@qwen-code/qwen-code 0.8.2-nightly.20260129.dd973379 → 0.8.2-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +300 -336
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -129795,30 +129795,6 @@ function isQwenQuotaExceededError(error2) {
|
|
|
129795
129795
|
}
|
|
129796
129796
|
return false;
|
|
129797
129797
|
}
|
|
129798
|
-
function isQwenThrottlingError(error2) {
|
|
129799
|
-
const checkMessage = /* @__PURE__ */ __name((message) => {
|
|
129800
|
-
const lowerMessage = message.toLowerCase();
|
|
129801
|
-
return lowerMessage.includes("throttling") || lowerMessage.includes("requests throttling triggered") || lowerMessage.includes("rate limit") || lowerMessage.includes("too many requests");
|
|
129802
|
-
}, "checkMessage");
|
|
129803
|
-
const getStatusCode = /* @__PURE__ */ __name((error3) => {
|
|
129804
|
-
if (error3 && typeof error3 === "object") {
|
|
129805
|
-
const errorObj = error3;
|
|
129806
|
-
return errorObj.status || errorObj.code;
|
|
129807
|
-
}
|
|
129808
|
-
return void 0;
|
|
129809
|
-
}, "getStatusCode");
|
|
129810
|
-
const statusCode = getStatusCode(error2);
|
|
129811
|
-
if (typeof error2 === "string") {
|
|
129812
|
-
return statusCode === 429 && checkMessage(error2) || error2.includes("throttling");
|
|
129813
|
-
}
|
|
129814
|
-
if (isStructuredError(error2)) {
|
|
129815
|
-
return statusCode === 429 && checkMessage(error2.message);
|
|
129816
|
-
}
|
|
129817
|
-
if (isApiError(error2)) {
|
|
129818
|
-
return error2.error.code === 429 && checkMessage(error2.error.message);
|
|
129819
|
-
}
|
|
129820
|
-
return false;
|
|
129821
|
-
}
|
|
129822
129798
|
var init_quotaErrorDetection = __esm({
|
|
129823
129799
|
"packages/core/dist/src/utils/quotaErrorDetection.js"() {
|
|
129824
129800
|
"use strict";
|
|
@@ -129826,7 +129802,6 @@ var init_quotaErrorDetection = __esm({
|
|
|
129826
129802
|
__name(isApiError, "isApiError");
|
|
129827
129803
|
__name(isStructuredError, "isStructuredError");
|
|
129828
129804
|
__name(isQwenQuotaExceededError, "isQwenQuotaExceededError");
|
|
129829
|
-
__name(isQwenThrottlingError, "isQwenThrottlingError");
|
|
129830
129805
|
}
|
|
129831
129806
|
});
|
|
129832
129807
|
|
|
@@ -155665,7 +155640,7 @@ __export(geminiContentGenerator_exports, {
|
|
|
155665
155640
|
createGeminiContentGenerator: () => createGeminiContentGenerator
|
|
155666
155641
|
});
|
|
155667
155642
|
function createGeminiContentGenerator(config2, gcConfig) {
|
|
155668
|
-
const version2 = "0.8.2-
|
|
155643
|
+
const version2 = "0.8.2-preview.1";
|
|
155669
155644
|
const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
155670
155645
|
const baseHeaders = {
|
|
155671
155646
|
"User-Agent": userAgent2
|
|
@@ -155834,19 +155809,8 @@ var init_contentGenerator = __esm({
|
|
|
155834
155809
|
|
|
155835
155810
|
// packages/core/dist/src/utils/retry.js
|
|
155836
155811
|
function defaultShouldRetry(error2) {
|
|
155837
|
-
|
|
155838
|
-
|
|
155839
|
-
if (status === 429 || status >= 500 && status < 600) {
|
|
155840
|
-
return true;
|
|
155841
|
-
}
|
|
155842
|
-
}
|
|
155843
|
-
if (error2 instanceof Error && error2.message) {
|
|
155844
|
-
if (error2.message.includes("429"))
|
|
155845
|
-
return true;
|
|
155846
|
-
if (error2.message.match(/5\d{2}/))
|
|
155847
|
-
return true;
|
|
155848
|
-
}
|
|
155849
|
-
return false;
|
|
155812
|
+
const status = getErrorStatus(error2);
|
|
155813
|
+
return status === 429 || status !== void 0 && status >= 500 && status < 600;
|
|
155850
155814
|
}
|
|
155851
155815
|
function delay(ms) {
|
|
155852
155816
|
return new Promise((resolve28) => setTimeout(resolve28, ms));
|
|
@@ -155862,7 +155826,6 @@ async function retryWithBackoff(fn, options2) {
|
|
|
155862
155826
|
};
|
|
155863
155827
|
let attempt = 0;
|
|
155864
155828
|
let currentDelay = initialDelayMs;
|
|
155865
|
-
let consecutive429Count = 0;
|
|
155866
155829
|
while (attempt < maxAttempts) {
|
|
155867
155830
|
attempt++;
|
|
155868
155831
|
try {
|
|
@@ -155880,23 +155843,13 @@ async function retryWithBackoff(fn, options2) {
|
|
|
155880
155843
|
if (authType === AuthType2.QWEN_OAUTH && isQwenQuotaExceededError(error2)) {
|
|
155881
155844
|
throw new Error(`Qwen API quota exceeded: Your Qwen API quota has been exhausted. Please wait for your quota to reset.`);
|
|
155882
155845
|
}
|
|
155883
|
-
if (errorStatus === 429) {
|
|
155884
|
-
if (authType === AuthType2.QWEN_OAUTH && isQwenThrottlingError(error2)) {
|
|
155885
|
-
consecutive429Count = 0;
|
|
155886
|
-
} else {
|
|
155887
|
-
consecutive429Count++;
|
|
155888
|
-
}
|
|
155889
|
-
} else {
|
|
155890
|
-
consecutive429Count = 0;
|
|
155891
|
-
}
|
|
155892
|
-
console.debug("consecutive429Count", consecutive429Count);
|
|
155893
155846
|
if (attempt >= maxAttempts || !shouldRetryOnError(error2)) {
|
|
155894
155847
|
throw error2;
|
|
155895
155848
|
}
|
|
155896
|
-
const
|
|
155897
|
-
if (
|
|
155898
|
-
console.warn(`Attempt ${attempt} failed with status ${
|
|
155899
|
-
await delay(
|
|
155849
|
+
const retryAfterMs = errorStatus === 429 ? getRetryAfterDelayMs(error2) : 0;
|
|
155850
|
+
if (retryAfterMs > 0) {
|
|
155851
|
+
console.warn(`Attempt ${attempt} failed with status ${errorStatus ?? "unknown"}. Retrying after explicit delay of ${retryAfterMs}ms...`, error2);
|
|
155852
|
+
await delay(retryAfterMs);
|
|
155900
155853
|
currentDelay = initialDelayMs;
|
|
155901
155854
|
} else {
|
|
155902
155855
|
logRetryAttempt(attempt, error2, errorStatus);
|
|
@@ -155910,18 +155863,12 @@ async function retryWithBackoff(fn, options2) {
|
|
|
155910
155863
|
throw new Error("Retry attempts exhausted");
|
|
155911
155864
|
}
|
|
155912
155865
|
function getErrorStatus(error2) {
|
|
155913
|
-
if (typeof error2
|
|
155914
|
-
|
|
155915
|
-
return error2.status;
|
|
155916
|
-
}
|
|
155917
|
-
if ("response" in error2 && typeof error2.response === "object" && error2.response !== null) {
|
|
155918
|
-
const response = error2.response;
|
|
155919
|
-
if ("status" in response && typeof response.status === "number") {
|
|
155920
|
-
return response.status;
|
|
155921
|
-
}
|
|
155922
|
-
}
|
|
155866
|
+
if (typeof error2 !== "object" || error2 === null) {
|
|
155867
|
+
return void 0;
|
|
155923
155868
|
}
|
|
155924
|
-
|
|
155869
|
+
const err = error2;
|
|
155870
|
+
const value = err.status ?? err.statusCode ?? err.response?.status ?? err.error?.code;
|
|
155871
|
+
return typeof value === "number" && value >= 100 && value <= 599 ? value : void 0;
|
|
155925
155872
|
}
|
|
155926
155873
|
function getRetryAfterDelayMs(error2) {
|
|
155927
155874
|
if (typeof error2 === "object" && error2 !== null) {
|
|
@@ -155945,31 +155892,12 @@ function getRetryAfterDelayMs(error2) {
|
|
|
155945
155892
|
}
|
|
155946
155893
|
return 0;
|
|
155947
155894
|
}
|
|
155948
|
-
function getDelayDurationAndStatus(error2) {
|
|
155949
|
-
const errorStatus = getErrorStatus(error2);
|
|
155950
|
-
let delayDurationMs = 0;
|
|
155951
|
-
if (errorStatus === 429) {
|
|
155952
|
-
delayDurationMs = getRetryAfterDelayMs(error2);
|
|
155953
|
-
}
|
|
155954
|
-
return { delayDurationMs, errorStatus };
|
|
155955
|
-
}
|
|
155956
155895
|
function logRetryAttempt(attempt, error2, errorStatus) {
|
|
155957
|
-
|
|
155958
|
-
if (errorStatus) {
|
|
155959
|
-
message = `Attempt ${attempt} failed with status ${errorStatus}. Retrying with backoff...`;
|
|
155960
|
-
}
|
|
155896
|
+
const message = errorStatus ? `Attempt ${attempt} failed with status ${errorStatus}. Retrying with backoff...` : `Attempt ${attempt} failed. Retrying with backoff...`;
|
|
155961
155897
|
if (errorStatus === 429) {
|
|
155962
155898
|
console.warn(message, error2);
|
|
155963
155899
|
} else if (errorStatus && errorStatus >= 500 && errorStatus < 600) {
|
|
155964
155900
|
console.error(message, error2);
|
|
155965
|
-
} else if (error2 instanceof Error) {
|
|
155966
|
-
if (error2.message.includes("429")) {
|
|
155967
|
-
console.warn(`Attempt ${attempt} failed with 429 error (no Retry-After header). Retrying with backoff...`, error2);
|
|
155968
|
-
} else if (error2.message.match(/5\d{2}/)) {
|
|
155969
|
-
console.error(`Attempt ${attempt} failed with 5xx error. Retrying with backoff...`, error2);
|
|
155970
|
-
} else {
|
|
155971
|
-
console.warn(message, error2);
|
|
155972
|
-
}
|
|
155973
155901
|
} else {
|
|
155974
155902
|
console.warn(message, error2);
|
|
155975
155903
|
}
|
|
@@ -155982,8 +155910,8 @@ var init_retry = __esm({
|
|
|
155982
155910
|
init_contentGenerator();
|
|
155983
155911
|
init_quotaErrorDetection();
|
|
155984
155912
|
DEFAULT_RETRY_OPTIONS = {
|
|
155985
|
-
maxAttempts:
|
|
155986
|
-
initialDelayMs:
|
|
155913
|
+
maxAttempts: 7,
|
|
155914
|
+
initialDelayMs: 1500,
|
|
155987
155915
|
maxDelayMs: 3e4,
|
|
155988
155916
|
// 30 seconds
|
|
155989
155917
|
shouldRetryOnError: defaultShouldRetry
|
|
@@ -155993,7 +155921,6 @@ var init_retry = __esm({
|
|
|
155993
155921
|
__name(retryWithBackoff, "retryWithBackoff");
|
|
155994
155922
|
__name(getErrorStatus, "getErrorStatus");
|
|
155995
155923
|
__name(getRetryAfterDelayMs, "getRetryAfterDelayMs");
|
|
155996
|
-
__name(getDelayDurationAndStatus, "getDelayDurationAndStatus");
|
|
155997
155924
|
__name(logRetryAttempt, "logRetryAttempt");
|
|
155998
155925
|
}
|
|
155999
155926
|
});
|
|
@@ -156097,7 +156024,7 @@ var init_baseLlmClient = __esm({
|
|
|
156097
156024
|
init_errors();
|
|
156098
156025
|
init_retry();
|
|
156099
156026
|
init_generateContentResponseUtilities();
|
|
156100
|
-
DEFAULT_MAX_ATTEMPTS =
|
|
156027
|
+
DEFAULT_MAX_ATTEMPTS = 7;
|
|
156101
156028
|
BaseLlmClient = class {
|
|
156102
156029
|
static {
|
|
156103
156030
|
__name(this, "BaseLlmClient");
|
|
@@ -156537,42 +156464,6 @@ var init_chatRecordingService = __esm({
|
|
|
156537
156464
|
}
|
|
156538
156465
|
});
|
|
156539
156466
|
|
|
156540
|
-
// packages/core/dist/src/fallback/handler.js
|
|
156541
|
-
async function handleFallback(config2, failedModel, authType, error2) {
|
|
156542
|
-
if (authType === AuthType2.QWEN_OAUTH) {
|
|
156543
|
-
return handleQwenOAuthError(error2);
|
|
156544
|
-
}
|
|
156545
|
-
return null;
|
|
156546
|
-
}
|
|
156547
|
-
async function handleQwenOAuthError(error2) {
|
|
156548
|
-
if (!error2) {
|
|
156549
|
-
return null;
|
|
156550
|
-
}
|
|
156551
|
-
const errorMessage = error2 instanceof Error ? error2.message.toLowerCase() : String(error2).toLowerCase();
|
|
156552
|
-
const errorCode = error2?.status || error2?.code;
|
|
156553
|
-
const isAuthError = errorCode === 401 || errorCode === 403 || errorMessage.includes("unauthorized") || errorMessage.includes("forbidden") || errorMessage.includes("invalid api key") || errorMessage.includes("authentication") || errorMessage.includes("access denied") || errorMessage.includes("token") && errorMessage.includes("expired");
|
|
156554
|
-
const isRateLimitError = errorCode === 429 || errorMessage.includes("429") || errorMessage.includes("rate limit") || errorMessage.includes("too many requests");
|
|
156555
|
-
if (isAuthError) {
|
|
156556
|
-
console.warn("Qwen OAuth authentication error detected:", errorMessage);
|
|
156557
|
-
console.log("Note: If this persists, you may need to re-authenticate with Qwen OAuth");
|
|
156558
|
-
return null;
|
|
156559
|
-
}
|
|
156560
|
-
if (isRateLimitError) {
|
|
156561
|
-
console.warn("Qwen API rate limit encountered:", errorMessage);
|
|
156562
|
-
return null;
|
|
156563
|
-
}
|
|
156564
|
-
return null;
|
|
156565
|
-
}
|
|
156566
|
-
var init_handler = __esm({
|
|
156567
|
-
"packages/core/dist/src/fallback/handler.js"() {
|
|
156568
|
-
"use strict";
|
|
156569
|
-
init_esbuild_shims();
|
|
156570
|
-
init_contentGenerator();
|
|
156571
|
-
__name(handleFallback, "handleFallback");
|
|
156572
|
-
__name(handleQwenOAuthError, "handleQwenOAuthError");
|
|
156573
|
-
}
|
|
156574
|
-
});
|
|
156575
|
-
|
|
156576
156467
|
// packages/core/dist/src/core/geminiChat.js
|
|
156577
156468
|
function isValidResponse2(response) {
|
|
156578
156469
|
if (response.usageMetadata) {
|
|
@@ -156662,7 +156553,6 @@ var init_geminiChat = __esm({
|
|
|
156662
156553
|
init_loggers();
|
|
156663
156554
|
init_chatRecordingService();
|
|
156664
156555
|
init_types();
|
|
156665
|
-
init_handler();
|
|
156666
156556
|
init_uiTelemetry();
|
|
156667
156557
|
(function(StreamEventType2) {
|
|
156668
156558
|
StreamEventType2["CHUNK"] = "chunk";
|
|
@@ -156797,22 +156687,23 @@ var init_geminiChat = __esm({
|
|
|
156797
156687
|
contents: requestContents,
|
|
156798
156688
|
config: { ...this.generationConfig, ...params.config }
|
|
156799
156689
|
}, prompt_id), "apiCall");
|
|
156800
|
-
const onPersistent429Callback = /* @__PURE__ */ __name(async (authType, error2) => await handleFallback(this.config, model, authType, error2), "onPersistent429Callback");
|
|
156801
156690
|
const streamResponse2 = await retryWithBackoff(apiCall, {
|
|
156802
156691
|
shouldRetryOnError: /* @__PURE__ */ __name((error2) => {
|
|
156803
|
-
if (error2 instanceof
|
|
156804
|
-
if (error2.status === 400)
|
|
156805
|
-
return false;
|
|
156692
|
+
if (error2 instanceof Error) {
|
|
156806
156693
|
if (isSchemaDepthError(error2.message))
|
|
156807
156694
|
return false;
|
|
156808
|
-
if (error2.
|
|
156809
|
-
return
|
|
156810
|
-
if (error2.status >= 500 && error2.status < 600)
|
|
156811
|
-
return true;
|
|
156695
|
+
if (isInvalidArgumentError(error2.message))
|
|
156696
|
+
return false;
|
|
156812
156697
|
}
|
|
156698
|
+
const status = getErrorStatus(error2);
|
|
156699
|
+
if (status === 400)
|
|
156700
|
+
return false;
|
|
156701
|
+
if (status === 429)
|
|
156702
|
+
return true;
|
|
156703
|
+
if (status && status >= 500 && status < 600)
|
|
156704
|
+
return true;
|
|
156813
156705
|
return false;
|
|
156814
156706
|
}, "shouldRetryOnError"),
|
|
156815
|
-
onPersistent429: onPersistent429Callback,
|
|
156816
156707
|
authType: this.config.getContentGeneratorConfig()?.authType
|
|
156817
156708
|
});
|
|
156818
156709
|
return this.processStreamResponse(model, streamResponse2);
|
|
@@ -171201,12 +171092,11 @@ function isShellCommandReadOnly(command2) {
|
|
|
171201
171092
|
}
|
|
171202
171093
|
const segments = splitCommands(command2);
|
|
171203
171094
|
for (const segment of segments) {
|
|
171204
|
-
|
|
171205
|
-
if (!isAllowed) {
|
|
171095
|
+
if (!evaluateShellSegment(segment)) {
|
|
171206
171096
|
return false;
|
|
171207
171097
|
}
|
|
171208
171098
|
}
|
|
171209
|
-
return
|
|
171099
|
+
return segments.length > 0;
|
|
171210
171100
|
}
|
|
171211
171101
|
var import_shell_quote, READ_ONLY_ROOT_COMMANDS, BLOCKED_FIND_FLAGS, BLOCKED_FIND_PREFIXES, READ_ONLY_GIT_SUBCOMMANDS, BLOCKED_GIT_REMOTE_ACTIONS, BLOCKED_GIT_BRANCH_FLAGS, BLOCKED_SED_PREFIXES, AWK_SIDE_EFFECT_PATTERNS, SED_SIDE_EFFECT_PATTERNS, ENV_ASSIGNMENT_REGEX;
|
|
171212
171102
|
var init_shellReadOnlyChecker = __esm({
|
|
@@ -171404,6 +171294,13 @@ function splitCommands(command2) {
|
|
|
171404
171294
|
} else if (char === ";" || char === "&" || char === "|") {
|
|
171405
171295
|
commands.push(currentCommand.trim());
|
|
171406
171296
|
currentCommand = "";
|
|
171297
|
+
} else if (char === "\r" && nextChar === "\n") {
|
|
171298
|
+
commands.push(currentCommand.trim());
|
|
171299
|
+
currentCommand = "";
|
|
171300
|
+
i3++;
|
|
171301
|
+
} else if (char === "\n") {
|
|
171302
|
+
commands.push(currentCommand.trim());
|
|
171303
|
+
currentCommand = "";
|
|
171407
171304
|
} else {
|
|
171408
171305
|
currentCommand += char;
|
|
171409
171306
|
}
|
|
@@ -172214,6 +172111,7 @@ var init_coreToolScheduler = __esm({
|
|
|
172214
172111
|
"use strict";
|
|
172215
172112
|
init_esbuild_shims();
|
|
172216
172113
|
init_src2();
|
|
172114
|
+
init_tool_names();
|
|
172217
172115
|
init_generateContentResponseUtilities();
|
|
172218
172116
|
init_modifiable_tool();
|
|
172219
172117
|
init_lib();
|
|
@@ -172429,15 +172327,21 @@ var init_coreToolScheduler = __esm({
|
|
|
172429
172327
|
}
|
|
172430
172328
|
}
|
|
172431
172329
|
/**
|
|
172432
|
-
* Generates
|
|
172433
|
-
*
|
|
172434
|
-
* Note: Excluded tools are handled separately before calling this method, so this only
|
|
172435
|
-
* handles the case where a tool is truly not found (hallucinated or typo).
|
|
172436
|
-
* @param unknownToolName The tool name that was not found.
|
|
172437
|
-
* @param topN The number of suggestions to return. Defaults to 3.
|
|
172438
|
-
* @returns A suggestion string like " Did you mean 'tool'?" or " Did you mean one of: 'tool1', 'tool2'?",
|
|
172439
|
-
* or an empty string if no suggestions are found.
|
|
172330
|
+
* Generates error message for unknown tool. Returns early with skill-specific
|
|
172331
|
+
* message if the name matches a skill, otherwise uses Levenshtein suggestions.
|
|
172440
172332
|
*/
|
|
172333
|
+
getToolNotFoundMessage(unknownToolName, topN = 3) {
|
|
172334
|
+
const skillTool = this.toolRegistry.getTool(ToolNames.SKILL);
|
|
172335
|
+
if (skillTool instanceof SkillTool) {
|
|
172336
|
+
const availableSkillNames = skillTool.getAvailableSkillNames();
|
|
172337
|
+
if (availableSkillNames.includes(unknownToolName)) {
|
|
172338
|
+
return `"${unknownToolName}" is a skill name, not a tool name. To use this skill, invoke the "${ToolNames.SKILL}" tool with parameter: skill: "${unknownToolName}"`;
|
|
172339
|
+
}
|
|
172340
|
+
}
|
|
172341
|
+
const suggestion = this.getToolSuggestion(unknownToolName, topN);
|
|
172342
|
+
return `Tool "${unknownToolName}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
|
|
172343
|
+
}
|
|
172344
|
+
/** Suggests similar tool names using Levenshtein distance. */
|
|
172441
172345
|
getToolSuggestion(unknownToolName, topN = 3) {
|
|
172442
172346
|
const allToolNames = this.toolRegistry.getAllToolNames();
|
|
172443
172347
|
const matches = allToolNames.map((toolName) => ({
|
|
@@ -172507,8 +172411,7 @@ var init_coreToolScheduler = __esm({
|
|
|
172507
172411
|
}
|
|
172508
172412
|
const toolInstance = this.toolRegistry.getTool(reqInfo.name);
|
|
172509
172413
|
if (!toolInstance) {
|
|
172510
|
-
const
|
|
172511
|
-
const errorMessage = `Tool "${reqInfo.name}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
|
|
172414
|
+
const errorMessage = this.getToolNotFoundMessage(reqInfo.name);
|
|
172512
172415
|
return {
|
|
172513
172416
|
status: "error",
|
|
172514
172417
|
request: reqInfo,
|
|
@@ -173398,13 +173301,15 @@ var init_subagent = __esm({
|
|
|
173398
173301
|
const parts = content?.parts || [];
|
|
173399
173302
|
for (const p2 of parts) {
|
|
173400
173303
|
const txt = p2.text;
|
|
173401
|
-
|
|
173304
|
+
const isThought = p2.thought ?? false;
|
|
173305
|
+
if (txt && !isThought)
|
|
173402
173306
|
roundText += txt;
|
|
173403
173307
|
if (txt)
|
|
173404
173308
|
this.eventEmitter?.emit(SubAgentEventType.STREAM_TEXT, {
|
|
173405
173309
|
subagentId: this.subagentId,
|
|
173406
173310
|
round: turnCounter,
|
|
173407
173311
|
text: txt,
|
|
173312
|
+
thought: isThought,
|
|
173408
173313
|
timestamp: Date.now()
|
|
173409
173314
|
});
|
|
173410
173315
|
}
|
|
@@ -179265,7 +179170,6 @@ var init_client2 = __esm({
|
|
|
179265
179170
|
init_retry();
|
|
179266
179171
|
init_ideContext();
|
|
179267
179172
|
init_types7();
|
|
179268
|
-
init_handler();
|
|
179269
179173
|
MAX_TURNS = 100;
|
|
179270
179174
|
GeminiClient = class {
|
|
179271
179175
|
static {
|
|
@@ -179632,12 +179536,7 @@ var init_client2 = __esm({
|
|
|
179632
179536
|
contents
|
|
179633
179537
|
}, this.lastPromptId);
|
|
179634
179538
|
}, "apiCall");
|
|
179635
|
-
const onPersistent429Callback = /* @__PURE__ */ __name(async (authType, error2) => (
|
|
179636
|
-
// Pass the captured model to the centralized handler.
|
|
179637
|
-
await handleFallback(this.config, currentAttemptModel, authType, error2)
|
|
179638
|
-
), "onPersistent429Callback");
|
|
179639
179539
|
const result = await retryWithBackoff(apiCall, {
|
|
179640
|
-
onPersistent429: onPersistent429Callback,
|
|
179641
179540
|
authType: this.config.getContentGeneratorConfig()?.authType
|
|
179642
179541
|
});
|
|
179643
179542
|
return result;
|
|
@@ -218775,7 +218674,7 @@ function createFsWatchInstance(path118, options2, listener, errHandler, emitRaw)
|
|
|
218775
218674
|
}
|
|
218776
218675
|
}
|
|
218777
218676
|
var STR_DATA, STR_END, STR_CLOSE, EMPTY_FN, pl, isWindows2, isMacos, isLinux, isFreeBSD, isIBMi, EVENTS, EV, THROTTLE_MODE_WATCH, statMethods, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, binaryExtensions, isBinaryPath, foreach, addAndConvert, clearItem, delFromSet, isEmptySet, FsWatchInstances, fsWatchBroadcast, setFsWatchListener, FsWatchFileInstances, setFsWatchFileListener, NodeFsHandler;
|
|
218778
|
-
var
|
|
218677
|
+
var init_handler = __esm({
|
|
218779
218678
|
"node_modules/chokidar/esm/handler.js"() {
|
|
218780
218679
|
init_esbuild_shims();
|
|
218781
218680
|
STR_DATA = "data";
|
|
@@ -219597,7 +219496,7 @@ var init_esm21 = __esm({
|
|
|
219597
219496
|
"node_modules/chokidar/esm/index.js"() {
|
|
219598
219497
|
init_esbuild_shims();
|
|
219599
219498
|
init_esm20();
|
|
219600
|
-
|
|
219499
|
+
init_handler();
|
|
219601
219500
|
SLASH = "/";
|
|
219602
219501
|
SLASH_SLASH = "//";
|
|
219603
219502
|
ONE_DOT = ".";
|
|
@@ -231915,18 +231814,24 @@ async function convertClaudePluginPackage(extensionDir, pluginName) {
|
|
|
231915
231814
|
const tmpDir = await ExtensionStorage.createTmpDir();
|
|
231916
231815
|
try {
|
|
231917
231816
|
await copyDirectory(pluginSource, tmpDir);
|
|
231918
|
-
|
|
231919
|
-
|
|
231920
|
-
|
|
231921
|
-
|
|
231922
|
-
|
|
231923
|
-
|
|
231924
|
-
|
|
231817
|
+
const resourceConfigs = [
|
|
231818
|
+
{ name: "commands", config: mergedConfig.commands },
|
|
231819
|
+
{ name: "skills", config: mergedConfig.skills },
|
|
231820
|
+
{ name: "agents", config: mergedConfig.agents }
|
|
231821
|
+
];
|
|
231822
|
+
for (const { name: name3, config: config2 } of resourceConfigs) {
|
|
231823
|
+
const folderPath = path61.join(tmpDir, name3);
|
|
231824
|
+
const sourceFolderPath = path61.join(pluginSource, name3);
|
|
231825
|
+
if (config2) {
|
|
231826
|
+
if (fs59.existsSync(folderPath)) {
|
|
231827
|
+
fs59.rmSync(folderPath, { recursive: true, force: true });
|
|
231828
|
+
}
|
|
231829
|
+
await collectResources(config2, pluginSource, folderPath);
|
|
231830
|
+
} else if (!fs59.existsSync(sourceFolderPath) && fs59.existsSync(folderPath)) {
|
|
231831
|
+
fs59.rmSync(folderPath, { recursive: true, force: true });
|
|
231832
|
+
}
|
|
231925
231833
|
}
|
|
231926
231834
|
const agentsDestDir = path61.join(tmpDir, "agents");
|
|
231927
|
-
if (mergedConfig.agents) {
|
|
231928
|
-
await collectResources(mergedConfig.agents, pluginSource, agentsDestDir);
|
|
231929
|
-
}
|
|
231930
231835
|
await convertAgentFiles(agentsDestDir);
|
|
231931
231836
|
const qwenConfig = convertClaudeToQwenConfig(mergedConfig);
|
|
231932
231837
|
const qwenConfigPath = path61.join(tmpDir, "qwen-extension.json");
|
|
@@ -231963,6 +231868,7 @@ async function collectResources(resourcePaths, pluginRoot, destDir) {
|
|
|
231963
231868
|
console.log(`Skipping ${resolvedPath} as it's already in the correct location`);
|
|
231964
231869
|
continue;
|
|
231965
231870
|
}
|
|
231871
|
+
const finalDestDir = path61.join(destDir, dirName);
|
|
231966
231872
|
const files = await glob("**/*", {
|
|
231967
231873
|
cwd: resolvedPath,
|
|
231968
231874
|
nodir: true,
|
|
@@ -231970,7 +231876,7 @@ async function collectResources(resourcePaths, pluginRoot, destDir) {
|
|
|
231970
231876
|
});
|
|
231971
231877
|
for (const file of files) {
|
|
231972
231878
|
const srcFile = path61.join(resolvedPath, file);
|
|
231973
|
-
const destFile = path61.join(
|
|
231879
|
+
const destFile = path61.join(finalDestDir, file);
|
|
231974
231880
|
const destFileDir = path61.dirname(destFile);
|
|
231975
231881
|
if (!fs59.existsSync(destFileDir)) {
|
|
231976
231882
|
fs59.mkdirSync(destFileDir, { recursive: true });
|
|
@@ -241770,7 +241676,7 @@ var init_config3 = __esm({
|
|
|
241770
241676
|
contentGeneratorConfigSources = {};
|
|
241771
241677
|
contentGenerator;
|
|
241772
241678
|
embeddingModel;
|
|
241773
|
-
|
|
241679
|
+
modelsConfig;
|
|
241774
241680
|
modelProvidersConfig;
|
|
241775
241681
|
sandbox;
|
|
241776
241682
|
targetDir;
|
|
@@ -241949,7 +241855,7 @@ var init_config3 = __esm({
|
|
|
241949
241855
|
if (params.contextFileName) {
|
|
241950
241856
|
setGeminiMdFilename(params.contextFileName);
|
|
241951
241857
|
}
|
|
241952
|
-
this.
|
|
241858
|
+
this.modelsConfig = new ModelsConfig({
|
|
241953
241859
|
initialAuthType: params.authType ?? params.generationConfig?.authType,
|
|
241954
241860
|
modelProvidersConfig: this.modelProvidersConfig,
|
|
241955
241861
|
generationConfig: {
|
|
@@ -242016,8 +241922,8 @@ var init_config3 = __esm({
|
|
|
242016
241922
|
* Get the ModelsConfig instance for model-related operations.
|
|
242017
241923
|
* External code (e.g., CLI) can use this to access model configuration.
|
|
242018
241924
|
*/
|
|
242019
|
-
|
|
242020
|
-
return this.
|
|
241925
|
+
getModelsConfig() {
|
|
241926
|
+
return this.modelsConfig;
|
|
242021
241927
|
}
|
|
242022
241928
|
/**
|
|
242023
241929
|
* Updates the credentials in the generation config.
|
|
@@ -242025,17 +241931,17 @@ var init_config3 = __esm({
|
|
|
242025
241931
|
* Delegates to ModelsConfig.
|
|
242026
241932
|
*/
|
|
242027
241933
|
updateCredentials(credentials, settingsGenerationConfig) {
|
|
242028
|
-
this.
|
|
241934
|
+
this.modelsConfig.updateCredentials(credentials, settingsGenerationConfig);
|
|
242029
241935
|
}
|
|
242030
241936
|
/**
|
|
242031
241937
|
* Refresh authentication and rebuild ContentGenerator.
|
|
242032
241938
|
*/
|
|
242033
241939
|
async refreshAuth(authMethod, isInitialAuth) {
|
|
242034
|
-
const modelId = this.
|
|
242035
|
-
this.
|
|
242036
|
-
const requireCached = this.
|
|
242037
|
-
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authMethod, this.
|
|
242038
|
-
strictModelProvider: this.
|
|
241940
|
+
const modelId = this.modelsConfig.getModel();
|
|
241941
|
+
this.modelsConfig.syncAfterAuthRefresh(authMethod, modelId);
|
|
241942
|
+
const requireCached = this.modelsConfig.consumeRequireCachedCredentialsFlag();
|
|
241943
|
+
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authMethod, this.modelsConfig.getGenerationConfig(), this.modelsConfig.getGenerationConfigSources(), {
|
|
241944
|
+
strictModelProvider: this.modelsConfig.isStrictModelProviderSelection()
|
|
242039
241945
|
});
|
|
242040
241946
|
const newContentGeneratorConfig = config2;
|
|
242041
241947
|
this.contentGenerator = await createContentGenerator(newContentGeneratorConfig, this, requireCached ? true : isInitialAuth);
|
|
@@ -242093,20 +241999,20 @@ var init_config3 = __esm({
|
|
|
242093
241999
|
return this.contentGeneratorConfig;
|
|
242094
242000
|
}
|
|
242095
242001
|
getContentGeneratorConfigSources() {
|
|
242096
|
-
if (Object.keys(this.contentGeneratorConfigSources).length === 0 && this.
|
|
242097
|
-
return this.
|
|
242002
|
+
if (Object.keys(this.contentGeneratorConfigSources).length === 0 && this.modelsConfig) {
|
|
242003
|
+
return this.modelsConfig.getGenerationConfigSources();
|
|
242098
242004
|
}
|
|
242099
242005
|
return this.contentGeneratorConfigSources;
|
|
242100
242006
|
}
|
|
242101
242007
|
getModel() {
|
|
242102
|
-
return this.contentGeneratorConfig?.model || this.
|
|
242008
|
+
return this.contentGeneratorConfig?.model || this.modelsConfig.getModel();
|
|
242103
242009
|
}
|
|
242104
242010
|
/**
|
|
242105
242011
|
* Set model programmatically (e.g., VLM auto-switch, fallback).
|
|
242106
242012
|
* Delegates to ModelsConfig.
|
|
242107
242013
|
*/
|
|
242108
242014
|
async setModel(newModel, metadata) {
|
|
242109
|
-
await this.
|
|
242015
|
+
await this.modelsConfig.setModel(newModel, metadata);
|
|
242110
242016
|
if (this.contentGeneratorConfig) {
|
|
242111
242017
|
this.contentGeneratorConfig.model = newModel;
|
|
242112
242018
|
}
|
|
@@ -242120,8 +242026,8 @@ var init_config3 = __esm({
|
|
|
242120
242026
|
return;
|
|
242121
242027
|
}
|
|
242122
242028
|
if (authType === AuthType2.QWEN_OAUTH && !requiresRefresh) {
|
|
242123
|
-
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authType, this.
|
|
242124
|
-
strictModelProvider: this.
|
|
242029
|
+
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authType, this.modelsConfig.getGenerationConfig(), this.modelsConfig.getGenerationConfigSources(), {
|
|
242030
|
+
strictModelProvider: this.modelsConfig.isStrictModelProviderSelection()
|
|
242125
242031
|
});
|
|
242126
242032
|
this.contentGeneratorConfig.model = config2.model;
|
|
242127
242033
|
this.contentGeneratorConfig.samplingParams = config2.samplingParams;
|
|
@@ -242144,14 +242050,14 @@ var init_config3 = __esm({
|
|
|
242144
242050
|
* Delegates to ModelsConfig.
|
|
242145
242051
|
*/
|
|
242146
242052
|
getAvailableModels() {
|
|
242147
|
-
return this.
|
|
242053
|
+
return this.modelsConfig.getAvailableModels();
|
|
242148
242054
|
}
|
|
242149
242055
|
/**
|
|
242150
242056
|
* Get available models for a specific authType.
|
|
242151
242057
|
* Delegates to ModelsConfig.
|
|
242152
242058
|
*/
|
|
242153
242059
|
getAvailableModelsForAuthType(authType) {
|
|
242154
|
-
return this.
|
|
242060
|
+
return this.modelsConfig.getAvailableModelsForAuthType(authType);
|
|
242155
242061
|
}
|
|
242156
242062
|
/**
|
|
242157
242063
|
* Switch authType+model via registry-backed selection.
|
|
@@ -242164,7 +242070,7 @@ var init_config3 = __esm({
|
|
|
242164
242070
|
* @param metadata - Metadata for logging/tracking
|
|
242165
242071
|
*/
|
|
242166
242072
|
async switchModel(authType, modelId, options2, metadata) {
|
|
242167
|
-
await this.
|
|
242073
|
+
await this.modelsConfig.switchModel(authType, modelId, options2, metadata);
|
|
242168
242074
|
}
|
|
242169
242075
|
getMaxSessionTurns() {
|
|
242170
242076
|
return this.maxSessionTurns;
|
|
@@ -362908,7 +362814,7 @@ function findModelConfig(modelProviders, authType, modelId) {
|
|
|
362908
362814
|
__name(findModelConfig, "findModelConfig");
|
|
362909
362815
|
function hasApiKeyForAuth(authType, settings, config2) {
|
|
362910
362816
|
const modelProviders = settings.modelProviders;
|
|
362911
|
-
const modelId = config2?.
|
|
362817
|
+
const modelId = config2?.getModelsConfig().getModel() ?? settings.model?.name;
|
|
362912
362818
|
const modelConfig = findModelConfig(modelProviders, authType, modelId);
|
|
362913
362819
|
if (modelConfig?.envKey) {
|
|
362914
362820
|
const hasKey2 = !!process.env[modelConfig.envKey];
|
|
@@ -362994,7 +362900,7 @@ function validateAuthMethod(authMethod, config2) {
|
|
|
362994
362900
|
return apiKeyError;
|
|
362995
362901
|
}
|
|
362996
362902
|
const modelProviders = settings.merged.modelProviders;
|
|
362997
|
-
const modelId = config2?.
|
|
362903
|
+
const modelId = config2?.getModelsConfig().getModel() ?? settings.merged.model?.name;
|
|
362998
362904
|
const modelConfig = findModelConfig(modelProviders, authMethod, modelId);
|
|
362999
362905
|
if (modelConfig && !modelConfig.baseUrl) {
|
|
363000
362906
|
return t4(
|
|
@@ -369475,7 +369381,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
369475
369381
|
// packages/cli/src/utils/version.ts
|
|
369476
369382
|
async function getCliVersion() {
|
|
369477
369383
|
const pkgJson = await getPackageJson();
|
|
369478
|
-
return "0.8.2-
|
|
369384
|
+
return "0.8.2-preview.1";
|
|
369479
369385
|
}
|
|
369480
369386
|
__name(getCliVersion, "getCliVersion");
|
|
369481
369387
|
|
|
@@ -376560,125 +376466,11 @@ function validateTheme(settings) {
|
|
|
376560
376466
|
}
|
|
376561
376467
|
__name(validateTheme, "validateTheme");
|
|
376562
376468
|
|
|
376563
|
-
// packages/cli/src/utils/languageUtils.ts
|
|
376564
|
-
init_esbuild_shims();
|
|
376565
|
-
import * as fs78 from "node:fs";
|
|
376566
|
-
import * as path86 from "node:path";
|
|
376567
|
-
var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
|
|
376568
|
-
var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "qwen-code:llm-output-language:";
|
|
376569
|
-
var OUTPUT_LANGUAGE_AUTO = "auto";
|
|
376570
|
-
function isAutoLanguage(value) {
|
|
376571
|
-
return !value || value.toLowerCase() === OUTPUT_LANGUAGE_AUTO;
|
|
376572
|
-
}
|
|
376573
|
-
__name(isAutoLanguage, "isAutoLanguage");
|
|
376574
|
-
function normalizeOutputLanguage(language) {
|
|
376575
|
-
const lowered = language.toLowerCase();
|
|
376576
|
-
const fullName = getLanguageNameFromLocale(lowered);
|
|
376577
|
-
if (fullName !== "English" || lowered === "en") {
|
|
376578
|
-
return fullName;
|
|
376579
|
-
}
|
|
376580
|
-
return language;
|
|
376581
|
-
}
|
|
376582
|
-
__name(normalizeOutputLanguage, "normalizeOutputLanguage");
|
|
376583
|
-
function resolveOutputLanguage(value) {
|
|
376584
|
-
if (isAutoLanguage(value)) {
|
|
376585
|
-
const detectedLocale = detectSystemLanguage();
|
|
376586
|
-
return getLanguageNameFromLocale(detectedLocale);
|
|
376587
|
-
}
|
|
376588
|
-
return normalizeOutputLanguage(value);
|
|
376589
|
-
}
|
|
376590
|
-
__name(resolveOutputLanguage, "resolveOutputLanguage");
|
|
376591
|
-
function getOutputLanguageFilePath() {
|
|
376592
|
-
return path86.join(
|
|
376593
|
-
Storage.getGlobalQwenDir(),
|
|
376594
|
-
LLM_OUTPUT_LANGUAGE_RULE_FILENAME
|
|
376595
|
-
);
|
|
376596
|
-
}
|
|
376597
|
-
__name(getOutputLanguageFilePath, "getOutputLanguageFilePath");
|
|
376598
|
-
function sanitizeForMarker(language) {
|
|
376599
|
-
return language.replace(/[\r\n]/g, " ").replace(/--!?>/g, "").replace(/--/g, "");
|
|
376600
|
-
}
|
|
376601
|
-
__name(sanitizeForMarker, "sanitizeForMarker");
|
|
376602
|
-
function generateOutputLanguageFileContent(language) {
|
|
376603
|
-
const safeLanguage = sanitizeForMarker(language);
|
|
376604
|
-
return `# Output language preference: ${language}
|
|
376605
|
-
<!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${safeLanguage} -->
|
|
376606
|
-
|
|
376607
|
-
## Goal
|
|
376608
|
-
Prefer responding in **${language}** for normal assistant messages and explanations.
|
|
376609
|
-
|
|
376610
|
-
## Keep technical artifacts unchanged
|
|
376611
|
-
Do **not** translate or rewrite:
|
|
376612
|
-
- Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
|
|
376613
|
-
- Exact quoted text from the user (keep quotes verbatim)
|
|
376614
|
-
|
|
376615
|
-
## When a conflict exists
|
|
376616
|
-
If higher-priority instructions (system/developer) require a different behavior, follow them.
|
|
376617
|
-
|
|
376618
|
-
## Tool / system outputs
|
|
376619
|
-
Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
|
|
376620
|
-
`;
|
|
376621
|
-
}
|
|
376622
|
-
__name(generateOutputLanguageFileContent, "generateOutputLanguageFileContent");
|
|
376623
|
-
function parseOutputLanguageFromContent(content) {
|
|
376624
|
-
const markerRegex = new RegExp(
|
|
376625
|
-
String.raw`<!--\s*${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX}\s*(.*?)\s*-->`,
|
|
376626
|
-
"i"
|
|
376627
|
-
);
|
|
376628
|
-
const markerMatch = content.match(markerRegex);
|
|
376629
|
-
if (markerMatch?.[1]?.trim()) {
|
|
376630
|
-
return markerMatch[1].trim();
|
|
376631
|
-
}
|
|
376632
|
-
const headingMatch = content.match(
|
|
376633
|
-
/^#.*?CRITICAL:\s*(.*?)\s+Output Language Rule\b/im
|
|
376634
|
-
);
|
|
376635
|
-
if (headingMatch?.[1]?.trim()) {
|
|
376636
|
-
return headingMatch[1].trim();
|
|
376637
|
-
}
|
|
376638
|
-
return null;
|
|
376639
|
-
}
|
|
376640
|
-
__name(parseOutputLanguageFromContent, "parseOutputLanguageFromContent");
|
|
376641
|
-
function readOutputLanguageFromFile() {
|
|
376642
|
-
const filePath = getOutputLanguageFilePath();
|
|
376643
|
-
if (!fs78.existsSync(filePath)) {
|
|
376644
|
-
return null;
|
|
376645
|
-
}
|
|
376646
|
-
try {
|
|
376647
|
-
const content = fs78.readFileSync(filePath, "utf-8");
|
|
376648
|
-
return parseOutputLanguageFromContent(content);
|
|
376649
|
-
} catch {
|
|
376650
|
-
return null;
|
|
376651
|
-
}
|
|
376652
|
-
}
|
|
376653
|
-
__name(readOutputLanguageFromFile, "readOutputLanguageFromFile");
|
|
376654
|
-
function writeOutputLanguageFile(language) {
|
|
376655
|
-
const filePath = getOutputLanguageFilePath();
|
|
376656
|
-
const content = generateOutputLanguageFileContent(language);
|
|
376657
|
-
const dir = path86.dirname(filePath);
|
|
376658
|
-
fs78.mkdirSync(dir, { recursive: true });
|
|
376659
|
-
fs78.writeFileSync(filePath, content, "utf-8");
|
|
376660
|
-
}
|
|
376661
|
-
__name(writeOutputLanguageFile, "writeOutputLanguageFile");
|
|
376662
|
-
function updateOutputLanguageFile(settingValue) {
|
|
376663
|
-
const resolved = resolveOutputLanguage(settingValue);
|
|
376664
|
-
writeOutputLanguageFile(resolved);
|
|
376665
|
-
}
|
|
376666
|
-
__name(updateOutputLanguageFile, "updateOutputLanguageFile");
|
|
376667
|
-
function initializeLlmOutputLanguage(outputLanguage) {
|
|
376668
|
-
const resolved = resolveOutputLanguage(outputLanguage);
|
|
376669
|
-
const currentFileLanguage = readOutputLanguageFromFile();
|
|
376670
|
-
if (currentFileLanguage !== resolved) {
|
|
376671
|
-
writeOutputLanguageFile(resolved);
|
|
376672
|
-
}
|
|
376673
|
-
}
|
|
376674
|
-
__name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
|
|
376675
|
-
|
|
376676
376469
|
// packages/cli/src/core/initializer.ts
|
|
376677
376470
|
async function initializeApp(config2, settings) {
|
|
376678
376471
|
const languageSetting = process.env["QWEN_CODE_LANG"] || settings.merged.general?.language || "auto";
|
|
376679
376472
|
await initializeI18n(languageSetting);
|
|
376680
|
-
|
|
376681
|
-
const authType = config2.modelsConfig.getCurrentAuthType();
|
|
376473
|
+
const authType = config2.getModelsConfig().getCurrentAuthType();
|
|
376682
376474
|
const authError = await performInitialAuth(config2, authType);
|
|
376683
376475
|
if (authError) {
|
|
376684
376476
|
settings.setValue(
|
|
@@ -376688,7 +376480,7 @@ async function initializeApp(config2, settings) {
|
|
|
376688
376480
|
);
|
|
376689
376481
|
}
|
|
376690
376482
|
const themeError = validateTheme(settings);
|
|
376691
|
-
const shouldOpenAuthDialog = !config2.
|
|
376483
|
+
const shouldOpenAuthDialog = !config2.getModelsConfig().wasAuthTypeExplicitlyProvided() || !!authError;
|
|
376692
376484
|
if (config2.getIdeMode()) {
|
|
376693
376485
|
const ideClient = await IdeClient.getInstance();
|
|
376694
376486
|
await ideClient.connect();
|
|
@@ -377095,7 +376887,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
377095
376887
|
|
|
377096
376888
|
// packages/cli/src/generated/git-commit.ts
|
|
377097
376889
|
init_esbuild_shims();
|
|
377098
|
-
var GIT_COMMIT_INFO2 = "
|
|
376890
|
+
var GIT_COMMIT_INFO2 = "284ec6d1";
|
|
377099
376891
|
|
|
377100
376892
|
// packages/cli/src/utils/systemInfo.ts
|
|
377101
376893
|
async function getNpmVersion() {
|
|
@@ -377709,7 +377501,7 @@ var docsCommand = {
|
|
|
377709
377501
|
// packages/cli/src/ui/commands/directoryCommand.tsx
|
|
377710
377502
|
init_esbuild_shims();
|
|
377711
377503
|
import * as os31 from "node:os";
|
|
377712
|
-
import * as
|
|
377504
|
+
import * as path86 from "node:path";
|
|
377713
377505
|
function expandHomeDir(p2) {
|
|
377714
377506
|
if (!p2) {
|
|
377715
377507
|
return "";
|
|
@@ -377720,7 +377512,7 @@ function expandHomeDir(p2) {
|
|
|
377720
377512
|
} else if (p2 === "~" || p2.startsWith("~/")) {
|
|
377721
377513
|
expandedPath = os31.homedir() + p2.substring(1);
|
|
377722
377514
|
}
|
|
377723
|
-
return
|
|
377515
|
+
return path86.normalize(expandedPath);
|
|
377724
377516
|
}
|
|
377725
377517
|
__name(expandHomeDir, "expandHomeDir");
|
|
377726
377518
|
var directoryCommand = {
|
|
@@ -378505,7 +378297,7 @@ var helpCommand = {
|
|
|
378505
378297
|
|
|
378506
378298
|
// packages/cli/src/ui/commands/ideCommand.ts
|
|
378507
378299
|
init_esbuild_shims();
|
|
378508
|
-
import
|
|
378300
|
+
import path87 from "node:path";
|
|
378509
378301
|
function getIdeStatusMessage(ideClient) {
|
|
378510
378302
|
const connection = ideClient.getConnectionStatus();
|
|
378511
378303
|
switch (connection.status) {
|
|
@@ -378535,13 +378327,13 @@ __name(getIdeStatusMessage, "getIdeStatusMessage");
|
|
|
378535
378327
|
function formatFileList(openFiles) {
|
|
378536
378328
|
const basenameCounts = /* @__PURE__ */ new Map();
|
|
378537
378329
|
for (const file of openFiles) {
|
|
378538
|
-
const basename24 =
|
|
378330
|
+
const basename24 = path87.basename(file.path);
|
|
378539
378331
|
basenameCounts.set(basename24, (basenameCounts.get(basename24) || 0) + 1);
|
|
378540
378332
|
}
|
|
378541
378333
|
const fileList = openFiles.map((file) => {
|
|
378542
|
-
const basename24 =
|
|
378334
|
+
const basename24 = path87.basename(file.path);
|
|
378543
378335
|
const isDuplicate = (basenameCounts.get(basename24) || 0) > 1;
|
|
378544
|
-
const parentDir =
|
|
378336
|
+
const parentDir = path87.basename(path87.dirname(file.path));
|
|
378545
378337
|
const displayName = isDuplicate ? `${basename24} (/${parentDir})` : basename24;
|
|
378546
378338
|
return ` - ${displayName}${file.isActive ? " (active)" : ""}`;
|
|
378547
378339
|
}).join("\n");
|
|
@@ -378784,8 +378576,8 @@ var ideCommand = /* @__PURE__ */ __name(async () => {
|
|
|
378784
378576
|
|
|
378785
378577
|
// packages/cli/src/ui/commands/initCommand.ts
|
|
378786
378578
|
init_esbuild_shims();
|
|
378787
|
-
import * as
|
|
378788
|
-
import * as
|
|
378579
|
+
import * as fs78 from "node:fs";
|
|
378580
|
+
import * as path88 from "node:path";
|
|
378789
378581
|
var import_react27 = __toESM(require_react(), 1);
|
|
378790
378582
|
var initCommand = {
|
|
378791
378583
|
name: "init",
|
|
@@ -378803,11 +378595,11 @@ var initCommand = {
|
|
|
378803
378595
|
}
|
|
378804
378596
|
const targetDir = context2.services.config.getTargetDir();
|
|
378805
378597
|
const contextFileName = getCurrentGeminiMdFilename();
|
|
378806
|
-
const contextFilePath =
|
|
378598
|
+
const contextFilePath = path88.join(targetDir, contextFileName);
|
|
378807
378599
|
try {
|
|
378808
|
-
if (
|
|
378600
|
+
if (fs78.existsSync(contextFilePath)) {
|
|
378809
378601
|
try {
|
|
378810
|
-
const existing =
|
|
378602
|
+
const existing = fs78.readFileSync(contextFilePath, "utf8");
|
|
378811
378603
|
if (existing && existing.trim().length > 0) {
|
|
378812
378604
|
if (!context2.overwriteConfirmed) {
|
|
378813
378605
|
return {
|
|
@@ -378829,7 +378621,7 @@ var initCommand = {
|
|
|
378829
378621
|
}
|
|
378830
378622
|
}
|
|
378831
378623
|
try {
|
|
378832
|
-
|
|
378624
|
+
fs78.writeFileSync(contextFilePath, "", "utf8");
|
|
378833
378625
|
context2.ui.addItem(
|
|
378834
378626
|
{
|
|
378835
378627
|
type: "info",
|
|
@@ -378894,6 +378686,121 @@ Write the complete content to the \`${contextFileName}\` file. The output must b
|
|
|
378894
378686
|
|
|
378895
378687
|
// packages/cli/src/ui/commands/languageCommand.ts
|
|
378896
378688
|
init_esbuild_shims();
|
|
378689
|
+
|
|
378690
|
+
// packages/cli/src/utils/languageUtils.ts
|
|
378691
|
+
init_esbuild_shims();
|
|
378692
|
+
import * as fs79 from "node:fs";
|
|
378693
|
+
import * as path89 from "node:path";
|
|
378694
|
+
var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
|
|
378695
|
+
var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "qwen-code:llm-output-language:";
|
|
378696
|
+
var OUTPUT_LANGUAGE_AUTO = "auto";
|
|
378697
|
+
function isAutoLanguage(value) {
|
|
378698
|
+
return !value || value.toLowerCase() === OUTPUT_LANGUAGE_AUTO;
|
|
378699
|
+
}
|
|
378700
|
+
__name(isAutoLanguage, "isAutoLanguage");
|
|
378701
|
+
function normalizeOutputLanguage(language) {
|
|
378702
|
+
const lowered = language.toLowerCase();
|
|
378703
|
+
const fullName = getLanguageNameFromLocale(lowered);
|
|
378704
|
+
if (fullName !== "English" || lowered === "en") {
|
|
378705
|
+
return fullName;
|
|
378706
|
+
}
|
|
378707
|
+
return language;
|
|
378708
|
+
}
|
|
378709
|
+
__name(normalizeOutputLanguage, "normalizeOutputLanguage");
|
|
378710
|
+
function resolveOutputLanguage(value) {
|
|
378711
|
+
if (isAutoLanguage(value)) {
|
|
378712
|
+
const detectedLocale = detectSystemLanguage();
|
|
378713
|
+
return getLanguageNameFromLocale(detectedLocale);
|
|
378714
|
+
}
|
|
378715
|
+
return normalizeOutputLanguage(value);
|
|
378716
|
+
}
|
|
378717
|
+
__name(resolveOutputLanguage, "resolveOutputLanguage");
|
|
378718
|
+
function getOutputLanguageFilePath() {
|
|
378719
|
+
return path89.join(
|
|
378720
|
+
Storage.getGlobalQwenDir(),
|
|
378721
|
+
LLM_OUTPUT_LANGUAGE_RULE_FILENAME
|
|
378722
|
+
);
|
|
378723
|
+
}
|
|
378724
|
+
__name(getOutputLanguageFilePath, "getOutputLanguageFilePath");
|
|
378725
|
+
function sanitizeForMarker(language) {
|
|
378726
|
+
return language.replace(/[\r\n]/g, " ").replace(/--!?>/g, "").replace(/--/g, "");
|
|
378727
|
+
}
|
|
378728
|
+
__name(sanitizeForMarker, "sanitizeForMarker");
|
|
378729
|
+
function generateOutputLanguageFileContent(language) {
|
|
378730
|
+
const safeLanguage = sanitizeForMarker(language);
|
|
378731
|
+
return `# Output language preference: ${language}
|
|
378732
|
+
<!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${safeLanguage} -->
|
|
378733
|
+
|
|
378734
|
+
## Goal
|
|
378735
|
+
Prefer responding in **${language}** for normal assistant messages and explanations.
|
|
378736
|
+
|
|
378737
|
+
## Keep technical artifacts unchanged
|
|
378738
|
+
Do **not** translate or rewrite:
|
|
378739
|
+
- Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
|
|
378740
|
+
- Exact quoted text from the user (keep quotes verbatim)
|
|
378741
|
+
|
|
378742
|
+
## When a conflict exists
|
|
378743
|
+
If higher-priority instructions (system/developer) require a different behavior, follow them.
|
|
378744
|
+
|
|
378745
|
+
## Tool / system outputs
|
|
378746
|
+
Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
|
|
378747
|
+
`;
|
|
378748
|
+
}
|
|
378749
|
+
__name(generateOutputLanguageFileContent, "generateOutputLanguageFileContent");
|
|
378750
|
+
function parseOutputLanguageFromContent(content) {
|
|
378751
|
+
const markerRegex = new RegExp(
|
|
378752
|
+
String.raw`<!--\s*${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX}\s*(.*?)\s*-->`,
|
|
378753
|
+
"i"
|
|
378754
|
+
);
|
|
378755
|
+
const markerMatch = content.match(markerRegex);
|
|
378756
|
+
if (markerMatch?.[1]?.trim()) {
|
|
378757
|
+
return markerMatch[1].trim();
|
|
378758
|
+
}
|
|
378759
|
+
const headingMatch = content.match(
|
|
378760
|
+
/^#.*?CRITICAL:\s*(.*?)\s+Output Language Rule\b/im
|
|
378761
|
+
);
|
|
378762
|
+
if (headingMatch?.[1]?.trim()) {
|
|
378763
|
+
return headingMatch[1].trim();
|
|
378764
|
+
}
|
|
378765
|
+
return null;
|
|
378766
|
+
}
|
|
378767
|
+
__name(parseOutputLanguageFromContent, "parseOutputLanguageFromContent");
|
|
378768
|
+
function readOutputLanguageFromFile() {
|
|
378769
|
+
const filePath = getOutputLanguageFilePath();
|
|
378770
|
+
if (!fs79.existsSync(filePath)) {
|
|
378771
|
+
return null;
|
|
378772
|
+
}
|
|
378773
|
+
try {
|
|
378774
|
+
const content = fs79.readFileSync(filePath, "utf-8");
|
|
378775
|
+
return parseOutputLanguageFromContent(content);
|
|
378776
|
+
} catch {
|
|
378777
|
+
return null;
|
|
378778
|
+
}
|
|
378779
|
+
}
|
|
378780
|
+
__name(readOutputLanguageFromFile, "readOutputLanguageFromFile");
|
|
378781
|
+
function writeOutputLanguageFile(language) {
|
|
378782
|
+
const filePath = getOutputLanguageFilePath();
|
|
378783
|
+
const content = generateOutputLanguageFileContent(language);
|
|
378784
|
+
const dir = path89.dirname(filePath);
|
|
378785
|
+
fs79.mkdirSync(dir, { recursive: true });
|
|
378786
|
+
fs79.writeFileSync(filePath, content, "utf-8");
|
|
378787
|
+
}
|
|
378788
|
+
__name(writeOutputLanguageFile, "writeOutputLanguageFile");
|
|
378789
|
+
function updateOutputLanguageFile(settingValue) {
|
|
378790
|
+
const resolved = resolveOutputLanguage(settingValue);
|
|
378791
|
+
writeOutputLanguageFile(resolved);
|
|
378792
|
+
}
|
|
378793
|
+
__name(updateOutputLanguageFile, "updateOutputLanguageFile");
|
|
378794
|
+
function initializeLlmOutputLanguage(outputLanguage) {
|
|
378795
|
+
const resolved = resolveOutputLanguage(outputLanguage);
|
|
378796
|
+
const currentFileLanguage = readOutputLanguageFromFile();
|
|
378797
|
+
if (currentFileLanguage !== resolved) {
|
|
378798
|
+
writeOutputLanguageFile(resolved);
|
|
378799
|
+
}
|
|
378800
|
+
}
|
|
378801
|
+
__name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
|
|
378802
|
+
|
|
378803
|
+
// packages/cli/src/ui/commands/languageCommand.ts
|
|
378897
378804
|
function getCurrentOutputLanguage(context2) {
|
|
378898
378805
|
const settingValue = context2?.services?.settings?.merged?.general?.outputLanguage || OUTPUT_LANGUAGE_AUTO;
|
|
378899
378806
|
const resolved = resolveOutputLanguage(settingValue);
|
|
@@ -425911,7 +425818,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
425911
425818
|
} = useAuthCommand(settings, config2, historyManager.addItem);
|
|
425912
425819
|
useInitializationAuthError(initializationResult.authError, onAuthError);
|
|
425913
425820
|
(0, import_react134.useEffect)(() => {
|
|
425914
|
-
const currentAuthType = config2.
|
|
425821
|
+
const currentAuthType = config2.getModelsConfig().getCurrentAuthType();
|
|
425915
425822
|
if (settings.merged.security?.auth?.enforcedType && currentAuthType && settings.merged.security?.auth.enforcedType !== currentAuthType) {
|
|
425916
425823
|
onAuthError(
|
|
425917
425824
|
t4(
|
|
@@ -427834,7 +427741,7 @@ __name(getUserStartupWarnings, "getUserStartupWarnings");
|
|
|
427834
427741
|
init_esbuild_shims();
|
|
427835
427742
|
async function validateNonInteractiveAuth(useExternalAuth, nonInteractiveConfig, settings) {
|
|
427836
427743
|
try {
|
|
427837
|
-
const authType = nonInteractiveConfig.
|
|
427744
|
+
const authType = nonInteractiveConfig.getModelsConfig().getCurrentAuthType();
|
|
427838
427745
|
if (!authType) {
|
|
427839
427746
|
throw new Error(
|
|
427840
427747
|
"No auth type is selected. Please configure an auth type (e.g. via settings or `--auth-type`) before running in non-interactive mode."
|
|
@@ -428175,7 +428082,9 @@ var usageSchema = external_exports.object({
|
|
|
428175
428082
|
var sessionUpdateMetaSchema = external_exports.object({
|
|
428176
428083
|
usage: usageSchema.optional().nullable(),
|
|
428177
428084
|
durationMs: external_exports.number().optional().nullable(),
|
|
428178
|
-
toolName: external_exports.string().optional().nullable()
|
|
428085
|
+
toolName: external_exports.string().optional().nullable(),
|
|
428086
|
+
parentToolCallId: external_exports.string().optional().nullable(),
|
|
428087
|
+
subagentType: external_exports.string().optional().nullable()
|
|
428179
428088
|
});
|
|
428180
428089
|
var requestPermissionResponseSchema = external_exports.object({
|
|
428181
428090
|
outcome: requestPermissionOutcomeSchema
|
|
@@ -428859,7 +428768,7 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
428859
428768
|
/**
|
|
428860
428769
|
* Emits usage metadata.
|
|
428861
428770
|
*/
|
|
428862
|
-
async emitUsageMetadata(usageMetadata, text = "", durationMs) {
|
|
428771
|
+
async emitUsageMetadata(usageMetadata, text = "", durationMs, subagentMeta) {
|
|
428863
428772
|
const usage2 = {
|
|
428864
428773
|
promptTokens: usageMetadata.promptTokenCount,
|
|
428865
428774
|
completionTokens: usageMetadata.candidatesTokenCount,
|
|
@@ -428867,7 +428776,7 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
428867
428776
|
totalTokens: usageMetadata.totalTokenCount,
|
|
428868
428777
|
cachedTokens: usageMetadata.cachedContentTokenCount
|
|
428869
428778
|
};
|
|
428870
|
-
const meta = typeof durationMs === "number" ? { usage: usage2, durationMs } : { usage: usage2 };
|
|
428779
|
+
const meta = typeof durationMs === "number" ? { usage: usage2, durationMs, ...subagentMeta } : { usage: usage2, ...subagentMeta };
|
|
428871
428780
|
await this.sendUpdate({
|
|
428872
428781
|
sessionUpdate: "agent_message_chunk",
|
|
428873
428782
|
content: { type: "text", text },
|
|
@@ -428993,7 +428902,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
428993
428902
|
locations,
|
|
428994
428903
|
kind: kind2,
|
|
428995
428904
|
rawInput: params.args ?? {},
|
|
428996
|
-
_meta: {
|
|
428905
|
+
_meta: {
|
|
428906
|
+
toolName: params.toolName,
|
|
428907
|
+
...params.subagentMeta
|
|
428908
|
+
}
|
|
428997
428909
|
});
|
|
428998
428910
|
return true;
|
|
428999
428911
|
}
|
|
@@ -429035,7 +428947,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
429035
428947
|
toolCallId: params.callId,
|
|
429036
428948
|
status: params.success ? "completed" : "failed",
|
|
429037
428949
|
content: contentArray,
|
|
429038
|
-
_meta: {
|
|
428950
|
+
_meta: {
|
|
428951
|
+
toolName: params.toolName,
|
|
428952
|
+
...params.subagentMeta
|
|
428953
|
+
}
|
|
429039
428954
|
};
|
|
429040
428955
|
if (params.resultDisplay !== void 0) {
|
|
429041
428956
|
update2["rawOutput"] = params.resultDisplay;
|
|
@@ -429047,9 +428962,11 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
429047
428962
|
* Use this for explicit error handling when not using emitResult.
|
|
429048
428963
|
*
|
|
429049
428964
|
* @param callId - The tool call ID
|
|
428965
|
+
* @param toolName - The tool name
|
|
429050
428966
|
* @param error - The error that occurred
|
|
428967
|
+
* @param subagentMeta - Optional subagent metadata
|
|
429051
428968
|
*/
|
|
429052
|
-
async emitError(callId, toolName, error2) {
|
|
428969
|
+
async emitError(callId, toolName, error2, subagentMeta) {
|
|
429053
428970
|
await this.sendUpdate({
|
|
429054
428971
|
sessionUpdate: "tool_call_update",
|
|
429055
428972
|
toolCallId: callId,
|
|
@@ -429057,7 +428974,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
429057
428974
|
content: [
|
|
429058
428975
|
{ type: "content", content: { type: "text", text: error2.message } }
|
|
429059
428976
|
],
|
|
429060
|
-
_meta: {
|
|
428977
|
+
_meta: {
|
|
428978
|
+
toolName,
|
|
428979
|
+
...subagentMeta
|
|
428980
|
+
}
|
|
429061
428981
|
});
|
|
429062
428982
|
}
|
|
429063
428983
|
// ==================== Public Utilities ====================
|
|
@@ -429334,9 +429254,11 @@ var basicPermissionOptions = [
|
|
|
429334
429254
|
}
|
|
429335
429255
|
];
|
|
429336
429256
|
var SubAgentTracker = class {
|
|
429337
|
-
constructor(ctx, client) {
|
|
429257
|
+
constructor(ctx, client, parentToolCallId, subagentType) {
|
|
429338
429258
|
this.ctx = ctx;
|
|
429339
429259
|
this.client = client;
|
|
429260
|
+
this.parentToolCallId = parentToolCallId;
|
|
429261
|
+
this.subagentType = subagentType;
|
|
429340
429262
|
this.toolCallEmitter = new ToolCallEmitter(ctx);
|
|
429341
429263
|
this.messageEmitter = new MessageEmitter(ctx);
|
|
429342
429264
|
}
|
|
@@ -429346,6 +429268,15 @@ var SubAgentTracker = class {
|
|
|
429346
429268
|
toolCallEmitter;
|
|
429347
429269
|
messageEmitter;
|
|
429348
429270
|
toolStates = /* @__PURE__ */ new Map();
|
|
429271
|
+
/**
|
|
429272
|
+
* Gets the subagent metadata to attach to all events.
|
|
429273
|
+
*/
|
|
429274
|
+
getSubagentMeta() {
|
|
429275
|
+
return {
|
|
429276
|
+
parentToolCallId: this.parentToolCallId,
|
|
429277
|
+
subagentType: this.subagentType
|
|
429278
|
+
};
|
|
429279
|
+
}
|
|
429349
429280
|
/**
|
|
429350
429281
|
* Sets up event listeners for a sub-agent's tool events.
|
|
429351
429282
|
*
|
|
@@ -429358,16 +429289,19 @@ var SubAgentTracker = class {
|
|
|
429358
429289
|
const onToolResult = this.createToolResultHandler(abortSignal);
|
|
429359
429290
|
const onApproval = this.createApprovalHandler(abortSignal);
|
|
429360
429291
|
const onUsageMetadata = this.createUsageMetadataHandler(abortSignal);
|
|
429292
|
+
const onStreamText = this.createStreamTextHandler(abortSignal);
|
|
429361
429293
|
eventEmitter.on(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
429362
429294
|
eventEmitter.on(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
429363
429295
|
eventEmitter.on(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
|
|
429364
429296
|
eventEmitter.on(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
|
|
429297
|
+
eventEmitter.on(SubAgentEventType.STREAM_TEXT, onStreamText);
|
|
429365
429298
|
return [
|
|
429366
429299
|
() => {
|
|
429367
429300
|
eventEmitter.off(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
429368
429301
|
eventEmitter.off(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
429369
429302
|
eventEmitter.off(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
|
|
429370
429303
|
eventEmitter.off(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
|
|
429304
|
+
eventEmitter.off(SubAgentEventType.STREAM_TEXT, onStreamText);
|
|
429371
429305
|
this.toolStates.clear();
|
|
429372
429306
|
}
|
|
429373
429307
|
];
|
|
@@ -429397,7 +429331,8 @@ var SubAgentTracker = class {
|
|
|
429397
429331
|
void this.toolCallEmitter.emitStart({
|
|
429398
429332
|
toolName: event.name,
|
|
429399
429333
|
callId: event.callId,
|
|
429400
|
-
args: event.args
|
|
429334
|
+
args: event.args,
|
|
429335
|
+
subagentMeta: this.getSubagentMeta()
|
|
429401
429336
|
});
|
|
429402
429337
|
};
|
|
429403
429338
|
}
|
|
@@ -429415,7 +429350,8 @@ var SubAgentTracker = class {
|
|
|
429415
429350
|
success: event.success,
|
|
429416
429351
|
message: event.responseParts ?? [],
|
|
429417
429352
|
resultDisplay: event.resultDisplay,
|
|
429418
|
-
args: state?.args
|
|
429353
|
+
args: state?.args,
|
|
429354
|
+
subagentMeta: this.getSubagentMeta()
|
|
429419
429355
|
});
|
|
429420
429356
|
this.toolStates.delete(event.callId);
|
|
429421
429357
|
};
|
|
@@ -429477,7 +429413,27 @@ var SubAgentTracker = class {
|
|
|
429477
429413
|
return (...args) => {
|
|
429478
429414
|
const event = args[0];
|
|
429479
429415
|
if (abortSignal.aborted) return;
|
|
429480
|
-
this.messageEmitter.emitUsageMetadata(
|
|
429416
|
+
this.messageEmitter.emitUsageMetadata(
|
|
429417
|
+
event.usage,
|
|
429418
|
+
"",
|
|
429419
|
+
event.durationMs,
|
|
429420
|
+
this.getSubagentMeta()
|
|
429421
|
+
);
|
|
429422
|
+
};
|
|
429423
|
+
}
|
|
429424
|
+
/**
|
|
429425
|
+
* Creates a handler for stream text events.
|
|
429426
|
+
* Emits agent message or thought chunks for text content from subagent model responses.
|
|
429427
|
+
*/
|
|
429428
|
+
createStreamTextHandler(abortSignal) {
|
|
429429
|
+
return (...args) => {
|
|
429430
|
+
const event = args[0];
|
|
429431
|
+
if (abortSignal.aborted) return;
|
|
429432
|
+
void this.messageEmitter.emitMessage(
|
|
429433
|
+
event.text,
|
|
429434
|
+
"assistant",
|
|
429435
|
+
event.thought ?? false
|
|
429436
|
+
);
|
|
429481
429437
|
};
|
|
429482
429438
|
}
|
|
429483
429439
|
/**
|
|
@@ -429835,7 +429791,14 @@ var Session3 = class {
|
|
|
429835
429791
|
const invocation = tool.build(args);
|
|
429836
429792
|
if (isTaskTool && "eventEmitter" in invocation) {
|
|
429837
429793
|
const taskEventEmitter = invocation.eventEmitter;
|
|
429838
|
-
const
|
|
429794
|
+
const parentToolCallId = callId;
|
|
429795
|
+
const subagentType = args["subagent_type"] ?? "";
|
|
429796
|
+
const subAgentTracker = new SubAgentTracker(
|
|
429797
|
+
this,
|
|
429798
|
+
this.client,
|
|
429799
|
+
parentToolCallId,
|
|
429800
|
+
subagentType
|
|
429801
|
+
);
|
|
429839
429802
|
subAgentCleanupFunctions = subAgentTracker.setup(
|
|
429840
429803
|
taskEventEmitter,
|
|
429841
429804
|
abortSignal
|
|
@@ -430382,7 +430345,7 @@ var GeminiAgent = class {
|
|
|
430382
430345
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
430383
430346
|
description: APPROVAL_MODE_INFO[mode].description
|
|
430384
430347
|
}));
|
|
430385
|
-
const version2 = "0.8.2-
|
|
430348
|
+
const version2 = "0.8.2-preview.1";
|
|
430386
430349
|
return {
|
|
430387
430350
|
protocolVersion: PROTOCOL_VERSION,
|
|
430388
430351
|
agentInfo: {
|
|
@@ -430541,7 +430504,7 @@ var GeminiAgent = class {
|
|
|
430541
430504
|
return session.setModel(params);
|
|
430542
430505
|
}
|
|
430543
430506
|
async ensureAuthenticated(config2) {
|
|
430544
|
-
const selectedType =
|
|
430507
|
+
const selectedType = config2.getModelsConfig().getCurrentAuthType();
|
|
430545
430508
|
if (!selectedType) {
|
|
430546
430509
|
throw RequestError.authRequired(
|
|
430547
430510
|
"Use Qwen Code CLI to authenticate first."
|
|
@@ -430757,7 +430720,7 @@ async function main() {
|
|
|
430757
430720
|
);
|
|
430758
430721
|
if (!settings.merged.security?.auth?.useExternal) {
|
|
430759
430722
|
try {
|
|
430760
|
-
const authType = partialConfig.
|
|
430723
|
+
const authType = partialConfig.getModelsConfig().getCurrentAuthType();
|
|
430761
430724
|
if (authType) {
|
|
430762
430725
|
const err = validateAuthMethod(authType, partialConfig);
|
|
430763
430726
|
if (err) {
|
|
@@ -430807,6 +430770,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
430807
430770
|
}
|
|
430808
430771
|
argv = { ...argv, resume: selectedSessionId };
|
|
430809
430772
|
}
|
|
430773
|
+
initializeLlmOutputLanguage(settings.merged.general?.outputLanguage);
|
|
430810
430774
|
{
|
|
430811
430775
|
const config2 = await loadCliConfig(
|
|
430812
430776
|
settings.merged,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwen-code/qwen-code",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-preview.1",
|
|
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.8.2-
|
|
23
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.8.2-preview.1"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {},
|
|
26
26
|
"optionalDependencies": {
|