skema-core 0.1.0 → 0.1.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/README.md +98 -49
- package/dist/cli.js +1186 -23
- package/dist/index.d.mts +81 -3
- package/dist/index.d.ts +81 -3
- package/dist/index.js +2388 -991
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2389 -993
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +208 -3
- package/dist/server.d.ts +208 -3
- package/dist/server.js +1012 -143
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +981 -145
- package/dist/server.mjs.map +1 -1
- package/package.json +7 -2
package/dist/server.d.mts
CHANGED
|
@@ -193,10 +193,12 @@ interface GeminiCLIEvent {
|
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Build a prompt for Gemini CLI from an annotation
|
|
196
|
+
*
|
|
197
|
+
* @see /server/prompts.ts for the actual prompt templates
|
|
196
198
|
*/
|
|
197
199
|
declare function buildPromptFromAnnotation(annotation: Partial<Annotation> & {
|
|
198
200
|
comment?: string;
|
|
199
|
-
},
|
|
201
|
+
}, _projectContext?: ProjectContext, options?: {
|
|
200
202
|
fastMode?: boolean;
|
|
201
203
|
visionDescription?: string;
|
|
202
204
|
}): string;
|
|
@@ -207,12 +209,21 @@ declare function spawnGeminiCLI(prompt: string, options?: GeminiCLIOptions): {
|
|
|
207
209
|
process: ChildProcess;
|
|
208
210
|
events: AsyncIterable<GeminiCLIEvent>;
|
|
209
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Options for createGeminiCLIStream with abort support
|
|
214
|
+
*/
|
|
215
|
+
interface StreamOptions extends GeminiCLIOptions {
|
|
216
|
+
/** Abort signal for cancellation */
|
|
217
|
+
signal?: AbortSignal;
|
|
218
|
+
/** Callback when cancelled - for cleanup like reverting snapshots */
|
|
219
|
+
onCancel?: () => void;
|
|
220
|
+
}
|
|
210
221
|
/**
|
|
211
222
|
* Create a streaming response for use in API routes (Next.js, Express, etc.)
|
|
212
223
|
*/
|
|
213
224
|
declare function createGeminiCLIStream(annotation: Partial<Annotation> & {
|
|
214
225
|
comment?: string;
|
|
215
|
-
}, projectContext?: ProjectContext, options?:
|
|
226
|
+
}, projectContext?: ProjectContext, options?: StreamOptions): ReadableStream<Uint8Array>;
|
|
216
227
|
/**
|
|
217
228
|
* Run Gemini CLI and wait for completion
|
|
218
229
|
*/
|
|
@@ -257,4 +268,198 @@ declare function createRevertRouteHandler(defaultOptions?: {
|
|
|
257
268
|
declare const POST: (request: Request) => Promise<Response>;
|
|
258
269
|
declare const DELETE: (request: Request) => Promise<Response>;
|
|
259
270
|
|
|
260
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Skema AI Prompts
|
|
273
|
+
*
|
|
274
|
+
* This file contains all AI prompts used by Skema for generating code changes.
|
|
275
|
+
*
|
|
276
|
+
* Prompts:
|
|
277
|
+
* - FAST_DOM_SELECTION_PROMPT: Quick, minimal prompt for DOM element changes
|
|
278
|
+
* - DETAILED_DOM_SELECTION_PROMPT: Full context prompt for complex DOM changes
|
|
279
|
+
* - DRAWING_TO_CODE_PROMPT: Converts wireframe sketches to React components
|
|
280
|
+
* - IMAGE_ANALYSIS_PROMPT: Gemini Vision prompt to analyze drawing images
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
interface DomSelectionInput {
|
|
284
|
+
comment: string;
|
|
285
|
+
selector?: string;
|
|
286
|
+
text?: string;
|
|
287
|
+
tagName?: string;
|
|
288
|
+
}
|
|
289
|
+
interface DetailedDomSelectionInput extends DomSelectionInput {
|
|
290
|
+
elementPath?: string;
|
|
291
|
+
cssClasses?: string;
|
|
292
|
+
attributes?: Record<string, string>;
|
|
293
|
+
elements?: Array<{
|
|
294
|
+
tagName: string;
|
|
295
|
+
selector: string;
|
|
296
|
+
elementPath: string;
|
|
297
|
+
text?: string;
|
|
298
|
+
}>;
|
|
299
|
+
}
|
|
300
|
+
interface GestureInput {
|
|
301
|
+
comment: string;
|
|
302
|
+
gesture?: string;
|
|
303
|
+
boundingBox?: {
|
|
304
|
+
x: number;
|
|
305
|
+
y: number;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
interface DrawingInput {
|
|
309
|
+
comment: string;
|
|
310
|
+
boundingBox?: {
|
|
311
|
+
x: number;
|
|
312
|
+
y: number;
|
|
313
|
+
width: number;
|
|
314
|
+
height: number;
|
|
315
|
+
};
|
|
316
|
+
drawingSvg?: string;
|
|
317
|
+
drawingImage?: string;
|
|
318
|
+
extractedText?: string;
|
|
319
|
+
gridConfig?: {
|
|
320
|
+
color: string;
|
|
321
|
+
size: number;
|
|
322
|
+
labels: boolean;
|
|
323
|
+
};
|
|
324
|
+
viewport?: ViewportInfo;
|
|
325
|
+
projectStyles?: ProjectStyleContext;
|
|
326
|
+
nearbyElements?: NearbyElement[];
|
|
327
|
+
visionDescription?: string;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Fast mode prompt for quick DOM element changes.
|
|
331
|
+
* Used when fastMode is enabled for simple, targeted edits.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* // Result: "Make this button blue (target: "Submit"). Make the change directly..."
|
|
335
|
+
* buildFastDomSelectionPrompt({ comment: "Make this button blue", text: "Submit" })
|
|
336
|
+
*/
|
|
337
|
+
declare function buildFastDomSelectionPrompt(input: DomSelectionInput): string;
|
|
338
|
+
/**
|
|
339
|
+
* Detailed mode prompt for DOM element changes with full context.
|
|
340
|
+
* Used for complex changes that need more information about the target.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* buildDetailedDomSelectionPrompt({
|
|
344
|
+
* comment: "Add a hover effect",
|
|
345
|
+
* tagName: "button",
|
|
346
|
+
* selector: "#submit-btn",
|
|
347
|
+
* text: "Submit Form"
|
|
348
|
+
* })
|
|
349
|
+
*/
|
|
350
|
+
declare function buildDetailedDomSelectionPrompt(input: DetailedDomSelectionInput): string;
|
|
351
|
+
/**
|
|
352
|
+
* Prompt for gesture-based annotations (circles, scribbles, etc.)
|
|
353
|
+
*/
|
|
354
|
+
declare function buildGesturePrompt(input: GestureInput): string;
|
|
355
|
+
/**
|
|
356
|
+
* Comprehensive prompt for converting wireframe sketches into React components.
|
|
357
|
+
* This is the most complex prompt, used when users draw UI elements.
|
|
358
|
+
*
|
|
359
|
+
* The prompt instructs the AI to:
|
|
360
|
+
* 1. Analyze the sketch to understand the visual intent
|
|
361
|
+
* 2. Interpret (not transcribe) the low-fidelity drawing
|
|
362
|
+
* 3. Generate high-quality inline JSX with Tailwind CSS
|
|
363
|
+
* 4. Integrate naturally with the existing page flow
|
|
364
|
+
*/
|
|
365
|
+
declare function buildDrawingToCodePrompt(input: DrawingInput): string;
|
|
366
|
+
/**
|
|
367
|
+
* Prompt for Gemini Vision to analyze a wireframe sketch image.
|
|
368
|
+
* This generates a description that is then passed to the main drawing prompt.
|
|
369
|
+
*/
|
|
370
|
+
declare const IMAGE_ANALYSIS_PROMPT: string;
|
|
371
|
+
|
|
372
|
+
type AIProvider = 'gemini' | 'claude';
|
|
373
|
+
interface AIProviderConfig {
|
|
374
|
+
provider: AIProvider;
|
|
375
|
+
/** Working directory for CLI commands */
|
|
376
|
+
cwd?: string;
|
|
377
|
+
/** Model override (provider-specific) */
|
|
378
|
+
model?: string;
|
|
379
|
+
}
|
|
380
|
+
interface AIStreamEvent {
|
|
381
|
+
type: 'init' | 'text' | 'tool_use' | 'tool_result' | 'error' | 'done' | 'debug';
|
|
382
|
+
content?: string;
|
|
383
|
+
timestamp: string;
|
|
384
|
+
provider: AIProvider;
|
|
385
|
+
/** Raw event from the CLI (provider-specific) */
|
|
386
|
+
raw?: unknown;
|
|
387
|
+
}
|
|
388
|
+
interface AIRunResult {
|
|
389
|
+
success: boolean;
|
|
390
|
+
output: string;
|
|
391
|
+
events: AIStreamEvent[];
|
|
392
|
+
provider: AIProvider;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Spawn an AI CLI and return an async iterator of events
|
|
396
|
+
*/
|
|
397
|
+
declare function spawnAICLI(prompt: string, config: AIProviderConfig): {
|
|
398
|
+
process: ChildProcess;
|
|
399
|
+
events: AsyncIterable<AIStreamEvent>;
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Run an AI CLI and wait for completion (non-streaming)
|
|
403
|
+
*/
|
|
404
|
+
declare function runAICLI(prompt: string, config: AIProviderConfig): Promise<AIRunResult>;
|
|
405
|
+
/**
|
|
406
|
+
* Check if a provider CLI is available
|
|
407
|
+
*/
|
|
408
|
+
declare function isProviderAvailable(provider: AIProvider): boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Get available providers
|
|
411
|
+
*/
|
|
412
|
+
declare function getAvailableProviders(): AIProvider[];
|
|
413
|
+
|
|
414
|
+
interface DaemonConfig {
|
|
415
|
+
/** Port for WebSocket server (default: 9999) */
|
|
416
|
+
port?: number;
|
|
417
|
+
/** Working directory for file operations and AI commands */
|
|
418
|
+
cwd?: string;
|
|
419
|
+
/** Default AI provider */
|
|
420
|
+
defaultProvider?: AIProvider;
|
|
421
|
+
}
|
|
422
|
+
interface IncomingMessage {
|
|
423
|
+
id: string;
|
|
424
|
+
type: string;
|
|
425
|
+
[key: string]: unknown;
|
|
426
|
+
}
|
|
427
|
+
interface OutgoingMessage {
|
|
428
|
+
id?: string;
|
|
429
|
+
type: string;
|
|
430
|
+
success?: boolean;
|
|
431
|
+
error?: string;
|
|
432
|
+
[key: string]: unknown;
|
|
433
|
+
}
|
|
434
|
+
interface DaemonInstance {
|
|
435
|
+
port: number;
|
|
436
|
+
close: () => void;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Start the Skema daemon (WebSocket server)
|
|
440
|
+
*/
|
|
441
|
+
declare function startDaemon(config?: DaemonConfig): DaemonInstance;
|
|
442
|
+
|
|
443
|
+
interface VisionAnalysisResult {
|
|
444
|
+
success: boolean;
|
|
445
|
+
description: string;
|
|
446
|
+
provider: AIProvider;
|
|
447
|
+
error?: string;
|
|
448
|
+
}
|
|
449
|
+
interface VisionConfig {
|
|
450
|
+
provider: AIProvider;
|
|
451
|
+
/** API key for vision API (falls back to env vars) */
|
|
452
|
+
apiKey?: string;
|
|
453
|
+
/** Model to use for vision */
|
|
454
|
+
model?: string;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Analyze an image using the specified AI provider's vision capabilities
|
|
458
|
+
*/
|
|
459
|
+
declare function analyzeImage(base64Image: string, config: VisionConfig): Promise<VisionAnalysisResult>;
|
|
460
|
+
/**
|
|
461
|
+
* Check if vision analysis is available for a provider
|
|
462
|
+
*/
|
|
463
|
+
declare function isVisionAvailable(provider: AIProvider): boolean;
|
|
464
|
+
|
|
465
|
+
export { type AIProvider, type AIProviderConfig, type AIRunResult, type AIStreamEvent, DELETE, type DaemonConfig, type DaemonInstance, type DetailedDomSelectionInput, type DomSelectionInput, type DrawingInput, type GeminiCLIEvent, type GeminiCLIOptions, type GestureInput, IMAGE_ANALYSIS_PROMPT, type IncomingMessage, type OutgoingMessage, POST, type ProjectContext, type VisionAnalysisResult, type VisionConfig, analyzeImage, buildDetailedDomSelectionPrompt, buildDrawingToCodePrompt, buildFastDomSelectionPrompt, buildGesturePrompt, buildPromptFromAnnotation, createGeminiCLIStream, createGeminiRouteHandler, createRevertRouteHandler, getAvailableProviders, getTrackedAnnotations, isProviderAvailable, isVisionAvailable, revertAnnotation, runAICLI, runGeminiCLI, spawnAICLI, spawnGeminiCLI, startDaemon };
|
package/dist/server.d.ts
CHANGED
|
@@ -193,10 +193,12 @@ interface GeminiCLIEvent {
|
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Build a prompt for Gemini CLI from an annotation
|
|
196
|
+
*
|
|
197
|
+
* @see /server/prompts.ts for the actual prompt templates
|
|
196
198
|
*/
|
|
197
199
|
declare function buildPromptFromAnnotation(annotation: Partial<Annotation> & {
|
|
198
200
|
comment?: string;
|
|
199
|
-
},
|
|
201
|
+
}, _projectContext?: ProjectContext, options?: {
|
|
200
202
|
fastMode?: boolean;
|
|
201
203
|
visionDescription?: string;
|
|
202
204
|
}): string;
|
|
@@ -207,12 +209,21 @@ declare function spawnGeminiCLI(prompt: string, options?: GeminiCLIOptions): {
|
|
|
207
209
|
process: ChildProcess;
|
|
208
210
|
events: AsyncIterable<GeminiCLIEvent>;
|
|
209
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Options for createGeminiCLIStream with abort support
|
|
214
|
+
*/
|
|
215
|
+
interface StreamOptions extends GeminiCLIOptions {
|
|
216
|
+
/** Abort signal for cancellation */
|
|
217
|
+
signal?: AbortSignal;
|
|
218
|
+
/** Callback when cancelled - for cleanup like reverting snapshots */
|
|
219
|
+
onCancel?: () => void;
|
|
220
|
+
}
|
|
210
221
|
/**
|
|
211
222
|
* Create a streaming response for use in API routes (Next.js, Express, etc.)
|
|
212
223
|
*/
|
|
213
224
|
declare function createGeminiCLIStream(annotation: Partial<Annotation> & {
|
|
214
225
|
comment?: string;
|
|
215
|
-
}, projectContext?: ProjectContext, options?:
|
|
226
|
+
}, projectContext?: ProjectContext, options?: StreamOptions): ReadableStream<Uint8Array>;
|
|
216
227
|
/**
|
|
217
228
|
* Run Gemini CLI and wait for completion
|
|
218
229
|
*/
|
|
@@ -257,4 +268,198 @@ declare function createRevertRouteHandler(defaultOptions?: {
|
|
|
257
268
|
declare const POST: (request: Request) => Promise<Response>;
|
|
258
269
|
declare const DELETE: (request: Request) => Promise<Response>;
|
|
259
270
|
|
|
260
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Skema AI Prompts
|
|
273
|
+
*
|
|
274
|
+
* This file contains all AI prompts used by Skema for generating code changes.
|
|
275
|
+
*
|
|
276
|
+
* Prompts:
|
|
277
|
+
* - FAST_DOM_SELECTION_PROMPT: Quick, minimal prompt for DOM element changes
|
|
278
|
+
* - DETAILED_DOM_SELECTION_PROMPT: Full context prompt for complex DOM changes
|
|
279
|
+
* - DRAWING_TO_CODE_PROMPT: Converts wireframe sketches to React components
|
|
280
|
+
* - IMAGE_ANALYSIS_PROMPT: Gemini Vision prompt to analyze drawing images
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
interface DomSelectionInput {
|
|
284
|
+
comment: string;
|
|
285
|
+
selector?: string;
|
|
286
|
+
text?: string;
|
|
287
|
+
tagName?: string;
|
|
288
|
+
}
|
|
289
|
+
interface DetailedDomSelectionInput extends DomSelectionInput {
|
|
290
|
+
elementPath?: string;
|
|
291
|
+
cssClasses?: string;
|
|
292
|
+
attributes?: Record<string, string>;
|
|
293
|
+
elements?: Array<{
|
|
294
|
+
tagName: string;
|
|
295
|
+
selector: string;
|
|
296
|
+
elementPath: string;
|
|
297
|
+
text?: string;
|
|
298
|
+
}>;
|
|
299
|
+
}
|
|
300
|
+
interface GestureInput {
|
|
301
|
+
comment: string;
|
|
302
|
+
gesture?: string;
|
|
303
|
+
boundingBox?: {
|
|
304
|
+
x: number;
|
|
305
|
+
y: number;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
interface DrawingInput {
|
|
309
|
+
comment: string;
|
|
310
|
+
boundingBox?: {
|
|
311
|
+
x: number;
|
|
312
|
+
y: number;
|
|
313
|
+
width: number;
|
|
314
|
+
height: number;
|
|
315
|
+
};
|
|
316
|
+
drawingSvg?: string;
|
|
317
|
+
drawingImage?: string;
|
|
318
|
+
extractedText?: string;
|
|
319
|
+
gridConfig?: {
|
|
320
|
+
color: string;
|
|
321
|
+
size: number;
|
|
322
|
+
labels: boolean;
|
|
323
|
+
};
|
|
324
|
+
viewport?: ViewportInfo;
|
|
325
|
+
projectStyles?: ProjectStyleContext;
|
|
326
|
+
nearbyElements?: NearbyElement[];
|
|
327
|
+
visionDescription?: string;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Fast mode prompt for quick DOM element changes.
|
|
331
|
+
* Used when fastMode is enabled for simple, targeted edits.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* // Result: "Make this button blue (target: "Submit"). Make the change directly..."
|
|
335
|
+
* buildFastDomSelectionPrompt({ comment: "Make this button blue", text: "Submit" })
|
|
336
|
+
*/
|
|
337
|
+
declare function buildFastDomSelectionPrompt(input: DomSelectionInput): string;
|
|
338
|
+
/**
|
|
339
|
+
* Detailed mode prompt for DOM element changes with full context.
|
|
340
|
+
* Used for complex changes that need more information about the target.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* buildDetailedDomSelectionPrompt({
|
|
344
|
+
* comment: "Add a hover effect",
|
|
345
|
+
* tagName: "button",
|
|
346
|
+
* selector: "#submit-btn",
|
|
347
|
+
* text: "Submit Form"
|
|
348
|
+
* })
|
|
349
|
+
*/
|
|
350
|
+
declare function buildDetailedDomSelectionPrompt(input: DetailedDomSelectionInput): string;
|
|
351
|
+
/**
|
|
352
|
+
* Prompt for gesture-based annotations (circles, scribbles, etc.)
|
|
353
|
+
*/
|
|
354
|
+
declare function buildGesturePrompt(input: GestureInput): string;
|
|
355
|
+
/**
|
|
356
|
+
* Comprehensive prompt for converting wireframe sketches into React components.
|
|
357
|
+
* This is the most complex prompt, used when users draw UI elements.
|
|
358
|
+
*
|
|
359
|
+
* The prompt instructs the AI to:
|
|
360
|
+
* 1. Analyze the sketch to understand the visual intent
|
|
361
|
+
* 2. Interpret (not transcribe) the low-fidelity drawing
|
|
362
|
+
* 3. Generate high-quality inline JSX with Tailwind CSS
|
|
363
|
+
* 4. Integrate naturally with the existing page flow
|
|
364
|
+
*/
|
|
365
|
+
declare function buildDrawingToCodePrompt(input: DrawingInput): string;
|
|
366
|
+
/**
|
|
367
|
+
* Prompt for Gemini Vision to analyze a wireframe sketch image.
|
|
368
|
+
* This generates a description that is then passed to the main drawing prompt.
|
|
369
|
+
*/
|
|
370
|
+
declare const IMAGE_ANALYSIS_PROMPT: string;
|
|
371
|
+
|
|
372
|
+
type AIProvider = 'gemini' | 'claude';
|
|
373
|
+
interface AIProviderConfig {
|
|
374
|
+
provider: AIProvider;
|
|
375
|
+
/** Working directory for CLI commands */
|
|
376
|
+
cwd?: string;
|
|
377
|
+
/** Model override (provider-specific) */
|
|
378
|
+
model?: string;
|
|
379
|
+
}
|
|
380
|
+
interface AIStreamEvent {
|
|
381
|
+
type: 'init' | 'text' | 'tool_use' | 'tool_result' | 'error' | 'done' | 'debug';
|
|
382
|
+
content?: string;
|
|
383
|
+
timestamp: string;
|
|
384
|
+
provider: AIProvider;
|
|
385
|
+
/** Raw event from the CLI (provider-specific) */
|
|
386
|
+
raw?: unknown;
|
|
387
|
+
}
|
|
388
|
+
interface AIRunResult {
|
|
389
|
+
success: boolean;
|
|
390
|
+
output: string;
|
|
391
|
+
events: AIStreamEvent[];
|
|
392
|
+
provider: AIProvider;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Spawn an AI CLI and return an async iterator of events
|
|
396
|
+
*/
|
|
397
|
+
declare function spawnAICLI(prompt: string, config: AIProviderConfig): {
|
|
398
|
+
process: ChildProcess;
|
|
399
|
+
events: AsyncIterable<AIStreamEvent>;
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Run an AI CLI and wait for completion (non-streaming)
|
|
403
|
+
*/
|
|
404
|
+
declare function runAICLI(prompt: string, config: AIProviderConfig): Promise<AIRunResult>;
|
|
405
|
+
/**
|
|
406
|
+
* Check if a provider CLI is available
|
|
407
|
+
*/
|
|
408
|
+
declare function isProviderAvailable(provider: AIProvider): boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Get available providers
|
|
411
|
+
*/
|
|
412
|
+
declare function getAvailableProviders(): AIProvider[];
|
|
413
|
+
|
|
414
|
+
interface DaemonConfig {
|
|
415
|
+
/** Port for WebSocket server (default: 9999) */
|
|
416
|
+
port?: number;
|
|
417
|
+
/** Working directory for file operations and AI commands */
|
|
418
|
+
cwd?: string;
|
|
419
|
+
/** Default AI provider */
|
|
420
|
+
defaultProvider?: AIProvider;
|
|
421
|
+
}
|
|
422
|
+
interface IncomingMessage {
|
|
423
|
+
id: string;
|
|
424
|
+
type: string;
|
|
425
|
+
[key: string]: unknown;
|
|
426
|
+
}
|
|
427
|
+
interface OutgoingMessage {
|
|
428
|
+
id?: string;
|
|
429
|
+
type: string;
|
|
430
|
+
success?: boolean;
|
|
431
|
+
error?: string;
|
|
432
|
+
[key: string]: unknown;
|
|
433
|
+
}
|
|
434
|
+
interface DaemonInstance {
|
|
435
|
+
port: number;
|
|
436
|
+
close: () => void;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Start the Skema daemon (WebSocket server)
|
|
440
|
+
*/
|
|
441
|
+
declare function startDaemon(config?: DaemonConfig): DaemonInstance;
|
|
442
|
+
|
|
443
|
+
interface VisionAnalysisResult {
|
|
444
|
+
success: boolean;
|
|
445
|
+
description: string;
|
|
446
|
+
provider: AIProvider;
|
|
447
|
+
error?: string;
|
|
448
|
+
}
|
|
449
|
+
interface VisionConfig {
|
|
450
|
+
provider: AIProvider;
|
|
451
|
+
/** API key for vision API (falls back to env vars) */
|
|
452
|
+
apiKey?: string;
|
|
453
|
+
/** Model to use for vision */
|
|
454
|
+
model?: string;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Analyze an image using the specified AI provider's vision capabilities
|
|
458
|
+
*/
|
|
459
|
+
declare function analyzeImage(base64Image: string, config: VisionConfig): Promise<VisionAnalysisResult>;
|
|
460
|
+
/**
|
|
461
|
+
* Check if vision analysis is available for a provider
|
|
462
|
+
*/
|
|
463
|
+
declare function isVisionAvailable(provider: AIProvider): boolean;
|
|
464
|
+
|
|
465
|
+
export { type AIProvider, type AIProviderConfig, type AIRunResult, type AIStreamEvent, DELETE, type DaemonConfig, type DaemonInstance, type DetailedDomSelectionInput, type DomSelectionInput, type DrawingInput, type GeminiCLIEvent, type GeminiCLIOptions, type GestureInput, IMAGE_ANALYSIS_PROMPT, type IncomingMessage, type OutgoingMessage, POST, type ProjectContext, type VisionAnalysisResult, type VisionConfig, analyzeImage, buildDetailedDomSelectionPrompt, buildDrawingToCodePrompt, buildFastDomSelectionPrompt, buildGesturePrompt, buildPromptFromAnnotation, createGeminiCLIStream, createGeminiRouteHandler, createRevertRouteHandler, getAvailableProviders, getTrackedAnnotations, isProviderAvailable, isVisionAvailable, revertAnnotation, runAICLI, runGeminiCLI, spawnAICLI, spawnGeminiCLI, startDaemon };
|