MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / queueNextGoal

Function queueNextGoal

apps/kimi-code/src/tui/commands/goal.ts:176–212  ·  view source on GitHub ↗
(
  host: SlashCommandHost,
  parsed: Extract<ParsedGoalCommand, { kind: 'next-add' }>,
)

Source from the content-addressed store, hash-verified

174}
175
176async function queueNextGoal(
177 host: SlashCommandHost,
178 parsed: Extract<ParsedGoalCommand, { kind: 'next-add' }>,
179): Promise<void> {
180 const session = host.requireSession();
181 let hasCurrentGoal: boolean;
182 try {
183 const { goal } = await session.getGoal();
184 hasCurrentGoal = goal !== null;
185 } catch (error) {
186 host.showError(`Failed to inspect current goal: ${formatErrorMessage(error)}`);
187 return;
188 }
189
190 if (!hasCurrentGoal && !isBusy(host)) {
191 host.showStatus(START_NEXT_GOAL_NOW_MESSAGE);
192 await createGoal(
193 host,
194 { kind: 'create', objective: parsed.objective, replace: false },
195 `next ${parsed.objective}`,
196 );
197 return;
198 }
199
200 try {
201 await appendGoalQueueItem(session, { objective: parsed.objective });
202 } catch (error) {
203 host.showError(formatErrorMessage(error));
204 return;
205 }
206 host.track('goal_queue_append');
207 if (!hasCurrentGoal) host.requestQueuedGoalPromotion?.();
208 host.state.transcriptContainer.addChild(
209 new UpcomingGoalAddedMessageComponent(),
210 );
211 host.state.ui.requestRender();
212}
213
214async function showGoalQueueManager(
215 host: SlashCommandHost,

Callers 1

handleGoalCommandFunction · 0.85

Calls 12

formatErrorMessageFunction · 0.90
appendGoalQueueItemFunction · 0.90
isBusyFunction · 0.85
createGoalFunction · 0.70
requireSessionMethod · 0.65
showErrorMethod · 0.65
showStatusMethod · 0.65
trackMethod · 0.65
requestRenderMethod · 0.65
getGoalMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected