基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/pssah4/vault-operator --skill sandbox-environment命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Autonomous batch mode for Vault Health findings. Works through orphans, missing backlinks, and tags in batches without asking on every fix.
Answers questions about Vault Operator usage, features, setup, configuration, models, providers, tools, skills, workflows, rules, modes, permissions, memory, semantic search, MCP, office documents, and troubleshooting
| name | sandbox-environment |
| description | Sandbox API reference, proven patterns, and library recommendations for evaluate_expression |
| trigger | sandbox|evaluate|pptx|xlsx|pdf|binary|generate|erstelle.*datei|code.*modul |
| source | bundled |
| requiredTools | ["evaluate_expression"] |
ctx.vault.read(path: string): Promise<string> -- Read text filectx.vault.readBinary(path: string): Promise<ArrayBuffer> -- Read binary filectx.vault.write(path: string, content: string): Promise<void> -- Write text (max 10MB, no writes to .obsidian/)ctx.vault.writeBinary(path: string, content: ArrayBuffer): Promise<void> -- Write binary (max 10MB)ctx.vault.list(path: string): Promise<string[]> -- List folder contentsctx.requestUrl(url: string, options?: {method?: string, body?: string}): Promise<{status: number, text: string}>Promise, JSON, Math, Date, Object (full), Array, Map, Set, RegExp, Number, String, Boolean, Symbol, setTimeout, clearTimeout, TextEncoder, TextDecoder, parseInt, parseFloat, isNaN, isFinite, encodeURIComponent, decodeURIComponent, Error, TypeError, RangeError
Uint8Array, Int8Array, Uint16Array, Int16Array, Uint32Array, Int32Array, Float32Array, Float64Array, ArrayBuffer, DataView
Buffer (Node.js), require(), dynamic import(), process, fs, path, __dirname, __filename, child_process, WebAssembly, eval(), new Function()
require, import(), process, globalThis, eval, new Function and WebAssembly are not merely absent: the AstValidator rejects the script BEFORE it compiles if the source so much as contains them, and its comment stripper deliberately keeps string literals. A script that searches for these tokens must therefore assemble them at runtime ('pro' + 'cess'), or it rejects itself. new RegExp is allowed.
A skill script is a single, self-contained file. No import, no require.
A static import x from './y.js' passes every check: the AstValidator only blocks require( and import(, and the repo has no other gate. But esbuild.transform (no bundling) rewrites it to require(), and there is no require here. The script dies on the user's first call, with an error that names none of this. Put everything in one file.
A Chromium iframe (sandbox="allow-scripts", no allow-same-origin, CSP default-src 'none'), NOT a Node vm. The vm worker was removed after a confirmed RCE; sandbox-worker.js in the repo root is a dead build artefact. Browser globals therefore exist in the usual browser sense, but the CSP gives them nothing to talk to: there is no network for fetch, and document belongs to a blank, origin-less frame. Do not build on them. ctx.vault and ctx.requestUrl are the entire surface you are given, and they are enough.
The agent sees exactly one thing: the value your execute returns, JSON-stringified. A thrown error becomes Script execution error: {message}, so put the recovery step in the message. Everything the agent must know goes in the return value.
console.log is not a no-op, despite what this file used to claim. It works, and the output is visible in the Electron DevTools console. It simply is not a transport: nothing can read a child realm's console from the parent, and across an opaque origin the parent cannot even patch it. Use it to debug with DevTools open; never to return a result.
fetch, XMLHttpRequest, WebSocket, EventSource and navigator.sendBeacon all EXIST as globals. Every call fails. The CSP is default-src 'none' with no connect-src, connect-src falls back to default-src by spec, and 'none' matches no URL at all: not a remote one, not a relative one, not a same-origin one. fetch() rejects with TypeError: Failed to fetch before a packet leaves the process. There is no URL, no retry and no fallback that changes this.
Dynamic import('https://esm.sh/...') is dead for the same reason: a script fetch falls to script-src, which grants 'unsafe-inline' 'unsafe-eval' and no URL sources. 'unsafe-eval' permits new Function; it does not permit loading code from a URL.
ctx.requestUrl is the only way out, and it works because the PARENT makes the request, not you.
localStorage, sessionStorage, document.cookie and indexedDB are blocked by the opaque origin. Reading the property THROWS a SecurityError; even typeof localStorage throws. An unguarded reference kills the script at the point of access, which is harsher than the network case. Persist through ctx.vault.
A srcdoc iframe inherits the embedding document's CSP, and multiple policies are enforced as a conjunction: the meta CSP is a floor, never a ceiling. So new Function works only for as long as Obsidian's own renderer policy tolerates unsafe-eval. If Obsidian ever tightens it, this sandbox stops working and no change to the plugin can repair it.
IMPORTANT: Use the dedicated built-in tools instead of the sandbox for Office documents:
create_pptx tool (not evaluate_expression)create_xlsx tool (not evaluate_expression)create_docx tool (not evaluate_expression)workspace:export-pdf (Tier 1) or pandoc-pdf recipe (Tier 2)These built-in tools run in the plugin context with full Node.js access and produce professional output. The sandbox should NOT be used for binary file generation -- it lacks Buffer/Blob support.
If you need simple PDF generation from scratch (not conversion), pdf-lib remains available in the sandbox:
import { PDFDocument, StandardFonts } from 'pdf-lib';
const doc = await PDFDocument.create();
const page = doc.addPage([595, 842]); // A4
const font = await doc.embedFont(StandardFonts.Helvetica);
page.drawText('Hello World', { x: 50, y: 750, size: 24, font });
const buf = await doc.save();
await ctx.vault.writeBinary('output.pdf', buf);
return 'Created output.pdf';
const content = await ctx.vault.read('data.csv');
const rows = content.split('\n').map(r => r.split(','));
const markdown = '| ' + rows[0].join(' | ') + ' |\n| ' + rows[0].map(() => '---').join(' | ') + ' |\n' + rows.slice(1).map(r => '| ' + r.join(' | ') + ' |').join('\n');
await ctx.vault.write('data.md', markdown);
return 'Converted CSV to Markdown table';
const resp = await ctx.requestUrl('https://esm.sh/lodash@4.17.21/package.json');
const pkg = JSON.parse(resp.text);
return pkg.version;
new Blob([data]) -- Blob not available. Use new Uint8Array(data) or ArrayBufferBuffer.from(str) -- Buffer not available. Use new TextEncoder().encode(str)require('fs') -- require not available. Use ctx.vaultfetch(url) -- fetch not available. Use ctx.requestUrlimport('module') -- dynamic import not available. Use static import + dependencies paramoutputType: 'blob' -- Blob not available. Use outputType: 'arraybuffer'document.createElement() -- DOM not availablewindow.crypto.getRandomValues() -- crypto not available. Use Math.random()| Task | Recommended | Avoid | Reason |
|---|---|---|---|
| Excel | exceljs | sheetjs/xlsx | ExcelJS writeBuffer() returns ArrayBuffer natively |
| pdf-lib | jspdf | pdf-lib pure JS, no DOM dependency | |
| PPTX | pptxgenjs (with caution) | officegen | pptxgenjs supports arraybuffer output |
| Images | sharp (if available) | canvas | canvas requires DOM |
| JSON/CSV | built-in | papaparse | papaparse works but unnecessary overhead |
| Dates | built-in Date | moment | moment too heavy for sandbox |