@kenkaiiii/gg-boss 4.11.0 → 4.11.2

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.
@@ -72263,16 +72263,22 @@ function formatSize(bytes) {
72263
72263
  init_esm_shims();
72264
72264
  import { spawn as spawn5 } from "child_process";
72265
72265
  import { createInterface } from "readline";
72266
+ import { existsSync as existsSync2 } from "fs";
72267
+ import { fileURLToPath as fileURLToPath2 } from "url";
72266
72268
  var SUB_AGENT_MAX_TURNS = 10;
72267
72269
  var SUB_AGENT_MAX_OUTPUT_CHARS = 1e5;
72268
72270
  var SUB_AGENT_MAX_OUTPUT_LINES = 500;
72269
72271
  var SUB_AGENT_MAX_STDERR_CHARS = 1e4;
72270
72272
  var SUB_AGENT_TIMEOUT_MS = 10 * 60 * 1e3;
72273
+ function resolveCliEntry() {
72274
+ const cliPath = fileURLToPath2(new URL("../cli.js", import.meta.url));
72275
+ return existsSync2(cliPath) ? cliPath : process.argv[1];
72276
+ }
72271
72277
  var SubAgentParams = external_exports.object({
72272
72278
  task: external_exports.string().describe("The task to delegate to the sub-agent"),
72273
72279
  agent: external_exports.string().optional().describe("Named agent definition to use (from ~/.gg/agents/ or .gg/agents/)")
72274
72280
  });
72275
- function createSubAgentTool(cwd2, agents, parentProvider, parentModel, getParentCacheKey, planModeRef) {
72281
+ function createSubAgentTool(cwd2, agents, getParentProvider, getParentModel, getParentCacheKey, planModeRef) {
72276
72282
  const agentList = agents.map((a) => `- ${a.name}: ${a.description}`).join("\n");
72277
72283
  const agentDesc = agentList ? `
72278
72284
 
@@ -72302,13 +72308,14 @@ ${agentList}` : "\n\nNo named agents configured.";
72302
72308
  };
72303
72309
  }
72304
72310
  }
72305
- const useProvider = parentProvider;
72311
+ const useProvider = getParentProvider();
72312
+ const useModel = getParentModel();
72306
72313
  const cliArgs = [
72307
72314
  "--json",
72308
72315
  "--provider",
72309
72316
  useProvider,
72310
72317
  "--model",
72311
- parentModel,
72318
+ useModel,
72312
72319
  "--max-turns",
72313
72320
  String(SUB_AGENT_MAX_TURNS)
72314
72321
  ];
@@ -72320,8 +72327,7 @@ ${agentList}` : "\n\nNo named agents configured.";
72320
72327
  cliArgs.push("--system-prompt", agentDef.systemPrompt);
72321
72328
  }
72322
72329
  cliArgs.push(args.task);
72323
- const binPath = process.argv[1];
72324
- const child = spawn5(process.execPath, [binPath, ...cliArgs], {
72330
+ const child = spawn5(process.execPath, [resolveCliEntry(), ...cliArgs], {
72325
72331
  cwd: cwd2,
72326
72332
  stdio: ["ignore", "pipe", "pipe"],
72327
72333
  env: { ...process.env }
@@ -72336,7 +72342,7 @@ ${agentList}` : "\n\nNo named agents configured.";
72336
72342
  log("INFO", "subagent", "Sub-agent spawn", {
72337
72343
  cacheKey: subCacheKey,
72338
72344
  provider: useProvider,
72339
- model: parentModel,
72345
+ model: useModel,
72340
72346
  agent: agentDef?.name ?? "(default)"
72341
72347
  });
72342
72348
  let childExited = false;
