pi-codebuddy-sdk 0.4.1 → 0.4.3
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/package.json +1 -1
- package/src/cb-session-io.ts +6 -1
- package/src/index.ts +7 -4
package/package.json
CHANGED
package/src/cb-session-io.ts
CHANGED
|
@@ -22,7 +22,12 @@ export function normalizeProjectPath(projectPath: string): string {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function projectPathToHash(projectPath: string): string {
|
|
25
|
-
|
|
25
|
+
// Keep session paths aligned with CodeBuddy CLI PathUtils.compressPath.
|
|
26
|
+
return normalizeProjectPath(projectPath)
|
|
27
|
+
.replace(/[/\\:]/g, "-")
|
|
28
|
+
.replace(/^-+/, "")
|
|
29
|
+
.replace(/-+$/, "")
|
|
30
|
+
.replace(/-+/g, "-");
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
export function getProjectDir(projectPath: string, codebuddyDir?: string): string {
|
package/src/index.ts
CHANGED
|
@@ -1642,7 +1642,7 @@ async function ensureModelsDiscovered(): Promise<void> {
|
|
|
1642
1642
|
await discoverInFlight;
|
|
1643
1643
|
}
|
|
1644
1644
|
|
|
1645
|
-
export default function (pi: ExtensionAPI) {
|
|
1645
|
+
export default async function (pi: ExtensionAPI) {
|
|
1646
1646
|
piApi = pi;
|
|
1647
1647
|
const config = loadConfig(process.cwd());
|
|
1648
1648
|
debug("loadConfig:", JSON.stringify(config));
|
|
@@ -1657,9 +1657,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
1657
1657
|
} else {
|
|
1658
1658
|
MODELS = buildModels(FALLBACK_MODELS, providerSettings, providerSettings.modelOverrides);
|
|
1659
1659
|
}
|
|
1660
|
-
const registeredModels = MODELS;
|
|
1661
1660
|
|
|
1662
|
-
|
|
1661
|
+
// Discover real models BEFORE registering the provider, so the first
|
|
1662
|
+
// (synchronous-flush) registration carries live models instead of the
|
|
1663
|
+
// FALLBACK_MODELS snapshot. pi awaits this async factory before startup
|
|
1664
|
+
// continues, so the model list shown at startup is never the fallback.
|
|
1665
|
+
await ensureModelsDiscovered();
|
|
1663
1666
|
|
|
1664
1667
|
const clearSession = (event: string) => {
|
|
1665
1668
|
debug(`${event}: clearing session ${sharedSession?.sessionId?.slice(0, 8) ?? "none"}`);
|
|
@@ -1747,7 +1750,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1747
1750
|
baseUrl: PROVIDER_ID,
|
|
1748
1751
|
apiKey: "not-used",
|
|
1749
1752
|
api: "codebuddy-sdk",
|
|
1750
|
-
models:
|
|
1753
|
+
models: MODELS as any,
|
|
1751
1754
|
// Cast: pi-ai AssistantMessageEventStream diamond dep between pi-coding-agent and pi-agent-core
|
|
1752
1755
|
streamSimple: streamCodebuddySdk as any,
|
|
1753
1756
|
});
|