Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

Add user profile prompt context with conditional injection (TUI, server, prompt templates) (#37)

7 months ago

49fa806
Authored
Max Weinbach3/13/2026, 2:10:01 PM
* Handle optional prompt profile lines via regex injection

* fix: allow empty userName in set_config validation

The userName validation used z.string().trim().min(1).optional() which
rejected empty strings, preventing users from clearing their name via
the TUI. userProfile fields accepted empty strings, creating inconsistent
validation semantics.

Changed userName to z.string().optional() to match userProfile fields,
allowing users to clear their name just like other profile fields.

Added test coverage for:
- userName with non-empty string
- userName with empty string (for clearing)
- userProfile object with all fields
- userProfile with partial fields
- userProfile with empty field strings (for clearing)

* Fix live profile prompt refresh in set_config

* Grant desktop app persistence access

* Fix remaining profile config review issues

* Fix blank desktop app on input

* Fix literal prompt template injection

---------

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

Parent1c9c888

49 files changed
  • apps/TUI/app.tsx+7−0
  • apps/TUI/component/dialog-command.tsx+9−0
  • apps/TUI/component/dialog-user-profile.tsx+126−0
  • apps/TUI/context/sync.tsx+6−0
  • apps/TUI/context/syncEventReducer.ts+2−0
  • apps/TUI/context/syncTypes.ts+12−0
  • apps/TUI/routes/session/index.tsx+12−12
  • apps/TUI/routes/session/sidebar.tsx+24
−0
  • apps/TUI/ui/dialog-prompt.tsx+4−3
  • apps/desktop/electron/services/persistence.ts+10−0
  • apps/desktop/src/app/store.actions/bootstrap.ts+18−1
  • apps/desktop/src/app/store.actions/workspaceDefaults.ts+25−3
  • apps/desktop/src/app/store.helpers/controlSocket.ts+4−0
  • apps/desktop/src/app/types.ts+20−1
  • apps/desktop/src/lib/desktopSchemas.ts+10−0
  • apps/desktop/src/ui/ChatView.tsx+1−1
  • apps/desktop/src/ui/settings/pages/WorkspacesPage.tsx+142−2
  • apps/desktop/test/chat-view.stability.test.tsx+214−0
  • apps/desktop/test/desktop-schemas.test.ts+12−0
  • apps/desktop/test/persistence-state-sanitization.test.ts+39−0
  • apps/desktop/test/workspace-settings-sync.test.ts+157−0
  • apps/desktop/test/workspaces-page.test.ts+217−2
  • docs/websocket-protocol.md+11−1
  • prompts/system-models/claude-haiku-4-5.md+4−1
  • prompts/system-models/claude-opus-4-6.md+4−1
  • prompts/system-models/claude-sonnet-4-6.md+4−1
  • prompts/system-models/gemini-3-flash-preview.md+4−1
  • prompts/system-models/gemini-3-pro-preview.md+4−1
  • prompts/system-models/gpt-5.2.md+4−1
  • prompts/system-models/gpt-5.4.md+4−1
  • prompts/system.md+4−1
  • src/config.ts+22−6
  • src/prompt.ts+20−3
  • src/server/protocol.ts+12−0
  • src/server/protocolEventParser.ts+6−0
  • src/server/protocolParser.ts+8−0
  • src/server/session/AgentSession.ts+14−1
  • src/server/session/SessionContext.ts+4−1
  • src/server/session/SessionMetadataManager.ts+65−0
  • src/server/startServer.ts+18−2
  • src/types.ts+7−0
  • tasks/lessons.md+3−0
  • tasks/todo.md+158−9
  • test/agentSocket.parse.test.ts+6−0
  • test/config.test.ts+21−0
  • test/prompt.test.ts+60−0
  • test/protocol.test.ts+82−0
  • test/server.test.ts+74−0
  • test/session.test.ts+75−1