@@ -73716,7 +73722,7 @@ function createWebSearchTool() {
73716
73722
  init_esm_shims();
73717
73723
  import { spawn as spawn6 } from "child_process";
73718
73724
  import path18 from "path";
73719
- import { fileURLToPath as fileURLToPath2 } from "url";
73725
+ import { fileURLToPath as fileURLToPath3 } from "url";
73720
73726
  var SOURCE_PATH_TIMEOUT_MS = 12e4;
73721
73727
  var MAX_STDERR_CHARS = 1e4;
73722
73728
  var OPENSRC_BIN_ENV = "GG_CODER_OPENSRC_BIN";
@@ -73815,7 +73821,7 @@ function getBundledOpenSrcBinPath() {
73815
73821
  const override = process.env[OPENSRC_BIN_ENV]?.trim();
73816
73822
  if (override)
73817
73823
  return override;
73818
- const currentDir = path18.dirname(fileURLToPath2(import.meta.url));
73824
+ const currentDir = path18.dirname(fileURLToPath3(import.meta.url));
73819
73825
  return path18.resolve(currentDir, "../../node_modules/opensrc/bin/opensrc.js");
73820
73826
  }
73821
73827
  function getOpenSrcEnv() {
@@ -74266,7 +74272,7 @@ function createTools(cwd2, opts) {
74266
74272
  tools.push(createWebSearchTool());
74267
74273
  }
74268
74274
  if (opts?.agents && opts.agents.length > 0 && opts.provider && opts.model) {
74269
- tools.push(createSubAgentTool(cwd2, opts.agents, opts.provider, opts.model, opts.getCacheKey, planModeRef));
74275
+ tools.push(createSubAgentTool(cwd2, opts.agents, () => opts.getProvider?.() ?? opts.provider, () => opts.getModel?.() ?? opts.model, opts.getCacheKey, planModeRef));
74270
74276
  }
74271
74277
  if (opts?.skills && opts.skills.length > 0) {
74272
74278
  tools.push(createSkillTool(opts.skills));
@@ -83711,6 +83717,10 @@ var AgentSession = class {
83711
83717
  customSystemPrompt;
83712
83718
  /** Shared with the tool layer so plan-mode restrictions read live state. */
83713
83719
  planModeRef = { current: false };
83720
+ /** Path of the approved plan currently being implemented, or undefined. When
83721
+ * set, the system prompt carries the `[DONE:n]` progress contract so the
83722
+ * model emits step-completion markers the UI's plan-progress widget reads. */
83723
+ approvedPlanPath;
83714
83724
  sessionId = "";
83715
83725
  sessionPath = "";
83716
83726
  lastPersistedIndex = 0;
@@ -83753,8 +83763,10 @@ var AgentSession = class {
83753
83763
  provider: this.provider,
83754
83764
  model: this.model,
83755
83765
  lspDiagnostics: this.settingsManager.get("lspDiagnostics"),
83756
- // Lazy — sessionId isn't assigned yet when createTools() runs, so we
83757
- // must defer reading the cache key until the sub-agent actually fires.
83766
+ // Lazy — sessionId/model/provider can change after createTools() runs, so
83767
+ // sub-agent spawns read the current parent state at execution time.
83768
+ getProvider: () => this.provider,
83769
+ getModel: () => this.model,
83758
83770
  getCacheKey: () => this.getPromptCacheKey(),
83759
83771
  // Plan mode: only wired when the host supplies callbacks. The ref is
83760
83772
  // shared so bash/edit/write enforce read-only restrictions live.
@@ -84198,6 +84210,8 @@ ${fileNotes.join("\n")}`);
84198
84210
  });
84199
84211
  }
84200
84212
  async newSession() {
84213
+ this.planModeRef.current = false;
84214
+ this.approvedPlanPath = void 0;
84201
84215
  const basePrompt = this.customSystemPrompt ?? await buildSystemPrompt(this.cwd, this.skills, false, void 0, this.tools.map((tool) => tool.name), void 0, this.provider);
84202
84216
  this.messages = [{ role: "system", content: basePrompt }];
84203
84217
  await this.createNewSession();
@@ -84291,9 +84305,25 @@ ${fileNotes.join("\n")}`);
84291
84305
  */
84292
84306
  async setPlanMode(active) {
84293
84307
  this.planModeRef.current = active;
84308
+ if (active)
84309
+ this.approvedPlanPath = void 0;
84310
+ await this.rebuildSystemPromptInPlace();
84311
+ }
84312
+ /**
84313
+ * Bake an approved plan into the system prompt so the model is told to emit
84314
+ * `[DONE:n]` markers as it completes each step (the contract the UI's
84315
+ * plan-progress widget reads). Pass `undefined` to clear it. No-op when a
84316
+ * custom system prompt is in force (the host owns the prompt then).
84317
+ */
84318
+ async setApprovedPlan(approvedPlanPath) {
84319
+ this.approvedPlanPath = approvedPlanPath;
84320
+ await this.rebuildSystemPromptInPlace();
84321
+ }
84322
+ /** Rebuild messages[0] from current plan-mode + approved-plan state. */
84323
+ async rebuildSystemPromptInPlace() {
84294
84324
  if (this.customSystemPrompt)
84295
84325
  return;
84296
- const rebuilt = await buildSystemPrompt(this.cwd, this.skills, active, void 0, this.tools.map((tool) => tool.name), void 0, this.provider);
84326
+ const rebuilt = await buildSystemPrompt(this.cwd, this.skills, this.planModeRef.current, this.approvedPlanPath, this.tools.map((tool) => tool.name), void 0, this.provider);
84297
84327
  if (this.messages[0]?.role === "system") {
84298
84328
  this.messages[0] = { role: "system", content: rebuilt };
84299
84329
  } else {
@@ -93799,9 +93829,9 @@ var taskBarStore = createStore({
93799
93829
  // ../ggcoder/dist/utils/sound.js
93800
93830
  init_esm_shims();
93801
93831
  import { execFile as execFile2 } from "child_process";
93802
- import { fileURLToPath as fileURLToPath3 } from "url";
93832
+ import { fileURLToPath as fileURLToPath4 } from "url";
93803
93833
  import { resolve, dirname } from "path";
93804
- var __dirname2 = dirname(fileURLToPath3(import.meta.url));
93834
+ var __dirname2 = dirname(fileURLToPath4(import.meta.url));
93805
93835
  var notificationPath = resolve(__dirname2, "../../assets/end-notification.mp3");
93806
93836
 
93807
93837
  // ../ggcoder/dist/ui/hooks/useAgentLoop.js
@@ -110428,7 +110458,7 @@ function TaskPickerMenu({ tasks, selectedIndex, width }) {
110428
110458
  // ../ggcoder/dist/ui/components/InputArea.js
110429
110459
  import { homedir as homedir2 } from "os";
110430
110460
  import { join as join2 } from "path";
110431
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, appendFileSync, mkdirSync as mkdirSync2, renameSync, unlinkSync, existsSync as existsSync3 } from "fs";
110461
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, appendFileSync, mkdirSync as mkdirSync2, renameSync, unlinkSync, existsSync as existsSync4 } from "fs";
110432
110462
  var MAX_VISIBLE_LINES = 12;
110433
110463
  var PROMPT = "> ";
110434
110464
  var PLACEHOLDER = " Type your message or / to run a command";
@@ -110568,7 +110598,7 @@ function compactHistory2() {
110568
110598
  lineCountEstimate = trimmed.length;
110569
110599
  } catch {
110570
110600
  try {
110571
- if (existsSync3(tempPath))
110601
+ if (existsSync4(tempPath))
110572
110602
  unlinkSync(tempPath);
110573
110603
  } catch {
110574
110604
  }
@@ -111680,7 +111710,7 @@ var import_react67 = __toESM(require_react(), 1);
111680
111710
 
111681
111711
  // ../ggcoder/dist/ui/pixel.js
111682
111712
  init_esm_shims();
111683
- import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
111713
+ import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
111684
111714
  import { homedir as homedir3 } from "os";
111685
111715
  import { join as join4 } from "path";
111686
111716
 
@@ -111689,9 +111719,9 @@ init_esm_shims();
111689
111719
  import { execFile as execFile3 } from "child_process";
111690
111720
  import { readFileSync as readFileSync5 } from "fs";
111691
111721
  import { dirname as dirname2, join as join3 } from "path";
111692
- import { fileURLToPath as fileURLToPath4 } from "url";
111722
+ import { fileURLToPath as fileURLToPath5 } from "url";
111693
111723
  function resolveCliVersion() {
111694
- let dir = dirname2(fileURLToPath4(import.meta.url));
111724
+ let dir = dirname2(fileURLToPath5(import.meta.url));
111695
111725
  for (let i = 0; i < 6; i++) {
111696
111726
  try {
111697
111727
  const manifest = JSON.parse(readFileSync5(join3(dir, "package.json"), "utf8"));
@@ -115138,7 +115168,7 @@ function createTaskTools(deps) {
115138
115168
  // src/audio.ts
115139
115169
  init_esm_shims();
115140
115170
  import { spawn as spawn8, execFileSync as execFileSync4 } from "child_process";
115141
- import { fileURLToPath as fileURLToPath5 } from "url";
115171
+ import { fileURLToPath as fileURLToPath6 } from "url";
115142
115172
  import path44 from "path";
115143
115173
  import fs37 from "fs";
115144
115174
  function readMp3DurationMs(file2) {
@@ -115200,7 +115230,7 @@ function getSplashAudioDurationMs() {
115200
115230
  return ms && ms > 0 ? ms : 1500;
115201
115231
  }
115202
115232
  function assetPath(name) {
115203
- const here = path44.dirname(fileURLToPath5(import.meta.url));
115233
+ const here = path44.dirname(fileURLToPath6(import.meta.url));
115204
115234
  const dist = path44.join(here, name);
115205
115235
  if (fs37.existsSync(dist)) return dist;
115206
115236
  return path44.join(here, "..", "assets", name);
@@ -115247,7 +115277,7 @@ function isWsl() {
115247
115277
  }
115248
115278
  async function tryPlayOnWindowsHost(file2) {
115249
115279
  try {
115250
- const here = path44.dirname(fileURLToPath5(import.meta.url));
115280
+ const here = path44.dirname(fileURLToPath6(import.meta.url));
115251
115281
  const devAssets = path44.resolve(here, "..", "assets");
115252
115282
  const resolved = path44.resolve(file2);
115253
115283
  const inDist = resolved === here || resolved.startsWith(here + path44.sep);
@@ -116467,4 +116497,4 @@ react/cjs/react-jsx-runtime.development.js:
116467
116497
  * LICENSE file in the root directory of this source tree.
116468
116498
  *)
116469
116499
  */
116470
- //# sourceMappingURL=chunk-D3OOVNMX.js.map
116500
+ //# sourceMappingURL=chunk-CR6V6KR3.js.map