bermudis-pi-goodies 0.4.1 → 0.4.2
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/README.md +1 -1
- package/kilo.ts +30 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ extensions. One entry point, ten independent features.
|
|
|
21
21
|
After publishing the package to npm:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
pi install npm:bermudis-pi-goodies@0.4.
|
|
24
|
+
pi install npm:bermudis-pi-goodies@0.4.2
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Remove any old `bermudis-pi-goodies.ts` symlink before reloading Pi. Each
|
package/kilo.ts
CHANGED
|
@@ -632,7 +632,6 @@ export default function kilo(pi: ExtensionAPI): void {
|
|
|
632
632
|
// and preserves the full authenticated catalog across pi processes.
|
|
633
633
|
let lastFullCatalog: ProviderModelConfig[] | null = null;
|
|
634
634
|
let lastFullCatalogCheckedAt = 0;
|
|
635
|
-
let refreshInFlight: Promise<ProviderModelConfig[]> | undefined;
|
|
636
635
|
|
|
637
636
|
pi.registerProvider(KILO_PROVIDER_ID, {
|
|
638
637
|
...KILO_PROVIDER_CONFIG,
|
|
@@ -686,46 +685,41 @@ export default function kilo(pi: ExtensionAPI): void {
|
|
|
686
685
|
return lastFullCatalog;
|
|
687
686
|
}
|
|
688
687
|
|
|
689
|
-
|
|
688
|
+
try {
|
|
689
|
+
const models = await fetchKiloModels({
|
|
690
|
+
token,
|
|
691
|
+
signal: context.signal,
|
|
692
|
+
});
|
|
693
|
+
const checkedAt = Date.now();
|
|
690
694
|
try {
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
695
|
+
const published = await publishStoredCatalog(context, {
|
|
696
|
+
models: models.map(modelConfigToStoredModel),
|
|
697
|
+
checkedAt,
|
|
694
698
|
});
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
const published = await publishStoredCatalog(context, {
|
|
698
|
-
models: models.map(modelConfigToStoredModel),
|
|
699
|
-
checkedAt,
|
|
700
|
-
});
|
|
701
|
-
if (!published) {
|
|
702
|
-
return lastFullCatalog ?? KILO_FREE_MODELS;
|
|
703
|
-
}
|
|
704
|
-
} catch (error) {
|
|
705
|
-
console.warn(
|
|
706
|
-
"[kilo] Failed to persist refreshed models:",
|
|
707
|
-
error instanceof Error ? error.message : error,
|
|
708
|
-
);
|
|
699
|
+
if (!published) {
|
|
700
|
+
return lastFullCatalog ?? KILO_FREE_MODELS;
|
|
709
701
|
}
|
|
710
|
-
lastFullCatalog = models;
|
|
711
|
-
lastFullCatalogCheckedAt = checkedAt;
|
|
712
|
-
return models;
|
|
713
702
|
} catch (error) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
"[kilo] refreshModels fetch failed:",
|
|
719
|
-
error instanceof Error ? error.message : error,
|
|
720
|
-
);
|
|
721
|
-
}
|
|
722
|
-
return lastFullCatalog ?? KILO_FREE_MODELS;
|
|
723
|
-
} finally {
|
|
724
|
-
refreshInFlight = undefined;
|
|
703
|
+
console.warn(
|
|
704
|
+
"[kilo] Failed to persist refreshed models:",
|
|
705
|
+
error instanceof Error ? error.message : error,
|
|
706
|
+
);
|
|
725
707
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
708
|
+
lastFullCatalog = models;
|
|
709
|
+
lastFullCatalogCheckedAt = checkedAt;
|
|
710
|
+
return models;
|
|
711
|
+
} catch (error) {
|
|
712
|
+
// Closing a picker or starting a newer refresh aborts the old request.
|
|
713
|
+
// Each generation owns its request so a successor never inherits an
|
|
714
|
+
// aborted promise from the generation it superseded.
|
|
715
|
+
if (!context.signal?.aborted) {
|
|
716
|
+
console.warn(
|
|
717
|
+
"[kilo] refreshModels fetch failed:",
|
|
718
|
+
error instanceof Error ? error.message : error,
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
return lastFullCatalog ?? KILO_FREE_MODELS;
|
|
722
|
+
}
|
|
729
723
|
},
|
|
730
724
|
});
|
|
731
725
|
}
|