Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events, heartbeat_runs, issue_comments. Add corresponding shared types and validators. Update existing schemas (agents, goals, issues, projects) with new fields for company association, budgets, and richer metadata. Generate initial Drizzle migration. Update seed data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
import { z } from "zod";
|
||||
import { AGENT_ROLES, AGENT_STATUSES } from "../constants.js";
|
||||
import {
|
||||
AGENT_ADAPTER_TYPES,
|
||||
AGENT_CONTEXT_MODES,
|
||||
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),
|
||||
role: z.enum(AGENT_ROLES).optional().default("general"),
|
||||
title: z.string().optional().nullable(),
|
||||
reportsTo: z.string().uuid().optional().nullable(),
|
||||
capabilities: z.string().optional().nullable(),
|
||||
adapterType: z.enum(AGENT_ADAPTER_TYPES).optional().default("process"),
|
||||
adapterConfig: z.record(z.unknown()).optional().default({}),
|
||||
contextMode: z.enum(AGENT_CONTEXT_MODES).optional().default("thin"),
|
||||
budgetMonthlyCents: z.number().int().nonnegative().optional().default(0),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
});
|
||||
|
||||
@@ -15,6 +25,13 @@ export const updateAgentSchema = createAgentSchema
|
||||
.partial()
|
||||
.extend({
|
||||
status: z.enum(AGENT_STATUSES).optional(),
|
||||
spentMonthlyCents: z.number().int().nonnegative().optional(),
|
||||
});
|
||||
|
||||
export type UpdateAgent = z.infer<typeof updateAgentSchema>;
|
||||
|
||||
export const createAgentKeySchema = z.object({
|
||||
name: z.string().min(1).default("default"),
|
||||
});
|
||||
|
||||
export type CreateAgentKey = z.infer<typeof createAgentKeySchema>;
|
||||
|
||||
Reference in New Issue
Block a user