@mitralab.io/sdk-core 0.2.6-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
@@ -1273,6 +1273,7 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1273
1273
  }
1274
1274
 
1275
1275
  // src/modules/agentCredentials.ts
1276
+ var MAX_CUSTOM_PROVIDER_MODELS2 = 32;
1276
1277
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1277
1278
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1278
1279
  const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
@@ -1364,6 +1365,40 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1364
1365
  "Device authorization poll response",
1365
1366
  errors
1366
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
+ );
1367
1402
  }
1368
1403
  };
1369
1404
  }
package/dist/index.d.cts CHANGED
@@ -1152,7 +1152,10 @@ interface ProviderCredentialStatus {
1152
1152
  accountEmail: string | null;
1153
1153
  }
1154
1154
  interface AgentConnectionCustomProviderInput {
1155
- /** Name the person chooses for the provider, unique within the connection. */
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
+ */
1156
1159
  name: string;
1157
1160
  /** OpenAI-compatible endpoint, http or https without a query string. */
1158
1161
  baseUrl: string;
@@ -1248,6 +1251,16 @@ interface AgentCredentialsModule {
1248
1251
  startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1249
1252
  /** Polls one device authorization. Respect the returned start interval between calls. */
1250
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>;
1251
1264
  }
1252
1265
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1253
1266
 
package/dist/index.d.ts CHANGED
@@ -1152,7 +1152,10 @@ interface ProviderCredentialStatus {
1152
1152
  accountEmail: string | null;
1153
1153
  }
1154
1154
  interface AgentConnectionCustomProviderInput {
1155
- /** Name the person chooses for the provider, unique within the connection. */
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
+ */
1156
1159
  name: string;
1157
1160
  /** OpenAI-compatible endpoint, http or https without a query string. */
1158
1161
  baseUrl: string;
@@ -1248,6 +1251,16 @@ interface AgentCredentialsModule {
1248
1251
  startDeviceAuthorization(provider: CopilotProvider, options?: AgentCredentialOptions): Promise<DeviceAuthorization>;
1249
1252
  /** Polls one device authorization. Respect the returned start interval between calls. */
1250
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>;
1251
1264
  }
1252
1265
  declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
1253
1266
 
package/dist/index.js CHANGED
@@ -1201,6 +1201,7 @@ function createAgentConnectionsModule(transport, errors = defaultSdkCoreErrorFac
1201
1201
  }
1202
1202
 
1203
1203
  // src/modules/agentCredentials.ts
1204
+ var MAX_CUSTOM_PROVIDER_MODELS2 = 32;
1204
1205
  function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFactory) {
1205
1206
  const providerSegment = (provider) => encodePathSegment(provider, "provider", errors);
1206
1207
  const scopeParams = (options) => options?.scope ? { params: { scope: options.scope } } : {};
@@ -1292,6 +1293,40 @@ function createAgentCredentialsModule(transport, errors = defaultSdkCoreErrorFac
1292
1293
  "Device authorization poll response",
1293
1294
  errors
1294
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
+ );
1295
1330
  }
1296
1331
  };
1297
1332
  }
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.7-beta.0",
4
4
  "description": "Environment-neutral contracts and modules shared by Mitra JavaScript SDKs",
5
5
  "type": "module",
6
6
  "sideEffects": false,