-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschemas.ts
More file actions
75 lines (63 loc) · 2.36 KB
/
Copy pathschemas.ts
File metadata and controls
75 lines (63 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { z } from "zod";
import { MESSAGE_KINDS } from "./types.js";
export const SpawnTeamTeammateSchema = z.object({
agent: z.string().min(1, "Agent file path is required (e.g. refinement.md)"),
mcp_servers: z.array(z.string()).optional(),
});
export const SpawnTeamSchema = z.object({
objective: z.string().min(1, "Team objective is required"),
teammates: z
.array(SpawnTeamTeammateSchema)
.min(1, "At least one teammate is required"),
});
export const AddTeammateSchema = z.object({
agent: z.string().min(1, "Agent file path is required"),
mcp_servers: z.array(z.string()).optional(),
});
export const RemoveTeammateSchema = z.object({
teammate_id: z.string().min(1, "Teammate ID is required"),
});
export const CreateTaskSchema = z.object({
title: z.string().min(1, "Task title is required"),
description: z.string().min(1, "Task description is required"),
depends_on: z.array(z.string()).optional().default([]),
exclusive_paths: z.array(z.string()).optional().default([]),
acceptance_criteria: z.array(z.string()).optional().default([]),
});
export const TeamStatusSchema = z.object({});
export const SendMessageSchema = z.object({
to: z.string().optional(),
broadcast: z.boolean().optional().default(false),
subject: z.string().min(1, "Subject is required"),
body: z.string().min(1, "Body is required"),
kind: z.enum(MESSAGE_KINDS).optional().default("info"),
});
export const WaitForTeamSchema = z.object({
timeout_seconds: z.number().positive().optional().default(300),
});
export const ReadArtifactSchema = z.object({
artifact_id: z.string().min(1, "Artifact ID is required"),
});
export type SpawnTeamParams = z.infer<typeof SpawnTeamSchema>;
export type AddTeammateParams = z.infer<typeof AddTeammateSchema>;
export type RemoveTeammateParams = z.infer<typeof RemoveTeammateSchema>;
export type CreateTaskParams = z.infer<typeof CreateTaskSchema>;
export type SendMessageParams = z.infer<typeof SendMessageSchema>;
export type WaitForTeamParams = z.infer<typeof WaitForTeamSchema>;
export type ReadArtifactParams = z.infer<typeof ReadArtifactSchema>;
export interface McpToolResult {
[key: string]: unknown;
content: Array<{
type: "text";
text: string;
}>;
}
export class AgentTeamsError extends Error {
constructor(
message: string,
public code: string
) {
super(message);
this.name = "AgentTeamsError";
}
}