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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vg-coder-cli",
3
- "version": "2.0.65",
3
+ "version": "2.0.66",
4
4
  "description": "🚀 CLI tool to analyze projects, concatenate source files, count tokens, and export HTML with syntax highlighting and copy functionality",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -799,16 +799,21 @@ class ApiServer {
799
799
  } catch (e) { res.status(launcherErr(e)).json({ error: e.message }); }
800
800
  });
801
801
 
802
- // Run JS inside the launcher SW. Body: { chromeId? | workerLabel?, code, timeoutMs? }
803
- // Code is wrapped in `async () => { ${code} }` use `return` to surface
804
- // a value. Result must JSON-serialize. Debug-only.
805
- this.app.post('/api/launcher/eval', async (req, res) => {
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.code) return res.status(400).json({ error: 'code required' });
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:eval', { code: body.code }, opts, timeoutMs);
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
  });