@qwen-code/qwen-code 0.4.1-nightly.20251211.a02c4b27 → 0.5.0-nightly.20251212.8b29dd13

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 (2) hide show
  1. package/cli.js +242 -68
  2. package/package.json +2 -2
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);
@@ -82925,7 +82949,8 @@ var init_qwen_logger = __esm({
82925
82949
  properties: {
82926
82950
  auth_type: authType,
82927
82951
  model: this.config?.getModel(),
82928
- base_url: authType === AuthType2.USE_OPENAI ? this.config?.getContentGeneratorConfig().baseUrl || "" : ""
82952
+ base_url: authType === AuthType2.USE_OPENAI ? this.config?.getContentGeneratorConfig().baseUrl || "" : "",
82953
+ ...this.config?.getChannel?.() ? { channel: this.config.getChannel() } : {}
82929
82954
  },
82930
82955
  _v: `qwen-code@${version2}`
82931
82956
  };
@@ -133148,6 +133173,7 @@ var init_uiTelemetry = __esm({
133148
133173
  init_esbuild_shims();
133149
133174
  init_constants();
133150
133175
  init_tool_call_decision();
133176
+ init_constants();
133151
133177
  createInitialModelMetrics = /* @__PURE__ */ __name(() => ({
133152
133178
  api: {
133153
133179
  totalRequests: 0,
@@ -142061,10 +142087,12 @@ var init_dashscope = __esm({
142061
142087
  };
142062
142088
  }
142063
142089
  buildMetadata(userPromptId) {
142090
+ const channel = this.cliConfig.getChannel?.();
142064
142091
  return {
142065
142092
  metadata: {
142066
142093
  sessionId: this.cliConfig.getSessionId?.(),
142067
- promptId: userPromptId
142094
+ promptId: userPromptId,
142095
+ ...channel ? { channel } : {}
142068
142096
  }
142069
142097
  };
142070
142098
  }
@@ -145729,7 +145757,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
145729
145757
  };
145730
145758
  }
145731
145759
  async function createContentGenerator(config, gcConfig, isInitialAuth) {
145732
- const version2 = "0.4.1-nightly.20251211.a02c4b27";
145760
+ const version2 = "0.5.0-nightly.20251212.8b29dd13";
145733
145761
  const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
145734
145762
  const baseHeaders = {
145735
145763
  "User-Agent": userAgent2
@@ -163096,6 +163124,7 @@ var init_subagent_events = __esm({
163096
163124
  SubAgentEventType2["TOOL_CALL"] = "tool_call";
163097
163125
  SubAgentEventType2["TOOL_RESULT"] = "tool_result";
163098
163126
  SubAgentEventType2["TOOL_WAITING_APPROVAL"] = "tool_waiting_approval";
163127
+ SubAgentEventType2["USAGE_METADATA"] = "usage_metadata";
163099
163128
  SubAgentEventType2["FINISH"] = "finish";
163100
163129
  SubAgentEventType2["ERROR"] = "error";
163101
163130
  })(SubAgentEventType || (SubAgentEventType = {}));
@@ -163318,6 +163347,7 @@ var init_subagent = __esm({
163318
163347
  tools: [{ functionDeclarations: toolsList }]
163319
163348
  }
163320
163349
  };
163350
+ const roundStreamStart = Date.now();
163321
163351
  const responseStream = await chat.sendMessageStream(this.modelConfig.model || this.runtimeContext.getModel() || DEFAULT_QWEN_MODEL, messageParams, promptId);
163322
163352
  this.eventEmitter?.emit(SubAgentEventType.ROUND_START, {
163323
163353
  subagentId: this.subagentId,
@@ -163372,13 +163402,22 @@ var init_subagent = __esm({
163372
163402
  if (lastUsage) {
163373
163403
  const inTok = Number(lastUsage.promptTokenCount || 0);
163374
163404
  const outTok = Number(lastUsage.candidatesTokenCount || 0);
163375
- if (isFinite(inTok) || isFinite(outTok)) {
163376
- this.stats.recordTokens(isFinite(inTok) ? inTok : 0, isFinite(outTok) ? outTok : 0);
163405
+ const thoughtTok = Number(lastUsage.thoughtsTokenCount || 0);
163406
+ const cachedTok = Number(lastUsage.cachedContentTokenCount || 0);
163407
+ if (isFinite(inTok) || isFinite(outTok) || isFinite(thoughtTok) || isFinite(cachedTok)) {
163408
+ this.stats.recordTokens(isFinite(inTok) ? inTok : 0, isFinite(outTok) ? outTok : 0, isFinite(thoughtTok) ? thoughtTok : 0, isFinite(cachedTok) ? cachedTok : 0);
163377
163409
  this.executionStats.inputTokens = (this.executionStats.inputTokens || 0) + (isFinite(inTok) ? inTok : 0);
163378
163410
  this.executionStats.outputTokens = (this.executionStats.outputTokens || 0) + (isFinite(outTok) ? outTok : 0);
163379
- this.executionStats.totalTokens = (this.executionStats.inputTokens || 0) + (this.executionStats.outputTokens || 0);
163411
+ this.executionStats.totalTokens = (this.executionStats.inputTokens || 0) + (this.executionStats.outputTokens || 0) + (isFinite(thoughtTok) ? thoughtTok : 0) + (isFinite(cachedTok) ? cachedTok : 0);
163380
163412
  this.executionStats.estimatedCost = (this.executionStats.inputTokens || 0) * 3e-5 + (this.executionStats.outputTokens || 0) * 6e-5;
163381
163413
  }
163414
+ this.eventEmitter?.emit(SubAgentEventType.USAGE_METADATA, {
163415
+ subagentId: this.subagentId,
163416
+ round: turnCounter,
163417
+ usage: lastUsage,
163418
+ durationMs: Date.now() - roundStreamStart,
163419
+ timestamp: Date.now()
163420
+ });
163382
163421
  }
163383
163422
  if (functionCalls.length > 0) {
163384
163423
  currentMessages = await this.processFunctionCalls(functionCalls, abortController, promptId, turnCounter, currentResponseId);
@@ -208380,6 +208419,7 @@ var init_config3 = __esm({
208380
208419
  enableToolOutputTruncation;
208381
208420
  eventEmitter;
208382
208421
  useSmartEdit;
208422
+ channel;
208383
208423
  constructor(params) {
208384
208424
  this.sessionId = params.sessionId ?? randomUUID5();
208385
208425
  this.sessionData = params.sessionData;
@@ -208476,6 +208516,7 @@ var init_config3 = __esm({
208476
208516
  this.enableToolOutputTruncation = params.enableToolOutputTruncation ?? true;
208477
208517
  this.useSmartEdit = params.useSmartEdit ?? false;
208478
208518
  this.extensionManagement = params.extensionManagement ?? true;
208519
+ this.channel = params.channel;
208479
208520
  this.storage = new Storage(this.targetDir);
208480
208521
  this.vlmSwitchMode = params.vlmSwitchMode;
208481
208522
  this.inputFormat = params.inputFormat ?? InputFormat.TEXT;
@@ -208856,6 +208897,9 @@ var init_config3 = __esm({
208856
208897
  getCliVersion() {
208857
208898
  return this.cliVersion;
208858
208899
  }
208900
+ getChannel() {
208901
+ return this.channel;
208902
+ }
208859
208903
  /**
208860
208904
  * Get the current FileSystemService
208861
208905
  */
@@ -287760,7 +287804,7 @@ var patchConsole = /* @__PURE__ */ __name((callback) => {
287760
287804
  var dist_default = patchConsole;
287761
287805
 
287762
287806
  // node_modules/ink/build/ink.js
287763
- var import_constants19 = __toESM(require_constants11(), 1);
287807
+ var import_constants20 = __toESM(require_constants11(), 1);
287764
287808
 
287765
287809
  // node_modules/yoga-layout/dist/src/index.js
287766
287810
  init_esbuild_shims();
@@ -289823,7 +289867,7 @@ __name(wrapAnsi, "wrapAnsi");
289823
289867
  // node_modules/ink/build/reconciler.js
289824
289868
  init_esbuild_shims();
289825
289869
  var import_react_reconciler = __toESM(require_react_reconciler(), 1);
289826
- var import_constants18 = __toESM(require_constants11(), 1);
289870
+ var import_constants19 = __toESM(require_constants11(), 1);
289827
289871
  import process15 from "node:process";
289828
289872
  var import_react = __toESM(require_react(), 1);
289829
289873
 
@@ -290794,7 +290838,7 @@ var cleanupYogaNode = /* @__PURE__ */ __name((node) => {
290794
290838
  node?.unsetMeasureFunc();
290795
290839
  node?.freeRecursive();
290796
290840
  }, "cleanupYogaNode");
290797
- var currentUpdatePriority = import_constants18.NoEventPriority;
290841
+ var currentUpdatePriority = import_constants19.NoEventPriority;
290798
290842
  var currentRootNode;
290799
290843
  var reconciler_default = (0, import_react_reconciler.default)({
290800
290844
  getRootHostContext: /* @__PURE__ */ __name(() => ({
@@ -290951,10 +290995,10 @@ var reconciler_default = (0, import_react_reconciler.default)({
290951
290995
  },
290952
290996
  getCurrentUpdatePriority: /* @__PURE__ */ __name(() => currentUpdatePriority, "getCurrentUpdatePriority"),
290953
290997
  resolveUpdatePriority() {
290954
- if (currentUpdatePriority !== import_constants18.NoEventPriority) {
290998
+ if (currentUpdatePriority !== import_constants19.NoEventPriority) {
290955
290999
  return currentUpdatePriority;
290956
291000
  }
290957
- return import_constants18.DefaultEventPriority;
291001
+ return import_constants19.DefaultEventPriority;
290958
291002
  },
290959
291003
  maySuspendCommit() {
290960
291004
  return false;
@@ -293472,7 +293516,7 @@ var Ink = class {
293472
293516
  this.fullStaticOutput = "";
293473
293517
  this.container = reconciler_default.createContainer(
293474
293518
  this.rootNode,
293475
- import_constants19.LegacyRoot,
293519
+ import_constants20.LegacyRoot,
293476
293520
  null,
293477
293521
  false,
293478
293522
  null,
@@ -297625,12 +297669,12 @@ var Header = class {
297625
297669
  if (!buf || !(buf.length >= off + 512)) {
297626
297670
  throw new Error("need 512 bytes for header");
297627
297671
  }
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);
297672
+ this.path = ex?.path ?? decString(buf, off, 100);
297673
+ this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8);
297674
+ this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
297675
+ this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
297676
+ this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
297677
+ this.mtime = ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
297634
297678
  this.cksum = decNumber(buf, off + 148, 12);
297635
297679
  if (gex)
297636
297680
  this.#slurp(gex, true);
@@ -297648,10 +297692,10 @@ var Header = class {
297648
297692
  }
297649
297693
  this.linkpath = decString(buf, off + 157, 100);
297650
297694
  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;
297695
+ this.uname = ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
297696
+ this.gname = ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
297697
+ this.devmaj = ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
297698
+ this.devmin = ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0;
297655
297699
  if (buf[off + 475] !== 0) {
297656
297700
  const prefix = decString(buf, off + 345, 155);
297657
297701
  this.path = prefix + "/" + this.path;
@@ -297660,8 +297704,8 @@ var Header = class {
297660
297704
  if (prefix) {
297661
297705
  this.path = prefix + "/" + this.path;
297662
297706
  }
297663
- this.atime = decDate(buf, off + 476, 12);
297664
- this.ctime = decDate(buf, off + 488, 12);
297707
+ this.atime = ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
297708
+ this.ctime = ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
297665
297709
  }
297666
297710
  }
297667
297711
  let sum = 8 * 32;
@@ -298607,13 +298651,15 @@ var listFileSync = /* @__PURE__ */ __name((opt) => {
298607
298651
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
298608
298652
  if (stat6.size < readSize) {
298609
298653
  const buf = Buffer.allocUnsafe(stat6.size);
298610
- fs57.readSync(fd, buf, 0, stat6.size, 0);
298611
- p.end(buf);
298654
+ const read3 = fs57.readSync(fd, buf, 0, stat6.size, 0);
298655
+ p.end(read3 === buf.byteLength ? buf : buf.subarray(0, read3));
298612
298656
  } else {
298613
298657
  let pos2 = 0;
298614
298658
  const buf = Buffer.allocUnsafe(readSize);
298615
298659
  while (pos2 < stat6.size) {
298616
298660
  const bytesRead = fs57.readSync(fd, buf, 0, readSize, pos2);
298661
+ if (bytesRead === 0)
298662
+ break;
298617
298663
  pos2 += bytesRead;
298618
298664
  p.write(buf.subarray(0, bytesRead));
298619
298665
  }
@@ -309147,7 +309193,7 @@ __name(getPackageJson, "getPackageJson");
309147
309193
  // packages/cli/src/utils/version.ts
309148
309194
  async function getCliVersion() {
309149
309195
  const pkgJson = await getPackageJson();
309150
- return "0.4.1-nightly.20251211.a02c4b27";
309196
+ return "0.5.0-nightly.20251212.8b29dd13";
309151
309197
  }
309152
309198
  __name(getCliVersion, "getCliVersion");
309153
309199
 
@@ -309771,6 +309817,10 @@ async function parseArguments(settings) {
309771
309817
  }).option("experimental-acp", {
309772
309818
  type: "boolean",
309773
309819
  description: "Starts the agent in ACP mode"
309820
+ }).option("channel", {
309821
+ type: "string",
309822
+ choices: ["VSCode", "ACP", "SDK", "CI"],
309823
+ description: "Channel identifier (VSCode, ACP, SDK, CI)"
309774
309824
  }).option("allowed-mcp-server-names", {
309775
309825
  type: "array",
309776
309826
  string: true,
@@ -309950,6 +310000,9 @@ async function parseArguments(settings) {
309950
310000
  }
309951
310001
  }
309952
310002
  result["query"] = q || void 0;
310003
+ if (result["experimentalAcp"] && !result["channel"]) {
310004
+ result["channel"] = "ACP";
310005
+ }
309953
310006
  return result;
309954
310007
  }
309955
310008
  __name(parseArguments, "parseArguments");
@@ -310238,7 +310291,8 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, a
310238
310291
  useSmartEdit: argv.useSmartEdit ?? settings.useSmartEdit,
310239
310292
  output: {
310240
310293
  format: outputSettingsFormat
310241
- }
310294
+ },
310295
+ channel: argv.channel
310242
310296
  });
310243
310297
  }
310244
310298
  __name(loadCliConfig, "loadCliConfig");
@@ -313213,7 +313267,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
313213
313267
 
313214
313268
  // packages/cli/src/generated/git-commit.ts
313215
313269
  init_esbuild_shims();
313216
- var GIT_COMMIT_INFO2 = "e4ee3397";
313270
+ var GIT_COMMIT_INFO2 = "b59de9a8";
313217
313271
 
313218
313272
  // packages/cli/src/utils/systemInfo.ts
313219
313273
  async function getNpmVersion() {
@@ -316380,7 +316434,7 @@ var getGitRepoRoot = /* @__PURE__ */ __name(() => {
316380
316434
  var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
316381
316435
  try {
316382
316436
  const controller = new AbortController();
316383
- const endpoint = `https://api.github.com/repos/google-github-actions/run-gemini-cli/releases/latest`;
316437
+ const endpoint = `https://api.github.com/repos/QwenLM/qwen-code-action/releases/latest`;
316384
316438
  const response = await fetch(endpoint, {
316385
316439
  method: "GET",
316386
316440
  headers: {
@@ -316402,9 +316456,12 @@ var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
316402
316456
  }
316403
316457
  return releaseTag;
316404
316458
  } catch (_error) {
316405
- console.debug(`Failed to determine latest run-gemini-cli release:`, _error);
316459
+ console.debug(
316460
+ `Failed to determine latest qwen-code-action release:`,
316461
+ _error
316462
+ );
316406
316463
  throw new Error(
316407
- `Unable to determine the latest run-gemini-cli release on GitHub.`
316464
+ `Unable to determine the latest qwen-code-action release on GitHub.`
316408
316465
  );
316409
316466
  }
316410
316467
  }, "getLatestGitHubRelease");
@@ -316426,11 +316483,11 @@ __name(getGitHubRepoInfo, "getGitHubRepoInfo");
316426
316483
 
316427
316484
  // packages/cli/src/ui/commands/setupGithubCommand.ts
316428
316485
  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"
316486
+ "qwen-dispatch/qwen-dispatch.yml",
316487
+ "qwen-assistant/qwen-invoke.yml",
316488
+ "issue-triage/qwen-triage.yml",
316489
+ "issue-triage/qwen-scheduled-triage.yml",
316490
+ "pr-review/qwen-review.yml"
316434
316491
  ];
316435
316492
  function getOpenUrlsCommands(readmeUrl) {
316436
316493
  const openCmd = getUrlOpenCommand();
@@ -316446,7 +316503,7 @@ function getOpenUrlsCommands(readmeUrl) {
316446
316503
  }
316447
316504
  __name(getOpenUrlsCommands, "getOpenUrlsCommands");
316448
316505
  async function updateGitignore(gitRepoRoot) {
316449
- const gitignoreEntries = [".gemini/", "gha-creds-*.json"];
316506
+ const gitignoreEntries = [".qwen/", "gha-creds-*.json"];
316450
316507
  const gitignorePath = path89.join(gitRepoRoot, ".gitignore");
316451
316508
  try {
316452
316509
  let existingContent = "";
@@ -316497,7 +316554,7 @@ var setupGithubCommand = {
316497
316554
  }
316498
316555
  const proxy = context2?.services?.config?.getProxy();
316499
316556
  const releaseTag = await getLatestGitHubRelease(proxy);
316500
- const readmeUrl = `https://github.com/google-github-actions/run-gemini-cli/blob/${releaseTag}/README.md#quick-start`;
316557
+ const readmeUrl = `https://github.com/QwenLM/qwen-code-action/blob/${releaseTag}/README.md#quick-start`;
316501
316558
  const githubWorkflowsDir = path89.join(gitRepoRoot, ".github", "workflows");
316502
316559
  try {
316503
316560
  await fs79.promises.mkdir(githubWorkflowsDir, { recursive: true });
@@ -316514,7 +316571,7 @@ var setupGithubCommand = {
316514
316571
  for (const workflow of GITHUB_WORKFLOW_PATHS) {
316515
316572
  downloads.push(
316516
316573
  (async () => {
316517
- const endpoint = `https://raw.githubusercontent.com/google-github-actions/run-gemini-cli/refs/tags/${releaseTag}/examples/workflows/${workflow}`;
316574
+ const endpoint = `https://raw.githubusercontent.com/QwenLM/qwen-code-action/refs/tags/${releaseTag}/examples/workflows/${workflow}`;
316518
316575
  const response = await fetch(endpoint, {
316519
316576
  method: "GET",
316520
316577
  dispatcher: proxy ? new import_undici5.ProxyAgent(proxy) : void 0,
@@ -316564,8 +316621,9 @@ var setupGithubCommand = {
316564
316621
  type: "tool",
316565
316622
  toolName: "run_shell_command",
316566
316623
  toolArgs: {
316567
- description: "Setting up GitHub Actions to triage issues and review PRs with Gemini.",
316568
- command: command2
316624
+ description: "Setting up GitHub Actions to triage issues and review PRs with Qwen.",
316625
+ command: command2,
316626
+ is_background: false
316569
316627
  }
316570
316628
  };
316571
316629
  }, "action")
@@ -361676,6 +361734,17 @@ var annotationsSchema = external_exports.object({
361676
361734
  lastModified: external_exports.string().optional().nullable(),
361677
361735
  priority: external_exports.number().optional().nullable()
361678
361736
  });
361737
+ var usageSchema = external_exports.object({
361738
+ promptTokens: external_exports.number().optional().nullable(),
361739
+ completionTokens: external_exports.number().optional().nullable(),
361740
+ thoughtsTokens: external_exports.number().optional().nullable(),
361741
+ totalTokens: external_exports.number().optional().nullable(),
361742
+ cachedTokens: external_exports.number().optional().nullable()
361743
+ });
361744
+ var sessionUpdateMetaSchema = external_exports.object({
361745
+ usage: usageSchema.optional().nullable(),
361746
+ durationMs: external_exports.number().optional().nullable()
361747
+ });
361679
361748
  var requestPermissionResponseSchema = external_exports.object({
361680
361749
  outcome: requestPermissionOutcomeSchema
361681
361750
  });
@@ -361831,11 +361900,13 @@ var sessionUpdateSchema = external_exports.union([
361831
361900
  }),
361832
361901
  external_exports.object({
361833
361902
  content: contentBlockSchema,
361834
- sessionUpdate: external_exports.literal("agent_message_chunk")
361903
+ sessionUpdate: external_exports.literal("agent_message_chunk"),
361904
+ _meta: sessionUpdateMetaSchema.optional().nullable()
361835
361905
  }),
361836
361906
  external_exports.object({
361837
361907
  content: contentBlockSchema,
361838
- sessionUpdate: external_exports.literal("agent_thought_chunk")
361908
+ sessionUpdate: external_exports.literal("agent_thought_chunk"),
361909
+ _meta: sessionUpdateMetaSchema.optional().nullable()
361839
361910
  }),
361840
361911
  external_exports.object({
361841
361912
  content: external_exports.array(toolCallContentSchema).optional(),
@@ -362165,6 +362236,15 @@ var AcpFileSystemService = class {
362165
362236
  line: null,
362166
362237
  limit: null
362167
362238
  });
362239
+ if (response.content.startsWith("ERROR: ENOENT:")) {
362240
+ const match2 = /^ERROR:\s*ENOENT:\s*(?<path>.*)$/i.exec(response.content);
362241
+ const err = new Error(response.content);
362242
+ err.code = "ENOENT";
362243
+ err.errno = -2;
362244
+ const rawPath = match2?.groups?.["path"]?.trim();
362245
+ err["path"] = rawPath ? rawPath.replace(/^['"]|['"]$/g, "") || filePath : filePath;
362246
+ throw err;
362247
+ }
362168
362248
  return response.content;
362169
362249
  }
362170
362250
  async writeTextFile(filePath, content) {
@@ -362241,6 +362321,15 @@ var MessageEmitter = class extends BaseEmitter {
362241
362321
  content: { type: "text", text }
362242
362322
  });
362243
362323
  }
362324
+ /**
362325
+ * Emits an agent thought chunk.
362326
+ */
362327
+ async emitAgentThought(text) {
362328
+ await this.sendUpdate({
362329
+ sessionUpdate: "agent_thought_chunk",
362330
+ content: { type: "text", text }
362331
+ });
362332
+ }
362244
362333
  /**
362245
362334
  * Emits an agent message chunk.
362246
362335
  */
@@ -362251,12 +362340,21 @@ var MessageEmitter = class extends BaseEmitter {
362251
362340
  });
362252
362341
  }
362253
362342
  /**
362254
- * Emits an agent thought chunk.
362343
+ * Emits usage metadata.
362255
362344
  */
362256
- async emitAgentThought(text) {
362345
+ async emitUsageMetadata(usageMetadata, text = "", durationMs) {
362346
+ const usage2 = {
362347
+ promptTokens: usageMetadata.promptTokenCount,
362348
+ completionTokens: usageMetadata.candidatesTokenCount,
362349
+ thoughtsTokens: usageMetadata.thoughtsTokenCount,
362350
+ totalTokens: usageMetadata.totalTokenCount,
362351
+ cachedTokens: usageMetadata.cachedContentTokenCount
362352
+ };
362353
+ const meta = typeof durationMs === "number" ? { usage: usage2, durationMs } : { usage: usage2 };
362257
362354
  await this.sendUpdate({
362258
- sessionUpdate: "agent_thought_chunk",
362259
- content: { type: "text", text }
362355
+ sessionUpdate: "agent_message_chunk",
362356
+ content: { type: "text", text },
362357
+ _meta: meta
362260
362358
  });
362261
362359
  }
362262
362360
  /**
@@ -362372,7 +362470,7 @@ var ToolCallEmitter = class extends BaseEmitter {
362372
362470
  await this.sendUpdate({
362373
362471
  sessionUpdate: "tool_call",
362374
362472
  toolCallId: params.callId,
362375
- status: "in_progress",
362473
+ status: params.status || "pending",
362376
362474
  title,
362377
362475
  content: [],
362378
362476
  locations,
@@ -362539,7 +362637,10 @@ var ToolCallEmitter = class extends BaseEmitter {
362539
362637
  }
362540
362638
  if ("functionResponse" in part && part.functionResponse) {
362541
362639
  try {
362542
- const responseText = JSON.stringify(part.functionResponse.response);
362640
+ const resp = part.functionResponse.response;
362641
+ const outputField = resp["output"];
362642
+ const errorField = resp["error"];
362643
+ const responseText = typeof outputField === "string" ? outputField : typeof errorField === "string" ? errorField : JSON.stringify(resp);
362543
362644
  result.push({
362544
362645
  type: "content",
362545
362646
  content: { type: "text", text: responseText }
@@ -362587,6 +362688,9 @@ var HistoryReplayer = class {
362587
362688
  if (record.message) {
362588
362689
  await this.replayContent(record.message, "assistant");
362589
362690
  }
362691
+ if (record.usageMetadata) {
362692
+ await this.replayUsageMetadata(record.usageMetadata);
362693
+ }
362590
362694
  break;
362591
362695
  case "tool_result":
362592
362696
  await this.replayToolResult(record);
@@ -362611,11 +362715,19 @@ var HistoryReplayer = class {
362611
362715
  await this.toolCallEmitter.emitStart({
362612
362716
  toolName: functionName,
362613
362717
  callId,
362614
- args: part.functionCall.args
362718
+ args: part.functionCall.args,
362719
+ status: "in_progress"
362615
362720
  });
362616
362721
  }
362617
362722
  }
362618
362723
  }
362724
+ /**
362725
+ * Replays usage metadata.
362726
+ * @param usageMetadata - The usage metadata to replay
362727
+ */
362728
+ async replayUsageMetadata(usageMetadata) {
362729
+ await this.messageEmitter.emitUsageMetadata(usageMetadata);
362730
+ }
362619
362731
  /**
362620
362732
  * Replays a tool result record.
362621
362733
  */
@@ -362636,6 +362748,40 @@ var HistoryReplayer = class {
362636
362748
  // Note: args aren't stored in tool_result records by default
362637
362749
  args: void 0
362638
362750
  });
362751
+ const { resultDisplay } = result ?? {};
362752
+ if (!!resultDisplay && typeof resultDisplay === "object" && "type" in resultDisplay && resultDisplay.type === "task_execution") {
362753
+ await this.emitTaskUsageFromResultDisplay(
362754
+ resultDisplay
362755
+ );
362756
+ }
362757
+ }
362758
+ /**
362759
+ * Emits token usage from a TaskResultDisplay execution summary, if present.
362760
+ */
362761
+ async emitTaskUsageFromResultDisplay(resultDisplay) {
362762
+ const summary = resultDisplay.executionSummary;
362763
+ if (!summary) {
362764
+ return;
362765
+ }
362766
+ const usageMetadata = {};
362767
+ if (Number.isFinite(summary.inputTokens)) {
362768
+ usageMetadata.promptTokenCount = summary.inputTokens;
362769
+ }
362770
+ if (Number.isFinite(summary.outputTokens)) {
362771
+ usageMetadata.candidatesTokenCount = summary.outputTokens;
362772
+ }
362773
+ if (Number.isFinite(summary.thoughtTokens)) {
362774
+ usageMetadata.thoughtsTokenCount = summary.thoughtTokens;
362775
+ }
362776
+ if (Number.isFinite(summary.cachedTokens)) {
362777
+ usageMetadata.cachedContentTokenCount = summary.cachedTokens;
362778
+ }
362779
+ if (Number.isFinite(summary.totalTokens)) {
362780
+ usageMetadata.totalTokenCount = summary.totalTokens;
362781
+ }
362782
+ if (Object.keys(usageMetadata).length > 0) {
362783
+ await this.messageEmitter.emitUsageMetadata(usageMetadata);
362784
+ }
362639
362785
  }
362640
362786
  /**
362641
362787
  * Extracts tool name from a chat record's function response.
@@ -362672,11 +362818,13 @@ var SubAgentTracker = class {
362672
362818
  this.ctx = ctx;
362673
362819
  this.client = client;
362674
362820
  this.toolCallEmitter = new ToolCallEmitter(ctx);
362821
+ this.messageEmitter = new MessageEmitter(ctx);
362675
362822
  }
362676
362823
  static {
362677
362824
  __name(this, "SubAgentTracker");
362678
362825
  }
362679
362826
  toolCallEmitter;
362827
+ messageEmitter;
362680
362828
  toolStates = /* @__PURE__ */ new Map();
362681
362829
  /**
362682
362830
  * Sets up event listeners for a sub-agent's tool events.
@@ -362689,14 +362837,17 @@ var SubAgentTracker = class {
362689
362837
  const onToolCall = this.createToolCallHandler(abortSignal);
362690
362838
  const onToolResult = this.createToolResultHandler(abortSignal);
362691
362839
  const onApproval = this.createApprovalHandler(abortSignal);
362840
+ const onUsageMetadata = this.createUsageMetadataHandler(abortSignal);
362692
362841
  eventEmitter.on(SubAgentEventType.TOOL_CALL, onToolCall);
362693
362842
  eventEmitter.on(SubAgentEventType.TOOL_RESULT, onToolResult);
362694
362843
  eventEmitter.on(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
362844
+ eventEmitter.on(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
362695
362845
  return [
362696
362846
  () => {
362697
362847
  eventEmitter.off(SubAgentEventType.TOOL_CALL, onToolCall);
362698
362848
  eventEmitter.off(SubAgentEventType.TOOL_RESULT, onToolResult);
362699
362849
  eventEmitter.off(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
362850
+ eventEmitter.off(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
362700
362851
  this.toolStates.clear();
362701
362852
  }
362702
362853
  ];
@@ -362799,6 +362950,16 @@ var SubAgentTracker = class {
362799
362950
  }
362800
362951
  };
362801
362952
  }
362953
+ /**
362954
+ * Creates a handler for usage metadata events.
362955
+ */
362956
+ createUsageMetadataHandler(abortSignal) {
362957
+ return (...args) => {
362958
+ const event = args[0];
362959
+ if (abortSignal.aborted) return;
362960
+ this.messageEmitter.emitUsageMetadata(event.usage, "", event.durationMs);
362961
+ };
362962
+ }
362802
362963
  /**
362803
362964
  * Converts confirmation details to permission options for the client.
362804
362965
  */
@@ -362873,6 +363034,7 @@ var Session3 = class {
362873
363034
  this.toolCallEmitter = new ToolCallEmitter(this);
362874
363035
  this.planEmitter = new PlanEmitter(this);
362875
363036
  this.historyReplayer = new HistoryReplayer(this);
363037
+ this.messageEmitter = new MessageEmitter(this);
362876
363038
  }
362877
363039
  static {
362878
363040
  __name(this, "Session");
@@ -362883,6 +363045,7 @@ var Session3 = class {
362883
363045
  historyReplayer;
362884
363046
  toolCallEmitter;
362885
363047
  planEmitter;
363048
+ messageEmitter;
362886
363049
  // Implement SessionContext interface
362887
363050
  sessionId;
362888
363051
  getId() {
@@ -362949,6 +363112,8 @@ var Session3 = class {
362949
363112
  return { stopReason: "cancelled" };
362950
363113
  }
362951
363114
  const functionCalls = [];
363115
+ let usageMetadata = null;
363116
+ const streamStartTime = Date.now();
362952
363117
  try {
362953
363118
  const responseStream = await chat.sendMessageStream(
362954
363119
  this.config.getModel(),
@@ -362971,16 +363136,16 @@ var Session3 = class {
362971
363136
  if (!part.text) {
362972
363137
  continue;
362973
363138
  }
362974
- const content = {
362975
- type: "text",
362976
- text: part.text
362977
- };
362978
- this.sendUpdate({
362979
- sessionUpdate: part.thought ? "agent_thought_chunk" : "agent_message_chunk",
362980
- content
362981
- });
363139
+ this.messageEmitter.emitMessage(
363140
+ part.text,
363141
+ "assistant",
363142
+ part.thought
363143
+ );
362982
363144
  }
362983
363145
  }
363146
+ if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
363147
+ usageMetadata = resp.value.usageMetadata;
363148
+ }
362984
363149
  if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
362985
363150
  functionCalls.push(...resp.value.functionCalls);
362986
363151
  }
@@ -362994,6 +363159,14 @@ var Session3 = class {
362994
363159
  }
362995
363160
  throw error;
362996
363161
  }
363162
+ if (usageMetadata) {
363163
+ const durationMs = Date.now() - streamStartTime;
363164
+ await this.messageEmitter.emitUsageMetadata(
363165
+ usageMetadata,
363166
+ "",
363167
+ durationMs
363168
+ );
363169
+ }
362997
363170
  if (functionCalls.length > 0) {
362998
363171
  const toolResponseParts = [];
362999
363172
  for (const fc of functionCalls) {
@@ -363132,7 +363305,7 @@ var Session3 = class {
363132
363305
  abortSignal
363133
363306
  );
363134
363307
  }
363135
- const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
363308
+ const confirmationDetails = this.config.getApprovalMode() !== ApprovalMode.YOLO ? await invocation.shouldConfirmExecute(abortSignal) : false;
363136
363309
  if (confirmationDetails) {
363137
363310
  const content = [];
363138
363311
  if (confirmationDetails.type === "edit") {
@@ -363191,7 +363364,8 @@ var Session3 = class {
363191
363364
  const startParams = {
363192
363365
  callId,
363193
363366
  toolName: fc.name,
363194
- args
363367
+ args,
363368
+ status: "in_progress"
363195
363369
  };
363196
363370
  await this.toolCallEmitter.emitStart(startParams);
363197
363371
  }
@@ -363604,7 +363778,7 @@ var GeminiAgent = class {
363604
363778
  name: APPROVAL_MODE_INFO[mode].name,
363605
363779
  description: APPROVAL_MODE_INFO[mode].description
363606
363780
  }));
363607
- const version2 = "0.4.1-nightly.20251211.a02c4b27";
363781
+ const version2 = "0.5.0-nightly.20251212.8b29dd13";
363608
363782
  return {
363609
363783
  protocolVersion: PROTOCOL_VERSION,
363610
363784
  agentInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwen-code/qwen-code",
3
- "version": "0.4.1-nightly.20251211.a02c4b27",
3
+ "version": "0.5.0-nightly.20251212.8b29dd13",
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.20251211.a02c4b27"
23
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.5.0-nightly.20251212.8b29dd13"
24
24
  },
25
25
  "dependencies": {
26
26
  "tiktoken": "^1.0.21"