orchid-ai 1.0.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/README.md +225 -0
- package/dist/components/ChatPanel.d.ts +123 -0
- package/dist/components/Conversation.d.ts +75 -0
- package/dist/components/ErrorBoundary.d.ts +16 -0
- package/dist/components/Icon.d.ts +84 -0
- package/dist/components/ModelSwitcher.d.ts +24 -0
- package/dist/components/SuggestionsPanel.d.ts +27 -0
- package/dist/constants.d.ts +353 -0
- package/dist/hooks/useAiMerge.d.ts +20 -0
- package/dist/hooks/useModelSwitcher.d.ts +65 -0
- package/dist/hooks/useStreamingAI.d.ts +29 -0
- package/dist/hooks/useSuggestions.d.ts +48 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.esm.js +3385 -0
- package/dist/index.js +3400 -0
- package/dist/server/components/ChatPanel.d.ts +123 -0
- package/dist/server/components/Conversation.d.ts +75 -0
- package/dist/server/components/ErrorBoundary.d.ts +16 -0
- package/dist/server/components/Icon.d.ts +84 -0
- package/dist/server/components/ModelSwitcher.d.ts +24 -0
- package/dist/server/components/SuggestionsPanel.d.ts +27 -0
- package/dist/server/constants.d.ts +353 -0
- package/dist/server/contextual-service.d.ts +59 -0
- package/dist/server/document-processor.d.ts +60 -0
- package/dist/server/hooks/useAiMerge.d.ts +20 -0
- package/dist/server/hooks/useModelSwitcher.d.ts +65 -0
- package/dist/server/hooks/useStreamingAI.d.ts +29 -0
- package/dist/server/hooks/useSuggestions.d.ts +48 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.esm.js +14008 -0
- package/dist/server/index.js +14019 -0
- package/dist/server/server/contextual-service.d.ts +59 -0
- package/dist/server/server/document-processor.d.ts +60 -0
- package/dist/server/server/index.d.ts +7 -0
- package/dist/server/server/server.d.ts +32 -0
- package/dist/server/server/service.d.ts +267 -0
- package/dist/server/server/training-schema.d.ts +17 -0
- package/dist/server/server/training.d.ts +231 -0
- package/dist/server/server/utils.d.ts +209 -0
- package/dist/server/server.d.ts +32 -0
- package/dist/server/service.d.ts +267 -0
- package/dist/server/training-schema.d.ts +17 -0
- package/dist/server/training.d.ts +231 -0
- package/dist/server/types/types.d.ts +481 -0
- package/dist/server/utils/fileHandler.d.ts +20 -0
- package/dist/server/utils/mergeWithAi.d.ts +19 -0
- package/dist/server/utils.d.ts +209 -0
- package/dist/types/types.d.ts +481 -0
- package/dist/utils/fileHandler.d.ts +20 -0
- package/dist/utils/mergeWithAi.d.ts +19 -0
- package/dist/utils.d.ts +19 -0
- package/package.json +137 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
export interface CommandSuggestion {
|
|
2
|
+
action?: string;
|
|
3
|
+
actionType: Action;
|
|
4
|
+
path?: string;
|
|
5
|
+
queryParams?: Record<string, string>;
|
|
6
|
+
formState?: Record<string, unknown>;
|
|
7
|
+
message?: string;
|
|
8
|
+
user?: User;
|
|
9
|
+
initials?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
shortcut?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CommandPopupProps {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
userId: string;
|
|
19
|
+
setFormState: (state: Record<string, unknown>) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface User {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
email: string;
|
|
25
|
+
initials: string;
|
|
26
|
+
color: string;
|
|
27
|
+
}
|
|
28
|
+
export interface CommandTheme {
|
|
29
|
+
primary: string;
|
|
30
|
+
primaryHover: string;
|
|
31
|
+
primaryLight: string;
|
|
32
|
+
secondary: string;
|
|
33
|
+
secondaryHover: string;
|
|
34
|
+
background: string;
|
|
35
|
+
backgroundSecondary: string;
|
|
36
|
+
backgroundTertiary: string;
|
|
37
|
+
textPrimary: string;
|
|
38
|
+
textSecondary: string;
|
|
39
|
+
textTertiary: string;
|
|
40
|
+
textInverse: string;
|
|
41
|
+
borderPrimary: string;
|
|
42
|
+
borderSecondary: string;
|
|
43
|
+
success: string;
|
|
44
|
+
warning: string;
|
|
45
|
+
error: string;
|
|
46
|
+
info: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ChatTheme {
|
|
49
|
+
colors: {
|
|
50
|
+
primary: {
|
|
51
|
+
50: string;
|
|
52
|
+
100: string;
|
|
53
|
+
400: string;
|
|
54
|
+
500: string;
|
|
55
|
+
600: string;
|
|
56
|
+
700: string;
|
|
57
|
+
800: string;
|
|
58
|
+
900: string;
|
|
59
|
+
};
|
|
60
|
+
background: {
|
|
61
|
+
primary: string;
|
|
62
|
+
secondary: string;
|
|
63
|
+
tertiary: string;
|
|
64
|
+
};
|
|
65
|
+
text: {
|
|
66
|
+
primary: string;
|
|
67
|
+
secondary: string;
|
|
68
|
+
tertiary: string;
|
|
69
|
+
inverse: string;
|
|
70
|
+
};
|
|
71
|
+
border: {
|
|
72
|
+
primary: string;
|
|
73
|
+
secondary: string;
|
|
74
|
+
};
|
|
75
|
+
surface: {
|
|
76
|
+
primary: string;
|
|
77
|
+
secondary: string;
|
|
78
|
+
tertiary: string;
|
|
79
|
+
elevated: string;
|
|
80
|
+
};
|
|
81
|
+
state: {
|
|
82
|
+
error: {
|
|
83
|
+
background: string;
|
|
84
|
+
border: string;
|
|
85
|
+
text: string;
|
|
86
|
+
};
|
|
87
|
+
warning: {
|
|
88
|
+
background: string;
|
|
89
|
+
border: string;
|
|
90
|
+
text: string;
|
|
91
|
+
};
|
|
92
|
+
success: {
|
|
93
|
+
background: string;
|
|
94
|
+
border: string;
|
|
95
|
+
text: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
spacing: {
|
|
100
|
+
xs: string;
|
|
101
|
+
sm: string;
|
|
102
|
+
md: string;
|
|
103
|
+
lg: string;
|
|
104
|
+
xl: string;
|
|
105
|
+
};
|
|
106
|
+
borderRadius: {
|
|
107
|
+
sm: string;
|
|
108
|
+
md: string;
|
|
109
|
+
lg: string;
|
|
110
|
+
full: string;
|
|
111
|
+
};
|
|
112
|
+
shadows: {
|
|
113
|
+
sm: string;
|
|
114
|
+
md: string;
|
|
115
|
+
lg: string;
|
|
116
|
+
xl: string;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export type AIProvider = 'openai' | 'claude' | 'google';
|
|
120
|
+
export type Action = 'create' | 'new' | 'edit' | 'update' | 'delete' | 'remove' | 'view';
|
|
121
|
+
export type AIStatus = 'none' | 'suggesting' | 'thinking' | 'typing';
|
|
122
|
+
export type ChatLevel = 'full' | 'basic' | 'none';
|
|
123
|
+
export interface RouteConfig {
|
|
124
|
+
path: string;
|
|
125
|
+
title: string;
|
|
126
|
+
description: string;
|
|
127
|
+
}
|
|
128
|
+
export interface ServerConfig {
|
|
129
|
+
domain?: string;
|
|
130
|
+
port?: number;
|
|
131
|
+
suffix?: string;
|
|
132
|
+
secure?: boolean;
|
|
133
|
+
schema?: any;
|
|
134
|
+
additionalContext?: string;
|
|
135
|
+
stayOnPage?: boolean;
|
|
136
|
+
}
|
|
137
|
+
export interface TrainingDataPaths {
|
|
138
|
+
components: string[];
|
|
139
|
+
schemas: string[];
|
|
140
|
+
constants: string[];
|
|
141
|
+
types: string[];
|
|
142
|
+
api: string[];
|
|
143
|
+
utils: string[];
|
|
144
|
+
training: string[];
|
|
145
|
+
}
|
|
146
|
+
export interface TrainingCustomData {
|
|
147
|
+
instructions?: string;
|
|
148
|
+
domain?: Record<string, any>;
|
|
149
|
+
options?: Record<string, any>;
|
|
150
|
+
businessRules?: Record<string, any>;
|
|
151
|
+
}
|
|
152
|
+
export interface TrainingConfig {
|
|
153
|
+
filePaths: TrainingDataPaths;
|
|
154
|
+
routes?: RouteConfig[];
|
|
155
|
+
customTrainingData?: TrainingCustomData;
|
|
156
|
+
verboseLogging?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface ProcessedTrainingData {
|
|
159
|
+
components: Array<{
|
|
160
|
+
filePath: string;
|
|
161
|
+
content: {
|
|
162
|
+
componentName: string;
|
|
163
|
+
props: Array<{
|
|
164
|
+
name: string;
|
|
165
|
+
type: string;
|
|
166
|
+
required: boolean;
|
|
167
|
+
}>;
|
|
168
|
+
formFields: string[];
|
|
169
|
+
};
|
|
170
|
+
}>;
|
|
171
|
+
schemas: Array<{
|
|
172
|
+
filePath: string;
|
|
173
|
+
content: {
|
|
174
|
+
modelName: string;
|
|
175
|
+
fields: Array<{
|
|
176
|
+
name: string;
|
|
177
|
+
type: string;
|
|
178
|
+
required: boolean;
|
|
179
|
+
dataType: string;
|
|
180
|
+
}>;
|
|
181
|
+
};
|
|
182
|
+
}>;
|
|
183
|
+
constants: Array<{
|
|
184
|
+
filePath: string;
|
|
185
|
+
content: {
|
|
186
|
+
constValues: Array<{
|
|
187
|
+
name: string;
|
|
188
|
+
value: any;
|
|
189
|
+
}>;
|
|
190
|
+
};
|
|
191
|
+
}>;
|
|
192
|
+
types: Array<{
|
|
193
|
+
filePath: string;
|
|
194
|
+
content: {
|
|
195
|
+
typeName: string;
|
|
196
|
+
properties: Array<{
|
|
197
|
+
name: string;
|
|
198
|
+
type: string;
|
|
199
|
+
optional: boolean;
|
|
200
|
+
}>;
|
|
201
|
+
};
|
|
202
|
+
}>;
|
|
203
|
+
routes: RouteConfig[];
|
|
204
|
+
customTrainingData?: TrainingCustomData;
|
|
205
|
+
}
|
|
206
|
+
export interface TrainingData {
|
|
207
|
+
filePaths?: TrainingDataPaths;
|
|
208
|
+
verboseLogging?: boolean;
|
|
209
|
+
components?: Array<{
|
|
210
|
+
filePath: string;
|
|
211
|
+
content: {
|
|
212
|
+
componentName: string;
|
|
213
|
+
props: Array<{
|
|
214
|
+
name: string;
|
|
215
|
+
type: string;
|
|
216
|
+
required: boolean;
|
|
217
|
+
}>;
|
|
218
|
+
formFields: string[];
|
|
219
|
+
};
|
|
220
|
+
}>;
|
|
221
|
+
schemas?: Array<{
|
|
222
|
+
filePath: string;
|
|
223
|
+
content: {
|
|
224
|
+
modelName: string;
|
|
225
|
+
fields: Array<{
|
|
226
|
+
name: string;
|
|
227
|
+
type: string;
|
|
228
|
+
required: boolean;
|
|
229
|
+
dataType: string;
|
|
230
|
+
}>;
|
|
231
|
+
};
|
|
232
|
+
}>;
|
|
233
|
+
constants?: Array<{
|
|
234
|
+
filePath: string;
|
|
235
|
+
content: {
|
|
236
|
+
constValues: Array<{
|
|
237
|
+
name: string;
|
|
238
|
+
value: any;
|
|
239
|
+
}>;
|
|
240
|
+
};
|
|
241
|
+
}>;
|
|
242
|
+
types?: Array<{
|
|
243
|
+
filePath: string;
|
|
244
|
+
content: {
|
|
245
|
+
typeName: string;
|
|
246
|
+
properties: Array<{
|
|
247
|
+
name: string;
|
|
248
|
+
type: string;
|
|
249
|
+
optional: boolean;
|
|
250
|
+
}>;
|
|
251
|
+
};
|
|
252
|
+
}>;
|
|
253
|
+
routes?: RouteConfig[];
|
|
254
|
+
customTrainingData?: TrainingCustomData;
|
|
255
|
+
}
|
|
256
|
+
export interface AIServiceConfig {
|
|
257
|
+
providers?: Record<string, {
|
|
258
|
+
apiKey: string;
|
|
259
|
+
models: string[];
|
|
260
|
+
}>;
|
|
261
|
+
openaiApiKey?: string;
|
|
262
|
+
claudeApiKey?: string;
|
|
263
|
+
geminiApiKey?: string;
|
|
264
|
+
chatLevel?: 'full' | 'basic' | 'none';
|
|
265
|
+
verboseLogging?: boolean;
|
|
266
|
+
trainingData?: ProcessedTrainingData;
|
|
267
|
+
trainingConfig?: TrainingConfig;
|
|
268
|
+
model?: string | null;
|
|
269
|
+
maxTokens?: number;
|
|
270
|
+
temperature?: number;
|
|
271
|
+
writeConfigToFile?: boolean;
|
|
272
|
+
baseDir?: string;
|
|
273
|
+
}
|
|
274
|
+
export interface CommandConfig extends AIServiceConfig {
|
|
275
|
+
service?: AIProvider | null;
|
|
276
|
+
apiKey?: string | null;
|
|
277
|
+
}
|
|
278
|
+
export interface TextContent {
|
|
279
|
+
type: 'text';
|
|
280
|
+
content: string;
|
|
281
|
+
}
|
|
282
|
+
export interface SuggestionsContent {
|
|
283
|
+
type: 'suggestions';
|
|
284
|
+
content: CommandSuggestion[];
|
|
285
|
+
}
|
|
286
|
+
export interface LoadingSuggestionsContent {
|
|
287
|
+
type: 'loading-suggestions';
|
|
288
|
+
content: string;
|
|
289
|
+
}
|
|
290
|
+
export type MessageContent = TextContent | SuggestionsContent | LoadingSuggestionsContent;
|
|
291
|
+
export interface ChatMessage {
|
|
292
|
+
sender: 'user' | 'ai' | 'system';
|
|
293
|
+
content: MessageContent[];
|
|
294
|
+
action?: string;
|
|
295
|
+
isLoading?: boolean;
|
|
296
|
+
aiStatus?: AIStatus;
|
|
297
|
+
isError?: boolean;
|
|
298
|
+
errorType?: string;
|
|
299
|
+
retryAfter?: number;
|
|
300
|
+
timestamp?: number;
|
|
301
|
+
files?: File[];
|
|
302
|
+
suggestions?: CommandSuggestion[];
|
|
303
|
+
}
|
|
304
|
+
export interface ModelCapabilities {
|
|
305
|
+
supportsImages: boolean;
|
|
306
|
+
supportsAudio?: boolean;
|
|
307
|
+
supportsVideo?: boolean;
|
|
308
|
+
maxTokens?: number;
|
|
309
|
+
contextWindow?: number;
|
|
310
|
+
computeWeight?: number;
|
|
311
|
+
}
|
|
312
|
+
export interface CurrentModel {
|
|
313
|
+
model: string;
|
|
314
|
+
provider: string;
|
|
315
|
+
}
|
|
316
|
+
export interface ModelInfo {
|
|
317
|
+
id: string;
|
|
318
|
+
name: string;
|
|
319
|
+
provider: string;
|
|
320
|
+
available: boolean;
|
|
321
|
+
error?: string;
|
|
322
|
+
supportsImages: boolean;
|
|
323
|
+
computeWeight: number;
|
|
324
|
+
description?: string;
|
|
325
|
+
}
|
|
326
|
+
export interface ProviderStats {
|
|
327
|
+
name: string;
|
|
328
|
+
requests: number;
|
|
329
|
+
}
|
|
330
|
+
export interface UsageStats {
|
|
331
|
+
requests: number;
|
|
332
|
+
totalTokens: number;
|
|
333
|
+
totalComputeUnits: number;
|
|
334
|
+
modelSwitches: number;
|
|
335
|
+
uptime: number;
|
|
336
|
+
providers: Array<{
|
|
337
|
+
name: string;
|
|
338
|
+
requests: number;
|
|
339
|
+
computeUnits: number;
|
|
340
|
+
models: string[];
|
|
341
|
+
}>;
|
|
342
|
+
currentProvider: string;
|
|
343
|
+
currentModel: string;
|
|
344
|
+
}
|
|
345
|
+
export interface Store {
|
|
346
|
+
ai: {
|
|
347
|
+
form: Record<string, unknown>;
|
|
348
|
+
setForm: (state: Record<string, unknown>) => void;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
export interface ModelSwitcherData {
|
|
352
|
+
modelsByProvider: Record<string, ModelInfo[]>;
|
|
353
|
+
currentModel: CurrentModel | null;
|
|
354
|
+
currentCapabilities: ModelCapabilities | null;
|
|
355
|
+
usageStats: UsageStats | null;
|
|
356
|
+
isLoading: boolean;
|
|
357
|
+
error: string | null;
|
|
358
|
+
switchModel: (modelId: string, provider: string) => Promise<void>;
|
|
359
|
+
integrationMode: string;
|
|
360
|
+
}
|
|
361
|
+
export interface ServerOptions extends AIServiceConfig {
|
|
362
|
+
port?: number;
|
|
363
|
+
baseDir?: string;
|
|
364
|
+
service?: AIProvider;
|
|
365
|
+
apiKey?: string;
|
|
366
|
+
customTrainingData?: Partial<TrainingCustomData>;
|
|
367
|
+
}
|
|
368
|
+
export interface CommandServer {
|
|
369
|
+
app: any;
|
|
370
|
+
start: () => void;
|
|
371
|
+
stop: () => void;
|
|
372
|
+
getConfig: () => CommandConfig;
|
|
373
|
+
}
|
|
374
|
+
export interface ApiKeys {
|
|
375
|
+
openai?: string;
|
|
376
|
+
claude?: string;
|
|
377
|
+
gemini?: string;
|
|
378
|
+
[key: string]: string | undefined;
|
|
379
|
+
}
|
|
380
|
+
export interface DefaultModels {
|
|
381
|
+
openai: string[];
|
|
382
|
+
claude: string[];
|
|
383
|
+
gemini: string[];
|
|
384
|
+
[key: string]: string[];
|
|
385
|
+
}
|
|
386
|
+
export interface ImageContent {
|
|
387
|
+
type: string;
|
|
388
|
+
source?: {
|
|
389
|
+
type: string;
|
|
390
|
+
media_type: string;
|
|
391
|
+
data: string;
|
|
392
|
+
};
|
|
393
|
+
image_url?: {
|
|
394
|
+
url: string;
|
|
395
|
+
};
|
|
396
|
+
inlineData?: {
|
|
397
|
+
mimeType: string;
|
|
398
|
+
data: string;
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
export interface Provider {
|
|
402
|
+
apiKey: string;
|
|
403
|
+
models?: string[];
|
|
404
|
+
}
|
|
405
|
+
export type Intent = 'CORRECTION' | 'COMPLETION' | 'DATA_ENTRY' | 'NAVIGATION' | 'INFORMATION';
|
|
406
|
+
export interface AnalysisContext {
|
|
407
|
+
entities: Map<string, any>;
|
|
408
|
+
formStates: Map<string, any>;
|
|
409
|
+
userPreferences: Map<string, any>;
|
|
410
|
+
recentActions: string[];
|
|
411
|
+
intent: Intent;
|
|
412
|
+
extractedData: Record<string, any>;
|
|
413
|
+
}
|
|
414
|
+
export interface DataType {
|
|
415
|
+
pattern: RegExp;
|
|
416
|
+
convert: (value: string) => any;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* JSON Schema definition for data that the AI should generate
|
|
420
|
+
* This follows JSON Schema specification but simplified for common use cases
|
|
421
|
+
*/
|
|
422
|
+
export interface SchemaDefinition {
|
|
423
|
+
title?: string;
|
|
424
|
+
description?: string;
|
|
425
|
+
type: 'object' | 'array' | 'string' | 'number' | 'boolean';
|
|
426
|
+
properties?: Record<string, SchemaProperty>;
|
|
427
|
+
required?: string[];
|
|
428
|
+
items?: SchemaProperty;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Individual property definition in a schema
|
|
432
|
+
*/
|
|
433
|
+
export interface SchemaProperty {
|
|
434
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
435
|
+
description?: string;
|
|
436
|
+
enum?: string[] | number[];
|
|
437
|
+
items?: SchemaProperty;
|
|
438
|
+
properties?: Record<string, SchemaProperty>;
|
|
439
|
+
required?: string[];
|
|
440
|
+
default?: any;
|
|
441
|
+
format?: string;
|
|
442
|
+
pattern?: string;
|
|
443
|
+
minLength?: number;
|
|
444
|
+
maxLength?: number;
|
|
445
|
+
minimum?: number;
|
|
446
|
+
maximum?: number;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Simplified config for ContextualCommandService
|
|
450
|
+
*/
|
|
451
|
+
export interface ContextualServiceConfig {
|
|
452
|
+
openaiApiKey?: string;
|
|
453
|
+
claudeApiKey?: string;
|
|
454
|
+
geminiApiKey?: string;
|
|
455
|
+
providers?: Record<string, {
|
|
456
|
+
apiKey: string;
|
|
457
|
+
models: string[];
|
|
458
|
+
}>;
|
|
459
|
+
chatLevel?: 'full' | 'basic' | 'none';
|
|
460
|
+
temperature?: number;
|
|
461
|
+
maxTokens?: number;
|
|
462
|
+
verboseLogging?: boolean;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Request structure for contextual service
|
|
466
|
+
*/
|
|
467
|
+
export interface ContextualRequest {
|
|
468
|
+
command: string;
|
|
469
|
+
schema?: SchemaDefinition;
|
|
470
|
+
chatHistory?: Array<{
|
|
471
|
+
role: 'user' | 'assistant';
|
|
472
|
+
content: string;
|
|
473
|
+
}>;
|
|
474
|
+
modelSelection?: {
|
|
475
|
+
provider: string;
|
|
476
|
+
model: string;
|
|
477
|
+
};
|
|
478
|
+
chatLevel?: 'full' | 'basic' | 'none';
|
|
479
|
+
additionalContext?: string;
|
|
480
|
+
images?: any[];
|
|
481
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File processing utility
|
|
3
|
+
*/
|
|
4
|
+
export declare const FileHandler: {
|
|
5
|
+
getAcceptedTypes(): {
|
|
6
|
+
mimeTypes: string[];
|
|
7
|
+
extensions: string[];
|
|
8
|
+
descriptions: string[];
|
|
9
|
+
};
|
|
10
|
+
isFileAccepted(file: File): boolean;
|
|
11
|
+
processFiles(files: File[]): {
|
|
12
|
+
acceptedFiles: File[];
|
|
13
|
+
rejectedFiles: File[];
|
|
14
|
+
};
|
|
15
|
+
getAcceptedTypesDescription(): string;
|
|
16
|
+
getInputAcceptAttribute(): string;
|
|
17
|
+
getFileIcon(file: File): React.ReactNode;
|
|
18
|
+
formatFileSize(bytes: number): string;
|
|
19
|
+
getFileTypeDescription(file: File): string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type MergeConfig<T> = {
|
|
2
|
+
/**
|
|
3
|
+
* Map incoming AI keys → draft keys when they differ.
|
|
4
|
+
* Example: { originCity: 'origin' }
|
|
5
|
+
*/
|
|
6
|
+
keyMap?: Partial<Record<keyof T | string, keyof T>>;
|
|
7
|
+
/**
|
|
8
|
+
* Fine-grained transforms for fields that need more than simple assignment.
|
|
9
|
+
*/
|
|
10
|
+
transforms?: Partial<Record<keyof T, (val: unknown, draft: T) => unknown>>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Generic helper that patches an existing object with an AI-generated payload.
|
|
14
|
+
*
|
|
15
|
+
* • Skips undefined / null values so they never blank user input
|
|
16
|
+
* • Coerces strings → numbers when the draft already stores a number
|
|
17
|
+
* • Allows per-field key mapping & transform overrides
|
|
18
|
+
*/
|
|
19
|
+
export declare function mergeWithAi<T extends Record<string, unknown>>(draft: T, ai: Partial<T> | Record<string, unknown> | undefined, config?: MergeConfig<T>): T;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type MergeConfig<T> = {
|
|
2
|
+
/**
|
|
3
|
+
* Map incoming AI keys → draft keys when they differ.
|
|
4
|
+
* Example: { originCity: 'origin' }
|
|
5
|
+
*/
|
|
6
|
+
keyMap?: Partial<Record<keyof T | string, keyof T>>;
|
|
7
|
+
/**
|
|
8
|
+
* Fine-grained transforms for fields that need more than simple assignment.
|
|
9
|
+
*/
|
|
10
|
+
transforms?: Partial<Record<keyof T, (val: unknown, draft: T) => unknown>>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Generic helper that patches an existing object with an AI-generated payload.
|
|
14
|
+
*
|
|
15
|
+
* • Skips undefined / null values so they never blank user input
|
|
16
|
+
* • Coerces strings → numbers when the draft already stores a number
|
|
17
|
+
* • Allows per-field key mapping & transform overrides
|
|
18
|
+
*/
|
|
19
|
+
export declare function mergeWithAi<T extends Record<string, unknown>>(draft: T, ai: Partial<T> | Record<string, unknown> | undefined, config?: MergeConfig<T>): T;
|
package/package.json
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "orchid-ai",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "AI-powered command processing and chat interface for React applications",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"typings": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.esm.js",
|
|
14
|
+
"require": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./server": {
|
|
17
|
+
"types": "./dist/server/index.d.ts",
|
|
18
|
+
"import": "./dist/server/index.esm.js",
|
|
19
|
+
"require": "./dist/server/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./styles.css": "./dist/styles.css",
|
|
22
|
+
"./index.css": "./dist/index.css"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/**/*.js",
|
|
26
|
+
"dist/**/*.d.ts",
|
|
27
|
+
"dist/**/*.d.ts.map",
|
|
28
|
+
"dist/**/*.css",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "npm run build:js && npm run build:types",
|
|
33
|
+
"build:js": "rollup -c",
|
|
34
|
+
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
35
|
+
"dev": "rollup -c -w",
|
|
36
|
+
"type-check": "tsc --noEmit",
|
|
37
|
+
"prepublishOnly": "npm run build",
|
|
38
|
+
"deploy": "./deploy.sh",
|
|
39
|
+
"dev:server": "tsx examples/apps/react-min-server/dev-server.js",
|
|
40
|
+
"dev:server:nitro": "tsx examples/apps/react-min-nitro/server/index.js",
|
|
41
|
+
"dev:react": "vite examples/apps/react-min-server",
|
|
42
|
+
"dev:nitro": "cd examples/apps/react-min-nitro && npm run dev:client",
|
|
43
|
+
"dev:full": "concurrently \"npm run dev:server\" \"npm run dev:react\"",
|
|
44
|
+
"dev:full:nitro": "concurrently \"npm run dev:server:nitro\" \"npm run dev:nitro\"",
|
|
45
|
+
"test:themes": "node -e \"console.log('Theme testing utilities available in examples/apps/test-themes.js')\"",
|
|
46
|
+
"manual:client": "cd examples/apps/react-min-nitro-manual && npm run dev:client",
|
|
47
|
+
"manual:server": "cd examples/apps/react-min-nitro-manual && npm run dev:server",
|
|
48
|
+
"manual": "concurrently \"npm run manual:server\" \"npm run manual:client\"",
|
|
49
|
+
"nitro:client": "cd examples/apps/react-min-nitro-manual && npm run dev:client",
|
|
50
|
+
"nitro:server": "cd examples/apps/react-min-nitro-manual && npm run dev:server",
|
|
51
|
+
"nitro": "concurrently \"npm run nitro:server\" \"npm run nitro:client\""
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"express": "^4.18.0",
|
|
55
|
+
"react": "^18.0.0",
|
|
56
|
+
"react-dom": "^18.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"react": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"react-dom": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"express": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"monastery": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"nitro-web": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@anthropic-ai/sdk": "^0.54.0",
|
|
77
|
+
"@babel/runtime": "^7.27.6",
|
|
78
|
+
"@google/generative-ai": "^0.24.1",
|
|
79
|
+
"@types/multer": "^1.4.13",
|
|
80
|
+
"dotenv": "^16.3.1",
|
|
81
|
+
"fast-glob": "^3.3.3",
|
|
82
|
+
"multer": "^2.0.1",
|
|
83
|
+
"openai": "^5.3.0",
|
|
84
|
+
"tailwind-merge": "^3.3.1",
|
|
85
|
+
"ws": "^8.18.2"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
89
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
90
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
91
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
92
|
+
"@tailwindcss/postcss": "^4.1.10",
|
|
93
|
+
"@types/express": "^4.17.0",
|
|
94
|
+
"@types/react": "^18.0.0",
|
|
95
|
+
"@types/react-dom": "^18.3.7",
|
|
96
|
+
"@types/ws": "^8.18.1",
|
|
97
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
98
|
+
"autoprefixer": "^10.4.16",
|
|
99
|
+
"concurrently": "^9.1.2",
|
|
100
|
+
"http-server": "^14.1.1",
|
|
101
|
+
"postcss": "^8.4.32",
|
|
102
|
+
"postcss-cli": "^11.0.0",
|
|
103
|
+
"rollup": "^4.0.0",
|
|
104
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
105
|
+
"rollup-plugin-string": "^3.0.0",
|
|
106
|
+
"tailwindcss": "^3.4.0",
|
|
107
|
+
"tslib": "^2.8.1",
|
|
108
|
+
"tsx": "^4.7.0",
|
|
109
|
+
"typescript": "^5.0.0",
|
|
110
|
+
"vite": "^5.0.12",
|
|
111
|
+
"@types/node": "^20.0.0"
|
|
112
|
+
},
|
|
113
|
+
"keywords": [
|
|
114
|
+
"ai",
|
|
115
|
+
"command",
|
|
116
|
+
"chat",
|
|
117
|
+
"react",
|
|
118
|
+
"openai",
|
|
119
|
+
"claude",
|
|
120
|
+
"google-ai",
|
|
121
|
+
"streaming",
|
|
122
|
+
"suggestions"
|
|
123
|
+
],
|
|
124
|
+
"author": "Tracform",
|
|
125
|
+
"license": "MIT",
|
|
126
|
+
"engines": {
|
|
127
|
+
"node": "^20"
|
|
128
|
+
},
|
|
129
|
+
"repository": {
|
|
130
|
+
"type": "git",
|
|
131
|
+
"url": "https://github.com/tracform/command.git"
|
|
132
|
+
},
|
|
133
|
+
"bugs": {
|
|
134
|
+
"url": "https://github.com/tracform/command/issues"
|
|
135
|
+
},
|
|
136
|
+
"homepage": "https://github.com/tracform/command#readme"
|
|
137
|
+
}
|