2026-02-16 13:31:47 -06:00
|
|
|
import { z } from "zod";
|
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>
2026-02-17 09:07:22 -06:00
|
|
|
import {
|
|
|
|
|
AGENT_ADAPTER_TYPES,
|
|
|
|
|
AGENT_ROLES,
|
|
|
|
|
AGENT_STATUSES,
|
|
|
|
|
} from "../constants.js";
|
2026-02-16 13:31:47 -06:00
|
|
|
|
|
|
|
|
export const createAgentSchema = z.object({
|
|
|
|
|
name: z.string().min(1),
|
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>
2026-02-17 09:07:22 -06:00
|
|
|
role: z.enum(AGENT_ROLES).optional().default("general"),
|
|
|
|
|
title: z.string().optional().nullable(),
|
2026-02-16 13:31:47 -06:00
|
|
|
reportsTo: z.string().uuid().optional().nullable(),
|
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>
2026-02-17 09:07:22 -06:00
|
|
|
capabilities: z.string().optional().nullable(),
|
|
|
|
|
adapterType: z.enum(AGENT_ADAPTER_TYPES).optional().default("process"),
|
|
|
|
|
adapterConfig: z.record(z.unknown()).optional().default({}),
|
2026-02-17 12:24:38 -06:00
|
|
|
runtimeConfig: z.record(z.unknown()).optional().default({}),
|
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>
2026-02-17 09:07:22 -06:00
|
|
|
budgetMonthlyCents: z.number().int().nonnegative().optional().default(0),
|
2026-02-16 13:31:47 -06:00
|
|
|
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(),
|
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>
2026-02-17 09:07:22 -06:00
|
|
|
spentMonthlyCents: z.number().int().nonnegative().optional(),
|
2026-02-16 13:31:47 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type UpdateAgent = z.infer<typeof updateAgentSchema>;
|
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>
2026-02-17 09:07:22 -06:00
|
|
|
|
|
|
|
|
export const createAgentKeySchema = z.object({
|
|
|
|
|
name: z.string().min(1).default("default"),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type CreateAgentKey = z.infer<typeof createAgentKeySchema>;
|
2026-02-17 12:24:38 -06:00
|
|
|
|
|
|
|
|
export const wakeAgentSchema = z.object({
|
|
|
|
|
source: z.enum(["timer", "assignment", "on_demand", "automation"]).optional().default("on_demand"),
|
|
|
|
|
triggerDetail: z.enum(["manual", "ping", "callback", "system"]).optional(),
|
|
|
|
|
reason: z.string().optional().nullable(),
|
|
|
|
|
payload: z.record(z.unknown()).optional().nullable(),
|
|
|
|
|
idempotencyKey: z.string().optional().nullable(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type WakeAgent = z.infer<typeof wakeAgentSchema>;
|