supipowers 0.6.0 → 0.6.1
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/context-mode/detector.ts +26 -10
package/package.json
CHANGED
|
@@ -13,14 +13,25 @@ export interface ContextModeStatus {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
/** Suffixes to match against full MCP-namespaced tool names */
|
|
17
|
+
const TOOL_SUFFIXES: Array<[string, keyof ContextModeStatus["tools"]]> = [
|
|
18
|
+
["ctx_execute", "ctxExecute"],
|
|
19
|
+
["ctx_batch_execute", "ctxBatchExecute"],
|
|
20
|
+
["ctx_execute_file", "ctxExecuteFile"],
|
|
21
|
+
["ctx_index", "ctxIndex"],
|
|
22
|
+
["ctx_search", "ctxSearch"],
|
|
23
|
+
["ctx_fetch_and_index", "ctxFetchAndIndex"],
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Extract the short tool name from a potentially MCP-namespaced tool name.
|
|
28
|
+
* MCP tools use the format: mcp__<server>__<tool_name>
|
|
29
|
+
* Native tools use bare names like: lsp, bash, etc.
|
|
30
|
+
*/
|
|
31
|
+
function getShortName(tool: string): string {
|
|
32
|
+
const lastSep = tool.lastIndexOf("__");
|
|
33
|
+
return lastSep >= 0 ? tool.slice(lastSep + 2) : tool;
|
|
34
|
+
}
|
|
24
35
|
|
|
25
36
|
/** Detect context-mode MCP tool availability from the active tools list */
|
|
26
37
|
export function detectContextMode(activeTools: string[]): ContextModeStatus {
|
|
@@ -34,8 +45,13 @@ export function detectContextMode(activeTools: string[]): ContextModeStatus {
|
|
|
34
45
|
};
|
|
35
46
|
|
|
36
47
|
for (const tool of activeTools) {
|
|
37
|
-
const
|
|
38
|
-
|
|
48
|
+
const shortName = getShortName(tool);
|
|
49
|
+
for (const [suffix, key] of TOOL_SUFFIXES) {
|
|
50
|
+
if (shortName === suffix) {
|
|
51
|
+
tools[key] = true;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
39
55
|
}
|
|
40
56
|
|
|
41
57
|
const available = Object.values(tools).some(Boolean);
|