sweagent 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1816 @@
1
+ import * as ai from 'ai';
2
+ import { LanguageModelUsage, ModelMessage, Tool, FinishReason } from 'ai';
3
+ export { FinishReason, LanguageModelUsage, ModelMessage, Tool, ToolExecutionOptions, jsonSchema, tool } from 'ai';
4
+ import { z } from 'zod';
5
+
6
+ /**
7
+ * Custom error classes for the library
8
+ */
9
+ /**
10
+ * Base error class for all library errors
11
+ */
12
+ declare class LibraryError extends Error {
13
+ constructor(message: string, cause?: Error);
14
+ }
15
+ /**
16
+ * Error thrown when model operations fail
17
+ */
18
+ declare class ModelError extends LibraryError {
19
+ readonly provider?: string | undefined;
20
+ constructor(message: string, provider?: string | undefined, cause?: Error);
21
+ }
22
+ /**
23
+ * Error thrown when tool execution fails
24
+ */
25
+ declare class ToolError extends LibraryError {
26
+ readonly toolName?: string | undefined;
27
+ constructor(message: string, toolName?: string | undefined, cause?: Error);
28
+ }
29
+ /**
30
+ * Error thrown when tool input validation fails
31
+ */
32
+ declare class ValidationError extends LibraryError {
33
+ readonly errors?: unknown[] | undefined;
34
+ constructor(message: string, errors?: unknown[] | undefined);
35
+ }
36
+ /**
37
+ * Error thrown when agent execution fails
38
+ */
39
+ declare class AgentError extends LibraryError {
40
+ readonly iteration?: number | undefined;
41
+ constructor(message: string, iteration?: number | undefined, cause?: Error);
42
+ }
43
+ /**
44
+ * Error thrown when subagent execution fails
45
+ */
46
+ declare class SubagentError extends LibraryError {
47
+ readonly subagentName?: string | undefined;
48
+ constructor(message: string, subagentName?: string | undefined, cause?: Error);
49
+ }
50
+
51
+ /**
52
+ * Common types shared across modules
53
+ * Re-exports AI SDK message types; keeps sweagent-specific ImageInput and Logger
54
+ */
55
+
56
+ /**
57
+ * Image input for vision models
58
+ */
59
+ interface ImageInput {
60
+ /** Base64-encoded image data */
61
+ base64: string;
62
+ /** MIME type of the image */
63
+ mimeType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
64
+ /** Optional path to the source file */
65
+ path?: string;
66
+ }
67
+ /**
68
+ * Logger interface for pluggable logging
69
+ */
70
+ interface Logger {
71
+ debug(message: string, data?: Record<string, unknown>): void;
72
+ info(message: string, data?: Record<string, unknown>): void;
73
+ warn(message: string, data?: Record<string, unknown>): void;
74
+ error(message: string, error?: Error | Record<string, unknown>): void;
75
+ }
76
+
77
+ /**
78
+ * Simple logger with optional prefix and progress support
79
+ */
80
+
81
+ /**
82
+ * Log levels
83
+ */
84
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
85
+ /**
86
+ * Logger configuration
87
+ */
88
+ interface LoggerConfig {
89
+ /** Prefix for all log messages */
90
+ prefix?: string;
91
+ /** Minimum log level to output */
92
+ level?: LogLevel;
93
+ /** Whether to output timestamps */
94
+ timestamps?: boolean;
95
+ }
96
+ /**
97
+ * Create a logger with the given configuration
98
+ */
99
+ declare function createLogger(config?: LoggerConfig): Logger;
100
+
101
+ /**
102
+ * Utility functions
103
+ */
104
+
105
+ /**
106
+ * Sum token usage from multiple steps (AI SDK LanguageModelUsage)
107
+ */
108
+ declare function sumTokenUsage(usages: (LanguageModelUsage | undefined)[]): LanguageModelUsage;
109
+
110
+ /**
111
+ * Model-related types
112
+ * Uses AI SDK types for messages, tools, usage, and result shape
113
+ */
114
+
115
+ /**
116
+ * Tool type for model invocation
117
+ * Uses the default Tool type which accepts any input/output schema
118
+ */
119
+ type ModelTool = Tool;
120
+ /**
121
+ * Supported model providers
122
+ */
123
+ type ModelProvider = 'openai' | 'anthropic' | 'google';
124
+ /**
125
+ * Configuration for creating a model
126
+ */
127
+ interface ModelConfig {
128
+ /** The provider to use */
129
+ provider: ModelProvider;
130
+ /** The model name/ID */
131
+ model: string;
132
+ /** API key (optional, uses environment variable by default) */
133
+ apiKey?: string;
134
+ /** Temperature for generation (0-1) */
135
+ temperature?: number;
136
+ /** Maximum output tokens to generate */
137
+ maxOutputTokens?: number;
138
+ /** Base URL for the API (optional) */
139
+ baseUrl?: string;
140
+ }
141
+ /**
142
+ * Tool call shape returned by the model (AI SDK compatible)
143
+ */
144
+ interface ModelToolCall {
145
+ toolCallId: string;
146
+ toolName: string;
147
+ input: unknown;
148
+ }
149
+ /**
150
+ * Options for model invocation
151
+ */
152
+ interface InvokeOptions {
153
+ /** Tools the model can call */
154
+ tools?: Record<string, ModelTool>;
155
+ /** Maximum output tokens to generate */
156
+ maxOutputTokens?: number;
157
+ /** Temperature for generation */
158
+ temperature?: number;
159
+ /** Stop sequences */
160
+ stop?: string[];
161
+ }
162
+ /**
163
+ * Options for vision generation
164
+ */
165
+ interface VisionOptions extends InvokeOptions {
166
+ /** System prompt */
167
+ systemPrompt?: string;
168
+ /** Detail level for image analysis */
169
+ detail?: 'low' | 'high' | 'auto';
170
+ }
171
+ /**
172
+ * Response from a model invocation (AI SDK GenerateTextResult subset)
173
+ */
174
+ interface ModelResponse {
175
+ /** The generated text */
176
+ text: string;
177
+ /** Tool calls if any were made */
178
+ toolCalls: ModelToolCall[];
179
+ /** Token usage */
180
+ usage: LanguageModelUsage;
181
+ /** The finish reason */
182
+ finishReason: FinishReason;
183
+ }
184
+ /**
185
+ * A model instance that can generate responses
186
+ */
187
+ interface Model {
188
+ /** The provider of this model */
189
+ provider: ModelProvider;
190
+ /** The model name */
191
+ modelName: string;
192
+ /**
193
+ * Invoke the model with messages (AI SDK ModelMessage[])
194
+ */
195
+ invoke(messages: ModelMessage[], options?: InvokeOptions): Promise<ModelResponse>;
196
+ /**
197
+ * Generate a response with vision (images)
198
+ */
199
+ generateVision(prompt: string, images: ImageInput[], options?: VisionOptions): Promise<ModelResponse>;
200
+ }
201
+
202
+ /**
203
+ * Tool-related types
204
+ * Re-exports AI SDK Tool, tool, jsonSchema, ToolExecutionOptions; keeps ToolConfig and ToolContext for defineTool
205
+ */
206
+
207
+ /**
208
+ * Configuration for defining a tool (input to defineTool)
209
+ */
210
+ interface ToolConfig<TInput extends z.ZodType = z.ZodType, TOutput = unknown> {
211
+ /** Unique name for the tool */
212
+ name: string;
213
+ /** Description of what the tool does */
214
+ description: string;
215
+ /** Zod schema for input validation */
216
+ input: TInput;
217
+ /** The handler function that executes the tool */
218
+ handler: (input: z.infer<TInput>, context?: ToolContext) => Promise<TOutput>;
219
+ }
220
+ /**
221
+ * Logger interface for tool context
222
+ */
223
+ interface ToolLogger {
224
+ debug(message: string, data?: Record<string, unknown>): void;
225
+ info(message: string, data?: Record<string, unknown>): void;
226
+ warn(message: string, data?: Record<string, unknown>): void;
227
+ error(message: string, error?: Error | Record<string, unknown>): void;
228
+ }
229
+ /**
230
+ * Context passed to tool handlers
231
+ */
232
+ interface ToolContext {
233
+ /** Optional model for tools that need AI capabilities */
234
+ model?: {
235
+ invoke: (...args: unknown[]) => Promise<unknown>;
236
+ };
237
+ /** Optional logger */
238
+ logger?: ToolLogger;
239
+ /** Additional custom context */
240
+ [key: string]: unknown;
241
+ }
242
+ /**
243
+ * Result of tool execution (for executeTool / executeToolByName)
244
+ */
245
+ interface ToolExecutionResult<T = unknown> {
246
+ success: boolean;
247
+ output?: T;
248
+ error?: string;
249
+ }
250
+
251
+ /**
252
+ * Agent-related types
253
+ * Uses AI SDK types for messages, tool calls/results, and usage
254
+ */
255
+
256
+ /**
257
+ * Tool type for agent context
258
+ * Uses the default Tool type which accepts any input/output schema
259
+ */
260
+ type AgentTool = Tool;
261
+ /**
262
+ * Tool result shape (AI SDK compatible)
263
+ */
264
+ interface AgentToolResult {
265
+ toolCallId: string;
266
+ toolName: string;
267
+ output: unknown;
268
+ isError?: boolean;
269
+ }
270
+ /**
271
+ * Configuration for running an agent
272
+ */
273
+ interface AgentConfig {
274
+ /** The model to use for generation */
275
+ model: Model;
276
+ /** Tools available to the agent */
277
+ tools: Record<string, AgentTool>;
278
+ /** System prompt for the agent */
279
+ systemPrompt: string;
280
+ /** The user's input/query */
281
+ input: string;
282
+ /** Maximum number of iterations (tool call rounds) */
283
+ maxIterations?: number;
284
+ /** Callback for each step */
285
+ onStep?: (step: AgentStep) => void;
286
+ }
287
+ /**
288
+ * A single step in the agent's execution
289
+ */
290
+ interface AgentStep {
291
+ /** The iteration number (0-indexed) */
292
+ iteration: number;
293
+ /** The model's response text (if any) */
294
+ content?: string;
295
+ /** Tool calls made in this step (AI SDK shape) */
296
+ toolCalls?: ModelToolCall[];
297
+ /** Results from tool executions (AI SDK shape) */
298
+ toolResults?: AgentToolResult[];
299
+ /** Token usage for this step */
300
+ usage?: LanguageModelUsage;
301
+ }
302
+ /**
303
+ * Result of running an agent
304
+ */
305
+ interface AgentResult {
306
+ /** The final output from the agent */
307
+ output: string;
308
+ /** All steps taken during execution */
309
+ steps: AgentStep[];
310
+ /** Total token usage across all steps */
311
+ totalUsage?: LanguageModelUsage;
312
+ /** The full message history (ModelMessage[]) */
313
+ messages: ModelMessage[];
314
+ }
315
+
316
+ /**
317
+ * Subagent-related types
318
+ * Specialized agents with custom prompts, tool restrictions, and isolated context
319
+ */
320
+
321
+ /**
322
+ * Configuration for defining a subagent (input to defineSubagent)
323
+ */
324
+ interface SubagentConfig {
325
+ /** Unique identifier (kebab-case) */
326
+ name: string;
327
+ /** When the parent agent should delegate to this subagent */
328
+ description: string;
329
+ /** The subagent's system prompt */
330
+ systemPrompt: string;
331
+ /** Allowed tools; if omitted, subagent inherits parent's tools (minus disallowedTools) */
332
+ tools?: Record<string, AgentTool>;
333
+ /** Tools to deny from inherited set */
334
+ disallowedTools?: string[];
335
+ /** Model override; if omitted, subagent uses parent's model */
336
+ model?: ModelConfig;
337
+ /** Maximum iterations; defaults to 10 */
338
+ maxIterations?: number;
339
+ /** Callback for each step */
340
+ onStep?: (step: AgentStep) => void;
341
+ }
342
+ /**
343
+ * Validated subagent definition (returned by defineSubagent)
344
+ */
345
+ interface SubagentDefinition extends SubagentConfig {
346
+ /** Same as name; present for convenience */
347
+ name: string;
348
+ }
349
+ /**
350
+ * Result of running a subagent (extends AgentResult)
351
+ */
352
+ interface SubagentResult extends AgentResult {
353
+ /** Which subagent produced this result */
354
+ subagentName: string;
355
+ }
356
+
357
+ /**
358
+ * Agent loop: model + tools, AI SDK message shapes
359
+ */
360
+
361
+ /**
362
+ * Run an agent with the given configuration.
363
+ *
364
+ * 1. Calls the model with ModelMessage[] and tools
365
+ * 2. If no tool calls, returns the response
366
+ * 3. If tool calls, executes them and appends assistant + tool messages (AI SDK shape)
367
+ * 4. Repeats until done or max iterations reached
368
+ *
369
+ * @example
370
+ * ```typescript
371
+ * const result = await runAgent({
372
+ * model: createModel({ provider: 'openai', model: 'gpt-4o' }),
373
+ * tools: createToolSet({ search: searchTool, calculator: calculatorTool }),
374
+ * systemPrompt: 'You are a helpful assistant.',
375
+ * input: 'What is 2 + 2?',
376
+ * maxIterations: 10
377
+ * });
378
+ * console.log(result.output);
379
+ * ```
380
+ */
381
+ declare function runAgent(config: AgentConfig): Promise<AgentResult>;
382
+
383
+ /**
384
+ * Create a model instance based on provider
385
+ */
386
+
387
+ /**
388
+ * Create a model instance for the given provider
389
+ *
390
+ * @example
391
+ * ```typescript
392
+ * const model = createModel({
393
+ * provider: 'openai',
394
+ * model: 'gpt-4o',
395
+ * temperature: 0.7
396
+ * });
397
+ *
398
+ * const response = await model.invoke([
399
+ * { role: 'user', content: 'Hello!' }
400
+ * ]);
401
+ * ```
402
+ */
403
+ declare function createModel(config: ModelConfig): Model;
404
+
405
+ /**
406
+ * OpenAI model provider using AI SDK
407
+ */
408
+
409
+ /**
410
+ * Create an OpenAI model instance
411
+ */
412
+ declare function createOpenAIModel(config: ModelConfig): Model;
413
+
414
+ /**
415
+ * Anthropic model provider using AI SDK
416
+ */
417
+
418
+ /**
419
+ * Create an Anthropic model instance
420
+ */
421
+ declare function createAnthropicModel(config: ModelConfig): Model;
422
+
423
+ /**
424
+ * Google (Gemini) model provider using AI SDK
425
+ */
426
+
427
+ /**
428
+ * Create a Google (Gemini) model instance
429
+ */
430
+ declare function createGoogleModel(config: ModelConfig): Model;
431
+
432
+ /**
433
+ * Tools: defineTool, createToolSet, execute, zodToJsonSchema
434
+ */
435
+
436
+ /** Tool has description (and optional title) in config; name is the key in createToolSet. */
437
+ declare function defineTool<TInput extends z.ZodType, TOutput>(config: ToolConfig<TInput, TOutput>): Tool;
438
+ type ToolSet = Record<string, Tool>;
439
+ /** Pass a record: key = tool name (same as in defineTool config). */
440
+ declare function createToolSet(tools: ToolSet): ToolSet;
441
+ declare function getTools(toolSet: ToolSet): Tool[];
442
+ declare function getTool(toolSet: ToolSet, name: string): Tool | undefined;
443
+ declare function executeTool<TInput, TOutput>(toolImpl: Tool<TInput, TOutput>, input: TInput, options?: {
444
+ toolCallId?: string;
445
+ abortSignal?: AbortSignal;
446
+ }): Promise<ToolExecutionResult<TOutput>>;
447
+ declare function executeToolByName(tools: ToolSet, name: string, input: unknown, options?: {
448
+ toolCallId?: string;
449
+ abortSignal?: AbortSignal;
450
+ }): Promise<ToolExecutionResult>;
451
+
452
+ /**
453
+ * Subagents: define, run, and expose as tools to a parent agent
454
+ */
455
+
456
+ /**
457
+ * Validates and creates a subagent definition (analogous to defineTool).
458
+ * Name must be kebab-case.
459
+ */
460
+ declare function defineSubagent(config: SubagentConfig): SubagentDefinition;
461
+ interface RunSubagentOptions {
462
+ /** Parent's tools; used when definition does not specify tools (filtered by disallowedTools) */
463
+ parentTools?: Record<string, AgentTool>;
464
+ /** Parent's model; used when definition does not specify model */
465
+ parentModel?: Model;
466
+ }
467
+ /**
468
+ * Executes the subagent in isolation: resolves tools and model, runs runAgent, returns SubagentResult.
469
+ */
470
+ declare function runSubagent(definition: SubagentDefinition, input: string, options?: RunSubagentOptions): Promise<SubagentResult>;
471
+ interface CreateSubagentToolOptions {
472
+ parentTools?: Record<string, AgentTool>;
473
+ parentModel?: Model;
474
+ }
475
+ /**
476
+ * Wraps a subagent as an AI SDK Tool so a parent agent can delegate via a tool call.
477
+ * Input: { prompt: string }. Returns the subagent's final output string.
478
+ */
479
+ declare function createSubagentTool(definition: SubagentDefinition, options?: CreateSubagentToolOptions): AgentTool;
480
+ /**
481
+ * Creates a Record<string, Tool> from multiple subagent definitions, keyed by subagent_<name>.
482
+ */
483
+ declare function createSubagentToolSet(definitions: SubagentDefinition[], options?: CreateSubagentToolOptions): ToolSet;
484
+
485
+ /**
486
+ * MCP client types - transport, config, and response shapes
487
+ * for the Model Context Protocol client infrastructure.
488
+ */
489
+ /** Minimal transport interface matching the MCP SDK's transport contract. */
490
+ interface McpTransport {
491
+ start(): Promise<void>;
492
+ close(): Promise<void>;
493
+ send(message: unknown): Promise<void>;
494
+ }
495
+ /** How to connect to an MCP server. Exactly one of (url) or (command) must be set. */
496
+ interface McpClientConfig {
497
+ /** Streamable HTTP endpoint for the MCP server. */
498
+ url?: string;
499
+ /** Custom headers to send with HTTP requests (e.g. auth headers). */
500
+ headers?: Record<string, string>;
501
+ /** For stdio transport: command to spawn (e.g. "npx"). */
502
+ command?: string;
503
+ /** For stdio transport: arguments for the command. */
504
+ args?: string[];
505
+ }
506
+ /** Identity advertised to the MCP server during the handshake. */
507
+ interface McpClientInfo {
508
+ name: string;
509
+ version: string;
510
+ }
511
+ /** A single content block returned by an MCP tool call. */
512
+ interface McpToolContent {
513
+ type: string;
514
+ text?: string;
515
+ }
516
+ /**
517
+ * Options for `resolveConfig` that describe which env-var prefix to read
518
+ * and what error message to show when no config is found.
519
+ */
520
+ interface McpResolveOptions {
521
+ /**
522
+ * Env-var prefix. Given "STITCH_MCP" the helper reads:
523
+ * STITCH_MCP_URL, STITCH_MCP_API_KEY, STITCH_MCP_COMMAND, STITCH_MCP_ARGS
524
+ */
525
+ envPrefix: string;
526
+ /** Human-readable server name used in error messages (e.g. "Stitch"). */
527
+ serverLabel?: string;
528
+ /**
529
+ * Header name for the API key read from env (<PREFIX>_API_KEY).
530
+ * Defaults to "Authorization" (value sent as "Bearer <key>").
531
+ */
532
+ apiKeyHeader?: string;
533
+ }
534
+
535
+ /**
536
+ * BaseMcpClient - reusable MCP client with lazy connection and typed tool invocation.
537
+ * Extend and add domain methods that call this.callTool(name, args).
538
+ */
539
+
540
+ declare class BaseMcpClient {
541
+ private readonly info;
542
+ private readonly config;
543
+ private client;
544
+ private transport;
545
+ private connectPromise;
546
+ constructor(info: McpClientInfo, config: McpClientConfig);
547
+ /** Build config from options + env (<PREFIX>_URL, _API_KEY, _COMMAND, _ARGS). */
548
+ static resolveConfig(options?: McpClientConfig, resolveOpts?: McpResolveOptions): McpClientConfig;
549
+ private ensureConnected;
550
+ private doConnect;
551
+ /** Call MCP tool and parse result. Subclasses use this for typed domain methods. */
552
+ protected callTool<T>(name: string, args?: Record<string, unknown>): Promise<T>;
553
+ close(): Promise<void>;
554
+ }
555
+
556
+ /**
557
+ * Hello World tool
558
+ */
559
+ declare const helloWorldTool: ai.Tool;
560
+
561
+ /**
562
+ * Hello World agent - runs an agent with the hello world tool
563
+ */
564
+
565
+ interface HelloWorldAgentConfig {
566
+ /** User input (e.g. "Say hello to Alice") */
567
+ input: string;
568
+ /** Model config; defaults to OpenAI gpt-4o-mini */
569
+ model?: ModelConfig;
570
+ /** System prompt override */
571
+ systemPrompt?: string;
572
+ /** Max iterations; default 3 */
573
+ maxIterations?: number;
574
+ /** Callback for each step */
575
+ onStep?: (step: AgentStep) => void;
576
+ }
577
+ declare function runHelloWorldAgent(config: HelloWorldAgentConfig): Promise<AgentResult>;
578
+
579
+ /**
580
+ * Field-level schema for MongoDB collection fields
581
+ */
582
+
583
+ declare const fieldSchema: z.ZodObject<{
584
+ fieldName: z.ZodString;
585
+ fieldType: z.ZodEnum<{
586
+ string: "string";
587
+ number: "number";
588
+ boolean: "boolean";
589
+ object: "object";
590
+ enum: "enum";
591
+ Date: "Date";
592
+ "Types.ObjectId": "Types.ObjectId";
593
+ email: "email";
594
+ password: "password";
595
+ }>;
596
+ isArray: z.ZodBoolean;
597
+ isRequired: z.ZodBoolean;
598
+ isUnique: z.ZodBoolean;
599
+ values: z.ZodArray<z.ZodString>;
600
+ defaultVal: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodNull]>>;
601
+ relationTo: z.ZodOptional<z.ZodString>;
602
+ relationType: z.ZodOptional<z.ZodEnum<{
603
+ "": "";
604
+ "one-to-one": "one-to-one";
605
+ "many-to-one": "many-to-one";
606
+ }>>;
607
+ isPrivate: z.ZodBoolean;
608
+ }, z.core.$strip>;
609
+ type TFieldSchema = z.infer<typeof fieldSchema>;
610
+
611
+ /**
612
+ * Module (collection) level schema for MongoDB
613
+ */
614
+
615
+ declare const moduleSchema: z.ZodObject<{
616
+ moduleName: z.ZodString;
617
+ isUserModule: z.ZodBoolean;
618
+ authMethod: z.ZodOptional<z.ZodEnum<{
619
+ "": "";
620
+ EMAIL_AND_PASSWORD: "EMAIL_AND_PASSWORD";
621
+ PHONE_AND_OTP: "PHONE_AND_OTP";
622
+ }>>;
623
+ emailField: z.ZodOptional<z.ZodString>;
624
+ passwordField: z.ZodOptional<z.ZodString>;
625
+ phoneField: z.ZodOptional<z.ZodString>;
626
+ roleField: z.ZodOptional<z.ZodString>;
627
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodEnum<{
628
+ CREATE: "CREATE";
629
+ READ: "READ";
630
+ UPDATE: "UPDATE";
631
+ DELETE: "DELETE";
632
+ }>>>>;
633
+ fields: z.ZodArray<z.ZodObject<{
634
+ fieldName: z.ZodString;
635
+ fieldType: z.ZodEnum<{
636
+ string: "string";
637
+ number: "number";
638
+ boolean: "boolean";
639
+ object: "object";
640
+ enum: "enum";
641
+ Date: "Date";
642
+ "Types.ObjectId": "Types.ObjectId";
643
+ email: "email";
644
+ password: "password";
645
+ }>;
646
+ isArray: z.ZodBoolean;
647
+ isRequired: z.ZodBoolean;
648
+ isUnique: z.ZodBoolean;
649
+ values: z.ZodArray<z.ZodString>;
650
+ defaultVal: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodNull]>>;
651
+ relationTo: z.ZodOptional<z.ZodString>;
652
+ relationType: z.ZodOptional<z.ZodEnum<{
653
+ "": "";
654
+ "one-to-one": "one-to-one";
655
+ "many-to-one": "many-to-one";
656
+ }>>;
657
+ isPrivate: z.ZodBoolean;
658
+ }, z.core.$strip>>;
659
+ }, z.core.$strip>;
660
+ type TModuleSchema$1 = z.infer<typeof moduleSchema>;
661
+
662
+ /**
663
+ * Root project schema for MongoDB database design
664
+ */
665
+
666
+ declare const projectSchema: z.ZodObject<{
667
+ projectName: z.ZodString;
668
+ projectDescription: z.ZodString;
669
+ modules: z.ZodArray<z.ZodObject<{
670
+ moduleName: z.ZodString;
671
+ isUserModule: z.ZodBoolean;
672
+ authMethod: z.ZodOptional<z.ZodEnum<{
673
+ "": "";
674
+ EMAIL_AND_PASSWORD: "EMAIL_AND_PASSWORD";
675
+ PHONE_AND_OTP: "PHONE_AND_OTP";
676
+ }>>;
677
+ emailField: z.ZodOptional<z.ZodString>;
678
+ passwordField: z.ZodOptional<z.ZodString>;
679
+ phoneField: z.ZodOptional<z.ZodString>;
680
+ roleField: z.ZodOptional<z.ZodString>;
681
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodEnum<{
682
+ CREATE: "CREATE";
683
+ READ: "READ";
684
+ UPDATE: "UPDATE";
685
+ DELETE: "DELETE";
686
+ }>>>>;
687
+ fields: z.ZodArray<z.ZodObject<{
688
+ fieldName: z.ZodString;
689
+ fieldType: z.ZodEnum<{
690
+ string: "string";
691
+ number: "number";
692
+ boolean: "boolean";
693
+ object: "object";
694
+ enum: "enum";
695
+ Date: "Date";
696
+ "Types.ObjectId": "Types.ObjectId";
697
+ email: "email";
698
+ password: "password";
699
+ }>;
700
+ isArray: z.ZodBoolean;
701
+ isRequired: z.ZodBoolean;
702
+ isUnique: z.ZodBoolean;
703
+ values: z.ZodArray<z.ZodString>;
704
+ defaultVal: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodNull]>>;
705
+ relationTo: z.ZodOptional<z.ZodString>;
706
+ relationType: z.ZodOptional<z.ZodEnum<{
707
+ "": "";
708
+ "one-to-one": "one-to-one";
709
+ "many-to-one": "many-to-one";
710
+ }>>;
711
+ isPrivate: z.ZodBoolean;
712
+ }, z.core.$strip>>;
713
+ }, z.core.$strip>>;
714
+ author: z.ZodDefault<z.ZodString>;
715
+ }, z.core.$strip>;
716
+ type TBackendProjectSchema = z.infer<typeof projectSchema>;
717
+
718
+ /**
719
+ * db-designer module types - structured requirements and agent config
720
+ */
721
+
722
+ interface Actor {
723
+ id: string;
724
+ name: string;
725
+ description: string;
726
+ goals: string[];
727
+ }
728
+ interface ExtractedFlow {
729
+ id: string;
730
+ actorId: string;
731
+ name: string;
732
+ description: string;
733
+ trigger: string;
734
+ outcome: string;
735
+ }
736
+ interface ExtractedStory {
737
+ id: string;
738
+ flowId: string;
739
+ actor: string;
740
+ action: string;
741
+ benefit: string;
742
+ preconditions: string[];
743
+ postconditions: string[];
744
+ dataInvolved: string[];
745
+ }
746
+ interface TechnicalRequirements {
747
+ authentication: 'none' | 'email' | 'oauth' | 'phone' | 'email_and_phone';
748
+ authorization: boolean;
749
+ roles?: string[];
750
+ integrations?: string[];
751
+ realtime?: boolean;
752
+ fileUpload?: boolean;
753
+ search?: boolean;
754
+ }
755
+ interface StructuredRequirementsInput {
756
+ projectName: string;
757
+ projectGoal: string;
758
+ projectDescription?: string;
759
+ actors: Actor[];
760
+ flows: ExtractedFlow[];
761
+ stories: ExtractedStory[];
762
+ technicalRequirements?: TechnicalRequirements;
763
+ }
764
+ interface DbDesignerAgentConfig {
765
+ /** User input: natural language requirement or instruction */
766
+ input: string;
767
+ /** Model config; optional, caller can pass via runAgent */
768
+ model?: ModelConfig;
769
+ /** Max iterations; default 15 */
770
+ maxIterations?: number;
771
+ /** Callback for each step */
772
+ onStep?: (step: AgentStep) => void;
773
+ }
774
+
775
+ /**
776
+ * System prompt for database design - 5-phase analysis framework
777
+ */
778
+ declare const DB_DESIGN_SYSTEM_PROMPT = "You are an expert MongoDB database architect with deep expertise in schema design, performance optimization, scalability, and domain-driven design. You analyze requirements systematically using a multi-phase approach to create production-ready database schemas.\n\n## ANALYSIS FRAMEWORK\n\nYou MUST follow this 5-phase analysis process before generating the schema:\n\n### PHASE 1: Entity Discovery\nSystematically extract all entities from the provided requirements:\n\n1. **From dataInvolved fields**: Every item in user stories' dataInvolved[] array indicates a potential entity or field\n - Pattern: \"User Profile\" \u2192 user collection with profile fields\n - Pattern: \"Order Items\" \u2192 order collection + item collection with relationship\n - Pattern: \"Product Inventory\" \u2192 product collection with inventory fields\n\n2. **From User Types (Actors)**: Each actor type may indicate a User variant or role\n - Pattern: \"Admin\", \"Customer\", \"Vendor\" \u2192 User collection with role enum\n - Pattern: \"Guest\" \u2192 May not need persistence, or limited session data\n\n3. **From User Flow Actions**: Action verbs reveal implicit entities\n - \"creates order\" \u2192 Order collection\n - \"submits payment\" \u2192 Payment collection\n - \"uploads document\" \u2192 Document collection\n - \"sends message\" \u2192 Message collection\n\n4. **From Flow States**: Transitions reveal status enums\n - Flow: pending \u2192 approved \u2192 completed \u2192 Order.status enum\n - Flow: draft \u2192 published \u2192 archived \u2192 Content.status enum\n\n### PHASE 2: Relationship Mapping\nFor each entity pair, determine relationships based on:\n\n1. **Ownership Patterns** (from actor actions):\n - \"Customer places Order\" \u2192 Order.customer (many-to-one to User)\n - \"Admin approves Request\" \u2192 Request.approvedBy (many-to-one to User)\n - \"User creates Post\" \u2192 Post.author (many-to-one to User)\n\n2. **Cardinality from Flow Context**:\n - \"User has one profile\" \u2192 one-to-one\n - \"User places multiple orders\" \u2192 many-to-one (Order \u2192 User)\n - \"Order contains items\" \u2192 many-to-one (OrderItem \u2192 Order)\n\n3. **Shared Entities** (referenced across flows):\n - Entity referenced by multiple actors \u2192 likely needs relationships to User\n - Entity in multiple flows \u2192 likely a core/central entity\n\n4. **Bidirectional References** (for one-to-one):\n - Include reference field in BOTH collections for one-to-one relationships\n\n### PHASE 3: Permission Derivation\nMap actors to RBAC permissions:\n\n1. **Role Extraction**: Each actor type becomes a role value\n - actors: [Admin, Customer, Vendor] \u2192 role enum: ['admin', 'customer', 'vendor']\n\n2. **Permission Mining from User Stories**:\n - \"As Admin, I can delete users\" \u2192 admin: ['CREATE', 'READ', 'UPDATE', 'DELETE'] on user\n - \"As Customer, I can view my orders\" \u2192 customer: ['READ'] on order (own records)\n - \"As Vendor, I can update products\" \u2192 vendor: ['CREATE', 'READ', 'UPDATE'] on product\n\n3. **Data Visibility Rules**:\n - \"view own\" \u2192 READ permission with ownership filter\n - \"view all\" \u2192 READ permission without filter\n - \"manage\" \u2192 full CRUD permissions\n\n### PHASE 4: Query Pattern Inference\nAnalyze flows to predict database access patterns:\n\n1. **Read Patterns** (suggest indexes):\n - \"list orders by date\" \u2192 index on order.createdAt\n - \"search products by category\" \u2192 index on product.category\n - \"find user by email\" \u2192 unique index on user.email\n - \"filter by status\" \u2192 index on status field\n\n2. **Write Patterns** (affect schema design):\n - High-frequency writes \u2192 consider denormalization\n - Audit requirements \u2192 add createdBy, updatedBy fields\n\n3. **Aggregation Needs** (from reporting flows):\n - \"view sales dashboard\" \u2192 may need summary collections\n - \"generate reports\" \u2192 ensure proper indexing for date ranges\n\n### PHASE 5: Schema Construction\nSynthesize all analyses into the final schema:\n\n1. **Module Definition**:\n - One module per core entity\n - camelCase module names (never 'auth' or 'authentication')\n - Mark user modules with isUserModule: true\n\n2. **Field Completeness**:\n - All fields from dataInvolved\n - Relationship fields (Types.ObjectId with relationTo)\n - Status/lifecycle fields (enum type with values from flow states)\n - Audit fields: createdAt, updatedAt (Date, required)\n - createdBy, updatedBy when flows mention \"who did what\"\n\n3. **Validation Constraints**:\n - isRequired: true for fields mentioned in preconditions\n - isUnique: true for identifier fields (email, slug, code)\n - enum values from flow states and categorical data\n\n4. **Security Fields**:\n - password fields: fieldType: 'password', isPrivate: true\n - email fields: fieldType: 'email', isUnique: true\n\n## CORE CONSTRAINTS (MUST FOLLOW)\n\n1. **Primary Key**: _id with Types.ObjectId (auto-generated, do not include in fields)\n\n2. **Relationships**:\n - One-to-One: Reference field in BOTH collections\n - Many-to-One: Reference in the \"many\" side only\n - Many-to-Many: ONLY when necessary, use intermediate collection\n - One-to-Many: FORBIDDEN - invert to many-to-one from child\n\n3. **Data Types**:\n - NO arrays of ObjectIds for relationships\n - Timestamps: createdAt, updatedAt (Date) in EVERY collection\n - Enums: Use fieldType: 'enum' with values array\n\n4. **Security**:\n - NO separate \"Auth\" or \"Authentication\" collection\n - NO token storage in database\n - Password fields: isPrivate: true\n\n5. **Authorization (RBAC)**:\n - Define permissions per role on user modules\n - Format: {{ \"roleName\": [\"CREATE\", \"READ\", \"UPDATE\", \"DELETE\"] }}";
779
+
780
+ /**
781
+ * Design prompts - legacy and pro-level, plus structured requirement formatters
782
+ */
783
+
784
+ /**
785
+ * Legacy: build design prompt from plain requirement string
786
+ */
787
+ declare function createDbDesignPrompt(requirement: string): string;
788
+ /**
789
+ * Format actors/user types into prompt-friendly string
790
+ */
791
+ declare function formatUserTypes(actors: Actor[]): string;
792
+ /**
793
+ * Format user flows into prompt-friendly string
794
+ */
795
+ declare function formatUserFlows(flows: ExtractedFlow[], actors: Actor[]): string;
796
+ /**
797
+ * Format user stories with dataInvolved into prompt-friendly string
798
+ */
799
+ declare function formatUserStories(stories: ExtractedStory[], flows: ExtractedFlow[]): string;
800
+ /**
801
+ * Format technical requirements into prompt-friendly string
802
+ */
803
+ declare function formatTechnicalRequirements(tech?: TechnicalRequirements): string;
804
+ /**
805
+ * Extract all unique dataInvolved items from stories for entity hints
806
+ */
807
+ declare function extractDataEntities(stories: ExtractedStory[]): string[];
808
+ /**
809
+ * Extract roles from actors for RBAC configuration
810
+ */
811
+ declare function extractRoles(actors: Actor[]): string[];
812
+ /**
813
+ * Build complete prompt variables from structured requirements
814
+ */
815
+ declare function buildPromptVariables(input: StructuredRequirementsInput): Record<string, string>;
816
+ /**
817
+ * Pro-level DB design prompt from structured requirements
818
+ */
819
+ declare function createProDbDesignPrompt(input: StructuredRequirementsInput): string;
820
+
821
+ /**
822
+ * Redesign prompt - update existing schema based on user feedback
823
+ */
824
+ declare function createRedesignPrompt(existingSchema: string, userFeedback: string): string;
825
+
826
+ /**
827
+ * validate_schema tool - validates JSON against projectSchema (no AI)
828
+ */
829
+ declare const validateSchemaTool: ai.Tool;
830
+
831
+ /**
832
+ * Creates the design_database tool. Requires a model to invoke for schema generation.
833
+ */
834
+ declare function createDesignDatabaseTool(model: Model): ai.Tool;
835
+
836
+ /**
837
+ * Creates the design_database_pro tool. Requires a model for schema generation.
838
+ */
839
+ declare function createDesignDatabaseProTool(model: Model): ai.Tool;
840
+
841
+ /**
842
+ * Creates the redesign_database tool. Requires a model for schema update.
843
+ */
844
+ declare function createRedesignDatabaseTool(model: Model): ai.Tool;
845
+
846
+ /**
847
+ * Create all db-designer tools for the agent. Pass the model for AI-backed tools.
848
+ */
849
+ declare function createDbDesignerTools(model: Model): ToolSet;
850
+
851
+ /**
852
+ * entity-analyzer subagent - extracts entities, relationships, and roles from requirements (no tools)
853
+ */
854
+ declare const entityAnalyzerSubagent: SubagentDefinition;
855
+
856
+ /**
857
+ * schema-refiner subagent - validates schema and suggests refinements (has validate_schema tool)
858
+ */
859
+ declare function createSchemaRefinerSubagent(): SubagentDefinition;
860
+
861
+ /**
862
+ * runDbDesignerAgent - orchestrator for the full DB design workflow
863
+ */
864
+
865
+ /**
866
+ * Run the db-designer orchestrator agent with all tools and subagents.
867
+ */
868
+ declare function runDbDesignerAgent(config: DbDesignerAgentConfig): Promise<AgentResult>;
869
+
870
+ /**
871
+ * Branding schema for frontend app config
872
+ */
873
+
874
+ declare const BrandingSchema: z.ZodObject<{
875
+ brandName: z.ZodString;
876
+ primaryColor: z.ZodString;
877
+ secondaryColor: z.ZodString;
878
+ logo: z.ZodURL;
879
+ }, z.core.$strip>;
880
+ type TBrandingSchema = z.infer<typeof BrandingSchema>;
881
+
882
+ /**
883
+ * App configuration schema
884
+ */
885
+
886
+ declare const AppConfigSchema: z.ZodObject<{
887
+ name: z.ZodString;
888
+ description: z.ZodString;
889
+ author: z.ZodDefault<z.ZodString>;
890
+ branding: z.ZodObject<{
891
+ brandName: z.ZodString;
892
+ primaryColor: z.ZodString;
893
+ secondaryColor: z.ZodString;
894
+ logo: z.ZodURL;
895
+ }, z.core.$strip>;
896
+ apiEndpoint: z.ZodURL;
897
+ }, z.core.$strip>;
898
+ type TAppConfigSchema = z.infer<typeof AppConfigSchema>;
899
+
900
+ /**
901
+ * Form field, validation, options, and column schemas
902
+ */
903
+
904
+ declare const ValidationSchema: z.ZodObject<{
905
+ minLength: z.ZodOptional<z.ZodNumber>;
906
+ zodString: z.ZodString;
907
+ }, z.core.$strip>;
908
+ declare const FieldOptionsSchema: z.ZodObject<{
909
+ hookName: z.ZodOptional<z.ZodString>;
910
+ queryString: z.ZodOptional<z.ZodString>;
911
+ labelKey: z.ZodOptional<z.ZodString>;
912
+ valueKey: z.ZodOptional<z.ZodString>;
913
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
914
+ }, z.core.$strip>;
915
+ declare const FormFieldSchema: z.ZodObject<{
916
+ name: z.ZodString;
917
+ type: z.ZodEnum<{
918
+ number: "number";
919
+ text: "text";
920
+ image: "image";
921
+ date: "date";
922
+ email: "email";
923
+ password: "password";
924
+ multiSelect: "multiSelect";
925
+ textarea: "textarea";
926
+ hidden: "hidden";
927
+ select: "select";
928
+ }>;
929
+ required: z.ZodOptional<z.ZodBoolean>;
930
+ validation: z.ZodOptional<z.ZodObject<{
931
+ minLength: z.ZodOptional<z.ZodNumber>;
932
+ zodString: z.ZodString;
933
+ }, z.core.$strip>>;
934
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
935
+ options: z.ZodOptional<z.ZodObject<{
936
+ hookName: z.ZodOptional<z.ZodString>;
937
+ queryString: z.ZodOptional<z.ZodString>;
938
+ labelKey: z.ZodOptional<z.ZodString>;
939
+ valueKey: z.ZodOptional<z.ZodString>;
940
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
941
+ }, z.core.$strip>>;
942
+ }, z.core.$strip>;
943
+ declare const ColumnSchema: z.ZodObject<{
944
+ field: z.ZodString;
945
+ label: z.ZodString;
946
+ }, z.core.$strip>;
947
+ type TFormFieldSchema = z.infer<typeof FormFieldSchema>;
948
+ type TColumnSchema = z.infer<typeof ColumnSchema>;
949
+
950
+ /**
951
+ * API, drawer, auth page, listing page, and page union schemas
952
+ */
953
+
954
+ declare const ApiResponseTypeSchema: z.ZodOptional<z.ZodObject<{
955
+ type: z.ZodString;
956
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
957
+ type: z.ZodString;
958
+ }, z.core.$strip>>;
959
+ }, z.core.$strip>>;
960
+ type TApiResponseTypeSchema = z.infer<typeof ApiResponseTypeSchema>;
961
+ declare const ListingPageApiSchema: z.ZodObject<{
962
+ type: z.ZodEnum<{
963
+ list: "list";
964
+ create: "create";
965
+ update: "update";
966
+ delete: "delete";
967
+ getById: "getById";
968
+ }>;
969
+ graphqlHook: z.ZodString;
970
+ queryString: z.ZodString;
971
+ responseType: z.ZodOptional<z.ZodObject<{
972
+ type: z.ZodString;
973
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
974
+ type: z.ZodString;
975
+ }, z.core.$strip>>;
976
+ }, z.core.$strip>>;
977
+ }, z.core.$strip>;
978
+ declare const AuthPageApiSchema: z.ZodObject<{
979
+ type: z.ZodEnum<{
980
+ login: "login";
981
+ currentUser: "currentUser";
982
+ forgotPassword: "forgotPassword";
983
+ resetPassword: "resetPassword";
984
+ }>;
985
+ graphqlHook: z.ZodString;
986
+ queryString: z.ZodString;
987
+ responseType: z.ZodOptional<z.ZodObject<{
988
+ type: z.ZodString;
989
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
990
+ type: z.ZodString;
991
+ }, z.core.$strip>>;
992
+ }, z.core.$strip>>;
993
+ }, z.core.$strip>;
994
+ declare const DrawerSchema: z.ZodObject<{
995
+ title: z.ZodString;
996
+ graphqlHook: z.ZodString;
997
+ fields: z.ZodArray<z.ZodObject<{
998
+ name: z.ZodString;
999
+ type: z.ZodEnum<{
1000
+ number: "number";
1001
+ text: "text";
1002
+ image: "image";
1003
+ date: "date";
1004
+ email: "email";
1005
+ password: "password";
1006
+ multiSelect: "multiSelect";
1007
+ textarea: "textarea";
1008
+ hidden: "hidden";
1009
+ select: "select";
1010
+ }>;
1011
+ required: z.ZodOptional<z.ZodBoolean>;
1012
+ validation: z.ZodOptional<z.ZodObject<{
1013
+ minLength: z.ZodOptional<z.ZodNumber>;
1014
+ zodString: z.ZodString;
1015
+ }, z.core.$strip>>;
1016
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1017
+ options: z.ZodOptional<z.ZodObject<{
1018
+ hookName: z.ZodOptional<z.ZodString>;
1019
+ queryString: z.ZodOptional<z.ZodString>;
1020
+ labelKey: z.ZodOptional<z.ZodString>;
1021
+ valueKey: z.ZodOptional<z.ZodString>;
1022
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1023
+ }, z.core.$strip>>;
1024
+ }, z.core.$strip>>;
1025
+ }, z.core.$strip>;
1026
+ declare const AuthPageSchema: z.ZodObject<{
1027
+ name: z.ZodEnum<{
1028
+ LoginPage: "LoginPage";
1029
+ ForgotPasswordPage: "ForgotPasswordPage";
1030
+ ResetPasswordPage: "ResetPasswordPage";
1031
+ }>;
1032
+ type: z.ZodEnum<{
1033
+ EmailPassword: "EmailPassword";
1034
+ ForgotPassword: "ForgotPassword";
1035
+ ResetPassword: "ResetPassword";
1036
+ }>;
1037
+ route: z.ZodString;
1038
+ isPrivate: z.ZodBoolean;
1039
+ api: z.ZodArray<z.ZodObject<{
1040
+ type: z.ZodEnum<{
1041
+ login: "login";
1042
+ currentUser: "currentUser";
1043
+ forgotPassword: "forgotPassword";
1044
+ resetPassword: "resetPassword";
1045
+ }>;
1046
+ graphqlHook: z.ZodString;
1047
+ queryString: z.ZodString;
1048
+ responseType: z.ZodOptional<z.ZodObject<{
1049
+ type: z.ZodString;
1050
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1051
+ type: z.ZodString;
1052
+ }, z.core.$strip>>;
1053
+ }, z.core.$strip>>;
1054
+ }, z.core.$strip>>;
1055
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
1056
+ name: z.ZodString;
1057
+ type: z.ZodEnum<{
1058
+ number: "number";
1059
+ text: "text";
1060
+ image: "image";
1061
+ date: "date";
1062
+ email: "email";
1063
+ password: "password";
1064
+ multiSelect: "multiSelect";
1065
+ textarea: "textarea";
1066
+ hidden: "hidden";
1067
+ select: "select";
1068
+ }>;
1069
+ required: z.ZodOptional<z.ZodBoolean>;
1070
+ validation: z.ZodOptional<z.ZodObject<{
1071
+ minLength: z.ZodOptional<z.ZodNumber>;
1072
+ zodString: z.ZodString;
1073
+ }, z.core.$strip>>;
1074
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1075
+ options: z.ZodOptional<z.ZodObject<{
1076
+ hookName: z.ZodOptional<z.ZodString>;
1077
+ queryString: z.ZodOptional<z.ZodString>;
1078
+ labelKey: z.ZodOptional<z.ZodString>;
1079
+ valueKey: z.ZodOptional<z.ZodString>;
1080
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1081
+ }, z.core.$strip>>;
1082
+ }, z.core.$strip>>>;
1083
+ }, z.core.$strip>;
1084
+ declare const ListingPageSchema: z.ZodObject<{
1085
+ type: z.ZodLiteral<"Listing">;
1086
+ name: z.ZodString;
1087
+ route: z.ZodString;
1088
+ isPrivate: z.ZodBoolean;
1089
+ api: z.ZodArray<z.ZodObject<{
1090
+ type: z.ZodEnum<{
1091
+ list: "list";
1092
+ create: "create";
1093
+ update: "update";
1094
+ delete: "delete";
1095
+ getById: "getById";
1096
+ }>;
1097
+ graphqlHook: z.ZodString;
1098
+ queryString: z.ZodString;
1099
+ responseType: z.ZodOptional<z.ZodObject<{
1100
+ type: z.ZodString;
1101
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1102
+ type: z.ZodString;
1103
+ }, z.core.$strip>>;
1104
+ }, z.core.$strip>>;
1105
+ }, z.core.$strip>>;
1106
+ columns: z.ZodArray<z.ZodObject<{
1107
+ field: z.ZodString;
1108
+ label: z.ZodString;
1109
+ }, z.core.$strip>>;
1110
+ actions: z.ZodArray<z.ZodString>;
1111
+ drawerCreate: z.ZodObject<{
1112
+ title: z.ZodString;
1113
+ graphqlHook: z.ZodString;
1114
+ fields: z.ZodArray<z.ZodObject<{
1115
+ name: z.ZodString;
1116
+ type: z.ZodEnum<{
1117
+ number: "number";
1118
+ text: "text";
1119
+ image: "image";
1120
+ date: "date";
1121
+ email: "email";
1122
+ password: "password";
1123
+ multiSelect: "multiSelect";
1124
+ textarea: "textarea";
1125
+ hidden: "hidden";
1126
+ select: "select";
1127
+ }>;
1128
+ required: z.ZodOptional<z.ZodBoolean>;
1129
+ validation: z.ZodOptional<z.ZodObject<{
1130
+ minLength: z.ZodOptional<z.ZodNumber>;
1131
+ zodString: z.ZodString;
1132
+ }, z.core.$strip>>;
1133
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1134
+ options: z.ZodOptional<z.ZodObject<{
1135
+ hookName: z.ZodOptional<z.ZodString>;
1136
+ queryString: z.ZodOptional<z.ZodString>;
1137
+ labelKey: z.ZodOptional<z.ZodString>;
1138
+ valueKey: z.ZodOptional<z.ZodString>;
1139
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1140
+ }, z.core.$strip>>;
1141
+ }, z.core.$strip>>;
1142
+ }, z.core.$strip>;
1143
+ drawerUpdate: z.ZodObject<{
1144
+ title: z.ZodString;
1145
+ graphqlHook: z.ZodString;
1146
+ fields: z.ZodArray<z.ZodObject<{
1147
+ name: z.ZodString;
1148
+ type: z.ZodEnum<{
1149
+ number: "number";
1150
+ text: "text";
1151
+ image: "image";
1152
+ date: "date";
1153
+ email: "email";
1154
+ password: "password";
1155
+ multiSelect: "multiSelect";
1156
+ textarea: "textarea";
1157
+ hidden: "hidden";
1158
+ select: "select";
1159
+ }>;
1160
+ required: z.ZodOptional<z.ZodBoolean>;
1161
+ validation: z.ZodOptional<z.ZodObject<{
1162
+ minLength: z.ZodOptional<z.ZodNumber>;
1163
+ zodString: z.ZodString;
1164
+ }, z.core.$strip>>;
1165
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1166
+ options: z.ZodOptional<z.ZodObject<{
1167
+ hookName: z.ZodOptional<z.ZodString>;
1168
+ queryString: z.ZodOptional<z.ZodString>;
1169
+ labelKey: z.ZodOptional<z.ZodString>;
1170
+ valueKey: z.ZodOptional<z.ZodString>;
1171
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1172
+ }, z.core.$strip>>;
1173
+ }, z.core.$strip>>;
1174
+ }, z.core.$strip>;
1175
+ }, z.core.$strip>;
1176
+ declare const PageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1177
+ name: z.ZodEnum<{
1178
+ LoginPage: "LoginPage";
1179
+ ForgotPasswordPage: "ForgotPasswordPage";
1180
+ ResetPasswordPage: "ResetPasswordPage";
1181
+ }>;
1182
+ type: z.ZodEnum<{
1183
+ EmailPassword: "EmailPassword";
1184
+ ForgotPassword: "ForgotPassword";
1185
+ ResetPassword: "ResetPassword";
1186
+ }>;
1187
+ route: z.ZodString;
1188
+ isPrivate: z.ZodBoolean;
1189
+ api: z.ZodArray<z.ZodObject<{
1190
+ type: z.ZodEnum<{
1191
+ login: "login";
1192
+ currentUser: "currentUser";
1193
+ forgotPassword: "forgotPassword";
1194
+ resetPassword: "resetPassword";
1195
+ }>;
1196
+ graphqlHook: z.ZodString;
1197
+ queryString: z.ZodString;
1198
+ responseType: z.ZodOptional<z.ZodObject<{
1199
+ type: z.ZodString;
1200
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1201
+ type: z.ZodString;
1202
+ }, z.core.$strip>>;
1203
+ }, z.core.$strip>>;
1204
+ }, z.core.$strip>>;
1205
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
1206
+ name: z.ZodString;
1207
+ type: z.ZodEnum<{
1208
+ number: "number";
1209
+ text: "text";
1210
+ image: "image";
1211
+ date: "date";
1212
+ email: "email";
1213
+ password: "password";
1214
+ multiSelect: "multiSelect";
1215
+ textarea: "textarea";
1216
+ hidden: "hidden";
1217
+ select: "select";
1218
+ }>;
1219
+ required: z.ZodOptional<z.ZodBoolean>;
1220
+ validation: z.ZodOptional<z.ZodObject<{
1221
+ minLength: z.ZodOptional<z.ZodNumber>;
1222
+ zodString: z.ZodString;
1223
+ }, z.core.$strip>>;
1224
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1225
+ options: z.ZodOptional<z.ZodObject<{
1226
+ hookName: z.ZodOptional<z.ZodString>;
1227
+ queryString: z.ZodOptional<z.ZodString>;
1228
+ labelKey: z.ZodOptional<z.ZodString>;
1229
+ valueKey: z.ZodOptional<z.ZodString>;
1230
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1231
+ }, z.core.$strip>>;
1232
+ }, z.core.$strip>>>;
1233
+ }, z.core.$strip>, z.ZodObject<{
1234
+ type: z.ZodLiteral<"Listing">;
1235
+ name: z.ZodString;
1236
+ route: z.ZodString;
1237
+ isPrivate: z.ZodBoolean;
1238
+ api: z.ZodArray<z.ZodObject<{
1239
+ type: z.ZodEnum<{
1240
+ list: "list";
1241
+ create: "create";
1242
+ update: "update";
1243
+ delete: "delete";
1244
+ getById: "getById";
1245
+ }>;
1246
+ graphqlHook: z.ZodString;
1247
+ queryString: z.ZodString;
1248
+ responseType: z.ZodOptional<z.ZodObject<{
1249
+ type: z.ZodString;
1250
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1251
+ type: z.ZodString;
1252
+ }, z.core.$strip>>;
1253
+ }, z.core.$strip>>;
1254
+ }, z.core.$strip>>;
1255
+ columns: z.ZodArray<z.ZodObject<{
1256
+ field: z.ZodString;
1257
+ label: z.ZodString;
1258
+ }, z.core.$strip>>;
1259
+ actions: z.ZodArray<z.ZodString>;
1260
+ drawerCreate: z.ZodObject<{
1261
+ title: z.ZodString;
1262
+ graphqlHook: z.ZodString;
1263
+ fields: z.ZodArray<z.ZodObject<{
1264
+ name: z.ZodString;
1265
+ type: z.ZodEnum<{
1266
+ number: "number";
1267
+ text: "text";
1268
+ image: "image";
1269
+ date: "date";
1270
+ email: "email";
1271
+ password: "password";
1272
+ multiSelect: "multiSelect";
1273
+ textarea: "textarea";
1274
+ hidden: "hidden";
1275
+ select: "select";
1276
+ }>;
1277
+ required: z.ZodOptional<z.ZodBoolean>;
1278
+ validation: z.ZodOptional<z.ZodObject<{
1279
+ minLength: z.ZodOptional<z.ZodNumber>;
1280
+ zodString: z.ZodString;
1281
+ }, z.core.$strip>>;
1282
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1283
+ options: z.ZodOptional<z.ZodObject<{
1284
+ hookName: z.ZodOptional<z.ZodString>;
1285
+ queryString: z.ZodOptional<z.ZodString>;
1286
+ labelKey: z.ZodOptional<z.ZodString>;
1287
+ valueKey: z.ZodOptional<z.ZodString>;
1288
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1289
+ }, z.core.$strip>>;
1290
+ }, z.core.$strip>>;
1291
+ }, z.core.$strip>;
1292
+ drawerUpdate: z.ZodObject<{
1293
+ title: z.ZodString;
1294
+ graphqlHook: z.ZodString;
1295
+ fields: z.ZodArray<z.ZodObject<{
1296
+ name: z.ZodString;
1297
+ type: z.ZodEnum<{
1298
+ number: "number";
1299
+ text: "text";
1300
+ image: "image";
1301
+ date: "date";
1302
+ email: "email";
1303
+ password: "password";
1304
+ multiSelect: "multiSelect";
1305
+ textarea: "textarea";
1306
+ hidden: "hidden";
1307
+ select: "select";
1308
+ }>;
1309
+ required: z.ZodOptional<z.ZodBoolean>;
1310
+ validation: z.ZodOptional<z.ZodObject<{
1311
+ minLength: z.ZodOptional<z.ZodNumber>;
1312
+ zodString: z.ZodString;
1313
+ }, z.core.$strip>>;
1314
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1315
+ options: z.ZodOptional<z.ZodObject<{
1316
+ hookName: z.ZodOptional<z.ZodString>;
1317
+ queryString: z.ZodOptional<z.ZodString>;
1318
+ labelKey: z.ZodOptional<z.ZodString>;
1319
+ valueKey: z.ZodOptional<z.ZodString>;
1320
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1321
+ }, z.core.$strip>>;
1322
+ }, z.core.$strip>>;
1323
+ }, z.core.$strip>;
1324
+ }, z.core.$strip>], "type">;
1325
+ type TPageSchema = z.infer<typeof PageSchema>;
1326
+
1327
+ /**
1328
+ * Module and root application schema
1329
+ */
1330
+
1331
+ declare const ModuleSchema: z.ZodObject<{
1332
+ name: z.ZodString;
1333
+ pages: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1334
+ name: z.ZodEnum<{
1335
+ LoginPage: "LoginPage";
1336
+ ForgotPasswordPage: "ForgotPasswordPage";
1337
+ ResetPasswordPage: "ResetPasswordPage";
1338
+ }>;
1339
+ type: z.ZodEnum<{
1340
+ EmailPassword: "EmailPassword";
1341
+ ForgotPassword: "ForgotPassword";
1342
+ ResetPassword: "ResetPassword";
1343
+ }>;
1344
+ route: z.ZodString;
1345
+ isPrivate: z.ZodBoolean;
1346
+ api: z.ZodArray<z.ZodObject<{
1347
+ type: z.ZodEnum<{
1348
+ login: "login";
1349
+ currentUser: "currentUser";
1350
+ forgotPassword: "forgotPassword";
1351
+ resetPassword: "resetPassword";
1352
+ }>;
1353
+ graphqlHook: z.ZodString;
1354
+ queryString: z.ZodString;
1355
+ responseType: z.ZodOptional<z.ZodObject<{
1356
+ type: z.ZodString;
1357
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1358
+ type: z.ZodString;
1359
+ }, z.core.$strip>>;
1360
+ }, z.core.$strip>>;
1361
+ }, z.core.$strip>>;
1362
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
1363
+ name: z.ZodString;
1364
+ type: z.ZodEnum<{
1365
+ number: "number";
1366
+ text: "text";
1367
+ image: "image";
1368
+ date: "date";
1369
+ email: "email";
1370
+ password: "password";
1371
+ multiSelect: "multiSelect";
1372
+ textarea: "textarea";
1373
+ hidden: "hidden";
1374
+ select: "select";
1375
+ }>;
1376
+ required: z.ZodOptional<z.ZodBoolean>;
1377
+ validation: z.ZodOptional<z.ZodObject<{
1378
+ minLength: z.ZodOptional<z.ZodNumber>;
1379
+ zodString: z.ZodString;
1380
+ }, z.core.$strip>>;
1381
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1382
+ options: z.ZodOptional<z.ZodObject<{
1383
+ hookName: z.ZodOptional<z.ZodString>;
1384
+ queryString: z.ZodOptional<z.ZodString>;
1385
+ labelKey: z.ZodOptional<z.ZodString>;
1386
+ valueKey: z.ZodOptional<z.ZodString>;
1387
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1388
+ }, z.core.$strip>>;
1389
+ }, z.core.$strip>>>;
1390
+ }, z.core.$strip>, z.ZodObject<{
1391
+ type: z.ZodLiteral<"Listing">;
1392
+ name: z.ZodString;
1393
+ route: z.ZodString;
1394
+ isPrivate: z.ZodBoolean;
1395
+ api: z.ZodArray<z.ZodObject<{
1396
+ type: z.ZodEnum<{
1397
+ list: "list";
1398
+ create: "create";
1399
+ update: "update";
1400
+ delete: "delete";
1401
+ getById: "getById";
1402
+ }>;
1403
+ graphqlHook: z.ZodString;
1404
+ queryString: z.ZodString;
1405
+ responseType: z.ZodOptional<z.ZodObject<{
1406
+ type: z.ZodString;
1407
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1408
+ type: z.ZodString;
1409
+ }, z.core.$strip>>;
1410
+ }, z.core.$strip>>;
1411
+ }, z.core.$strip>>;
1412
+ columns: z.ZodArray<z.ZodObject<{
1413
+ field: z.ZodString;
1414
+ label: z.ZodString;
1415
+ }, z.core.$strip>>;
1416
+ actions: z.ZodArray<z.ZodString>;
1417
+ drawerCreate: z.ZodObject<{
1418
+ title: z.ZodString;
1419
+ graphqlHook: z.ZodString;
1420
+ fields: z.ZodArray<z.ZodObject<{
1421
+ name: z.ZodString;
1422
+ type: z.ZodEnum<{
1423
+ number: "number";
1424
+ text: "text";
1425
+ image: "image";
1426
+ date: "date";
1427
+ email: "email";
1428
+ password: "password";
1429
+ multiSelect: "multiSelect";
1430
+ textarea: "textarea";
1431
+ hidden: "hidden";
1432
+ select: "select";
1433
+ }>;
1434
+ required: z.ZodOptional<z.ZodBoolean>;
1435
+ validation: z.ZodOptional<z.ZodObject<{
1436
+ minLength: z.ZodOptional<z.ZodNumber>;
1437
+ zodString: z.ZodString;
1438
+ }, z.core.$strip>>;
1439
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1440
+ options: z.ZodOptional<z.ZodObject<{
1441
+ hookName: z.ZodOptional<z.ZodString>;
1442
+ queryString: z.ZodOptional<z.ZodString>;
1443
+ labelKey: z.ZodOptional<z.ZodString>;
1444
+ valueKey: z.ZodOptional<z.ZodString>;
1445
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1446
+ }, z.core.$strip>>;
1447
+ }, z.core.$strip>>;
1448
+ }, z.core.$strip>;
1449
+ drawerUpdate: z.ZodObject<{
1450
+ title: z.ZodString;
1451
+ graphqlHook: z.ZodString;
1452
+ fields: z.ZodArray<z.ZodObject<{
1453
+ name: z.ZodString;
1454
+ type: z.ZodEnum<{
1455
+ number: "number";
1456
+ text: "text";
1457
+ image: "image";
1458
+ date: "date";
1459
+ email: "email";
1460
+ password: "password";
1461
+ multiSelect: "multiSelect";
1462
+ textarea: "textarea";
1463
+ hidden: "hidden";
1464
+ select: "select";
1465
+ }>;
1466
+ required: z.ZodOptional<z.ZodBoolean>;
1467
+ validation: z.ZodOptional<z.ZodObject<{
1468
+ minLength: z.ZodOptional<z.ZodNumber>;
1469
+ zodString: z.ZodString;
1470
+ }, z.core.$strip>>;
1471
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1472
+ options: z.ZodOptional<z.ZodObject<{
1473
+ hookName: z.ZodOptional<z.ZodString>;
1474
+ queryString: z.ZodOptional<z.ZodString>;
1475
+ labelKey: z.ZodOptional<z.ZodString>;
1476
+ valueKey: z.ZodOptional<z.ZodString>;
1477
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1478
+ }, z.core.$strip>>;
1479
+ }, z.core.$strip>>;
1480
+ }, z.core.$strip>;
1481
+ }, z.core.$strip>], "type">>;
1482
+ }, z.core.$strip>;
1483
+ declare const ApplicationSchema: z.ZodObject<{
1484
+ app: z.ZodObject<{
1485
+ name: z.ZodString;
1486
+ description: z.ZodString;
1487
+ author: z.ZodDefault<z.ZodString>;
1488
+ branding: z.ZodObject<{
1489
+ brandName: z.ZodString;
1490
+ primaryColor: z.ZodString;
1491
+ secondaryColor: z.ZodString;
1492
+ logo: z.ZodURL;
1493
+ }, z.core.$strip>;
1494
+ apiEndpoint: z.ZodURL;
1495
+ }, z.core.$strip>;
1496
+ modules: z.ZodArray<z.ZodObject<{
1497
+ name: z.ZodString;
1498
+ pages: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1499
+ name: z.ZodEnum<{
1500
+ LoginPage: "LoginPage";
1501
+ ForgotPasswordPage: "ForgotPasswordPage";
1502
+ ResetPasswordPage: "ResetPasswordPage";
1503
+ }>;
1504
+ type: z.ZodEnum<{
1505
+ EmailPassword: "EmailPassword";
1506
+ ForgotPassword: "ForgotPassword";
1507
+ ResetPassword: "ResetPassword";
1508
+ }>;
1509
+ route: z.ZodString;
1510
+ isPrivate: z.ZodBoolean;
1511
+ api: z.ZodArray<z.ZodObject<{
1512
+ type: z.ZodEnum<{
1513
+ login: "login";
1514
+ currentUser: "currentUser";
1515
+ forgotPassword: "forgotPassword";
1516
+ resetPassword: "resetPassword";
1517
+ }>;
1518
+ graphqlHook: z.ZodString;
1519
+ queryString: z.ZodString;
1520
+ responseType: z.ZodOptional<z.ZodObject<{
1521
+ type: z.ZodString;
1522
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1523
+ type: z.ZodString;
1524
+ }, z.core.$strip>>;
1525
+ }, z.core.$strip>>;
1526
+ }, z.core.$strip>>;
1527
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
1528
+ name: z.ZodString;
1529
+ type: z.ZodEnum<{
1530
+ number: "number";
1531
+ text: "text";
1532
+ image: "image";
1533
+ date: "date";
1534
+ email: "email";
1535
+ password: "password";
1536
+ multiSelect: "multiSelect";
1537
+ textarea: "textarea";
1538
+ hidden: "hidden";
1539
+ select: "select";
1540
+ }>;
1541
+ required: z.ZodOptional<z.ZodBoolean>;
1542
+ validation: z.ZodOptional<z.ZodObject<{
1543
+ minLength: z.ZodOptional<z.ZodNumber>;
1544
+ zodString: z.ZodString;
1545
+ }, z.core.$strip>>;
1546
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1547
+ options: z.ZodOptional<z.ZodObject<{
1548
+ hookName: z.ZodOptional<z.ZodString>;
1549
+ queryString: z.ZodOptional<z.ZodString>;
1550
+ labelKey: z.ZodOptional<z.ZodString>;
1551
+ valueKey: z.ZodOptional<z.ZodString>;
1552
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1553
+ }, z.core.$strip>>;
1554
+ }, z.core.$strip>>>;
1555
+ }, z.core.$strip>, z.ZodObject<{
1556
+ type: z.ZodLiteral<"Listing">;
1557
+ name: z.ZodString;
1558
+ route: z.ZodString;
1559
+ isPrivate: z.ZodBoolean;
1560
+ api: z.ZodArray<z.ZodObject<{
1561
+ type: z.ZodEnum<{
1562
+ list: "list";
1563
+ create: "create";
1564
+ update: "update";
1565
+ delete: "delete";
1566
+ getById: "getById";
1567
+ }>;
1568
+ graphqlHook: z.ZodString;
1569
+ queryString: z.ZodString;
1570
+ responseType: z.ZodOptional<z.ZodObject<{
1571
+ type: z.ZodString;
1572
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
1573
+ type: z.ZodString;
1574
+ }, z.core.$strip>>;
1575
+ }, z.core.$strip>>;
1576
+ }, z.core.$strip>>;
1577
+ columns: z.ZodArray<z.ZodObject<{
1578
+ field: z.ZodString;
1579
+ label: z.ZodString;
1580
+ }, z.core.$strip>>;
1581
+ actions: z.ZodArray<z.ZodString>;
1582
+ drawerCreate: z.ZodObject<{
1583
+ title: z.ZodString;
1584
+ graphqlHook: z.ZodString;
1585
+ fields: z.ZodArray<z.ZodObject<{
1586
+ name: z.ZodString;
1587
+ type: z.ZodEnum<{
1588
+ number: "number";
1589
+ text: "text";
1590
+ image: "image";
1591
+ date: "date";
1592
+ email: "email";
1593
+ password: "password";
1594
+ multiSelect: "multiSelect";
1595
+ textarea: "textarea";
1596
+ hidden: "hidden";
1597
+ select: "select";
1598
+ }>;
1599
+ required: z.ZodOptional<z.ZodBoolean>;
1600
+ validation: z.ZodOptional<z.ZodObject<{
1601
+ minLength: z.ZodOptional<z.ZodNumber>;
1602
+ zodString: z.ZodString;
1603
+ }, z.core.$strip>>;
1604
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1605
+ options: z.ZodOptional<z.ZodObject<{
1606
+ hookName: z.ZodOptional<z.ZodString>;
1607
+ queryString: z.ZodOptional<z.ZodString>;
1608
+ labelKey: z.ZodOptional<z.ZodString>;
1609
+ valueKey: z.ZodOptional<z.ZodString>;
1610
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1611
+ }, z.core.$strip>>;
1612
+ }, z.core.$strip>>;
1613
+ }, z.core.$strip>;
1614
+ drawerUpdate: z.ZodObject<{
1615
+ title: z.ZodString;
1616
+ graphqlHook: z.ZodString;
1617
+ fields: z.ZodArray<z.ZodObject<{
1618
+ name: z.ZodString;
1619
+ type: z.ZodEnum<{
1620
+ number: "number";
1621
+ text: "text";
1622
+ image: "image";
1623
+ date: "date";
1624
+ email: "email";
1625
+ password: "password";
1626
+ multiSelect: "multiSelect";
1627
+ textarea: "textarea";
1628
+ hidden: "hidden";
1629
+ select: "select";
1630
+ }>;
1631
+ required: z.ZodOptional<z.ZodBoolean>;
1632
+ validation: z.ZodOptional<z.ZodObject<{
1633
+ minLength: z.ZodOptional<z.ZodNumber>;
1634
+ zodString: z.ZodString;
1635
+ }, z.core.$strip>>;
1636
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1637
+ options: z.ZodOptional<z.ZodObject<{
1638
+ hookName: z.ZodOptional<z.ZodString>;
1639
+ queryString: z.ZodOptional<z.ZodString>;
1640
+ labelKey: z.ZodOptional<z.ZodString>;
1641
+ valueKey: z.ZodOptional<z.ZodString>;
1642
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
1643
+ }, z.core.$strip>>;
1644
+ }, z.core.$strip>>;
1645
+ }, z.core.$strip>;
1646
+ }, z.core.$strip>], "type">>;
1647
+ }, z.core.$strip>>;
1648
+ }, z.core.$strip>;
1649
+ type TApplicationSchema = z.infer<typeof ApplicationSchema>;
1650
+ type TModuleSchema = z.infer<typeof ModuleSchema>;
1651
+
1652
+ /**
1653
+ * User-related schemas - same as .ref/core/react/zodTypes.ts
1654
+ */
1655
+
1656
+ declare const LoginInputSchema: z.ZodObject<{
1657
+ email: z.ZodEmail;
1658
+ password: z.ZodString;
1659
+ }, z.core.$strip>;
1660
+ declare const SpecializationSchema: z.ZodObject<{
1661
+ _id: z.ZodString;
1662
+ title: z.ZodString;
1663
+ }, z.core.$strip>;
1664
+ declare const UserSchema: z.ZodObject<{
1665
+ _id: z.ZodString;
1666
+ firstName: z.ZodString;
1667
+ lastName: z.ZodString;
1668
+ email: z.ZodEmail;
1669
+ phoneNumber: z.ZodString;
1670
+ profileImage: z.ZodOptional<z.ZodString>;
1671
+ role: z.ZodEnum<{
1672
+ ADMIN: "ADMIN";
1673
+ TRAINER: "TRAINER";
1674
+ CLIENT: "CLIENT";
1675
+ }>;
1676
+ rate: z.ZodOptional<z.ZodNumber>;
1677
+ specializations: z.ZodOptional<z.ZodArray<z.ZodObject<{
1678
+ _id: z.ZodString;
1679
+ title: z.ZodString;
1680
+ }, z.core.$strip>>>;
1681
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
1682
+ about: z.ZodOptional<z.ZodString>;
1683
+ gender: z.ZodOptional<z.ZodString>;
1684
+ timezone: z.ZodOptional<z.ZodString>;
1685
+ averageRating: z.ZodOptional<z.ZodNumber>;
1686
+ }, z.core.$strip>;
1687
+ declare const CreateUserInputSchema: z.ZodObject<{
1688
+ firstName: z.ZodString;
1689
+ lastName: z.ZodString;
1690
+ email: z.ZodEmail;
1691
+ phoneNumber: z.ZodString;
1692
+ password: z.ZodString;
1693
+ role: z.ZodEnum<{
1694
+ ADMIN: "ADMIN";
1695
+ TRAINER: "TRAINER";
1696
+ CLIENT: "CLIENT";
1697
+ }>;
1698
+ rate: z.ZodOptional<z.ZodNumber>;
1699
+ specializationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1700
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
1701
+ about: z.ZodOptional<z.ZodString>;
1702
+ }, z.core.$strip>;
1703
+ declare const UpdateUserInputSchema: z.ZodObject<{
1704
+ _id: z.ZodString;
1705
+ firstName: z.ZodOptional<z.ZodString>;
1706
+ lastName: z.ZodOptional<z.ZodString>;
1707
+ email: z.ZodOptional<z.ZodEmail>;
1708
+ phoneNumber: z.ZodOptional<z.ZodString>;
1709
+ rate: z.ZodOptional<z.ZodNumber>;
1710
+ specializationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1711
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
1712
+ about: z.ZodOptional<z.ZodString>;
1713
+ }, z.core.$strip>;
1714
+ declare const ForgotPasswordSchema: z.ZodObject<{
1715
+ email: z.ZodEmail;
1716
+ }, z.core.$strip>;
1717
+ declare const ResetPasswordSchema: z.ZodObject<{
1718
+ type: z.ZodEnum<{
1719
+ EMAIL: "EMAIL";
1720
+ SMS: "SMS";
1721
+ }>;
1722
+ resetTicket: z.ZodString;
1723
+ newPassword: z.ZodString;
1724
+ }, z.core.$strip>;
1725
+ type TLoginInputSchema = z.infer<typeof LoginInputSchema>;
1726
+ type TUserSchema = z.infer<typeof UserSchema>;
1727
+ type TSpecializationSchema = z.infer<typeof SpecializationSchema>;
1728
+ type TCreateUserInputSchema = z.infer<typeof CreateUserInputSchema>;
1729
+ type TUpdateUserInputSchema = z.infer<typeof UpdateUserInputSchema>;
1730
+ type TForgotPasswordSchema = z.infer<typeof ForgotPasswordSchema>;
1731
+ type TResetPasswordSchema = z.infer<typeof ResetPasswordSchema>;
1732
+
1733
+ /**
1734
+ * react-builder module types
1735
+ */
1736
+
1737
+ interface AppInfo {
1738
+ projectName?: string;
1739
+ projectDescription?: string;
1740
+ modules?: string;
1741
+ apiEndpoint?: string;
1742
+ }
1743
+ interface ReactBuilderAgentConfig {
1744
+ /** User input: GraphQL schema string or instruction */
1745
+ input: string;
1746
+ /** Optional app info (project name, description, modules list) for context */
1747
+ appInfo?: AppInfo;
1748
+ /** Model config; optional */
1749
+ model?: ModelConfig;
1750
+ /** Max iterations; default 15 */
1751
+ maxIterations?: number;
1752
+ /** Callback for each step */
1753
+ onStep?: (step: AgentStep) => void;
1754
+ }
1755
+
1756
+ /**
1757
+ * System prompt for GraphQL-to-frontend configuration conversion
1758
+ */
1759
+ declare const REACT_BUILDER_SYSTEM_PROMPT = "You are an expert GraphQL-to-frontend configuration converter. Transform the provided GraphQL schema into a structured JSON configuration for rapid app development.\n\n**Your output must be valid JSON only.** No markdown code fences, no explanations. Return the raw JSON object matching the application schema (app with name, description, author, branding, apiEndpoint; modules array with name and pages; each page has type, name, route, isPrivate, api, and for listing pages: columns, actions, drawerCreate, drawerUpdate; for auth pages: fields when needed).\n\nStrict guidelines:\n- Use every available CRUD GraphQL query and mutation from the project schema.\n- Map GraphQL types to frontend modules and pages.\n- EmailAddress \u2192 \"type\": \"email\" with validation; DateTime \u2192 \"type\": \"date\"; enums \u2192 select with options.values.\n- Relationships \u2192 multiSelect with query-based options where appropriate.\n- Add isPrivate: true for authenticated operations.\n- Maintain camelCase. Ensure valid JSON syntax.";
1760
+
1761
+ /**
1762
+ * Instruction template for GraphQL-to-frontend conversion
1763
+ */
1764
+ declare const REACT_BUILDER_INSTRUCTION: string;
1765
+ declare function buildInstructionPrompt(): string;
1766
+
1767
+ /**
1768
+ * Few-shot examples: example GraphQL schema and expected JSON output (abbreviated)
1769
+ */
1770
+ declare const EXAMPLE_GRAPHQL_SCHEMA: string;
1771
+ declare const EXAMPLE_JSON_OUTPUT = "{\n \"app\": {\n \"name\": \"my-app\",\n \"description\": \"App description\",\n \"author\": \"Author\",\n \"branding\": {\n \"brandName\": \"MyBrand\",\n \"primaryColor\": \"#333\",\n \"secondaryColor\": \"#fff\",\n \"logo\": \"https://example.com/logo.png\"\n },\n \"apiEndpoint\": \"http://localhost:4000/graphql\"\n },\n \"modules\": [\n {\n \"name\": \"auth\",\n \"pages\": [\n {\n \"name\": \"LoginPage\",\n \"type\": \"EmailPassword\",\n \"route\": \"/login\",\n \"isPrivate\": false,\n \"api\": [\n { \"type\": \"login\", \"graphqlHook\": \"useLoginMutation\", \"queryString\": \"mutation Login($data: LoginInput!) { login(data: $data) { accessToken } }\" }\n ]\n }\n ]\n },\n {\n \"name\": \"user\",\n \"pages\": [\n {\n \"type\": \"Listing\",\n \"name\": \"UserListPage\",\n \"route\": \"/users\",\n \"isPrivate\": true,\n \"api\": [\n { \"type\": \"list\", \"graphqlHook\": \"useGetAllUserQuery\", \"queryString\": \"query GetAllUser { getAllUser { _id firstName email } }\" },\n { \"type\": \"create\", \"graphqlHook\": \"useCreateUserMutation\", \"queryString\": \"mutation CreateUser($data: CreateUserInput!) { createUser(data: $data) { _id } }\" }\n ],\n \"columns\": [{ \"field\": \"firstName\", \"label\": \"First Name\" }, { \"field\": \"email\", \"label\": \"Email\" }],\n \"actions\": [\"create\", \"edit\", \"delete\"],\n \"drawerCreate\": { \"title\": \"Create User\", \"graphqlHook\": \"useCreateUserMutation\", \"fields\": [{ \"name\": \"firstName\", \"type\": \"text\", \"required\": true }, { \"name\": \"email\", \"type\": \"email\", \"required\": true }] },\n \"drawerUpdate\": { \"title\": \"Edit User\", \"graphqlHook\": \"useUpdateUserMutation\", \"fields\": [{ \"name\": \"firstName\", \"type\": \"text\" }, { \"name\": \"email\", \"type\": \"email\" }] }\n }\n ]\n }\n ]\n}";
1772
+ declare function buildExampleShotPrompt(): string;
1773
+
1774
+ /**
1775
+ * Feedback prompt - re-generate frontend config incorporating user feedback
1776
+ */
1777
+ declare function buildFeedbackPrompt(userFeedback: string, schemaFile: string): string;
1778
+
1779
+ /**
1780
+ * validate_frontend_config tool - validates JSON against ApplicationSchema (no AI)
1781
+ */
1782
+ declare const validateFrontendConfigTool: ai.Tool;
1783
+
1784
+ declare function createGenerateFrontendTool(model: Model): ai.Tool;
1785
+
1786
+ interface FeatureBreakdownResult {
1787
+ summary: string;
1788
+ modules: string[];
1789
+ operations: string[];
1790
+ suggestedPages?: string[];
1791
+ }
1792
+ declare function createGenerateFeatureBreakdownTool(model: Model): ai.Tool;
1793
+
1794
+ declare function createReactBuilderTools(model: Model): ToolSet;
1795
+
1796
+ /**
1797
+ * graphql-analyzer subagent - analyzes GraphQL schemas (no tools)
1798
+ */
1799
+ declare const graphqlAnalyzerSubagent: SubagentDefinition;
1800
+
1801
+ /**
1802
+ * config-validator subagent - validates frontend config (has validate_frontend_config tool)
1803
+ */
1804
+ declare function createConfigValidatorSubagent(): SubagentDefinition;
1805
+
1806
+ /**
1807
+ * runReactBuilderAgent - orchestrator for frontend config generation with retry and subagents
1808
+ */
1809
+
1810
+ /**
1811
+ * Run the react-builder orchestrator agent with all tools and subagents.
1812
+ * Use generate_frontend tool for config generation; the tool may throw on parse failure (caller can retry with new input).
1813
+ */
1814
+ declare function runReactBuilderAgent(config: ReactBuilderAgentConfig): Promise<AgentResult>;
1815
+
1816
+ export { type Actor, type AgentConfig, AgentError, type AgentResult, type AgentStep, type AgentTool, type AgentToolResult, ApiResponseTypeSchema, AppConfigSchema, type AppInfo, ApplicationSchema, AuthPageApiSchema, AuthPageSchema, BaseMcpClient, BrandingSchema, ColumnSchema, type CreateSubagentToolOptions, CreateUserInputSchema, DB_DESIGN_SYSTEM_PROMPT, type DbDesignerAgentConfig, DrawerSchema, EXAMPLE_GRAPHQL_SCHEMA, EXAMPLE_JSON_OUTPUT, type ExtractedFlow, type ExtractedStory, type FeatureBreakdownResult, FieldOptionsSchema, ForgotPasswordSchema, FormFieldSchema, type HelloWorldAgentConfig, type ImageInput, type InvokeOptions, LibraryError, ListingPageApiSchema, ListingPageSchema, type LogLevel, type Logger, type LoggerConfig, LoginInputSchema, type McpClientConfig, type McpClientInfo, type McpResolveOptions, type McpToolContent, type McpTransport, type Model, type ModelConfig, ModelError, type ModelProvider, type ModelResponse, type ModelTool, type ModelToolCall, ModuleSchema, PageSchema, REACT_BUILDER_INSTRUCTION, REACT_BUILDER_SYSTEM_PROMPT, type ReactBuilderAgentConfig, ResetPasswordSchema, type RunSubagentOptions, SpecializationSchema, type StructuredRequirementsInput, type SubagentConfig, type SubagentDefinition, SubagentError, type SubagentResult, type TApiResponseTypeSchema, type TAppConfigSchema, type TApplicationSchema, type TBackendProjectSchema, type TBrandingSchema, type TColumnSchema, type TCreateUserInputSchema, type TFieldSchema, type TForgotPasswordSchema, type TFormFieldSchema, type TLoginInputSchema, type TModuleSchema$1 as TModuleSchema, type TPageSchema, type TModuleSchema as TReactModuleSchema, type TResetPasswordSchema, type TSpecializationSchema, type TUpdateUserInputSchema, type TUserSchema, type TechnicalRequirements, type ToolConfig, type ToolContext, ToolError, type ToolExecutionResult, type ToolLogger, type ToolSet, UpdateUserInputSchema, UserSchema, ValidationError, ValidationSchema, type VisionOptions, buildExampleShotPrompt, buildFeedbackPrompt, buildInstructionPrompt, buildPromptVariables, createAnthropicModel, createConfigValidatorSubagent, createDbDesignPrompt, createDbDesignerTools, createDesignDatabaseProTool, createDesignDatabaseTool, createGenerateFeatureBreakdownTool, createGenerateFrontendTool, createGoogleModel, createLogger, createModel, createOpenAIModel, createProDbDesignPrompt, createReactBuilderTools, createRedesignDatabaseTool, createRedesignPrompt, createSchemaRefinerSubagent, createSubagentTool, createSubagentToolSet, createToolSet, defineSubagent, defineTool, entityAnalyzerSubagent, executeTool, executeToolByName, extractDataEntities, extractRoles, fieldSchema, formatTechnicalRequirements, formatUserFlows, formatUserStories, formatUserTypes, getTool, getTools, graphqlAnalyzerSubagent, helloWorldTool, moduleSchema, projectSchema, runAgent, runDbDesignerAgent, runHelloWorldAgent, runReactBuilderAgent, runSubagent, sumTokenUsage, validateFrontendConfigTool, validateSchemaTool };