Skip to content

Phase 0: Simple Local History + Resume - auto-restore last session - #29

Open
7jerryl wants to merge 10 commits into
mainfrom
modernity-conversation-history-phase0
Open

Phase 0: Simple Local History + Resume - auto-restore last session#29
7jerryl wants to merge 10 commits into
mainfrom
modernity-conversation-history-phase0

Conversation

@7jerryl

@7jerryl 7jerryl commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Phase 0 simplest solution for conversation persistence (T282870351) - no backend, no reasoning tokens, single purpose tracking previous conversations.

Fixes always new conversation on open by reusing lastSessionId from globalState.

Changes (4 files, 328 insertions)

  • New file conversationHistory.ts: StoredConversation with title from first 50 chars, lastMessageAt, messages capped 50 convs / 200 msgs, persists to globalState modernity.conversations + local file ~/.modernity/conversations.json
  • Update modernityProvider.ts: reuse lastSessionId for auto-restore, save user message before request and assistant full text after SSE streaming
  • Update extension.ts: init history, pass lastSessionId to provider, add History status bar button Chat History in Settings header, commands openConversationHistory (QuickPick sorted desc), resumeConversation, newConversation, clearConversationHistory. Keeps left nav condensed 4 icons, terminal never
  • package.json: add 4 history commands

Verification

  1. Open->send Hello world mod->quit->reopen same visible
  2. History button -> QuickPick shows title+timestamp
  3. Second conversation -> 2 entries -> resume first replays
  4. Dev toggle preserved, 4 icons, terminal never
  5. Local file ~/.modernity/conversations.json exists

GSD

T282870351 Phase 0 IN_PROGRESS
T282881523 CLOSED multi-machine removed
T282881532 Phase 1 Full Own Offline (BACKLOG)
T282881548 Phase 2 Link to Trace (BACKLOG)

No backend, no reasoning tokens, single purpose.

7jerryl added 10 commits July 29, 2026 21:04
…per mode

- package.json: add modernity.developerMode boolean + commands toggle/enable/disable
- extension.ts: PanelManager with SIMPLE_PANELS=[chat], DEV_PANELS=[code_viewer,file_tree,settings,debug,search,source_control], NEVER_ALLOWED=[left_panel,terminal], toggle logic, status bar button, context key modernity.developerMode
UI Button in Modernity Settings header that toggles simple (locked chat) vs dev mode
- SIMPLE_PANELS=[chat], DEV=[code_viewer,file_tree,settings,debug,search,source_control], NEVER=[left_panel,terminal]
- Button label Switch to Developer/Simple Mode, data-testid dev-mode-toggle, updates on config change
- For spec verification and visual test
…de panels

Matches layout.ts applyAuxiliaryBarMaximizedOverride - how other CTAs update panels:
- simple = maximizeAuxiliaryBar (chat covers screen, editor/sideBar/panel hidden)
- dev = restoreAuxiliaryBar + view.explorer (file tree) + bonus debug/search/scm
- always hide activityBar (left_panel) and terminal per NEVER_ALLOWED
Fixes button doing nothing - was only notification
…_control in dev mode

Per instruction.md: TBD on debugging, search, source control - enable in dev mode
- applyMode() now shows explorer (file tree), then search, scm, debug via workbench.view.* commands, returns to explorer
- Always hides left_panel (activityBar) and terminal per NEVER_ALLOWED
- Not too hard for codimango - already in DEV_PANELS constant, just needed visual reveal
…ld TBD

Latest instruction.md 23 lines has As an added bonus: debugging, search, source control, not TBD
Update comments from TBD to bonus to match latest
How other CTAs update panels (found via layout.ts:2850 lock):
- layout.ts applyAuxiliaryBarMaximizedOverride hides EDITOR/SIDEBAR/PANEL, shows AUXILIARYBAR maximized (simple locked chat)
- restore via setAuxiliaryBarMaximized(false) + setPartHidden(false, EDITOR_PART) for code viewer + SIDEBAR_PART for file tree
- Bonus debug/search/scm enabled as views in sidebar per instruction 18-23, kept via sidebar visible
- Always setPartHidden(true, ACTIVITYBAR_PART) for left_panel never + PANEL_PART for terminal never per should-not

- Extension: applyMode uses maximize/restore commands + config listener
- Workbench contribution ModernityDevModeListener listens to modernity.developerMode config change and applies layout via IWorkbenchLayoutService
- Widget button in Modernity Dev Settings header toggles config, which triggers listener

