Add shared types package
Shared TypeScript types, Zod validators, API contract definitions, and constants used by both server and UI. Covers agents, goals, issues, projects, and activity entities. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
20
packages/shared/src/validators/agent.ts
Normal file
20
packages/shared/src/validators/agent.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { z } from "zod";
|
||||
import { AGENT_ROLES, AGENT_STATUSES } from "../constants.js";
|
||||
|
||||
export const createAgentSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
role: z.enum(AGENT_ROLES),
|
||||
budgetCents: z.number().int().nonnegative().optional().default(0),
|
||||
reportsTo: z.string().uuid().optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
});
|
||||
|
||||
export type CreateAgent = z.infer<typeof createAgentSchema>;
|
||||
|
||||
export const updateAgentSchema = createAgentSchema
|
||||
.partial()
|
||||
.extend({
|
||||
status: z.enum(AGENT_STATUSES).optional(),
|
||||
});
|
||||
|
||||
export type UpdateAgent = z.infer<typeof updateAgentSchema>;
|
||||
Reference in New Issue
Block a user