stelo 1.0.1

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.
Files changed (141) hide show
  1. package/LICENSE +184 -0
  2. package/README.md +853 -0
  3. package/dist/accessibility.d.ts +227 -0
  4. package/dist/accessibility.d.ts.map +1 -0
  5. package/dist/accessibility.js +602 -0
  6. package/dist/accessibility.js.map +1 -0
  7. package/dist/agent.d.ts +870 -0
  8. package/dist/agent.d.ts.map +1 -0
  9. package/dist/agent.js +1107 -0
  10. package/dist/agent.js.map +1 -0
  11. package/dist/audio-stream.d.ts +114 -0
  12. package/dist/audio-stream.d.ts.map +1 -0
  13. package/dist/audio-stream.js +167 -0
  14. package/dist/audio-stream.js.map +1 -0
  15. package/dist/clipboard.d.ts +99 -0
  16. package/dist/clipboard.d.ts.map +1 -0
  17. package/dist/clipboard.js +352 -0
  18. package/dist/clipboard.js.map +1 -0
  19. package/dist/config.d.ts +183 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +477 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/context.d.ts +213 -0
  24. package/dist/context.d.ts.map +1 -0
  25. package/dist/context.js +387 -0
  26. package/dist/context.js.map +1 -0
  27. package/dist/cortex.d.ts +548 -0
  28. package/dist/cortex.d.ts.map +1 -0
  29. package/dist/cortex.js +1479 -0
  30. package/dist/cortex.js.map +1 -0
  31. package/dist/errors.d.ts +133 -0
  32. package/dist/errors.d.ts.map +1 -0
  33. package/dist/errors.js +278 -0
  34. package/dist/errors.js.map +1 -0
  35. package/dist/events.d.ts +227 -0
  36. package/dist/events.d.ts.map +1 -0
  37. package/dist/events.js +429 -0
  38. package/dist/events.js.map +1 -0
  39. package/dist/executor.d.ts +212 -0
  40. package/dist/executor.d.ts.map +1 -0
  41. package/dist/executor.js +545 -0
  42. package/dist/executor.js.map +1 -0
  43. package/dist/index.d.ts +69 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +167 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/integration.d.ts +159 -0
  48. package/dist/integration.d.ts.map +1 -0
  49. package/dist/integration.js +533 -0
  50. package/dist/integration.js.map +1 -0
  51. package/dist/keyboard.d.ts +276 -0
  52. package/dist/keyboard.d.ts.map +1 -0
  53. package/dist/keyboard.js +404 -0
  54. package/dist/keyboard.js.map +1 -0
  55. package/dist/logger.d.ts +198 -0
  56. package/dist/logger.d.ts.map +1 -0
  57. package/dist/logger.js +516 -0
  58. package/dist/logger.js.map +1 -0
  59. package/dist/middleware.d.ts +183 -0
  60. package/dist/middleware.d.ts.map +1 -0
  61. package/dist/middleware.js +493 -0
  62. package/dist/middleware.js.map +1 -0
  63. package/dist/monitor.d.ts +136 -0
  64. package/dist/monitor.d.ts.map +1 -0
  65. package/dist/monitor.js +341 -0
  66. package/dist/monitor.js.map +1 -0
  67. package/dist/mouse.d.ts +290 -0
  68. package/dist/mouse.d.ts.map +1 -0
  69. package/dist/mouse.js +466 -0
  70. package/dist/mouse.js.map +1 -0
  71. package/dist/plugin.d.ts +157 -0
  72. package/dist/plugin.d.ts.map +1 -0
  73. package/dist/plugin.js +409 -0
  74. package/dist/plugin.js.map +1 -0
  75. package/dist/process.d.ts +106 -0
  76. package/dist/process.d.ts.map +1 -0
  77. package/dist/process.js +326 -0
  78. package/dist/process.js.map +1 -0
  79. package/dist/recorder.d.ts +100 -0
  80. package/dist/recorder.d.ts.map +1 -0
  81. package/dist/recorder.js +258 -0
  82. package/dist/recorder.js.map +1 -0
  83. package/dist/safety.d.ts +59 -0
  84. package/dist/safety.d.ts.map +1 -0
  85. package/dist/safety.js +98 -0
  86. package/dist/safety.js.map +1 -0
  87. package/dist/scheduler.d.ts +152 -0
  88. package/dist/scheduler.d.ts.map +1 -0
  89. package/dist/scheduler.js +615 -0
  90. package/dist/scheduler.js.map +1 -0
  91. package/dist/screen.d.ts +96 -0
  92. package/dist/screen.d.ts.map +1 -0
  93. package/dist/screen.js +154 -0
  94. package/dist/screen.js.map +1 -0
  95. package/dist/session.d.ts +209 -0
  96. package/dist/session.d.ts.map +1 -0
  97. package/dist/session.js +479 -0
  98. package/dist/session.js.map +1 -0
  99. package/dist/stream.d.ts +168 -0
  100. package/dist/stream.d.ts.map +1 -0
  101. package/dist/stream.js +298 -0
  102. package/dist/stream.js.map +1 -0
  103. package/dist/telemetry.d.ts +223 -0
  104. package/dist/telemetry.d.ts.map +1 -0
  105. package/dist/telemetry.js +433 -0
  106. package/dist/telemetry.js.map +1 -0
  107. package/dist/types.d.ts +165 -0
  108. package/dist/types.d.ts.map +1 -0
  109. package/dist/types.js +8 -0
  110. package/dist/types.js.map +1 -0
  111. package/dist/utils/bezier.d.ts +51 -0
  112. package/dist/utils/bezier.d.ts.map +1 -0
  113. package/dist/utils/bezier.js +117 -0
  114. package/dist/utils/bezier.js.map +1 -0
  115. package/dist/utils/helpers.d.ts +90 -0
  116. package/dist/utils/helpers.d.ts.map +1 -0
  117. package/dist/utils/helpers.js +143 -0
  118. package/dist/utils/helpers.js.map +1 -0
  119. package/dist/utils/index.d.ts +4 -0
  120. package/dist/utils/index.d.ts.map +1 -0
  121. package/dist/utils/index.js +18 -0
  122. package/dist/utils/index.js.map +1 -0
  123. package/dist/validation.d.ts +254 -0
  124. package/dist/validation.d.ts.map +1 -0
  125. package/dist/validation.js +478 -0
  126. package/dist/validation.js.map +1 -0
  127. package/dist/vision.d.ts +719 -0
  128. package/dist/vision.d.ts.map +1 -0
  129. package/dist/vision.js +1197 -0
  130. package/dist/vision.js.map +1 -0
  131. package/dist/window.d.ts +80 -0
  132. package/dist/window.d.ts.map +1 -0
  133. package/dist/window.js +170 -0
  134. package/dist/window.js.map +1 -0
  135. package/dist/workflow.d.ts +224 -0
  136. package/dist/workflow.d.ts.map +1 -0
  137. package/dist/workflow.js +578 -0
  138. package/dist/workflow.js.map +1 -0
  139. package/index.d.ts +840 -0
  140. package/index.js +495 -0
  141. package/package.json +91 -0
