Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/orchestration/test/tasks/notice-claim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type { TaskSettledInput } from "../../src";
import { defineTaskCollection, type TaskCollectionRef, type TaskWorker } from "../../src/tasks";
import { taskBoard } from "../../src/task-board";
import {
askPerson,
awaitApproval,
fileCall,
finishTask,
finalAnswer,
Expand Down Expand Up @@ -163,7 +163,7 @@ describe.each(STORES)("a task's ending is heard once by its filer (%s)", { timeo
fileCall("f1"),
(opts) => {
taskId = waitedTaskId([opts], 0);
return askPerson("p1")(opts);
return awaitApproval("p1")(opts);
},
waitAgain("w1", () => taskId),
finalAnswer
Expand Down Expand Up @@ -199,7 +199,7 @@ describe.each(STORES)("a task's ending is heard once by its filer (%s)", { timeo
fileCall("f1"),
(opts) => {
taskId = waitedTaskId([opts], 0);
return askPerson("p1")(opts);
return awaitApproval("p1")(opts);
},
// Back from the park, the turn runs while the task ends: its notice is held for it.
finishTask("x1", () => taskId, "found it"),
Expand Down
10 changes: 5 additions & 5 deletions packages/orchestration/test/tasks/wait-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const fileCall = (id: string, question = "Is ACME's SOC 2 current?"): Ste
});

/** A step that parks the turn on a person, until they approve. */
export const askPerson = (id: string): StepFn => (_options) => ({
toolCalls: [{ toolCallId: id, toolName: "ask_person", args: {} }],
export const awaitApproval = (id: string): StepFn => (_options) => ({
toolCalls: [{ toolCallId: id, toolName: "await_approval", args: {} }],
finishReason: "tool-calls"
});

Expand Down Expand Up @@ -242,8 +242,8 @@ export function waitFlow(
return waited.ok ? shown(waited.task) : { ok: false, taskId: input.id, error: `${waited.error}: ${waited.message}` };
}
});
const askPersonTool = handler({
name: "ask_person",
const approvalTool = handler({
name: "await_approval",
inputSchema: z.object({}).passthrough(),
outputSchema: z.any(),
execute: async (_input, ctx) => ({ answer: await ctx.suspend!({ reason: "human_approval", message: "Go ahead?" }) })
Expand Down Expand Up @@ -328,7 +328,7 @@ export function waitFlow(
actions: {
run: {
block: sequencer({ name: "turn" }).step(
generator({ name: "agent", model, prompt: "p", tools: [wait, waitAgainTool, readTaskTool, fileTool, askPersonTool, finishTaskTool] })
generator({ name: "agent", model, prompt: "p", tools: [wait, waitAgainTool, readTaskTool, fileTool, approvalTool, finishTaskTool] })
),
inputSchema: z.object({}).passthrough(),
...(options.noticeAfterTurn === true ? { concurrency: "hold" as const } : {})
Expand Down
Loading