@rdmind/rdmind 0.1.8 → 0.1.9-alpha.1

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.
Files changed (45) hide show
  1. package/cli.js +287 -78
  2. package/locales/en.js +3 -1
  3. package/locales/zh.js +3 -0
  4. package/package.json +2 -2
  5. package/template/pom.xml +40 -0
  6. package/template/sns-demo-app/pom.xml +0 -5
  7. package/template/sns-demo-common/pom.xml +4 -5
  8. package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/constants/AppPlatform.java +57 -0
  9. package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/enums/ErrorCodeEnum.java +30 -0
  10. package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/exception/AppBizException.java +51 -0
  11. package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/utils/AssertUtils.java +137 -0
  12. package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/utils/JsonHelper.java +129 -0
  13. package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/utils/WrappedContextHelper.java +182 -0
  14. package/template/sns-demo-domain/pom.xml +0 -5
  15. package/template/sns-demo-infrastructure/pom.xml +0 -5
  16. package/template/sns-demo-start/pom.xml +0 -5
  17. package/template/sns-demo-start/src/main/resources/logback-spring.xml +5 -8
  18. package/templates/idl-template/wiki/.idea/codeStyles/Project.xml +7 -0
  19. package/templates/idl-template/wiki/.idea/codeStyles/codeStyleConfig.xml +5 -0
  20. package/templates/idl-template/wiki/.idea/inspectionProfiles/Project_Default.xml +5 -0
  21. package/templates/idl-template/wiki/.idea/misc.xml +14 -0
  22. package/templates/idl-template/wiki/.idea/modules.xml +8 -0
  23. package/templates/idl-template/wiki/.idea/vcs.xml +6 -0
  24. package/templates/idl-template/wiki/.idea/wiki.iml +9 -0
  25. package/templates/idl-template/wiki/SDK-Dev-Guide.md +0 -2
  26. package/templates/idl-template/wiki/example/.gitlab-ci.yml +3 -17
  27. package/templates/idl-template/wiki/example/base.thrift +94 -0
  28. package/templates/idl-template/wiki/example/common.thrift +39 -0
  29. package/templates/idl-template/wiki/example/dto.thrift +3 -0
  30. package/templates/idl-template/wiki/example/enum.thrift +1 -0
  31. package/templates/idl-template/wiki/example/gen-java.sh +5 -2
  32. package/templates/idl-template/wiki/example/maven_project/pom.xml +57 -38
  33. package/templates/idl-template/wiki/example/req.thrift +4 -0
  34. package/templates/idl-template/wiki/example/res.thrift +5 -0
  35. package/templates/idl-template/wiki/example/sdk-spec.yml +4 -3
  36. package/templates/idl-template/wiki/example/service.thrift +15 -0
  37. package/template/sns-demo-common/src/main/java/com/xiaohongshu/sns/demo/common/enums/.gitkeep +0 -0
  38. package/template/sns-demo-start/src/main/java/com/xiaohongshu/sns/demo/start/provider/.gitkeep +0 -0
  39. package/templates/idl-template/wiki/.arcconfig +0 -3
  40. package/templates/idl-template/wiki/example/.arcconfig +0 -3
  41. package/templates/idl-template/wiki/example/hello.thrift +0 -29
  42. package/templates/idl-template/wiki/example/maven_project/src/main/java/com/xiaohongshu/sns/thrift/hello/HelloServiceAutoConfiguration.java +0 -46
  43. package/templates/idl-template/wiki/example/maven_project/src/main/java/com/xiaohongshu/sns/thrift/hello/HelloServiceProperties.java +0 -18
  44. package/templates/idl-template/wiki/example/maven_project/src/main/resources/META-INF/spring.factories +0 -3
  45. package/templates/idl-template/wiki/example/maven_project/src/test/java/com/xiaohongshu/sns/thrift/test/AutoConfigureTest.java +0 -53
package/cli.js CHANGED
@@ -70991,13 +70991,20 @@ var require_dist3 = __commonJS({
70991
70991
  });
70992
70992
 
70993
70993
  // packages/core/src/utils/schemaValidator.ts
