@benz-ai-x/dsh-md-preview 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/lib/index.js +7 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -216,14 +216,20 @@ let MdPreviewService = (() => {
216
216
  kind: "replaceIfVersion",
217
217
  version: fingerprint
218
218
  };
219
+ const sandboxPolicy = {
220
+ mode: "workspace-write",
221
+ workspaceRoot: cwd,
222
+ sessionId
223
+ };
219
224
  let outcome;
220
225
  try {
221
- outcome = await this.ctx.fs.writeText(target, content, expected, signal);
226
+ outcome = await this.ctx.fs.writeText(target, content, expected, signal, sandboxPolicy);
222
227
  } catch (error) {
223
228
  if (signal.aborted) throw error;
224
229
  const code = fsErrorCode(error);
225
230
  if (code === "FS_STALE_VERSION") throw failure("md-preview/conflict", `mdPreview/write refuses "${path}": the file changed since read`);
226
231
  if (code === "FS_NOT_FOUND") throw failure("md-preview/not-found", `mdPreview/write cannot find "${path}"`);
232
+ if (code === "FS_SANDBOX_DENIED") throw failure("md-preview/forbidden", `mdPreview/write is not permitted inside the session workspace for "${path}"`);
227
233
  throw failure("md-preview/unavailable", `mdPreview/write failed for "${path}": ${error instanceof Error ? error.message : String(error)}`);
228
234
  }
229
235
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benz-ai-x/dsh-md-preview",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "DSH markdown preview: clicking a markdown document in the conversation opens a rendered preview panel docked to the right of the chat.",
5
5
  "license": "MIT",
6
6
  "repository": {