Skip to content

emrg: GUI / 指令 P2 — session management commands (/sessions /resume /rename /delete /rewind, rant 19:44) - #487

Merged
argszero merged 2 commits into
masterfrom
feature/gui-slash-commands-p2
Aug 6, 2026
Merged

emrg: GUI / 指令 P2 — session management commands (/sessions /resume /rename /delete /rewind, rant 19:44)#487
argszero merged 2 commits into
masterfrom
feature/gui-slash-commands-p2

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 2 of the GUI slash-command support (rant 2026-08-06T19:44:38, P1 merged in #486). Adds all session-management commands to the GUI input, reusing existing daemon protocol — zero daemon changes.

Changes

  • renderer/js/app.js: open handleCommand for phase-2 commands; add routing for /sessions /resume (session list dialog), /rename (reuse rename dialog), /delete (reuse confirm dialog), /rewind (history checkpoint dialog via list_historyrewind_session)
  • main.js: new IPC handlers emrg:listHistory (daemon list_historyhistory_list) and emrg:rewindSession (daemon rewind_sessionrewind_result), with session_id/record_index validation
  • preload.js: expose listHistory / rewindSession
  • renderer/index.html: sessions-dialog + rewind-dialog (same card style as help dialog)
  • tests: new test/app-commands.test.js (4 P2 route tests: /resume direct switch, /rewind dialog+listHistory, /rename dialog reuse, phase-3 gate); smoke test adds dialog element IDs

Verification

  • GUI test suite: 51 pass / 0 fail (daemon_client 22 + integration 7 + smoke 16 + app-commands 4 + commands 2)
  • daemon protocol cross-checked against daemon.py: list_history returns history_list with messages[] (record_index/preview); rewind_session returns rewind_result with removed_count

Phase 3 (model/memory/skills), Phase 4 (rant/trigger dialogs), Phase 5 (regression+docs) remain per rant acceptance checklist.

…,rant 19:44)

- app.js: handleCommand 开放 phase 2,新增会话列表/历史回退对话框 + 指令路由
- main.js: 新增 emrg:listHistory / emrg:rewindSession IPC(daemon 协议已存在)
- preload.js: 暴露 listHistory / rewindSession
- index.html: sessions-dialog + rewind-dialog
- test: app-commands.test.js 新增 4 个 P2 路由测试;smoke 补对话框元素 ID
- 全量 GUI 测试 51 pass(22 daemon_client + 7 integration + 16 smoke + 4 app-commands + 2 commands 已有)

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Needs fix: state.sessions is only synced in refreshSessions() (app.js:410). It is NOT synced in: (1) boot() when init.sessions is rendered (line ~57), (2) the sessions broadcast event (line ~634), (3) the list_result sessions_list branch (line ~660). Consequences: after boot (before any refresh), /rename finds no current session in state.sessions and pre-fills an empty title; deleteSession() computes remaining from the empty array and falls back to newSession() instead of switching to the most recent session when deleting the current one. Please sync state.sessions in all four places.

…esult (P2 review)

state.sessions was only assigned in refreshSessions(), leaving it empty
after boot until the first refresh. This broke:
- /rename: could not find the current session to pre-fill its title
- deleteSession(): 'remaining' computed from an empty array fell back to
newSession() instead of switching to the most recent session when the
current one is deleted

Sync state.sessions in all four places: boot (init.sessions),
refreshSessions, sessions broadcast event, and list_result sessions_list.

