@vanillagreen/pi-claude-bridge 1.0.2 → 1.0.4

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/bundle/index.js CHANGED
@@ -19487,8 +19487,7 @@ function popContext() {
19487
19487
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
19488
19488
  import { homedir as homedir2 } from "os";
19489
19489
  import { dirname as dirname2, join as join2, resolve } from "path";
19490
- var PACKAGE_ID = "pi-claude-bridge";
19491
- var SCOPED_PACKAGE_ID = "@vanillagreen/pi-claude-bridge";
19490
+ var PACKAGE_ID = "@vanillagreen/pi-claude-bridge";
19492
19491
  function expandHome(input) {
19493
19492
  if (input === "~") return homedir2();
19494
19493
  if (input.startsWith("~/")) return join2(homedir2(), input.slice(2));
@@ -19539,7 +19538,7 @@ function readManagerConfig(cwd) {
19539
19538
  try {
19540
19539
  const parsed = JSON.parse(readFileSync3(path, "utf8"));
19541
19540
  const configRoot = asRecord(asRecord(asRecord(parsed?.vstack)?.extensionManager)?.config);
19542
- const config2 = asRecord(configRoot?.[PACKAGE_ID]) ?? asRecord(configRoot?.[SCOPED_PACKAGE_ID]);
19541
+ const config2 = asRecord(configRoot?.[PACKAGE_ID]);
19543
19542
  if (config2) mergeDeep(merged, config2);
19544
19543
  } catch {
19545
19544
  }
@@ -33844,7 +33843,14 @@ function mapToolName(name, customToolNameToPi) {
33844
33843
  const mapped = customToolNameToPi.get(name) ?? customToolNameToPi.get(normalized);
33845
33844
  if (mapped) return mapped;
33846
33845
  }
33847
- if (normalized.startsWith(MCP_TOOL_PREFIX)) return name.slice(MCP_TOOL_PREFIX.length);
33846
+ for (const prefix of [
33847
+ MCP_TOOL_PREFIX,
33848
+ `mcp__${MCP_SERVER_NAME.replace(/-/g, "_")}__`,
33849
+ `mcp/${MCP_SERVER_NAME}/`,
33850
+ `mcp/${MCP_SERVER_NAME.replace(/-/g, "_")}/`
33851
+ ]) {
33852
+ if (normalized.startsWith(prefix)) return normalized.slice(prefix.length);
33853
+ }
33848
33854
  return name;
33849
33855
  }
33850
33856
  var SDK_KEY_RENAMES = {
@@ -34435,5 +34441,6 @@ function index_default(pi) {
34435
34441
  export {
34436
34442
  CLAUDE_BRIDGE_TOOL_ISOLATION,
34437
34443
  DISALLOWED_BUILTIN_TOOLS,
34438
- index_default as default
34444
+ index_default as default,
34445
+ mapToolName
34439
34446
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanillagreen/pi-claude-bridge",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Pi provider bridge that runs Claude Code through the Claude Agent SDK, with opt-in forwarding for Pi prompt context.",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/config.ts CHANGED
@@ -7,8 +7,7 @@ import { existsSync, readFileSync } from "fs";
7
7
  import { homedir } from "os";
8
8
  import { dirname, join, resolve } from "path";
9
9
 
10
- export const PACKAGE_ID = "pi-claude-bridge";
11
- export const SCOPED_PACKAGE_ID = "@vanillagreen/pi-claude-bridge";
10
+ export const PACKAGE_ID = "@vanillagreen/pi-claude-bridge";
12
11
 
13
12
  export interface Config {
14
13
  enabled?: boolean;
@@ -87,7 +86,7 @@ function readManagerConfig(cwd: string): SettingsRecord {
87
86
  try {
88
87
  const parsed = JSON.parse(readFileSync(path, "utf8"));
89
88
  const configRoot = asRecord(asRecord(asRecord(parsed?.vstack)?.extensionManager)?.config);
90
- const config = asRecord(configRoot?.[PACKAGE_ID]) ?? asRecord(configRoot?.[SCOPED_PACKAGE_ID]);
89
+ const config = asRecord(configRoot?.[PACKAGE_ID]);
91
90
  if (config) mergeDeep(merged, config);
92
91
  } catch {
93
92
  // Ignore malformed optional manager config; Pi will surface settings issues elsewhere.
package/src/index.ts CHANGED
@@ -426,7 +426,7 @@ function syncSharedSession(
426
426
 
427
427
  // --- Provider helpers: tool name mapping ---
428
428
 
429
- function mapToolName(name: string, customToolNameToPi?: Map<string, string>): string {
429
+ export function mapToolName(name: string, customToolNameToPi?: Map<string, string>): string {
430
430
  const normalized = name.toLowerCase();
431
431
  const builtin = SDK_TO_PI_TOOL_NAME[normalized];
432
432
  if (builtin) return builtin;
@@ -434,7 +434,14 @@ function mapToolName(name: string, customToolNameToPi?: Map<string, string>): st
434
434
  const mapped = customToolNameToPi.get(name) ?? customToolNameToPi.get(normalized);
435
435
  if (mapped) return mapped;
436
436
  }
437
- if (normalized.startsWith(MCP_TOOL_PREFIX)) return name.slice(MCP_TOOL_PREFIX.length);
437
+ for (const prefix of [
438
+ MCP_TOOL_PREFIX,
439
+ `mcp__${MCP_SERVER_NAME.replace(/-/g, "_")}__`,
440
+ `mcp/${MCP_SERVER_NAME}/`,
441
+ `mcp/${MCP_SERVER_NAME.replace(/-/g, "_")}/`,
442
+ ]) {
443
+ if (normalized.startsWith(prefix)) return normalized.slice(prefix.length);
444
+ }
438
445
  return name;
439
446
  }
440
447