70994
- function fixBooleanCasing(data) {
70994
+ function fixBooleanValues(data) {
70995
70995
  for (const key of Object.keys(data)) {
70996
70996
  if (!(key in data)) continue;
70997
- if (typeof data[key] === "object") {
70998
- fixBooleanCasing(data[key]);
70999
- } else if (data[key] === "True") data[key] = "true";
71000
- else if (data[key] === "False") data[key] = "false";
70997
+ const value = data[key];
70998
+ if (typeof value === "object" && value !== null) {
70999
+ fixBooleanValues(value);
71000
+ } else if (typeof value === "string") {
71001
+ const lower3 = value.toLowerCase();
71002
+ if (lower3 === "true") {
71003
+ data[key] = true;
71004
+ } else if (lower3 === "false") {
71005
+ data[key] = false;
71006
+ }
71007
+ }
71001
71008
  }
71002
71009
  }
71003
71010
  var import_ajv, addFormats, AjvClass, ajValidator, addFormatsFunc, SchemaValidator;
@@ -71038,19 +71045,18 @@ var init_schemaValidator = __esm({
71038
71045
  return "Value of params must be an object";
71039
71046
  }
71040
71047
  const validate3 = ajValidator.compile(schema);
71041
- const valid = validate3(data);
71048
+ let valid = validate3(data);
71042
71049
  if (!valid && validate3.errors) {
71043
- fixBooleanCasing(data);
71044
- const validate4 = ajValidator.compile(schema);
71045
- const valid2 = validate4(data);
71046
- if (!valid2 && validate4.errors) {
71047
- return ajValidator.errorsText(validate4.errors, { dataVar: "params" });
71050
+ fixBooleanValues(data);
71051
+ valid = validate3(data);
71052
+ if (!valid && validate3.errors) {
71053
+ return ajValidator.errorsText(validate3.errors, { dataVar: "params" });
71048
71054
  }
71049
71055
  }
71050
71056
  return null;
71051
71057
  }
71052
71058
  };
71053
- __name(fixBooleanCasing, "fixBooleanCasing");
71059
+ __name(fixBooleanValues, "fixBooleanValues");
71054
71060
  }
71055
71061
  });
71056
71062
 
