@kenkaiiii/gg-boss 4.3.161 → 4.3.162

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.
@@ -7348,21 +7348,21 @@ var require_cross_spawn = __commonJS({
7348
7348
  var cp = __require("child_process");
7349
7349
  var parse3 = require_parse();
7350
7350
  var enoent = require_enoent();
7351
- function spawn9(command, args, options2) {
7351
+ function spawn10(command, args, options2) {
7352
7352
  const parsed = parse3(command, args, options2);
7353
7353
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
7354
7354
  enoent.hookChildProcess(spawned, parsed);
7355
7355
  return spawned;
7356
7356
  }
7357
- function spawnSync2(command, args, options2) {
7357
+ function spawnSync3(command, args, options2) {
7358
7358
  const parsed = parse3(command, args, options2);
7359
7359
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
7360
7360
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
7361
7361
  return result;
7362
7362
  }
7363
- module.exports = spawn9;
7364
- module.exports.spawn = spawn9;
7365
- module.exports.sync = spawnSync2;
7363
+ module.exports = spawn10;
7364
+ module.exports.spawn = spawn10;
7365
+ module.exports.sync = spawnSync3;
7366
7366
  module.exports._parse = parse3;
7367
7367
  module.exports._enoent = enoent;
7368
7368
  }
@@ -65162,7 +65162,7 @@ init_esm_shims();
65162
65162
 
65163
65163
  // ../ggcoder/dist/core/process-manager.js
65164
65164
  init_esm_shims();
65165
- import { spawn } from "child_process";
65165
+ import { spawn, spawnSync } from "child_process";
65166
65166
  import fs from "fs";
65167
65167
  import fsp from "fs/promises";
65168
65168
  import path3 from "path";
@@ -65182,11 +65182,77 @@ function killProcessTree(pid) {
65182
65182
  }
65183
65183
  }
65184
65184
 
65185
+ // ../ggcoder/dist/tools/safe-env.js
65186
+ init_esm_shims();
65187
+ var ENV_ALLOWLIST = /* @__PURE__ */ new Set([
65188
+ "PATH",
65189
+ "HOME",
65190
+ "USER",
65191
+ "LOGNAME",
65192
+ "SHELL",
65193
+ "LANG",
65194
+ "LC_ALL",
65195
+ "LC_CTYPE",
65196
+ "TMPDIR",
65197
+ "XDG_CONFIG_HOME",
65198
+ "XDG_DATA_HOME",
65199
+ "XDG_CACHE_HOME",
65200
+ "XDG_RUNTIME_DIR",
65201
+ "EDITOR",
65202
+ "VISUAL",
65203
+ "PAGER",
65204
+ "CLICOLOR",
65205
+ "CLICOLOR_FORCE",
65206
+ "NO_COLOR",
65207
+ "FORCE_COLOR",
65208
+ // Development toolchains
65209
+ "NODE_PATH",
65210
+ "NVM_DIR",
65211
+ "NPM_CONFIG_PREFIX",
65212
+ "PNPM_HOME",
65213
+ "GOPATH",
65214
+ "GOROOT",
65215
+ "CARGO_HOME",
65216
+ "RUSTUP_HOME",
65217
+ "PYENV_ROOT",
65218
+ "VIRTUAL_ENV",
65219
+ "CONDA_DEFAULT_ENV",
65220
+ "CONDA_PREFIX",
65221
+ "JAVA_HOME",
65222
+ "ANDROID_HOME",
65223
+ "ANDROID_SDK_ROOT",
65224
+ "RUBY_VERSION",
65225
+ "GEM_HOME",
65226
+ "RBENV_ROOT"
65227
+ ]);
65228
+ function getSafeToolEnv(sourceEnv = process.env) {
65229
+ const env2 = { TERM: "dumb", GG_CODER: "true" };
65230
+ for (const key of ENV_ALLOWLIST) {
65231
+ const value = sourceEnv[key];
65232
+ if (value)
65233
+ env2[key] = value;
65234
+ }
65235
+ return env2;
65236
+ }
65237
+
65185
65238
  // ../ggcoder/dist/core/process-manager.js
65186
65239
  var BG_DIR = path3.join(os2.homedir(), ".gg", "bg");
65240
+ function stopProcessTree(pid, ops = {}) {
65241
+ if ((ops.platform ?? process.platform) === "win32") {
65242
+ (ops.spawnSync ?? spawnSync)("taskkill", ["/pid", String(pid), "/T", "/F"], {
65243
+ stdio: "ignore"
65244
+ });
65245
+ return;
65246
+ }
65247
+ (ops.killProcessTree ?? killProcessTree)(pid);
65248
+ }
65187
65249
  var ProcessManager = class {
65250
+ ops;
65188
65251
  processes = /* @__PURE__ */ new Map();
65189
65252
  children = /* @__PURE__ */ new Map();
65253
+ constructor(ops = {}) {
65254
+ this.ops = ops;
65255
+ }
65190
65256
  async start(command, cwd2) {
65191
65257
  await fsp.mkdir(BG_DIR, { recursive: true });
65192
65258
  const id2 = crypto2.randomUUID().slice(0, 8);
@@ -65196,7 +65262,7 @@ var ProcessManager = class {
65196
65262
  cwd: cwd2,
65197
65263
  detached: true,
65198
65264
  stdio: ["ignore", fd3, fd3],
65199
- env: { ...process.env, TERM: "dumb" }
65265
+ env: getSafeToolEnv()
65200
65266
  });
65201
65267
  fs.closeSync(fd3);
65202
65268
  const pid = child.pid;
@@ -65255,10 +65321,10 @@ var ProcessManager = class {
65255
65321
  return `Process ${id2} already exited (code ${proc.exitCode})`;
65256
65322
  }
65257
65323
  try {
65258
- process.kill(-proc.pid, "SIGTERM");
65324
+ (this.ops.kill ?? process.kill)(-proc.pid, "SIGTERM");
65259
65325
  } catch {
65260
65326
  try {
65261
- process.kill(proc.pid, "SIGTERM");
65327
+ (this.ops.kill ?? process.kill)(proc.pid, "SIGTERM");
65262
65328
  } catch {
65263
65329
  return `Process ${id2} already exited`;
65264
65330
  }
@@ -65271,7 +65337,7 @@ var ProcessManager = class {
65271
65337
  });
65272
65338
  });
65273
65339
  if (!exited) {
65274
- killProcessTree(proc.pid);
65340
+ stopProcessTree(proc.pid, this.ops);
65275
65341
  }
65276
65342
  return `Process ${id2} stopped`;
65277
65343
  }
