cencori 1.7.5 → 1.8.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.js CHANGED
@@ -32,6 +32,7 @@ __export(src_exports, {
32
32
  ClientTokensNamespace: () => ClientTokensNamespace,
33
33
  ComputeNamespace: () => ComputeNamespace,
34
34
  ConnectionsNamespace: () => ConnectionsNamespace,
35
+ DEFAULT_CATALOG_BASE_URL: () => DEFAULT_CATALOG_BASE_URL,
35
36
  DocumentsNamespace: () => DocumentsNamespace,
36
37
  EndUsersNamespace: () => EndUsersNamespace,
37
38
  InstallationsNamespace: () => InstallationsNamespace,
@@ -62,7 +63,10 @@ __export(src_exports, {
62
63
  cencori: () => cencori,
63
64
  createCencori: () => createCencori,
64
65
  default: () => Cencori,
65
- fetchWithRetry: () => fetchWithRetry
66
+ fetchWithRetry: () => fetchWithRetry,
67
+ listCatalogModels: () => listCatalogModels,
68
+ listCatalogProviders: () => listCatalogProviders,
69
+ providerLogoUrl: () => providerLogoUrl
66
70
  });
67
71
  module.exports = __toCommonJS(src_exports);
68
72
 
@@ -1962,7 +1966,7 @@ var ModelsNamespace = class {
1962
1966
  this.config = config;
1963
1967
  }
1964
1968
  list(params) {
1965
- return request(this.config, "GET", `/v1/models${qs({ provider: params?.provider, type: params?.type, available: params?.available, source: params?.source, connection_id: params?.connection_id })}`);
1969
+ return request(this.config, "GET", `/v1/models${qs({ provider: params?.provider, type: params?.type, available: params?.available, source: params?.source, connection_id: params?.connection_id, limit: params?.limit, cursor: params?.cursor })}`);
1966
1970
  }
1967
1971
  };
1968
1972
  var ProviderConnectionsNamespace = class {
@@ -2045,8 +2049,8 @@ var InstallationsNamespace = class {
2045
2049
  create(params) {
2046
2050
  return request(this.config, "POST", "/v1/agent-installations", params);
2047
2051
  }
2048
- list(tenantId) {
2049
- return request(this.config, "GET", `/v1/agent-installations${qs({ tenant_id: tenantId })}`);
2052
+ list(tenantId, params) {
2053
+ return request(this.config, "GET", `/v1/agent-installations${qs({ tenant_id: tenantId, agent_id: params?.agent_id, limit: params?.limit, cursor: params?.cursor })}`);
2050
2054
  }
2051
2055
  get(installationId) {
2052
2056
  return request(this.config, "GET", `/v1/agent-installations/${installationId}`);
@@ -2071,6 +2075,9 @@ var RunsNamespace = class {
2071
2075
  create(agentId, params, idempotencyKey, options) {
2072
2076
  return request(this.config, "POST", `/v1/agents/${agentId}/runs`, params, idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0, options);
2073
2077
  }
2078
+ history(agentId, params) {
2079
+ return request(this.config, "GET", `/v1/agents/${agentId}/runs${qs({ limit: params?.limit, cursor: params?.cursor })}`);
2080
+ }
2074
2081
  get(runId, options) {
2075
2082
  return request(this.config, "GET", `/v1/runs/${runId}`, void 0, void 0, options);
2076
2083
  }
@@ -2267,6 +2274,20 @@ var McpServersNamespace = class {
2267
2274
  return request(this.config, "POST", `/v1/mcp/servers/${serverId}/refresh-tools`, {});
2268
2275
  }
2269
2276
  };
2277
+ var MarketplaceNamespace = class {
2278
+ constructor(config) {
2279
+ this.config = config;
2280
+ }
2281
+ list(params) {
2282
+ return request(this.config, "GET", `/v1/marketplace/agents${qs({ limit: params?.limit, cursor: params?.cursor })}`);
2283
+ }
2284
+ get(versionId) {
2285
+ return request(this.config, "GET", `/v1/marketplace/agents/${versionId}`);
2286
+ }
2287
+ install(params) {
2288
+ return request(this.config, "POST", "/v1/marketplace/installations", params);
2289
+ }
2290
+ };
2270
2291
  var WebhooksNamespace = class {
2271
2292
  constructor(config) {
2272
2293
  this.config = config;
@@ -2295,10 +2316,10 @@ var UsageNamespace = class {
2295
2316
  this.config = config;
2296
2317
  }
2297
2318
  summary(params) {
2298
- return request(this.config, "GET", `/v1/usage${qs({ days: params?.days, tenant_id: params?.tenant_id, agent_id: params?.agent_id })}`);
2319
+ return request(this.config, "GET", `/v1/usage${qs({ days: params?.days, since: params?.since, until: params?.until, tenant_id: params?.tenant_id, agent_id: params?.agent_id, installation_id: params?.installation_id, model: params?.model })}`);
2299
2320
  }
2300
2321
  events(params) {
2301
- return request(this.config, "GET", `/v1/usage/events${qs({ days: params?.days, tenant_id: params?.tenant_id, agent_id: params?.agent_id, limit: params?.limit, cursor: params?.cursor })}`);
2322
+ return request(this.config, "GET", `/v1/usage/events${qs({ days: params?.days, since: params?.since, until: params?.until, tenant_id: params?.tenant_id, agent_id: params?.agent_id, installation_id: params?.installation_id, model: params?.model, limit: params?.limit, cursor: params?.cursor })}`);
2302
2323
  }
2303
2324
  async exportCsv(params) {
2304
2325
  const search = new URLSearchParams({ format: "csv" });
@@ -2451,6 +2472,7 @@ var Cencori = class {
2451
2472
  this.knowledge = new KnowledgeNamespace2(this.config);
2452
2473
  this.connections = new ConnectionsNamespace(this.config);
2453
2474
  this.mcpServers = new McpServersNamespace(this.config);
2475
+ this.marketplace = new MarketplaceNamespace(this.config);
2454
2476
  this.skills = new SkillsNamespace(this.config);
2455
2477
  this.skillImports = new SkillImportsNamespace(this.config);
2456
2478
  this.webhooks = new WebhooksNamespace(this.config);
@@ -2541,6 +2563,45 @@ var Cencori = class {
2541
2563
  }
2542
2564
  };
2543
2565
 
2566
+ // src/catalog/index.ts
2567
+ var DEFAULT_CATALOG_BASE_URL = "https://cencori.com";
2568
+ function baseUrlOf(options) {
2569
+ return (options?.baseUrl ?? DEFAULT_CATALOG_BASE_URL).replace(/\/$/, "");
2570
+ }
2571
+ function modelQuery(filters) {
2572
+ const search = new URLSearchParams();
2573
+ if (filters?.provider) search.set("provider", filters.provider);
2574
+ if (filters?.type) search.set("type", filters.type);
2575
+ if (filters?.search) search.set("search", filters.search);
2576
+ const caps = filters?.capability ? Array.isArray(filters.capability) ? filters.capability : [filters.capability] : [];
2577
+ for (const cap of caps) search.append("capability", cap);
2578
+ const s = search.toString();
2579
+ return s ? `?${s}` : "";
2580
+ }
2581
+ async function getJson(url, signal) {
2582
+ const response = await fetch(url, { signal });
2583
+ if (!response.ok) {
2584
+ const body = await response.text().catch(() => "");
2585
+ throw new Error(`Catalog request failed (${response.status} ${url})${body ? `: ${body.slice(0, 200)}` : ""}`);
2586
+ }
2587
+ return response.json();
2588
+ }
2589
+ function listCatalogModels(filters, options) {
2590
+ return getJson(
2591
+ `${baseUrlOf(options)}/api/models${modelQuery(filters)}`,
2592
+ options?.signal
2593
+ );
2594
+ }
2595
+ function listCatalogProviders(options) {
2596
+ return getJson(
2597
+ `${baseUrlOf(options)}/api/providers`,
2598
+ options?.signal
2599
+ );
2600
+ }
2601
+ function providerLogoUrl(providerId, baseUrl = DEFAULT_CATALOG_BASE_URL) {
2602
+ return `${baseUrl.replace(/\/$/, "")}/api/providers/${encodeURIComponent(providerId)}/logo`;
2603
+ }
2604
+
2544
2605
  // src/vercel/cencori-chat-model.ts
2545
2606
  var CencoriChatLanguageModel = class {
2546
2607
  constructor(modelId, settings) {
@@ -2893,6 +2954,7 @@ cencori.chat = cencori;
2893
2954
  ClientTokensNamespace,
2894
2955
  ComputeNamespace,
2895
2956
  ConnectionsNamespace,
2957
+ DEFAULT_CATALOG_BASE_URL,
2896
2958
  DocumentsNamespace,
2897
2959
  EndUsersNamespace,
2898
2960
  InstallationsNamespace,
@@ -2922,6 +2984,9 @@ cencori.chat = cencori;
2922
2984
  WorkflowNamespace,
2923
2985
  cencori,
2924
2986
  createCencori,
2925
- fetchWithRetry
2987
+ fetchWithRetry,
2988
+ listCatalogModels,
2989
+ listCatalogProviders,
2990
+ providerLogoUrl
2926
2991
  });
2927
2992
  //# sourceMappingURL=index.js.map