Refresh goals and versions on precise goal updates

This commit is contained in:
kris
2026-04-07 16:41:09 +08:00
parent 9268f64506
commit b5d6495017
9 changed files with 527 additions and 6 deletions

View File

@@ -5040,7 +5040,7 @@ export async function getPreferredDeviceIdForAccount(
}
export async function toggleGoal(projectId: string, goalId: string) {
return mutateState((state) => {
const goal = await mutateState((state) => {
const project = state.projects.find((item) => item.id === projectId);
if (!project) throw new Error("PROJECT_NOT_FOUND");
@@ -5062,10 +5062,12 @@ export async function toggleGoal(projectId: string, goalId: string) {
project.lastMessageAt = nowIso();
return goal;
});
publishBossEvent("conversation.updated", { projectId, note: "project_goals.updated" });
return goal;
}
export async function updateGoalText(projectId: string, goalId: string, text: string) {
return mutateState((state) => {
const goal = await mutateState((state) => {
const project = state.projects.find((item) => item.id === projectId);
if (!project) throw new Error("PROJECT_NOT_FOUND");
@@ -5078,10 +5080,12 @@ export async function updateGoalText(projectId: string, goalId: string, text: st
project.lastMessageAt = nowIso();
return goal;
});
publishBossEvent("conversation.updated", { projectId, note: "project_goals.updated" });
return goal;
}
export async function createGoal(projectId: string, text: string) {
return mutateState((state) => {
const goal = await mutateState((state) => {
const project = state.projects.find((item) => item.id === projectId);
if (!project) throw new Error("PROJECT_NOT_FOUND");
if (!text.trim()) throw new Error("GOAL_TEXT_REQUIRED");
@@ -5097,6 +5101,8 @@ export async function createGoal(projectId: string, text: string) {
project.lastMessageAt = nowIso();
return goal;
});
publishBossEvent("conversation.updated", { projectId, note: "project_goals.updated" });
return goal;
}
export async function issueVerificationCode(