MCPcopy Create free account
hub / github.com/cortexkit/magic-context / runDreamerSetup

Function runDreamerSetup

packages/cli/src/lib/dreamer-setup.ts:102–146  ·  view source on GitHub ↗
(
    prompts: PromptIO,
    allModels: string[],
)

Source from the content-addressed store, hash-verified

100 * the dreamer is enabled.
101 */
102export async function runDreamerSetup(
103 prompts: PromptIO,
104 allModels: string[],
105): Promise<DreamerSetupResult> {
106 const model = await pickModel(prompts, allModels, "dreamer");
107 prompts.log.success(`Dreamer model: ${model}`);
108
109 const useDefaults = await prompts.confirm(
110 "Use recommended task schedules? (verify nightly; curate weekly; classify + retrospective daily; docs off)",
111 true,
112 );
113 if (useDefaults) {
114 return { model };
115 }
116
117 const tasks: Record<string, { schedule: string }> = {};
118 for (const task of CANONICAL_DREAM_TASKS) {
119 prompts.note(TASK_DESCRIPTIONS[task], task);
120 const choice = await prompts.selectOne(
121 `Schedule for "${task}"`,
122 scheduleOptions(DEFAULT_TASK_SCHEDULES[task]),
123 );
124 let schedule: string;
125 if (choice === PRESET_CUSTOM) {
126 schedule = (
127 await prompts.text("Enter a 5-field cron expression (empty to disable)", {
128 placeholder: "0 3 * * *",
129 validate: (value) => {
130 const v = value.trim();
131 if (v === "") return undefined; // empty = disabled
132 return isValidCron(v)
133 ? undefined
134 : 'Invalid cron. Use 5 fields, e.g. "0 3 * * *".';
135 },
136 })
137 ).trim();
138 } else {
139 // value is "cron:<expr>"
140 schedule = choice.slice("cron:".length);
141 }
142 tasks[task] = { schedule };
143 prompts.log.success(`${task}: ${schedule === "" ? "disabled" : schedule}`);
144 }
145 return { model, tasks };
146}

Callers 3

runSetupFunction · 0.90
runSetupFunction · 0.90

Calls 8

pickModelFunction · 0.90
isValidCronFunction · 0.90
scheduleOptionsFunction · 0.85
successMethod · 0.65
confirmMethod · 0.65
noteMethod · 0.65
selectOneMethod · 0.65
textMethod · 0.65

Tested by

no test coverage detected