@qwen-code/qwen-code 0.4.1-nightly.20251210.5fddcd50 → 0.4.1-nightly.20251212.58d3a9c2

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 (3) hide show
  1. package/README.md +6 -0
  2. package/cli.js +231 -68
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -88,6 +88,12 @@ npm install -g .
88
88
  brew install qwen-code
89
89
  ```
90
90
 
91
+ ## VS Code Extension
92
+
93
+ In addition to the CLI tool, Qwen Code also provides a **VS Code extension** that brings AI-powered coding assistance directly into your editor with features like file system operations, native diffing, interactive chat, and more.
94
+
95
+ > 📦 The extension is currently in development. For installation, features, and development guide, see the [VS Code Extension README](./packages/vscode-ide-companion/README.md).
96
+
91
97
  ## Quick Start
92
98
 
93
99
  ```bash
package/cli.js CHANGED
@@ -33249,7 +33249,12 @@ var require_sign_stream = __commonJS({
33249
33249
  }
33250
33250
  __name(jwsSign, "jwsSign");
33251
33251
  function SignStream(opts) {
33252
- var secret = opts.secret || opts.privateKey || opts.key;
33252
+ var secret = opts.secret;
33253
+ secret = secret == null ? opts.privateKey : secret;
33254
+ secret = secret == null ? opts.key : secret;
33255
+ if (/^hs/i.test(opts.header.alg) === true && secret == null) {
33256
+ throw new TypeError("secret must be a string or buffer or a KeyObject");
33257
+ }
33253
33258
  var secretStream = new DataStream(secret);
33254
33259
  this.readable = true;
33255
33260
  this.header = opts.header;
@@ -33372,7 +33377,12 @@ var require_verify_stream = __commonJS({
33372
33377
  __name(jwsDecode, "jwsDecode");
33373
33378
  function VerifyStream(opts) {
33374
33379
  opts = opts || {};
33375
- var secretOrKey = opts.secret || opts.publicKey || opts.key;
33380
+ var secretOrKey = opts.secret;
33381
+ secretOrKey = secretOrKey == null ? opts.publicKey : secretOrKey;
33382
+ secretOrKey = secretOrKey == null ? opts.key : secretOrKey;
33383
+ if (/^hs/i.test(opts.algorithm) === true && secretOrKey == null) {
33384
+ throw new TypeError("secret must be a string or buffer or a KeyObject");
33385
+ }
33376
33386
  var secretStream = new DataStream(secretOrKey);
33377
33387
  this.readable = true;
33378
33388
  this.algorithm = opts.algorithm;
@@ -75550,6 +75560,8 @@ var init_subagent_statistics = __esm({
75550
75560
  failedToolCalls = 0;
75551
75561
  inputTokens = 0;
75552
75562
  outputTokens = 0;
75563
+ thoughtTokens = 0;
75564
+ cachedTokens = 0;
75553
75565
  toolUsage = /* @__PURE__ */ new Map();
75554
75566
  start(now = Date.now()) {
75555
75567
  this.startTimeMs = now;
@@ -75583,15 +75595,17 @@ var init_subagent_statistics = __esm({
75583
75595
  tu.averageDurationMs = tu.count > 0 ? tu.totalDurationMs / tu.count : 0;
75584
75596
  this.toolUsage.set(name3, tu);
75585
75597
  }
75586
- recordTokens(input, output) {
75598
+ recordTokens(input, output, thought = 0, cached = 0) {
75587
75599
  this.inputTokens += Math.max(0, input || 0);
75588
75600
  this.outputTokens += Math.max(0, output || 0);
75601
+ this.thoughtTokens += Math.max(0, thought || 0);
75602
+ this.cachedTokens += Math.max(0, cached || 0);
75589
75603
  }
75590
75604
  getSummary(now = Date.now()) {
75591
75605
  const totalDurationMs = this.startTimeMs ? now - this.startTimeMs : 0;
75592
75606
  const totalToolCalls = this.totalToolCalls;
75593
75607
  const successRate = totalToolCalls > 0 ? this.successfulToolCalls / totalToolCalls * 100 : 0;
75594
- const totalTokens = this.inputTokens + this.outputTokens;
75608
+ const totalTokens = this.inputTokens + this.outputTokens + this.thoughtTokens + this.cachedTokens;
75595
75609
  const estimatedCost = this.inputTokens * 3e-5 + this.outputTokens * 6e-5;
75596
75610
  return {
75597
75611
  rounds: this.rounds,
@@ -75602,6 +75616,8 @@ var init_subagent_statistics = __esm({
75602
75616
  successRate,
75603
75617
  inputTokens: this.inputTokens,
75604
75618
  outputTokens: this.outputTokens,
75619
+ thoughtTokens: this.thoughtTokens,
75620
+ cachedTokens: this.cachedTokens,
75605
75621
  totalTokens,
75606
75622
  estimatedCost,
75607
75623
  toolUsage: Array.from(this.toolUsage.values())
@@ -75616,7 +75632,11 @@ var init_subagent_statistics = __esm({
75616
75632
  `\u23F1\uFE0F Duration: ${this.fmtDuration(stats.totalDurationMs)} | \u{1F501} Rounds: ${stats.rounds}`
75617
75633
  ];
75618
75634
  if (typeof stats.totalTokens === "number") {
75619
- lines.push(`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()}${stats.inputTokens || stats.outputTokens ? ` (in ${stats.inputTokens ?? 0}, out ${stats.outputTokens ?? 0})` : ""}`);
75635
+ const parts = [
75636
+ `in ${stats.inputTokens ?? 0}`,
75637
+ `out ${stats.outputTokens ?? 0}`
75638
+ ];
75639
+ lines.push(`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()}${parts.length ? ` (${parts.join(", ")})` : ""}`);
75620
75640
  }
75621
75641
  return lines.join("\n");
75622
75642
  }
@@ -75645,7 +75665,11 @@ var init_subagent_statistics = __esm({
75645
75665
  lines.push(`\u{1F680} Speed: ${speed}`);
75646
75666
  lines.push(`\u{1F527} Tools: ${stats.totalToolCalls} calls, ${sr.toFixed(1)}% success (${stats.successfulToolCalls} ok, ${stats.failedToolCalls} failed)`);
75647
75667
  if (typeof stats.totalTokens === "number") {
75648
- lines.push(`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()} (in ${stats.inputTokens ?? 0}, out ${stats.outputTokens ?? 0})`);
75668
+ const parts = [
75669
+ `in ${stats.inputTokens ?? 0}`,
75670
+ `out ${stats.outputTokens ?? 0}`
75671
+ ];
75672
+ lines.push(`\u{1F522} Tokens: ${stats.totalTokens.toLocaleString()} (${parts.join(", ")})`);
75649
75673
  }
75650
75674
  if (stats.toolUsage && stats.toolUsage.length) {
75651
75675
  const sorted2 = [...stats.toolUsage].sort((a, b) => b.count - a.count).slice(0, 5);
@@ -133148,6 +133172,7 @@ var init_uiTelemetry = __esm({
133148
133172
  init_esbuild_shims();
133149
133173
  init_constants();
133150
133174
  init_tool_call_decision();
133175
+ init_constants();
133151
133176
  createInitialModelMetrics = /* @__PURE__ */ __name(() => ({
133152
133177
  api: {
133153
133178
  totalRequests: 0,
@@ -145729,7 +145754,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
145729
145754
  };
145730
145755
  }
145731
145756
  async function createContentGenerator(config, gcConfig, isInitialAuth) {
145732
- const version2 = "0.4.1-nightly.20251210.5fddcd50";
145757
+ const version2 = "0.4.1-nightly.20251212.58d3a9c2";
145733
145758
  const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
145734
145759
  const baseHeaders = {
145735
145760
  "User-Agent": userAgent2
@@ -163096,6 +163121,7 @@ var init_subagent_events = __esm({
163096
163121
  SubAgentEventType2["TOOL_CALL"] = "tool_call";
163097
163122
  SubAgentEventType2["TOOL_RESULT"] = "tool_result";
163098
163123
  SubAgentEventType2["TOOL_WAITING_APPROVAL"] = "tool_waiting_approval";
163124
+ SubAgentEventType2["USAGE_METADATA"] = "usage_metadata";
163099
163125
  SubAgentEventType2["FINISH"] = "finish";
163100
163126
  SubAgentEventType2["ERROR"] = "error";
163101
163127
  })(SubAgentEventType || (SubAgentEventType = {}));
@@ -163318,6 +163344,7 @@ var init_subagent = __esm({
163318
163344
  tools: [{ functionDeclarations: toolsList }]
163319
163345
  }
163320
163346
  };
163347
+ const roundStreamStart = Date.now();
163321
163348
  const responseStream = await chat.sendMessageStream(this.modelConfig.model || this.runtimeContext.getModel() || DEFAULT_QWEN_MODEL, messageParams, promptId);
163322
163349
  this.eventEmitter?.emit(SubAgentEventType.ROUND_START, {
163323
163350
  subagentId: this.subagentId,
@@ -163372,13 +163399,22 @@ var init_subagent = __esm({
163372
163399
  if (lastUsage) {
163373
163400
  const inTok = Number(lastUsage.promptTokenCount || 0);
163374
163401
  const outTok = Number(lastUsage.candidatesTokenCount || 0);
163375
- if (isFinite(inTok) || isFinite(outTok)) {
163376
- this.stats.recordTokens(isFinite(inTok) ? inTok : 0, isFinite(outTok) ? outTok : 0);
163402
+ const thoughtTok = Number(lastUsage.thoughtsTokenCount || 0);
163403
+ const cachedTok = Number(lastUsage.cachedContentTokenCount || 0);
163404
+ if (isFinite(inTok) || isFinite(outTok) || isFinite(thoughtTok) || isFinite(cachedTok)) {
163405
+ this.stats.recordTokens(isFinite(inTok) ? inTok : 0, isFinite(outTok) ? outTok : 0, isFinite(thoughtTok) ? thoughtTok : 0, isFinite(cachedTok) ? cachedTok : 0);
163377
163406
  this.executionStats.inputTokens = (this.executionStats.inputTokens || 0) + (isFinite(inTok) ? inTok : 0);
163378
163407
  this.executionStats.outputTokens = (this.executionStats.outputTokens || 0) + (isFinite(outTok) ? outTok : 0);
163379
- this.executionStats.totalTokens = (this.executionStats.inputTokens || 0) + (this.executionStats.outputTokens || 0);
163408
+ this.executionStats.totalTokens = (this.executionStats.inputTokens || 0) + (this.executionStats.outputTokens || 0) + (isFinite(thoughtTok) ? thoughtTok : 0) + (isFinite(cachedTok) ? cachedTok : 0);
163380
163409
  this.executionStats.estimatedCost = (this.executionStats.inputTokens || 0) * 3e-5 + (this.executionStats.outputTokens || 0) * 6e-5;
163381
163410
  }
163411
+ this.eventEmitter?.emit(SubAgentEventType.USAGE_METADATA, {
163412
+ subagentId: this.subagentId,
163413
+ round: turnCounter,
163414
+ usage: lastUsage,
163415
+ durationMs: Date.now() - roundStreamStart,
163416
+ timestamp: Date.now()
163417
+ });
163382
163418
  }
163383
163419
  if (functionCalls.length > 0) {
163384
163420
  currentMessages = await this.processFunctionCalls(functionCalls, abortController, promptId, turnCounter, currentResponseId);
@@ -287760,7 +287796,7 @@ var patchConsole = /* @__PURE__ */ __name((callback) => {
287760
287796
  var dist_default = patchConsole;
287761
287797
 
287762
287798
  // node_modules/ink/build/ink.js
287763
- var import_constants19 = __toESM(require_constants11(), 1);
287799
+ var import_constants20 = __toESM(require_constants11(), 1);
287764
287800
 
287765
287801
  // node_modules/yoga-layout/dist/src/index.js
287766
287802
  init_esbuild_shims();
@@ -289823,7 +289859,7 @@ __name(wrapAnsi, "wrapAnsi");
289823
289859
  // node_modules/ink/build/reconciler.js
289824
289860
  init_esbuild_shims();
289825
289861
  var import_react_reconciler = __toESM(require_react_reconciler(), 1);
289826
- var import_constants18 = __toESM(require_constants11(), 1);
289862
+ var import_constants19 = __toESM(require_constants11(), 1);
289827
289863
  import process15 from "node:process";
289828
289864
  var import_react = __toESM(require_react(), 1);
289829
289865
 
@@ -290794,7 +290830,7 @@ var cleanupYogaNode = /* @__PURE__ */ __name((node) => {
290794
290830
  node?.unsetMeasureFunc();
290795
290831
  node?.freeRecursive();
290796
290832
  }, "cleanupYogaNode");
290797
- var currentUpdatePriority = import_constants18.NoEventPriority;
290833
+ var currentUpdatePriority = import_constants19.NoEventPriority;
290798
290834
  var currentRootNode;
290799
290835
  var reconciler_default = (0, import_react_reconciler.default)({
290800
290836
  getRootHostContext: /* @__PURE__ */ __name(() => ({
@@ -290951,10 +290987,10 @@ var reconciler_default = (0, import_react_reconciler.default)({
290951
290987
  },
290952
290988
  getCurrentUpdatePriority: /* @__PURE__ */ __name(() => currentUpdatePriority, "getCurrentUpdatePriority"),
290953
290989
  resolveUpdatePriority() {
290954
- if (currentUpdatePriority !== import_constants18.NoEventPriority) {
290990
+ if (currentUpdatePriority !== import_constants19.NoEventPriority) {
290955
290991
  return currentUpdatePriority;
290956
290992
  }
290957
- return import_constants18.DefaultEventPriority;
290993
+ return import_constants19.DefaultEventPriority;
290958
290994
  },
290959
290995
  maySuspendCommit() {
290960
290996
  return false;
@@ -293472,7 +293508,7 @@ var Ink = class {
293472
293508
  this.fullStaticOutput = "";
293473
293509
  this.container = reconciler_default.createContainer(
293474
293510
  this.rootNode,
293475
- import_constants19.LegacyRoot,
293511
+ import_constants20.LegacyRoot,
293476
293512
  null,
293477
293513
  false,
293478
293514
  null,
@@ -297625,12 +297661,12 @@ var Header = class {
297625
297661
  if (!buf || !(buf.length >= off + 512)) {
297626
297662
  throw new Error("need 512 bytes for header");
297627
297663
  }
297628
- this.path = decString(buf, off, 100);
297629
- this.mode = decNumber(buf, off + 100, 8);
297630
- this.uid = decNumber(buf, off + 108, 8);
297631
- this.gid = decNumber(buf, off + 116, 8);
297632
- this.size = decNumber(buf, off + 124, 12);
297633
- this.mtime = decDate(buf, off + 136, 12);
297664
+ this.path = ex?.path ?? decString(buf, off, 100);
297665
+ this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8);
297666
+ this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
297667
+ this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
297668
+ this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
297669
+ this.mtime = ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
297634
297670
  this.cksum = decNumber(buf, off + 148, 12);
297635
297671
  if (gex)
297636
297672
  this.#slurp(gex, true);
@@ -297648,10 +297684,10 @@ var Header = class {
297648
297684
  }
297649
297685
  this.linkpath = decString(buf, off + 157, 100);
297650
297686
  if (buf.subarray(off + 257, off + 265).toString() === "ustar\x0000") {
297651
- this.uname = decString(buf, off + 265, 32);
297652
- this.gname = decString(buf, off + 297, 32);
297653
- this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
297654
- this.devmin = decNumber(buf, off + 337, 8) ?? 0;
297687
+ this.uname = ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
297688
+ this.gname = ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
297689
+ this.devmaj = ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
297690
+ this.devmin = ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0;
297655
297691
  if (buf[off + 475] !== 0) {
297656
297692
  const prefix = decString(buf, off + 345, 155);
297657
297693
  this.path = prefix + "/" + this.path;
@@ -297660,8 +297696,8 @@ var Header = class {
297660
297696
  if (prefix) {
297661
297697
  this.path = prefix + "/" + this.path;
297662
297698
  }
297663
- this.atime = decDate(buf, off + 476, 12);
297664
- this.ctime = decDate(buf, off + 488, 12);
297699
+ this.atime = ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
297700
+ this.ctime = ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
297665
297701
  }
297666
297702
  }
297667
297703
  let sum = 8 * 32;
@@ -298607,13 +298643,15 @@ var listFileSync = /* @__PURE__ */ __name((opt) => {
298607
298643
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
298608
298644
  if (stat6.size < readSize) {
298609
298645
  const buf = Buffer.allocUnsafe(stat6.size);
298610
- fs57.readSync(fd, buf, 0, stat6.size, 0);
298611
- p.end(buf);
298646
+ const read3 = fs57.readSync(fd, buf, 0, stat6.size, 0);
298647
+ p.end(read3 === buf.byteLength ? buf : buf.subarray(0, read3));
298612
298648
  } else {
298613
298649
  let pos2 = 0;
298614
298650
  const buf = Buffer.allocUnsafe(readSize);
298615
298651
  while (pos2 < stat6.size) {
298616
298652
  const bytesRead = fs57.readSync(fd, buf, 0, readSize, pos2);
298653
+ if (bytesRead === 0)
298654
+ break;
298617
298655
  pos2 += bytesRead;
298618
298656
  p.write(buf.subarray(0, bytesRead));
298619
298657
  }
@@ -309147,7 +309185,7 @@ __name(getPackageJson, "getPackageJson");
309147
309185
  // packages/cli/src/utils/version.ts
309148
309186
  async function getCliVersion() {
309149
309187
  const pkgJson = await getPackageJson();
309150
- return "0.4.1-nightly.20251210.5fddcd50";
309188
+ return "0.4.1-nightly.20251212.58d3a9c2";
309151
309189
  }
309152
309190
  __name(getCliVersion, "getCliVersion");
309153
309191
 
@@ -313213,7 +313251,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
313213
313251
 
313214
313252
  // packages/cli/src/generated/git-commit.ts
313215
313253
  init_esbuild_shims();
313216
- var GIT_COMMIT_INFO2 = "9d0d932d";
313254
+ var GIT_COMMIT_INFO2 = "ff26a54d";
313217
313255
 
313218
313256
  // packages/cli/src/utils/systemInfo.ts
313219
313257
  async function getNpmVersion() {
@@ -316380,7 +316418,7 @@ var getGitRepoRoot = /* @__PURE__ */ __name(() => {
316380
316418
  var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
316381
316419
  try {
316382
316420
  const controller = new AbortController();
316383
- const endpoint = `https://api.github.com/repos/google-github-actions/run-gemini-cli/releases/latest`;
316421
+ const endpoint = `https://api.github.com/repos/QwenLM/qwen-code-action/releases/latest`;
316384
316422
  const response = await fetch(endpoint, {
316385
316423
  method: "GET",
316386
316424
  headers: {
@@ -316402,9 +316440,12 @@ var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
316402
316440
  }
316403
316441
  return releaseTag;
316404
316442
  } catch (_error) {
316405
- console.debug(`Failed to determine latest run-gemini-cli release:`, _error);
316443
+ console.debug(
316444
+ `Failed to determine latest qwen-code-action release:`,
316445
+ _error
316446
+ );
316406
316447
  throw new Error(
316407
- `Unable to determine the latest run-gemini-cli release on GitHub.`
316448
+ `Unable to determine the latest qwen-code-action release on GitHub.`
316408
316449
  );
316409
316450
  }
316410
316451
  }, "getLatestGitHubRelease");
@@ -316426,11 +316467,11 @@ __name(getGitHubRepoInfo, "getGitHubRepoInfo");
316426
316467
 
316427
316468
  // packages/cli/src/ui/commands/setupGithubCommand.ts
316428
316469
  var GITHUB_WORKFLOW_PATHS = [
316429
- "gemini-dispatch/gemini-dispatch.yml",
316430
- "gemini-assistant/gemini-invoke.yml",
316431
- "issue-triage/gemini-triage.yml",
316432
- "issue-triage/gemini-scheduled-triage.yml",
316433
- "pr-review/gemini-review.yml"
316470
+ "qwen-dispatch/qwen-dispatch.yml",
316471
+ "qwen-assistant/qwen-invoke.yml",
316472
+ "issue-triage/qwen-triage.yml",
316473
+ "issue-triage/qwen-scheduled-triage.yml",
316474
+ "pr-review/qwen-review.yml"
316434
316475
  ];
316435
316476
  function getOpenUrlsCommands(readmeUrl) {
316436
316477
  const openCmd = getUrlOpenCommand();
@@ -316446,7 +316487,7 @@ function getOpenUrlsCommands(readmeUrl) {
316446
316487
  }
316447
316488
  __name(getOpenUrlsCommands, "getOpenUrlsCommands");
316448
316489
  async function updateGitignore(gitRepoRoot) {
316449
- const gitignoreEntries = [".gemini/", "gha-creds-*.json"];
316490
+ const gitignoreEntries = [".qwen/", "gha-creds-*.json"];
316450
316491
  const gitignorePath = path89.join(gitRepoRoot, ".gitignore");
316451
316492
  try {
316452
316493
  let existingContent = "";
@@ -316497,7 +316538,7 @@ var setupGithubCommand = {
316497
316538
  }
316498
316539
  const proxy = context2?.services?.config?.getProxy();
316499
316540
  const releaseTag = await getLatestGitHubRelease(proxy);
316500
- const readmeUrl = `https://github.com/google-github-actions/run-gemini-cli/blob/${releaseTag}/README.md#quick-start`;
316541
+ const readmeUrl = `https://github.com/QwenLM/qwen-code-action/blob/${releaseTag}/README.md#quick-start`;
316501
316542
  const githubWorkflowsDir = path89.join(gitRepoRoot, ".github", "workflows");
316502
316543
  try {
316503
316544
  await fs79.promises.mkdir(githubWorkflowsDir, { recursive: true });
@@ -316514,7 +316555,7 @@ var setupGithubCommand = {
316514
316555
  for (const workflow of GITHUB_WORKFLOW_PATHS) {
316515
316556
  downloads.push(
316516
316557
  (async () => {
316517
- const endpoint = `https://raw.githubusercontent.com/google-github-actions/run-gemini-cli/refs/tags/${releaseTag}/examples/workflows/${workflow}`;
316558
+ const endpoint = `https://raw.githubusercontent.com/QwenLM/qwen-code-action/refs/tags/${releaseTag}/examples/workflows/${workflow}`;
316518
316559
  const response = await fetch(endpoint, {
316519
316560
  method: "GET",
316520
316561
  dispatcher: proxy ? new import_undici5.ProxyAgent(proxy) : void 0,
@@ -316564,8 +316605,9 @@ var setupGithubCommand = {
316564
316605
  type: "tool",
316565
316606
  toolName: "run_shell_command",
316566
316607
  toolArgs: {
316567
- description: "Setting up GitHub Actions to triage issues and review PRs with Gemini.",
316568
- command: command2
316608
+ description: "Setting up GitHub Actions to triage issues and review PRs with Qwen.",
316609
+ command: command2,
316610
+ is_background: false
316569
316611
  }
316570
316612
  };
316571
316613
  }, "action")
@@ -350705,12 +350747,17 @@ var InputPrompt = /* @__PURE__ */ __name(({
350705
350747
  statusColor = theme.status.warning;
350706
350748
  statusText = t2("Accepting edits");
350707
350749
  }
350750
+ const borderColor = isShellFocused && !isEmbeddedShellFocused ? statusColor ?? theme.border.focused : theme.border.default;
350708
350751
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
350709
350752
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
350710
350753
  Box_default,
350711
350754
  {
350712
- borderStyle: "round",
350713
- borderColor: isShellFocused && !isEmbeddedShellFocused ? statusColor ?? theme.border.focused : theme.border.default,
350755
+ borderStyle: "single",
350756
+ borderTop: true,
350757
+ borderBottom: true,
350758
+ borderLeft: false,
350759
+ borderRight: false,
350760
+ borderColor,
350714
350761
  paddingX: 1,
350715
350762
  children: [
350716
350763
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
@@ -350789,7 +350836,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
350789
350836
  });
350790
350837
  if (isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText)) {
350791
350838
  renderedLine.push(
350792
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text3, { children: showCursor ? import_chalk7.default.inverse(" ") : " " }, `cursor-end-${cursorVisualColAbsolute}`)
350839
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text3, { children: showCursor ? import_chalk7.default.inverse(" ") + "\u200B" : " \u200B" }, `cursor-end-${cursorVisualColAbsolute}`)
350793
350840
  );
350794
350841
  }
350795
350842
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Box_default, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text3, { children: renderedLine }) }, `line-${visualIdxInRenderedSet}`);
@@ -361671,6 +361718,17 @@ var annotationsSchema = external_exports.object({
361671
361718
  lastModified: external_exports.string().optional().nullable(),
361672
361719
  priority: external_exports.number().optional().nullable()
361673
361720
  });
361721
+ var usageSchema = external_exports.object({
361722
+ promptTokens: external_exports.number().optional().nullable(),
361723
+ completionTokens: external_exports.number().optional().nullable(),
361724
+ thoughtsTokens: external_exports.number().optional().nullable(),
361725
+ totalTokens: external_exports.number().optional().nullable(),
361726
+ cachedTokens: external_exports.number().optional().nullable()
361727
+ });
361728
+ var sessionUpdateMetaSchema = external_exports.object({
361729
+ usage: usageSchema.optional().nullable(),
361730
+ durationMs: external_exports.number().optional().nullable()
361731
+ });
361674
361732
  var requestPermissionResponseSchema = external_exports.object({
361675
361733
  outcome: requestPermissionOutcomeSchema
361676
361734
  });
@@ -361826,11 +361884,13 @@ var sessionUpdateSchema = external_exports.union([
361826
361884
  }),
361827
361885
  external_exports.object({
361828
361886
  content: contentBlockSchema,
361829
- sessionUpdate: external_exports.literal("agent_message_chunk")
361887
+ sessionUpdate: external_exports.literal("agent_message_chunk"),
361888
+ _meta: sessionUpdateMetaSchema.optional().nullable()
361830
361889
  }),
361831
361890
  external_exports.object({
361832
361891
  content: contentBlockSchema,
361833
- sessionUpdate: external_exports.literal("agent_thought_chunk")
361892
+ sessionUpdate: external_exports.literal("agent_thought_chunk"),
361893
+ _meta: sessionUpdateMetaSchema.optional().nullable()
361834
361894
  }),
361835
361895
  external_exports.object({
361836
361896
  content: external_exports.array(toolCallContentSchema).optional(),
@@ -362160,6 +362220,15 @@ var AcpFileSystemService = class {
362160
362220
  line: null,
362161
362221
  limit: null
362162
362222
  });
362223
+ if (response.content.startsWith("ERROR: ENOENT:")) {
362224
+ const match2 = /^ERROR:\s*ENOENT:\s*(?<path>.*)$/i.exec(response.content);
362225
+ const err = new Error(response.content);
362226
+ err.code = "ENOENT";
362227
+ err.errno = -2;
362228
+ const rawPath = match2?.groups?.["path"]?.trim();
362229
+ err["path"] = rawPath ? rawPath.replace(/^['"]|['"]$/g, "") || filePath : filePath;
362230
+ throw err;
362231
+ }
362163
362232
  return response.content;
362164
362233
  }
362165
362234
  async writeTextFile(filePath, content) {
@@ -362236,6 +362305,15 @@ var MessageEmitter = class extends BaseEmitter {
362236
362305
  content: { type: "text", text }
362237
362306
  });
362238
362307
  }
362308
+ /**
362309
+ * Emits an agent thought chunk.
362310
+ */
362311
+ async emitAgentThought(text) {
362312
+ await this.sendUpdate({
362313
+ sessionUpdate: "agent_thought_chunk",
362314
+ content: { type: "text", text }
362315
+ });
362316
+ }
362239
362317
  /**
362240
362318
  * Emits an agent message chunk.
362241
362319
  */
@@ -362246,12 +362324,21 @@ var MessageEmitter = class extends BaseEmitter {
362246
362324
  });
362247
362325
  }
362248
362326
  /**
362249
- * Emits an agent thought chunk.
362327
+ * Emits usage metadata.
362250
362328
  */
362251
- async emitAgentThought(text) {
362329
+ async emitUsageMetadata(usageMetadata, text = "", durationMs) {
362330
+ const usage2 = {
362331
+ promptTokens: usageMetadata.promptTokenCount,
362332
+ completionTokens: usageMetadata.candidatesTokenCount,
362333
+ thoughtsTokens: usageMetadata.thoughtsTokenCount,
362334
+ totalTokens: usageMetadata.totalTokenCount,
362335
+ cachedTokens: usageMetadata.cachedContentTokenCount
362336
+ };
362337
+ const meta = typeof durationMs === "number" ? { usage: usage2, durationMs } : { usage: usage2 };
362252
362338
  await this.sendUpdate({
362253
- sessionUpdate: "agent_thought_chunk",
362254
- content: { type: "text", text }
362339
+ sessionUpdate: "agent_message_chunk",
362340
+ content: { type: "text", text },
362341
+ _meta: meta
362255
362342
  });
362256
362343
  }
362257
362344
  /**
@@ -362367,7 +362454,7 @@ var ToolCallEmitter = class extends BaseEmitter {
362367
362454
  await this.sendUpdate({
362368
362455
  sessionUpdate: "tool_call",
362369
362456
  toolCallId: params.callId,
362370
- status: "in_progress",
362457
+ status: params.status || "pending",
362371
362458
  title,
362372
362459
  content: [],
362373
362460
  locations,
@@ -362534,7 +362621,10 @@ var ToolCallEmitter = class extends BaseEmitter {
362534
362621
  }
362535
362622
  if ("functionResponse" in part && part.functionResponse) {
362536
362623
  try {
362537
- const responseText = JSON.stringify(part.functionResponse.response);
362624
+ const resp = part.functionResponse.response;
362625
+ const outputField = resp["output"];
362626
+ const errorField = resp["error"];
362627
+ const responseText = typeof outputField === "string" ? outputField : typeof errorField === "string" ? errorField : JSON.stringify(resp);
362538
362628
  result.push({
362539
362629
  type: "content",
362540
362630
  content: { type: "text", text: responseText }
@@ -362582,6 +362672,9 @@ var HistoryReplayer = class {
362582
362672
  if (record.message) {
362583
362673
  await this.replayContent(record.message, "assistant");
362584
362674
  }
362675
+ if (record.usageMetadata) {
362676
+ await this.replayUsageMetadata(record.usageMetadata);
362677
+ }
362585
362678
  break;
362586
362679
  case "tool_result":
362587
362680
  await this.replayToolResult(record);
@@ -362606,11 +362699,19 @@ var HistoryReplayer = class {
362606
362699
  await this.toolCallEmitter.emitStart({
362607
362700
  toolName: functionName,
362608
362701
  callId,
362609
- args: part.functionCall.args
362702
+ args: part.functionCall.args,
362703
+ status: "in_progress"
362610
362704
  });
362611
362705
  }
362612
362706
  }
362613
362707
  }
362708
+ /**
362709
+ * Replays usage metadata.
362710
+ * @param usageMetadata - The usage metadata to replay
362711
+ */
362712
+ async replayUsageMetadata(usageMetadata) {
362713
+ await this.messageEmitter.emitUsageMetadata(usageMetadata);
362714
+ }
362614
362715
  /**
362615
362716
  * Replays a tool result record.
362616
362717
  */
@@ -362631,6 +362732,40 @@ var HistoryReplayer = class {
362631
362732
  // Note: args aren't stored in tool_result records by default
362632
362733
  args: void 0
362633
362734
  });
362735
+ const { resultDisplay } = result ?? {};
362736
+ if (!!resultDisplay && typeof resultDisplay === "object" && "type" in resultDisplay && resultDisplay.type === "task_execution") {
362737
+ await this.emitTaskUsageFromResultDisplay(
362738
+ resultDisplay
362739
+ );
362740
+ }
362741
+ }
362742
+ /**
362743
+ * Emits token usage from a TaskResultDisplay execution summary, if present.
362744
+ */
362745
+ async emitTaskUsageFromResultDisplay(resultDisplay) {
362746
+ const summary = resultDisplay.executionSummary;
362747
+ if (!summary) {
362748
+ return;
362749
+ }
362750
+ const usageMetadata = {};
362751
+ if (Number.isFinite(summary.inputTokens)) {
362752
+ usageMetadata.promptTokenCount = summary.inputTokens;
362753
+ }
362754
+ if (Number.isFinite(summary.outputTokens)) {
362755
+ usageMetadata.candidatesTokenCount = summary.outputTokens;
362756
+ }
362757
+ if (Number.isFinite(summary.thoughtTokens)) {
362758
+ usageMetadata.thoughtsTokenCount = summary.thoughtTokens;
362759
+ }
362760
+ if (Number.isFinite(summary.cachedTokens)) {
362761
+ usageMetadata.cachedContentTokenCount = summary.cachedTokens;
362762
+ }
362763
+ if (Number.isFinite(summary.totalTokens)) {
362764
+ usageMetadata.totalTokenCount = summary.totalTokens;
362765
+ }
362766
+ if (Object.keys(usageMetadata).length > 0) {
362767
+ await this.messageEmitter.emitUsageMetadata(usageMetadata);
362768
+ }
362634
362769
  }
362635
362770
  /**
362636
362771
  * Extracts tool name from a chat record's function response.
@@ -362667,11 +362802,13 @@ var SubAgentTracker = class {
362667
362802
  this.ctx = ctx;
362668
362803
  this.client = client;
362669
362804
  this.toolCallEmitter = new ToolCallEmitter(ctx);
362805
+ this.messageEmitter = new MessageEmitter(ctx);
362670
362806
  }
362671
362807
  static {
362672
362808
  __name(this, "SubAgentTracker");
362673
362809
  }
362674
362810
  toolCallEmitter;
362811
+ messageEmitter;
362675
362812
  toolStates = /* @__PURE__ */ new Map();
362676
362813
  /**
362677
362814
  * Sets up event listeners for a sub-agent's tool events.
@@ -362684,14 +362821,17 @@ var SubAgentTracker = class {
362684
362821
  const onToolCall = this.createToolCallHandler(abortSignal);
362685
362822
  const onToolResult = this.createToolResultHandler(abortSignal);
362686
362823
  const onApproval = this.createApprovalHandler(abortSignal);
362824
+ const onUsageMetadata = this.createUsageMetadataHandler(abortSignal);
362687
362825
  eventEmitter.on(SubAgentEventType.TOOL_CALL, onToolCall);
362688
362826
  eventEmitter.on(SubAgentEventType.TOOL_RESULT, onToolResult);
362689
362827
  eventEmitter.on(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
362828
+ eventEmitter.on(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
362690
362829
  return [
362691
362830
  () => {
362692
362831
  eventEmitter.off(SubAgentEventType.TOOL_CALL, onToolCall);
362693
362832
  eventEmitter.off(SubAgentEventType.TOOL_RESULT, onToolResult);
362694
362833
  eventEmitter.off(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
362834
+ eventEmitter.off(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
362695
362835
  this.toolStates.clear();
362696
362836
  }
362697
362837
  ];
@@ -362794,6 +362934,16 @@ var SubAgentTracker = class {
362794
362934
  }
362795
362935
  };
362796
362936
  }
362937
+ /**
362938
+ * Creates a handler for usage metadata events.
362939
+ */
362940
+ createUsageMetadataHandler(abortSignal) {
362941
+ return (...args) => {
362942
+ const event = args[0];
362943
+ if (abortSignal.aborted) return;
362944
+ this.messageEmitter.emitUsageMetadata(event.usage, "", event.durationMs);
362945
+ };
362946
+ }
362797
362947
  /**
362798
362948
  * Converts confirmation details to permission options for the client.
362799
362949
  */
@@ -362868,6 +363018,7 @@ var Session3 = class {
362868
363018
  this.toolCallEmitter = new ToolCallEmitter(this);
362869
363019
  this.planEmitter = new PlanEmitter(this);
362870
363020
  this.historyReplayer = new HistoryReplayer(this);
363021
+ this.messageEmitter = new MessageEmitter(this);
362871
363022
  }
362872
363023
  static {
362873
363024
  __name(this, "Session");
@@ -362878,6 +363029,7 @@ var Session3 = class {
362878
363029
  historyReplayer;
362879
363030
  toolCallEmitter;
362880
363031
  planEmitter;
363032
+ messageEmitter;
362881
363033
  // Implement SessionContext interface
362882
363034
  sessionId;
362883
363035
  getId() {
@@ -362944,6 +363096,8 @@ var Session3 = class {
362944
363096
  return { stopReason: "cancelled" };
362945
363097
  }
362946
363098
  const functionCalls = [];
363099
+ let usageMetadata = null;
363100
+ const streamStartTime = Date.now();
362947
363101
  try {
362948
363102
  const responseStream = await chat.sendMessageStream(
362949
363103
  this.config.getModel(),
@@ -362966,16 +363120,16 @@ var Session3 = class {
362966
363120
  if (!part.text) {
362967
363121
  continue;
362968
363122
  }
362969
- const content = {
362970
- type: "text",
362971
- text: part.text
362972
- };
362973
- this.sendUpdate({
362974
- sessionUpdate: part.thought ? "agent_thought_chunk" : "agent_message_chunk",
362975
- content
362976
- });
363123
+ this.messageEmitter.emitMessage(
363124
+ part.text,
363125
+ "assistant",
363126
+ part.thought
363127
+ );
362977
363128
  }
362978
363129
  }
363130
+ if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
363131
+ usageMetadata = resp.value.usageMetadata;
363132
+ }
362979
363133
  if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
362980
363134
  functionCalls.push(...resp.value.functionCalls);
362981
363135
  }
@@ -362989,6 +363143,14 @@ var Session3 = class {
362989
363143
  }
362990
363144
  throw error;
362991
363145
  }
363146
+ if (usageMetadata) {
363147
+ const durationMs = Date.now() - streamStartTime;
363148
+ await this.messageEmitter.emitUsageMetadata(
363149
+ usageMetadata,
363150
+ "",
363151
+ durationMs
363152
+ );
363153
+ }
362992
363154
  if (functionCalls.length > 0) {
362993
363155
  const toolResponseParts = [];
362994
363156
  for (const fc of functionCalls) {
@@ -363127,7 +363289,7 @@ var Session3 = class {
363127
363289
  abortSignal
363128
363290
  );
363129
363291
  }
363130
- const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
363292
+ const confirmationDetails = this.config.getApprovalMode() !== ApprovalMode.YOLO ? await invocation.shouldConfirmExecute(abortSignal) : false;
363131
363293
  if (confirmationDetails) {
363132
363294
  const content = [];
363133
363295
  if (confirmationDetails.type === "edit") {
@@ -363186,7 +363348,8 @@ var Session3 = class {
363186
363348
  const startParams = {
363187
363349
  callId,
363188
363350
  toolName: fc.name,
363189
- args
363351
+ args,
363352
+ status: "in_progress"
363190
363353
  };
363191
363354
  await this.toolCallEmitter.emitStart(startParams);
363192
363355
  }
@@ -363599,7 +363762,7 @@ var GeminiAgent = class {
363599
363762
  name: APPROVAL_MODE_INFO[mode].name,
363600
363763
  description: APPROVAL_MODE_INFO[mode].description
363601
363764
  }));
363602
- const version2 = "0.4.1-nightly.20251210.5fddcd50";
363765
+ const version2 = "0.4.1-nightly.20251212.58d3a9c2";
363603
363766
  return {
363604
363767
  protocolVersion: PROTOCOL_VERSION,
363605
363768
  agentInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwen-code/qwen-code",
3
- "version": "0.4.1-nightly.20251210.5fddcd50",
3
+ "version": "0.4.1-nightly.20251212.58d3a9c2",
4
4
  "description": "Qwen Code - AI-powered coding assistant",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "locales"
21
21
  ],
22
22
  "config": {
23
- "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.4.1-nightly.20251210.5fddcd50"
23
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.4.1-nightly.20251212.58d3a9c2"
24
24
  },
25
25
  "dependencies": {
26
26
  "tiktoken": "^1.0.21"