feat(FN-4074): add priority option to task creation in engine and extension
Adds task priority support to the task creation flow, spanning the engine runtime (`agent-tools.ts`, `triage.ts`), the CLI extension interface (`extension.ts`), and corresponding documentation and tests. The changeset bumps `@runfusion/fusion` as a minor version. Fusion-Task-Id: FN-4074 Fusion-Task-Lineage: 726c0ae6-90fb-4c13-ace1-215a2becb2a9
This commit is contained in:
@@ -176,6 +176,7 @@ describe.skipIf(!SHOULD_RUN_EXTENSION_INTEGRATION)("built fn pi extension integr
|
||||
|
||||
expect(created.details.taskId).toMatch(/^[A-Z]+-\d+$/);
|
||||
expect(created.details.column).toBe("triage");
|
||||
expect(created.details.priority).toBe("normal");
|
||||
|
||||
const listTool = api.tools.get("fn_task_list")!;
|
||||
const listed = await listTool.execute("list-1", {}, undefined, undefined, makeCtx(tmpDir));
|
||||
@@ -186,6 +187,17 @@ describe.skipIf(!SHOULD_RUN_EXTENSION_INTEGRATION)("built fn pi extension integr
|
||||
await store.init();
|
||||
const persisted = await store.getTask(created.details.taskId);
|
||||
expect(persisted?.description).toBe("Ship the packed CLI contract");
|
||||
|
||||
const urgent = await createTool.execute(
|
||||
"create-2",
|
||||
{ description: "Needs urgency", priority: "high" },
|
||||
undefined,
|
||||
undefined,
|
||||
makeCtx(tmpDir),
|
||||
);
|
||||
expect(urgent.details.priority).toBe("high");
|
||||
const urgentPersisted = await store.getTask(urgent.details.taskId);
|
||||
expect(urgentPersisted?.priority).toBe("high");
|
||||
});
|
||||
|
||||
it("runs provisioning tools through the built extension", async () => {
|
||||
|
||||
@@ -269,6 +269,25 @@ describe.skipIf(!SHOULD_RUN_LEGACY_EXTENSION_INTEGRATION)("fn pi extension (lega
|
||||
expect(result.content[0].text).toContain("Fix the login button");
|
||||
expect(result.content[0].text).toContain("triage");
|
||||
expect(result.details.column).toBe("triage");
|
||||
expect(result.details.priority).toBe("normal");
|
||||
});
|
||||
|
||||
it("creates a task with explicit priority", async () => {
|
||||
const tool = api.tools.get("fn_task_create")!;
|
||||
const result = await tool.execute(
|
||||
"call-priority",
|
||||
{ description: "Urgent task", priority: "urgent" },
|
||||
undefined,
|
||||
undefined,
|
||||
makeCtx(tmpDir),
|
||||
);
|
||||
|
||||
expect(result.details.priority).toBe("urgent");
|
||||
expect(result.content[0].text).toContain("Priority: urgent");
|
||||
|
||||
const showTool = api.tools.get("fn_task_show")!;
|
||||
const show = await showTool.execute("s-priority", { id: result.details.taskId }, undefined, undefined, makeCtx(tmpDir));
|
||||
expect(show.details.task.priority).toBe("urgent");
|
||||
});
|
||||
|
||||
it("creates a task with dependencies", async () => {
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
validateNodeOverrideChange,
|
||||
type Task,
|
||||
type InsightCategory,
|
||||
type TaskPriority,
|
||||
type InsightStatus,
|
||||
type InsightRunStatus,
|
||||
type InsightRunTrigger,
|
||||
@@ -19,6 +20,7 @@ import {
|
||||
canAgentTakeImplementationTaskForExplicitRouting,
|
||||
formatRoleMismatchReason,
|
||||
resolveAgentProvisioningPolicy,
|
||||
TASK_PRIORITIES,
|
||||
} from "@fusion/core";
|
||||
import {
|
||||
getGhErrorMessage,
|
||||
@@ -406,6 +408,9 @@ export default function kbExtension(pi: ExtensionAPI) {
|
||||
description: "Agent ID to assign this task to (e.g. 'agent-abc123')",
|
||||
}),
|
||||
),
|
||||
priority: Type.Optional(
|
||||
StringEnum([...TASK_PRIORITIES], { description: "Task priority (low, normal, high, urgent)" }) as unknown as TSchema,
|
||||
),
|
||||
}),
|
||||
|
||||
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
||||
@@ -430,6 +435,7 @@ export default function kbExtension(pi: ExtensionAPI) {
|
||||
description: params.description.trim(),
|
||||
dependencies: params.depends,
|
||||
assignedAgentId: normalizedAgentId === null ? undefined : normalizedAgentId,
|
||||
priority: params.priority as TaskPriority | undefined,
|
||||
source: { sourceType: "api" },
|
||||
});
|
||||
|
||||
@@ -451,6 +457,7 @@ export default function kbExtension(pi: ExtensionAPI) {
|
||||
(task.assignedAgentId
|
||||
? `Assigned to: ${task.assignedAgentId}\n`
|
||||
: "") +
|
||||
`Priority: ${task.priority}\n` +
|
||||
`Path: .fusion/tasks/${task.id}/`,
|
||||
},
|
||||
],
|
||||
@@ -459,6 +466,7 @@ export default function kbExtension(pi: ExtensionAPI) {
|
||||
column: task.column,
|
||||
dependencies: task.dependencies,
|
||||
assignedAgentId: task.assignedAgentId,
|
||||
priority: task.priority,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user