@kenkaiiii/gg-boss 4.3.151 → 4.3.153

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/dist/cli.js CHANGED
@@ -43,7 +43,7 @@ import {
43
43
  use_app_default,
44
44
  use_input_default,
45
45
  use_stdout_default
46
- } from "./chunk-JFMWBELU.js";
46
+ } from "./chunk-2SKO3MTH.js";
47
47
  import "./chunk-QT366Y52.js";
48
48
  import {
49
49
  source_default
@@ -336,7 +336,7 @@ init_esm_shims();
336
336
  // package.json
337
337
  var package_default = {
338
338
  name: "@kenkaiiii/gg-boss",
339
- version: "4.3.151",
339
+ version: "4.3.153",
340
340
  type: "module",
341
341
  description: "Orchestrator agent that drives multiple ggcoder sessions across projects from a single chat",
342
342
  license: "MIT",
@@ -1256,6 +1256,7 @@ var import_react10 = __toESM(require_react(), 1);
1256
1256
  // src/radio.ts
1257
1257
  init_esm_shims();
1258
1258
  import { spawn } from "child_process";
1259
+ import { existsSync } from "fs";
1259
1260
  var RADIO_STATIONS = [
1260
1261
  {
1261
1262
  id: "somafm-groove-salad",
@@ -1314,10 +1315,65 @@ function stopRadio() {
1314
1315
  currentStationId = null;
1315
1316
  log("INFO", "radio", "stopped");
1316
1317
  }
1318
+ function isWsl() {
1319
+ if (process.platform !== "linux") return false;
1320
+ return !!process.env.WSL_DISTRO_NAME || existsSync("/proc/sys/fs/binfmt_misc/WSLInterop");
1321
+ }
1322
+ function tryPlayOnWindowsHost(station) {
1323
+ const allowedUrls = new Set(RADIO_STATIONS.map((s) => s.url));
1324
+ if (!allowedUrls.has(station.url)) return null;
1325
+ if (!/^https?:\/\//i.test(station.url)) return null;
1326
+ const psScript = [
1327
+ "Add-Type -AssemblyName presentationCore;",
1328
+ "Add-Type -AssemblyName WindowsBase;",
1329
+ "$p = New-Object System.Windows.Media.MediaPlayer;",
1330
+ "$p.Open([uri]$env:GGBOSS_RADIO_URL);",
1331
+ "$p.Play();",
1332
+ "[System.Windows.Threading.Dispatcher]::Run();"
1333
+ ].join(" ");
1334
+ try {
1335
+ const child = spawn(
1336
+ "powershell.exe",
1337
+ ["-NoProfile", "-WindowStyle", "Hidden", "-Command", psScript],
1338
+ {
1339
+ detached: true,
1340
+ stdio: "ignore",
1341
+ env: {
1342
+ ...process.env,
1343
+ GGBOSS_RADIO_URL: station.url,
1344
+ WSLENV: (process.env.WSLENV ? process.env.WSLENV + ":" : "") + "GGBOSS_RADIO_URL"
1345
+ }
1346
+ }
1347
+ );
1348
+ return child;
1349
+ } catch {
1350
+ return null;
1351
+ }
1352
+ }
1317
1353
  function playRadio(stationId) {
1318
1354
  const station = RADIO_STATIONS.find((s) => s.id === stationId);
1319
1355
  if (!station) return { ok: false, error: `Unknown station: ${stationId}` };
1320
1356
  stopRadio();
1357
+ if (isWsl()) {
1358
+ const child = tryPlayOnWindowsHost(station);
1359
+ if (child) {
1360
+ let errored = false;
1361
+ child.once("error", () => {
1362
+ errored = true;
1363
+ });
1364
+ if (child.pid && !errored) {
1365
+ currentChild = child;
1366
+ currentStationId = stationId;
1367
+ log("INFO", "radio", "playing", {
1368
+ station: station.id,
1369
+ player: "powershell.exe (wsl\u2192host)",
1370
+ url: station.url
1371
+ });
1372
+ child.unref();
1373
+ return { ok: true };
1374
+ }
1375
+ }
1376
+ }
1321
1377
  for (const player of PLAYERS) {
1322
1378
  try {
1323
1379
  const child = spawn(player.cmd, player.args(station.url), {
@@ -2239,6 +2295,15 @@ function renderBossApp(opts) {
2239
2295
  exitOnCtrlC: false
2240
2296
  });
2241
2297
  ref.instance = instance;
2298
+ let resizeTimer = null;
2299
+ const onTerminalResize = () => {
2300
+ if (resizeTimer) clearTimeout(resizeTimer);
2301
+ resizeTimer = setTimeout(() => {
2302
+ resizeTimer = null;
2303
+ resetUI();
2304
+ }, 250);
2305
+ };
2306
+ process.stdout.on("resize", onTerminalResize);
2242
2307
  return {
2243
2308
  // Follow ref.instance through restarts: when /clear nukes the current
2244
2309
  // instance and creates a new one, this promise re-binds to whichever
@@ -2248,15 +2313,25 @@ function renderBossApp(opts) {
2248
2313
  waitUntilExit: async () => {
2249
2314
  while (true) {
2250
2315
  const current = ref.instance;
2251
- if (!current) return;
2316
+ if (!current) {
2317
+ process.stdout.off("resize", onTerminalResize);
2318
+ if (resizeTimer) clearTimeout(resizeTimer);
2319
+ return;
2320
+ }
2252
2321
  await current.waitUntilExit();
2253
2322
  if (ref.instance === current) {
2254
2323
  ref.instance = null;
2324
+ process.stdout.off("resize", onTerminalResize);
2325
+ if (resizeTimer) clearTimeout(resizeTimer);
2255
2326
  return;
2256
2327
  }
2257
2328
  }
2258
2329
  },
2259
- unmount: () => ref.instance?.unmount()
2330
+ unmount: () => {
2331
+ process.stdout.off("resize", onTerminalResize);
2332
+ if (resizeTimer) clearTimeout(resizeTimer);
2333
+ ref.instance?.unmount();
2334
+ }
2260
2335
  };
2261
2336
  }
2262
2337