vg-coder-cli 2.0.65 → 2.0.66
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
CHANGED
package/src/server/api-server.js
CHANGED
|
@@ -799,16 +799,21 @@ class ApiServer {
|
|
|
799
799
|
} catch (e) { res.status(launcherErr(e)).json({ error: e.message }); }
|
|
800
800
|
});
|
|
801
801
|
|
|
802
|
-
// Run
|
|
803
|
-
//
|
|
804
|
-
// a
|
|
805
|
-
|
|
802
|
+
// Run a predefined chrome.* command inside the launcher SW. Manifest V3
|
|
803
|
+
// CSP forbids new Function() in service workers, so eval was replaced by
|
|
804
|
+
// a fixed command map. Body:
|
|
805
|
+
// { chromeId? | workerLabel?, cmd, args?, timeoutMs? }
|
|
806
|
+
// Available cmds (see launcher.ts execCommands):
|
|
807
|
+
// tabs.query | tabs.get | tabs.update | tabs.reload
|
|
808
|
+
// storage.sync.get | storage.sync.set | storage.local.get
|
|
809
|
+
// runtime.reload | windows.list | cookies.get
|
|
810
|
+
this.app.post('/api/launcher/exec', async (req, res) => {
|
|
806
811
|
try {
|
|
807
812
|
const body = req.body || {};
|
|
808
|
-
if (!body.
|
|
813
|
+
if (!body.cmd) return res.status(400).json({ error: 'cmd required' });
|
|
809
814
|
const opts = launcherOpts(body) || (body.all ? { all: true } : {});
|
|
810
815
|
const timeoutMs = Math.min(Math.max(parseInt(body.timeoutMs, 10) || 10_000, 1_000), 30_000);
|
|
811
|
-
const result = await taskQueue.requestLauncher('launcher:
|
|
816
|
+
const result = await taskQueue.requestLauncher('launcher:exec', { cmd: body.cmd, args: body.args }, opts, timeoutMs);
|
|
812
817
|
res.json(result);
|
|
813
818
|
} catch (e) { res.status(launcherErr(e)).json({ error: e.message }); }
|
|
814
819
|
});
|