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

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
@@ -1364,6 +1364,44 @@ declare class RunStream implements AsyncIterable<M8tesStreamEvent> {
1364
1364
  * request. Mirrors `sdk/py/m8tes/_resources/runs.py`, field for field.
1365
1365
  */
1366
1366
 
1367
+ /**
1368
+ * Per-reply overrides accepted by `POST /runs/{id}/reply`.
1369
+ *
1370
+ * These mirror the server's `RunReply` model. Every field is optional; omit one
1371
+ * to inherit whatever the run last ran with. (The Python SDK also takes `files`;
1372
+ * TypeScript has no attachment path on reply yet.)
1373
+ *
1374
+ * SETTING ANY OF THESE CHANGES HOW A MID-TURN REPLY BEHAVES. A reply to a run
1375
+ * whose current turn is still executing is normally QUEUED and delivered as the
1376
+ * next turn. The server refuses to queue overrides — it cannot apply them to a
1377
+ * turn already running under the run's persisted settings — so a reply carrying
1378
+ * any field below fails with 409 instead. Send the message bare, or retry once
1379
+ * the turn ends.
1380
+ */
1381
+ interface RunReplyOptions extends RunStreamOptions {
1382
+ /**
1383
+ * Override this reply's app toolset (names from `client.apps.list()`).
1384
+ * A changed set persists to the run, so later replies inherit it.
1385
+ * `[]` means "inherit the run's current set", NOT "no tools".
1386
+ */
1387
+ tools?: string[];
1388
+ /** Execution-mode override for this and later replies. Omit to inherit the run's mode. */
1389
+ permission_mode?: PermissionMode;
1390
+ /** Override whether the internal same-scope management tools are enabled for this reply. */
1391
+ task_setup_tools?: boolean;
1392
+ /** Override whether the internal issue-reporting feedback tool is enabled for this reply. */
1393
+ feedback?: boolean;
1394
+ /**
1395
+ * Override whether the agent may ask questions (AskUserQuestion) during this reply.
1396
+ * Pass `false` to pin non-interactive behavior, so an unattended reply loop on a
1397
+ * run created with `human_in_the_loop: true` cannot pause on a question.
1398
+ *
1399
+ * Note the 409 above: `false` is still an override, so a loop that sets it on
1400
+ * every reply will fail whenever it catches the run mid-turn. Set it on the
1401
+ * replies that start a turn, not blindly on all of them.
1402
+ */
1403
+ human_in_the_loop?: boolean;
1404
+ }
1367
1405
  interface RunCreateParams {
1368
1406
  /** What the agent should do. */
1369
1407
  message: string;
@@ -1520,7 +1558,7 @@ interface RunsResource {
1520
1558
  stream(runId: number, options?: RunStreamOptions): RunStream;
1521
1559
  /** Continue the same run, streaming only this follow-up. After a provider failure,
1522
1560
  * the reply follows the account's current connected/preferred provider. */
1523
- reply(runId: number, message: string, options?: RunStreamOptions): RunStream;
1561
+ reply(runId: number, message: string, options?: RunReplyOptions): RunStream;
1524
1562
  /** GET /runs/{id}. Pass `user_id` to scope to one end-user (required when the
1525
1563
  * account has strict multi-tenant mode on). */
1526
1564
  get(runId: number, params?: {
@@ -1846,7 +1884,7 @@ interface WebhooksResource {
1846
1884
  */
1847
1885
 
1848
1886
  /** Kept in lockstep with package.json "version" — guarded by test/version.test.ts. */
1849
- declare const M8TES_SDK_VERSION = "0.1.0-alpha.6";
1887
+ declare const M8TES_SDK_VERSION = "0.1.0-alpha.7";
1850
1888
  declare class M8tes {
1851
1889
  readonly runs: RunsResource;
1852
1890
  readonly agents: AgentsResource;
@@ -1868,4 +1906,4 @@ declare class M8tes {
1868
1906
  constructor(options?: ClientOptions);
1869
1907
  }
1870
1908
 
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 };
1909
+ 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, 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, createHttp, createMemoriesResource, createModelConnectionsResource, createModelsResource, createPermissionsResource, isPlanApproval, planText, pollRun, verifySignature, waitForRun };
package/dist/index.d.ts CHANGED
@@ -1364,6 +1364,44 @@ declare class RunStream implements AsyncIterable<M8tesStreamEvent> {
1364
1364
  * request. Mirrors `sdk/py/m8tes/_resources/runs.py`, field for field.
1365
1365
  */
1366
1366
 
1367
+ /**
1368
+ * Per-reply overrides accepted by `POST /runs/{id}/reply`.
1369
+ *
1370
+ * These mirror the server's `RunReply` model. Every field is optional; omit one
1371
+ * to inherit whatever the run last ran with. (The Python SDK also takes `files`;
1372
+ * TypeScript has no attachment path on reply yet.)
1373
+ *
1374
+ * SETTING ANY OF THESE CHANGES HOW A MID-TURN REPLY BEHAVES. A reply to a run
1375
+ * whose current turn is still executing is normally QUEUED and delivered as the
1376
+ * next turn. The server refuses to queue overrides — it cannot apply them to a
1377
+ * turn already running under the run's persisted settings — so a reply carrying
1378
+ * any field below fails with 409 instead. Send the message bare, or retry once
1379
+ * the turn ends.
1380
+ */
1381
+ interface RunReplyOptions extends RunStreamOptions {
1382
+ /**
1383
+ * Override this reply's app toolset (names from `client.apps.list()`).
1384
+ * A changed set persists to the run, so later replies inherit it.
1385
+ * `[]` means "inherit the run's current set", NOT "no tools".
1386
+ */
1387
+ tools?: string[];
1388
+ /** Execution-mode override for this and later replies. Omit to inherit the run's mode. */
1389
+ permission_mode?: PermissionMode;
1390
+ /** Override whether the internal same-scope management tools are enabled for this reply. */
1391
+ task_setup_tools?: boolean;
1392
+ /** Override whether the internal issue-reporting feedback tool is enabled for this reply. */
1393
+ feedback?: boolean;
1394
+ /**
1395
+ * Override whether the agent may ask questions (AskUserQuestion) during this reply.
1396
+ * Pass `false` to pin non-interactive behavior, so an unattended reply loop on a
1397
+ * run created with `human_in_the_loop: true` cannot pause on a question.
1398
+ *
1399
+ * Note the 409 above: `false` is still an override, so a loop that sets it on
1400
+ * every reply will fail whenever it catches the run mid-turn. Set it on the
1401
+ * replies that start a turn, not blindly on all of them.
1402
+ */
1403
+ human_in_the_loop?: boolean;
1404
+ }
1367
1405
  interface RunCreateParams {
1368
1406
  /** What the agent should do. */
1369
1407
  message: string;
@@ -1520,7 +1558,7 @@ interface RunsResource {
1520
1558
  stream(runId: number, options?: RunStreamOptions): RunStream;
1521
1559
  /** Continue the same run, streaming only this follow-up. After a provider failure,
1522
1560
  * the reply follows the account's current connected/preferred provider. */
1523
- reply(runId: number, message: string, options?: RunStreamOptions): RunStream;
1561
+ reply(runId: number, message: string, options?: RunReplyOptions): RunStream;
1524
1562
  /** GET /runs/{id}. Pass `user_id` to scope to one end-user (required when the
1525
1563
  * account has strict multi-tenant mode on). */
1526
1564
  get(runId: number, params?: {
@@ -1846,7 +1884,7 @@ interface WebhooksResource {
1846
1884
  */
1847
1885
 
1848
1886
  /** Kept in lockstep with package.json "version" — guarded by test/version.test.ts. */
1849
- declare const M8TES_SDK_VERSION = "0.1.0-alpha.6";
1887
+ declare const M8TES_SDK_VERSION = "0.1.0-alpha.7";
1850
1888
  declare class M8tes {
1851
1889
  readonly runs: RunsResource;
1852
1890
  readonly agents: AgentsResource;
@@ -1868,4 +1906,4 @@ declare class M8tes {
1868
1906
  constructor(options?: ClientOptions);
1869
1907
  }
1870
1908
 
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 };
1909
+ 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, 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, 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);
@@ -949,6 +951,10 @@ function withRunId(err, runId) {
949
951
  }
950
952
  return err;
951
953
  }
954
+ function replyBody(message, options) {
955
+ const { raiseOnError: _raiseOnError, idempotencyKey: _idempotencyKey, ...overrides } = options ?? {};
956
+ return toBody({ ...overrides, message, stream: true });
957
+ }
952
958
  function items(payload) {
953
959
  return Array.isArray(payload) ? payload : payload?.data ?? [];
954
960
  }
@@ -1052,7 +1058,7 @@ function createRunsResource(http) {
1052
1058
  reply(runId, message, options) {
1053
1059
  return new RunStream(
1054
1060
  http.stream("POST", `/runs/${seg(runId)}/reply`, {
1055
- body: { message },
1061
+ body: replyBody(message, options),
1056
1062
  headers: idempotencyHeaders(options?.idempotencyKey),
1057
1063
  onReplay: replayJoin(http)
1058
1064
  }),
@@ -1291,7 +1297,7 @@ function createWebhooksResource(http) {
1291
1297
  }
1292
1298
 
1293
1299
  // src/index.ts
1294
- var M8TES_SDK_VERSION = "0.1.0-alpha.6";
1300
+ var M8TES_SDK_VERSION = "0.1.0-alpha.7";
1295
1301
  var M8tes = class {
1296
1302
  runs;
1297
1303
  agents;