@kenkaiiii/gg-boss 4.6.2 → 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.
@@ -63507,6 +63507,29 @@ function isRawThinking(part) {
63507
63507
  const t = part.data.type;
63508
63508
  return t === "thinking" || t === "redacted_thinking";
63509
63509
  }
63510
+ var ANTHROPIC_INPUT_BLOCK_TYPES = /* @__PURE__ */ new Set([
63511
+ "bash_code_execution_tool_result",
63512
+ "code_execution_tool_result",
63513
+ "connector_text",
63514
+ "container_upload",
63515
+ "document",
63516
+ "image",
63517
+ "mid_conv_system",
63518
+ "redacted_thinking",
63519
+ "search_result",
63520
+ "server_tool_use",
63521
+ "text",
63522
+ "text_editor_code_execution_tool_result",
63523
+ "thinking",
63524
+ "tool_result",
63525
+ "tool_search_tool_result",
63526
+ "tool_use",
63527
+ "web_fetch_tool_result",
63528
+ "web_search_tool_result"
63529
+ ]);
63530
+ function isAnthropicCompatibleRaw(part) {
63531
+ return ANTHROPIC_INPUT_BLOCK_TYPES.has(part.data.type);
63532
+ }
63510
63533
  function isPositionSensitiveThinking(part) {
63511
63534
  if (part.type === "thinking") return hasValidThinkingSignature(part);
63512
63535
  return isRawThinking(part);
@@ -63533,7 +63556,8 @@ function toAnthropicAssistantPart(part, idMap) {
63533
63556
  };
63534
63557
  if (part.type === "server_tool_result")
63535
63558
  return part.data;
63536
- if (part.type === "raw") return part.data;
63559
+ if (part.type === "raw")
63560
+ return isAnthropicCompatibleRaw(part) ? part.data : null;
63537
63561
  return null;
63538
63562
  }
63539
63563
  function toAnthropicAssistantContent(content, preserveThinking, idMap) {
@@ -69086,10 +69110,14 @@ var ProcessManager = class {
69086
69110
  const child = spawn2("bash", ["-c", command], {
69087
69111
  cwd: cwd2,
69088
69112
  detached: true,
69089
- 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],
69090
69116
  env: getSafeToolEnv()
69091
69117
  });
69092
69118
  fs6.closeSync(fd2);
69119
+ child.stdin?.on("error", () => {
69120
+ });
69093
69121
  const pid = child.pid;
69094
69122
  child.unref();
69095
69123
  const proc = {
@@ -69137,6 +69165,40 @@ var ProcessManager = class {
69137
69165
  const isRunning = this.children.has(id2);
69138
69166
  return { id: id2, isRunning, exitCode: proc.exitCode, output };
69139
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
+ }
69140
69202
  async stop(id2) {
69141
69203
  const proc = this.processes.get(id2);
69142
69204
  if (!proc)
@@ -71097,7 +71159,7 @@ var BashParams = external_exports.object({
71097
71159
  function createBashTool(cwd2, processManager, ops = localOperations, planModeRef) {
71098
71160
  return {
71099
71161
  name: "bash",
71100
- 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.",
71101
71163
  parameters: BashParams,
71102
71164
  executionMode: "sequential",
71103
71165
  async execute({ command, timeout: timeoutMs, run_in_background }, context) {
@@ -71110,7 +71172,7 @@ function createBashTool(cwd2, processManager, ops = localOperations, planModeRef
71110
71172
  ID: ${result.id}
71111
71173
  PID: ${result.pid}
71112
71174
  Log: ${result.logFile}
71113
- 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.`;
71114
71176
  }
71115
71177
  const effectiveTimeout = timeoutMs ?? DEFAULT_TIMEOUT;
71116
71178
  return new Promise((resolve2) => {
@@ -73038,6 +73100,29 @@ function createTaskStopTool(processManager) {
73038
73100
  };
73039
73101
  }
73040
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
+
73041
73126
  // ../ggcoder/dist/tools/tasks.js
73042
73127
  init_esm_shims();
73043
73128
 
@@ -73400,6 +73485,7 @@ function createTools(cwd2, opts) {
73400
73485
  createSourcePathTool(cwd2),
73401
73486
  createWebFetchTool(),
73402
73487
  createTaskOutputTool(processManager),
73488
+ createTaskSendTool(processManager),
73403
73489
  createTaskStopTool(processManager),
73404
73490
  createTasksTool(cwd2),
73405
73491
  createScreenshotTool(cwd2)
@@ -114479,4 +114565,4 @@ react/cjs/react-jsx-runtime.development.js:
114479
114565
  * LICENSE file in the root directory of this source tree.
114480
114566
  *)
114481
114567
  */
114482
- //# sourceMappingURL=chunk-TXKXCIP2.js.map
114568
+ //# sourceMappingURL=chunk-ZJHFDDEC.js.map