@mitralab.io/sdk-core 0.2.12 → 0.3.0-beta.2

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
@@ -589,6 +589,13 @@ interface AppUpdateInput {
589
589
  icon?: string;
590
590
  /** Whether users may sign up through this app. Omission preserves the current value. */
591
591
  allowSignup?: boolean;
592
+ /** Whether users may sign in with a code sent by email. Omission preserves the current value. */
593
+ emailLoginEnabled?: boolean;
594
+ /**
595
+ * Whether users may sign in with a password. Omission preserves the current value. Code Studio
596
+ * rejects `true` while the app inherits the platform login.
597
+ */
598
+ passwordLoginEnabled?: boolean;
592
599
  }
593
600
  interface AppDomain {
594
601
  hostname: string;
@@ -610,6 +617,10 @@ interface AppSummary {
610
617
  template: string | null;
611
618
  planId: string;
612
619
  allowSignup: boolean;
620
+ /** Absent on a Code Studio that predates email login. */
621
+ emailLoginEnabled?: boolean;
622
+ /** Absent on a Code Studio that predates password login. */
623
+ passwordLoginEnabled?: boolean;
613
624
  externalAccessEnabled: boolean;
614
625
  currentVersion: AppVersion | null;
615
626
  createdAt: string;
@@ -630,6 +641,10 @@ interface AppDefinition {
630
641
  planId: string;
631
642
  template: string | null;
632
643
  allowSignup: boolean;
644
+ /** Absent on a Code Studio that predates email login. */
645
+ emailLoginEnabled?: boolean;
646
+ /** Absent on a Code Studio that predates password login. */
647
+ passwordLoginEnabled?: boolean;
633
648
  externalAccessEnabled: boolean;
634
649
  currentVersion: AppVersion | null;
635
650
  createdAt: string;
@@ -1074,11 +1089,31 @@ type AgentTaskInput = {
1074
1089
  content: string;
1075
1090
  agentType?: string;
1076
1091
  reasoningEffort?: string;
1092
+ /**
1093
+ * `steer` takes the message into the running turn; a box given none puts it in T3's queue.
1094
+ * The session always sends `steer`. The Copilot does not take the field.
1095
+ */
1096
+ mode?: "steer";
1077
1097
  } | {
1078
1098
  type: "interrupt";
1079
1099
  } | {
1080
1100
  type: "approval_response";
1081
1101
  approved: boolean;
1102
+ }
1103
+ /**
1104
+ * The answer to a `user_input_request` the box forwards from T3 mid-turn (a `raw` event whose
1105
+ * payload is T3's item). Same shape as T3's own command; only the box's direct channel takes it.
1106
+ */
1107
+ | {
1108
+ type: "runtime-request.respond";
1109
+ requestId: string;
1110
+ answers: Record<string, unknown>;
1111
+ attachmentsByQuestionId?: Record<string, unknown>;
1112
+ }
1113
+ /** Stops one subagent, as T3's own `subagent.stop`; only the box channel takes it. */
1114
+ | {
1115
+ type: "subagent.stop";
1116
+ subagentId: string;
1082
1117
  };
1083
1118
  interface AgentTaskEvent {
1084
1119
  /** Event names are open and can grow without a client release. */
@@ -1137,6 +1172,18 @@ interface AgentTurnUsage {
1137
1172
  * the history and in a recovered turn, never in the live `turnEnd`.
1138
1173
  */
1139
1174
  requestMessageId?: string;
1175
+ /**
1176
+ * Tokens occupying the chat's context window at the end of the turn: the prompt of the last
1177
+ * request of the main conversation, cache included, subagents excluded. Sent by the box in
1178
+ * `stepFinish`: live in `turnEnd` and in the history. Absent from older boxes and older turns.
1179
+ */
1180
+ contextTokens?: number;
1181
+ /**
1182
+ * Size of the model's context window, in tokens, always positive. Sent by the box in
1183
+ * `stepFinish`: live in `turnEnd` and in the history. Absent when the box does not know it, and
1184
+ * from older boxes and older turns.
1185
+ */
1186
+ contextWindow?: number;
1140
1187
  }
1141
1188
  interface AgentMessage {
1142
1189
  id: string;
@@ -1254,9 +1301,28 @@ interface AgentConnection {
1254
1301
  customProviders?: AgentConnectionCustomProvider[];
1255
1302
  }
1256
1303
  interface MessageAccepted {
1257
- /** Identifier assigned by Messenger to the accepted notification. */
1304
+ /** Identifier assigned by Messenger to the accepted message. */
1258
1305
  messageId: string;
1259
1306
  }
1307
+ /**
1308
+ * Email sent with the app's sender. There is no `from` because Messenger picks the sender from
1309
+ * the app in the token, and only the app's backend sends: a token exchanged from an api key or
1310
+ * the Server Function token. An app end-user token is refused with `403`. Recipient and content
1311
+ * rules, such as Messenger's cap on recipients across `to`, `cc` and `bcc`, are enforced there.
1312
+ */
1313
+ interface SendEmailInput {
1314
+ /** One address per entry. */
1315
+ to: string[];
1316
+ /** One address per entry. */
1317
+ cc?: string[];
1318
+ /** One address per entry. */
1319
+ bcc?: string[];
1320
+ replyTo?: string;
1321
+ subject: string;
1322
+ html: string;
1323
+ /** Plain-text alternative for clients that do not render HTML. */
1324
+ text?: string;
1325
+ }
1260
1326
  interface AppContext {
1261
1327
  appId: string;
1262
1328
  app: AppDefinition;
@@ -1747,6 +1813,8 @@ declare function createMembersModule(transport: Transport, errors?: SdkCoreError
1747
1813
  interface MessengerModule {
1748
1814
  /** Sends plain text to the authenticated user; channel rendering may support markdown. */
1749
1815
  notify(content: string): Promise<MessageAccepted>;
1816
+ /** Sends an email from the app's sender; only the app's backend token may send. */
1817
+ sendEmail(input: SendEmailInput): Promise<MessageAccepted>;
1750
1818
  }
1751
1819
  declare function createMessengerModule(transport: Transport, errors?: SdkCoreErrorFactory): MessengerModule;
1752
1820
 
@@ -1972,14 +2040,33 @@ interface AgentSendAndWaitOptions extends AgentSendOptions {
1972
2040
  timeoutMs?: number;
1973
2041
  }
1974
2042
  type AgentTaskSessionStatus = "opening" | "idle" | "streaming" | "cancelled" | "error" | "closed";
2043
+ /** @deprecated Messages are no longer held by the session; the queue is always empty. */
1975
2044
  interface AgentQueueItem extends AgentSendOptions {
1976
2045
  id: string;
1977
2046
  text: string;
1978
2047
  createdAt: number;
1979
2048
  }
2049
+ /** T3's subagent statuses; a status this version does not know comes through as it was sent. */
2050
+ type AgentSubagentStatus = "idle" | "pending" | "running" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted";
2051
+ /** The last state the box reported for a subagent of the chat. */
2052
+ interface AgentSubagent {
2053
+ subagentId: string;
2054
+ /** The tool call that spawned it: the `toolId` of its `tool` event. */
2055
+ toolId: string;
2056
+ status: AgentSubagentStatus | (string & {});
2057
+ progress?: string;
2058
+ /** Epoch milliseconds. */
2059
+ startedAt?: number;
2060
+ /** Epoch milliseconds, once it settled. */
2061
+ endedAt?: number;
2062
+ /** T3's thread for the subagent's own conversation, when the provider exposes one. */
2063
+ childThreadId?: string;
2064
+ }
1980
2065
  interface AgentToolEvent {
1981
2066
  tool: string;
1982
2067
  toolId?: string;
2068
+ /** On a tool a subagent called: the `toolId` of the tool call that spawned the subagent. */
2069
+ parentToolId?: string;
1983
2070
  phase: "call" | "result";
1984
2071
  input?: unknown;
1985
2072
  content?: unknown;
@@ -2033,9 +2120,33 @@ interface AgentTaskSessionEventMap {
2033
2120
  */
2034
2121
  accepted: Record<string, never>;
2035
2122
  cancelled: Record<string, never>;
2123
+ /** @deprecated Never emitted: every message is sent at once, so there is no queue to change. */
2036
2124
  queueChange: {
2037
2125
  queue: readonly AgentQueueItem[];
2038
2126
  };
2127
+ /**
2128
+ * The box took a message into the running turn at this point, with no turn of its own: the
2129
+ * place the app shows it in that turn. The turn's `turnEnd` answers it.
2130
+ */
2131
+ steered: {
2132
+ text: string;
2133
+ messageId: string;
2134
+ };
2135
+ /** A subagent's status, progress or child thread changed. */
2136
+ subagent: AgentSubagent;
2137
+ /**
2138
+ * Text of a subagent's own thread. It never reaches `delta` or `content`: the chat's answer
2139
+ * stays the parent's.
2140
+ */
2141
+ subagentDelta: {
2142
+ parentToolId: string;
2143
+ delta: string;
2144
+ kind: "text" | "thinking";
2145
+ };
2146
+ /** A tool a subagent called, in its own thread. */
2147
+ subagentTool: AgentToolEvent & {
2148
+ parentToolId: string;
2149
+ };
2039
2150
  error: {
2040
2151
  code?: string;
2041
2152
  error: string;
@@ -2058,17 +2169,27 @@ interface AgentTaskSession {
2058
2169
  readonly status: AgentTaskSessionStatus;
2059
2170
  readonly history: readonly AgentTimelineItem[];
2060
2171
  readonly content: string;
2172
+ /** @deprecated Always empty: a message sent while a turn runs goes to the box at once. */
2061
2173
  readonly queue: readonly AgentQueueItem[];
2174
+ /** Every subagent the box reported on this session, in the order first seen. */
2175
+ readonly subagents: readonly AgentSubagent[];
2062
2176
  send(prompt: string, options?: AgentSendOptions): void;
2063
2177
  sendAndWait(prompt: string, options?: AgentSendAndWaitOptions): Promise<AgentTurnResult>;
2064
2178
  cancel(): Promise<void>;
2065
2179
  respondApproval(approved: boolean): void;
2180
+ /** Answers T3's `user_input_request` (a `raw` event) on the box's direct channel. */
2181
+ respondUserInput(requestId: string, answers: Record<string, unknown>, attachmentsByQuestionId?: Record<string, unknown>): void;
2066
2182
  loadHistory(options?: {
2067
2183
  limit?: number;
2068
2184
  }): Promise<readonly AgentTimelineItem[]>;
2185
+ /** @deprecated No effect: the queue is always empty. */
2069
2186
  editQueueItem(id: string, text: string): void;
2187
+ /** @deprecated No effect: the queue is always empty. */
2070
2188
  removeQueueItem(id: string): void;
2189
+ /** @deprecated No effect: the queue is always empty. */
2071
2190
  clearQueue(): void;
2191
+ /** Stops one subagent and leaves the turn running (T3's `subagent.stop`). */
2192
+ stopSubagent(subagentId: string): void;
2072
2193
  on<K extends keyof AgentTaskSessionEventMap>(event: K, handler: (payload: AgentTaskSessionEventMap[K]) => void): () => void;
2073
2194
  close(): void;
2074
2195
  }
@@ -2140,4 +2261,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
2140
2261
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
2141
2262
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
2142
2263
 
2143
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
2264
+ export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
package/dist/index.d.ts CHANGED
@@ -589,6 +589,13 @@ interface AppUpdateInput {
589
589
  icon?: string;
590
590
  /** Whether users may sign up through this app. Omission preserves the current value. */
591
591
  allowSignup?: boolean;
592
+ /** Whether users may sign in with a code sent by email. Omission preserves the current value. */
593
+ emailLoginEnabled?: boolean;
594
+ /**
595
+ * Whether users may sign in with a password. Omission preserves the current value. Code Studio
596
+ * rejects `true` while the app inherits the platform login.
597
+ */
598
+ passwordLoginEnabled?: boolean;
592
599
  }
593
600
  interface AppDomain {
594
601
  hostname: string;
@@ -610,6 +617,10 @@ interface AppSummary {
610
617
  template: string | null;
611
618
  planId: string;
612
619
  allowSignup: boolean;
620
+ /** Absent on a Code Studio that predates email login. */
621
+ emailLoginEnabled?: boolean;
622
+ /** Absent on a Code Studio that predates password login. */
623
+ passwordLoginEnabled?: boolean;
613
624
  externalAccessEnabled: boolean;
614
625
  currentVersion: AppVersion | null;
615
626
  createdAt: string;
@@ -630,6 +641,10 @@ interface AppDefinition {
630
641
  planId: string;
631
642
  template: string | null;
632
643
  allowSignup: boolean;
644
+ /** Absent on a Code Studio that predates email login. */
645
+ emailLoginEnabled?: boolean;
646
+ /** Absent on a Code Studio that predates password login. */
647
+ passwordLoginEnabled?: boolean;
633
648
  externalAccessEnabled: boolean;
634
649
  currentVersion: AppVersion | null;
635
650
  createdAt: string;
@@ -1074,11 +1089,31 @@ type AgentTaskInput = {
1074
1089
  content: string;
1075
1090
  agentType?: string;
1076
1091
  reasoningEffort?: string;
1092
+ /**
1093
+ * `steer` takes the message into the running turn; a box given none puts it in T3's queue.
1094
+ * The session always sends `steer`. The Copilot does not take the field.
1095
+ */
1096
+ mode?: "steer";
1077
1097
  } | {
1078
1098
  type: "interrupt";
1079
1099
  } | {
1080
1100
  type: "approval_response";
1081
1101
  approved: boolean;
1102
+ }
1103
+ /**
1104
+ * The answer to a `user_input_request` the box forwards from T3 mid-turn (a `raw` event whose
1105
+ * payload is T3's item). Same shape as T3's own command; only the box's direct channel takes it.
1106
+ */
1107
+ | {
1108
+ type: "runtime-request.respond";
1109
+ requestId: string;
1110
+ answers: Record<string, unknown>;
1111
+ attachmentsByQuestionId?: Record<string, unknown>;
1112
+ }
1113
+ /** Stops one subagent, as T3's own `subagent.stop`; only the box channel takes it. */
1114
+ | {
1115
+ type: "subagent.stop";
1116
+ subagentId: string;
1082
1117
  };
1083
1118
  interface AgentTaskEvent {
1084
1119
  /** Event names are open and can grow without a client release. */
@@ -1137,6 +1172,18 @@ interface AgentTurnUsage {
1137
1172
  * the history and in a recovered turn, never in the live `turnEnd`.
1138
1173
  */
1139
1174
  requestMessageId?: string;
1175
+ /**
1176
+ * Tokens occupying the chat's context window at the end of the turn: the prompt of the last
1177
+ * request of the main conversation, cache included, subagents excluded. Sent by the box in
1178
+ * `stepFinish`: live in `turnEnd` and in the history. Absent from older boxes and older turns.
1179
+ */
1180
+ contextTokens?: number;
1181
+ /**
1182
+ * Size of the model's context window, in tokens, always positive. Sent by the box in
1183
+ * `stepFinish`: live in `turnEnd` and in the history. Absent when the box does not know it, and
1184
+ * from older boxes and older turns.
1185
+ */
1186
+ contextWindow?: number;
1140
1187
  }
1141
1188
  interface AgentMessage {
1142
1189
  id: string;
@@ -1254,9 +1301,28 @@ interface AgentConnection {
1254
1301
  customProviders?: AgentConnectionCustomProvider[];
1255
1302
  }
1256
1303
  interface MessageAccepted {
1257
- /** Identifier assigned by Messenger to the accepted notification. */
1304
+ /** Identifier assigned by Messenger to the accepted message. */
1258
1305
  messageId: string;
1259
1306
  }
1307
+ /**
1308
+ * Email sent with the app's sender. There is no `from` because Messenger picks the sender from
1309
+ * the app in the token, and only the app's backend sends: a token exchanged from an api key or
1310
+ * the Server Function token. An app end-user token is refused with `403`. Recipient and content
1311
+ * rules, such as Messenger's cap on recipients across `to`, `cc` and `bcc`, are enforced there.
1312
+ */
1313
+ interface SendEmailInput {
1314
+ /** One address per entry. */
1315
+ to: string[];
1316
+ /** One address per entry. */
1317
+ cc?: string[];
1318
+ /** One address per entry. */
1319
+ bcc?: string[];
1320
+ replyTo?: string;
1321
+ subject: string;
1322
+ html: string;
1323
+ /** Plain-text alternative for clients that do not render HTML. */
1324
+ text?: string;
1325
+ }
1260
1326
  interface AppContext {
1261
1327
  appId: string;
1262
1328
  app: AppDefinition;
@@ -1747,6 +1813,8 @@ declare function createMembersModule(transport: Transport, errors?: SdkCoreError
1747
1813
  interface MessengerModule {
1748
1814
  /** Sends plain text to the authenticated user; channel rendering may support markdown. */
1749
1815
  notify(content: string): Promise<MessageAccepted>;
1816
+ /** Sends an email from the app's sender; only the app's backend token may send. */
1817
+ sendEmail(input: SendEmailInput): Promise<MessageAccepted>;
1750
1818
  }
1751
1819
  declare function createMessengerModule(transport: Transport, errors?: SdkCoreErrorFactory): MessengerModule;
1752
1820
 
@@ -1972,14 +2040,33 @@ interface AgentSendAndWaitOptions extends AgentSendOptions {
1972
2040
  timeoutMs?: number;
1973
2041
  }
1974
2042
  type AgentTaskSessionStatus = "opening" | "idle" | "streaming" | "cancelled" | "error" | "closed";
2043
+ /** @deprecated Messages are no longer held by the session; the queue is always empty. */
1975
2044
  interface AgentQueueItem extends AgentSendOptions {
1976
2045
  id: string;
1977
2046
  text: string;
1978
2047
  createdAt: number;
1979
2048
  }
2049
+ /** T3's subagent statuses; a status this version does not know comes through as it was sent. */
2050
+ type AgentSubagentStatus = "idle" | "pending" | "running" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted";
2051
+ /** The last state the box reported for a subagent of the chat. */
2052
+ interface AgentSubagent {
2053
+ subagentId: string;
2054
+ /** The tool call that spawned it: the `toolId` of its `tool` event. */
2055
+ toolId: string;
2056
+ status: AgentSubagentStatus | (string & {});
2057
+ progress?: string;
2058
+ /** Epoch milliseconds. */
2059
+ startedAt?: number;
2060
+ /** Epoch milliseconds, once it settled. */
2061
+ endedAt?: number;
2062
+ /** T3's thread for the subagent's own conversation, when the provider exposes one. */
2063
+ childThreadId?: string;
2064
+ }
1980
2065
  interface AgentToolEvent {
1981
2066
  tool: string;
1982
2067
  toolId?: string;
2068
+ /** On a tool a subagent called: the `toolId` of the tool call that spawned the subagent. */
2069
+ parentToolId?: string;
1983
2070
  phase: "call" | "result";
1984
2071
  input?: unknown;
1985
2072
  content?: unknown;
@@ -2033,9 +2120,33 @@ interface AgentTaskSessionEventMap {
2033
2120
  */
2034
2121
  accepted: Record<string, never>;
2035
2122
  cancelled: Record<string, never>;
2123
+ /** @deprecated Never emitted: every message is sent at once, so there is no queue to change. */
2036
2124
  queueChange: {
2037
2125
  queue: readonly AgentQueueItem[];
2038
2126
  };
2127
+ /**
2128
+ * The box took a message into the running turn at this point, with no turn of its own: the
2129
+ * place the app shows it in that turn. The turn's `turnEnd` answers it.
2130
+ */
2131
+ steered: {
2132
+ text: string;
2133
+ messageId: string;
2134
+ };
2135
+ /** A subagent's status, progress or child thread changed. */
2136
+ subagent: AgentSubagent;
2137
+ /**
2138
+ * Text of a subagent's own thread. It never reaches `delta` or `content`: the chat's answer
2139
+ * stays the parent's.
2140
+ */
2141
+ subagentDelta: {
2142
+ parentToolId: string;
2143
+ delta: string;
2144
+ kind: "text" | "thinking";
2145
+ };
2146
+ /** A tool a subagent called, in its own thread. */
2147
+ subagentTool: AgentToolEvent & {
2148
+ parentToolId: string;
2149
+ };
2039
2150
  error: {
2040
2151
  code?: string;
2041
2152
  error: string;
@@ -2058,17 +2169,27 @@ interface AgentTaskSession {
2058
2169
  readonly status: AgentTaskSessionStatus;
2059
2170
  readonly history: readonly AgentTimelineItem[];
2060
2171
  readonly content: string;
2172
+ /** @deprecated Always empty: a message sent while a turn runs goes to the box at once. */
2061
2173
  readonly queue: readonly AgentQueueItem[];
2174
+ /** Every subagent the box reported on this session, in the order first seen. */
2175
+ readonly subagents: readonly AgentSubagent[];
2062
2176
  send(prompt: string, options?: AgentSendOptions): void;
2063
2177
  sendAndWait(prompt: string, options?: AgentSendAndWaitOptions): Promise<AgentTurnResult>;
2064
2178
  cancel(): Promise<void>;
2065
2179
  respondApproval(approved: boolean): void;
2180
+ /** Answers T3's `user_input_request` (a `raw` event) on the box's direct channel. */
2181
+ respondUserInput(requestId: string, answers: Record<string, unknown>, attachmentsByQuestionId?: Record<string, unknown>): void;
2066
2182
  loadHistory(options?: {
2067
2183
  limit?: number;
2068
2184
  }): Promise<readonly AgentTimelineItem[]>;
2185
+ /** @deprecated No effect: the queue is always empty. */
2069
2186
  editQueueItem(id: string, text: string): void;
2187
+ /** @deprecated No effect: the queue is always empty. */
2070
2188
  removeQueueItem(id: string): void;
2189
+ /** @deprecated No effect: the queue is always empty. */
2071
2190
  clearQueue(): void;
2191
+ /** Stops one subagent and leaves the turn running (T3's `subagent.stop`). */
2192
+ stopSubagent(subagentId: string): void;
2072
2193
  on<K extends keyof AgentTaskSessionEventMap>(event: K, handler: (payload: AgentTaskSessionEventMap[K]) => void): () => void;
2073
2194
  close(): void;
2074
2195
  }
@@ -2140,4 +2261,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
2140
2261
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
2141
2262
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
2142
2263
 
2143
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
2264
+ export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentInput, type AgentMessage, type AgentModel, type AgentProviderUsage, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };