@oh-my-pi/pi-coding-agent 13.6.1 → 13.6.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/CHANGELOG.md +8 -0
- package/package.json +7 -7
- package/src/cli/update-cli.ts +14 -17
- package/src/config/model-registry.ts +1 -1
- package/src/internal-urls/mcp-protocol.ts +2 -2
- package/src/mcp/manager.ts +10 -7
- package/src/mcp/smithery-registry.ts +27 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [13.6.2] - 2026-03-03
|
|
6
|
+
### Fixed
|
|
7
|
+
|
|
8
|
+
- Fixed LM Studio API key retrieval to use configured provider name instead of hardcoded 'lm-studio'
|
|
9
|
+
- Fixed resource content handling to properly check for empty text values (null/undefined)
|
|
10
|
+
- Fixed resource refresh tracking to prevent stale promise reuse when server connection changes
|
|
11
|
+
- Fixed update target resolution to properly handle cases where binary path cannot be resolved
|
|
12
|
+
|
|
5
13
|
## [13.6.1] - 2026-03-03
|
|
6
14
|
|
|
7
15
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
4
|
-
"version": "13.6.
|
|
4
|
+
"version": "13.6.2",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@mozilla/readability": "^0.6",
|
|
44
|
-
"@oh-my-pi/omp-stats": "13.6.
|
|
45
|
-
"@oh-my-pi/pi-agent-core": "13.6.
|
|
46
|
-
"@oh-my-pi/pi-ai": "13.6.
|
|
47
|
-
"@oh-my-pi/pi-natives": "13.6.
|
|
48
|
-
"@oh-my-pi/pi-tui": "13.6.
|
|
49
|
-
"@oh-my-pi/pi-utils": "13.6.
|
|
44
|
+
"@oh-my-pi/omp-stats": "13.6.2",
|
|
45
|
+
"@oh-my-pi/pi-agent-core": "13.6.2",
|
|
46
|
+
"@oh-my-pi/pi-ai": "13.6.2",
|
|
47
|
+
"@oh-my-pi/pi-natives": "13.6.2",
|
|
48
|
+
"@oh-my-pi/pi-tui": "13.6.2",
|
|
49
|
+
"@oh-my-pi/pi-utils": "13.6.2",
|
|
50
50
|
"@sinclair/typebox": "^0.34",
|
|
51
51
|
"@xterm/headless": "^6.0",
|
|
52
52
|
"ajv": "^8.18",
|
package/src/cli/update-cli.ts
CHANGED
|
@@ -47,14 +47,6 @@ async function getBunGlobalBinDir(): Promise<string | undefined> {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function getRealPathOrOriginal(filePath: string): string {
|
|
51
|
-
try {
|
|
52
|
-
return fs.realpathSync(filePath);
|
|
53
|
-
} catch {
|
|
54
|
-
return filePath;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
50
|
function normalizePathForComparison(filePath: string): string {
|
|
59
51
|
const normalized = path.normalize(filePath);
|
|
60
52
|
if (process.platform === "win32") return normalized.toLowerCase();
|
|
@@ -62,16 +54,13 @@ function normalizePathForComparison(filePath: string): string {
|
|
|
62
54
|
}
|
|
63
55
|
|
|
64
56
|
function isPathInDirectory(filePath: string, directoryPath: string): boolean {
|
|
65
|
-
const normalizedPath = normalizePathForComparison(
|
|
66
|
-
const normalizedDirectory = normalizePathForComparison(
|
|
57
|
+
const normalizedPath = normalizePathForComparison(path.resolve(filePath));
|
|
58
|
+
const normalizedDirectory = normalizePathForComparison(path.resolve(directoryPath));
|
|
67
59
|
const relativePath = path.relative(normalizedDirectory, normalizedPath);
|
|
68
60
|
return relativePath === "" || (!relativePath.startsWith("..") && !path.isAbsolute(relativePath));
|
|
69
61
|
}
|
|
70
62
|
|
|
71
|
-
|
|
72
|
-
method: "bun" | "binary";
|
|
73
|
-
path: string;
|
|
74
|
-
}
|
|
63
|
+
type UpdateTarget = { method: "bun" } | { method: "binary"; path: string };
|
|
75
64
|
|
|
76
65
|
function resolveUpdateMethod(ompPath: string, bunBinDir: string | undefined): "bun" | "binary" {
|
|
77
66
|
if (!bunBinDir) return "binary";
|
|
@@ -82,10 +71,18 @@ export function _resolveUpdateMethodForTest(ompPath: string, bunBinDir: string |
|
|
|
82
71
|
return resolveUpdateMethod(ompPath, bunBinDir);
|
|
83
72
|
}
|
|
84
73
|
async function resolveUpdateTarget(): Promise<UpdateTarget> {
|
|
85
|
-
const ompPath = resolveOmpPath() ?? process.execPath;
|
|
86
74
|
const bunBinDir = await getBunGlobalBinDir();
|
|
87
|
-
const
|
|
88
|
-
|
|
75
|
+
const ompPath = resolveOmpPath();
|
|
76
|
+
|
|
77
|
+
if (ompPath) {
|
|
78
|
+
const method = resolveUpdateMethod(ompPath, bunBinDir);
|
|
79
|
+
if (method === "bun") return { method };
|
|
80
|
+
return { method, path: ompPath };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (bunBinDir) return { method: "bun" };
|
|
84
|
+
|
|
85
|
+
throw new Error(`Could not resolve ${APP_NAME} binary path in PATH`);
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
/**
|
|
@@ -883,7 +883,7 @@ export class ModelRegistry {
|
|
|
883
883
|
const modelsUrl = `${baseUrl}/models`;
|
|
884
884
|
|
|
885
885
|
const headers: Record<string, string> = { ...(providerConfig.headers ?? {}) };
|
|
886
|
-
const apiKey = await this.authStorage.getApiKey(
|
|
886
|
+
const apiKey = await this.authStorage.getApiKey(providerConfig.provider);
|
|
887
887
|
if (apiKey && apiKey !== DEFAULT_LOCAL_TOKEN && apiKey !== kNoAuth) {
|
|
888
888
|
headers.Authorization = `Bearer ${apiKey}`;
|
|
889
889
|
}
|
|
@@ -137,14 +137,14 @@ export class McpProtocolHandler implements ProtocolHandler {
|
|
|
137
137
|
|
|
138
138
|
const textParts: string[] = [];
|
|
139
139
|
for (const item of result.contents) {
|
|
140
|
-
if (item.text) {
|
|
140
|
+
if (item.text !== undefined && item.text !== null) {
|
|
141
141
|
textParts.push(item.text);
|
|
142
142
|
} else if (item.blob) {
|
|
143
143
|
textParts.push(`[Binary content: ${item.mimeType ?? "unknown"}, base64 length ${item.blob.length}]`);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
const content = textParts.join("\n---\n")
|
|
147
|
+
const content = textParts.length > 0 ? textParts.join("\n---\n") : "(empty resource)";
|
|
148
148
|
return {
|
|
149
149
|
url: url.href,
|
|
150
150
|
content,
|
package/src/mcp/manager.ts
CHANGED
|
@@ -126,7 +126,7 @@ export class MCPManager {
|
|
|
126
126
|
#notificationsEnabled = false;
|
|
127
127
|
#notificationsEpoch = 0;
|
|
128
128
|
#subscribedResources = new Map<string, Set<string>>();
|
|
129
|
-
#pendingResourceRefresh = new Map<string, Promise<void
|
|
129
|
+
#pendingResourceRefresh = new Map<string, { connection: MCPServerConnection; promise: Promise<void> }>();
|
|
130
130
|
|
|
131
131
|
constructor(
|
|
132
132
|
private cwd: string,
|
|
@@ -590,6 +590,7 @@ export class MCPManager {
|
|
|
590
590
|
this.#pendingConnections.delete(name);
|
|
591
591
|
this.#pendingToolLoads.delete(name);
|
|
592
592
|
this.#sources.delete(name);
|
|
593
|
+
this.#pendingResourceRefresh.delete(name);
|
|
593
594
|
|
|
594
595
|
const connection = this.#connections.get(name);
|
|
595
596
|
|
|
@@ -622,6 +623,7 @@ export class MCPManager {
|
|
|
622
623
|
|
|
623
624
|
this.#pendingConnections.clear();
|
|
624
625
|
this.#pendingToolLoads.clear();
|
|
626
|
+
this.#pendingResourceRefresh.clear();
|
|
625
627
|
this.#sources.clear();
|
|
626
628
|
this.#connections.clear();
|
|
627
629
|
this.#tools = [];
|
|
@@ -660,13 +662,13 @@ export class MCPManager {
|
|
|
660
662
|
* Refresh resources from a specific server.
|
|
661
663
|
*/
|
|
662
664
|
async refreshServerResources(name: string): Promise<void> {
|
|
665
|
+
const connection = this.#connections.get(name);
|
|
666
|
+
if (!connection || !serverSupportsResources(connection.capabilities)) return;
|
|
667
|
+
|
|
663
668
|
const existing = this.#pendingResourceRefresh.get(name);
|
|
664
|
-
if (existing) return existing;
|
|
669
|
+
if (existing && existing.connection === connection) return existing.promise;
|
|
665
670
|
|
|
666
671
|
const doRefresh = async (): Promise<void> => {
|
|
667
|
-
const connection = this.#connections.get(name);
|
|
668
|
-
if (!connection || !serverSupportsResources(connection.capabilities)) return;
|
|
669
|
-
|
|
670
672
|
// Clear cached resources
|
|
671
673
|
connection.resources = undefined;
|
|
672
674
|
connection.resourceTemplates = undefined;
|
|
@@ -716,11 +718,12 @@ export class MCPManager {
|
|
|
716
718
|
};
|
|
717
719
|
|
|
718
720
|
const promise = doRefresh().finally(() => {
|
|
719
|
-
|
|
721
|
+
const pending = this.#pendingResourceRefresh.get(name);
|
|
722
|
+
if (pending?.promise === promise) {
|
|
720
723
|
this.#pendingResourceRefresh.delete(name);
|
|
721
724
|
}
|
|
722
725
|
});
|
|
723
|
-
this.#pendingResourceRefresh.set(name, promise);
|
|
726
|
+
this.#pendingResourceRefresh.set(name, { connection, promise });
|
|
724
727
|
return promise;
|
|
725
728
|
}
|
|
726
729
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from "@oh-my-pi/pi-utils";
|
|
1
2
|
import type { MCPServerConfig } from "./types";
|
|
2
3
|
|
|
3
4
|
const SMITHERY_REGISTRY_BASE_URL = "https://registry.smithery.ai";
|
|
@@ -324,8 +325,12 @@ async function fetchServerDetailsFromEntry(
|
|
|
324
325
|
): Promise<SmitheryServerDetails | null> {
|
|
325
326
|
const candidates = resolveDetailPathCandidates(entry);
|
|
326
327
|
for (const candidate of candidates) {
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
try {
|
|
329
|
+
const details = await fetchServerDetails(candidate, options);
|
|
330
|
+
if (details) return details;
|
|
331
|
+
} catch (error) {
|
|
332
|
+
logger.debug("Smithery detail fetch candidate failed", { candidate, error: String(error) });
|
|
333
|
+
}
|
|
329
334
|
}
|
|
330
335
|
return null;
|
|
331
336
|
}
|
|
@@ -439,14 +444,31 @@ export async function searchSmitheryRegistry(
|
|
|
439
444
|
);
|
|
440
445
|
});
|
|
441
446
|
|
|
447
|
+
const detailFailures: Array<{ identity: string; error: string }> = [];
|
|
442
448
|
const results = await Promise.all(
|
|
443
449
|
uniqueEntries.map(async entry => {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
450
|
+
try {
|
|
451
|
+
const details = await fetchServerDetailsFromEntry(entry, { apiKey: options?.apiKey });
|
|
452
|
+
if (!details) return null;
|
|
453
|
+
return toSearchResult(entry, details);
|
|
454
|
+
} catch (error) {
|
|
455
|
+
detailFailures.push({
|
|
456
|
+
identity: getEntryIdentityKey(entry) ?? entry.id ?? "unknown",
|
|
457
|
+
error: String(error),
|
|
458
|
+
});
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
447
461
|
}),
|
|
448
462
|
);
|
|
449
463
|
|
|
464
|
+
if (detailFailures.length > 0) {
|
|
465
|
+
logger.warn("Smithery detail fetch failed for some entries", {
|
|
466
|
+
query,
|
|
467
|
+
failedEntries: detailFailures.length,
|
|
468
|
+
totalEntries: uniqueEntries.length,
|
|
469
|
+
sample: detailFailures.slice(0, 3),
|
|
470
|
+
});
|
|
471
|
+
}
|
|
450
472
|
return results.filter((result): result is SmitherySearchResult => result !== null).slice(0, limit);
|
|
451
473
|
}
|
|
452
474
|
|