@qwen-code/qwen-code 0.8.0 → 0.8.2-preview.0
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 +118 -54
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -155656,7 +155656,7 @@ __export(geminiContentGenerator_exports, {
|
|
|
155656
155656
|
createGeminiContentGenerator: () => createGeminiContentGenerator
|
|
155657
155657
|
});
|
|
155658
155658
|
function createGeminiContentGenerator(config2, gcConfig) {
|
|
155659
|
-
const version2 = "0.8.0";
|
|
155659
|
+
const version2 = "0.8.2-preview.0";
|
|
155660
155660
|
const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
155661
155661
|
const baseHeaders = {
|
|
155662
155662
|
"User-Agent": userAgent2
|
|
@@ -172205,6 +172205,7 @@ var init_coreToolScheduler = __esm({
|
|
|
172205
172205
|
"use strict";
|
|
172206
172206
|
init_esbuild_shims();
|
|
172207
172207
|
init_src2();
|
|
172208
|
+
init_tool_names();
|
|
172208
172209
|
init_generateContentResponseUtilities();
|
|
172209
172210
|
init_modifiable_tool();
|
|
172210
172211
|
init_lib();
|
|
@@ -172420,15 +172421,21 @@ var init_coreToolScheduler = __esm({
|
|
|
172420
172421
|
}
|
|
172421
172422
|
}
|
|
172422
172423
|
/**
|
|
172423
|
-
* Generates
|
|
172424
|
-
*
|
|
172425
|
-
* Note: Excluded tools are handled separately before calling this method, so this only
|
|
172426
|
-
* handles the case where a tool is truly not found (hallucinated or typo).
|
|
172427
|
-
* @param unknownToolName The tool name that was not found.
|
|
172428
|
-
* @param topN The number of suggestions to return. Defaults to 3.
|
|
172429
|
-
* @returns A suggestion string like " Did you mean 'tool'?" or " Did you mean one of: 'tool1', 'tool2'?",
|
|
172430
|
-
* or an empty string if no suggestions are found.
|
|
172424
|
+
* Generates error message for unknown tool. Returns early with skill-specific
|
|
172425
|
+
* message if the name matches a skill, otherwise uses Levenshtein suggestions.
|
|
172431
172426
|
*/
|
|
172427
|
+
getToolNotFoundMessage(unknownToolName, topN = 3) {
|
|
172428
|
+
const skillTool = this.toolRegistry.getTool(ToolNames.SKILL);
|
|
172429
|
+
if (skillTool instanceof SkillTool) {
|
|
172430
|
+
const availableSkillNames = skillTool.getAvailableSkillNames();
|
|
172431
|
+
if (availableSkillNames.includes(unknownToolName)) {
|
|
172432
|
+
return `"${unknownToolName}" is a skill name, not a tool name. To use this skill, invoke the "${ToolNames.SKILL}" tool with parameter: skill: "${unknownToolName}"`;
|
|
172433
|
+
}
|
|
172434
|
+
}
|
|
172435
|
+
const suggestion = this.getToolSuggestion(unknownToolName, topN);
|
|
172436
|
+
return `Tool "${unknownToolName}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
|
|
172437
|
+
}
|
|
172438
|
+
/** Suggests similar tool names using Levenshtein distance. */
|
|
172432
172439
|
getToolSuggestion(unknownToolName, topN = 3) {
|
|
172433
172440
|
const allToolNames = this.toolRegistry.getAllToolNames();
|
|
172434
172441
|
const matches = allToolNames.map((toolName) => ({
|
|
@@ -172498,8 +172505,7 @@ var init_coreToolScheduler = __esm({
|
|
|
172498
172505
|
}
|
|
172499
172506
|
const toolInstance = this.toolRegistry.getTool(reqInfo.name);
|
|
172500
172507
|
if (!toolInstance) {
|
|
172501
|
-
const
|
|
172502
|
-
const errorMessage = `Tool "${reqInfo.name}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
|
|
172508
|
+
const errorMessage = this.getToolNotFoundMessage(reqInfo.name);
|
|
172503
172509
|
return {
|
|
172504
172510
|
status: "error",
|
|
172505
172511
|
request: reqInfo,
|
|
@@ -173389,13 +173395,15 @@ var init_subagent = __esm({
|
|
|
173389
173395
|
const parts = content?.parts || [];
|
|
173390
173396
|
for (const p2 of parts) {
|
|
173391
173397
|
const txt = p2.text;
|
|
173392
|
-
|
|
173398
|
+
const isThought = p2.thought ?? false;
|
|
173399
|
+
if (txt && !isThought)
|
|
173393
173400
|
roundText += txt;
|
|
173394
173401
|
if (txt)
|
|
173395
173402
|
this.eventEmitter?.emit(SubAgentEventType.STREAM_TEXT, {
|
|
173396
173403
|
subagentId: this.subagentId,
|
|
173397
173404
|
round: turnCounter,
|
|
173398
173405
|
text: txt,
|
|
173406
|
+
thought: isThought,
|
|
173399
173407
|
timestamp: Date.now()
|
|
173400
173408
|
});
|
|
173401
173409
|
}
|
|
@@ -241761,7 +241769,7 @@ var init_config3 = __esm({
|
|
|
241761
241769
|
contentGeneratorConfigSources = {};
|
|
241762
241770
|
contentGenerator;
|
|
241763
241771
|
embeddingModel;
|
|
241764
|
-
|
|
241772
|
+
modelsConfig;
|
|
241765
241773
|
modelProvidersConfig;
|
|
241766
241774
|
sandbox;
|
|
241767
241775
|
targetDir;
|
|
@@ -241940,7 +241948,7 @@ var init_config3 = __esm({
|
|
|
241940
241948
|
if (params.contextFileName) {
|
|
241941
241949
|
setGeminiMdFilename(params.contextFileName);
|
|
241942
241950
|
}
|
|
241943
|
-
this.
|
|
241951
|
+
this.modelsConfig = new ModelsConfig({
|
|
241944
241952
|
initialAuthType: params.authType ?? params.generationConfig?.authType,
|
|
241945
241953
|
modelProvidersConfig: this.modelProvidersConfig,
|
|
241946
241954
|
generationConfig: {
|
|
@@ -242007,8 +242015,8 @@ var init_config3 = __esm({
|
|
|
242007
242015
|
* Get the ModelsConfig instance for model-related operations.
|
|
242008
242016
|
* External code (e.g., CLI) can use this to access model configuration.
|
|
242009
242017
|
*/
|
|
242010
|
-
|
|
242011
|
-
return this.
|
|
242018
|
+
getModelsConfig() {
|
|
242019
|
+
return this.modelsConfig;
|
|
242012
242020
|
}
|
|
242013
242021
|
/**
|
|
242014
242022
|
* Updates the credentials in the generation config.
|
|
@@ -242016,17 +242024,17 @@ var init_config3 = __esm({
|
|
|
242016
242024
|
* Delegates to ModelsConfig.
|
|
242017
242025
|
*/
|
|
242018
242026
|
updateCredentials(credentials, settingsGenerationConfig) {
|
|
242019
|
-
this.
|
|
242027
|
+
this.modelsConfig.updateCredentials(credentials, settingsGenerationConfig);
|
|
242020
242028
|
}
|
|
242021
242029
|
/**
|
|
242022
242030
|
* Refresh authentication and rebuild ContentGenerator.
|
|
242023
242031
|
*/
|
|
242024
242032
|
async refreshAuth(authMethod, isInitialAuth) {
|
|
242025
|
-
const modelId = this.
|
|
242026
|
-
this.
|
|
242027
|
-
const requireCached = this.
|
|
242028
|
-
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authMethod, this.
|
|
242029
|
-
strictModelProvider: this.
|
|
242033
|
+
const modelId = this.modelsConfig.getModel();
|
|
242034
|
+
this.modelsConfig.syncAfterAuthRefresh(authMethod, modelId);
|
|
242035
|
+
const requireCached = this.modelsConfig.consumeRequireCachedCredentialsFlag();
|
|
242036
|
+
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authMethod, this.modelsConfig.getGenerationConfig(), this.modelsConfig.getGenerationConfigSources(), {
|
|
242037
|
+
strictModelProvider: this.modelsConfig.isStrictModelProviderSelection()
|
|
242030
242038
|
});
|
|
242031
242039
|
const newContentGeneratorConfig = config2;
|
|
242032
242040
|
this.contentGenerator = await createContentGenerator(newContentGeneratorConfig, this, requireCached ? true : isInitialAuth);
|
|
@@ -242084,20 +242092,20 @@ var init_config3 = __esm({
|
|
|
242084
242092
|
return this.contentGeneratorConfig;
|
|
242085
242093
|
}
|
|
242086
242094
|
getContentGeneratorConfigSources() {
|
|
242087
|
-
if (Object.keys(this.contentGeneratorConfigSources).length === 0 && this.
|
|
242088
|
-
return this.
|
|
242095
|
+
if (Object.keys(this.contentGeneratorConfigSources).length === 0 && this.modelsConfig) {
|
|
242096
|
+
return this.modelsConfig.getGenerationConfigSources();
|
|
242089
242097
|
}
|
|
242090
242098
|
return this.contentGeneratorConfigSources;
|
|
242091
242099
|
}
|
|
242092
242100
|
getModel() {
|
|
242093
|
-
return this.contentGeneratorConfig?.model || this.
|
|
242101
|
+
return this.contentGeneratorConfig?.model || this.modelsConfig.getModel();
|
|
242094
242102
|
}
|
|
242095
242103
|
/**
|
|
242096
242104
|
* Set model programmatically (e.g., VLM auto-switch, fallback).
|
|
242097
242105
|
* Delegates to ModelsConfig.
|
|
242098
242106
|
*/
|
|
242099
242107
|
async setModel(newModel, metadata) {
|
|
242100
|
-
await this.
|
|
242108
|
+
await this.modelsConfig.setModel(newModel, metadata);
|
|
242101
242109
|
if (this.contentGeneratorConfig) {
|
|
242102
242110
|
this.contentGeneratorConfig.model = newModel;
|
|
242103
242111
|
}
|
|
@@ -242111,8 +242119,8 @@ var init_config3 = __esm({
|
|
|
242111
242119
|
return;
|
|
242112
242120
|
}
|
|
242113
242121
|
if (authType === AuthType2.QWEN_OAUTH && !requiresRefresh) {
|
|
242114
|
-
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authType, this.
|
|
242115
|
-
strictModelProvider: this.
|
|
242122
|
+
const { config: config2, sources } = resolveContentGeneratorConfigWithSources(this, authType, this.modelsConfig.getGenerationConfig(), this.modelsConfig.getGenerationConfigSources(), {
|
|
242123
|
+
strictModelProvider: this.modelsConfig.isStrictModelProviderSelection()
|
|
242116
242124
|
});
|
|
242117
242125
|
this.contentGeneratorConfig.model = config2.model;
|
|
242118
242126
|
this.contentGeneratorConfig.samplingParams = config2.samplingParams;
|
|
@@ -242135,14 +242143,14 @@ var init_config3 = __esm({
|
|
|
242135
242143
|
* Delegates to ModelsConfig.
|
|
242136
242144
|
*/
|
|
242137
242145
|
getAvailableModels() {
|
|
242138
|
-
return this.
|
|
242146
|
+
return this.modelsConfig.getAvailableModels();
|
|
242139
242147
|
}
|
|
242140
242148
|
/**
|
|
242141
242149
|
* Get available models for a specific authType.
|
|
242142
242150
|
* Delegates to ModelsConfig.
|
|
242143
242151
|
*/
|
|
242144
242152
|
getAvailableModelsForAuthType(authType) {
|
|
242145
|
-
return this.
|
|
242153
|
+
return this.modelsConfig.getAvailableModelsForAuthType(authType);
|
|
242146
242154
|
}
|
|
242147
242155
|
/**
|
|
242148
242156
|
* Switch authType+model via registry-backed selection.
|
|
@@ -242155,7 +242163,7 @@ var init_config3 = __esm({
|
|
|
242155
242163
|
* @param metadata - Metadata for logging/tracking
|
|
242156
242164
|
*/
|
|
242157
242165
|
async switchModel(authType, modelId, options2, metadata) {
|
|
242158
|
-
await this.
|
|
242166
|
+
await this.modelsConfig.switchModel(authType, modelId, options2, metadata);
|
|
242159
242167
|
}
|
|
242160
242168
|
getMaxSessionTurns() {
|
|
242161
242169
|
return this.maxSessionTurns;
|
|
@@ -361117,7 +361125,7 @@ function findModelConfig(modelProviders, authType, modelId) {
|
|
|
361117
361125
|
__name(findModelConfig, "findModelConfig");
|
|
361118
361126
|
function hasApiKeyForAuth(authType, settings, config2) {
|
|
361119
361127
|
const modelProviders = settings.modelProviders;
|
|
361120
|
-
const modelId = config2?.
|
|
361128
|
+
const modelId = config2?.getModelsConfig().getModel() ?? settings.model?.name;
|
|
361121
361129
|
const modelConfig = findModelConfig(modelProviders, authType, modelId);
|
|
361122
361130
|
if (modelConfig?.envKey) {
|
|
361123
361131
|
const hasKey2 = !!process.env[modelConfig.envKey];
|
|
@@ -361203,7 +361211,7 @@ function validateAuthMethod(authMethod, config2) {
|
|
|
361203
361211
|
return apiKeyError;
|
|
361204
361212
|
}
|
|
361205
361213
|
const modelProviders = settings.merged.modelProviders;
|
|
361206
|
-
const modelId = config2?.
|
|
361214
|
+
const modelId = config2?.getModelsConfig().getModel() ?? settings.merged.model?.name;
|
|
361207
361215
|
const modelConfig = findModelConfig(modelProviders, authMethod, modelId);
|
|
361208
361216
|
if (modelConfig && !modelConfig.baseUrl) {
|
|
361209
361217
|
return t4(
|
|
@@ -367668,7 +367676,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
367668
367676
|
// packages/cli/src/utils/version.ts
|
|
367669
367677
|
async function getCliVersion() {
|
|
367670
367678
|
const pkgJson = await getPackageJson();
|
|
367671
|
-
return "0.8.0";
|
|
367679
|
+
return "0.8.2-preview.0";
|
|
367672
367680
|
}
|
|
367673
367681
|
__name(getCliVersion, "getCliVersion");
|
|
367674
367682
|
|
|
@@ -374871,7 +374879,7 @@ async function initializeApp(config2, settings) {
|
|
|
374871
374879
|
const languageSetting = process.env["QWEN_CODE_LANG"] || settings.merged.general?.language || "auto";
|
|
374872
374880
|
await initializeI18n(languageSetting);
|
|
374873
374881
|
initializeLlmOutputLanguage(settings.merged.general?.outputLanguage);
|
|
374874
|
-
const authType = config2.
|
|
374882
|
+
const authType = config2.getModelsConfig().getCurrentAuthType();
|
|
374875
374883
|
const authError = await performInitialAuth(config2, authType);
|
|
374876
374884
|
if (authError) {
|
|
374877
374885
|
settings.setValue(
|
|
@@ -374881,7 +374889,7 @@ async function initializeApp(config2, settings) {
|
|
|
374881
374889
|
);
|
|
374882
374890
|
}
|
|
374883
374891
|
const themeError = validateTheme(settings);
|
|
374884
|
-
const shouldOpenAuthDialog = !config2.
|
|
374892
|
+
const shouldOpenAuthDialog = !config2.getModelsConfig().wasAuthTypeExplicitlyProvided() || !!authError;
|
|
374885
374893
|
if (config2.getIdeMode()) {
|
|
374886
374894
|
const ideClient = await IdeClient.getInstance();
|
|
374887
374895
|
await ideClient.connect();
|
|
@@ -375288,7 +375296,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
375288
375296
|
|
|
375289
375297
|
// packages/cli/src/generated/git-commit.ts
|
|
375290
375298
|
init_esbuild_shims();
|
|
375291
|
-
var GIT_COMMIT_INFO2 = "
|
|
375299
|
+
var GIT_COMMIT_INFO2 = "83aa7283";
|
|
375292
375300
|
|
|
375293
375301
|
// packages/cli/src/utils/systemInfo.ts
|
|
375294
375302
|
async function getNpmVersion() {
|
|
@@ -424101,7 +424109,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
424101
424109
|
} = useAuthCommand(settings, config2, historyManager.addItem);
|
|
424102
424110
|
useInitializationAuthError(initializationResult.authError, onAuthError);
|
|
424103
424111
|
(0, import_react134.useEffect)(() => {
|
|
424104
|
-
const currentAuthType = config2.
|
|
424112
|
+
const currentAuthType = config2.getModelsConfig().getCurrentAuthType();
|
|
424105
424113
|
if (settings.merged.security?.auth?.enforcedType && currentAuthType && settings.merged.security?.auth.enforcedType !== currentAuthType) {
|
|
424106
424114
|
onAuthError(
|
|
424107
424115
|
t4(
|
|
@@ -426024,7 +426032,7 @@ __name(getUserStartupWarnings, "getUserStartupWarnings");
|
|
|
426024
426032
|
init_esbuild_shims();
|
|
426025
426033
|
async function validateNonInteractiveAuth(useExternalAuth, nonInteractiveConfig, settings) {
|
|
426026
426034
|
try {
|
|
426027
|
-
const authType = nonInteractiveConfig.
|
|
426035
|
+
const authType = nonInteractiveConfig.getModelsConfig().getCurrentAuthType();
|
|
426028
426036
|
if (!authType) {
|
|
426029
426037
|
throw new Error(
|
|
426030
426038
|
"No auth type is selected. Please configure an auth type (e.g. via settings or `--auth-type`) before running in non-interactive mode."
|
|
@@ -426365,7 +426373,9 @@ var usageSchema = external_exports.object({
|
|
|
426365
426373
|
var sessionUpdateMetaSchema = external_exports.object({
|
|
426366
426374
|
usage: usageSchema.optional().nullable(),
|
|
426367
426375
|
durationMs: external_exports.number().optional().nullable(),
|
|
426368
|
-
toolName: external_exports.string().optional().nullable()
|
|
426376
|
+
toolName: external_exports.string().optional().nullable(),
|
|
426377
|
+
parentToolCallId: external_exports.string().optional().nullable(),
|
|
426378
|
+
subagentType: external_exports.string().optional().nullable()
|
|
426369
426379
|
});
|
|
426370
426380
|
var requestPermissionResponseSchema = external_exports.object({
|
|
426371
426381
|
outcome: requestPermissionOutcomeSchema
|
|
@@ -427049,7 +427059,7 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
427049
427059
|
/**
|
|
427050
427060
|
* Emits usage metadata.
|
|
427051
427061
|
*/
|
|
427052
|
-
async emitUsageMetadata(usageMetadata, text = "", durationMs) {
|
|
427062
|
+
async emitUsageMetadata(usageMetadata, text = "", durationMs, subagentMeta) {
|
|
427053
427063
|
const usage2 = {
|
|
427054
427064
|
promptTokens: usageMetadata.promptTokenCount,
|
|
427055
427065
|
completionTokens: usageMetadata.candidatesTokenCount,
|
|
@@ -427057,7 +427067,7 @@ var MessageEmitter = class extends BaseEmitter {
|
|
|
427057
427067
|
totalTokens: usageMetadata.totalTokenCount,
|
|
427058
427068
|
cachedTokens: usageMetadata.cachedContentTokenCount
|
|
427059
427069
|
};
|
|
427060
|
-
const meta = typeof durationMs === "number" ? { usage: usage2, durationMs } : { usage: usage2 };
|
|
427070
|
+
const meta = typeof durationMs === "number" ? { usage: usage2, durationMs, ...subagentMeta } : { usage: usage2, ...subagentMeta };
|
|
427061
427071
|
await this.sendUpdate({
|
|
427062
427072
|
sessionUpdate: "agent_message_chunk",
|
|
427063
427073
|
content: { type: "text", text },
|
|
@@ -427183,7 +427193,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
427183
427193
|
locations,
|
|
427184
427194
|
kind: kind2,
|
|
427185
427195
|
rawInput: params.args ?? {},
|
|
427186
|
-
_meta: {
|
|
427196
|
+
_meta: {
|
|
427197
|
+
toolName: params.toolName,
|
|
427198
|
+
...params.subagentMeta
|
|
427199
|
+
}
|
|
427187
427200
|
});
|
|
427188
427201
|
return true;
|
|
427189
427202
|
}
|
|
@@ -427225,7 +427238,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
427225
427238
|
toolCallId: params.callId,
|
|
427226
427239
|
status: params.success ? "completed" : "failed",
|
|
427227
427240
|
content: contentArray,
|
|
427228
|
-
_meta: {
|
|
427241
|
+
_meta: {
|
|
427242
|
+
toolName: params.toolName,
|
|
427243
|
+
...params.subagentMeta
|
|
427244
|
+
}
|
|
427229
427245
|
};
|
|
427230
427246
|
if (params.resultDisplay !== void 0) {
|
|
427231
427247
|
update2["rawOutput"] = params.resultDisplay;
|
|
@@ -427237,9 +427253,11 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
427237
427253
|
* Use this for explicit error handling when not using emitResult.
|
|
427238
427254
|
*
|
|
427239
427255
|
* @param callId - The tool call ID
|
|
427256
|
+
* @param toolName - The tool name
|
|
427240
427257
|
* @param error - The error that occurred
|
|
427258
|
+
* @param subagentMeta - Optional subagent metadata
|
|
427241
427259
|
*/
|
|
427242
|
-
async emitError(callId, toolName, error2) {
|
|
427260
|
+
async emitError(callId, toolName, error2, subagentMeta) {
|
|
427243
427261
|
await this.sendUpdate({
|
|
427244
427262
|
sessionUpdate: "tool_call_update",
|
|
427245
427263
|
toolCallId: callId,
|
|
@@ -427247,7 +427265,10 @@ var ToolCallEmitter = class extends BaseEmitter {
|
|
|
427247
427265
|
content: [
|
|
427248
427266
|
{ type: "content", content: { type: "text", text: error2.message } }
|
|
427249
427267
|
],
|
|
427250
|
-
_meta: {
|
|
427268
|
+
_meta: {
|
|
427269
|
+
toolName,
|
|
427270
|
+
...subagentMeta
|
|
427271
|
+
}
|
|
427251
427272
|
});
|
|
427252
427273
|
}
|
|
427253
427274
|
// ==================== Public Utilities ====================
|
|
@@ -427524,9 +427545,11 @@ var basicPermissionOptions = [
|
|
|
427524
427545
|
}
|
|
427525
427546
|
];
|
|
427526
427547
|
var SubAgentTracker = class {
|
|
427527
|
-
constructor(ctx, client) {
|
|
427548
|
+
constructor(ctx, client, parentToolCallId, subagentType) {
|
|
427528
427549
|
this.ctx = ctx;
|
|
427529
427550
|
this.client = client;
|
|
427551
|
+
this.parentToolCallId = parentToolCallId;
|
|
427552
|
+
this.subagentType = subagentType;
|
|
427530
427553
|
this.toolCallEmitter = new ToolCallEmitter(ctx);
|
|
427531
427554
|
this.messageEmitter = new MessageEmitter(ctx);
|
|
427532
427555
|
}
|
|
@@ -427536,6 +427559,15 @@ var SubAgentTracker = class {
|
|
|
427536
427559
|
toolCallEmitter;
|
|
427537
427560
|
messageEmitter;
|
|
427538
427561
|
toolStates = /* @__PURE__ */ new Map();
|
|
427562
|
+
/**
|
|
427563
|
+
* Gets the subagent metadata to attach to all events.
|
|
427564
|
+
*/
|
|
427565
|
+
getSubagentMeta() {
|
|
427566
|
+
return {
|
|
427567
|
+
parentToolCallId: this.parentToolCallId,
|
|
427568
|
+
subagentType: this.subagentType
|
|
427569
|
+
};
|
|
427570
|
+
}
|
|
427539
427571
|
/**
|
|
427540
427572
|
* Sets up event listeners for a sub-agent's tool events.
|
|
427541
427573
|
*
|
|
@@ -427548,16 +427580,19 @@ var SubAgentTracker = class {
|
|
|
427548
427580
|
const onToolResult = this.createToolResultHandler(abortSignal);
|
|
427549
427581
|
const onApproval = this.createApprovalHandler(abortSignal);
|
|
427550
427582
|
const onUsageMetadata = this.createUsageMetadataHandler(abortSignal);
|
|
427583
|
+
const onStreamText = this.createStreamTextHandler(abortSignal);
|
|
427551
427584
|
eventEmitter.on(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
427552
427585
|
eventEmitter.on(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
427553
427586
|
eventEmitter.on(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
|
|
427554
427587
|
eventEmitter.on(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
|
|
427588
|
+
eventEmitter.on(SubAgentEventType.STREAM_TEXT, onStreamText);
|
|
427555
427589
|
return [
|
|
427556
427590
|
() => {
|
|
427557
427591
|
eventEmitter.off(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
427558
427592
|
eventEmitter.off(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
427559
427593
|
eventEmitter.off(SubAgentEventType.TOOL_WAITING_APPROVAL, onApproval);
|
|
427560
427594
|
eventEmitter.off(SubAgentEventType.USAGE_METADATA, onUsageMetadata);
|
|
427595
|
+
eventEmitter.off(SubAgentEventType.STREAM_TEXT, onStreamText);
|
|
427561
427596
|
this.toolStates.clear();
|
|
427562
427597
|
}
|
|
427563
427598
|
];
|
|
@@ -427587,7 +427622,8 @@ var SubAgentTracker = class {
|
|
|
427587
427622
|
void this.toolCallEmitter.emitStart({
|
|
427588
427623
|
toolName: event.name,
|
|
427589
427624
|
callId: event.callId,
|
|
427590
|
-
args: event.args
|
|
427625
|
+
args: event.args,
|
|
427626
|
+
subagentMeta: this.getSubagentMeta()
|
|
427591
427627
|
});
|
|
427592
427628
|
};
|
|
427593
427629
|
}
|
|
@@ -427605,7 +427641,8 @@ var SubAgentTracker = class {
|
|
|
427605
427641
|
success: event.success,
|
|
427606
427642
|
message: event.responseParts ?? [],
|
|
427607
427643
|
resultDisplay: event.resultDisplay,
|
|
427608
|
-
args: state?.args
|
|
427644
|
+
args: state?.args,
|
|
427645
|
+
subagentMeta: this.getSubagentMeta()
|
|
427609
427646
|
});
|
|
427610
427647
|
this.toolStates.delete(event.callId);
|
|
427611
427648
|
};
|
|
@@ -427667,7 +427704,27 @@ var SubAgentTracker = class {
|
|
|
427667
427704
|
return (...args) => {
|
|
427668
427705
|
const event = args[0];
|
|
427669
427706
|
if (abortSignal.aborted) return;
|
|
427670
|
-
this.messageEmitter.emitUsageMetadata(
|
|
427707
|
+
this.messageEmitter.emitUsageMetadata(
|
|
427708
|
+
event.usage,
|
|
427709
|
+
"",
|
|
427710
|
+
event.durationMs,
|
|
427711
|
+
this.getSubagentMeta()
|
|
427712
|
+
);
|
|
427713
|
+
};
|
|
427714
|
+
}
|
|
427715
|
+
/**
|
|
427716
|
+
* Creates a handler for stream text events.
|
|
427717
|
+
* Emits agent message or thought chunks for text content from subagent model responses.
|
|
427718
|
+
*/
|
|
427719
|
+
createStreamTextHandler(abortSignal) {
|
|
427720
|
+
return (...args) => {
|
|
427721
|
+
const event = args[0];
|
|
427722
|
+
if (abortSignal.aborted) return;
|
|
427723
|
+
void this.messageEmitter.emitMessage(
|
|
427724
|
+
event.text,
|
|
427725
|
+
"assistant",
|
|
427726
|
+
event.thought ?? false
|
|
427727
|
+
);
|
|
427671
427728
|
};
|
|
427672
427729
|
}
|
|
427673
427730
|
/**
|
|
@@ -428025,7 +428082,14 @@ var Session3 = class {
|
|
|
428025
428082
|
const invocation = tool.build(args);
|
|
428026
428083
|
if (isTaskTool && "eventEmitter" in invocation) {
|
|
428027
428084
|
const taskEventEmitter = invocation.eventEmitter;
|
|
428028
|
-
const
|
|
428085
|
+
const parentToolCallId = callId;
|
|
428086
|
+
const subagentType = args["subagent_type"] ?? "";
|
|
428087
|
+
const subAgentTracker = new SubAgentTracker(
|
|
428088
|
+
this,
|
|
428089
|
+
this.client,
|
|
428090
|
+
parentToolCallId,
|
|
428091
|
+
subagentType
|
|
428092
|
+
);
|
|
428029
428093
|
subAgentCleanupFunctions = subAgentTracker.setup(
|
|
428030
428094
|
taskEventEmitter,
|
|
428031
428095
|
abortSignal
|
|
@@ -428572,7 +428636,7 @@ var GeminiAgent = class {
|
|
|
428572
428636
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
428573
428637
|
description: APPROVAL_MODE_INFO[mode].description
|
|
428574
428638
|
}));
|
|
428575
|
-
const version2 = "0.8.0";
|
|
428639
|
+
const version2 = "0.8.2-preview.0";
|
|
428576
428640
|
return {
|
|
428577
428641
|
protocolVersion: PROTOCOL_VERSION,
|
|
428578
428642
|
agentInfo: {
|
|
@@ -428731,7 +428795,7 @@ var GeminiAgent = class {
|
|
|
428731
428795
|
return session.setModel(params);
|
|
428732
428796
|
}
|
|
428733
428797
|
async ensureAuthenticated(config2) {
|
|
428734
|
-
const selectedType =
|
|
428798
|
+
const selectedType = config2.getModelsConfig().getCurrentAuthType();
|
|
428735
428799
|
if (!selectedType) {
|
|
428736
428800
|
throw RequestError.authRequired(
|
|
428737
428801
|
"Use Qwen Code CLI to authenticate first."
|
|
@@ -428947,7 +429011,7 @@ async function main() {
|
|
|
428947
429011
|
);
|
|
428948
429012
|
if (!settings.merged.security?.auth?.useExternal) {
|
|
428949
429013
|
try {
|
|
428950
|
-
const authType = partialConfig.
|
|
429014
|
+
const authType = partialConfig.getModelsConfig().getCurrentAuthType();
|
|
428951
429015
|
if (authType) {
|
|
428952
429016
|
const err = validateAuthMethod(authType, partialConfig);
|
|
428953
429017
|
if (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwen-code/qwen-code",
|
|
3
|
-
"version": "0.8.0",
|
|
3
|
+
"version": "0.8.2-preview.0",
|
|
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.0"
|
|
23
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.8.2-preview.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {},
|
|
26
26
|
"optionalDependencies": {
|