@trops/dash-core 0.1.549 → 0.1.551

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.
@@ -50404,6 +50404,109 @@ function resolveLockdownCwd({ cwd, disableTools = false } = {}) {
50404
50404
  return null;
50405
50405
  }
50406
50406
 
50407
+ /**
50408
+ * Resolve the plugin directory the spawned CLI should look in.
50409
+ *
50410
+ * Same shape as resolveLockdownCwd. When in lockdown, point Claude
50411
+ * Code at an empty scratch directory so plugin auto-discovery finds
50412
+ * nothing — sealing the gap left by `--bare` (which strips CLAUDE.md
50413
+ * and auto-memory but NOT user plugins under ~/.claude/plugins/).
50414
+ * The Skill tool gets loaded from those plugins, which is how it
50415
+ * survived the slice 17f flag set.
50416
+ *
50417
+ * Sibling of the scratch cwd dir — DIFFERENT name so plugin discovery
50418
+ * doesn't pick up the cwd itself.
50419
+ *
50420
+ * @param {object} opts
50421
+ * @param {string=} opts.pluginDir
50422
+ * @param {boolean=} opts.disableTools
50423
+ * @returns {string|null}
50424
+ */
50425
+ function resolveLockdownPluginDir({ pluginDir, disableTools = false } = {}) {
50426
+ if (pluginDir) return pluginDir;
50427
+ if (disableTools) {
50428
+ const os = require$$2$1;
50429
+ const path = require$$1$1;
50430
+ return path.join(os.tmpdir(), "dash-widget-builder-cli-plugins");
50431
+ }
50432
+ return null;
50433
+ }
50434
+
50435
+ /**
50436
+ * Canonical denylist for the lockdown — every built-in tool name we
50437
+ * know about, comma-separated (no whitespace) so the single arg is
50438
+ * Windows-shell-safe. Adding a new built-in upstream means appending
50439
+ * its name here; the flag is belt-and-suspenders alongside `--tools ""`,
50440
+ * but it's the only layer that actually keeps the Skill tool from
50441
+ * being callable when a user has plugins installed in
50442
+ * ~/.claude/plugins/.
50443
+ */
50444
+ const LOCKDOWN_DISALLOWED_TOOLS = [
50445
+ "Skill",
50446
+ "Bash",
50447
+ "BashOutput",
50448
+ "Read",
50449
+ "Edit",
50450
+ "Write",
50451
+ "Glob",
50452
+ "Grep",
50453
+ "WebFetch",
50454
+ "WebSearch",
50455
+ "NotebookRead",
50456
+ "NotebookEdit",
50457
+ "Task",
50458
+ "TodoWrite",
50459
+ "KillBash",
50460
+ "SlashCommand",
50461
+ ].join(",");
50462
+
50463
+ /**
50464
+ * Path to the e2e-only argv capture file. Only written when
50465
+ * `process.env.DASH_E2E === "1"` (set by `e2e/helpers/electron-app.js`
50466
+ * for Playwright runs). Production launches never set it, so no
50467
+ * diagnostic is written on a real user's machine.
50468
+ *
50469
+ * The capture deterministically pins the chain ChatCore → IPC →
50470
+ * cliController. Slice 18a's diagnostic revealed that the chain
50471
+ * silently dropped `replaceSystemPrompt` and `disableTools` for
50472
+ * months. Without an argv assertion, the next break would be
50473
+ * invisible until a user filed a bug. With it, the e2e test
50474
+ * `widget-builder-cli-flow.spec.js` reads this file and asserts the
50475
+ * full lockdown flag set is present — fails immediately if any flag
50476
+ * goes missing.
50477
+ */
50478
+ const E2E_LAST_SPAWN_LOG_PATH = (() => {
50479
+ const os = require$$2$1;
50480
+ const path = require$$1$1;
50481
+ return path.join(os.tmpdir(), "dash-cli-last-spawn.e2e.json");
50482
+ })();
50483
+
50484
+ /**
50485
+ * Slice 18b — gated argv capture. No-op outside e2e mode.
50486
+ *
50487
+ * Captures argv only (NOT env values, NOT env keys — production users
50488
+ * are protected by the env-var gate; we don't need the keys-only
50489
+ * privacy hedge anymore since this never runs for them).
50490
+ */
50491
+ function captureLastSpawnArgsForE2E({ args, disableTools = false } = {}) {
50492
+ if (process.env.DASH_E2E !== "1") return;
50493
+ try {
50494
+ const fs = require("fs");
50495
+ const payload = {
50496
+ ts: Date.now(),
50497
+ disableTools: disableTools === true,
50498
+ args: Array.isArray(args) ? args.slice() : [],
50499
+ };
50500
+ fs.writeFileSync(
50501
+ E2E_LAST_SPAWN_LOG_PATH,
50502
+ JSON.stringify(payload, null, 2),
50503
+ { encoding: "utf8" },
50504
+ );
50505
+ } catch (_e) {
50506
+ // Capture must NEVER break the spawn.
50507
+ }
50508
+ }
50509
+
50407
50510
  /**
50408
50511
  * Build the argv array for spawning the Claude Code CLI.
50409
50512
  *
@@ -50464,6 +50567,17 @@ function buildClaudeCliArgs({
50464
50567
  // exactly our --system-prompt and nothing else.
50465
50568
  args.push("--bare");
50466
50569
  args.push("--strict-mcp-config");
50570
+
50571
+ // `--bare` strips CLAUDE.md and auto-memory but NOT user plugins
50572
+ // (under ~/.claude/plugins/). The Skill TOOL gets loaded from
50573
+ // those plugins, which is why it kept firing despite slices 17e
50574
+ // and 17f. Two layers seal it:
50575
+ // 1. --disallowed-tools denies every known built-in by name
50576
+ // (comma-separated, no whitespace, Windows-shell-safe).
50577
+ // 2. --plugin-dir points at an empty scratch dir under
50578
+ // os.tmpdir() so plugin auto-discovery finds nothing.
50579
+ args.push("--disallowed-tools", LOCKDOWN_DISALLOWED_TOOLS);
50580
+ args.push("--plugin-dir", resolveLockdownPluginDir({ disableTools: true }));
50467
50581
  }
50468
50582
 
50469
50583
  if (model) {
@@ -50677,8 +50791,22 @@ const cliController$2 = {
50677
50791
  }
50678
50792
  spawnOpts.cwd = resolvedCwd;
50679
50793
  }
50794
+ // The --plugin-dir argv we built above points at a scratch
50795
+ // directory; create it on first run so the CLI doesn't error
50796
+ // out trying to read a missing path.
50797
+ if (disableTools) {
50798
+ const fs = require("fs");
50799
+ const lockdownPluginDir = resolveLockdownPluginDir({
50800
+ disableTools: true,
50801
+ });
50802
+ if (lockdownPluginDir && !fs.existsSync(lockdownPluginDir)) {
50803
+ fs.mkdirSync(lockdownPluginDir, { recursive: true });
50804
+ }
50805
+ }
50680
50806
  const spawnCmd = IS_WINDOWS ? windowsQuote(binaryPath) : binaryPath;
50681
50807
  const spawnArgs = IS_WINDOWS ? args.map(windowsQuote) : args;
50808
+ // No-op outside e2e mode (gated on process.env.DASH_E2E === "1").
50809
+ captureLastSpawnArgsForE2E({ args, disableTools });
50682
50810
  const child = spawn(spawnCmd, spawnArgs, spawnOpts);
50683
50811
 
50684
50812
  activeProcesses.set(requestId, child);
@@ -50998,6 +51126,9 @@ const cliController$2 = {
50998
51126
  cliController$3.exports = cliController$2;
50999
51127
  cliController$3.exports.buildClaudeCliArgs = buildClaudeCliArgs;
51000
51128
  cliController$3.exports.resolveLockdownCwd = resolveLockdownCwd;
51129
+ cliController$3.exports.resolveLockdownPluginDir = resolveLockdownPluginDir;
51130
+ cliController$3.exports.LOCKDOWN_DISALLOWED_TOOLS = LOCKDOWN_DISALLOWED_TOOLS;
51131
+ cliController$3.exports.E2E_LAST_SPAWN_LOG_PATH = E2E_LAST_SPAWN_LOG_PATH;
51001
51132
 
51002
51133
  var cliControllerExports = cliController$3.exports;
51003
51134