This commit is contained in:
seb
2026-10-10 06:33:46 +02:00
parent 6af150aea4
commit 004e0de869
3 changed files with 421 additions and 61 deletions

View File

@@ -106,4 +106,25 @@ export const vfs = {
body: { oldPath: cleanOld, newPath: cleanNew },
});
},
/**
* POST /api/vfs/*path — run a `.applet.js` file from VFS.
* Path goes in the URL, run params in the JSON body.
* @param {string} path VFS-relative applet path (e.g. `demo.applet.js`)
* @param {{ input?: object, timeout?: number, max_output?: number }} [options]
* → 200 { ok, result, columns, rows, warnings?, stdout, consoleLines, durationMs, truncated? }
* `result` is a typed CSV string (`;`-separated, header row first), `columns` are the
* declared `{ name, type }` pairs, `rows` is the data-row count.
*/
runApplet(path, options = {}) {
const clean = String(path || '').replace(/^\/+/, '');
const body = {};
if (options.input !== undefined) body.input = options.input;
if (options.timeout !== undefined) body.timeout = options.timeout;
if (options.max_output !== undefined) body.max_output = options.max_output;
return http(`/api/vfs/${clean}`, {
method: 'POST',
body,
});
},
};