SPB Git

Repository Public

dto.ts 2.1 KB 50 lines typescript

1/**2 * Server-local DTOs that `@aos/shared` (frozen) does not define. Additive to CONTRACT §8; the3 * web workstream may import this file by relative path, like `dto-auth.ts`.4 */5import { z } from 'zod';6import { Id, ModelInfo } from '@aos/shared';78const iso = z.string();910export const UpdateProject = z.object({11  name: z.string().min(1).max(80).optional(),12  description: z.string().max(2000).optional(),13  instructions: z.string().max(8000).optional(),14});15export type UpdateProject = z.infer<typeof UpdateProject>;1617/** `GET /models` item: `ModelInfo` + an optional staleness note (live listing failed or no API key). */18export const ModelInfoEx = ModelInfo.extend({ stale: z.boolean().optional(), note: z.string().optional() });19export type ModelInfoEx = z.infer<typeof ModelInfoEx>;2021export const SteeringMessage = z.object({ text: z.string().min(1).max(8000) });2223export const ArtifactDto = z.object({24  sha256: z.string(), name: z.string(), size: z.number(), mime: z.string(), stepSeq: z.number().nullable(), createdAt: iso,25});26export type ArtifactDto = z.infer<typeof ArtifactDto>;2728/** `GET /system/status`. Unknown ⇒ null, never a guess. Provider keys are reported as booleans only. */29export const SystemStatus = z.object({30  collectedAt: iso,31  version: z.string(),32  db: z.object({ ok: z.boolean(), latencyMs: z.number().nullable() }),33  worker: z.object({34    /** null = cannot tell (no `workers` table / row and no run currently leased). */35    alive: z.boolean().nullable(),36    lastSeenAt: iso.nullable(),37    source: z.enum(['workers', 'leases', 'none']),38    workers: z.array(z.object({ id: z.string(), lastSeenAt: iso, version: z.string().nullable() })),39  }),40  providers: z.object({ anthropic: z.boolean(), openai: z.boolean() }),41  counts: z.object({42    missionsQueued: z.number(), missionsRunning: z.number(), missionsWaiting: z.number(),43    pendingWaits: z.number(), wsClients: z.number(),44  }),45});46export type SystemStatus = z.infer<typeof SystemStatus>;4748export const Health = z.object({ ok: z.boolean(), version: z.string(), agent: z.literal('aos') });49export { Id };50
Files main
Menu

Theme