@mitralab.io/sdk-core 0.2.5-beta.0 → 0.2.7-beta.0

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.cjs CHANGED
@@ -996,6 +996,7 @@ function expectAgentTask(value, context, errors = defaultSdkCoreErrorFactory) {
996
996
  if (!isNullableString(task[field])) invalidField(context, field, errors);
997
997
  }
998
998
  if ("scope" in task && !isNullableString(task.scope)) invalidField(context, "scope", errors);
999
+ if ("model" in task && !isNullableString(task.model)) invalidField(context, "model", errors);
999
1000
  if (typeof task.agentType !== "string") invalidField(context, "agentType", errors);
1000
1001
  if (typeof task.archived !== "boolean") invalidField(context, "archived", errors);
1001
1002
  if (!isNullableString(task.createdAt)) invalidField(context, "createdAt", errors);
@@ -1015,6 +1016,9 @@ function expectAgentModel(value, context, errors = defaultSdkCoreErrorFactory) {
1015
1016
  if (typeof model[field] !== "string") invalidField(context, field, errors);
1016
1017
  }
1017
1018
  if (!isStringArray(model.reasoningOptions)) invalidField(context, "reasoningOptions", errors);
1019
+ if ("providerName" in model && !isNullableString(model.providerName)) {
1020
+ invalidField(context, "providerName", errors);
1021
+ }
1018
1022
  return model;
1019
1023
  }
1020
1024
  function expectCredentialStatus(value, context, errors = defaultSdkCoreErrorFactory) {
@@ -1054,6 +1058,14 @@ function expectProviderCredentialStatus(value, context, errors) {
1054
1058
  if (!isNullableString(status.accountEmail)) invalidField(context, "accountEmail", errors);
1055
1059
  return status;
1056
1060
  }
1061
+ function expectAgentConnectionCustomProvider(value, context, errors) {
1062
+ const provider = expectObject(value, context, errors);
1063
+ for (const field of ["id", "name", "baseUrl", "maskedApiKey"]) {
1064
+ if (typeof provider[field] !== "string") invalidField(context, field, errors);
1065
+ }
1066
+ if (!isStringArray(provider.models)) invalidField(context, "models", errors);
1067
+ return provider;
1068
+ }
1057
1069
  function expectAgentConnection(value, context, errors = defaultSdkCoreErrorFactory) {
1058
1070
  const connection = expectObject(value, context, errors);
1059
1071
  if (typeof connection.id !== "string") invalidField(context, "id", errors);
@@ -1066,6 +1078,14 @@ function expectAgentConnection(value, context, errors = defaultSdkCoreErrorFacto
1066
1078
  errors,
1067
1079
  expectProviderCredentialStatus
1068
1080
  );
1081
+ if ("customProviders" in connection) {
1082
+ expectObjectArray(
1083
+ connection.customProviders,
1084
+ `${context} customProviders`,
1085
+ errors,
1086
+ expectAgentConnectionCustomProvider
1087
+ );
1088
+ }
1069
1089
  return connection;
1070
1090
  }
1071
1091
  function expectTableDefinition(value, context, errors = defaultSdkCoreErrorFactory) {
@@ -1120,6 +1140,7 @@ function expectEmpty(value, context, errors = defaultSdkCoreErrorFactory) {
1120
1140
 
1121
1141
  // src/modules/agentConnections.ts
1122
1142
  var MAX_CONNECTIONS = 100;
1143
+ var MAX_CUSTOM_PROVIDER_MODELS = 32;
1123
1144
  function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFactory) {
1124
1145
  const path = (id) => `/api/v1/connections/${encodePathSegment(id, "connection id", errors)}`;
1125
1146
  const providerPath = (id, provider) => `${path(id)}/providers/${encodePathSegment(provider, "provider", errors)}`;
@@ -1226,11 +1247,33 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1226
1247
  "Connection device authorization poll response",
1227
1248
  errors
1228
1249
  );
1250
+ },
1251
+ async createCustomProvider(id, input) {
1252
+ requireBatchSize(input.models, "models", MAX_CUSTOM_PROVIDER_MODELS, errors);
1253
+ return expectAgentConnection(
1254
+ await transport.request(`${path(id)}/custom-providers`, {
1255
+ method: "POST",
1256
+ body: input
1257
+ }),
1258
+ "Create connection custom provider response",
1259
+ errors
1260
+ );
1261
+ },
1262
+ async deleteCustomProvider(id, providerId) {
1263
+ expectEmpty(
1264
+ await transport.request(
1265
+ `${path(id)}/custom-providers/${encodePathSegment(providerId, "custom provider id", errors)}`,
1266
+ { method: "DELETE" }
1267
+ ),
1268
+ "Delete connection custom provider response",
1269
+ errors
1270
+ );
1229
1271
  }
1230
1272
  };
