mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(assistant): self-configuring assistant mode (#244)
* test(backend): replace better-sqlite3 test mock with node:sqlite Reimplement the bun:sqlite test mock on top of node:sqlite with an explicit BEGIN/COMMIT/ROLLBACK transaction wrapper. * feat(assistant): self-configuring assistant mode Add a self-editable assistant workspace and the APIs that support it: - POST /assistant/reload disposes and re-bootstraps the assistant instance (directory-scoped, rate-limited) so agent.md edits apply. - Internal settings API accepts non-secret TTS/STT patches via dedicated partial schemas. - Strip the generated agent persona from opencode.json on repair so user-customized agents are preserved across config recovery. - Cache the last assistant session id to avoid redundant session listing on launch. * style(repo): align worktree and workspace tabs with primary/orange theme
This commit is contained in:
1 parent
eedbbfb94e
commit
dbd6866682
22 files changed
+733
-156
No files matched your search
@@ -18,6 +18,26 @@ export const AssistantNotificationResponseSchema = z.object({
|
||||
noSubscriptions: z.boolean(),
|
||||
})
|
||||
|
||||
// NOTE: These are defined as plain z.object (not .pick() from the full schemas)
|
||||
// so that .default() values from the source schemas are NOT inherited. A patch
|
||||
// like { voice: 'nova' } must produce only { voice: 'nova' } in the parsed output,
|
||||
// not { voice: 'nova', provider: 'external', autoPlay: false }.
|
||||
export const AssistantTTSPatchSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
provider: z.enum(['external', 'builtin']),
|
||||
autoPlay: z.boolean(),
|
||||
voice: z.string(),
|
||||
model: z.string(),
|
||||
speed: z.number().min(0.25).max(4.0),
|
||||
}).partial().strict()
|
||||
|
||||
export const AssistantSTTPatchSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
provider: z.enum(['external', 'builtin']),
|
||||
model: z.string(),
|
||||
language: z.string(),
|
||||
}).partial().strict()
|
||||
|
||||
export const AssistantSettingsPatchSchema = UserPreferencesSchema.pick({
|
||||
theme: true,
|
||||
mode: true,
|
||||
@@ -35,23 +55,7 @@ export const AssistantSettingsPatchSchema = UserPreferencesSchema.pick({
|
||||
notifications: true,
|
||||
repoOrder: true,
|
||||
repoSortMode: true,
|
||||
}).extend({
|
||||
tts: AssistantTTSPatchSchema,
|
||||
stt: AssistantSTTPatchSchema,
|
||||
}).partial().strict()
|
||||
|
||||
export const ASSISTANT_SETTINGS_ALLOWED_KEYS = [
|
||||
'theme',
|
||||
'mode',
|
||||
'defaultModel',
|
||||
'defaultAgent',
|
||||
'autoScroll',
|
||||
'expandDiffs',
|
||||
'expandToolCalls',
|
||||
'showReasoning',
|
||||
'simpleChatMode',
|
||||
'leaderKey',
|
||||
'directShortcuts',
|
||||
'keyboardShortcuts',
|
||||
'customCommands',
|
||||
'notifications',
|
||||
'repoOrder',
|
||||
'repoSortMode',
|
||||
] as const
|
||||
Reference in new issue
Block a user