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

Function restoreGoalQueueItem

apps/kimi-code/src/tui/goal-queue-store.ts:98–111  ·  view source on GitHub ↗
(
  session: GoalQueueSession,
  goal: UpcomingGoal,
)

Source from the content-addressed store, hash-verified

96}
97
98export async function restoreGoalQueueItem(
99 session: GoalQueueSession,
100 goal: UpcomingGoal,
101): Promise<GoalQueueSnapshot> {
102 return withQueueMutationLock(session, async () => {
103 const state = await readQueueFile(session);
104 if (state.goals.some((item) => item.id === goal.id)) {
105 return toSnapshot(state);
106 }
107 const next: GoalQueueFile = { version: GOAL_QUEUE_VERSION, goals: [goal, ...state.goals] };
108 await writeQueueFile(session, next);
109 return toSnapshot(next);
110 });
111}
112
113export async function moveGoalQueueItem(
114 session: GoalQueueSession,

Calls 4

withQueueMutationLockFunction · 0.85
toSnapshotFunction · 0.85
writeQueueFileFunction · 0.85
readQueueFileFunction · 0.70

Tested by

no test coverage detected