big format

This commit is contained in:
Dax Raad
2025-11-06 13:03:02 -05:00
parent 8729edc5e0
commit 1ea3a8eb9b
183 changed files with 2629 additions and 2497 deletions

View File

@@ -14,7 +14,10 @@ export const TaskTool = Tool.define("task", async () => {
const description = DESCRIPTION.replace(
"{agents}",
agents
.map((a) => `- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`)
.map(
(a) =>
`- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`,
)
.join("\n"),
)
return {
@@ -26,7 +29,8 @@ export const TaskTool = Tool.define("task", async () => {
}),
async execute(params, ctx) {
const agent = await Agent.get(params.subagent_type)
if (!agent) throw new Error(`Unknown agent type: ${params.subagent_type} is not a valid agent type`)
if (!agent)
throw new Error(`Unknown agent type: ${params.subagent_type} is not a valid agent type`)
const session = await Session.create({
parentID: ctx.sessionID,
title: params.description + ` (@${agent.name} subagent)`,
@@ -91,7 +95,9 @@ export const TaskTool = Tool.define("task", async () => {
let all
all = await Session.messages(session.id)
all = all.filter((x) => x.info.role === "assistant")
all = all.flatMap((msg) => msg.parts.filter((x: any) => x.type === "tool") as MessageV2.ToolPart[])
all = all.flatMap(
(msg) => msg.parts.filter((x: any) => x.type === "tool") as MessageV2.ToolPart[],
)
return {
title: params.description,
metadata: {