@qwen-code/qwen-code 0.15.12-preview.3 → 0.16.0-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/bundled/qc-helper/docs/configuration/settings.md +20 -24
- package/bundled/qc-helper/docs/qwen-serve.md +29 -10
- package/chunks/{agent-LIAWUWAO.js → agent-ZNQPH67I.js} +15 -15
- package/chunks/{anthropicContentGenerator-4QE6LTVV.js → anthropicContentGenerator-ICBDZ6R2.js} +4 -4
- package/chunks/{askUserQuestion-QFSCBTUO.js → askUserQuestion-WQILGUSQ.js} +2 -2
- package/chunks/{chunk-SQNQIOD5.js → chunk-2B7UBDY5.js} +2 -2
- package/chunks/chunk-3MBY4GKN.js +350 -0
- package/chunks/{chunk-GC5RXNL2.js → chunk-7QXHXMC6.js} +23 -7
- package/chunks/{chunk-XLQ4E5PS.js → chunk-C3LHPHN2.js} +11 -11
- package/chunks/{chunk-UXW7MYAW.js → chunk-CW44BRRA.js} +1 -1
- package/chunks/{chunk-G27O2LD2.js → chunk-D5NTAHYL.js} +1 -1
- package/chunks/{chunk-CBVB66WY.js → chunk-EDYSNFEM.js} +1 -1
- package/chunks/{chunk-OCC4MZRS.js → chunk-F23NCRJ2.js} +1 -1
- package/chunks/{chunk-FYMSCRHM.js → chunk-FZIUV27X.js} +1 -1
- package/chunks/{chunk-5QQ5FGTU.js → chunk-G7YTSRES.js} +1 -1
- package/chunks/{chunk-AOJ3BBY7.js → chunk-JHMX4QTD.js} +9 -9
- package/chunks/{chunk-TPGOGCWM.js → chunk-JYQUJ5DS.js} +1 -1
- package/chunks/{chunk-FKVKVE6N.js → chunk-KXZ4TJB4.js} +1 -1
- package/chunks/{chunk-AJSOD5IR.js → chunk-MNPZ2WO6.js} +535 -141
- package/chunks/{chunk-BXNCPI75.js → chunk-NAID3ZWF.js} +2 -2
- package/chunks/{chunk-JMZQICAL.js → chunk-PPHYLJSS.js} +1 -1
- package/chunks/{chunk-CM2IESUE.js → chunk-PR4T27R7.js} +1 -1
- package/chunks/{chunk-CAWKL3UC.js → chunk-VTPOO6GV.js} +1 -1
- package/chunks/{chunk-GJXIKCKL.js → chunk-XP27SJMH.js} +76 -5
- package/chunks/{chunk-B7ZL7HUA.js → chunk-XVHR7ATJ.js} +1 -1
- package/chunks/{contextCommand-SVLAZMQL.js → contextCommand-IGBCEXI4.js} +16 -16
- package/chunks/{cron-create-WUTD5ZTH.js → cron-create-AVI3Q267.js} +2 -2
- package/chunks/{cron-delete-N3UQYCRA.js → cron-delete-ZCEGDXXV.js} +2 -2
- package/chunks/{cron-list-Z6RJJ4YH.js → cron-list-VN653OK5.js} +2 -2
- package/chunks/{edit-VNAZBIZR.js → edit-74Q4AFHQ.js} +16 -16
- package/chunks/{en-NRN4QBAT.js → en-FIUWJSZR.js} +1 -0
- package/chunks/{enter-worktree-FOF5YZIV.js → enter-worktree-H72HXC7D.js} +15 -15
- package/chunks/{exit-worktree-Y6QVAO3C.js → exit-worktree-FGIQO3S3.js} +15 -15
- package/chunks/{exitPlanMode-QZKO7GH7.js → exitPlanMode-NBR2PK2D.js} +15 -15
- package/chunks/{geminiContentGenerator-DYHZPKJX.js → geminiContentGenerator-33RP4WKD.js} +3 -3
- package/chunks/{glob-G7XATELV.js → glob-WEE3CJL6.js} +15 -15
- package/chunks/{grep-4SETMY47.js → grep-DZKSBFZK.js} +15 -15
- package/chunks/{keychain-token-storage-DMFP5IJM.js → keychain-token-storage-335UOLJ6.js} +2 -2
- package/chunks/{ls-SUILOZZB.js → ls-6F3VSP6S.js} +3 -3
- package/chunks/{lsp-6TQBWVMZ.js → lsp-67Y7DJN5.js} +2 -2
- package/chunks/{monitor-JTLJBJ7H.js → monitor-EDZWEZVS.js} +15 -15
- package/chunks/{openaiContentGenerator-3H7XOZBW.js → openaiContentGenerator-5NQG3W64.js} +10 -10
- package/chunks/{qwenContentGenerator-FAU3QPYO.js → qwenContentGenerator-4DPUUS6R.js} +17 -17
- package/chunks/{qwenOAuth2-JSQ7EPR3.js → qwenOAuth2-JE7H47TE.js} +3 -3
- package/chunks/{read-file-WWUQVNCZ.js → read-file-CQOF7BQ2.js} +7 -7
- package/chunks/{ripGrep-WCOAIWL6.js → ripGrep-KR5LKGTI.js} +15 -15
- package/chunks/{send-message-Q2JRAC3J.js → send-message-GB4AQZNC.js} +2 -2
- package/chunks/{serve-VJEEEXA6.js → serve-GAD2PEST.js} +501 -286
- package/chunks/{shell-IAOKGIJ6.js → shell-E2HMCBGR.js} +15 -15
- package/chunks/{skill-NHW6222K.js → skill-KDZH6UZ6.js} +9 -9
- package/chunks/{src-OWV5HVQQ.js → src-LY4RU5AI.js} +17 -15
- package/chunks/{syntheticOutput-S4DRGMQM.js → syntheticOutput-HFL3DE7R.js} +3 -3
- package/chunks/{task-stop-7THHVAQS.js → task-stop-ZQF26RXS.js} +2 -2
- package/chunks/{todoWrite-WKUGUTPX.js → todoWrite-U4SC643O.js} +3 -3
- package/chunks/{tool-search-MSJ6SXLI.js → tool-search-U4XQVLFU.js} +7 -7
- package/chunks/{web-fetch-OZE6ZQUF.js → web-fetch-BRWZ4WSE.js} +4 -4
- package/chunks/{write-file-RKCENFZ5.js → write-file-NBLRMNGB.js} +16 -16
- package/chunks/{zh-TW-XZEHEV5S.js → zh-TW-552S24LR.js} +1 -0
- package/chunks/{zh-RN3JULHO.js → zh-V32QONGV.js} +1 -0
- package/cli.js +598 -59
- package/locales/en.js +2 -0
- package/locales/zh-TW.js +1 -0
- package/locales/zh.js +1 -0
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -8,6 +8,11 @@ import {
|
|
|
8
8
|
loadAccount,
|
|
9
9
|
saveAccount
|
|
10
10
|
} from "./chunks/chunk-AEJ2DKLP.js";
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_RING_SIZE,
|
|
13
|
+
SERVE_STATUS_EXT_METHODS,
|
|
14
|
+
STATUS_SCHEMA_VERSION
|
|
15
|
+
} from "./chunks/chunk-3MBY4GKN.js";
|
|
11
16
|
import {
|
|
12
17
|
SUPPORTED_LANGUAGES,
|
|
13
18
|
contextCommand,
|
|
@@ -22,7 +27,7 @@ import {
|
|
|
22
27
|
setLanguageAsync,
|
|
23
28
|
t,
|
|
24
29
|
ta
|
|
25
|
-
} from "./chunks/chunk-
|
|
30
|
+
} from "./chunks/chunk-JHMX4QTD.js";
|
|
26
31
|
import {
|
|
27
32
|
clearScreen,
|
|
28
33
|
writeStderrLine,
|
|
@@ -93,6 +98,7 @@ import {
|
|
|
93
98
|
checkForExtensionUpdate,
|
|
94
99
|
checkHasEditorType,
|
|
95
100
|
clearWelcomeBackState,
|
|
101
|
+
collectMemoryDiagnostics,
|
|
96
102
|
convertToFunctionResponse,
|
|
97
103
|
convertTomlToMarkdown,
|
|
98
104
|
createFollowupController,
|
|
@@ -124,6 +130,7 @@ import {
|
|
|
124
130
|
getIdeInstaller,
|
|
125
131
|
getInsightPrompt,
|
|
126
132
|
getLastGoalTerminal,
|
|
133
|
+
getMCPDiscoveryState,
|
|
127
134
|
getMCPServerPrompts,
|
|
128
135
|
getMCPServerStatus,
|
|
129
136
|
getPlanModeSystemReminder,
|
|
@@ -185,7 +192,7 @@ import {
|
|
|
185
192
|
unregisterGoalHook,
|
|
186
193
|
updateSetting,
|
|
187
194
|
writeRuntimeStatus
|
|
188
|
-
} from "./chunks/chunk-
|
|
195
|
+
} from "./chunks/chunk-MNPZ2WO6.js";
|
|
189
196
|
import "./chunks/chunk-5P5XGNYH.js";
|
|
190
197
|
import {
|
|
191
198
|
_enum,
|
|
@@ -214,24 +221,24 @@ import "./chunks/chunk-TW522KN6.js";
|
|
|
214
221
|
import "./chunks/chunk-MLZQVCF3.js";
|
|
215
222
|
import {
|
|
216
223
|
runSideQuery
|
|
217
|
-
} from "./chunks/chunk-
|
|
224
|
+
} from "./chunks/chunk-PPHYLJSS.js";
|
|
218
225
|
import {
|
|
219
226
|
buildSkillLlmContent
|
|
220
|
-
} from "./chunks/chunk-
|
|
227
|
+
} from "./chunks/chunk-G7YTSRES.js";
|
|
221
228
|
import {
|
|
222
229
|
HOOKS_CONFIG_FIELDS,
|
|
223
230
|
HookEventName,
|
|
224
231
|
createHookOutput
|
|
225
|
-
} from "./chunks/chunk-
|
|
232
|
+
} from "./chunks/chunk-XVHR7ATJ.js";
|
|
226
233
|
import "./chunks/chunk-77WXWU44.js";
|
|
227
|
-
import "./chunks/chunk-
|
|
234
|
+
import "./chunks/chunk-F23NCRJ2.js";
|
|
228
235
|
import {
|
|
229
236
|
detectRuntime,
|
|
230
237
|
getOrCreateSharedDispatcher,
|
|
231
238
|
getUnsupportedImageFormatWarning,
|
|
232
239
|
isSupportedImageMimeType,
|
|
233
240
|
redactProxyCredentials
|
|
234
|
-
} from "./chunks/chunk-
|
|
241
|
+
} from "./chunks/chunk-VTPOO6GV.js";
|
|
235
242
|
import {
|
|
236
243
|
ApiCancelEvent,
|
|
237
244
|
AuthEvent,
|
|
@@ -270,7 +277,7 @@ import {
|
|
|
270
277
|
setGeminiMdFilename,
|
|
271
278
|
shutdownTelemetry,
|
|
272
279
|
uiTelemetryService
|
|
273
|
-
} from "./chunks/chunk-
|
|
280
|
+
} from "./chunks/chunk-C3LHPHN2.js";
|
|
274
281
|
import "./chunks/chunk-SYCJMSIJ.js";
|
|
275
282
|
import "./chunks/chunk-UWCTAVOD.js";
|
|
276
283
|
import {
|
|
@@ -281,12 +288,12 @@ import {
|
|
|
281
288
|
getAutoMemoryProjectStateDir,
|
|
282
289
|
getAutoMemoryRoot,
|
|
283
290
|
isAutoMemPath
|
|
284
|
-
} from "./chunks/chunk-
|
|
291
|
+
} from "./chunks/chunk-PR4T27R7.js";
|
|
285
292
|
import {
|
|
286
293
|
DEFAULT_TOKEN_LIMIT,
|
|
287
294
|
tokenLimit
|
|
288
|
-
} from "./chunks/chunk-
|
|
289
|
-
import "./chunks/chunk-
|
|
295
|
+
} from "./chunks/chunk-CW44BRRA.js";
|
|
296
|
+
import "./chunks/chunk-D5NTAHYL.js";
|
|
290
297
|
import {
|
|
291
298
|
require_base64_js,
|
|
292
299
|
require_ecdsa_sig_formatter,
|
|
@@ -295,7 +302,7 @@ import {
|
|
|
295
302
|
require_jws
|
|
296
303
|
} from "./chunks/chunk-T4VD6OJ4.js";
|
|
297
304
|
import "./chunks/chunk-RDYWTWEM.js";
|
|
298
|
-
import "./chunks/chunk-
|
|
305
|
+
import "./chunks/chunk-JYQUJ5DS.js";
|
|
299
306
|
import {
|
|
300
307
|
SchemaValidator,
|
|
301
308
|
ToolConfirmationOutcome,
|
|
@@ -304,13 +311,13 @@ import {
|
|
|
304
311
|
require_dist,
|
|
305
312
|
require_fast_deep_equal,
|
|
306
313
|
require_fast_uri
|
|
307
|
-
} from "./chunks/chunk-
|
|
314
|
+
} from "./chunks/chunk-FZIUV27X.js";
|
|
308
315
|
import {
|
|
309
316
|
clearCachedCredentialFile,
|
|
310
317
|
open_default,
|
|
311
318
|
qwenOAuth2Events
|
|
312
|
-
} from "./chunks/chunk-
|
|
313
|
-
import "./chunks/chunk-
|
|
319
|
+
} from "./chunks/chunk-2B7UBDY5.js";
|
|
320
|
+
import "./chunks/chunk-KXZ4TJB4.js";
|
|
314
321
|
import {
|
|
315
322
|
FatalCancellationError,
|
|
316
323
|
FatalConfigError,
|
|
@@ -332,7 +339,7 @@ import {
|
|
|
332
339
|
tildeifyPath,
|
|
333
340
|
unescapePath,
|
|
334
341
|
updateSymlink
|
|
335
|
-
} from "./chunks/chunk-
|
|
342
|
+
} from "./chunks/chunk-XP27SJMH.js";
|
|
336
343
|
import "./chunks/chunk-E7E2MFYM.js";
|
|
337
344
|
import "./chunks/chunk-ZERZSAZL.js";
|
|
338
345
|
import "./chunks/chunk-QN5NZ3UQ.js";
|
|
@@ -93391,6 +93398,15 @@ var SETTINGS_SCHEMA = {
|
|
|
93391
93398
|
showInDialog: false,
|
|
93392
93399
|
mergeStrategy: "replace" /* REPLACE */
|
|
93393
93400
|
},
|
|
93401
|
+
plansDirectory: {
|
|
93402
|
+
type: "string",
|
|
93403
|
+
label: "Plans Directory",
|
|
93404
|
+
category: "Advanced",
|
|
93405
|
+
requiresRestart: true,
|
|
93406
|
+
default: void 0,
|
|
93407
|
+
description: "Custom directory for approved Plan Mode files. Relative paths are resolved from the project root, and the resolved path must stay within the project root. Defaults to ~/.qwen/plans.",
|
|
93408
|
+
showInDialog: false
|
|
93409
|
+
},
|
|
93394
93410
|
// Environment variables fallback
|
|
93395
93411
|
env: {
|
|
93396
93412
|
type: "object",
|
|
@@ -103901,7 +103917,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
103901
103917
|
// packages/cli/src/utils/version.ts
|
|
103902
103918
|
async function getCliVersion() {
|
|
103903
103919
|
const pkgJson = await getPackageJson();
|
|
103904
|
-
return "0.
|
|
103920
|
+
return "0.16.0-preview.0";
|
|
103905
103921
|
}
|
|
103906
103922
|
__name(getCliVersion, "getCliVersion");
|
|
103907
103923
|
|
|
@@ -110258,6 +110274,18 @@ var serveCommand = {
|
|
|
110258
110274
|
type: "number",
|
|
110259
110275
|
default: 256,
|
|
110260
110276
|
description: "Listener-level TCP connection cap (server.maxConnections). Bounds raw sockets \u2014 slow/phantom SSE clients get rejected at accept time once full. Set to 0 to disable."
|
|
110277
|
+
}).option("require-auth", {
|
|
110278
|
+
type: "boolean",
|
|
110279
|
+
default: false,
|
|
110280
|
+
description: "Refuse to start without a bearer token, even on loopback. Hardens the loopback developer default for shared dev hosts / CI runners / multi-tenant workstations where any local user can hit 127.0.0.1. Requires --token or QWEN_SERVER_TOKEN. /health also requires Authorization when enabled (no loopback exemption \u2014 k8s/Compose probes must pass the bearer too)."
|
|
110281
|
+
}).option("event-ring-size", {
|
|
110282
|
+
type: "number",
|
|
110283
|
+
// Single source of truth — `DEFAULT_RING_SIZE` (currently 8000,
|
|
110284
|
+
// #3803 §02) is also what the bridge falls back to when the
|
|
110285
|
+
// option is undefined. Importing here keeps a future bump in
|
|
110286
|
+
// one place rather than drifting between CLI and bus.
|
|
110287
|
+
default: DEFAULT_RING_SIZE,
|
|
110288
|
+
description: "Per-session SSE replay ring depth (#3803 \xA702 target). Sets the replay backlog available to `GET /session/:id/events` reconnects that send a `Last-Event-ID: N` header. Larger = more reconnect headroom at the cost of a few hundred KB extra RAM per session. Must be a positive finite integer."
|
|
110261
110289
|
}).option("http-bridge", {
|
|
110262
110290
|
type: "boolean",
|
|
110263
110291
|
default: true,
|
|
@@ -110274,7 +110302,7 @@ var serveCommand = {
|
|
|
110274
110302
|
"qwen serve: --token is visible in the process command line; prefer the QWEN_SERVER_TOKEN env var for any non-trivial deployment."
|
|
110275
110303
|
);
|
|
110276
110304
|
}
|
|
110277
|
-
const { runQwenServe } = await import("./chunks/serve-
|
|
110305
|
+
const { runQwenServe } = await import("./chunks/serve-GAD2PEST.js");
|
|
110278
110306
|
try {
|
|
110279
110307
|
await runQwenServe({
|
|
110280
110308
|
port: argv.port,
|
|
@@ -110283,7 +110311,9 @@ var serveCommand = {
|
|
|
110283
110311
|
mode: "http-bridge",
|
|
110284
110312
|
maxSessions: argv["max-sessions"],
|
|
110285
110313
|
maxConnections: argv["max-connections"],
|
|
110286
|
-
|
|
110314
|
+
eventRingSize: argv["event-ring-size"],
|
|
110315
|
+
workspace: argv.workspace,
|
|
110316
|
+
requireAuth: argv["require-auth"]
|
|
110287
110317
|
});
|
|
110288
110318
|
} catch (err) {
|
|
110289
110319
|
writeStderrLine(
|
|
@@ -111231,6 +111261,7 @@ async function loadCliConfig(settings, argv, cwd5 = process.cwd(), overrideExten
|
|
|
111231
111261
|
clearContextOnIdle: settings.context?.clearContextOnIdle,
|
|
111232
111262
|
fileFiltering: settings.context?.fileFiltering,
|
|
111233
111263
|
checkpointing: argv.checkpointing || settings.general?.checkpointing?.enabled,
|
|
111264
|
+
plansDirectory: settings.plansDirectory,
|
|
111234
111265
|
proxy: argv.proxy || settings.proxy || process.env["HTTPS_PROXY"] || process.env["https_proxy"] || process.env["HTTP_PROXY"] || process.env["http_proxy"],
|
|
111235
111266
|
cwd: cwd5,
|
|
111236
111267
|
fileDiscoveryService: fileService,
|
|
@@ -114621,7 +114652,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds, options) => {
|
|
|
114621
114652
|
|
|
114622
114653
|
// packages/cli/src/generated/git-commit.ts
|
|
114623
114654
|
init_esbuild_shims();
|
|
114624
|
-
var GIT_COMMIT_INFO = "
|
|
114655
|
+
var GIT_COMMIT_INFO = "87eb2f743";
|
|
114625
114656
|
|
|
114626
114657
|
// packages/cli/src/utils/systemInfo.ts
|
|
114627
114658
|
var debugLogger11 = createDebugLogger("STATUS");
|
|
@@ -118851,8 +118882,137 @@ ${formatHeapSnapshotErrorMessage(error)}`;
|
|
|
118851
118882
|
context.ui.setPendingItem(null);
|
|
118852
118883
|
}
|
|
118853
118884
|
}
|
|
118854
|
-
}, "action")
|
|
118885
|
+
}, "action"),
|
|
118886
|
+
subCommands: [
|
|
118887
|
+
{
|
|
118888
|
+
name: "memory",
|
|
118889
|
+
get description() {
|
|
118890
|
+
return t("Show current process memory diagnostics");
|
|
118891
|
+
},
|
|
118892
|
+
kind: "built-in" /* BUILT_IN */,
|
|
118893
|
+
supportedModes: ["interactive", "non_interactive", "acp"],
|
|
118894
|
+
argumentHint: "[--json] [--sample] [--snapshot]",
|
|
118895
|
+
action: memoryDoctorAction
|
|
118896
|
+
}
|
|
118897
|
+
]
|
|
118855
118898
|
};
|
|
118899
|
+
var MEMORY_USAGE_HINT = "/doctor memory [--json] [--sample] [--snapshot]";
|
|
118900
|
+
async function memoryDoctorAction(context, args = "") {
|
|
118901
|
+
if (context.abortSignal?.aborted) {
|
|
118902
|
+
return;
|
|
118903
|
+
}
|
|
118904
|
+
const tokens = args.trim().split(/\s+/).filter(Boolean);
|
|
118905
|
+
const unknown2 = tokens.filter(
|
|
118906
|
+
(token) => token !== "--json" && token !== "--sample" && token !== "--snapshot"
|
|
118907
|
+
);
|
|
118908
|
+
if (unknown2.length > 0) {
|
|
118909
|
+
return {
|
|
118910
|
+
type: "message",
|
|
118911
|
+
messageType: "error",
|
|
118912
|
+
content: `${t("Unknown argument(s)")}: ${unknown2.join(", ")}. ${t("Usage")}: ${MEMORY_USAGE_HINT}`
|
|
118913
|
+
};
|
|
118914
|
+
}
|
|
118915
|
+
const shouldSampleMemory = tokens.includes("--sample");
|
|
118916
|
+
const shouldWriteHeapSnapshot = tokens.includes("--snapshot");
|
|
118917
|
+
if (shouldSampleMemory || shouldWriteHeapSnapshot) {
|
|
118918
|
+
return doctorCommand.action?.(
|
|
118919
|
+
context,
|
|
118920
|
+
[MEMORY_SUBCOMMAND, ...tokens.filter((token) => token !== "--json")].join(
|
|
118921
|
+
" "
|
|
118922
|
+
)
|
|
118923
|
+
);
|
|
118924
|
+
}
|
|
118925
|
+
try {
|
|
118926
|
+
const diagnostics = await collectMemoryDiagnostics({
|
|
118927
|
+
sessionId: context.services.config?.getSessionId(),
|
|
118928
|
+
qwenVersion: context.services.config?.getCliVersion()
|
|
118929
|
+
});
|
|
118930
|
+
if (context.abortSignal?.aborted) {
|
|
118931
|
+
return;
|
|
118932
|
+
}
|
|
118933
|
+
return {
|
|
118934
|
+
type: "message",
|
|
118935
|
+
messageType: diagnostics.analysis.risks.length > 0 ? "warning" : "info",
|
|
118936
|
+
content: tokens.includes("--json") ? JSON.stringify(diagnostics, null, 2) : formatCoreDiagnostics(diagnostics)
|
|
118937
|
+
};
|
|
118938
|
+
} catch (error) {
|
|
118939
|
+
if (context.abortSignal?.aborted) {
|
|
118940
|
+
return;
|
|
118941
|
+
}
|
|
118942
|
+
return {
|
|
118943
|
+
type: "message",
|
|
118944
|
+
messageType: "error",
|
|
118945
|
+
content: `${t("Failed to collect memory diagnostics")}: ${formatErrorMessage2(error)}`
|
|
118946
|
+
};
|
|
118947
|
+
}
|
|
118948
|
+
}
|
|
118949
|
+
__name(memoryDoctorAction, "memoryDoctorAction");
|
|
118950
|
+
function formatCpuMicroseconds(micros) {
|
|
118951
|
+
return `${(micros / 1e6).toFixed(2)}s`;
|
|
118952
|
+
}
|
|
118953
|
+
__name(formatCpuMicroseconds, "formatCpuMicroseconds");
|
|
118954
|
+
function formatHeapSpaces(spaces) {
|
|
118955
|
+
if (!spaces || spaces.length === 0) {
|
|
118956
|
+
return void 0;
|
|
118957
|
+
}
|
|
118958
|
+
const top2 = [...spaces].sort((a, b) => b.used - a.used).slice(0, 4);
|
|
118959
|
+
const lines = top2.map(
|
|
118960
|
+
(space) => ` - ${space.name}: used ${formatMemoryUsage(space.used)} / size ${formatMemoryUsage(space.size)}`
|
|
118961
|
+
);
|
|
118962
|
+
if (spaces.length > top2.length) {
|
|
118963
|
+
lines.push(` - \u2026 ${spaces.length - top2.length} more`);
|
|
118964
|
+
}
|
|
118965
|
+
return lines.join("\n");
|
|
118966
|
+
}
|
|
118967
|
+
__name(formatHeapSpaces, "formatHeapSpaces");
|
|
118968
|
+
function formatSmapsRollup(smapsRollup) {
|
|
118969
|
+
if (!smapsRollup) {
|
|
118970
|
+
return t("unavailable");
|
|
118971
|
+
}
|
|
118972
|
+
const rssLine = smapsRollup.split(/\r?\n/).map((line) => line.trim().replace(/\s+/g, " ")).find((line) => line.startsWith("Rss:"));
|
|
118973
|
+
if (rssLine) {
|
|
118974
|
+
return rssLine;
|
|
118975
|
+
}
|
|
118976
|
+
const preview = smapsRollup.slice(0, 80).trim().replace(/\s+/g, " ");
|
|
118977
|
+
return `${t("parse error")}: ${preview}`;
|
|
118978
|
+
}
|
|
118979
|
+
__name(formatSmapsRollup, "formatSmapsRollup");
|
|
118980
|
+
function formatCoreDiagnostics(diagnostics) {
|
|
118981
|
+
const risks = diagnostics.analysis.risks.length > 0 ? diagnostics.analysis.risks.map((risk) => ` - ${risk.type}: ${risk.message}`).join("\n") : ` ${t("none")}`;
|
|
118982
|
+
const lines = [
|
|
118983
|
+
t("Memory Diagnostics"),
|
|
118984
|
+
`timestamp: ${diagnostics.timestamp}`,
|
|
118985
|
+
`uptimeSeconds: ${diagnostics.uptimeSeconds.toFixed(1)}`,
|
|
118986
|
+
`heapUsed: ${formatMemoryUsage(diagnostics.memoryUsage.heapUsed)}`,
|
|
118987
|
+
`heapTotal: ${formatMemoryUsage(diagnostics.memoryUsage.heapTotal)}`,
|
|
118988
|
+
`rss: ${formatMemoryUsage(diagnostics.memoryUsage.rss)}`,
|
|
118989
|
+
`external: ${formatMemoryUsage(diagnostics.memoryUsage.external)}`,
|
|
118990
|
+
`arrayBuffers: ${formatMemoryUsage(diagnostics.memoryUsage.arrayBuffers)}`,
|
|
118991
|
+
`v8HeapLimit: ${formatMemoryUsage(diagnostics.v8HeapStats.heapSizeLimit)}`,
|
|
118992
|
+
`v8MallocedMemory: ${formatMemoryUsage(diagnostics.v8HeapStats.mallocedMemory)}`,
|
|
118993
|
+
`v8PeakMallocedMemory: ${formatMemoryUsage(diagnostics.v8HeapStats.peakMallocedMemory)}`,
|
|
118994
|
+
`detachedContexts: ${diagnostics.v8HeapStats.detachedContexts}`,
|
|
118995
|
+
`nativeContexts: ${diagnostics.v8HeapStats.nativeContexts}`,
|
|
118996
|
+
`maxRSS: ${formatMemoryUsage(diagnostics.resourceUsage.maxRSS)}`,
|
|
118997
|
+
`userCPUTime: ${formatCpuMicroseconds(diagnostics.resourceUsage.userCPUTime)}`,
|
|
118998
|
+
`systemCPUTime: ${formatCpuMicroseconds(diagnostics.resourceUsage.systemCPUTime)}`,
|
|
118999
|
+
`activeHandles: ${diagnostics.activeHandles}`,
|
|
119000
|
+
`activeRequests: ${diagnostics.activeRequests}`,
|
|
119001
|
+
`openFileDescriptors: ${diagnostics.openFileDescriptors ?? t("unavailable")}`,
|
|
119002
|
+
`smapsRollup: ${formatSmapsRollup(diagnostics.smapsRollup)}`
|
|
119003
|
+
];
|
|
119004
|
+
const heapSpaces = formatHeapSpaces(diagnostics.v8HeapSpaces);
|
|
119005
|
+
if (heapSpaces) {
|
|
119006
|
+
lines.push("v8HeapSpaces:", heapSpaces);
|
|
119007
|
+
}
|
|
119008
|
+
lines.push(
|
|
119009
|
+
"risks:",
|
|
119010
|
+
risks,
|
|
119011
|
+
`recommendation: ${diagnostics.analysis.recommendation}`
|
|
119012
|
+
);
|
|
119013
|
+
return lines.join("\n");
|
|
119014
|
+
}
|
|
119015
|
+
__name(formatCoreDiagnostics, "formatCoreDiagnostics");
|
|
118856
119016
|
|
|
118857
119017
|
// packages/cli/src/ui/commands/diffCommand.ts
|
|
118858
119018
|
init_esbuild_shims();
|
|
@@ -119882,6 +120042,18 @@ var HistoryReplayer = class {
|
|
|
119882
120042
|
}
|
|
119883
120043
|
break;
|
|
119884
120044
|
}
|
|
120045
|
+
if (record2.subtype === "mid_turn_user_message") {
|
|
120046
|
+
const displayText = record2.systemPayload?.displayText;
|
|
120047
|
+
if (displayText) {
|
|
120048
|
+
await this.messageEmitter.emitUserMessage(
|
|
120049
|
+
displayText,
|
|
120050
|
+
record2.timestamp
|
|
120051
|
+
);
|
|
120052
|
+
} else if (record2.message) {
|
|
120053
|
+
await this.replayContent(record2.message, "user", record2.timestamp);
|
|
120054
|
+
}
|
|
120055
|
+
break;
|
|
120056
|
+
}
|
|
119885
120057
|
if (record2.message) {
|
|
119886
120058
|
await this.replayContent(record2.message, "user", record2.timestamp);
|
|
119887
120059
|
}
|
|
@@ -120221,7 +120393,7 @@ async function extractMetadata(conversation, config) {
|
|
|
120221
120393
|
const gitBranch = firstRecord?.gitBranch;
|
|
120222
120394
|
let gitRepo;
|
|
120223
120395
|
if (cwd5) {
|
|
120224
|
-
const { getGitRepoName } = await import("./chunks/src-
|
|
120396
|
+
const { getGitRepoName } = await import("./chunks/src-LY4RU5AI.js");
|
|
120225
120397
|
gitRepo = getGitRepoName(cwd5);
|
|
120226
120398
|
}
|
|
120227
120399
|
let model;
|
|
@@ -122733,6 +122905,16 @@ function formatAcpModelId(modelId, authType) {
|
|
|
122733
122905
|
return `${modelId}(${authType})`;
|
|
122734
122906
|
}
|
|
122735
122907
|
__name(formatAcpModelId, "formatAcpModelId");
|
|
122908
|
+
function parseAcpBaseModelId(value) {
|
|
122909
|
+
const trimmed = value.trim();
|
|
122910
|
+
const closeIdx = trimmed.lastIndexOf(")");
|
|
122911
|
+
const openIdx = trimmed.lastIndexOf("(");
|
|
122912
|
+
if (openIdx >= 0 && closeIdx === trimmed.length - 1 && openIdx < closeIdx) {
|
|
122913
|
+
return trimmed.slice(0, openIdx);
|
|
122914
|
+
}
|
|
122915
|
+
return trimmed;
|
|
122916
|
+
}
|
|
122917
|
+
__name(parseAcpBaseModelId, "parseAcpBaseModelId");
|
|
122736
122918
|
function parseAcpModelOption(input) {
|
|
122737
122919
|
const trimmed = input.trim();
|
|
122738
122920
|
const closeIdx = trimmed.lastIndexOf(")");
|
|
@@ -130443,7 +130625,7 @@ var SystemController = class extends BaseController {
|
|
|
130443
130625
|
throw new Error("Request aborted");
|
|
130444
130626
|
}
|
|
130445
130627
|
try {
|
|
130446
|
-
const mod = await import("./chunks/contextCommand-
|
|
130628
|
+
const mod = await import("./chunks/contextCommand-IGBCEXI4.js");
|
|
130447
130629
|
if (signal.aborted) {
|
|
130448
130630
|
throw new Error("Request aborted");
|
|
130449
130631
|
}
|
|
@@ -161906,6 +162088,14 @@ function convertToHistoryItems(conversation, config) {
|
|
|
161906
162088
|
items.push({ type: "notification", text: text2 });
|
|
161907
162089
|
break;
|
|
161908
162090
|
}
|
|
162091
|
+
if (record2.subtype === "mid_turn_user_message") {
|
|
162092
|
+
const payload = record2.systemPayload;
|
|
162093
|
+
const text2 = payload?.displayText || extractTextFromParts(record2.message?.parts);
|
|
162094
|
+
if (text2) {
|
|
162095
|
+
items.push({ type: "user", text: text2 });
|
|
162096
|
+
}
|
|
162097
|
+
break;
|
|
162098
|
+
}
|
|
161909
162099
|
if (pendingAtCommands.length > 0) {
|
|
161910
162100
|
if (currentToolGroup.length > 0) {
|
|
161911
162101
|
items.push({
|
|
@@ -172008,6 +172198,12 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
172008
172198
|
content: result.content,
|
|
172009
172199
|
timestamp: /* @__PURE__ */ new Date()
|
|
172010
172200
|
});
|
|
172201
|
+
} else if (result.messageType === "warning") {
|
|
172202
|
+
addMessage({
|
|
172203
|
+
type: "warning" /* WARNING */,
|
|
172204
|
+
content: result.content,
|
|
172205
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
172206
|
+
});
|
|
172011
172207
|
} else {
|
|
172012
172208
|
addMessage({
|
|
172013
172209
|
type: "error" /* ERROR */,
|
|
@@ -174381,10 +174577,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
174381
174577
|
const drained = turnCancelledRef.current || abortControllerRef.current?.signal.aborted ? [] : midTurnDrainRef?.current?.() ?? [];
|
|
174382
174578
|
if (drained.length > 0) {
|
|
174383
174579
|
for (const msg of drained) {
|
|
174384
|
-
|
|
174580
|
+
const midTurnUserMessage = {
|
|
174385
174581
|
text: `
|
|
174386
174582
|
[User message received during tool execution]: ${msg}`
|
|
174387
|
-
}
|
|
174583
|
+
};
|
|
174584
|
+
responsesToSend.push(midTurnUserMessage);
|
|
174585
|
+
config.getChatRecordingService()?.recordMidTurnUserMessage(midTurnUserMessage, msg);
|
|
174388
174586
|
addItem({ type: "user" /* USER */, text: msg }, Date.now());
|
|
174389
174587
|
}
|
|
174390
174588
|
}
|
|
@@ -185180,6 +185378,96 @@ __name(loadRewriteConfig, "loadRewriteConfig");
|
|
|
185180
185378
|
|
|
185181
185379
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
185182
185380
|
var debugLogger72 = createDebugLogger("SESSION");
|
|
185381
|
+
function computeInitialTurnFromHistory(records, sessionId) {
|
|
185382
|
+
let maxPromptTurn = 0;
|
|
185383
|
+
let userMessageCount = 0;
|
|
185384
|
+
const promptIdPrefix = `${sessionId}########`;
|
|
185385
|
+
for (const record2 of records) {
|
|
185386
|
+
if (record2.sessionId === sessionId && isUserPromptRecord(record2)) {
|
|
185387
|
+
userMessageCount += 1;
|
|
185388
|
+
}
|
|
185389
|
+
for (const promptId of getRecordPromptIds(record2)) {
|
|
185390
|
+
if (!promptId.startsWith(promptIdPrefix)) {
|
|
185391
|
+
continue;
|
|
185392
|
+
}
|
|
185393
|
+
const suffix = promptId.slice(promptIdPrefix.length);
|
|
185394
|
+
if (!/^\d+$/.test(suffix)) {
|
|
185395
|
+
continue;
|
|
185396
|
+
}
|
|
185397
|
+
maxPromptTurn = Math.max(maxPromptTurn, Number(suffix));
|
|
185398
|
+
}
|
|
185399
|
+
}
|
|
185400
|
+
return maxPromptTurn > 0 ? maxPromptTurn : userMessageCount;
|
|
185401
|
+
}
|
|
185402
|
+
__name(computeInitialTurnFromHistory, "computeInitialTurnFromHistory");
|
|
185403
|
+
function getRecordPromptIds(record2) {
|
|
185404
|
+
const promptIds = [];
|
|
185405
|
+
const recordPromptId = record2.promptId;
|
|
185406
|
+
if (typeof recordPromptId === "string") {
|
|
185407
|
+
promptIds.push(recordPromptId);
|
|
185408
|
+
}
|
|
185409
|
+
const telemetryPromptId = readTelemetryPromptId(record2.systemPayload);
|
|
185410
|
+
if (telemetryPromptId) {
|
|
185411
|
+
promptIds.push(telemetryPromptId);
|
|
185412
|
+
}
|
|
185413
|
+
return promptIds;
|
|
185414
|
+
}
|
|
185415
|
+
__name(getRecordPromptIds, "getRecordPromptIds");
|
|
185416
|
+
function readTelemetryPromptId(payload) {
|
|
185417
|
+
if (!payload || typeof payload !== "object" || !("uiEvent" in payload)) {
|
|
185418
|
+
return void 0;
|
|
185419
|
+
}
|
|
185420
|
+
const uiEvent = payload.uiEvent;
|
|
185421
|
+
if (!uiEvent || typeof uiEvent !== "object" || !("prompt_id" in uiEvent)) {
|
|
185422
|
+
return void 0;
|
|
185423
|
+
}
|
|
185424
|
+
const promptId = uiEvent.prompt_id;
|
|
185425
|
+
return typeof promptId === "string" ? promptId : void 0;
|
|
185426
|
+
}
|
|
185427
|
+
__name(readTelemetryPromptId, "readTelemetryPromptId");
|
|
185428
|
+
function isUserPromptRecord(record2) {
|
|
185429
|
+
if (record2.type !== "user") {
|
|
185430
|
+
return false;
|
|
185431
|
+
}
|
|
185432
|
+
return record2.message?.parts?.some(
|
|
185433
|
+
(part) => typeof part.text === "string" && part.text.trim().length > 0
|
|
185434
|
+
) ?? false;
|
|
185435
|
+
}
|
|
185436
|
+
__name(isUserPromptRecord, "isUserPromptRecord");
|
|
185437
|
+
async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.timeout(1e4)) {
|
|
185438
|
+
const slashCommands = await getAvailableCommands(config, abortSignal, "acp");
|
|
185439
|
+
const availableCommands = slashCommands.map((cmd) => {
|
|
185440
|
+
const acceptsInput = cmd.acceptsInput ?? (cmd.kind !== "built-in" /* BUILT_IN */ || cmd.completion != null || cmd.argumentHint != null || cmd.subCommands != null && cmd.subCommands.length > 0);
|
|
185441
|
+
return {
|
|
185442
|
+
name: cmd.name,
|
|
185443
|
+
description: cmd.description,
|
|
185444
|
+
input: acceptsInput ? { hint: cmd.argumentHint ?? "" } : null,
|
|
185445
|
+
_meta: {
|
|
185446
|
+
argumentHint: cmd.argumentHint,
|
|
185447
|
+
source: cmd.source,
|
|
185448
|
+
sourceLabel: cmd.sourceLabel,
|
|
185449
|
+
supportedModes: getEffectiveSupportedModes(cmd),
|
|
185450
|
+
subcommands: getCommandSubcommandNames(cmd),
|
|
185451
|
+
modelInvocable: cmd.modelInvocable === true
|
|
185452
|
+
}
|
|
185453
|
+
};
|
|
185454
|
+
});
|
|
185455
|
+
let availableSkills;
|
|
185456
|
+
try {
|
|
185457
|
+
const skillManager = config.getSkillManager();
|
|
185458
|
+
if (skillManager) {
|
|
185459
|
+
const skills = await skillManager.listSkills();
|
|
185460
|
+
availableSkills = skills.map((skill) => skill.name);
|
|
185461
|
+
}
|
|
185462
|
+
} catch (error) {
|
|
185463
|
+
debugLogger72.error("Error loading available skills:", error);
|
|
185464
|
+
}
|
|
185465
|
+
return {
|
|
185466
|
+
availableCommands,
|
|
185467
|
+
...availableSkills !== void 0 ? { availableSkills } : {}
|
|
185468
|
+
};
|
|
185469
|
+
}
|
|
185470
|
+
__name(buildAvailableCommandsSnapshot, "buildAvailableCommandsSnapshot");
|
|
185183
185471
|
var Session2 = class {
|
|
185184
185472
|
constructor(id, config, client, settings) {
|
|
185185
185473
|
this.config = config;
|
|
@@ -185249,6 +185537,10 @@ var Session2 = class {
|
|
|
185249
185537
|
* Delegates to HistoryReplayer for consistent event emission.
|
|
185250
185538
|
*/
|
|
185251
185539
|
async replayHistory(records) {
|
|
185540
|
+
this.turn = Math.max(
|
|
185541
|
+
this.turn,
|
|
185542
|
+
computeInitialTurnFromHistory(records, this.config.getSessionId())
|
|
185543
|
+
);
|
|
185252
185544
|
await this.historyReplayer.replay(records);
|
|
185253
185545
|
}
|
|
185254
185546
|
rewindToTurn(targetTurnIndex) {
|
|
@@ -186075,43 +186367,12 @@ var Session2 = class {
|
|
|
186075
186367
|
);
|
|
186076
186368
|
}
|
|
186077
186369
|
async sendAvailableCommandsUpdate() {
|
|
186078
|
-
const abortController = new AbortController();
|
|
186079
186370
|
try {
|
|
186080
|
-
const
|
|
186081
|
-
this.config,
|
|
186082
|
-
abortController.signal,
|
|
186083
|
-
"acp"
|
|
186084
|
-
);
|
|
186085
|
-
const availableCommands = slashCommands.map((cmd) => {
|
|
186086
|
-
const acceptsInput = cmd.kind !== "built-in" /* BUILT_IN */ || cmd.completion != null || cmd.argumentHint != null || cmd.subCommands != null && cmd.subCommands.length > 0;
|
|
186087
|
-
return {
|
|
186088
|
-
name: cmd.name,
|
|
186089
|
-
description: cmd.description,
|
|
186090
|
-
input: acceptsInput ? { hint: cmd.argumentHint ?? "" } : null,
|
|
186091
|
-
_meta: {
|
|
186092
|
-
argumentHint: cmd.argumentHint,
|
|
186093
|
-
source: cmd.source,
|
|
186094
|
-
sourceLabel: cmd.sourceLabel,
|
|
186095
|
-
supportedModes: getEffectiveSupportedModes(cmd),
|
|
186096
|
-
subcommands: getCommandSubcommandNames(cmd),
|
|
186097
|
-
modelInvocable: cmd.modelInvocable === true
|
|
186098
|
-
}
|
|
186099
|
-
};
|
|
186100
|
-
});
|
|
186101
|
-
let availableSkills;
|
|
186102
|
-
try {
|
|
186103
|
-
const skillManager = this.config.getSkillManager();
|
|
186104
|
-
if (skillManager) {
|
|
186105
|
-
const skills = await skillManager.listSkills();
|
|
186106
|
-
availableSkills = skills.map((skill) => skill.name);
|
|
186107
|
-
}
|
|
186108
|
-
} catch (error) {
|
|
186109
|
-
debugLogger72.error("Error loading available skills:", error);
|
|
186110
|
-
}
|
|
186371
|
+
const { availableCommands, availableSkills } = await buildAvailableCommandsSnapshot(this.config);
|
|
186111
186372
|
const update = {
|
|
186112
186373
|
sessionUpdate: "available_commands_update",
|
|
186113
186374
|
availableCommands,
|
|
186114
|
-
...availableSkills ? {
|
|
186375
|
+
...availableSkills !== void 0 ? {
|
|
186115
186376
|
_meta: {
|
|
186116
186377
|
availableSkills
|
|
186117
186378
|
}
|
|
@@ -186990,7 +187251,7 @@ var QwenAgent = class {
|
|
|
186990
187251
|
async initialize(args) {
|
|
186991
187252
|
this.clientCapabilities = args.clientCapabilities;
|
|
186992
187253
|
const authMethods = buildAuthMethods();
|
|
186993
|
-
const version = "0.
|
|
187254
|
+
const version = "0.16.0-preview.0";
|
|
186994
187255
|
return {
|
|
186995
187256
|
protocolVersion: PROTOCOL_VERSION,
|
|
186996
187257
|
agentInfo: {
|
|
@@ -187220,10 +187481,288 @@ var QwenAgent = class {
|
|
|
187220
187481
|
}
|
|
187221
187482
|
await session.cancelPendingPrompt();
|
|
187222
187483
|
}
|
|
187484
|
+
workspaceCwd(config) {
|
|
187485
|
+
return config.getTargetDir();
|
|
187486
|
+
}
|
|
187487
|
+
safeWorkspaceCwd(config) {
|
|
187488
|
+
try {
|
|
187489
|
+
return this.workspaceCwd(config);
|
|
187490
|
+
} catch {
|
|
187491
|
+
return "";
|
|
187492
|
+
}
|
|
187493
|
+
}
|
|
187494
|
+
mcpTransport(server) {
|
|
187495
|
+
if (server && typeof server === "object" && "type" in server && server.type === "sdk") {
|
|
187496
|
+
return "sdk";
|
|
187497
|
+
}
|
|
187498
|
+
if (server && typeof server === "object" && typeof server.httpUrl === "string") {
|
|
187499
|
+
return "http";
|
|
187500
|
+
}
|
|
187501
|
+
if (server && typeof server === "object" && typeof server.url === "string") {
|
|
187502
|
+
return "sse";
|
|
187503
|
+
}
|
|
187504
|
+
if (server && typeof server === "object" && typeof server.tcp === "string") {
|
|
187505
|
+
return "websocket";
|
|
187506
|
+
}
|
|
187507
|
+
if (server && typeof server === "object" && typeof server.command === "string") {
|
|
187508
|
+
return "stdio";
|
|
187509
|
+
}
|
|
187510
|
+
return "unknown";
|
|
187511
|
+
}
|
|
187512
|
+
mcpStatus(status) {
|
|
187513
|
+
switch (status) {
|
|
187514
|
+
case "connected" /* CONNECTED */:
|
|
187515
|
+
return "connected";
|
|
187516
|
+
case "connecting" /* CONNECTING */:
|
|
187517
|
+
return "connecting";
|
|
187518
|
+
case "disconnected" /* DISCONNECTED */:
|
|
187519
|
+
default:
|
|
187520
|
+
return "disconnected";
|
|
187521
|
+
}
|
|
187522
|
+
}
|
|
187523
|
+
mcpCellStatus(status, disabled) {
|
|
187524
|
+
if (disabled) return "disabled";
|
|
187525
|
+
switch (status) {
|
|
187526
|
+
case "connected" /* CONNECTED */:
|
|
187527
|
+
return "ok";
|
|
187528
|
+
case "connecting" /* CONNECTING */:
|
|
187529
|
+
return "warning";
|
|
187530
|
+
case "disconnected" /* DISCONNECTED */:
|
|
187531
|
+
default:
|
|
187532
|
+
return "error";
|
|
187533
|
+
}
|
|
187534
|
+
}
|
|
187535
|
+
discoveryState() {
|
|
187536
|
+
const state = getMCPDiscoveryState();
|
|
187537
|
+
switch (state) {
|
|
187538
|
+
case "in_progress" /* IN_PROGRESS */:
|
|
187539
|
+
return "in_progress";
|
|
187540
|
+
case "completed" /* COMPLETED */:
|
|
187541
|
+
return "completed";
|
|
187542
|
+
case "not_started" /* NOT_STARTED */:
|
|
187543
|
+
default:
|
|
187544
|
+
return "not_started";
|
|
187545
|
+
}
|
|
187546
|
+
}
|
|
187547
|
+
buildWorkspaceMcpStatus(config) {
|
|
187548
|
+
try {
|
|
187549
|
+
const workspaceCwd = this.workspaceCwd(config);
|
|
187550
|
+
const servers = config.getMcpServers() ?? {};
|
|
187551
|
+
return {
|
|
187552
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187553
|
+
workspaceCwd,
|
|
187554
|
+
initialized: true,
|
|
187555
|
+
discoveryState: this.discoveryState(),
|
|
187556
|
+
servers: Object.entries(servers).map(([name, server]) => {
|
|
187557
|
+
const disabled = config.isMcpServerDisabled(name);
|
|
187558
|
+
const rawStatus = getMCPServerStatus(name);
|
|
187559
|
+
const out = {
|
|
187560
|
+
kind: "mcp_server",
|
|
187561
|
+
status: this.mcpCellStatus(rawStatus, disabled),
|
|
187562
|
+
name,
|
|
187563
|
+
mcpStatus: this.mcpStatus(rawStatus),
|
|
187564
|
+
transport: this.mcpTransport(server),
|
|
187565
|
+
disabled
|
|
187566
|
+
};
|
|
187567
|
+
const description = server && typeof server === "object" ? server.description : void 0;
|
|
187568
|
+
const extensionName = server && typeof server === "object" ? server.extensionName : void 0;
|
|
187569
|
+
if (typeof description === "string") {
|
|
187570
|
+
out.description = description;
|
|
187571
|
+
}
|
|
187572
|
+
if (typeof extensionName === "string") {
|
|
187573
|
+
out.extensionName = extensionName;
|
|
187574
|
+
}
|
|
187575
|
+
return out;
|
|
187576
|
+
})
|
|
187577
|
+
};
|
|
187578
|
+
} catch (error) {
|
|
187579
|
+
return {
|
|
187580
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187581
|
+
workspaceCwd: this.safeWorkspaceCwd(config),
|
|
187582
|
+
initialized: true,
|
|
187583
|
+
servers: [],
|
|
187584
|
+
errors: [this.errorCell("mcp", error)]
|
|
187585
|
+
};
|
|
187586
|
+
}
|
|
187587
|
+
}
|
|
187588
|
+
errorCell(kind, error) {
|
|
187589
|
+
return {
|
|
187590
|
+
kind,
|
|
187591
|
+
status: "error",
|
|
187592
|
+
error: error instanceof Error ? error.message : String(error)
|
|
187593
|
+
};
|
|
187594
|
+
}
|
|
187595
|
+
async buildWorkspaceSkillsStatus(config) {
|
|
187596
|
+
const skillManager = config.getSkillManager();
|
|
187597
|
+
if (!skillManager) {
|
|
187598
|
+
return {
|
|
187599
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187600
|
+
workspaceCwd: this.workspaceCwd(config),
|
|
187601
|
+
initialized: true,
|
|
187602
|
+
skills: []
|
|
187603
|
+
};
|
|
187604
|
+
}
|
|
187605
|
+
try {
|
|
187606
|
+
const skills = await skillManager.listSkills();
|
|
187607
|
+
return {
|
|
187608
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187609
|
+
workspaceCwd: this.workspaceCwd(config),
|
|
187610
|
+
initialized: true,
|
|
187611
|
+
skills: skills.map((skill) => {
|
|
187612
|
+
const modelInvocable = skill.disableModelInvocation !== true;
|
|
187613
|
+
return {
|
|
187614
|
+
kind: "skill",
|
|
187615
|
+
status: modelInvocable ? "ok" : "disabled",
|
|
187616
|
+
name: skill.name,
|
|
187617
|
+
description: skill.description,
|
|
187618
|
+
level: skill.level,
|
|
187619
|
+
modelInvocable,
|
|
187620
|
+
...skill.argumentHint ? { argumentHint: skill.argumentHint } : {},
|
|
187621
|
+
...skill.model ? { model: skill.model } : {},
|
|
187622
|
+
...skill.extensionName ? { extensionName: skill.extensionName } : {}
|
|
187623
|
+
};
|
|
187624
|
+
})
|
|
187625
|
+
};
|
|
187626
|
+
} catch (error) {
|
|
187627
|
+
return {
|
|
187628
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187629
|
+
workspaceCwd: this.workspaceCwd(config),
|
|
187630
|
+
initialized: true,
|
|
187631
|
+
skills: [],
|
|
187632
|
+
errors: [this.errorCell("skills", error)]
|
|
187633
|
+
};
|
|
187634
|
+
}
|
|
187635
|
+
}
|
|
187636
|
+
buildWorkspaceProvidersStatus(config) {
|
|
187637
|
+
try {
|
|
187638
|
+
const workspaceCwd = this.workspaceCwd(config);
|
|
187639
|
+
const currentAuthType = config.getAuthType?.();
|
|
187640
|
+
const activeRuntimeSnapshot = config.getActiveRuntimeModelSnapshot?.();
|
|
187641
|
+
const currentModelId = activeRuntimeSnapshot ? activeRuntimeSnapshot.id : (config.getModel() || "").trim();
|
|
187642
|
+
const hasCurrentModel = currentModelId.length > 0;
|
|
187643
|
+
const currentAuth = activeRuntimeSnapshot?.authType ?? currentAuthType;
|
|
187644
|
+
const currentAcpModelId = hasCurrentModel && currentAuth ? formatAcpModelId(currentModelId, currentAuth) : currentModelId || void 0;
|
|
187645
|
+
const providers = /* @__PURE__ */ new Map();
|
|
187646
|
+
for (const model of config.getAllConfiguredModels()) {
|
|
187647
|
+
const authType = String(model.authType);
|
|
187648
|
+
let provider = providers.get(authType);
|
|
187649
|
+
if (!provider) {
|
|
187650
|
+
provider = {
|
|
187651
|
+
kind: "model_provider",
|
|
187652
|
+
status: "ok",
|
|
187653
|
+
authType,
|
|
187654
|
+
current: false,
|
|
187655
|
+
models: []
|
|
187656
|
+
};
|
|
187657
|
+
providers.set(authType, provider);
|
|
187658
|
+
}
|
|
187659
|
+
const effectiveModelId = model.isRuntimeModel && model.runtimeSnapshotId ? model.runtimeSnapshotId : model.id;
|
|
187660
|
+
const modelId = formatAcpModelId(effectiveModelId, model.authType);
|
|
187661
|
+
const isCurrent = currentAuth === model.authType && hasCurrentModel && (currentModelId === effectiveModelId || currentModelId === model.id || currentAcpModelId === modelId);
|
|
187662
|
+
const providerModel = {
|
|
187663
|
+
modelId,
|
|
187664
|
+
baseModelId: parseAcpBaseModelId(effectiveModelId),
|
|
187665
|
+
name: model.label,
|
|
187666
|
+
...model.description !== void 0 ? { description: model.description } : {},
|
|
187667
|
+
contextLimit: model.contextWindowSize ?? tokenLimit(effectiveModelId),
|
|
187668
|
+
isCurrent,
|
|
187669
|
+
isRuntime: model.isRuntimeModel === true
|
|
187670
|
+
};
|
|
187671
|
+
provider.models.push(providerModel);
|
|
187672
|
+
if (isCurrent) provider.current = true;
|
|
187673
|
+
}
|
|
187674
|
+
return {
|
|
187675
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187676
|
+
workspaceCwd,
|
|
187677
|
+
initialized: true,
|
|
187678
|
+
...currentAuth || currentAcpModelId ? {
|
|
187679
|
+
current: {
|
|
187680
|
+
...currentAuth ? { authType: String(currentAuth) } : {},
|
|
187681
|
+
...currentAcpModelId ? { modelId: currentAcpModelId } : {}
|
|
187682
|
+
}
|
|
187683
|
+
} : {},
|
|
187684
|
+
providers: [...providers.values()]
|
|
187685
|
+
};
|
|
187686
|
+
} catch (error) {
|
|
187687
|
+
return {
|
|
187688
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187689
|
+
workspaceCwd: this.safeWorkspaceCwd(config),
|
|
187690
|
+
initialized: true,
|
|
187691
|
+
providers: [],
|
|
187692
|
+
errors: [this.errorCell("providers", error)]
|
|
187693
|
+
};
|
|
187694
|
+
}
|
|
187695
|
+
}
|
|
187696
|
+
sessionOrThrow(sessionId) {
|
|
187697
|
+
const session = this.sessions.get(sessionId);
|
|
187698
|
+
if (!session) {
|
|
187699
|
+
throw RequestError.invalidParams(
|
|
187700
|
+
void 0,
|
|
187701
|
+
`Session not found for id: ${sessionId}`
|
|
187702
|
+
);
|
|
187703
|
+
}
|
|
187704
|
+
return session;
|
|
187705
|
+
}
|
|
187706
|
+
buildSessionContextStatus(sessionId) {
|
|
187707
|
+
const session = this.sessionOrThrow(sessionId);
|
|
187708
|
+
const config = session.getConfig();
|
|
187709
|
+
return {
|
|
187710
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187711
|
+
sessionId,
|
|
187712
|
+
workspaceCwd: this.workspaceCwd(config),
|
|
187713
|
+
state: {
|
|
187714
|
+
models: this.buildAvailableModels(config),
|
|
187715
|
+
modes: this.buildModesData(config),
|
|
187716
|
+
configOptions: this.buildConfigOptions(config)
|
|
187717
|
+
}
|
|
187718
|
+
};
|
|
187719
|
+
}
|
|
187720
|
+
async buildSessionSupportedCommandsStatus(sessionId) {
|
|
187721
|
+
const session = this.sessionOrThrow(sessionId);
|
|
187722
|
+
const { availableCommands, availableSkills } = await buildAvailableCommandsSnapshot(session.getConfig());
|
|
187723
|
+
return {
|
|
187724
|
+
v: STATUS_SCHEMA_VERSION,
|
|
187725
|
+
sessionId,
|
|
187726
|
+
availableCommands,
|
|
187727
|
+
availableSkills: availableSkills ?? []
|
|
187728
|
+
};
|
|
187729
|
+
}
|
|
187223
187730
|
async extMethod(method, params) {
|
|
187224
187731
|
const cwd5 = params["cwd"] || process.cwd();
|
|
187225
187732
|
const SESSION_ID_RE = /^[0-9a-fA-F-]{32,36}$/;
|
|
187226
187733
|
switch (method) {
|
|
187734
|
+
case SERVE_STATUS_EXT_METHODS.workspaceMcp:
|
|
187735
|
+
return this.buildWorkspaceMcpStatus(this.config);
|
|
187736
|
+
case SERVE_STATUS_EXT_METHODS.workspaceSkills:
|
|
187737
|
+
return await this.buildWorkspaceSkillsStatus(
|
|
187738
|
+
this.config
|
|
187739
|
+
);
|
|
187740
|
+
case SERVE_STATUS_EXT_METHODS.workspaceProviders:
|
|
187741
|
+
return this.buildWorkspaceProvidersStatus(
|
|
187742
|
+
this.config
|
|
187743
|
+
);
|
|
187744
|
+
case SERVE_STATUS_EXT_METHODS.sessionContext: {
|
|
187745
|
+
const sessionId = params["sessionId"];
|
|
187746
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
187747
|
+
throw RequestError.invalidParams(
|
|
187748
|
+
void 0,
|
|
187749
|
+
"Invalid or missing sessionId"
|
|
187750
|
+
);
|
|
187751
|
+
}
|
|
187752
|
+
return this.buildSessionContextStatus(sessionId);
|
|
187753
|
+
}
|
|
187754
|
+
case SERVE_STATUS_EXT_METHODS.sessionSupportedCommands: {
|
|
187755
|
+
const sessionId = params["sessionId"];
|
|
187756
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
187757
|
+
throw RequestError.invalidParams(
|
|
187758
|
+
void 0,
|
|
187759
|
+
"Invalid or missing sessionId"
|
|
187760
|
+
);
|
|
187761
|
+
}
|
|
187762
|
+
return await this.buildSessionSupportedCommandsStatus(
|
|
187763
|
+
sessionId
|
|
187764
|
+
);
|
|
187765
|
+
}
|
|
187227
187766
|
case "deleteSession": {
|
|
187228
187767
|
const sessionId = params["sessionId"];
|
|
187229
187768
|
if (!sessionId || !SESSION_ID_RE.test(sessionId)) {
|