open-agents-ai 0.187.233 → 0.187.234

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.
Files changed (2) hide show
  1. package/dist/index.js +79 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -323527,6 +323527,81 @@ async function handleV1Models(res, ollamaUrl) {
323527
323527
  });
323528
323528
  }
323529
323529
  }
323530
+ async function fetchAggregatedOllamaTags() {
323531
+ const out = [];
323532
+ modelRouteMap.clear();
323533
+ const nowIso = (/* @__PURE__ */ new Date()).toISOString();
323534
+ const fetches = endpointRegistry.map(async (ep) => {
323535
+ try {
323536
+ const isOllama = ep.type === "ollama";
323537
+ const path5 = isOllama ? "/api/tags" : "/v1/models";
323538
+ const result = await ollamaRequest(ep.url, path5, "GET");
323539
+ if (result.status !== 200) return;
323540
+ const body = JSON.parse(result.body);
323541
+ if (isOllama) {
323542
+ const models = Array.isArray(body.models) ? body.models : [];
323543
+ for (const m2 of models) {
323544
+ const originalId = String(m2.name ?? m2.model ?? "");
323545
+ if (!originalId) continue;
323546
+ const prefixed = `${ep.label}/${originalId}`;
323547
+ modelRouteMap.set(prefixed, { endpoint: ep, originalId });
323548
+ out.push({
323549
+ name: prefixed,
323550
+ model: prefixed,
323551
+ modified_at: String(m2.modified_at ?? nowIso),
323552
+ size: Number(m2.size ?? 0),
323553
+ digest: String(m2.digest ?? ""),
323554
+ details: {
323555
+ parent_model: m2.details?.parent_model,
323556
+ format: String(m2.details?.format ?? "gguf"),
323557
+ family: String(m2.details?.family ?? ""),
323558
+ families: Array.isArray(m2.details?.families) ? m2.details.families : [],
323559
+ parameter_size: String(m2.details?.parameter_size ?? ""),
323560
+ quantization_level: String(m2.details?.quantization_level ?? "")
323561
+ }
323562
+ });
323563
+ }
323564
+ } else {
323565
+ const models = Array.isArray(body.data) ? body.data : [];
323566
+ for (const m2 of models) {
323567
+ const originalId = String(m2.id ?? m2.name ?? "");
323568
+ if (!originalId) continue;
323569
+ const prefixed = `${ep.label}/${originalId}`;
323570
+ modelRouteMap.set(prefixed, { endpoint: ep, originalId });
323571
+ const created = Number(m2.created ?? 0);
323572
+ out.push({
323573
+ name: prefixed,
323574
+ model: prefixed,
323575
+ modified_at: created > 0 ? new Date(created * 1e3).toISOString() : nowIso,
323576
+ size: 0,
323577
+ digest: "",
323578
+ details: {
323579
+ format: "api",
323580
+ family: ep.type || "unknown",
323581
+ families: [ep.type || "unknown"],
323582
+ parameter_size: "",
323583
+ quantization_level: ""
323584
+ }
323585
+ });
323586
+ }
323587
+ }
323588
+ } catch {
323589
+ }
323590
+ });
323591
+ await Promise.allSettled(fetches);
323592
+ return out.sort((a2, b) => a2.name.localeCompare(b.name));
323593
+ }
323594
+ async function handleApiTags(res) {
323595
+ try {
323596
+ const models = await fetchAggregatedOllamaTags();
323597
+ jsonResponse(res, 200, { models });
323598
+ } catch (err) {
323599
+ jsonResponse(res, 502, {
323600
+ error: "Failed to fetch tags",
323601
+ message: err instanceof Error ? err.message : String(err)
323602
+ });
323603
+ }
323604
+ }
323530
323605
  async function handleV1ChatCompletions(req2, res, ollamaUrl) {
323531
323606
  const body = await parseJsonBody(req2);
323532
323607
  if (!body || typeof body !== "object") {
@@ -325764,6 +325839,10 @@ ${steering}`;
325764
325839
  await handleV1Models(res, ollamaUrl);
325765
325840
  return;
325766
325841
  }
325842
+ if (pathname === "/api/tags" && method === "GET") {
325843
+ await handleApiTags(res);
325844
+ return;
325845
+ }
325767
325846
  if (pathname === "/v1/chat/completions" && method === "POST") {
325768
325847
  await handleV1ChatCompletions(req2, res, ollamaUrl);
325769
325848
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.233",
3
+ "version": "0.187.234",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",