@m8tes/sdk 0.1.0-alpha.5 → 0.1.0-alpha.6
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/CHANGELOG.md +70 -1
- package/README.md +7 -1
- package/dist/{chunk-CURNMC4F.js → chunk-F6B6R3SP.js} +17 -2
- package/dist/chunk-F6B6R3SP.js.map +1 -0
- package/dist/index.cjs +76 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +153 -33
- package/dist/index.d.ts +153 -33
- package/dist/index.js +63 -20
- package/dist/index.js.map +1 -1
- package/dist/protocol/index.cjs +15 -0
- package/dist/protocol/index.cjs.map +1 -1
- package/dist/protocol/index.d.cts +4 -2
- package/dist/protocol/index.d.ts +4 -2
- package/dist/protocol/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CURNMC4F.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -214,6 +214,19 @@ interface Run {
|
|
|
214
214
|
retry_count?: number;
|
|
215
215
|
output_data?: JsonObject | null;
|
|
216
216
|
usage?: RunUsage | null;
|
|
217
|
+
/**
|
|
218
|
+
* Which meter the run settles on: "api" (prepaid balance — end-user-scoped /
|
|
219
|
+
* embedding work) or "platform" (subscription plan — first-party work, INCLUDING
|
|
220
|
+
* the account's own API-key calls). Stamped at creation.
|
|
221
|
+
*/
|
|
222
|
+
billing_surface?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Where the run came in: "api", "app", "cli", "email", "slack", "imessage",
|
|
225
|
+
* "webhook". Attribution only, never billing — a first-party API-key call is
|
|
226
|
+
* channel "api" but billing_surface "platform", so filtering a developer view
|
|
227
|
+
* on surface alone hides your own traffic.
|
|
228
|
+
*/
|
|
229
|
+
channel?: string | null;
|
|
217
230
|
}
|
|
218
231
|
/** Condensed run result: what happened, without replaying the transcript. */
|
|
219
232
|
interface RunOutcome {
|
|
@@ -244,10 +257,15 @@ interface PermissionRequest {
|
|
|
244
257
|
created_at: string;
|
|
245
258
|
resolved_at: string | null;
|
|
246
259
|
auto_resolved?: boolean;
|
|
260
|
+
/** Actual saved cross-run grant outcome, also present on listings. Null means unknown. */
|
|
261
|
+
remembered?: boolean | null;
|
|
247
262
|
/** False when the runtime would ignore an "always allow" for this tool. */
|
|
248
263
|
can_remember?: boolean;
|
|
249
264
|
/** False when the Always-allow control must start unticked (force-ask floor). */
|
|
250
265
|
remember_default?: boolean;
|
|
266
|
+
ask_reason?: string;
|
|
267
|
+
surface?: string;
|
|
268
|
+
surface_label?: string | null;
|
|
251
269
|
}
|
|
252
270
|
interface Task {
|
|
253
271
|
id: number;
|
|
@@ -409,6 +427,8 @@ interface Webhook {
|
|
|
409
427
|
/** Signing secret. Returned on create only — store it, you cannot read it back. */
|
|
410
428
|
secret: string | null;
|
|
411
429
|
active: boolean;
|
|
430
|
+
/** End-user scope. Null/omitted = account-level. */
|
|
431
|
+
user_id?: string | null;
|
|
412
432
|
created_at: string;
|
|
413
433
|
updated_at?: string | null;
|
|
414
434
|
}
|
|
@@ -442,12 +462,12 @@ interface WebhookDelivery {
|
|
|
442
462
|
next_retry_at: string | null;
|
|
443
463
|
created_at: string;
|
|
444
464
|
}
|
|
445
|
-
/** A standing tool permission policy: one pre-approved tool for one
|
|
446
|
-
*
|
|
447
|
-
* `tool_name`. */
|
|
465
|
+
/** A standing tool permission policy: one pre-approved tool for one scope.
|
|
466
|
+
* `user_id` is null for the account-level scope. Note the asymmetry — you
|
|
467
|
+
* create it with `tool`, the API returns it as `tool_name`. */
|
|
448
468
|
interface PermissionPolicy {
|
|
449
469
|
id: number;
|
|
450
|
-
user_id: string;
|
|
470
|
+
user_id: string | null;
|
|
451
471
|
tool_name: string;
|
|
452
472
|
created_at: string;
|
|
453
473
|
/** Which surface minted the grant ("run_approval" / "api"); null on legacy rows. */
|
|
@@ -469,7 +489,9 @@ interface Usage {
|
|
|
469
489
|
cost_limit: string;
|
|
470
490
|
period_end: string;
|
|
471
491
|
subscription_status: string | null;
|
|
472
|
-
/**
|
|
492
|
+
/** Current paid subscription cadence, when known. */
|
|
493
|
+
subscription_billing_period?: "monthly" | "annual" | null;
|
|
494
|
+
/** Authoritative eligibility for the model-subscription-funded Hobby path. */
|
|
473
495
|
free_path_available: boolean;
|
|
474
496
|
overage_enabled: boolean;
|
|
475
497
|
overage_used_cents: number;
|
|
@@ -518,7 +540,7 @@ interface Receipt {
|
|
|
518
540
|
receipt_url: string | null;
|
|
519
541
|
created_at: string;
|
|
520
542
|
}
|
|
521
|
-
/** A public
|
|
543
|
+
/** A public Hobby or paid plan from the canonical catalog. All prices in cents. */
|
|
522
544
|
interface Plan {
|
|
523
545
|
slug: string;
|
|
524
546
|
display_name: string;
|
|
@@ -526,9 +548,20 @@ interface Plan {
|
|
|
526
548
|
monthly_price_cents: number;
|
|
527
549
|
annual_price_cents: number;
|
|
528
550
|
overage_rate_cents: number;
|
|
551
|
+
/** `own_subscription` uses the customer's connected model plan; `platform` includes inference. */
|
|
552
|
+
inference_mode: "own_subscription" | "platform";
|
|
553
|
+
/** Whether this plan may opt into metered usage beyond its included runs. */
|
|
554
|
+
overage_available: boolean;
|
|
529
555
|
/** Per-period model-spend fair-use cap; `0` on servers that predate the field. */
|
|
530
556
|
fair_use_cost_limit_cents: number;
|
|
531
557
|
}
|
|
558
|
+
type SubscriptionPlanId = "individual" | "pro" | "max_5x" | "max_20x";
|
|
559
|
+
type SubscriptionBillingPeriod = "monthly" | "annual";
|
|
560
|
+
/** Stripe redirect returned when starting checkout or managing the current plan. */
|
|
561
|
+
interface SubscriptionCheckout {
|
|
562
|
+
url: string;
|
|
563
|
+
destination: "checkout" | "portal" | "sales";
|
|
564
|
+
}
|
|
532
565
|
/** One prepaid token-balance ledger entry. Micro-USD; debits are negative. */
|
|
533
566
|
interface TokenTransaction {
|
|
534
567
|
type: string;
|
|
@@ -842,6 +875,18 @@ interface OverageParams {
|
|
|
842
875
|
/** Hard ceiling on overage spend per period, in cents. */
|
|
843
876
|
monthly_cap_cents: number;
|
|
844
877
|
}
|
|
878
|
+
interface SubscriptionCheckoutParams {
|
|
879
|
+
plan_id: SubscriptionPlanId;
|
|
880
|
+
billing_period?: SubscriptionBillingPeriod;
|
|
881
|
+
}
|
|
882
|
+
interface BillingPortalParams {
|
|
883
|
+
/** Kept for wire compatibility; `subscription_update` returns a sales-contact URL. */
|
|
884
|
+
flow?: "subscription_update";
|
|
885
|
+
}
|
|
886
|
+
interface BillingPlansParams {
|
|
887
|
+
/** Include Hobby, which is activated separately and cannot be submitted to checkout. */
|
|
888
|
+
include_free?: boolean;
|
|
889
|
+
}
|
|
845
890
|
interface TopupParams {
|
|
846
891
|
/** Cents to add. $5 minimum, $1M maximum. */
|
|
847
892
|
amount_cents: number;
|
|
@@ -883,13 +928,19 @@ interface BillingResource {
|
|
|
883
928
|
* `receipt_url` can be `null` when Stripe can no longer retrieve the session.
|
|
884
929
|
*/
|
|
885
930
|
receipts(params?: PageParams): Promise<Page<Receipt>>;
|
|
886
|
-
/**
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
931
|
+
/** Purchasable plans from the canonical catalog. Pass `include_free` to also render Hobby. */
|
|
932
|
+
plans(params?: BillingPlansParams): Promise<Plan[]>;
|
|
933
|
+
/** Start a paid subscription. Existing customers may manage their current tier and cadence;
|
|
934
|
+
* changing either returns `destination="sales"` with a contact URL. */
|
|
935
|
+
checkout(params: SubscriptionCheckoutParams): Promise<SubscriptionCheckout>;
|
|
936
|
+
/** Open Stripe for payment methods, invoices, or cancellation. */
|
|
937
|
+
portal(params?: BillingPortalParams): Promise<string>;
|
|
938
|
+
/** Activate Hobby using a connected model subscription. */
|
|
939
|
+
activateFree(): Promise<Usage>;
|
|
890
940
|
/**
|
|
891
941
|
* Decide whether runs may continue past your plan's included allotment, and how
|
|
892
|
-
* far.
|
|
942
|
+
* far. Available only when the current catalog plan has `overage_available=true`.
|
|
943
|
+
* Off by default; once enabled, extra runs bill at the per-run overage rate
|
|
893
944
|
* until `monthly_cap_cents` is reached. Returns the refreshed usage so you can
|
|
894
945
|
* confirm the new state without a second call.
|
|
895
946
|
*/
|
|
@@ -1026,6 +1077,7 @@ interface ModelConnection {
|
|
|
1026
1077
|
provider: ModelConnectionProvider;
|
|
1027
1078
|
display_name: string;
|
|
1028
1079
|
connected: boolean;
|
|
1080
|
+
is_default: boolean;
|
|
1029
1081
|
status?: string | null;
|
|
1030
1082
|
account_label?: string | null;
|
|
1031
1083
|
expires_at?: string | null;
|
|
@@ -1060,46 +1112,72 @@ interface ModelConnectionsResource {
|
|
|
1060
1112
|
declare function createModelConnectionsResource(http: Http): ModelConnectionsResource;
|
|
1061
1113
|
|
|
1062
1114
|
/**
|
|
1063
|
-
* `client.permissions` — standing tool allow-lists
|
|
1115
|
+
* `client.permissions` — standing tool allow-lists.
|
|
1064
1116
|
*
|
|
1065
1117
|
* A run pauses whenever the agent reaches for a tool that is not pre-approved,
|
|
1066
1118
|
* and stays paused until somebody answers. That is the right default for a first
|
|
1067
1119
|
* run and the wrong one for a tool your product has already decided is fine. A
|
|
1068
|
-
* policy here says "
|
|
1069
|
-
* stop stopping.
|
|
1120
|
+
* policy here says "these runs may use this tool" once, so they stop stopping.
|
|
1070
1121
|
*
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1122
|
+
* TWO SCOPES, and `user_id` is what selects between them — it is not a required
|
|
1123
|
+
* argument. Pass it to reach one end-user's policies. OMIT it to reach the
|
|
1124
|
+
* ACCOUNT-LEVEL scope (`end_user_id IS NULL`), which is the scope a run with no
|
|
1125
|
+
* `user_id` matches and the one the platform writes to when somebody picks
|
|
1126
|
+
* "always allow" on a first-party run. Requiring `user_id` here is exactly what
|
|
1127
|
+
* made those policies ungovernable — grantable, but never listable or revocable
|
|
1128
|
+
* through this SDK. The API stopped requiring it on 2026-08-01
|
|
1129
|
+
* (`PermissionPolicyCreate.user_id`, `_end_user_id_query`); this client did not
|
|
1130
|
+
* follow, and its own docstring asserted the account scope did not exist.
|
|
1131
|
+
*
|
|
1132
|
+
* The two scopes never overlap: a delete must name the SAME scope the policy
|
|
1133
|
+
* lives in, so an end-user-scoped delete cannot reach an account-level policy
|
|
1134
|
+
* (404), and neither can the reverse.
|
|
1135
|
+
*
|
|
1136
|
+
* One account setting narrows this: with strict multi-tenant mode on
|
|
1137
|
+
* (`require_end_user_id`, the default for API-key signups) the server rejects a
|
|
1138
|
+
* programmatic call that resolves to no end-user with a 422 naming the setting.
|
|
1139
|
+
* Omitting `user_id` is still how you ASK for the account scope — on those
|
|
1140
|
+
* accounts the answer is just no.
|
|
1141
|
+
*
|
|
1142
|
+
* Policies outlive the run, unlike `runs.answerPermission()` which unblocks a
|
|
1143
|
+
* single gate. `/docs/users` documents this surface; mirrors
|
|
1074
1144
|
* `sdk/py/m8tes/_resources/permissions.py`.
|
|
1075
1145
|
*/
|
|
1076
1146
|
|
|
1077
1147
|
interface PermissionCreateParams {
|
|
1078
|
-
/**
|
|
1079
|
-
|
|
1148
|
+
/**
|
|
1149
|
+
* The end-user whose runs this policy applies to. Omit for the account-level
|
|
1150
|
+
* scope — the one runs that carry no `user_id` match.
|
|
1151
|
+
*/
|
|
1152
|
+
user_id?: string;
|
|
1080
1153
|
/** The tool to pre-approve, e.g. `"Bash"` or an `mcp__*` tool name. */
|
|
1081
1154
|
tool: string;
|
|
1082
1155
|
}
|
|
1083
1156
|
interface PermissionListParams extends PageParams {
|
|
1084
|
-
/**
|
|
1085
|
-
user_id
|
|
1157
|
+
/** One end-user's policies. Omit to list the account-level scope. */
|
|
1158
|
+
user_id?: string;
|
|
1159
|
+
}
|
|
1160
|
+
interface PermissionDeleteParams {
|
|
1161
|
+
/**
|
|
1162
|
+
* The scope the policy lives in. Omit to delete an account-level policy.
|
|
1163
|
+
* A scope that does not match the policy is a 404, never a silent no-op.
|
|
1164
|
+
*/
|
|
1165
|
+
user_id?: string;
|
|
1086
1166
|
}
|
|
1087
1167
|
interface PermissionsResource {
|
|
1088
1168
|
/**
|
|
1089
|
-
* Pre-approve a tool so
|
|
1169
|
+
* Pre-approve a tool so matching runs no longer pause on it.
|
|
1090
1170
|
* Idempotent — re-approving the same tool returns the existing policy rather
|
|
1091
1171
|
* than erroring or duplicating. Send `tool`; the policy comes back as `tool_name`.
|
|
1092
1172
|
*/
|
|
1093
1173
|
create(params: PermissionCreateParams): Promise<PermissionPolicy>;
|
|
1094
|
-
/** Audit what
|
|
1095
|
-
list(params
|
|
1174
|
+
/** Audit what one scope's runs are allowed to do without asking. */
|
|
1175
|
+
list(params?: PermissionListParams): Promise<Page<PermissionPolicy>>;
|
|
1096
1176
|
/**
|
|
1097
1177
|
* Revoke a pre-approval, so the tool gates again on the next run.
|
|
1098
|
-
* `user_id`
|
|
1178
|
+
* `user_id` scopes the delete and must match the policy's own scope.
|
|
1099
1179
|
*/
|
|
1100
|
-
delete(permissionId: number, params:
|
|
1101
|
-
user_id: string;
|
|
1102
|
-
}): Promise<void>;
|
|
1180
|
+
delete(permissionId: number, params?: PermissionDeleteParams): Promise<void>;
|
|
1103
1181
|
}
|
|
1104
1182
|
declare function createPermissionsResource(http: Http): PermissionsResource;
|
|
1105
1183
|
|
|
@@ -1192,6 +1270,7 @@ interface PollDeps {
|
|
|
1192
1270
|
}, signal?: AbortSignal): Promise<unknown>;
|
|
1193
1271
|
answer(runId: number, params: {
|
|
1194
1272
|
answers: Record<string, string>;
|
|
1273
|
+
request_id?: string;
|
|
1195
1274
|
}, signal?: AbortSignal): Promise<unknown>;
|
|
1196
1275
|
}
|
|
1197
1276
|
/** Thrown when the caller aborts the wait. */
|
|
@@ -1357,6 +1436,10 @@ interface RunListParams {
|
|
|
1357
1436
|
teammate_id?: number;
|
|
1358
1437
|
task_id?: number;
|
|
1359
1438
|
status?: string;
|
|
1439
|
+
/** `created` (newest first, the default) or `priority` (runs waiting on a human first). */
|
|
1440
|
+
sort?: "created" | "priority";
|
|
1441
|
+
/** Hide Company Agent Day-1 / pulse / maintenance (Platform accounts only) — ask whether the user has run anything. */
|
|
1442
|
+
exclude_platform_runs?: boolean;
|
|
1360
1443
|
limit?: number;
|
|
1361
1444
|
starting_after?: number;
|
|
1362
1445
|
}
|
|
@@ -1374,6 +1457,13 @@ interface ApproveParams {
|
|
|
1374
1457
|
* stored policy).
|
|
1375
1458
|
*/
|
|
1376
1459
|
remember?: boolean;
|
|
1460
|
+
/**
|
|
1461
|
+
* Steering in your own words, e.g. with `decision: "deny"`, "use the staging
|
|
1462
|
+
* board instead". The agent reads it and adapts rather than silently skipping
|
|
1463
|
+
* the action. Delivered on both decisions when the run is paused; a deny's
|
|
1464
|
+
* reason also reaches a still-live run.
|
|
1465
|
+
*/
|
|
1466
|
+
reason?: string;
|
|
1377
1467
|
}
|
|
1378
1468
|
interface AnswerParams {
|
|
1379
1469
|
/**
|
|
@@ -1381,6 +1471,20 @@ interface AnswerParams {
|
|
|
1381
1471
|
* `question` strings from the `question` event.
|
|
1382
1472
|
*/
|
|
1383
1473
|
answers: Record<string, string>;
|
|
1474
|
+
/**
|
|
1475
|
+
* The gate this answer is for — `requestId` off the `question` event (the
|
|
1476
|
+
* stream normalises it to camelCase), or `request_id` from
|
|
1477
|
+
* `runs.permissions()`. Required whenever the run has more than one
|
|
1478
|
+
* unresolved `AskUserQuestion`.
|
|
1479
|
+
*
|
|
1480
|
+
* A run accumulates asks over its life, and only some of them get resolved.
|
|
1481
|
+
* With no `request_id` the server does not know which one you answered, so it
|
|
1482
|
+
* falls back to position: the OLDEST ask that is not already allowed. A gate
|
|
1483
|
+
* that timed out earlier still matches that, so the answer you wrote for the
|
|
1484
|
+
* live question is merged into the stale one and the run resumes on the wrong
|
|
1485
|
+
* selection. Send the id and the server targets exactly that gate.
|
|
1486
|
+
*/
|
|
1487
|
+
request_id?: string;
|
|
1384
1488
|
}
|
|
1385
1489
|
interface RunsResource {
|
|
1386
1490
|
/** Start a run and stream it. */
|
|
@@ -1430,7 +1534,11 @@ interface RunsResource {
|
|
|
1430
1534
|
}): Promise<Run>;
|
|
1431
1535
|
/** Approve or deny a pending tool-permission gate. */
|
|
1432
1536
|
approve(runId: number, params: ApproveParams): Promise<PermissionRequest>;
|
|
1433
|
-
/**
|
|
1537
|
+
/**
|
|
1538
|
+
* Answer a pending AskUserQuestion gate, resuming the run. Pass `request_id`
|
|
1539
|
+
* when the run has more than one unresolved ask, or the server picks by
|
|
1540
|
+
* position instead.
|
|
1541
|
+
*/
|
|
1434
1542
|
answer(runId: number, params: AnswerParams): Promise<{
|
|
1435
1543
|
status: string;
|
|
1436
1544
|
resumed: boolean;
|
|
@@ -1649,6 +1757,9 @@ interface TasksResource {
|
|
|
1649
1757
|
* byte on the signing scheme, so a payload verified by one SDK verifies in the
|
|
1650
1758
|
* other.
|
|
1651
1759
|
*
|
|
1760
|
+
* `user_id` scopes an endpoint to one end-user; omit for account-level. The
|
|
1761
|
+
* scopes never mix: an end-user run only delivers to that end-user's endpoints.
|
|
1762
|
+
*
|
|
1652
1763
|
* Scheme: HMAC-SHA256 over `"{webhook-id}.{webhook-timestamp}.{raw body}"`, hex,
|
|
1653
1764
|
* prefixed `v1=`, compared in constant time.
|
|
1654
1765
|
*/
|
|
@@ -1683,22 +1794,31 @@ interface WebhooksResource {
|
|
|
1683
1794
|
create(params: {
|
|
1684
1795
|
url: string;
|
|
1685
1796
|
events?: string[];
|
|
1797
|
+
user_id?: string;
|
|
1686
1798
|
}): Promise<Webhook>;
|
|
1687
1799
|
list(params?: {
|
|
1688
1800
|
limit?: number;
|
|
1689
1801
|
starting_after?: number;
|
|
1802
|
+
user_id?: string;
|
|
1690
1803
|
}): Promise<Page<Webhook>>;
|
|
1691
|
-
get(webhookId: number
|
|
1804
|
+
get(webhookId: number, params?: {
|
|
1805
|
+
user_id?: string;
|
|
1806
|
+
}): Promise<Webhook>;
|
|
1692
1807
|
update(webhookId: number, params: {
|
|
1693
1808
|
url?: string;
|
|
1694
1809
|
events?: string[];
|
|
1695
1810
|
active?: boolean;
|
|
1811
|
+
rotate_secret?: boolean;
|
|
1812
|
+
user_id?: string;
|
|
1696
1813
|
}): Promise<Webhook>;
|
|
1697
|
-
delete(webhookId: number
|
|
1814
|
+
delete(webhookId: number, params?: {
|
|
1815
|
+
user_id?: string;
|
|
1816
|
+
}): Promise<void>;
|
|
1698
1817
|
/** Delivery attempts, for debugging a receiver that is not getting events. */
|
|
1699
1818
|
listDeliveries(webhookId: number, params?: {
|
|
1700
1819
|
limit?: number;
|
|
1701
1820
|
starting_after?: number;
|
|
1821
|
+
user_id?: string;
|
|
1702
1822
|
}): Promise<Page<WebhookDelivery>>;
|
|
1703
1823
|
}
|
|
1704
1824
|
|
|
@@ -1726,7 +1846,7 @@ interface WebhooksResource {
|
|
|
1726
1846
|
*/
|
|
1727
1847
|
|
|
1728
1848
|
/** Kept in lockstep with package.json "version" — guarded by test/version.test.ts. */
|
|
1729
|
-
declare const M8TES_SDK_VERSION = "0.1.0-alpha.
|
|
1849
|
+
declare const M8TES_SDK_VERSION = "0.1.0-alpha.6";
|
|
1730
1850
|
declare class M8tes {
|
|
1731
1851
|
readonly runs: RunsResource;
|
|
1732
1852
|
readonly agents: AgentsResource;
|
|
@@ -1748,4 +1868,4 @@ declare class M8tes {
|
|
|
1748
1868
|
constructor(options?: ClientOptions);
|
|
1749
1869
|
}
|
|
1750
1870
|
|
|
1751
|
-
export { type AccountDeletion, type AccountExport, type AccountResource, type AccountSettings, type AccountSettingsUpdateParams, type Agent, type AgentCreateParams, type AgentListParams, type AgentUpdateParams, type AgentsResource, type AlertThresholdParams, type App, type AppConnectionInitiation, type AppConnectionResult, type AppsResource, type AuthorizableModelConnectionProvider, type AutoReloadParams, type Balance, type BillingResource, type ClientOptions, type CodeModelConnectionProvider, ConversationState, DEFAULT_BASE_URL, type DeviceModelConnectionProvider, type EmailInbox, type EndUser, type EndUserCreateParams, type EndUserUpdateParams, type EndUserUsage, type FetchLike, type Http, type JsonObject, type ListResponse, M8TES_SDK_VERSION, M8tes, M8tesStreamEvent, type MemoriesResource, type Memory, type MemoryCreateParams, type MemoryListParams, type MemoryUpdateParams, type Model, type ModelAuthorization, type ModelConnection, type ModelConnectionProvider, type ModelConnectionsResource, type ModelPricing, type ModelsResource, Normalizer, type OverageParams, Page, type PageParams, type PermissionCreateParams, type PermissionListParams, type PermissionMode, type PermissionPolicy, type PermissionRequest, type PermissionsResource, type Plan, type PollOptions, type Receipt, type Run, type RunCreateParams, type RunFile, type RunListParams, type RunOutcome, RunPausedError, RunStream, type RunStreamOptions, RunTimeoutError, type RunUsage, RunWaitAbortedError, type RunsResource, type SettingsResource, TERMINAL_STATUSES, type Task, type TaskCreateParams, type TaskListParams, type TaskRunParams, type TaskUpdateParams, type TasksResource, type Teammate, type TokenTransaction, type TopupParams, type Trigger, type TriggerCreateParams, type TriggerType, type TriggersResource, type Usage, type UsageBucket, type UsageModelSlice, type UsageTimeseries, type UsageTimeseriesParams, type UsageTotals, type UsersResource, type VerifySignatureOptions, type WaitOptions, type Webhook, type WebhookDelivery, type WebhookToggle, type WebhooksResource, createAccountResource, createBillingResource, createHttp, createMemoriesResource, createModelConnectionsResource, createModelsResource, createPermissionsResource, isPlanApproval, planText, pollRun, verifySignature, waitForRun };
|
|
1871
|
+
export { type AccountDeletion, type AccountExport, type AccountResource, type AccountSettings, type AccountSettingsUpdateParams, type Agent, type AgentCreateParams, type AgentListParams, type AgentUpdateParams, type AgentsResource, type AlertThresholdParams, type App, type AppConnectionInitiation, type AppConnectionResult, type AppsResource, type AuthorizableModelConnectionProvider, type AutoReloadParams, type Balance, type BillingPlansParams, type BillingPortalParams, type BillingResource, type ClientOptions, type CodeModelConnectionProvider, ConversationState, DEFAULT_BASE_URL, type DeviceModelConnectionProvider, type EmailInbox, type EndUser, type EndUserCreateParams, type EndUserUpdateParams, type EndUserUsage, type FetchLike, type Http, type JsonObject, type ListResponse, M8TES_SDK_VERSION, M8tes, M8tesStreamEvent, type MemoriesResource, type Memory, type MemoryCreateParams, type MemoryListParams, type MemoryUpdateParams, type Model, type ModelAuthorization, type ModelConnection, type ModelConnectionProvider, type ModelConnectionsResource, type ModelPricing, type ModelsResource, Normalizer, type OverageParams, Page, type PageParams, type PermissionCreateParams, type PermissionDeleteParams, type PermissionListParams, type PermissionMode, type PermissionPolicy, type PermissionRequest, type PermissionsResource, type Plan, type PollOptions, type Receipt, type Run, type RunCreateParams, type RunFile, type RunListParams, type RunOutcome, RunPausedError, RunStream, type RunStreamOptions, RunTimeoutError, type RunUsage, RunWaitAbortedError, type RunsResource, type SettingsResource, type SubscriptionBillingPeriod, type SubscriptionCheckout, type SubscriptionCheckoutParams, type SubscriptionPlanId, TERMINAL_STATUSES, type Task, type TaskCreateParams, type TaskListParams, type TaskRunParams, type TaskUpdateParams, type TasksResource, type Teammate, type TokenTransaction, type TopupParams, type Trigger, type TriggerCreateParams, type TriggerType, type TriggersResource, type Usage, type UsageBucket, type UsageModelSlice, type UsageTimeseries, type UsageTimeseriesParams, type UsageTotals, type UsersResource, type VerifySignatureOptions, type WaitOptions, type Webhook, type WebhookDelivery, type WebhookToggle, type WebhooksResource, createAccountResource, createBillingResource, createHttp, createMemoriesResource, createModelConnectionsResource, createModelsResource, createPermissionsResource, isPlanApproval, planText, pollRun, verifySignature, waitForRun };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createNormalizer, createSseDecoder, initialConversationState, accumulate, RunFailedError, APIError, parseRetryAfter, ConflictError, NotFoundError, AuthenticationError, PermissionDeniedError, ValidationError, seg, parseErrorEnvelope, errorClassForStatus } from './chunk-
|
|
2
|
-
export { APIError, AuthenticationError, BillingError, ConflictError, M8tesApiError, NotFoundError, PROTOCOL_VERSION, PermissionDeniedError, RateLimitError, RunFailedError, RunNotStreamingError, TERMINAL_EVENT_TYPES, ValidationError, accumulate, createAccumulator, createNormalizer, createSseDecoder, errorClassForStatus, errorFromResponse, initialConversationState, isTerminalEvent, parseErrorEnvelope, parseRetryAfter, parseSse, seg, splitConcatenatedJson } from './chunk-
|
|
1
|
+
import { createNormalizer, createSseDecoder, initialConversationState, accumulate, RunFailedError, APIError, parseRetryAfter, ConflictError, NotFoundError, AuthenticationError, PermissionDeniedError, ValidationError, seg, parseErrorEnvelope, errorClassForStatus } from './chunk-F6B6R3SP.js';
|
|
2
|
+
export { APIError, AuthenticationError, BillingError, ConflictError, M8tesApiError, NotFoundError, PROTOCOL_VERSION, PermissionDeniedError, RateLimitError, RunFailedError, RunNotStreamingError, TERMINAL_EVENT_TYPES, ValidationError, accumulate, createAccumulator, createNormalizer, createSseDecoder, errorClassForStatus, errorFromResponse, initialConversationState, isTerminalEvent, parseErrorEnvelope, parseRetryAfter, parseSse, seg, splitConcatenatedJson } from './chunk-F6B6R3SP.js';
|
|
3
3
|
import { createHmac, timingSafeEqual } from 'crypto';
|
|
4
4
|
|
|
5
5
|
// src/http.ts
|
|
@@ -417,13 +417,39 @@ function createBillingResource(http) {
|
|
|
417
417
|
const query = toQuery(
|
|
418
418
|
toBody({ ...rest, teammate_id: resolveAgentId(teammate_id, agent_id) })
|
|
419
419
|
);
|
|
420
|
-
return http.request("GET", "/usage/timeseries", {
|
|
420
|
+
return http.request("GET", "/usage/timeseries", {
|
|
421
|
+
query
|
|
422
|
+
});
|
|
421
423
|
},
|
|
422
424
|
receipts(params = {}) {
|
|
423
425
|
return pager(http, "/billing/receipts")({ ...params });
|
|
424
426
|
},
|
|
425
|
-
plans() {
|
|
426
|
-
return http.request("GET", "/billing/plans"
|
|
427
|
+
plans(params = {}) {
|
|
428
|
+
return http.request("GET", "/billing/plans", {
|
|
429
|
+
query: toQuery(toBody({ ...params }))
|
|
430
|
+
});
|
|
431
|
+
},
|
|
432
|
+
checkout(params) {
|
|
433
|
+
return http.request("POST", "/billing/checkout", {
|
|
434
|
+
body: toBody({ billing_period: "monthly", ...params })
|
|
435
|
+
});
|
|
436
|
+
},
|
|
437
|
+
async portal(params = {}) {
|
|
438
|
+
const response = await http.request(
|
|
439
|
+
"POST",
|
|
440
|
+
"/billing/portal",
|
|
441
|
+
{
|
|
442
|
+
body: toBody({ ...params })
|
|
443
|
+
}
|
|
444
|
+
);
|
|
445
|
+
return response.url;
|
|
446
|
+
},
|
|
447
|
+
async activateFree() {
|
|
448
|
+
const usage = await http.request("POST", "/billing/activate-free");
|
|
449
|
+
return {
|
|
450
|
+
...usage,
|
|
451
|
+
free_path_available: usage.free_path_available ?? false
|
|
452
|
+
};
|
|
427
453
|
},
|
|
428
454
|
async setOverage(params) {
|
|
429
455
|
const usage = await http.request("PATCH", "/billing/overage", {
|
|
@@ -438,9 +464,13 @@ function createBillingResource(http) {
|
|
|
438
464
|
return http.request("GET", "/billing/balance");
|
|
439
465
|
},
|
|
440
466
|
async topup(params) {
|
|
441
|
-
const res = await http.request(
|
|
442
|
-
|
|
443
|
-
|
|
467
|
+
const res = await http.request(
|
|
468
|
+
"POST",
|
|
469
|
+
"/billing/topup",
|
|
470
|
+
{
|
|
471
|
+
body: toBody({ ...params })
|
|
472
|
+
}
|
|
473
|
+
);
|
|
444
474
|
return res.checkout_url;
|
|
445
475
|
},
|
|
446
476
|
setAutoReload(params) {
|
|
@@ -539,10 +569,10 @@ function createPermissionsResource(http) {
|
|
|
539
569
|
body: toBody({ ...params })
|
|
540
570
|
});
|
|
541
571
|
},
|
|
542
|
-
list(params) {
|
|
572
|
+
list(params = {}) {
|
|
543
573
|
return pager(http, "/permissions/")({ ...params });
|
|
544
574
|
},
|
|
545
|
-
async delete(permissionId, params) {
|
|
575
|
+
async delete(permissionId, params = {}) {
|
|
546
576
|
await http.request("DELETE", `/permissions/${seg(permissionId)}`, {
|
|
547
577
|
query: toQuery({ user_id: params.user_id })
|
|
548
578
|
});
|
|
@@ -810,7 +840,7 @@ async function waitForRun(deps, runId, options = {}) {
|
|
|
810
840
|
);
|
|
811
841
|
}
|
|
812
842
|
const answers = await bound(async () => options.onQuestion(request));
|
|
813
|
-
await resolveGate(() => deps.answer(runId, { answers }, signal));
|
|
843
|
+
await resolveGate(() => deps.answer(runId, { answers, request_id: request.request_id }, signal));
|
|
814
844
|
} else {
|
|
815
845
|
if (!options.onApproval) {
|
|
816
846
|
throw new RunPausedError(
|
|
@@ -1061,8 +1091,12 @@ function createRunsResource(http) {
|
|
|
1061
1091
|
});
|
|
1062
1092
|
},
|
|
1063
1093
|
answer(runId, params) {
|
|
1094
|
+
const body = {
|
|
1095
|
+
answers: params.answers
|
|
1096
|
+
};
|
|
1097
|
+
if (params.request_id !== void 0) body.request_id = params.request_id;
|
|
1064
1098
|
return http.request("POST", `/runs/${seg(runId)}/answer`, {
|
|
1065
|
-
body
|
|
1099
|
+
body
|
|
1066
1100
|
});
|
|
1067
1101
|
},
|
|
1068
1102
|
async permissions(runId) {
|
|
@@ -1232,23 +1266,32 @@ function createWebhooksResource(http) {
|
|
|
1232
1266
|
list(params = {}) {
|
|
1233
1267
|
return pager(http, "/webhooks/")({ ...params });
|
|
1234
1268
|
},
|
|
1235
|
-
get(webhookId) {
|
|
1236
|
-
return http.request("GET", `/webhooks/${seg(webhookId)}
|
|
1269
|
+
get(webhookId, params = {}) {
|
|
1270
|
+
return http.request("GET", `/webhooks/${seg(webhookId)}`, {
|
|
1271
|
+
query: toQuery({ user_id: params.user_id })
|
|
1272
|
+
});
|
|
1237
1273
|
},
|
|
1238
|
-
update(webhookId,
|
|
1239
|
-
return http.request("PATCH", `/webhooks/${seg(webhookId)}`, {
|
|
1274
|
+
update(webhookId, { user_id, ...body }) {
|
|
1275
|
+
return http.request("PATCH", `/webhooks/${seg(webhookId)}`, {
|
|
1276
|
+
query: toQuery({ user_id }),
|
|
1277
|
+
body: toBody({ ...body })
|
|
1278
|
+
});
|
|
1240
1279
|
},
|
|
1241
|
-
async delete(webhookId) {
|
|
1242
|
-
await http.request("DELETE", `/webhooks/${seg(webhookId)}
|
|
1280
|
+
async delete(webhookId, params = {}) {
|
|
1281
|
+
await http.request("DELETE", `/webhooks/${seg(webhookId)}`, {
|
|
1282
|
+
query: toQuery({ user_id: params.user_id })
|
|
1283
|
+
});
|
|
1243
1284
|
},
|
|
1244
1285
|
listDeliveries(webhookId, params = {}) {
|
|
1245
|
-
return pager(http, `/webhooks/${seg(webhookId)}/deliveries`)({
|
|
1286
|
+
return pager(http, `/webhooks/${seg(webhookId)}/deliveries`)({
|
|
1287
|
+
...params
|
|
1288
|
+
});
|
|
1246
1289
|
}
|
|
1247
1290
|
};
|
|
1248
1291
|
}
|
|
1249
1292
|
|
|
1250
1293
|
// src/index.ts
|
|
1251
|
-
var M8TES_SDK_VERSION = "0.1.0-alpha.
|
|
1294
|
+
var M8TES_SDK_VERSION = "0.1.0-alpha.6";
|
|
1252
1295
|
var M8tes = class {
|
|
1253
1296
|
runs;
|
|
1254
1297
|
agents;
|