@zenera/cli 1.1.30 → 1.1.31
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/catalog.js +30 -18
- package/package.json +3 -3
package/dist/catalog.js
CHANGED
|
@@ -463,10 +463,6 @@ const store = () => new Cache(CATALOG_KIND, { mode: 0o644 });
|
|
|
463
463
|
* to both. A project left to the service-account file is not seen here.
|
|
464
464
|
*/
|
|
465
465
|
function scope(provider) {
|
|
466
|
-
const at = gatewayOf();
|
|
467
|
-
if (at) {
|
|
468
|
-
return cacheKey(GATEWAY_NAME, at.baseURL);
|
|
469
|
-
}
|
|
470
466
|
if (provider !== 'vertex') {
|
|
471
467
|
return undefined;
|
|
472
468
|
}
|
|
@@ -483,6 +479,29 @@ function readCache(provider) {
|
|
|
483
479
|
? file
|
|
484
480
|
: undefined;
|
|
485
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* Through a gateway nothing is cached on disk: the gateway caches its own
|
|
484
|
+
* listing, one request serves every provider, and a stale copy outlives the
|
|
485
|
+
* gateway's providers or the virtual key that was allowed to see them.
|
|
486
|
+
*/
|
|
487
|
+
async function loadGatewayCatalog(provider, at) {
|
|
488
|
+
const via = { via: { name: GATEWAY_NAME, url: at.baseURL } };
|
|
489
|
+
try {
|
|
490
|
+
const entries = await fetchGatewayCatalog(provider, at);
|
|
491
|
+
return { provider, entries, origin: 'live', fetchedAt: new Date().toISOString(), ...via };
|
|
492
|
+
}
|
|
493
|
+
catch (err) {
|
|
494
|
+
// No built-in list: it names vendor models the gateway may not serve at all.
|
|
495
|
+
return {
|
|
496
|
+
provider,
|
|
497
|
+
entries: [],
|
|
498
|
+
origin: 'curated',
|
|
499
|
+
fetchedAt: new Date(0).toISOString(),
|
|
500
|
+
problem: classify(err),
|
|
501
|
+
...via,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
}
|
|
486
505
|
/**
|
|
487
506
|
* The listing for one provider, from the cheapest source that can answer.
|
|
488
507
|
*
|
|
@@ -494,9 +513,9 @@ function readCache(provider) {
|
|
|
494
513
|
*/
|
|
495
514
|
export async function loadCatalog(provider, opts = {}) {
|
|
496
515
|
const at = gatewayOf();
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
516
|
+
if (at) {
|
|
517
|
+
return loadGatewayCatalog(provider, at);
|
|
518
|
+
}
|
|
500
519
|
const cached = readCache(provider);
|
|
501
520
|
const fresh = cached && Date.now() - new Date(cached.fetchedAt).getTime() < CATALOG_TTL_MS
|
|
502
521
|
? cached
|
|
@@ -507,17 +526,14 @@ export async function loadCatalog(provider, opts = {}) {
|
|
|
507
526
|
entries: fresh.entries,
|
|
508
527
|
origin: 'cache',
|
|
509
528
|
fetchedAt: fresh.fetchedAt,
|
|
510
|
-
...via,
|
|
511
529
|
};
|
|
512
530
|
}
|
|
513
531
|
if (!opts.offline) {
|
|
514
532
|
try {
|
|
515
|
-
const entries =
|
|
516
|
-
? await fetchGatewayCatalog(provider, at)
|
|
517
|
-
: await fetchCatalog(provider);
|
|
533
|
+
const entries = await fetchCatalog(provider);
|
|
518
534
|
const fetchedAt = new Date().toISOString();
|
|
519
535
|
store().put(catalogKey(provider), { provider, fetchedAt, entries });
|
|
520
|
-
return { provider, entries, origin: 'live', fetchedAt
|
|
536
|
+
return { provider, entries, origin: 'live', fetchedAt };
|
|
521
537
|
}
|
|
522
538
|
catch (err) {
|
|
523
539
|
const problem = classify(err);
|
|
@@ -528,16 +544,14 @@ export async function loadCatalog(provider, opts = {}) {
|
|
|
528
544
|
origin: 'stale',
|
|
529
545
|
fetchedAt: cached.fetchedAt,
|
|
530
546
|
problem,
|
|
531
|
-
...via,
|
|
532
547
|
};
|
|
533
548
|
}
|
|
534
549
|
return {
|
|
535
550
|
provider,
|
|
536
|
-
entries:
|
|
551
|
+
entries: curated(provider),
|
|
537
552
|
origin: 'curated',
|
|
538
553
|
fetchedAt: new Date(0).toISOString(),
|
|
539
554
|
problem,
|
|
540
|
-
...via,
|
|
541
555
|
};
|
|
542
556
|
}
|
|
543
557
|
}
|
|
@@ -547,15 +561,13 @@ export async function loadCatalog(provider, opts = {}) {
|
|
|
547
561
|
entries: cached.entries,
|
|
548
562
|
origin: 'stale',
|
|
549
563
|
fetchedAt: cached.fetchedAt,
|
|
550
|
-
...via,
|
|
551
564
|
};
|
|
552
565
|
}
|
|
553
566
|
return {
|
|
554
567
|
provider,
|
|
555
|
-
entries:
|
|
568
|
+
entries: curated(provider),
|
|
556
569
|
origin: 'curated',
|
|
557
570
|
fetchedAt: new Date(0).toISOString(),
|
|
558
|
-
...via,
|
|
559
571
|
};
|
|
560
572
|
}
|
|
561
573
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenera/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"description": "Command-line front end for @zenera/neo: agentic projects you can run, share and commit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@google/genai": "^2.30.0",
|
|
55
55
|
"@inkjs/ui": "^2.0.0",
|
|
56
56
|
"@openrouter/sdk": "^1.4.25",
|
|
57
|
-
"@zenera/neo": "^1.1.
|
|
58
|
-
"@zenera/view": "^1.1.
|
|
57
|
+
"@zenera/neo": "^1.1.31",
|
|
58
|
+
"@zenera/view": "^1.1.31",
|
|
59
59
|
"google-auth-library": "^10.0.0",
|
|
60
60
|
"ink": "^7.1.1",
|
|
61
61
|
"openai": "^6.0.0",
|