bermudis-pi-goodies 0.4.0 → 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 +26 -28
- 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,42 +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) {
|
|
703
|
+
console.warn(
|
|
704
|
+
"[kilo] Failed to persist refreshed models:",
|
|
705
|
+
error instanceof Error ? error.message : error,
|
|
706
|
+
);
|
|
707
|
+
}
|
|
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) {
|
|
714
716
|
console.warn(
|
|
715
717
|
"[kilo] refreshModels fetch failed:",
|
|
716
718
|
error instanceof Error ? error.message : error,
|
|
717
719
|
);
|
|
718
|
-
return lastFullCatalog ?? KILO_FREE_MODELS;
|
|
719
|
-
} finally {
|
|
720
|
-
refreshInFlight = undefined;
|
|
721
720
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
return refreshInFlight;
|
|
721
|
+
return lastFullCatalog ?? KILO_FREE_MODELS;
|
|
722
|
+
}
|
|
725
723
|
},
|
|
726
724
|
});
|
|
727
725
|
}
|