@objectql/core 1.7.2 → 1.8.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @objectql/core
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Release minor version 1.8.0
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @objectql/types@1.8.0
13
+
14
+ ## 1.7.3
15
+
16
+ ### Patch Changes
17
+
18
+ - Release patch version 1.7.3 with latest improvements and bug fixes
19
+ - Updated dependencies
20
+ - @objectql/types@1.7.3
21
+
3
22
  ## 1.7.2
4
23
 
5
24
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 ObjectQL Contributors
3
+ Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,175 @@
1
+ /**
2
+ * ObjectQL AI Agent - Programmatic API for AI-powered application generation
3
+ *
4
+ * This module provides a high-level API for using AI to generate and validate
5
+ * ObjectQL metadata programmatically.
6
+ */
7
+ /**
8
+ * Configuration for the ObjectQL AI Agent
9
+ */
10
+ export interface AgentConfig {
11
+ /** OpenAI API key */
12
+ apiKey: string;
13
+ /** OpenAI model to use (default: gpt-4) */
14
+ model?: string;
15
+ /** Temperature for generation (0-1, default: 0.7) */
16
+ temperature?: number;
17
+ /** Preferred language for messages (default: en) */
18
+ language?: string;
19
+ }
20
+ /**
21
+ * Options for generating application metadata
22
+ */
23
+ export interface GenerateAppOptions {
24
+ /** Natural language description of the application */
25
+ description: string;
26
+ /** Type of generation: basic (minimal), complete (comprehensive), or custom */
27
+ type?: 'basic' | 'complete' | 'custom';
28
+ /** Maximum tokens for generation */
29
+ maxTokens?: number;
30
+ }
31
+ /**
32
+ * Result of application generation
33
+ */
34
+ export interface GenerateAppResult {
35
+ /** Whether generation was successful */
36
+ success: boolean;
37
+ /** Generated metadata files */
38
+ files: Array<{
39
+ filename: string;
40
+ content: string;
41
+ type: 'object' | 'validation' | 'form' | 'view' | 'page' | 'menu' | 'action' | 'hook' | 'permission' | 'workflow' | 'report' | 'data' | 'application' | 'typescript' | 'test' | 'other';
42
+ }>;
43
+ /** Any errors encountered */
44
+ errors?: string[];
45
+ /** AI model response (raw) */
46
+ rawResponse?: string;
47
+ }
48
+ /**
49
+ * Conversation message for step-by-step generation
50
+ */
51
+ export interface ConversationMessage {
52
+ role: 'system' | 'user' | 'assistant';
53
+ content: string;
54
+ }
55
+ /**
56
+ * Options for conversational generation
57
+ */
58
+ export interface ConversationalGenerateOptions {
59
+ /** Initial description or follow-up request */
60
+ message: string;
61
+ /** Previous conversation history */
62
+ conversationHistory?: ConversationMessage[];
63
+ /** Current application state (already generated files) */
64
+ currentApp?: GenerateAppResult;
65
+ }
66
+ /**
67
+ * Result of conversational generation
68
+ */
69
+ export interface ConversationalGenerateResult extends GenerateAppResult {
70
+ /** Updated conversation history */
71
+ conversationHistory: ConversationMessage[];
72
+ /** Suggested next steps or questions */
73
+ suggestions?: string[];
74
+ }
75
+ /**
76
+ * Options for validating metadata
77
+ */
78
+ export interface ValidateMetadataOptions {
79
+ /** Metadata content (YAML string or parsed object) */
80
+ metadata: string | any;
81
+ /** Filename (for context) */
82
+ filename?: string;
83
+ /** Whether to check business logic consistency */
84
+ checkBusinessLogic?: boolean;
85
+ /** Whether to check performance considerations */
86
+ checkPerformance?: boolean;
87
+ /** Whether to check security issues */
88
+ checkSecurity?: boolean;
89
+ }
90
+ /**
91
+ * Result of metadata validation
92
+ */
93
+ export interface ValidateMetadataResult {
94
+ /** Whether validation passed (no errors) */
95
+ valid: boolean;
96
+ /** Errors found */
97
+ errors: Array<{
98
+ message: string;
99
+ location?: string;
100
+ code?: string;
101
+ }>;
102
+ /** Warnings found */
103
+ warnings: Array<{
104
+ message: string;
105
+ location?: string;
106
+ suggestion?: string;
107
+ }>;
108
+ /** Informational messages */
109
+ info: Array<{
110
+ message: string;
111
+ location?: string;
112
+ }>;
113
+ }
114
+ /**
115
+ * ObjectQL AI Agent for programmatic application generation and validation
116
+ */
117
+ export declare class ObjectQLAgent {
118
+ private openai;
119
+ private validator;
120
+ private config;
121
+ constructor(config: AgentConfig);
122
+ /**
123
+ * Generate application metadata from natural language description
124
+ */
125
+ generateApp(options: GenerateAppOptions): Promise<GenerateAppResult>;
126
+ /**
127
+ * Validate metadata using AI
128
+ */
129
+ validateMetadata(options: ValidateMetadataOptions): Promise<ValidateMetadataResult>;
130
+ /**
131
+ * Refine existing metadata based on feedback
132
+ */
133
+ refineMetadata(metadata: string, feedback: string, iterations?: number): Promise<GenerateAppResult>;
134
+ /**
135
+ * Conversational generation with step-by-step refinement
136
+ * This allows users to iteratively improve the application through dialogue
137
+ */
138
+ generateConversational(options: ConversationalGenerateOptions): Promise<ConversationalGenerateResult>;
139
+ /**
140
+ * Generate suggestions for next steps based on current application state
141
+ */
142
+ private generateSuggestions;
143
+ /**
144
+ * Get system prompt for metadata generation
145
+ */
146
+ private getSystemPrompt;
147
+ /**
148
+ * Get system prompt for validation
149
+ */
150
+ private getValidationSystemPrompt;
151
+ /**
152
+ * Build generation prompt based on options
153
+ */
154
+ private buildGenerationPrompt;
155
+ /**
156
+ * Build validation prompt
157
+ */
158
+ private buildValidationPrompt;
159
+ /**
160
+ * Parse generation response and extract files
161
+ */
162
+ private parseGenerationResponse;
163
+ /**
164
+ * Parse validation feedback into structured result
165
+ */
166
+ private parseFeedback;
167
+ /**
168
+ * Infer file type from filename
169
+ */
170
+ private inferFileType;
171
+ }
172
+ /**
173
+ * Convenience function to create an agent instance
174
+ */
175
+ export declare function createAgent(apiKey: string, options?: Partial<AgentConfig>): ObjectQLAgent;