@mitralab.io/sdk-core 0.2.6-beta.0 → 0.2.8-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,7 +996,6 @@ 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);
1000
999
  if (typeof task.agentType !== "string") invalidField(context, "agentType", errors);
1001
1000
  if (typeof task.archived !== "boolean") invalidField(context, "archived", errors);
1002
1001
  if (!isNullableString(task.createdAt)) invalidField(context, "createdAt", errors);
@@ -1273,6 +1272,7 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1273
1272
  }
1274
1273
 
1275
1274
  // src/modules/agentCredentials.ts
1275
+ var MAX_CUSTOM_PROVIDER_MODELS2 = 32;
1276
1276
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1277
1277
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1278
1278
  const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
@@ -1364,6 +1364,40 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1364
1364
  "Device authorization poll response",
1365
1365
  errors
1366
1366
  );
1367
+ },
1368
+ async listCustomProviders(options) {
1369
+ return expectObjectArray(
1370
+ await transport.request("/api/v1/credentials/custom-providers", {
1371
+ method: "GET",
1372
+ ...scopeParams(options)
1373
+ }),
1374
+ "Custom provider list response",
1375
+ errors,
1376
+ expectAgentConnectionCustomProvider
1377
+ );
1378
+ },
1379
+ async createCustomProvider(input, options) {
1380
+ requireBatchSize(input.models, "models", MAX_CUSTOM_PROVIDER_MODELS2, errors);
1381
+ return expectObjectArray(
1382
+ await transport.request("/api/v1/credentials/custom-providers", {
1383
+ method: "POST",
1384
+ body: input,
1385
+ ...scopeParams(options)
1386
+ }),
1387
+ "Create custom provider response",
1388
+ errors,
1389
+ expectAgentConnectionCustomProvider
1390
+ );
1391
+ },
1392
+ async deleteCustomProvider(id, options) {
1393
+ expectEmpty(
1394
+ await transport.request(
1395
+ `/api/v1/credentials/custom-providers/${encodePathSegment(id, "custom provider id", errors)}`,
1396
+ { method: "DELETE", ...scopeParams(options) }
1397
+ ),
1398
+ "Delete custom provider response",
1399
+ errors
1400
+ );
1367
1401
  }
1368
1402
  };
1369
1403
  }
@@ -3242,8 +3276,7 @@ var CoreAgentTaskSession = class {
3242
3276
  text: item.text,
3243
3277
  createdAt: item.createdAt,
3244
3278
  ...item.agentType ? { agentType: item.agentType } : {},
3245
- ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {},
3246
- ...item.model ? { model: item.model } : {}
3279
+ ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {}
3247
3280
  }));
3248
3281
  }
