@hyperbrowser/agent
Version:
Hyperbrowsers Web Agent
37 lines (36 loc) • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompletionValidateActionDefinition = exports.CompletionValidateAction = void 0;
const zod_1 = require("zod");
exports.CompletionValidateAction = zod_1.z
.object({
task: zod_1.z
.string()
.describe("The detailed description of the task to complete."),
completionCriteria: zod_1.z.array(zod_1.z.object({
subTask: zod_1.z
.string()
.describe("The description of the specific sub task of the task."),
subTaskSatisfied: zod_1.z
.boolean()
.describe("Is the specific sub task of the task completed."),
subTaskSatisfiedReason: zod_1.z
.string()
.describe("How and why has this subtask been marked as completed (if completed). Provide the result as well if this response required an action, and that action produced a result."),
})),
})
.describe(`Must run this before issuing the final complete action to validate that the task is completed.
Evaluate if all the sub parts of the task are completed, and so if the task itself is completed. If you don't run this step, you will be heavily penalized.`);
exports.CompletionValidateActionDefinition = {
type: "taskCompleteValidation",
actionParams: exports.CompletionValidateAction,
run: async (ctx, action) => {
const completionCriteria = action.completionCriteria
.map((subTask) => `subTask:${subTask.subTask} || condition satisfied: ${subTask.subTaskSatisfied}`)
.join("\n");
return {
success: true,
message: `Task Completion Report: \ntask:${action.task} \nsubtasks: \n${completionCriteria}`,
};
},
};