@@ -65287,7 +65353,7 @@ var ProcessManager = class {
65287
65353
  shutdownAll() {
65288
65354
  for (const [id2, proc] of this.processes) {
65289
65355
  if (this.children.has(id2)) {
65290
- killProcessTree(proc.pid);
65356
+ stopProcessTree(proc.pid, this.ops);
65291
65357
  proc.exitCode = proc.exitCode ?? 1;
65292
65358
  this.children.delete(id2);
65293
65359
  }
@@ -66826,55 +66892,6 @@ ${failures.length} ${noun} skipped \u2014 re-issue ONLY these (the rest are alre
66826
66892
  init_esm_shims();
66827
66893
  var DEFAULT_TIMEOUT = 12e4;
66828
66894
  var MAX_OUTPUT_BYTES = 10 * 1024 * 1024;
66829
- var ENV_ALLOWLIST = /* @__PURE__ */ new Set([
66830
- "PATH",
66831
- "HOME",
66832
- "USER",
66833
- "LOGNAME",
66834
- "SHELL",
66835
- "LANG",
66836
- "LC_ALL",
66837
- "LC_CTYPE",
66838
- "TMPDIR",
66839
- "XDG_CONFIG_HOME",
66840
- "XDG_DATA_HOME",
66841
- "XDG_CACHE_HOME",
66842
- "XDG_RUNTIME_DIR",
66843
- "EDITOR",
66844
- "VISUAL",
66845
- "PAGER",
66846
- "CLICOLOR",
66847
- "CLICOLOR_FORCE",
66848
- "NO_COLOR",
66849
- "FORCE_COLOR",
66850
- // Development toolchains
66851
- "NODE_PATH",
66852
- "NVM_DIR",
66853
- "NPM_CONFIG_PREFIX",
66854
- "PNPM_HOME",
66855
- "GOPATH",
66856
- "GOROOT",
66857
- "CARGO_HOME",
66858
- "RUSTUP_HOME",
66859
- "PYENV_ROOT",
66860
- "VIRTUAL_ENV",
66861
- "CONDA_DEFAULT_ENV",
66862
- "CONDA_PREFIX",
66863
- "JAVA_HOME",
66864
- "ANDROID_HOME",
66865
- "ANDROID_SDK_ROOT",
66866
- "RUBY_VERSION",
66867
- "GEM_HOME",
66868
- "RBENV_ROOT"
66869
- ]);
66870
- function getSafeEnv() {
66871
- const env2 = { TERM: "dumb", GG_CODER: "true" };
66872
- for (const key of ENV_ALLOWLIST) {
66873
- if (process.env[key])
66874
- env2[key] = process.env[key];
66875
- }
66876
- return env2;
66877
- }
66878
66895
  var BashParams = external_exports.object({
66879
66896
  command: external_exports.string().describe("The bash command to execute"),
66880
66897
  timeout: external_exports.number().int().min(1e3).optional().describe("Timeout in milliseconds (default: 120000)"),
@@ -66904,7 +66921,7 @@ Use task_output with id="${result.id}" to read output.`;
66904
66921
  cwd: cwd2,
66905
66922
  detached: true,
66906
66923
  stdio: ["ignore", "pipe", "pipe"],
66907
- env: getSafeEnv()
66924
+ env: getSafeToolEnv()
66908
66925
  });
66909
66926
  const chunks = [];
66910
66927
  let totalBytes = 0;
@@ -67043,6 +67060,7 @@ var GrepParams = external_exports.object({
67043
67060
  var DEFAULT_MAX_RESULTS = 50;
67044
67061
  var MAX_LINE_LENGTH = 500;
67045
67062
  var MAX_FILE_SIZE = 10 * 1024 * 1024;
67063
+ var MAX_CANDIDATE_FILES = 1e4;
67046
67064
  function createGrepTool(cwd2, ops = localOperations) {
67047
67065
  return {
67048
67066
  name: "grep",
@@ -67071,12 +67089,22 @@ function createGrepTool(cwd2, ops = localOperations) {
67071
67089
  onlyFiles: true,
67072
67090
  ignore: ["**/node_modules/**", "**/.git/**"],
67073
67091
  suppressErrors: true,
67074
- followSymbolicLinks: false
67092
+ followSymbolicLinks: false,
67093
+ objectMode: true,
67094
+ stats: false
67075
67095
  });
67076
67096
  const results = [];
67077
- for (const entry of entries) {
67097
+ let scannedCandidates = 0;
67098
+ let candidateLimitHit = false;
67099
+ for (const item of entries) {
67078
67100
  if (results.length >= maxResults)
67079
67101
  break;
67102
+ if (scannedCandidates >= MAX_CANDIDATE_FILES) {
67103
+ candidateLimitHit = true;
67104
+ break;
67105
+ }
67106
+ scannedCandidates += 1;
67107
+ const entry = typeof item === "string" ? item : item.path;
67080
67108
  const ext = path11.extname(entry).toLowerCase();
67081
67109
  if (BINARY_EXTENSIONS.has(ext))
67082
67110
  continue;
@@ -67084,7 +67112,7 @@ function createGrepTool(cwd2, ops = localOperations) {
67084
67112
  const fileResults = await searchFile(filePath, regex2, cwd2, maxResults - results.length, ops);
67085
67113
  results.push(...fileResults);
67086
67114
  }
67087
- return formatResults(results, maxResults);
67115
+ return formatResults(results, maxResults, candidateLimitHit);
67088
67116
  }
67089
67117
  };
67090
67118
  }
@@ -67129,9 +67157,10 @@ async function searchFile(filePath, regex2, cwd2, maxResults, ops) {
67129
67157
  }
67130
67158
  return results;
67131
67159
  }
67132
- function formatResults(results, maxResults) {
67133
- if (results.length === 0)
67134
- return "No matches found.";
67160
+ function formatResults(results, maxResults, candidateLimitHit = false) {
67161
+ if (results.length === 0) {
67162
+ return candidateLimitHit ? `No matches found. [Stopped after scanning ${MAX_CANDIDATE_FILES} candidate files]` : "No matches found.";
67163
+ }
67135
67164
  let output = results.join("\n");
67136
67165
  if (results.length >= maxResults) {
67137
67166
  output += `
@@ -67141,6 +67170,10 @@ function formatResults(results, maxResults) {
67141
67170
  output += `
67142
67171
 
67143
67172
  ${results.length} match(es) found`;
67173
+ }
67174
+ if (candidateLimitHit) {
67175
+ output += `
67176
+ [Stopped after scanning ${MAX_CANDIDATE_FILES} candidate files]`;
67144
67177
  }
67145
67178
  return output;
67146
67179
  }
@@ -67606,8 +67639,19 @@ function createWebFetchTool() {
67606
67639
  "User-Agent": "Mozilla/5.0 (compatible; GGCoder/1.0)",
67607
67640
  Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
67608
67641
  },
67642
+ redirect: "manual",
67609
67643
  signal: AbortSignal.timeout(3e4)
67610
67644
  });
67645
+ if (response.status >= 300 && response.status < 400) {
67646
+ const location = response.headers.get("location");
67647
+ if (!location)
67648
+ return `Error: HTTP ${response.status} redirect without Location header`;
67649
+ const redirectUrl = new URL(location, args.url).toString();
67650
+ if (isBlockedUrl(redirectUrl)) {
67651
+ return "Error: Redirect blocked \u2014 target URL is private/internal or unsupported.";
67652
+ }
67653
+ return `Error: Redirects are not followed automatically. Safe redirect target: ${redirectUrl}`;
67654
+ }
67611
67655
  if (!response.ok) {
67612
67656
  return `Error: HTTP ${response.status} ${response.statusText}`;
67613
67657
  }
@@ -90546,7 +90590,7 @@ var taskBarStore = createStore({
90546
90590
  import { createHash as createHash4 } from "crypto";
90547
90591
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
90548
90592
  import { homedir as homedir6 } from "os";
90549
- import { join as join8 } from "path";
90593
+ import { join as join9 } from "path";
90550
90594
 
90551
90595
  // ../ggcoder/dist/utils/sound.js
90552
90596
  init_esm_shims();
@@ -96566,7 +96610,7 @@ var SIDE_BY_SIDE_MIN5 = LOGO_WIDTH4 + GAP5.length + 20;
96566
96610
  init_esm_shims();
96567
96611
  var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
96568
96612
  var import_react70 = __toESM(require_react(), 1);
96569
- import { spawnSync } from "child_process";
96613
+ import { spawnSync as spawnSync2 } from "child_process";
96570
96614
  import { createRequire } from "module";
96571
96615
  var GAP6 = " ";
96572
96616
  var LOGO_WIDTH5 = 11;
@@ -96625,13 +96669,20 @@ var HISTORY_PATH = path31.join(os10.homedir(), ".gg", "setup-history.json");
96625
96669
  // ../ggcoder/dist/ui/live-item-flush.js
96626
96670
  init_esm_shims();
96627
96671
 
96628
- // ../ggcoder/dist/core/goal-worker.js
96672
+ // ../ggcoder/dist/core/goal-verifier.js
96629
96673
  init_esm_shims();
96630
96674
  import { spawn as spawn7 } from "child_process";
96675
+ import { mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
96676
+ import { join as join7 } from "path";
96677
+ var DEFAULT_GOAL_VERIFIER_TIMEOUT_MS = 10 * 60 * 1e3;
96678
+
96679
+ // ../ggcoder/dist/core/goal-worker.js
96680
+ init_esm_shims();
96681
+ import { spawn as spawn8 } from "child_process";
96631
96682
  import { createInterface as createInterface3 } from "readline";
96632
96683
  import { createWriteStream, existsSync as existsSync6 } from "fs";
96633
- import { mkdir as mkdir4 } from "fs/promises";
96634
- import { join as join7 } from "path";
96684
+ import { mkdir as mkdir5 } from "fs/promises";
96685
+ import { join as join8 } from "path";
96635
96686
  import { randomUUID as randomUUID5 } from "crypto";
96636
96687
 
96637
96688
  // ../ggcoder/dist/ui/goal-events.js
@@ -98529,7 +98580,7 @@ function createTaskTools(deps) {
98529
98580
 
98530
98581
  // src/audio.ts
98531
98582
  init_esm_shims();
98532
- import { spawn as spawn8, execFileSync as execFileSync3 } from "child_process";
98583
+ import { spawn as spawn9, execFileSync as execFileSync3 } from "child_process";
98533
98584
  import { fileURLToPath as fileURLToPath3 } from "url";
98534
98585
  import path35 from "path";
98535
98586
  import fs35 from "fs";
@@ -98604,7 +98655,7 @@ function trySpawn(cmd, args) {
98604
98655
  return new Promise((resolve4) => {
98605
98656
  let resolved = false;
98606
98657
  try {
98607
- const child = spawn8(cmd, args, {
98658
+ const child = spawn9(cmd, args, {
98608
98659
  detached: true,
98609
98660
  stdio: "ignore"
98610
98661
  });
@@ -98663,7 +98714,7 @@ async function tryPlayOnWindowsHost(file2) {
98663
98714
  return new Promise((resolve4) => {
98664
98715
  let resolved2 = false;
98665
98716
  try {
98666
- const child = spawn8(
98717
+ const child = spawn9(
98667
98718
  "powershell.exe",
98668
98719
  ["-NoProfile", "-WindowStyle", "Hidden", "-Command", script],
98669
98720
  {
@@ -99808,4 +99859,4 @@ react/cjs/react-jsx-runtime.development.js:
99808
99859
  * LICENSE file in the root directory of this source tree.
99809
99860
  *)
99810
99861
  */
99811
- //# sourceMappingURL=chunk-3O74GM4F.js.map
99862
+ //# sourceMappingURL=chunk-U3L3QW6X.js.map