@m8tes/sdk 0.1.0-alpha.3 → 0.1.0-alpha.5

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/dist/index.d.cts CHANGED
@@ -171,6 +171,12 @@ interface Agent {
171
171
  enable_task_setup_tools?: boolean | null;
172
172
  enable_feedback?: boolean | null;
173
173
  enable_self_improvement?: boolean | null;
174
+ /** Most recent run activity in the last 90 days; null if idle longer. */
175
+ last_active_at?: string | null;
176
+ /** How many runs are executing or awaiting approval right now. */
177
+ active_run_count?: number;
178
+ /** Sole live run id when active_run_count is exactly 1; otherwise null. */
179
+ active_run_id?: number | null;
174
180
  }
175
181
  /** Permanent alias — the platform term is "agent", the DB model is `Teammate`. */
176
182
  type Teammate = Agent;
@@ -200,6 +206,10 @@ interface Run {
200
206
  /** Provider behind an OAuth subscription route: claude, openai, xai, or gemini. */
201
207
  auth_provider?: string | null;
202
208
  retryable?: boolean;
209
+ /** Whether this run performed any non-read-only action. Null when not computed. */
210
+ repeats_actions?: boolean | null;
211
+ /** Whether the offered recovery would repeat an action; latest turn only for chat. */
212
+ recovery_repeats_actions?: boolean | null;
203
213
  retry_of_run_id?: number | null;
204
214
  retry_count?: number;
205
215
  output_data?: JsonObject | null;
@@ -212,6 +222,9 @@ interface RunOutcome {
212
222
  summary: string | null;
213
223
  headline: string | null;
214
224
  needs_reply: boolean;
225
+ needs_reply_count: number | null;
226
+ /** How the agent chose to deliver this outcome: email, slack, or none. */
227
+ delivery_channel: string;
215
228
  output_data: JsonObject | null;
216
229
  message_count: number;
217
230
  input_tokens: number;
@@ -257,6 +270,7 @@ interface Task {
257
270
  enable_task_setup_tools?: boolean | null;
258
271
  enable_feedback?: boolean | null;
259
272
  enable_lessons?: boolean;
273
+ permission_mode?: PermissionMode | null;
260
274
  }
261
275
  type TriggerType = "schedule" | "webhook" | "email" | "app";
262
276
  interface Trigger {
@@ -455,6 +469,8 @@ interface Usage {
455
469
  cost_limit: string;
456
470
  period_end: string;
457
471
  subscription_status: string | null;
472
+ /** Authoritative eligibility for the model-subscription-funded Free path. */
473
+ free_path_available: boolean;
458
474
  overage_enabled: boolean;
459
475
  overage_used_cents: number;
460
476
  /** Ceiling on overage spend per period. Runs stop billing overage once reached. */
@@ -596,6 +612,8 @@ interface AgentUpdateParams {
596
612
  model?: string | null;
597
613
  effort?: string | null;
598
614
  default_permission_mode?: PermissionMode | null;
615
+ /** Who can see this agent. Omit or null leaves it unchanged. */
616
+ visibility?: "personal" | "organization" | null;
599
617
  allowed_senders?: string[] | null;
600
618
  enable_memory?: boolean | null;
601
619
  enable_history?: boolean | null;
@@ -1036,6 +1054,8 @@ interface ModelConnectionsResource {
1036
1054
  cancelAuthorization(provider: AuthorizableModelConnectionProvider, state: string): Promise<void>;
1037
1055
  /** Delete m8tes' encrypted copy of the provider credentials. */
1038
1056
  disconnect(provider: ModelConnectionProvider): Promise<ModelConnection>;
1057
+ /** Clear the account model-plan default so platform mates use m8tes credits again. */
1058
+ clearDefault(): Promise<boolean>;
1039
1059
  }
1040
1060
  declare function createModelConnectionsResource(http: Http): ModelConnectionsResource;
1041
1061
 
@@ -1384,13 +1404,18 @@ interface RunsResource {
1384
1404
  * If the run already did something visible (sent a message, changed data), the
1385
1405
  * API refuses with a 409 `retry_needs_confirmation`; pass `confirm: true` to
1386
1406
  * proceed. Check `run.retryable` first to avoid a guaranteed conflict.
1407
+ * Provider auth, quota, own-subscription rate-limit, and availability failures
1408
+ * follow the account's current connected/preferred provider. Other failures
1409
+ * replay the original concrete model; `use_credits` pins m8tes credits.
1387
1410
  */
1388
1411
  retry(runId: number, params?: {
1389
1412
  confirm?: boolean;
1413
+ use_credits?: boolean;
1390
1414
  }): Promise<Run>;
1391
1415
  /** Join a run already in flight. Throws `RunNotStreamingError` if it has finished. */
1392
1416
  stream(runId: number, options?: RunStreamOptions): RunStream;
1393
- /** Continue the conversation on an existing run, streaming the reply. */
1417
+ /** Continue the same run, streaming only this follow-up. After a provider failure,
1418
+ * the reply follows the account's current connected/preferred provider. */
1394
1419
  reply(runId: number, message: string, options?: RunStreamOptions): RunStream;
1395
1420
  /** GET /runs/{id}. Pass `user_id` to scope to one end-user (required when the
1396
1421
  * account has strict multi-tenant mode on). */
@@ -1507,6 +1532,8 @@ interface TaskCreateFields {
1507
1532
  enable_feedback?: boolean;
1508
1533
  /** Accumulate self-improvement lessons across this task's runs. Default true. */
1509
1534
  enable_lessons?: boolean;
1535
+ /** How this task's runs ask for approval. Default: the agent's default. */
1536
+ permission_mode?: PermissionMode;
1510
1537
  }
1511
1538
  /**
1512
1539
  * PATCH /tasks/{id} accepts exactly these fields (backend `DevTaskUpdate`).
@@ -1528,6 +1555,7 @@ interface TaskUpdateParams {
1528
1555
  enable_task_setup_tools?: boolean | null;
1529
1556
  enable_feedback?: boolean | null;
1530
1557
  enable_lessons?: boolean | null;
1558
+ permission_mode?: PermissionMode | null;
1531
1559
  }
1532
1560
  interface TaskListParams {
1533
1561
  user_id?: string;
@@ -1698,7 +1726,7 @@ interface WebhooksResource {
1698
1726
  */
1699
1727
 
1700
1728
  /** Kept in lockstep with package.json "version" — guarded by test/version.test.ts. */
1701
- declare const M8TES_SDK_VERSION = "0.1.0-alpha.3";
1729
+ declare const M8TES_SDK_VERSION = "0.1.0-alpha.5";
1702
1730
  declare class M8tes {
1703
1731
  readonly runs: RunsResource;
1704
1732
  readonly agents: AgentsResource;
package/dist/index.d.ts CHANGED
@@ -171,6 +171,12 @@ interface Agent {
171
171
  enable_task_setup_tools?: boolean | null;
172
172
  enable_feedback?: boolean | null;
173
173
  enable_self_improvement?: boolean | null;
174
+ /** Most recent run activity in the last 90 days; null if idle longer. */
175
+ last_active_at?: string | null;
176
+ /** How many runs are executing or awaiting approval right now. */
177
+ active_run_count?: number;
178
+ /** Sole live run id when active_run_count is exactly 1; otherwise null. */
179
+ active_run_id?: number | null;
174
180
  }
175
181
  /** Permanent alias — the platform term is "agent", the DB model is `Teammate`. */
176
182
  type Teammate = Agent;
@@ -200,6 +206,10 @@ interface Run {
200
206
  /** Provider behind an OAuth subscription route: claude, openai, xai, or gemini. */
201
207
  auth_provider?: string | null;
202
208
  retryable?: boolean;
209
+ /** Whether this run performed any non-read-only action. Null when not computed. */
210
+ repeats_actions?: boolean | null;
211
+ /** Whether the offered recovery would repeat an action; latest turn only for chat. */
212
+ recovery_repeats_actions?: boolean | null;
203
213
  retry_of_run_id?: number | null;
204
214
  retry_count?: number;
205
215
  output_data?: JsonObject | null;
@@ -212,6 +222,9 @@ interface RunOutcome {
212
222
  summary: string | null;
213
223
  headline: string | null;
214
224
  needs_reply: boolean;
225
+ needs_reply_count: number | null;
226
+ /** How the agent chose to deliver this outcome: email, slack, or none. */
227
+ delivery_channel: string;
215
228
  output_data: JsonObject | null;
216
229
  message_count: number;
217
230
  input_tokens: number;
@@ -257,6 +270,7 @@ interface Task {
257
270
  enable_task_setup_tools?: boolean | null;
258
271
  enable_feedback?: boolean | null;
259
272
  enable_lessons?: boolean;
273
+ permission_mode?: PermissionMode | null;
260
274
  }
261
275
  type TriggerType = "schedule" | "webhook" | "email" | "app";
262
276
  interface Trigger {
@@ -455,6 +469,8 @@ interface Usage {
455
469
  cost_limit: string;
456
470
  period_end: string;
457
471
  subscription_status: string | null;
472
+ /** Authoritative eligibility for the model-subscription-funded Free path. */
473
+ free_path_available: boolean;
458
474
  overage_enabled: boolean;
459
475
  overage_used_cents: number;
460
476
  /** Ceiling on overage spend per period. Runs stop billing overage once reached. */
@@ -596,6 +612,8 @@ interface AgentUpdateParams {
596
612
  model?: string | null;
597
613
  effort?: string | null;
598
614
  default_permission_mode?: PermissionMode | null;
615
+ /** Who can see this agent. Omit or null leaves it unchanged. */
616
+ visibility?: "personal" | "organization" | null;
599
617
  allowed_senders?: string[] | null;
600
618
  enable_memory?: boolean | null;
601
619
  enable_history?: boolean | null;
@@ -1036,6 +1054,8 @@ interface ModelConnectionsResource {
1036
1054
  cancelAuthorization(provider: AuthorizableModelConnectionProvider, state: string): Promise<void>;
1037
1055
  /** Delete m8tes' encrypted copy of the provider credentials. */
1038
1056
  disconnect(provider: ModelConnectionProvider): Promise<ModelConnection>;
1057
+ /** Clear the account model-plan default so platform mates use m8tes credits again. */
1058
+ clearDefault(): Promise<boolean>;
1039
1059
  }
1040
1060
  declare function createModelConnectionsResource(http: Http): ModelConnectionsResource;
1041
1061
 
@@ -1384,13 +1404,18 @@ interface RunsResource {
1384
1404
  * If the run already did something visible (sent a message, changed data), the
1385
1405
  * API refuses with a 409 `retry_needs_confirmation`; pass `confirm: true` to
1386
1406
  * proceed. Check `run.retryable` first to avoid a guaranteed conflict.
1407
+ * Provider auth, quota, own-subscription rate-limit, and availability failures
1408
+ * follow the account's current connected/preferred provider. Other failures
1409
+ * replay the original concrete model; `use_credits` pins m8tes credits.
1387
1410
  */
1388
1411
  retry(runId: number, params?: {
1389
1412
  confirm?: boolean;
1413
+ use_credits?: boolean;
1390
1414
  }): Promise<Run>;
1391
1415
  /** Join a run already in flight. Throws `RunNotStreamingError` if it has finished. */
1392
1416
  stream(runId: number, options?: RunStreamOptions): RunStream;
1393
- /** Continue the conversation on an existing run, streaming the reply. */
1417
+ /** Continue the same run, streaming only this follow-up. After a provider failure,
1418
+ * the reply follows the account's current connected/preferred provider. */
1394
1419
  reply(runId: number, message: string, options?: RunStreamOptions): RunStream;
1395
1420
  /** GET /runs/{id}. Pass `user_id` to scope to one end-user (required when the
1396
1421
  * account has strict multi-tenant mode on). */
@@ -1507,6 +1532,8 @@ interface TaskCreateFields {
1507
1532
  enable_feedback?: boolean;
1508
1533
  /** Accumulate self-improvement lessons across this task's runs. Default true. */
1509
1534
  enable_lessons?: boolean;
1535
+ /** How this task's runs ask for approval. Default: the agent's default. */
1536
+ permission_mode?: PermissionMode;
1510
1537
  }
1511
1538
  /**
1512
1539
  * PATCH /tasks/{id} accepts exactly these fields (backend `DevTaskUpdate`).
@@ -1528,6 +1555,7 @@ interface TaskUpdateParams {
1528
1555
  enable_task_setup_tools?: boolean | null;
1529
1556
  enable_feedback?: boolean | null;
1530
1557
  enable_lessons?: boolean | null;
1558
+ permission_mode?: PermissionMode | null;
1531
1559
  }
1532
1560
  interface TaskListParams {
1533
1561
  user_id?: string;
@@ -1698,7 +1726,7 @@ interface WebhooksResource {
1698
1726
  */
1699
1727
 
1700
1728
  /** Kept in lockstep with package.json "version" — guarded by test/version.test.ts. */
1701
- declare const M8TES_SDK_VERSION = "0.1.0-alpha.3";
1729
+ declare const M8TES_SDK_VERSION = "0.1.0-alpha.5";
1702
1730
  declare class M8tes {
1703
1731
  readonly runs: RunsResource;
1704
1732
  readonly agents: AgentsResource;
package/dist/index.js CHANGED
@@ -405,8 +405,12 @@ function createUsersResource(http) {
405
405
  // src/resources/billing.ts
406
406
  function createBillingResource(http) {
407
407
  return {
408
- usage() {
409
- return http.request("GET", "/usage/");
408
+ async usage() {
409
+ const usage = await http.request("GET", "/usage/");
410
+ return {
411
+ ...usage,
412
+ free_path_available: usage.free_path_available ?? false
413
+ };
410
414
  },
411
415
  usageTimeseries(params = {}) {
412
416
  const { agent_id, teammate_id, ...rest } = params;
@@ -421,8 +425,14 @@ function createBillingResource(http) {
421
425
  plans() {
422
426
  return http.request("GET", "/billing/plans");
423
427
  },
424
- setOverage(params) {
425
- return http.request("PATCH", "/billing/overage", { body: toBody({ ...params }) });
428
+ async setOverage(params) {
429
+ const usage = await http.request("PATCH", "/billing/overage", {
430
+ body: toBody({ ...params })
431
+ });
432
+ return {
433
+ ...usage,
434
+ free_path_available: usage.free_path_available ?? false
435
+ };
426
436
  },
427
437
  balance() {
428
438
  return http.request("GET", "/billing/balance");
@@ -510,6 +520,13 @@ function createModelConnectionsResource(http) {
510
520
  },
511
521
  disconnect(provider) {
512
522
  return http.request("DELETE", `/model-connections/${seg(provider)}`);
523
+ },
524
+ async clearDefault() {
525
+ const res = await http.request(
526
+ "DELETE",
527
+ "/model-connections/preferred-default"
528
+ );
529
+ return Boolean(res?.cleared);
513
530
  }
514
531
  };
515
532
  }
@@ -989,11 +1006,14 @@ function createRunsResource(http) {
989
1006
  wait(runId, options = {}) {
990
1007
  return waitForRun(pollDeps(options.user_id), runId, options);
991
1008
  },
992
- // `confirm` is a QUERY param and the route takes no body (verified against
993
- // fastapi/app/routers/v2/runs.py::retry_run), so send neither.
1009
+ // `confirm` / `use_credits` are QUERY params and the route takes no body
1010
+ // (verified against fastapi/app/routers/v2/runs.py::retry_run).
994
1011
  retry(runId, params = {}) {
995
1012
  return http.request("POST", `/runs/${seg(runId)}/retry`, {
996
- query: params.confirm ? toQuery({ confirm: true }) : ""
1013
+ query: toQuery({
1014
+ confirm: params.confirm ? true : void 0,
1015
+ use_credits: params.use_credits ? true : void 0
1016
+ })
997
1017
  });
998
1018
  },
999
1019
  stream(runId, options) {
@@ -1228,7 +1248,7 @@ function createWebhooksResource(http) {
1228
1248
  }
1229
1249
 
1230
1250
  // src/index.ts
1231
- var M8TES_SDK_VERSION = "0.1.0-alpha.3";
1251
+ var M8TES_SDK_VERSION = "0.1.0-alpha.5";
1232
1252
  var M8tes = class {
1233
1253
  runs;
1234
1254
  agents;