@deepnoodle/mobius 0.0.21 → 0.0.22
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 +31 -45
- package/dist/api/index.d.ts +124 -283
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/schema.d.ts +5450 -11248
- package/dist/api/schema.d.ts.map +1 -1
- package/dist/client.d.ts +64 -151
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +164 -368
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/signing.d.ts +43 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +101 -0
- package/dist/signing.js.map +1 -0
- package/dist/webhook.d.ts +5 -17
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +38 -50
- package/dist/webhook.js.map +1 -1
- package/dist/worker.d.ts +40 -138
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +314 -464
- package/dist/worker.js.map +1 -1
- package/package.json +4 -4
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
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
###
|
|
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
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
###
|
|
77
|
+
### Automations
|
|
77
78
|
|
|
78
79
|
```ts
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|
91
|
-
|
|
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
|
-
|
|
96
|
+
parseWebhookDelivery,
|
|
97
|
+
verifySignedDelivery,
|
|
99
98
|
} from "@deepnoodle/mobius";
|
|
100
99
|
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
);
|
|
105
|
-
console.log(
|
|
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.
|
|
138
|
-
|
|
139
|
-
|
|
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) {
|