@vanillagreen/pi-claude-bridge 1.0.1 → 1.0.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/bundle/index.js +21 -5
- package/package.json +1 -1
- package/src/config.ts +2 -3
- package/src/index.ts +18 -5
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])
|
|
19541
|
+
const config2 = asRecord(configRoot?.[PACKAGE_ID]);
|
|
19543
19542
|
if (config2) mergeDeep(merged, config2);
|
|
19544
19543
|
} catch {
|
|
19545
19544
|
}
|
|
@@ -33642,17 +33641,28 @@ var DISALLOWED_BUILTIN_TOOLS = [
|
|
|
33642
33641
|
"Read",
|
|
33643
33642
|
"Write",
|
|
33644
33643
|
"Edit",
|
|
33644
|
+
"MultiEdit",
|
|
33645
33645
|
"Glob",
|
|
33646
33646
|
"Grep",
|
|
33647
33647
|
"Bash",
|
|
33648
33648
|
"Agent",
|
|
33649
|
+
"Task",
|
|
33649
33650
|
"NotebookEdit",
|
|
33650
33651
|
"EnterWorktree",
|
|
33651
33652
|
"ExitWorktree",
|
|
33653
|
+
"CronList",
|
|
33652
33654
|
"CronCreate",
|
|
33653
33655
|
"CronDelete",
|
|
33654
33656
|
"TeamCreate",
|
|
33655
33657
|
"TeamDelete",
|
|
33658
|
+
"TaskOutput",
|
|
33659
|
+
"TaskStop",
|
|
33660
|
+
"SendMessage",
|
|
33661
|
+
"Skill",
|
|
33662
|
+
"TodoRead",
|
|
33663
|
+
"TodoWrite",
|
|
33664
|
+
"ListMcpResources",
|
|
33665
|
+
"ReadMcpResource",
|
|
33656
33666
|
"WebFetch",
|
|
33657
33667
|
"WebSearch",
|
|
33658
33668
|
"AskUserQuestion",
|
|
@@ -33661,6 +33671,11 @@ var DISALLOWED_BUILTIN_TOOLS = [
|
|
|
33661
33671
|
"ToolSearch",
|
|
33662
33672
|
"ScheduleWakeup"
|
|
33663
33673
|
];
|
|
33674
|
+
var CLAUDE_BRIDGE_TOOL_ISOLATION = {
|
|
33675
|
+
tools: [],
|
|
33676
|
+
disallowedTools: DISALLOWED_BUILTIN_TOOLS,
|
|
33677
|
+
allowedTools: [`mcp__${MCP_SERVER_NAME}__*`]
|
|
33678
|
+
};
|
|
33664
33679
|
var sharedSession = null;
|
|
33665
33680
|
function convertAndImportMessages(session, messages, customToolNameToSdk) {
|
|
33666
33681
|
const { anthropicMessages, sanitizedIds } = convertPiMessages(messages, customToolNameToSdk);
|
|
@@ -34235,8 +34250,7 @@ function streamClaudeAgentSdk(model, context, options) {
|
|
|
34235
34250
|
const queryOptions = {
|
|
34236
34251
|
cwd,
|
|
34237
34252
|
env: childEnv,
|
|
34238
|
-
|
|
34239
|
-
allowedTools: [`mcp__${MCP_SERVER_NAME}__*`],
|
|
34253
|
+
...CLAUDE_BRIDGE_TOOL_ISOLATION,
|
|
34240
34254
|
permissionMode: "bypassPermissions",
|
|
34241
34255
|
includePartialMessages: true,
|
|
34242
34256
|
systemPrompt: {
|
|
@@ -34418,5 +34432,7 @@ function index_default(pi) {
|
|
|
34418
34432
|
}
|
|
34419
34433
|
}
|
|
34420
34434
|
export {
|
|
34435
|
+
CLAUDE_BRIDGE_TOOL_ISOLATION,
|
|
34436
|
+
DISALLOWED_BUILTIN_TOOLS,
|
|
34421
34437
|
index_default as default
|
|
34422
34438
|
};
|
package/package.json
CHANGED
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])
|
|
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
|
@@ -138,15 +138,29 @@ const MODELS = buildModels(getModels("anthropic"));
|
|
|
138
138
|
|
|
139
139
|
// Disable Claude Code built-ins in the provider path. Pi owns tool execution;
|
|
140
140
|
// Claude reaches Pi tools through the bridged MCP server instead.
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
//
|
|
142
|
+
// `allowedTools` is a permission auto-allow list in the Claude Agent SDK, not a
|
|
143
|
+
// visibility allowlist. Use `tools: []` to remove the built-in tool set, and keep
|
|
144
|
+
// this disallow list as a belt-and-suspenders guard for SDK/CLI built-ins that may
|
|
145
|
+
// otherwise leak into the model context (e.g. TodoWrite, CronList, SendMessage).
|
|
146
|
+
export const DISALLOWED_BUILTIN_TOOLS = [
|
|
147
|
+
"Read", "Write", "Edit", "MultiEdit", "Glob", "Grep", "Bash", "Agent", "Task",
|
|
143
148
|
"NotebookEdit", "EnterWorktree", "ExitWorktree",
|
|
144
|
-
"CronCreate", "CronDelete", "TeamCreate", "TeamDelete",
|
|
149
|
+
"CronList", "CronCreate", "CronDelete", "TeamCreate", "TeamDelete",
|
|
150
|
+
"TaskOutput", "TaskStop", "SendMessage", "Skill",
|
|
151
|
+
"TodoRead", "TodoWrite",
|
|
152
|
+
"ListMcpResources", "ReadMcpResource",
|
|
145
153
|
"WebFetch", "WebSearch",
|
|
146
154
|
"AskUserQuestion", "EnterPlanMode", "ExitPlanMode",
|
|
147
155
|
"ToolSearch", "ScheduleWakeup",
|
|
148
156
|
];
|
|
149
157
|
|
|
158
|
+
export const CLAUDE_BRIDGE_TOOL_ISOLATION = {
|
|
159
|
+
tools: [] as string[],
|
|
160
|
+
disallowedTools: DISALLOWED_BUILTIN_TOOLS,
|
|
161
|
+
allowedTools: [`mcp__${MCP_SERVER_NAME}__*`],
|
|
162
|
+
} satisfies Pick<NonNullable<Parameters<typeof query>[0]["options"]>, "tools" | "allowedTools" | "disallowedTools">;
|
|
163
|
+
|
|
150
164
|
// --- Session persistence ---
|
|
151
165
|
|
|
152
166
|
interface SessionState {
|
|
@@ -987,8 +1001,7 @@ function streamClaudeAgentSdk(model: Model<any>, context: Context, options?: Sim
|
|
|
987
1001
|
const queryOptions: NonNullable<Parameters<typeof query>[0]["options"]> = {
|
|
988
1002
|
cwd,
|
|
989
1003
|
env: childEnv,
|
|
990
|
-
|
|
991
|
-
allowedTools: [`mcp__${MCP_SERVER_NAME}__*`],
|
|
1004
|
+
...CLAUDE_BRIDGE_TOOL_ISOLATION,
|
|
992
1005
|
permissionMode: "bypassPermissions",
|
|
993
1006
|
includePartialMessages: true,
|
|
994
1007
|
systemPrompt: {
|