nexus-agents 2.72.1 → 2.73.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.
@@ -40,7 +40,7 @@ import {
40
40
  } from "./chunk-GOT7OAL5.js";
41
41
 
42
42
  // src/version.ts
43
- var VERSION = true ? "2.72.1" : "dev";
43
+ var VERSION = true ? "2.73.0" : "dev";
44
44
 
45
45
  // src/config/schemas-core.ts
46
46
  import { z } from "zod";
@@ -1296,6 +1296,182 @@ function getConfig(options) {
1296
1296
  return loadedConfig;
1297
1297
  }
1298
1298
 
1299
+ // src/config/model-identity.ts
1300
+ var VENDOR_PATTERNS = [
1301
+ { vendor: "anthropic", regex: /\b(claude|anthropic)\b/ },
1302
+ // OpenAI: gpt, o1-o9 reasoning, chatgpt, openai prefix
1303
+ { vendor: "openai", regex: /\b(gpt|o[1-9]|chatgpt|openai)\b/ },
1304
+ { vendor: "google", regex: /\b(gemini|bison|gecko|palm|google)\b/ },
1305
+ { vendor: "meta", regex: /\b(llama|meta-llama|meta)\b/ },
1306
+ { vendor: "qwen", regex: /\b(qwen)\b/ },
1307
+ { vendor: "nvidia", regex: /\b(nemotron|nvidia)\b/ },
1308
+ { vendor: "mistral", regex: /\b(mistral|mixtral|codestral)\b/ },
1309
+ { vendor: "cohere", regex: /\b(command-r|command|cohere)\b/ },
1310
+ { vendor: "deepseek", regex: /\b(deepseek)\b/ }
1311
+ ];
1312
+ var FAMILY_PATTERNS = [
1313
+ // Anthropic
1314
+ { vendor: "anthropic", family: "claude-opus", regex: /\b(opus)\b/ },
1315
+ { vendor: "anthropic", family: "claude-sonnet", regex: /\b(sonnet)\b/ },
1316
+ { vendor: "anthropic", family: "claude-haiku", regex: /\b(haiku)\b/ },
1317
+ // OpenAI
1318
+ { vendor: "openai", family: "o-reasoning", regex: /\bo[1-9]\b/ },
1319
+ { vendor: "openai", family: "gpt-4o", regex: /\b(gpt-4o|gpt4o|4o)\b/ },
1320
+ { vendor: "openai", family: "gpt-4", regex: /\b(gpt-4)\b/ },
1321
+ { vendor: "openai", family: "gpt-3.5", regex: /\b(gpt-3-5|gpt-3\.5|gpt35)\b/ },
1322
+ // Google
1323
+ { vendor: "google", family: "gemini-pro", regex: /\bgemini.*\bpro\b/ },
1324
+ { vendor: "google", family: "gemini-flash", regex: /\bgemini.*\bflash\b/ },
1325
+ { vendor: "google", family: "gemini", regex: /\bgemini\b/ },
1326
+ // Meta
1327
+ { vendor: "meta", family: "llama-3", regex: /\bllama-?3\b/ },
1328
+ { vendor: "meta", family: "llama-2", regex: /\bllama-?2\b/ },
1329
+ // Qwen — version is in the family name
1330
+ { vendor: "qwen", family: "qwen-3", regex: /\bqwen-?3\b/ },
1331
+ { vendor: "qwen", family: "qwen-2.5", regex: /\bqwen-?2-?5\b/ },
1332
+ { vendor: "qwen", family: "qwen-2", regex: /\bqwen-?2\b/ },
1333
+ // Mistral
1334
+ { vendor: "mistral", family: "mixtral", regex: /\bmixtral\b/ },
1335
+ { vendor: "mistral", family: "codestral", regex: /\bcodestral\b/ },
1336
+ { vendor: "mistral", family: "mistral", regex: /\bmistral\b/ }
1337
+ ];
1338
+ var QUIRK_PATTERNS = [
1339
+ { regex: /\b(embedding|embed)\b/, quirk: "embedding" },
1340
+ { regex: /\b(thinking|reasoning)\b/, quirk: "thinking" },
1341
+ { regex: /\bvision\b/, quirk: "vision" },
1342
+ { regex: /\b(coder|code)\b/, quirk: "coder" },
1343
+ { regex: /\binstruct\b/, quirk: "instruct" },
1344
+ { regex: /\b(mini|nano|tiny|small|lite)\b/, quirk: "small" },
1345
+ { regex: /\b(large|xl|big|maxi)\b/, quirk: "large" },
1346
+ { regex: /\bhigh\b/, quirk: "high-variant" },
1347
+ { regex: /\b(\d+)b\b/, quirk: "sized-suffix" },
1348
+ // 7b, 70b, 405b
1349
+ { regex: /\b(?:\d{8}|\d{4}-\d{2}-\d{2}|\d{4}-\d{2})\b/, quirk: "dated" }
1350
+ // 20240806 / 2024-08-06 / 2024-08
1351
+ ];
1352
+ async function resolveModelIdentity(adapter, options = {}) {
1353
+ const rawModelId = adapter.modelId;
1354
+ const hints = options.hints ?? {};
1355
+ let probe;
1356
+ if (options.skipProbe !== true && typeof adapter.listModels === "function") {
1357
+ probe = await runProbe(adapter, rawModelId);
1358
+ }
1359
+ const parsed = parseModelId(rawModelId);
1360
+ return mergeIdentity({ rawModelId, hints, probe, parsed });
1361
+ }
1362
+ function resolveModelIdentitySync(modelId, hints) {
1363
+ return mergeIdentity({
1364
+ rawModelId: modelId,
1365
+ hints: hints ?? {},
1366
+ probe: void 0,
1367
+ parsed: parseModelId(modelId)
1368
+ });
1369
+ }
1370
+ function parseModelId(modelId) {
1371
+ const normalised = normaliseModelId(modelId);
1372
+ const vendor = detectVendor(normalised);
1373
+ const family = vendor !== void 0 ? detectFamily(normalised, vendor) : void 0;
1374
+ const version = vendor !== void 0 && family !== void 0 ? extractVersion(normalised, family) : void 0;
1375
+ const quirks = detectQuirks(normalised);
1376
+ return {
1377
+ ...vendor !== void 0 && { vendor },
1378
+ ...family !== void 0 && { family },
1379
+ ...version !== void 0 && { version },
1380
+ quirks
1381
+ };
1382
+ }
1383
+ function normaliseModelId(modelId) {
1384
+ return modelId.toLowerCase().replace(/[_/]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
1385
+ }
1386
+ function detectVendor(normalised) {
1387
+ for (const { vendor, regex } of VENDOR_PATTERNS) {
1388
+ if (regex.test(normalised)) return vendor;
1389
+ }
1390
+ return void 0;
1391
+ }
1392
+ function detectFamily(normalised, vendor) {
1393
+ for (const fp of FAMILY_PATTERNS) {
1394
+ if (fp.vendor !== vendor) continue;
1395
+ if (fp.regex.test(normalised)) return fp.family;
1396
+ }
1397
+ return void 0;
1398
+ }
1399
+ function extractVersion(normalised, family) {
1400
+ const familyRoot = family.replace(/^claude-|^gemini-|^llama-|^qwen-|^gpt-/, "");
1401
+ const idx = normalised.indexOf(familyRoot);
1402
+ if (idx === -1) return void 0;
1403
+ const tail = normalised.slice(idx + familyRoot.length);
1404
+ const m = /^[-]?(\d[\d.\-]*)/.exec(tail);
1405
+ if (m === null) return void 0;
1406
+ return m[1]?.replace(/-+$/, "") ?? void 0;
1407
+ }
1408
+ function detectQuirks(normalised) {
1409
+ const out = [];
1410
+ for (const { regex, quirk } of QUIRK_PATTERNS) {
1411
+ if (regex.test(normalised) && !out.includes(quirk)) out.push(quirk);
1412
+ }
1413
+ return out;
1414
+ }
1415
+ async function runProbe(adapter, modelId) {
1416
+ try {
1417
+ const capable = adapter;
1418
+ const models = await capable.listModels();
1419
+ const matched = models.find((m) => m.id === modelId);
1420
+ if (matched === void 0) return void 0;
1421
+ const result = { metadata: matched };
1422
+ if (matched.ownedBy !== void 0) {
1423
+ const vendor = vendorFromOwnedBy(matched.ownedBy);
1424
+ if (vendor !== void 0) {
1425
+ return { ...result, vendor };
1426
+ }
1427
+ }
1428
+ return result;
1429
+ } catch {
1430
+ return void 0;
1431
+ }
1432
+ }
1433
+ var OWNED_BY_PATTERNS = [
1434
+ { substr: "anthropic", vendor: "anthropic" },
1435
+ { substr: "openai", vendor: "openai" },
1436
+ { substr: "google", vendor: "google" },
1437
+ { substr: "meta", vendor: "meta" },
1438
+ { substr: "alibaba", vendor: "qwen" },
1439
+ { substr: "qwen", vendor: "qwen" },
1440
+ { substr: "nvidia", vendor: "nvidia" },
1441
+ { substr: "nemotron", vendor: "nvidia" },
1442
+ { substr: "mistral", vendor: "mistral" },
1443
+ { substr: "cohere", vendor: "cohere" },
1444
+ { substr: "deepseek", vendor: "deepseek" }
1445
+ ];
1446
+ function vendorFromOwnedBy(ownedBy) {
1447
+ const lc = ownedBy.toLowerCase();
1448
+ for (const { substr, vendor } of OWNED_BY_PATTERNS) {
1449
+ if (lc.includes(substr)) return vendor;
1450
+ }
1451
+ return void 0;
1452
+ }
1453
+ function mergeIdentity(args) {
1454
+ const { rawModelId, hints, probe, parsed } = args;
1455
+ const version = pickVersion(hints, parsed);
1456
+ return {
1457
+ vendor: hints.vendor ?? probe?.vendor ?? parsed.vendor ?? "unknown",
1458
+ family: hints.family ?? parsed.family ?? "unknown",
1459
+ ...version !== void 0 && { version },
1460
+ quirks: [.../* @__PURE__ */ new Set([...hints.quirks ?? [], ...parsed.quirks])],
1461
+ source: pickSource(hints, probe, parsed),
1462
+ rawModelId
1463
+ };
1464
+ }
1465
+ function pickVersion(hints, parsed) {
1466
+ return hints.version ?? parsed.version;
1467
+ }
1468
+ function pickSource(hints, probe, parsed) {
1469
+ if (hints.vendor !== void 0) return "modelHints";
1470
+ if (probe?.vendor !== void 0) return "probe";
1471
+ if (parsed.vendor !== void 0) return "modelIdParse";
1472
+ return "default";
1473
+ }
1474
+
1299
1475
  // src/cli/setup-data-dir.ts
1300
1476
  import { mkdirSync, existsSync as existsSync4 } from "fs";
1301
1477
  import { join as join4 } from "path";
@@ -2307,7 +2483,7 @@ async function runDoctorFix(result) {
2307
2483
  writeLine2("\u2500".repeat(40));
2308
2484
  let fixCount = 0;
2309
2485
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2310
- const { runSetup } = await import("./setup-command-BWUFMZ7U.js");
2486
+ const { runSetup } = await import("./setup-command-PLZIEFY5.js");
2311
2487
  const setupResult = runSetup({
2312
2488
  skipMcp: true,
2313
2489
  skipRules: true,
@@ -2403,6 +2579,8 @@ export {
2403
2579
  getAvailabilityCache,
2404
2580
  resetAvailabilityCache,
2405
2581
  filterAvailableModels,
2582
+ resolveModelIdentity,
2583
+ resolveModelIdentitySync,
2406
2584
  DEFAULT_TASK_TTL_MS,
2407
2585
  clampTaskTtl,
2408
2586
  probeAllClis,
@@ -2418,4 +2596,4 @@ export {
2418
2596
  startStdioServer,
2419
2597
  closeServer
2420
2598
  };
2421
- //# sourceMappingURL=chunk-YOREAPF6.js.map
2599
+ //# sourceMappingURL=chunk-JUM52GVN.js.map