@kenkaiiii/gg-boss 4.6.3 → 4.7.0

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.
@@ -69110,10 +69110,14 @@ var ProcessManager = class {
69110
69110
  const child = spawn2("bash", ["-c", command], {
69111
69111
  cwd: cwd2,
69112
69112
  detached: true,
69113
- stdio: ["ignore", fd2, fd2],
69113
+ // stdin is a pipe so callers can drive interactive processes (REPLs,
69114
+ // scaffolders, [Y/n] prompts) via sendInput(); stdout/stderr go to the log.
69115
+ stdio: ["pipe", fd2, fd2],
69114
69116
  env: getSafeToolEnv()
69115
69117
  });
69116
69118
  fs6.closeSync(fd2);
69119
+ child.stdin?.on("error", () => {
69120
+ });
69117
69121
  const pid = child.pid;
69118
69122
  child.unref();
69119
69123
  const proc = {
@@ -69161,6 +69165,40 @@ var ProcessManager = class {
69161
69165
  const isRunning = this.children.has(id2);
69162
69166
  return { id: id2, isRunning, exitCode: proc.exitCode, output };
69163
69167
  }
69168
+ /**
69169
+ * Write input to a running background process's stdin, enabling interactive
69170
+ * control (answer prompts, drive a REPL, feed a scaffolder). By default a
69171
+ * newline is appended (as if the user pressed Enter). Set `eof` to close
69172
+ * stdin afterwards, signalling end-of-input (Ctrl-D) to the program.
69173
+ */
69174
+ async sendInput(id2, input, opts = {}) {
69175
+ const proc = this.processes.get(id2);
69176
+ if (!proc)
69177
+ return `No background process with id "${id2}"`;
69178
+ const child = this.children.get(id2);
69179
+ if (!child || proc.exitCode !== null) {
69180
+ return `Process ${id2} already exited (code ${proc.exitCode})`;
69181
+ }
69182
+ const stdin = child.stdin;
69183
+ if (!stdin || stdin.destroyed || stdin.writableEnded) {
69184
+ return `Process ${id2} is not accepting input (stdin is closed).`;
69185
+ }
69186
+ const enter = opts.enter ?? true;
69187
+ const text = input + (enter ? "\n" : "");
69188
+ try {
69189
+ if (text.length > 0) {
69190
+ await new Promise((resolve2, reject) => {
69191
+ stdin.write(text, (err) => err ? reject(err) : resolve2());
69192
+ });
69193
+ }
69194
+ if (opts.eof)
69195
+ stdin.end();
69196
+ } catch (err) {
69197
+ return `Failed to send input to ${id2}: ${err.message}`;
69198
+ }
69199
+ const summary = opts.eof ? text.length > 0 ? `Sent input and closed stdin (EOF) for ${id2}.` : `Closed stdin (EOF) for ${id2}.` : `Sent input to ${id2}.`;
69200
+ return `${summary} Use task_output with id="${id2}" to read the response.`;
69201
+ }
69164
69202
  async stop(id2) {
69165
69203
  const proc = this.processes.get(id2);
69166
69204
  if (!proc)
@@ -71121,7 +71159,7 @@ var BashParams = external_exports.object({
71121
71159
  function createBashTool(cwd2, processManager, ops = localOperations, planModeRef) {
71122
71160
  return {
71123
71161
  name: "bash",
71124
- description: "Execute a bash command. The shell's working directory is already set to the project root \u2014 don't cd into it redundantly. Use cd only when you need a different directory. Returns exit code and combined stdout/stderr. Commands run in a non-interactive bash shell with TERM=dumb. Long output is truncated (tail kept). Set run_in_background=true for long-running processes (dev servers, watchers). Use task_output/task_stop to interact with background processes.",
71162
+ description: "Execute a bash command. The shell's working directory is already set to the project root \u2014 don't cd into it redundantly. Use cd only when you need a different directory. Returns exit code and combined stdout/stderr. Commands run in a non-interactive bash shell with TERM=dumb. Long output is truncated (tail kept). Set run_in_background=true for long-running OR interactive processes (dev servers, watchers, REPLs, scaffolders, programs that prompt for input). Use task_output to read output, task_send to type input/answer prompts, and task_stop to stop background processes.",
71125
71163
  parameters: BashParams,
71126
71164
  executionMode: "sequential",
71127
71165
  async execute({ command, timeout: timeoutMs, run_in_background }, context) {
@@ -71134,7 +71172,7 @@ function createBashTool(cwd2, processManager, ops = localOperations, planModeRef
71134
71172
  ID: ${result.id}
71135
71173
  PID: ${result.pid}
71136
71174
  Log: ${result.logFile}
71137
- Use task_output with id="${result.id}" to read output.`;
71175
+ Use task_output with id="${result.id}" to read output, task_send to type input/answer prompts, task_stop to stop it.`;
71138
71176
  }
71139
71177
  const effectiveTimeout = timeoutMs ?? DEFAULT_TIMEOUT;
71140
71178
  return new Promise((resolve2) => {
@@ -73062,6 +73100,29 @@ function createTaskStopTool(processManager) {
73062
73100
  };
73063
73101
  }
73064
73102
 
73103
+ // ../ggcoder/dist/tools/task-send.js
73104
+ init_esm_shims();
73105
+ var TaskSendParams = external_exports.object({
73106
+ id: external_exports.string().describe("The background process ID to send input to"),
73107
+ input: external_exports.string().optional().describe("Text to type into the process's stdin (e.g. an answer to a prompt or a REPL line)"),
73108
+ enter: external_exports.boolean().optional().describe("Append a newline (press Enter) after the input. Default true."),
73109
+ eof: external_exports.boolean().optional().describe("Close stdin after sending, signalling end-of-input (Ctrl-D).")
73110
+ });
73111
+ function createTaskSendTool(processManager) {
73112
+ return {
73113
+ name: "task_send",
73114
+ description: "Send input to a running background process (started with run_in_background) to drive it interactively \u2014 answer a [Y/n] or password-style prompt, type into a REPL, or feed a scaffolder's questions. By default the input is followed by Enter. After sending, call task_output to read the process's response. Set eof=true to close stdin (Ctrl-D).",
73115
+ parameters: TaskSendParams,
73116
+ executionMode: "sequential",
73117
+ async execute({ id: id2, input, enter, eof }) {
73118
+ if ((input === void 0 || input === "") && enter === false && !eof) {
73119
+ return "Nothing to send: provide input, or set enter=true to press Enter, or eof=true.";
73120
+ }
73121
+ return processManager.sendInput(id2, input ?? "", { enter, eof });
73122
+ }
73123
+ };
73124
+ }
73125
+
73065
73126
  // ../ggcoder/dist/tools/tasks.js
73066
73127
  init_esm_shims();
73067
73128
 
@@ -73424,6 +73485,7 @@ function createTools(cwd2, opts) {
73424
73485
  createSourcePathTool(cwd2),
73425
73486
  createWebFetchTool(),
73426
73487
  createTaskOutputTool(processManager),
73488
+ createTaskSendTool(processManager),
73427
73489
  createTaskStopTool(processManager),
73428
73490
  createTasksTool(cwd2),
73429
73491
  createScreenshotTool(cwd2)
@@ -114503,4 +114565,4 @@ react/cjs/react-jsx-runtime.development.js:
114503
114565
  * LICENSE file in the root directory of this source tree.
114504
114566
  *)
114505
114567
  */
114506
- //# sourceMappingURL=chunk-EVFGJFHT.js.map
114568
+ //# sourceMappingURL=chunk-ZJHFDDEC.js.map