import { z } from 'zod';
// Step type enum
export const StepTypeSchema = z.enum([
'action', // User must perform a manual action
'verification', // User must verify something is correct
'acknowledgment', // User must acknowledge they understand
'confirmation', // User must confirm to proceed (yes/no outcome)
]);
export type StepType = z.infer<typeof StepTypeSchema>;
// Individual step definition
export const StepInputSchema = z.object({
id: z.string().describe('Unique identifier for the step'),
title: z.string().max(100).describe('Short title displayed in checklist'),
description: z.string().optional().describe('Detailed instructions or context'),
type: StepTypeSchema.default('action').describe('Type of step'),
required: z.boolean().default(true).describe('Whether step must be completed'),
dependsOn: z.array(z.string()).optional().describe('IDs of steps that must complete first'),
});
export type StepInput = z.infer<typeof StepInputSchema>;
// Main tool input schema
export const UserStepsInputSchema = z.object({
sessionId: z.string().optional().describe('Optional session ID for resuming a previous session'),
title: z.string().max(50).describe('Overall title for the step list'),
description: z.string().optional().describe('Context explaining why these steps are needed'),
steps: z.array(StepInputSchema).min(1).max(20).describe('List of steps (1-20)'),
allowPartialCompletion: z.boolean().default(false).describe('Allow returning with some steps incomplete'),
timeoutMs: z.number().positive().optional().describe('Timeout in milliseconds (default: no timeout)'),
});
export type UserStepsInput = z.infer<typeof UserStepsInputSchema>;
// Step status enum
export const StepStatusSchema = z.enum(['pending', 'completed', 'skipped']);
export type StepStatus = z.infer<typeof StepStatusSchema>;
// Step result in output
export const StepResultSchema = z.object({
id: z.string(),
status: StepStatusSchema,
completedAt: z.string().datetime().optional(),
notes: z.string().optional().describe('Optional user notes'),
});
export type StepResult = z.infer<typeof StepResultSchema>;
// Session status enum
export const SessionStatusSchema = z.enum(['active', 'completed', 'cancelled', 'timeout', 'partial']);
export type SessionStatus = z.infer<typeof SessionStatusSchema>;
// Tool output schema
export const UserStepsOutputSchema = z.object({
sessionId: z.string(),
status: SessionStatusSchema,
steps: z.array(StepResultSchema),
completedCount: z.number(),
totalCount: z.number(),
startedAt: z.string().datetime(),
completedAt: z.string().datetime().optional(),
});
export type UserStepsOutput = z.infer<typeof UserStepsOutputSchema>;