Skip to content

Align mode catalog with ZCode 3.11.2 and add strict validation - #19

Merged
supermomonga merged 1 commit into
mainfrom
fix/issue-17
Sep 4, 2026
Merged

Align mode catalog with ZCode 3.11.2 and add strict validation#19
supermomonga merged 1 commit into
mainfrom
fix/issue-17

Conversation

@supermomonga

@supermomonga supermomonga commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Align the ACP adapter's mode catalog with ZCode 3.11.2's official modes and add strict validation to reject any modes outside the published catalog.

Changes

Mode Catalog

  • Removed deprecated auto mode
  • Updated mode names and descriptions to match ZCode 3.11.2 official UI
  • Official modes: build (Ask before changes), edit (Edit automatically), plan (Plan mode), yolo (Full access)

Validation

  • Added isZCodeModeId() type guard to validate client-provided mode IDs
  • Added requireZCodeModeId() to validate native modes and reject protocol mismatches
  • Reject unknown modes before calling the native host
  • Reject invalid modes returned by native ZCode without changing session state

Refactoring

  • Introduced updateBindingSnapshot() helper to centralize snapshot state updates
  • Made MODE_OPTIONS const with TypeScript type narrowing for type safety
  • Updated adapter spec and implementation status documentation

Testing

  • All 61 tests pass (4 new tests added)
  • Mode catalog validation: MODE_OPTIONS matches official ZCode 3.11.2 catalog
  • Mode publishing: new/loaded/resumed sessions return correct modes and labels
  • Mode switching: each official mode ID passed to host unchanged with current_mode_update notification
  • Input rejection: unknown modes rejected with INVALID_CONFIGURATION error before calling host
  • Native protocol errors: invalid modes from native ZCode rejected without changing session state
  • Manual ACP wire verification: mode switching notifications, read tool, end_turn

this closes #17

@supermomonga
supermomonga merged commit f9445dd into main Sep 4, 2026
1 check passed
@supermomonga
supermomonga deleted the fix/issue-17 branch September 4, 2026 14:32
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.

ACPで公開するモードをZCodeの正式な4モードに合わせる

1 participant