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/index.d.mts
CHANGED
|
@@ -190,11 +190,23 @@ interface AnnotationExport {
|
|
|
190
190
|
interface SkemaProps {
|
|
191
191
|
/** Whether Skema overlay is enabled */
|
|
192
192
|
enabled?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* WebSocket URL for the Skema daemon (default: ws://localhost:9999)
|
|
195
|
+
* When provided (or using default), Skema auto-connects and handles AI generation internally.
|
|
196
|
+
* Set to null to disable auto-connection (useful if providing custom callbacks).
|
|
197
|
+
*/
|
|
198
|
+
daemonUrl?: string | null;
|
|
193
199
|
/** Callback when annotations change */
|
|
194
200
|
onAnnotationsChange?: (annotations: Annotation[]) => void;
|
|
195
|
-
/**
|
|
201
|
+
/**
|
|
202
|
+
* Callback when a single annotation is submitted.
|
|
203
|
+
* If not provided and daemonUrl is set, Skema will auto-generate using the daemon.
|
|
204
|
+
*/
|
|
196
205
|
onAnnotationSubmit?: (annotation: Annotation, comment: string) => void;
|
|
197
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Callback when an annotation is deleted.
|
|
208
|
+
* If not provided and daemonUrl is set, Skema will auto-revert using the daemon.
|
|
209
|
+
*/
|
|
198
210
|
onAnnotationDelete?: (annotationId: string) => void;
|
|
199
211
|
/** Keyboard shortcut to toggle Skema (default: Cmd/Ctrl + Shift + E) */
|
|
200
212
|
toggleShortcut?: string;
|
|
@@ -202,6 +214,10 @@ interface SkemaProps {
|
|
|
202
214
|
initialAnnotations?: Annotation[];
|
|
203
215
|
/** Z-index for the overlay (default: 99999) */
|
|
204
216
|
zIndex?: number;
|
|
217
|
+
/** Whether an annotation is currently being processed (shows loading animation) */
|
|
218
|
+
isProcessing?: boolean;
|
|
219
|
+
/** Callback when user cancels an in-progress annotation (clicks X during processing) */
|
|
220
|
+
onProcessingCancel?: () => void;
|
|
205
221
|
}
|
|
206
222
|
/**
|
|
207
223
|
* Skema mode - determines what tools are available
|
|
@@ -243,6 +259,68 @@ interface AnnotationPopupHandle {
|
|
|
243
259
|
}
|
|
244
260
|
declare const AnnotationPopup: React.ForwardRefExoticComponent<AnnotationPopupProps & React.RefAttributes<AnnotationPopupHandle>>;
|
|
245
261
|
|
|
262
|
+
type AIProvider = 'gemini' | 'claude';
|
|
263
|
+
interface DaemonState {
|
|
264
|
+
connected: boolean;
|
|
265
|
+
provider: AIProvider;
|
|
266
|
+
availableProviders: AIProvider[];
|
|
267
|
+
cwd: string;
|
|
268
|
+
}
|
|
269
|
+
interface AIStreamEvent {
|
|
270
|
+
type: 'init' | 'text' | 'tool_use' | 'tool_result' | 'error' | 'done' | 'debug';
|
|
271
|
+
content?: string;
|
|
272
|
+
timestamp: string;
|
|
273
|
+
provider: AIProvider;
|
|
274
|
+
raw?: unknown;
|
|
275
|
+
}
|
|
276
|
+
interface UseDaemonOptions {
|
|
277
|
+
/** WebSocket URL (default: ws://localhost:9999) */
|
|
278
|
+
url?: string;
|
|
279
|
+
/** Auto-connect on mount (default: true) */
|
|
280
|
+
autoConnect?: boolean;
|
|
281
|
+
/** Reconnect on disconnect (default: true) */
|
|
282
|
+
autoReconnect?: boolean;
|
|
283
|
+
/** Reconnect delay in ms (default: 2000) */
|
|
284
|
+
reconnectDelay?: number;
|
|
285
|
+
}
|
|
286
|
+
interface UseDaemonReturn {
|
|
287
|
+
/** Current daemon state */
|
|
288
|
+
state: DaemonState;
|
|
289
|
+
/** Whether currently generating */
|
|
290
|
+
isGenerating: boolean;
|
|
291
|
+
/** Last error message */
|
|
292
|
+
error: string | null;
|
|
293
|
+
/** Connect to daemon */
|
|
294
|
+
connect: () => void;
|
|
295
|
+
/** Disconnect from daemon */
|
|
296
|
+
disconnect: () => void;
|
|
297
|
+
/** Switch AI provider */
|
|
298
|
+
setProvider: (provider: AIProvider) => Promise<boolean>;
|
|
299
|
+
/** Generate code from annotation (streaming) */
|
|
300
|
+
generate: (annotation: Partial<Annotation> & {
|
|
301
|
+
comment?: string;
|
|
302
|
+
}, onEvent?: (event: AIStreamEvent) => void) => Promise<{
|
|
303
|
+
success: boolean;
|
|
304
|
+
annotationId: string;
|
|
305
|
+
}>;
|
|
306
|
+
/** Revert changes for an annotation */
|
|
307
|
+
revert: (annotationId: string) => Promise<{
|
|
308
|
+
success: boolean;
|
|
309
|
+
message: string;
|
|
310
|
+
}>;
|
|
311
|
+
/** Read a file */
|
|
312
|
+
readFile: (path: string) => Promise<string>;
|
|
313
|
+
/** Write a file */
|
|
314
|
+
writeFile: (path: string, content: string) => Promise<boolean>;
|
|
315
|
+
/** Run a command */
|
|
316
|
+
runCommand: (command: string) => Promise<{
|
|
317
|
+
stdout: string;
|
|
318
|
+
stderr: string;
|
|
319
|
+
exitCode: number;
|
|
320
|
+
}>;
|
|
321
|
+
}
|
|
322
|
+
declare function useDaemon(options?: UseDaemonOptions): UseDaemonReturn;
|
|
323
|
+
|
|
246
324
|
/**
|
|
247
325
|
* Generates a unique CSS selector for an element
|
|
248
326
|
*/
|
|
@@ -353,4 +431,4 @@ declare function getGridCellReference(x: number, y: number, gridSize?: number):
|
|
|
353
431
|
*/
|
|
354
432
|
declare function extractTextFromShapes(shapes: unknown[]): string;
|
|
355
433
|
|
|
356
|
-
export { type Annotation, type AnnotationExport, AnnotationPopup, type AnnotationPopupHandle, type AnnotationPopupProps, type BoundingBox, type DOMElement, type DOMSelection, type DrawingAnnotation, type ElementStyles, type GestureAnnotation, type NearbyElement, type PendingAnnotation, type ProjectStyleContext, Skema, type SkemaMode, type SkemaProps, type ViewportInfo, addGridToSvg, bboxCenter, bboxDocumentToViewport, bboxFromPoints, bboxIntersects, bboxViewportToDocument, blobToBase64, createDOMSelection, Skema as default, documentToViewport, expandBbox, extractTextFromShapes, generateSelector, getBoundingBox, getElementClasses, getElementPath, getGridCellReference, getViewportInfo, identifyElement, pointInBbox, shouldIgnoreElement, viewportToDocument };
|
|
434
|
+
export { type AIProvider, type AIStreamEvent, type Annotation, type AnnotationExport, AnnotationPopup, type AnnotationPopupHandle, type AnnotationPopupProps, type BoundingBox, type DOMElement, type DOMSelection, type DaemonState, type DrawingAnnotation, type ElementStyles, type GestureAnnotation, type NearbyElement, type PendingAnnotation, type ProjectStyleContext, Skema, type SkemaMode, type SkemaProps, type UseDaemonOptions, type UseDaemonReturn, type ViewportInfo, addGridToSvg, bboxCenter, bboxDocumentToViewport, bboxFromPoints, bboxIntersects, bboxViewportToDocument, blobToBase64, createDOMSelection, Skema as default, documentToViewport, expandBbox, extractTextFromShapes, generateSelector, getBoundingBox, getElementClasses, getElementPath, getGridCellReference, getViewportInfo, identifyElement, pointInBbox, shouldIgnoreElement, useDaemon, viewportToDocument };
|
package/dist/index.d.ts
CHANGED
|
@@ -190,11 +190,23 @@ interface AnnotationExport {
|
|
|
190
190
|
interface SkemaProps {
|
|
191
191
|
/** Whether Skema overlay is enabled */
|
|
192
192
|
enabled?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* WebSocket URL for the Skema daemon (default: ws://localhost:9999)
|
|
195
|
+
* When provided (or using default), Skema auto-connects and handles AI generation internally.
|
|
196
|
+
* Set to null to disable auto-connection (useful if providing custom callbacks).
|
|
197
|
+
*/
|
|
198
|
+
daemonUrl?: string | null;
|
|
193
199
|
/** Callback when annotations change */
|
|
194
200
|
onAnnotationsChange?: (annotations: Annotation[]) => void;
|
|
195
|
-
/**
|
|
201
|
+
/**
|
|
202
|
+
* Callback when a single annotation is submitted.
|
|
203
|
+
* If not provided and daemonUrl is set, Skema will auto-generate using the daemon.
|
|
204
|
+
*/
|
|
196
205
|
onAnnotationSubmit?: (annotation: Annotation, comment: string) => void;
|
|
197
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Callback when an annotation is deleted.
|
|
208
|
+
* If not provided and daemonUrl is set, Skema will auto-revert using the daemon.
|
|
209
|
+
*/
|
|
198
210
|
onAnnotationDelete?: (annotationId: string) => void;
|
|
199
211
|
/** Keyboard shortcut to toggle Skema (default: Cmd/Ctrl + Shift + E) */
|
|
200
212
|
toggleShortcut?: string;
|
|
@@ -202,6 +214,10 @@ interface SkemaProps {
|
|
|
202
214
|
initialAnnotations?: Annotation[];
|
|
203
215
|
/** Z-index for the overlay (default: 99999) */
|
|
204
216
|
zIndex?: number;
|
|
217
|
+
/** Whether an annotation is currently being processed (shows loading animation) */
|
|
218
|
+
isProcessing?: boolean;
|
|
219
|
+
/** Callback when user cancels an in-progress annotation (clicks X during processing) */
|
|
220
|
+
onProcessingCancel?: () => void;
|
|
205
221
|
}
|
|
206
222
|
/**
|
|
207
223
|
* Skema mode - determines what tools are available
|
|
@@ -243,6 +259,68 @@ interface AnnotationPopupHandle {
|
|
|
243
259
|
}
|
|
244
260
|
declare const AnnotationPopup: React.ForwardRefExoticComponent<AnnotationPopupProps & React.RefAttributes<AnnotationPopupHandle>>;
|
|
245
261
|
|
|
262
|
+
type AIProvider = 'gemini' | 'claude';
|
|
263
|
+
interface DaemonState {
|
|
264
|
+
connected: boolean;
|
|
265
|
+
provider: AIProvider;
|
|
266
|
+
availableProviders: AIProvider[];
|
|
267
|
+
cwd: string;
|
|
268
|
+
}
|
|
269
|
+
interface AIStreamEvent {
|
|
270
|
+
type: 'init' | 'text' | 'tool_use' | 'tool_result' | 'error' | 'done' | 'debug';
|
|
271
|
+
content?: string;
|
|
272
|
+
timestamp: string;
|
|
273
|
+
provider: AIProvider;
|
|
274
|
+
raw?: unknown;
|
|
275
|
+
}
|
|
276
|
+
interface UseDaemonOptions {
|
|
277
|
+
/** WebSocket URL (default: ws://localhost:9999) */
|
|
278
|
+
url?: string;
|
|
279
|
+
/** Auto-connect on mount (default: true) */
|
|
280
|
+
autoConnect?: boolean;
|
|
281
|
+
/** Reconnect on disconnect (default: true) */
|
|
282
|
+
autoReconnect?: boolean;
|
|
283
|
+
/** Reconnect delay in ms (default: 2000) */
|
|
284
|
+
reconnectDelay?: number;
|
|
285
|
+
}
|
|
286
|
+
interface UseDaemonReturn {
|
|
287
|
+
/** Current daemon state */
|
|
288
|
+
state: DaemonState;
|
|
289
|
+
/** Whether currently generating */
|
|
290
|
+
isGenerating: boolean;
|
|
291
|
+
/** Last error message */
|
|
292
|
+
error: string | null;
|
|
293
|
+
/** Connect to daemon */
|
|
294
|
+
connect: () => void;
|
|
295
|
+
/** Disconnect from daemon */
|
|
296
|
+
disconnect: () => void;
|
|
297
|
+
/** Switch AI provider */
|
|
298
|
+
setProvider: (provider: AIProvider) => Promise<boolean>;
|
|
299
|
+
/** Generate code from annotation (streaming) */
|
|
300
|
+
generate: (annotation: Partial<Annotation> & {
|
|
301
|
+
comment?: string;
|
|
302
|
+
}, onEvent?: (event: AIStreamEvent) => void) => Promise<{
|
|
303
|
+
success: boolean;
|
|
304
|
+
annotationId: string;
|
|
305
|
+
}>;
|
|
306
|
+
/** Revert changes for an annotation */
|
|
307
|
+
revert: (annotationId: string) => Promise<{
|
|
308
|
+
success: boolean;
|
|
309
|
+
message: string;
|
|
310
|
+
}>;
|
|
311
|
+
/** Read a file */
|
|
312
|
+
readFile: (path: string) => Promise<string>;
|
|
313
|
+
/** Write a file */
|
|
314
|
+
writeFile: (path: string, content: string) => Promise<boolean>;
|
|
315
|
+
/** Run a command */
|
|
316
|
+
runCommand: (command: string) => Promise<{
|
|
317
|
+
stdout: string;
|
|
318
|
+
stderr: string;
|
|
319
|
+
exitCode: number;
|
|
320
|
+
}>;
|
|
321
|
+
}
|
|
322
|
+
declare function useDaemon(options?: UseDaemonOptions): UseDaemonReturn;
|
|
323
|
+
|
|
246
324
|
/**
|
|
247
325
|
* Generates a unique CSS selector for an element
|
|
248
326
|
*/
|
|
@@ -353,4 +431,4 @@ declare function getGridCellReference(x: number, y: number, gridSize?: number):
|
|
|
353
431
|
*/
|
|
354
432
|
declare function extractTextFromShapes(shapes: unknown[]): string;
|
|
355
433
|
|
|
356
|
-
export { type Annotation, type AnnotationExport, AnnotationPopup, type AnnotationPopupHandle, type AnnotationPopupProps, type BoundingBox, type DOMElement, type DOMSelection, type DrawingAnnotation, type ElementStyles, type GestureAnnotation, type NearbyElement, type PendingAnnotation, type ProjectStyleContext, Skema, type SkemaMode, type SkemaProps, type ViewportInfo, addGridToSvg, bboxCenter, bboxDocumentToViewport, bboxFromPoints, bboxIntersects, bboxViewportToDocument, blobToBase64, createDOMSelection, Skema as default, documentToViewport, expandBbox, extractTextFromShapes, generateSelector, getBoundingBox, getElementClasses, getElementPath, getGridCellReference, getViewportInfo, identifyElement, pointInBbox, shouldIgnoreElement, viewportToDocument };
|
|
434
|
+
export { type AIProvider, type AIStreamEvent, type Annotation, type AnnotationExport, AnnotationPopup, type AnnotationPopupHandle, type AnnotationPopupProps, type BoundingBox, type DOMElement, type DOMSelection, type DaemonState, type DrawingAnnotation, type ElementStyles, type GestureAnnotation, type NearbyElement, type PendingAnnotation, type ProjectStyleContext, Skema, type SkemaMode, type SkemaProps, type UseDaemonOptions, type UseDaemonReturn, type ViewportInfo, addGridToSvg, bboxCenter, bboxDocumentToViewport, bboxFromPoints, bboxIntersects, bboxViewportToDocument, blobToBase64, createDOMSelection, Skema as default, documentToViewport, expandBbox, extractTextFromShapes, generateSelector, getBoundingBox, getElementClasses, getElementPath, getGridCellReference, getViewportInfo, identifyElement, pointInBbox, shouldIgnoreElement, useDaemon, viewportToDocument };
|