-
Notifications
You must be signed in to change notification settings - Fork 1
feat(desktop): TODO Agent に Crush CLI 対応を追加 #389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
572562b
74eed62
84ac978
5654bc3
4b80f48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ export interface TodoSessionListEntry extends SelectTodoSession { | |
|
|
||
| // ---- Agent kind ---- | ||
|
|
||
| export const AGENT_KIND_OPTIONS = ["claude", "codex"] as const; | ||
| export const AGENT_KIND_OPTIONS = ["claude", "codex", "crush"] as const; | ||
| export type AgentKind = (typeof AGENT_KIND_OPTIONS)[number]; | ||
| export const agentKindSchema = z.enum(AGENT_KIND_OPTIONS); | ||
| export const DEFAULT_AGENT_KIND: AgentKind = "claude"; | ||
|
|
@@ -161,6 +161,12 @@ export const todoCreateInputSchema = z.object({ | |
| // "codex"; ignored for Claude sessions. | ||
| codexModel: todoCodexModelSchema.nullish(), | ||
| codexEffort: todoCodexEffortSchema.nullish(), | ||
| // Optional per-session Crush CLI model override. Null / undefined means | ||
| // "use the user's configured default". Only read when agentKind is | ||
| // "crush"; ignored for Claude / Codex sessions. The value is a free-form | ||
| // string in the form "provider/model" (e.g. "openai/gpt-5.4") resolved | ||
| // dynamically from `crush models`. No effort option — Crush CLI lacks one. | ||
| crushModel: z.string().trim().max(200).nullish(), | ||
|
Comment on lines
+164
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Crush model の解決・実行経路で空文字が正規化されているか確認します。
rg -n -C3 '\b(resolvedCrushModel|crushModel|defaultCrushModel)\b|--model' apps/desktop/src/main/todo-agent apps/desktop/src/main/todo-daemon apps/desktop/src/renderer/features/todo-agentRepository: MocA-Love/superset Length of output: 34115 🏁 Script executed: #!/bin/bash
# Check where crushModel is set in the UI and if there's any validation preventing empty strings
rg -n -B3 -A3 'toPersistedCrushModel|fromPersistedCrushModel' apps/desktop/src/renderer/features/todo-agent --type ts --type tsxRepository: MocA-Love/superset Length of output: 89 🏁 Script executed: #!/bin/bash
# Check the implementation of toPersistedCrushModel and fromPersistedCrushModel functions
fd -type f '\.ts' '\.tsx' apps/desktop/src/renderer/features/todo-agent -x grep -l 'toPersistedCrushModel\|fromPersistedCrushModel'Repository: MocA-Love/superset Length of output: 232 🏁 Script executed: #!/bin/bash
# Find where these conversion functions are defined
rg -n 'export.*toPersistedCrushModel|export.*fromPersistedCrushModel|const.*toPersistedCrushModel|const.*fromPersistedCrushModel' apps/desktop/src/renderer --type ts --type tsx -A5Repository: MocA-Love/superset Length of output: 89 🏁 Script executed: #!/bin/bash
# Find where toPersistedCrushModel and fromPersistedCrushModel are defined
rg -n 'toPersistedCrushModel|fromPersistedCrushModel' apps/desktop/src/renderer/features/todo-agent -A3Repository: MocA-Love/superset Length of output: 8098 🏁 Script executed: #!/bin/bash
# Search for the conversion functions in the entire renderer directory
rg -n 'const toPersistedCrushModel|function toPersistedCrushModel|export.*toPersistedCrushModel' apps/desktop/src/renderer --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' -t ts -t tsxRepository: MocA-Love/superset Length of output: 232 🏁 Script executed: #!/bin/bash
# Simpler approach - find files with these function names and read them
find apps/desktop/src/renderer/features/todo-agent -name "*.ts" -o -name "*.tsx" | xargs grep -l "toPersistedCrushModel\|fromPersistedCrushModel"Repository: MocA-Love/superset Length of output: 460 🏁 Script executed: #!/bin/bash
# Read the complete implementation of the crush model conversion functions
sed -n '378,390p' apps/desktop/src/renderer/features/todo-agent/ClaudeRuntimePicker/claudeRuntimeOptions.tsRepository: MocA-Love/superset Length of output: 436 🏁 Script executed: #!/bin/bash
# Also check if there are type definitions for CrushModelPick
rg -n 'type CrushModelPick|interface CrushModelPick' apps/desktop/src/renderer --type-add 'ts:*.ts' --type-add 'tsx:*.tsx'Repository: MocA-Love/superset Length of output: 741 🏁 Script executed: #!/bin/bash
# Check if UI Select component validates or sanitizes the crush model input before submission
rg -n -B5 -A10 'onCrushModelChange' apps/desktop/src/renderer/features/todo-agent/ClaudeRuntimePicker/AgentRuntimePicker.tsx | head -60Repository: MocA-Love/superset Length of output: 1564 🏁 Script executed: #!/bin/bash
# Check the crush models dropdown - where does the list come from and how is it used
sed -n '232,280p' apps/desktop/src/renderer/features/todo-agent/ClaudeRuntimePicker/AgentRuntimePicker.tsxRepository: MocA-Love/superset Length of output: 1293 🏁 Script executed: #!/antml:bin/bash
# Check how crush models are fetched/populated in TodoModal
rg -n 'crushModels' apps/desktop/src/renderer/features/todo-agent/TodoModal/TodoModal.tsx -B2 -A2Repository: MocA-Love/superset Length of output: 359 🏁 Script executed: #!/bin/bash
# Check codexModel and claudeModel schemas for comparison - do they have the same issue?
sed -n '164,230p' apps/desktop/src/main/todo-agent/types.ts | grep -E 'Model|Effort' -A1 -B1Repository: MocA-Love/superset Length of output: 756 🏁 Script executed: #!/bin/bash
# Check what todoCodexModelSchema and todoClaudeModelSchema are - do they have transforms?
rg -n 'todoCodexModelSchema|todoClaudeModelSchema|todoCodaxEffortSchema|todoClaudeEffortSchema' apps/desktop/src/main/todo-agent/types.ts -B2 -A2Repository: MocA-Love/superset Length of output: 2341 🏁 Script executed: #!/bin/bash
# Check if codex/claude model schemas use transform to normalize empty strings
sed -n '1,160p' apps/desktop/src/main/todo-agent/types.ts | tail -80Repository: MocA-Love/superset Length of output: 2836 🏁 Script executed: #!/bin/bash
# Check if there are any DB inserts/updates that might allow empty strings for crushModel
rg -n 'crushModel|defaultCrushModel' apps/desktop/src/main/todo-agent/session-store.ts -B3 -A3 | head -80Repository: MocA-Love/superset Length of output: 616 🏁 Script executed: #!/bin/bash
# Check if there's any data migration or seeding that might create empty strings
rg -n 'crushModel.*""' apps/desktop --type-add 'ts:*.ts' --type-add 'tsx:*.tsx'Repository: MocA-Love/superset Length of output: 44 🏁 Script executed: #!/bin/bash
# Verify the actual runtime behavior - if empty string is passed, does the CLI handle it safely?
sed -n '207,220p' apps/desktop/src/main/todo-daemon/crush-turn-runner.tsRepository: MocA-Love/superset Length of output: 451
修正案+const crushModelSchema = z
+ .string()
+ .trim()
+ .max(200)
+ .transform((value) => (value.length > 0 ? value : null))
+ .nullish();
+
export const todoCreateInputSchema = z.object({
@@
- crushModel: z.string().trim().max(200).nullish(),
+ crushModel: crushModelSchema,
@@
- defaultCrushModel: z.string().trim().max(200).nullish().default(null),
+ defaultCrushModel: crushModelSchema.default(null),
});🤖 Prompt for AI Agents |
||
| // Beta escape hatch: opt a single TODO into the interactive PTY | ||
| // engine without flipping the whole app over from headless `-p`. | ||
| // Persisted in the artifact runtime config, not the DB row. | ||
|
|
@@ -218,6 +224,8 @@ export const todoSettingsSchema = z.object({ | |
| // Global defaults for Codex sessions. | ||
| defaultCodexModel: todoCodexModelSchema.nullish().default(null), | ||
| defaultCodexEffort: todoCodexEffortSchema.nullish().default(null), | ||
| // Global default for Crush sessions. Free-form string ("provider/model"). | ||
| defaultCrushModel: z.string().trim().max(200).nullish().default(null), | ||
| }); | ||
|
|
||
| export type TodoSettings = z.infer<typeof todoSettingsSchema>; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crush モデル一覧を cache に入れる前に重複排除してください。
このままだと同じモデル名が複数行に出た場合、Picker 側の
SelectItem key={model} value={model}が重複して選択 UI が不安定になります。修正案
📝 Committable suggestion
🤖 Prompt for AI Agents