@deepnoodle/mobius 0.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 +201 -0
- package/README.md +68 -0
- package/dist/api/index.d.ts +227 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/schema.d.ts +6456 -0
- package/dist/api/schema.d.ts.map +1 -0
- package/dist/api/schema.js +6 -0
- package/dist/api/schema.js.map +1 -0
- package/dist/client.d.ts +42 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +83 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/worker.d.ts +77 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +204 -0
- package/dist/worker.js.map +1 -0
- package/package.json +57 -0
package/dist/worker.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { LeaseLostError } from "./client.js";
|
|
2
|
+
const silentLogger = {
|
|
3
|
+
info: () => { },
|
|
4
|
+
warn: () => { },
|
|
5
|
+
error: () => { },
|
|
6
|
+
};
|
|
7
|
+
const defaultLogger = {
|
|
8
|
+
info: (...args) => console.log(...args),
|
|
9
|
+
warn: (...args) => console.warn(...args),
|
|
10
|
+
error: (...args) => console.error(...args),
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Worker claims jobs from Mobius and dispatches each to the corresponding
|
|
14
|
+
* registered action function. A *job* is a single action invocation on
|
|
15
|
+
* behalf of a workflow run; the backend owns the workflow engine.
|
|
16
|
+
*/
|
|
17
|
+
export class Worker {
|
|
18
|
+
constructor(client, config) {
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.actions = new Map();
|
|
21
|
+
this.abortController = new AbortController();
|
|
22
|
+
this.config = {
|
|
23
|
+
workerId: config.workerId,
|
|
24
|
+
name: config.name ?? "",
|
|
25
|
+
version: config.version ?? "",
|
|
26
|
+
queues: config.queues ?? [],
|
|
27
|
+
actions: config.actions ?? [],
|
|
28
|
+
concurrency: config.concurrency ?? 10,
|
|
29
|
+
pollWaitSeconds: config.pollWaitSeconds ?? 20,
|
|
30
|
+
heartbeatIntervalMs: config.heartbeatIntervalMs,
|
|
31
|
+
};
|
|
32
|
+
this.logger =
|
|
33
|
+
config.logger === null ? silentLogger : (config.logger ?? defaultLogger);
|
|
34
|
+
}
|
|
35
|
+
/** Register an action function under the given name. */
|
|
36
|
+
register(name, fn) {
|
|
37
|
+
this.actions.set(name, fn);
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Start the claim loop. Returns a promise that resolves when the worker is
|
|
42
|
+
* stopped via {@link stop} or the given signal is aborted.
|
|
43
|
+
*/
|
|
44
|
+
async run(signal) {
|
|
45
|
+
this.abortController = new AbortController();
|
|
46
|
+
const combined = signal
|
|
47
|
+
? anySignal(signal, this.abortController.signal)
|
|
48
|
+
: this.abortController.signal;
|
|
49
|
+
this.logger.info(`[mobius] worker ${this.config.workerId} started`);
|
|
50
|
+
const running = new Set();
|
|
51
|
+
while (!combined.aborted) {
|
|
52
|
+
if (running.size >= this.config.concurrency) {
|
|
53
|
+
await Promise.race(running);
|
|
54
|
+
}
|
|
55
|
+
let task;
|
|
56
|
+
try {
|
|
57
|
+
const claimReq = {
|
|
58
|
+
worker_id: this.config.workerId,
|
|
59
|
+
wait_seconds: this.config.pollWaitSeconds,
|
|
60
|
+
};
|
|
61
|
+
if (this.config.name)
|
|
62
|
+
claimReq.worker_name = this.config.name;
|
|
63
|
+
if (this.config.version)
|
|
64
|
+
claimReq.worker_version = this.config.version;
|
|
65
|
+
if (this.config.queues.length > 0)
|
|
66
|
+
claimReq.queues = this.config.queues;
|
|
67
|
+
if (this.config.actions.length > 0)
|
|
68
|
+
claimReq.actions = this.config.actions;
|
|
69
|
+
task = await this.client.claimJob(claimReq, combined);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
if (combined.aborted)
|
|
73
|
+
break;
|
|
74
|
+
this.logger.error("[mobius] claim error:", err);
|
|
75
|
+
await sleep(2000, combined);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (task == null) {
|
|
79
|
+
await sleep(0, combined);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const p = this.executeTask(task, combined).finally(() => running.delete(p));
|
|
83
|
+
running.add(p);
|
|
84
|
+
}
|
|
85
|
+
await Promise.allSettled(running);
|
|
86
|
+
this.logger.info(`[mobius] worker ${this.config.workerId} stopped`);
|
|
87
|
+
}
|
|
88
|
+
/** Gracefully stop the worker after in-flight tasks complete. */
|
|
89
|
+
stop() {
|
|
90
|
+
this.abortController.abort();
|
|
91
|
+
}
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
async executeTask(task, signal) {
|
|
94
|
+
const jobId = task.job_id;
|
|
95
|
+
const workerId = this.config.workerId;
|
|
96
|
+
const attempt = task.attempt;
|
|
97
|
+
this.logger.info(`[mobius] job ${jobId} claimed (workflow=${task.workflow_name}, step=${task.step_name}, action=${task.action}, attempt=${attempt})`);
|
|
98
|
+
const fn = this.actions.get(task.action);
|
|
99
|
+
if (!fn) {
|
|
100
|
+
const msg = `action ${JSON.stringify(task.action)} not registered on this worker`;
|
|
101
|
+
this.logger.error(`[mobius] ${msg}`);
|
|
102
|
+
await this.failTask(jobId, workerId, attempt, "ActionNotRegistered", msg);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const actionController = new AbortController();
|
|
106
|
+
const onAbort = () => actionController.abort();
|
|
107
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
108
|
+
const interval = this.heartbeatInterval(task);
|
|
109
|
+
let hbLost = false;
|
|
110
|
+
const heartbeatTimer = setInterval(async () => {
|
|
111
|
+
try {
|
|
112
|
+
const hb = await this.client.heartbeatJob(jobId, {
|
|
113
|
+
worker_id: workerId,
|
|
114
|
+
attempt,
|
|
115
|
+
});
|
|
116
|
+
if (hb.directives.should_cancel) {
|
|
117
|
+
this.logger.warn(`[mobius] job ${jobId}: cancel directive received`);
|
|
118
|
+
actionController.abort();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
if (err instanceof LeaseLostError) {
|
|
123
|
+
this.logger.warn(`[mobius] job ${jobId}: lease lost during heartbeat`);
|
|
124
|
+
hbLost = true;
|
|
125
|
+
actionController.abort();
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.logger.error(`[mobius] job ${jobId}: heartbeat error:`, err);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}, interval);
|
|
132
|
+
try {
|
|
133
|
+
const result = await fn(task.parameters, actionController.signal);
|
|
134
|
+
clearInterval(heartbeatTimer);
|
|
135
|
+
signal.removeEventListener("abort", onAbort);
|
|
136
|
+
if (hbLost)
|
|
137
|
+
return;
|
|
138
|
+
const completeReq = {
|
|
139
|
+
worker_id: workerId,
|
|
140
|
+
attempt,
|
|
141
|
+
status: "completed",
|
|
142
|
+
};
|
|
143
|
+
if (result != null) {
|
|
144
|
+
completeReq.result_b64 = Buffer.from(JSON.stringify(result)).toString("base64");
|
|
145
|
+
}
|
|
146
|
+
await this.client.completeJob(jobId, completeReq);
|
|
147
|
+
this.logger.info(`[mobius] job ${jobId} completed`);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
clearInterval(heartbeatTimer);
|
|
151
|
+
signal.removeEventListener("abort", onAbort);
|
|
152
|
+
if (err instanceof LeaseLostError || hbLost) {
|
|
153
|
+
this.logger.warn(`[mobius] job ${jobId}: lease lost — will be retried`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.logger.error(`[mobius] job ${jobId} failed:`, err);
|
|
157
|
+
const errType = actionController.signal.aborted ? "Timeout" : "Error";
|
|
158
|
+
await this.failTask(jobId, workerId, attempt, errType, String(err));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
heartbeatInterval(task) {
|
|
162
|
+
if (this.config.heartbeatIntervalMs != null)
|
|
163
|
+
return this.config.heartbeatIntervalMs;
|
|
164
|
+
if (task.heartbeat_interval_seconds != null) {
|
|
165
|
+
return task.heartbeat_interval_seconds * 1000;
|
|
166
|
+
}
|
|
167
|
+
return 10000;
|
|
168
|
+
}
|
|
169
|
+
async failTask(jobId, workerId, attempt, errorType, msg) {
|
|
170
|
+
try {
|
|
171
|
+
await this.client.completeJob(jobId, {
|
|
172
|
+
worker_id: workerId,
|
|
173
|
+
attempt,
|
|
174
|
+
status: "failed",
|
|
175
|
+
error_type: errorType,
|
|
176
|
+
error_message: msg,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
this.logger.error(`[mobius] failed to report failure for job ${jobId}:`, err);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function sleep(ms, signal) {
|
|
185
|
+
return new Promise((resolve) => {
|
|
186
|
+
const t = setTimeout(resolve, ms);
|
|
187
|
+
signal.addEventListener("abort", () => {
|
|
188
|
+
clearTimeout(t);
|
|
189
|
+
resolve();
|
|
190
|
+
}, { once: true });
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function anySignal(...signals) {
|
|
194
|
+
const controller = new AbortController();
|
|
195
|
+
for (const s of signals) {
|
|
196
|
+
if (s.aborted) {
|
|
197
|
+
controller.abort();
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
s.addEventListener("abort", () => controller.abort(), { once: true });
|
|
201
|
+
}
|
|
202
|
+
return controller.signal;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAKA,OAAO,EAAU,cAAc,EAAE,MAAM,aA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TypeScript SDK for Mobius workflow orchestration",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "Deepnoodle",
|
|
8
|
+
"homepage": "https://github.com/deepnoodle-ai/mobius#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/deepnoodle-ai/mobius.git",
|
|
12
|
+
"directory": "typescript"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/deepnoodle-ai/mobius/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mobius",
|
|
19
|
+
"workflow",
|
|
20
|
+
"orchestration",
|
|
21
|
+
"worker",
|
|
22
|
+
"deepnoodle",
|
|
23
|
+
"sdk"
|
|
24
|
+
],
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"sideEffects": false,
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^25.6.0",
|
|
48
|
+
"openapi-typescript": "^7.6.0",
|
|
49
|
+
"typescript": "^5.0.0"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"generate": "openapi-typescript ../openapi.yaml -o src/api/schema.ts && node scripts/gen-api-index.js",
|
|
53
|
+
"build": "tsc",
|
|
54
|
+
"typecheck": "tsc --noEmit",
|
|
55
|
+
"test": "tsc -p tsconfig.test.json && node --test build-test/test/*.test.js"
|
|
56
|
+
}
|
|
57
|
+
}
|