3249
3282
  send(prompt, options = {}) {
@@ -3262,8 +3295,7 @@ var CoreAgentTaskSession = class {
3262
3295
  if (waiter.settled) return waiter.promise;
3263
3296
  const sendOptions = {
3264
3297
  ...options.agentType ? { agentType: options.agentType } : {},
3265
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3266
- ...options.model ? { model: options.model } : {}
3298
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3267
3299
  };
3268
3300
  if (this.isBusy()) {
3269
3301
  const queueId = this.enqueue(prompt, sendOptions, waiter);
@@ -3400,8 +3432,7 @@ var CoreAgentTaskSession = class {
3400
3432
  type: "message",
3401
3433
  content: prompt,
3402
3434
  ...options.agentType ? { agentType: options.agentType } : {},
3403
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3404
- ...options.model ? { model: options.model } : {}
3435
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3405
3436
  };
3406
3437
  if (this.isClosed()) {
3407
3438
  await this.sendInput(input).catch(() => void 0);
@@ -3431,7 +3462,6 @@ var CoreAgentTaskSession = class {
3431
3462
  ...createOptions.title ? { title: createOptions.title } : {},
3432
3463
  ...createOptions.agentId ? { agentId: createOptions.agentId } : {},
3433
3464
  ...createOptions.reasoningEffort ? { reasoningEffort: createOptions.reasoningEffort } : {},
3434
- ...createOptions.model ? { model: createOptions.model } : {},
3435
3465
  ...createOptions.userId ? { userId: createOptions.userId } : {},
3436
3466
  ...createOptions.runtime ? { runtime: createOptions.runtime } : {},
3437
3467
  ...createOptions.scope ? { scope: createOptions.scope } : {}
@@ -3698,8 +3728,7 @@ var CoreAgentTaskSession = class {
3698
3728
  next.text,
3699
3729
  {
3700
3730
  ...next.agentType ? { agentType: next.agentType } : {},
3701
- ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {},
3702
- ...next.model ? { model: next.model } : {}
3731
+ ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {}
3703
3732
  },
3704
3733
  next.waiter
3705
3734
  );
package/dist/index.d.cts CHANGED
@@ -1033,8 +1033,6 @@ 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;
1038
1036
  /** Optional runtime. Core never defaults it; the concrete SDK decides what to send. */
1039
1037
  runtime?: AgentTaskRuntime;
1040
1038
  /** Optional credential scope. Core never defaults it; the concrete SDK decides what to send. */
@@ -1057,8 +1055,6 @@ interface AgentTask {
1057
1055
  reasoningEffort: string | null;
1058
1056
  /** Absent on a Copilot that predates credential scopes; null on a task without one. */
1059
1057
  scope?: AgentCredentialScope | null;
1060
- /** Absent on a Copilot that predates custom providers; null on a task without an explicit model. */
1061
- model?: string | null;
1062
1058
  archived: boolean;
1063
1059
  createdAt: string | null;
1064
1060
  updatedAt: string;
@@ -1078,8 +1074,6 @@ type AgentTaskInput = {
1078
1074
  content: string;
1079
1075
  agentType?: string;
1080
1076
  reasoningEffort?: string;
1081
- /** Catalog model id. */
1082
- model?: string;
1083
1077
  } | {
1084
1078
  type: "interrupt";
1085
1079
  } | {
@@ -1152,7 +1146,10 @@ interface ProviderCredentialStatus {
1152
1146
  accountEmail: string | null;
1153
1147
  }
1154
1148
  interface AgentConnectionCustomProviderInput {
1155
- /** Name the person chooses for the provider, unique within the connection. */
1149
+ /**
1150
+ * Name the person chooses for the provider, unique within the connection, or within the
1151
+ * person's account on the credentials surface.
1152
+ */
1156
1153
  name: string;
1157
1154
  /** OpenAI-compatible endpoint, http or https without a query string. */
1158
1155
  baseUrl: string;
@@ -1248,6 +1245,16 @@ interface AgentCredentialsModule {
1248
1245
  startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1249
1246
  /** Polls one device authorization. Respect the returned start interval between calls. */
1250
1247
  pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1248
+ /** Lists the person's OpenAI-compatible providers. The API key is returned masked. */
1249
+ listCustomProviders(options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1250
+ /**
1251
+ * Adds an OpenAI-compatible provider under a name the person chooses and returns the person's
1252
+ * list after creation. Its models join the catalog as `custom/<providerId>/<model>`; the API
1253
+ * key is write-only. Copilot requires scope ACCOUNT on an app token.
1254
+ */
1255
+ createCustomProvider(input: AgentConnectionCustomProviderInput, options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1256
+ /** Permanently removes one of the person's custom providers. */
1257
+ deleteCustomProvider(id: string, options?: AgentCredentialOptions): Promise<void>;
1251
1258
  }
1252
1259
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1253
1260
 
@@ -1778,8 +1785,6 @@ interface NewAgentTaskSessionOptions {
1778
1785
  title?: string;
1779
1786
  agentId?: string;
1780
1787
  reasoningEffort?: string;
1781
- /** Catalog model id. */
1782
- model?: string;
1783
1788
  userId?: string;
1784
1789
  /** Runtime the task is born on. Omitted means the Copilot server default. */
1785
1790
  runtime?: AgentTaskRuntime;
@@ -1796,8 +1801,6 @@ type AgentTaskSessionOptions = NewAgentTaskSessionOptions | ExistingAgentTaskSes
1796
1801
  interface AgentSendOptions {
1797
1802
  agentType?: string;
1798
1803
  reasoningEffort?: string;
1799
- /** Catalog model id. */
1800
- model?: string;
1801
1804
  }
1802
1805
  interface AgentSendAndWaitOptions extends AgentSendOptions {
1803
1806
  signal?: AbortSignal;
package/dist/index.d.ts CHANGED
@@ -1033,8 +1033,6 @@ 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;
1038
1036
  /** Optional runtime. Core never defaults it; the concrete SDK decides what to send. */
1039
1037
  runtime?: AgentTaskRuntime;
1040
1038
  /** Optional credential scope. Core never defaults it; the concrete SDK decides what to send. */
@@ -1057,8 +1055,6 @@ interface AgentTask {
1057
1055
  reasoningEffort: string | null;
1058
1056
  /** Absent on a Copilot that predates credential scopes; null on a task without one. */
1059
1057
  scope?: AgentCredentialScope | null;
1060
- /** Absent on a Copilot that predates custom providers; null on a task without an explicit model. */
1061
- model?: string | null;
1062
1058
  archived: boolean;
1063
1059
  createdAt: string | null;
1064
1060
  updatedAt: string;
@@ -1078,8 +1074,6 @@ type AgentTaskInput = {
1078
1074
  content: string;
1079
1075
  agentType?: string;
1080
1076
  reasoningEffort?: string;
1081
- /** Catalog model id. */
1082
- model?: string;
1083
1077
  } | {
1084
1078
  type: "interrupt";
1085
1079
  } | {
@@ -1152,7 +1146,10 @@ interface ProviderCredentialStatus {
1152
1146
  accountEmail: string | null;
1153
1147
  }
1154
1148
  interface AgentConnectionCustomProviderInput {
1155
- /** Name the person chooses for the provider, unique within the connection. */
1149
+ /**
1150
+ * Name the person chooses for the provider, unique within the connection, or within the
1151
+ * person's account on the credentials surface.
1152
+ */
1156
1153
  name: string;
1157
1154
  /** OpenAI-compatible endpoint, http or https without a query string. */
1158
1155
  baseUrl: string;
@@ -1248,6 +1245,16 @@ interface AgentCredentialsModule {
1248
1245
  startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1249
1246
  /** Polls one device authorization. Respect the returned start interval between calls. */
1250
1247
  pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string, options?: AgentCredentialOptions): Promise<AuthenticationResult>;
1248
+ /** Lists the person's OpenAI-compatible providers. The API key is returned masked. */
1249
+ listCustomProviders(options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1250
+ /**
1251
+ * Adds an OpenAI-compatible provider under a name the person chooses and returns the person's
1252
+ * list after creation. Its models join the catalog as `custom/<providerId>/<model>`; the API
1253
+ * key is write-only. Copilot requires scope ACCOUNT on an app token.
1254
+ */
1255
+ createCustomProvider(input: AgentConnectionCustomProviderInput, options?: AgentCredentialOptions): Promise<AgentConnectionCustomProvider[]>;
1256
+ /** Permanently removes one of the person's custom providers. */
1257
+ deleteCustomProvider(id: string, options?: AgentCredentialOptions): Promise<void>;
1251
1258
  }
1252
1259
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1253
1260
 
@@ -1778,8 +1785,6 @@ interface NewAgentTaskSessionOptions {
1778
1785
  title?: string;
1779
1786
  agentId?: string;
1780
1787
  reasoningEffort?: string;
1781
- /** Catalog model id. */
1782
- model?: string;
1783
1788
  userId?: string;
1784
1789
  /** Runtime the task is born on. Omitted means the Copilot server default. */
1785
1790
  runtime?: AgentTaskRuntime;
@@ -1796,8 +1801,6 @@ type AgentTaskSessionOptions = NewAgentTaskSessionOptions | ExistingAgentTaskSes
1796
1801
  interface AgentSendOptions {
1797
1802
  agentType?: string;
1798
1803
  reasoningEffort?: string;
1799
- /** Catalog model id. */
1800
- model?: string;
1801
1804
  }
1802
1805
  interface AgentSendAndWaitOptions extends AgentSendOptions {
1803
1806
  signal?: AbortSignal;
package/dist/index.js CHANGED
@@ -924,7 +924,6 @@ 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);
928
927
  if (typeof task.agentType !== "string") invalidField(context, "agentType", errors);
929
928
  if (typeof task.archived !== "boolean") invalidField(context, "archived", errors);
930
929
  if (!isNullableString(task.createdAt)) invalidField(context, "createdAt", errors);
@@ -1201,6 +1200,7 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1201
1200
  }
1202
1201
 
1203
1202
  // src/modules/agentCredentials.ts
1203
+ var MAX_CUSTOM_PROVIDER_MODELS2 = 32;
1204
1204
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1205
1205
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1206
1206
  const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
@@ -1292,6 +1292,40 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1292
1292
  "Device authorization poll response",
1293
1293
  errors
1294
1294
  );
1295
+ },
1296
+ async listCustomProviders(options) {
1297
+ return expectObjectArray(
1298
+ await transport.request("/api/v1/credentials/custom-providers", {
1299
+ method: "GET",
1300
+ ...scopeParams(options)
1301
+ }),
1302
+ "Custom provider list response",
1303
+ errors,
1304
+ expectAgentConnectionCustomProvider
1305
+ );
1306
+ },
1307
+ async createCustomProvider(input, options) {
1308
+ requireBatchSize(input.models, "models", MAX_CUSTOM_PROVIDER_MODELS2, errors);
1309
+ return expectObjectArray(
1310
+ await transport.request("/api/v1/credentials/custom-providers", {
1311
+ method: "POST",
1312
+ body: input,
1313
+ ...scopeParams(options)
1314
+ }),
1315
+ "Create custom provider response",
1316
+ errors,
1317
+ expectAgentConnectionCustomProvider
1318
+ );
1319
+ },
1320
+ async deleteCustomProvider(id, options) {
1321
+ expectEmpty(
1322
+ await transport.request(
1323
+ `/api/v1/credentials/custom-providers/${encodePathSegment(id, "custom provider id", errors)}`,
1324
+ { method: "DELETE", ...scopeParams(options) }
1325
+ ),
1326
+ "Delete custom provider response",
1327
+ errors
1328
+ );
1295
1329
  }
1296
1330
  };
1297
1331
  }
@@ -3170,8 +3204,7 @@ var CoreAgentTaskSession = class {
3170
3204
  text: item.text,
3171
3205
  createdAt: item.createdAt,
3172
3206
  ...item.agentType ? { agentType: item.agentType } : {},
3173
- ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {},
3174
- ...item.model ? { model: item.model } : {}
3207
+ ...item.reasoningEffort ? { reasoningEffort: item.reasoningEffort } : {}
3175
3208
  }));
3176
3209
  }
3177
3210
  send(prompt, options = {}) {
@@ -3190,8 +3223,7 @@ var CoreAgentTaskSession = class {
3190
3223
  if (waiter.settled) return waiter.promise;
3191
3224
  const sendOptions = {
3192
3225
  ...options.agentType ? { agentType: options.agentType } : {},
3193
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3194
- ...options.model ? { model: options.model } : {}
3226
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3195
3227
  };
3196
3228
  if (this.isBusy()) {
3197
3229
  const queueId = this.enqueue(prompt, sendOptions, waiter);
@@ -3328,8 +3360,7 @@ var CoreAgentTaskSession = class {
3328
3360
  type: "message",
3329
3361
  content: prompt,
3330
3362
  ...options.agentType ? { agentType: options.agentType } : {},
3331
- ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
3332
- ...options.model ? { model: options.model } : {}
3363
+ ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {}
3333
3364
  };
3334
3365
  if (this.isClosed()) {
3335
3366
  await this.sendInput(input).catch(() => void 0);
@@ -3359,7 +3390,6 @@ var CoreAgentTaskSession = class {
3359
3390
  ...createOptions.title ? { title: createOptions.title } : {},
3360
3391
  ...createOptions.agentId ? { agentId: createOptions.agentId } : {},
3361
3392
  ...createOptions.reasoningEffort ? { reasoningEffort: createOptions.reasoningEffort } : {},
3362
- ...createOptions.model ? { model: createOptions.model } : {},
3363
3393
  ...createOptions.userId ? { userId: createOptions.userId } : {},
3364
3394
  ...createOptions.runtime ? { runtime: createOptions.runtime } : {},
3365
3395
  ...createOptions.scope ? { scope: createOptions.scope } : {}
@@ -3626,8 +3656,7 @@ var CoreAgentTaskSession = class {
3626
3656
  next.text,
3627
3657
  {
3628
3658
  ...next.agentType ? { agentType: next.agentType } : {},
3629
- ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {},
3630
- ...next.model ? { model: next.model } : {}
3659
+ ...next.reasoningEffort ? { reasoningEffort: next.reasoningEffort } : {}
3631
3660
  },
3632
3661
  next.waiter
3633
3662
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitralab.io/sdk-core",
3
- "version": "0.2.6-beta.0",
3
+ "version": "0.2.8-beta.0",
4
4
  "description": "Environment-neutral contracts and modules shared by Mitra JavaScript SDKs",
5
5
  "type": "module",
6
6
  "sideEffects": false,