codai-sdk 0.7.0 → 0.13.0
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 +14 -2
- package/dist/index.d.ts +1848 -236
- package/dist/index.js +388 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ surface.
|
|
|
65
65
|
| `receipt` | `get` | `GET /v1/receipt` |
|
|
66
66
|
| `feedback` | `submit` | `POST /v1/feedback` |
|
|
67
67
|
| `phoneModels` | `list` | `GET /v1/phone/models` |
|
|
68
|
-
| `resolve` | `submit`, `get`, `accept`, `attestation`, `health`, `waitFor`
|
|
68
|
+
| `resolve` | `submit`, `get`, `accept`, `balance`, `attestation`, `keys`, `verifyAttestation`, `health`, `waitFor` | `https://resolve.codai.ro/v1/resolve/*` (own host) |
|
|
69
69
|
|
|
70
70
|
Every method takes an optional last argument `{ ext, signal }` where `ext` is a
|
|
71
71
|
typed bag of `X-Codai-*` extension headers (see below).
|
|
@@ -180,7 +180,8 @@ if (q.status === 'quoted') {
|
|
|
180
180
|
try {
|
|
181
181
|
await codai.resolve.accept(q.id); // free-tier jobs are auto-accepted
|
|
182
182
|
} catch (err) {
|
|
183
|
-
if (err instanceof ResolveInsufficientFundsError)
|
|
183
|
+
if (err instanceof ResolveInsufficientFundsError)
|
|
184
|
+
console.log('top up:', err.topupUrl, err.bundleUrl ?? ''); // bundleUrl: t7 only
|
|
184
185
|
throw err;
|
|
185
186
|
}
|
|
186
187
|
}
|
|
@@ -198,6 +199,15 @@ with `balance`, `required`, `currency: 'micro_eur'` and `topupUrl`. `submit` and
|
|
|
198
199
|
`accept` are never retried. `waitFor` stops at `resolved | failed | declined | error`
|
|
199
200
|
(or `until`), and throws `ResolveError` with `status: 0` on timeout.
|
|
200
201
|
|
|
202
|
+
**Pricing.** Your first paid accept holds **€1** instead of the list price (the quote then
|
|
203
|
+
carries `intro_price_micro_eur` / `list_price_micro_eur`); it is used up only by a verified
|
|
204
|
+
fix — a failed intro job is refunded and the intro is offered again. A **fix bundle** (€49 = 10
|
|
205
|
+
credits, <https://pay.codai.ro/checkout?bundle=resolve10>) pays for `t7` jobs only: a credit is
|
|
206
|
+
taken at accept instead of a wallet hold and returned on failure. Precedence:
|
|
207
|
+
free > intro > credit (t7) > wallet; `accept()` reports it in `paid_with`, and a t7 `402`
|
|
208
|
+
carries `bundleUrl`. `codai.resolve.balance()` returns `fix_credits`, `intro_available` and
|
|
209
|
+
`wallet_micro_eur`.
|
|
210
|
+
|
|
201
211
|
### Webhooks instead of polling
|
|
202
212
|
|
|
203
213
|
Pass `callback_url` (https, public host) on `submit`; the response carries
|
|
@@ -268,6 +278,8 @@ for await (const frame of codai.sessions.stream(session.id, { after: 0 })) {
|
|
|
268
278
|
}
|
|
269
279
|
|
|
270
280
|
await codai.sessions.dispatch(session.id, { device_id: phoneId, text: 'continue on the phone' });
|
|
281
|
+
// Handoff: just open the session on the phone, run nothing (`online` comes from devices.list()).
|
|
282
|
+
await codai.sessions.dispatch(session.id, { device_id: phoneId, mode: 'open' });
|
|
271
283
|
|
|
272
284
|
// Host relay: run one op on a connected desktop
|
|
273
285
|
const hosts = await codai.hosts.list();
|