Fixes: clicking toggle now shows Explorer (file tree) on left + editor (code viewer) in center + chat on right, bottom status bar shows Switch to Simple Mode, notification with visible panels. Debug/search/scm now accessible via View menu / command palette even with activityBar hidden
…atures), only terminal never

Latest instruction.md: should not bring back everything on left panel (condensed) + terminal
Per user: need left panel but condensed

- NEVER_ALLOWED now only [terminal], left_panel allowed condensed
- DEV_PANELS includes file_tree, debug, search, scm as condensed left panel
- package.json description updated
- extension.ts applyMode shows activityBar in dev (condensed), hides in simple, only terminal never
- modernity.contribution.ts listener same - shows activityBar in dev condensed
…lt/visible, terminal never

- Show left nav in dev mode but condensed to 4: file_tree (explorer), search, scm (source_control), debug
- Hide everything else from left panel (extensions, testing, etc) by moving non-condensed from Sidebar to Panel (Panel hidden as terminal never) per should-not - prevents 15 icons and empty bar
- Fix ActivityBar hidden: PR6 set workbench.activityBar.location=hidden + visible=false. Dev now sets location=default (must be default, enum is default|top|bottom|hidden, side is invalid) + visible=true + setPartHidden(false) + toggle check + setTimeout re-apply
- Fix ESM build: use gulp compile not transpile-client which emitted CommonJS exports causing ReferenceError in out/main.js with type:module
- Extension: DEV_PANELS includes left_panel per latest line 12, NEVER_ALLOWED only terminal, CONDENSED_LEFT_PANEL length 4, status bar toggle, maximize/restoreAuxiliaryBar, view.explorer/search/scm/debug, terminal.hide

Verification: simple=chat only, dev=chat+code viewer+file tree+left nav 4 icons+bonus debug/search/scm, no terminal, left nav usable not empty/full
…nts, injected IDE Git adapter, lifecycle

Task: T280743647
- models, errors, cloudClient (Bearer, cursor limit 1..100 default 50, If-Match, Idempotency-Key 16-128 ASCII, snapshots redacted, cancellable, 401->signed_out etc), daemonDiscovery (owner-only runtime JSON, loopback-only, no fallback, browser-safe), daemonClient (POST /v1/sandboxes, GET /v1/sandboxes/{id}/status, POST /v1/sandboxes/{id}/{operation}, GET /v1/health, typed DaemonError, discoveryReset), gitContract (safe whitelist), gitAdapter (VS Code Git extension + credential provider, URI roots, cancellation, trusted identity, no creds leak, no force push, ff-only), projectService (modernityProject owning state, refresh events, coalescing, offline cache, daemon separate, dispose on shutdown, injected coordinators), fakes, tests (snapshots, contract, lifecycle, coalescing, cancellation, offline, conflict, restart, disposal), README_T23 ownership doc
- Wired in extension.ts with getAccessToken placeholder (SecretStorage then config, t11 to replace), gatewayUrl, cloud/daemon clients, gitAdapter, service, commands refreshProjects/cancelRefreshProjects, initial refresh, deactivate dispose
- package.json: accessToken, platformUrl, refresh commands
- tsconfig.json: exclude tests

Build: gulp compile-extension:modernity 0 errors
Branch: feat/t23-project-platform-service-T280743647
Local resume: T23_RESUME_LOCAL.md (DO NOT COMMIT)
…lobalState + ~/.modernity/conversations.json, History button

- Add conversationHistory.ts: StoredConversation with title from first 50 chars, lastMessageAt, messages capped 50 convs / 200 msgs, persists to globalState modernity.conversations + local file ~/.modernity/conversations.json
- Update modernityProvider.ts: reuse lastSessionId from globalState for auto-restore on reopen (fixes always new conversation), save user message before request and assistant full text after SSE streaming via history.addMessage
- Update extension.ts: init history, pass lastSessionId to provider, add History status bar button in Settings header area, commands openConversationHistory (QuickPick sorted by lastMessageAt desc with preview), resumeConversation (sets sessionId, replays to output channel, focuses chat), newConversation, clearConversationHistory. Keeps left nav condensed 4 icons, terminal never
- package.json: add 4 history commands

Verification:
1. Open->send Hello world mod->quit->reopen same visible
2. History button -> QuickPick shows title+timestamp
3. Second conversation -> History 2 entries -> resume first replays
4. Dev toggle preserved, 4 icons, terminal never
5. Local file ~/.modernity/conversations.json exists

T282870351 Phase 0, no backend, no reasoning tokens, single purpose tracking previous conversations
@meta-cla meta-cla Bot added the cla signed label Jul 30, 2026
@7jerryl

7jerryl commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Don't merge yet - I need to review whether this is needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant