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.mjs CHANGED
@@ -1894,7 +1894,7 @@ var ModelsNamespace = class {
1894
1894
  this.config = config;
1895
1895
  }
1896
1896
  list(params) {
1897
- 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 })}`);
1897
+ 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 })}`);
1898
1898
  }
1899
1899
  };
1900
1900
  var ProviderConnectionsNamespace = class {
@@ -1977,8 +1977,8 @@ var InstallationsNamespace = class {
1977
1977
  create(params) {
1978
1978
  return request(this.config, "POST", "/v1/agent-installations", params);
1979
1979
  }
1980
- list(tenantId) {
1981
- return request(this.config, "GET", `/v1/agent-installations${qs({ tenant_id: tenantId })}`);
1980
+ list(tenantId, params) {
1981
+ return request(this.config, "GET", `/v1/agent-installations${qs({ tenant_id: tenantId, agent_id: params?.agent_id, limit: params?.limit, cursor: params?.cursor })}`);
1982
1982
  }
1983
1983
  get(installationId) {
1984
1984
  return request(this.config, "GET", `/v1/agent-installations/${installationId}`);
@@ -2003,6 +2003,9 @@ var RunsNamespace = class {
2003
2003
  create(agentId, params, idempotencyKey, options) {
2004
2004
  return request(this.config, "POST", `/v1/agents/${agentId}/runs`, params, idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0, options);
2005
2005
  }
2006
+ history(agentId, params) {
2007
+ return request(this.config, "GET", `/v1/agents/${agentId}/runs${qs({ limit: params?.limit, cursor: params?.cursor })}`);
2008
+ }
2006
2009
  get(runId, options) {
2007
2010
  return request(this.config, "GET", `/v1/runs/${runId}`, void 0, void 0, options);
2008
2011
  }
@@ -2199,6 +2202,20 @@ var McpServersNamespace = class {
2199
2202
  return request(this.config, "POST", `/v1/mcp/servers/${serverId}/refresh-tools`, {});
2200
2203
  }
2201
2204
  };
2205
+ var MarketplaceNamespace = class {
2206
+ constructor(config) {
2207
+ this.config = config;
2208
+ }
2209
+ list(params) {
2210
+ return request(this.config, "GET", `/v1/marketplace/agents${qs({ limit: params?.limit, cursor: params?.cursor })}`);
2211
+ }
2212
+ get(versionId) {
2213
+ return request(this.config, "GET", `/v1/marketplace/agents/${versionId}`);
2214
+ }
2215
+ install(params) {
2216
+ return request(this.config, "POST", "/v1/marketplace/installations", params);
2217
+ }
2218
+ };
2202
2219
  var WebhooksNamespace = class {
2203
2220
  constructor(config) {
2204
2221
  this.config = config;
@@ -2227,10 +2244,10 @@ var UsageNamespace = class {
2227
2244
  this.config = config;
2228
2245
  }
2229
2246
  summary(params) {
2230
- return request(this.config, "GET", `/v1/usage${qs({ days: params?.days, tenant_id: params?.tenant_id, agent_id: params?.agent_id })}`);
2247
+ 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 })}`);
2231
2248
  }
2232
2249
  events(params) {
2233
- 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 })}`);
2250
+ 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 })}`);
2234
2251
  }
2235
2252
  async exportCsv(params) {
2236
2253
  const search = new URLSearchParams({ format: "csv" });
@@ -2383,6 +2400,7 @@ var Cencori = class {
2383
2400
  this.knowledge = new KnowledgeNamespace2(this.config);
2384
2401
  this.connections = new ConnectionsNamespace(this.config);
2385
2402
  this.mcpServers = new McpServersNamespace(this.config);
2403
+ this.marketplace = new MarketplaceNamespace(this.config);
2386
2404
  this.skills = new SkillsNamespace(this.config);
2387
2405
  this.skillImports = new SkillImportsNamespace(this.config);
2388
2406
  this.webhooks = new WebhooksNamespace(this.config);
@@ -2473,6 +2491,45 @@ var Cencori = class {
2473
2491
  }
2474
2492
  };
2475
2493
 
2494
+ // src/catalog/index.ts
2495
+ var DEFAULT_CATALOG_BASE_URL = "https://cencori.com";
2496
+ function baseUrlOf(options) {
2497
+ return (options?.baseUrl ?? DEFAULT_CATALOG_BASE_URL).replace(/\/$/, "");
2498
+ }
2499
+ function modelQuery(filters) {
2500
+ const search = new URLSearchParams();
2501
+ if (filters?.provider) search.set("provider", filters.provider);
2502
+ if (filters?.type) search.set("type", filters.type);
2503
+ if (filters?.search) search.set("search", filters.search);
2504
+ const caps = filters?.capability ? Array.isArray(filters.capability) ? filters.capability : [filters.capability] : [];
2505
+ for (const cap of caps) search.append("capability", cap);
2506
+ const s = search.toString();
2507
+ return s ? `?${s}` : "";
2508
+ }
2509
+ async function getJson(url, signal) {
2510
+ const response = await fetch(url, { signal });
2511
+ if (!response.ok) {
2512
+ const body = await response.text().catch(() => "");
2513
+ throw new Error(`Catalog request failed (${response.status} ${url})${body ? `: ${body.slice(0, 200)}` : ""}`);
2514
+ }
2515
+ return response.json();
2516
+ }
2517
+ function listCatalogModels(filters, options) {
2518
+ return getJson(
2519
+ `${baseUrlOf(options)}/api/models${modelQuery(filters)}`,
2520
+ options?.signal
2521
+ );
2522
+ }
2523
+ function listCatalogProviders(options) {
2524
+ return getJson(
2525
+ `${baseUrlOf(options)}/api/providers`,
2526
+ options?.signal
2527
+ );
2528
+ }
2529
+ function providerLogoUrl(providerId, baseUrl = DEFAULT_CATALOG_BASE_URL) {
2530
+ return `${baseUrl.replace(/\/$/, "")}/api/providers/${encodeURIComponent(providerId)}/logo`;
2531
+ }
2532
+
2476
2533
  // src/vercel/cencori-chat-model.ts
2477
2534
  var CencoriChatLanguageModel = class {
2478
2535
  constructor(modelId, settings) {
@@ -2824,6 +2881,7 @@ export {
2824
2881
  ClientTokensNamespace,
2825
2882
  ComputeNamespace,
2826
2883
  ConnectionsNamespace,
2884
+ DEFAULT_CATALOG_BASE_URL,
2827
2885
  DocumentsNamespace,
2828
2886
  EndUsersNamespace,
2829
2887
  InstallationsNamespace,
@@ -2854,6 +2912,9 @@ export {
2854
2912
  cencori,
2855
2913
  createCencori,
2856
2914
  Cencori as default,
2857
- fetchWithRetry
2915
+ fetchWithRetry,
2916
+ listCatalogModels,
2917
+ listCatalogProviders,
2918
+ providerLogoUrl
2858
2919
  };
2859
2920
  //# sourceMappingURL=index.mjs.map