agentSessionLock (prospecting/agent-session-schema.ts)

DeskcommCRM · lib/prospecting/agent-session-schema.ts · typescript · MIT
ai, tag:embed-classified

Zod schemas and lock key for prospecting agent session data, ensuring validation and consistency.

// Source: https://github.com/melgarafael/DeskcommCRM | License: MIT | Copyright 2026 Rafael Melgaço
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from "zod";
import { agentChatDraftSchema } from "./agent-chat-schema";
import { prospectingAgentSetupSchema } from "./agent-setup-schema";

export const agentSessionLock = (orgId: string, campaignId: string) =>
  `prospecting-agent-session:${orgId}:${campaignId}`;

export const agentSetupResultSchema = z
  .object({
    agent: z.object({ id: z.string().uuid(), name: z.string() }).strict(),
    version_id: z.string().uuid(),
    model_label: z.string(),
  })
  .strict();

export const agentSessionWriteSchema = z
  .object({
    messages: z
      .array(
        z
          .object({
            role: z.enum(["user

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key