@qwen-code/qwen-code 0.4.1-nightly.20251211.a02c4b27 → 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.
- package/cli.js +223 -65
- 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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
163376
|
-
|
|
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
|
|
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
|
|
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 =
|
|
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 !==
|
|
290990
|
+
if (currentUpdatePriority !== import_constants19.NoEventPriority) {
|
|
290955
290991
|
return currentUpdatePriority;
|
|
290956
290992
|
}
|
|
290957
|
-
return
|
|
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
|
-
|
|
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.
|
|
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 = "
|
|
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/
|
|
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(
|
|
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
|
|
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
|
-
"
|
|
316430
|
-
"
|
|
316431
|
-
"issue-triage/
|
|
316432
|
-
"issue-triage/
|
|
316433
|
-
"pr-review/
|
|
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 = [".
|
|
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/
|
|
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/
|
|
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
|
|
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")
|
|
@@ -361676,6 +361718,17 @@ var annotationsSchema = external_exports.object({
|
|
|
361676
361718
|
lastModified: external_exports.string().optional().nullable(),
|
|
361677
361719
|
priority: external_exports.number().optional().nullable()
|
|
361678
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
|
+
});
|
|
361679
361732
|
var requestPermissionResponseSchema = external_exports.object({
|
|
361680
361733
|
outcome: requestPermissionOutcomeSchema
|
|
361681
361734
|
});
|
|
@@ -361831,11 +361884,13 @@ var sessionUpdateSchema = external_exports.union([
|
|
|
361831
361884
|
}),
|
|
361832
361885
|
external_exports.object({
|
|
361833
361886
|
content: contentBlockSchema,
|
|
361834
|
-
sessionUpdate: external_exports.literal("agent_message_chunk")
|
|
361887
|
+
sessionUpdate: external_exports.literal("agent_message_chunk"),
|
|
361888
|
+
_meta: sessionUpdateMetaSchema.optional().nullable()
|
|
361835
361889
|
}),
|
|
361836
361890
|
external_exports.object({
|
|
361837
361891
|
content: contentBlockSchema,
|
|
361838
|
-
sessionUpdate: external_exports.literal("agent_thought_chunk")
|
|
361892
|
+
sessionUpdate: external_exports.literal("agent_thought_chunk"),
|
|
361893
|
+
_meta: sessionUpdateMetaSchema.optional().nullable()
|
|
361839
361894
|
}),
|
|
361840
361895
|
external_exports.object({
|
|
361841
361896
|
content: external_exports.array(toolCallContentSchema).optional(),
|
|
@@ -362165,6 +362220,15 @@ var AcpFileSystemService = class {
|
|
|
362165
362220
|
line: null,
|
|
362166
362221
|
limit: null
|
|
362167
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
|
+
}
|
|
362168
362232
|
return response.content;
|
|
362169
362233
|
}
|
|
362170
362234
|
async writeTextFile(filePath, content) {
|
|
@@ -362241,6 +362305,15 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
362241
362305
|
content: { type: "text", text }
|
|
362242
362306
|
});
|
|
362243
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
|
+
}
|
|
362244
362317
|
/**
|
|
362245
362318
|
* Emits an agent message chunk.
|
|
362246
362319
|
*/
|
|
@@ -362251,12 +362324,21 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
362251
362324
|
});
|
|
362252
362325
|
}
|
|
362253
362326
|
/**
|
|
362254
|
-
* Emits
|
|
362327
|
+
* Emits usage metadata.
|
|
362255
362328
|
*/
|
|
362256
|
-
async
|
|
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 };
|
|
362257
362338
|
await this.sendUpdate({
|
|
362258
|
-
sessionUpdate: "
|
|
362259
|
-
content: { type: "text", text }
|
|
362339
|
+
sessionUpdate: "agent_message_chunk",
|
|
362340
|
+
content: { type: "text", text },
|
|
362341
|
+
_meta: meta
|
|
362260
362342
|
});
|
|
362261
362343
|
}
|
|
362262
362344
|
/**
|
|
@@ -362372,7 +362454,7 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
362372
362454
|
await this.sendUpdate({
|
|
362373
362455
|
sessionUpdate: "tool_call",
|
|
362374
362456
|
toolCallId: params.callId,
|
|
362375
|
-
status: "
|
|
362457
|
+
status: params.status || "pending",
|
|
362376
362458
|
title,
|
|
362377
362459
|
content: [],
|
|
362378
362460
|
locations,
|
|
@@ -362539,7 +362621,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
362539
362621
|
}
|
|
362540
362622
|
if ("functionResponse" in part && part.functionResponse) {
|
|
362541
362623
|
try {
|
|
362542
|
-
const
|
|
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);
|
|
362543
362628
|
result.push({
|
|
362544
362629
|
type: "content",
|
|
362545
362630
|
content: { type: "text", text: responseText }
|
|
@@ -362587,6 +362672,9 @@ var HistoryReplayer = class {
|
|
|
362587
362672
|
if (record.message) {
|
|
362588
362673
|
await this.replayContent(record.message, "assistant");
|
|
362589
362674
|
}
|
|
362675
|
+
if (record.usageMetadata) {
|
|
362676
|
+
await this.replayUsageMetadata(record.usageMetadata);
|
|
362677
|
+
}
|
|
362590
362678
|
break;
|
|
362591
362679
|
case "tool_result":
|
|
362592
362680
|
await this.replayToolResult(record);
|
|
@@ -362611,11 +362699,19 @@ var HistoryReplayer = class {
|
|
|
362611
362699
|
await this.toolCallEmitter.emitStart({
|
|
362612
362700
|
toolName: functionName,
|
|
362613
362701
|
callId,
|
|
362614
|
-
args: part.functionCall.args
|
|
362702
|
+
args: part.functionCall.args,
|
|
362703
|
+
status: "in_progress"
|
|
362615
362704
|
});
|
|
362616
362705
|
}
|
|
362617
362706
|
}
|
|
362618
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
|
+
}
|
|
362619
362715
|
/**
|
|
362620
362716
|
* Replays a tool result record.
|
|
362621
362717
|
*/
|
|
@@ -362636,6 +362732,40 @@ var HistoryReplayer = class {
|
|
|
362636
362732
|
// Note: args aren't stored in tool_result records by default
|
|
362637
362733
|
args: void 0
|
|
362638
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
|
+
}
|
|
362639
362769
|
}
|
|
362640
362770
|
/**
|
|
362641
362771
|
* Extracts tool name from a chat record's function response.
|
|
@@ -362672,11 +362802,13 @@ var SubAgentTracker = class {
|
|
|
362672
362802
|
this.ctx = ctx;
|
|
362673
362803
|
this.client = client;
|
|
362674
362804
|
this.toolCallEmitter = new ToolCallEmitter(ctx);
|
|
362805
|
+
this.messageEmitter = new MessageEmitter(ctx);
|
|
362675
362806
|
}
|
|
362676
362807
|
static {
|
|
362677
362808
|
__name(this, "SubAgentTracker");
|
|
362678
362809
|
}
|
|
362679
362810
|
toolCallEmitter;
|
|
362811
|
+
messageEmitter;
|
|
362680
362812
|
toolStates = /* @__PURE__ */ new Map();
|
|
362681
362813
|
/**
|
|
362682
362814
|
* Sets up event listeners for a sub-agent's tool events.
|
|
@@ -362689,14 +362821,17 @@ var SubAgentTracker = class {
|
|
|
362689
362821
|
const onToolCall = this.createToolCallHandler(abortSignal);
|
|
362690
362822
|
const onToolResult = this.createToolResultHandler(abortSignal);
|
|
362691
362823
|
const onApproval = this.createApprovalHandler(abortSignal);
|
|
362824
|
+
const onUsageMetadata = this.createUsageMetadataHandler(abortSignal);
|
|
362692
362825
|
eventEmitter.on(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
362693
362826
|
eventEmitter.on(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
362694
362827
|
eventEmitter.on(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
|
|
362828
|
+
eventEmitter.on(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
|
|
362695
362829
|
return [
|
|
362696
362830
|
() => {
|
|
362697
362831
|
eventEmitter.off(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
362698
362832
|
eventEmitter.off(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
362699
362833
|
eventEmitter.off(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
|
|
362834
|
+
eventEmitter.off(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
|
|
362700
362835
|
this.toolStates.clear();
|
|
362701
362836
|
}
|
|
362702
362837
|
];
|
|
@@ -362799,6 +362934,16 @@ var SubAgentTracker = class {
|
|
|
362799
362934
|
}
|
|
362800
362935
|
};
|
|
362801
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
|
+
}
|
|
362802
362947
|
/**
|
|
362803
362948
|
* Converts confirmation details to permission options for the client.
|
|
362804
362949
|
*/
|
|
@@ -362873,6 +363018,7 @@ var Session3 = class {
|
|
|
362873
363018
|
this.toolCallEmitter = new ToolCallEmitter(this);
|
|
362874
363019
|
this.planEmitter = new PlanEmitter(this);
|
|
362875
363020
|
this.historyReplayer = new HistoryReplayer(this);
|
|
363021
|
+
this.messageEmitter = new MessageEmitter(this);
|
|
362876
363022
|
}
|
|
362877
363023
|
static {
|
|
362878
363024
|
__name(this, "Session");
|
|
@@ -362883,6 +363029,7 @@ var Session3 = class {
|
|
|
362883
363029
|
historyReplayer;
|
|
362884
363030
|
toolCallEmitter;
|
|
362885
363031
|
planEmitter;
|
|
363032
|
+
messageEmitter;
|
|
362886
363033
|
// Implement SessionContext interface
|
|
362887
363034
|
sessionId;
|
|
362888
363035
|
getId() {
|
|
@@ -362949,6 +363096,8 @@ var Session3 = class {
|
|
|
362949
363096
|
return { stopReason: "cancelled" };
|
|
362950
363097
|
}
|
|
362951
363098
|
const functionCalls = [];
|
|
363099
|
+
let usageMetadata = null;
|
|
363100
|
+
const streamStartTime = Date.now();
|
|
362952
363101
|
try {
|
|
362953
363102
|
const responseStream = await chat.sendMessageStream(
|
|
362954
363103
|
this.config.getModel(),
|
|
@@ -362971,16 +363120,16 @@ var Session3 = class {
|
|
|
362971
363120
|
if (!part.text) {
|
|
362972
363121
|
continue;
|
|
362973
363122
|
}
|
|
362974
|
-
|
|
362975
|
-
|
|
362976
|
-
|
|
362977
|
-
|
|
362978
|
-
|
|
362979
|
-
sessionUpdate: part.thought ? "agent_thought_chunk" : "agent_message_chunk",
|
|
362980
|
-
content
|
|
362981
|
-
});
|
|
363123
|
+
this.messageEmitter.emitMessage(
|
|
363124
|
+
part.text,
|
|
363125
|
+
"assistant",
|
|
363126
|
+
part.thought
|
|
363127
|
+
);
|
|
362982
363128
|
}
|
|
362983
363129
|
}
|
|
363130
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
|
|
363131
|
+
usageMetadata = resp.value.usageMetadata;
|
|
363132
|
+
}
|
|
362984
363133
|
if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
|
|
362985
363134
|
functionCalls.push(...resp.value.functionCalls);
|
|
362986
363135
|
}
|
|
@@ -362994,6 +363143,14 @@ var Session3 = class {
|
|
|
362994
363143
|
}
|
|
362995
363144
|
throw error;
|
|
362996
363145
|
}
|
|
363146
|
+
if (usageMetadata) {
|
|
363147
|
+
const durationMs = Date.now() - streamStartTime;
|
|
363148
|
+
await this.messageEmitter.emitUsageMetadata(
|
|
363149
|
+
usageMetadata,
|
|
363150
|
+
"",
|
|
363151
|
+
durationMs
|
|
363152
|
+
);
|
|
363153
|
+
}
|
|
362997
363154
|
if (functionCalls.length > 0) {
|
|
362998
363155
|
const toolResponseParts = [];
|
|
362999
363156
|
for (const fc of functionCalls) {
|
|
@@ -363132,7 +363289,7 @@ var Session3 = class {
|
|
|
363132
363289
|
abortSignal
|
|
363133
363290
|
);
|
|
363134
363291
|
}
|
|
363135
|
-
const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
363292
|
+
const confirmationDetails = this.config.getApprovalMode() !== ApprovalMode.YOLO ? await invocation.shouldConfirmExecute(abortSignal) : false;
|
|
363136
363293
|
if (confirmationDetails) {
|
|
363137
363294
|
const content = [];
|
|
363138
363295
|
if (confirmationDetails.type === "edit") {
|
|
@@ -363191,7 +363348,8 @@ var Session3 = class {
|
|
|
363191
363348
|
const startParams = {
|
|
363192
363349
|
callId,
|
|
363193
363350
|
toolName: fc.name,
|
|
363194
|
-
args
|
|
363351
|
+
args,
|
|
363352
|
+
status: "in_progress"
|
|
363195
363353
|
};
|
|
363196
363354
|
await this.toolCallEmitter.emitStart(startParams);
|
|
363197
363355
|
}
|
|
@@ -363604,7 +363762,7 @@ var GeminiAgent = class {
|
|
|
363604
363762
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
363605
363763
|
description: APPROVAL_MODE_INFO[mode].description
|
|
363606
363764
|
}));
|
|
363607
|
-
const version2 = "0.4.1-nightly.
|
|
363765
|
+
const version2 = "0.4.1-nightly.20251212.58d3a9c2";
|
|
363608
363766
|
return {
|
|
363609
363767
|
protocolVersion: PROTOCOL_VERSION,
|
|
363610
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.
|
|
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.
|
|
23
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.4.1-nightly.20251212.58d3a9c2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"tiktoken": "^1.0.21"
|