sweagent 0.0.1 → 0.0.2

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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import { z } from 'zod';
2
+ import pino from 'pino';
1
3
  import * as ai from 'ai';
2
4
  import { LanguageModelUsage, ModelMessage, Tool, FinishReason } from 'ai';
3
5
  export { FinishReason, LanguageModelUsage, ModelMessage, Tool, ToolExecutionOptions, jsonSchema, tool } from 'ai';
4
- import { z } from 'zod';
5
6
 
6
7
  /**
7
8
  * Custom error classes for the library
@@ -48,6 +49,30 @@ declare class SubagentError extends LibraryError {
48
49
  constructor(message: string, subagentName?: string | undefined, cause?: Error);
49
50
  }
50
51
 
52
+ /**
53
+ * Shared utilities for extracting and parsing JSON from model responses.
54
+ *
55
+ * Models frequently wrap JSON in markdown code blocks or include extra text.
56
+ * These helpers handle extraction, parsing, and Zod validation with clear errors
57
+ * so the agent can retry on failure.
58
+ */
59
+
60
+ /**
61
+ * Extract a JSON string from model output.
62
+ * Handles markdown code blocks (```json ... ``` or ``` ... ```) and bare JSON.
63
+ */
64
+ declare function extractJson(text: string): string;
65
+ /**
66
+ * Parse a model text response as JSON then validate with a Zod schema.
67
+ * Throws a descriptive error on failure (JSON syntax or validation) so the
68
+ * wrapping ToolError gives the agent enough context to retry.
69
+ */
70
+ declare function parseModelJsonResponse<T>(text: string, schema: z.ZodType<T>): T;
71
+ /**
72
+ * Parse a raw JSON string (e.g. tool input) with a descriptive error on failure.
73
+ */
74
+ declare function safeJsonParse(jsonStr: string, label?: string): unknown;
75
+
51
76
  /**
52
77
  * Common types shared across modules
53
78
  * Re-exports AI SDK message types; keeps sweagent-specific ImageInput and Logger
@@ -72,31 +97,47 @@ interface Logger {
72
97
  info(message: string, data?: Record<string, unknown>): void;
73
98
  warn(message: string, data?: Record<string, unknown>): void;
74
99
  error(message: string, error?: Error | Record<string, unknown>): void;
100
+ /** Create a child logger with additional context bindings */
101
+ child(bindings: Record<string, unknown>): Logger;
75
102
  }
76
103
 
77
104
  /**
78
- * Simple logger with optional prefix and progress support
105
+ * Structured logger using Pino (JSON by default, optional pretty/file).
106
+ * Use loggerConfigFromEnv() for .env-driven config (SWE_LOG_* vars).
79
107
  */
80
108
 
81
- /**
82
- * Log levels
83
- */
84
109
  type LogLevel = 'debug' | 'info' | 'warn' | 'error';
85
- /**
86
- * Logger configuration
87
- */
88
110
  interface LoggerConfig {
89
- /** Prefix for all log messages */
90
- prefix?: string;
91
- /** Minimum log level to output */
111
+ /** Logger name (appears in logs) */
112
+ name?: string;
113
+ /** Minimum log level */
92
114
  level?: LogLevel;
93
- /** Whether to output timestamps */
94
- timestamps?: boolean;
115
+ /** Use pino-pretty for readable output */
116
+ pretty?: boolean;
117
+ /** File path for JSON logs */
118
+ file?: string;
119
+ /** Console stream: stderr avoids mixing with stdout prompts (e.g. inquirer). Default: stderr when pretty, else stdout. */
120
+ stream?: 'stdout' | 'stderr';
121
+ /** When false, returns a no-op logger (no output). Set via SWE_LOG_ENABLED=0. */
122
+ enabled?: boolean;
123
+ /** Optional stream for testing (bypasses transport) */
124
+ destination?: pino.DestinationStream;
95
125
  }
126
+ declare function createLogger(config?: LoggerConfig): Logger;
96
127
  /**
97
- * Create a logger with the given configuration
128
+ * Build logger config from process.env (SWE_* vars). Caller loads .env if desired (e.g. dotenv or `node --env-file=.env`).
129
+ *
130
+ * Env vars (all optional):
131
+ * - SWE_LOG_ENABLED: 1|true|yes (default) = on; 0|false|no|disabled = off (no-op logger).
132
+ * - SWE_LOG_LEVEL: debug|info|warn|error (default: info).
133
+ * - SWE_LOG_STREAM: stdout|stderr; default stderr when SWE_LOG_PRETTY is true, else stdout.
134
+ * - SWE_LOG_PRETTY: 1|true|yes = human-readable (pino-pretty); 0|false (default) = JSON.
135
+ * - SWE_LOG_FILE: path to also write JSON logs to a file.
136
+ * - SWE_LOG_NAME: logger name in output.
137
+ *
138
+ * For interactive CLIs (e.g. inquirer), use pretty and stderr so logs do not mix with stdout prompts.
98
139
  */
99
- declare function createLogger(config?: LoggerConfig): Logger;
140
+ declare function loggerConfigFromEnv(overrides?: Partial<LoggerConfig>): LoggerConfig;
100
141
 
101
142
  /**
102
143
  * Utility functions
@@ -159,6 +200,20 @@ interface InvokeOptions {
159
200
  /** Stop sequences */
160
201
  stop?: string[];
161
202
  }
203
+ /**
204
+ * Options for structured object invocation (no tools)
205
+ */
206
+ interface InvokeObjectOptions {
207
+ maxOutputTokens?: number;
208
+ temperature?: number;
209
+ }
210
+ /**
211
+ * Result of invokeObject (structured output)
212
+ */
213
+ interface InvokeObjectResult<T> {
214
+ data: T;
215
+ usage?: LanguageModelUsage;
216
+ }
162
217
  /**
163
218
  * Options for vision generation
164
219
  */
@@ -197,6 +252,11 @@ interface Model {
197
252
  * Generate a response with vision (images)
198
253
  */
199
254
  generateVision(prompt: string, images: ImageInput[], options?: VisionOptions): Promise<ModelResponse>;
255
+ /**
256
+ * Invoke the model and return a structured object matching the given schema (Zod).
257
+ * Uses AI SDK generateObject; when not implemented, callers may fall back to invoke + manual parse.
258
+ */
259
+ invokeObject?<T>(messages: ModelMessage[], schema: unknown, options?: InvokeObjectOptions): Promise<InvokeObjectResult<T>>;
200
260
  }
201
261
 
202
262
  /**
@@ -267,6 +327,15 @@ interface AgentToolResult {
267
327
  output: unknown;
268
328
  isError?: boolean;
269
329
  }
330
+ /**
331
+ * Observer for agent events (step, tool execution, error).
332
+ * Multiple observers can be attached via AgentConfig.observers.
333
+ */
334
+ interface AgentObserver {
335
+ onStep?(step: AgentStep): void;
336
+ onToolExecution?(toolName: string, result: unknown): void;
337
+ onError?(error: Error): void;
338
+ }
270
339
  /**
271
340
  * Configuration for running an agent
272
341
  */
@@ -283,6 +352,10 @@ interface AgentConfig {
283
352
  maxIterations?: number;
284
353
  /** Callback for each step */
285
354
  onStep?: (step: AgentStep) => void;
355
+ /** Optional observers for step, tool execution, and error events */
356
+ observers?: AgentObserver[];
357
+ /** Optional logger for agent execution */
358
+ logger?: Logger;
286
359
  }
287
360
  /**
288
361
  * A single step in the agent's execution
@@ -440,14 +513,15 @@ type ToolSet = Record<string, Tool>;
440
513
  declare function createToolSet(tools: ToolSet): ToolSet;
441
514
  declare function getTools(toolSet: ToolSet): Tool[];
442
515
  declare function getTool(toolSet: ToolSet, name: string): Tool | undefined;
443
- declare function executeTool<TInput, TOutput>(toolImpl: Tool<TInput, TOutput>, input: TInput, options?: {
516
+ interface ExecuteToolOptions {
444
517
  toolCallId?: string;
445
518
  abortSignal?: AbortSignal;
519
+ logger?: Logger;
520
+ }
521
+ declare function executeTool<TInput, TOutput>(toolImpl: Tool<TInput, TOutput>, input: TInput, options?: ExecuteToolOptions & {
522
+ toolName?: string;
446
523
  }): Promise<ToolExecutionResult<TOutput>>;
447
- declare function executeToolByName(tools: ToolSet, name: string, input: unknown, options?: {
448
- toolCallId?: string;
449
- abortSignal?: AbortSignal;
450
- }): Promise<ToolExecutionResult>;
524
+ declare function executeToolByName(tools: ToolSet, name: string, input: unknown, options?: ExecuteToolOptions): Promise<ToolExecutionResult>;
451
525
 
452
526
  /**
453
527
  * Subagents: define, run, and expose as tools to a parent agent
@@ -482,6 +556,104 @@ declare function createSubagentTool(definition: SubagentDefinition, options?: Cr
482
556
  */
483
557
  declare function createSubagentToolSet(definitions: SubagentDefinition[], options?: CreateSubagentToolOptions): ToolSet;
484
558
 
559
+ /**
560
+ * Template engine types for Handlebars-based project scaffolding
561
+ */
562
+ /** Context data passed to Handlebars templates during compilation */
563
+ interface TemplateContext {
564
+ /** Application name */
565
+ appName: string;
566
+ /** Application description */
567
+ description?: string;
568
+ /** API endpoint URL */
569
+ apiEndpoint?: string;
570
+ /** Module definitions for iterating in templates */
571
+ modules?: TemplateModule[];
572
+ /** Auth configuration */
573
+ auth?: TemplateAuth;
574
+ /** Branding configuration */
575
+ branding?: TemplateBranding;
576
+ /** Arbitrary additional data for templates */
577
+ [key: string]: unknown;
578
+ }
579
+ interface TemplateModule {
580
+ name: string;
581
+ /** PascalCase name for class/component names */
582
+ pascalName: string;
583
+ /** camelCase name for variable names */
584
+ camelName: string;
585
+ fields?: TemplateField[];
586
+ operations?: TemplateOperation[];
587
+ /** Arbitrary additional data for templates */
588
+ [key: string]: unknown;
589
+ }
590
+ interface TemplateField {
591
+ name: string;
592
+ type: string;
593
+ required: boolean;
594
+ graphqlType?: string;
595
+ /** Arbitrary additional data */
596
+ [key: string]: unknown;
597
+ }
598
+ interface TemplateOperation {
599
+ name: string;
600
+ type: string;
601
+ queryString?: string;
602
+ hookName?: string;
603
+ /** Arbitrary additional data */
604
+ [key: string]: unknown;
605
+ }
606
+ interface TemplateAuth {
607
+ strategy: string;
608
+ providers?: string[];
609
+ hasRoles: boolean;
610
+ roles?: string[];
611
+ }
612
+ interface TemplateBranding {
613
+ brandName: string;
614
+ primaryColor: string;
615
+ secondaryColor: string;
616
+ logo: string;
617
+ }
618
+ /** Configuration for scaffold_project tool */
619
+ interface ScaffoldConfig {
620
+ /** Absolute path to the template directory (e.g. .ref/templates/vite) */
621
+ templateDir: string;
622
+ /** Absolute path to the output directory */
623
+ outputDir: string;
624
+ /** Context data to compile templates with */
625
+ context: TemplateContext;
626
+ /** File patterns to skip (glob-style) */
627
+ skipPatterns?: string[];
628
+ }
629
+ /** Result from scaffolding a project */
630
+ interface ScaffoldResult {
631
+ /** Total files generated */
632
+ fileCount: number;
633
+ /** List of generated file paths (relative to outputDir) */
634
+ files: string[];
635
+ /** Any files that failed to compile */
636
+ errors: ScaffoldError[];
637
+ }
638
+ interface ScaffoldError {
639
+ file: string;
640
+ message: string;
641
+ }
642
+
643
+ /**
644
+ * Handlebars template compiler - reads .hbs files, compiles with context, writes output
645
+ */
646
+
647
+ /** Compile a single Handlebars template string with context */
648
+ declare function compileTemplate(template: string, context: TemplateContext): string;
649
+ /**
650
+ * Scaffold a project: compile all .hbs templates in templateDir with context,
651
+ * write results to outputDir, return summary.
652
+ */
653
+ declare function scaffoldProject(config: ScaffoldConfig): Promise<ScaffoldResult>;
654
+ /** Register common Handlebars helpers */
655
+ declare function registerHelpers(): void;
656
+
485
657
  /**
486
658
  * MCP client types - transport, config, and response shapes
487
659
  * for the Model Context Protocol client infrastructure.
@@ -573,6 +745,8 @@ interface HelloWorldAgentConfig {
573
745
  maxIterations?: number;
574
746
  /** Callback for each step */
575
747
  onStep?: (step: AgentStep) => void;
748
+ /** Optional logger for execution logs */
749
+ logger?: Logger;
576
750
  }
577
751
  declare function runHelloWorldAgent(config: HelloWorldAgentConfig): Promise<AgentResult>;
578
752
 
@@ -582,7 +756,7 @@ declare function runHelloWorldAgent(config: HelloWorldAgentConfig): Promise<Agen
582
756
 
583
757
  declare const fieldSchema: z.ZodObject<{
584
758
  fieldName: z.ZodString;
585
- fieldType: z.ZodEnum<{
759
+ fieldType: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<"string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password", string>>, z.ZodEnum<{
586
760
  string: "string";
587
761
  number: "number";
588
762
  boolean: "boolean";
@@ -592,19 +766,19 @@ declare const fieldSchema: z.ZodObject<{
592
766
  "Types.ObjectId": "Types.ObjectId";
593
767
  email: "email";
594
768
  password: "password";
595
- }>;
596
- isArray: z.ZodBoolean;
597
- isRequired: z.ZodBoolean;
598
- isUnique: z.ZodBoolean;
599
- values: z.ZodArray<z.ZodString>;
769
+ }>>;
770
+ isArray: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
771
+ isRequired: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
772
+ isUnique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
773
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
600
774
  defaultVal: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodNull]>>;
601
775
  relationTo: z.ZodOptional<z.ZodString>;
602
- relationType: z.ZodOptional<z.ZodEnum<{
776
+ relationType: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<"" | "one-to-one" | "many-to-one", string>>, z.ZodEnum<{
603
777
  "": "";
604
778
  "one-to-one": "one-to-one";
605
779
  "many-to-one": "many-to-one";
606
- }>>;
607
- isPrivate: z.ZodBoolean;
780
+ }>>>;
781
+ isPrivate: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
608
782
  }, z.core.$strip>;
609
783
  type TFieldSchema = z.infer<typeof fieldSchema>;
610
784
 
@@ -614,12 +788,12 @@ type TFieldSchema = z.infer<typeof fieldSchema>;
614
788
 
615
789
  declare const moduleSchema: z.ZodObject<{
616
790
  moduleName: z.ZodString;
617
- isUserModule: z.ZodBoolean;
618
- authMethod: z.ZodOptional<z.ZodEnum<{
791
+ isUserModule: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
792
+ authMethod: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<"" | "EMAIL_AND_PASSWORD" | "PHONE_AND_OTP", string>>, z.ZodEnum<{
619
793
  "": "";
620
794
  EMAIL_AND_PASSWORD: "EMAIL_AND_PASSWORD";
621
795
  PHONE_AND_OTP: "PHONE_AND_OTP";
622
- }>>;
796
+ }>>>;
623
797
  emailField: z.ZodOptional<z.ZodString>;
624
798
  passwordField: z.ZodOptional<z.ZodString>;
625
799
  phoneField: z.ZodOptional<z.ZodString>;
@@ -630,9 +804,9 @@ declare const moduleSchema: z.ZodObject<{
630
804
  UPDATE: "UPDATE";
631
805
  DELETE: "DELETE";
632
806
  }>>>>;
633
- fields: z.ZodArray<z.ZodObject<{
807
+ fields: z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
634
808
  fieldName: z.ZodString;
635
- fieldType: z.ZodEnum<{
809
+ fieldType: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<"string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password", string>>, z.ZodEnum<{
636
810
  string: "string";
637
811
  number: "number";
638
812
  boolean: "boolean";
@@ -642,20 +816,42 @@ declare const moduleSchema: z.ZodObject<{
642
816
  "Types.ObjectId": "Types.ObjectId";
643
817
  email: "email";
644
818
  password: "password";
645
- }>;
646
- isArray: z.ZodBoolean;
647
- isRequired: z.ZodBoolean;
648
- isUnique: z.ZodBoolean;
649
- values: z.ZodArray<z.ZodString>;
819
+ }>>;
820
+ isArray: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
821
+ isRequired: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
822
+ isUnique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
823
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
650
824
  defaultVal: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodNull]>>;
651
825
  relationTo: z.ZodOptional<z.ZodString>;
652
- relationType: z.ZodOptional<z.ZodEnum<{
826
+ relationType: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<"" | "one-to-one" | "many-to-one", string>>, z.ZodEnum<{
653
827
  "": "";
654
828
  "one-to-one": "one-to-one";
655
829
  "many-to-one": "many-to-one";
656
- }>>;
657
- isPrivate: z.ZodBoolean;
658
- }, z.core.$strip>>;
830
+ }>>>;
831
+ isPrivate: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
832
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, z.ZodTransform<{
833
+ fieldName: string;
834
+ fieldType: "string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password";
835
+ isArray: boolean;
836
+ isRequired: boolean;
837
+ isUnique: boolean;
838
+ values: string[];
839
+ isPrivate: boolean;
840
+ defaultVal?: string | number | boolean | null | undefined;
841
+ relationTo?: string | undefined;
842
+ relationType?: "" | "one-to-one" | "many-to-one" | undefined;
843
+ }[], Record<string, unknown> | {
844
+ fieldName: string;
845
+ fieldType: "string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password";
846
+ isArray: boolean;
847
+ isRequired: boolean;
848
+ isUnique: boolean;
849
+ values: string[];
850
+ isPrivate: boolean;
851
+ defaultVal?: string | number | boolean | null | undefined;
852
+ relationTo?: string | undefined;
853
+ relationType?: "" | "one-to-one" | "many-to-one" | undefined;
854
+ }[]>>;
659
855
  }, z.core.$strip>;
660
856
  type TModuleSchema$1 = z.infer<typeof moduleSchema>;
661
857
 
@@ -664,16 +860,16 @@ type TModuleSchema$1 = z.infer<typeof moduleSchema>;
664
860
  */
665
861
 
666
862
  declare const projectSchema: z.ZodObject<{
667
- projectName: z.ZodString;
668
- projectDescription: z.ZodString;
669
- modules: z.ZodArray<z.ZodObject<{
863
+ projectName: z.ZodDefault<z.ZodString>;
864
+ projectDescription: z.ZodDefault<z.ZodString>;
865
+ modules: z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
670
866
  moduleName: z.ZodString;
671
- isUserModule: z.ZodBoolean;
672
- authMethod: z.ZodOptional<z.ZodEnum<{
867
+ isUserModule: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
868
+ authMethod: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<"" | "EMAIL_AND_PASSWORD" | "PHONE_AND_OTP", string>>, z.ZodEnum<{
673
869
  "": "";
674
870
  EMAIL_AND_PASSWORD: "EMAIL_AND_PASSWORD";
675
871
  PHONE_AND_OTP: "PHONE_AND_OTP";
676
- }>>;
872
+ }>>>;
677
873
  emailField: z.ZodOptional<z.ZodString>;
678
874
  passwordField: z.ZodOptional<z.ZodString>;
679
875
  phoneField: z.ZodOptional<z.ZodString>;
@@ -684,9 +880,9 @@ declare const projectSchema: z.ZodObject<{
684
880
  UPDATE: "UPDATE";
685
881
  DELETE: "DELETE";
686
882
  }>>>>;
687
- fields: z.ZodArray<z.ZodObject<{
883
+ fields: z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
688
884
  fieldName: z.ZodString;
689
- fieldType: z.ZodEnum<{
885
+ fieldType: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<"string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password", string>>, z.ZodEnum<{
690
886
  string: "string";
691
887
  number: "number";
692
888
  boolean: "boolean";
@@ -696,21 +892,85 @@ declare const projectSchema: z.ZodObject<{
696
892
  "Types.ObjectId": "Types.ObjectId";
697
893
  email: "email";
698
894
  password: "password";
699
- }>;
700
- isArray: z.ZodBoolean;
701
- isRequired: z.ZodBoolean;
702
- isUnique: z.ZodBoolean;
703
- values: z.ZodArray<z.ZodString>;
895
+ }>>;
896
+ isArray: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
897
+ isRequired: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
898
+ isUnique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
899
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
704
900
  defaultVal: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodNull]>>;
705
901
  relationTo: z.ZodOptional<z.ZodString>;
706
- relationType: z.ZodOptional<z.ZodEnum<{
902
+ relationType: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<"" | "one-to-one" | "many-to-one", string>>, z.ZodEnum<{
707
903
  "": "";
708
904
  "one-to-one": "one-to-one";
709
905
  "many-to-one": "many-to-one";
710
- }>>;
711
- isPrivate: z.ZodBoolean;
712
- }, z.core.$strip>>;
713
- }, z.core.$strip>>;
906
+ }>>>;
907
+ isPrivate: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
908
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, z.ZodTransform<{
909
+ fieldName: string;
910
+ fieldType: "string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password";
911
+ isArray: boolean;
912
+ isRequired: boolean;
913
+ isUnique: boolean;
914
+ values: string[];
915
+ isPrivate: boolean;
916
+ defaultVal?: string | number | boolean | null | undefined;
917
+ relationTo?: string | undefined;
918
+ relationType?: "" | "one-to-one" | "many-to-one" | undefined;
919
+ }[], Record<string, unknown> | {
920
+ fieldName: string;
921
+ fieldType: "string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password";
922
+ isArray: boolean;
923
+ isRequired: boolean;
924
+ isUnique: boolean;
925
+ values: string[];
926
+ isPrivate: boolean;
927
+ defaultVal?: string | number | boolean | null | undefined;
928
+ relationTo?: string | undefined;
929
+ relationType?: "" | "one-to-one" | "many-to-one" | undefined;
930
+ }[]>>;
931
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, z.ZodTransform<{
932
+ moduleName: string;
933
+ isUserModule: boolean;
934
+ fields: {
935
+ fieldName: string;
936
+ fieldType: "string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password";
937
+ isArray: boolean;
938
+ isRequired: boolean;
939
+ isUnique: boolean;
940
+ values: string[];
941
+ isPrivate: boolean;
942
+ defaultVal?: string | number | boolean | null | undefined;
943
+ relationTo?: string | undefined;
944
+ relationType?: "" | "one-to-one" | "many-to-one" | undefined;
945
+ }[];
946
+ authMethod?: "" | "EMAIL_AND_PASSWORD" | "PHONE_AND_OTP" | undefined;
947
+ emailField?: string | undefined;
948
+ passwordField?: string | undefined;
949
+ phoneField?: string | undefined;
950
+ roleField?: string | undefined;
951
+ permissions?: Record<string, ("CREATE" | "READ" | "UPDATE" | "DELETE")[]> | undefined;
952
+ }[], Record<string, unknown> | {
953
+ moduleName: string;
954
+ isUserModule: boolean;
955
+ fields: {
956
+ fieldName: string;
957
+ fieldType: "string" | "number" | "boolean" | "object" | "enum" | "Date" | "Types.ObjectId" | "email" | "password";
958
+ isArray: boolean;
959
+ isRequired: boolean;
960
+ isUnique: boolean;
961
+ values: string[];
962
+ isPrivate: boolean;
963
+ defaultVal?: string | number | boolean | null | undefined;
964
+ relationTo?: string | undefined;
965
+ relationType?: "" | "one-to-one" | "many-to-one" | undefined;
966
+ }[];
967
+ authMethod?: "" | "EMAIL_AND_PASSWORD" | "PHONE_AND_OTP" | undefined;
968
+ emailField?: string | undefined;
969
+ passwordField?: string | undefined;
970
+ phoneField?: string | undefined;
971
+ roleField?: string | undefined;
972
+ permissions?: Record<string, ("CREATE" | "READ" | "UPDATE" | "DELETE")[]> | undefined;
973
+ }[]>>;
714
974
  author: z.ZodDefault<z.ZodString>;
715
975
  }, z.core.$strip>;
716
976
  type TBackendProjectSchema = z.infer<typeof projectSchema>;
@@ -719,7 +979,7 @@ type TBackendProjectSchema = z.infer<typeof projectSchema>;
719
979
  * db-designer module types - structured requirements and agent config
720
980
  */
721
981
 
