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.
- package/LICENSE +184 -0
- package/README.md +853 -0
- package/dist/accessibility.d.ts +227 -0
- package/dist/accessibility.d.ts.map +1 -0
- package/dist/accessibility.js +602 -0
- package/dist/accessibility.js.map +1 -0
- package/dist/agent.d.ts +870 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +1107 -0
- package/dist/agent.js.map +1 -0
- package/dist/audio-stream.d.ts +114 -0
- package/dist/audio-stream.d.ts.map +1 -0
- package/dist/audio-stream.js +167 -0
- package/dist/audio-stream.js.map +1 -0
- package/dist/clipboard.d.ts +99 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +352 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/config.d.ts +183 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +477 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +213 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +387 -0
- package/dist/context.js.map +1 -0
- package/dist/cortex.d.ts +548 -0
- package/dist/cortex.d.ts.map +1 -0
- package/dist/cortex.js +1479 -0
- package/dist/cortex.js.map +1 -0
- package/dist/errors.d.ts +133 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +278 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +227 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +429 -0
- package/dist/events.js.map +1 -0
- package/dist/executor.d.ts +212 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +545 -0
- package/dist/executor.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +167 -0
- package/dist/index.js.map +1 -0
- package/dist/integration.d.ts +159 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +533 -0
- package/dist/integration.js.map +1 -0
- package/dist/keyboard.d.ts +276 -0
- package/dist/keyboard.d.ts.map +1 -0
- package/dist/keyboard.js +404 -0
- package/dist/keyboard.js.map +1 -0
- package/dist/logger.d.ts +198 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +516 -0
- package/dist/logger.js.map +1 -0
- package/dist/middleware.d.ts +183 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +493 -0
- package/dist/middleware.js.map +1 -0
- package/dist/monitor.d.ts +136 -0
- package/dist/monitor.d.ts.map +1 -0
- package/dist/monitor.js +341 -0
- package/dist/monitor.js.map +1 -0
- package/dist/mouse.d.ts +290 -0
- package/dist/mouse.d.ts.map +1 -0
- package/dist/mouse.js +466 -0
- package/dist/mouse.js.map +1 -0
- package/dist/plugin.d.ts +157 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +409 -0
- package/dist/plugin.js.map +1 -0
- package/dist/process.d.ts +106 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +326 -0
- package/dist/process.js.map +1 -0
- package/dist/recorder.d.ts +100 -0
- package/dist/recorder.d.ts.map +1 -0
- package/dist/recorder.js +258 -0
- package/dist/recorder.js.map +1 -0
- package/dist/safety.d.ts +59 -0
- package/dist/safety.d.ts.map +1 -0
- package/dist/safety.js +98 -0
- package/dist/safety.js.map +1 -0
- package/dist/scheduler.d.ts +152 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +615 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/screen.d.ts +96 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +154 -0
- package/dist/screen.js.map +1 -0
- package/dist/session.d.ts +209 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +479 -0
- package/dist/session.js.map +1 -0
- package/dist/stream.d.ts +168 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +298 -0
- package/dist/stream.js.map +1 -0
- package/dist/telemetry.d.ts +223 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +433 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/types.d.ts +165 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/bezier.d.ts +51 -0
- package/dist/utils/bezier.d.ts.map +1 -0
- package/dist/utils/bezier.js +117 -0
- package/dist/utils/bezier.js.map +1 -0
- package/dist/utils/helpers.d.ts +90 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +143 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/validation.d.ts +254 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +478 -0
- package/dist/validation.js.map +1 -0
- package/dist/vision.d.ts +719 -0
- package/dist/vision.d.ts.map +1 -0
- package/dist/vision.js +1197 -0
- package/dist/vision.js.map +1 -0
- package/dist/window.d.ts +80 -0
- package/dist/window.d.ts.map +1 -0
- package/dist/window.js +170 -0
- package/dist/window.js.map +1 -0
- package/dist/workflow.d.ts +224 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +578 -0
- package/dist/workflow.js.map +1 -0
- package/index.d.ts +840 -0
- package/index.js +495 -0
- package/package.json +91 -0
package/dist/executor.js
ADDED
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Stelo — Queue-Based Action Executor
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// Priority-queue executor with cancellation, timeouts, concurrency control,
|
|
6
|
+
// dependency tracking, retry logic, and full lifecycle events.
|
|
7
|
+
// ============================================================================
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Executor = void 0;
|
|
10
|
+
exports.getDefaultExecutor = getDefaultExecutor;
|
|
11
|
+
exports.createExecutor = createExecutor;
|
|
12
|
+
exports.enqueue = enqueue;
|
|
13
|
+
exports.urgent = urgent;
|
|
14
|
+
exports.background = background;
|
|
15
|
+
const events_1 = require("./events");
|
|
16
|
+
const logger_1 = require("./logger");
|
|
17
|
+
// ── Priority Queue ───────────────────────────────────────────────────────────
|
|
18
|
+
class PriorityQueue {
|
|
19
|
+
_items = [];
|
|
20
|
+
_fifo;
|
|
21
|
+
constructor(fifo = true) {
|
|
22
|
+
this._fifo = fifo;
|
|
23
|
+
}
|
|
24
|
+
enqueue(item) {
|
|
25
|
+
this._items.push(item);
|
|
26
|
+
this._items.sort((a, b) => {
|
|
27
|
+
// Higher priority first
|
|
28
|
+
if (b.priority !== a.priority)
|
|
29
|
+
return b.priority - a.priority;
|
|
30
|
+
// FIFO within same priority
|
|
31
|
+
if (this._fifo)
|
|
32
|
+
return a.createdAt < b.createdAt ? -1 : 1;
|
|
33
|
+
return 0;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
dequeue() {
|
|
37
|
+
return this._items.shift();
|
|
38
|
+
}
|
|
39
|
+
peek() {
|
|
40
|
+
return this._items[0];
|
|
41
|
+
}
|
|
42
|
+
remove(predicate) {
|
|
43
|
+
const removed = [];
|
|
44
|
+
this._items = this._items.filter((item) => {
|
|
45
|
+
if (predicate(item)) {
|
|
46
|
+
removed.push(item);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
});
|
|
51
|
+
return removed;
|
|
52
|
+
}
|
|
53
|
+
get size() {
|
|
54
|
+
return this._items.length;
|
|
55
|
+
}
|
|
56
|
+
clear() {
|
|
57
|
+
const items = [...this._items];
|
|
58
|
+
this._items = [];
|
|
59
|
+
return items;
|
|
60
|
+
}
|
|
61
|
+
toArray() {
|
|
62
|
+
return [...this._items];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// ── Executor ─────────────────────────────────────────────────────────────────
|
|
66
|
+
let _taskCounter = 0;
|
|
67
|
+
class Executor {
|
|
68
|
+
_queue;
|
|
69
|
+
_running = new Map();
|
|
70
|
+
_completed = new Map();
|
|
71
|
+
_options;
|
|
72
|
+
_isRunning = false;
|
|
73
|
+
_isPaused = false;
|
|
74
|
+
_stats = {
|
|
75
|
+
totalSubmitted: 0,
|
|
76
|
+
completedCount: 0,
|
|
77
|
+
failedCount: 0,
|
|
78
|
+
cancelledCount: 0,
|
|
79
|
+
timedOutCount: 0,
|
|
80
|
+
totalDurationMs: 0,
|
|
81
|
+
};
|
|
82
|
+
_processing = false;
|
|
83
|
+
_log;
|
|
84
|
+
_groupLocks = new Map();
|
|
85
|
+
constructor(options) {
|
|
86
|
+
this._options = {
|
|
87
|
+
maxConcurrency: options?.maxConcurrency ?? 1,
|
|
88
|
+
defaultTimeoutMs: options?.defaultTimeoutMs ?? 30000,
|
|
89
|
+
defaultPriority: (options?.defaultPriority ?? 5),
|
|
90
|
+
maxQueueSize: options?.maxQueueSize ?? 10000,
|
|
91
|
+
defaultRetryAttempts: options?.defaultRetryAttempts ?? 0,
|
|
92
|
+
defaultRetryDelayMs: options?.defaultRetryDelayMs ?? 1000,
|
|
93
|
+
fifoWithinPriority: options?.fifoWithinPriority ?? true,
|
|
94
|
+
pauseOnFailure: options?.pauseOnFailure ?? false,
|
|
95
|
+
logging: options?.logging ?? true,
|
|
96
|
+
};
|
|
97
|
+
this._queue = new PriorityQueue(this._options.fifoWithinPriority);
|
|
98
|
+
this._log = logger_1.logger.child('executor');
|
|
99
|
+
this._isRunning = true;
|
|
100
|
+
}
|
|
101
|
+
// ── Submit Tasks ─────────────────────────────────────────────────────────
|
|
102
|
+
/**
|
|
103
|
+
* Submit a task to the executor.
|
|
104
|
+
* Returns a promise that resolves with the task result.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const result = await executor.submit('moveToButton', () => {
|
|
109
|
+
* mouse.moveSmoothly(500, 300);
|
|
110
|
+
* }, { priority: 8, timeoutMs: 5000 });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
submit(name, execute, options) {
|
|
114
|
+
if (!this._isRunning) {
|
|
115
|
+
return Promise.reject(new Error('Executor is stopped'));
|
|
116
|
+
}
|
|
117
|
+
if (this._options.maxQueueSize > 0 && this._queue.size >= this._options.maxQueueSize) {
|
|
118
|
+
return Promise.reject(new Error(`Queue is full (max: ${this._options.maxQueueSize})`));
|
|
119
|
+
}
|
|
120
|
+
let resolve;
|
|
121
|
+
let reject;
|
|
122
|
+
const promise = new Promise((res, rej) => {
|
|
123
|
+
resolve = res;
|
|
124
|
+
reject = rej;
|
|
125
|
+
});
|
|
126
|
+
const task = {
|
|
127
|
+
id: `task_${Date.now().toString(36)}_${(++_taskCounter).toString(36)}`,
|
|
128
|
+
name,
|
|
129
|
+
status: 'queued',
|
|
130
|
+
priority: (options?.priority ?? this._options.defaultPriority),
|
|
131
|
+
execute,
|
|
132
|
+
attempt: 0,
|
|
133
|
+
maxAttempts: (options?.retryAttempts ?? this._options.defaultRetryAttempts) + 1,
|
|
134
|
+
retryDelayMs: options?.retryDelayMs ?? this._options.defaultRetryDelayMs,
|
|
135
|
+
retryBackoff: options?.retryBackoff ?? 2.0,
|
|
136
|
+
timeoutMs: options?.timeoutMs ?? this._options.defaultTimeoutMs,
|
|
137
|
+
tags: options?.tags ?? [],
|
|
138
|
+
group: options?.group,
|
|
139
|
+
dependsOn: options?.dependsOn ?? [],
|
|
140
|
+
metadata: options?.metadata ?? {},
|
|
141
|
+
createdAt: new Date().toISOString(),
|
|
142
|
+
promise,
|
|
143
|
+
_resolve: resolve,
|
|
144
|
+
_reject: reject,
|
|
145
|
+
signal: options?.signal,
|
|
146
|
+
};
|
|
147
|
+
// Check for cancellation before queueing
|
|
148
|
+
if (task.signal?.aborted) {
|
|
149
|
+
task.status = 'cancelled';
|
|
150
|
+
task._reject(new Error('Task was cancelled before execution'));
|
|
151
|
+
this._stats.cancelledCount++;
|
|
152
|
+
return promise;
|
|
153
|
+
}
|
|
154
|
+
// Listen for abort signal
|
|
155
|
+
if (task.signal) {
|
|
156
|
+
task.signal.addEventListener('abort', () => {
|
|
157
|
+
if (task.status === 'queued') {
|
|
158
|
+
this._queue.remove((t) => t.id === task.id);
|
|
159
|
+
task.status = 'cancelled';
|
|
160
|
+
task._reject(new Error('Task cancelled'));
|
|
161
|
+
this._stats.cancelledCount++;
|
|
162
|
+
this._emitTaskEvent(task, 'cancel');
|
|
163
|
+
}
|
|
164
|
+
}, { once: true });
|
|
165
|
+
}
|
|
166
|
+
this._queue.enqueue(task);
|
|
167
|
+
this._stats.totalSubmitted++;
|
|
168
|
+
if (this._options.logging) {
|
|
169
|
+
this._log.debug(`Task queued: ${name}`, {
|
|
170
|
+
taskId: task.id,
|
|
171
|
+
priority: task.priority,
|
|
172
|
+
queueSize: this._queue.size,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
this._emitTaskEvent(task, 'enqueue');
|
|
176
|
+
this._processQueue();
|
|
177
|
+
return promise;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Submit multiple tasks at once. Returns array of promises.
|
|
181
|
+
*/
|
|
182
|
+
submitBatch(tasks) {
|
|
183
|
+
return tasks.map((t) => this.submit(t.name, t.execute, t.options));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Submit a task and wait for it to complete, returning the task metadata.
|
|
187
|
+
*/
|
|
188
|
+
async submitAndWait(name, execute, options) {
|
|
189
|
+
const startTime = performance.now();
|
|
190
|
+
const taskPromise = this.submit(name, execute, options);
|
|
191
|
+
// Find the task to get its ID
|
|
192
|
+
const taskId = `pending_${_taskCounter}`;
|
|
193
|
+
const result = await taskPromise;
|
|
194
|
+
const durationMs = performance.now() - startTime;
|
|
195
|
+
return { result, durationMs, taskId };
|
|
196
|
+
}
|
|
197
|
+
// ── Control ──────────────────────────────────────────────────────────────
|
|
198
|
+
/** Pause task processing (running tasks continue, no new ones start) */
|
|
199
|
+
pause() {
|
|
200
|
+
this._isPaused = true;
|
|
201
|
+
if (this._options.logging)
|
|
202
|
+
this._log.info('Executor paused');
|
|
203
|
+
events_1.events.emit('executor.pause', 'executor', undefined, { source: 'executor' });
|
|
204
|
+
}
|
|
205
|
+
/** Resume task processing */
|
|
206
|
+
resume() {
|
|
207
|
+
this._isPaused = false;
|
|
208
|
+
if (this._options.logging)
|
|
209
|
+
this._log.info('Executor resumed');
|
|
210
|
+
events_1.events.emit('executor.resume', 'executor', undefined, { source: 'executor' });
|
|
211
|
+
this._processQueue();
|
|
212
|
+
}
|
|
213
|
+
/** Stop the executor. Optionally cancel all pending tasks. */
|
|
214
|
+
stop(cancelPending = true) {
|
|
215
|
+
this._isRunning = false;
|
|
216
|
+
if (cancelPending) {
|
|
217
|
+
const pending = this._queue.clear();
|
|
218
|
+
for (const task of pending) {
|
|
219
|
+
task.status = 'cancelled';
|
|
220
|
+
task._reject(new Error('Executor stopped'));
|
|
221
|
+
this._stats.cancelledCount++;
|
|
222
|
+
this._emitTaskEvent(task, 'cancel');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (this._options.logging)
|
|
226
|
+
this._log.info('Executor stopped');
|
|
227
|
+
events_1.events.emit('executor.stop', 'executor', { cancelledPending: cancelPending }, { source: 'executor' });
|
|
228
|
+
}
|
|
229
|
+
/** Start the executor (if previously stopped) */
|
|
230
|
+
start() {
|
|
231
|
+
this._isRunning = true;
|
|
232
|
+
this._isPaused = false;
|
|
233
|
+
if (this._options.logging)
|
|
234
|
+
this._log.info('Executor started');
|
|
235
|
+
events_1.events.emit('executor.start', 'executor', undefined, { source: 'executor' });
|
|
236
|
+
this._processQueue();
|
|
237
|
+
}
|
|
238
|
+
/** Cancel a specific task by ID */
|
|
239
|
+
cancel(taskId) {
|
|
240
|
+
// Check queue
|
|
241
|
+
const removed = this._queue.remove((t) => t.id === taskId);
|
|
242
|
+
if (removed.length > 0) {
|
|
243
|
+
for (const task of removed) {
|
|
244
|
+
task.status = 'cancelled';
|
|
245
|
+
task._reject(new Error('Task cancelled'));
|
|
246
|
+
this._stats.cancelledCount++;
|
|
247
|
+
this._emitTaskEvent(task, 'cancel');
|
|
248
|
+
}
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
// Check running (can't truly cancel, but mark it)
|
|
252
|
+
const running = this._running.get(taskId);
|
|
253
|
+
if (running) {
|
|
254
|
+
running.status = 'cancelled';
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
/** Cancel all tasks matching a predicate */
|
|
260
|
+
cancelWhere(predicate) {
|
|
261
|
+
const removed = this._queue.remove(predicate);
|
|
262
|
+
let count = removed.length;
|
|
263
|
+
for (const task of removed) {
|
|
264
|
+
task.status = 'cancelled';
|
|
265
|
+
task._reject(new Error('Task cancelled'));
|
|
266
|
+
this._stats.cancelledCount++;
|
|
267
|
+
}
|
|
268
|
+
return count;
|
|
269
|
+
}
|
|
270
|
+
/** Cancel all tasks in a group */
|
|
271
|
+
cancelGroup(group) {
|
|
272
|
+
return this.cancelWhere((t) => t.group === group);
|
|
273
|
+
}
|
|
274
|
+
/** Cancel all tasks with a specific tag */
|
|
275
|
+
cancelByTag(tag) {
|
|
276
|
+
return this.cancelWhere((t) => t.tags.includes(tag));
|
|
277
|
+
}
|
|
278
|
+
/** Drain the queue — wait for all pending + running tasks to complete */
|
|
279
|
+
async drain() {
|
|
280
|
+
while (this._queue.size > 0 || this._running.size > 0) {
|
|
281
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
282
|
+
}
|
|
283
|
+
events_1.events.emit('executor.drain', 'executor', undefined, { source: 'executor' });
|
|
284
|
+
}
|
|
285
|
+
/** Clear the queue (cancel all pending, let running finish) */
|
|
286
|
+
clear() {
|
|
287
|
+
const pending = this._queue.clear();
|
|
288
|
+
for (const task of pending) {
|
|
289
|
+
task.status = 'cancelled';
|
|
290
|
+
task._reject(new Error('Queue cleared'));
|
|
291
|
+
this._stats.cancelledCount++;
|
|
292
|
+
}
|
|
293
|
+
return pending.length;
|
|
294
|
+
}
|
|
295
|
+
// ── Query ────────────────────────────────────────────────────────────────
|
|
296
|
+
/** Get executor statistics */
|
|
297
|
+
getStats() {
|
|
298
|
+
return {
|
|
299
|
+
totalSubmitted: this._stats.totalSubmitted,
|
|
300
|
+
queueSize: this._queue.size,
|
|
301
|
+
runningCount: this._running.size,
|
|
302
|
+
completedCount: this._stats.completedCount,
|
|
303
|
+
failedCount: this._stats.failedCount,
|
|
304
|
+
cancelledCount: this._stats.cancelledCount,
|
|
305
|
+
timedOutCount: this._stats.timedOutCount,
|
|
306
|
+
avgDurationMs: this._stats.completedCount > 0
|
|
307
|
+
? this._stats.totalDurationMs / this._stats.completedCount
|
|
308
|
+
: 0,
|
|
309
|
+
isRunning: this._isRunning,
|
|
310
|
+
isPaused: this._isPaused,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/** Get all queued tasks */
|
|
314
|
+
getQueuedTasks() {
|
|
315
|
+
return this._queue.toArray();
|
|
316
|
+
}
|
|
317
|
+
/** Get all currently running tasks */
|
|
318
|
+
getRunningTasks() {
|
|
319
|
+
return [...this._running.values()];
|
|
320
|
+
}
|
|
321
|
+
/** Get a completed task by ID */
|
|
322
|
+
getCompletedTask(taskId) {
|
|
323
|
+
return this._completed.get(taskId);
|
|
324
|
+
}
|
|
325
|
+
/** Check if a task exists (queued, running, or completed) */
|
|
326
|
+
hasTask(taskId) {
|
|
327
|
+
return (this._queue.toArray().some((t) => t.id === taskId) ||
|
|
328
|
+
this._running.has(taskId) ||
|
|
329
|
+
this._completed.has(taskId));
|
|
330
|
+
}
|
|
331
|
+
// ── Internal Processing ──────────────────────────────────────────────────
|
|
332
|
+
async _processQueue() {
|
|
333
|
+
if (this._processing)
|
|
334
|
+
return;
|
|
335
|
+
this._processing = true;
|
|
336
|
+
try {
|
|
337
|
+
while (this._isRunning &&
|
|
338
|
+
!this._isPaused &&
|
|
339
|
+
this._queue.size > 0 &&
|
|
340
|
+
this._running.size < this._options.maxConcurrency) {
|
|
341
|
+
const task = this._queue.peek();
|
|
342
|
+
if (!task)
|
|
343
|
+
break;
|
|
344
|
+
// Check dependencies
|
|
345
|
+
if (task.dependsOn.length > 0) {
|
|
346
|
+
const allDepsComplete = task.dependsOn.every((depId) => {
|
|
347
|
+
const dep = this._completed.get(depId);
|
|
348
|
+
return dep && dep.status === 'completed';
|
|
349
|
+
});
|
|
350
|
+
if (!allDepsComplete) {
|
|
351
|
+
// Skip this task, try next
|
|
352
|
+
this._queue.dequeue();
|
|
353
|
+
this._queue.enqueue(task);
|
|
354
|
+
break; // Avoid infinite loops — let running tasks finish
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// Check group lock
|
|
358
|
+
if (task.group && this._groupLocks.has(task.group)) {
|
|
359
|
+
break; // Wait for group to unlock
|
|
360
|
+
}
|
|
361
|
+
this._queue.dequeue();
|
|
362
|
+
if (task.status === 'cancelled')
|
|
363
|
+
continue;
|
|
364
|
+
// Execute
|
|
365
|
+
this._executeTask(task);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
finally {
|
|
369
|
+
this._processing = false;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
async _executeTask(task) {
|
|
373
|
+
task.status = 'running';
|
|
374
|
+
task.startedAt = new Date().toISOString();
|
|
375
|
+
task.attempt++;
|
|
376
|
+
this._running.set(task.id, task);
|
|
377
|
+
this._emitTaskEvent(task, 'execute');
|
|
378
|
+
if (this._options.logging) {
|
|
379
|
+
this._log.debug(`Task executing: ${task.name}`, {
|
|
380
|
+
taskId: task.id,
|
|
381
|
+
attempt: task.attempt,
|
|
382
|
+
maxAttempts: task.maxAttempts,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
// Set up group lock
|
|
386
|
+
let unlockGroup;
|
|
387
|
+
if (task.group) {
|
|
388
|
+
let resolveGroupLock;
|
|
389
|
+
const groupPromise = new Promise((resolve) => { resolveGroupLock = resolve; });
|
|
390
|
+
this._groupLocks.set(task.group, groupPromise);
|
|
391
|
+
unlockGroup = () => {
|
|
392
|
+
resolveGroupLock();
|
|
393
|
+
this._groupLocks.delete(task.group);
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
// Set up timeout
|
|
397
|
+
let timedOut = false;
|
|
398
|
+
if (task.timeoutMs > 0) {
|
|
399
|
+
task._timeoutHandle = setTimeout(() => {
|
|
400
|
+
timedOut = true;
|
|
401
|
+
if (task.status === 'running') {
|
|
402
|
+
task.status = 'timedout';
|
|
403
|
+
task.completedAt = new Date().toISOString();
|
|
404
|
+
task.durationMs = Date.now() - new Date(task.startedAt).getTime();
|
|
405
|
+
task._reject(new Error(`Task timed out after ${task.timeoutMs}ms`));
|
|
406
|
+
this._running.delete(task.id);
|
|
407
|
+
this._completed.set(task.id, task);
|
|
408
|
+
this._stats.timedOutCount++;
|
|
409
|
+
this._emitTaskEvent(task, 'timeout');
|
|
410
|
+
unlockGroup?.();
|
|
411
|
+
this._processQueue();
|
|
412
|
+
}
|
|
413
|
+
}, task.timeoutMs);
|
|
414
|
+
}
|
|
415
|
+
try {
|
|
416
|
+
const result = await Promise.resolve(task.execute());
|
|
417
|
+
if (timedOut || task.status === 'cancelled')
|
|
418
|
+
return;
|
|
419
|
+
// Clear timeout
|
|
420
|
+
if (task._timeoutHandle)
|
|
421
|
+
clearTimeout(task._timeoutHandle);
|
|
422
|
+
task.status = 'completed';
|
|
423
|
+
task.result = result;
|
|
424
|
+
task.completedAt = new Date().toISOString();
|
|
425
|
+
task.durationMs = Date.now() - new Date(task.startedAt).getTime();
|
|
426
|
+
this._running.delete(task.id);
|
|
427
|
+
this._completed.set(task.id, task);
|
|
428
|
+
this._stats.completedCount++;
|
|
429
|
+
this._stats.totalDurationMs += task.durationMs;
|
|
430
|
+
task._resolve(result);
|
|
431
|
+
this._emitTaskEvent(task, 'complete');
|
|
432
|
+
if (this._options.logging) {
|
|
433
|
+
this._log.debug(`Task completed: ${task.name}`, {
|
|
434
|
+
taskId: task.id,
|
|
435
|
+
durationMs: task.durationMs,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
catch (err) {
|
|
440
|
+
if (timedOut || task.status === 'cancelled' || task.status === 'timedout')
|
|
441
|
+
return;
|
|
442
|
+
if (task._timeoutHandle)
|
|
443
|
+
clearTimeout(task._timeoutHandle);
|
|
444
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
445
|
+
// Retry logic
|
|
446
|
+
if (task.attempt < task.maxAttempts) {
|
|
447
|
+
task.status = 'retrying';
|
|
448
|
+
this._running.delete(task.id);
|
|
449
|
+
this._emitTaskEvent(task, 'retry');
|
|
450
|
+
if (this._options.logging) {
|
|
451
|
+
this._log.warn(`Task retrying: ${task.name}`, {
|
|
452
|
+
taskId: task.id,
|
|
453
|
+
attempt: task.attempt,
|
|
454
|
+
maxAttempts: task.maxAttempts,
|
|
455
|
+
error: error.message,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
// Calculate retry delay with exponential backoff
|
|
459
|
+
const delay = task.retryDelayMs * Math.pow(task.retryBackoff, task.attempt - 1);
|
|
460
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
461
|
+
// Re-enqueue
|
|
462
|
+
task.status = 'queued';
|
|
463
|
+
this._queue.enqueue(task);
|
|
464
|
+
unlockGroup?.();
|
|
465
|
+
this._processQueue();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
// Final failure
|
|
469
|
+
task.status = 'failed';
|
|
470
|
+
task.error = error;
|
|
471
|
+
task.completedAt = new Date().toISOString();
|
|
472
|
+
task.durationMs = Date.now() - new Date(task.startedAt).getTime();
|
|
473
|
+
this._running.delete(task.id);
|
|
474
|
+
this._completed.set(task.id, task);
|
|
475
|
+
this._stats.failedCount++;
|
|
476
|
+
task._reject(error);
|
|
477
|
+
this._emitTaskEvent(task, 'error');
|
|
478
|
+
if (this._options.logging) {
|
|
479
|
+
this._log.error(`Task failed: ${task.name}`, error, {
|
|
480
|
+
taskId: task.id,
|
|
481
|
+
durationMs: task.durationMs,
|
|
482
|
+
attempt: task.attempt,
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
if (this._options.pauseOnFailure) {
|
|
486
|
+
this.pause();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
finally {
|
|
490
|
+
unlockGroup?.();
|
|
491
|
+
if (!timedOut)
|
|
492
|
+
this._processQueue();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
_emitTaskEvent(task, action) {
|
|
496
|
+
events_1.events.emit(`executor.${action}`, 'executor', {
|
|
497
|
+
action,
|
|
498
|
+
taskId: task.id,
|
|
499
|
+
taskName: task.name,
|
|
500
|
+
priority: task.priority,
|
|
501
|
+
status: task.status,
|
|
502
|
+
attempt: task.attempt,
|
|
503
|
+
durationMs: task.durationMs,
|
|
504
|
+
group: task.group,
|
|
505
|
+
tags: task.tags,
|
|
506
|
+
}, { source: 'executor' });
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
exports.Executor = Executor;
|
|
510
|
+
// ── Default Executor ─────────────────────────────────────────────────────────
|
|
511
|
+
let _defaultExecutor;
|
|
512
|
+
/**
|
|
513
|
+
* Get (or create) the default executor singleton.
|
|
514
|
+
*/
|
|
515
|
+
function getDefaultExecutor(options) {
|
|
516
|
+
if (!_defaultExecutor) {
|
|
517
|
+
_defaultExecutor = new Executor(options);
|
|
518
|
+
}
|
|
519
|
+
return _defaultExecutor;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Create a new executor with custom options.
|
|
523
|
+
*/
|
|
524
|
+
function createExecutor(options) {
|
|
525
|
+
return new Executor(options);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Convenience: submit a task to the default executor.
|
|
529
|
+
*/
|
|
530
|
+
function enqueue(name, execute, options) {
|
|
531
|
+
return getDefaultExecutor().submit(name, execute, options);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Convenience: submit a high-priority task.
|
|
535
|
+
*/
|
|
536
|
+
function urgent(name, execute, options) {
|
|
537
|
+
return getDefaultExecutor().submit(name, execute, { ...options, priority: 10 });
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Convenience: submit a background (low-priority) task.
|
|
541
|
+
*/
|
|
542
|
+
function background(name, execute, options) {
|
|
543
|
+
return getDefaultExecutor().submit(name, execute, { ...options, priority: 1 });
|
|
544
|
+
}
|
|
545
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../ts/executor.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,sCAAsC;AACtC,+EAA+E;AAC/E,4EAA4E;AAC5E,+DAA+D;AAC/D,+EAA+E;;;AA6sB/E,gDAKC;AAKD,wCAEC;AAKD,0BAMC;AAKD,wBAMC;AAKD,gCAMC;AAxvBD,qCAAkC;AAClC,qCAA+C;AAuI/C,gFAAgF;AAEhF,MAAM,aAAa;IACT,MAAM,GAAQ,EAAE,CAAC;IACjB,KAAK,CAAU;IAEvB,YAAY,OAAgB,IAAI;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,IAAO;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACxB,wBAAwB;YACxB,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;gBAAE,OAAO,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;YAC9D,4BAA4B;YAC5B,IAAI,IAAI,CAAC,KAAK;gBAAE,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1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EAC7B,OAAuC;IAEvC,OAAO,kBAAkB,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AAClF,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CACxB,IAAY,EACZ,OAA6B,EAC7B,OAAuC;IAEvC,OAAO,kBAAkB,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AACjF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export { mouse } from './mouse';
|
|
2
|
+
export type { MovementHandle } from './mouse';
|
|
3
|
+
export { keyboard } from './keyboard';
|
|
4
|
+
export { screen } from './screen';
|
|
5
|
+
export { appWindow, appWindow as window } from './window';
|
|
6
|
+
export { recorder } from './recorder';
|
|
7
|
+
export { safety } from './safety';
|
|
8
|
+
export { stream } from './stream';
|
|
9
|
+
export { audioStream } from './audio-stream';
|
|
10
|
+
export { vision, AgentVision, createAgentVision } from './vision';
|
|
11
|
+
export type { VisualFingerprint, VisualMemory, LocatedElement, TemporalPrediction, AgentVisionConfig } from './vision';
|
|
12
|
+
export { agent, ActionSequence, sequence, parallel, createCursorStream, nativeParallel, interleave, ocr, findText, clickText, waitForText, waitForTextAndClick, watchRegion, onRegionChange, onHotkey, waitForHotkey } from './agent';
|
|
13
|
+
export { Cortex, createCortex, geminiLiveProvider, openAIRealtimeProvider, customProvider } from './cortex';
|
|
14
|
+
export type { ConversationState, TurnOwner, ToolDefinition, CortexProvider, CortexTransport, ProviderConfig, TransportEvents, CortexConfig, CortexEvents, ScreenFeedConfig, AudioFeedConfig, CustomProviderConfig, ParsedMessage, } from './cortex';
|
|
15
|
+
export { telemetry, CircuitBreaker, getCircuitBreakers } from './telemetry';
|
|
16
|
+
export { validate, security, RateLimiter, ValidationError, ok, err, unwrap } from './validation';
|
|
17
|
+
export { SteloError, ErrorCode, wrapError, withErrorHandling, withErrorHandlingSync, retryWithBackoff, RecoveryHints, } from './errors';
|
|
18
|
+
export { events } from './events';
|
|
19
|
+
export { logger, ConsoleTransport, MemoryTransport, CallbackTransport, TraceContext, SpanContext, ChildLogger } from './logger';
|
|
20
|
+
export { config } from './config';
|
|
21
|
+
export { context } from './context';
|
|
22
|
+
export { Executor, getDefaultExecutor, createExecutor, enqueue, urgent, background } from './executor';
|
|
23
|
+
export { middleware, boundaryPolicy, ratePolicy, cooldownPolicy, loggingMiddleware, retryMiddleware, transformMiddleware, } from './middleware';
|
|
24
|
+
export { workflow } from './workflow';
|
|
25
|
+
export { clipboard } from './clipboard';
|
|
26
|
+
export { process_manager } from './process';
|
|
27
|
+
export { monitor } from './monitor';
|
|
28
|
+
export { accessibility } from './accessibility';
|
|
29
|
+
export { scheduler } from './scheduler';
|
|
30
|
+
export { session } from './session';
|
|
31
|
+
export { plugin } from './plugin';
|
|
32
|
+
export { integration } from './integration';
|
|
33
|
+
export type { MouseButton, SmoothMoveOptions, HumanizedMoveOptions, DragOptions, ScrollDirection, Point, TypeOptions, HumanizedTypeOptions, ScreenSize, PixelColor, Region, ScreenCapture, DisplayInfo, CurveType, WindowInfo, AutomationEvent, PlaybackOptions, SafetyConfig, } from './types';
|
|
34
|
+
export type { StreamConfig, StreamFrame, StreamStats, FrameHandler, } from './stream';
|
|
35
|
+
export type { AudioStreamConfig, AudioFormat, AudioChunk, AudioStreamStats, } from './audio-stream';
|
|
36
|
+
export type { KeySequenceOptions, WaitForKeyOptions, } from './keyboard';
|
|
37
|
+
export type { TelemetryEvent, PerformanceMetrics, HealthCheckResult, TelemetrySeverity, OperationCategory, CircuitState, CircuitBreakerOptions, } from './telemetry';
|
|
38
|
+
export type { Result, AuditLogEntry, } from './validation';
|
|
39
|
+
export type { ErrorCodeType, ErrorDiagnostics, } from './errors';
|
|
40
|
+
export type { ScreenDiff, GridCell, GridAnalysis, CaptureReference, DiffOptions, WaitOptions, } from './vision';
|
|
41
|
+
export type { Action, ActionResult, BatchResult, VerifyResult, TrailPoint, ParallelTaskResult, ParallelResult, CursorStreamHandle, } from './agent';
|
|
42
|
+
export type { SteloEvent, MouseEvent, KeyboardEvent, WorkflowEvent, SafetyEvent, ExecutorEvent, EventCategory, EventFilter, EventBusOptions, EventListener, ListenerRegistration, } from './events';
|
|
43
|
+
export type { LogLevel, LogEntry, LogTransport, LoggerOptions, } from './logger';
|
|
44
|
+
export type { SteloConfig, ConfigProfile, ConfigSource, } from './config';
|
|
45
|
+
export type { SystemInfo, DisplayContext, PerformanceSnapshot, ContextVariable, OperationContext, EnvironmentFeatures, } from './context';
|
|
46
|
+
export type { TaskPriority, TaskStatus, TaskOptions, Task, ExecutorOptions, ExecutorStats, } from './executor';
|
|
47
|
+
export type { ActionType, MiddlewareContext, MiddlewareFn, Middleware, BoundaryRegion, } from './middleware';
|
|
48
|
+
export type { WorkflowStatus, StateDefinition, TransitionDefinition, WorkflowDefinition, WorkflowContext, TransitionRecord, WorkflowSnapshot, } from './workflow';
|
|
49
|
+
export type { ClipboardContentType, ClipboardEntry, ClipboardWatcherOptions, } from './clipboard';
|
|
50
|
+
export type { ProcessInfo, ForegroundChange, ProcessWatcherOptions, } from './process';
|
|
51
|
+
export type { MonitorDisplayInfo, VirtualBounds, MonitorTransition, MonitorLayout, } from './monitor';
|
|
52
|
+
export type { ScheduledTaskStatus, SchedulerOptions, ScheduledTaskOptions, ScheduledTask, SchedulerStats, } from './scheduler';
|
|
53
|
+
export type { SessionStatus, SessionMetadata, Checkpoint, RecordedAction, SessionSnapshot, SessionOptions, } from './session';
|
|
54
|
+
export type { PluginStatus, PluginManifest, PluginAPI, PluginDefinition, PluginInfo, PluginSystemStats, } from './plugin';
|
|
55
|
+
export type { UIElement, FormField, DialogInfo, ClickTargetOptions, WaitForUIOptions, } from './accessibility';
|
|
56
|
+
export type { WebhookConfig, WebhookDelivery, HttpRequestOptions, HttpResponse, ExternalToolConfig, PipelineStage, } from './integration';
|
|
57
|
+
export { bezier } from './utils/bezier';
|
|
58
|
+
export { delay, retry, waitUntil, batch } from './utils/helpers';
|
|
59
|
+
/** Returns the current platform: 'windows' | 'macos' | 'linux' */
|
|
60
|
+
export declare function getPlatform(): string;
|
|
61
|
+
/** Returns the Stelo native library version */
|
|
62
|
+
export declare function getVersion(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Access the raw native bindings directly.
|
|
65
|
+
* Use this only when you need low-level control not exposed through the
|
|
66
|
+
* high-level API.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getNativeBindings(): Record<string, (...args: unknown[]) => unknown>;
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACvH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE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