🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(goal): rename graph-node Work wording to Task (#19081)
Arvin Xu348c32d5bcd6
diff --git a/apps/cli/src/commands/goal.test.ts b/apps/cli/src/commands/goal.test.tsindex 4a9f41503bc..57adde3bc41 100644--- a/apps/cli/src/commands/goal.test.ts+++ b/apps/cli/src/commands/goal.test.ts@@ -328,4 +328,39 @@ describe('goal create command', () => {expect(output).toContain('https://app.lobehub.com/goal/goal_PrUIwfSnU9TH');expect(output).not.toContain('/goal/undefined');});++ it('sends task seeds and the per-Task attempt budget with the primary flags', async () => {+ mockClient.goal.create.mutate.mockResolvedValue({+ data: {+ decisions: [],+ edges: [],+ events: [],+ goal: { id: 'goal-1', requirement: null, status: 'planning', title: 'Fix bugs' },+ nodes: [],+ workVersions: [],+ },+ });++ await createProgram().parseAsync([+ 'node',+ 'test',+ 'goal',+ 'create',+ 'Fix bugs',+ '--task',+ 'Inspect',+ 'Repair',+ '--max-attempts-per-task',+ '4',+ ]);++ expect(mockClient.goal.create.mutate).toHaveBeenCalledWith(+ expect.objectContaining({+ config: expect.objectContaining({+ recovery: expect.objectContaining({ maxAttemptsPerTask: 4 }),+ }),+ tasks: ['Inspect', 'Repair'],+ }),+ );+ });});diff --git a/apps/cli/src/commands/goal.ts b/apps/cli/src/commands/goal.tsindex ac75ba34cf8..20c0a749889 100644--- a/apps/cli/src/commands/goal.ts+++ b/apps/cli/src/commands/goal.ts@@ -168,21 +168,21 @@ export function registerGoalCommand(program: Command) {'-i, --instruction <text>',"The ask in the user's own words, shown on the problem node",)- .option('-w, --work <title...>', 'Initial work node titles (omit to let the planner decompose)')+ .option('-t, --task <title...>', 'Initial task node titles (omit to let the planner decompose)').option('--agent <id>', 'Responsible agent ID').option('--project <id>', 'Project ID').option('--max-rounds <n>', 'Maximum goal rounds').option('--max-cost <usd>', 'Maximum total cost in USD')- .option('--max-attempts-per-work <n>', 'Attempts per Work before opening a decision gate')+ .option('--max-attempts-per-task <n>', 'Attempts per Task before opening a decision gate').option('--max-concurrent-tasks <n>',"How many of this goal's tasks may run at once (default 3)",)- .option('--max-steps-per-run <n>', 'Optional agent step cap per Work run (for example 500)')+ .option('--max-steps-per-run <n>', 'Optional agent step cap per Task run (for example 500)').option('--operation-lease-timeout-ms <n>',- 'Reclaim a Work operation after this idle time (minimum: 60000)',+ 'Reclaim a Task operation after this idle time (minimum: 60000)',).option('--json [fields]', 'Output JSON').action(async (title: string, options) => {@@ -218,7 +218,7 @@ export function registerGoalCommand(program: Command) {projectId: options.project,requirement: options.requirement,title,- work: options.work,+ tasks: options.task,});// `goal.create` returns the whole graph snapshot, so the id is on its// goal — `result.data.id` is undefined, and the CLI cannot resolve the@@ -252,13 +252,13 @@ export function registerGoalCommand(program: Command) {result.goals.map((item) => [item.goal.status,truncate(item.goal.title, 44),- `${item.workDone}/${item.workTotal}`,+ `${item.taskDone}/${item.taskTotal}`,String(item.findingCount),item.pendingDecisions > 0 ? pc.yellow(String(item.pendingDecisions)) : '-',`$${item.totalRunCost.toFixed(2)}`,item.goal.id,]),- ['STATUS', 'TITLE', 'WORK', 'FINDINGS', 'NEEDS YOU', 'COST', 'GOAL ID'],+ ['STATUS', 'TITLE', 'TASKS', 'FINDINGS', 'NEEDS YOU', 'COST', 'GOAL ID'],);});@@ -315,7 +315,7 @@ export function registerGoalCommand(program: Command) {const retryWindowMs = Number.parseInt(options.retryWindowMs, 10);// Only ticks that CHANGED something count against the budget. Polling an// unchanged `waiting_external` state is the coordinator idling while a- // Work runs — a Work that legitimately takes an hour would otherwise+ // Task runs — a Task that legitimately takes an hour would otherwise// burn the whole allowance on no-ops and stop a healthy goal half-way.let advancingTicks = 0;let exhaustedBudget = false;@@ -438,7 +438,7 @@ export function registerGoalCommand(program: Command) {goal.command('add-node <id> <kind> <title>')- .description('Add a problem, work, finding, or decision node')+ .description('Add a problem, task, finding, or decision node').option('-d, --description <text>').option('-p, --priority <n>').action(diff --git a/apps/server/src/routers/lambda/goal.ts b/apps/server/src/routers/lambda/goal.tsindex 6d0770af67e..769a45ded3f 100644--- a/apps/server/src/routers/lambda/goal.ts+++ b/apps/server/src/routers/lambda/goal.ts@@ -123,7 +123,7 @@ export const goalRouter = router({.optional(),maxRounds: z.number().int().positive().optional(),maxTotalCost: z.number().positive().optional(),-/** Structured acceptance criteria — persisted rows that gate the terminal acceptance. */+ /** Structured acceptance criteria — persisted rows that gate the terminal acceptance. */criteria: z.array(z.object({@@ -137,7 +137,8 @@ export const goalRouter = router({projectId: z.string().optional(),requirement: z.string().optional(),title: z.string().min(1),- work: z+ /** Seed task nodes, in dependency-free order. */+ tasks: z.array(z.union([z.string().min(1),@@ -180,7 +181,7 @@ export const goalRouter = router({input.optionId,input.resolution,);- // Answering the gate is what unblocks the Work; carry on from here.+ // Answering the gate is what unblocks the Task; carry on from here.await scheduleGoalAdvance({goalId: input.id,trigger: 'decide',@@ -216,7 +217,7 @@ export const goalRouter = router({/*** Delete a goal and, by FK cascade, its whole graph. Anything still running- * is stopped first; the Work Tasks themselves are deliberately left in place+ * is stopped first; the graph Tasks themselves are deliberately left in place* — they are ordinary tasks with their own history and acceptance.*/delete: goalWriteProcedure.input(idInput).mutation(async ({ ctx, input }) => {@@ -244,7 +245,7 @@ export const goalRouter = router({}),/**- * List goals with their graph roll-up: how much Work is done, how many+ * List goals with their graph roll-up: how many Tasks are done, how many* decision gates wait on a human, and what the exploration has cost.*/list: goalProcedurediff --git a/apps/server/src/services/goal/advanceGoal.test.ts b/apps/server/src/services/goal/advanceGoal.test.tsindex 2f274ef78c9..799489f6d69 100644--- a/apps/server/src/services/goal/advanceGoal.test.ts+++ b/apps/server/src/services/goal/advanceGoal.test.ts@@ -51,7 +51,7 @@ describe('advanceGoal', () => {});it('hands off at waiting_external instead of polling a running task', async () => {- // The Work Task's own settle queues the next advance. Polling here would+ // The Task's own settle queues the next advance. Polling here would// hold a worker open for the whole execution and duplicate that event.mocks.tick.mockResolvedValueOnce(tickResult('advanced'))diff --git a/apps/server/src/services/goal/advanceGoal.ts b/apps/server/src/services/goal/advanceGoal.tsindex 254c630f14d..711f54e1220 100644--- a/apps/server/src/services/goal/advanceGoal.ts+++ b/apps/server/src/services/goal/advanceGoal.ts@@ -13,7 +13,7 @@ const log = debug('lobe-server:goal-advance');* Outcomes the coordinator cannot get past by ticking again.** `waiting_external` is one of them here, and that is the whole point of the- * event-driven design: it means a Work Task is now executing, so the next move+ * event-driven design: it means a graph Task is now executing, so the next move* belongs to that task's completion, not to a poll loop holding a worker open.*/const STOP_OUTCOMES = new Set<GoalTickOutcome>([diff --git a/apps/server/src/services/goal/criteriaGenerator.ts b/apps/server/src/services/goal/criteriaGenerator.tsindex 90f98f5ec58..8a2170c7662 100644--- a/apps/server/src/services/goal/criteriaGenerator.ts+++ b/apps/server/src/services/goal/criteriaGenerator.ts@@ -69,10 +69,10 @@ export interface GoalPlanDraft {const decompositionSchema = z.object({problemStatement: z.string().min(1),- works: z+ tasks: z.array(z.object({- /** 0-based indices of earlier works this one consumes; drives `depends_on` edges. */+ /** 0-based indices of earlier tasks this one consumes; drives `depends_on` edges. */dependsOn: z.array(z.number().int().nonnegative()).optional(),instruction: z.string().min(1),title: z.string().min(1).max(80),@@ -140,10 +140,10 @@ export class GoalCriteriaGeneratorService {}/**- * Plan the opening exploration structure for a goal that has no work yet:+ * Plan the opening exploration structure for a goal that has no tasks yet:* the core question plus 1–5 independent directions. Returns undefined on* any model/schema failure so the coordinator can fall back to a single- * work seeded from the raw requirement instead of stalling the goal.+ * task seeded from the raw requirement instead of stalling the goal.*/async decompose(params: { requirement: string }): Promise<GoalDecompositionDraft | undefined> {const modelConfig = await resolveGoalModelConfig(this.db, this.userId);diff --git a/apps/server/src/services/goal/decideNextMove.test.ts b/apps/server/src/services/goal/decideNextMove.test.tsindex 784e14b9f42..98496c76577 100644--- a/apps/server/src/services/goal/decideNextMove.test.ts+++ b/apps/server/src/services/goal/decideNextMove.test.ts@@ -93,7 +93,7 @@ describe('selectFrontier', () => {expect(selection.chosen?.id).toBe('a');});- it('drops terminal work from the frontier', () => {+ it('drops terminal Tasks from the frontier', () => {const snapshot = graph({nodes: [node('done', { status: 'resolved' }), node('gone', { status: 'retired' })],});@@ -103,7 +103,7 @@ describe('selectFrontier', () => {});describe('decideNextMove', () => {- it('stops on a paused or terminal goal before looking at work', () => {+ it('stops on a paused or terminal goal before looking at Tasks', () => {const nodes = [node('a')];expect(decide(graph({ goal: { ...graph().goal, status: 'paused' }, nodes })).branch).toBe('goal_paused',@@ -116,7 +116,7 @@ describe('decideNextMove', () => {);});- it('parks on an open gate ahead of any ready work', () => {+ it('parks on an open gate ahead of any ready Task', () => {const move = decide(graph({decisions: [@@ -134,7 +134,7 @@ describe('decideNextMove', () => {});});- it('asks for a responsible task when the chosen work has none', () => {+ it('asks for a responsible runner when the chosen Task has none', () => {expect(decide(graph({ nodes: [node('a')] }))).toMatchObject({branch: 'create_task',chosenNodeId: 'a',@@ -255,9 +255,9 @@ describe('decideNextMove', () => {});});- describe('with no ready work', () => {+ describe('with no ready Tasks', () => {it('plans the decomposition for an empty graph, parks a fully blocked one', () => {- // A goal with no work has not been planned yet — that is the planner's+ // A goal with no tasks has not been planned yet — that is the planner's// cue, not a dead end.expect(decide(graph())).toMatchObject({branch: 'plan_decomposition',@@ -276,7 +276,7 @@ describe('decideNextMove', () => {});});- it('moves to the terminal acceptance contract once every Work is done', () => {+ it('moves to the terminal acceptance contract once every Task is done', () => {const snapshot = graph({goal: { ...graph().goal, requirement: 'Prove it' },nodes: [node('a', { status: 'resolved' })],@@ -288,7 +288,7 @@ describe('decideNextMove', () => {});});- it('holds the goal open while its acceptance Work has not passed', () => {+ it('holds the goal open while its acceptance Task has not passed', () => {const snapshot = graph({goal: { ...graph().goal, requirement: 'Prove it' },nodes: [@@ -376,7 +376,7 @@ describe('decideNextMove concurrency', () => {expect(move.outcome).toBe('advanced');});- it('does not let a paused task block independent work', () => {+ it('does not let a paused task block an independent Task', () => {const snapshot = graph({ nodes: [node('a', { taskId: 'task_1' }), node('b')] });expect(decide(snapshot, { tasks: [task({ id: 'task_1', status: 'paused' })] })).toMatchObject({diff --git a/apps/server/src/services/goal/decideNextMove.ts b/apps/server/src/services/goal/decideNextMove.tsindex 03be9368531..3ce4a6c309c 100644--- a/apps/server/src/services/goal/decideNextMove.ts+++ b/apps/server/src/services/goal/decideNextMove.ts@@ -10,7 +10,7 @@ import type { GoalGraphNode, GoalGraphSnapshot, TaskItem } from '@lobechat/typesexport { GOAL_ACCEPTANCE_TASK_TITLE } from '@lobechat/const/goal';/** Reason strings the recovery paths key off, written by the settle path. */-export const LEASE_EXPIRED_ERROR = 'Goal Work operation lease expired.';+export const LEASE_EXPIRED_ERROR = 'Goal Task operation lease expired.';export const VERIFICATION_FAILED_ERROR = 'Delivery did not pass verification.';export const TERMINAL_NODE_STATUSES = new Set(['resolved', 'rejected', 'retired']);@@ -25,7 +25,7 @@ export interface FrontierSelection {}/**- * Rank the work nodes that could run right now.+ * Rank the task nodes that could run right now.** Split out of the decision so the caller can resolve the chosen node's task* before deciding, and exported so a trace keeps the whole ranking rather than@@ -73,7 +73,7 @@ export const selectFrontier = (graph: GoalGraphSnapshot): FrontierSelection => {* the budget has to be read before deciding.** Every other task status resolves to a branch that costs nothing, so a goal- * that is merely waiting on a running Work does not pay for a budget query on+ * that is merely waiting on a running Task does not pay for a budget query on* every sweep.*/export const needsBudget = (task?: TaskItem | null): boolean => {@@ -317,45 +317,45 @@ const decideWithoutFrontier = (const base = { candidates };const taskNodes = graph.nodes.filter((node) => node.kind === 'task');- // A goal with no work at all has not been planned yet — decompose it into+ // A goal with no tasks at all has not been planned yet — decompose it into// explorable directions before anything runs, instead of parking it.if (taskNodes.length === 0) {return {...base,branch: 'plan_decomposition',- message: 'Goal has no work yet; plan its exploration structure first',+ message: 'Goal has no tasks yet; plan its exploration structure first',outcome: 'advanced',};}- const allWorkTerminal = taskNodes.every((node) => TERMINAL_NODE_STATUSES.has(node.status));+ const allTasksTerminal = taskNodes.every((node) => TERMINAL_NODE_STATUSES.has(node.status));- if (!allWorkTerminal) {- // Nothing here moves without a person: every remaining Work is blocked and+ if (!allTasksTerminal) {+ // Nothing here moves without a person: every remaining Task is blocked and// nothing is running to unblock it.return {...base,branch: 'no_frontier',- message: 'No work node is ready; resolve its dependencies first',+ message: 'No task node is ready; resolve its dependencies first',outcome: 'no_progress',};}- const acceptanceWork = taskNodes.find((node) => node.title === GOAL_ACCEPTANCE_TASK_TITLE);+ const acceptanceTask = taskNodes.find((node) => node.title === GOAL_ACCEPTANCE_TASK_TITLE);- if (graph.goal.requirement && !acceptanceWork) {+ if (graph.goal.requirement && !acceptanceTask) {return {...base,branch: 'terminal_acceptance',- message: 'Every Work finished; the Goal-level acceptance contract is next',+ message: 'Every Task finished; the Goal-level acceptance contract is next',outcome: 'advanced',};}- if (graph.goal.requirement && acceptanceWork?.status !== 'resolved') {+ if (graph.goal.requirement && acceptanceTask?.status !== 'resolved') {return {...base,branch: 'terminal_acceptance',- focusNodeId: acceptanceWork?.id,+ focusNodeId: acceptanceTask?.id,message: 'Goal-level acceptance did not pass',outcome: 'no_progress',};@@ -397,7 +397,7 @@ const decideForTask = (return {...base,branch: 'budget_exhausted',- message: `Deadline passed (${graph.goal.config?.schedule?.deadline ?? 'unknown'}); no new Work will be dispatched`,+ message: `Deadline passed (${graph.goal.config?.schedule?.deadline ?? 'unknown'}); no new Task will be dispatched`,outcome: 'no_progress',};}@@ -427,7 +427,7 @@ const decideForTask = (};}- // Parked on a person, and holding no slot. The goal has other work.+ // Parked on a person, and holding no slot. The goal has other Tasks.if (task.status === 'paused') return 'parked';// Callers filter these out before they get here; kept so the classification@@ -438,7 +438,7 @@ const decideForTask = (return {...base,branch: 'budget_exhausted',- message: `Deadline passed (${graph.goal.config?.schedule?.deadline ?? 'unknown'}); no new Work will be dispatched`,+ message: `Deadline passed (${graph.goal.config?.schedule?.deadline ?? 'unknown'}); no new Task will be dispatched`,outcome: 'no_progress',};}@@ -447,7 +447,7 @@ const decideForTask = (return {...base,branch: 'budget_exhausted',- message: `Deadline passed (${graph.goal.config?.schedule?.deadline ?? 'unknown'}); no new Work will be dispatched`,+ message: `Deadline passed (${graph.goal.config?.schedule?.deadline ?? 'unknown'}); no new Task will be dispatched`,outcome: 'no_progress',};}diff --git a/apps/server/src/services/goal/goalTraceRecorder.ts b/apps/server/src/services/goal/goalTraceRecorder.tsindex 6ab67d41d0c..c9b50dd5953 100644--- a/apps/server/src/services/goal/goalTraceRecorder.ts+++ b/apps/server/src/services/goal/goalTraceRecorder.ts@@ -49,7 +49,7 @@ export class GoalAdvanceRecorder {return this.store !== null;}- /** Pass to `GoalService.tick`; undefined when tracing is off, so tick skips the work. */+ /** Pass to `GoalService.tick`; undefined when tracing is off, so tick skips recording. */get onDecision(): ((observation: GoalTickObservation) => void) | undefined {if (!this.store) return undefined;return (observation) => {diff --git a/apps/server/src/services/goal/index.test.ts b/apps/server/src/services/goal/index.test.tsindex cc211d5805c..cbb2f97f393 100644--- a/apps/server/src/services/goal/index.test.ts+++ b/apps/server/src/services/goal/index.test.ts@@ -70,7 +70,7 @@ describe('GoalService', () => {{ instruction: 'Check README covers install and run', title: 'Docs are complete' },],title: 'Structured goal',- work: ['Only work'],+ tasks: ['Only task'],});const criteriaIds = graph.goal.config?.acceptance?.criteriaIds ?? [];@@ -85,21 +85,21 @@ describe('GoalService', () => {});it('rebinding criteria also updates the dispatched terminal acceptance task', async () => {- // Editing the standard after the terminal Goal-acceptance Work exists must- // not leave that Work's Acceptance gating on the stale id list.+ // Editing the standard after the terminal Goal-acceptance Task exists must+ // not leave that Task's Acceptance gating on the stale id list.const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);const graph = await service.create({criteria: [{ title: 'Original criterion' }],requirement: 'Deliver with evidence',title: 'Rebind criteria goal',- work: ['Only work'],+ tasks: ['Only task'],});const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'completed');await service.tick(graph.goal.id); // synthesize finding- await service.tick(graph.goal.id); // create acceptance work+ await service.tick(graph.goal.id); // create acceptance taskconst acceptanceTaskCreated = await service.tick(graph.goal.id); // dispatch itexpect(acceptanceTaskCreated.taskId).toBeDefined();@@ -120,9 +120,9 @@ describe('GoalService', () => {expect(acceptance?.config?.verifyCriteriaIds).toEqual([replacementId]);});- it('creates only one responsible task when ticks race on the same work node', async () => {+ it('creates only one responsible task when ticks race on the same task node', async () => {const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'Concurrent goal', work: ['Single owner work'] });+ const graph = await service.create({ tasks: ['Single owner task'], title: 'Concurrent goal' });const results = await Promise.all([service.tick(graph.goal.id), service.tick(graph.goal.id)]);const current = await service.graph(graph.goal.id);@@ -134,15 +134,15 @@ describe('GoalService', () => {expect(current.workVersions).toHaveLength(1);});- it('starts the bound Work once when advances race on dispatch', async () => {+ it('starts the bound Task once when advances race on dispatch', async () => {// Overlapping advances (an event hook, a manual nudge, the sweep) both read// the task as backlog; without an atomic claim both would call runTask and- // the user would pay for the same Work twice.+ // the user would pay for the same Task twice.const runSpy = vi.spyOn(TaskRunnerService.prototype, 'runTask').mockImplementation(async ({ taskId }) => ({ taskId }) as never);const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'Raced dispatch', work: ['Only run once'] });+ const graph = await service.create({ tasks: ['Only run once'], title: 'Raced dispatch' });await service.tick(graph.goal.id);const results = await Promise.all([service.tick(graph.goal.id), service.tick(graph.goal.id)]);@@ -152,7 +152,7 @@ describe('GoalService', () => {});it('retries a failed verification once when advances race on recovery', async () => {- // The dispatch claim only covers starting a backlog Work; the automatic+ // The dispatch claim only covers starting a backlog Task; the automatic// retry path spawns its own run, so without the same claim two overlapping// advances would each pay for an attempt.const runSpy = vi@@ -163,7 +163,7 @@ describe('GoalService', () => {const graph = await service.create({config: { recovery: { maxAttemptsPerTask: 3 } },title: 'Raced recovery',- work: ['Retry me once'],+ tasks: ['Retry me once'],});const created = await service.tick(graph.goal.id);await taskModel.update(created.taskId!, { totalTopics: 1 });@@ -188,7 +188,7 @@ describe('GoalService', () => {const graph = await service.create({config: { schedule: { deadline: new Date(Date.now() - 1000).toISOString() } },title: `Overdue recovery ${error}`,- work: ['Do not retry'],+ tasks: ['Do not retry'],});const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'paused', { error });@@ -211,7 +211,7 @@ describe('GoalService', () => {.mockRejectedValue(new Error('worker died'));const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);- const graph = await service.create({ title: 'Orphaned claim', work: ['Start me'] });+ const graph = await service.create({ tasks: ['Start me'], title: 'Orphaned claim' });const created = await service.tick(graph.goal.id);// The claim survives the crash: put the row back where a dead worker left it.@@ -229,8 +229,8 @@ describe('GoalService', () => {runSpy.mockRestore();});- it('does not re-dispatch a delivered Work while verification is still judging', async () => {- // A verify-bound Work keeps its task `running` with a completed topic until+ it('does not re-dispatch a delivered Task while verification is still judging', async () => {+ // A verify-bound Task keeps its task `running` with a completed topic until// the verify run settles, and that judgment routinely outlives the// operation lease. Treating the window as a dead claim released the task// back to backlog, and the next advance paid for a ghost attempt that the@@ -241,7 +241,7 @@ describe('GoalService', () => {const graph = await service.create({config: { recovery: { operationLeaseTimeoutMs: 60_000 } },title: 'Deliveries wait for verification',- work: ['Deliver and wait'],+ tasks: ['Deliver and wait'],});const created = await service.tick(graph.goal.id);await serverDB.insert(taskTopics).values({@@ -268,7 +268,7 @@ describe('GoalService', () => {expect(runSpy).not.toHaveBeenCalled();});- it('reclaims a delivered Work once the verification grace window lapses', async () => {+ it('reclaims a delivered Task once the verification grace window lapses', async () => {// The hold-off above cannot be unconditional: a verify run that died// silently would otherwise strand the goal forever, which is exactly the// failure mode the sweep exists to break.@@ -277,7 +277,7 @@ describe('GoalService', () => {const graph = await service.create({config: { recovery: { operationLeaseTimeoutMs: 60_000 } },title: 'Dead verification is reclaimed',- work: ['Deliver into silence'],+ tasks: ['Deliver into silence'],});const created = await service.tick(graph.goal.id);await serverDB.insert(taskTopics).values({@@ -304,10 +304,10 @@ describe('GoalService', () => {// When verification accepts a delivery, the settle path cancels the ghost// retry it superseded — leaving the canceled, handoff-less topic as the// newest row. Reading blindly by seq produced findings titled- // "Completed: <work>" with no description.+ // "Completed: <task>" with no description.const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);- const graph = await service.create({ title: 'Consume the delivery', work: ['Deliver me'] });+ const graph = await service.create({ tasks: ['Deliver me'], title: 'Consume the delivery' });const created = await service.tick(graph.goal.id);await serverDB.insert(taskTopics).values([{@@ -348,7 +348,7 @@ describe('GoalService', () => {vi.spyOn(TaskRunnerService.prototype, 'runTask').mockRejectedValue(new Error('worker died'));const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);- const graph = await service.create({ title: 'Fresh claim', work: ['Start me'] });+ const graph = await service.create({ tasks: ['Start me'], title: 'Fresh claim' });const created = await service.tick(graph.goal.id);await expect(service.tick(graph.goal.id)).rejects.toThrow('worker died');await taskModel.updateStatus(created.taskId!, 'running');@@ -366,7 +366,7 @@ describe('GoalService', () => {const graph = await service.create({maxRounds: 1,title: 'Budget stopped',- work: ['Costs a round'],+ tasks: ['Costs a round'],});const created = await service.tick(graph.goal.id);await serverDB.insert(topics).values({ id: 'tpc_budget', userId });@@ -386,7 +386,11 @@ describe('GoalService', () => {it('edits the standing requirement in place', async () => {const service = new GoalService(serverDB, userId);- const graph = await service.create({ requirement: '初版验收', title: 'Editable', work: ['A'] });+ const graph = await service.create({+ requirement: '初版验收',+ tasks: ['A'],+ title: 'Editable',+ });const updated = await service.updateRequirement(graph.goal.id, '改过的验收标准');@@ -399,7 +403,7 @@ describe('GoalService', () => {// Nothing distinguishes a user pause from a budget pause on the row, so the// reopen is limited to goals whose budget was actually binding.const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'User paused', work: ['Wait'] });+ const graph = await service.create({ tasks: ['Wait'], title: 'User paused' });await service.pause(graph.goal.id);const updated = await service.setBudget(graph.goal.id, { maxTotalCost: 50 });@@ -407,12 +411,12 @@ describe('GoalService', () => {expect(updated?.status).toBe('paused');});- it('refuses to delete a goal whose running work cannot be stopped', async () => {+ it('refuses to delete a goal whose running Task cannot be stopped', async () => {// Deleting anyway would remove the only surface that can stop an operation// which keeps spending.vi.spyOn(TaskRunnerService.prototype, 'runTask').mockResolvedValue({} as never);const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'Unstoppable', work: ['Runs on'] });+ const graph = await service.create({ tasks: ['Runs on'], title: 'Unstoppable' });const created = await service.tick(graph.goal.id);await serverDB.insert(topics).values({ id: 'tpc_stuck', userId });await new TaskTopicModel(serverDB, userId).add(created.taskId!, 'tpc_stuck', { seq: 1 });@@ -427,10 +431,10 @@ describe('GoalService', () => {expect(await service.graph(graph.goal.id)).toBeDefined();});- it('plans the decomposition when a goal has no work yet', async () => {+ it('plans the decomposition when a goal has no tasks yet', async () => {vi.spyOn(GoalCriteriaGeneratorService.prototype, 'decompose').mockResolvedValue({problemStatement: '核心问题的一句话陈述',- works: [+ tasks: [{ dependsOn: [], instruction: '收集原始材料', title: '方向A:收集' },{ dependsOn: [0], instruction: '分析并综合结论', title: '方向B:分析' },// Self and forward references are planner hallucinations — dropped.@@ -488,7 +492,7 @@ describe('GoalService', () => {await gate;return {problemStatement: '并发规划',- works: [+ tasks: [{ dependsOn: [], instruction: '收集', title: '方向A' },{ dependsOn: [0], instruction: '分析', title: '方向B' },],@@ -512,7 +516,7 @@ describe('GoalService', () => {expect(after.edges.filter((e) => e.kind === 'depends_on')).toHaveLength(1);});- it('falls back to a single work when the planner fails, instead of stalling', async () => {+ it('falls back to a single Task when the planner fails, instead of stalling', async () => {vi.spyOn(GoalCriteriaGeneratorService.prototype, 'decompose').mockRejectedValue(new Error('model unavailable'),);@@ -528,11 +532,11 @@ describe('GoalService', () => {});it('parks a goal nothing can move so the sweep stops re-picking it', async () => {- // Every remaining Work is blocked and nothing runs to unblock it. Left+ // Every remaining Task is blocked and nothing runs to unblock it. Left// `running` it is selected by every newest-first scan forever, and enough// of them starve every other stalled goal out of the sweep's window.const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'Deadlocked', work: ['A', 'B'] });+ const graph = await service.create({ tasks: ['A', 'B'], title: 'Deadlocked' });const [a, b] = graph.nodes.filter((n) => n.kind === 'task');const graphModel = new GoalGraphModel(serverDB, userId);await graphModel.createEdge(graph.goal.id, a.id, b.id, 'depends_on');@@ -552,7 +556,7 @@ describe('GoalService', () => {// transitions used to be recorded — `entity_type='goal'` events existed in// the schema with no writer, so the lifecycle timeline was unreconstructable.const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'Lifecycle trail', work: ['A', 'B'] });+ const graph = await service.create({ tasks: ['A', 'B'], title: 'Lifecycle trail' });const [a, b] = graph.nodes.filter((n) => n.kind === 'task');const graphModel = new GoalGraphModel(serverDB, userId);await graphModel.createEdge(graph.goal.id, a.id, b.id, 'depends_on');@@ -571,7 +575,7 @@ describe('GoalService', () => {expect.objectContaining({actorType: 'system',eventType: 'updated',- reason: 'no eligible work to advance',+ reason: 'no eligible task to advance',}),);expect(lifecycle).toContainEqual(@@ -587,7 +591,7 @@ describe('GoalService', () => {const graph = await service.create({config: { schedule: { deadline: new Date(Date.now() - 1000).toISOString() } },title: 'Overdue',- work: ['Too late to start'],+ tasks: ['Too late to start'],});await service.tick(graph.goal.id); // creates the responsible task@@ -603,9 +607,9 @@ describe('GoalService', () => {expect(extended?.config?.schedule?.deadline).toBeTruthy();});- it('dispatches work when the goal has no deadline', async () => {+ it('dispatches a Task when the goal has no deadline', async () => {const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'No deadline', work: ['Just work'] });+ const graph = await service.create({ tasks: ['Just task'], title: 'No deadline' });const result = await service.tick(graph.goal.id);@@ -624,7 +628,7 @@ describe('GoalService', () => {agentId: 'agt_goal_author',createdByAgentId: 'agt_goal_author',title: 'Agent-authored goal',- work: ['Do the thing'],+ tasks: ['Do the thing'],});const seeded = graph.events.filter((event) => ['created', 'linked'].includes(event.eventType));@@ -642,7 +646,7 @@ describe('GoalService', () => {const graph = await service.create({agentId: 'agt_assignee',title: 'User-authored goal',- work: ['Do the thing'],+ tasks: ['Do the thing'],});const seeded = graph.events.filter((event) => ['created', 'linked'].includes(event.eventType));@@ -654,32 +658,32 @@ describe('GoalService', () => {// The audit trail recorded every transition as the goal's owner, so "what did// the system decide on its own" could not be answered from product data.const service = new GoalService(serverDB, userId);- const graph = await service.create({ title: 'Attributed goal', work: ['Do the thing'] });+ const graph = await service.create({ tasks: ['Do the thing'], title: 'Attributed goal' });- // Seeding is the user's ask; claiming the Work and binding its task is not.+ // Seeding is the user's ask; claiming the Task and binding its runner is not.await service.tick(graph.goal.id);const { events, nodes } = await service.graph(graph.goal.id);- const work = nodes.find((node) => node.kind === 'task')!;+ const task = nodes.find((node) => node.kind === 'task')!;const actorsFor = (eventType: string, entityId: string) =>events.filter((event) => event.eventType === eventType && event.entityId === entityId).map((event) => ({ actorId: event.actorId, actorType: event.actorType }));- expect(actorsFor('created', work.id)).toEqual([{ actorId: userId, actorType: 'user' }]);- expect(actorsFor('activated', work.id)).toEqual([+ expect(actorsFor('created', task.id)).toEqual([{ actorId: userId, actorType: 'user' }]);+ expect(actorsFor('activated', task.id)).toEqual([{ actorId: GOAL_COORDINATOR_ACTOR_ID, actorType: 'system' },]);expect(events.some((event) => event.actorType === 'system')).toBe(true);});- it('keeps the overall requirement as background while making the current work authoritative', async () => {+ it('keeps the overall requirement as background while making the current Task authoritative', async () => {const service = new GoalService(serverDB, userId);const requirement = `Generate verified training data. ${'Detailed acceptance evidence. '.repeat(20)}`;const graph = await service.create({requirement,title: 'Long requirement goal',- work: ['Generate training data'],+ tasks: ['Generate training data'],});const created = await service.tick(graph.goal.id);@@ -689,7 +693,7 @@ describe('GoalService', () => {expect(task?.description).toBe('Generate training data');expect(task?.instruction).toContain(requirement);expect(task?.instruction).toContain(- 'Current Work contract (authoritative execution scope): Generate training data',+ 'Current Task contract (authoritative execution scope): Generate training data',);expect(task?.instruction).toContain('Do not implement, validate, or pre-empt any sibling');expect(task?.instruction).toContain(@@ -700,7 +704,7 @@ describe('GoalService', () => {);});- it('gates every responsible task with a work-scoped Acceptance requirement', async () => {+ it('gates every responsible task with a Task-scoped Acceptance requirement', async () => {const service = new GoalService(serverDB, userId);const agentId = 'goal-work-verifier-agent';await serverDB.insert(agents).values({ id: agentId, title: 'Goal worker', userId });@@ -708,7 +712,7 @@ describe('GoalService', () => {agentId,requirement: 'Generate data, then train and evaluate a model.',title: 'Two-stage experiment',- work: ['Generate isolated data'],+ tasks: ['Generate isolated data'],});const created = await service.tick(graph.goal.id);@@ -723,19 +727,19 @@ describe('GoalService', () => {expect(task?.config).not.toHaveProperty('verify');expect(acceptance).toMatchObject({ config: { enabled: true } });expect(acceptance?.config).not.toHaveProperty('verifierAgentId');- expect(acceptance?.requirement).toContain('Verify only this Work: Generate isolated data.');+ expect(acceptance?.requirement).toContain('Verify only this Task: Generate isolated data.');expect(acceptance?.requirement).toContain(- 'Ignore sibling and downstream Work deliverables; they are verified by their own Tasks.',+ 'Ignore sibling and downstream Task deliverables; they are verified by their own acceptance runs.',);});- it('requires a Goal-level Acceptance Work before marking the complete goal achieved', async () => {+ it('requires a Goal-level Acceptance Task before marking the complete goal achieved', async () => {const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);const graph = await service.create({requirement: 'A runnable minimal training loop with evidence',title: 'Reproduce Ornith training',- work: ['Implement minimal training loop'],+ tasks: ['Implement minimal training loop'],});const created = await service.tick(graph.goal.id);@@ -762,7 +766,7 @@ describe('GoalService', () => {const goalAcceptanceCreated = await service.tick(graph.goal.id);expect(goalAcceptanceCreated).toMatchObject({- message: 'Created Goal-level acceptance Work for the remaining contract',+ message: 'Created Goal-level acceptance Task for the remaining contract',outcome: 'advanced',});const acceptanceWork = (await service.graph(graph.goal.id)).nodes.find(@@ -804,13 +808,13 @@ describe('GoalService', () => {});});- it('does not mark a required goal achieved when only its initial Work is complete', async () => {+ it('does not mark a required goal achieved when only its initial Task is complete', async () => {const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);const graph = await service.create({requirement: 'Return a supplier list with fixed prices.',title: 'Find BW150 suppliers and fixed prices',- work: ['Verify the BW150 product identity'],+ tasks: ['Verify the BW150 product identity'],});const created = await service.tick(graph.goal.id);@@ -831,13 +835,13 @@ describe('GoalService', () => {);});- it('creates only one Goal-level Acceptance Work when terminal ticks race', async () => {+ it('creates only one Goal-level Acceptance Task when terminal ticks race', async () => {const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);const graph = await service.create({requirement: 'Return three verified supplier quotes.',title: 'Find supplier quotes',- work: ['Research suppliers'],+ tasks: ['Research suppliers'],});const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'completed');@@ -857,10 +861,10 @@ describe('GoalService', () => {).toHaveLength(1);});- it('evolves a failed work task into a durable decision gate', async () => {+ it('evolves a failed task into a durable decision gate', async () => {const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);- const graph = await service.create({ title: 'Failure recovery', work: ['Risky work'] });+ const graph = await service.create({ tasks: ['Risky task'], title: 'Failure recovery' });const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'paused', { error: 'Verifier rejected output' });@@ -884,7 +888,7 @@ describe('GoalService', () => {// catches it; a synthetic observation always agrees with itself.const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);- const graph = await service.create({ title: 'Effect reporting', work: ['Risky task'] });+ const graph = await service.create({ tasks: ['Risky task'], title: 'Effect reporting' });const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'paused', { error: 'Verifier rejected output' });@@ -927,7 +931,7 @@ describe('GoalService', () => {const graph = await service.create({config: { maxConcurrentTasks: 1 },title: 'Capped goal',- work: ['First', 'Second'],+ tasks: ['First', 'Second'],});// Fill the single slot.@@ -943,7 +947,7 @@ describe('GoalService', () => {expect(runSpy).not.toHaveBeenCalled();});- it('automatically retries failed Work verification within policy budget', async () => {+ it('automatically retries failed Task verification within policy budget', async () => {const runSpy = vi.spyOn(TaskRunnerService.prototype, 'runTask').mockResolvedValue({agentId: 'agent-recovery',assistantMessageId: 'message-assistant',@@ -964,7 +968,7 @@ describe('GoalService', () => {const graph = await service.create({config: { recovery: { maxAttemptsPerTask: 3, maxStepsPerRun: 500 } },title: 'Recover BW 150 research',- work: ['Verify Micron BW 150 suppliers'],+ tasks: ['Verify Micron BW 150 suppliers'],});const created = await service.tick(graph.goal.id);await taskModel.update(created.taskId!, { totalTopics: 1 });@@ -983,7 +987,7 @@ describe('GoalService', () => {expect((await service.graph(graph.goal.id)).decisions).toHaveLength(0);});- it('reclaims a stale running Work operation and starts the next attempt', async () => {+ it('reclaims a stale running Task operation and starts the next attempt', async () => {const runSpy = vi.spyOn(TaskRunnerService.prototype, 'runTask').mockResolvedValue({agentId: 'agent-recovery',assistantMessageId: 'message-assistant',@@ -1016,7 +1020,7 @@ describe('GoalService', () => {recovery: { maxAttemptsPerTask: 3, operationLeaseTimeoutMs: 60_000 },},title: 'Recover interrupted work',- work: ['Run a durable experiment'],+ tasks: ['Run a durable experiment'],});const created = await service.tick(graph.goal.id);await taskModel.update(created.taskId!, { totalTopics: 1 });@@ -1038,7 +1042,7 @@ describe('GoalService', () => {});});- it('charges stale Work usage before checking the replacement budget', async () => {+ it('charges stale Task usage before checking the replacement budget', async () => {const runSpy = vi.spyOn(TaskRunnerService.prototype, 'runTask').mockResolvedValue({} as never);vi.spyOn(TaskTopicModel.prototype, 'findRunningByTaskIds').mockResolvedValue([{ operationId: 'op-stale-cost', topicId: 'topic-stale-cost' } as never,@@ -1058,7 +1062,7 @@ describe('GoalService', () => {config: { recovery: { maxAttemptsPerTask: 3, operationLeaseTimeoutMs: 60_000 } },maxTotalCost: 0.5,title: 'Respect abandoned Work cost',- work: ['Run an expensive experiment'],+ tasks: ['Run an expensive experiment'],});const created = await service.tick(graph.goal.id);await taskModel.update(created.taskId!, { totalTopics: 1 });@@ -1084,7 +1088,7 @@ describe('GoalService', () => {);});- it('does not reclaim a running Work operation without a persisted topic id', async () => {+ it('does not reclaim a running Task operation without a persisted topic id', async () => {vi.spyOn(TaskTopicModel.prototype, 'findRunningByTaskIds').mockResolvedValue([{ operationId: 'op-without-topic', topicId: null } as never,]);@@ -1095,7 +1099,7 @@ describe('GoalService', () => {const graph = await service.create({config: { recovery: { operationLeaseTimeoutMs: 60_000 } },title: 'Wait for topic persistence',- work: ['Run a durable experiment'],+ tasks: ['Run a durable experiment'],});const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'running');@@ -1110,13 +1114,13 @@ describe('GoalService', () => {});});- it('starts ready sibling Work even when a running Task row is older than the operation lease', async () => {+ it('starts a ready sibling Task even when a running Task row is older than the operation lease', async () => {const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);const graph = await service.create({config: { recovery: { operationLeaseTimeoutMs: 60_000 } },title: 'Keep parallel work moving',- work: ['Long-running experiment', 'Independent analysis'],+ tasks: ['Long-running experiment', 'Independent analysis'],});const running = await service.tick(graph.goal.id);await taskModel.updateStatus(running.taskId!, 'running');@@ -1145,7 +1149,7 @@ describe('GoalService', () => {const graph = await service.create({config: { recovery: { operationLeaseTimeoutMs: 60_000 } },title: 'Atomic abandoned recovery',- work: ['Run a durable experiment'],+ tasks: ['Run a durable experiment'],});const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'running');@@ -1182,12 +1186,12 @@ describe('GoalService', () => {const graph = await service.create({config: { recovery: { maxAttemptsPerTask: 3 } },title: 'Resume abandoned recovery',- work: ['Run a durable experiment'],+ tasks: ['Run a durable experiment'],});const created = await service.tick(graph.goal.id);await taskModel.update(created.taskId!, { totalTopics: 1 });await taskModel.updateStatus(created.taskId!, 'paused', {- error: 'Goal Work operation lease expired.',+ error: 'Goal Task operation lease expired.',});const recovered = await service.tick(graph.goal.id);@@ -1199,13 +1203,13 @@ describe('GoalService', () => {});});- it('opens the decision gate only after the Work attempt budget is exhausted', async () => {+ it('opens the decision gate only after the Task attempt budget is exhausted', async () => {const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);const graph = await service.create({config: { recovery: { maxAttemptsPerTask: 1 } },title: 'Bounded recovery',- work: ['Verify Micron BW 150 suppliers'],+ tasks: ['Verify Micron BW 150 suppliers'],});const created = await service.tick(graph.goal.id);await taskModel.update(created.taskId!, { totalTopics: 1 });@@ -1226,7 +1230,7 @@ describe('GoalService', () => {config: { recovery: { maxAttemptsPerTask: 1 } },requirement: 'Return three verified supplier quotes.',title: 'Bounded terminal acceptance',- work: ['Complete full Goal acceptance'],+ tasks: ['Complete full Goal acceptance'],});const created = await service.tick(graph.goal.id);await taskModel.update(created.taskId!, { totalTopics: 1 });@@ -1246,7 +1250,7 @@ describe('GoalService', () => {it('respects a manually paused responsible task without rerunning it', async () => {const service = new GoalService(serverDB, userId);const taskModel = new TaskModel(serverDB, userId);- const graph = await service.create({ title: 'Paused work', work: ['Wait for review'] });+ const graph = await service.create({ tasks: ['Wait for review'], title: 'Paused task' });const created = await service.tick(graph.goal.id);await taskModel.updateStatus(created.taskId!, 'paused', { error: null });@@ -1259,7 +1263,7 @@ describe('GoalService', () => {expect((await service.graph(graph.goal.id)).decisions).toHaveLength(0);});- it('only selects work whose explicit dependencies are resolved', async () => {+ it('only selects Tasks whose explicit dependencies are resolved', async () => {const service = new GoalService(serverDB, userId);const graph = await service.create({ title: 'Dependency-aware goal' });const prerequisite = await service.addNode(graph.goal.id, {diff --git a/apps/server/src/services/goal/index.ts b/apps/server/src/services/goal/index.tsindex 46b1c46fe57..50aba38fce4 100644--- a/apps/server/src/services/goal/index.ts+++ b/apps/server/src/services/goal/index.ts@@ -38,6 +38,7 @@ import {frontierNeedsBudget,GOAL_ACCEPTANCE_TASK_TITLE,type GoalMove,+ LEASE_EXPIRED_ERROR,selectFrontier,TERMINAL_NODE_STATUSES,} from './decideNextMove';@@ -60,7 +61,7 @@ const TASK_DESCRIPTION_MAX_LENGTH = 255;/** Advisory-lock namespace for goal dispatch. `0x676f_6469` is ASCII `godi`. */const GOAL_DISPATCH_LOCK_NAMESPACE = 0x67_6f_64_69;-export interface CreateGoalWorkInput {+export interface CreateGoalTaskInput {description?: string;title: string;}@@ -77,9 +78,9 @@ export interface CreateGoalGraphInput {/*** Structured acceptance criteria. Persisted as `verify_criteria` rows and* recorded on `config.acceptance.criteriaIds`, so the goal page can show and- * edit them and the terminal Goal-acceptance Work verifies against exactly+ * edit them and the terminal Goal-acceptance Task verifies against exactly* these checks. Callers still fold the same criteria into `requirement`- * prose — that text remains what every Work's execution context reads.+ * prose — that text remains what every Task's execution context reads.*/criteria?: Array<{ description?: string; instruction?: string; title: string }>;maxRounds?: number;@@ -92,12 +93,12 @@ export interface CreateGoalGraphInput {problemDescription?: string;projectId?: string;requirement?: string;- title: string;/**- * Seed Work nodes, in dependency-free order. A plain string is title-only.+ * Seed task nodes, in dependency-free order. A plain string is title-only.* When omitted, the coordinator plans the decomposition on first advance.*/- work?: Array<CreateGoalWorkInput | string>;+ tasks?: Array<CreateGoalTaskInput | string>;+ title: string;}export interface CreateGoalNodeInput {@@ -118,8 +119,8 @@ export class GoalService {*/private readonly graphModel: GoalGraphModel;/**- * Graph writes the coordinator makes on its own — claiming Work, binding its- * task, synthesizing a finding, opening a gate. Attributed to the coordinator+ * Graph writes the coordinator makes on its own — claiming a Task node,+ * binding its task, synthesizing a finding, opening a gate. Attributed to the coordinator* even when a person pressed Advance: they asked it to run, they did not make* these moves.*/@@ -172,13 +173,13 @@ export class GoalService {if (!project) throw new TRPCError({ code: 'NOT_FOUND', message: 'Project not found' });}// Persist the structured acceptance criteria first: their ids ride on the- // goal config so the page can edit them and the terminal acceptance Work+ // goal config so the page can edit them and the terminal acceptance Task// is gated on exactly these checks (not an AI re-derivation of the prose).let config = input.config;let requirement = input.requirement;if (input.criteria?.length) {// The prose requirement must keep carrying the full standard (the goal- // page's 什么算完成 block and every Work's execution context read it).+ // page's 什么算完成 block and every Task's execution context read it).// Callers normally compose it via `buildGoalRequirement`; guard API// callers that pass criteria with a bare requirement.const carriesCriteria = input.criteria.every((item) =>@@ -231,16 +232,16 @@ export class GoalService {});if (!problem) throw new Error('Failed to seed goal problem');- for (const seed of input.work ?? []) {+ for (const seed of input.tasks ?? []) {const { description, title } = typeof seed === 'string' ? { title: seed } : seed;- const work = await authorGraph.createNode(goal.id, {+ const taskNode = await authorGraph.createNode(goal.id, {createdByAgentId: input.createdByAgentId,description,kind: 'task',title,});- if (!work) throw new Error('Failed to seed goal work');- await authorGraph.createEdge(goal.id, problem.id, work.id, 'decomposes');+ if (!taskNode) throw new Error('Failed to seed goal task');+ await authorGraph.createEdge(goal.id, problem.id, taskNode.id, 'decomposes');}} catch (error) {await this.goalModel.delete(goal.id).catch(() => {});@@ -261,7 +262,7 @@ export class GoalService {config: { ...goal.config, acceptance: { criteriaIds } },});- // A terminal Goal-acceptance Work may already be dispatched — its+ // A terminal Goal-acceptance Task may already be dispatched — its// Acceptance row snapshotted the previous id list. Rebind it too, or the// page would present the new criteria as gates while the verifier keeps// materializing plans from the stale list. A verify round already@@ -362,7 +363,7 @@ export class GoalService {/*** Stop everything the goal has running, then delete it and its graph.*- * Deleting only the goal row cascades the graph away but leaves each Work+ * Deleting only the goal row cascades the graph away but leaves each graph* Task — and the agent operation behind it — running, spending the user's* budget with nothing left on screen to stop it. The tasks themselves stay:* they are ordinary tasks with their own history and acceptance.@@ -439,7 +440,7 @@ export class GoalService {/*** What the goal has spent against what it is allowed to spend.*- * Rounds are counted across every Work Task in the graph, not per Work — the+ * Rounds are counted across every Task in the graph, not per Task — the* budget is the goal's, so `setBudget` has to read it exactly the way the* coordinator does or raising a budget would not reliably unstick a goal.*@@ -465,8 +466,8 @@ export class GoalService {/*** Edit the goal's standing acceptance requirement in place. The next- * coordinator move and every later dispatched Work read the updated text;- * already-running Work keeps the contract it was dispatched with.+ * coordinator move and every later dispatched Task read the updated text;+ * an already-running Task keeps the contract it was dispatched with.*/updateRequirement = async (goalId: string, requirement: string) => {const goal = await this.goalModel.update(goalId, { requirement });@@ -676,7 +677,7 @@ export class GoalService {// sweep's window. A `running` goal that always reports `no_progress` is// picked by every scan forever, and enough of them starve every other// stalled goal out of the newest-first limit.- await this.transitionStatus(graph.goal, 'paused', 'no eligible work to advance');+ await this.transitionStatus(graph.goal, 'paused', 'no eligible task to advance');effects.push({ type: 'goal_status', detail: 'paused' });return observe({ goalId, message: move.message, outcome: move.outcome });}@@ -772,8 +773,8 @@ export class GoalService {};/**- * Create the Goal-level acceptance Work, or read the verdict it already- * reached. Only runs once every other Work is terminal.+ * Create the Goal-level acceptance Task, or read the verdict it already+ * reached. Only runs once every other Task is terminal.*/private settleTerminalAcceptance = async (graph: GoalGraphSnapshot,@@ -784,7 +785,7 @@ export class GoalService {if (move.outcome === 'achieved') {// The map must agree with the verdict: only task nodes get resolved as- // Work completes, so without this the seeded problem nodes would read+ // Tasks complete, so without this the seeded problem nodes would read// "active / unanswered" forever on an achieved goal.for (const node of graph.nodes) {if (node.kind !== 'problem' || TERMINAL_NODE_STATUSES.has(node.status)) continue;@@ -804,7 +805,7 @@ export class GoalService {description: [`Complete and prove the overall Goal acceptance requirement: ${graph.goal.requirement}`,'Inspect and reuse existing Goal findings, artifacts, metrics, and command results as the primary evidence. Do not repeat expensive or destructive work when the existing evidence is sufficient and still auditable.',- 'Explicitly close every remaining acceptance gap instead of treating completed upstream Work as proof that the whole Goal is achieved. Run only the missing or stale checks needed to close those gaps.',+ 'Explicitly close every remaining acceptance gap instead of treating completed upstream Tasks as proof that the whole Goal is achieved. Run only the missing or stale checks needed to close those gaps.','Return one auditable final delivery with evidence for every requirement. If a requirement cannot be satisfied, state the exact gap and the minimum next action; do not claim the Goal is complete.',].join('\n\n'),kind: 'task',@@ -814,7 +815,7 @@ export class GoalService {if (!result) {return {goalId,- message: 'Could not create the Goal-level acceptance Work',+ message: 'Could not create the Goal-level acceptance Task',outcome: 'no_progress',};}@@ -828,14 +829,14 @@ export class GoalService {return {goalId,message: result.created- ? 'Created Goal-level acceptance Work for the remaining contract'- : 'Goal-level acceptance Work was created by another coordinator',+ ? 'Created Goal-level acceptance Task for the remaining contract'+ : 'Goal-level acceptance Task was created by another coordinator',nodeId: result.node.id,outcome: 'advanced',};};- /** Claim the chosen Work and give it a responsible task plus its acceptance contract. */+ /** Claim the chosen Task node and give it a responsible task plus its acceptance contract. */private createResponsibleTask = async (graph: GoalGraphSnapshot,frontier: GoalGraphNode,@@ -855,7 +856,7 @@ export class GoalService {goalId,message: current?.taskId? 'Responsible task was created by another coordinator'- : 'Work node is being claimed by another coordinator',+ : 'Task node is being claimed by another coordinator',nodeId: frontier.id,outcome: 'waiting_external',taskId: current?.taskId ?? undefined,@@ -874,10 +875,10 @@ export class GoalService {name: frontier.title,projectId: graph.goal.projectId ?? undefined,});- // The terminal Goal-acceptance Work is gated on the goal's structured+ // The terminal Goal-acceptance Task is gated on the goal's structured// criteria when it has them: the verify plan materializes exactly those// rows (deterministic checklist) instead of AI-deriving checks from the- // requirement prose. Ordinary Work keeps the prose-scoped contract.+ // requirement prose. Ordinary Tasks keep the prose-scoped contract.const goalCriteriaIds =frontier.title === GOAL_ACCEPTANCE_TASK_TITLE? graph.goal.config?.acceptance?.criteriaIds@@ -944,8 +945,8 @@ export class GoalService {};/**- * Automatic recovery after a Work delivery failed verification. Spends the- * Work's remaining attempt budget before it escalates to a person.+ * Automatic recovery after a Task delivery failed verification. Spends the+ * Task's remaining attempt budget before it escalates to a person.*/private recoverAfterVerification = async (graph: GoalGraphSnapshot,@@ -968,7 +969,7 @@ export class GoalService {goalId,nodeId,'active',- 'Automatically started the next Work attempt after verification feedback',+ 'Automatically started the next Task attempt after verification feedback',);await this.transitionStatus(graph.goal, 'running', 'automatic recovery started a run');// Only when this advance is the one that spawned the run. Reporting it@@ -996,7 +997,7 @@ export class GoalService {recovery.outcome === 'exhausted-cost'? 'Goal cost budget was exhausted': recovery.outcome === 'exhausted-rounds'- ? 'Work attempt budget was exhausted'+ ? 'Task attempt budget was exhausted': 'Automatic recovery could not start the next attempt';return this.openFailureDecision(graph, nodeId, task.id, exhaustedReason, effects);};@@ -1013,7 +1014,7 @@ export class GoalService {// Advances arrive from independent sources — an event hook, a manual nudge,// the sweep — and can overlap. `runTask` decides whether a run is already// in flight by reading the task's topics and only then creating one, so two- // overlapping advances would both dispatch this Work and pay for it twice.+ // overlapping advances would both dispatch this Task and pay for it twice.// Claim the task first: the transition is a single conditional UPDATE, so// exactly one advance can win it.//@@ -1083,7 +1084,7 @@ export class GoalService {};} catch (error) {// We claimed the task, so nothing else will put it back. Release it or the- // Work stays 'running' with no run behind it and only the lease reclaims it.+ // Task stays 'running' with no run behind it and only the lease reclaims it.await this.taskModel.updateStatusIfCurrent(task.id, 'running', task.status).catch((releaseError) => {@@ -1130,7 +1131,7 @@ export class GoalService {const staleBefore = new Date(Date.now() - resolveOperationLeaseTimeout(graph.goal));if (!operationId || !topicId) {- // No running topic covers two very different shapes. A verify-bound Work+ // No running topic covers two very different shapes. A verify-bound Task// that delivered keeps its task `running` with a *completed* topic until// the verify run settles, and that judgment — a full agent run — outlives// the operation lease routinely. Re-dispatching there pays for a duplicate@@ -1185,7 +1186,7 @@ export class GoalService {'timeout',);await new TaskModel(tx, this.userId, this.workspaceId).updateStatus(task.id, 'paused', {- error: 'Goal Work operation lease expired.',+ error: LEASE_EXPIRED_ERROR,});return true;});@@ -1210,9 +1211,9 @@ export class GoalService {graph.goal.id,nodeId,'active',- 'Recovered an abandoned Work operation and started the next attempt',+ 'Recovered an abandoned Task operation and started the next attempt',);- await this.transitionStatus(graph.goal, 'running', 'reclaimed an abandoned Work');+ await this.transitionStatus(graph.goal, 'running', 'reclaimed an abandoned Task');if (recovery.outcome === 'started') {effects.push({detail: 'abandoned operation retry',@@ -1235,7 +1236,7 @@ export class GoalService {recovery.outcome === 'exhausted-cost'? 'Goal cost budget was exhausted after an operation was abandoned': recovery.outcome === 'exhausted-rounds'- ? 'Work attempt budget was exhausted after an operation was abandoned'+ ? 'Task attempt budget was exhausted after an operation was abandoned': 'Automatic recovery could not restart an abandoned operation';return this.openFailureDecision(graph, nodeId, task.id, reason, effects);};@@ -1250,11 +1251,11 @@ export class GoalService {graph.goal.requirement? `Overall goal acceptance context (background only): ${graph.goal.requirement}`: undefined,- `Current Work contract (authoritative execution scope): ${title}`,+ `Current Task contract (authoritative execution scope): ${title}`,description,- 'Execute only the Current Work contract. Do not implement, validate, or pre-empt any sibling or downstream Work node, even when the overall goal context describes it.',- 'The complete requirements for this Work are included here. Do not inspect unrelated agent documents to recover requirements. Do not invoke Acceptance skills or Acceptance CLI commands during the main Work; a dedicated post-run phase will ask you to submit your evidence before an independent verifier judges it.',- 'Create implementation-level subtasks when useful. Finish the operation once the Current Work deliverable and its concrete evidence are ready; Acceptance verification will decide whether this Task is complete.',+ 'Execute only the Current Task contract. Do not implement, validate, or pre-empt any sibling or downstream Task node, even when the overall goal context describes it.',+ 'The complete requirements for this Task are included here. Do not inspect unrelated agent documents to recover requirements. Do not invoke Acceptance skills or Acceptance CLI commands during the main Task; a dedicated post-run phase will ask you to submit your evidence before an independent verifier judges it.',+ 'Create implementation-level subtasks when useful. Finish the operation once the Current Task deliverable and its concrete evidence are ready; Acceptance verification will decide whether this Task is complete.','Make the final delivery self-contained for an independent verifier that may not have workspace access. Include the relevant artifact contents or exact excerpts and the raw outputs of decisive verification commands; file paths and claims that checks passed are not sufficient evidence by themselves.','Return the produced artifacts, evidence, key findings, and the recommended next action. Do not mark the overall Goal complete.',]@@ -1262,9 +1263,9 @@ export class GoalService {.join('\n\n');/**- * Turn a goal with no work into an explorable structure: the LLM plans the+ * Turn a goal with no tasks into an explorable structure: the LLM plans the* core question plus 1–5 independent directions, each carrying only its own- * deliverable requirements. A planning failure degrades to one work seeded+ * deliverable requirements. A planning failure degrades to one task seeded* from the raw requirement — the goal must never stall on its planner.*/private planDecomposition = async (graph: GoalGraphSnapshot, effects: GoalAdvanceEffect[]) => {@@ -1273,7 +1274,7 @@ export class GoalService {const requirement = graph.goal.requirement ?? problem?.description ?? graph.goal.title;// Two advances can reach this branch together — the queued kickoff and the- // client's fire-and-forget fallback both see zero Works. The conditional+ // client's fire-and-forget fallback both see zero Tasks. The conditional// `planning → running` write is the claim: the loser stops before even// calling the planner, so nothing double-plans and nothing double-pays.// `waiting_external` ends its advance loop — the winner carries the goal.@@ -1294,7 +1295,7 @@ export class GoalService {const generator = new GoalCriteriaGeneratorService(this.db, this.userId, this.workspaceId);const plan = await generator.decompose({ requirement }).catch(() => undefined);- // Rare shape: a goal already past `planning` whose Works were all removed.+ // Rare shape: a goal already past `planning` whose Tasks were all removed.// There is no status edge to claim on that path, so shrink the duplicate// window to the instant before the inserts with a re-read instead.if (graph.goal.status !== 'planning') {@@ -1308,7 +1309,7 @@ export class GoalService {}}- const works: GoalDecompositionDraft['works'] = plan?.works ?? [+ const draftTasks: GoalDecompositionDraft['tasks'] = plan?.tasks ?? [{ instruction: problem?.description ?? requirement, title: graph.goal.title },];@@ -1319,27 +1320,27 @@ export class GoalService {}const createdIds: (string | undefined)[] = [];- for (const work of works) {+ for (const draft of draftTasks) {const node = await this.coordinatorGraph.createNode(goalId, {- description: work.instruction,+ description: draft.instruction,kind: 'task',- title: work.title,+ title: draft.title,});createdIds.push(node?.id);if (!node) continue;if (problem)await this.coordinatorGraph.createEdge(goalId, problem.id, node.id, 'decomposes');- effects.push({ nodeId: node.id, type: 'created_node', detail: work.title });+ effects.push({ nodeId: node.id, type: 'created_node', detail: draft.title });}// The planner's `dependsOn` indices become `depends_on` edges, drawn// dependent → prerequisite the way `decideNextMove` reads a blocker. Only// earlier indices are honoured, so a hallucinated forward or self reference// can never form a cycle that deadlocks the frontier.- for (const [index, work] of works.entries()) {+ for (const [index, draft] of draftTasks.entries()) {const nodeId = createdIds[index];if (!nodeId) continue;- for (const dep of new Set(work.dependsOn ?? [])) {+ for (const dep of new Set(draft.dependsOn ?? [])) {const prerequisiteId = dep < index ? createdIds[dep] : undefined;if (!prerequisiteId) continue;await this.coordinatorGraph.createEdge(goalId, nodeId, prerequisiteId, 'depends_on');@@ -1349,8 +1350,8 @@ export class GoalService {return {goalId,message: plan- ? `Planned ${works.length} exploration direction${works.length > 1 ? 's' : ''}`- : 'Planner unavailable; seeded a single work from the requirement',+ ? `Planned ${draftTasks.length} exploration direction${draftTasks.length > 1 ? 's' : ''}`+ : 'Planner unavailable; seeded a single task from the requirement',outcome: 'advanced' as const,};};@@ -1374,13 +1375,13 @@ export class GoalService {// The full goal requirement (with its numbered acceptance list) is NOT// injected here: it belongs to the terminal acceptance task above, and- // pasting it into every Work made each task's acceptance read as the whole- // contract. A Work is judged on its own outcome only.+ // pasting it into every Task made each task's acceptance read as the whole+ // contract. A Task is judged on its own outcome only.return [- `Verify only this Work: ${title}.`,- description ? `Required Work outcome: ${description}` : undefined,- `This Work is one direction of the Goal "${graph.goal.title}"; the full Goal contract is verified separately at the end.`,- 'Pass only when the current Work deliverable is complete and supported by concrete evidence. Ignore sibling and downstream Work deliverables; they are verified by their own Tasks.',+ `Verify only this Task: ${title}.`,+ description ? `Required Task outcome: ${description}` : undefined,+ `This Task is one direction of the Goal "${graph.goal.title}"; the full Goal contract is verified separately at the end.`,+ 'Pass only when the current Task deliverable is complete and supported by concrete evidence. Ignore sibling and downstream Task deliverables; they are verified by their own acceptance runs.',].filter(Boolean).join('\n\n');diff --git a/apps/server/src/services/goal/recoveryPolicy.ts b/apps/server/src/services/goal/recoveryPolicy.tsindex 730c4284030..960acd67f66 100644--- a/apps/server/src/services/goal/recoveryPolicy.ts+++ b/apps/server/src/services/goal/recoveryPolicy.ts@@ -1,6 +1,6 @@import type { GoalItem } from '@lobechat/types';-const DEFAULT_MAX_ATTEMPTS_PER_WORK = 3;+const DEFAULT_MAX_ATTEMPTS_PER_TASK = 3;/*** Conservative on purpose: enough to stop independent Tasks queueing behind one* another, low enough that a goal cannot empty its budget in one fan-out before@@ -15,7 +15,7 @@ const DEFAULT_OPERATION_LEASE_TIMEOUT_MS = 5 * 60 * 1000;export const MIN_OPERATION_LEASE_TIMEOUT_MS = 3 * 60 * 1000;/**- * How long a delivered Work may sit with verification pending before the+ * How long a delivered Task may sit with verification pending before the* coordinator treats the delivery as abandoned and re-dispatches. The verify* judge is a full agent run — tens of minutes on a large delivery — so this* sits far above the operation lease, which is scaled to heartbeat gaps, not@@ -23,11 +23,11 @@ export const MIN_OPERATION_LEASE_TIMEOUT_MS = 3 * 60 * 1000;*/export const VERIFY_SETTLE_GRACE_MS = 60 * 60 * 1000;-/** How many attempts one Work gets before the coordinator opens a decision gate. */+/** How many attempts one Task gets before the coordinator opens a decision gate. */export const resolveTaskAttemptBudget = (goal: GoalItem): number => {const configured = goal.config?.recovery?.maxAttemptsPerTask;if (typeof configured === 'number') return Math.max(1, configured);- return DEFAULT_MAX_ATTEMPTS_PER_WORK;+ return DEFAULT_MAX_ATTEMPTS_PER_TASK;};/** How many of this goal's Tasks may run at once. */diff --git a/apps/server/src/services/goal/replayCoordinator.test.ts b/apps/server/src/services/goal/replayCoordinator.test.tsindex 3966b0942a7..7e1742caeff 100644--- a/apps/server/src/services/goal/replayCoordinator.test.ts+++ b/apps/server/src/services/goal/replayCoordinator.test.ts@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest';import { replayGoalAgainstCurrentCoordinator } from './replayCoordinator';-const work = (id: string, overrides: Partial<GoalGraphState['nodes'][number]> = {}) => ({+const task = (id: string, overrides: Partial<GoalGraphState['nodes'][number]> = {}) => ({createdAt: 1000,id,kind: 'task',@@ -51,7 +51,7 @@ const tick = (index: number, overrides: Partial<GoalTickSnapshot>): GoalTickSnap});/**- * Two advances of a two-Work goal: the second Work depends on the first, so the+ * Two advances of a two-Task goal: the second Task depends on the first, so the* coordinator picks `a`, then picks `b` only once `a` resolves.*/const trajectory: GoalTrajectory = {@@ -81,7 +81,7 @@ const trajectory: GoalTrajectory = {tick(0, {candidates: [{ blockedBy: [], nodeId: 'b', priority: 0, status: 'proposed', title: 'b' }],chosenNodeId: 'b',- graphDelta: { nodesUpserted: [work('a', { status: 'resolved' })] },+ graphDelta: { nodesUpserted: [task('a', { status: 'resolved' })] },}),],trigger: 'settle',@@ -90,7 +90,7 @@ const trajectory: GoalTrajectory = {goalId: 'goal_1',graphBaseline: graphState({edges: [{ id: 'e1', kind: 'depends_on', sourceNodeId: 'b', targetNodeId: 'a' }],- nodes: [work('a'), work('b')],+ nodes: [task('a'), task('b')],}),startedAt: 0,title: 'Reproduce nanoGPT',@@ -163,7 +163,7 @@ describe('replayGoalAgainstCurrentCoordinator', () => {],graphBaseline: graphState({edges: [{ id: 'e1', kind: 'depends_on', sourceNodeId: 'b', targetNodeId: 'a' }],- nodes: [work('a', { taskId: 'task_1' }), work('b')],+ nodes: [task('a', { taskId: 'task_1' }), task('b')],}),};diff --git a/apps/server/src/services/goal/scheduler/index.ts b/apps/server/src/services/goal/scheduler/index.tsindex 36ea6d5d379..1b35d490f16 100644--- a/apps/server/src/services/goal/scheduler/index.ts+++ b/apps/server/src/services/goal/scheduler/index.ts@@ -8,7 +8,7 @@ const log = debug('goal-scheduler');* Ask the coordinator to advance a goal, without waiting for it.** Every caller is a place where a goal *might* now be able to move — it was- * created, a gate was resolved, a budget was raised, a Work Task settled. None+ * created, a gate was resolved, a budget was raised, a graph Task settled. None* of them should fail because the advance could not be queued, and none of them* should block on it: the handler re-reads the goal, and the sweep picks up* anything a lost message would have stranded.diff --git a/apps/server/src/services/goal/taskRecoveryCoordinator.ts b/apps/server/src/services/goal/taskRecoveryCoordinator.tsindex ff57199f89b..f0a0a5ddf43 100644--- a/apps/server/src/services/goal/taskRecoveryCoordinator.ts+++ b/apps/server/src/services/goal/taskRecoveryCoordinator.ts@@ -8,7 +8,7 @@ import { TaskRunnerService } from '@/server/services/taskRunner';import { resolveTaskAttemptBudget, resolveTaskMaxSteps } from './recoveryPolicy';-const log = debug('lobe-server:goal-work-recovery');+const log = debug('lobe-server:goal-task-recovery');export type TaskRecoveryOutcome =/** This call spawned the retry, and `operationId` is its run. */@@ -20,7 +20,7 @@ export type TaskRecoveryOutcome =| 'spawn-failed';/**- * `started` and `already-running` both mean "the Work is moving, keep waiting",+ * `started` and `already-running` both mean "the Task is moving, keep waiting",* but only the first is something *this* advance did. They used to share the* name `continued`, which made the trajectory claim a run it had not started* and drop the operation id of the one it had.@@ -31,7 +31,7 @@ export interface TaskRecoveryResult {outcome: TaskRecoveryOutcome;}-/** Retry budget and spawn boundary for a Goal Graph Work Task. */+/** Retry budget and spawn boundary for a Goal Graph Task. */export class TaskRecoveryCoordinator {constructor(private readonly db: LobeChatDatabase,@@ -62,7 +62,7 @@ export class TaskRecoveryCoordinator {// reach here from `tick`, and advances overlap: an event hook, a manual// nudge, the sweep. `runTask` decides whether a run is in flight by reading// the task's topics before creating one, so without this claim two- // coordinators would each spawn a paid retry of the same Work.+ // coordinators would each spawn a paid retry of the same Task.//// Both paths hand us a task row read before they paused it, so the claim// has to compare against what the row says now. A task already `running`diff --git a/apps/server/src/services/taskLifecycle/index.ts b/apps/server/src/services/taskLifecycle/index.tsindex 34f303e3b87..c398763ac3b 100644--- a/apps/server/src/services/taskLifecycle/index.ts+++ b/apps/server/src/services/taskLifecycle/index.ts@@ -199,13 +199,13 @@ export class TaskLifecycleService {// The agent-driven `createBrief` tool path stays the default until// the GrowthBook flag flips. See for the rollout plan.//- // Goal Work rounds are deliberately silent. The coordinator can run- // many attempts on one Work before it converges, and a card per round+ // Goal Task rounds are deliberately silent. The coordinator can run+ // many attempts on one Task before it converges, and a card per round// buries the one moment that actually needs the user — the decision// gate the coordinator opens when the attempt budget runs out.const isGoalLoopRound =!!currentTask &&- !!(await new GoalModel(this.db, this.userId, this.workspaceId).findByWorkTask(+ !!(await new GoalModel(this.db, this.userId, this.workspaceId).findByGraphTask(currentTask.id,));if (diff --git a/apps/server/src/services/taskLifecycle/onTopicComplete.test.ts b/apps/server/src/services/taskLifecycle/onTopicComplete.test.tsindex 28632ff6f16..e2e2d711ab1 100644--- a/apps/server/src/services/taskLifecycle/onTopicComplete.test.ts+++ b/apps/server/src/services/taskLifecycle/onTopicComplete.test.ts@@ -30,9 +30,9 @@ vi.mock('@/database/models/verifyRun', () => ({// Goal-loop rounds suppress the per-topic brief; onTopicComplete asks the// goals table whether this task carries a goal. Default = plain task.-const goalFindByWorkTask = vi.fn().mockResolvedValue(undefined);+const goalFindByGraphTask = vi.fn().mockResolvedValue(undefined);vi.mock('@/database/models/goal', () => ({- GoalModel: vi.fn(() => ({ findByWorkTask: goalFindByWorkTask })),+ GoalModel: vi.fn(() => ({ findByGraphTask: goalFindByGraphTask })),}));// Error-brief copy is localized at the source via the server translator; mock itdiff --git a/apps/server/src/services/taskRunner/buildTaskPrompt.test.ts b/apps/server/src/services/taskRunner/buildTaskPrompt.test.tsindex d74374cae89..3eb1477776e 100644--- a/apps/server/src/services/taskRunner/buildTaskPrompt.test.ts+++ b/apps/server/src/services/taskRunner/buildTaskPrompt.test.ts@@ -28,7 +28,7 @@ afterEach(async () => {});describe('buildTaskPrompt Goal loop context', () => {- it('uses the per-Work attempt budget for a Goal Graph Work Task', async () => {+ it('uses the per-Task attempt budget for a Goal Graph Task', async () => {const taskModel = new TaskModel(db, userId);const task = await taskModel.create({instruction: 'Close the remaining acceptance gap.',diff --git a/apps/server/src/services/taskRunner/buildTaskPrompt.ts b/apps/server/src/services/taskRunner/buildTaskPrompt.tsindex 169dc90e217..da5bd761632 100644--- a/apps/server/src/services/taskRunner/buildTaskPrompt.ts+++ b/apps/server/src/services/taskRunner/buildTaskPrompt.ts@@ -31,7 +31,7 @@ const resolveGoalLoopContext = async (deps: BuildTaskPromptDeps,): Promise<TaskRunPromptGoalLoop | undefined> => {const { db, userId, workspaceId } = deps;- const goal = await new GoalModel(db, userId, workspaceId).findByWorkTask(task.id);+ const goal = await new GoalModel(db, userId, workspaceId).findByGraphTask(task.id);if (!goal || !task.totalTopics) return undefined;const budget = resolveTaskAttemptBudget(goal);diff --git a/apps/server/src/services/verify/acceptanceService.ts b/apps/server/src/services/verify/acceptanceService.tsindex bff15a5af8f..e2d3bcf8084 100644--- a/apps/server/src/services/verify/acceptanceService.ts+++ b/apps/server/src/services/verify/acceptanceService.ts@@ -778,7 +778,7 @@ export class AcceptanceService {* agent-bound rounds via the repair pipeline, for ingested rounds via the* next `lh verify ingest-report`.)*- * A Goal Work Task is no exception: its next attempt is started by the Goal+ * A Goal Task is no exception: its next attempt is started by the Goal* coordinator on the following tick, which reads the rejected round's* decision detail through the prompt builder.*/diff --git a/apps/server/src/services/verify/planInstantiation.ts b/apps/server/src/services/verify/planInstantiation.tsindex eb9426f8bb4..9be0fb81827 100644--- a/apps/server/src/services/verify/planInstantiation.ts+++ b/apps/server/src/services/verify/planInstantiation.ts@@ -67,7 +67,7 @@ export const instantiateVerifyPlanOnStart = async (const goal = task?.instruction ?? task?.name ?? '';const planGenerator = new VerifyPlanGeneratorService(db, userId, workspaceId);- // Undecomposed acceptance (goal-dispatched Work, one-sentence requirement):+ // Undecomposed acceptance (goal-dispatched Task, one-sentence requirement):// spend one generation call splitting the requirement into named criteria,// so the checklist reads as distinguishable items instead of one generic// "Task delivery acceptance" row.diff --git a/apps/server/src/services/verify/settle.ts b/apps/server/src/services/verify/settle.tsindex 41363308b36..ac96639c075 100644--- a/apps/server/src/services/verify/settle.ts+++ b/apps/server/src/services/verify/settle.ts@@ -100,7 +100,7 @@ export const driveTaskFromVerify = async (if (run.status === 'passed') {// Verify passing completes the task and cascades (checkpoint / sibling- // rollup / downstream unlock). A Goal Graph Work Task is an ordinary task+ // rollup / downstream unlock). A Goal Graph Task is an ordinary task// here — the coordinator reads its completed status on the next tick and// synthesizes the finding from it.if (task.automationMode) {@@ -126,7 +126,7 @@ export const driveTaskFromVerify = async (// `Delivery did not pass verification.` is a contract string, not just// copy: the Goal coordinator matches on it to decide whether a paused- // Work Task should start another attempt or open a decision gate.+ // Goal Task should start another attempt or open a decision gate.const pauseSummary = isErrored? 'Verification could not run (internal error); the delivery was not evaluated.': 'Delivery did not pass verification.';@@ -167,13 +167,13 @@ export const driveTaskFromVerify = async ();}- // A Goal Work Task settling is the event the coordinator waits on: it+ // A Goal Task settling is the event the coordinator waits on: it// decides whether to synthesize a finding, start another attempt, or open a// decision gate. Queue the advance so the goal keeps moving on its own —// this is the server-side driver for long-horizon goals, and without it a// goal only progresses while some client keeps ticking it.try {- const goal = await new GoalModel(db, userId, workspaceId).findByWorkTask(+ const goal = await new GoalModel(db, userId, workspaceId).findByGraphTask(taskOperation.taskId,);if (goal) {diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 1b962216f74..01588848d57 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -467,7 +467,7 @@"goalList.loadError": "Could not load goals","goalList.loadErrorDescription": "The service is temporarily unavailable. Your goals are not lost.","goalList.needsYou": "{{count}} need you",- "goalList.noWork": "No tasks yet",+ "goalList.noTasks": "No tasks yet","goalList.retry": "Retry","goalList.roundProgress": "Round {{current}}/{{total}}","goalList.status.achieved": "Achieved",@@ -479,8 +479,8 @@"goalList.status.running": "Pursuing","goalList.status.verifying": "Verifying","goalList.status.waiting": "Waiting",+ "goalList.taskProgress": "{{done}}/{{total}} tasks done","goalList.title": "Goals",- "goalList.workProgress": "{{done}}/{{total}} tasks done","goalPage.activeGoals": "Open goals","goalPage.allGoals": "All goals","goalPage.create": "Create goal",@@ -641,19 +641,19 @@"goalProcess.tag.lost": "Lost","goalProcess.tag.needsDecision": "Needs your decision","goalProcess.tag.retired": "Retired",- "goalWork.checks": "{{passed}}/{{total}} checks passed",- "goalWork.round": "Round {{current}}",- "goalWork.roundWithBudget": "Round {{current}}/{{total}}",- "goalWork.status.achieved": "Achieved",- "goalWork.status.canceled": "Canceled",- "goalWork.status.error": "Needs attention",- "goalWork.status.paused": "Paused",- "goalWork.status.repairing": "Repairing",- "goalWork.status.review": "Pending acceptance",- "goalWork.status.running": "Executing",- "goalWork.status.verifying": "Verifying",- "goalWork.status.waiting": "Waiting",- "goalWork.workDone": "{{passed}}/{{total}} tasks done",+ "goalTask.checks": "{{passed}}/{{total}} checks passed",+ "goalTask.round": "Round {{current}}",+ "goalTask.roundWithBudget": "Round {{current}}/{{total}}",+ "goalTask.status.achieved": "Achieved",+ "goalTask.status.canceled": "Canceled",+ "goalTask.status.error": "Needs attention",+ "goalTask.status.paused": "Paused",+ "goalTask.status.repairing": "Repairing",+ "goalTask.status.review": "Pending acceptance",+ "goalTask.status.running": "Executing",+ "goalTask.status.verifying": "Verifying",+ "goalTask.status.waiting": "Waiting",+ "goalTask.tasksDone": "{{passed}}/{{total}} tasks done","grokBuildInstallGuide.actions.openDocs": "Open Install Guide","grokBuildInstallGuide.actions.openSystemTools": "Open System Tools","grokBuildInstallGuide.afterInstall": "After installing, run `grok login`, then retry your message or click Re-detect in System Tools.",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 1fb9543e858..30c724e87fa 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -467,7 +467,7 @@"goalList.loadError": "无法加载目标","goalList.loadErrorDescription": "服务暂时不可用,你的目标没有丢失。","goalList.needsYou": "{{count}} 项需要你",- "goalList.noWork": "还没有任务",+ "goalList.noTasks": "还没有任务","goalList.retry": "重试","goalList.roundProgress": "第 {{current}}/{{total}} 轮","goalList.status.achieved": "已达成",@@ -479,8 +479,8 @@"goalList.status.running": "追逐中","goalList.status.verifying": "验证中","goalList.status.waiting": "等待中",+ "goalList.taskProgress": "{{done}}/{{total}} 项任务完成","goalList.title": "目标",- "goalList.workProgress": "{{done}}/{{total}} 项任务完成","goalPage.activeGoals": "待处理目标","goalPage.allGoals": "全部目标","goalPage.create": "创建目标",@@ -641,19 +641,19 @@"goalProcess.tag.lost": "失联","goalProcess.tag.needsDecision": "等你决定","goalProcess.tag.retired": "已放弃",- "goalWork.checks": "{{passed}}/{{total}} 项通过",- "goalWork.round": "第 {{current}} 轮",- "goalWork.roundWithBudget": "第 {{current}}/{{total}} 轮",- "goalWork.status.achieved": "已达成",- "goalWork.status.canceled": "已取消",- "goalWork.status.error": "需要处理",- "goalWork.status.paused": "已暂停",- "goalWork.status.repairing": "修复中",- "goalWork.status.review": "待验收",- "goalWork.status.running": "执行中",- "goalWork.status.verifying": "验证中",- "goalWork.status.waiting": "等待中",- "goalWork.workDone": "{{passed}}/{{total}} 项任务完成",+ "goalTask.checks": "{{passed}}/{{total}} 项通过",+ "goalTask.round": "第 {{current}} 轮",+ "goalTask.roundWithBudget": "第 {{current}}/{{total}} 轮",+ "goalTask.status.achieved": "已达成",+ "goalTask.status.canceled": "已取消",+ "goalTask.status.error": "需要处理",+ "goalTask.status.paused": "已暂停",+ "goalTask.status.repairing": "修复中",+ "goalTask.status.review": "待验收",+ "goalTask.status.running": "执行中",+ "goalTask.status.verifying": "验证中",+ "goalTask.status.waiting": "等待中",+ "goalTask.tasksDone": "{{passed}}/{{total}} 项任务完成","grokBuildInstallGuide.actions.openDocs": "打开安装指南","grokBuildInstallGuide.actions.openSystemTools": "打开系统工具","grokBuildInstallGuide.afterInstall": "安装完成后,请运行 `grok login` 登录,然后重试刚才的消息,或在系统工具中点击“重新检测”。",diff --git a/packages/agent-tracing/src/goal/__tests__/delta.test.ts b/packages/agent-tracing/src/goal/__tests__/delta.test.tsindex 8ee622ac95d..0bddd2941ed 100644--- a/packages/agent-tracing/src/goal/__tests__/delta.test.ts+++ b/packages/agent-tracing/src/goal/__tests__/delta.test.ts@@ -113,7 +113,7 @@ describe('reconstructGraphAt', () => {});describe('buildGraphShape', () => {- it('splits open work into ready and blocked by unresolved dependencies', () => {+ it('splits open tasks into ready and blocked by unresolved dependencies', () => {const state = graph({edges: [edge('e1', 'b', 'a')],nodes: [@@ -133,7 +133,7 @@ describe('buildGraphShape', () => {});});- it('counts work ready once its dependency resolves', () => {+ it('counts a task ready once its dependency resolves', () => {const state = graph({edges: [edge('e1', 'b', 'a')],nodes: [node('a', { status: 'resolved' }), node('b')],diff --git a/packages/agent-tracing/src/goal/__tests__/fixtures.ts b/packages/agent-tracing/src/goal/__tests__/fixtures.tsindex 2bf957a5fd6..2d130345d6e 100644--- a/packages/agent-tracing/src/goal/__tests__/fixtures.ts+++ b/packages/agent-tracing/src/goal/__tests__/fixtures.ts@@ -3,7 +3,7 @@ import type { GoalGraphState, GoalTraceEdge, GoalTraceNode } from '../types';export const node = (id: string, overrides: Partial<GoalTraceNode> = {}): GoalTraceNode => ({createdAt: 1000,id,- kind: 'work',+ kind: 'task',priority: 0,status: 'proposed',title: id,diff --git a/packages/agent-tracing/src/goal/__tests__/recorder.test.ts b/packages/agent-tracing/src/goal/__tests__/recorder.test.tsindex b1df17a1389..db69109b938 100644--- a/packages/agent-tracing/src/goal/__tests__/recorder.test.ts+++ b/packages/agent-tracing/src/goal/__tests__/recorder.test.ts@@ -96,7 +96,7 @@ describe('appendAdvanceToPartial', () => {trigger: 'create',});- // A work node added from the UI, with no advance in between.+ // A task node added from the UI, with no advance in between.const withExtra = graph({ nodes: [node('a'), node('b')] });const next = (await appendAdvanceToPartial(store, 'goal_1', {diff --git a/packages/agent-tracing/src/goal/__tests__/replay.test.ts b/packages/agent-tracing/src/goal/__tests__/replay.test.tsindex f9eb487ead8..123e5b7c120 100644--- a/packages/agent-tracing/src/goal/__tests__/replay.test.ts+++ b/packages/agent-tracing/src/goal/__tests__/replay.test.ts@@ -53,7 +53,7 @@ const trajectory: GoalTrajectory = {/** Ranks the same way the recorded run did: priority desc, then creation order. */const faithful: GoalDecider = ({ graph: state }) => {const candidates = state.nodes- .filter((item) => item.kind === 'work')+ .filter((item) => item.kind === 'task').sort((a, b) => b.priority - a.priority || a.createdAt - b.createdAt).map((item) => ({blockedBy: [],diff --git a/packages/agent-tracing/src/goal/delta.ts b/packages/agent-tracing/src/goal/delta.tsindex 966032fdb58..ecbe76418f7 100644--- a/packages/agent-tracing/src/goal/delta.ts+++ b/packages/agent-tracing/src/goal/delta.ts@@ -154,8 +154,8 @@ export const buildGraphShape = (state: GoalGraphState): GoalGraphShape => {const resolvedNodeIds = new Set(state.nodes.filter((node) => node.status === 'resolved').map((node) => node.id),);- const work = state.nodes.filter((node) => node.kind === 'work');- const open = work.filter((node) => !TERMINAL_NODE_STATUSES.has(node.status));+ const taskNodes = state.nodes.filter((node) => node.kind === 'task');+ const open = taskNodes.filter((node) => !TERMINAL_NODE_STATUSES.has(node.status));const ready = open.filter((node) =>state.edges@@ -171,6 +171,6 @@ export const buildGraphShape = (state: GoalGraphState): GoalGraphShape => {tasksBlocked: open.length - ready.length,tasksOpen: open.length,tasksReady: ready.length,- tasksCompleted: work.filter((node) => node.status === 'resolved').length,+ tasksCompleted: taskNodes.filter((node) => node.status === 'resolved').length,};};diff --git a/packages/agent-tracing/src/goal/recorder.ts b/packages/agent-tracing/src/goal/recorder.tsindex c84416ae4e7..911cfaed942 100644--- a/packages/agent-tracing/src/goal/recorder.ts+++ b/packages/agent-tracing/src/goal/recorder.ts@@ -36,7 +36,7 @@ export interface RecordAdvanceInput {* Deltas are computed here rather than by the caller because advances run in* separate processes — a QStash worker holds no memory of the previous one. The* partial is the only place the prior state exists, so folding it forward is- * also what keeps a graph edit made outside an advance (a work node added from+ * also what keeps a graph edit made outside an advance (a task node added from* the UI between two advances) inside the trace instead of vanishing between* two states.*/diff --git a/packages/agent-tracing/src/goal/replay.ts b/packages/agent-tracing/src/goal/replay.tsindex 47f5b1c884e..cf1337afe84 100644--- a/packages/agent-tracing/src/goal/replay.ts+++ b/packages/agent-tracing/src/goal/replay.ts@@ -31,7 +31,7 @@ export interface GoalDecisionInput {*/export interface GoalDecision {branch: GoalTickBranch;- /** Every eligible work node, in the order the coordinator ranked them. */+ /** Every eligible task node, in the order the coordinator ranked them. */candidates: FrontierCandidate[];chosenNodeId?: string;}diff --git a/packages/agent-tracing/src/goal/rollup.ts b/packages/agent-tracing/src/goal/rollup.tsindex 77325264a22..da82d8e4517 100644--- a/packages/agent-tracing/src/goal/rollup.ts+++ b/packages/agent-tracing/src/goal/rollup.ts@@ -133,7 +133,7 @@ export const buildGoalTraceRollup = (trajectory: GoalTrajectory): GoalTraceRolluoperationsTotal: operationIds.size,tasksCompleted: shape.tasksCompleted,tasksRetired: finalGraph.nodes.filter(- (node) => node.kind === 'work' && node.status === 'retired',+ (node) => node.kind === 'task' && node.status === 'retired',).length,};};diff --git a/packages/agent-tracing/src/goal/types.ts b/packages/agent-tracing/src/goal/types.tsindex 713d3f8b465..f9a9b03f0eb 100644--- a/packages/agent-tracing/src/goal/types.ts+++ b/packages/agent-tracing/src/goal/types.ts@@ -25,13 +25,13 @@ export type GoalTickBranch =| 'goal_terminal'/** A gate is open; the goal is parked on a person. */| 'pending_decision'- /** No work node is eligible: none exists, or all remaining ones are blocked. */+ /** No task node is eligible: none exists, or all remaining ones are blocked. */| 'no_frontier'- /** The graph has no work yet — decompose the goal into explorable directions first. */+ /** The graph has no tasks yet — decompose the goal into explorable directions first. */| 'plan_decomposition'- /** Every work node finished; the goal-level acceptance contract is next. */+ /** Every task node finished; the goal-level acceptance contract is next. */| 'terminal_acceptance'- /** The chosen work has no responsible task yet. */+ /** The chosen task node has no responsible task yet. */| 'create_task'/** Its task row is gone. */| 'missing_task'@@ -45,9 +45,9 @@ export type GoalTickBranch =/** Task is parked or already in flight. */| 'task_paused'| 'task_running'- /** Budget stopped the goal before this work could be dispatched. */+ /** Budget stopped the goal before this task could be dispatched. */| 'budget_exhausted'- /** Start a run for the chosen work. */+ /** Start a run for the chosen task. */| 'dispatch_task';export type GoalTickOutcome =@@ -116,7 +116,7 @@ export interface GoalGraphDelta {// ==================== Decision input surface ====================/**- * A work node that was eligible this tick. Losers are recorded too — without+ * A task node that was eligible this tick. Losers are recorded too — without* them a trace cannot answer "why not that node", which is the whole point of* keeping the input surface rather than the result.*/diff --git a/packages/context-engine/src/providers/__tests__/GoalContextSyntheticInjector.test.ts b/packages/context-engine/src/providers/__tests__/GoalContextSyntheticInjector.test.tsindex 5b7d2a9653a..858917e922a 100644--- a/packages/context-engine/src/providers/__tests__/GoalContextSyntheticInjector.test.ts+++ b/packages/context-engine/src/providers/__tests__/GoalContextSyntheticInjector.test.ts@@ -16,7 +16,7 @@ const OVERVIEW: InitialGoalOverviewContext = {findings: [],goal: { status: 'running', title: 'Demo' },pendingDecisions: [],- work: [{ seq: 1, status: 'active', title: 'Only work' }],+ tasks: [{ seq: 1, status: 'active', title: 'Only task' }],};// The injector owns prompt composition — callers pass structured data only.const OVERVIEW_PROMPT = buildGoalOverviewPrompt(OVERVIEW);diff --git a/packages/database/src/models/__tests__/goal.test.ts b/packages/database/src/models/__tests__/goal.test.tsindex 4d987a91916..e54c6161a20 100644--- a/packages/database/src/models/__tests__/goal.test.ts+++ b/packages/database/src/models/__tests__/goal.test.ts@@ -57,14 +57,14 @@ describe('GoalModel', () => {});});- describe('findByWorkTask', () => {- it('finds the goal whose graph owns a Work Task', async () => {+ describe('findByGraphTask', () => {+ it('finds the goal whose graph owns a Task', async () => {const task = await new TaskModel(serverDB, userId).create({ instruction: 'do the work' });const goal = await goalModel.create({ subjectType: 'standalone', title: 'Owner' });const node = await graphModel.createNode(goal.id, { kind: 'task', title: 'W1' });await serverDB.update(goalNodes).set({ taskId: task.id }).where(eq(goalNodes.id, node!.id));- expect((await goalModel.findByWorkTask(task.id))?.id).toBe(goal.id);+ expect((await goalModel.findByGraphTask(task.id))?.id).toBe(goal.id);});it('does not cross user boundaries', async () => {@@ -75,7 +75,7 @@ describe('GoalModel', () => {const node = await otherGraph.createNode(goal.id, { kind: 'task', title: 'W1' });await serverDB.update(goalNodes).set({ taskId: task.id }).where(eq(goalNodes.id, node!.id));- expect(await goalModel.findByWorkTask(task.id)).toBeUndefined();+ expect(await goalModel.findByGraphTask(task.id)).toBeUndefined();});});@@ -95,8 +95,8 @@ describe('GoalModel', () => {expect(goals[0]).toMatchObject({findingCount: 1,pendingDecisions: 0,- workDone: 1,- workTotal: 2,+ taskDone: 1,+ taskTotal: 2,});expect(goals[0].goal.id).toBe(goal.id);});@@ -157,7 +157,7 @@ describe('GoalModel', () => {it('leaves out a goal that never got a graph', async () => {// Rows from the earlier task-carried flow have no `goal_nodes`. Listing- // them renders a goal page with no work, no frontier and no way forward.+ // them renders a goal page with no tasks, no frontier and no way forward.const legacy = await goalModel.create({ subjectType: 'task', title: 'Carrier-bound' });const graphed = await goalModel.create({ subjectType: 'standalone', title: 'Has a graph' });await graphModel.createNode(graphed.id, { kind: 'task', title: 'W1' });@@ -204,7 +204,7 @@ describe('GoalModel', () => {expect(stalled.map(({ id }) => id)).not.toContain(goal.id);});- it('leaves a goal alone while one of its Work Tasks is freshly active', async () => {+ it('leaves a goal alone while one of its Tasks is freshly active', async () => {const goal = await goalModel.create({ subjectType: 'standalone', title: 'Working' });await goalModel.updateStatus(goal.id, 'running');const node = await graphModel.createNode(goal.id, { kind: 'task', title: 'W1' });@@ -214,7 +214,7 @@ describe('GoalModel', () => {expect(stalled.map(({ id }) => id)).not.toContain(goal.id);});- it('reclaims a Work that outlived its operation lease', async () => {+ it('reclaims a Task that outlived its operation lease', async () => {const goal = await goalModel.create({ subjectType: 'standalone', title: 'Lost' });await goalModel.updateStatus(goal.id, 'running');const node = await graphModel.createNode(goal.id, { kind: 'task', title: 'W1' });diff --git a/packages/database/src/models/__tests__/goalGraph.test.ts b/packages/database/src/models/__tests__/goalGraph.test.tsindex 7912de4d4d2..78087f7f733 100644--- a/packages/database/src/models/__tests__/goalGraph.test.ts+++ b/packages/database/src/models/__tests__/goalGraph.test.ts@@ -157,7 +157,7 @@ describe('GoalGraphModel', () => {expect(graph?.decisions[0].resolvedOptionId).toBe(results.find(Boolean)!.resolvedOptionId);});- it('allows only one task binding for a work node', async () => {+ it('allows only one task binding for a task node', async () => {const goal = await goalModel.create({ subjectType: 'standalone', title: 'Task binding race' });const node = await graphModel.createNode(goal.id, { kind: 'task', title: 'Run once' });const taskModel = new TaskModel(serverDB, userId);diff --git a/packages/database/src/models/goal.ts b/packages/database/src/models/goal.tsindex b230fccda98..ebcbdfcae5e 100644--- a/packages/database/src/models/goal.ts+++ b/packages/database/src/models/goal.ts@@ -21,7 +21,7 @@ const TERMINAL_NODE_STATUSES = new Set<GoalNodeStatus>(['resolved', 'rejected',* its own definition (title / requirement), budget and lifecycle state.** Execution lives in the goal's graph, not on the goal row: the coordinator- * dispatches a Task per Work node, and everything execution-specific (attempts,+ * dispatches a Task per task node, and everything execution-specific (attempts,* cost, acceptance) is derived from those tasks at read time.*/export class GoalModel {@@ -37,7 +37,7 @@ export class GoalModel {/*** The goal owns a Goal Graph. `goal.create` always seeds a problem node and- * the opening Work, so this is exactly "not a leftover from the old+ * the opening Tasks, so this is exactly "not a leftover from the old* task-carried flow".*/private static hasGraphSql = sql`EXISTS (@@ -68,8 +68,8 @@ export class GoalModel {return this.db.query.goals.findFirst({ where: and(eq(goals.id, id), this.ownership()) });};- /** The Goal Graph that owns a Work Task, or undefined when the task is not graph-managed. */- findByWorkTask = async (taskId: string): Promise<GoalItem | undefined> => {+ /** The Goal Graph that owns this Task, or undefined when the task is not graph-managed. */+ findByGraphTask = async (taskId: string): Promise<GoalItem | undefined> => {const [row] = await this.db.select({ goal: goals }).from(goalNodes)@@ -130,10 +130,10 @@ export class GoalModel {/*** Open goals that nothing is currently moving — the sweep's work list.*- * A goal qualifies when it is still open and has no Work node that is both+ * A goal qualifies when it is still open and has no task node that is both* `active` and freshly touched: either nothing was ever dispatched, the* completion event that should have re-entered the coordinator was lost, or a- * running Work outlived its operation lease and needs reclaiming. Goals with a+ * running Task outlived its operation lease and needs reclaiming. Goals with a* decision gate open are excluded — only a human moves those, and ticking them* would just report `waiting_human` on every sweep.*@@ -182,7 +182,7 @@ export class GoalModel {* Goal-centric on purpose. Goals used to be listed through their carrier* task, which made a goal without one invisible; a Goal Graph goal is* `standalone`, so the list reads the `goals` table and derives execution- * facts from the graph's Work tasks.+ * facts from the graph's tasks.*/list = async (options: {@@ -197,7 +197,7 @@ export class GoalModel {// Only goals that actually have a graph. Rows created by the earlier// task-carried flow have no `goal_nodes`, so they would render as a- // zero-work goal page that can never advance; they stay out of the list+ // zero-task goal page that can never advance; they stay out of the list// until something backfills them into graphs.const conditions = [this.ownership(), GoalModel.hasGraphSql];if (agentId) conditions.push(eq(goals.agentId, agentId));@@ -238,33 +238,33 @@ export class GoalModel {.innerJoin(goalNodes, eq(goalNodeDecisions.nodeId, goalNodes.id)).where(and(inArray(goalNodes.goalId, goalIds), eq(goalNodeDecisions.status, 'pending'))).groupBy(goalNodes.goalId),- this.workTaskRunStats(goalIds),+ this.graphTaskRunStats(goalIds),]);- const stats = new Map<string, { findingCount: number; workDone: number; workTotal: number }>();+ const stats = new Map<string, { findingCount: number; taskDone: number; taskTotal: number }>();for (const row of nodeRows) {- const current = stats.get(row.goalId) ?? { findingCount: 0, workDone: 0, workTotal: 0 };+ const current = stats.get(row.goalId) ?? { findingCount: 0, taskDone: 0, taskTotal: 0 };const count = Number(row.count);if (row.kind === 'finding') current.findingCount += count;if (row.kind === 'task') {- current.workTotal += count;- if (TERMINAL_NODE_STATUSES.has(row.status)) current.workDone += count;+ current.taskTotal += count;+ if (TERMINAL_NODE_STATUSES.has(row.status)) current.taskDone += count;}stats.set(row.goalId, current);}const pendingByGoal = new Map(decisionRows.map((row) => [row.goalId, Number(row.count)]));const items: GoalListItem[] = rows.map((goal) => {- const counts = stats.get(goal.id) ?? { findingCount: 0, workDone: 0, workTotal: 0 };+ const counts = stats.get(goal.id) ?? { findingCount: 0, taskDone: 0, taskTotal: 0 };const run = runStats.get(goal.id) ?? { totalRunCost: 0, totalRunDuration: 0 };return {findingCount: counts.findingCount,goal,pendingDecisions: pendingByGoal.get(goal.id) ?? 0,+ taskDone: counts.taskDone,+ taskTotal: counts.taskTotal,totalRunCost: run.totalRunCost,totalRunDuration: run.totalRunDuration,- workDone: counts.workDone,- workTotal: counts.workTotal,};});@@ -273,10 +273,10 @@ export class GoalModel {/*** Cost and runtime across every task the graph dispatched, including tasks- * those Work tasks spawned themselves — the same subtree rule the task board- * uses, seeded from the Work nodes instead of one carrier root.+ * those graph tasks spawned themselves — the same subtree rule the task board+ * uses, seeded from the task nodes instead of one carrier root.*/- private workTaskRunStats = async (goalIds: string[]) => {+ private graphTaskRunStats = async (goalIds: string[]) => {if (goalIds.length === 0)return new Map<string, { totalRunCost: number; totalRunDuration: number }>();@@ -285,7 +285,7 @@ export class GoalModel {total_run_cost: number;total_run_duration: number;}>(sql`- WITH RECURSIVE work_tree AS (+ WITH RECURSIVE task_tree AS (SELECT ${goalNodes.goalId} AS goal_id, ${tasks.id} AS task_idFROM ${goalNodes}JOIN ${tasks} ON ${tasks.id} = ${goalNodes.taskId}@@ -293,23 +293,23 @@ export class GoalModel {AND ${goalNodes.kind} = 'task'AND ${this.taskOwnershipSql('tasks')}UNION ALL- SELECT work_tree.goal_id, child.id+ SELECT task_tree.goal_id, child.idFROM ${tasks} child- JOIN work_tree ON child.parent_task_id = work_tree.task_id+ JOIN task_tree ON child.parent_task_id = task_tree.task_idWHERE ${this.taskOwnershipSql('child')})SELECT- work_tree.goal_id,+ task_tree.goal_id,coalesce(sum(${topics.totalCost}), 0) AS total_run_cost,coalesce(sum(extract(epoch from (${topics.completedAt} - ${taskTopics.createdAt})) * 1000)filter (where ${topics.completedAt} is not null),0) AS total_run_duration- FROM work_tree- LEFT JOIN ${taskTopics} ON ${taskTopics.taskId} = work_tree.task_id+ FROM task_tree+ LEFT JOIN ${taskTopics} ON ${taskTopics.taskId} = task_tree.task_idLEFT JOIN ${topics} ON ${topics.id} = ${taskTopics.topicId}- GROUP BY work_tree.goal_id+ GROUP BY task_tree.goal_id`);return new Map(@@ -333,8 +333,9 @@ export interface GoalListItem {goal: GoalItem;/** Decision gates waiting on a human right now. */pendingDecisions: number;+ /** Task nodes in a terminal status (resolved / rejected / retired). */+ taskDone: number;+ taskTotal: number;totalRunCost: number;totalRunDuration: number;- workDone: number;- workTotal: number;}diff --git a/packages/database/src/schemas/goalGraph.ts b/packages/database/src/schemas/goalGraph.tsindex bb73df66fab..61c08797d1b 100644--- a/packages/database/src/schemas/goalGraph.ts+++ b/packages/database/src/schemas/goalGraph.ts@@ -34,8 +34,8 @@ import { workVersions } from './work';/*** Goal Graph nodes preserve the evolving problem framing above individual Task- * execution. A Work node may own one responsible Task; that Task remains free to- * create its own implementation-level subtree.+ * execution. A task node may own one responsible Task; that Task remains free+ * to create its own implementation-level subtree.*/export const goalNodes = pgTable('goal_nodes',@@ -48,7 +48,7 @@ export const goalNodes = pgTable(status: text('status').$type<GoalNodeStatus>().default('proposed').notNull(),title: text('title').notNull(),description: text('description'),- /** Responsible execution container. Valid only when kind is `work`. */+ /** Responsible execution container. Valid only when kind is `task`. */taskId: text('task_id').references(() => tasks.id, { onDelete: 'set null' }),priority: integer('priority').default(0).notNull(),/** Agent or reviewer confidence from 0 to 1. */diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex fc936b894ba..c809e7fb5bd 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -1765,10 +1765,10 @@ export default {'goalList.acceptanceProgress': '{{passed}}/{{total}} passed','goalList.agentRuns': '{{count}} runs','goalList.empty': 'No goals yet',- 'goalList.workProgress': '{{done}}/{{total}} tasks done',+ 'goalList.taskProgress': '{{done}}/{{total}} tasks done','goalList.findings': '{{count}} findings','goalList.needsYou': '{{count}} need you',- 'goalList.noWork': 'No tasks yet',+ 'goalList.noTasks': 'No tasks yet','goalList.loadError': 'Could not load goals','goalList.loadErrorDescription':'The service is temporarily unavailable. Your goals are not lost.',@@ -1783,19 +1783,19 @@ export default {'goalList.status.running': 'Pursuing','goalList.status.verifying': 'Verifying','goalList.status.waiting': 'Waiting',- 'goalWork.checks': '{{passed}}/{{total}} checks passed',- 'goalWork.round': 'Round {{current}}',- 'goalWork.roundWithBudget': 'Round {{current}}/{{total}}',- 'goalWork.workDone': '{{passed}}/{{total}} tasks done',- 'goalWork.status.achieved': 'Achieved',- 'goalWork.status.canceled': 'Canceled',- 'goalWork.status.error': 'Needs attention',- 'goalWork.status.paused': 'Paused',- 'goalWork.status.repairing': 'Repairing',- 'goalWork.status.review': 'Pending acceptance',- 'goalWork.status.running': 'Executing',- 'goalWork.status.verifying': 'Verifying',- 'goalWork.status.waiting': 'Waiting',+ 'goalTask.checks': '{{passed}}/{{total}} checks passed',+ 'goalTask.round': 'Round {{current}}',+ 'goalTask.roundWithBudget': 'Round {{current}}/{{total}}',+ 'goalTask.tasksDone': '{{passed}}/{{total}} tasks done',+ 'goalTask.status.achieved': 'Achieved',+ 'goalTask.status.canceled': 'Canceled',+ 'goalTask.status.error': 'Needs attention',+ 'goalTask.status.paused': 'Paused',+ 'goalTask.status.repairing': 'Repairing',+ 'goalTask.status.review': 'Pending acceptance',+ 'goalTask.status.running': 'Executing',+ 'goalTask.status.verifying': 'Verifying',+ 'goalTask.status.waiting': 'Waiting','goalList.title': 'Goals','goalDetail.acceptance': 'Acceptance checks','goalAcceptance.add': 'Add criterion',diff --git a/packages/prompts/src/chains/goal.ts b/packages/prompts/src/chains/goal.tsindex b14e5930da6..cb45739e12f 100644--- a/packages/prompts/src/chains/goal.ts+++ b/packages/prompts/src/chains/goal.ts@@ -65,7 +65,7 @@ export const GOAL_CRITERIA_DRAFT_JSON_SCHEMA = {};/** Bump when the goal decomposition planning prompt meaningfully changes. */-export const GOAL_DECOMPOSE_PROMPT_VERSION = 'v2';+export const GOAL_DECOMPOSE_PROMPT_VERSION = 'v3';export const GOAL_DECOMPOSE_JSON_SCHEMA = {name: 'goal_decomposition',@@ -73,7 +73,7 @@ export const GOAL_DECOMPOSE_JSON_SCHEMA = {additionalProperties: false,properties: {problemStatement: { maxLength: 280, minLength: 1, type: 'string' },- works: {+ tasks: {items: {additionalProperties: false,properties: {@@ -89,7 +89,7 @@ export const GOAL_DECOMPOSE_JSON_SCHEMA = {type: 'array',},},- required: ['problemStatement', 'works'],+ required: ['problemStatement', 'tasks'],type: 'object' as const,},strict: true,@@ -101,7 +101,7 @@ interface GoalDecomposeInput {/*** Plan the opening exploration structure of a goal graph: the core question it- * answers plus the independent work directions to pursue, before anything runs.+ * answers plus the independent task directions to pursue, before anything runs.*/export const chainGoalDecompose = ({requirement,@@ -112,15 +112,15 @@ export const chainGoalDecompose = ({{content: ['You plan the opening exploration structure for a persistent autonomous goal.',- 'Decompose the goal into the core question it must answer and the independent work directions that together answer it.',+ 'Decompose the goal into the core question it must answer and the independent task directions that together answer it.','Guidelines:','- problemStatement is 1–2 sentences naming the core question or outcome of the goal, in your own words. Never copy the acceptance-criteria list into it.',- '- Return 1–5 works. A complex goal (analysis, research, multi-stage delivery) must be split into several directions that can be explored independently or in sequence — e.g. gather the raw material, analyze it from distinct angles, then synthesize. A genuinely small single-step goal may stay as one work.',- '- Each work.title names its direction concisely; titles must be distinct from each other and from the goal name.',- '- Each work.instruction is a complete, self-contained brief for an autonomous agent working on that direction only: what to do, the concrete deliverable, and how that deliverable will be judged. Include only the requirements relevant to this direction — never paste the full goal acceptance list into every work.',- '- Preserve every concrete URL, scope, constraint, and numeric threshold from the goal in whichever work it belongs to.',- '- Order works so that earlier ones produce what later ones consume.',- '- For each work, set dependsOn to the 0-based indices of the earlier works whose outputs it consumes; use [] for a work that can start immediately. A pipeline-shaped goal (gather → analyze → synthesize) must express those edges — do not mark every work independent — but never invent a dependency the work does not actually need.',+ '- Return 1–5 tasks. A complex goal (analysis, research, multi-stage delivery) must be split into several directions that can be explored independently or in sequence — e.g. gather the raw material, analyze it from distinct angles, then synthesize. A genuinely small single-step goal may stay as one task.',+ '- Each task.title names its direction concisely; titles must be distinct from each other and from the goal name.',+ '- Each task.instruction is a complete, self-contained brief for an autonomous agent working on that direction only: what to do, the concrete deliverable, and how that deliverable will be judged. Include only the requirements relevant to this direction — never paste the full goal acceptance list into every task.',+ '- Preserve every concrete URL, scope, constraint, and numeric threshold from the goal in whichever task it belongs to.',+ '- Order tasks so that earlier ones produce what later ones consume.',+ '- For each task, set dependsOn to the 0-based indices of the earlier tasks whose outputs it consumes; use [] for a task that can start immediately. A pipeline-shaped goal (gather → analyze → synthesize) must express those edges — do not mark every task independent — but never invent a dependency the task does not actually need.','- Write all fields in the language used by the goal.',].join('\n'),role: 'system',diff --git a/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.test.ts b/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.test.tsindex bb2704d6e5b..df748226f94 100644--- a/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.test.ts+++ b/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.test.ts@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest';import { buildGoalOverviewPrompt } from './buildGoalOverviewPrompt';describe('buildGoalOverviewPrompt', () => {- it('renders goal, work items, findings and pending decisions', () => {+ it('renders goal, tasks, findings and pending decisions', () => {const prompt = buildGoalOverviewPrompt({findings: ['Local run boots end to end'],goal: {@@ -12,7 +12,7 @@ describe('buildGoalOverviewPrompt', () => {title: 'WikiSkill 本地完整复现',},pendingDecisions: [{ question: 'Use the small model for the ablation?' }],- work: [+ tasks: [{ seq: 1, status: 'resolved', title: '项目骨架与本地运行基座' },{ attempts: 2, seq: 2, status: 'active', title: '经验编译与技能演化闭环' },],@@ -33,7 +33,7 @@ describe('buildGoalOverviewPrompt', () => {findings: [],goal: { status: 'pending', title: 'Goal' },pendingDecisions: [],- work: [],+ tasks: [],});expect(prompt).not.toContain('Findings');diff --git a/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.ts b/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.tsindex df86f29029a..37237e86a35 100644--- a/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.ts+++ b/packages/prompts/src/prompts/goal/buildGoalOverviewPrompt.ts@@ -14,7 +14,7 @@ export type BuildGoalOverviewPromptInput = InitialGoalOverviewContext;* Goal overview prompt for the goal-page conversational reference.*/export const buildGoalOverviewPrompt = (input: BuildGoalOverviewPromptInput): string => {- const { findings, goal, pendingDecisions, work } = input;+ const { findings, goal, pendingDecisions, tasks } = input;const lines: string[] = ['<goal_overview>',@@ -24,9 +24,9 @@ export const buildGoalOverviewPrompt = (input: BuildGoalOverviewPromptInput): stif (goal.requirement?.trim()) lines.push(`Requirement: ${goal.requirement.trim()}`);- if (work.length > 0) {- lines.push('', `Work items (${work.length}):`);- for (const item of work) {+ if (tasks.length > 0) {+ lines.push('', `Tasks (${tasks.length}):`);+ for (const item of tasks) {const seq = item.seq ? `#${item.seq} ` : '';const attempts = item.attempts && item.attempts > 1 ? ` (attempt ${item.attempts})` : '';lines.push(` ${seq}[${item.status}] ${item.title}${attempts}`);diff --git a/packages/types/src/goal.ts b/packages/types/src/goal.tsindex 7d98985df87..e600fe7ae25 100644--- a/packages/types/src/goal.ts+++ b/packages/types/src/goal.ts@@ -17,19 +17,19 @@ export type GoalStatus =/*** The execution carrier a goal is optionally bound to. Goals are standalone- * today: the Goal Graph owns execution and dispatches its own Work Tasks, so+ * today: the Goal Graph owns execution and dispatches its own Tasks, so* nothing binds a goal to a single carrier row. The column stays because* existing rows still carry the earlier `task` value.*/export type GoalSubjectType = 'task' | 'topic' | 'standalone';-/** Automatic recovery policy for Goal Graph Work. */+/** Automatic recovery policy for Goal Graph Tasks. */export interface GoalRecoveryPolicy {- /** Maximum execution attempts for one Work before escalating to a decision gate. */+ /** Maximum execution attempts for one Task before escalating to a decision gate. */maxAttemptsPerTask?: number;/** Per-operation agent step limit. Null/undefined leaves the runtime uncapped. */maxStepsPerRun?: number | null;- /** Time without a durable runtime lease refresh before a running Work is reclaimed. */+ /** Time without a durable runtime lease refresh before a running Task is reclaimed. */operationLeaseTimeoutMs?: number;}@@ -41,7 +41,7 @@ export interface GoalRecoveryPolicy {*/export interface GoalSchedulePolicy {/**- * ISO-8601 instant. Past it the coordinator stops dispatching new Work and+ * ISO-8601 instant. Past it the coordinator stops dispatching new Tasks and* pauses the goal — the temporal twin of `budget_exhausted`.*/deadline?: string | null;@@ -50,7 +50,7 @@ export interface GoalSchedulePolicy {/*** The goal's structured acceptance standard. The drafted criteria persist as* `verify_criteria` rows (viewable and editable on the goal page); this block- * records their ids so the terminal Goal-acceptance Work verifies against+ * records their ids so the terminal Goal-acceptance Task verifies against* exactly these checks instead of re-deriving them from the requirement prose.*/export interface GoalAcceptancePolicy {@@ -241,7 +241,7 @@ export interface GoalGraphSnapshot {export const buildGoalOverviewContext = (snapshot: GoalGraphSnapshot,): InitialGoalOverviewContext => {- let workSeq = 0;+ let taskSeq = 0;return {findings: snapshot.nodes.filter((node) => node.kind === 'finding').map((node) => node.title),goal: {@@ -252,9 +252,9 @@ export const buildGoalOverviewContext = (pendingDecisions: snapshot.decisions.filter((decision) => decision.status === 'pending').map((decision) => ({ question: decision.question })),- work: snapshot.nodes+ tasks: snapshot.nodes.filter((node) => node.kind === 'task')- .map((node) => ({ seq: ++workSeq, status: node.status, title: node.title })),+ .map((node) => ({ seq: ++taskSeq, status: node.status, title: node.title })),};};diff --git a/packages/types/src/stepContext.ts b/packages/types/src/stepContext.tsindex 418815c83d7..8ed8ca38430 100644--- a/packages/types/src/stepContext.ts+++ b/packages/types/src/stepContext.ts@@ -277,10 +277,10 @@ export interface InitialTaskManagerContext {contextPrompt: string;}-export interface GoalOverviewWorkItem {+export interface GoalOverviewTaskItem {/** 1-based attempt count so far, when known. */attempts?: number;- /** 1-based Work number as shown in the UI (#1, #2 …). */+ /** 1-based Task number as shown in the UI (#1, #2 …). */seq?: number;status: string;title: string;@@ -303,5 +303,5 @@ export interface InitialGoalOverviewContext {title: string;};pendingDecisions: GoalOverviewDecision[];- work: GoalOverviewWorkItem[];+ tasks: GoalOverviewTaskItem[];}diff --git a/src/features/AgentGoals/AddTaskModal/AddTaskContent.tsx b/src/features/AgentGoals/AddTaskModal/AddTaskContent.tsxindex 337f5e86132..008dbfb16f7 100644--- a/src/features/AgentGoals/AddTaskModal/AddTaskContent.tsx+++ b/src/features/AgentGoals/AddTaskModal/AddTaskContent.tsx@@ -6,7 +6,7 @@ import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';/**- * Add a Work to a running goal. A task the coordinator will spend rounds on+ * Add a Task to a running goal. A task the coordinator will spend rounds on* deserves a titled brief, not a one-line inline input — the modal gives the* instruction room and keeps the frontier list itself read-focused.*/diff --git a/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsx b/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsxindex b1784e719d0..5b0acfcea5c 100644--- a/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsx+++ b/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsx@@ -375,8 +375,8 @@ const CreateGoalContent = memo<CreateGoalContentProps>((props) => {config: {recovery: { maxAttemptsPerTask: resolveGoalAttemptBudget(plan.maxIterations) },},- // `maxIterations` is the per-Work attempt budget above; it is not the- // graph-wide round cap, which counts runs across every Work and would+ // `maxIterations` is the per-Task attempt budget above; it is not the+ // graph-wide round cap, which counts runs across every Task and would// strand the fourth task of a goal whose limit is three attempts.// Structured criteria persist alongside the prose requirement: the goal// page shows/edits them and the terminal acceptance is gated on them.@@ -386,7 +386,7 @@ const CreateGoalContent = memo<CreateGoalContentProps>((props) => {title: name,})),maxTotalCost: budget.maxTotalCost ?? undefined,- // No seed work: the coordinator plans the decomposition on first+ // No seed tasks: the coordinator plans the decomposition on first// advance, turning a complex ask into several explorable directions.problemDescription: instruction,projectId,diff --git a/src/features/AgentGoals/CreateGoalModal/goalConfig.test.ts b/src/features/AgentGoals/CreateGoalModal/goalConfig.test.tsindex 7bf78c119dc..3bb778174ae 100644--- a/src/features/AgentGoals/CreateGoalModal/goalConfig.test.ts+++ b/src/features/AgentGoals/CreateGoalModal/goalConfig.test.ts@@ -18,8 +18,8 @@ describe('deriveInitialGoalCriterionTitle', () => {describe('buildGoalCreateInput', () => {it('never sets a graph-wide round cap', () => {- // The modal's only iteration field means "attempts on one Work". `maxRounds`- // counts runs across every Work in the graph, so deriving it from that field+ // The modal's only iteration field means "attempts on one Task". `maxRounds`+ // counts runs across every Task in the graph, so deriving it from that field// stranded the fourth task of a goal whose limit was three attempts.expect(buildGoalCreateInput({ instruction: 'ship it' })).not.toHaveProperty('maxRounds');});diff --git a/src/features/AgentGoals/GoalAcceptanceCriteria.tsx b/src/features/AgentGoals/GoalAcceptanceCriteria.tsxindex e3fd2ac3c2b..497ec6892c2 100644--- a/src/features/AgentGoals/GoalAcceptanceCriteria.tsx+++ b/src/features/AgentGoals/GoalAcceptanceCriteria.tsx@@ -40,7 +40,7 @@ const emptyForm: CriterionFormValue = { description: '', instruction: '', title:/*** The goal's structured acceptance standard: the persisted verify criteria the- * terminal Goal-acceptance Work is gated on. Rendered as its own section so the+ * terminal Goal-acceptance Task is gated on. Rendered as its own section so the* standard is inspectable and editable instead of living only inside the* requirement prose.*diff --git a/src/features/AgentGoals/GoalCardItem.tsx b/src/features/AgentGoals/GoalCardItem.tsxindex 3c5e0455bf0..d43fee6673e 100644--- a/src/features/AgentGoals/GoalCardItem.tsx+++ b/src/features/AgentGoals/GoalCardItem.tsx@@ -78,10 +78,10 @@ export const GoalCardItem = memo<GoalItemProps>(({ goal: item }) => {<GoalProgressfindingCount={item.findingCount}pendingDecisions={item.pendingDecisions}+ taskDone={item.taskDone}+ taskTotal={item.taskTotal}totalRunCost={item.totalRunCost}totalRunDuration={item.totalRunDuration}- workDone={item.workDone}- workTotal={item.workTotal}/></Block>);diff --git a/src/features/AgentGoals/GoalDetailPage.tsx b/src/features/AgentGoals/GoalDetailPage.tsxindex d6089107f0d..5bc2f085837 100644--- a/src/features/AgentGoals/GoalDetailPage.tsx+++ b/src/features/AgentGoals/GoalDetailPage.tsx@@ -32,7 +32,7 @@ import ProcessControl from './ProcessControl';/*** The goal detail page. A goal is a Goal Graph — it owns its own decomposition- * and dispatches Work Tasks — so the page reads the graph snapshot directly and+ * and dispatches its own Tasks — so the page reads the graph snapshot directly and* the route is keyed by the `goals` row id.** Every header metric is a drill-down entry: clicking one opens its detail indiff --git a/src/features/AgentGoals/GoalListItem.tsx b/src/features/AgentGoals/GoalListItem.tsxindex eee22d74edd..c175bc5c4a0 100644--- a/src/features/AgentGoals/GoalListItem.tsx+++ b/src/features/AgentGoals/GoalListItem.tsx@@ -78,10 +78,10 @@ export const GoalListItem = memo<GoalItemProps>(({ goal: item }) => {<GoalProgressfindingCount={item.findingCount}pendingDecisions={item.pendingDecisions}+ taskDone={item.taskDone}+ taskTotal={item.taskTotal}totalRunCost={item.totalRunCost}totalRunDuration={item.totalRunDuration}- workDone={item.workDone}- workTotal={item.workTotal}/><Icon color={cssVar.colorTextQuaternary} icon={ArrowRightIcon} size={16} /></Block>diff --git a/src/features/AgentGoals/GoalProgress.tsx b/src/features/AgentGoals/GoalProgress.tsxindex dc76aee7d94..e99b37d2f75 100644--- a/src/features/AgentGoals/GoalProgress.tsx+++ b/src/features/AgentGoals/GoalProgress.tsx@@ -58,10 +58,10 @@ const styles = createStaticStyles(({ css }) => ({export interface GoalProgressProps {findingCount: number;pendingDecisions: number;+ taskDone: number;+ taskTotal: number;totalRunCost: number;totalRunDuration: number;- workDone: number;- workTotal: number;}/**@@ -70,24 +70,24 @@ export interface GoalProgressProps {* blocked on the user right now.*/export const GoalProgress = memo<GoalProgressProps>(- ({ findingCount, pendingDecisions, totalRunCost, totalRunDuration, workDone, workTotal }) => {+ ({ findingCount, pendingDecisions, totalRunCost, totalRunDuration, taskDone, taskTotal }) => {const { t } = useTranslation('chat');- const progress = workTotal > 0 ? Math.round((workDone / workTotal) * 100) : 0;+ const progress = taskTotal > 0 ? Math.round((taskDone / taskTotal) * 100) : 0;return (<div className={styles.metrics}>- {workTotal > 0 ? (+ {taskTotal > 0 ? (<Flexbox horizontal align={'center'} className={styles.acceptance} gap={6}><div aria-hidden className={styles.progress}><div className={styles.progressValue} style={{ width: `${progress}%` }} /></div><Text ellipsis color={cssVar.colorTextTertiary} fontSize={12}>- {t('goalList.workProgress', { done: workDone, total: workTotal })}+ {t('goalList.taskProgress', { done: taskDone, total: taskTotal })}</Text></Flexbox>) : (<Text ellipsis color={cssVar.colorTextTertiary} fontSize={12}>- {t('goalList.noWork')}+ {t('goalList.noTasks')}</Text>)}{pendingDecisions > 0 ? (diff --git a/src/features/AgentGoals/ProcessControl/Frontier.tsx b/src/features/AgentGoals/ProcessControl/Frontier.tsxindex 6ec44b35cb6..d2e656e0445 100644--- a/src/features/AgentGoals/ProcessControl/Frontier.tsx+++ b/src/features/AgentGoals/ProcessControl/Frontier.tsx@@ -286,7 +286,7 @@ const FrontierRow = memo<{item: FrontierItem;numbers: Map<string, number>;onSelect: (nodeId: string) => void;- /** A gate's ledger is the ledger of the Work it was opened for. */+ /** A gate's ledger is the ledger of the Task it was opened for. */subject?: GoalNodeView;}>(({ actions, canEdit, item, numbers, onSelect, subject }) => {const { t } = useTranslation('chat');diff --git a/src/features/AgentGoals/ProcessControl/Graph/GraphNode.tsx b/src/features/AgentGoals/ProcessControl/Graph/GraphNode.tsxindex 87a15bc565f..0d779f17c6b 100644--- a/src/features/AgentGoals/ProcessControl/Graph/GraphNode.tsx+++ b/src/features/AgentGoals/ProcessControl/Graph/GraphNode.tsx@@ -302,7 +302,7 @@ const GraphNodeView = memo<NodeProps>(({ data }) => {<span className={styles.human}>@</span></Tooltip>)}- {/* Top-right corner: this Work carries its own verifier. Icon only —+ {/* Top-right corner: this Task carries its own verifier. Icon only —the word added nothing the hover hint doesn't say better. */}{isTask && node.taskId && (<Tooltip title={t('goalProcess.node.verifierTooltip')}>diff --git a/src/features/AgentGoals/ProcessControl/coordinatorCopy.test.ts b/src/features/AgentGoals/ProcessControl/coordinatorCopy.test.tsindex 60bc72f829a..f8b1b68c39d 100644--- a/src/features/AgentGoals/ProcessControl/coordinatorCopy.test.ts+++ b/src/features/AgentGoals/ProcessControl/coordinatorCopy.test.ts@@ -18,7 +18,7 @@ describe('coordinatorGateKind', () => {});describe('coordinatorNodeTitleKey', () => {- it('maps the terminal acceptance work and coordinator gates to locale keys', async () => {+ it('maps the terminal acceptance task and coordinator gates to locale keys', async () => {const { coordinatorNodeTitleKey } = await import('./coordinatorCopy');const view = (node: any, dec?: any) => ({ decision: dec, humanTouches: [], node }) as any;@@ -66,7 +66,7 @@ describe('coordinatorReasonCopy', () => {key: 'goalProcess.gate.reason.verifyFailed',params: { id: 'T-932' },});- expect(coordinatorReasonCopy('Work attempt budget was exhausted')).toEqual({+ expect(coordinatorReasonCopy('Task attempt budget was exhausted')).toEqual({key: 'goalProcess.gate.reason.attemptBudgetExhausted',});expect(diff --git a/src/features/AgentGoals/ProcessControl/coordinatorCopy.ts b/src/features/AgentGoals/ProcessControl/coordinatorCopy.tsindex 2515c1ccdcc..9cc269d0d9c 100644--- a/src/features/AgentGoals/ProcessControl/coordinatorCopy.ts+++ b/src/features/AgentGoals/ProcessControl/coordinatorCopy.ts@@ -38,7 +38,7 @@ export const gateTitleKey = (kind: CoordinatorGateKind): string => `goalProcess./*** Locale key for a coordinator-authored fixed node title (gate nodes and the- * terminal Goal-acceptance Work), or undefined for user/agent-authored nodes.+ * terminal Goal-acceptance Task), or undefined for user/agent-authored nodes.*/export const coordinatorNodeTitleKey = (view: GoalNodeView): string | undefined => {const { node } = view;@@ -89,7 +89,7 @@ const REASON_PATTERNS: Array<{},{key: 'goalProcess.gate.reason.attemptBudgetExhausted',- pattern: /^Work attempt budget was exhausted( after an operation was abandoned)?$/,+ pattern: /^Task attempt budget was exhausted( after an operation was abandoned)?$/,},{key: 'goalProcess.gate.reason.costBudgetExhausted',diff --git a/src/features/AgentGoals/ProcessControl/goalGraphViewModel.test.ts b/src/features/AgentGoals/ProcessControl/goalGraphViewModel.test.tsindex c343723abe8..05e865430d4 100644--- a/src/features/AgentGoals/ProcessControl/goalGraphViewModel.test.ts+++ b/src/features/AgentGoals/ProcessControl/goalGraphViewModel.test.ts@@ -92,7 +92,7 @@ const snapshot = (partial: Partial<GoalGraphSnapshot>): GoalGraphSnapshot => ({});describe('buildGoalGraphView', () => {- it('mirrors the coordinator frontier: unblocked work is ready, blocked work folds', () => {+ it('mirrors the coordinator frontier: unblocked tasks are ready, blocked tasks fold', () => {const view = buildGoalGraphView(snapshot({edges: [edge('w2', 'w1', 'depends_on')],@@ -105,7 +105,7 @@ describe('buildGoalGraphView', () => {expect(view.blocked.map((item) => item.node.id)).toEqual(['w2']);});- it('numbers work nodes by graph creation order so dependency refs stay stable', () => {+ it('numbers task nodes by graph creation order so dependency refs stay stable', () => {const view = buildGoalGraphView(snapshot({ nodes: [node('w1'), node('p1', { kind: 'problem' }), node('w2')] }),NOW,@@ -121,7 +121,7 @@ describe('buildGoalGraphView', () => {snapshot({events: [event('w1', 'activated', 5),- event('w1', 'updated', 20, 'Work attempt budget was exhausted'),+ event('w1', 'updated', 20, 'Task attempt budget was exhausted'),event('w1', 'activated', 25, 'retry with the missing directory created first'),event('w1', 'resolved', 40, 'Responsible task completed'),],@@ -131,7 +131,7 @@ describe('buildGoalGraphView', () => {);expect(view.byId.w1.attempts).toMatchObject([- { index: 1, outcome: 'failed', reason: 'Work attempt budget was exhausted' },+ { index: 1, outcome: 'failed', reason: 'Task attempt budget was exhausted' },{ index: 2, outcome: 'passed', reason: 'Responsible task completed' },]);});@@ -156,7 +156,7 @@ describe('buildGoalGraphView', () => {expect(view.frontier[0]).toMatchObject({ kind: 'running' });});- it('marks an active work stale once it outlives the operation lease', () => {+ it('marks an active task stale once it outlives the operation lease', () => {const view = buildGoalGraphView(snapshot({events: [event('w1', 'activated', 30)],@@ -170,7 +170,7 @@ describe('buildGoalGraphView', () => {expect(view.needsYou).toBe(1);});- it('keeps a work running when the run operation heartbeat is fresh despite a quiet node row', () => {+ it('keeps a task running when the run operation heartbeat is fresh despite a quiet node row', () => {// The node row only moves on observations / status changes; a long tool// call or the verify stage keeps the operation lease fresh while the row// goes quiet. That must not read as "lost".@@ -188,7 +188,7 @@ describe('buildGoalGraphView', () => {expect(view.frontier[0]).toMatchObject({ kind: 'running' });});- it('keeps a fresh active work running, with the current attempt start for the clock', () => {+ it('keeps a fresh active task running, with the current attempt start for the clock', () => {const view = buildGoalGraphView(snapshot({events: [event('w1', 'activated', 115)],@@ -201,15 +201,15 @@ describe('buildGoalGraphView', () => {expect(view.byId.w1.startedAt).toEqual(at(115));});- it('closes the parked attempt of a Work waiting at a gate', () => {+ it('closes the parked attempt of a Task waiting at a gate', () => {// The gate is written as an `updated` event, which is not an attempt- // boundary — without the node-state fallback the parked Work kept+ // boundary — without the node-state fallback the parked Task kept// reporting a running attempt, and the gate case read as still executing.const view = buildGoalGraphView(snapshot({events: [event('w1', 'activated', 5),- event('w1', 'updated', 40, 'Work attempt budget was exhausted'),+ event('w1', 'updated', 40, 'Task attempt budget was exhausted'),],nodes: [node('w1', { status: 'waiting', taskId: 'task-1', updatedAt: at(40) })],}),@@ -217,12 +217,12 @@ describe('buildGoalGraphView', () => {);expect(view.byId.w1.attempts).toMatchObject([- { endedAt: at(40), index: 1, outcome: 'failed', reason: 'Work attempt budget was exhausted' },+ { endedAt: at(40), index: 1, outcome: 'failed', reason: 'Task attempt budget was exhausted' },]);expect(view.byId.w1.startedAt).toBeUndefined();});- it('surfaces a pending gate and hides the waiting work it was opened for', () => {+ it('surfaces a pending gate and hides the waiting task it was opened for', () => {const decision: GoalGraphDecision = {authority: 'user',canceledAt: null,@@ -230,8 +230,8 @@ describe('buildGoalGraphView', () => {id: 'dec-1',nodeId: 'd1',options: [- { id: 'retry', label: 'Retry work' },- { id: 'retire', label: 'Retire work' },+ { id: 'retry', label: 'Retry task' },+ { id: 'retire', label: 'Retire task' },],question: 'Retry or retire?',recommendedOptionId: 'retry',@@ -259,11 +259,11 @@ describe('buildGoalGraphView', () => {expect(view.frontier.map((item) => [item.view.node.id, item.kind])).toEqual([['d1', 'gate']]);expect(view.byId.d1.decision?.id).toBe('dec-1');- // The gate's case is the failed Work's ledger, not the decision node's own.+ // The gate's case is the failed Task's ledger, not the decision node's own.expect(view.byId.d1.gateSubjectId).toBe('w1');});- it('links a finding to the work that produced it and the problem it answers', () => {+ it('links a finding to the task that produced it and the problem it answers', () => {const view = buildGoalGraphView(snapshot({edges: [edge('w1', 'f1', 'produces'), edge('f1', 'p1', 'supports')],@@ -281,7 +281,7 @@ describe('buildGoalGraphView', () => {expect(view.byId.w1.findings.map((n) => n.id)).toEqual(['f1']);});- it('keeps only the most recent finished tasks, shown in work numbering ahead of live rows', () => {+ it('keeps only the most recent finished tasks, shown in task numbering ahead of live rows', () => {// w2 finished AFTER w3: recency picks which rows stay (w1 drops), but the// list still reads #2 then #3 — not "most recently finished first".const view = buildGoalGraphView(diff --git a/src/features/AgentGoals/ProcessControl/goalGraphViewModel.ts b/src/features/AgentGoals/ProcessControl/goalGraphViewModel.tsindex 2719987ad51..670fef1a403 100644--- a/src/features/AgentGoals/ProcessControl/goalGraphViewModel.ts+++ b/src/features/AgentGoals/ProcessControl/goalGraphViewModel.ts@@ -18,7 +18,7 @@ import type {* `undefined` and the UI omits it rather than inventing a value.*/-/** Mirrors the reclaim window the coordinator uses when a Work holds no lease. */+/** Mirrors the reclaim window the coordinator uses when a Task holds no lease. */const DEFAULT_LEASE_TIMEOUT_MS = 15 * 60 * 1000;/** How many just-finished tasks stay visible so the list fades instead of items vanishing. */@@ -50,9 +50,9 @@ export interface GoalNodeView {/** Pending user decision opened on this node. */decision?: GoalGraphDecision;dependsOn: string[];- /** Findings produced by this Work. */+ /** Findings produced by this Task. */findings: GoalGraphNode[];- /** Decision only: the Work this gate was opened for — its ledger is the case. */+ /** Decision only: the Task this gate was opened for — its ledger is the case. */gateSubjectId?: string;/** Latest liveness signal: node row update or the run operation's lease heartbeat. */heartbeatAt: Date;@@ -61,9 +61,9 @@ export interface GoalNodeView {/** Active for longer than the lease window with no heartbeat — the coordinator would reclaim it. */isStale: boolean;node: GoalGraphNode;- /** The Work that produced this finding. */+ /** The Task that produced this finding. */producedBy?: GoalGraphNode;- /** Stable 1-based number over Work nodes in graph creation order. */+ /** Stable 1-based number over task nodes in graph creation order. */seq?: number;/** When the current attempt started, for the running clock. */startedAt?: Date;@@ -164,7 +164,7 @@ const buildAttempts = (node: GoalGraphNode, events: GoalGraphEvent[]): GoalAttem}}- // A Work parked at a decision gate leaves its last attempt open: the gate is+ // A Task parked at a decision gate leaves its last attempt open: the gate is// written as `updated`, which is not a boundary. Only an `active` node is// still trying, so close the attempt against the node's own state.const open = attempts.at(-1);@@ -186,7 +186,7 @@ export const buildGoalGraphView = (const lease = leaseTimeoutMs(goal);const dependsOn = new Map<string, string[]>();- const producesByWork = new Map<string, GoalGraphNode[]>();+ const producesByTask = new Map<string, GoalGraphNode[]>();const gateSubject = new Map<string, string>();const producedByFinding = new Map<string, GoalGraphNode>();const supportsByFinding = new Map<string, GoalGraphNode[]>();@@ -197,10 +197,10 @@ export const buildGoalGraphView = (if (edge.kind === 'depends_on')dependsOn.set(source.id, [...(dependsOn.get(source.id) ?? []), target.id]);if (edge.kind === 'produces') {- producesByWork.set(source.id, [...(producesByWork.get(source.id) ?? []), target]);+ producesByTask.set(source.id, [...(producesByTask.get(source.id) ?? []), target]);producedByFinding.set(target.id, source);}- // The coordinator links the failed Work to the gate it opened with `leads_to`.+ // The coordinator links the failed Task to the gate it opened with `leads_to`.if (edge.kind === 'leads_to' && target.kind === 'decision')gateSubject.set(target.id, source.id);if (edge.kind === 'supports')@@ -241,7 +241,7 @@ export const buildGoalGraphView = (.filter((dep): dep is GoalGraphNode => !!dep && !TERMINAL_NODE_STATUSES.has(dep.status)),decision: nodeDecisions.find((d) => d.status === 'pending'),dependsOn: dependsOn.get(node.id) ?? [],- findings: producesByWork.get(node.id) ?? [],+ findings: producesByTask.get(node.id) ?? [],gateSubjectId: gateSubject.get(node.id),heartbeatAt,humanTouches: nodeDecisions.filter((d) => d.status === 'resolved' && !!d.resolvedByUserId),@@ -255,8 +255,8 @@ export const buildGoalGraphView = (});const byId = Object.fromEntries(views.map((view) => [view.node.id, view]));- // The coordinator's own frontier rule (GoalService.tick): a Work whose- // `depends_on` targets are all resolved. Blocked Work folds instead of listing.+ // The coordinator's own frontier rule (GoalService.tick): a Task whose+ // `depends_on` targets are all resolved. Blocked Tasks fold instead of listing.const frontier: FrontierItem[] = [];const blocked: GoalNodeView[] = [];for (const view of views) {@@ -285,7 +285,7 @@ export const buildGoalGraphView = (// Recency picks WHICH finished rows stay visible….sort((a, b) => resolvedTime(b.node) - resolvedTime(a.node)).slice(0, RECENT_DONE)- // …but the list displays them in the stable Work numbering (#1, #2, …) —+ // …but the list displays them in the stable task numbering (#1, #2, …) —// "most recently finished first" reads as the sequence having changed..sort((a, b) =>diff --git a/src/features/AgentGoals/ProcessControl/index.tsx b/src/features/AgentGoals/ProcessControl/index.tsxindex c924cbf16de..794fd15ddab 100644--- a/src/features/AgentGoals/ProcessControl/index.tsx+++ b/src/features/AgentGoals/ProcessControl/index.tsx@@ -68,7 +68,7 @@ const ProcessControl = memo<ProcessControlProps>();// Every click funnels here: keep the map highlight (spatial continuity) and- // open the drill-down — a dispatched Work goes straight to its Task detail,+ // open the drill-down — a dispatched Task goes straight to its Task detail,// everything else opens the node view. This is the chain the page was// missing: node → task → topic conversation.const select = useCallback(@@ -86,8 +86,8 @@ const ProcessControl = memo<ProcessControlProps>(if (!graph || graph.nodes.length === 0) return null;// The coordinator is decomposing the problem into tasks. `running` with zero- // Works counts too: the decomposition claim flips the status before the- // planner returns, and a re-plan after all Works were removed is the same+ // Task counts too: the decomposition claim flips the status before the+ // planner returns, and a re-plan after all Tasks were removed is the same// state. The surfaces below promise the incoming structure instead of// reading as an empty goal — the graph poll fills them in as nodes land.const planning =@@ -99,7 +99,7 @@ const ProcessControl = memo<ProcessControlProps>(const acceptanceConfig = graph.goal.config?.acceptance;const criteriaIds = acceptanceConfig?.criteriaIds ?? [];// A closed goal cannot move: the coordinator returns immediately for these,- // and a Work added here would sit `proposed` forever. Stop offering actions+ // and a Task added here would sit `proposed` forever. Stop offering actions// that cannot land. The goal otherwise advances entirely on its own — the// only legitimate human control over its pace is pause/resume.const closed = ['achieved', 'canceled', 'failed'].includes(graph.goal.status);diff --git a/src/features/Conversation/Messages/AssistantGroup/index.tsx b/src/features/Conversation/Messages/AssistantGroup/index.tsxindex 1d504c0bb4a..fb1619e5626 100644--- a/src/features/Conversation/Messages/AssistantGroup/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/index.tsx@@ -41,8 +41,8 @@ import {} from '../Contexts/message-action-context';import EditedFilesCard from '../EditedFilesCard';import { useOperationEditedFiles } from '../EditedFilesCard/useOperationEditedFiles';-import GoalWorkCard from '../GoalWorkCard';-import { useOperationGoals } from '../GoalWorkCard/useOperationGoals';+import GoalTaskCard from '../GoalTaskCard';+import { useOperationGoals } from '../GoalTaskCard/useOperationGoals';import MessageWorks from '../MessageWorks';import SignalCallbacks from '../SignalCallbacks';import FileListViewer from '../User/components/FileListViewer';@@ -291,7 +291,7 @@ const GroupMessage = memo<GroupMessageProps>(editedFiles.length > 0 || operationGoals.length > 0 ? (<Flexbox gap={8}>{editedFiles.length > 0 && <EditedFilesCard entries={editedFiles} />}- {operationGoals.length > 0 && <GoalWorkCard goals={operationGoals} />}+ {operationGoals.length > 0 && <GoalTaskCard goals={operationGoals} />}{workRootOperationId && <MessageWorks rootOperationId={workRootOperationId} />}</Flexbox>) : workRootOperationId ? (diff --git a/src/features/Conversation/Messages/GoalWorkCard/GoalElapsedTime.tsx b/src/features/Conversation/Messages/GoalTaskCard/GoalElapsedTime.tsxsimilarity index 100%rename from src/features/Conversation/Messages/GoalWorkCard/GoalElapsedTime.tsxrename to src/features/Conversation/Messages/GoalTaskCard/GoalElapsedTime.tsxdiff --git a/src/features/Conversation/Messages/GoalWorkCard/GoalStatusLine.tsx b/src/features/Conversation/Messages/GoalTaskCard/GoalStatusLine.tsxsimilarity index 92%rename from src/features/Conversation/Messages/GoalWorkCard/GoalStatusLine.tsxrename to src/features/Conversation/Messages/GoalTaskCard/GoalStatusLine.tsxindex ef86e5f0234..61f354907a3 100644--- a/src/features/Conversation/Messages/GoalWorkCard/GoalStatusLine.tsx+++ b/src/features/Conversation/Messages/GoalTaskCard/GoalStatusLine.tsx@@ -17,7 +17,7 @@ import {import { memo } from 'react';import { useTranslation } from 'react-i18next';-import type { GoalWorkPhase } from './goalWorkProgress';+import type { GoalTaskPhase } from './goalTaskProgress';const PHASE_META = {achieved: { color: cssVar.colorSuccess, icon: CheckCircle2Icon, spin: false },@@ -30,7 +30,7 @@ const PHASE_META = {verifying: { color: cssVar.colorInfo, icon: LoaderCircleIcon, spin: true },waiting: { color: cssVar.colorTextSecondary, icon: Clock3Icon, spin: false },} as const satisfies Record<- GoalWorkPhase,+ GoalTaskPhase,{ color: string; icon: typeof TargetIcon; spin: boolean }>;@@ -61,7 +61,7 @@ const styles = createStaticStyles(({ css }) => ({export interface GoalStatusLineProps {passed: number;- phase: GoalWorkPhase;+ phase: GoalTaskPhase;progress: number;total: number;}@@ -88,7 +88,7 @@ const GoalStatusLine = memo<GoalStatusLineProps>(({ passed, phase, progress, totsize={12}spin={meta.spin}/>- <Text className={styles.status}>{t(`goalWork.status.${phase}`)}</Text>+ <Text className={styles.status}>{t(`goalTask.status.${phase}`)}</Text><Text className={styles.status}>·</Text></>)}@@ -97,7 +97,7 @@ const GoalStatusLine = memo<GoalStatusLineProps>(({ passed, phase, progress, tot<div className={styles.progress}><div className={styles.progressFill} style={{ width: `${progress}%` }} /></div>- <Text className={styles.status}>{t('goalWork.workDone', { passed, total })}</Text>+ <Text className={styles.status}>{t('goalTask.tasksDone', { passed, total })}</Text></>)}</Flexbox>diff --git a/src/features/Conversation/Messages/GoalWorkCard/deriveOperationGoals.test.ts b/src/features/Conversation/Messages/GoalTaskCard/deriveOperationGoals.test.tssimilarity index 100%rename from src/features/Conversation/Messages/GoalWorkCard/deriveOperationGoals.test.tsrename to src/features/Conversation/Messages/GoalTaskCard/deriveOperationGoals.test.tsdiff --git a/src/features/Conversation/Messages/GoalWorkCard/deriveOperationGoals.ts b/src/features/Conversation/Messages/GoalTaskCard/deriveOperationGoals.tssimilarity index 100%rename from src/features/Conversation/Messages/GoalWorkCard/deriveOperationGoals.tsrename to src/features/Conversation/Messages/GoalTaskCard/deriveOperationGoals.tsdiff --git a/src/features/Conversation/Messages/GoalWorkCard/goalWorkProgress.test.ts b/src/features/Conversation/Messages/GoalTaskCard/goalTaskProgress.test.tssimilarity index 71%rename from src/features/Conversation/Messages/GoalWorkCard/goalWorkProgress.test.tsrename to src/features/Conversation/Messages/GoalTaskCard/goalTaskProgress.test.tsindex 5194988249b..4d7e9213d89 100644--- a/src/features/Conversation/Messages/GoalWorkCard/goalWorkProgress.test.ts+++ b/src/features/Conversation/Messages/GoalTaskCard/goalTaskProgress.test.ts@@ -1,16 +1,16 @@import { describe, expect, it } from 'vitest';-import { getGoalWorkProgress } from './goalWorkProgress';+import { getGoalTaskProgress } from './goalTaskProgress';-describe('getGoalWorkProgress', () => {+describe('getGoalTaskProgress', () => {it('reports how much of the graph is closed while it runs', () => {expect(- getGoalWorkProgress({ criteriaCount: 4, status: 'running', workDone: 2, workTotal: 3 }),+ getGoalTaskProgress({ criteriaCount: 4, status: 'running', taskDone: 2, taskTotal: 3 }),).toEqual({ passed: 2, phase: 'running', progress: 67, total: 3 });});it('falls back to the drafted criteria count before the graph is seeded', () => {- expect(getGoalWorkProgress({ criteriaCount: 4, status: 'planning' })).toEqual({+ expect(getGoalTaskProgress({ criteriaCount: 4, status: 'planning' })).toEqual({passed: 0,phase: 'running',progress: 0,@@ -22,7 +22,7 @@ describe('getGoalWorkProgress', () => {// A goal keeps its `running` row while a gate is open; the card must still// read as blocked on the user, not as work in progress.expect(- getGoalWorkProgress({ criteriaCount: 1, pendingDecisions: 1, status: 'running' }).phase,+ getGoalTaskProgress({ criteriaCount: 1, pendingDecisions: 1, status: 'running' }).phase,).toBe('waiting');});@@ -34,6 +34,6 @@ describe('getGoalWorkProgress', () => {['review', 'review'],['verifying', 'verifying'],] as const)('maps goal status %s to phase %s', (status, phase) => {- expect(getGoalWorkProgress({ criteriaCount: 1, status }).phase).toBe(phase);+ expect(getGoalTaskProgress({ criteriaCount: 1, status }).phase).toBe(phase);});});diff --git a/src/features/Conversation/Messages/GoalWorkCard/goalWorkProgress.ts b/src/features/Conversation/Messages/GoalTaskCard/goalTaskProgress.tssimilarity index 76%rename from src/features/Conversation/Messages/GoalWorkCard/goalWorkProgress.tsrename to src/features/Conversation/Messages/GoalTaskCard/goalTaskProgress.tsindex 5607759dbda..2a6cf6791b6 100644--- a/src/features/Conversation/Messages/GoalWorkCard/goalWorkProgress.ts+++ b/src/features/Conversation/Messages/GoalTaskCard/goalTaskProgress.ts@@ -1,6 +1,6 @@import type { GoalStatus } from '@lobechat/const/goal';-export type GoalWorkPhase =+export type GoalTaskPhase =| 'achieved'| 'canceled'| 'error'@@ -11,16 +11,16 @@ export type GoalWorkPhase =| 'verifying'| 'waiting';-interface GoalWorkProgressInput {+interface GoalTaskProgressInput {criteriaCount: number;/** Decision gates waiting on a human right now — they outrank the goal's own status. */pendingDecisions?: number;status?: GoalStatus;- workDone?: number;- workTotal?: number;+ taskDone?: number;+ taskTotal?: number;}-const resolvePhase = (status?: GoalStatus, pendingDecisions = 0): GoalWorkPhase => {+const resolvePhase = (status?: GoalStatus, pendingDecisions = 0): GoalTaskPhase => {if (pendingDecisions > 0) return 'waiting';switch (status) {case 'achieved': {@@ -49,12 +49,12 @@ const resolvePhase = (status?: GoalStatus, pendingDecisions = 0): GoalWorkPhase/*** Honest Goal progress for the conversation card: lifecycle phase plus how much- * of the graph's Work is closed. The criteria count is only a fallback for a+ * of the graph's Tasks are closed. The criteria count is only a fallback for a* goal whose graph has not been seeded yet.*/-export const getGoalWorkProgress = (input: GoalWorkProgressInput) => {- const total = input.workTotal || input.criteriaCount;- const passed = input.workDone ?? 0;+export const getGoalTaskProgress = (input: GoalTaskProgressInput) => {+ const total = input.taskTotal || input.criteriaCount;+ const passed = input.taskDone ?? 0;return {passed,diff --git a/src/features/Conversation/Messages/GoalWorkCard/index.tsx b/src/features/Conversation/Messages/GoalTaskCard/index.tsxsimilarity index 87%rename from src/features/Conversation/Messages/GoalWorkCard/index.tsxrename to src/features/Conversation/Messages/GoalTaskCard/index.tsxindex cd11d5e8ab3..65bc9098366 100644--- a/src/features/Conversation/Messages/GoalWorkCard/index.tsx+++ b/src/features/Conversation/Messages/GoalTaskCard/index.tsx@@ -12,10 +12,10 @@ import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwarimport type { OperationGoal } from './deriveOperationGoals';import GoalElapsedTime from './GoalElapsedTime';import GoalStatusLine from './GoalStatusLine';-import type { GoalWorkPhase } from './goalWorkProgress';-import { useGoalWorkStatus } from './useGoalWorkStatus';+import type { GoalTaskPhase } from './goalTaskProgress';+import { useGoalTaskStatus } from './useGoalTaskStatus';-const ACTIVE_PHASES = new Set<GoalWorkPhase>(['repairing', 'running', 'verifying']);+const ACTIVE_PHASES = new Set<GoalTaskPhase>(['repairing', 'running', 'verifying']);const styles = createStaticStyles(({ css }) => ({card: css`@@ -57,7 +57,7 @@ const styles = createStaticStyles(({ css }) => ({const GoalCard = memo<{ goal: OperationGoal }>(({ goal }) => {const navigate = useWorkspaceAwareNavigate();- const { agentId, progress, startedAt, title } = useGoalWorkStatus({+ const { agentId, progress, startedAt, title } = useGoalTaskStatus({criteriaCount: goal.criteriaCount,goalId: goal.goalId,});@@ -104,9 +104,9 @@ const GoalCard = memo<{ goal: OperationGoal }>(({ goal }) => {);});-GoalCard.displayName = 'GoalWorkCardItem';+GoalCard.displayName = 'GoalTaskCardItem';-const GoalWorkCard = memo<{ goals: OperationGoal[] }>(({ goals }) => {+const GoalTaskCard = memo<{ goals: OperationGoal[] }>(({ goals }) => {if (goals.length === 0) return null;return (@@ -118,6 +118,6 @@ const GoalWorkCard = memo<{ goals: OperationGoal[] }>(({ goals }) => {);});-GoalWorkCard.displayName = 'GoalWorkCard';+GoalTaskCard.displayName = 'GoalTaskCard';-export default GoalWorkCard;+export default GoalTaskCard;diff --git a/src/features/Conversation/Messages/GoalWorkCard/useGoalWorkStatus.test.ts b/src/features/Conversation/Messages/GoalTaskCard/useGoalTaskStatus.test.tssimilarity index 87%rename from src/features/Conversation/Messages/GoalWorkCard/useGoalWorkStatus.test.tsrename to src/features/Conversation/Messages/GoalTaskCard/useGoalTaskStatus.test.tsindex da67cb5edca..6e5f3cf1a32 100644--- a/src/features/Conversation/Messages/GoalWorkCard/useGoalWorkStatus.test.ts+++ b/src/features/Conversation/Messages/GoalTaskCard/useGoalTaskStatus.test.ts@@ -2,7 +2,7 @@ import type { GoalGraphSnapshot } from '@lobechat/types';import { renderHook } from '@testing-library/react';import { beforeEach, describe, expect, it, vi } from 'vitest';-import { useGoalWorkStatus } from './useGoalWorkStatus';+import { useGoalTaskStatus } from './useGoalTaskStatus';const mocks = vi.hoisted(() => ({goalGraphById: {} as Record<string, unknown>,@@ -40,21 +40,21 @@ const snapshot = (overrides: Partial<GoalGraphSnapshot> = {}) =>...overrides,}) as unknown as GoalGraphSnapshot;-describe('useGoalWorkStatus', () => {+describe('useGoalTaskStatus', () => {beforeEach(() => {mocks.goalGraphById = {};vi.clearAllMocks();});it('falls back to the drafted criteria count until the graph resolves', () => {- const { result } = renderHook(() => useGoalWorkStatus({ criteriaCount: 3, goalId: 'goal-1' }));+ const { result } = renderHook(() => useGoalTaskStatus({ criteriaCount: 3, goalId: 'goal-1' }));expect(mocks.useFetchGoalGraph).toHaveBeenCalledWith('goal-1');expect(result.current.progress).toMatchObject({ phase: 'running', total: 3 });expect(result.current.title).toBeUndefined();});- it('counts every terminal Work node as closed', () => {+ it('counts every terminal Task node as closed', () => {mocks.goalGraphById['goal-1'] = snapshot({nodes: [node('w1', 'task', 'resolved'),@@ -64,7 +64,7 @@ describe('useGoalWorkStatus', () => {] as never,});- const { result } = renderHook(() => useGoalWorkStatus({ goalId: 'goal-1' }));+ const { result } = renderHook(() => useGoalTaskStatus({ goalId: 'goal-1' }));expect(result.current.progress).toMatchObject({ passed: 2, total: 3 });expect(result.current.agentId).toBe('agt-1');@@ -77,7 +77,7 @@ describe('useGoalWorkStatus', () => {nodes: [node('w1', 'task', 'active')] as never,});- const { result } = renderHook(() => useGoalWorkStatus({ goalId: 'goal-1' }));+ const { result } = renderHook(() => useGoalTaskStatus({ goalId: 'goal-1' }));expect(result.current.progress.phase).toBe('waiting');});diff --git a/src/features/Conversation/Messages/GoalWorkCard/useGoalWorkStatus.ts b/src/features/Conversation/Messages/GoalTaskCard/useGoalTaskStatus.tssimilarity index 76%rename from src/features/Conversation/Messages/GoalWorkCard/useGoalWorkStatus.tsrename to src/features/Conversation/Messages/GoalTaskCard/useGoalTaskStatus.tsindex 4b1da83f836..2d6c418bbdc 100644--- a/src/features/Conversation/Messages/GoalWorkCard/useGoalWorkStatus.ts+++ b/src/features/Conversation/Messages/GoalTaskCard/useGoalTaskStatus.ts@@ -1,13 +1,13 @@import { goalSelectors, useGoalStore } from '@/store/goal';-import { getGoalWorkProgress } from './goalWorkProgress';+import { getGoalTaskProgress } from './goalTaskProgress';/*** Live Goal status for one `goals` row: the graph snapshot → phase and how much- * of its Work is closed. The card only holds the goal id, so everything else is+ * of its Tasks are closed. The card only holds the goal id, so everything else is* fetched here.*/-export const useGoalWorkStatus = ({+export const useGoalTaskStatus = ({criteriaCount = 0,goalId,}: {@@ -22,15 +22,15 @@ export const useGoalWorkStatus = ({return {agentId: snapshot?.goal.agentId ?? undefined,- progress: getGoalWorkProgress({+ progress: getGoalTaskProgress({criteriaCount,pendingDecisions:snapshot?.decisions.filter((decision) => decision.status === 'pending').length ?? 0,status: snapshot?.goal.status,- workDone: taskNodes.filter((node) =>+ taskDone: taskNodes.filter((node) =>['rejected', 'resolved', 'retired'].includes(node.status),).length,- workTotal: taskNodes.length,+ taskTotal: taskNodes.length,}),startedAt: snapshot?.goal.startedAt ?? undefined,title: snapshot?.goal.title,diff --git a/src/features/Conversation/Messages/GoalWorkCard/useOperationGoals.ts b/src/features/Conversation/Messages/GoalTaskCard/useOperationGoals.tssimilarity index 98%rename from src/features/Conversation/Messages/GoalWorkCard/useOperationGoals.tsrename to src/features/Conversation/Messages/GoalTaskCard/useOperationGoals.tsindex 918464bedb7..13b6e8a6479 100644--- a/src/features/Conversation/Messages/GoalWorkCard/useOperationGoals.ts+++ b/src/features/Conversation/Messages/GoalTaskCard/useOperationGoals.ts@@ -7,7 +7,7 @@ import { deriveOperationGoals, type OperationGoal } from './deriveOperationGoals* Display-only Goal artifacts derived from one settled assistant group.** The card tracks the goal itself, not one of the tasks its coordinator- * dispatches, so it stays for the whole life of the goal — a Work Task+ * dispatches, so it stays for the whole life of the goal — a Goal Task* finishing is progress inside the goal, not the end of it.*/export const useOperationGoals = (blocks?: AssistantContentBlock[]): OperationGoal[] =>diff --git a/src/features/HomeInbox/GoalsRailCard.tsx b/src/features/HomeInbox/GoalsRailCard.tsxindex c33591ee5bc..00a8c381257 100644--- a/src/features/HomeInbox/GoalsRailCard.tsx+++ b/src/features/HomeInbox/GoalsRailCard.tsx@@ -118,15 +118,15 @@ const GoalRow = memo<GoalRowProps>(({ bare, entry }) => {{entry.title}</Text><GoalAgentAvatar agentId={entry.agentId} />- {/* A goal is measured in the work it has closed, not in time — how far+ {/* A goal is measured in the tasks it has closed, not in time — how farthrough its own decomposition it is says more at a glance. */}<span className={cx(homeType.meta, styles.rounds)}>{entry.pendingDecisions > 0? t('goalList.needsYou', { count: entry.pendingDecisions, ns: 'chat' })- : t('goalList.workProgress', {- done: entry.workDone,+ : t('goalList.taskProgress', {+ done: entry.taskDone,ns: 'chat',- total: entry.workTotal,+ total: entry.taskTotal,})}</span><Icon color={cssVar.colorTextQuaternary} icon={ChevronRightIcon} size={14} />diff --git a/src/features/HomeInbox/homeGoals.test.ts b/src/features/HomeInbox/homeGoals.test.tsindex 02ee14872dd..02534a8f14b 100644--- a/src/features/HomeInbox/homeGoals.test.ts+++ b/src/features/HomeInbox/homeGoals.test.ts@@ -10,9 +10,9 @@ interface GoalOverrides {goal?: Partial<GoalListItem['goal']>;id: string;pendingDecisions?: number;+ taskDone?: number;+ taskTotal?: number;title?: string;- workDone?: number;- workTotal?: number;}const goal = ({ agentId = 'agt_1', id, goal: overrides, ...rest }: GoalOverrides): GoalListItem =>@@ -22,8 +22,8 @@ const goal = ({ agentId = 'agt_1', id, goal: overrides, ...rest }: GoalOverridespendingDecisions: 0,totalRunCost: 0,totalRunDuration: 0,- workDone: 1,- workTotal: 3,+ taskDone: 1,+ taskTotal: 3,...rest,}) as GoalListItem;@@ -74,15 +74,15 @@ describe('buildHomeGoalEntries', () => {});it('carries the graph roll-up the row renders', () => {- const goals = [goal({ id: 'x', pendingDecisions: 2, workDone: 2, workTotal: 5 })];+ const goals = [goal({ id: 'x', pendingDecisions: 2, taskDone: 2, taskTotal: 5 })];expect(buildHomeGoalEntries(goals)[0]).toMatchObject({agentId: 'agt_1',id: 'g-x',pendingDecisions: 2,title: 'goal x',- workDone: 2,- workTotal: 5,+ taskDone: 2,+ taskTotal: 5,});});});diff --git a/src/features/HomeInbox/homeGoals.ts b/src/features/HomeInbox/homeGoals.tsindex 5b1cee012c8..8981cfcf35d 100644--- a/src/features/HomeInbox/homeGoals.ts+++ b/src/features/HomeInbox/homeGoals.ts@@ -15,9 +15,9 @@ export interface HomeGoalEntry {pendingDecisions: number;/** Key in the `chat` namespace — the same label the goal pages use. */statusKey: GoalStatusKey;+ taskDone: number;+ taskTotal: number;title: string;- workDone: number;- workTotal: number;}/**@@ -57,8 +57,8 @@ export const buildHomeGoalEntries = (goals: GoalListItem[]): HomeGoalEntry[] =>pendingDecisions: item.pendingDecisions,statusKey,title: item.goal.title,- workDone: item.workDone,- workTotal: item.workTotal,+ taskDone: item.taskDone,+ taskTotal: item.taskTotal,},];});