pi-better-sandbox 0.5.2 → 0.5.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/shared-task-sandbox.ts +3 -1
package/package.json
CHANGED
package/shared-task-sandbox.ts
CHANGED
|
@@ -160,6 +160,8 @@ export function installTaskTools(pi: ExtensionAPI, options: {
|
|
|
160
160
|
shellPath?: () => string | undefined;
|
|
161
161
|
trustedSources: readonly string[];
|
|
162
162
|
admitExtensionTool?: (name: string, input: unknown, sourcePath: string | undefined) => boolean;
|
|
163
|
+
/** Build the admitted bash definition from the confined operations (default: the SDK bash tool). */
|
|
164
|
+
bashDefinition?: (cwd: string, operations: BashOperations) => ReturnType<typeof createBashToolDefinition>;
|
|
163
165
|
}) {
|
|
164
166
|
const { controller } = options;
|
|
165
167
|
const sourceKey = (path: string) => path.startsWith("<") ? path : canonicalizePath(path);
|
|
@@ -180,7 +182,7 @@ export function installTaskTools(pi: ExtensionAPI, options: {
|
|
|
180
182
|
pi.registerTool(own(createReadToolDefinition(cwd, { operations: files.read })));
|
|
181
183
|
pi.registerTool(own(createWriteToolDefinition(cwd, { operations: files.write })));
|
|
182
184
|
pi.registerTool(own(createEditToolDefinition(cwd, { operations: files.edit })));
|
|
183
|
-
pi.registerTool(own(createBashToolDefinition(cwd, { operations: bash })));
|
|
185
|
+
pi.registerTool(own(options.bashDefinition ? options.bashDefinition(cwd, bash) : createBashToolDefinition(cwd, { operations: bash })));
|
|
184
186
|
};
|
|
185
187
|
register(options.cwd);
|
|
186
188
|
pi.on("user_bash", () => ({ operations: bash }));
|