1231
1273
  }
1232
1274
 
1233
1275
  // src/modules/agentCredentials.ts
1276
+ var MAX_CUSTOM_PROVIDER_MODELS2 = 32;
1234
1277
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1235
1278
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1236
1279
  const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
@@ -1322,6 +1365,40 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1322
1365
  "Device authorization poll response",
1323
1366
  errors
1324
1367
  );
1368
+ },
1369
+ async listCustomProviders(options) {
1370
+ return expectObjectArray(
1371
+ await transport.request("/api/v1/credentials/custom-providers", {
1372
+ method: "GET",
1373
+ ...scopeParams(options)
1374
+ }),
1375
+ "Custom provider list response",
1376
+ errors,
1377
+ expectAgentConnectionCustomProvider
1378
+ );
1379
+ },
1380
+ async createCustomProvider(input, options) {
1381
+ requireBatchSize(input.models, "models", MAX_CUSTOM_PROVIDER_MODELS2, errors);
1382
+ return expectObjectArray(
1383
+ await transport.request("/api/v1/credentials/custom-providers", {
1384
+ method: "POST",
1385
+ body: input,
1386
+ ...scopeParams(options)
1387
+ }),
1388
+ "Create custom provider response",
1389
+ errors,
1390
+ expectAgentConnectionCustomProvider
1391
+ );
1392
+ },
1393
+ async deleteCustomProvider(id, options) {
1394
+ expectEmpty(
1395
+ await transport.request(
1396
+ `/api/v1/credentials/custom-providers/${encodePathSegment(id, "custom provider id", errors)}`,
1397
+ { method: "DELETE", ...scopeParams(options) }
1398
+ ),
1399
+ "Delete custom provider response",
1400
+ errors
1401
+ );
1325
1402
  }
1326
1403
  };
1327
1404
  }
@@ -3200,7 +3277,8 @@ var CoreAgentTaskSession = class {
3200
3277
  text: item.text,
3201
3278
  createdAt: item.createdAt,
3202
3279
  ...item.agentType ? { agentType: item.agentType } : {},
3203
- ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {}
3280
+ ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {},
3281
+ ...item.model ? { model: item.model } : {}
3204
3282
  }));
3205
3283
  }
