feat(tools): add native team orchestration tool suite
Port team lifecycle, teammate runtime, inbox messaging, and team-scoped task flows into built-in tools so multi-agent coordination works natively without external server dependencies.
This commit is contained in:
committed by
YeonGyu-Kim
parent
4ab93c0cf7
commit
0f9c93fd55
@@ -0,0 +1,48 @@
|
||||
import { tool, type ToolDefinition } from "@opencode-ai/plugin/tool"
|
||||
import { readTeamConfigOrThrow } from "./team-config-store"
|
||||
import { TeamTaskUpdateInputSchema } from "./types"
|
||||
import { updateTeamTask } from "./team-task-update"
|
||||
import { notifyOwnerAssignment } from "./team-task-tools"
|
||||
|
||||
export function createTeamTaskUpdateTool(): ToolDefinition {
|
||||
return tool({
|
||||
description: "Update task status, owner, dependencies, and metadata in a team task list.",
|
||||
args: {
|
||||
team_name: tool.schema.string().describe("Team name"),
|
||||
task_id: tool.schema.string().describe("Task id"),
|
||||
status: tool.schema.enum(["pending", "in_progress", "completed", "deleted"]).optional().describe("Task status"),
|
||||
owner: tool.schema.string().optional().describe("Task owner"),
|
||||
subject: tool.schema.string().optional().describe("Task subject"),
|
||||
description: tool.schema.string().optional().describe("Task description"),
|
||||
active_form: tool.schema.string().optional().describe("Present-continuous form"),
|
||||
add_blocks: tool.schema.array(tool.schema.string()).optional().describe("Add task ids this task blocks"),
|
||||
add_blocked_by: tool.schema.array(tool.schema.string()).optional().describe("Add blocker task ids"),
|
||||
metadata: tool.schema.record(tool.schema.string(), tool.schema.unknown()).optional().describe("Metadata patch (null removes key)"),
|
||||
},
|
||||
execute: async (args: Record<string, unknown>): Promise<string> => {
|
||||
try {
|
||||
const input = TeamTaskUpdateInputSchema.parse(args)
|
||||
readTeamConfigOrThrow(input.team_name)
|
||||
|
||||
const task = updateTeamTask(input.team_name, input.task_id, {
|
||||
status: input.status,
|
||||
owner: input.owner,
|
||||
subject: input.subject,
|
||||
description: input.description,
|
||||
activeForm: input.active_form,
|
||||
addBlocks: input.add_blocks,
|
||||
addBlockedBy: input.add_blocked_by,
|
||||
metadata: input.metadata,
|
||||
})
|
||||
|
||||
if (input.owner !== undefined) {
|
||||
notifyOwnerAssignment(input.team_name, task)
|
||||
}
|
||||
|
||||
return JSON.stringify(task)
|
||||
} catch (error) {
|
||||
return JSON.stringify({ error: error instanceof Error ? error.message : "team_task_update_failed" })
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user