722
- interface Actor {
982
+ interface Actor$1 {
723
983
  id: string;
724
984
  name: string;
725
985
  description: string;
@@ -756,7 +1016,7 @@ interface StructuredRequirementsInput {
756
1016
  projectName: string;
757
1017
  projectGoal: string;
758
1018
  projectDescription?: string;
759
- actors: Actor[];
1019
+ actors: Actor$1[];
760
1020
  flows: ExtractedFlow[];
761
1021
  stories: ExtractedStory[];
762
1022
  technicalRequirements?: TechnicalRequirements;
@@ -770,6 +1030,8 @@ interface DbDesignerAgentConfig {
770
1030
  maxIterations?: number;
771
1031
  /** Callback for each step */
772
1032
  onStep?: (step: AgentStep) => void;
1033
+ /** Optional logger for execution logs */
1034
+ logger?: Logger;
773
1035
  }
774
1036
 
775
1037
  /**
@@ -788,11 +1050,11 @@ declare function createDbDesignPrompt(requirement: string): string;
788
1050
  /**
789
1051
  * Format actors/user types into prompt-friendly string
790
1052
  */
791
- declare function formatUserTypes(actors: Actor[]): string;
1053
+ declare function formatUserTypes(actors: Actor$1[]): string;
792
1054
  /**
793
1055
  * Format user flows into prompt-friendly string
794
1056
  */
795
- declare function formatUserFlows(flows: ExtractedFlow[], actors: Actor[]): string;
1057
+ declare function formatUserFlows(flows: ExtractedFlow[], actors: Actor$1[]): string;
796
1058
  /**
797
1059
  * Format user stories with dataInvolved into prompt-friendly string
798
1060
  */
@@ -808,7 +1070,7 @@ declare function extractDataEntities(stories: ExtractedStory[]): string[];
808
1070
  /**
809
1071
  * Extract roles from actors for RBAC configuration
810
1072
  */
811
- declare function extractRoles(actors: Actor[]): string[];
1073
+ declare function extractRoles(actors: Actor$1[]): string[];
812
1074
  /**
813
1075
  * Build complete prompt variables from structured requirements
814
1076
  */
@@ -826,7 +1088,7 @@ declare function createRedesignPrompt(existingSchema: string, userFeedback: stri
826
1088
  /**
827
1089
  * validate_schema tool - validates JSON against projectSchema (no AI)
828
1090
  */
829
- declare const validateSchemaTool: ai.Tool;
1091
+ declare const validateSchemaTool$1: ai.Tool;
830
1092
 
831
1093
  /**
832
1094
  * Creates the design_database tool. Requires a model to invoke for schema generation.
@@ -851,12 +1113,12 @@ declare function createDbDesignerTools(model: Model): ToolSet;
851
1113
  /**
852
1114
  * entity-analyzer subagent - extracts entities, relationships, and roles from requirements (no tools)
853
1115
  */
854
- declare const entityAnalyzerSubagent: SubagentDefinition;
1116
+ declare const entityAnalyzerSubagent$1: SubagentDefinition;
855
1117
 
856
1118
  /**
857
1119
  * schema-refiner subagent - validates schema and suggests refinements (has validate_schema tool)
858
1120
  */
859
- declare function createSchemaRefinerSubagent(): SubagentDefinition;
1121
+ declare function createSchemaRefinerSubagent$1(): SubagentDefinition;
860
1122
 
861
1123
  /**
862
1124
  * runDbDesignerAgent - orchestrator for the full DB design workflow
@@ -921,10 +1183,10 @@ declare const FormFieldSchema: z.ZodObject<{
921
1183
  date: "date";
922
1184
  email: "email";
923
1185
  password: "password";
1186
+ select: "select";
924
1187
  multiSelect: "multiSelect";
925
1188
  textarea: "textarea";
926
1189
  hidden: "hidden";
927
- select: "select";
928
1190
  }>;
929
1191
  required: z.ZodOptional<z.ZodBoolean>;
930
1192
  validation: z.ZodOptional<z.ZodObject<{
@@ -1003,10 +1265,10 @@ declare const DrawerSchema: z.ZodObject<{
1003
1265
  date: "date";
1004
1266
  email: "email";
1005
1267
  password: "password";
1268
+ select: "select";
1006
1269
  multiSelect: "multiSelect";
1007
1270
  textarea: "textarea";
1008
1271
  hidden: "hidden";
1009
- select: "select";
1010
1272
  }>;
1011
1273
  required: z.ZodOptional<z.ZodBoolean>;
1012
1274
  validation: z.ZodOptional<z.ZodObject<{
@@ -1061,10 +1323,10 @@ declare const AuthPageSchema: z.ZodObject<{
1061
1323
  date: "date";
1062
1324
  email: "email";
1063
1325
  password: "password";
1326
+ select: "select";
1064
1327
  multiSelect: "multiSelect";
1065
1328
  textarea: "textarea";
1066
1329
  hidden: "hidden";
1067
- select: "select";
1068
1330
  }>;
1069
1331
  required: z.ZodOptional<z.ZodBoolean>;
1070
1332
  validation: z.ZodOptional<z.ZodObject<{
@@ -1120,10 +1382,10 @@ declare const ListingPageSchema: z.ZodObject<{
1120
1382
  date: "date";
1121
1383
  email: "email";
1122
1384
  password: "password";
1385
+ select: "select";
1123
1386
  multiSelect: "multiSelect";
1124
1387
  textarea: "textarea";
1125
1388
  hidden: "hidden";
1126
- select: "select";
1127
1389
  }>;
1128
1390
  required: z.ZodOptional<z.ZodBoolean>;
1129
1391
  validation: z.ZodOptional<z.ZodObject<{
@@ -1152,10 +1414,10 @@ declare const ListingPageSchema: z.ZodObject<{
1152
1414
  date: "date";
1153
1415
  email: "email";
1154
1416
  password: "password";
1417
+ select: "select";
1155
1418
  multiSelect: "multiSelect";
1156
1419
  textarea: "textarea";
1157
1420
  hidden: "hidden";
1158
- select: "select";
1159
1421
  }>;
1160
1422
  required: z.ZodOptional<z.ZodBoolean>;
1161
1423
  validation: z.ZodOptional<z.ZodObject<{
@@ -1211,10 +1473,10 @@ declare const PageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1211
1473
  date: "date";
1212
1474
  email: "email";
1213
1475
  password: "password";
1476
+ select: "select";
1214
1477
  multiSelect: "multiSelect";
1215
1478
  textarea: "textarea";
1216
1479
  hidden: "hidden";
1217
- select: "select";
1218
1480
  }>;
1219
1481
  required: z.ZodOptional<z.ZodBoolean>;
1220
1482
  validation: z.ZodOptional<z.ZodObject<{
@@ -1269,10 +1531,10 @@ declare const PageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1269
1531
  date: "date";
1270
1532
  email: "email";
1271
1533
  password: "password";
1534
+ select: "select";
1272
1535
  multiSelect: "multiSelect";
1273
1536
  textarea: "textarea";
1274
1537
  hidden: "hidden";
1275
- select: "select";
1276
1538
  }>;
1277
1539
  required: z.ZodOptional<z.ZodBoolean>;
1278
1540
  validation: z.ZodOptional<z.ZodObject<{
@@ -1301,10 +1563,10 @@ declare const PageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1301
1563
  date: "date";
1302
1564
  email: "email";
1303
1565
  password: "password";
1566
+ select: "select";
1304
1567
  multiSelect: "multiSelect";
1305
1568
  textarea: "textarea";
1306
1569
  hidden: "hidden";
1307
- select: "select";
1308
1570
  }>;
1309
1571
  required: z.ZodOptional<z.ZodBoolean>;
1310
1572
  validation: z.ZodOptional<z.ZodObject<{
@@ -1368,10 +1630,10 @@ declare const ModuleSchema: z.ZodObject<{
1368
1630
  date: "date";
1369
1631
  email: "email";
1370
1632
  password: "password";
1633
+ select: "select";
1371
1634
  multiSelect: "multiSelect";
1372
1635
  textarea: "textarea";
1373
1636
  hidden: "hidden";
1374
- select: "select";
1375
1637
  }>;
1376
1638
  required: z.ZodOptional<z.ZodBoolean>;
1377
1639
  validation: z.ZodOptional<z.ZodObject<{
@@ -1426,10 +1688,10 @@ declare const ModuleSchema: z.ZodObject<{
1426
1688
  date: "date";
1427
1689
  email: "email";
1428
1690
  password: "password";
1691
+ select: "select";
1429
1692
  multiSelect: "multiSelect";
1430
1693
  textarea: "textarea";
1431
1694
  hidden: "hidden";
1432
- select: "select";
1433
1695
  }>;
1434
1696
  required: z.ZodOptional<z.ZodBoolean>;
1435
1697
  validation: z.ZodOptional<z.ZodObject<{
@@ -1458,10 +1720,10 @@ declare const ModuleSchema: z.ZodObject<{
1458
1720
  date: "date";
1459
1721
  email: "email";
1460
1722
  password: "password";
1723
+ select: "select";
1461
1724
  multiSelect: "multiSelect";
1462
1725
  textarea: "textarea";
1463
1726
  hidden: "hidden";
1464
- select: "select";
1465
1727
  }>;
1466
1728
  required: z.ZodOptional<z.ZodBoolean>;
1467
1729
  validation: z.ZodOptional<z.ZodObject<{
@@ -1533,10 +1795,10 @@ declare const ApplicationSchema: z.ZodObject<{
1533
1795
  date: "date";
1534
1796
  email: "email";
1535
1797
  password: "password";
1798
+ select: "select";
1536
1799
  multiSelect: "multiSelect";
1537
1800
  textarea: "textarea";
1538
1801
  hidden: "hidden";
1539
- select: "select";
1540
1802
  }>;
1541
1803
  required: z.ZodOptional<z.ZodBoolean>;
1542
1804
  validation: z.ZodOptional<z.ZodObject<{
@@ -1591,10 +1853,10 @@ declare const ApplicationSchema: z.ZodObject<{
1591
1853
  date: "date";
1592
1854
  email: "email";
1593
1855
  password: "password";
1856
+ select: "select";
1594
1857
  multiSelect: "multiSelect";
1595
1858
  textarea: "textarea";
1596
1859
  hidden: "hidden";
1597
- select: "select";
1598
1860
  }>;
1599
1861
  required: z.ZodOptional<z.ZodBoolean>;
1600
1862
  validation: z.ZodOptional<z.ZodObject<{
@@ -1623,10 +1885,10 @@ declare const ApplicationSchema: z.ZodObject<{
1623
1885
  date: "date";
1624
1886
  email: "email";
1625
1887
  password: "password";
1888
+ select: "select";
1626
1889
  multiSelect: "multiSelect";
1627
1890
  textarea: "textarea";
1628
1891
  hidden: "hidden";
1629
- select: "select";
1630
1892
  }>;
1631
1893
  required: z.ZodOptional<z.ZodBoolean>;
1632
1894
  validation: z.ZodOptional<z.ZodObject<{
@@ -1751,12 +2013,14 @@ interface ReactBuilderAgentConfig {
1751
2013
  maxIterations?: number;
1752
2014
  /** Callback for each step */
1753
2015
  onStep?: (step: AgentStep) => void;
2016
+ /** Optional logger for execution logs */
2017
+ logger?: Logger;
1754
2018
  }
1755
2019
 
1756
2020
  /**
1757
2021
  * System prompt for GraphQL-to-frontend configuration conversion
1758
2022
  */
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.";
2023
+ 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 a React + Vite frontend application.\n\n## Target Tech Stack\nThe generated configuration will be consumed by a Vite + React 19 + TypeScript template with:\n- **UI Components**: ShadCN UI (Radix-based) from src/components/ui/\n- **Styling**: Tailwind CSS v4 with OKLCH color space\n- **Routing**: React Router v7 with private route support\n- **Forms**: React Hook Form + Zod validation (zodResolver)\n- **GraphQL Client**: Apollo Client with typed hooks from CodeGen\n- **Path Aliases**: @/{appName}/* maps to ./src/*\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 (route guarded by React Router).\n- Form fields should map to React Hook Form + Zod validation schemas.\n- Maintain camelCase. Ensure valid JSON syntax.";
1760
2024
 
1761
2025
  /**
1762
2026
  * Instruction template for GraphQL-to-frontend conversion
@@ -1813,4 +2077,3008 @@ declare function createConfigValidatorSubagent(): SubagentDefinition;
1813
2077
  */
1814
2078
  declare function runReactBuilderAgent(config: ReactBuilderAgentConfig): Promise<AgentResult>;
1815
2079
 
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 };
2080
+ /**
2081
+ * Zod schemas for RequirementContext, ProjectBrief, Question, ChatEntry
2082
+ */
2083
+
2084
+ declare const projectBriefSchema: z.ZodObject<{
2085
+ name: z.ZodString;
2086
+ goal: z.ZodString;
2087
+ features: z.ZodArray<z.ZodString>;
2088
+ domain: z.ZodString;
2089
+ database: z.ZodEnum<{
2090
+ mongodb: "mongodb";
2091
+ postgresql: "postgresql";
2092
+ }>;
2093
+ backendRuntime: z.ZodLiteral<"nodejs">;
2094
+ apiStyle: z.ZodEnum<{
2095
+ rest: "rest";
2096
+ graphql: "graphql";
2097
+ }>;
2098
+ }, z.core.$strip>;
2099
+ declare const questionSchema: z.ZodObject<{
2100
+ id: z.ZodString;
2101
+ question: z.ZodString;
2102
+ context: z.ZodString;
2103
+ suggestions: z.ZodArray<z.ZodString>;
2104
+ multiSelect: z.ZodBoolean;
2105
+ required: z.ZodBoolean;
2106
+ }, z.core.$strip>;
2107
+ declare const chatEntrySchema: z.ZodObject<{
2108
+ role: z.ZodEnum<{
2109
+ user: "user";
2110
+ assistant: "assistant";
2111
+ }>;
2112
+ content: z.ZodString;
2113
+ }, z.core.$strip>;
2114
+ declare const requirementContextSchema: z.ZodObject<{
2115
+ stage: z.ZodEnum<{
2116
+ discovery: "discovery";
2117
+ requirements: "requirements";
2118
+ design: "design";
2119
+ complete: "complete";
2120
+ }>;
2121
+ projectBrief: z.ZodNullable<z.ZodObject<{
2122
+ name: z.ZodString;
2123
+ goal: z.ZodString;
2124
+ features: z.ZodArray<z.ZodString>;
2125
+ domain: z.ZodString;
2126
+ database: z.ZodEnum<{
2127
+ mongodb: "mongodb";
2128
+ postgresql: "postgresql";
2129
+ }>;
2130
+ backendRuntime: z.ZodLiteral<"nodejs">;
2131
+ apiStyle: z.ZodEnum<{
2132
+ rest: "rest";
2133
+ graphql: "graphql";
2134
+ }>;
2135
+ }, z.core.$strip>>;
2136
+ actors: z.ZodArray<z.ZodObject<{
2137
+ id: z.ZodString;
2138
+ name: z.ZodString;
2139
+ description: z.ZodString;
2140
+ goals: z.ZodArray<z.ZodString>;
2141
+ }, z.core.$strip>>;
2142
+ flows: z.ZodArray<z.ZodObject<{
2143
+ id: z.ZodString;
2144
+ actorId: z.ZodString;
2145
+ name: z.ZodString;
2146
+ description: z.ZodString;
2147
+ trigger: z.ZodString;
2148
+ outcome: z.ZodString;
2149
+ }, z.core.$strip>>;
2150
+ stories: z.ZodArray<z.ZodObject<{
2151
+ id: z.ZodString;
2152
+ flowId: z.ZodString;
2153
+ actor: z.ZodString;
2154
+ action: z.ZodString;
2155
+ benefit: z.ZodString;
2156
+ preconditions: z.ZodArray<z.ZodString>;
2157
+ postconditions: z.ZodArray<z.ZodString>;
2158
+ dataInvolved: z.ZodArray<z.ZodString>;
2159
+ }, z.core.$strip>>;
2160
+ modules: z.ZodArray<z.ZodObject<{
2161
+ id: z.ZodString;
2162
+ name: z.ZodString;
2163
+ description: z.ZodString;
2164
+ entity: z.ZodString;
2165
+ apis: z.ZodArray<z.ZodObject<{
2166
+ id: z.ZodString;
2167
+ name: z.ZodString;
2168
+ operation: z.ZodEnum<{
2169
+ create: "create";
2170
+ update: "update";
2171
+ delete: "delete";
2172
+ read: "read";
2173
+ readAll: "readAll";
2174
+ }>;
2175
+ description: z.ZodString;
2176
+ inputs: z.ZodArray<z.ZodString>;
2177
+ outputs: z.ZodArray<z.ZodString>;
2178
+ }, z.core.$strip>>;
2179
+ }, z.core.$strip>>;
2180
+ database: z.ZodNullable<z.ZodObject<{
2181
+ type: z.ZodEnum<{
2182
+ mongodb: "mongodb";
2183
+ postgresql: "postgresql";
2184
+ }>;
2185
+ reasoning: z.ZodString;
2186
+ entities: z.ZodArray<z.ZodObject<{
2187
+ name: z.ZodString;
2188
+ description: z.ZodString;
2189
+ fields: z.ZodArray<z.ZodObject<{
2190
+ name: z.ZodString;
2191
+ type: z.ZodString;
2192
+ required: z.ZodBoolean;
2193
+ unique: z.ZodBoolean;
2194
+ description: z.ZodString;
2195
+ default: z.ZodOptional<z.ZodString>;
2196
+ }, z.core.$strip>>;
2197
+ indexes: z.ZodArray<z.ZodObject<{
2198
+ name: z.ZodString;
2199
+ fields: z.ZodArray<z.ZodString>;
2200
+ unique: z.ZodBoolean;
2201
+ }, z.core.$strip>>;
2202
+ relations: z.ZodArray<z.ZodObject<{
2203
+ field: z.ZodString;
2204
+ references: z.ZodString;
2205
+ description: z.ZodString;
2206
+ }, z.core.$strip>>;
2207
+ }, z.core.$strip>>;
2208
+ }, z.core.$strip>>;
2209
+ apiDesign: z.ZodNullable<z.ZodObject<{
2210
+ style: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2211
+ rest: "rest";
2212
+ graphql: "graphql";
2213
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2214
+ rest: "rest";
2215
+ graphql: "graphql";
2216
+ }>>;
2217
+ rest: z.ZodOptional<z.ZodObject<{
2218
+ baseUrl: z.ZodDefault<z.ZodString>;
2219
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
2220
+ id: z.ZodString;
2221
+ moduleId: z.ZodString;
2222
+ method: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2223
+ DELETE: "DELETE";
2224
+ GET: "GET";
2225
+ POST: "POST";
2226
+ PUT: "PUT";
2227
+ PATCH: "PATCH";
2228
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2229
+ DELETE: "DELETE";
2230
+ GET: "GET";
2231
+ POST: "POST";
2232
+ PUT: "PUT";
2233
+ PATCH: "PATCH";
2234
+ }>>;
2235
+ path: z.ZodString;
2236
+ description: z.ZodString;
2237
+ auth: z.ZodCoercedBoolean<unknown>;
2238
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2239
+ requestBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2240
+ [k: string]: string;
2241
+ }, Record<string, unknown>>>;
2242
+ responseBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2243
+ [k: string]: string;
2244
+ }, Record<string, unknown>>>;
2245
+ queryParams: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2246
+ [k: string]: string;
2247
+ }, Record<string, unknown>>>;
2248
+ }, z.core.$strip>>>;
2249
+ }, z.core.$strip>>;
2250
+ graphql: z.ZodOptional<z.ZodObject<{
2251
+ types: z.ZodDefault<z.ZodArray<z.ZodObject<{
2252
+ name: z.ZodString;
2253
+ kind: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2254
+ input: "input";
2255
+ type: "type";
2256
+ enum: "enum";
2257
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2258
+ input: "input";
2259
+ type: "type";
2260
+ enum: "enum";
2261
+ }>>;
2262
+ fields: z.ZodArray<z.ZodObject<{
2263
+ name: z.ZodString;
2264
+ type: z.ZodString;
2265
+ description: z.ZodString;
2266
+ }, z.core.$strip>>;
2267
+ }, z.core.$strip>>>;
2268
+ queries: z.ZodDefault<z.ZodArray<z.ZodObject<{
2269
+ name: z.ZodString;
2270
+ moduleId: z.ZodString;
2271
+ description: z.ZodString;
2272
+ auth: z.ZodCoercedBoolean<unknown>;
2273
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2274
+ args: z.ZodArray<z.ZodObject<{
2275
+ name: z.ZodString;
2276
+ type: z.ZodString;
2277
+ required: z.ZodCoercedBoolean<unknown>;
2278
+ }, z.core.$strip>>;
2279
+ returnType: z.ZodString;
2280
+ }, z.core.$strip>>>;
2281
+ mutations: z.ZodDefault<z.ZodArray<z.ZodObject<{
2282
+ name: z.ZodString;
2283
+ moduleId: z.ZodString;
2284
+ description: z.ZodString;
2285
+ auth: z.ZodCoercedBoolean<unknown>;
2286
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2287
+ args: z.ZodArray<z.ZodObject<{
2288
+ name: z.ZodString;
2289
+ type: z.ZodString;
2290
+ required: z.ZodCoercedBoolean<unknown>;
2291
+ }, z.core.$strip>>;
2292
+ returnType: z.ZodString;
2293
+ }, z.core.$strip>>>;
2294
+ }, z.core.$strip>>;
2295
+ }, z.core.$strip>>;
2296
+ history: z.ZodArray<z.ZodObject<{
2297
+ role: z.ZodEnum<{
2298
+ user: "user";
2299
+ assistant: "assistant";
2300
+ }>;
2301
+ content: z.ZodString;
2302
+ }, z.core.$strip>>;
2303
+ pendingQuestions: z.ZodArray<z.ZodObject<{
2304
+ id: z.ZodString;
2305
+ question: z.ZodString;
2306
+ context: z.ZodString;
2307
+ suggestions: z.ZodArray<z.ZodString>;
2308
+ multiSelect: z.ZodBoolean;
2309
+ required: z.ZodBoolean;
2310
+ }, z.core.$strip>>;
2311
+ }, z.core.$strip>;
2312
+ type Question$1 = z.infer<typeof questionSchema>;
2313
+ type ChatEntry$2 = z.infer<typeof chatEntrySchema>;
2314
+
2315
+ /**
2316
+ * Zod schemas for DatabaseDesign, DatabaseEntity, EntityField, EntityIndex, EntityRelation
2317
+ */
2318
+
2319
+ declare const entityFieldSchema: z.ZodObject<{
2320
+ name: z.ZodString;
2321
+ type: z.ZodString;
2322
+ required: z.ZodBoolean;
2323
+ unique: z.ZodBoolean;
2324
+ description: z.ZodString;
2325
+ default: z.ZodOptional<z.ZodString>;
2326
+ }, z.core.$strip>;
2327
+ declare const entityIndexSchema: z.ZodObject<{
2328
+ name: z.ZodString;
2329
+ fields: z.ZodArray<z.ZodString>;
2330
+ unique: z.ZodBoolean;
2331
+ }, z.core.$strip>;
2332
+ declare const entityRelationSchema: z.ZodObject<{
2333
+ field: z.ZodString;
2334
+ references: z.ZodString;
2335
+ description: z.ZodString;
2336
+ }, z.core.$strip>;
2337
+ declare const databaseEntitySchema: z.ZodObject<{
2338
+ name: z.ZodString;
2339
+ description: z.ZodString;
2340
+ fields: z.ZodArray<z.ZodObject<{
2341
+ name: z.ZodString;
2342
+ type: z.ZodString;
2343
+ required: z.ZodBoolean;
2344
+ unique: z.ZodBoolean;
2345
+ description: z.ZodString;
2346
+ default: z.ZodOptional<z.ZodString>;
2347
+ }, z.core.$strip>>;
2348
+ indexes: z.ZodArray<z.ZodObject<{
2349
+ name: z.ZodString;
2350
+ fields: z.ZodArray<z.ZodString>;
2351
+ unique: z.ZodBoolean;
2352
+ }, z.core.$strip>>;
2353
+ relations: z.ZodArray<z.ZodObject<{
2354
+ field: z.ZodString;
2355
+ references: z.ZodString;
2356
+ description: z.ZodString;
2357
+ }, z.core.$strip>>;
2358
+ }, z.core.$strip>;
2359
+ declare const databaseDesignSchema: z.ZodObject<{
2360
+ type: z.ZodEnum<{
2361
+ mongodb: "mongodb";
2362
+ postgresql: "postgresql";
2363
+ }>;
2364
+ reasoning: z.ZodString;
2365
+ entities: z.ZodArray<z.ZodObject<{
2366
+ name: z.ZodString;
2367
+ description: z.ZodString;
2368
+ fields: z.ZodArray<z.ZodObject<{
2369
+ name: z.ZodString;
2370
+ type: z.ZodString;
2371
+ required: z.ZodBoolean;
2372
+ unique: z.ZodBoolean;
2373
+ description: z.ZodString;
2374
+ default: z.ZodOptional<z.ZodString>;
2375
+ }, z.core.$strip>>;
2376
+ indexes: z.ZodArray<z.ZodObject<{
2377
+ name: z.ZodString;
2378
+ fields: z.ZodArray<z.ZodString>;
2379
+ unique: z.ZodBoolean;
2380
+ }, z.core.$strip>>;
2381
+ relations: z.ZodArray<z.ZodObject<{
2382
+ field: z.ZodString;
2383
+ references: z.ZodString;
2384
+ description: z.ZodString;
2385
+ }, z.core.$strip>>;
2386
+ }, z.core.$strip>>;
2387
+ }, z.core.$strip>;
2388
+ type EntityField$2 = z.infer<typeof entityFieldSchema>;
2389
+ type EntityIndex$2 = z.infer<typeof entityIndexSchema>;
2390
+ type EntityRelation$2 = z.infer<typeof entityRelationSchema>;
2391
+ type DatabaseEntity$1 = z.infer<typeof databaseEntitySchema>;
2392
+ type DatabaseDesign$1 = z.infer<typeof databaseDesignSchema>;
2393
+
2394
+ /**
2395
+ * Zod schemas for ApiDesign, RestEndpoint, GraphqlTypeDefinition, GraphqlOperation
2396
+ * Uses coercion so LLM output (e.g. "GET" vs "get", "true" vs true) still validates.
2397
+ */
2398
+
2399
+ declare const restEndpointSchema$1: z.ZodObject<{
2400
+ id: z.ZodString;
2401
+ moduleId: z.ZodString;
2402
+ method: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2403
+ DELETE: "DELETE";
2404
+ GET: "GET";
2405
+ POST: "POST";
2406
+ PUT: "PUT";
2407
+ PATCH: "PATCH";
2408
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2409
+ DELETE: "DELETE";
2410
+ GET: "GET";
2411
+ POST: "POST";
2412
+ PUT: "PUT";
2413
+ PATCH: "PATCH";
2414
+ }>>;
2415
+ path: z.ZodString;
2416
+ description: z.ZodString;
2417
+ auth: z.ZodCoercedBoolean<unknown>;
2418
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2419
+ requestBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2420
+ [k: string]: string;
2421
+ }, Record<string, unknown>>>;
2422
+ responseBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2423
+ [k: string]: string;
2424
+ }, Record<string, unknown>>>;
2425
+ queryParams: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2426
+ [k: string]: string;
2427
+ }, Record<string, unknown>>>;
2428
+ }, z.core.$strip>;
2429
+ declare const restApiDesignSchema: z.ZodObject<{
2430
+ baseUrl: z.ZodDefault<z.ZodString>;
2431
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
2432
+ id: z.ZodString;
2433
+ moduleId: z.ZodString;
2434
+ method: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2435
+ DELETE: "DELETE";
2436
+ GET: "GET";
2437
+ POST: "POST";
2438
+ PUT: "PUT";
2439
+ PATCH: "PATCH";
2440
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2441
+ DELETE: "DELETE";
2442
+ GET: "GET";
2443
+ POST: "POST";
2444
+ PUT: "PUT";
2445
+ PATCH: "PATCH";
2446
+ }>>;
2447
+ path: z.ZodString;
2448
+ description: z.ZodString;
2449
+ auth: z.ZodCoercedBoolean<unknown>;
2450
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2451
+ requestBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2452
+ [k: string]: string;
2453
+ }, Record<string, unknown>>>;
2454
+ responseBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2455
+ [k: string]: string;
2456
+ }, Record<string, unknown>>>;
2457
+ queryParams: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2458
+ [k: string]: string;
2459
+ }, Record<string, unknown>>>;
2460
+ }, z.core.$strip>>>;
2461
+ }, z.core.$strip>;
2462
+ declare const graphqlTypeDefinitionSchema: z.ZodObject<{
2463
+ name: z.ZodString;
2464
+ kind: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2465
+ input: "input";
2466
+ type: "type";
2467
+ enum: "enum";
2468
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2469
+ input: "input";
2470
+ type: "type";
2471
+ enum: "enum";
2472
+ }>>;
2473
+ fields: z.ZodArray<z.ZodObject<{
2474
+ name: z.ZodString;
2475
+ type: z.ZodString;
2476
+ description: z.ZodString;
2477
+ }, z.core.$strip>>;
2478
+ }, z.core.$strip>;
2479
+ declare const graphqlOperationSchema$1: z.ZodObject<{
2480
+ name: z.ZodString;
2481
+ moduleId: z.ZodString;
2482
+ description: z.ZodString;
2483
+ auth: z.ZodCoercedBoolean<unknown>;
2484
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2485
+ args: z.ZodArray<z.ZodObject<{
2486
+ name: z.ZodString;
2487
+ type: z.ZodString;
2488
+ required: z.ZodCoercedBoolean<unknown>;
2489
+ }, z.core.$strip>>;
2490
+ returnType: z.ZodString;
2491
+ }, z.core.$strip>;
2492
+ declare const graphqlApiDesignSchema: z.ZodObject<{
2493
+ types: z.ZodDefault<z.ZodArray<z.ZodObject<{
2494
+ name: z.ZodString;
2495
+ kind: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2496
+ input: "input";
2497
+ type: "type";
2498
+ enum: "enum";
2499
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2500
+ input: "input";
2501
+ type: "type";
2502
+ enum: "enum";
2503
+ }>>;
2504
+ fields: z.ZodArray<z.ZodObject<{
2505
+ name: z.ZodString;
2506
+ type: z.ZodString;
2507
+ description: z.ZodString;
2508
+ }, z.core.$strip>>;
2509
+ }, z.core.$strip>>>;
2510
+ queries: z.ZodDefault<z.ZodArray<z.ZodObject<{
2511
+ name: z.ZodString;
2512
+ moduleId: z.ZodString;
2513
+ description: z.ZodString;
2514
+ auth: z.ZodCoercedBoolean<unknown>;
2515
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2516
+ args: z.ZodArray<z.ZodObject<{
2517
+ name: z.ZodString;
2518
+ type: z.ZodString;
2519
+ required: z.ZodCoercedBoolean<unknown>;
2520
+ }, z.core.$strip>>;
2521
+ returnType: z.ZodString;
2522
+ }, z.core.$strip>>>;
2523
+ mutations: z.ZodDefault<z.ZodArray<z.ZodObject<{
2524
+ name: z.ZodString;
2525
+ moduleId: z.ZodString;
2526
+ description: z.ZodString;
2527
+ auth: z.ZodCoercedBoolean<unknown>;
2528
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2529
+ args: z.ZodArray<z.ZodObject<{
2530
+ name: z.ZodString;
2531
+ type: z.ZodString;
2532
+ required: z.ZodCoercedBoolean<unknown>;
2533
+ }, z.core.$strip>>;
2534
+ returnType: z.ZodString;
2535
+ }, z.core.$strip>>>;
2536
+ }, z.core.$strip>;
2537
+ declare const apiDesignSchema$1: z.ZodObject<{
2538
+ style: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2539
+ rest: "rest";
2540
+ graphql: "graphql";
2541
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2542
+ rest: "rest";
2543
+ graphql: "graphql";
2544
+ }>>;
2545
+ rest: z.ZodOptional<z.ZodObject<{
2546
+ baseUrl: z.ZodDefault<z.ZodString>;
2547
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
2548
+ id: z.ZodString;
2549
+ moduleId: z.ZodString;
2550
+ method: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2551
+ DELETE: "DELETE";
2552
+ GET: "GET";
2553
+ POST: "POST";
2554
+ PUT: "PUT";
2555
+ PATCH: "PATCH";
2556
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2557
+ DELETE: "DELETE";
2558
+ GET: "GET";
2559
+ POST: "POST";
2560
+ PUT: "PUT";
2561
+ PATCH: "PATCH";
2562
+ }>>;
2563
+ path: z.ZodString;
2564
+ description: z.ZodString;
2565
+ auth: z.ZodCoercedBoolean<unknown>;
2566
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2567
+ requestBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2568
+ [k: string]: string;
2569
+ }, Record<string, unknown>>>;
2570
+ responseBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2571
+ [k: string]: string;
2572
+ }, Record<string, unknown>>>;
2573
+ queryParams: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2574
+ [k: string]: string;
2575
+ }, Record<string, unknown>>>;
2576
+ }, z.core.$strip>>>;
2577
+ }, z.core.$strip>>;
2578
+ graphql: z.ZodOptional<z.ZodObject<{
2579
+ types: z.ZodDefault<z.ZodArray<z.ZodObject<{
2580
+ name: z.ZodString;
2581
+ kind: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2582
+ input: "input";
2583
+ type: "type";
2584
+ enum: "enum";
2585
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2586
+ input: "input";
2587
+ type: "type";
2588
+ enum: "enum";
2589
+ }>>;
2590
+ fields: z.ZodArray<z.ZodObject<{
2591
+ name: z.ZodString;
2592
+ type: z.ZodString;
2593
+ description: z.ZodString;
2594
+ }, z.core.$strip>>;
2595
+ }, z.core.$strip>>>;
2596
+ queries: z.ZodDefault<z.ZodArray<z.ZodObject<{
2597
+ name: z.ZodString;
2598
+ moduleId: z.ZodString;
2599
+ description: z.ZodString;
2600
+ auth: z.ZodCoercedBoolean<unknown>;
2601
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2602
+ args: z.ZodArray<z.ZodObject<{
2603
+ name: z.ZodString;
2604
+ type: z.ZodString;
2605
+ required: z.ZodCoercedBoolean<unknown>;
2606
+ }, z.core.$strip>>;
2607
+ returnType: z.ZodString;
2608
+ }, z.core.$strip>>>;
2609
+ mutations: z.ZodDefault<z.ZodArray<z.ZodObject<{
2610
+ name: z.ZodString;
2611
+ moduleId: z.ZodString;
2612
+ description: z.ZodString;
2613
+ auth: z.ZodCoercedBoolean<unknown>;
2614
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2615
+ args: z.ZodArray<z.ZodObject<{
2616
+ name: z.ZodString;
2617
+ type: z.ZodString;
2618
+ required: z.ZodCoercedBoolean<unknown>;
2619
+ }, z.core.$strip>>;
2620
+ returnType: z.ZodString;
2621
+ }, z.core.$strip>>>;
2622
+ }, z.core.$strip>>;
2623
+ }, z.core.$strip>;
2624
+ type RestEndpoint$2 = z.infer<typeof restEndpointSchema$1>;
2625
+ type RestApiDesign$1 = z.infer<typeof restApiDesignSchema>;
2626
+ type GraphqlTypeDefinition$1 = z.infer<typeof graphqlTypeDefinitionSchema>;
2627
+ type GraphqlOperation$2 = z.infer<typeof graphqlOperationSchema$1>;
2628
+ type GraphqlApiDesign$1 = z.infer<typeof graphqlApiDesignSchema>;
2629
+ type ApiDesign$2 = z.infer<typeof apiDesignSchema$1>;
2630
+
2631
+ /**
2632
+ * Zod schemas for FinalRequirement, RequirementSummary
2633
+ */
2634
+
2635
+ declare const requirementSummarySchema: z.ZodObject<{
2636
+ totalActors: z.ZodNumber;
2637
+ totalFlows: z.ZodNumber;
2638
+ totalStories: z.ZodNumber;
2639
+ totalModules: z.ZodNumber;
2640
+ totalEntities: z.ZodNumber;
2641
+ totalEndpoints: z.ZodNumber;
2642
+ overview: z.ZodString;
2643
+ }, z.core.$strip>;
2644
+ declare const finalRequirementSchema: z.ZodObject<{
2645
+ project: z.ZodObject<{
2646
+ name: z.ZodString;
2647
+ goal: z.ZodString;
2648
+ features: z.ZodArray<z.ZodString>;
2649
+ domain: z.ZodString;
2650
+ database: z.ZodEnum<{
2651
+ mongodb: "mongodb";
2652
+ postgresql: "postgresql";
2653
+ }>;
2654
+ backendRuntime: z.ZodLiteral<"nodejs">;
2655
+ apiStyle: z.ZodEnum<{
2656
+ rest: "rest";
2657
+ graphql: "graphql";
2658
+ }>;
2659
+ }, z.core.$strip>;
2660
+ actors: z.ZodArray<z.ZodObject<{
2661
+ id: z.ZodString;
2662
+ name: z.ZodString;
2663
+ description: z.ZodString;
2664
+ goals: z.ZodArray<z.ZodString>;
2665
+ }, z.core.$strip>>;
2666
+ flows: z.ZodArray<z.ZodObject<{
2667
+ id: z.ZodString;
2668
+ actorId: z.ZodString;
2669
+ name: z.ZodString;
2670
+ description: z.ZodString;
2671
+ trigger: z.ZodString;
2672
+ outcome: z.ZodString;
2673
+ }, z.core.$strip>>;
2674
+ stories: z.ZodArray<z.ZodObject<{
2675
+ id: z.ZodString;
2676
+ flowId: z.ZodString;
2677
+ actor: z.ZodString;
2678
+ action: z.ZodString;
2679
+ benefit: z.ZodString;
2680
+ preconditions: z.ZodArray<z.ZodString>;
2681
+ postconditions: z.ZodArray<z.ZodString>;
2682
+ dataInvolved: z.ZodArray<z.ZodString>;
2683
+ }, z.core.$strip>>;
2684
+ modules: z.ZodArray<z.ZodObject<{
2685
+ id: z.ZodString;
2686
+ name: z.ZodString;
2687
+ description: z.ZodString;
2688
+ entity: z.ZodString;
2689
+ apis: z.ZodArray<z.ZodObject<{
2690
+ id: z.ZodString;
2691
+ name: z.ZodString;
2692
+ operation: z.ZodEnum<{
2693
+ create: "create";
2694
+ update: "update";
2695
+ delete: "delete";
2696
+ read: "read";
2697
+ readAll: "readAll";
2698
+ }>;
2699
+ description: z.ZodString;
2700
+ inputs: z.ZodArray<z.ZodString>;
2701
+ outputs: z.ZodArray<z.ZodString>;
2702
+ }, z.core.$strip>>;
2703
+ }, z.core.$strip>>;
2704
+ database: z.ZodObject<{
2705
+ type: z.ZodEnum<{
2706
+ mongodb: "mongodb";
2707
+ postgresql: "postgresql";
2708
+ }>;
2709
+ reasoning: z.ZodString;
2710
+ entities: z.ZodArray<z.ZodObject<{
2711
+ name: z.ZodString;
2712
+ description: z.ZodString;
2713
+ fields: z.ZodArray<z.ZodObject<{
2714
+ name: z.ZodString;
2715
+ type: z.ZodString;
2716
+ required: z.ZodBoolean;
2717
+ unique: z.ZodBoolean;
2718
+ description: z.ZodString;
2719
+ default: z.ZodOptional<z.ZodString>;
2720
+ }, z.core.$strip>>;
2721
+ indexes: z.ZodArray<z.ZodObject<{
2722
+ name: z.ZodString;
2723
+ fields: z.ZodArray<z.ZodString>;
2724
+ unique: z.ZodBoolean;
2725
+ }, z.core.$strip>>;
2726
+ relations: z.ZodArray<z.ZodObject<{
2727
+ field: z.ZodString;
2728
+ references: z.ZodString;
2729
+ description: z.ZodString;
2730
+ }, z.core.$strip>>;
2731
+ }, z.core.$strip>>;
2732
+ }, z.core.$strip>;
2733
+ apiDesign: z.ZodObject<{
2734
+ style: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2735
+ rest: "rest";
2736
+ graphql: "graphql";
2737
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2738
+ rest: "rest";
2739
+ graphql: "graphql";
2740
+ }>>;
2741
+ rest: z.ZodOptional<z.ZodObject<{
2742
+ baseUrl: z.ZodDefault<z.ZodString>;
2743
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
2744
+ id: z.ZodString;
2745
+ moduleId: z.ZodString;
2746
+ method: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2747
+ DELETE: "DELETE";
2748
+ GET: "GET";
2749
+ POST: "POST";
2750
+ PUT: "PUT";
2751
+ PATCH: "PATCH";
2752
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2753
+ DELETE: "DELETE";
2754
+ GET: "GET";
2755
+ POST: "POST";
2756
+ PUT: "PUT";
2757
+ PATCH: "PATCH";
2758
+ }>>;
2759
+ path: z.ZodString;
2760
+ description: z.ZodString;
2761
+ auth: z.ZodCoercedBoolean<unknown>;
2762
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2763
+ requestBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2764
+ [k: string]: string;
2765
+ }, Record<string, unknown>>>;
2766
+ responseBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2767
+ [k: string]: string;
2768
+ }, Record<string, unknown>>>;
2769
+ queryParams: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
2770
+ [k: string]: string;
2771
+ }, Record<string, unknown>>>;
2772
+ }, z.core.$strip>>>;
2773
+ }, z.core.$strip>>;
2774
+ graphql: z.ZodOptional<z.ZodObject<{
2775
+ types: z.ZodDefault<z.ZodArray<z.ZodObject<{
2776
+ name: z.ZodString;
2777
+ kind: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
2778
+ input: "input";
2779
+ type: "type";
2780
+ enum: "enum";
2781
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
2782
+ input: "input";
2783
+ type: "type";
2784
+ enum: "enum";
2785
+ }>>;
2786
+ fields: z.ZodArray<z.ZodObject<{
2787
+ name: z.ZodString;
2788
+ type: z.ZodString;
2789
+ description: z.ZodString;
2790
+ }, z.core.$strip>>;
2791
+ }, z.core.$strip>>>;
2792
+ queries: z.ZodDefault<z.ZodArray<z.ZodObject<{
2793
+ name: z.ZodString;
2794
+ moduleId: z.ZodString;
2795
+ description: z.ZodString;
2796
+ auth: z.ZodCoercedBoolean<unknown>;
2797
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2798
+ args: z.ZodArray<z.ZodObject<{
2799
+ name: z.ZodString;
2800
+ type: z.ZodString;
2801
+ required: z.ZodCoercedBoolean<unknown>;
2802
+ }, z.core.$strip>>;
2803
+ returnType: z.ZodString;
2804
+ }, z.core.$strip>>>;
2805
+ mutations: z.ZodDefault<z.ZodArray<z.ZodObject<{
2806
+ name: z.ZodString;
2807
+ moduleId: z.ZodString;
2808
+ description: z.ZodString;
2809
+ auth: z.ZodCoercedBoolean<unknown>;
2810
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
2811
+ args: z.ZodArray<z.ZodObject<{
2812
+ name: z.ZodString;
2813
+ type: z.ZodString;
2814
+ required: z.ZodCoercedBoolean<unknown>;
2815
+ }, z.core.$strip>>;
2816
+ returnType: z.ZodString;
2817
+ }, z.core.$strip>>>;
2818
+ }, z.core.$strip>>;
2819
+ }, z.core.$strip>;
2820
+ summary: z.ZodObject<{
2821
+ totalActors: z.ZodNumber;
2822
+ totalFlows: z.ZodNumber;
2823
+ totalStories: z.ZodNumber;
2824
+ totalModules: z.ZodNumber;
2825
+ totalEntities: z.ZodNumber;
2826
+ totalEndpoints: z.ZodNumber;
2827
+ overview: z.ZodString;
2828
+ }, z.core.$strip>;
2829
+ }, z.core.$strip>;
2830
+ type RequirementSummary$1 = z.infer<typeof requirementSummarySchema>;
2831
+
2832
+ /**
2833
+ * Zod schema for extract_actors tool output
2834
+ */
2835
+
2836
+ declare const actorSchema: z.ZodObject<{
2837
+ id: z.ZodString;
2838
+ name: z.ZodString;
2839
+ description: z.ZodString;
2840
+ goals: z.ZodArray<z.ZodString>;
2841
+ }, z.core.$strip>;
2842
+ declare const actorsResultSchema: z.ZodObject<{
2843
+ actors: z.ZodArray<z.ZodObject<{
2844
+ id: z.ZodString;
2845
+ name: z.ZodString;
2846
+ description: z.ZodString;
2847
+ goals: z.ZodArray<z.ZodString>;
2848
+ }, z.core.$strip>>;
2849
+ message: z.ZodString;
2850
+ }, z.core.$strip>;
2851
+ type ActorResult = z.infer<typeof actorsResultSchema>;
2852
+
2853
+ /**
2854
+ * Zod schema for generate_flows tool output
2855
+ */
2856
+
2857
+ declare const flowSchema: z.ZodObject<{
2858
+ id: z.ZodString;
2859
+ actorId: z.ZodString;
2860
+ name: z.ZodString;
2861
+ description: z.ZodString;
2862
+ trigger: z.ZodString;
2863
+ outcome: z.ZodString;
2864
+ }, z.core.$strip>;
2865
+ declare const flowsResultSchema: z.ZodObject<{
2866
+ flows: z.ZodArray<z.ZodObject<{
2867
+ id: z.ZodString;
2868
+ actorId: z.ZodString;
2869
+ name: z.ZodString;
2870
+ description: z.ZodString;
2871
+ trigger: z.ZodString;
2872
+ outcome: z.ZodString;
2873
+ }, z.core.$strip>>;
2874
+ message: z.ZodString;
2875
+ }, z.core.$strip>;
2876
+ type FlowsResult = z.infer<typeof flowsResultSchema>;
2877
+
2878
+ /**
2879
+ * Zod schema for generate_stories tool output
2880
+ */
2881
+
2882
+ declare const storySchema: z.ZodObject<{
2883
+ id: z.ZodString;
2884
+ flowId: z.ZodString;
2885
+ actor: z.ZodString;
2886
+ action: z.ZodString;
2887
+ benefit: z.ZodString;
2888
+ preconditions: z.ZodArray<z.ZodString>;
2889
+ postconditions: z.ZodArray<z.ZodString>;
2890
+ dataInvolved: z.ZodArray<z.ZodString>;
2891
+ }, z.core.$strip>;
2892
+ declare const storiesResultSchema: z.ZodObject<{
2893
+ stories: z.ZodArray<z.ZodObject<{
2894
+ id: z.ZodString;
2895
+ flowId: z.ZodString;
2896
+ actor: z.ZodString;
2897
+ action: z.ZodString;
2898
+ benefit: z.ZodString;
2899
+ preconditions: z.ZodArray<z.ZodString>;
2900
+ postconditions: z.ZodArray<z.ZodString>;
2901
+ dataInvolved: z.ZodArray<z.ZodString>;
2902
+ }, z.core.$strip>>;
2903
+ message: z.ZodString;
2904
+ }, z.core.$strip>;
2905
+ type StoriesResult = z.infer<typeof storiesResultSchema>;
2906
+
2907
+ /**
2908
+ * Zod schema for extract_modules tool output
2909
+ */
2910
+
2911
+ declare const crudApiSchema: z.ZodObject<{
2912
+ id: z.ZodString;
2913
+ name: z.ZodString;
2914
+ operation: z.ZodEnum<{
2915
+ create: "create";
2916
+ update: "update";
2917
+ delete: "delete";
2918
+ read: "read";
2919
+ readAll: "readAll";
2920
+ }>;
2921
+ description: z.ZodString;
2922
+ inputs: z.ZodArray<z.ZodString>;
2923
+ outputs: z.ZodArray<z.ZodString>;
2924
+ }, z.core.$strip>;
2925
+ declare const extractedModuleSchema: z.ZodObject<{
2926
+ id: z.ZodString;
2927
+ name: z.ZodString;
2928
+ description: z.ZodString;
2929
+ entity: z.ZodString;
2930
+ apis: z.ZodArray<z.ZodObject<{
2931
+ id: z.ZodString;
2932
+ name: z.ZodString;
2933
+ operation: z.ZodEnum<{
2934
+ create: "create";
2935
+ update: "update";
2936
+ delete: "delete";
2937
+ read: "read";
2938
+ readAll: "readAll";
2939
+ }>;
2940
+ description: z.ZodString;
2941
+ inputs: z.ZodArray<z.ZodString>;
2942
+ outputs: z.ZodArray<z.ZodString>;
2943
+ }, z.core.$strip>>;
2944
+ }, z.core.$strip>;
2945
+ declare const modulesResultSchema: z.ZodObject<{
2946
+ modules: z.ZodArray<z.ZodObject<{
2947
+ id: z.ZodString;
2948
+ name: z.ZodString;
2949
+ description: z.ZodString;
2950
+ entity: z.ZodString;
2951
+ apis: z.ZodArray<z.ZodObject<{
2952
+ id: z.ZodString;
2953
+ name: z.ZodString;
2954
+ operation: z.ZodEnum<{
2955
+ create: "create";
2956
+ update: "update";
2957
+ delete: "delete";
2958
+ read: "read";
2959
+ readAll: "readAll";
2960
+ }>;
2961
+ description: z.ZodString;
2962
+ inputs: z.ZodArray<z.ZodString>;
2963
+ outputs: z.ZodArray<z.ZodString>;
2964
+ }, z.core.$strip>>;
2965
+ }, z.core.$strip>>;
2966
+ summary: z.ZodObject<{
2967
+ totalModules: z.ZodNumber;
2968
+ totalApis: z.ZodNumber;
2969
+ }, z.core.$strip>;
2970
+ message: z.ZodString;
2971
+ }, z.core.$strip>;
2972
+ type ModulesResult = z.infer<typeof modulesResultSchema>;
2973
+
2974
+ /**
2975
+ * requirement-gatherer module types
2976
+ * Chat-based 4-stage flow: discovery -> requirements -> design -> complete
2977
+ */
2978
+
2979
+ /** Stage in the requirement gathering flow */
2980
+ type Stage$1 = 'discovery' | 'requirements' | 'design' | 'complete';
2981
+ /** Project brief from discovery (name, goal, api style, backend runtime) */
2982
+ interface ProjectBrief {
2983
+ name: string;
2984
+ goal: string;
2985
+ features: string[];
2986
+ domain: string;
2987
+ database: 'mongodb' | 'postgresql';
2988
+ backendRuntime: 'nodejs';
2989
+ apiStyle: 'rest' | 'graphql';
2990
+ }
2991
+ /** Clarifying question for the user */
2992
+ interface Question {
2993
+ id: string;
2994
+ question: string;
2995
+ context: string;
2996
+ suggestions: string[];
2997
+ multiSelect: boolean;
2998
+ required: boolean;
2999
+ }
3000
+ /** Single chat message entry */
3001
+ interface ChatEntry$1 {
3002
+ role: 'user' | 'assistant';
3003
+ content: string;
3004
+ }
3005
+ /** Actor (user type) from requirements stage */
3006
+ interface Actor {
3007
+ id: string;
3008
+ name: string;
3009
+ description: string;
3010
+ goals: string[];
3011
+ }
3012
+ /** Flow (user journey) from requirements stage */
3013
+ interface Flow {
3014
+ id: string;
3015
+ actorId: string;
3016
+ name: string;
3017
+ description: string;
3018
+ trigger: string;
3019
+ outcome: string;
3020
+ }
3021
+ /** User story with data involved */
3022
+ interface Story {
3023
+ id: string;
3024
+ flowId: string;
3025
+ actor: string;
3026
+ action: string;
3027
+ benefit: string;
3028
+ preconditions: string[];
3029
+ postconditions: string[];
3030
+ dataInvolved: string[];
3031
+ }
3032
+ /** Module with CRUD APIs from requirements stage */
3033
+ interface CrudApi {
3034
+ id: string;
3035
+ name: string;
3036
+ operation: 'create' | 'read' | 'readAll' | 'update' | 'delete';
3037
+ description: string;
3038
+ inputs: string[];
3039
+ outputs: string[];
3040
+ }
3041
+ interface Module {
3042
+ id: string;
3043
+ name: string;
3044
+ description: string;
3045
+ entity: string;
3046
+ apis: CrudApi[];
3047
+ }
3048
+ /** Database design: MongoDB or PostgreSQL with entities */
3049
+ interface EntityField$1 {
3050
+ name: string;
3051
+ type: string;
3052
+ required: boolean;
3053
+ unique: boolean;
3054
+ description: string;
3055
+ default?: string;
3056
+ }
3057
+ interface EntityIndex$1 {
3058
+ name: string;
3059
+ fields: string[];
3060
+ unique: boolean;
3061
+ }
3062
+ interface EntityRelation$1 {
3063
+ field: string;
3064
+ references: string;
3065
+ description: string;
3066
+ }
3067
+ interface DatabaseEntity {
3068
+ name: string;
3069
+ description: string;
3070
+ fields: EntityField$1[];
3071
+ indexes: EntityIndex$1[];
3072
+ relations: EntityRelation$1[];
3073
+ }
3074
+ interface DatabaseDesign {
3075
+ type: 'mongodb' | 'postgresql';
3076
+ reasoning: string;
3077
+ entities: DatabaseEntity[];
3078
+ }
3079
+ /** REST API design */
3080
+ interface RestEndpoint$1 {
3081
+ id: string;
3082
+ moduleId: string;
3083
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
3084
+ path: string;
3085
+ description: string;
3086
+ auth: boolean;
3087
+ roles: string[];
3088
+ requestBody?: Record<string, string>;
3089
+ responseBody?: Record<string, string>;
3090
+ queryParams?: Record<string, string>;
3091
+ }
3092
+ interface RestApiDesign {
3093
+ baseUrl: string;
3094
+ endpoints: RestEndpoint$1[];
3095
+ }
3096
+ /** GraphQL API design */
3097
+ interface GraphqlTypeDefinition {
3098
+ name: string;
3099
+ kind: 'type' | 'input' | 'enum';
3100
+ fields: {
3101
+ name: string;
3102
+ type: string;
3103
+ description: string;
3104
+ }[];
3105
+ }
3106
+ interface GraphqlOperation$1 {
3107
+ name: string;
3108
+ moduleId: string;
3109
+ description: string;
3110
+ auth: boolean;
3111
+ roles: string[];
3112
+ args: {
3113
+ name: string;
3114
+ type: string;
3115
+ required: boolean;
3116
+ }[];
3117
+ returnType: string;
3118
+ }
3119
+ interface GraphqlApiDesign {
3120
+ types: GraphqlTypeDefinition[];
3121
+ queries: GraphqlOperation$1[];
3122
+ mutations: GraphqlOperation$1[];
3123
+ }
3124
+ /** Combined API design: REST and/or GraphQL */
3125
+ interface ApiDesign$1 {
3126
+ style: 'rest' | 'graphql';
3127
+ rest?: RestApiDesign;
3128
+ graphql?: GraphqlApiDesign;
3129
+ }
3130
+ /** Summary for final requirement document */
3131
+ interface RequirementSummary {
3132
+ totalActors: number;
3133
+ totalFlows: number;
3134
+ totalStories: number;
3135
+ totalModules: number;
3136
+ totalEntities: number;
3137
+ totalEndpoints: number;
3138
+ overview: string;
3139
+ }
3140
+ /** Final requirement document output */
3141
+ interface FinalRequirement {
3142
+ project: ProjectBrief;
3143
+ actors: Actor[];
3144
+ flows: Flow[];
3145
+ stories: Story[];
3146
+ modules: Module[];
3147
+ database: DatabaseDesign;
3148
+ apiDesign: ApiDesign$1;
3149
+ summary: RequirementSummary;
3150
+ }
3151
+ /** Accumulated context across chat turns */
3152
+ interface RequirementContext {
3153
+ stage: Stage$1;
3154
+ projectBrief: ProjectBrief | null;
3155
+ actors: Actor[];
3156
+ flows: Flow[];
3157
+ stories: Story[];
3158
+ modules: Module[];
3159
+ database: DatabaseDesign | null;
3160
+ apiDesign: ApiDesign$1 | null;
3161
+ history: ChatEntry$1[];
3162
+ pendingQuestions: Question[];
3163
+ }
3164
+ /** Result of a single chat turn */
3165
+ interface ChatTurnResult {
3166
+ message: string;
3167
+ context: RequirementContext;
3168
+ questions: Question[];
3169
+ finalRequirement: FinalRequirement | null;
3170
+ }
3171
+ /** Config for processRequirementChat */
3172
+ interface RequirementChatConfig {
3173
+ model?: ModelConfig;
3174
+ maxIterations?: number;
3175
+ onStep?: (step: AgentStep) => void;
3176
+ logger?: Logger;
3177
+ }
3178
+ /** Result of a stage processor */
3179
+ interface StageResult {
3180
+ message: string;
3181
+ questions?: Question[];
3182
+ advance: boolean;
3183
+ data: Partial<RequirementContext> & {
3184
+ finalRequirement?: FinalRequirement;
3185
+ };
3186
+ }
3187
+ /** Legacy alias for Module (backward compatibility) */
3188
+ type ExtractedModule = Module;
3189
+ /** Legacy: minimal project info (backward compatibility) */
3190
+ interface BasicProjectInfo {
3191
+ name: string;
3192
+ goal: string;
3193
+ features: string;
3194
+ }
3195
+ /** Legacy: runRequirementGathererAgent config (one-shot wrapper) */
3196
+ interface RequirementGathererAgentConfig {
3197
+ input: string;
3198
+ model?: ModelConfig;
3199
+ maxIterations?: number;
3200
+ onStep?: (step: AgentStep) => void;
3201
+ logger?: Logger;
3202
+ }
3203
+
3204
+ /**
3205
+ * System prompt for chat-based requirement gathering
3206
+ */
3207
+ declare const REQUIREMENT_GATHERER_SYSTEM_PROMPT = "You are a senior fullstack developer helping scope and plan a project. Your role is to understand what the user wants to build and produce a clear, actionable requirement document.\n\nYou work in stages: discovery (understand the project and tech preferences), requirements (actors, flows, stories, modules), design (database + APIs), and complete (final document).\n\nThink about the project the way a developer would: core problem, user interactions, data model, auth, integrations, real-time needs. Do NOT ask generic template questions (e.g. scale, complexity level, \"how many users?\"). Ask only questions that directly unblock design decisions.\n\nGuidelines:\n- For tech choices (API style: REST vs GraphQL; database: MongoDB vs PostgreSQL), offer predefined options and ask what the user is comfortable with.\n- For everything else, ask open-ended, context-specific questions based on what the user described. Leave suggestions empty for those.\n- Never repeat a question already answered in the conversation history.\n- When the user says \"continue\", \"yes\", \"looks good\", or similar, treat it as confirmation and advance.\n- Return valid JSON only when the prompt asks for JSON (no markdown code fences unless specified).\n- Backend is Node.js only; database is MongoDB or PostgreSQL per user preference.";
3208
+
3209
+ /**
3210
+ * Discovery stage prompt - understand project and optionally ask questions
3211
+ */
3212
+ declare const DISCOVERY_SYSTEM_FRAGMENT = "You are in the discovery stage. Parse the user's message (and prior context) into a structured project brief. Ask clarifying questions only when something genuinely blocks design decisions.\n\nDetermine from the user's words:\n- Project name and goal\n- Key features (array of strings)\n- Domain (e.g. e-commerce, healthcare, saas)\n- API style: \"rest\" | \"graphql\" \u2014 infer from context or ask with predefined options\n- Database: \"mongodb\" | \"postgresql\" \u2014 ask which they are comfortable with, with predefined options\n- Backend is always \"nodejs\"\n\nQuestion rules:\n- Tech stack (API style, database): Always provide \"suggestions\" with predefined options (e.g. [\"REST\", \"GraphQL\"], [\"MongoDB\", \"PostgreSQL\"]). Frame as \"which are you comfortable with?\"\n- All other questions: Use \"suggestions\": []. Ask open-ended, specific to what the user described (e.g. file uploads, real-time features, auth provider, core user action).\n- Never ask: scale, \"how many users?\", \"what's the complexity?\", or generic intake-form questions.\n- Before asking, check conversation history \u2014 never repeat something already answered.\n- If the user's message is clear enough (e.g. \"Instagram clone with photo sharing, messaging, stories\"), infer the obvious and ask only about genuine gaps. If you have enough for the brief, set needsClarification to false and empty questions.";
3213
+ declare const DISCOVERY_USER_PROMPT = "## Current user message:\n{userMessage}\n\n## Prior conversation (if any):\n{history}\n\nAnalyze the message and prior context. If you have enough to fill the project brief, return it and set needsClarification to false. Otherwise ask 1-3 short, problem-focused questions.\n\nReturn ONLY valid JSON (no markdown, no explanation) in this shape:\n{\n \"needsClarification\": boolean,\n \"questions\": [\n {\n \"id\": \"q1\",\n \"question\": \"Question text\",\n \"context\": \"Why this helps\",\n \"suggestions\": [],\n \"multiSelect\": false,\n \"required\": true\n }\n ],\n \"conversationalMessage\": \"Brief friendly message to the user\",\n \"projectBrief\": {\n \"name\": \"string\",\n \"goal\": \"string\",\n \"features\": [\"string\"],\n \"domain\": \"string\",\n \"database\": \"mongodb\" | \"postgresql\",\n \"backendRuntime\": \"nodejs\",\n \"apiStyle\": \"rest\" | \"graphql\"\n }\n}\n\nFor tech choices (API style, database), populate \"suggestions\" with the predefined options. For all other questions, use \"suggestions\": [].\nIf needsClarification is true, projectBrief can have empty/default values. If false, projectBrief must be complete.";
3214
+ declare function buildDiscoveryPrompt(userMessage: string, history: string): string;
3215
+
3216
+ /**
3217
+ * Requirements stage prompts - actors, flows, stories, modules (chained)
3218
+ */
3219
+ declare const EXTRACT_ACTORS_PROMPT = "## Project:\n- **Name**: {projectName}\n- **Goal**: {projectGoal}\n- **Features**: {projectFeatures}\n\nIdentify ALL distinct user types (actors) who will use this system. 2-5 actors. Include unauthenticated and admin roles if applicable.\n\nReturn ONLY valid JSON:\n{\n \"actors\": [\n { \"id\": \"actor-1\", \"name\": \"Name\", \"description\": \"Who they are\", \"goals\": [\"goal1\", \"goal2\"] }\n ],\n \"message\": \"Brief explanation\"\n}";
3220
+ declare const GENERATE_FLOWS_PROMPT = "## Project:\n- **Name**: {projectName}\n- **Goal**: {projectGoal}\n- **Features**: {projectFeatures}\n\n## Actors (JSON):\n{actors}\n\nFor EACH actor, identify 2-5 key user journeys (flows). Each flow: id, actorId, name, description, trigger, outcome.\n\nReturn ONLY valid JSON:\n{\n \"flows\": [\n { \"id\": \"flow-1\", \"actorId\": \"actor-1\", \"name\": \"Flow Name\", \"description\": \"...\", \"trigger\": \"...\", \"outcome\": \"...\" }\n ],\n \"message\": \"Brief explanation\"\n}";
3221
+ declare const GENERATE_STORIES_PROMPT = "## Project:\n- **Name**: {projectName}\n- **Goal**: {projectGoal}\n- **Features**: {projectFeatures}\n\n## Actors: {actors}\n\n## Flows (JSON):\n{flows}\n\nFor EACH flow, generate 2-5 user stories. Each story MUST include dataInvolved (entity.field names) for DB design. Include preconditions, postconditions.\n\nReturn ONLY valid JSON:\n{\n \"stories\": [\n { \"id\": \"story-1\", \"flowId\": \"flow-1\", \"actor\": \"ActorName\", \"action\": \"...\", \"benefit\": \"...\", \"preconditions\": [], \"postconditions\": [], \"dataInvolved\": [\"User.email\", \"Order.total\"] }\n ],\n \"message\": \"Brief explanation\"\n}";
3222
+ declare const EXTRACT_MODULES_PROMPT = "## Project:\n- **Name**: {projectName}\n- **Goal**: {projectGoal}\n- **Features**: {projectFeatures}\n\n## Actors: {actors}\n## Flows: {flows}\n## Stories (JSON):\n{stories}\n\nExtract modules (one per major entity). Each module has apis: create, read, readAll, update, delete plus any extra (e.g. searchUsers). CamelCase names. Clear inputs/outputs.\n\nReturn ONLY valid JSON:\n{\n \"modules\": [\n { \"id\": \"module-1\", \"name\": \"User\", \"description\": \"...\", \"entity\": \"User\", \"apis\": [ { \"id\": \"api-1-1\", \"name\": \"createUser\", \"operation\": \"create\", \"description\": \"...\", \"inputs\": [], \"outputs\": [] } ] }\n ],\n \"summary\": { \"totalModules\": 0, \"totalApis\": 0 },\n \"message\": \"Brief explanation\"\n}";
3223
+ declare function buildExtractActorsPrompt(projectName: string, projectGoal: string, projectFeatures: string): string;
3224
+ declare function buildGenerateFlowsPrompt(projectName: string, projectGoal: string, projectFeatures: string, actorsJson: string): string;
3225
+ declare function buildGenerateStoriesPrompt(projectName: string, projectGoal: string, projectFeatures: string, actorsJson: string, flowsJson: string): string;
3226
+ declare function buildExtractModulesPrompt(projectName: string, projectGoal: string, projectFeatures: string, actorsJson: string, flowsJson: string, storiesJson: string): string;
3227
+
3228
+ /**
3229
+ * Design stage prompts - direct LLM invocation for database and API design
3230
+ */
3231
+ declare const DESIGN_DATABASE_SYSTEM_PROMPT = "You output only valid JSON. No markdown, no explanation.";
3232
+ declare const DESIGN_APIS_SYSTEM_PROMPT = "You output only valid JSON. No markdown, no explanation.";
3233
+ declare function buildDesignDatabasePrompt(projectBrief: string, modules: string, stories: string): string;
3234
+ declare function buildDesignApisPrompt(projectBrief: string, modules: string, actors: string, stories: string, database: string): string;
3235
+
3236
+ /**
3237
+ * Synthesis stage prompt - compile FinalRequirement document
3238
+ */
3239
+ declare const SYNTHESIS_SYSTEM_FRAGMENT = "You are in the complete stage. You have the full context: project brief, actors, flows, stories, modules, database design, and API design. Your job is to produce a single final requirement document (JSON) that matches the FinalRequirement schema, with a summary that includes totalActors, totalFlows, totalStories, totalModules, totalEntities, totalEndpoints, and a short overview paragraph.";
3240
+ declare const SYNTHESIS_USER_PROMPT = "## Project brief (JSON):\n{projectBrief}\n\n## Actors (JSON):\n{actors}\n\n## Flows (JSON):\n{flows}\n\n## Stories (JSON):\n{stories}\n\n## Modules (JSON):\n{modules}\n\n## Database design (JSON):\n{database}\n\n## API design (JSON):\n{apiDesign}\n\nCompile the above into one FinalRequirement JSON. Include a \"summary\" object with: totalActors, totalFlows, totalStories, totalModules, totalEntities (from database.entities.length), totalEndpoints (count of REST endpoints or GraphQL queries+mutations as appropriate), and \"overview\" (2-4 sentence paragraph summarizing the project and tech choices).\n\nReturn ONLY valid JSON in this shape (no markdown, no extra text):\n{\n \"project\": { ... },\n \"actors\": [ ... ],\n \"flows\": [ ... ],\n \"stories\": [ ... ],\n \"modules\": [ ... ],\n \"database\": { ... },\n \"apiDesign\": { ... },\n \"summary\": {\n \"totalActors\": 0,\n \"totalFlows\": 0,\n \"totalStories\": 0,\n \"totalModules\": 0,\n \"totalEntities\": 0,\n \"totalEndpoints\": 0,\n \"overview\": \"string\"\n }\n}";
3241
+ declare function buildSynthesisPrompt(projectBrief: string, actors: string, flows: string, stories: string, modules: string, database: string, apiDesign: string): string;
3242
+
3243
+ /**
3244
+ * runRequirementGathererAgent - one-shot wrapper around processRequirementChat
3245
+ * Runs the full chat flow non-interactively, auto-advancing with "continue" when questions are asked.
3246
+ */
3247
+
3248
+ /**
3249
+ * Run the requirement gatherer in one-shot mode: single input, auto-advance through stages,
3250
+ * return final requirement document or last message as AgentResult.
3251
+ */
3252
+ declare function runRequirementGathererAgent(config: RequirementGathererAgentConfig): Promise<AgentResult>;
3253
+
3254
+ /**
3255
+ * processRequirementChat - main entry point for chat-based requirement gathering
3256
+ */
3257
+
3258
+ declare function processRequirementChat(userMessage: string, context: RequirementContext | null, config: RequirementChatConfig): Promise<ChatTurnResult>;
3259
+
3260
+ /**
3261
+ * Builder for RequirementContext - fluent API, max 150 lines.
3262
+ */
3263
+
3264
+ declare class RequirementContextBuilder {
3265
+ private data;
3266
+ withStage(stage: Stage$1): this;
3267
+ withProjectBrief(projectBrief: ProjectBrief | null): this;
3268
+ withActors(actors: Actor[]): this;
3269
+ withFlows(flows: Flow[]): this;
3270
+ withStories(stories: Story[]): this;
3271
+ withModules(modules: Module[]): this;
3272
+ withDatabase(database: DatabaseDesign | null): this;
3273
+ withApiDesign(apiDesign: ApiDesign$1 | null): this;
3274
+ withHistory(history: ChatEntry$1[]): this;
3275
+ withPendingQuestions(pendingQuestions: Question[]): this;
3276
+ reset(): this;
3277
+ build(): RequirementContext;
3278
+ }
3279
+ declare function createRequirementContextBuilder(): RequirementContextBuilder;
3280
+
3281
+ /**
3282
+ * Context management for requirement chat
3283
+ */
3284
+
3285
+ declare function createInitialContext(): RequirementContext;
3286
+ declare function mergeStageResult(context: RequirementContext, result: StageResult): RequirementContext;
3287
+ declare function addChatEntry(context: RequirementContext, role: 'user' | 'assistant', content: string): RequirementContext;
3288
+ declare function advanceStage(context: RequirementContext): RequirementContext;
3289
+
3290
+ /**
3291
+ * planning module types
3292
+ * Chat-based 4-stage flow: discovery -> requirements -> design -> complete
3293
+ * All LLM output is raw markdown strings; no JSON parsing or schema validation.
3294
+ */
3295
+
3296
+ /** Stage in the planning flow */
3297
+ type Stage = 'discovery' | 'requirements' | 'design' | 'complete';
3298
+ /** Accumulated markdown sections -- each is a raw string from an LLM call */
3299
+ interface PlanSections {
3300
+ overview: string | null;
3301
+ techStack: string | null;
3302
+ featureDecisions: string | null;
3303
+ dataModels: string | null;
3304
+ pagesAndRoutes: string | null;
3305
+ authFlow: string | null;
3306
+ apiRoutes: string | null;
3307
+ implementation: string | null;
3308
+ executionPlan: string | null;
3309
+ edgeCases: string | null;
3310
+ testingChecklist: string | null;
3311
+ }
3312
+ /** Single chat message entry */
3313
+ interface ChatEntry {
3314
+ role: 'user' | 'assistant';
3315
+ content: string;
3316
+ }
3317
+ /** Accumulated context across chat turns */
3318
+ interface PlanningContext {
3319
+ stage: Stage;
3320
+ projectDescription: string | null;
3321
+ sections: PlanSections;
3322
+ history: ChatEntry[];
3323
+ pendingQuestions: string[];
3324
+ }
3325
+ /** Result of a single chat turn */
3326
+ interface PlanChatTurnResult {
3327
+ message: string;
3328
+ context: PlanningContext;
3329
+ pendingQuestions: string[];
3330
+ planMarkdown: string | null;
3331
+ }
3332
+ /** Config for processPlanningChat */
3333
+ interface PlanningChatConfig {
3334
+ model?: ModelConfig;
3335
+ maxIterations?: number;
3336
+ onStep?: (step: AgentStep) => void;
3337
+ logger?: Logger;
3338
+ }
3339
+ /** Result of a stage processor */
3340
+ interface PlanStageResult {
3341
+ message: string;
3342
+ advance: boolean;
3343
+ sections: Partial<PlanSections>;
3344
+ projectDescription?: string | null;
3345
+ pendingQuestions?: string[];
3346
+ /** Set by synthesis stage when plan is complete */
3347
+ planMarkdown?: string;
3348
+ }
3349
+ /** Input passed to stage process() */
3350
+ interface StageInput {
3351
+ userMessage: string;
3352
+ model: Model;
3353
+ logger?: Logger;
3354
+ }
3355
+ /** Config for runPlanningAgent (one-shot wrapper) */
3356
+ interface PlanningAgentConfig {
3357
+ input: string;
3358
+ model?: ModelConfig;
3359
+ maxIterations?: number;
3360
+ onStep?: (step: AgentStep) => void;
3361
+ logger?: Logger;
3362
+ }
3363
+ /** Config for editPlan (edit existing plan with feedback) */
3364
+ interface EditPlanConfig {
3365
+ /** Current plan.md content */
3366
+ existingPlan: string;
3367
+ /** Edit instructions or additional context */
3368
+ feedback: string;
3369
+ model?: ModelConfig;
3370
+ logger?: Logger;
3371
+ }
3372
+
3373
+ /**
3374
+ * runPlanningAgent - one-shot wrapper around processPlanningChat
3375
+ * Auto-advances with "continue"; returns plan markdown. Does not write to file.
3376
+ */
3377
+
3378
+ /**
3379
+ * Run the planning agent in one-shot mode: single input, auto-advance through stages,
3380
+ * return plan markdown as AgentResult. Does not write to file.
3381
+ */
3382
+ declare function runPlanningAgent(config: PlanningAgentConfig): Promise<AgentResult>;
3383
+
3384
+ /**
3385
+ * editPlan - single LLM call to revise an existing plan based on feedback.
3386
+ * Takes existing plan markdown + edit instructions, returns updated markdown.
3387
+ */
3388
+
3389
+ /**
3390
+ * Edit an existing plan based on feedback or additional context.
3391
+ * Single focused LLM call -- no multi-stage pipeline needed.
3392
+ * Returns the full revised plan as a markdown string.
3393
+ */
3394
+ declare function editPlan(config: EditPlanConfig): Promise<string>;
3395
+
3396
+ /**
3397
+ * processPlanningChat - main entry point for chat-based planning
3398
+ */
3399
+
3400
+ declare function processPlanningChat(userMessage: string, context: PlanningContext | null, config: PlanningChatConfig): Promise<PlanChatTurnResult>;
3401
+
3402
+ /**
3403
+ * Builder for PlanningContext - fluent API
3404
+ */
3405
+
3406
+ declare class PlanningContextBuilder {
3407
+ private data;
3408
+ withStage(stage: Stage): this;
3409
+ withProjectDescription(projectDescription: string | null): this;
3410
+ withSections(sections: Partial<PlanSections>): this;
3411
+ withHistory(history: ChatEntry[]): this;
3412
+ withPendingQuestions(pendingQuestions: string[]): this;
3413
+ reset(): this;
3414
+ build(): PlanningContext;
3415
+ }
3416
+ declare function createPlanningContextBuilder(): PlanningContextBuilder;
3417
+
3418
+ /**
3419
+ * Assemble plan sections into markdown and write to file
3420
+ */
3421
+
3422
+ declare function assemblePlan(projectName: string, sections: PlanSections): string;
3423
+ declare function writePlanToFile(markdown: string, outputPath: string): Promise<void>;
3424
+
3425
+ /**
3426
+ * System prompt for planning module - markdown-only, pro-level output
3427
+ */
3428
+ declare const PLANNING_SYSTEM_PROMPT = "You are a senior software architect creating a single, implementation-ready plan that a developer can follow without ambiguity.\n\nCRITICAL RULES:\n- Output ONLY raw markdown text. Use code blocks ONLY for: request/response JSON examples, file/directory trees, and env or config snippets. No JSON or structured data outside those code blocks.\n- Use consistent structure: ## for main sections, ### for subsections, #### for per-item headings (e.g. per route, per endpoint). Use **bold** for labels (e.g. **Purpose**, **Request Body**, **Response on Success**).\n- Be concrete and actionable: include validation rules, HTTP status codes, redirects, field-level data model descriptions, and step-by-step auth flows. Every section should give enough detail to implement from the plan alone.";
3429
+
3430
+ /**
3431
+ * Zod schemas for DataModelDesign
3432
+ */
3433
+
3434
+ declare const dataEntitySchema: z.ZodObject<{
3435
+ name: z.ZodString;
3436
+ description: z.ZodDefault<z.ZodString>;
3437
+ fields: z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
3438
+ name: z.ZodString;
3439
+ type: z.ZodString;
3440
+ required: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
3441
+ unique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
3442
+ description: z.ZodDefault<z.ZodString>;
3443
+ default: z.ZodOptional<z.ZodString>;
3444
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, z.ZodTransform<{
3445
+ name: string;
3446
+ type: string;
3447
+ required: boolean;
3448
+ unique: boolean;
3449
+ description: string;
3450
+ default?: string | undefined;
3451
+ }[], Record<string, unknown> | {
3452
+ name: string;
3453
+ type: string;
3454
+ required: boolean;
3455
+ unique: boolean;
3456
+ description: string;
3457
+ default?: string | undefined;
3458
+ }[]>>;
3459
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
3460
+ name: z.ZodDefault<z.ZodString>;
3461
+ fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
3462
+ unique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
3463
+ }, z.core.$strip>>>;
3464
+ relations: z.ZodDefault<z.ZodArray<z.ZodObject<{
3465
+ field: z.ZodString;
3466
+ references: z.ZodString;
3467
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
3468
+ "1:1": "1:1";
3469
+ "1:N": "1:N";
3470
+ "M:N": "M:N";
3471
+ }>>;
3472
+ description: z.ZodDefault<z.ZodString>;
3473
+ }, z.core.$strip>>>;
3474
+ }, z.core.$strip>;
3475
+ declare const dataModelDesignSchema: z.ZodObject<{
3476
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
3477
+ mongodb: "mongodb";
3478
+ postgresql: "postgresql";
3479
+ }>>;
3480
+ reasoning: z.ZodDefault<z.ZodString>;
3481
+ entities: z.ZodDefault<z.ZodArray<z.ZodObject<{
3482
+ name: z.ZodString;
3483
+ description: z.ZodDefault<z.ZodString>;
3484
+ fields: z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
3485
+ name: z.ZodString;
3486
+ type: z.ZodString;
3487
+ required: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
3488
+ unique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
3489
+ description: z.ZodDefault<z.ZodString>;
3490
+ default: z.ZodOptional<z.ZodString>;
3491
+ }, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, z.ZodTransform<{
3492
+ name: string;
3493
+ type: string;
3494
+ required: boolean;
3495
+ unique: boolean;
3496
+ description: string;
3497
+ default?: string | undefined;
3498
+ }[], Record<string, unknown> | {
3499
+ name: string;
3500
+ type: string;
3501
+ required: boolean;
3502
+ unique: boolean;
3503
+ description: string;
3504
+ default?: string | undefined;
3505
+ }[]>>;
3506
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
3507
+ name: z.ZodDefault<z.ZodString>;
3508
+ fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
3509
+ unique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
3510
+ }, z.core.$strip>>>;
3511
+ relations: z.ZodDefault<z.ZodArray<z.ZodObject<{
3512
+ field: z.ZodString;
3513
+ references: z.ZodString;
3514
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
3515
+ "1:1": "1:1";
3516
+ "1:N": "1:N";
3517
+ "M:N": "M:N";
3518
+ }>>;
3519
+ description: z.ZodDefault<z.ZodString>;
3520
+ }, z.core.$strip>>>;
3521
+ }, z.core.$strip>>>;
3522
+ }, z.core.$strip>;
3523
+ type TDataModelDesign = z.infer<typeof dataModelDesignSchema>;
3524
+
3525
+ /**
3526
+ * data-modeler module types
3527
+ */
3528
+
3529
+ type DatabaseType = 'mongodb' | 'postgresql';
3530
+ interface EntityField {
3531
+ name: string;
3532
+ type: string;
3533
+ required: boolean;
3534
+ unique: boolean;
3535
+ description: string;
3536
+ default?: string;
3537
+ }
3538
+ interface EntityIndex {
3539
+ name: string;
3540
+ fields: string[];
3541
+ unique: boolean;
3542
+ }
3543
+ interface EntityRelation {
3544
+ field: string;
3545
+ references: string;
3546
+ type: '1:1' | '1:N' | 'M:N';
3547
+ description: string;
3548
+ }
3549
+ interface DataEntity {
3550
+ name: string;
3551
+ description: string;
3552
+ fields: EntityField[];
3553
+ indexes: EntityIndex[];
3554
+ relations: EntityRelation[];
3555
+ }
3556
+ interface DataModelDesign {
3557
+ type: DatabaseType;
3558
+ reasoning: string;
3559
+ entities: DataEntity[];
3560
+ }
3561
+ interface DataModelerAgentConfig {
3562
+ /** User input: natural language description of data modeling needs */
3563
+ input: string;
3564
+ /** Model config; defaults to gpt-4o-mini */
3565
+ model?: ModelConfig;
3566
+ /** Max iterations; default 15 */
3567
+ maxIterations?: number;
3568
+ /** Callback for each step */
3569
+ onStep?: (step: AgentStep) => void;
3570
+ /** Optional logger */
3571
+ logger?: Logger;
3572
+ }
3573
+
3574
+ /**
3575
+ * System prompt for data-modeler orchestrator
3576
+ */
3577
+ declare const DATA_MODELER_SYSTEM_PROMPT = "You are a senior database architect specializing in both MongoDB and PostgreSQL schema design.\n\nYou analyze requirements and produce enterprise-quality data models with:\n- Properly typed fields (MongoDB: ObjectId, string, number, date, array; PostgreSQL: uuid, varchar, text, integer, timestamp, jsonb)\n- Indexes optimized for query patterns\n- Relationships with correct cardinality (1:1, 1:N, M:N)\n- Validation constraints and default values\n- Security considerations (hashed passwords, encrypted fields)\n\nOutput only valid JSON unless instructed otherwise.";
3578
+
3579
+ /**
3580
+ * validate_schema tool - validates JSON against dataModelDesignSchema (no AI)
3581
+ */
3582
+ declare const validateSchemaTool: ai.Tool;
3583
+
3584
+ /**
3585
+ * Creates the design_schema tool. Requires a model for generation.
3586
+ */
3587
+ declare function createDesignSchemaTool(model: Model): ai.Tool;
3588
+
3589
+ /**
3590
+ * Creates the design_schema_pro tool for structured 5-phase data modeling.
3591
+ */
3592
+ declare function createDesignSchemaProTool(model: Model): ai.Tool;
3593
+
3594
+ /**
3595
+ * Creates the refine_schema tool for iterating on an existing data model.
3596
+ */
3597
+ declare function createRefineSchemaTools(model: Model): ai.Tool;
3598
+
3599
+ /**
3600
+ * Create all data-modeler tools. Pass the model for AI-backed tools.
3601
+ */
3602
+ declare function createDataModelerTools(model: Model): ToolSet;
3603
+
3604
+ /**
3605
+ * entity-analyzer subagent - extracts entities, fields, and relationships from requirements
3606
+ */
3607
+ declare const entityAnalyzerSubagent: SubagentDefinition;
3608
+
3609
+ /**
3610
+ * relationship-mapper subagent - maps cardinality, foreign keys, indexes
3611
+ */
3612
+ declare const relationshipMapperSubagent: SubagentDefinition;
3613
+
3614
+ /**
3615
+ * schema-refiner subagent - reviews schema for completeness and performance
3616
+ */
3617
+ declare function createSchemaRefinerSubagent(): SubagentDefinition;
3618
+
3619
+ /**
3620
+ * runDataModelerAgent - orchestrator for data model design
3621
+ */
3622
+
3623
+ /**
3624
+ * Run the data-modeler orchestrator agent with all tools and subagents.
3625
+ */
3626
+ declare function runDataModelerAgent(config: DataModelerAgentConfig): Promise<AgentResult>;
3627
+
3628
+ /**
3629
+ * Zod schemas for ApiDesign
3630
+ */
3631
+
3632
+ declare const restEndpointSchema: z.ZodObject<{
3633
+ id: z.ZodString;
3634
+ resource: z.ZodString;
3635
+ method: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
3636
+ DELETE: "DELETE";
3637
+ GET: "GET";
3638
+ POST: "POST";
3639
+ PUT: "PUT";
3640
+ PATCH: "PATCH";
3641
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
3642
+ DELETE: "DELETE";
3643
+ GET: "GET";
3644
+ POST: "POST";
3645
+ PUT: "PUT";
3646
+ PATCH: "PATCH";
3647
+ }>>;
3648
+ path: z.ZodString;
3649
+ description: z.ZodString;
3650
+ auth: z.ZodCoercedBoolean<unknown>;
3651
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
3652
+ requestBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
3653
+ [k: string]: string;
3654
+ }, Record<string, unknown>>>;
3655
+ responseBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
3656
+ [k: string]: string;
3657
+ }, Record<string, unknown>>>;
3658
+ queryParams: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
3659
+ [k: string]: string;
3660
+ }, Record<string, unknown>>>;
3661
+ validation: z.ZodPipe<z.ZodDefault<z.ZodArray<z.ZodUnknown>>, z.ZodTransform<string[], unknown[]>>;
3662
+ errorResponses: z.ZodPipe<z.ZodDefault<z.ZodArray<z.ZodUnknown>>, z.ZodTransform<string[], unknown[]>>;
3663
+ }, z.core.$strip>;
3664
+ declare const graphqlOperationSchema: z.ZodObject<{
3665
+ name: z.ZodString;
3666
+ type: z.ZodEnum<{
3667
+ query: "query";
3668
+ mutation: "mutation";
3669
+ subscription: "subscription";
3670
+ }>;
3671
+ description: z.ZodString;
3672
+ auth: z.ZodCoercedBoolean<unknown>;
3673
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
3674
+ args: z.ZodArray<z.ZodObject<{
3675
+ name: z.ZodString;
3676
+ type: z.ZodString;
3677
+ required: z.ZodCoercedBoolean<unknown>;
3678
+ }, z.core.$strip>>;
3679
+ returnType: z.ZodString;
3680
+ }, z.core.$strip>;
3681
+ declare const apiDesignSchema: z.ZodObject<{
3682
+ style: z.ZodPipe<z.ZodUnknown, z.ZodTransform<"rest" | "graphql", unknown>>;
3683
+ baseUrl: z.ZodDefault<z.ZodString>;
3684
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
3685
+ id: z.ZodString;
3686
+ resource: z.ZodString;
3687
+ method: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodEnum<{
3688
+ DELETE: "DELETE";
3689
+ GET: "GET";
3690
+ POST: "POST";
3691
+ PUT: "PUT";
3692
+ PATCH: "PATCH";
3693
+ }>, z.ZodString]>, z.ZodTransform<string, string>>, z.ZodEnum<{
3694
+ DELETE: "DELETE";
3695
+ GET: "GET";
3696
+ POST: "POST";
3697
+ PUT: "PUT";
3698
+ PATCH: "PATCH";
3699
+ }>>;
3700
+ path: z.ZodString;
3701
+ description: z.ZodString;
3702
+ auth: z.ZodCoercedBoolean<unknown>;
3703
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
3704
+ requestBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
3705
+ [k: string]: string;
3706
+ }, Record<string, unknown>>>;
3707
+ responseBody: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
3708
+ [k: string]: string;
3709
+ }, Record<string, unknown>>>;
3710
+ queryParams: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<{
3711
+ [k: string]: string;
3712
+ }, Record<string, unknown>>>;
3713
+ validation: z.ZodPipe<z.ZodDefault<z.ZodArray<z.ZodUnknown>>, z.ZodTransform<string[], unknown[]>>;
3714
+ errorResponses: z.ZodPipe<z.ZodDefault<z.ZodArray<z.ZodUnknown>>, z.ZodTransform<string[], unknown[]>>;
3715
+ }, z.core.$strip>>>;
3716
+ graphqlOperations: z.ZodDefault<z.ZodArray<z.ZodObject<{
3717
+ name: z.ZodString;
3718
+ type: z.ZodEnum<{
3719
+ query: "query";
3720
+ mutation: "mutation";
3721
+ subscription: "subscription";
3722
+ }>;
3723
+ description: z.ZodString;
3724
+ auth: z.ZodCoercedBoolean<unknown>;
3725
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
3726
+ args: z.ZodArray<z.ZodObject<{
3727
+ name: z.ZodString;
3728
+ type: z.ZodString;
3729
+ required: z.ZodCoercedBoolean<unknown>;
3730
+ }, z.core.$strip>>;
3731
+ returnType: z.ZodString;
3732
+ }, z.core.$strip>>>;
3733
+ }, z.core.$strip>;
3734
+ type TApiDesign = z.infer<typeof apiDesignSchema>;
3735
+
3736
+ /**
3737
+ * api-designer module types
3738
+ */
3739
+
3740
+ type ApiStyle = 'rest' | 'graphql';
3741
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
3742
+ interface RestEndpoint {
3743
+ id: string;
3744
+ resource: string;
3745
+ method: HttpMethod;
3746
+ path: string;
3747
+ description: string;
3748
+ auth: boolean;
3749
+ roles: string[];
3750
+ requestBody: Record<string, string>;
3751
+ responseBody: Record<string, string>;
3752
+ queryParams: Record<string, string>;
3753
+ validation: string[];
3754
+ errorResponses: string[];
3755
+ }
3756
+ interface GraphqlOperation {
3757
+ name: string;
3758
+ type: 'query' | 'mutation' | 'subscription';
3759
+ description: string;
3760
+ auth: boolean;
3761
+ roles: string[];
3762
+ args: {
3763
+ name: string;
3764
+ type: string;
3765
+ required: boolean;
3766
+ }[];
3767
+ returnType: string;
3768
+ }
3769
+ interface ApiDesign {
3770
+ style: ApiStyle;
3771
+ baseUrl: string;
3772
+ endpoints: RestEndpoint[];
3773
+ graphqlOperations: GraphqlOperation[];
3774
+ }
3775
+ interface ApiDesignerAgentConfig {
3776
+ /** User input: natural language description or data model + requirements */
3777
+ input: string;
3778
+ /** Model config; defaults to gpt-4o-mini */
3779
+ model?: ModelConfig;
3780
+ /** Max iterations; default 15 */
3781
+ maxIterations?: number;
3782
+ /** Callback for each step */
3783
+ onStep?: (step: AgentStep) => void;
3784
+ /** Optional logger */
3785
+ logger?: Logger;
3786
+ }
3787
+
3788
+ /**
3789
+ * System prompt for api-designer orchestrator
3790
+ */
3791
+ declare const API_DESIGNER_SYSTEM_PROMPT = "You are a senior API architect specializing in REST and GraphQL API design.\n\nYou analyze data models and requirements to produce enterprise-quality API designs with:\n- RESTful endpoints grouped by resource with proper HTTP methods\n- Request/response contracts with field types and validation rules\n- Error responses with appropriate HTTP status codes (400, 401, 403, 404, 500)\n- Pagination, filtering, and sorting patterns\n- Authentication and authorization annotations per endpoint\n- GraphQL types, queries, mutations, and subscriptions when applicable\n\nOutput only valid JSON unless instructed otherwise.";
3792
+
3793
+ /**
3794
+ * validate_api tool - validates JSON against apiDesignSchema (no AI)
3795
+ */
3796
+ declare const validateApiTool: ai.Tool;
3797
+
3798
+ /**
3799
+ * Creates the design_api tool for plain text requirements.
3800
+ */
3801
+ declare function createDesignApiTool(model: Model): ai.Tool;
3802
+
3803
+ /**
3804
+ * Creates the design_api_pro tool for structured API design.
3805
+ */
3806
+ declare function createDesignApiProTool(model: Model): ai.Tool;
3807
+
3808
+ /**
3809
+ * Create all api-designer tools. Pass the model for AI-backed tools.
3810
+ */
3811
+ declare function createApiDesignerTools(model: Model): ToolSet;
3812
+
3813
+ /**
3814
+ * endpoint-analyzer subagent - derives API endpoints from data model and requirements
3815
+ */
3816
+ declare const endpointAnalyzerSubagent: SubagentDefinition;
3817
+
3818
+ /**
3819
+ * contract-designer subagent - designs request/response contracts per endpoint
3820
+ */
3821
+ declare const contractDesignerSubagent: SubagentDefinition;
3822
+
3823
+ /**
3824
+ * runApiDesignerAgent - orchestrator for API design
3825
+ */
3826
+
3827
+ /**
3828
+ * Run the api-designer orchestrator agent with all tools and subagents.
3829
+ */
3830
+ declare function runApiDesignerAgent(config: ApiDesignerAgentConfig): Promise<AgentResult>;
3831
+
3832
+ /**
3833
+ * Zod schemas for AuthDesign
3834
+ */
3835
+
3836
+ declare const authFlowStepSchema: z.ZodObject<{
3837
+ order: z.ZodNumber;
3838
+ side: z.ZodEnum<{
3839
+ frontend: "frontend";
3840
+ backend: "backend";
3841
+ }>;
3842
+ action: z.ZodString;
3843
+ details: z.ZodString;
3844
+ }, z.core.$strip>;
3845
+ declare const authFlowSchema: z.ZodObject<{
3846
+ name: z.ZodString;
3847
+ description: z.ZodString;
3848
+ steps: z.ZodArray<z.ZodObject<{
3849
+ order: z.ZodNumber;
3850
+ side: z.ZodEnum<{
3851
+ frontend: "frontend";
3852
+ backend: "backend";
3853
+ }>;
3854
+ action: z.ZodString;
3855
+ details: z.ZodString;
3856
+ }, z.core.$strip>>;
3857
+ }, z.core.$strip>;
3858
+ declare const authMiddlewareSchema: z.ZodObject<{
3859
+ name: z.ZodString;
3860
+ purpose: z.ZodString;
3861
+ behavior: z.ZodArray<z.ZodString>;
3862
+ }, z.core.$strip>;
3863
+ declare const roleDefinitionSchema: z.ZodObject<{
3864
+ name: z.ZodString;
3865
+ description: z.ZodString;
3866
+ permissions: z.ZodArray<z.ZodString>;
3867
+ }, z.core.$strip>;
3868
+ declare const securityPolicySchema: z.ZodObject<{
3869
+ area: z.ZodString;
3870
+ rules: z.ZodArray<z.ZodString>;
3871
+ }, z.core.$strip>;
3872
+ declare const authDesignSchema: z.ZodObject<{
3873
+ strategy: z.ZodEnum<{
3874
+ jwt: "jwt";
3875
+ oauth: "oauth";
3876
+ session: "session";
3877
+ }>;
3878
+ flows: z.ZodArray<z.ZodObject<{
3879
+ name: z.ZodString;
3880
+ description: z.ZodString;
3881
+ steps: z.ZodArray<z.ZodObject<{
3882
+ order: z.ZodNumber;
3883
+ side: z.ZodEnum<{
3884
+ frontend: "frontend";
3885
+ backend: "backend";
3886
+ }>;
3887
+ action: z.ZodString;
3888
+ details: z.ZodString;
3889
+ }, z.core.$strip>>;
3890
+ }, z.core.$strip>>;
3891
+ middleware: z.ZodArray<z.ZodObject<{
3892
+ name: z.ZodString;
3893
+ purpose: z.ZodString;
3894
+ behavior: z.ZodArray<z.ZodString>;
3895
+ }, z.core.$strip>>;
3896
+ roles: z.ZodArray<z.ZodObject<{
3897
+ name: z.ZodString;
3898
+ description: z.ZodString;
3899
+ permissions: z.ZodArray<z.ZodString>;
3900
+ }, z.core.$strip>>;
3901
+ policies: z.ZodArray<z.ZodObject<{
3902
+ area: z.ZodString;
3903
+ rules: z.ZodArray<z.ZodString>;
3904
+ }, z.core.$strip>>;
3905
+ }, z.core.$strip>;
3906
+ type TAuthDesign = z.infer<typeof authDesignSchema>;
3907
+
3908
+ /**
3909
+ * auth-designer module types
3910
+ */
3911
+
3912
+ type AuthStrategy = 'jwt' | 'session' | 'oauth';
3913
+ interface AuthFlow {
3914
+ name: string;
3915
+ description: string;
3916
+ steps: AuthFlowStep[];
3917
+ }
3918
+ interface AuthFlowStep {
3919
+ order: number;
3920
+ side: 'frontend' | 'backend';
3921
+ action: string;
3922
+ details: string;
3923
+ }
3924
+ interface AuthMiddleware {
3925
+ name: string;
3926
+ purpose: string;
3927
+ behavior: string[];
3928
+ }
3929
+ interface RoleDefinition {
3930
+ name: string;
3931
+ description: string;
3932
+ permissions: string[];
3933
+ }
3934
+ interface SecurityPolicy {
3935
+ area: string;
3936
+ rules: string[];
3937
+ }
3938
+ interface AuthDesign {
3939
+ strategy: AuthStrategy;
3940
+ flows: AuthFlow[];
3941
+ middleware: AuthMiddleware[];
3942
+ roles: RoleDefinition[];
3943
+ policies: SecurityPolicy[];
3944
+ }
3945
+ interface AuthDesignerAgentConfig {
3946
+ /** User input: project context and auth requirements */
3947
+ input: string;
3948
+ /** Model config; defaults to gpt-4o-mini */
3949
+ model?: ModelConfig;
3950
+ /** Max iterations; default 15 */
3951
+ maxIterations?: number;
3952
+ /** Callback for each step */
3953
+ onStep?: (step: AgentStep) => void;
3954
+ /** Optional logger */
3955
+ logger?: Logger;
3956
+ }
3957
+
3958
+ /**
3959
+ * System prompt for auth-designer orchestrator
3960
+ */
3961
+ declare const AUTH_DESIGNER_SYSTEM_PROMPT = "You are a senior security engineer specializing in authentication, authorization, and web security.\n\nYou design enterprise-quality auth systems with:\n- Step-by-step auth flows (signup, login, logout, password reset) with both frontend and backend steps\n- JWT or session strategy with proper cookie configuration (httpOnly, secure, sameSite, maxAge)\n- Role-based access control (RBAC) with permission matrices\n- Middleware chains for route protection and API authentication\n- Security policies: password hashing (bcrypt), rate limiting, CORS, input sanitization, brute force protection\n- OAuth integration patterns when needed\n\nOutput only valid JSON unless instructed otherwise.";
3962
+
3963
+ /**
3964
+ * Design prompts for auth-designer
3965
+ */
3966
+ declare const DESIGN_AUTH_PROMPT = "## Requirements:\n{requirement}\n\nDesign the authentication and authorization system. Include:\n\n1. Strategy: jwt, session, or oauth (choose based on requirements).\n2. Flows: signup, login, logout, password reset (if applicable). Each flow with numbered steps, frontend/backend side, action, and details.\n3. Middleware: route protection middleware, API auth middleware. Each with name, purpose, and behavior list.\n4. Roles: role definitions with name, description, and permissions list.\n5. Policies: security policies grouped by area (passwords, tokens, CORS, rate limiting, etc.).\n\nReturn ONLY valid JSON:\n{\n \"strategy\": \"jwt\" | \"session\" | \"oauth\",\n \"flows\": [{ \"name\": \"signup\", \"description\": \"...\", \"steps\": [{ \"order\": 1, \"side\": \"frontend\", \"action\": \"...\", \"details\": \"...\" }] }],\n \"middleware\": [{ \"name\": \"authenticateRequest\", \"purpose\": \"...\", \"behavior\": [\"...\"] }],\n \"roles\": [{ \"name\": \"user\", \"description\": \"...\", \"permissions\": [\"...\"] }],\n \"policies\": [{ \"area\": \"passwords\", \"rules\": [\"...\"] }]\n}";
3967
+ declare function buildDesignAuthPrompt(requirement: string): string;
3968
+
3969
+ /**
3970
+ * validate_auth tool - validates JSON against authDesignSchema (no AI)
3971
+ */
3972
+ declare const validateAuthTool: ai.Tool;
3973
+
3974
+ /**
3975
+ * Creates the design_auth tool for auth flow generation.
3976
+ */
3977
+ declare function createDesignAuthTool(model: Model): ai.Tool;
3978
+
3979
+ /**
3980
+ * Create all auth-designer tools. Pass the model for AI-backed tools.
3981
+ */
3982
+ declare function createAuthDesignerTools(model: Model): ToolSet;
3983
+
3984
+ /**
3985
+ * security-analyzer subagent - analyzes security requirements and threat vectors
3986
+ */
3987
+ declare const securityAnalyzerSubagent: SubagentDefinition;
3988
+
3989
+ /**
3990
+ * flow-designer subagent - designs step-by-step auth flows
3991
+ */
3992
+ declare const flowDesignerSubagent: SubagentDefinition;
3993
+
3994
+ /**
3995
+ * runAuthDesignerAgent - orchestrator for auth design
3996
+ */
3997
+
3998
+ /**
3999
+ * Run the auth-designer orchestrator agent with all tools and subagents.
4000
+ */
4001
+ declare function runAuthDesignerAgent(config: AuthDesignerAgentConfig): Promise<AgentResult>;
4002
+
4003
+ /**
4004
+ * Zod schemas for FrontendDesign
4005
+ */
4006
+
4007
+ declare const formFieldSchema: z.ZodObject<{
4008
+ name: z.ZodString;
4009
+ type: z.ZodString;
4010
+ required: z.ZodCoercedBoolean<unknown>;
4011
+ validation: z.ZodString;
4012
+ }, z.core.$strip>;
4013
+ declare const pageDesignSchema: z.ZodObject<{
4014
+ path: z.ZodString;
4015
+ name: z.ZodString;
4016
+ access: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4017
+ public: "public";
4018
+ protected: "protected";
4019
+ }>>;
4020
+ purpose: z.ZodString;
4021
+ formFields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4022
+ name: z.ZodString;
4023
+ type: z.ZodString;
4024
+ required: z.ZodCoercedBoolean<unknown>;
4025
+ validation: z.ZodString;
4026
+ }, z.core.$strip>>>;
4027
+ actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
4028
+ emptyState: z.ZodDefault<z.ZodString>;
4029
+ errorState: z.ZodDefault<z.ZodString>;
4030
+ redirectOnSuccess: z.ZodDefault<z.ZodString>;
4031
+ keyUiElements: z.ZodDefault<z.ZodArray<z.ZodString>>;
4032
+ }, z.core.$strip>;
4033
+ declare const componentDesignSchema: z.ZodObject<{
4034
+ name: z.ZodString;
4035
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4036
+ form: "form";
4037
+ layout: "layout";
4038
+ shared: "shared";
4039
+ display: "display";
4040
+ navigation: "navigation";
4041
+ }>>;
4042
+ purpose: z.ZodString;
4043
+ props: z.ZodDefault<z.ZodArray<z.ZodString>>;
4044
+ usedIn: z.ZodDefault<z.ZodArray<z.ZodString>>;
4045
+ }, z.core.$strip>;
4046
+ declare const frontendDesignSchema: z.ZodObject<{
4047
+ pages: z.ZodDefault<z.ZodArray<z.ZodObject<{
4048
+ path: z.ZodString;
4049
+ name: z.ZodString;
4050
+ access: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4051
+ public: "public";
4052
+ protected: "protected";
4053
+ }>>;
4054
+ purpose: z.ZodString;
4055
+ formFields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4056
+ name: z.ZodString;
4057
+ type: z.ZodString;
4058
+ required: z.ZodCoercedBoolean<unknown>;
4059
+ validation: z.ZodString;
4060
+ }, z.core.$strip>>>;
4061
+ actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
4062
+ emptyState: z.ZodDefault<z.ZodString>;
4063
+ errorState: z.ZodDefault<z.ZodString>;
4064
+ redirectOnSuccess: z.ZodDefault<z.ZodString>;
4065
+ keyUiElements: z.ZodDefault<z.ZodArray<z.ZodString>>;
4066
+ }, z.core.$strip>>>;
4067
+ components: z.ZodDefault<z.ZodArray<z.ZodObject<{
4068
+ name: z.ZodString;
4069
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4070
+ form: "form";
4071
+ layout: "layout";
4072
+ shared: "shared";
4073
+ display: "display";
4074
+ navigation: "navigation";
4075
+ }>>;
4076
+ purpose: z.ZodString;
4077
+ props: z.ZodDefault<z.ZodArray<z.ZodString>>;
4078
+ usedIn: z.ZodDefault<z.ZodArray<z.ZodString>>;
4079
+ }, z.core.$strip>>>;
4080
+ stateManagement: z.ZodDefault<z.ZodString>;
4081
+ routingNotes: z.ZodDefault<z.ZodString>;
4082
+ }, z.core.$strip>;
4083
+ type TFrontendDesign = z.infer<typeof frontendDesignSchema>;
4084
+
4085
+ /**
4086
+ * frontend-architect module types
4087
+ */
4088
+
4089
+ type PageAccess = 'public' | 'protected';
4090
+ interface FormField {
4091
+ name: string;
4092
+ type: string;
4093
+ required: boolean;
4094
+ validation: string;
4095
+ }
4096
+ interface PageDesign {
4097
+ path: string;
4098
+ name: string;
4099
+ access: PageAccess;
4100
+ purpose: string;
4101
+ formFields: FormField[];
4102
+ actions: string[];
4103
+ emptyState: string;
4104
+ errorState: string;
4105
+ redirectOnSuccess: string;
4106
+ keyUiElements: string[];
4107
+ }
4108
+ interface ComponentDesign {
4109
+ name: string;
4110
+ type: 'layout' | 'shared' | 'form' | 'display' | 'navigation';
4111
+ purpose: string;
4112
+ props: string[];
4113
+ usedIn: string[];
4114
+ }
4115
+ interface FrontendDesign {
4116
+ pages: PageDesign[];
4117
+ components: ComponentDesign[];
4118
+ stateManagement: string;
4119
+ routingNotes: string;
4120
+ }
4121
+ interface FrontendArchitectAgentConfig {
4122
+ /** User input: project context, API surface, and frontend requirements */
4123
+ input: string;
4124
+ /** Model config; defaults to gpt-4o-mini */
4125
+ model?: ModelConfig;
4126
+ /** Max iterations; default 15 */
4127
+ maxIterations?: number;
4128
+ /** Callback for each step */
4129
+ onStep?: (step: AgentStep) => void;
4130
+ /** Optional logger */
4131
+ logger?: Logger;
4132
+ }
4133
+
4134
+ /**
4135
+ * System prompt for frontend-architect orchestrator
4136
+ */
4137
+ declare const FRONTEND_ARCHITECT_SYSTEM_PROMPT = "You are a senior frontend architect specializing in page design, routing, and component architecture.\n\nYou design enterprise-quality frontend architectures targeting a Vite + React 19 + TypeScript stack with:\n- **UI Library**: ShadCN UI (Radix-based components in src/components/ui/)\n- **Styling**: Tailwind CSS v4 with OKLCH color space and dark mode support\n- **Routing**: React Router v7 with private route guards\n- **Forms**: React Hook Form + Zod validation\n- **GraphQL**: Apollo Client with CodeGen-typed hooks\n- **Path Aliases**: @/{appName}/* mapping to ./src/*\n\nArchitecture outputs:\n- Public and protected pages with detailed route definitions\n- Per-page specifications: purpose, form fields with validation, actions, empty/error states, redirects\n- Component taxonomy: layout (sidebar, navbar), shared (data tables, dialogs), form (inputs, selects), display (cards, badges), navigation (breadcrumbs, tabs)\n- State management strategy (per-page vs global, Apollo cache vs local state)\n\nOutput only valid JSON unless instructed otherwise.";
4138
+
4139
+ /**
4140
+ * Design prompts for frontend-architect
4141
+ */
4142
+ declare const DESIGN_FRONTEND_PROMPT = "## Requirements:\n{requirement}\n\nDesign the frontend architecture. Include:\n\n1. Pages: public and protected pages. For each page: path, name, access level, purpose, form fields (with validation), actions, empty state, error state, redirect on success, key UI elements.\n2. Components: reusable components. For each: name, type (layout/shared/form/display/navigation), purpose, props, and which pages use it.\n3. State management: describe the state strategy (e.g. React Server Components for data, client state for forms).\n4. Routing notes: any special routing behavior (redirects, guards, nested routes).\n\nReturn ONLY valid JSON:\n{\n \"pages\": [{ \"path\": \"/login\", \"name\": \"Login\", \"access\": \"public\", \"purpose\": \"...\", \"formFields\": [{ \"name\": \"email\", \"type\": \"email\", \"required\": true, \"validation\": \"valid email format\" }], \"actions\": [\"Submit login form\"], \"emptyState\": \"\", \"errorState\": \"Show error message\", \"redirectOnSuccess\": \"/dashboard\", \"keyUiElements\": [\"Email input\", \"Password input\", \"Submit button\"] }],\n \"components\": [{ \"name\": \"Navbar\", \"type\": \"navigation\", \"purpose\": \"...\", \"props\": [\"user\"], \"usedIn\": [\"/dashboard\", \"/profile\"] }],\n \"stateManagement\": \"...\",\n \"routingNotes\": \"...\"\n}";
4143
+ declare function buildDesignFrontendPrompt(requirement: string): string;
4144
+
4145
+ /**
4146
+ * validate_frontend tool - validates JSON against frontendDesignSchema (no AI)
4147
+ */
4148
+ declare const validateFrontendTool: ai.Tool;
4149
+
4150
+ /**
4151
+ * Creates the design_frontend tool for frontend architecture generation.
4152
+ */
4153
+ declare function createDesignFrontendTool(model: Model): ai.Tool;
4154
+
4155
+ /**
4156
+ * Create all frontend-architect tools. Pass the model for AI-backed tools.
4157
+ */
4158
+ declare function createFrontendArchitectTools(model: Model): ToolSet;
4159
+
4160
+ /**
4161
+ * page-planner subagent - designs page structure, routes, and layouts
4162
+ */
4163
+ declare const pagePlannerSubagent: SubagentDefinition;
4164
+
4165
+ /**
4166
+ * component-analyzer subagent - identifies reusable components and shared layouts
4167
+ */
4168
+ declare const componentAnalyzerSubagent: SubagentDefinition;
4169
+
4170
+ /**
4171
+ * runFrontendArchitectAgent - routing orchestrator for frontend architecture design.
4172
+ * Delegates to react-builder or nextjs-builder based on framework selection.
4173
+ */
4174
+
4175
+ /**
4176
+ * Run the frontend-architect routing orchestrator with all tools and subagents.
4177
+ */
4178
+ declare function runFrontendArchitectAgent(config: FrontendArchitectAgentConfig): Promise<AgentResult>;
4179
+
4180
+ /**
4181
+ * Zod schemas for ExecutionPlan
4182
+ */
4183
+
4184
+ declare const phaseStepSchema: z.ZodObject<{
4185
+ order: z.ZodNumber;
4186
+ action: z.ZodString;
4187
+ details: z.ZodString;
4188
+ }, z.core.$strip>;
4189
+ declare const implementationPhaseSchema: z.ZodObject<{
4190
+ name: z.ZodString;
4191
+ description: z.ZodString;
4192
+ steps: z.ZodArray<z.ZodObject<{
4193
+ order: z.ZodNumber;
4194
+ action: z.ZodString;
4195
+ details: z.ZodString;
4196
+ }, z.core.$strip>>;
4197
+ }, z.core.$strip>;
4198
+ declare const edgeCaseSchema: z.ZodObject<{
4199
+ area: z.ZodString;
4200
+ scenario: z.ZodString;
4201
+ handling: z.ZodString;
4202
+ severity: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4203
+ info: "info";
4204
+ critical: "critical";
4205
+ warning: "warning";
4206
+ }>>;
4207
+ }, z.core.$strip>;
4208
+ declare const testChecklistItemSchema: z.ZodObject<{
4209
+ flow: z.ZodString;
4210
+ item: z.ZodString;
4211
+ expectedResult: z.ZodString;
4212
+ }, z.core.$strip>;
4213
+ declare const executionPlanSchema: z.ZodObject<{
4214
+ phases: z.ZodDefault<z.ZodArray<z.ZodObject<{
4215
+ name: z.ZodString;
4216
+ description: z.ZodString;
4217
+ steps: z.ZodArray<z.ZodObject<{
4218
+ order: z.ZodNumber;
4219
+ action: z.ZodString;
4220
+ details: z.ZodString;
4221
+ }, z.core.$strip>>;
4222
+ }, z.core.$strip>>>;
4223
+ currentState: z.ZodDefault<z.ZodString>;
4224
+ desiredEndState: z.ZodDefault<z.ZodString>;
4225
+ edgeCases: z.ZodDefault<z.ZodArray<z.ZodObject<{
4226
+ area: z.ZodString;
4227
+ scenario: z.ZodString;
4228
+ handling: z.ZodString;
4229
+ severity: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4230
+ info: "info";
4231
+ critical: "critical";
4232
+ warning: "warning";
4233
+ }>>;
4234
+ }, z.core.$strip>>>;
4235
+ securityNotes: z.ZodDefault<z.ZodArray<z.ZodString>>;
4236
+ performanceNotes: z.ZodDefault<z.ZodArray<z.ZodString>>;
4237
+ testingChecklist: z.ZodDefault<z.ZodArray<z.ZodObject<{
4238
+ flow: z.ZodString;
4239
+ item: z.ZodString;
4240
+ expectedResult: z.ZodString;
4241
+ }, z.core.$strip>>>;
4242
+ }, z.core.$strip>;
4243
+ type TExecutionPlan = z.infer<typeof executionPlanSchema>;
4244
+
4245
+ /**
4246
+ * execution-planner module types
4247
+ */
4248
+
4249
+ interface PhaseStep {
4250
+ order: number;
4251
+ action: string;
4252
+ details: string;
4253
+ }
4254
+ interface ImplementationPhase {
4255
+ name: string;
4256
+ description: string;
4257
+ steps: PhaseStep[];
4258
+ }
4259
+ interface EdgeCase {
4260
+ area: string;
4261
+ scenario: string;
4262
+ handling: string;
4263
+ severity: 'critical' | 'warning' | 'info';
4264
+ }
4265
+ interface TestChecklistItem {
4266
+ flow: string;
4267
+ item: string;
4268
+ expectedResult: string;
4269
+ }
4270
+ interface ExecutionPlan {
4271
+ phases: ImplementationPhase[];
4272
+ currentState: string;
4273
+ desiredEndState: string;
4274
+ edgeCases: EdgeCase[];
4275
+ securityNotes: string[];
4276
+ performanceNotes: string[];
4277
+ testingChecklist: TestChecklistItem[];
4278
+ }
4279
+ interface ExecutionPlannerAgentConfig {
4280
+ /** User input: all plan sections to create execution plan from */
4281
+ input: string;
4282
+ /** Model config; defaults to gpt-4o-mini */
4283
+ model?: ModelConfig;
4284
+ /** Max iterations; default 15 */
4285
+ maxIterations?: number;
4286
+ /** Callback for each step */
4287
+ onStep?: (step: AgentStep) => void;
4288
+ /** Optional logger */
4289
+ logger?: Logger;
4290
+ }
4291
+
4292
+ /**
4293
+ * System prompt for execution-planner orchestrator
4294
+ */
4295
+ declare const EXECUTION_PLANNER_SYSTEM_PROMPT = "You are a senior tech lead specializing in implementation strategy and project execution planning.\n\nYou create enterprise-quality execution plans with:\n- Phased implementation order with concrete, numbered steps per phase\n- Current state analysis and desired end state definition\n- Edge cases per domain area with handling strategies and severity levels\n- Security considerations (passwords, tokens, CORS, input validation)\n- Performance considerations (indexing, caching, lazy loading, N+1 prevention)\n- Manual testing checklists grouped by feature flow\n\nOutput only valid JSON unless instructed otherwise.";
4296
+
4297
+ /**
4298
+ * Design prompts for execution-planner
4299
+ */
4300
+ declare const CREATE_EXECUTION_PLAN_PROMPT = "## Full Plan Context:\n{context}\n\nCreate a comprehensive execution plan. Include:\n\n1. **phases**: Implementation phases (Foundation, Auth, Core Features, etc.). Each phase has numbered steps with concrete actions (e.g. \"1. Install dependencies\", \"2. Create User model\").\n2. **currentState**: What the project starts with (e.g. \"vanilla Next.js, no DB, no auth\").\n3. **desiredEndState**: What must work when done (user capabilities + technical verification).\n4. **edgeCases**: Edge cases per area with scenario, handling strategy, and severity (critical/warning/info).\n5. **securityNotes**: Security considerations (password hashing, JWT config, rate limiting, etc.).\n6. **performanceNotes**: Performance considerations (indexing, caching, lazy loading, etc.).\n7. **testingChecklist**: Manual testing items per flow with expected results.\n\nReturn ONLY valid JSON:\n{\n \"phases\": [{ \"name\": \"Phase 1: Foundation\", \"description\": \"...\", \"steps\": [{ \"order\": 1, \"action\": \"Install dependencies\", \"details\": \"npm install mongoose bcryptjs jsonwebtoken\" }] }],\n \"currentState\": \"...\",\n \"desiredEndState\": \"...\",\n \"edgeCases\": [{ \"area\": \"Authentication\", \"scenario\": \"Email already exists\", \"handling\": \"Return 400 with clear message\", \"severity\": \"critical\" }],\n \"securityNotes\": [\"...\"],\n \"performanceNotes\": [\"...\"],\n \"testingChecklist\": [{ \"flow\": \"Auth Flow\", \"item\": \"Sign up with valid credentials\", \"expectedResult\": \"Account created, redirected to dashboard\" }]\n}";
4301
+ declare function buildCreateExecutionPlanPrompt(context: string): string;
4302
+
4303
+ /**
4304
+ * validate_execution_plan tool - validates JSON against executionPlanSchema (no AI)
4305
+ */
4306
+ declare const validateExecutionPlanTool: ai.Tool;
4307
+
4308
+ /**
4309
+ * Creates the create_execution_plan tool for generating phased plans.
4310
+ */
4311
+ declare function createExecutionPlanTool(model: Model): ai.Tool;
4312
+
4313
+ /**
4314
+ * Create all execution-planner tools. Pass the model for AI-backed tools.
4315
+ */
4316
+ declare function createExecutionPlannerTools(model: Model): ToolSet;
4317
+
4318
+ /**
4319
+ * edge-case-analyzer subagent - identifies edge cases per domain area
4320
+ */
4321
+ declare const edgeCaseAnalyzerSubagent: SubagentDefinition;
4322
+
4323
+ /**
4324
+ * testing-strategist subagent - designs manual testing checklists
4325
+ */
4326
+ declare const testingStrategistSubagent: SubagentDefinition;
4327
+
4328
+ /**
4329
+ * runExecutionPlannerAgent - orchestrator for execution plan design
4330
+ */
4331
+
4332
+ /**
4333
+ * Run the execution-planner orchestrator agent with all tools and subagents.
4334
+ */
4335
+ declare function runExecutionPlannerAgent(config: ExecutionPlannerAgentConfig): Promise<AgentResult>;
4336
+
4337
+ /**
4338
+ * Zod schemas for BackendDesign
4339
+ */
4340
+
4341
+ declare const middlewareSchema: z.ZodObject<{
4342
+ name: z.ZodString;
4343
+ purpose: z.ZodString;
4344
+ appliesTo: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<"global" | "route" | "resource", string>>, z.ZodEnum<{
4345
+ route: "route";
4346
+ resource: "resource";
4347
+ global: "global";
4348
+ }>>;
4349
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4350
+ }, z.core.$strip>;
4351
+ declare const serviceSchema: z.ZodObject<{
4352
+ name: z.ZodString;
4353
+ entity: z.ZodString;
4354
+ operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
4355
+ dependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
4356
+ }, z.core.$strip>;
4357
+ declare const routeGroupSchema: z.ZodObject<{
4358
+ resource: z.ZodString;
4359
+ basePath: z.ZodString;
4360
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
4361
+ method: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4362
+ DELETE: "DELETE";
4363
+ GET: "GET";
4364
+ POST: "POST";
4365
+ PUT: "PUT";
4366
+ PATCH: "PATCH";
4367
+ }>>;
4368
+ path: z.ZodString;
4369
+ handler: z.ZodString;
4370
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4371
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4372
+ }, z.core.$strip>>>;
4373
+ }, z.core.$strip>;
4374
+ declare const backendDesignSchema: z.ZodObject<{
4375
+ framework: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4376
+ both: "both";
4377
+ express: "express";
4378
+ apollo: "apollo";
4379
+ }>>;
4380
+ language: z.ZodDefault<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4381
+ typescript: "typescript";
4382
+ javascript: "javascript";
4383
+ }>>>;
4384
+ database: z.ZodDefault<z.ZodString>;
4385
+ services: z.ZodDefault<z.ZodArray<z.ZodObject<{
4386
+ name: z.ZodString;
4387
+ entity: z.ZodString;
4388
+ operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
4389
+ dependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
4390
+ }, z.core.$strip>>>;
4391
+ middleware: z.ZodDefault<z.ZodArray<z.ZodObject<{
4392
+ name: z.ZodString;
4393
+ purpose: z.ZodString;
4394
+ appliesTo: z.ZodPipe<z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<"global" | "route" | "resource", string>>, z.ZodEnum<{
4395
+ route: "route";
4396
+ resource: "resource";
4397
+ global: "global";
4398
+ }>>;
4399
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4400
+ }, z.core.$strip>>>;
4401
+ routes: z.ZodDefault<z.ZodArray<z.ZodObject<{
4402
+ resource: z.ZodString;
4403
+ basePath: z.ZodString;
4404
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodObject<{
4405
+ method: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4406
+ DELETE: "DELETE";
4407
+ GET: "GET";
4408
+ POST: "POST";
4409
+ PUT: "PUT";
4410
+ PATCH: "PATCH";
4411
+ }>>;
4412
+ path: z.ZodString;
4413
+ handler: z.ZodString;
4414
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4415
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4416
+ }, z.core.$strip>>>;
4417
+ }, z.core.$strip>>>;
4418
+ folderStructure: z.ZodDefault<z.ZodArray<z.ZodString>>;
4419
+ envVars: z.ZodDefault<z.ZodArray<z.ZodString>>;
4420
+ notes: z.ZodDefault<z.ZodString>;
4421
+ }, z.core.$strip>;
4422
+ type TBackendDesign = z.infer<typeof backendDesignSchema>;
4423
+
4424
+ /**
4425
+ * backend-architect module types
4426
+ */
4427
+
4428
+ interface BackendArchitectAgentConfig {
4429
+ /** Project requirements, data model, and API design context */
4430
+ input: string;
4431
+ /** Model config; optional */
4432
+ model?: ModelConfig;
4433
+ /** Max iterations; default 15 */
4434
+ maxIterations?: number;
4435
+ /** Callback for each step */
4436
+ onStep?: (step: AgentStep) => void;
4437
+ /** Optional logger for execution logs */
4438
+ logger?: Logger;
4439
+ }
4440
+
4441
+ /**
4442
+ * System prompt for backend-architect orchestrator
4443
+ */
4444
+ declare const BACKEND_ARCHITECT_SYSTEM_PROMPT = "You are a senior backend architect specializing in Node.js server design.\n\nYou analyze data models, API designs, and auth requirements to produce enterprise-quality backend architectures with:\n- Framework selection (Express REST, Apollo GraphQL, or both)\n- Service layer design with clear operation contracts per entity\n- Middleware stack (auth, validation, error handling, CORS, rate limiting)\n- Route/resolver organization grouped by resource\n- Folder structure following domain-driven conventions\n- Environment variable inventory\n- Database connection and ORM/ODM strategy\n\nWhen \"both\" is selected (Express + Apollo), use the Apollo Gateway pattern:\n- Apollo Gateway as the single public entry point for GraphQL queries\n- Subgraphs as internal services composed via IntrospectAndCompose\n- RemoteGraphQLDataSource for header forwarding (auth tokens, service tokens)\n- Express for webhooks, file uploads, and health checks only\n- Gateway has no business logic, all logic lives in subgraphs\n\nOutput only valid JSON unless instructed otherwise.";
4445
+
4446
+ /**
4447
+ * Design prompt for backend architecture generation
4448
+ */
4449
+ declare const DESIGN_BACKEND_PROMPT = "## Requirements:\n{requirement}\n\nDesign the backend architecture. Include:\n\n1. Framework: choose \"express\" (REST API), \"apollo\" (GraphQL subgraph), or \"both\" (Apollo subgraph + Express gateway).\n2. Services: one per entity with CRUD operations and dependencies.\n3. Middleware: auth (JWT/session), validation (Zod/Joi), error handling, CORS, rate limiting.\n4. Routes (if Express): RESTful routes grouped by resource with method, path, handler, auth, and roles.\n5. Folder structure: list of directories and key files.\n6. Env vars: list all required environment variables.\n\nReturn ONLY valid JSON:\n{\n \"framework\": \"express\" | \"apollo\" | \"both\",\n \"language\": \"typescript\",\n \"database\": \"mongodb\",\n \"services\": [{ \"name\": \"UserService\", \"entity\": \"User\", \"operations\": [\"create\", \"findById\", \"findAll\", \"update\", \"delete\"], \"dependencies\": [] }],\n \"middleware\": [{ \"name\": \"authMiddleware\", \"purpose\": \"JWT token verification\", \"appliesTo\": \"global\", \"config\": {} }],\n \"routes\": [{ \"resource\": \"users\", \"basePath\": \"/api/users\", \"endpoints\": [{ \"method\": \"GET\", \"path\": \"/\", \"handler\": \"getAll\", \"auth\": true, \"roles\": [\"admin\"] }] }],\n \"folderStructure\": [\"src/\", \"src/routes/\", \"src/services/\", \"src/middleware/\", \"src/models/\", \"src/config/\"],\n \"envVars\": [\"PORT\", \"DATABASE_URL\", \"JWT_SECRET\"],\n \"notes\": \"\"\n}";
4450
+ declare function buildDesignBackendPrompt(requirement: string): string;
4451
+
4452
+ /**
4453
+ * validate_backend tool - validates JSON against backendDesignSchema (no AI)
4454
+ */
4455
+ declare const validateBackendTool: ai.Tool;
4456
+
4457
+ /**
4458
+ * Creates the design_backend tool for backend architecture generation.
4459
+ */
4460
+ declare function createDesignBackendTool(model: Model): ai.Tool;
4461
+
4462
+ /**
4463
+ * Create all backend-architect tools. Pass the model for AI-backed tools.
4464
+ */
4465
+ declare function createBackendArchitectTools(model: Model): ToolSet;
4466
+
4467
+ /**
4468
+ * service-planner subagent - plans service layer, middleware stack, folder structure
4469
+ */
4470
+ declare const servicePlannerSubagent: SubagentDefinition;
4471
+
4472
+ /**
4473
+ * framework-selector subagent - analyzes requirements and selects Express vs Apollo vs both
4474
+ */
4475
+ declare const frameworkSelectorSubagent: SubagentDefinition;
4476
+
4477
+ /**
4478
+ * runBackendArchitectAgent - routing orchestrator for backend design
4479
+ * Delegates to express-builder or apollo-builder based on framework selection.
4480
+ */
4481
+
4482
+ /**
4483
+ * Run the backend-architect orchestrator agent.
4484
+ */
4485
+ declare function runBackendArchitectAgent(config: BackendArchitectAgentConfig): Promise<AgentResult>;
4486
+
4487
+ /**
4488
+ * Zod schemas for Apollo subgraph configuration
4489
+ */
4490
+
4491
+ declare const graphqlFieldSchema: z.ZodObject<{
4492
+ name: z.ZodString;
4493
+ type: z.ZodString;
4494
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4495
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4496
+ description: z.ZodDefault<z.ZodString>;
4497
+ }, z.core.$strip>;
4498
+ declare const graphqlTypeSchema: z.ZodObject<{
4499
+ name: z.ZodString;
4500
+ kind: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4501
+ input: "input";
4502
+ type: "type";
4503
+ enum: "enum";
4504
+ union: "union";
4505
+ interface: "interface";
4506
+ }>>;
4507
+ fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4508
+ name: z.ZodString;
4509
+ type: z.ZodString;
4510
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4511
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4512
+ description: z.ZodDefault<z.ZodString>;
4513
+ }, z.core.$strip>>>;
4514
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
4515
+ description: z.ZodDefault<z.ZodString>;
4516
+ isEntity: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4517
+ keyFields: z.ZodDefault<z.ZodArray<z.ZodString>>;
4518
+ }, z.core.$strip>;
4519
+ declare const resolverOperationSchema: z.ZodObject<{
4520
+ name: z.ZodString;
4521
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4522
+ query: "query";
4523
+ mutation: "mutation";
4524
+ subscription: "subscription";
4525
+ }>>;
4526
+ args: z.ZodDefault<z.ZodArray<z.ZodObject<{
4527
+ name: z.ZodString;
4528
+ type: z.ZodString;
4529
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4530
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4531
+ description: z.ZodDefault<z.ZodString>;
4532
+ }, z.core.$strip>>>;
4533
+ returnType: z.ZodString;
4534
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4535
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4536
+ description: z.ZodDefault<z.ZodString>;
4537
+ }, z.core.$strip>;
4538
+ declare const subgraphModuleSchema: z.ZodObject<{
4539
+ name: z.ZodString;
4540
+ entity: z.ZodString;
4541
+ types: z.ZodDefault<z.ZodArray<z.ZodObject<{
4542
+ name: z.ZodString;
4543
+ kind: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4544
+ input: "input";
4545
+ type: "type";
4546
+ enum: "enum";
4547
+ union: "union";
4548
+ interface: "interface";
4549
+ }>>;
4550
+ fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4551
+ name: z.ZodString;
4552
+ type: z.ZodString;
4553
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4554
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4555
+ description: z.ZodDefault<z.ZodString>;
4556
+ }, z.core.$strip>>>;
4557
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
4558
+ description: z.ZodDefault<z.ZodString>;
4559
+ isEntity: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4560
+ keyFields: z.ZodDefault<z.ZodArray<z.ZodString>>;
4561
+ }, z.core.$strip>>>;
4562
+ operations: z.ZodDefault<z.ZodArray<z.ZodObject<{
4563
+ name: z.ZodString;
4564
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4565
+ query: "query";
4566
+ mutation: "mutation";
4567
+ subscription: "subscription";
4568
+ }>>;
4569
+ args: z.ZodDefault<z.ZodArray<z.ZodObject<{
4570
+ name: z.ZodString;
4571
+ type: z.ZodString;
4572
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4573
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4574
+ description: z.ZodDefault<z.ZodString>;
4575
+ }, z.core.$strip>>>;
4576
+ returnType: z.ZodString;
4577
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4578
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4579
+ description: z.ZodDefault<z.ZodString>;
4580
+ }, z.core.$strip>>>;
4581
+ datasource: z.ZodDefault<z.ZodString>;
4582
+ loader: z.ZodDefault<z.ZodString>;
4583
+ }, z.core.$strip>;
4584
+ declare const subgraphConfigSchema: z.ZodObject<{
4585
+ appName: z.ZodDefault<z.ZodString>;
4586
+ port: z.ZodDefault<z.ZodNumber>;
4587
+ database: z.ZodDefault<z.ZodString>;
4588
+ modules: z.ZodDefault<z.ZodArray<z.ZodObject<{
4589
+ name: z.ZodString;
4590
+ entity: z.ZodString;
4591
+ types: z.ZodDefault<z.ZodArray<z.ZodObject<{
4592
+ name: z.ZodString;
4593
+ kind: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4594
+ input: "input";
4595
+ type: "type";
4596
+ enum: "enum";
4597
+ union: "union";
4598
+ interface: "interface";
4599
+ }>>;
4600
+ fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4601
+ name: z.ZodString;
4602
+ type: z.ZodString;
4603
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4604
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4605
+ description: z.ZodDefault<z.ZodString>;
4606
+ }, z.core.$strip>>>;
4607
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
4608
+ description: z.ZodDefault<z.ZodString>;
4609
+ isEntity: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4610
+ keyFields: z.ZodDefault<z.ZodArray<z.ZodString>>;
4611
+ }, z.core.$strip>>>;
4612
+ operations: z.ZodDefault<z.ZodArray<z.ZodObject<{
4613
+ name: z.ZodString;
4614
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4615
+ query: "query";
4616
+ mutation: "mutation";
4617
+ subscription: "subscription";
4618
+ }>>;
4619
+ args: z.ZodDefault<z.ZodArray<z.ZodObject<{
4620
+ name: z.ZodString;
4621
+ type: z.ZodString;
4622
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4623
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4624
+ description: z.ZodDefault<z.ZodString>;
4625
+ }, z.core.$strip>>>;
4626
+ returnType: z.ZodString;
4627
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4628
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4629
+ description: z.ZodDefault<z.ZodString>;
4630
+ }, z.core.$strip>>>;
4631
+ datasource: z.ZodDefault<z.ZodString>;
4632
+ loader: z.ZodDefault<z.ZodString>;
4633
+ }, z.core.$strip>>>;
4634
+ sharedTypes: z.ZodDefault<z.ZodArray<z.ZodObject<{
4635
+ name: z.ZodString;
4636
+ kind: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4637
+ input: "input";
4638
+ type: "type";
4639
+ enum: "enum";
4640
+ union: "union";
4641
+ interface: "interface";
4642
+ }>>;
4643
+ fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4644
+ name: z.ZodString;
4645
+ type: z.ZodString;
4646
+ nullable: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4647
+ isList: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4648
+ description: z.ZodDefault<z.ZodString>;
4649
+ }, z.core.$strip>>>;
4650
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
4651
+ description: z.ZodDefault<z.ZodString>;
4652
+ isEntity: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4653
+ keyFields: z.ZodDefault<z.ZodArray<z.ZodString>>;
4654
+ }, z.core.$strip>>>;
4655
+ authDirective: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4656
+ cacheDirective: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4657
+ envVars: z.ZodDefault<z.ZodArray<z.ZodString>>;
4658
+ }, z.core.$strip>;
4659
+ type TSubgraphConfig = z.infer<typeof subgraphConfigSchema>;
4660
+
4661
+ /**
4662
+ * apollo-builder module types
4663
+ */
4664
+
4665
+ interface ApolloBuilderAgentConfig {
4666
+ /** Data model, API design, and project requirements */
4667
+ input: string;
4668
+ /** Model config; optional */
4669
+ model?: ModelConfig;
4670
+ /** Max iterations; default 15 */
4671
+ maxIterations?: number;
4672
+ /** Callback for each step */
4673
+ onStep?: (step: AgentStep) => void;
4674
+ /** Optional logger for execution logs */
4675
+ logger?: Logger;
4676
+ }
4677
+
4678
+ /**
4679
+ * System prompt for apollo-builder orchestrator
4680
+ */
4681
+ declare const APOLLO_BUILDER_SYSTEM_PROMPT = "You are an expert Apollo GraphQL subgraph architect using Apollo Federation v2.\n\nYou generate production-ready Apollo subgraph configurations from data models and API designs:\n- 4-file module pattern per entity: {module}.graphql, {module}.resolver.ts, {module}.datasource.ts, {module}.loader.ts\n- GraphQL type definitions with proper nullability, lists, and descriptions\n- Input types for mutations with validation annotations\n- Enum types from domain values\n- Federation directives: @key for entity references, @external for fields owned by other subgraphs, @requires for field dependencies, @provides for fields resolvable by this subgraph\n- __resolveReference for cross-subgraph entity resolution via buildSubgraphSchema\n- DataLoader per module for batching and caching database lookups (solves N+1)\n- Query and mutation resolvers with auth/role requirements\n- Datasource classes per entity (MongoDB datasource pattern)\n- Auth directive (@auth) configuration\n- Redis cache directives: @cacheSet on queries, @cachePurge on mutations\n- GraphQL CodeGen for TypeScript types (generates base-types.ts)\n- Module-based organization (one module per entity/domain)\n\nOutput only valid JSON unless instructed otherwise.";
4682
+
4683
+ /**
4684
+ * Design prompt for subgraph config generation
4685
+ */
4686
+ declare const DESIGN_SUBGRAPH_PROMPT = "## Requirements:\n{requirement}\n\nGenerate an Apollo GraphQL subgraph configuration (Federation v2). Include:\n\n1. Modules: one per entity with 4 files each ({module}.graphql, {module}.resolver.ts, {module}.datasource.ts, {module}.loader.ts).\n2. Types: GraphQL object types with isEntity/keyFields for federation, input types, enums with fields/values.\n3. Operations: queries (getById, getAll, search) and mutations (create, update, delete) per module.\n4. Auth: mark which operations require authentication and which roles.\n5. DataLoader: one loader per module for batching lookups (loader name).\n6. Shared types: types used across modules (e.g. Pagination, SortOrder).\n7. Cache: set cacheDirective to true if Redis caching (@cacheSet/@cachePurge) is needed.\n8. Env vars: PORT, DATABASE_URL, JWT_SECRET, REDIS_URL, etc.\n\nReturn ONLY valid JSON:\n{\n \"appName\": \"my-subgraph\",\n \"port\": 4000,\n \"database\": \"mongodb\",\n \"modules\": [{\n \"name\": \"user\",\n \"entity\": \"User\",\n \"types\": [{ \"name\": \"User\", \"kind\": \"type\", \"fields\": [{ \"name\": \"id\", \"type\": \"ID\", \"nullable\": false }], \"isEntity\": true, \"keyFields\": [\"id\"] }],\n \"operations\": [{ \"name\": \"getUser\", \"type\": \"query\", \"args\": [{ \"name\": \"id\", \"type\": \"ID\", \"nullable\": false }], \"returnType\": \"User\", \"auth\": true, \"roles\": [] }],\n \"datasource\": \"UserDataSource\",\n \"loader\": \"UserLoader\"\n }],\n \"sharedTypes\": [],\n \"authDirective\": true,\n \"cacheDirective\": false,\n \"envVars\": [\"PORT\", \"DATABASE_URL\", \"JWT_SECRET\", \"REDIS_URL\"]\n}";
4687
+ declare function buildDesignSubgraphPrompt(requirement: string): string;
4688
+
4689
+ /**
4690
+ * validate_subgraph tool - validates JSON against subgraphConfigSchema (no AI)
4691
+ */
4692
+ declare const validateSubgraphTool: ai.Tool;
4693
+
4694
+ /**
4695
+ * Creates the generate_subgraph tool for Apollo subgraph config generation.
4696
+ */
4697
+ declare function createGenerateSubgraphTool(model: Model): ai.Tool;
4698
+
4699
+ /**
4700
+ * scaffold_subgraph tool - compiles .ref/templates/subgraph/ with config
4701
+ */
4702
+ declare const scaffoldSubgraphTool: ai.Tool;
4703
+
4704
+ /**
4705
+ * Create all apollo-builder tools. Pass the model for AI-backed tools.
4706
+ */
4707
+ declare function createApolloBuilderTools(model: Model): ToolSet;
4708
+
4709
+ /**
4710
+ * schema-generator subagent - generates GraphQL type definitions from data model
4711
+ */
4712
+ declare const schemaGeneratorSubagent: SubagentDefinition;
4713
+
4714
+ /**
4715
+ * resolver-planner subagent - plans resolver implementations per module
4716
+ */
4717
+ declare const resolverPlannerSubagent: SubagentDefinition;
4718
+
4719
+ /**
4720
+ * runApolloBuilderAgent - orchestrator for Apollo GraphQL subgraph generation
4721
+ */
4722
+
4723
+ /**
4724
+ * Run the apollo-builder orchestrator agent.
4725
+ */
4726
+ declare function runApolloBuilderAgent(config: ApolloBuilderAgentConfig): Promise<AgentResult>;
4727
+
4728
+ /**
4729
+ * Zod schemas for Express app configuration
4730
+ */
4731
+
4732
+ declare const routerMethodSchema: z.ZodObject<{
4733
+ name: z.ZodString;
4734
+ httpMethod: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4735
+ DELETE: "DELETE";
4736
+ GET: "GET";
4737
+ POST: "POST";
4738
+ PUT: "PUT";
4739
+ PATCH: "PATCH";
4740
+ }>>;
4741
+ path: z.ZodString;
4742
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4743
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4744
+ validation: z.ZodDefault<z.ZodString>;
4745
+ description: z.ZodDefault<z.ZodString>;
4746
+ }, z.core.$strip>;
4747
+ declare const routerSchema: z.ZodObject<{
4748
+ name: z.ZodString;
4749
+ resource: z.ZodString;
4750
+ basePath: z.ZodString;
4751
+ methods: z.ZodDefault<z.ZodArray<z.ZodObject<{
4752
+ name: z.ZodString;
4753
+ httpMethod: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4754
+ DELETE: "DELETE";
4755
+ GET: "GET";
4756
+ POST: "POST";
4757
+ PUT: "PUT";
4758
+ PATCH: "PATCH";
4759
+ }>>;
4760
+ path: z.ZodString;
4761
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4762
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4763
+ validation: z.ZodDefault<z.ZodString>;
4764
+ description: z.ZodDefault<z.ZodString>;
4765
+ }, z.core.$strip>>>;
4766
+ }, z.core.$strip>;
4767
+ declare const modelFieldSchema: z.ZodObject<{
4768
+ name: z.ZodString;
4769
+ type: z.ZodString;
4770
+ required: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4771
+ unique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4772
+ ref: z.ZodOptional<z.ZodString>;
4773
+ default: z.ZodOptional<z.ZodString>;
4774
+ }, z.core.$strip>;
4775
+ declare const modelSchema: z.ZodObject<{
4776
+ name: z.ZodString;
4777
+ collection: z.ZodString;
4778
+ fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4779
+ name: z.ZodString;
4780
+ type: z.ZodString;
4781
+ required: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4782
+ unique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4783
+ ref: z.ZodOptional<z.ZodString>;
4784
+ default: z.ZodOptional<z.ZodString>;
4785
+ }, z.core.$strip>>>;
4786
+ timestamps: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4787
+ indexes: z.ZodDefault<z.ZodArray<z.ZodString>>;
4788
+ }, z.core.$strip>;
4789
+ declare const middlewareConfigSchema: z.ZodObject<{
4790
+ name: z.ZodString;
4791
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<"validation" | "custom" | "auth" | "errorHandler" | "cors" | "rateLimit" | "logging", string>>, z.ZodEnum<{
4792
+ validation: "validation";
4793
+ custom: "custom";
4794
+ auth: "auth";
4795
+ errorHandler: "errorHandler";
4796
+ cors: "cors";
4797
+ rateLimit: "rateLimit";
4798
+ logging: "logging";
4799
+ }>>;
4800
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4801
+ }, z.core.$strip>;
4802
+ declare const expressConfigSchema: z.ZodObject<{
4803
+ appName: z.ZodDefault<z.ZodString>;
4804
+ port: z.ZodDefault<z.ZodNumber>;
4805
+ database: z.ZodDefault<z.ZodString>;
4806
+ routers: z.ZodDefault<z.ZodArray<z.ZodObject<{
4807
+ name: z.ZodString;
4808
+ resource: z.ZodString;
4809
+ basePath: z.ZodString;
4810
+ methods: z.ZodDefault<z.ZodArray<z.ZodObject<{
4811
+ name: z.ZodString;
4812
+ httpMethod: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4813
+ DELETE: "DELETE";
4814
+ GET: "GET";
4815
+ POST: "POST";
4816
+ PUT: "PUT";
4817
+ PATCH: "PATCH";
4818
+ }>>;
4819
+ path: z.ZodString;
4820
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4821
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
4822
+ validation: z.ZodDefault<z.ZodString>;
4823
+ description: z.ZodDefault<z.ZodString>;
4824
+ }, z.core.$strip>>>;
4825
+ }, z.core.$strip>>>;
4826
+ models: z.ZodDefault<z.ZodArray<z.ZodObject<{
4827
+ name: z.ZodString;
4828
+ collection: z.ZodString;
4829
+ fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
4830
+ name: z.ZodString;
4831
+ type: z.ZodString;
4832
+ required: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4833
+ unique: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4834
+ ref: z.ZodOptional<z.ZodString>;
4835
+ default: z.ZodOptional<z.ZodString>;
4836
+ }, z.core.$strip>>>;
4837
+ timestamps: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4838
+ indexes: z.ZodDefault<z.ZodArray<z.ZodString>>;
4839
+ }, z.core.$strip>>>;
4840
+ middleware: z.ZodDefault<z.ZodArray<z.ZodObject<{
4841
+ name: z.ZodString;
4842
+ type: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<"validation" | "custom" | "auth" | "errorHandler" | "cors" | "rateLimit" | "logging", string>>, z.ZodEnum<{
4843
+ validation: "validation";
4844
+ custom: "custom";
4845
+ auth: "auth";
4846
+ errorHandler: "errorHandler";
4847
+ cors: "cors";
4848
+ rateLimit: "rateLimit";
4849
+ logging: "logging";
4850
+ }>>;
4851
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4852
+ }, z.core.$strip>>>;
4853
+ envVars: z.ZodDefault<z.ZodArray<z.ZodString>>;
4854
+ }, z.core.$strip>;
4855
+ type TExpressConfig = z.infer<typeof expressConfigSchema>;
4856
+
4857
+ /**
4858
+ * express-builder module types
4859
+ */
4860
+
4861
+ interface ExpressBuilderAgentConfig {
4862
+ /** Data model, API design, and project requirements */
4863
+ input: string;
4864
+ /** Model config; optional */
4865
+ model?: ModelConfig;
4866
+ /** Max iterations; default 15 */
4867
+ maxIterations?: number;
4868
+ /** Callback for each step */
4869
+ onStep?: (step: AgentStep) => void;
4870
+ /** Optional logger for execution logs */
4871
+ logger?: Logger;
4872
+ }
4873
+
4874
+ /**
4875
+ * System prompt for express-builder orchestrator
4876
+ */
4877
+ declare const EXPRESS_BUILDER_SYSTEM_PROMPT = "You are an expert Express.js backend architect.\n\nYou generate production-ready Express application configurations from data models and API designs:\n- Co-located router pattern: each feature lives in src/routers/{name}/ with {name}.controller.ts, {name}.router.ts, and {name}.spec.ts\n- Mongoose/Prisma models with field types, validation, and relationships\n- Middleware stack (auth JWT, validation Zod, error handler, CORS, rate limiting)\n- Route organization with proper HTTP methods and paths\n- Health check endpoint at /health (included by default)\n- Jest tests per router using supertest\n- Environment variable inventory\n\nOutput only valid JSON unless instructed otherwise.";
4878
+
4879
+ /**
4880
+ * Design prompt for Express config generation
4881
+ */
4882
+ declare const DESIGN_EXPRESS_PROMPT = "## Requirements:\n{requirement}\n\nGenerate an Express.js application configuration. Include:\n\n1. Routers: one per resource, co-located with controller and test spec. Each router has RESTful methods (GET, POST, PUT, DELETE).\n2. Health check: a default /health router is always included.\n3. Models: Mongoose models with fields, types, required, unique, refs, defaults, indexes.\n4. Middleware: auth (JWT), validation (Zod), error handler, CORS, rate limiting, logging.\n5. Env vars: PORT, DATABASE_URL, JWT_SECRET, NODE_ENV, etc.\n6. Folder structure: src/routers/{name}/ with {name}.controller.ts, {name}.router.ts, {name}.spec.ts per feature.\n\nReturn ONLY valid JSON:\n{\n \"appName\": \"my-api\",\n \"port\": 3000,\n \"database\": \"mongodb\",\n \"routers\": [{\n \"name\": \"users\",\n \"resource\": \"users\",\n \"basePath\": \"/api/users\",\n \"methods\": [{\n \"name\": \"getAll\",\n \"httpMethod\": \"GET\",\n \"path\": \"/\",\n \"auth\": true,\n \"roles\": [\"admin\"],\n \"validation\": \"\",\n \"description\": \"Get all users with pagination\"\n }]\n }],\n \"models\": [{\n \"name\": \"User\",\n \"collection\": \"users\",\n \"fields\": [{ \"name\": \"email\", \"type\": \"String\", \"required\": true, \"unique\": true }],\n \"timestamps\": true,\n \"indexes\": [\"email\"]\n }],\n \"middleware\": [{ \"name\": \"authMiddleware\", \"type\": \"auth\", \"config\": {} }],\n \"envVars\": [\"PORT\", \"DATABASE_URL\", \"JWT_SECRET\", \"NODE_ENV\"]\n}";
4883
+ declare function buildDesignExpressPrompt(requirement: string): string;
4884
+
4885
+ /**
4886
+ * validate_express tool - validates JSON against expressConfigSchema (no AI)
4887
+ */
4888
+ declare const validateExpressTool: ai.Tool;
4889
+
4890
+ /**
4891
+ * Creates the generate_express tool for Express config generation.
4892
+ */
4893
+ declare function createGenerateExpressTool(model: Model): ai.Tool;
4894
+
4895
+ /**
4896
+ * scaffold_express tool - compiles .ref/templates/express/ with config
4897
+ */
4898
+ declare const scaffoldExpressTool: ai.Tool;
4899
+
4900
+ /**
4901
+ * Create all express-builder tools. Pass the model for AI-backed tools.
4902
+ */
4903
+ declare function createExpressBuilderTools(model: Model): ToolSet;
4904
+
4905
+ /**
4906
+ * route-generator subagent - generates route files from API design
4907
+ */
4908
+ declare const routeGeneratorSubagent: SubagentDefinition;
4909
+
4910
+ /**
4911
+ * middleware-configurator subagent - designs middleware stack
4912
+ */
4913
+ declare const middlewareConfiguratorSubagent: SubagentDefinition;
4914
+
4915
+ /**
4916
+ * runExpressBuilderAgent - orchestrator for Express.js project generation
4917
+ */
4918
+
4919
+ /**
4920
+ * Run the express-builder orchestrator agent.
4921
+ */
4922
+ declare function runExpressBuilderAgent(config: ExpressBuilderAgentConfig): Promise<AgentResult>;
4923
+
4924
+ /**
4925
+ * Zod schemas for Next.js application configuration
4926
+ */
4927
+
4928
+ declare const nextjsPageSchema: z.ZodObject<{
4929
+ path: z.ZodString;
4930
+ name: z.ZodString;
4931
+ access: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4932
+ public: "public";
4933
+ protected: "protected";
4934
+ }>>;
4935
+ routeGroup: z.ZodDefault<z.ZodString>;
4936
+ purpose: z.ZodString;
4937
+ hasForm: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4938
+ formFields: z.ZodDefault<z.ZodArray<z.ZodString>>;
4939
+ dataFetching: z.ZodDefault<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4940
+ client: "client";
4941
+ server: "server";
4942
+ hybrid: "hybrid";
4943
+ }>>>;
4944
+ actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
4945
+ }, z.core.$strip>;
4946
+ declare const nextjsLayoutSchema: z.ZodObject<{
4947
+ name: z.ZodString;
4948
+ path: z.ZodString;
4949
+ routeGroup: z.ZodDefault<z.ZodString>;
4950
+ components: z.ZodDefault<z.ZodArray<z.ZodString>>;
4951
+ purpose: z.ZodString;
4952
+ }, z.core.$strip>;
4953
+ declare const nextjsApiRouteSchema: z.ZodObject<{
4954
+ path: z.ZodString;
4955
+ methods: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4956
+ DELETE: "DELETE";
4957
+ GET: "GET";
4958
+ POST: "POST";
4959
+ PUT: "PUT";
4960
+ PATCH: "PATCH";
4961
+ }>>>>;
4962
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4963
+ description: z.ZodString;
4964
+ }, z.core.$strip>;
4965
+ declare const serverActionSchema: z.ZodObject<{
4966
+ name: z.ZodString;
4967
+ module: z.ZodString;
4968
+ description: z.ZodString;
4969
+ revalidates: z.ZodDefault<z.ZodArray<z.ZodString>>;
4970
+ }, z.core.$strip>;
4971
+ declare const nextjsConfigSchema: z.ZodObject<{
4972
+ appName: z.ZodDefault<z.ZodString>;
4973
+ pages: z.ZodDefault<z.ZodArray<z.ZodObject<{
4974
+ path: z.ZodString;
4975
+ name: z.ZodString;
4976
+ access: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4977
+ public: "public";
4978
+ protected: "protected";
4979
+ }>>;
4980
+ routeGroup: z.ZodDefault<z.ZodString>;
4981
+ purpose: z.ZodString;
4982
+ hasForm: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
4983
+ formFields: z.ZodDefault<z.ZodArray<z.ZodString>>;
4984
+ dataFetching: z.ZodDefault<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
4985
+ client: "client";
4986
+ server: "server";
4987
+ hybrid: "hybrid";
4988
+ }>>>;
4989
+ actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
4990
+ }, z.core.$strip>>>;
4991
+ layouts: z.ZodDefault<z.ZodArray<z.ZodObject<{
4992
+ name: z.ZodString;
4993
+ path: z.ZodString;
4994
+ routeGroup: z.ZodDefault<z.ZodString>;
4995
+ components: z.ZodDefault<z.ZodArray<z.ZodString>>;
4996
+ purpose: z.ZodString;
4997
+ }, z.core.$strip>>>;
4998
+ apiRoutes: z.ZodDefault<z.ZodArray<z.ZodObject<{
4999
+ path: z.ZodString;
5000
+ methods: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
5001
+ DELETE: "DELETE";
5002
+ GET: "GET";
5003
+ POST: "POST";
5004
+ PUT: "PUT";
5005
+ PATCH: "PATCH";
5006
+ }>>>>;
5007
+ auth: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
5008
+ description: z.ZodString;
5009
+ }, z.core.$strip>>>;
5010
+ serverActions: z.ZodDefault<z.ZodArray<z.ZodObject<{
5011
+ name: z.ZodString;
5012
+ module: z.ZodString;
5013
+ description: z.ZodString;
5014
+ revalidates: z.ZodDefault<z.ZodArray<z.ZodString>>;
5015
+ }, z.core.$strip>>>;
5016
+ middleware: z.ZodDefault<z.ZodArray<z.ZodString>>;
5017
+ envVars: z.ZodDefault<z.ZodArray<z.ZodString>>;
5018
+ packages: z.ZodDefault<z.ZodArray<z.ZodString>>;
5019
+ }, z.core.$strip>;
5020
+ type TNextjsConfig = z.infer<typeof nextjsConfigSchema>;
5021
+
5022
+ /**
5023
+ * nextjs-builder module types
5024
+ */
5025
+
5026
+ interface NextjsBuilderAgentConfig {
5027
+ /** Frontend design, API design, and project requirements */
5028
+ input: string;
5029
+ /** Model config; optional */
5030
+ model?: ModelConfig;
5031
+ /** Max iterations; default 15 */
5032
+ maxIterations?: number;
5033
+ /** Callback for each step */
5034
+ onStep?: (step: AgentStep) => void;
5035
+ /** Optional logger for execution logs */
5036
+ logger?: Logger;
5037
+ }
5038
+
5039
+ /**
5040
+ * System prompt for nextjs-builder orchestrator
5041
+ */
5042
+ declare const NEXTJS_BUILDER_SYSTEM_PROMPT = "You are an expert Next.js application architect using the App Router.\n\nYou generate production-ready Next.js configurations from frontend designs and API designs:\n- App Router file structure with route groups, layouts, pages, loading, and error boundaries\n- Server Components by default, Client Components only when interactivity is needed\n- Server Actions for mutations (form submissions, data writes)\n- API Route Handlers for external integrations, webhooks, and file uploads\n- Next.js middleware for auth guards and redirects\n- Data fetching strategy (server vs client vs hybrid per page)\n- Package recommendations (next-auth, prisma, tailwindcss, shadcn/ui)\n\nOutput only valid JSON unless instructed otherwise.";
5043
+
5044
+ /**
5045
+ * Design prompt for Next.js config generation
5046
+ */
5047
+ declare const DESIGN_NEXTJS_PROMPT = "## Requirements:\n{requirement}\n\nGenerate a Next.js App Router application configuration. Include:\n\n1. Pages: app router pages with path, name, access level, route group, purpose, data fetching strategy.\n2. Layouts: shared layouts with route groups (e.g. (auth), (dashboard)), components they include.\n3. API Routes: route handlers with path, HTTP methods, auth requirement, description.\n4. Server Actions: named actions with module, description, and paths they revalidate.\n5. Middleware: list of middleware behaviors (e.g. \"redirect unauthenticated to /login\").\n6. Env vars: NEXTAUTH_SECRET, DATABASE_URL, etc.\n7. Packages: recommended npm packages.\n\nReturn ONLY valid JSON:\n{\n \"appName\": \"my-app\",\n \"pages\": [{\n \"path\": \"/dashboard\",\n \"name\": \"Dashboard\",\n \"access\": \"protected\",\n \"routeGroup\": \"(dashboard)\",\n \"purpose\": \"Main dashboard with stats\",\n \"hasForm\": false,\n \"formFields\": [],\n \"dataFetching\": \"server\",\n \"actions\": []\n }],\n \"layouts\": [{\n \"name\": \"DashboardLayout\",\n \"path\": \"app/(dashboard)/layout.tsx\",\n \"routeGroup\": \"(dashboard)\",\n \"components\": [\"Sidebar\", \"Header\"],\n \"purpose\": \"Shared layout for authenticated pages\"\n }],\n \"apiRoutes\": [{\n \"path\": \"/api/users\",\n \"methods\": [\"GET\", \"POST\"],\n \"auth\": true,\n \"description\": \"User CRUD endpoints\"\n }],\n \"serverActions\": [{\n \"name\": \"createUser\",\n \"module\": \"users\",\n \"description\": \"Create a new user\",\n \"revalidates\": [\"/dashboard/users\"]\n }],\n \"middleware\": [\"Redirect unauthenticated users to /login\"],\n \"envVars\": [\"DATABASE_URL\", \"NEXTAUTH_SECRET\"],\n \"packages\": [\"next-auth\", \"prisma\", \"@prisma/client\", \"tailwindcss\"]\n}";
5048
+ declare function buildDesignNextjsPrompt(requirement: string): string;
5049
+
5050
+ /**
5051
+ * validate_nextjs tool - validates JSON against nextjsConfigSchema (no AI)
5052
+ */
5053
+ declare const validateNextjsTool: ai.Tool;
5054
+
5055
+ /**
5056
+ * Creates the generate_nextjs tool for Next.js config generation.
5057
+ */
5058
+ declare function createGenerateNextjsTool(model: Model): ai.Tool;
5059
+
5060
+ /**
5061
+ * Create all nextjs-builder tools. Pass the model for AI-backed tools.
5062
+ */
5063
+ declare function createNextjsBuilderTools(model: Model): ToolSet;
5064
+
5065
+ /**
5066
+ * route-planner subagent - plans Next.js App Router file structure
5067
+ */
5068
+ declare const routePlannerSubagent: SubagentDefinition;
5069
+
5070
+ /**
5071
+ * api-route-generator subagent - generates Next.js API routes and server actions
5072
+ */
5073
+ declare const apiRouteGeneratorSubagent: SubagentDefinition;
5074
+
5075
+ /**
5076
+ * runNextjsBuilderAgent - orchestrator for Next.js project generation
5077
+ */
5078
+
5079
+ /**
5080
+ * Run the nextjs-builder orchestrator agent.
5081
+ */
5082
+ declare function runNextjsBuilderAgent(config: NextjsBuilderAgentConfig): Promise<AgentResult>;
5083
+
5084
+ export { API_DESIGNER_SYSTEM_PROMPT, APOLLO_BUILDER_SYSTEM_PROMPT, AUTH_DESIGNER_SYSTEM_PROMPT, type Actor$1 as Actor, type ActorResult, type ApiDesign as AdApiDesign, type GraphqlOperation as AdGraphqlOperation, type RestEndpoint as AdRestEndpoint, type AgentConfig, AgentError, type AgentObserver, type AgentResult, type AgentStep, type AgentTool, type AgentToolResult, type ApiDesign$2 as ApiDesign, type ApiDesignerAgentConfig, ApiResponseTypeSchema, type ApiStyle, type ApolloBuilderAgentConfig, AppConfigSchema, type AppInfo, ApplicationSchema, type AuthDesign, type AuthDesignerAgentConfig, type AuthFlow, type AuthFlowStep, type AuthMiddleware, AuthPageApiSchema, AuthPageSchema, type AuthStrategy, BACKEND_ARCHITECT_SYSTEM_PROMPT, type BackendArchitectAgentConfig, BaseMcpClient, type BasicProjectInfo, BrandingSchema, CREATE_EXECUTION_PLAN_PROMPT, type ChatEntry$2 as ChatEntry, type ChatTurnResult, ColumnSchema, type ComponentDesign, type CreateSubagentToolOptions, CreateUserInputSchema, type CrudApi, DATA_MODELER_SYSTEM_PROMPT, DB_DESIGN_SYSTEM_PROMPT, DESIGN_APIS_SYSTEM_PROMPT, DESIGN_AUTH_PROMPT, DESIGN_BACKEND_PROMPT, DESIGN_DATABASE_SYSTEM_PROMPT, DESIGN_EXPRESS_PROMPT, DESIGN_FRONTEND_PROMPT, DESIGN_NEXTJS_PROMPT, DESIGN_SUBGRAPH_PROMPT, DISCOVERY_SYSTEM_FRAGMENT, DISCOVERY_USER_PROMPT, type DataEntity, type DataModelDesign, type DataModelerAgentConfig, type DatabaseDesign$1 as DatabaseDesign, type DatabaseEntity$1 as DatabaseEntity, type DatabaseType, type DbDesignerAgentConfig, type EntityField as DmEntityField, type EntityIndex as DmEntityIndex, type EntityRelation as DmEntityRelation, DrawerSchema, EXAMPLE_GRAPHQL_SCHEMA, EXAMPLE_JSON_OUTPUT, EXECUTION_PLANNER_SYSTEM_PROMPT, EXPRESS_BUILDER_SYSTEM_PROMPT, EXTRACT_ACTORS_PROMPT, EXTRACT_MODULES_PROMPT, type EdgeCase, type EditPlanConfig, type EntityField$2 as EntityField, type EntityIndex$2 as EntityIndex, type EntityRelation$2 as EntityRelation, type ExecutionPlan, type ExecutionPlannerAgentConfig, type ExpressBuilderAgentConfig, type ExtractedFlow, type ExtractedModule, type ExtractedStory, FRONTEND_ARCHITECT_SYSTEM_PROMPT, type FeatureBreakdownResult, FieldOptionsSchema, type FinalRequirement, type FlowsResult, ForgotPasswordSchema, type FormField, FormFieldSchema, type FrontendArchitectAgentConfig, type FrontendDesign, GENERATE_FLOWS_PROMPT, GENERATE_STORIES_PROMPT, type GraphqlApiDesign$1 as GraphqlApiDesign, type GraphqlOperation$2 as GraphqlOperation, type GraphqlTypeDefinition$1 as GraphqlTypeDefinition, type HelloWorldAgentConfig, type HttpMethod, type ImageInput, type ImplementationPhase, type InvokeObjectOptions, type InvokeObjectResult, 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, type Module, ModuleSchema, type ModulesResult, NEXTJS_BUILDER_SYSTEM_PROMPT, type NextjsBuilderAgentConfig, PLANNING_SYSTEM_PROMPT, type PageAccess, type PageDesign, PageSchema, type PhaseStep, type PlanChatTurnResult, type PlanSections, type PlanStageResult, type PlanningAgentConfig, type PlanningChatConfig, type ChatEntry as PlanningChatEntry, type PlanningContext, PlanningContextBuilder, type Stage as PlanningStage, type ProjectBrief, type Question$1 as Question, REACT_BUILDER_INSTRUCTION, REACT_BUILDER_SYSTEM_PROMPT, REQUIREMENT_GATHERER_SYSTEM_PROMPT, type ReactBuilderAgentConfig, type RequirementChatConfig, type RequirementContext, RequirementContextBuilder, type RequirementGathererAgentConfig, type RequirementSummary$1 as RequirementSummary, ResetPasswordSchema, type RestApiDesign$1 as RestApiDesign, type RestEndpoint$2 as RestEndpoint, type RoleDefinition, type RunSubagentOptions, SYNTHESIS_SYSTEM_FRAGMENT, SYNTHESIS_USER_PROMPT, type ScaffoldConfig, type ScaffoldError, type ScaffoldResult, type SecurityPolicy, SpecializationSchema, type Stage$1 as Stage, type StageInput, type StoriesResult, type StructuredRequirementsInput, type SubagentConfig, type SubagentDefinition, SubagentError, type SubagentResult, type TApiDesign, type TApiResponseTypeSchema, type TAppConfigSchema, type TApplicationSchema, type TAuthDesign, type TBackendDesign, type TBackendProjectSchema, type TBrandingSchema, type TColumnSchema, type TCreateUserInputSchema, type TDataModelDesign, type TExecutionPlan, type TExpressConfig, type TFieldSchema, type TForgotPasswordSchema, type TFormFieldSchema, type TFrontendDesign, type TLoginInputSchema, type TModuleSchema$1 as TModuleSchema, type TNextjsConfig, type TPageSchema, type TModuleSchema as TReactModuleSchema, type TResetPasswordSchema, type TSpecializationSchema, type TSubgraphConfig, type TUpdateUserInputSchema, type TUserSchema, type TechnicalRequirements, type TemplateAuth, type TemplateBranding, type TemplateContext, type TemplateField, type TemplateModule, type TemplateOperation, type TestChecklistItem, type ToolConfig, type ToolContext, ToolError, type ToolExecutionResult, type ToolLogger, type ToolSet, UpdateUserInputSchema, UserSchema, ValidationError, ValidationSchema, type VisionOptions, actorSchema, actorsResultSchema, apiDesignSchema as adApiDesignSchema, graphqlOperationSchema as adGraphqlOperationSchema, restEndpointSchema as adRestEndpointSchema, addChatEntry, advanceStage, apiDesignSchema$1 as apiDesignSchema, apiRouteGeneratorSubagent, assemblePlan, authDesignSchema, authFlowSchema, authFlowStepSchema, authMiddlewareSchema, backendDesignSchema, buildCreateExecutionPlanPrompt, buildDesignApisPrompt, buildDesignAuthPrompt, buildDesignBackendPrompt, buildDesignDatabasePrompt, buildDesignExpressPrompt, buildDesignFrontendPrompt, buildDesignNextjsPrompt, buildDesignSubgraphPrompt, buildDiscoveryPrompt, buildExampleShotPrompt, buildExtractActorsPrompt, buildExtractModulesPrompt, buildFeedbackPrompt, buildGenerateFlowsPrompt, buildGenerateStoriesPrompt, buildInstructionPrompt, buildPromptVariables, buildSynthesisPrompt, chatEntrySchema, compileTemplate, componentAnalyzerSubagent, componentDesignSchema, contractDesignerSubagent, createAnthropicModel, createApiDesignerTools, createApolloBuilderTools, createAuthDesignerTools, createBackendArchitectTools, createConfigValidatorSubagent, createDataModelerTools, createDbDesignPrompt, createDbDesignerTools, createDesignApiProTool, createDesignApiTool, createDesignAuthTool, createDesignBackendTool, createDesignDatabaseProTool, createDesignDatabaseTool, createDesignFrontendTool, createDesignSchemaProTool, createDesignSchemaTool, createExecutionPlanTool, createExecutionPlannerTools, createExpressBuilderTools, createFrontendArchitectTools, createGenerateExpressTool, createGenerateFeatureBreakdownTool, createGenerateFrontendTool, createGenerateNextjsTool, createGenerateSubgraphTool, createGoogleModel, createInitialContext, createLogger, createModel, createNextjsBuilderTools, createOpenAIModel, createPlanningContextBuilder, createProDbDesignPrompt, createReactBuilderTools, createRedesignDatabaseTool, createRedesignPrompt, createRefineSchemaTools, createRequirementContextBuilder, createSchemaRefinerSubagent$1 as createSchemaRefinerSubagent, createSubagentTool, createSubagentToolSet, createToolSet, crudApiSchema, databaseDesignSchema, databaseEntitySchema, defineSubagent, defineTool, createSchemaRefinerSubagent as dmCreateSchemaRefinerSubagent, dataEntitySchema as dmDataEntitySchema, dataModelDesignSchema as dmDataModelDesignSchema, entityAnalyzerSubagent as dmEntityAnalyzerSubagent, validateSchemaTool as dmValidateSchemaTool, edgeCaseAnalyzerSubagent, edgeCaseSchema, editPlan, endpointAnalyzerSubagent, entityAnalyzerSubagent$1 as entityAnalyzerSubagent, entityFieldSchema, entityIndexSchema, entityRelationSchema, executeTool, executeToolByName, executionPlanSchema, expressConfigSchema, extractDataEntities, extractJson, extractRoles, extractedModuleSchema, fieldSchema, finalRequirementSchema, flowDesignerSubagent, flowSchema, flowsResultSchema, formFieldSchema, formatTechnicalRequirements, formatUserFlows, formatUserStories, formatUserTypes, frameworkSelectorSubagent, frontendDesignSchema, getTool, getTools, graphqlAnalyzerSubagent, graphqlApiDesignSchema, graphqlFieldSchema, graphqlOperationSchema$1 as graphqlOperationSchema, graphqlTypeDefinitionSchema, graphqlTypeSchema, helloWorldTool, implementationPhaseSchema, loggerConfigFromEnv, mergeStageResult, middlewareConfigSchema, middlewareConfiguratorSubagent, middlewareSchema, modelFieldSchema, modelSchema, moduleSchema, modulesResultSchema, nextjsApiRouteSchema, nextjsConfigSchema, nextjsLayoutSchema, nextjsPageSchema, pageDesignSchema, pagePlannerSubagent, parseModelJsonResponse, phaseStepSchema, processPlanningChat, processRequirementChat, projectBriefSchema, projectSchema, questionSchema, registerHelpers, relationshipMapperSubagent, requirementContextSchema, requirementSummarySchema, resolverOperationSchema, resolverPlannerSubagent, restApiDesignSchema, restEndpointSchema$1 as restEndpointSchema, roleDefinitionSchema, routeGeneratorSubagent, routeGroupSchema, routePlannerSubagent, routerMethodSchema, routerSchema, runAgent, runApiDesignerAgent, runApolloBuilderAgent, runAuthDesignerAgent, runBackendArchitectAgent, runDataModelerAgent, runDbDesignerAgent, runExecutionPlannerAgent, runExpressBuilderAgent, runFrontendArchitectAgent, runHelloWorldAgent, runNextjsBuilderAgent, runPlanningAgent, runReactBuilderAgent, runRequirementGathererAgent, runSubagent, safeJsonParse, scaffoldExpressTool, scaffoldProject, scaffoldSubgraphTool, schemaGeneratorSubagent, securityAnalyzerSubagent, securityPolicySchema, serverActionSchema, servicePlannerSubagent, serviceSchema, storiesResultSchema, storySchema, subgraphConfigSchema, subgraphModuleSchema, sumTokenUsage, testChecklistItemSchema, testingStrategistSubagent, validateApiTool, validateAuthTool, validateBackendTool, validateExecutionPlanTool, validateExpressTool, validateFrontendConfigTool, validateFrontendTool, validateNextjsTool, validateSchemaTool$1 as validateSchemaTool, validateSubgraphTool, writePlanToFile };