@@ -132347,10 +132353,23 @@ var init_converter = __esm({
132347
132353
  if (message.role === "assistant" && merged.length > 0) {
132348
132354
  const lastMessage = merged[merged.length - 1];
132349
132355
  if (lastMessage.role === "assistant") {
132350
- const combinedContent = [
132351
- typeof lastMessage.content === "string" ? lastMessage.content : "",
132352
- typeof message.content === "string" ? message.content : ""
132353
- ].filter(Boolean).join("");
132356
+ const lastContent = lastMessage.content;
132357
+ const currentContent = message.content;
132358
+ const useArrayFormat = Array.isArray(lastContent) || Array.isArray(currentContent);
132359
+ let combinedContent;
132360
+ if (useArrayFormat) {
132361
+ const lastParts = Array.isArray(lastContent) ? lastContent : typeof lastContent === "string" && lastContent ? [{ type: "text", text: lastContent }] : [];
132362
+ const currentParts = Array.isArray(currentContent) ? currentContent : typeof currentContent === "string" && currentContent ? [{ type: "text", text: currentContent }] : [];
132363
+ combinedContent = [
132364
+ ...lastParts,
132365
+ ...currentParts
132366
+ ];
132367
+ } else {
132368
+ const lastText = typeof lastContent === "string" ? lastContent : "";
132369
+ const currentText = typeof currentContent === "string" ? currentContent : "";
132370
+ const mergedText = [lastText, currentText].filter(Boolean).join("");
132371
+ combinedContent = mergedText || null;
132372
+ }
132354
132373
  const lastToolCalls = "tool_calls" in lastMessage ? lastMessage.tool_calls || [] : [];
132355
132374
  const currentToolCalls = "tool_calls" in message ? message.tool_calls || [] : [];
132356
132375
  const combinedToolCalls = [...lastToolCalls, ...currentToolCalls];
@@ -156088,7 +156107,7 @@ __export(geminiContentGenerator_exports2, {
156088
156107
  createGeminiContentGenerator: () => createGeminiContentGenerator
156089
156108
  });
156090
156109
  function createGeminiContentGenerator(config2, gcConfig) {
156091
- const version2 = "0.1.8";
156110
+ const version2 = "0.1.9-alpha.1";
156092
156111
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
156093
156112
  const baseHeaders = {
156094
156113
  "User-Agent": userAgent2
@@ -171400,10 +171419,10 @@ var init_terminalSerializer = __esm({
171400
171419
  });
171401
171420
 
171402
171421
  // packages/core/src/services/shellExecutionService.ts
171403
- import { spawn as cpSpawn } from "node:child_process";
171422
+ import { spawn as cpSpawn, spawnSync as spawnSync2 } from "node:child_process";
171404
171423
  import { TextDecoder as TextDecoder2 } from "node:util";
171405
171424
  import os13 from "node:os";
171406
- var import_headless, Terminal, SIGKILL_TIMEOUT_MS, getFullBufferText, ShellExecutionService;
171425
+ var import_headless, Terminal, SIGKILL_TIMEOUT_MS, getFullBufferText, windowsStrategy, posixStrategy, getCleanupStrategy, ShellExecutionService;
171407
171426
  var init_shellExecutionService = __esm({
171408
171427
  "packages/core/src/services/shellExecutionService.ts"() {
171409
171428
  "use strict";
@@ -171426,11 +171445,58 @@ var init_shellExecutionService = __esm({
171426
171445
  }
171427
171446
  return lines.join("\n").trimEnd();
171428
171447
  }, "getFullBufferText");
171429
- ShellExecutionService = class {
171448
+ windowsStrategy = {
171449
+ killPty: /* @__PURE__ */ __name((_pid, pty) => {
171450
+ pty.ptyProcess.kill();
171451
+ }, "killPty"),
171452
+ killChildProcesses: /* @__PURE__ */ __name((pids) => {
171453
+ if (pids.size > 0) {
171454
+ try {
171455
+ const args = ["/f", "/t"];
171456
+ for (const pid of pids) {
171457
+ args.push("/pid", pid.toString());
171458
+ }
171459
+ spawnSync2("taskkill", args);
171460
+ } catch {
171461
+ }
171462
+ }
171463
+ }, "killChildProcesses")
171464
+ };
171465
+ posixStrategy = {
171466
+ killPty: /* @__PURE__ */ __name((pid, _pty) => {
171467
+ process.kill(-pid, "SIGKILL");
171468
+ }, "killPty"),
171469
+ killChildProcesses: /* @__PURE__ */ __name((pids) => {
171470
+ for (const pid of pids) {
171471
+ try {
171472
+ process.kill(-pid, "SIGKILL");
171473
+ } catch {
171474
+ }
171475
+ }
171476
+ }, "killChildProcesses")
171477
+ };
171478
+ getCleanupStrategy = /* @__PURE__ */ __name(() => os13.platform() === "win32" ? windowsStrategy : posixStrategy, "getCleanupStrategy");
171479
+ ShellExecutionService = class _ShellExecutionService {
171430
171480
  static {
171431
171481
  __name(this, "ShellExecutionService");
171432
171482
  }
171433
171483
  static activePtys = /* @__PURE__ */ new Map();
171484
+ static activeChildProcesses = /* @__PURE__ */ new Set();
171485
+ static cleanup() {
171486
+ const strategy = getCleanupStrategy();
171487
+ for (const [pid, pty] of this.activePtys) {
171488
+ try {
171489
+ strategy.killPty(pid, pty);
171490
+ } catch {
171491
+ }
171492
+ }
171493
+ strategy.killChildProcesses(this.activeChildProcesses);
171494
+ }
171495
+ static {
171496
+ process.on("exit", () => {
171497
+ _ShellExecutionService.cleanup();
171498
+ });
171499
+ }
171434
171500
  /**
171435
171501
  * Executes a shell command using `node-pty`, capturing all output and lifecycle events.
171436
171502
  *
@@ -171473,7 +171539,7 @@ var init_shellExecutionService = __esm({
171473
171539
  stdio: ["ignore", "pipe", "pipe"],
171474
171540
  windowsVerbatimArguments: true,
171475
171541
  shell: isWindows8 ? true : "bash",
171476
- detached: !isWindows8,
171542
+ detached: true,
171477
171543
  env: {
171478
171544
  ...process.env,
171479
171545
  QWEN_CODE: "1",
@@ -171568,9 +171634,12 @@ var init_shellExecutionService = __esm({
171568
171634
  }
171569
171635
  }, "abortHandler");
171570
171636
  abortSignal.addEventListener("abort", abortHandler, { once: true });
171637
+ if (child.pid) {
171638
+ this.activeChildProcesses.add(child.pid);
171639
+ }
171571
171640
  child.on("exit", (code2, signal) => {
171572
171641
  if (child.pid) {
171573
- this.activePtys.delete(child.pid);
171642
+ this.activeChildProcesses.delete(child.pid);
171574
171643
  }
171575
171644
  handleExit(code2, signal);
171576
171645
  });
@@ -171594,7 +171663,7 @@ var init_shellExecutionService = __esm({
171594
171663
  }
171595
171664
  __name(cleanup, "cleanup");
171596
171665
  });
171597
- return { pid: void 0, result };
171666
+ return { pid: child.pid, result };
171598
171667
  } catch (e4) {
171599
171668
  const error2 = e4;
171600
171669
  return {
@@ -172907,9 +172976,12 @@ var init_shell = __esm({
172907
172976
  const processedCommand = this.addCoAuthorToGitCommit(strippedCommand);
172908
172977
  const shouldRunInBackground = this.params.is_background;
172909
172978
  let finalCommand = processedCommand;
172910
- if (shouldRunInBackground && !finalCommand.trim().endsWith("&")) {
172979
+ if (!isWindows8 && shouldRunInBackground && !finalCommand.trim().endsWith("&")) {
172911
172980
  finalCommand = finalCommand.trim() + " &";
172912
172981
  }
172982
+ if (isWindows8 && shouldRunInBackground) {
172983
+ finalCommand = finalCommand.trim().replace(/&+$/, "").trim();
172984
+ }
172913
172985
  const commandToExecute = isWindows8 ? finalCommand : (() => {
172914
172986
  let command2 = finalCommand.trim();
172915
172987
  if (!command2.endsWith("&")) command2 += ";";
@@ -172923,9 +172995,6 @@ var init_shell = __esm({
172923
172995
  commandToExecute,
172924
172996
  cwd7,
172925
172997
  (event) => {
172926
- if (!updateOutput2) {
172927
- return;
172928
- }
172929
172998
  let shouldUpdate = false;
172930
172999
  switch (event.type) {
172931
173000
  case "data":
@@ -172951,7 +173020,7 @@ var init_shell = __esm({
172951
173020
  throw new Error("An unhandled ShellOutputEvent was found.");
172952
173021
  }
172953
173022
  }
172954
- if (shouldUpdate) {
173023
+ if (shouldUpdate && updateOutput2) {
172955
173024
  updateOutput2(
172956
173025
  typeof cumulativeOutput === "string" ? cumulativeOutput : { ansiOutput: cumulativeOutput }
172957
173026
  );
@@ -172965,6 +173034,14 @@ var init_shell = __esm({
172965
173034
  if (pid && setPidCallback) {
172966
173035
  setPidCallback(pid);
172967
173036
  }
173037
+ if (shouldRunInBackground) {
173038
+ const pidMsg = pid ? ` PID: ${pid}` : "";
173039
+ const killHint = isWindows8 ? " (Use taskkill /F /T /PID <pid> to stop)" : " (Use kill <pid> to stop)";
173040
+ return {
173041
+ llmContent: `Background command started.${pidMsg}${killHint}`,
173042
+ returnDisplay: `Background command started.${pidMsg}${killHint}`
173043
+ };
173044
+ }
172968
173045
  const result = await resultPromise;
172969
173046
  const backgroundPIDs = [];
172970
173047
  if (os15.platform() !== "win32") {
@@ -205441,16 +205518,16 @@ var require_cross_spawn = __commonJS({
205441
205518
  return spawned;
205442
205519
  }
205443
205520
  __name(spawn11, "spawn");
205444
- function spawnSync5(command2, args, options2) {
205521
+ function spawnSync6(command2, args, options2) {
205445
205522
  const parsed = parse13(command2, args, options2);
205446
205523
  const result = cp2.spawnSync(parsed.command, parsed.args, parsed.options);
205447
205524
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
205448
205525
  return result;
205449
205526
  }
205450
- __name(spawnSync5, "spawnSync");
205527
+ __name(spawnSync6, "spawnSync");
205451
205528
  module2.exports = spawn11;
205452
205529
  module2.exports.spawn = spawn11;
205453
- module2.exports.sync = spawnSync5;
205530
+ module2.exports.sync = spawnSync6;
205454
205531
  module2.exports._parse = parse13;
205455
205532
  module2.exports._enoent = enoent;
205456
205533
  }
@@ -233733,8 +233810,8 @@ var init_git_commit = __esm({
233733
233810
  "packages/core/src/generated/git-commit.ts"() {
233734
233811
  "use strict";
233735
233812
  init_esbuild_shims();
233736
- GIT_COMMIT_INFO = "8f0613d7";
233737
- CLI_VERSION = "0.1.8";
233813
+ GIT_COMMIT_INFO = "94f47fed";
233814
+ CLI_VERSION = "0.1.9-alpha.1";
233738
233815
  }
233739
233816
  });
233740
233817
 
@@ -282963,7 +283040,18 @@ function handleError(error2, config2, customErrorCode) {
282963
283040
  throw error2;
282964
283041
  }
282965
283042
  }
282966
- function handleToolError(toolName, toolError, config2, _errorCode, resultDisplay) {
283043
+ function handleToolError(toolName, toolError, config2, errorCode, resultDisplay) {
283044
+ const isExecutionDenied = errorCode === "execution_denied" /* EXECUTION_DENIED */;
283045
+ const isNonInteractive = !config2.isInteractive();
283046
+ const isTextMode = config2.getOutputFormat() === "text" /* TEXT */;
283047
+ if (isExecutionDenied && isNonInteractive && isTextMode) {
283048
+ const warningMessage = `Warning: Tool "${toolName}" requires user approval but cannot execute in non-interactive mode.
283049
+ To enable automatic tool execution, use the -y flag (YOLO mode):
283050
+ Example: rdmind -p 'your prompt' -y
283051
+
283052
+ `;
283053
+ process.stderr.write(warningMessage);
283054
+ }
282967
283055
  if (config2.getDebugMode()) {
282968
283056
  console.error(
282969
283057
  `Error executing tool ${toolName}: ${resultDisplay || toolError.message}`
@@ -304741,6 +304829,8 @@ var init_en3 = __esm({
304741
304829
  "Available RDMind CLI tools:": "Available RDMind CLI tools:",
304742
304830
  "No tools available": "No tools available",
304743
304831
  "View or change the approval mode for tool usage": "View or change the approval mode for tool usage",
304832
+ 'Invalid approval mode "{{arg}}". Valid modes: {{modes}}': 'Invalid approval mode "{{arg}}". Valid modes: {{modes}}',
304833
+ 'Approval mode set to "{{mode}}"': 'Approval mode set to "{{mode}}"',
304744
304834
  "View or change the language setting": "View or change the language setting",
304745
304835
  "change the theme": "change the theme",
304746
304836
  "Select Theme": "Select Theme",
@@ -305486,7 +305576,6 @@ var init_en3 = __esm({
305486
305576
  "Applying percussive maintenance...",
305487
305577
  "Searching for the correct USB orientation...",
305488
305578
  "Ensuring the magic smoke stays inside the wires...",
305489
- "Rewriting in Rust for no particular reason...",
305490
305579
  "Trying to exit Vim...",
305491
305580
  "Spinning up the hamster wheel...",
305492
305581
  "That's not a bug, it's an undocumented feature...",
@@ -305613,6 +305702,8 @@ var init_zh = __esm({
305613
305702
  "Available RDMind CLI tools:": "\u53EF\u7528\u7684 RDMind CLI \u5DE5\u5177\uFF1A",
305614
305703
  "No tools available": "\u6CA1\u6709\u53EF\u7528\u5DE5\u5177",
305615
305704
  "View or change the approval mode for tool usage": "\u67E5\u770B\u6216\u66F4\u6539\u5DE5\u5177\u4F7F\u7528\u7684\u5BA1\u6279\u6A21\u5F0F",
305705
+ 'Invalid approval mode "{{arg}}". Valid modes: {{modes}}': '\u65E0\u6548\u7684\u5BA1\u6279\u6A21\u5F0F "{{arg}}"\u3002\u6709\u6548\u6A21\u5F0F\uFF1A{{modes}}',
305706
+ 'Approval mode set to "{{mode}}"': '\u5BA1\u6279\u6A21\u5F0F\u5DF2\u8BBE\u7F6E\u4E3A "{{mode}}"',
305616
305707
  "View or change the language setting": "\u67E5\u770B\u6216\u66F4\u6539\u8BED\u8A00\u8BBE\u7F6E",
305617
305708
  "change the theme": "\u66F4\u6539\u4E3B\u9898",
305618
305709
  "Select Theme": "\u9009\u62E9\u4E3B\u9898",
@@ -344049,7 +344140,7 @@ __name(getPackageJson, "getPackageJson");
344049
344140
  // packages/cli/src/utils/version.ts
344050
344141
  async function getCliVersion() {
344051
344142
  const pkgJson = await getPackageJson();
344052
- return "0.1.8";
344143
+ return "0.1.9-alpha.1";
344053
344144
  }
344054
344145
  __name(getCliVersion, "getCliVersion");
344055
344146
 
@@ -348336,9 +348427,13 @@ async function parseArguments(settings) {
348336
348427
  type: "boolean",
348337
348428
  description: "Enables checkpointing of file edits",
348338
348429
  default: false
348339
- }).option("experimental-acp", {
348430
+ }).option("acp", {
348340
348431
  type: "boolean",
348341
348432
  description: "Starts the agent in ACP mode"
348433
+ }).option("experimental-acp", {
348434
+ type: "boolean",
348435
+ description: "Starts the agent in ACP mode (deprecated, use --acp instead)",
348436
+ hidden: true
348342
348437
  }).option("experimental-skills", {
348343
348438
  type: "boolean",
348344
348439
  description: "Enable experimental Skills feature",
@@ -348534,7 +348629,15 @@ async function parseArguments(settings) {
348534
348629
  }
348535
348630
  }
348536
348631
  result["query"] = q2 || void 0;
348537
- if (result["experimentalAcp"] && !result["channel"]) {
348632
+ if (result["experimentalAcp"]) {
348633
+ console.warn(
348634
+ "\x1B[33m\u26A0 Warning: --experimental-acp is deprecated and will be removed in a future release. Please use --acp instead.\x1B[0m"
348635
+ );
348636
+ if (!result["acp"]) {
348637
+ result["acp"] = true;
348638
+ }
348639
+ }
348640
+ if ((result["acp"] || result["experimentalAcp"]) && !result["channel"]) {
348538
348641
  result["channel"] = "ACP";
348539
348642
  }
348540
348643
  return result;
@@ -348789,7 +348892,7 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, a
348789
348892
  extensionContextFilePaths,
348790
348893
  sessionTokenLimit: settings.model?.sessionTokenLimit ?? -1,
348791
348894
  maxSessionTurns: argv.maxSessionTurns ?? settings.model?.maxSessionTurns ?? -1,
348792
- experimentalZedIntegration: argv.experimentalAcp || false,
348895
+ experimentalZedIntegration: argv.acp || argv.experimentalAcp || false,
348793
348896
  experimentalSkills: argv.experimentalSkills || false,
348794
348897
  listExtensions: argv.listExtensions || false,
348795
348898
  extensions: allExtensions,
@@ -352288,7 +352391,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
352288
352391
 
352289
352392
  // packages/cli/src/generated/git-commit.ts
352290
352393
  init_esbuild_shims();
352291
- var GIT_COMMIT_INFO2 = "8f0613d7";
352394
+ var GIT_COMMIT_INFO2 = "94f47fed";
352292
352395
 
352293
352396
  // packages/cli/src/utils/systemInfo.ts
352294
352397
  async function getNpmVersion() {
@@ -352422,16 +352525,57 @@ var agentsCommand = {
352422
352525
 
352423
352526
  // packages/cli/src/ui/commands/approvalModeCommand.ts
352424
352527
  init_esbuild_shims();
352528
+ init_core5();
352529
+ function parseApprovalModeArg(arg) {
352530
+ const trimmed2 = arg.trim().toLowerCase();
352531
+ if (!trimmed2) {
352532
+ return void 0;
352533
+ }
352534
+ return APPROVAL_MODES.find((mode) => mode.toLowerCase() === trimmed2);
352535
+ }
352536
+ __name(parseApprovalModeArg, "parseApprovalModeArg");
352425
352537
  var approvalModeCommand = {
352426
352538
  name: "approval-mode",
352427
352539
  get description() {
352428
352540
  return t4("View or change the approval mode for tool usage");
352429
352541
  },
352430
352542
  kind: "built-in" /* BUILT_IN */,
352431
- action: /* @__PURE__ */ __name(async (_context, _args) => ({
352432
- type: "dialog",
352433
- dialog: "approval-mode"
352434
- }), "action")
352543
+ action: /* @__PURE__ */ __name(async (context2, args) => {
352544
+ const mode = parseApprovalModeArg(args);
352545
+ if (!args.trim()) {
352546
+ return {
352547
+ type: "dialog",
352548
+ dialog: "approval-mode"
352549
+ };
352550
+ }
352551
+ if (!mode) {
352552
+ return {
352553
+ type: "message",
352554
+ messageType: "error",
352555
+ content: t4('Invalid approval mode "{{arg}}". Valid modes: {{modes}}', {
352556
+ arg: args.trim(),
352557
+ modes: APPROVAL_MODES.join(", ")
352558
+ })
352559
+ };
352560
+ }
352561
+ const { config: config2 } = context2.services;
352562
+ if (config2) {
352563
+ try {
352564
+ config2.setApprovalMode(mode);
352565
+ } catch (e4) {
352566
+ return {
352567
+ type: "message",
352568
+ messageType: "error",
352569
+ content: e4.message
352570
+ };
352571
+ }
352572
+ }
352573
+ return {
352574
+ type: "message",
352575
+ messageType: "info",
352576
+ content: t4('Approval mode set to "{{mode}}"', { mode })
352577
+ };
352578
+ }, "action")
352435
352579
  };
352436
352580
 
352437
352581
  // packages/cli/src/ui/commands/authCommand.ts
@@ -352937,7 +353081,11 @@ function getTemplatePath() {
352937
353081
  }
352938
353082
  __name(getTemplatePath, "getTemplatePath");
352939
353083
  function replaceIdlProjectNames(content, oldName, newName) {
352940
- return content.replace(new RegExp(`${oldName}\\.thrift`, "g"), `${newName}.thrift`).replace(
353084
+ const artifactId = newName.replace(/_idl$/, "").replace(/_/g, "-");
353085
+ return content.replace(new RegExp(`<artifactId>${oldName}-api</artifactId>`, "g"), `<artifactId>${artifactId}-api</artifactId>`).replace(new RegExp(`<artifactId>${oldName}</artifactId>`, "g"), `<artifactId>${artifactId}</artifactId>`).replace(new RegExp(`${oldName}\\.thrift`, "g"), `${newName}.thrift`).replace(new RegExp(`service\\.thrift`, "g"), `${newName}.thrift`).replace(
353086
+ new RegExp(`com\\.xiaohongshu\\.sns\\.demo`, "g"),
353087
+ `com.xiaohongshu.sns.${newName}`
353088
+ ).replace(new RegExp(`/demo/`, "g"), `/${newName}/`).replace(
352941
353089
  new RegExp(`com\\.xiaohongshu\\.sns\\.rpc\\.${oldName}`, "g"),
352942
353090
  `com.xiaohongshu.sns.rpc.${newName}`
352943
353091
  ).replace(new RegExp(`${oldName}Service`, "g"), `${newName}Service`).replace(new RegExp(`${oldName}Request`, "g"), `${newName}Request`).replace(new RegExp(`${oldName}Response`, "g"), `${newName}Response`).replace(new RegExp(oldName, "g"), newName);
@@ -353036,7 +353184,34 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
353036
353184
  continue;
353037
353185
  }
353038
353186
  let destItemName = item;
353039
- if (item === "demo") {
353187
+ if (item === "demo" && isIdlProject) {
353188
+ destItemName = newName;
353189
+ if (newName.includes("-")) {
353190
+ const pathParts = newName.split("-");
353191
+ const currentDestPath = destDir;
353192
+ for (let i3 = 0; i3 < pathParts.length; i3++) {
353193
+ const partPath = path87.join(
353194
+ currentDestPath,
353195
+ ...pathParts.slice(0, i3 + 1)
353196
+ );
353197
+ if (i3 === pathParts.length - 1) {
353198
+ await copyAndReplaceDir(
353199
+ srcPath,
353200
+ partPath,
353201
+ oldName,
353202
+ newName,
353203
+ businessModule,
353204
+ isIdlProject
353205
+ );
353206
+ } else {
353207
+ if (!fs81.existsSync(partPath)) {
353208
+ fs81.mkdirSync(partPath, { recursive: true });
353209
+ }
353210
+ }
353211
+ }
353212
+ continue;
353213
+ }
353214
+ } else if (item === "demo") {
353040
353215
  const projectPrefix = `${businessModule}-`;
353041
353216
  const packageDirName = newName.startsWith(projectPrefix) ? newName.substring(projectPrefix.length) : newName;
353042
353217
  destItemName = packageDirName;
@@ -353067,11 +353242,13 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
353067
353242
  }
353068
353243
  } else if (item === "sns") {
353069
353244
  destItemName = businessModule;
353245
+ } else if (item === "service.thrift" && isIdlProject) {
353246
+ destItemName = `${newName}.thrift`;
353070
353247
  } else if (item === "hello.thrift") {
353071
353248
  destItemName = `${newName}.thrift`;
353072
353249
  } else {
353073
353250
  if (isIdlProject) {
353074
- destItemName = item.replace(/hello/g, newName);
353251
+ destItemName = item.replace(/demo/g, newName);
353075
353252
  } else {
353076
353253
  destItemName = item.replace(/sns-demo/g, newName);
353077
353254
  }
@@ -353285,13 +353462,15 @@ async function createIdlProject(context2, projectName) {
353285
353462
  await copyAndReplaceDir(
353286
353463
  templatePath,
353287
353464
  targetPath,
353288
- "hello",
353465
+ "demo",
353466
+ // 模板中的占位名称
353289
353467
  projectName,
353290
353468
  "sns",
353291
353469
  // 默认业务模块
353292
353470
  true
353293
353471
  // 标记为IDL项目
353294
353472
  );
353473
+ const searchKeyword = projectName.replace(/_idl$/, "").replace(/_/g, "-");
353295
353474
  context2.ui.addItem(
353296
353475
  {
353297
353476
  type: "info" /* INFO */,
@@ -353316,7 +353495,7 @@ ${projectDirectoryName}/
353316
353495
  2. \u53C2\u8003\u6587\u6863\u914D\u7F6E\u6D41\u6C34\u7EBF: https://docs.xiaohongshu.com/doc/57be8d2fb7c584798d5b6135060b2c94
353317
353496
  3. \u8FD0\u884C\u6D41\u6C34\u7EBF\u6210\u529F\u540E\u53EF\u5728\u4EE5\u4E0B\u5730\u5740\u641C\u7D22\u83B7\u53D6maven\u5305:
353318
353497
  https://artifactory.devops.xiaohongshu.com/ui/packages/
353319
- \u641C\u7D22\u5173\u952E\u8BCD: "${projectName}-sdk"
353498
+ \u641C\u7D22\u5173\u952E\u8BCD: "${searchKeyword}-sdk"
353320
353499
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`
353321
353500
  },
353322
353501
  Date.now()
@@ -360316,7 +360495,14 @@ ${event.value}`, null);
360316
360495
  */
360317
360496
  appendThinking(state, subject, description, parentToolUseId) {
360318
360497
  const actualParentToolUseId = parentToolUseId ?? null;
360319
- const fragment = [subject?.trim(), description?.trim()].filter((value) => value && value.length > 0).join(": ");
360498
+ const parts = [];
360499
+ if (subject && subject.length > 0) {
360500
+ parts.push(subject);
360501
+ }
360502
+ if (description && description.length > 0) {
360503
+ parts.push(description);
360504
+ }
360505
+ const fragment = parts.join(": ");
360320
360506
  if (!fragment) {
360321
360507
  return;
360322
360508
  }
@@ -361419,6 +361605,7 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
361419
361605
  );
361420
361606
  process.stderr.write(`${errorText}
361421
361607
  `);
361608
+ throw new Error(errorText);
361422
361609
  }
361423
361610
  }
361424
361611
  }
@@ -361439,15 +361626,23 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
361439
361626
  adapter
361440
361627
  ) : void 0;
361441
361628
  const taskToolProgressHandler = taskToolProgress?.handler;
361629
+ const nonTaskOutputHandler = !isTaskTool && !adapter ? (callId, outputChunk) => {
361630
+ if (typeof outputChunk === "string") {
361631
+ process.stdout.write(outputChunk);
361632
+ } else if (outputChunk && typeof outputChunk === "object" && "ansiOutput" in outputChunk) {
361633
+ process.stdout.write(String(outputChunk.ansiOutput));
361634
+ }
361635
+ } : void 0;
361636
+ const outputUpdateHandler = taskToolProgressHandler || nonTaskOutputHandler;
361442
361637
  const toolResponse = await executeToolCall(
361443
361638
  config2,
361444
361639
  finalRequestInfo,
361445
361640
  abortController.signal,
361446
- isTaskTool && taskToolProgressHandler ? {
361447
- outputUpdateHandler: taskToolProgressHandler,
361448
- onToolCallsUpdate: toolCallUpdateCallback
361449
- } : toolCallUpdateCallback ? {
361450
- onToolCallsUpdate: toolCallUpdateCallback
361641
+ outputUpdateHandler || toolCallUpdateCallback ? {
361642
+ ...outputUpdateHandler && { outputUpdateHandler },
361643
+ ...toolCallUpdateCallback && {
361644
+ onToolCallsUpdate: toolCallUpdateCallback
361645
+ }
361451
361646
  } : void 0
361452
361647
  );
361453
361648
  if (toolResponse.error) {
@@ -380700,7 +380895,7 @@ var import_chalk5 = __toESM(require_source(), 1);
380700
380895
  init_esbuild_shims();
380701
380896
  var import_react46 = __toESM(require_react(), 1);
380702
380897
  init_core5();
380703
- import { spawnSync as spawnSync3 } from "node:child_process";
380898
+ import { spawnSync as spawnSync4 } from "node:child_process";
380704
380899
  import fs93 from "node:fs";
380705
380900
  import os35 from "node:os";
380706
380901
  import pathMod from "node:path";
@@ -382542,7 +382737,7 @@ function useTextBuffer({
382542
382737
  const wasRaw = stdin?.isRaw ?? false;
382543
382738
  try {
382544
382739
  setRawMode?.(false);
382545
- const { status, error: error2 } = spawnSync3(editor, [filePath], {
382740
+ const { status, error: error2 } = spawnSync4(editor, [filePath], {
382546
382741
  stdio: "inherit"
382547
382742
  });
382548
382743
  if (error2) throw error2;
@@ -383246,7 +383441,7 @@ var import_react52 = __toESM(require_react(), 1);
383246
383441
  // packages/cli/src/ui/hooks/useLaunchEditor.ts
383247
383442
  init_esbuild_shims();
383248
383443
  var import_react51 = __toESM(require_react(), 1);
383249
- import { spawnSync as spawnSync4 } from "child_process";
383444
+ import { spawnSync as spawnSync5 } from "child_process";
383250
383445
  function getEditorCommand(preferredEditor) {
383251
383446
  if (preferredEditor) {
383252
383447
  return preferredEditor;
@@ -383281,7 +383476,7 @@ function useLaunchEditor() {
383281
383476
  const wasRaw = stdin?.isRaw ?? false;
383282
383477
  try {
383283
383478
  setRawMode?.(false);
383284
- const { status, error: error2 } = spawnSync4(editorCommand2, editorArgs, {
383479
+ const { status, error: error2 } = spawnSync5(editorCommand2, editorArgs, {
383285
383480
  stdio: "inherit"
383286
383481
  });
383287
383482
  if (error2) throw error2;
@@ -405842,19 +406037,26 @@ async function showResumeSessionPicker(cwd7 = process.cwd()) {
405842
406037
  return new Promise((resolve27) => {
405843
406038
  let selectedId;
405844
406039
  const { unmount, waitUntilExit } = render_default(
405845
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(KeypressProvider, { kittyProtocolEnabled: false, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
405846
- StandalonePickerScreen,
406040
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
406041
+ KeypressProvider,
405847
406042
  {
405848
- sessionService,
405849
- onSelect: (id) => {
405850
- selectedId = id;
405851
- },
405852
- onCancel: () => {
405853
- selectedId = void 0;
405854
- },
405855
- currentBranch: getGitBranch(cwd7)
406043
+ kittyProtocolEnabled: false,
406044
+ pasteWorkaround: process.platform === "win32" || parseInt(process.versions.node.split(".")[0], 10) < 20,
406045
+ children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
406046
+ StandalonePickerScreen,
406047
+ {
406048
+ sessionService,
406049
+ onSelect: (id) => {
406050
+ selectedId = id;
406051
+ },
406052
+ onCancel: () => {
406053
+ selectedId = void 0;
406054
+ },
406055
+ currentBranch: getGitBranch(cwd7)
406056
+ }
406057
+ )
405856
406058
  }
405857
- ) }),
406059
+ ),
405858
406060
  {
405859
406061
  exitOnCtrlC: false
405860
406062
  }
@@ -408200,7 +408402,7 @@ var GeminiAgent = class {
408200
408402
  name: APPROVAL_MODE_INFO[mode].name,
408201
408403
  description: APPROVAL_MODE_INFO[mode].description
408202
408404
  }));
408203
- const version2 = "0.1.8";
408405
+ const version2 = "0.1.9-alpha.1";
408204
408406
  return {
408205
408407
  protocolVersion: PROTOCOL_VERSION,
408206
408408
  agentInfo: {
@@ -408515,13 +408717,15 @@ async function startInteractiveUI(config2, settings, startupWarnings, workspaceR
408515
408717
  isScreenReaderEnabled: config2.getScreenReader()
408516
408718
  }
408517
408719
  );
408518
- checkForUpdates().then((info) => {
408519
- handleAutoUpdate(info, settings, config2.getProjectRoot());
408520
- }).catch((err) => {
408521
- if (config2.getDebugMode()) {
408522
- console.error("Update check failed:", err);
408523
- }
408524
- });
408720
+ if (!settings.merged.general?.disableUpdateNag) {
408721
+ checkForUpdates().then((info) => {
408722
+ handleAutoUpdate(info, settings, config2.getProjectRoot());
408723
+ }).catch((err) => {
408724
+ if (config2.getDebugMode()) {
408725
+ console.error("Update check failed:", err);
408726
+ }
408727
+ });
408728
+ }
408525
408729
  registerCleanup(() => instance.unmount());
408526
408730
  }
408527
408731
  __name(startInteractiveUI, "startInteractiveUI");
@@ -408839,6 +409043,11 @@ main().catch((error2) => {
408839
409043
  * Copyright 2025 RDMind
408840
409044
  * SPDX-License-Identifier: Apache-2.0
408841
409045
  */
409046
+ /**
409047
+ * @license
409048
+ * Copyright 2026 Google LLC
409049
+ * SPDX-License-Identifier: Apache-2.0
409050
+ */
408842
409051
  /**
408843
409052
  * @license
408844
409053
  * Copyright 2025 Qwen team