@deepnoodle/mobius 0.0.21 → 0.0.23

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 CHANGED
@@ -3,9 +3,10 @@
3
3
  TypeScript SDK for [Mobius](https://www.mobiusops.ai/) — a work coordination
4
4
  platform for mixed teams of humans, systems, and AI agents.
5
5
 
6
- This package contains the runtime client and worker used to claim and execute
7
- tasks against the Mobius API, plus high-level helpers for starting, observing,
8
- and controlling workflow runs. Types are generated from the canonical
6
+ This package contains the runtime client and WebSocket worker used to execute
7
+ actions and LLM generations against the Mobius API, plus high-level helpers for
8
+ creating automations and starting, observing, and controlling automation runs.
9
+ Types are generated from the canonical
9
10
  [OpenAPI spec](https://github.com/deepnoodle-ai/mobius/blob/main/openapi.yaml)
10
11
  and round-tripped against the same cross-language contract fixtures as the Go
11
12
  and Python SDKs.
@@ -57,63 +58,50 @@ For independent presence rows (one row per worker) — e.g. graceful
57
58
  draining or in-flight isolation — use `WorkerPool` with `count` and
58
59
  optionally `workerInstanceIdPrefix` instead.
59
60
 
60
- ### Low-level client
61
+ ### Automation runs
61
62
 
62
63
  ```ts
63
64
  import { Client } from "@deepnoodle/mobius";
64
65
 
65
66
  const client = new Client({ apiKey: process.env.MOBIUS_API_KEY! });
66
67
 
67
- const claim = await client.claimJob({
68
- worker_instance_id: "my-worker-1",
69
- worker_session_token: crypto.randomUUID(),
70
- concurrency_limit: 1,
71
- queues: ["default"],
72
- wait_seconds: 20,
68
+ const run = await client.startAutomationRun("customer-onboarding", {
69
+ external_id: "customer-run-123",
70
+ inputs: { customer_id: "cus_123" },
73
71
  });
72
+
73
+ const terminal = await client.waitRun(run.id);
74
+ console.log(terminal.status, terminal.result, terminal.error_message);
74
75
  ```
75
76
 
76
- ### Run control
77
+ ### Automations
77
78
 
78
79
  ```ts
79
- const run = await client.startRun(
80
- {
81
- name: "demo",
82
- steps: [],
83
- },
84
- {
85
- external_id: "customer-run-123",
86
- metadata: { org_id: "org_123" },
87
- },
88
- );
80
+ const automation = await client.createAutomation({
81
+ handle: "customer-onboarding",
82
+ name: "Customer onboarding",
83
+ });
89
84
 
90
- const terminal = await client.waitRun(run.id);
91
- console.log(terminal.status, terminal.result_b64, terminal.error_message);
85
+ const version = await client.createAutomationVersion(automation.handle, {
86
+ steps: [],
87
+ }, { publish: true });
88
+
89
+ console.log(automation.id, version.version);
92
90
  ```
93
91
 
94
92
  ### Webhooks
95
93
 
96
94
  ```ts
97
95
  import {
98
- parseSignedWebhookRequest,
96
+ parseWebhookDelivery,
97
+ verifySignedDelivery,
99
98
  } from "@deepnoodle/mobius";
100
99
 
101
- const signed = await parseSignedWebhookRequest(
102
- request,
103
- process.env.MOBIUS_WEBHOOK_SECRET!,
104
- );
105
- console.log(signed.event.type, signed.event.data);
106
- ```
107
-
108
- ### Saved workflows
109
-
110
- ```ts
111
- const result = await client.ensureWorkflow(
112
- { name: "customer-onboarding", steps: [] },
113
- { handle: "customer-onboarding" },
114
- );
115
-
116
- console.log(result.created, result.updated, result.definition.id);
100
+ const verified = await verifySignedDelivery(request, {
101
+ key: Buffer.from(process.env.MOBIUS_SIGNING_KEY_B64!, "base64"),
102
+ });
103
+ const event = parseWebhookDelivery(verified);
104
+ console.log(event.type, event.data);
117
105
  ```
118
106
 
119
107
  ## Rate limiting
@@ -134,11 +122,9 @@ const client = new Client({
134
122
  });
135
123
 
136
124
  try {
137
- await client.claimJob({
138
- worker_instance_id: "w1",
139
- worker_session_token: crypto.randomUUID(),
140
- concurrency_limit: 1,
141
- queues: ["default"],
125
+ await client.startAutomationRun("customer-onboarding", {
126
+ external_id: "customer-run-123",
127
+ inputs: { customer_id: "cus_123" },
142
128
  });
143
129
  } catch (err) {
144
130
  if (err instanceof RateLimitError) {