package/dist/mouse.js ADDED
@@ -0,0 +1,466 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Stelo — Mouse Control API
4
+ // ============================================================================
5
+ // Ergonomic, chainable mouse control with sub-pixel precision.
6
+ // Includes async non-blocking movement for real-time AI agent control.
7
+ // ============================================================================
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.mouse = void 0;
10
+ // Import native bindings (generated by napi-rs at the project root)
11
+ const native = require('../index.js');
12
+ /** Internal: cubic ease-in-out for TypeScript-side async movement. */
13
+ function easeInOut(t) {
14
+ return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
15
+ }
16
+ /** Internal: generate a simple bezier-like path on the TS side. */
17
+ function generateAsyncPath(from, to, steps, easing = easeInOut) {
18
+ const points = [];
19
+ // Add a slight perpendicular curve for natural feel
20
+ const dx = to.x - from.x;
21
+ const dy = to.y - from.y;
22
+ const dist = Math.sqrt(dx * dx + dy * dy);
23
+ const nx = -dy / (dist || 1);
24
+ const ny = dx / (dist || 1);
25
+ const curveMag = dist * 0.15;
26
+ for (let i = 0; i <= steps; i++) {
27
+ const t = i / steps;
28
+ const e = easing(t);
29
+ // Quadratic arc: peaks at t=0.5
30
+ const arc = 4 * t * (1 - t) * curveMag;
31
+ points.push({
32
+ x: Math.round(from.x + dx * e + nx * arc),
33
+ y: Math.round(from.y + dy * e + ny * arc),
34
+ });
35
+ }
36
+ // Ensure last point is exact
37
+ points[points.length - 1] = { x: to.x, y: to.y };
38
+ return points;
39
+ }
40
+ /**
41
+ * Execute a step-by-step mouse movement using setTimeout.
42
+ * Non-blocking: the event loop is free between each step.
43
+ */
44
+ function asyncStepMovement(points, delayPerStepMs) {
45
+ let cancelled = false;
46
+ let stepIndex = 0;
47
+ let timer = null;
48
+ let resolvePromise = null;
49
+ const promise = new Promise((resolve) => {
50
+ resolvePromise = resolve;
51
+ function step() {
52
+ if (cancelled || stepIndex >= points.length) {
53
+ const pos = native.mouseGetPosition();
54
+ resolve({ x: pos.x, y: pos.y });
55
+ return;
56
+ }
57
+ const pt = points[stepIndex++];
58
+ native.mouseMove(pt.x, pt.y);
59
+ if (stepIndex < points.length) {
60
+ timer = setTimeout(step, delayPerStepMs);
61
+ }
62
+ else {
63
+ resolve({ x: pt.x, y: pt.y });
64
+ }
65
+ }
66
+ step();
67
+ });
68
+ return {
69
+ promise,
70
+ cancel() {
71
+ if (cancelled)
72
+ return;
73
+ cancelled = true;
74
+ if (timer !== null)
75
+ clearTimeout(timer);
76
+ // Immediately resolve with current position
77
+ if (resolvePromise) {
78
+ const pos = native.mouseGetPosition();
79
+ resolvePromise({ x: pos.x, y: pos.y });
80
+ resolvePromise = null;
81
+ }
82
+ },
83
+ };
84
+ }
85
+ /**
86
+ * Mouse control interface.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * import { mouse } from 'stelo';
91
+ *
92
+ * // Instant move
93
+ * mouse.move(100, 200);
94
+ *
95
+ * // Smooth bezier movement
96
+ * mouse.moveSmoothly(500, 400, { duration: 1000, curve: 'bezier' });
97
+ *
98
+ * // Human-like movement
99
+ * mouse.moveHumanized(800, 600);
100
+ *
101
+ * // Click, double-click, right-click
102
+ * mouse.click();
103
+ * mouse.doubleClick();
104
+ * mouse.click('right');
105
+ *
106
+ * // Drag
107
+ * mouse.drag(100, 100, 500, 400);
108
+ *
109
+ * // Scroll
110
+ * mouse.scroll(3, 'up');
111
+ * ```
112
+ */
113
+ exports.mouse = {
114
+ /**
115
+ * Move cursor instantly to absolute screen coordinates.
116
+ */
117
+ move(x, y) {
118
+ native.mouseMove(x, y);
119
+ },
120
+ /**
121
+ * Get current cursor position.
122
+ */
123
+ getPosition() {
124
+ return native.mouseGetPosition();
125
+ },
126
+ /**
127
+ * Move cursor smoothly to target with configurable curve and duration.
128
+ */
129
+ moveSmoothly(x, y, options) {
130
+ native.mouseMoveSmooth(x, y, options?.duration ?? undefined, options?.curve ?? undefined, options?.stepsPerSecond ?? undefined);
131
+ },
132
+ /**
133
+ * Move cursor with humanized, natural-feeling motion.
134
+ * Includes micro-jitter, variable speed, and optional overshoot.
135
+ */
136
+ moveHumanized(x, y, options) {
137
+ native.mouseMoveHumanized(x, y, options?.duration ?? undefined, options?.jitter ?? undefined, options?.overshoot ?? undefined);
138
+ },
139
+ /**
140
+ * Click a mouse button at the current position.
141
+ * @param button - 'left' (default), 'right', or 'middle'
142
+ */
143
+ click(button) {
144
+ native.mouseClick(button);
145
+ },
146
+ /**
147
+ * Double-click a mouse button.
148
+ */
149
+ doubleClick(button) {
150
+ native.mouseDoubleClick(button);
151
+ },
152
+ /**
153
+ * Triple-click (select line/paragraph).
154
+ */
155
+ tripleClick(button) {
156
+ native.mouseTripleClick(button);
157
+ },
158
+ /**
159
+ * Press (hold down) a mouse button without releasing.
160
+ */
161
+ down(button) {
162
+ native.mouseDown(button);
163
+ },
164
+ /**
165
+ * Release a mouse button.
166
+ */
167
+ up(button) {
168
+ native.mouseUp(button);
169
+ },
170
+ /**
171
+ * Scroll the mouse wheel.
172
+ * @param amount - Number of scroll increments
173
+ * @param direction - 'up' (default), 'down', 'left', 'right'
174
+ */
175
+ scroll(amount = 1, direction) {
176
+ native.mouseScroll(amount, direction);
177
+ },
178
+ /**
179
+ * Scroll the mouse wheel smoothly over time.
180
+ * @param amount - Number of scroll increments
181
+ * @param direction - 'up' (default), 'down', 'left', 'right'
182
+ * @param duration - Duration of the scroll in ms
183
+ */
184
+ scrollSmooth(amount = 1, direction, duration) {
185
+ native.mouseScrollSmooth(amount, direction, duration);
186
+ },
187
+ /**
188
+ * Drag from one point to another.
189
+ */
190
+ drag(fromX, fromY, toX, toY, options) {
191
+ native.mouseDrag(fromX, fromY, toX, toY, options?.button ?? undefined, options?.duration ?? undefined);
192
+ },
193
+ /**
194
+ * Click at a specific position.
195
+ * @param x - X coordinate
196
+ * @param y - Y coordinate
197
+ * @param button - Mouse button (default: 'left')
198
+ * @param restorePosition If true, returns cursor to original position after clicking
199
+ */
200
+ clickAt(x, y, button, restorePosition) {
201
+ native.mouseClickAt(x, y, button, restorePosition);
202
+ },
203
+ /**
204
+ * Move to a position and click in one call.
205
+ */
206
+ moveAndClick(x, y, button) {
207
+ native.mouseMove(x, y);
208
+ native.mouseClick(button);
209
+ },
210
+ // ── Async (Non-Blocking) Movement ─────────────────────────────────────
211
+ // These methods move the cursor step-by-step using setTimeout so the
212
+ // Node.js event loop stays free between steps. The cursor moves visually
213
+ // on-screen in real-time. Perfect for AI agents that need to observe
214
+ // and react while the mouse is in motion.
215
+ // ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ──
216
+ /**
217
+ * Move cursor smoothly to target — **non-blocking**.
218
+ *
219
+ * Unlike `moveSmoothly()` (which blocks the thread), this method yields
220
+ * control back to the event loop between each step. The cursor moves
221
+ * visually on-screen and other code (screen captures, AI inference, etc.)
222
+ * can run in parallel.
223
+ *
224
+ * @returns A `MovementHandle` with `.promise` and `.cancel()`.
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * // Simple await
229
+ * await mouse.moveSmoothAsync(500, 400, { duration: 600 });
230
+ *
231
+ * // Cancel mid-flight
232
+ * const handle = mouse.moveSmoothAsync(500, 400);
233
+ * setTimeout(() => handle.cancel(), 200);
234
+ * await handle.promise;
235
+ *
236
+ * // Run movement + screen monitoring in parallel
237
+ * const [_, frame] = await Promise.all([
238
+ * mouse.moveSmoothAsync(500, 400).promise,
239
+ * captureScreenDuringMovement(),
240
+ * ]);
241
+ * ```
242
+ */
243
+ moveSmoothAsync(x, y, options) {
244
+ const from = native.mouseGetPosition();
245
+ const duration = options?.duration ?? 500;
246
+ const stepsPerSecond = options?.stepsPerSecond ?? 120;
247
+ const totalSteps = Math.max(2, Math.round((stepsPerSecond * duration) / 1000));
248
+ const delayMs = Math.max(1, Math.round(duration / totalSteps));
249
+ const path = generateAsyncPath(from, { x, y }, totalSteps);
250
+ return asyncStepMovement(path, delayMs);
251
+ },
252
+ /**
253
+ * Move cursor with humanized motion — **non-blocking**.
254
+ *
255
+ * Same as `moveHumanized()` but non-blocking. The cursor visually traces
256
+ * a natural-looking path with jitter and variable speed, while the event
257
+ * loop stays free for other operations.
258
+ *
259
+ * @returns A `MovementHandle` with `.promise` and `.cancel()`.
260
+ */
261
+ moveHumanizedAsync(x, y, options) {
262
+ const from = native.mouseGetPosition();
263
+ const duration = options?.duration ?? 800;
264
+ const jitter = options?.jitter ?? 0.5;
265
+ const stepsPerSecond = 120;
266
+ const totalSteps = Math.max(2, Math.round((stepsPerSecond * duration) / 1000));
267
+ const delayMs = Math.max(1, Math.round(duration / totalSteps));
268
+ const dx = x - from.x;
269
+ const dy = y - from.y;
270
+ const dist = Math.sqrt(dx * dx + dy * dy);
271
+ const jitterMag = jitter * dist * 0.05;
272
+ // Build a humanized path with wind-like deviation and jitter
273
+ const path = [];
274
+ let wx = 0, wy = 0;
275
+ let vx = 0, vy = 0;
276
+ let cx = from.x, cy = from.y;
277
+ const gravity = dist / Math.max(totalSteps, 1);
278
+ const windStr = gravity * 0.8;
279
+ const maxStep = dist / Math.max(totalSteps * 0.5, 1);
280
+ for (let i = 0; i <= totalSteps; i++) {
281
+ const t = i / totalSteps;
282
+ const remaining = Math.sqrt((x - cx) ** 2 + (y - cy) ** 2);
283
+ if (remaining < 1) {
284
+ path.push({ x, y });
285
+ continue;
286
+ }
287
+ wx = wx / 2 + (Math.random() * 2 - 1) * windStr;
288
+ wy = wy / 2 + (Math.random() * 2 - 1) * windStr;
289
+ const gx = gravity * (x - cx) / remaining;
290
+ const gy = gravity * (y - cy) / remaining;
291
+ vx += gx + wx;
292
+ vy += gy + wy;
293
+ const speed = Math.sqrt(vx * vx + vy * vy);
294
+ if (speed > maxStep) {
295
+ const scale = maxStep / speed;
296
+ vx *= scale;
297
+ vy *= scale;
298
+ }
299
+ const progress = 1 - remaining / dist;
300
+ const speedFactor = 0.5 + 0.8 * Math.sin(Math.PI * progress);
301
+ vx *= speedFactor;
302
+ vy *= speedFactor;
303
+ cx += vx + (Math.random() * 2 - 1) * jitterMag;
304
+ cy += vy + (Math.random() * 2 - 1) * jitterMag;
305
+ path.push({ x: Math.round(cx), y: Math.round(cy) });
306
+ }
307
+ // Ensure endpoints
308
+ path[0] = { x: from.x, y: from.y };
309
+ path[path.length - 1] = { x, y };
310
+ return asyncStepMovement(path, delayMs);
311
+ },
312
+ /**
313
+ * Move the cursor along an arbitrary path of points — **non-blocking**.
314
+ *
315
+ * Pass any array of `{ x, y }` waypoints. The cursor follows the path
316
+ * with the given delay between each point. Ideal for replaying recorded
317
+ * gestures, following geometry, or executing complex paths from AI models.
318
+ *
319
+ * @returns A `MovementHandle` with `.promise` and `.cancel()`.
320
+ *
321
+ * @example
322
+ * ```typescript
323
+ * // Trace a rectangle
324
+ * await mouse.moveAlongPath([
325
+ * { x: 100, y: 100 },
326
+ * { x: 500, y: 100 },
327
+ * { x: 500, y: 400 },
328
+ * { x: 100, y: 400 },
329
+ * { x: 100, y: 100 },
330
+ * ], { stepDelayMs: 5 }).promise;
331
+ * ```
332
+ */
333
+ moveAlongPath(path, options) {
334
+ const delay = options?.stepDelayMs ?? 8;
335
+ return asyncStepMovement(path, delay);
336
+ },
337
+ /**
338
+ * Move to target position and click — **non-blocking smooth movement**.
339
+ *
340
+ * Smoothly moves to the target, then clicks. Returns after both complete.
341
+ *
342
+ * @example
343
+ * ```typescript
344
+ * await mouse.moveAndClickAsync(500, 300, { duration: 400 });
345
+ * ```
346
+ */
347
+ async moveAndClickAsync(x, y, options) {
348
+ await this.moveSmoothAsync(x, y, options).promise;
349
+ native.mouseClick(options?.button);
350
+ },
351
+ /**
352
+ * Drag from current position to target — **non-blocking smooth movement**.
353
+ *
354
+ * The cursor visibly moves to the target while holding the mouse button.
355
+ *
356
+ * @example
357
+ * ```typescript
358
+ * mouse.move(100, 100);
359
+ * await mouse.dragAsync(500, 400, { duration: 800 });
360
+ * ```
361
+ */
362
+ async dragAsync(toX, toY, options) {
363
+ const button = options?.button ?? 'left';
364
+ native.mouseDown(button);
365
+ await new Promise(r => setTimeout(r, 30));
366
+ await this.moveSmoothAsync(toX, toY, { duration: options?.duration ?? 500 }).promise;
367
+ await new Promise(r => setTimeout(r, 30));
368
+ native.mouseUp(button);
369
+ },
370
+ /**
371
+ * Get current X coordinate.
372
+ */
373
+ get x() {
374
+ return native.mouseGetPosition().x;
375
+ },
376
+ /**
377
+ * Get current Y coordinate.
378
+ */
379
+ get y() {
380
+ return native.mouseGetPosition().y;
381
+ },
382
+ // ── Gesture Primitives ──────────────────────────────────────────────────
383
+ /**
384
+ * Move the cursor smoothly through a sequence of waypoints.
385
+ *
386
+ * @example
387
+ * ```typescript
388
+ * // Visit three points with smooth interpolation
389
+ * mouse.moveThroughPoints([[100,200], [400,300], [600,100]], 1000);
390
+ * ```
391
+ */
392
+ moveThroughPoints(points, durationMs, options) {
393
+ native.mouseMoveThroughPoints(points.map(([x, y]) => [x, y]), durationMs, options?.curve, options?.stepsPerSecond);
394
+ },
395
+ /**
396
+ * Trace a circular gesture around a center point.
397
+ *
398
+ * @example
399
+ * ```typescript
400
+ * mouse.gestureCircle(500, 400, 100, 1000); // 100px radius circle in 1s
401
+ * ```
402
+ */
403
+ gestureCircle(centerX, centerY, radius, durationMs, options) {
404
+ native.mouseGestureCircle(centerX, centerY, radius, durationMs, options?.clockwise, options?.stepsPerSecond);
405
+ },
406
+ /**
407
+ * Fast swipe gesture — flick-like motion between two points.
408
+ * Optionally holds a mouse button during the swipe (for drag-swipes).
409
+ *
410
+ * @example
411
+ * ```typescript
412
+ * mouse.gestureSwipe(100, 500, 100, 100, { duration: 150 }); // swipe up
413
+ * ```
414
+ */
415
+ gestureSwipe(fromX, fromY, toX, toY, options) {
416
+ native.mouseGestureSwipe(fromX, fromY, toX, toY, options?.duration, options?.holdButton);
417
+ },
418
+ /**
419
+ * Drag along an arbitrary path while holding a mouse button.
420
+ * Perfect for drawing, resizing, or complex drag operations.
421
+ *
422
+ * @example
423
+ * ```typescript
424
+ * mouse.gestureDragPath([[100,100], [200,150], [300,100], [400,200]], 1000);
425
+ * ```
426
+ */
427
+ gestureDragPath(points, durationMs, options) {
428
+ native.mouseGestureDragPath(points.map(([x, y]) => [x, y]), options?.button, durationMs, options?.stepsPerSecond);
429
+ },
430
+ /**
431
+ * Spiral inward or outward from a center point.
432
+ *
433
+ * @example
434
+ * ```typescript
435
+ * // Spiral outward from center, 0→200px radius, 3 turns, 2 seconds
436
+ * mouse.gestureSpiral(500, 400, 0, 200, 3, 2000);
437
+ * ```
438
+ */
439
+ gestureSpiral(centerX, centerY, startRadius, endRadius, turns, durationMs, options) {
440
+ native.mouseGestureSpiral(centerX, centerY, startRadius, endRadius, turns, durationMs, options?.stepsPerSecond);
441
+ },
442
+ /**
443
+ * Zigzag motion — oscillates perpendicular to the travel direction.
444
+ *
445
+ * @example
446
+ * ```typescript
447
+ * // Zigzag from left to right with 30px amplitude, 5 waves
448
+ * mouse.gestureZigzag(100, 300, 800, 300, 30, 5, 1000);
449
+ * ```
450
+ */
451
+ gestureZigzag(fromX, fromY, toX, toY, amplitude, waves, durationMs, options) {
452
+ native.mouseGestureZigzag(fromX, fromY, toX, toY, amplitude, waves, durationMs, options?.stepsPerSecond);
453
+ },
454
+ /**
455
+ * Trace a rectangular path — clockwise from top-left corner.
456
+ *
457
+ * @example
458
+ * ```typescript
459
+ * mouse.gestureRectangle(100, 100, 400, 300, 2000);
460
+ * ```
461
+ */
462
+ gestureRectangle(x, y, width, height, durationMs, options) {
463
+ native.mouseGestureRectangle(x, y, width, height, durationMs, options?.curve);
464
+ },
465
+ };
466
+ //# sourceMappingURL=mouse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mouse.js","sourceRoot":"","sources":["../ts/mouse.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAC/E,+DAA+D;AAC/D,uEAAuE;AACvE,+EAA+E;;;AAW/E,oEAAoE;AACpE,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAgBtC,sEAAsE;AACtE,SAAS,SAAS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AAU,EAC5B,OAAO,EAAE,cAAc,CACxB,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,gBAAgB,CACd,CAAS,EACT,CAAS,EACT,KAAa,EACb,MAAc,EACd,UAAkB,EAClB,OAA4B;QAE5B,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAChF,CAAC;CACF,CAAC"}
@@ -0,0 +1,157 @@
1
+ import { events } from './events';
2
+ import { logger } from './logger';
3
+ export type PluginStatus = 'registered' | 'initializing' | 'active' | 'paused' | 'error' | 'unloaded';
4
+ export interface PluginManifest {
5
+ /** Unique plugin identifier (e.g. 'stelo-plugin-ocr') */
6
+ id: string;
7
+ /** Human-readable name */
8
+ name: string;
9
+ /** Semantic version */
10
+ version: string;
11
+ /** Description */
12
+ description?: string;
13
+ /** Author */
14
+ author?: string;
15
+ /** Plugin dependencies (other plugin IDs) */
16
+ dependencies?: string[];
17
+ /** Stelo SDK minimum version */
18
+ steloVersion?: string;
19
+ /** Tags for categorization */
20
+ tags?: string[];
21
+ /** Plugin priority (higher = loaded first). Default: 0 */
22
+ priority?: number;
23
+ }
24
+ export interface PluginAPI {
25
+ /** Access to the event bus */
26
+ events: typeof events;
27
+ /** Access to the logger (scoped to the plugin) */
28
+ logger: ReturnType<typeof logger.child>;
29
+ /** Get a reference to another plugin's exports */
30
+ getPlugin<T = any>(pluginId: string): T | null;
31
+ /** Register a hook that other plugins can call */
32
+ registerHook(name: string, fn: (...args: any[]) => any): void;
33
+ /** Call a hook registered by any plugin */
34
+ callHook<T = any>(name: string, ...args: any[]): Promise<T[]>;
35
+ /** Get plugin config (from Stelo config system) */
36
+ getConfig<T = any>(key: string, defaultValue?: T): T;
37
+ /** Set plugin config */
38
+ setConfig(key: string, value: any): void;
39
+ }
40
+ export interface PluginDefinition {
41
+ /** Plugin manifest/metadata */
42
+ manifest: PluginManifest;
43
+ /** Initialize the plugin. Return an object to expose as the plugin's API. */
44
+ init(api: PluginAPI): any | Promise<any>;
45
+ /** Called when the plugin is being unloaded (cleanup). */
46
+ destroy?(): void | Promise<void>;
47
+ /** Called when the plugin is paused. */
48
+ onPause?(): void | Promise<void>;
49
+ /** Called when the plugin is resumed. */
50
+ onResume?(): void | Promise<void>;
51
+ }
52
+ export interface PluginInfo {
53
+ id: string;
54
+ name: string;
55
+ version: string;
56
+ status: PluginStatus;
57
+ description?: string;
58
+ author?: string;
59
+ tags: string[];
60
+ loadedAt?: string;
61
+ errorMessage?: string;
62
+ }
63
+ export interface PluginSystemStats {
64
+ totalPlugins: number;
65
+ activePlugins: number;
66
+ errorPlugins: number;
67
+ totalHooks: number;
68
+ }
69
+ export declare const plugin: {
70
+ /**
71
+ * Register a plugin (does not initialize it yet).
72
+ */
73
+ register(definition: PluginDefinition): void;
74
+ /**
75
+ * Initialize and activate a specific plugin.
76
+ */
77
+ activate(pluginId: string): Promise<boolean>;
78
+ /**
79
+ * Activate all registered plugins (in dependency order).
80
+ */
81
+ activateAll(): Promise<{
82
+ activated: string[];
83
+ failed: string[];
84
+ }>;
85
+ /**
86
+ * Deactivate/unload a plugin.
87
+ */
88
+ deactivate(pluginId: string): Promise<boolean>;
89
+ /**
90
+ * Pause a plugin.
91
+ */
92
+ pause(pluginId: string): Promise<boolean>;
93
+ /**
94
+ * Resume a paused plugin.
95
+ */
96
+ resume(pluginId: string): Promise<boolean>;
97
+ /**
98
+ * Get a plugin's exported API.
99
+ */
100
+ get<T = any>(pluginId: string): T | null;
101
+ /**
102
+ * Get plugin info.
103
+ */
104
+ getInfo(pluginId: string): PluginInfo | null;
105
+ /**
106
+ * List all registered plugins.
107
+ */
108
+ list(): PluginInfo[];
109
+ /**
110
+ * Check if a plugin is registered.
111
+ */
112
+ has(pluginId: string): boolean;
113
+ /**
114
+ * Check if a plugin is active.
115
+ */
116
+ isActive(pluginId: string): boolean;
117
+ /**
118
+ * Call a named hook registered by any plugin. Returns all results.
119
+ */
120
+ callHook<T = any>(name: string, ...args: any[]): Promise<T[]>;
121
+ /**
122
+ * List all registered hook names.
123
+ */
124
+ listHooks(): string[];
125
+ /**
126
+ * Get all handlers for a specific hook.
127
+ */
128
+ getHookHandlers(name: string): Array<{
129
+ pluginId: string;
130
+ }>;
131
+ /**
132
+ * Quick plugin definition builder.
133
+ *
134
+ * @example
135
+ * plugin.register(plugin.define({
136
+ * id: 'my-plugin',
137
+ * name: 'My Plugin',
138
+ * version: '1.0.0',
139
+ * }, async (api) => {
140
+ * api.logger.info('Hello from my plugin!');
141
+ * api.registerHook('transform', (data) => data.toUpperCase());
142
+ * return { greet: () => 'hello!' };
143
+ * }));
144
+ */
145
+ define(manifest: PluginManifest, init: (api: PluginAPI) => any | Promise<any>, options?: {
146
+ destroy?: () => void | Promise<void>;
147
+ onPause?: () => void | Promise<void>;
148
+ onResume?: () => void | Promise<void>;
149
+ }): PluginDefinition;
150
+ /**
151
+ * Get stats about the plugin system.
152
+ */
153
+ getStats(): PluginSystemStats;
154
+ /** Reset the plugin system (deactivate all, clear state) */
155
+ reset(): Promise<void>;
156
+ };
157
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../ts/plugin.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,cAAc,GACd,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,UAAU,CAAC;AAEf,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IAC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