@m8tes/sdk 0.1.0-alpha.6 → 0.1.0-alpha.8

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
@@ -157,6 +157,12 @@ interface Agent {
157
157
  metadata: JsonObject | null;
158
158
  default_permission_mode: string;
159
159
  status: string;
160
+ /** Whether the caller may edit or configure this agent within their granted scope. */
161
+ can_manage: boolean;
162
+ /** Whether the caller may run this agent with its configured credentials. */
163
+ can_execute: boolean;
164
+ /** Whether the caller owns the Mate and may expose sharing controls. */
165
+ can_share: boolean;
160
166
  created_at: string;
161
167
  updated_at?: string | null;
162
168
  model?: string | null;
@@ -171,6 +177,8 @@ interface Agent {
171
177
  enable_task_setup_tools?: boolean | null;
172
178
  enable_feedback?: boolean | null;
173
179
  enable_self_improvement?: boolean | null;
180
+ group_id?: number | null;
181
+ group_name?: string | null;
174
182
  /** Most recent run activity in the last 90 days; null if idle longer. */
175
183
  last_active_at?: string | null;
176
184
  /** How many runs are executing or awaiting approval right now. */
@@ -344,6 +352,63 @@ interface EndUserUsage {
344
352
  period_end: string;
345
353
  rate_per_minute?: number | null;
346
354
  }
355
+ interface GroupPathItem {
356
+ id: number;
357
+ name: string;
358
+ }
359
+ type GroupMemberRole = "viewer" | "runner" | "editor";
360
+ /** A recursive Team folder. `path` contains visible ancestors from root to parent. */
361
+ interface Group {
362
+ id: number;
363
+ name: string;
364
+ visibility: string;
365
+ created_at: string;
366
+ display_order?: number | null;
367
+ user_id?: string | null;
368
+ updated_at?: string | null;
369
+ /** Null also represents a hidden ancestor, so callers only build from returned rows. */
370
+ parent_id: number | null;
371
+ path: GroupPathItem[];
372
+ can_manage: boolean;
373
+ can_leave: boolean;
374
+ }
375
+ interface GroupMember {
376
+ member_id: number;
377
+ name: string;
378
+ email: string;
379
+ role: GroupMemberRole;
380
+ inherited: boolean;
381
+ inherited_from_group_id: number | null;
382
+ inherited_from_group_name: string | null;
383
+ can_remove: boolean;
384
+ }
385
+ interface GroupInvite {
386
+ id: number;
387
+ email: string;
388
+ role: GroupMemberRole;
389
+ status: string;
390
+ created_at: string;
391
+ expires_at: string;
392
+ email_sent: boolean | null;
393
+ }
394
+ interface GroupInvitePreview {
395
+ group_name: string;
396
+ inviter_name: string;
397
+ email: string;
398
+ valid: boolean;
399
+ matches_current_user: boolean;
400
+ requires_verification: boolean;
401
+ role: GroupMemberRole;
402
+ }
403
+ interface GroupShareSkipped {
404
+ agent_id: number;
405
+ reason: string;
406
+ }
407
+ interface GroupShareResult {
408
+ visibility: string;
409
+ updated: number[];
410
+ skipped: GroupShareSkipped[];
411
+ }
347
412
  /**
348
413
  * One saved memory. `user_id` is the scope: your end-user's id, or `null` for an
349
414
  * account-level memory. `source` says who wrote it — `"api"` for ones you create
@@ -609,6 +674,8 @@ interface AgentCreateParams {
609
674
  goals?: string;
610
675
  /** Your id for the end-user who owns this agent. */
611
676
  user_id?: string;
677
+ /** Optional Team (`client.groups`) to place the agent in. */
678
+ group_id?: number;
612
679
  metadata?: JsonObject;
613
680
  model?: string;
614
681
  effort?: string;
@@ -647,6 +714,8 @@ interface AgentUpdateParams {
647
714
  default_permission_mode?: PermissionMode | null;
648
715
  /** Who can see this agent. Omit or null leaves it unchanged. */
649
716
  visibility?: "personal" | "organization" | null;
717
+ /** Move into a Team, `null` to ungroup, or omit to leave unchanged. */
718
+ group_id?: number | null;
650
719
  allowed_senders?: string[] | null;
651
720
  enable_memory?: boolean | null;
652
721
  enable_history?: boolean | null;
@@ -1033,6 +1102,71 @@ interface MemoriesResource {
1033
1102
  }
1034
1103
  declare function createMemoriesResource(http: Http): MemoriesResource;
1035
1104
 
1105
+ /**
1106
+ * `client.groups` — recursive Teams with inherited viewer, runner, and editor roles.
1107
+ *
1108
+ * Group CRUD keeps the API's optional `user_id` end-user isolation. Human membership and
1109
+ * invitation calls are account-scoped, so those methods deliberately do not accept `user_id`.
1110
+ * The legacy `share()` operation remains independent: it bulk-updates direct Mates' personal or
1111
+ * organization visibility and does not create a recursive Team grant.
1112
+ */
1113
+
1114
+ interface GroupCreateParams {
1115
+ name: string;
1116
+ user_id?: string;
1117
+ display_order?: number;
1118
+ parent_id?: number | null;
1119
+ }
1120
+ interface GroupUpdateParams {
1121
+ name?: string;
1122
+ display_order?: number | null;
1123
+ /** Move under another Team, `null` for the root, or omit to leave unchanged. */
1124
+ parent_id?: number | null;
1125
+ /** End-user isolation is sent in the query and is never part of the update body. */
1126
+ user_id?: string;
1127
+ }
1128
+ interface GroupsResource {
1129
+ create(params: GroupCreateParams): Promise<Group>;
1130
+ list(params?: {
1131
+ user_id?: string;
1132
+ }): Promise<Page<Group>>;
1133
+ get(groupId: number, params?: {
1134
+ user_id?: string;
1135
+ }): Promise<Group>;
1136
+ update(groupId: number, params: GroupUpdateParams): Promise<Group>;
1137
+ /** Recursively delete this Team and its children; Mates in the subtree become ungrouped. */
1138
+ delete(groupId: number, params?: {
1139
+ user_id?: string;
1140
+ }): Promise<void>;
1141
+ /** Legacy bulk direct-Mate visibility operation, independent of Team membership grants. */
1142
+ share(groupId: number, params: {
1143
+ visibility: "personal" | "organization";
1144
+ user_id?: string;
1145
+ }): Promise<GroupShareResult>;
1146
+ /** Managers-only account-scoped view of direct and inherited members. */
1147
+ members(groupId: number): Promise<Page<GroupMember>>;
1148
+ /** Alias for `members()`. */
1149
+ listMembers(groupId: number): Promise<Page<GroupMember>>;
1150
+ /** Change a direct grant's role. Managers only; account-scoped. */
1151
+ updateMember(groupId: number, memberId: number, params: {
1152
+ role: GroupMemberRole;
1153
+ }): Promise<GroupMember>;
1154
+ /** Remove a direct grant. Managers and the directly granted member may call this. */
1155
+ removeMember(groupId: number, memberId: number): Promise<void>;
1156
+ /** Managers-only account-scoped list of invitations. */
1157
+ invites(groupId: number): Promise<Page<GroupInvite>>;
1158
+ /** Alias for `invites()`. */
1159
+ listInvites(groupId: number): Promise<Page<GroupInvite>>;
1160
+ invite(groupId: number, params: {
1161
+ email: string;
1162
+ role?: GroupMemberRole;
1163
+ }): Promise<GroupInvite>;
1164
+ cancelInvite(inviteId: number): Promise<void>;
1165
+ previewInvite(token: string): Promise<GroupInvitePreview>;
1166
+ acceptInvite(token: string): Promise<Group>;
1167
+ }
1168
+ declare function createGroupsResource(http: Http): GroupsResource;
1169
+
1036
1170
  /**
1037
1171
  * `client.models` — find out which `model` values are actually valid, and what
1038
1172
  * they cost, instead of guessing from the docs.
@@ -1364,6 +1498,44 @@ declare class RunStream implements AsyncIterable<M8tesStreamEvent> {
1364
1498
  * request. Mirrors `sdk/py/m8tes/_resources/runs.py`, field for field.
1365
1499
  */
1366
1500
 
1501
+ /**
1502
+ * Per-reply overrides accepted by `POST /runs/{id}/reply`.
1503
+ *
1504
+ * These mirror the server's `RunReply` model. Every field is optional; omit one
1505
+ * to inherit whatever the run last ran with. (The Python SDK also takes `files`;
1506
+ * TypeScript has no attachment path on reply yet.)
1507
+ *
1508
+ * SETTING ANY OF THESE CHANGES HOW A MID-TURN REPLY BEHAVES. A reply to a run
1509
+ * whose current turn is still executing is normally QUEUED and delivered as the
1510
+ * next turn. The server refuses to queue overrides — it cannot apply them to a
1511
+ * turn already running under the run's persisted settings — so a reply carrying
1512
+ * any field below fails with 409 instead. Send the message bare, or retry once
1513
+ * the turn ends.
1514
+ */
1515
+ interface RunReplyOptions extends RunStreamOptions {
1516
+ /**
1517
+ * Override this reply's app toolset (names from `client.apps.list()`).
1518
+ * A changed set persists to the run, so later replies inherit it.
1519
+ * `[]` means "inherit the run's current set", NOT "no tools".
1520
+ */
1521
+ tools?: string[];
1522
+ /** Execution-mode override for this and later replies. Omit to inherit the run's mode. */
1523
+ permission_mode?: PermissionMode;
1524
+ /** Override whether the internal same-scope management tools are enabled for this reply. */
1525
+ task_setup_tools?: boolean;
1526
+ /** Override whether the internal issue-reporting feedback tool is enabled for this reply. */
1527
+ feedback?: boolean;
1528
+ /**
1529
+ * Override whether the agent may ask questions (AskUserQuestion) during this reply.
1530
+ * Pass `false` to pin non-interactive behavior, so an unattended reply loop on a
1531
+ * run created with `human_in_the_loop: true` cannot pause on a question.
1532
+ *
1533
+ * Note the 409 above: `false` is still an override, so a loop that sets it on
1534
+ * every reply will fail whenever it catches the run mid-turn. Set it on the
1535
+ * replies that start a turn, not blindly on all of them.
1536
+ */
1537
+ human_in_the_loop?: boolean;
1538
+ }
1367
1539
  interface RunCreateParams {
1368
1540
  /** What the agent should do. */
1369
1541
  message: string;
@@ -1520,7 +1692,7 @@ interface RunsResource {
1520
1692
  stream(runId: number, options?: RunStreamOptions): RunStream;
1521
1693
  /** Continue the same run, streaming only this follow-up. After a provider failure,
1522
1694
  * the reply follows the account's current connected/preferred provider. */
1523
- reply(runId: number, message: string, options?: RunStreamOptions): RunStream;
1695
+ reply(runId: number, message: string, options?: RunReplyOptions): RunStream;
1524
1696
  /** GET /runs/{id}. Pass `user_id` to scope to one end-user (required when the
1525
1697
  * account has strict multi-tenant mode on). */
1526
1698
  get(runId: number, params?: {
@@ -1846,7 +2018,7 @@ interface WebhooksResource {
1846
2018
  */
1847
2019
 
1848
2020
  /** Kept in lockstep with package.json "version" — guarded by test/version.test.ts. */
1849
- declare const M8TES_SDK_VERSION = "0.1.0-alpha.6";
2021
+ declare const M8TES_SDK_VERSION = "0.1.0-alpha.8";
1850
2022
  declare class M8tes {
1851
2023
  readonly runs: RunsResource;
1852
2024
  readonly agents: AgentsResource;
@@ -1858,6 +2030,7 @@ declare class M8tes {
1858
2030
  readonly webhooks: WebhooksResource;
1859
2031
  readonly settings: SettingsResource;
1860
2032
  readonly memories: MemoriesResource;
2033
+ readonly groups: GroupsResource;
1861
2034
  readonly permissions: PermissionsResource;
1862
2035
  readonly models: ModelsResource;
1863
2036
  readonly modelConnections: ModelConnectionsResource;
@@ -1868,4 +2041,4 @@ declare class M8tes {
1868
2041
  constructor(options?: ClientOptions);
1869
2042
  }
1870
2043
 
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 };
2044
+ 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 Group, type GroupCreateParams, type GroupInvite, type GroupInvitePreview, type GroupMember, type GroupMemberRole, type GroupPathItem, type GroupShareResult, type GroupShareSkipped, type GroupUpdateParams, type GroupsResource, 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, type RunReplyOptions, 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, createGroupsResource, createHttp, createMemoriesResource, createModelConnectionsResource, createModelsResource, createPermissionsResource, isPlanApproval, planText, pollRun, verifySignature, waitForRun };
package/dist/index.d.ts CHANGED
@@ -157,6 +157,12 @@ interface Agent {
157
157
  metadata: JsonObject | null;
158
158
  default_permission_mode: string;
159
159
  status: string;
160
+ /** Whether the caller may edit or configure this agent within their granted scope. */
161
+ can_manage: boolean;
162
+ /** Whether the caller may run this agent with its configured credentials. */
163
+ can_execute: boolean;
164
+ /** Whether the caller owns the Mate and may expose sharing controls. */
165
+ can_share: boolean;
160
166
  created_at: string;
161
167
  updated_at?: string | null;
162
168
  model?: string | null;
@@ -171,6 +177,8 @@ interface Agent {
171
177
  enable_task_setup_tools?: boolean | null;
172
178
  enable_feedback?: boolean | null;
173
179
  enable_self_improvement?: boolean | null;
180
+ group_id?: number | null;
181
+ group_name?: string | null;
174
182
  /** Most recent run activity in the last 90 days; null if idle longer. */
175
183
  last_active_at?: string | null;
176
184
  /** How many runs are executing or awaiting approval right now. */
@@ -344,6 +352,63 @@ interface EndUserUsage {
344
352
  period_end: string;
345
353
  rate_per_minute?: number | null;
346
354
  }
355
+ interface GroupPathItem {
356
+ id: number;
357
+ name: string;
358
+ }
359
+ type GroupMemberRole = "viewer" | "runner" | "editor";
360
+ /** A recursive Team folder. `path` contains visible ancestors from root to parent. */
361
+ interface Group {
362
+ id: number;
363
+ name: string;
364
+ visibility: string;
365
+ created_at: string;
366
+ display_order?: number | null;
367
+ user_id?: string | null;
368
+ updated_at?: string | null;
369
+ /** Null also represents a hidden ancestor, so callers only build from returned rows. */
370
+ parent_id: number | null;
371
+ path: GroupPathItem[];
372
+ can_manage: boolean;
373
+ can_leave: boolean;
374
+ }
375
+ interface GroupMember {
376
+ member_id: number;
377
+ name: string;
378
+ email: string;
379
+ role: GroupMemberRole;
380
+ inherited: boolean;
381
+ inherited_from_group_id: number | null;
382
+ inherited_from_group_name: string | null;
383
+ can_remove: boolean;
384
+ }
385
+ interface GroupInvite {
386
+ id: number;
387
+ email: string;
388
+ role: GroupMemberRole;
389
+ status: string;
390
+ created_at: string;
391
+ expires_at: string;
392
+ email_sent: boolean | null;
393
+ }
394
+ interface GroupInvitePreview {
395
+ group_name: string;
396
+ inviter_name: string;
397
+ email: string;
398
+ valid: boolean;
399
+ matches_current_user: boolean;
400
+ requires_verification: boolean;
401
+ role: GroupMemberRole;
402
+ }
403
+ interface GroupShareSkipped {
404
+ agent_id: number;
405
+ reason: string;
406
+ }
407
+ interface GroupShareResult {
408
+ visibility: string;
409
+ updated: number[];
410
+ skipped: GroupShareSkipped[];
411
+ }
347
412
  /**
348
413
  * One saved memory. `user_id` is the scope: your end-user's id, or `null` for an
349
414
  * account-level memory. `source` says who wrote it — `"api"` for ones you create
@@ -609,6 +674,8 @@ interface AgentCreateParams {
609
674
  goals?: string;
610
675
  /** Your id for the end-user who owns this agent. */
611
676
  user_id?: string;
677
+ /** Optional Team (`client.groups`) to place the agent in. */
678
+ group_id?: number;
612
679
  metadata?: JsonObject;
613
680
  model?: string;
614
681
  effort?: string;
@@ -647,6 +714,8 @@ interface AgentUpdateParams {
647
714
  default_permission_mode?: PermissionMode | null;
648
715
  /** Who can see this agent. Omit or null leaves it unchanged. */
649
716
  visibility?: "personal" | "organization" | null;
717
+ /** Move into a Team, `null` to ungroup, or omit to leave unchanged. */
718
+ group_id?: number | null;
650
719
  allowed_senders?: string[] | null;
651
720
  enable_memory?: boolean | null;
652
721
  enable_history?: boolean | null;
@@ -1033,6 +1102,71 @@ interface MemoriesResource {
1033
1102
  }
1034
1103
  declare function createMemoriesResource(http: Http): MemoriesResource;
1035
1104
 
1105
+ /**
1106
+ * `client.groups` — recursive Teams with inherited viewer, runner, and editor roles.
1107
+ *
1108
+ * Group CRUD keeps the API's optional `user_id` end-user isolation. Human membership and
1109
+ * invitation calls are account-scoped, so those methods deliberately do not accept `user_id`.
1110
+ * The legacy `share()` operation remains independent: it bulk-updates direct Mates' personal or
1111
+ * organization visibility and does not create a recursive Team grant.
1112
+ */
1113
+
1114
+ interface GroupCreateParams {
1115
+ name: string;
1116
+ user_id?: string;
1117
+ display_order?: number;
1118
+ parent_id?: number | null;
1119
+ }
1120
+ interface GroupUpdateParams {
1121
+ name?: string;
1122
+ display_order?: number | null;
1123
+ /** Move under another Team, `null` for the root, or omit to leave unchanged. */
1124
+ parent_id?: number | null;
1125
+ /** End-user isolation is sent in the query and is never part of the update body. */
1126
+ user_id?: string;
1127
+ }
1128
+ interface GroupsResource {
1129
+ create(params: GroupCreateParams): Promise<Group>;
1130
+ list(params?: {
1131
+ user_id?: string;
1132
+ }): Promise<Page<Group>>;
1133
+ get(groupId: number, params?: {
1134
+ user_id?: string;
1135
+ }): Promise<Group>;
1136
+ update(groupId: number, params: GroupUpdateParams): Promise<Group>;
1137
+ /** Recursively delete this Team and its children; Mates in the subtree become ungrouped. */
1138
+ delete(groupId: number, params?: {
1139
+ user_id?: string;
1140
+ }): Promise<void>;
1141
+ /** Legacy bulk direct-Mate visibility operation, independent of Team membership grants. */
1142
+ share(groupId: number, params: {
1143
+ visibility: "personal" | "organization";
1144
+ user_id?: string;
1145
+ }): Promise<GroupShareResult>;
1146
+ /** Managers-only account-scoped view of direct and inherited members. */
1147
+ members(groupId: number): Promise<Page<GroupMember>>;
1148
+ /** Alias for `members()`. */
1149
+ listMembers(groupId: number): Promise<Page<GroupMember>>;
1150
+ /** Change a direct grant's role. Managers only; account-scoped. */
1151
+ updateMember(groupId: number, memberId: number, params: {
1152
+ role: GroupMemberRole;
1153
+ }): Promise<GroupMember>;
1154
+ /** Remove a direct grant. Managers and the directly granted member may call this. */
1155
+ removeMember(groupId: number, memberId: number): Promise<void>;
1156
+ /** Managers-only account-scoped list of invitations. */
1157
+ invites(groupId: number): Promise<Page<GroupInvite>>;
1158
+ /** Alias for `invites()`. */
1159
+ listInvites(groupId: number): Promise<Page<GroupInvite>>;
1160
+ invite(groupId: number, params: {
1161
+ email: string;
1162
+ role?: GroupMemberRole;
1163
+ }): Promise<GroupInvite>;
1164
+ cancelInvite(inviteId: number): Promise<void>;
1165
+ previewInvite(token: string): Promise<GroupInvitePreview>;
1166
+ acceptInvite(token: string): Promise<Group>;
1167
+ }
1168
+ declare function createGroupsResource(http: Http): GroupsResource;
1169
+
1036
1170
  /**
1037
1171
  * `client.models` — find out which `model` values are actually valid, and what
1038
1172
  * they cost, instead of guessing from the docs.
@@ -1364,6 +1498,44 @@ declare class RunStream implements AsyncIterable<M8tesStreamEvent> {
1364
1498
  * request. Mirrors `sdk/py/m8tes/_resources/runs.py`, field for field.
1365
1499
  */
1366
1500
 
1501
+ /**
1502
+ * Per-reply overrides accepted by `POST /runs/{id}/reply`.
1503
+ *
1504
+ * These mirror the server's `RunReply` model. Every field is optional; omit one
1505
+ * to inherit whatever the run last ran with. (The Python SDK also takes `files`;
1506
+ * TypeScript has no attachment path on reply yet.)
1507
+ *
1508
+ * SETTING ANY OF THESE CHANGES HOW A MID-TURN REPLY BEHAVES. A reply to a run
1509
+ * whose current turn is still executing is normally QUEUED and delivered as the
1510
+ * next turn. The server refuses to queue overrides — it cannot apply them to a
1511
+ * turn already running under the run's persisted settings — so a reply carrying
1512
+ * any field below fails with 409 instead. Send the message bare, or retry once
1513
+ * the turn ends.
1514
+ */
1515
+ interface RunReplyOptions extends RunStreamOptions {
1516
+ /**
1517
+ * Override this reply's app toolset (names from `client.apps.list()`).
1518
+ * A changed set persists to the run, so later replies inherit it.
1519
+ * `[]` means "inherit the run's current set", NOT "no tools".
1520
+ */
1521
+ tools?: string[];
1522
+ /** Execution-mode override for this and later replies. Omit to inherit the run's mode. */
1523
+ permission_mode?: PermissionMode;
1524
+ /** Override whether the internal same-scope management tools are enabled for this reply. */
1525
+ task_setup_tools?: boolean;
1526
+ /** Override whether the internal issue-reporting feedback tool is enabled for this reply. */
1527
+ feedback?: boolean;
1528
+ /**
1529
+ * Override whether the agent may ask questions (AskUserQuestion) during this reply.
1530
+ * Pass `false` to pin non-interactive behavior, so an unattended reply loop on a
1531
+ * run created with `human_in_the_loop: true` cannot pause on a question.
1532
+ *
1533
+ * Note the 409 above: `false` is still an override, so a loop that sets it on
1534
+ * every reply will fail whenever it catches the run mid-turn. Set it on the
1535
+ * replies that start a turn, not blindly on all of them.
1536
+ */
1537
+ human_in_the_loop?: boolean;
1538
+ }
1367
1539
  interface RunCreateParams {
1368
1540
  /** What the agent should do. */
1369
1541
  message: string;
@@ -1520,7 +1692,7 @@ interface RunsResource {
1520
1692
  stream(runId: number, options?: RunStreamOptions): RunStream;
1521
1693
  /** Continue the same run, streaming only this follow-up. After a provider failure,
1522
1694
  * the reply follows the account's current connected/preferred provider. */
1523
- reply(runId: number, message: string, options?: RunStreamOptions): RunStream;
1695
+ reply(runId: number, message: string, options?: RunReplyOptions): RunStream;
1524
1696
  /** GET /runs/{id}. Pass `user_id` to scope to one end-user (required when the
1525
1697
  * account has strict multi-tenant mode on). */
1526
1698
  get(runId: number, params?: {
@@ -1846,7 +2018,7 @@ interface WebhooksResource {
1846
2018
  */
1847
2019
 
1848
2020
  /** Kept in lockstep with package.json "version" — guarded by test/version.test.ts. */
1849
- declare const M8TES_SDK_VERSION = "0.1.0-alpha.6";
2021
+ declare const M8TES_SDK_VERSION = "0.1.0-alpha.8";
1850
2022
  declare class M8tes {
1851
2023
  readonly runs: RunsResource;
1852
2024
  readonly agents: AgentsResource;
@@ -1858,6 +2030,7 @@ declare class M8tes {
1858
2030
  readonly webhooks: WebhooksResource;
1859
2031
  readonly settings: SettingsResource;
1860
2032
  readonly memories: MemoriesResource;
2033
+ readonly groups: GroupsResource;
1861
2034
  readonly permissions: PermissionsResource;
1862
2035
  readonly models: ModelsResource;
1863
2036
  readonly modelConnections: ModelConnectionsResource;
@@ -1868,4 +2041,4 @@ declare class M8tes {
1868
2041
  constructor(options?: ClientOptions);
1869
2042
  }
1870
2043
 
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 };
2044
+ 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 Group, type GroupCreateParams, type GroupInvite, type GroupInvitePreview, type GroupMember, type GroupMemberRole, type GroupPathItem, type GroupShareResult, type GroupShareSkipped, type GroupUpdateParams, type GroupsResource, 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, type RunReplyOptions, 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, createGroupsResource, 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-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';
1
+ import { createNormalizer, createSseDecoder, initialConversationState, accumulate, RunFailedError, APIError, parseRetryAfter, ConflictError, NotFoundError, AuthenticationError, PermissionDeniedError, ValidationError, seg, parseErrorEnvelope, errorClassForStatus } from './chunk-5X7I2XPE.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-5X7I2XPE.js';
3
3
  import { createHmac, timingSafeEqual } from 'crypto';
4
4
 
5
5
  // src/http.ts
@@ -157,7 +157,9 @@ function createHttp(options = {}) {
157
157
  return send(method, path, opts);
158
158
  },
159
159
  async *stream(method, path, opts = {}) {
160
- const res = await send(method, path, opts, { conflictIsNotStreaming: true });
160
+ const res = await send(method, path, opts, {
161
+ conflictIsNotStreaming: method === "GET"
162
+ });
161
163
  if (opts.onReplay && res.headers.get(REPLAY_HEADER)) {
162
164
  const run = await res.json();
163
165
  yield* opts.onReplay(run);
@@ -214,19 +216,19 @@ var Page = class {
214
216
  * it did see rather than a hung process.
215
217
  */
216
218
  async *[Symbol.asyncIterator]() {
217
- let page = this;
219
+ let page2 = this;
218
220
  const seen = /* @__PURE__ */ new Set();
219
221
  for (; ; ) {
220
- yield* page.data;
221
- const last = page.data.at(-1);
222
- if (!page.hasMore || !last || !page.fetchNext) return;
223
- let cursor = page.nextStartingAfter === null || page.nextStartingAfter === void 0 ? void 0 : page.nextStartingAfter;
222
+ yield* page2.data;
223
+ const last = page2.data.at(-1);
224
+ if (!page2.hasMore || !last || !page2.fetchNext) return;
225
+ let cursor = page2.nextStartingAfter === null || page2.nextStartingAfter === void 0 ? void 0 : page2.nextStartingAfter;
224
226
  if (cursor === void 0) {
225
227
  cursor = typeof last.id === "number" || typeof last.id === "string" ? last.id : typeof last.name === "string" ? last.name : void 0;
226
228
  }
227
229
  if (cursor === void 0 || seen.has(cursor)) return;
228
230
  seen.add(cursor);
229
- page = await page.fetchNext(cursor);
231
+ page2 = await page2.fetchNext(cursor);
230
232
  }
231
233
  }
232
234
  /** Every item across every page, collected. Prefer iteration for large sets. */
@@ -509,6 +511,69 @@ function createMemoriesResource(http) {
509
511
  };
510
512
  }
511
513
 
514
+ // src/resources/groups.ts
515
+ var page = (res) => new Page(res.data ?? [], res.has_more ?? false, void 0, res.next_starting_after);
516
+ function createGroupsResource(http) {
517
+ const members = async (groupId) => page(await http.request("GET", `/groups/${seg(groupId)}/members`));
518
+ const invites = async (groupId) => page(await http.request("GET", `/groups/${seg(groupId)}/invites`));
519
+ return {
520
+ create(params) {
521
+ return http.request("POST", "/groups", { body: toBody({ ...params }) });
522
+ },
523
+ async list(params = {}) {
524
+ return page(await http.request("GET", "/groups", { query: toQuery(params) }));
525
+ },
526
+ get(groupId, params = {}) {
527
+ return http.request("GET", `/groups/${seg(groupId)}`, { query: toQuery(params) });
528
+ },
529
+ update(groupId, params) {
530
+ const { user_id, ...body } = params;
531
+ return http.request("PATCH", `/groups/${seg(groupId)}`, {
532
+ query: toQuery({ user_id }),
533
+ body: toBody(body)
534
+ });
535
+ },
536
+ async delete(groupId, params = {}) {
537
+ await http.request("DELETE", `/groups/${seg(groupId)}`, { query: toQuery(params) });
538
+ },
539
+ share(groupId, params) {
540
+ const { user_id, ...body } = params;
541
+ return http.request("POST", `/groups/${seg(groupId)}/share`, {
542
+ query: toQuery({ user_id }),
543
+ body: toBody(body)
544
+ });
545
+ },
546
+ members,
547
+ listMembers: members,
548
+ updateMember(groupId, memberId, params) {
549
+ return http.request(
550
+ "PATCH",
551
+ `/groups/${seg(groupId)}/members/${seg(memberId)}`,
552
+ { body: toBody(params) }
553
+ );
554
+ },
555
+ async removeMember(groupId, memberId) {
556
+ await http.request("DELETE", `/groups/${seg(groupId)}/members/${seg(memberId)}`);
557
+ },
558
+ invites,
559
+ listInvites: invites,
560
+ invite(groupId, params) {
561
+ return http.request("POST", `/groups/${seg(groupId)}/invites`, {
562
+ body: toBody({ role: "editor", ...params })
563
+ });
564
+ },
565
+ async cancelInvite(inviteId) {
566
+ await http.request("DELETE", `/groups/invites/${seg(inviteId)}`);
567
+ },
568
+ previewInvite(token) {
569
+ return http.request("GET", `/groups/invites/${seg(token)}`);
570
+ },
571
+ acceptInvite(token) {
572
+ return http.request("POST", "/groups/invites/accept", { body: { token } });
573
+ }
574
+ };
575
+ }
576
+
512
577
  // src/resources/models.ts
513
578
  function createModelsResource(http) {
514
579
  return {
@@ -949,6 +1014,10 @@ function withRunId(err, runId) {
949
1014
  }
950
1015
  return err;
951
1016
  }
1017
+ function replyBody(message, options) {
1018
+ const { raiseOnError: _raiseOnError, idempotencyKey: _idempotencyKey, ...overrides } = options ?? {};
1019
+ return toBody({ ...overrides, message, stream: true });
1020
+ }
952
1021
  function items(payload) {
953
1022
  return Array.isArray(payload) ? payload : payload?.data ?? [];
954
1023
  }
@@ -1052,7 +1121,7 @@ function createRunsResource(http) {
1052
1121
  reply(runId, message, options) {
1053
1122
  return new RunStream(
1054
1123
  http.stream("POST", `/runs/${seg(runId)}/reply`, {
1055
- body: { message },
1124
+ body: replyBody(message, options),
1056
1125
  headers: idempotencyHeaders(options?.idempotencyKey),
1057
1126
  onReplay: replayJoin(http)
1058
1127
  }),
@@ -1291,7 +1360,7 @@ function createWebhooksResource(http) {
1291
1360
  }
1292
1361
 
1293
1362
  // src/index.ts
1294
- var M8TES_SDK_VERSION = "0.1.0-alpha.6";
1363
+ var M8TES_SDK_VERSION = "0.1.0-alpha.8";
1295
1364
  var M8tes = class {
1296
1365
  runs;
1297
1366
  agents;
@@ -1303,6 +1372,7 @@ var M8tes = class {
1303
1372
  webhooks;
1304
1373
  settings;
1305
1374
  memories;
1375
+ groups;
1306
1376
  permissions;
1307
1377
  models;
1308
1378
  modelConnections;
@@ -1321,6 +1391,7 @@ var M8tes = class {
1321
1391
  this.webhooks = createWebhooksResource(this.http);
1322
1392
  this.settings = createSettingsResource(this.http);
1323
1393
  this.memories = createMemoriesResource(this.http);
1394
+ this.groups = createGroupsResource(this.http);
1324
1395
  this.permissions = createPermissionsResource(this.http);
1325
1396
  this.models = createModelsResource(this.http);
1326
1397
  this.modelConnections = createModelConnectionsResource(this.http);