Skip to content
Visibility internal Owner _ Approver _ Created _ Updated _

AnalyzeOnboardingQuizSchema.ts



FieldValue
TypeTypeScript
SourceProduct/Projects/Onboarding_Quiz/Schemas/AnalyzeOnboardingQuizSchema.ts
ParentProduct
GitHubProduct/Projects/Onboarding_Quiz/Schemas/AnalyzeOnboardingQuizSchema.ts

This page is auto-generated. Edit the source to change the content.



import { z } from 'zod';
import { LifeDomainIdSchema } from '@dakoda/database/zod/enums/LifeDomainId.schema';
import {
  ProfileFieldFromAnalysisSchema,
  FactoidFromAnalysisSchema,
} from '@dakoda/memory/shared/MemoryAnalysisSchemas';

/**
 * Onboarding Quiz Analysis Output Schema
 *
 * Produced by the AnalyzeOnboardingQuiz bot after the onboarding quiz is completed.
 *
 * Root-level fields map to distinct storage destinations:
 *   - structuredAnalysis → stored with the quiz result for AI reference
 *   - profileFields      → written to the user profile
 *   - factoids           → entered into the factoid memory system
 *   - userEvaluation     → displayed to the user
 *   - activeDomainIds    → written to the user profile (consumed by multiple systems)
 */

// --- Sub-schemas ---

export const SkillGapSchema = z.object({
  domainId: z.string(),
  skill: z.string(),
  urgency: z.enum(['high', 'medium', 'low']),
  note: z.string(),
});

export const DomainPrioritySchema = z.object({
  domainId: z.string(),
  urgency: z.enum(['high', 'medium', 'low']),
  signal: z.string(),
});

export const UviloTagsSchema = z.object({
  lifeDomains: z.array(LifeDomainIdSchema).nullable(),
  issues: z.array(z.string()).nullable(),
  aspirations: z.array(z.string()).nullable(),
  practices: z.array(z.string()).nullable(),
});

export const OnboardingStructuredAnalysisSchema = z.object({
  oneLiner: z.string(),
  skillGaps: z.array(SkillGapSchema),
  motivationProfile: z.object({
    whyHere: z.string(),
    readiness: z.enum(['eager', 'open', 'cautious', 'resistant']),
    note: z.string(),
  }),
  priorities: z.array(DomainPrioritySchema),
  uviloTags: UviloTagsSchema.nullable(),
});

// --- Root analysis output ---

export const AnalyzeOnboardingQuizSchema = z.object({
  structuredAnalysis: OnboardingStructuredAnalysisSchema,
  profileFields: z.array(ProfileFieldFromAnalysisSchema),
  factoids: z.array(FactoidFromAnalysisSchema),
  userEvaluation: z.string(),
  activeDomainIds: z.array(z.string()),
});

// --- Exported types ---

export type SkillGap = z.infer<typeof SkillGapSchema>;
export type DomainPriority = z.infer<typeof DomainPrioritySchema>;
export type UviloTags = z.infer<typeof UviloTagsSchema>;
export type OnboardingStructuredAnalysis = z.infer<typeof OnboardingStructuredAnalysisSchema>;
export type AnalyzeOnboardingQuiz = z.infer<typeof AnalyzeOnboardingQuizSchema>;