3206
3284
  send(prompt, options = {}) {
@@ -3219,7 +3297,8 @@ var CoreAgentTaskSession = class {
3219
3297
  if (waiter.settled) return waiter.promise;
3220
3298
  const sendOptions = {
3221
3299
  ...options.agentType ? { agentType: options.agentType } : {},
3222
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3300
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3301
+ ...options.model ? { model: options.model } : {}
3223
3302
  };
3224
3303
  if (this.isBusy()) {
3225
3304
  const queueId = this.enqueue(prompt, sendOptions, waiter);
@@ -3356,7 +3435,8 @@ var CoreAgentTaskSession = class {
3356
3435
  type: "message",
3357
3436
  content: prompt,
3358
3437
  ...options.agentType ? { agentType: options.agentType } : {},
3359
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3438
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3439
+ ...options.model ? { model: options.model } : {}
3360
3440
  };
3361
3441
  if (this.isClosed()) {
3362
3442
  await this.sendInput(input).catch(() => void 0);
@@ -3386,6 +3466,7 @@ var CoreAgentTaskSession = class {
3386
3466
  ...createOptions.title ? { title: createOptions.title } : {},
3387
3467
  ...createOptions.agentId ? { agentId: createOptions.agentId } : {},
3388
3468
  ...createOptions.reasoningEffort ? { reasoningEffort: createOptions.reasoningEffort } : {},
3469
+ ...createOptions.model ? { model: createOptions.model } : {},
3389
3470
  ...createOptions.userId ? { userId: createOptions.userId } : {},
3390
3471
  ...createOptions.runtime ? { runtime: createOptions.runtime } : {},
3391
3472
  ...createOptions.scope ? { scope: createOptions.scope } : {}
@@ -3652,7 +3733,8 @@ var CoreAgentTaskSession = class {
3652
3733
  next.text,
3653
3734
  {
3654
3735
  ...next.agentType ? { agentType: next.agentType } : {},
3655
- ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {}
3736
+ ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {},
3737
+ ...next.model ? { model: next.model } : {}
3656
3738
  },
3657
3739
  next.waiter
3658
3740
  );
package/dist/index.d.cts CHANGED
@@ -1033,6 +1033,8 @@ interface AgentTaskCreateInput {
1033
1033
  agentId?: string;
1034
1034
  /** Optional reasoning setting supported by the selected model. */
1035
1035
  reasoningEffort?: string;
1036
+ /** Catalog model id, for example `custom/<providerId>/<model>`. Copilot requires it for CUSTOM_AI. */
1037
+ model?: string;
1036
1038
  /** Optional runtime. Core never defaults it; the concrete SDK decides what to send. */
1037
1039
  runtime?: AgentTaskRuntime;
1038
1040
  /** Optional credential scope. Core never defaults it; the concrete SDK decides what to send. */
@@ -1055,6 +1057,8 @@ interface AgentTask {
1055
1057
  reasoningEffort: string | null;
1056
1058
  /** Absent on a Copilot that predates credential scopes; null on a task without one. */
1057
1059
  scope?: AgentCredentialScope | null;
1060
+ /** Absent on a Copilot that predates custom providers; null on a task without an explicit model. */
1061
+ model?: string | null;
1058
1062
  archived: boolean;
1059
1063
  createdAt: string | null;
1060
1064
  updatedAt: string;
@@ -1074,6 +1078,8 @@ type AgentTaskInput = {
1074
1078
  content: string;
1075
1079
  agentType?: string;
1076
1080
  reasoningEffort?: string;
1081
+ /** Catalog model id. */
1082
+ model?: string;
1077
1083
  } | {
1078
1084
  type: "interrupt";
1079
1085
  } | {
@@ -1101,6 +1107,8 @@ interface AgentModel {
1101
1107
  provider: CopilotProvider;
1102
1108
  agentType: string;
1103
1109
  reasoningOptions: string[];
1110
+ /** Name the person chose for a custom provider; null on built-in models. Absent on an older Copilot. */
1111
+ providerName?: string | null;
1104
1112
  }
1105
1113
  interface CredentialStatus {
1106
1114
  provider: CopilotProvider;
@@ -1143,12 +1151,34 @@ interface ProviderCredentialStatus {
1143
1151
  credentialType: string | null;
1144
1152
  accountEmail: string | null;
1145
1153
  }
1154
+ interface AgentConnectionCustomProviderInput {
1155
+ /**
1156
+ * Name the person chooses for the provider, unique within the connection, or within the
1157
+ * person's account on the credentials surface.
1158
+ */
1159
+ name: string;
1160
+ /** OpenAI-compatible endpoint, http or https without a query string. */
1161
+ baseUrl: string;
1162
+ /** Write-only key. Copilot never returns it. */
1163
+ apiKey: string;
1164
+ /** 1 to 32 unique model ids served by the endpoint. */
1165
+ models: string[];
1166
+ }
1167
+ interface AgentConnectionCustomProvider {
1168
+ id: string;
1169
+ name: string;
1170
+ baseUrl: string;
1171
+ maskedApiKey: string;
1172
+ models: string[];
1173
+ }
1146
1174
  interface AgentConnection {
1147
1175
  id: string;
1148
1176
  name: string;
1149
1177
  createdAt: string;
1150
1178
  updatedAt: string;
1151
1179
  credentials: ProviderCredentialStatus[];
1180
+ /** Absent on a Copilot that predates custom providers. */
1181
+ customProviders?: AgentConnectionCustomProvider[];
1152
1182
  }
1153
1183
  interface MessageAccepted {
1154
1184
  /** Identifier assigned by Messenger to the accepted notification. */
@@ -1191,6 +1221,12 @@ interface AgentConnectionsModule {
1191
1221
  exchangeOAuth(id: string, provider: CopilotProvider, input: OAuthExchangeInput): Promise<AuthenticationResult>;
1192
1222
  startDeviceAuthorization(id: string, provider: CopilotProvider): Promise<DeviceAuthorization>;
1193
1223
  pollDeviceAuthorization(id: string, provider: CopilotProvider, deviceAuthId: string): Promise<AuthenticationResult>;
1224
+ /**
1225
+ * Adds an OpenAI-compatible provider under a name the person chooses. Its models join the
1226
+ * agent catalog as `custom/<providerId>/<model>`; the API key is write-only.
1227
+ */
1228
+ createCustomProvider(id: string, input: AgentConnectionCustomProviderInput): Promise<AgentConnection>;
1229
+ deleteCustomProvider(id: string, providerId: string): Promise<void>;
1194
1230
  }
1195
1231
  declare function createAgentConnectionsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentConnectionsModule;
1196
1232
 
@@ -1215,6 +1251,16 @@ interface AgentCredentialsModule {
1215
1251
  startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1216
1252
  /** Polls one device authorization. Respect the returned start interval between calls. */
1217
1253
  pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1254
+ /** Lists the person's OpenAI-compatible providers. The API key is returned masked. */
1255
+ listCustomProviders(options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1256
+ /**
1257
+ * Adds an OpenAI-compatible provider under a name the person chooses and returns the person's
1258
+ * list after creation. Its models join the catalog as `custom/<providerId>/<model>`; the API
1259
+ * key is write-only. Copilot requires scope ACCOUNT on an app token.
1260
+ */
1261
+ createCustomProvider(input: AgentConnectionCustomProviderInput, options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1262
+ /** Permanently removes one of the person's custom providers. */
1263
+ deleteCustomProvider(id: string, options?: AgentCredentialOptions): Promise<void>;
1218
1264
  }
1219
1265
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1220
1266
 
@@ -1745,6 +1791,8 @@ interface NewAgentTaskSessionOptions {
1745
1791
  title?: string;
1746
1792
  agentId?: string;
1747
1793
  reasoningEffort?: string;
1794
+ /** Catalog model id. */
1795
+ model?: string;
1748
1796
  userId?: string;
1749
1797
  /** Runtime the task is born on. Omitted means the Copilot server default. */
1750
1798
  runtime?: AgentTaskRuntime;
@@ -1761,6 +1809,8 @@ type AgentTaskSessionOptions = NewAgentTaskSessionOptions | ExistingAgentTaskSes
1761
1809
  interface AgentSendOptions {
1762
1810
  agentType?: string;
1763
1811
  reasoningEffort?: string;
1812
+ /** Catalog model id. */
1813
+ model?: string;
1764
1814
  }
1765
1815
  interface AgentSendAndWaitOptions extends AgentSendOptions {
1766
1816
  signal?: AbortSignal;
@@ -1918,4 +1968,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1918
1968
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1919
1969
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1920
1970
 
1921
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, 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 AgentUpdateItem, 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 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 };
1971
+ 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 AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, 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 AgentUpdateItem, 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 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 };
package/dist/index.d.ts CHANGED
@@ -1033,6 +1033,8 @@ interface AgentTaskCreateInput {
1033
1033
  agentId?: string;
1034
1034
  /** Optional reasoning setting supported by the selected model. */
1035
1035
  reasoningEffort?: string;
1036
+ /** Catalog model id, for example `custom/<providerId>/<model>`. Copilot requires it for CUSTOM_AI. */
1037
+ model?: string;
1036
1038
  /** Optional runtime. Core never defaults it; the concrete SDK decides what to send. */
1037
1039
  runtime?: AgentTaskRuntime;
1038
1040
  /** Optional credential scope. Core never defaults it; the concrete SDK decides what to send. */
@@ -1055,6 +1057,8 @@ interface AgentTask {
1055
1057
  reasoningEffort: string | null;
1056
1058
  /** Absent on a Copilot that predates credential scopes; null on a task without one. */
1057
1059
  scope?: AgentCredentialScope | null;
1060
+ /** Absent on a Copilot that predates custom providers; null on a task without an explicit model. */
1061
+ model?: string | null;
1058
1062
  archived: boolean;
1059
1063
  createdAt: string | null;
1060
1064
  updatedAt: string;
@@ -1074,6 +1078,8 @@ type AgentTaskInput = {
1074
1078
  content: string;
1075
1079
  agentType?: string;
1076
1080
  reasoningEffort?: string;
1081
+ /** Catalog model id. */
1082
+ model?: string;
1077
1083
  } | {
1078
1084
  type: "interrupt";
1079
1085
  } | {
@@ -1101,6 +1107,8 @@ interface AgentModel {
1101
1107
  provider: CopilotProvider;
1102
1108
  agentType: string;
1103
1109
  reasoningOptions: string[];
1110
+ /** Name the person chose for a custom provider; null on built-in models. Absent on an older Copilot. */
1111
+ providerName?: string | null;
1104
1112
  }
1105
1113
  interface CredentialStatus {
1106
1114
  provider: CopilotProvider;
@@ -1143,12 +1151,34 @@ interface ProviderCredentialStatus {
1143
1151
  credentialType: string | null;
1144
1152
  accountEmail: string | null;
1145
1153
  }
1154
+ interface AgentConnectionCustomProviderInput {
1155
+ /**
1156
+ * Name the person chooses for the provider, unique within the connection, or within the
1157
+ * person's account on the credentials surface.
1158
+ */
1159
+ name: string;
1160
+ /** OpenAI-compatible endpoint, http or https without a query string. */
1161
+ baseUrl: string;
1162
+ /** Write-only key. Copilot never returns it. */
1163
+ apiKey: string;
1164
+ /** 1 to 32 unique model ids served by the endpoint. */
1165
+ models: string[];
1166
+ }
1167
+ interface AgentConnectionCustomProvider {
1168
+ id: string;
1169
+ name: string;
1170
+ baseUrl: string;
1171
+ maskedApiKey: string;
1172
+ models: string[];
1173
+ }
1146
1174
  interface AgentConnection {
1147
1175
  id: string;
1148
1176
  name: string;
1149
1177
  createdAt: string;
1150
1178
  updatedAt: string;
1151
1179
  credentials: ProviderCredentialStatus[];
1180
+ /** Absent on a Copilot that predates custom providers. */
1181
+ customProviders?: AgentConnectionCustomProvider[];
1152
1182
  }
1153
1183
  interface MessageAccepted {
1154
1184
  /** Identifier assigned by Messenger to the accepted notification. */
@@ -1191,6 +1221,12 @@ interface AgentConnectionsModule {
1191
1221
  exchangeOAuth(id: string, provider: CopilotProvider, input: OAuthExchangeInput): Promise<AuthenticationResult>;
1192
1222
  startDeviceAuthorization(id: string, provider: CopilotProvider): Promise<DeviceAuthorization>;
1193
1223
  pollDeviceAuthorization(id: string, provider: CopilotProvider, deviceAuthId: string): Promise<AuthenticationResult>;
1224
+ /**
1225
+ * Adds an OpenAI-compatible provider under a name the person chooses. Its models join the
1226
+ * agent catalog as `custom/<providerId>/<model>`; the API key is write-only.
1227
+ */
1228
+ createCustomProvider(id: string, input: AgentConnectionCustomProviderInput): Promise<AgentConnection>;
1229
+ deleteCustomProvider(id: string, providerId: string): Promise<void>;
1194
1230
  }
1195
1231
  declare function createAgentConnectionsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentConnectionsModule;
1196
1232
 
@@ -1215,6 +1251,16 @@ interface AgentCredentialsModule {
1215
1251
  startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1216
1252
  /** Polls one device authorization. Respect the returned start interval between calls. */
1217
1253
  pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1254
+ /** Lists the person's OpenAI-compatible providers. The API key is returned masked. */
1255
+ listCustomProviders(options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1256
+ /**
1257
+ * Adds an OpenAI-compatible provider under a name the person chooses and returns the person's
1258
+ * list after creation. Its models join the catalog as `custom/<providerId>/<model>`; the API
1259
+ * key is write-only. Copilot requires scope ACCOUNT on an app token.
1260
+ */
1261
+ createCustomProvider(input: AgentConnectionCustomProviderInput, options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1262
+ /** Permanently removes one of the person's custom providers. */
1263
+ deleteCustomProvider(id: string, options?: AgentCredentialOptions): Promise<void>;
1218
1264
  }
1219
1265
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1220
1266
 
@@ -1745,6 +1791,8 @@ interface NewAgentTaskSessionOptions {
1745
1791
  title?: string;
1746
1792
  agentId?: string;
1747
1793
  reasoningEffort?: string;
1794
+ /** Catalog model id. */
1795
+ model?: string;
1748
1796
  userId?: string;
1749
1797
  /** Runtime the task is born on. Omitted means the Copilot server default. */
1750
1798
  runtime?: AgentTaskRuntime;
@@ -1761,6 +1809,8 @@ type AgentTaskSessionOptions = NewAgentTaskSessionOptions | ExistingAgentTaskSes
1761
1809
  interface AgentSendOptions {
1762
1810
  agentType?: string;
1763
1811
  reasoningEffort?: string;
1812
+ /** Catalog model id. */
1813
+ model?: string;
1764
1814
  }
1765
1815
  interface AgentSendAndWaitOptions extends AgentSendOptions {
1766
1816
  signal?: AbortSignal;
@@ -1918,4 +1968,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1918
1968
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1919
1969
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1920
1970
 
1921
- export { API_KEY_EXCHANGE_PATH, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, 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 AgentUpdateItem, 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 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 };
1971
+ 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 AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, 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 AgentUpdateItem, 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 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 };
package/dist/index.js CHANGED
@@ -924,6 +924,7 @@ function expectAgentTask(value, context, errors = defaultSdkCoreErrorFactory) {
924
924
  if (!isNullableString(task[field])) invalidField(context, field, errors);
925
925
  }
926
926
  if ("scope" in task && !isNullableString(task.scope)) invalidField(context, "scope", errors);
927
+ if ("model" in task && !isNullableString(task.model)) invalidField(context, "model", errors);
927
928
  if (typeof task.agentType !== "string") invalidField(context, "agentType", errors);
928
929
  if (typeof task.archived !== "boolean") invalidField(context, "archived", errors);
929
930
  if (!isNullableString(task.createdAt)) invalidField(context, "createdAt", errors);
@@ -943,6 +944,9 @@ function expectAgentModel(value, context, errors = defaultSdkCoreErrorFactory) {
943
944
  if (typeof model[field] !== "string") invalidField(context, field, errors);
944
945
  }
945
946
  if (!isStringArray(model.reasoningOptions)) invalidField(context, "reasoningOptions", errors);
947
+ if ("providerName" in model && !isNullableString(model.providerName)) {
948
+ invalidField(context, "providerName", errors);
949
+ }
946
950
  return model;
947
951
  }
948
952
  function expectCredentialStatus(value, context, errors = defaultSdkCoreErrorFactory) {
@@ -982,6 +986,14 @@ function expectProviderCredentialStatus(value, context, errors) {
982
986
  if (!isNullableString(status.accountEmail)) invalidField(context, "accountEmail", errors);
983
987
  return status;
984
988
  }
989
+ function expectAgentConnectionCustomProvider(value, context, errors) {
990
+ const provider = expectObject(value, context, errors);
991
+ for (const field of ["id", "name", "baseUrl", "maskedApiKey"]) {
992
+ if (typeof provider[field] !== "string") invalidField(context, field, errors);
993
+ }
994
+ if (!isStringArray(provider.models)) invalidField(context, "models", errors);
995
+ return provider;
996
+ }
985
997
  function expectAgentConnection(value, context, errors = defaultSdkCoreErrorFactory) {
986
998
  const connection = expectObject(value, context, errors);
987
999
  if (typeof connection.id !== "string") invalidField(context, "id", errors);
@@ -994,6 +1006,14 @@ function expectAgentConnection(value, context, errors = defaultSdkCoreErrorFacto
994
1006
  errors,
995
1007
  expectProviderCredentialStatus
996
1008
  );
1009
+ if ("customProviders" in connection) {
1010
+ expectObjectArray(
1011
+ connection.customProviders,
1012
+ `${context} customProviders`,
1013
+ errors,
1014
+ expectAgentConnectionCustomProvider
1015
+ );
1016
+ }
997
1017
  return connection;
998
1018
  }
999
1019
  function expectTableDefinition(value, context, errors = defaultSdkCoreErrorFactory) {
@@ -1048,6 +1068,7 @@ function expectEmpty(value, context, errors = defaultSdkCoreErrorFactory) {
1048
1068
 
1049
1069
  // src/modules/agentConnections.ts
1050
1070
  var MAX_CONNECTIONS = 100;
1071
+ var MAX_CUSTOM_PROVIDER_MODELS = 32;
1051
1072
  function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFactory) {
1052
1073
  const path = (id) => `/api/v1/connections/${encodePathSegment(id, "connection id", errors)}`;
1053
1074
  const providerPath = (id, provider) => `${path(id)}/providers/${encodePathSegment(provider, "provider", errors)}`;
@@ -1154,11 +1175,33 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1154
1175
  "Connection device authorization poll response",
1155
1176
  errors
1156
1177
  );
1178
+ },
1179
+ async createCustomProvider(id, input) {
1180
+ requireBatchSize(input.models, "models", MAX_CUSTOM_PROVIDER_MODELS, errors);
1181
+ return expectAgentConnection(
1182
+ await transport.request(`${path(id)}/custom-providers`, {
1183
+ method: "POST",
1184
+ body: input
1185
+ }),
1186
+ "Create connection custom provider response",
1187
+ errors
1188
+ );
1189
+ },
1190
+ async deleteCustomProvider(id, providerId) {
1191
+ expectEmpty(
1192
+ await transport.request(
1193
+ `${path(id)}/custom-providers/${encodePathSegment(providerId, "custom provider id", errors)}`,
1194
+ { method: "DELETE" }
1195
+ ),
1196
+ "Delete connection custom provider response",
1197
+ errors
1198
+ );
1157
1199
  }
1158
1200
  };
1159
1201
  }
1160
1202
 
1161
1203
  // src/modules/agentCredentials.ts
1204
+ var MAX_CUSTOM_PROVIDER_MODELS2 = 32;
1162
1205
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1163
1206
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1164
1207
  const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
@@ -1250,6 +1293,40 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1250
1293
  "Device authorization poll response",
1251
1294
  errors
1252
1295
  );
1296
+ },
1297
+ async listCustomProviders(options) {
1298
+ return expectObjectArray(
1299
+ await transport.request("/api/v1/credentials/custom-providers", {
1300
+ method: "GET",
1301
+ ...scopeParams(options)
1302
+ }),
1303
+ "Custom provider list response",
1304
+ errors,
1305
+ expectAgentConnectionCustomProvider
1306
+ );
1307
+ },
1308
+ async createCustomProvider(input, options) {
1309
+ requireBatchSize(input.models, "models", MAX_CUSTOM_PROVIDER_MODELS2, errors);
1310
+ return expectObjectArray(
1311
+ await transport.request("/api/v1/credentials/custom-providers", {
1312
+ method: "POST",
1313
+ body: input,
1314
+ ...scopeParams(options)
1315
+ }),
1316
+ "Create custom provider response",
1317
+ errors,
1318
+ expectAgentConnectionCustomProvider
1319
+ );
1320
+ },
1321
+ async deleteCustomProvider(id, options) {
1322
+ expectEmpty(
1323
+ await transport.request(
1324
+ `/api/v1/credentials/custom-providers/${encodePathSegment(id, "custom provider id", errors)}`,
1325
+ { method: "DELETE", ...scopeParams(options) }
1326
+ ),
1327
+ "Delete custom provider response",
1328
+ errors
1329
+ );
1253
1330
  }
1254
1331
  };
1255
1332
  }
@@ -3128,7 +3205,8 @@ var CoreAgentTaskSession = class {
3128
3205
  text: item.text,
3129
3206
  createdAt: item.createdAt,
3130
3207
  ...item.agentType ? { agentType: item.agentType } : {},
3131
- ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {}
3208
+ ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {},
3209
+ ...item.model ? { model: item.model } : {}
3132
3210
  }));
3133
3211
  }
3134
3212
  send(prompt, options = {}) {
@@ -3147,7 +3225,8 @@ var CoreAgentTaskSession = class {
3147
3225
  if (waiter.settled) return waiter.promise;
3148
3226
  const sendOptions = {
3149
3227
  ...options.agentType ? { agentType: options.agentType } : {},
3150
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3228
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3229
+ ...options.model ? { model: options.model } : {}
3151
3230
  };
3152
3231
  if (this.isBusy()) {
3153
3232
  const queueId = this.enqueue(prompt, sendOptions, waiter);
@@ -3284,7 +3363,8 @@ var CoreAgentTaskSession = class {
3284
3363
  type: "message",
3285
3364
  content: prompt,
3286
3365
  ...options.agentType ? { agentType: options.agentType } : {},
3287
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3366
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3367
+ ...options.model ? { model: options.model } : {}
3288
3368
  };
3289
3369
  if (this.isClosed()) {
3290
3370
  await this.sendInput(input).catch(() => void 0);
@@ -3314,6 +3394,7 @@ var CoreAgentTaskSession = class {
3314
3394
  ...createOptions.title ? { title: createOptions.title } : {},
3315
3395
  ...createOptions.agentId ? { agentId: createOptions.agentId } : {},
3316
3396
  ...createOptions.reasoningEffort ? { reasoningEffort: createOptions.reasoningEffort } : {},
3397
+ ...createOptions.model ? { model: createOptions.model } : {},
3317
3398
  ...createOptions.userId ? { userId: createOptions.userId } : {},
3318
3399
  ...createOptions.runtime ? { runtime: createOptions.runtime } : {},
3319
3400
  ...createOptions.scope ? { scope: createOptions.scope } : {}
@@ -3580,7 +3661,8 @@ var CoreAgentTaskSession = class {
3580
3661
  next.text,
3581
3662
  {
3582
3663
  ...next.agentType ? { agentType: next.agentType } : {},
3583
- ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {}
3664
+ ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {},
3665
+ ...next.model ? { model: next.model } : {}
3584
3666
  },
3585
3667
  next.waiter
3586
3668
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitralab.io/sdk-core",
3
- "version": "0.2.5-beta.0",
3
+ "version": "0.2.7-beta.0",
4
4
  "description": "Environment-neutral contracts and modules shared by Mitra JavaScript SDKs",
5
5
  "type": "module",
6
6
  "sideEffects": false,