@deepnoodle/mobius 0.0.8 → 0.0.10
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 +6 -6
- package/dist/api/schema.d.ts +46 -25
- package/dist/api/schema.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/worker.d.ts +29 -3
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +84 -11
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,24 +24,24 @@ Requires Node.js 18+.
|
|
|
24
24
|
### Worker
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
import { Client,
|
|
27
|
+
import { Client, WorkerPool } from "@deepnoodle/mobius";
|
|
28
28
|
|
|
29
29
|
const client = new Client({ apiKey: process.env.MOBIUS_API_KEY! });
|
|
30
30
|
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const workers = new WorkerPool(client, {
|
|
32
|
+
workerIdPrefix: "email-sender",
|
|
33
33
|
name: "email-sender",
|
|
34
34
|
version: "1.0.0",
|
|
35
35
|
queues: ["emails"],
|
|
36
|
-
|
|
36
|
+
count: 5,
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
workers.register("send_email", async (params, signal) => {
|
|
40
40
|
// send email...
|
|
41
41
|
return { sent: true };
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
await
|
|
44
|
+
await workers.run();
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Low-level client
|
package/dist/api/schema.d.ts
CHANGED
|
@@ -384,9 +384,28 @@ export interface paths {
|
|
|
384
384
|
};
|
|
385
385
|
/**
|
|
386
386
|
* Subscribe to a project-wide stream of run events (SSE)
|
|
387
|
-
* @description Opens a Server-Sent Events connection. Each frame carries a JSON envelope `{type, run_id, seq, timestamp, data}` where `
|
|
387
|
+
* @description Opens a Server-Sent Events connection. Each frame carries a JSON envelope `{type, run_id, seq, timestamp, data}` where `seq` is a monotonic durable cursor and `type` is one of:
|
|
388
|
+
*
|
|
389
|
+
* - `run_updated` — the run row's status, heartbeat, or
|
|
390
|
+
* timestamps changed; `data` is a full WorkflowRun.
|
|
391
|
+
* - `job_updated` — a single job's status or attempt
|
|
392
|
+
* advanced; `data` is a full Job.
|
|
393
|
+
* - `action_appended` — one entry was appended to the run
|
|
394
|
+
* timeline (worker job completed or platform action ran);
|
|
395
|
+
* `data` is a WorkflowActionLog row.
|
|
396
|
+
* - `interaction_created` / `interaction_completed` /
|
|
397
|
+
* `interaction_group_claimed` /
|
|
398
|
+
* `interaction_group_released` — interaction lifecycle;
|
|
399
|
+
* `data` is a full Interaction.
|
|
400
|
+
* - `custom` — a worker emitted a domain-specific event via
|
|
401
|
+
* `POST /v1/projects/{project}/jobs/{id}/events`. `data`
|
|
402
|
+
* carries `{kind: "custom", type, job_id, data}` where
|
|
403
|
+
* `type` is the worker-supplied name and inner `data` is
|
|
404
|
+
* the worker payload.
|
|
388
405
|
*
|
|
389
406
|
* Pass `?since=<seq>` on reconnect to replay any durable events the server has recorded past that cursor before switching back to live updates; clients should record the largest `seq` they have observed. Comment frames (`:keepalive`) are emitted every ~15s to keep intermediaries from closing the connection.
|
|
407
|
+
*
|
|
408
|
+
* Unknown future event types may appear; clients should ignore types they don't recognize rather than treat the stream as malformed.
|
|
390
409
|
*/
|
|
391
410
|
get: operations["streamProjectRunEvents"];
|
|
392
411
|
put?: never;
|
|
@@ -466,7 +485,7 @@ export interface paths {
|
|
|
466
485
|
};
|
|
467
486
|
/**
|
|
468
487
|
* Subscribe to a stream of events for a single run (SSE)
|
|
469
|
-
* @description Same envelope as `/v1/projects/{project}/runs/events`
|
|
488
|
+
* @description Same envelope and event-type set as `/v1/projects/{project}/runs/events` (see that endpoint for the full vocabulary of `type` values), filtered to a single run. The server writes one seed `run_updated` frame on connection so reconnects do not miss the latest state, and supports `?since=<seq>` replay for durable events recorded since the given seq cursor.
|
|
470
489
|
*/
|
|
471
490
|
get: operations["streamRunEvents"];
|
|
472
491
|
put?: never;
|
|
@@ -3546,6 +3565,8 @@ export interface components {
|
|
|
3546
3565
|
service_account_id?: string;
|
|
3547
3566
|
/** @description User this session authenticated as on register/heartbeat. Set when a human is polling via the CLI; mutually exclusive with `service_account_id`. */
|
|
3548
3567
|
user_id?: string;
|
|
3568
|
+
/** @description Embedded profile for `user_id` when this is a CLI-backed human worker session. Absent when the user record is unavailable or the session is service-account-backed. */
|
|
3569
|
+
user?: components["schemas"]["User"];
|
|
3549
3570
|
/** @description ID of the specific API key this session presented on its most recent register/heartbeat. Only set for service-account-backed sessions; changes across credential rotations. Use together with `service_account_id` to see rotation progress across a fleet. */
|
|
3550
3571
|
api_key_id?: string;
|
|
3551
3572
|
/** @description Agent this session represents, when the polling process declared itself as a registered agent (via `agent_id` on the claim request or via inference from the service account). Absent for ad-hoc worker processes that are not tied to a declared agent. */
|
|
@@ -3557,6 +3578,29 @@ export interface components {
|
|
|
3557
3578
|
/** @description The list of recently seen worker sessions. */
|
|
3558
3579
|
items: components["schemas"]["WorkerSession"][];
|
|
3559
3580
|
};
|
|
3581
|
+
/** @description Human identity known to the organization. User records are useful for membership lists, role assignment UIs, attribution, and displaying profile information next to actions. */
|
|
3582
|
+
User: {
|
|
3583
|
+
/** @description Clerk user ID. Stable and globally unique across all orgs. */
|
|
3584
|
+
id: string;
|
|
3585
|
+
/** @description Primary email address from Clerk. */
|
|
3586
|
+
email: string;
|
|
3587
|
+
/** @description User's first name from their Clerk profile. */
|
|
3588
|
+
first_name?: string;
|
|
3589
|
+
/** @description User's last name from their Clerk profile. */
|
|
3590
|
+
last_name?: string;
|
|
3591
|
+
/** @description Profile avatar URL from Clerk (may be a Gravatar or uploaded image). */
|
|
3592
|
+
avatar_url?: string;
|
|
3593
|
+
/**
|
|
3594
|
+
* Format: date-time
|
|
3595
|
+
* @description When the user record was first mirrored into Mobius.
|
|
3596
|
+
*/
|
|
3597
|
+
created_at: string;
|
|
3598
|
+
/**
|
|
3599
|
+
* Format: date-time
|
|
3600
|
+
* @description Timestamp when this user record was last synced from Clerk.
|
|
3601
|
+
*/
|
|
3602
|
+
updated_at: string;
|
|
3603
|
+
};
|
|
3560
3604
|
/**
|
|
3561
3605
|
* @description `org_open`: every org member can see and use the project, subject to role assignments. `restricted`: only listed project members (and org owners/admins) can see or use the project.
|
|
3562
3606
|
* @enum {string}
|
|
@@ -3654,29 +3698,6 @@ export interface components {
|
|
|
3654
3698
|
/** @description User ID of the org member to add to this project. */
|
|
3655
3699
|
user_id: string;
|
|
3656
3700
|
};
|
|
3657
|
-
/** @description Human identity known to the organization. User records are useful for membership lists, role assignment UIs, attribution, and displaying profile information next to actions. */
|
|
3658
|
-
User: {
|
|
3659
|
-
/** @description Clerk user ID. Stable and globally unique across all orgs. */
|
|
3660
|
-
id: string;
|
|
3661
|
-
/** @description Primary email address from Clerk. */
|
|
3662
|
-
email: string;
|
|
3663
|
-
/** @description User's first name from their Clerk profile. */
|
|
3664
|
-
first_name?: string;
|
|
3665
|
-
/** @description User's last name from their Clerk profile. */
|
|
3666
|
-
last_name?: string;
|
|
3667
|
-
/** @description Profile avatar URL from Clerk (may be a Gravatar or uploaded image). */
|
|
3668
|
-
avatar_url?: string;
|
|
3669
|
-
/**
|
|
3670
|
-
* Format: date-time
|
|
3671
|
-
* @description When the user record was first mirrored into Mobius.
|
|
3672
|
-
*/
|
|
3673
|
-
created_at: string;
|
|
3674
|
-
/**
|
|
3675
|
-
* Format: date-time
|
|
3676
|
-
* @description Timestamp when this user record was last synced from Clerk.
|
|
3677
|
-
*/
|
|
3678
|
-
updated_at: string;
|
|
3679
|
-
};
|
|
3680
3701
|
/**
|
|
3681
3702
|
* @description `pending` — queued, not yet attempted. `processing` — currently being delivered. `delivered` — recipient returned 2xx. `failed` — all retry attempts exhausted.
|
|
3682
3703
|
* @enum {string}
|