refactor: remove name from WorkflowDefinition, fix threadId type errors
WorkflowDefinition no longer carries 'name' — name is a registry-level concern, not a bundle property. Also fixed all missing threadId in test fixtures to match the updated ThreadContext type. 小橘 <xiaoju@shazhou.work>
This commit is contained in:
@@ -11,7 +11,8 @@ function makeCtx(userContent: string): ThreadContext {
|
|||||||
meta: { maxRounds: 10 },
|
meta: { maxRounds: 10 },
|
||||||
timestamp: 1,
|
timestamp: 1,
|
||||||
},
|
},
|
||||||
steps: [],
|
steps: [],
|
||||||
|
threadId: "01TEST000000000000000000TR",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ describe("buildAgentPrompt", () => {
|
|||||||
const ctx: ThreadContext = {
|
const ctx: ThreadContext = {
|
||||||
start: startTask("fix the bug"),
|
start: startTask("fix the bug"),
|
||||||
steps: [],
|
steps: [],
|
||||||
|
threadId: "01TEST000000000000000000TR",
|
||||||
};
|
};
|
||||||
const text = buildAgentPrompt("You are an agent.", ctx);
|
const text = buildAgentPrompt("You are an agent.", ctx);
|
||||||
expect(text).toContain("You are an agent.");
|
expect(text).toContain("You are an agent.");
|
||||||
@@ -28,6 +29,7 @@ describe("buildAgentPrompt", () => {
|
|||||||
test("single step shows full content and meta, and includes tools", () => {
|
test("single step shows full content and meta, and includes tools", () => {
|
||||||
const ctx: ThreadContext = {
|
const ctx: ThreadContext = {
|
||||||
start: startTask("user task"),
|
start: startTask("user task"),
|
||||||
|
threadId: "01TEST000000000000000000TR",
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
role: "coder",
|
role: "coder",
|
||||||
@@ -50,6 +52,7 @@ describe("buildAgentPrompt", () => {
|
|||||||
test("two or more steps: previous steps are meta-only; latest step is full", () => {
|
test("two or more steps: previous steps are meta-only; latest step is full", () => {
|
||||||
const ctx: ThreadContext = {
|
const ctx: ThreadContext = {
|
||||||
start: startTask("first message full: task content here"),
|
start: startTask("first message full: task content here"),
|
||||||
|
threadId: "01TEST000000000000000000TR",
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
role: "planner",
|
role: "planner",
|
||||||
@@ -80,6 +83,7 @@ describe("buildAgentPrompt", () => {
|
|||||||
test("middle steps show meta summary only, not full content", () => {
|
test("middle steps show meta summary only, not full content", () => {
|
||||||
const ctx: ThreadContext = {
|
const ctx: ThreadContext = {
|
||||||
start: startTask("start"),
|
start: startTask("start"),
|
||||||
|
threadId: "01TEST000000000000000000TR",
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
role: "a",
|
role: "a",
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ function makeCtx(): ThreadContext {
|
|||||||
meta: { maxRounds: 10 },
|
meta: { maxRounds: 10 },
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
},
|
},
|
||||||
steps: [],
|
steps: [],
|
||||||
|
threadId: "01TEST000000000000000000TR",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ function fakeCtx(): ThreadContext {
|
|||||||
},
|
},
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
},
|
},
|
||||||
steps: [],
|
steps: [],
|
||||||
|
threadId: "01TEST000000000000000000TR",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ export async function executeThread(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bundleOptions: WorkflowFnOptions = {
|
const bundleOptions: WorkflowFnOptions = {
|
||||||
|
threadId: io.threadId,
|
||||||
isDryRun: options.isDryRun,
|
isDryRun: options.isDryRun,
|
||||||
maxRounds: options.maxRounds,
|
maxRounds: options.maxRounds,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ export type Moderator<M extends RoleMeta> = (
|
|||||||
|
|
||||||
/** Complete workflow definition as authored by users. */
|
/** Complete workflow definition as authored by users. */
|
||||||
export type WorkflowDefinition<M extends RoleMeta> = {
|
export type WorkflowDefinition<M extends RoleMeta> = {
|
||||||
name: string;
|
|
||||||
roles: { [K in keyof M & string]: Role<M[K]> };
|
roles: { [K in keyof M & string]: Role<M[K]> };
|
||||||
moderator: Moderator<M>;
|
moderator: Moderator<M>;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ function parseRunControlPayload(rec: Record<string, unknown>): RunCommand | null
|
|||||||
threadId,
|
threadId,
|
||||||
workflowName,
|
workflowName,
|
||||||
prompt,
|
prompt,
|
||||||
options: { threadId, isDryRun, maxRounds },
|
options: { isDryRun, maxRounds },
|
||||||
steps: parsedSteps.steps,
|
steps: parsedSteps.steps,
|
||||||
stepTimestamps: parsedSteps.stepTimestamps,
|
stepTimestamps: parsedSteps.stepTimestamps,
|
||||||
forkSourceThreadId,
|
forkSourceThreadId,
|
||||||
|
|||||||
Reference in New Issue
Block a user