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

Function updateGoalQueueItem

apps/kimi-code/src/tui/goal-queue-store.ts:65–82  ·  view source on GitHub ↗
(
  session: GoalQueueSession,
  input: { readonly goalId: string; readonly objective: string },
)

Source from the content-addressed store, hash-verified

63}
64
65export async function updateGoalQueueItem(
66 session: GoalQueueSession,
67 input: { readonly goalId: string; readonly objective: string },
68): Promise<GoalQueueSnapshot> {
69 const objective = normalizeObjective(input.objective);
70 return withQueueMutationLock(session, async () => {
71 const state = await readQueueFile(session);
72 const index = findGoalIndex(state, input.goalId);
73 const current = state.goals[index]!;
74 const updatedAt = timestampAfter(current.updatedAt);
75 const goals = state.goals.map((goal, goalIndex) =>
76 goalIndex === index ? { ...goal, objective, updatedAt } : goal,
77 );
78 const next: GoalQueueFile = { version: GOAL_QUEUE_VERSION, goals };
79 await writeQueueFile(session, next);
80 return toSnapshot(next);
81 });
82}
83
84export async function removeGoalQueueItem(
85 session: GoalQueueSession,

Callers 2

Calls 7

normalizeObjectiveFunction · 0.85
withQueueMutationLockFunction · 0.85
findGoalIndexFunction · 0.85
timestampAfterFunction · 0.85
writeQueueFileFunction · 0.85
toSnapshotFunction · 0.85
readQueueFileFunction · 0.70

Tested by

no test coverage detected