GUI tests 51 pass.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle. Verified the fix commit 1f8855d: state.sessions is now synced in all four places (boot init.sessions, refreshSessions, sessions broadcast, list_result sessions_list). Re-ran GUI tests: 51 pass / 0 fail. Also verified daemon protocol reuse (list_history → history_list, rewind_session → rewind_result) with zero daemon changes, and that /rename reuses the existing rename dialog while /delete reuses the friendly confirm dialog (no session ID leakage). Phase 2 acceptance items from rant 19:44 are satisfied.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-204218. Independently verified: (1) worktree tests 51/51 pass including the 4 P2 route tests and the state.sessions sync fix; (2) diff review — handleCommand phase-2 routing, listHistory/rewindSession IPC validation (session_id + integer record_index), dialogs reuse existing confirm/rename patterns; (3) daemon protocol untouched, list_history→history_list and rewind_session→rewind_result confirmed against daemon.py. Ready to merge after one more LGTM.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-205521. Third vote. Re-verified the merged PR state: branch feature/gui-slash-commands-p2 @ 1f8855d, CI green (run 31102628247), 51/51 GUI tests, phase-2 acceptance items satisfied, no intervening ❌ since the fix. Merging.

@argszero
argszero merged commit 91b03c9 into master Aug 6, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 6, 2026
* emrg: persist repo URL in install-info.json for evolution workspace self-heal (rant 20:42)

_cache_tool_paths now also writes 'repo' = https://github.com/argszero/emrg.git
alongside git_path/gh_path. Complements PR #489's read side: packaged
installs have no git remote to detect, so the clone-on-demand self-heal
needs a repo source persisted at runtime.

2 new tests (repo field written, existing fields preserved).

* emrg: GUI / 指令 P3 — 模型/记忆/技能类指令(/model /memory /skills,rant 19:44)

Phase 3 of GUI slash-command support (rant 2026-08-06T19:44:38; P1 #486,
P2 #487 merged). Opens /model /memory /skills in the GUI:

- /model → triggers the existing model switcher (click .model-switcher)
- /memory [session|<id>] → memory browser dialog:
  list_memories → click a memory → read_memory → inline detail panel
- /skills → skills list dialog (main process reads ~/.emrg/skills and
  <projectDir>/.emrg/skills frontmatter; daemon has no skills protocol,
  mirrors TUI's local load_skills)

main.js: new IPC emrg:listMemories / emrg:readMemory (daemon
list_memories/read_memory protocol, session scope validated) /
emrg:listSkills (local fs read, no daemon change). preload.js exposes
them. index.html: memory-dialog + skills-dialog. components.css:
.memory-detail styles. commands.js phase comments updated.

Tests: app-commands +4 P3 route tests (55 total GUI, was 51); smoke
element IDs updated. pytest 475 passed; import + --help OK.

---------

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 6, 2026
Version bump 0.2.7 → 0.2.8 across all 6 version sources
(pyproject.toml / emrg/__init__.py / make-installer.sh /
build-runtime.sh / gui/package.json / uv.lock). Release includes
#486/#487/#491 GUI slash commands P1-P3, #488/#492/#493 i18n prompts,
#489/#490 evolution workspace self-heal, #484/#485 README/language
policy, #483 docs cleanup. test_version_sync all green.

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 6, 2026
Phase 4 — final phase of GUI slash-command support (rant 19:44; P1 #486,
P2 #487, P3 #491 merged). All 15 TUI slash commands now work in the GUI:

- /rant [message] → evolution dialog with project dropdown (list_projects)
  + textarea; /rant <text> submits directly; sends via daemon rant
  protocol (field order timestamp/project/status/progress/completed/message
  preserved by daemon)
- /trigger [name] → task list dialog (list_tasks); /trigger <name>
  triggers immediately via daemon trigger_task

main.js: new IPC emrg:listProjects / emrg:listTasks / emrg:triggerTask /
emrg:sendRant (daemon protocols already exist — zero daemon changes).
preload.js exposes them. index.html: rant-dialog + tasks-dialog.
commands.js phase comments updated (1-4 all done).

Tests: app-commands +4 P4 route tests (58 total GUI, was 55); smoke
element IDs updated. pytest 480 passed; import + --help OK.

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
@argszero
argszero deleted the feature/gui-slash-commands-p2 branch August 6, 2026 15:04
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