@qwen-code/qwen-code 0.18.0-preview.2 → 0.18.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/bundled/loop/SKILL.md +2 -1
- package/bundled/qc-helper/docs/_meta.ts +1 -0
- package/bundled/qc-helper/docs/configuration/auth.md +1 -1
- package/bundled/qc-helper/docs/configuration/model-providers.md +12 -5
- package/bundled/qc-helper/docs/configuration/settings.md +33 -32
- package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
- package/bundled/qc-helper/docs/features/commands.md +33 -11
- package/bundled/qc-helper/docs/features/dual-output.md +37 -3
- package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
- package/bundled/qc-helper/docs/features/skills.md +29 -3
- package/bundled/qc-helper/docs/features/sub-agents.md +34 -12
- package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
- package/bundled/qc-helper/docs/qwen-serve.md +246 -28
- package/chunks/{agent-QB7TZ4HW.js → agent-XT7NHZ5H.js} +25 -24
- package/chunks/agent-headless-LNRE63ZL.js +51 -0
- package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-DCI26OQF.js} +7 -7
- package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-ITYUTWLR.js} +45 -3
- package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
- package/chunks/{chunk-CWV3SJZS.js → chunk-3NRO6NHX.js} +2 -2
- package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
- package/chunks/{chunk-QCG6KPNM.js → chunk-6T7Y7USE.js} +18017 -11621
- package/chunks/{chunk-CNHFPN7T.js → chunk-7KPZFE5A.js} +1 -1
- package/chunks/{chunk-2ZTWI7KH.js → chunk-A2ZIEEGJ.js} +30 -22
- package/chunks/{chunk-JUGRPQAB.js → chunk-B4ZF2KSI.js} +1 -1
- package/chunks/chunk-BJ5HQ23U.js +178 -0
- package/chunks/{chunk-HXJE7VOG.js → chunk-BXYRCW2C.js} +1074 -144
- package/chunks/{chunk-ICOI4E4S.js → chunk-CPVI5J2L.js} +101 -23
- package/chunks/{chunk-HV3ZZ7G4.js → chunk-DHZREJTG.js} +2 -2
- package/chunks/{chunk-GX7VH5JQ.js → chunk-FIQECJTQ.js} +1 -1
- package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
- package/chunks/{chunk-JXAZUMDW.js → chunk-HA2UEYZP.js} +7 -4
- package/chunks/{chunk-USE2VQ5P.js → chunk-HED55F43.js} +26 -1
- package/chunks/{chunk-PAEBHDIO.js → chunk-HQUWWSSP.js} +1 -1
- package/chunks/{chunk-MVIVIPCU.js → chunk-IDYDPBBN.js} +361 -583
- package/chunks/{chunk-JVQOQ3OU.js → chunk-IQHSD7K5.js} +1 -1
- package/chunks/{chunk-NW5QBUYO.js → chunk-IS7UA4W3.js} +14 -14
- package/chunks/{chunk-UAMOBVVW.js → chunk-LXYWINWF.js} +1 -1
- package/chunks/{chunk-P4J26VDS.js → chunk-LYRSMKLS.js} +2 -2
- package/chunks/{chunk-Y7R6H6FT.js → chunk-LYSND7KR.js} +9 -4
- package/chunks/{chunk-LR62TEET.js → chunk-NNIYWQIS.js} +1 -1
- package/chunks/chunk-OMX7CUOE.js +356 -0
- package/chunks/{chunk-CNSMKPK6.js → chunk-QILTEBWS.js} +1 -1
- package/chunks/chunk-QQDPRDVW.js +25 -0
- package/chunks/{chunk-ZK4AMNIU.js → chunk-RON7LFNH.js} +1294 -314
- package/chunks/chunk-SFRV6BGY.js +243 -0
- package/chunks/{chunk-AVW55ZCO.js → chunk-WJ3SND6W.js} +37 -16
- package/chunks/{chunk-HGJPQK33.js → chunk-WPTCDQN6.js} +188 -534
- package/chunks/{chunk-7YKXFA3D.js → chunk-XZTNBSMW.js} +11 -11
- package/chunks/{chunk-C6WMLUNB.js → chunk-Y7KMDUEP.js} +1 -1
- package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
- package/chunks/{chunk-KC6ZMJ5X.js → chunk-ZMIBJS45.js} +1 -1
- package/chunks/chunk-ZOFNJQNJ.js +607 -0
- package/chunks/computer-use-4YX3JGBV.js +2052 -0
- package/chunks/contextCommand-KS2H7MW5.js +53 -0
- package/chunks/cron-create-CAPUKK7I.js +184 -0
- package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-G3KAR26Q.js} +28 -5
- package/chunks/{cron-list-QNNZGMN3.js → cron-list-ZA4ZIUS5.js} +40 -7
- package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
- package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
- package/chunks/{dist-ZMQ4TXD5.js → dist-7YWFWOCJ.js} +2 -2
- package/chunks/{dist-R2SXPG74.js → dist-VEGFONCF.js} +2 -2
- package/chunks/{dist-TE5QKMGR.js → dist-X4EXN7W6.js} +1 -1
- package/chunks/{dist-BXDUQ2QY.js → dist-YLS6NI7H.js} +1 -1
- package/chunks/{edit-6UBTS2J5.js → edit-2ARPEO4B.js} +26 -25
- package/chunks/{en-HSQQNQUB.js → en-VP6XPGEC.js} +9 -2
- package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-IXNXNAW5.js} +25 -24
- package/chunks/enterPlanMode-TAKAGAYP.js +159 -0
- package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-LHTRV7ML.js} +25 -24
- package/chunks/exitPlanMode-MK5UAITL.js +743 -0
- package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
- package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-HFJIGO77.js} +7 -7
- package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
- package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
- package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
- package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
- package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
- package/chunks/{glob-OLCX57MD.js → glob-I2USLUSC.js} +25 -24
- package/chunks/{grep-7HXIMDOW.js → grep-WBIF7THR.js} +37 -30
- package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
- package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-QSTRHKKL.js} +3 -3
- package/chunks/{ls-6PEZUK6O.js → ls-2R5RHLX5.js} +4 -4
- package/chunks/{lsp-JZSJOVT7.js → lsp-XKH6ZIAN.js} +3 -3
- package/chunks/{monitor-SQO7MVAV.js → monitor-WU7UFATU.js} +25 -24
- package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-KUHYPXEM.js} +26 -25
- package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-5PLHYJQL.js} +15 -15
- package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
- package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-TSKW73KY.js} +27 -26
- package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-KK433U33.js} +6 -5
- package/chunks/{read-file-UA64EEQC.js → read-file-VIPF2PS6.js} +11 -11
- package/chunks/ripGrep-XLIZTYE7.js +49 -0
- package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
- package/chunks/{scheduler-VBASHOCA.js → scheduler-O66SLJGU.js} +25 -24
- package/chunks/{send-message-OYJZ5TPG.js → send-message-CTME7DXD.js} +3 -3
- package/chunks/{serve-A7E2OJDR.js → serve-BWOLYT62.js} +13164 -3840
- package/chunks/{shell-3NFOT6F5.js → shell-XE7UYKOO.js} +25 -24
- package/chunks/{skill-RA5YUREY.js → skill-RZWM6XMC.js} +64 -113
- package/chunks/{src-NFCMARMT.js → src-L5P7K4MH.js} +176 -44
- package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-ZJGSU7OQ.js} +4 -4
- package/chunks/{task-create-Y3ZKTJIG.js → task-create-EE6JEM7G.js} +8 -7
- package/chunks/{task-list-ONXJ3I3A.js → task-list-EESYAC65.js} +7 -6
- package/chunks/{task-stop-UHDC4N5B.js → task-stop-XZVCFFYY.js} +3 -3
- package/chunks/{task-update-TCNOU3P5.js → task-update-EIO4HNE3.js} +21 -9
- package/chunks/{team-create-6SR4OVRG.js → team-create-R2H7Y3SG.js} +28 -26
- package/chunks/{team-delete-EJ4U4DDP.js → team-delete-A7LXPGV7.js} +9 -6
- package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-VRKSGAWM.js} +5 -5
- package/chunks/{tool-search-OD435A3X.js → tool-search-USSQMTMS.js} +11 -11
- package/chunks/{web-fetch-6W67H5PO.js → web-fetch-GHAZUA54.js} +5 -5
- package/chunks/workflow-5LNNLNUR.js +1414 -0
- package/chunks/{write-file-475L5OPP.js → write-file-2I7HP24C.js} +26 -25
- package/chunks/{zh-VCLWO26Y.js → zh-OIXDDQHB.js} +10 -3
- package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-6YFNCKTA.js} +10 -3
- package/cli-entry.js +19 -0
- package/cli.js +11064 -6628
- package/examples/starter/QWEN.md +30 -0
- package/examples/starter/README.md +59 -0
- package/examples/starter/agents/diary.md +86 -0
- package/examples/starter/commands/writing/polish.md +13 -0
- package/examples/starter/example.ts +64 -0
- package/examples/starter/package.json +18 -0
- package/examples/starter/qwen-extension.json +12 -0
- package/examples/starter/skills/synonyms/SKILL.md +48 -0
- package/examples/starter/tsconfig.json +13 -0
- package/fzfWorker.js +1083 -0
- package/locales/ca.js +20 -2
- package/locales/de.js +21 -2
- package/locales/en.js +13 -4
- package/locales/fr.js +22 -2
- package/locales/ja.js +22 -2
- package/locales/pt.js +21 -2
- package/locales/ru.js +20 -2
- package/locales/zh-TW.js +11 -4
- package/locales/zh.js +11 -4
- package/package.json +5 -3
- package/chunks/agent-headless-APVHH7QM.js +0 -50
- package/chunks/chunk-AJIR24J2.js +0 -59
- package/chunks/chunk-SKBPNJEW.js +0 -45
- package/chunks/chunk-XBFVXFB2.js +0 -216
- package/chunks/computer-use-B7VIUI7F.js +0 -825
- package/chunks/contextCommand-63RZ3O5R.js +0 -52
- package/chunks/cron-create-FI5LJVUS.js +0 -140
- package/chunks/exitPlanMode-H323NHB2.js +0 -235
- package/chunks/ripGrep-WSYCWZVK.js +0 -48
- package/chunks/workflow-62DHH4EO.js +0 -708
|
@@ -6,30 +6,32 @@ import {
|
|
|
6
6
|
getLanguageSettingsOptions,
|
|
7
7
|
t,
|
|
8
8
|
writeStderrLine
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XZTNBSMW.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_STOP_HOOK_BLOCK_CAP,
|
|
12
|
+
DEFAULT_TOOL_OUTPUT_BATCH_BUDGET,
|
|
13
|
+
DEFAULT_TOOL_RESULTS_TOTAL_CHARS_THRESHOLD,
|
|
12
14
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
|
|
13
15
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
|
14
16
|
IdeClient,
|
|
15
17
|
SkillError,
|
|
16
18
|
ideContextStore,
|
|
17
19
|
require_main
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-6T7Y7USE.js";
|
|
19
21
|
import {
|
|
20
22
|
isWithinRoot,
|
|
21
23
|
stripRuntimeSnapshotPrefix
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RON7LFNH.js";
|
|
23
25
|
import {
|
|
24
26
|
atomicWriteFileSync
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LXYWINWF.js";
|
|
26
28
|
import {
|
|
27
29
|
FatalConfigError,
|
|
28
30
|
QWEN_DIR,
|
|
29
31
|
Storage,
|
|
30
32
|
createDebugLogger,
|
|
31
33
|
getErrorMessage
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-HA2UEYZP.js";
|
|
33
35
|
import {
|
|
34
36
|
init_esbuild_shims
|
|
35
37
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -12001,13 +12003,13 @@ var require_hosts = __commonJS({
|
|
|
12001
12003
|
var defaults = {
|
|
12002
12004
|
sshtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin("#", committish)}`, "sshtemplate"),
|
|
12003
12005
|
sshurltemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "sshurltemplate"),
|
|
12004
|
-
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, editpath, path:
|
|
12006
|
+
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, editpath, path: path9 }) => `https://${domain}/${user}/${project}${maybeJoin("/", editpath, "/", maybeEncode(committish || "HEAD"), "/", path9)}`, "edittemplate"),
|
|
12005
12007
|
browsetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}`, "browsetemplate"),
|
|
12006
|
-
browsetreetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, treepath, path:
|
|
12007
|
-
browseblobtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, blobpath, path:
|
|
12008
|
+
browsetreetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, treepath, path: path9, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || "HEAD")}/${path9}${maybeJoin("#", hashformat(fragment || ""))}`, "browsetreetemplate"),
|
|
12009
|
+
browseblobtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, blobpath, path: path9, fragment, hashformat }) => `https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish || "HEAD")}/${path9}${maybeJoin("#", hashformat(fragment || ""))}`, "browseblobtemplate"),
|
|
12008
12010
|
docstemplate: /* @__PURE__ */ __name(({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}#readme`, "docstemplate"),
|
|
12009
12011
|
httpstemplate: /* @__PURE__ */ __name(({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "httpstemplate"),
|
|
12010
|
-
filetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, path:
|
|
12012
|
+
filetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, path: path9 }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish || "HEAD")}/${path9}`, "filetemplate"),
|
|
12011
12013
|
shortcuttemplate: /* @__PURE__ */ __name(({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin("#", committish)}`, "shortcuttemplate"),
|
|
12012
12014
|
pathtemplate: /* @__PURE__ */ __name(({ user, project, committish }) => `${user}/${project}${maybeJoin("#", committish)}`, "pathtemplate"),
|
|
12013
12015
|
bugstemplate: /* @__PURE__ */ __name(({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`, "bugstemplate"),
|
|
@@ -12022,7 +12024,7 @@ var require_hosts = __commonJS({
|
|
|
12022
12024
|
treepath: "tree",
|
|
12023
12025
|
blobpath: "blob",
|
|
12024
12026
|
editpath: "edit",
|
|
12025
|
-
filetemplate: /* @__PURE__ */ __name(({ auth, user, project, committish, path:
|
|
12027
|
+
filetemplate: /* @__PURE__ */ __name(({ auth, user, project, committish, path: path9 }) => `https://${maybeJoin(auth, "@")}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish || "HEAD")}/${path9}`, "filetemplate"),
|
|
12026
12028
|
gittemplate: /* @__PURE__ */ __name(({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "gittemplate"),
|
|
12027
12029
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`, "tarballtemplate"),
|
|
12028
12030
|
extract: /* @__PURE__ */ __name((url) => {
|
|
@@ -12048,7 +12050,7 @@ var require_hosts = __commonJS({
|
|
|
12048
12050
|
treepath: "src",
|
|
12049
12051
|
blobpath: "src",
|
|
12050
12052
|
editpath: "?mode=edit",
|
|
12051
|
-
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, treepath, path:
|
|
12053
|
+
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, treepath, path: path9, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish || "HEAD"), "/", path9, editpath)}`, "edittemplate"),
|
|
12052
12054
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish || "HEAD")}.tar.gz`, "tarballtemplate"),
|
|
12053
12055
|
extract: /* @__PURE__ */ __name((url) => {
|
|
12054
12056
|
let [, user, project, aux] = url.pathname.split("/", 4);
|
|
@@ -12073,11 +12075,11 @@ var require_hosts = __commonJS({
|
|
|
12073
12075
|
httpstemplate: /* @__PURE__ */ __name(({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "httpstemplate"),
|
|
12074
12076
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish || "HEAD")}`, "tarballtemplate"),
|
|
12075
12077
|
extract: /* @__PURE__ */ __name((url) => {
|
|
12076
|
-
const
|
|
12077
|
-
if (
|
|
12078
|
+
const path9 = url.pathname.slice(1);
|
|
12079
|
+
if (path9.includes("/-/") || path9.includes("/archive.tar.gz")) {
|
|
12078
12080
|
return;
|
|
12079
12081
|
}
|
|
12080
|
-
const segments =
|
|
12082
|
+
const segments = path9.split("/");
|
|
12081
12083
|
let project = segments.pop();
|
|
12082
12084
|
if (project.endsWith(".git")) {
|
|
12083
12085
|
project = project.slice(0, -4);
|
|
@@ -12097,11 +12099,11 @@ var require_hosts = __commonJS({
|
|
|
12097
12099
|
sshurltemplate: /* @__PURE__ */ __name(({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin("#", committish)}`, "sshurltemplate"),
|
|
12098
12100
|
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", maybeEncode(committish))}/${editpath}`, "edittemplate"),
|
|
12099
12101
|
browsetemplate: /* @__PURE__ */ __name(({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`, "browsetemplate"),
|
|
12100
|
-
browsetreetemplate: /* @__PURE__ */ __name(({ domain, project, committish, path:
|
|
12101
|
-
browseblobtemplate: /* @__PURE__ */ __name(({ domain, project, committish, path:
|
|
12102
|
+
browsetreetemplate: /* @__PURE__ */ __name(({ domain, project, committish, path: path9, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path9))}`, "browsetreetemplate"),
|
|
12103
|
+
browseblobtemplate: /* @__PURE__ */ __name(({ domain, project, committish, path: path9, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path9))}`, "browseblobtemplate"),
|
|
12102
12104
|
docstemplate: /* @__PURE__ */ __name(({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`, "docstemplate"),
|
|
12103
12105
|
httpstemplate: /* @__PURE__ */ __name(({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin("#", committish)}`, "httpstemplate"),
|
|
12104
|
-
filetemplate: /* @__PURE__ */ __name(({ user, project, committish, path:
|
|
12106
|
+
filetemplate: /* @__PURE__ */ __name(({ user, project, committish, path: path9 }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin("/", maybeEncode(committish))}/${path9}`, "filetemplate"),
|
|
12105
12107
|
shortcuttemplate: /* @__PURE__ */ __name(({ type, project, committish }) => `${type}:${project}${maybeJoin("#", committish)}`, "shortcuttemplate"),
|
|
12106
12108
|
pathtemplate: /* @__PURE__ */ __name(({ project, committish }) => `${project}${maybeJoin("#", committish)}`, "pathtemplate"),
|
|
12107
12109
|
bugstemplate: /* @__PURE__ */ __name(({ domain, project }) => `https://${domain}/${project}`, "bugstemplate"),
|
|
@@ -12133,7 +12135,7 @@ var require_hosts = __commonJS({
|
|
|
12133
12135
|
domain: "git.sr.ht",
|
|
12134
12136
|
treepath: "tree",
|
|
12135
12137
|
blobpath: "tree",
|
|
12136
|
-
filetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, path:
|
|
12138
|
+
filetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, path: path9 }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || "HEAD"}/${path9}`, "filetemplate"),
|
|
12137
12139
|
httpstemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "httpstemplate"),
|
|
12138
12140
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || "HEAD"}.tar.gz`, "tarballtemplate"),
|
|
12139
12141
|
bugstemplate: /* @__PURE__ */ __name(() => null, "bugstemplate"),
|
|
@@ -12327,8 +12329,8 @@ var require_lib3 = __commonJS({
|
|
|
12327
12329
|
return null;
|
|
12328
12330
|
}
|
|
12329
12331
|
const proto = /(?:git\+)http:$/.test(protocol) ? "http:" : "https:";
|
|
12330
|
-
const
|
|
12331
|
-
return `${proto}//${hostname}${
|
|
12332
|
+
const path9 = pathname.replace(/\.git$/, "");
|
|
12333
|
+
return `${proto}//${hostname}${path9}`;
|
|
12332
12334
|
} catch {
|
|
12333
12335
|
return null;
|
|
12334
12336
|
}
|
|
@@ -12424,25 +12426,25 @@ var require_lib3 = __commonJS({
|
|
|
12424
12426
|
sshurl(opts) {
|
|
12425
12427
|
return this.#fill(this.sshurltemplate, opts);
|
|
12426
12428
|
}
|
|
12427
|
-
browse(
|
|
12428
|
-
if (typeof
|
|
12429
|
-
return this.#fill(this.browsetemplate,
|
|
12429
|
+
browse(path9, ...args) {
|
|
12430
|
+
if (typeof path9 !== "string") {
|
|
12431
|
+
return this.#fill(this.browsetemplate, path9);
|
|
12430
12432
|
}
|
|
12431
12433
|
if (typeof args[0] !== "string") {
|
|
12432
|
-
return this.#fill(this.browsetreetemplate, { ...args[0], path:
|
|
12434
|
+
return this.#fill(this.browsetreetemplate, { ...args[0], path: path9 });
|
|
12433
12435
|
}
|
|
12434
|
-
return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path:
|
|
12436
|
+
return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path: path9 });
|
|
12435
12437
|
}
|
|
12436
12438
|
// If the path is known to be a file, then browseFile should be used. For some hosts
|
|
12437
12439
|
// the url is the same as browse, but for others like GitHub a file can use both `/tree/`
|
|
12438
12440
|
// and `/blob/` in the path. When using a default committish of `HEAD` then the `/tree/`
|
|
12439
12441
|
// path will redirect to a specific commit. Using the `/blob/` path avoids this and
|
|
12440
12442
|
// does not redirect to a different commit.
|
|
12441
|
-
browseFile(
|
|
12443
|
+
browseFile(path9, ...args) {
|
|
12442
12444
|
if (typeof args[0] !== "string") {
|
|
12443
|
-
return this.#fill(this.browseblobtemplate, { ...args[0], path:
|
|
12445
|
+
return this.#fill(this.browseblobtemplate, { ...args[0], path: path9 });
|
|
12444
12446
|
}
|
|
12445
|
-
return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path:
|
|
12447
|
+
return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path: path9 });
|
|
12446
12448
|
}
|
|
12447
12449
|
docs(opts) {
|
|
12448
12450
|
return this.#fill(this.docstemplate, opts);
|
|
@@ -12465,11 +12467,11 @@ var require_lib3 = __commonJS({
|
|
|
12465
12467
|
tarball(opts) {
|
|
12466
12468
|
return this.#fill(this.tarballtemplate, { ...opts, noCommittish: false });
|
|
12467
12469
|
}
|
|
12468
|
-
file(
|
|
12469
|
-
return this.#fill(this.filetemplate, { ...opts, path:
|
|
12470
|
+
file(path9, opts) {
|
|
12471
|
+
return this.#fill(this.filetemplate, { ...opts, path: path9 });
|
|
12470
12472
|
}
|
|
12471
|
-
edit(
|
|
12472
|
-
return this.#fill(this.edittemplate, { ...opts, path:
|
|
12473
|
+
edit(path9, opts) {
|
|
12474
|
+
return this.#fill(this.edittemplate, { ...opts, path: path9 });
|
|
12473
12475
|
}
|
|
12474
12476
|
getDefaultRepresentation() {
|
|
12475
12477
|
return this.default;
|
|
@@ -13122,6 +13124,11 @@ var DEFAULT_RING_SIZE = 8e3;
|
|
|
13122
13124
|
var WARN_THRESHOLD_RATIO = 0.75;
|
|
13123
13125
|
var WARN_RESET_RATIO = 0.375;
|
|
13124
13126
|
var DEFAULT_MAX_SUBSCRIBERS = 64;
|
|
13127
|
+
function getServerTimestamp(meta) {
|
|
13128
|
+
const existing = meta?.["serverTimestamp"];
|
|
13129
|
+
return typeof existing === "number" && Number.isFinite(existing) ? existing : Date.now();
|
|
13130
|
+
}
|
|
13131
|
+
__name(getServerTimestamp, "getServerTimestamp");
|
|
13125
13132
|
var SubscriberLimitExceededError = class extends Error {
|
|
13126
13133
|
static {
|
|
13127
13134
|
__name(this, "SubscriberLimitExceededError");
|
|
@@ -13134,9 +13141,10 @@ var SubscriberLimitExceededError = class extends Error {
|
|
|
13134
13141
|
}
|
|
13135
13142
|
};
|
|
13136
13143
|
var EventBus = class {
|
|
13137
|
-
constructor(ringSize = DEFAULT_RING_SIZE, maxSubscribers = DEFAULT_MAX_SUBSCRIBERS) {
|
|
13144
|
+
constructor(ringSize = DEFAULT_RING_SIZE, maxSubscribers = DEFAULT_MAX_SUBSCRIBERS, compactionEngine) {
|
|
13138
13145
|
this.ringSize = ringSize;
|
|
13139
13146
|
this.maxSubscribers = maxSubscribers;
|
|
13147
|
+
this.compactionEngine = compactionEngine;
|
|
13140
13148
|
}
|
|
13141
13149
|
static {
|
|
13142
13150
|
__name(this, "EventBus");
|
|
@@ -13145,6 +13153,9 @@ var EventBus = class {
|
|
|
13145
13153
|
ring = [];
|
|
13146
13154
|
subs = /* @__PURE__ */ new Set();
|
|
13147
13155
|
closed = false;
|
|
13156
|
+
snapshotReplay() {
|
|
13157
|
+
return this.compactionEngine?.snapshot();
|
|
13158
|
+
}
|
|
13148
13159
|
/** Most recent id ever assigned by `publish`. 0 if no events published. */
|
|
13149
13160
|
get lastEventId() {
|
|
13150
13161
|
return this.nextId - 1;
|
|
@@ -13158,7 +13169,7 @@ var EventBus = class {
|
|
|
13158
13169
|
* (with `id` + `v` assigned) on success, or `undefined` when the
|
|
13159
13170
|
* bus is closed.
|
|
13160
13171
|
*
|
|
13161
|
-
* **Never throws** (
|
|
13172
|
+
* **Never throws** (never-throws contract). Closing the bus mid-publish
|
|
13162
13173
|
* is the only abnormal path and is handled as a return-undefined
|
|
13163
13174
|
* no-op; subscriber-enqueue failures are caught internally and
|
|
13164
13175
|
* translated to per-subscriber eviction. Call sites can rely on
|
|
@@ -13169,12 +13180,21 @@ var EventBus = class {
|
|
|
13169
13180
|
*/
|
|
13170
13181
|
publish(input) {
|
|
13171
13182
|
if (this.closed) return void 0;
|
|
13183
|
+
const existingMeta = input._meta;
|
|
13172
13184
|
const event = {
|
|
13173
13185
|
id: this.nextId++,
|
|
13174
13186
|
v: EVENT_SCHEMA_VERSION,
|
|
13175
|
-
...input
|
|
13187
|
+
...input,
|
|
13188
|
+
_meta: {
|
|
13189
|
+
...existingMeta ?? {},
|
|
13190
|
+
serverTimestamp: getServerTimestamp(existingMeta)
|
|
13191
|
+
}
|
|
13176
13192
|
};
|
|
13177
13193
|
this.ring.push(event);
|
|
13194
|
+
try {
|
|
13195
|
+
this.compactionEngine?.ingest(event);
|
|
13196
|
+
} catch {
|
|
13197
|
+
}
|
|
13178
13198
|
if (this.ring.length > this.ringSize) this.ring.shift();
|
|
13179
13199
|
for (const sub of Array.from(this.subs)) {
|
|
13180
13200
|
if (sub.evicted) continue;
|
|
@@ -13247,11 +13267,61 @@ var EventBus = class {
|
|
|
13247
13267
|
};
|
|
13248
13268
|
this.subs.add(sub);
|
|
13249
13269
|
if (opts.lastEventId !== void 0) {
|
|
13270
|
+
const epochReset = opts.lastEventId >= this.nextId;
|
|
13271
|
+
if (epochReset) {
|
|
13272
|
+
queue.forcePush({
|
|
13273
|
+
v: EVENT_SCHEMA_VERSION,
|
|
13274
|
+
type: "state_resync_required",
|
|
13275
|
+
data: {
|
|
13276
|
+
reason: "epoch_reset",
|
|
13277
|
+
lastDeliveredId: opts.lastEventId,
|
|
13278
|
+
// Ring is typically empty right after a restart; fall back to
|
|
13279
|
+
// `nextId` (the first id this epoch will assign) so the field
|
|
13280
|
+
// stays meaningful ("fresh sequence starts here").
|
|
13281
|
+
earliestAvailableId: this.ring[0]?.id ?? this.nextId
|
|
13282
|
+
}
|
|
13283
|
+
});
|
|
13284
|
+
} else {
|
|
13285
|
+
const earliestInRing = this.ring[0]?.id;
|
|
13286
|
+
if (earliestInRing !== void 0 && earliestInRing > opts.lastEventId + 1) {
|
|
13287
|
+
queue.forcePush({
|
|
13288
|
+
v: EVENT_SCHEMA_VERSION,
|
|
13289
|
+
type: "state_resync_required",
|
|
13290
|
+
data: {
|
|
13291
|
+
reason: "ring_evicted",
|
|
13292
|
+
lastDeliveredId: opts.lastEventId,
|
|
13293
|
+
earliestAvailableId: earliestInRing
|
|
13294
|
+
}
|
|
13295
|
+
});
|
|
13296
|
+
}
|
|
13297
|
+
}
|
|
13298
|
+
const replayFrom = epochReset ? 0 : opts.lastEventId;
|
|
13299
|
+
let replayedCount = 0;
|
|
13300
|
+
let lastReplayedId;
|
|
13250
13301
|
for (const e of this.ring) {
|
|
13251
|
-
if (e.id !== void 0 && e.id >
|
|
13302
|
+
if (e.id !== void 0 && e.id > replayFrom) {
|
|
13252
13303
|
queue.forcePush(e);
|
|
13304
|
+
replayedCount += 1;
|
|
13305
|
+
lastReplayedId = e.id;
|
|
13306
|
+
}
|
|
13307
|
+
}
|
|
13308
|
+
queue.forcePush({
|
|
13309
|
+
v: EVENT_SCHEMA_VERSION,
|
|
13310
|
+
type: "replay_complete",
|
|
13311
|
+
data: {
|
|
13312
|
+
// Note: `lastReplayedEventId`
|
|
13313
|
+
// is the canonical wire name — the old `lastEventId` collided
|
|
13314
|
+
// semantically with the SSE protocol's `Last-Event-ID` (envelope
|
|
13315
|
+
// `id`) in raw daemon traces. Emit both: `lastReplayedEventId`
|
|
13316
|
+
// for current SDKs and `lastEventId` as a deprecated alias so
|
|
13317
|
+
// pre-rename consumers keep working (additive, non-breaking).
|
|
13318
|
+
...lastReplayedId !== void 0 ? {
|
|
13319
|
+
lastReplayedEventId: lastReplayedId,
|
|
13320
|
+
lastEventId: lastReplayedId
|
|
13321
|
+
} : {},
|
|
13322
|
+
replayedCount
|
|
13253
13323
|
}
|
|
13254
|
-
}
|
|
13324
|
+
});
|
|
13255
13325
|
}
|
|
13256
13326
|
let disposed = false;
|
|
13257
13327
|
const dispose = /* @__PURE__ */ __name(() => {
|
|
@@ -13293,6 +13363,7 @@ var EventBus = class {
|
|
|
13293
13363
|
this.closed = true;
|
|
13294
13364
|
for (const sub of this.subs) sub.queue.close();
|
|
13295
13365
|
this.subs.clear();
|
|
13366
|
+
this.compactionEngine?.close();
|
|
13296
13367
|
}
|
|
13297
13368
|
};
|
|
13298
13369
|
function emptyAsyncIterable() {
|
|
@@ -13396,13 +13467,355 @@ var BoundedAsyncQueue = class {
|
|
|
13396
13467
|
done: true
|
|
13397
13468
|
});
|
|
13398
13469
|
}
|
|
13399
|
-
return new Promise((
|
|
13470
|
+
return new Promise((resolve3) => this.resolvers.push(resolve3));
|
|
13400
13471
|
}
|
|
13401
13472
|
};
|
|
13402
13473
|
|
|
13403
13474
|
// packages/cli/src/serve/eventBus.ts
|
|
13404
13475
|
init_esbuild_shims();
|
|
13405
13476
|
|
|
13477
|
+
// packages/acp-bridge/src/bridgeErrors.ts
|
|
13478
|
+
init_esbuild_shims();
|
|
13479
|
+
|
|
13480
|
+
// packages/acp-bridge/src/workspacePaths.ts
|
|
13481
|
+
init_esbuild_shims();
|
|
13482
|
+
import { realpathSync } from "node:fs";
|
|
13483
|
+
import * as path from "node:path";
|
|
13484
|
+
function canonicalizeWorkspace(p) {
|
|
13485
|
+
const resolved = path.resolve(p);
|
|
13486
|
+
try {
|
|
13487
|
+
return realpathSync.native(resolved);
|
|
13488
|
+
} catch (err) {
|
|
13489
|
+
if (err && typeof err === "object" && err.code === "ENOENT") {
|
|
13490
|
+
return resolved;
|
|
13491
|
+
}
|
|
13492
|
+
throw err;
|
|
13493
|
+
}
|
|
13494
|
+
}
|
|
13495
|
+
__name(canonicalizeWorkspace, "canonicalizeWorkspace");
|
|
13496
|
+
var MAX_WORKSPACE_PATH_LENGTH = 4096;
|
|
13497
|
+
|
|
13498
|
+
// packages/acp-bridge/src/bridgeErrors.ts
|
|
13499
|
+
var NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE = "Not currently generating";
|
|
13500
|
+
function isNotCurrentlyGeneratingCancelError(err) {
|
|
13501
|
+
if (!err || typeof err !== "object") return false;
|
|
13502
|
+
const maybe = err;
|
|
13503
|
+
if (isNotCurrentlyGeneratingText(maybe.message)) return true;
|
|
13504
|
+
if (!maybe.data || typeof maybe.data !== "object") return false;
|
|
13505
|
+
return isNotCurrentlyGeneratingText(
|
|
13506
|
+
maybe.data.details
|
|
13507
|
+
);
|
|
13508
|
+
}
|
|
13509
|
+
__name(isNotCurrentlyGeneratingCancelError, "isNotCurrentlyGeneratingCancelError");
|
|
13510
|
+
function isNotCurrentlyGeneratingText(value) {
|
|
13511
|
+
return typeof value === "string" && /\bnot currently generating\b/i.test(value);
|
|
13512
|
+
}
|
|
13513
|
+
__name(isNotCurrentlyGeneratingText, "isNotCurrentlyGeneratingText");
|
|
13514
|
+
var SessionNotFoundError = class extends Error {
|
|
13515
|
+
static {
|
|
13516
|
+
__name(this, "SessionNotFoundError");
|
|
13517
|
+
}
|
|
13518
|
+
sessionId;
|
|
13519
|
+
constructor(sessionId, extra) {
|
|
13520
|
+
super(`No session with id "${sessionId}"` + (extra ? `. ${extra}` : ""));
|
|
13521
|
+
this.name = "SessionNotFoundError";
|
|
13522
|
+
this.sessionId = sessionId;
|
|
13523
|
+
}
|
|
13524
|
+
};
|
|
13525
|
+
var RestoreInProgressError = class extends Error {
|
|
13526
|
+
static {
|
|
13527
|
+
__name(this, "RestoreInProgressError");
|
|
13528
|
+
}
|
|
13529
|
+
sessionId;
|
|
13530
|
+
activeAction;
|
|
13531
|
+
requestedAction;
|
|
13532
|
+
constructor(sessionId, activeAction, requestedAction) {
|
|
13533
|
+
super(
|
|
13534
|
+
`Session "${sessionId}" is already being restored via session/${activeAction}; retry session/${requestedAction} after it completes`
|
|
13535
|
+
);
|
|
13536
|
+
this.name = "RestoreInProgressError";
|
|
13537
|
+
this.sessionId = sessionId;
|
|
13538
|
+
this.activeAction = activeAction;
|
|
13539
|
+
this.requestedAction = requestedAction;
|
|
13540
|
+
}
|
|
13541
|
+
};
|
|
13542
|
+
var InvalidSessionScopeError = class extends Error {
|
|
13543
|
+
static {
|
|
13544
|
+
__name(this, "InvalidSessionScopeError");
|
|
13545
|
+
}
|
|
13546
|
+
sessionScope;
|
|
13547
|
+
constructor(sessionScope) {
|
|
13548
|
+
super(
|
|
13549
|
+
`Invalid sessionScope: ${JSON.stringify(sessionScope)}. Expected 'single' or 'thread'.`
|
|
13550
|
+
);
|
|
13551
|
+
this.name = "InvalidSessionScopeError";
|
|
13552
|
+
this.sessionScope = sessionScope;
|
|
13553
|
+
}
|
|
13554
|
+
};
|
|
13555
|
+
var SessionLimitExceededError = class extends Error {
|
|
13556
|
+
static {
|
|
13557
|
+
__name(this, "SessionLimitExceededError");
|
|
13558
|
+
}
|
|
13559
|
+
limit;
|
|
13560
|
+
constructor(limit) {
|
|
13561
|
+
super(`Session limit reached (${limit})`);
|
|
13562
|
+
this.name = "SessionLimitExceededError";
|
|
13563
|
+
this.limit = limit;
|
|
13564
|
+
}
|
|
13565
|
+
};
|
|
13566
|
+
var PromptQueueFullError = class extends Error {
|
|
13567
|
+
static {
|
|
13568
|
+
__name(this, "PromptQueueFullError");
|
|
13569
|
+
}
|
|
13570
|
+
limit;
|
|
13571
|
+
pendingCount;
|
|
13572
|
+
sessionId;
|
|
13573
|
+
constructor(limit, pendingCount, sessionId) {
|
|
13574
|
+
super(
|
|
13575
|
+
`Prompt queue full for session "${sessionId}" (${pendingCount}/${limit} pending)`
|
|
13576
|
+
);
|
|
13577
|
+
this.name = "PromptQueueFullError";
|
|
13578
|
+
this.limit = limit;
|
|
13579
|
+
this.pendingCount = pendingCount;
|
|
13580
|
+
this.sessionId = sessionId;
|
|
13581
|
+
}
|
|
13582
|
+
};
|
|
13583
|
+
var WorkspaceMismatchError = class extends Error {
|
|
13584
|
+
static {
|
|
13585
|
+
__name(this, "WorkspaceMismatchError");
|
|
13586
|
+
}
|
|
13587
|
+
bound;
|
|
13588
|
+
requested;
|
|
13589
|
+
constructor(bound, requested) {
|
|
13590
|
+
const safeRequested = requested.length > MAX_WORKSPACE_PATH_LENGTH ? `${requested.slice(0, MAX_WORKSPACE_PATH_LENGTH)}\u2026[truncated]` : requested;
|
|
13591
|
+
super(
|
|
13592
|
+
`Workspace mismatch: daemon is bound to "${bound}" but request asked for "${safeRequested}". Each \`qwen serve\` daemon binds to exactly one workspace; start a separate daemon for "${safeRequested}" (or route the request to one via an orchestrator).`
|
|
13593
|
+
);
|
|
13594
|
+
this.name = "WorkspaceMismatchError";
|
|
13595
|
+
this.bound = bound;
|
|
13596
|
+
this.requested = safeRequested;
|
|
13597
|
+
}
|
|
13598
|
+
};
|
|
13599
|
+
var InvalidClientIdError = class extends Error {
|
|
13600
|
+
static {
|
|
13601
|
+
__name(this, "InvalidClientIdError");
|
|
13602
|
+
}
|
|
13603
|
+
sessionId;
|
|
13604
|
+
clientId;
|
|
13605
|
+
constructor(sessionId, clientId) {
|
|
13606
|
+
super(`Client id "${clientId}" is not registered for session ${sessionId}`);
|
|
13607
|
+
this.name = "InvalidClientIdError";
|
|
13608
|
+
this.sessionId = sessionId;
|
|
13609
|
+
this.clientId = clientId;
|
|
13610
|
+
}
|
|
13611
|
+
};
|
|
13612
|
+
var SessionShellDisabledError = class extends Error {
|
|
13613
|
+
static {
|
|
13614
|
+
__name(this, "SessionShellDisabledError");
|
|
13615
|
+
}
|
|
13616
|
+
constructor() {
|
|
13617
|
+
super("Direct session shell is disabled for this daemon");
|
|
13618
|
+
this.name = "SessionShellDisabledError";
|
|
13619
|
+
}
|
|
13620
|
+
};
|
|
13621
|
+
var SessionShellClientRequiredError = class extends Error {
|
|
13622
|
+
static {
|
|
13623
|
+
__name(this, "SessionShellClientRequiredError");
|
|
13624
|
+
}
|
|
13625
|
+
constructor() {
|
|
13626
|
+
super("Direct session shell requires a session-bound client id");
|
|
13627
|
+
this.name = "SessionShellClientRequiredError";
|
|
13628
|
+
}
|
|
13629
|
+
};
|
|
13630
|
+
var InvalidPermissionOptionError = class extends Error {
|
|
13631
|
+
static {
|
|
13632
|
+
__name(this, "InvalidPermissionOptionError");
|
|
13633
|
+
}
|
|
13634
|
+
requestId;
|
|
13635
|
+
optionId;
|
|
13636
|
+
constructor(requestId, optionId) {
|
|
13637
|
+
super(
|
|
13638
|
+
`Permission ${requestId}: optionId "${optionId}" is not in the set of options the agent offered.`
|
|
13639
|
+
);
|
|
13640
|
+
this.name = "InvalidPermissionOptionError";
|
|
13641
|
+
this.requestId = requestId;
|
|
13642
|
+
this.optionId = optionId;
|
|
13643
|
+
}
|
|
13644
|
+
};
|
|
13645
|
+
var InvalidSessionMetadataError = class extends Error {
|
|
13646
|
+
static {
|
|
13647
|
+
__name(this, "InvalidSessionMetadataError");
|
|
13648
|
+
}
|
|
13649
|
+
field;
|
|
13650
|
+
constructor(field, reason) {
|
|
13651
|
+
super(`Invalid session metadata: ${field} ${reason}`);
|
|
13652
|
+
this.name = "InvalidSessionMetadataError";
|
|
13653
|
+
this.field = field;
|
|
13654
|
+
}
|
|
13655
|
+
};
|
|
13656
|
+
var PermissionPolicyNotImplementedError = class extends Error {
|
|
13657
|
+
static {
|
|
13658
|
+
__name(this, "PermissionPolicyNotImplementedError");
|
|
13659
|
+
}
|
|
13660
|
+
policy;
|
|
13661
|
+
constructor(policy) {
|
|
13662
|
+
super(
|
|
13663
|
+
`Permission policy "${policy}" is declared in the contract but not yet implemented in this daemon build.`
|
|
13664
|
+
);
|
|
13665
|
+
this.name = "PermissionPolicyNotImplementedError";
|
|
13666
|
+
this.policy = policy;
|
|
13667
|
+
}
|
|
13668
|
+
};
|
|
13669
|
+
var CancelSentinelCollisionError = class extends Error {
|
|
13670
|
+
static {
|
|
13671
|
+
__name(this, "CancelSentinelCollisionError");
|
|
13672
|
+
}
|
|
13673
|
+
requestId;
|
|
13674
|
+
sentinel;
|
|
13675
|
+
constructor(requestId, sentinel) {
|
|
13676
|
+
super(
|
|
13677
|
+
`Permission ${requestId}: agent-declared optionId set contains the cancel-vote sentinel "${sentinel}", which would prevent the daemon from disambiguating cancel intent from a real vote.`
|
|
13678
|
+
);
|
|
13679
|
+
this.name = "CancelSentinelCollisionError";
|
|
13680
|
+
this.requestId = requestId;
|
|
13681
|
+
this.sentinel = sentinel;
|
|
13682
|
+
}
|
|
13683
|
+
};
|
|
13684
|
+
var PermissionForbiddenError = class extends Error {
|
|
13685
|
+
static {
|
|
13686
|
+
__name(this, "PermissionForbiddenError");
|
|
13687
|
+
}
|
|
13688
|
+
requestId;
|
|
13689
|
+
sessionId;
|
|
13690
|
+
reason;
|
|
13691
|
+
constructor(requestId, sessionId, reason) {
|
|
13692
|
+
super(
|
|
13693
|
+
`Permission ${requestId} on session ${sessionId}: vote rejected by policy (${reason}).`
|
|
13694
|
+
);
|
|
13695
|
+
this.name = "PermissionForbiddenError";
|
|
13696
|
+
this.requestId = requestId;
|
|
13697
|
+
this.sessionId = sessionId;
|
|
13698
|
+
this.reason = reason;
|
|
13699
|
+
}
|
|
13700
|
+
};
|
|
13701
|
+
var WorkspaceInitConflictError = class extends Error {
|
|
13702
|
+
static {
|
|
13703
|
+
__name(this, "WorkspaceInitConflictError");
|
|
13704
|
+
}
|
|
13705
|
+
path;
|
|
13706
|
+
existingSize;
|
|
13707
|
+
constructor(path9, existingSize) {
|
|
13708
|
+
super(
|
|
13709
|
+
`Workspace file ${path9} already exists (${existingSize} bytes); pass {force: true} to overwrite.`
|
|
13710
|
+
);
|
|
13711
|
+
this.name = "WorkspaceInitConflictError";
|
|
13712
|
+
this.path = path9;
|
|
13713
|
+
this.existingSize = existingSize;
|
|
13714
|
+
}
|
|
13715
|
+
};
|
|
13716
|
+
var WorkspaceInitPathEscapeError = class extends Error {
|
|
13717
|
+
static {
|
|
13718
|
+
__name(this, "WorkspaceInitPathEscapeError");
|
|
13719
|
+
}
|
|
13720
|
+
filename;
|
|
13721
|
+
boundWorkspace;
|
|
13722
|
+
constructor(filename, boundWorkspace) {
|
|
13723
|
+
super(
|
|
13724
|
+
`Configured workspace context filename ${JSON.stringify(filename)} resolves outside the bound workspace ${JSON.stringify(boundWorkspace)}. Refusing to write.`
|
|
13725
|
+
);
|
|
13726
|
+
this.name = "WorkspaceInitPathEscapeError";
|
|
13727
|
+
this.filename = filename;
|
|
13728
|
+
this.boundWorkspace = boundWorkspace;
|
|
13729
|
+
}
|
|
13730
|
+
};
|
|
13731
|
+
var WorkspaceInitSymlinkError = class extends Error {
|
|
13732
|
+
static {
|
|
13733
|
+
__name(this, "WorkspaceInitSymlinkError");
|
|
13734
|
+
}
|
|
13735
|
+
target;
|
|
13736
|
+
kind;
|
|
13737
|
+
constructor(target, kind, detail) {
|
|
13738
|
+
super(detail);
|
|
13739
|
+
this.name = "WorkspaceInitSymlinkError";
|
|
13740
|
+
this.target = target;
|
|
13741
|
+
this.kind = kind;
|
|
13742
|
+
}
|
|
13743
|
+
};
|
|
13744
|
+
var WorkspaceInitRaceError = class extends Error {
|
|
13745
|
+
static {
|
|
13746
|
+
__name(this, "WorkspaceInitRaceError");
|
|
13747
|
+
}
|
|
13748
|
+
target;
|
|
13749
|
+
kind;
|
|
13750
|
+
constructor(target, kind, detail) {
|
|
13751
|
+
super(detail);
|
|
13752
|
+
this.name = "WorkspaceInitRaceError";
|
|
13753
|
+
this.target = target;
|
|
13754
|
+
this.kind = kind;
|
|
13755
|
+
}
|
|
13756
|
+
};
|
|
13757
|
+
var McpServerNotFoundError = class extends Error {
|
|
13758
|
+
static {
|
|
13759
|
+
__name(this, "McpServerNotFoundError");
|
|
13760
|
+
}
|
|
13761
|
+
serverName;
|
|
13762
|
+
constructor(serverName) {
|
|
13763
|
+
super(`MCP server not configured: ${JSON.stringify(serverName)}`);
|
|
13764
|
+
this.name = "McpServerNotFoundError";
|
|
13765
|
+
this.serverName = serverName;
|
|
13766
|
+
}
|
|
13767
|
+
};
|
|
13768
|
+
var McpServerRestartFailedError = class extends Error {
|
|
13769
|
+
static {
|
|
13770
|
+
__name(this, "McpServerRestartFailedError");
|
|
13771
|
+
}
|
|
13772
|
+
serverName;
|
|
13773
|
+
mcpStatus;
|
|
13774
|
+
constructor(serverName, mcpStatus) {
|
|
13775
|
+
super(
|
|
13776
|
+
`MCP server ${JSON.stringify(serverName)} did not reach a connected state after restart (status: ${mcpStatus}).`
|
|
13777
|
+
);
|
|
13778
|
+
this.name = "McpServerRestartFailedError";
|
|
13779
|
+
this.serverName = serverName;
|
|
13780
|
+
this.mcpStatus = mcpStatus;
|
|
13781
|
+
}
|
|
13782
|
+
};
|
|
13783
|
+
var SessionBusyError = class extends Error {
|
|
13784
|
+
static {
|
|
13785
|
+
__name(this, "SessionBusyError");
|
|
13786
|
+
}
|
|
13787
|
+
sessionId;
|
|
13788
|
+
constructor(sessionId, message) {
|
|
13789
|
+
super(message ?? `Session ${sessionId} is busy (prompt running)`);
|
|
13790
|
+
this.name = "SessionBusyError";
|
|
13791
|
+
this.sessionId = sessionId;
|
|
13792
|
+
}
|
|
13793
|
+
};
|
|
13794
|
+
var InvalidRewindTargetError = class extends Error {
|
|
13795
|
+
static {
|
|
13796
|
+
__name(this, "InvalidRewindTargetError");
|
|
13797
|
+
}
|
|
13798
|
+
sessionId;
|
|
13799
|
+
constructor(sessionId, message) {
|
|
13800
|
+
super(
|
|
13801
|
+
message ?? `Cannot rewind to the requested turn (compressed or does not exist)`
|
|
13802
|
+
);
|
|
13803
|
+
this.name = "InvalidRewindTargetError";
|
|
13804
|
+
this.sessionId = sessionId;
|
|
13805
|
+
}
|
|
13806
|
+
};
|
|
13807
|
+
var BranchWhilePromptActiveError = class extends Error {
|
|
13808
|
+
static {
|
|
13809
|
+
__name(this, "BranchWhilePromptActiveError");
|
|
13810
|
+
}
|
|
13811
|
+
sessionId;
|
|
13812
|
+
constructor(sessionId) {
|
|
13813
|
+
super(`Cannot branch session ${sessionId}: a prompt is currently active`);
|
|
13814
|
+
this.name = "BranchWhilePromptActiveError";
|
|
13815
|
+
this.sessionId = sessionId;
|
|
13816
|
+
}
|
|
13817
|
+
};
|
|
13818
|
+
|
|
13406
13819
|
// packages/acp-bridge/src/status.ts
|
|
13407
13820
|
init_esbuild_shims();
|
|
13408
13821
|
var STATUS_SCHEMA_VERSION = 1;
|
|
@@ -13415,10 +13828,17 @@ var SERVE_ERROR_KINDS = [
|
|
|
13415
13828
|
"missing_file",
|
|
13416
13829
|
"parse_error",
|
|
13417
13830
|
"stat_failed",
|
|
13418
|
-
//
|
|
13831
|
+
// Budget refusal under `--mcp-budget-mode=enforce`.
|
|
13419
13832
|
// Surfaced on per-server `mcp_server` cells (refused at discovery)
|
|
13420
13833
|
// and on the workspace-level `mcp_budget` cell (any refusal this pass).
|
|
13421
|
-
"budget_exhausted"
|
|
13834
|
+
"budget_exhausted",
|
|
13835
|
+
// Runtime MCP mutation routes
|
|
13836
|
+
"mcp_budget_would_exceed",
|
|
13837
|
+
"mcp_server_spawn_failed",
|
|
13838
|
+
"invalid_config",
|
|
13839
|
+
// Prompt deadline + writer idle timeout
|
|
13840
|
+
"prompt_deadline_exceeded",
|
|
13841
|
+
"writer_idle_timeout"
|
|
13422
13842
|
];
|
|
13423
13843
|
var BridgeTimeoutError = class extends Error {
|
|
13424
13844
|
static {
|
|
@@ -13427,7 +13847,7 @@ var BridgeTimeoutError = class extends Error {
|
|
|
13427
13847
|
label;
|
|
13428
13848
|
timeoutMs;
|
|
13429
13849
|
constructor(label, timeoutMs) {
|
|
13430
|
-
super(`
|
|
13850
|
+
super(`AcpSessionBridge ${label} timed out after ${timeoutMs}ms`);
|
|
13431
13851
|
this.name = "BridgeTimeoutError";
|
|
13432
13852
|
this.label = label;
|
|
13433
13853
|
this.timeoutMs = timeoutMs;
|
|
@@ -13457,18 +13877,123 @@ var MissingCliEntryError = class extends Error {
|
|
|
13457
13877
|
};
|
|
13458
13878
|
var SERVE_STATUS_EXT_METHODS = {
|
|
13459
13879
|
workspaceMcp: "qwen/status/workspace/mcp",
|
|
13880
|
+
workspaceMcpTools: "qwen/status/workspace/mcp/tools",
|
|
13460
13881
|
workspaceSkills: "qwen/status/workspace/skills",
|
|
13882
|
+
workspaceTools: "qwen/status/workspace/tools",
|
|
13461
13883
|
workspaceProviders: "qwen/status/workspace/providers",
|
|
13462
13884
|
workspaceMemory: "qwen/status/workspace/memory",
|
|
13463
13885
|
workspaceAgents: "qwen/status/workspace/agents",
|
|
13464
13886
|
workspacePreflight: "qwen/status/workspace/preflight",
|
|
13465
13887
|
sessionContext: "qwen/status/session/context",
|
|
13466
|
-
|
|
13888
|
+
sessionContextUsage: "qwen/status/session/context_usage",
|
|
13889
|
+
sessionSupportedCommands: "qwen/status/session/supported_commands",
|
|
13890
|
+
sessionTasks: "qwen/status/session/tasks",
|
|
13891
|
+
sessionStats: "qwen/status/session/stats",
|
|
13892
|
+
sessionRewindSnapshots: "qwen/status/session/rewind_snapshots",
|
|
13893
|
+
workspaceHooks: "qwen/status/workspace/hooks",
|
|
13894
|
+
sessionHooks: "qwen/status/session/hooks",
|
|
13895
|
+
workspaceExtensions: "qwen/status/workspace/extensions"
|
|
13467
13896
|
};
|
|
13468
13897
|
var SERVE_CONTROL_EXT_METHODS = {
|
|
13898
|
+
sessionClose: "qwen/control/session/close",
|
|
13469
13899
|
sessionApprovalMode: "qwen/control/session/approval_mode",
|
|
13470
|
-
|
|
13900
|
+
sessionBranch: "qwen/control/session/branch",
|
|
13901
|
+
sessionRecap: "qwen/control/session/recap",
|
|
13902
|
+
sessionBtw: "qwen/control/session/btw",
|
|
13903
|
+
sessionShellHistory: "qwen/control/session/shell_history",
|
|
13904
|
+
sessionLanguage: "qwen/control/session/language",
|
|
13905
|
+
sessionRewind: "qwen/control/session/rewind",
|
|
13906
|
+
workspaceMcpRestart: "qwen/control/workspace/mcp/restart",
|
|
13907
|
+
workspaceMcpManage: "qwen/control/workspace/mcp/manage",
|
|
13908
|
+
workspaceAgentGenerate: "qwen/control/workspace/agents/generate",
|
|
13909
|
+
// Runtime MCP server mutation ext-methods
|
|
13910
|
+
sessionTaskCancel: "qwen/control/session/task/cancel",
|
|
13911
|
+
sessionGoalClear: "qwen/control/session/goal/clear",
|
|
13912
|
+
workspaceMcpRuntimeAdd: "qwen/control/workspace/mcp/runtime-add",
|
|
13913
|
+
workspaceMcpRuntimeRemove: "qwen/control/workspace/mcp/runtime-remove",
|
|
13914
|
+
workspaceReload: "qwen/control/workspace/reload"
|
|
13471
13915
|
};
|
|
13916
|
+
var IDLE_HOOK_EVENTS = {
|
|
13917
|
+
PreToolUse: { description: "Before tool execution", matcherKind: "toolName" },
|
|
13918
|
+
PostToolUse: { description: "After tool execution", matcherKind: "toolName" },
|
|
13919
|
+
PostToolUseFailure: {
|
|
13920
|
+
description: "After tool execution fails",
|
|
13921
|
+
matcherKind: "toolName"
|
|
13922
|
+
},
|
|
13923
|
+
PostToolBatch: { description: "After a batch of tool calls resolves" },
|
|
13924
|
+
Notification: {
|
|
13925
|
+
description: "When notifications are sent",
|
|
13926
|
+
matcherKind: "notificationType"
|
|
13927
|
+
},
|
|
13928
|
+
UserPromptSubmit: { description: "When the user submits a prompt" },
|
|
13929
|
+
UserPromptExpansion: {
|
|
13930
|
+
description: "When a slash command expands into a prompt",
|
|
13931
|
+
matcherKind: "commandName"
|
|
13932
|
+
},
|
|
13933
|
+
SessionStart: {
|
|
13934
|
+
description: "When a new session is started",
|
|
13935
|
+
matcherKind: "sessionTrigger"
|
|
13936
|
+
},
|
|
13937
|
+
Stop: { description: "Right before Qwen Code concludes its response" },
|
|
13938
|
+
SubagentStart: {
|
|
13939
|
+
description: "When a subagent is started",
|
|
13940
|
+
matcherKind: "agentType"
|
|
13941
|
+
},
|
|
13942
|
+
SubagentStop: {
|
|
13943
|
+
description: "Right before a subagent concludes its response",
|
|
13944
|
+
matcherKind: "agentType"
|
|
13945
|
+
},
|
|
13946
|
+
PreCompact: {
|
|
13947
|
+
description: "Before conversation compaction",
|
|
13948
|
+
matcherKind: "trigger"
|
|
13949
|
+
},
|
|
13950
|
+
PostCompact: {
|
|
13951
|
+
description: "After conversation compaction",
|
|
13952
|
+
matcherKind: "trigger"
|
|
13953
|
+
},
|
|
13954
|
+
SessionEnd: {
|
|
13955
|
+
description: "When a session is ending",
|
|
13956
|
+
matcherKind: "sessionTrigger"
|
|
13957
|
+
},
|
|
13958
|
+
PermissionRequest: {
|
|
13959
|
+
description: "When a permission dialog is displayed",
|
|
13960
|
+
matcherKind: "toolName"
|
|
13961
|
+
},
|
|
13962
|
+
PermissionDenied: {
|
|
13963
|
+
description: "When a tool call is denied",
|
|
13964
|
+
matcherKind: "toolName"
|
|
13965
|
+
},
|
|
13966
|
+
StopFailure: {
|
|
13967
|
+
description: "When the turn ends due to an API error",
|
|
13968
|
+
matcherKind: "error"
|
|
13969
|
+
},
|
|
13970
|
+
TodoCreated: { description: "When a new todo item is created" },
|
|
13971
|
+
TodoCompleted: { description: "When a todo item is marked as completed" },
|
|
13972
|
+
InstructionsLoaded: {
|
|
13973
|
+
description: "When an instruction or context file is loaded",
|
|
13974
|
+
matcherKind: "filePath"
|
|
13975
|
+
}
|
|
13976
|
+
};
|
|
13977
|
+
function createIdleWorkspaceExtensionsStatus(workspaceCwd) {
|
|
13978
|
+
return {
|
|
13979
|
+
v: STATUS_SCHEMA_VERSION,
|
|
13980
|
+
workspaceCwd,
|
|
13981
|
+
initialized: false,
|
|
13982
|
+
extensions: []
|
|
13983
|
+
};
|
|
13984
|
+
}
|
|
13985
|
+
__name(createIdleWorkspaceExtensionsStatus, "createIdleWorkspaceExtensionsStatus");
|
|
13986
|
+
function createIdleWorkspaceHooksStatus(workspaceCwd) {
|
|
13987
|
+
return {
|
|
13988
|
+
v: STATUS_SCHEMA_VERSION,
|
|
13989
|
+
workspaceCwd,
|
|
13990
|
+
initialized: false,
|
|
13991
|
+
disabled: false,
|
|
13992
|
+
hooks: [],
|
|
13993
|
+
events: IDLE_HOOK_EVENTS
|
|
13994
|
+
};
|
|
13995
|
+
}
|
|
13996
|
+
__name(createIdleWorkspaceHooksStatus, "createIdleWorkspaceHooksStatus");
|
|
13472
13997
|
function createIdleWorkspaceMemoryStatus(workspaceCwd) {
|
|
13473
13998
|
return {
|
|
13474
13999
|
v: STATUS_SCHEMA_VERSION,
|
|
@@ -13589,7 +14114,7 @@ init_esbuild_shims();
|
|
|
13589
14114
|
// packages/cli/src/utils/languageUtils.ts
|
|
13590
14115
|
init_esbuild_shims();
|
|
13591
14116
|
import * as fs from "node:fs";
|
|
13592
|
-
import * as
|
|
14117
|
+
import * as path2 from "node:path";
|
|
13593
14118
|
var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
|
|
13594
14119
|
var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "qwen-code:llm-output-language:";
|
|
13595
14120
|
var OUTPUT_LANGUAGE_AUTO = "auto";
|
|
@@ -13615,7 +14140,7 @@ function resolveOutputLanguage(value) {
|
|
|
13615
14140
|
}
|
|
13616
14141
|
__name(resolveOutputLanguage, "resolveOutputLanguage");
|
|
13617
14142
|
function getOutputLanguageFilePath() {
|
|
13618
|
-
return
|
|
14143
|
+
return path2.join(
|
|
13619
14144
|
Storage.getGlobalQwenDir(),
|
|
13620
14145
|
LLM_OUTPUT_LANGUAGE_RULE_FILENAME
|
|
13621
14146
|
);
|
|
@@ -13678,19 +14203,27 @@ function readOutputLanguageFromFile() {
|
|
|
13678
14203
|
}
|
|
13679
14204
|
}
|
|
13680
14205
|
__name(readOutputLanguageFromFile, "readOutputLanguageFromFile");
|
|
13681
|
-
function writeOutputLanguageFile(language) {
|
|
13682
|
-
const filePath = getOutputLanguageFilePath();
|
|
14206
|
+
function writeOutputLanguageFile(language, targetPath) {
|
|
14207
|
+
const filePath = targetPath ?? getOutputLanguageFilePath();
|
|
13683
14208
|
const content = generateOutputLanguageFileContent(language);
|
|
13684
|
-
const dir =
|
|
14209
|
+
const dir = path2.dirname(filePath);
|
|
13685
14210
|
fs.mkdirSync(dir, { recursive: true });
|
|
13686
14211
|
fs.writeFileSync(filePath, content, "utf-8");
|
|
13687
14212
|
}
|
|
13688
14213
|
__name(writeOutputLanguageFile, "writeOutputLanguageFile");
|
|
13689
|
-
function updateOutputLanguageFile(settingValue) {
|
|
14214
|
+
function updateOutputLanguageFile(settingValue, targetPath) {
|
|
13690
14215
|
const resolved = resolveOutputLanguage(settingValue);
|
|
13691
|
-
writeOutputLanguageFile(resolved);
|
|
14216
|
+
writeOutputLanguageFile(resolved, targetPath);
|
|
13692
14217
|
}
|
|
13693
14218
|
__name(updateOutputLanguageFile, "updateOutputLanguageFile");
|
|
14219
|
+
function writeOutputLanguageAndRegisterPath(settingValue, config) {
|
|
14220
|
+
const targetPath = config?.getOutputLanguageFilePath();
|
|
14221
|
+
updateOutputLanguageFile(settingValue, targetPath);
|
|
14222
|
+
if (!targetPath) {
|
|
14223
|
+
config?.setOutputLanguageFilePath(getOutputLanguageFilePath());
|
|
14224
|
+
}
|
|
14225
|
+
}
|
|
14226
|
+
__name(writeOutputLanguageAndRegisterPath, "writeOutputLanguageAndRegisterPath");
|
|
13694
14227
|
function initializeLlmOutputLanguage(outputLanguage) {
|
|
13695
14228
|
const currentFileLanguage = readOutputLanguageFromFile();
|
|
13696
14229
|
if (currentFileLanguage) {
|
|
@@ -13705,7 +14238,7 @@ __name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
|
|
|
13705
14238
|
init_esbuild_shims();
|
|
13706
14239
|
var dotenv = __toESM(require_main(), 1);
|
|
13707
14240
|
import * as fs6 from "node:fs";
|
|
13708
|
-
import * as
|
|
14241
|
+
import * as path4 from "node:path";
|
|
13709
14242
|
import { homedir, platform } from "node:os";
|
|
13710
14243
|
import process2 from "node:process";
|
|
13711
14244
|
var import_strip_json_comments2 = __toESM(require_strip_json_comments(), 1);
|
|
@@ -13898,6 +14431,89 @@ function resolveColor(colorValue) {
|
|
|
13898
14431
|
return void 0;
|
|
13899
14432
|
}
|
|
13900
14433
|
__name(resolveColor, "resolveColor");
|
|
14434
|
+
var INK_NAME_TO_HEX = {
|
|
14435
|
+
black: "#000000",
|
|
14436
|
+
red: "#ff0000",
|
|
14437
|
+
green: "#00ff00",
|
|
14438
|
+
yellow: "#ffff00",
|
|
14439
|
+
blue: "#0000ff",
|
|
14440
|
+
cyan: "#00ffff",
|
|
14441
|
+
magenta: "#ff00ff",
|
|
14442
|
+
white: "#ffffff",
|
|
14443
|
+
gray: "#808080",
|
|
14444
|
+
grey: "#808080",
|
|
14445
|
+
blackbright: "#808080",
|
|
14446
|
+
redbright: "#ff8080",
|
|
14447
|
+
greenbright: "#80ff80",
|
|
14448
|
+
yellowbright: "#ffff80",
|
|
14449
|
+
bluebright: "#8080ff",
|
|
14450
|
+
cyanbright: "#80ffff",
|
|
14451
|
+
magentabright: "#ff80ff",
|
|
14452
|
+
whitebright: "#ffffff"
|
|
14453
|
+
};
|
|
14454
|
+
function toHex(color) {
|
|
14455
|
+
const resolved = (resolveColor(color) ?? color).toLowerCase();
|
|
14456
|
+
if (resolved.startsWith("#")) {
|
|
14457
|
+
if (/^#[0-9a-f]{3}$/.test(resolved)) {
|
|
14458
|
+
return `#${resolved.slice(1).split("").map((c) => c + c).join("")}`;
|
|
14459
|
+
}
|
|
14460
|
+
if (/^#[0-9a-f]{6}$/.test(resolved)) {
|
|
14461
|
+
return resolved;
|
|
14462
|
+
}
|
|
14463
|
+
return void 0;
|
|
14464
|
+
}
|
|
14465
|
+
return INK_NAME_TO_HEX[resolved];
|
|
14466
|
+
}
|
|
14467
|
+
__name(toHex, "toHex");
|
|
14468
|
+
function interpolateColor(color1, color2, factor) {
|
|
14469
|
+
if (factor <= 0) {
|
|
14470
|
+
return color1;
|
|
14471
|
+
}
|
|
14472
|
+
if (factor >= 1) {
|
|
14473
|
+
return color2;
|
|
14474
|
+
}
|
|
14475
|
+
const h1 = toHex(color1);
|
|
14476
|
+
const h2 = toHex(color2);
|
|
14477
|
+
if (!h1 || !h2) {
|
|
14478
|
+
return "";
|
|
14479
|
+
}
|
|
14480
|
+
const r1 = parseInt(h1.slice(1, 3), 16);
|
|
14481
|
+
const g1 = parseInt(h1.slice(3, 5), 16);
|
|
14482
|
+
const b1 = parseInt(h1.slice(5, 7), 16);
|
|
14483
|
+
const r2 = parseInt(h2.slice(1, 3), 16);
|
|
14484
|
+
const g2 = parseInt(h2.slice(3, 5), 16);
|
|
14485
|
+
const b2 = parseInt(h2.slice(5, 7), 16);
|
|
14486
|
+
const lerp = /* @__PURE__ */ __name((a, b) => Math.round(a + (b - a) * factor), "lerp");
|
|
14487
|
+
const toByte = /* @__PURE__ */ __name((n) => Math.max(0, Math.min(255, n)).toString(16).padStart(2, "0"), "toByte");
|
|
14488
|
+
return `#${toByte(lerp(r1, r2))}${toByte(lerp(g1, g2))}${toByte(lerp(b1, b2))}`;
|
|
14489
|
+
}
|
|
14490
|
+
__name(interpolateColor, "interpolateColor");
|
|
14491
|
+
function subtleBandColor(bgColor, factor = 0.06) {
|
|
14492
|
+
const hex = toHex(bgColor);
|
|
14493
|
+
if (!hex) {
|
|
14494
|
+
return "";
|
|
14495
|
+
}
|
|
14496
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
14497
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
14498
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
14499
|
+
const isDark = (r * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
14500
|
+
const target = isDark ? "#ffffff" : "#000000";
|
|
14501
|
+
return interpolateColor(hex, target, factor);
|
|
14502
|
+
}
|
|
14503
|
+
__name(subtleBandColor, "subtleBandColor");
|
|
14504
|
+
var _supportsTrueColor;
|
|
14505
|
+
function supportsTrueColor() {
|
|
14506
|
+
if (_supportsTrueColor !== void 0) return _supportsTrueColor;
|
|
14507
|
+
const colorterm = process.env["COLORTERM"];
|
|
14508
|
+
if (colorterm === "truecolor" || colorterm === "24bit" || colorterm === "kmscon") {
|
|
14509
|
+
return _supportsTrueColor = true;
|
|
14510
|
+
}
|
|
14511
|
+
if (process.stdout.getColorDepth && process.stdout.getColorDepth() >= 24) {
|
|
14512
|
+
return _supportsTrueColor = true;
|
|
14513
|
+
}
|
|
14514
|
+
return _supportsTrueColor = false;
|
|
14515
|
+
}
|
|
14516
|
+
__name(supportsTrueColor, "supportsTrueColor");
|
|
13901
14517
|
|
|
13902
14518
|
// packages/cli/src/ui/themes/theme.ts
|
|
13903
14519
|
var lightTheme = {
|
|
@@ -14516,14 +15132,14 @@ var DefaultDark = new Theme(
|
|
|
14516
15132
|
// packages/cli/src/config/trustedFolders.ts
|
|
14517
15133
|
init_esbuild_shims();
|
|
14518
15134
|
import * as fs2 from "node:fs";
|
|
14519
|
-
import * as
|
|
15135
|
+
import * as path3 from "node:path";
|
|
14520
15136
|
var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
|
|
14521
15137
|
var TRUSTED_FOLDERS_FILENAME = "trustedFolders.json";
|
|
14522
15138
|
function getTrustedFoldersPath() {
|
|
14523
15139
|
if (process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"]) {
|
|
14524
15140
|
return process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"];
|
|
14525
15141
|
}
|
|
14526
|
-
return
|
|
15142
|
+
return path3.join(Storage.getGlobalQwenDir(), TRUSTED_FOLDERS_FILENAME);
|
|
14527
15143
|
}
|
|
14528
15144
|
__name(getTrustedFoldersPath, "getTrustedFoldersPath");
|
|
14529
15145
|
var LoadedTrustedFolders = class {
|
|
@@ -14535,8 +15151,8 @@ var LoadedTrustedFolders = class {
|
|
|
14535
15151
|
__name(this, "LoadedTrustedFolders");
|
|
14536
15152
|
}
|
|
14537
15153
|
get rules() {
|
|
14538
|
-
return Object.entries(this.user.config).map(([
|
|
14539
|
-
path:
|
|
15154
|
+
return Object.entries(this.user.config).map(([path9, trustLevel]) => ({
|
|
15155
|
+
path: path9,
|
|
14540
15156
|
trustLevel
|
|
14541
15157
|
}));
|
|
14542
15158
|
}
|
|
@@ -14556,7 +15172,7 @@ var LoadedTrustedFolders = class {
|
|
|
14556
15172
|
trustedPaths.push(rule.path);
|
|
14557
15173
|
break;
|
|
14558
15174
|
case "TRUST_PARENT" /* TRUST_PARENT */:
|
|
14559
|
-
trustedPaths.push(
|
|
15175
|
+
trustedPaths.push(path3.dirname(rule.path));
|
|
14560
15176
|
break;
|
|
14561
15177
|
case "DO_NOT_TRUST" /* DO_NOT_TRUST */:
|
|
14562
15178
|
untrustedPaths.push(rule.path);
|
|
@@ -14571,14 +15187,14 @@ var LoadedTrustedFolders = class {
|
|
|
14571
15187
|
}
|
|
14572
15188
|
}
|
|
14573
15189
|
for (const untrustedPath of untrustedPaths) {
|
|
14574
|
-
if (
|
|
15190
|
+
if (path3.normalize(location) === path3.normalize(untrustedPath)) {
|
|
14575
15191
|
return false;
|
|
14576
15192
|
}
|
|
14577
15193
|
}
|
|
14578
15194
|
return void 0;
|
|
14579
15195
|
}
|
|
14580
|
-
setValue(
|
|
14581
|
-
this.user.config[
|
|
15196
|
+
setValue(path9, trustLevel) {
|
|
15197
|
+
this.user.config[path9] = trustLevel;
|
|
14582
15198
|
saveTrustedFolders(this.user);
|
|
14583
15199
|
}
|
|
14584
15200
|
};
|
|
@@ -14618,7 +15234,7 @@ function loadTrustedFolders() {
|
|
|
14618
15234
|
__name(loadTrustedFolders, "loadTrustedFolders");
|
|
14619
15235
|
function saveTrustedFolders(trustedFoldersFile) {
|
|
14620
15236
|
try {
|
|
14621
|
-
const dirPath =
|
|
15237
|
+
const dirPath = path3.dirname(trustedFoldersFile.path);
|
|
14622
15238
|
if (!fs2.existsSync(dirPath)) {
|
|
14623
15239
|
fs2.mkdirSync(dirPath, { recursive: true });
|
|
14624
15240
|
}
|
|
@@ -15791,7 +16407,7 @@ var SETTINGS_SCHEMA = {
|
|
|
15791
16407
|
category: "Context",
|
|
15792
16408
|
requiresRestart: false,
|
|
15793
16409
|
default: {},
|
|
15794
|
-
description: "Settings for clearing stale
|
|
16410
|
+
description: "Settings for clearing stale or oversized tool result context. Use -1 to disable a threshold.",
|
|
15795
16411
|
showInDialog: false,
|
|
15796
16412
|
properties: {
|
|
15797
16413
|
toolResultsThresholdMinutes: {
|
|
@@ -15811,6 +16427,15 @@ var SETTINGS_SCHEMA = {
|
|
|
15811
16427
|
default: 5,
|
|
15812
16428
|
description: "Number of most-recent compactable tool results to preserve when clearing. Floor at 1.",
|
|
15813
16429
|
showInDialog: false
|
|
16430
|
+
},
|
|
16431
|
+
toolResultsTotalCharsThreshold: {
|
|
16432
|
+
type: "number",
|
|
16433
|
+
label: "Tool Results Total Chars Threshold",
|
|
16434
|
+
category: "Context",
|
|
16435
|
+
requiresRestart: false,
|
|
16436
|
+
default: DEFAULT_TOOL_RESULTS_TOTAL_CHARS_THRESHOLD,
|
|
16437
|
+
description: "Total compactable tool result output characters allowed in history before clearing oldest results. Use -1 to disable. This is a soft threshold: protected recent tool results may keep the total above it.",
|
|
16438
|
+
showInDialog: false
|
|
15814
16439
|
}
|
|
15815
16440
|
}
|
|
15816
16441
|
},
|
|
@@ -16320,13 +16945,22 @@ var SETTINGS_SCHEMA = {
|
|
|
16320
16945
|
description: "The number of lines to keep when truncating tool output.",
|
|
16321
16946
|
showInDialog: false
|
|
16322
16947
|
},
|
|
16948
|
+
toolOutputBatchBudget: {
|
|
16949
|
+
type: "number",
|
|
16950
|
+
label: "Tool Output Batch Budget",
|
|
16951
|
+
category: "General",
|
|
16952
|
+
requiresRestart: true,
|
|
16953
|
+
default: DEFAULT_TOOL_OUTPUT_BATCH_BUDGET,
|
|
16954
|
+
description: "Per-message budget (characters) for the combined output of one batch of tool calls; the largest results are offloaded to disk when exceeded. Set to -1 to disable.",
|
|
16955
|
+
showInDialog: false
|
|
16956
|
+
},
|
|
16323
16957
|
computerUse: {
|
|
16324
16958
|
type: "object",
|
|
16325
16959
|
label: "Computer Use",
|
|
16326
16960
|
category: "Tools",
|
|
16327
16961
|
requiresRestart: true,
|
|
16328
16962
|
default: {},
|
|
16329
|
-
description: "Cross-platform desktop automation via the
|
|
16963
|
+
description: "Cross-platform desktop automation via the cua-driver native driver (trycua/cua). On first invocation a pinned, signed + notarized binary (~20MB) is downloaded into ~/.qwen/computer-use/ and the user is walked through macOS Accessibility / Screen Recording permissions if needed. Exposes cua-driver's full tool surface (click, type_text, scroll, drag, press_key, get_window_state, page, launch_app, and more).",
|
|
16330
16964
|
showInDialog: false,
|
|
16331
16965
|
properties: {
|
|
16332
16966
|
enabled: {
|
|
@@ -16335,13 +16969,67 @@ var SETTINGS_SCHEMA = {
|
|
|
16335
16969
|
category: "Tools",
|
|
16336
16970
|
requiresRestart: true,
|
|
16337
16971
|
default: true,
|
|
16338
|
-
description: "When enabled (default), the
|
|
16972
|
+
description: "When enabled (default), the cua-driver computer_use__* tools are registered as deferred built-ins.",
|
|
16339
16973
|
showInDialog: true
|
|
16974
|
+
},
|
|
16975
|
+
maxImageDimension: {
|
|
16976
|
+
type: "number",
|
|
16977
|
+
label: "Max Screenshot Dimension",
|
|
16978
|
+
category: "Tools",
|
|
16979
|
+
requiresRestart: true,
|
|
16980
|
+
default: -1,
|
|
16981
|
+
description: "Longest-edge pixel cap applied to cua-driver screenshots (via set_config's max_image_dimension). -1 (default) keeps cua-driver's built-in default (1568); 0 disables resizing (full resolution); a positive value caps the longest edge. Lower caps cut vision-token cost at the expense of fine detail. Overridable via the QWEN_COMPUTER_USE_MAX_IMAGE_DIMENSION env var.",
|
|
16982
|
+
showInDialog: false
|
|
16340
16983
|
}
|
|
16341
16984
|
}
|
|
16342
16985
|
}
|
|
16343
16986
|
}
|
|
16344
16987
|
},
|
|
16988
|
+
policy: {
|
|
16989
|
+
type: "object",
|
|
16990
|
+
label: "Daemon Policy",
|
|
16991
|
+
category: "Daemon",
|
|
16992
|
+
requiresRestart: true,
|
|
16993
|
+
default: {},
|
|
16994
|
+
description: "Daemon multi-client coordination policies. Tool-level allow/deny rules live under `permissions`; this section is for runtime mediation behavior between concurrent HTTP clients sharing one `qwen serve` daemon.",
|
|
16995
|
+
showInDialog: false,
|
|
16996
|
+
properties: {
|
|
16997
|
+
permissionStrategy: {
|
|
16998
|
+
type: "enum",
|
|
16999
|
+
label: "Permission Mediation Policy",
|
|
17000
|
+
category: "Daemon",
|
|
17001
|
+
requiresRestart: true,
|
|
17002
|
+
default: "first-responder",
|
|
17003
|
+
description: 'How permission requests resolve when multiple clients are attached. `first-responder` (default) = any client decides, first wins. `designated` = only the prompt originator decides; falls back to first-responder if originator is anonymous. NOTE: client identity comes from self-declared X-Qwen-Client-Id with no proof-of-possession (pair-token identity is not implemented yet), so any client observing originatorClientId on SSE frames can register with the same id and impersonate the originator. `consensus` = N-of-M voters must agree. Default N=floor(M/2)+1, which means UNANIMITY for M=2 (quorum=2, both must agree) and supermajority for larger even M (M=4 \u2192 quorum=3; M=6 \u2192 quorum=4). For M=2 specifically, split votes resolve only via permissionTimeoutMs. `local-only` = only loopback clients can RESOLVE; remote clients can still ABORT a pending permission via the cancel sentinel ({outcome:"cancelled"}) \u2014 cancel stays cross-policy for consistency. Strict-cancel-too deployments need a dedicated loopback-bound daemon. Requires daemon restart \u2014 read once at boot.',
|
|
17004
|
+
showInDialog: true,
|
|
17005
|
+
options: [
|
|
17006
|
+
{ value: "first-responder", label: "First Responder" },
|
|
17007
|
+
{ value: "designated", label: "Designated Originator" },
|
|
17008
|
+
{ value: "consensus", label: "Consensus Quorum" },
|
|
17009
|
+
{ value: "local-only", label: "Local Only" }
|
|
17010
|
+
]
|
|
17011
|
+
},
|
|
17012
|
+
consensusQuorum: {
|
|
17013
|
+
type: "number",
|
|
17014
|
+
label: "Consensus Quorum Override",
|
|
17015
|
+
category: "Daemon",
|
|
17016
|
+
requiresRestart: true,
|
|
17017
|
+
default: void 0,
|
|
17018
|
+
description: "Optional fixed quorum size for consensus policy. Capped at M (count of registered voters at request issue time) to prevent unreachable quorum. Unset = floor(M/2)+1. Requires daemon restart \u2014 read once at boot.",
|
|
17019
|
+
showInDialog: false,
|
|
17020
|
+
// runQwenServe.ts validates `Number.isInteger(n) && n >= 1` and
|
|
17021
|
+
// refuses to boot otherwise. Override the generated schema so IDE
|
|
17022
|
+
// (VSCode, JetBrains via JSON Schema) flags `0`, `-1`, `1.5`
|
|
17023
|
+
// BEFORE the user restarts the daemon. The bare `type:'number'`
|
|
17024
|
+
// mapping accepts all of these.
|
|
17025
|
+
jsonSchemaOverride: {
|
|
17026
|
+
type: "integer",
|
|
17027
|
+
minimum: 1,
|
|
17028
|
+
description: "Optional fixed quorum size for consensus policy. Capped at M (count of registered voters at request issue time) to prevent unreachable quorum. Unset = floor(M/2)+1. Requires daemon restart \u2014 read once at boot."
|
|
17029
|
+
}
|
|
17030
|
+
}
|
|
17031
|
+
}
|
|
17032
|
+
},
|
|
16345
17033
|
mcp: {
|
|
16346
17034
|
type: "object",
|
|
16347
17035
|
label: "MCP",
|
|
@@ -16976,8 +17664,8 @@ function getDefaultValue(key) {
|
|
|
16976
17664
|
return getFlattenedSchema()[key]?.default;
|
|
16977
17665
|
}
|
|
16978
17666
|
__name(getDefaultValue, "getDefaultValue");
|
|
16979
|
-
function getNestedValue(obj,
|
|
16980
|
-
const [first, ...rest] =
|
|
17667
|
+
function getNestedValue(obj, path9) {
|
|
17668
|
+
const [first, ...rest] = path9;
|
|
16981
17669
|
if (!first || !(first in obj)) {
|
|
16982
17670
|
return void 0;
|
|
16983
17671
|
}
|
|
@@ -16991,8 +17679,8 @@ function getNestedValue(obj, path8) {
|
|
|
16991
17679
|
return void 0;
|
|
16992
17680
|
}
|
|
16993
17681
|
__name(getNestedValue, "getNestedValue");
|
|
16994
|
-
function getNestedProperty(obj,
|
|
16995
|
-
return getNestedValue(obj,
|
|
17682
|
+
function getNestedProperty(obj, path9) {
|
|
17683
|
+
return getNestedValue(obj, path9.split("."));
|
|
16996
17684
|
}
|
|
16997
17685
|
__name(getNestedProperty, "getNestedProperty");
|
|
16998
17686
|
function getEffectiveValue(key, settings, mergedSettings) {
|
|
@@ -17000,12 +17688,12 @@ function getEffectiveValue(key, settings, mergedSettings) {
|
|
|
17000
17688
|
if (!definition) {
|
|
17001
17689
|
return void 0;
|
|
17002
17690
|
}
|
|
17003
|
-
const
|
|
17004
|
-
let value = getNestedValue(settings,
|
|
17691
|
+
const path9 = key.split(".");
|
|
17692
|
+
let value = getNestedValue(settings, path9);
|
|
17005
17693
|
if (value !== void 0) {
|
|
17006
17694
|
return value;
|
|
17007
17695
|
}
|
|
17008
|
-
value = getNestedValue(mergedSettings,
|
|
17696
|
+
value = getNestedValue(mergedSettings, path9);
|
|
17009
17697
|
if (value !== void 0) {
|
|
17010
17698
|
return value;
|
|
17011
17699
|
}
|
|
@@ -17056,8 +17744,8 @@ function getDialogSettingKeys() {
|
|
|
17056
17744
|
}
|
|
17057
17745
|
__name(getDialogSettingKeys, "getDialogSettingKeys");
|
|
17058
17746
|
function settingExistsInScope(key, scopeSettings) {
|
|
17059
|
-
const
|
|
17060
|
-
const value = getNestedValue(scopeSettings,
|
|
17747
|
+
const path9 = key.split(".");
|
|
17748
|
+
const value = getNestedValue(scopeSettings, path9);
|
|
17061
17749
|
return value !== void 0;
|
|
17062
17750
|
}
|
|
17063
17751
|
__name(settingExistsInScope, "settingExistsInScope");
|
|
@@ -17070,8 +17758,8 @@ function pathHasUnsafeSegment(keys) {
|
|
|
17070
17758
|
return false;
|
|
17071
17759
|
}
|
|
17072
17760
|
__name(pathHasUnsafeSegment, "pathHasUnsafeSegment");
|
|
17073
|
-
function setNestedPropertyForce(obj,
|
|
17074
|
-
const keys =
|
|
17761
|
+
function setNestedPropertyForce(obj, path9, value) {
|
|
17762
|
+
const keys = path9.split(".");
|
|
17075
17763
|
if (pathHasUnsafeSegment(keys)) return;
|
|
17076
17764
|
const lastKey = keys.pop();
|
|
17077
17765
|
if (!lastKey) return;
|
|
@@ -17085,8 +17773,8 @@ function setNestedPropertyForce(obj, path8, value) {
|
|
|
17085
17773
|
current[lastKey] = value;
|
|
17086
17774
|
}
|
|
17087
17775
|
__name(setNestedPropertyForce, "setNestedPropertyForce");
|
|
17088
|
-
function setNestedPropertySafe(obj,
|
|
17089
|
-
const keys =
|
|
17776
|
+
function setNestedPropertySafe(obj, path9, value) {
|
|
17777
|
+
const keys = path9.split(".");
|
|
17090
17778
|
if (pathHasUnsafeSegment(keys)) return;
|
|
17091
17779
|
const lastKey = keys.pop();
|
|
17092
17780
|
if (!lastKey) return;
|
|
@@ -17105,8 +17793,8 @@ function setNestedPropertySafe(obj, path8, value) {
|
|
|
17105
17793
|
current[lastKey] = value;
|
|
17106
17794
|
}
|
|
17107
17795
|
__name(setNestedPropertySafe, "setNestedPropertySafe");
|
|
17108
|
-
function deleteNestedPropertySafe(obj,
|
|
17109
|
-
const keys =
|
|
17796
|
+
function deleteNestedPropertySafe(obj, path9) {
|
|
17797
|
+
const keys = path9.split(".");
|
|
17110
17798
|
const lastKey = keys.pop();
|
|
17111
17799
|
if (!lastKey) return;
|
|
17112
17800
|
let current = obj;
|
|
@@ -17138,10 +17826,10 @@ function getRestartRequiredFromModified(modifiedSettings) {
|
|
|
17138
17826
|
__name(getRestartRequiredFromModified, "getRestartRequiredFromModified");
|
|
17139
17827
|
function saveModifiedSettings(modifiedSettings, pendingSettings, loadedSettings, scope) {
|
|
17140
17828
|
modifiedSettings.forEach((settingKey) => {
|
|
17141
|
-
const
|
|
17829
|
+
const path9 = settingKey.split(".");
|
|
17142
17830
|
const value = getNestedValue(
|
|
17143
17831
|
pendingSettings,
|
|
17144
|
-
|
|
17832
|
+
path9
|
|
17145
17833
|
);
|
|
17146
17834
|
const existsInOriginalFile = settingExistsInScope(
|
|
17147
17835
|
settingKey,
|
|
@@ -17243,12 +17931,12 @@ function isPlainObject(item) {
|
|
|
17243
17931
|
return !!item && typeof item === "object" && !Array.isArray(item);
|
|
17244
17932
|
}
|
|
17245
17933
|
__name(isPlainObject, "isPlainObject");
|
|
17246
|
-
function mergeRecursively(target, source, getMergeStrategyForPath2,
|
|
17934
|
+
function mergeRecursively(target, source, getMergeStrategyForPath2, path9 = []) {
|
|
17247
17935
|
for (const key of Object.keys(source)) {
|
|
17248
17936
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
17249
17937
|
continue;
|
|
17250
17938
|
}
|
|
17251
|
-
const newPath = [...
|
|
17939
|
+
const newPath = [...path9, key];
|
|
17252
17940
|
const srcValue = source[key];
|
|
17253
17941
|
const objValue = target[key];
|
|
17254
17942
|
const mergeStrategy = getMergeStrategyForPath2(newPath);
|
|
@@ -18093,10 +18781,10 @@ __name(needsMigration, "needsMigration");
|
|
|
18093
18781
|
|
|
18094
18782
|
// packages/cli/src/config/settings.ts
|
|
18095
18783
|
var debugLogger3 = createDebugLogger("SETTINGS");
|
|
18096
|
-
function getMergeStrategyForPath(
|
|
18784
|
+
function getMergeStrategyForPath(path9) {
|
|
18097
18785
|
let current = void 0;
|
|
18098
18786
|
let currentSchema = getSettingsSchema();
|
|
18099
|
-
for (const key of
|
|
18787
|
+
for (const key of path9) {
|
|
18100
18788
|
if (!currentSchema || !currentSchema[key]) {
|
|
18101
18789
|
return void 0;
|
|
18102
18790
|
}
|
|
@@ -18112,7 +18800,7 @@ function getUserSettingsPath() {
|
|
|
18112
18800
|
}
|
|
18113
18801
|
__name(getUserSettingsPath, "getUserSettingsPath");
|
|
18114
18802
|
function getUserSettingsDir() {
|
|
18115
|
-
return
|
|
18803
|
+
return path4.dirname(getUserSettingsPath());
|
|
18116
18804
|
}
|
|
18117
18805
|
__name(getUserSettingsDir, "getUserSettingsDir");
|
|
18118
18806
|
var DEFAULT_EXCLUDED_ENV_VARS = ["DEBUG", "DEBUG_MODE"];
|
|
@@ -18121,9 +18809,34 @@ var ENV_WAS_RECOVERED = "QWEN_CODE_SETTINGS_WAS_RECOVERED";
|
|
|
18121
18809
|
var PROJECT_ENV_HARDCODED_EXCLUSIONS = [
|
|
18122
18810
|
"QWEN_HOME",
|
|
18123
18811
|
"QWEN_RUNTIME_DIR",
|
|
18812
|
+
"QWEN_CODE_MCP_APPROVALS_PATH",
|
|
18124
18813
|
ENV_CORRUPTED_PATH,
|
|
18125
18814
|
ENV_WAS_RECOVERED
|
|
18126
18815
|
];
|
|
18816
|
+
var RELOAD_EXCLUDED_KEYS = /* @__PURE__ */ new Set([
|
|
18817
|
+
...PROJECT_ENV_HARDCODED_EXCLUSIONS,
|
|
18818
|
+
"QWEN_SERVER_TOKEN",
|
|
18819
|
+
"QWEN_CLI_ENTRY",
|
|
18820
|
+
"NODE_OPTIONS",
|
|
18821
|
+
"NODE_PATH",
|
|
18822
|
+
"NODE_TLS_REJECT_UNAUTHORIZED",
|
|
18823
|
+
"LD_PRELOAD",
|
|
18824
|
+
"LD_AUDIT",
|
|
18825
|
+
"LD_LIBRARY_PATH",
|
|
18826
|
+
"DYLD_INSERT_LIBRARIES",
|
|
18827
|
+
"DYLD_LIBRARY_PATH",
|
|
18828
|
+
"BASH_ENV",
|
|
18829
|
+
"ENV",
|
|
18830
|
+
"PATH",
|
|
18831
|
+
"HOME",
|
|
18832
|
+
"TMPDIR",
|
|
18833
|
+
"TMP",
|
|
18834
|
+
"TEMP"
|
|
18835
|
+
]);
|
|
18836
|
+
var dotEnvSourcedKeys = /* @__PURE__ */ new Set();
|
|
18837
|
+
var settingsEnvSourcedKeys = /* @__PURE__ */ new Set();
|
|
18838
|
+
var lastReloadSnapshot = /* @__PURE__ */ new Map();
|
|
18839
|
+
var lastReloadSnapshotSeeded = false;
|
|
18127
18840
|
var SETTINGS_VERSION = 4;
|
|
18128
18841
|
var SETTINGS_VERSION_KEY = "$version";
|
|
18129
18842
|
function getSystemSettingsPath() {
|
|
@@ -18143,8 +18856,8 @@ function getSystemDefaultsPath() {
|
|
|
18143
18856
|
if (process2.env["QWEN_CODE_SYSTEM_DEFAULTS_PATH"]) {
|
|
18144
18857
|
return process2.env["QWEN_CODE_SYSTEM_DEFAULTS_PATH"];
|
|
18145
18858
|
}
|
|
18146
|
-
return
|
|
18147
|
-
|
|
18859
|
+
return path4.join(
|
|
18860
|
+
path4.dirname(getSystemSettingsPath()),
|
|
18148
18861
|
"system-defaults.json"
|
|
18149
18862
|
);
|
|
18150
18863
|
}
|
|
@@ -18254,8 +18967,20 @@ function getSettingsWarnings(loadedSettings) {
|
|
|
18254
18967
|
return [...warningSet];
|
|
18255
18968
|
}
|
|
18256
18969
|
__name(getSettingsWarnings, "getSettingsWarnings");
|
|
18970
|
+
function tagMcpServerScope(settings, scope) {
|
|
18971
|
+
const servers = settings.mcpServers;
|
|
18972
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
18973
|
+
return settings;
|
|
18974
|
+
}
|
|
18975
|
+
const tagged = {};
|
|
18976
|
+
for (const [name, config] of Object.entries(servers)) {
|
|
18977
|
+
tagged[name] = { ...config, scope };
|
|
18978
|
+
}
|
|
18979
|
+
return { ...settings, mcpServers: tagged };
|
|
18980
|
+
}
|
|
18981
|
+
__name(tagMcpServerScope, "tagMcpServerScope");
|
|
18257
18982
|
function mergeSettings(system, systemDefaults, user, workspace, isTrusted) {
|
|
18258
|
-
const safeWorkspace = isTrusted ? workspace : {};
|
|
18983
|
+
const safeWorkspace = isTrusted ? tagMcpServerScope(workspace, "workspace") : {};
|
|
18259
18984
|
return customDeepMerge(
|
|
18260
18985
|
getMergeStrategyForPath,
|
|
18261
18986
|
{},
|
|
@@ -18263,7 +18988,7 @@ function mergeSettings(system, systemDefaults, user, workspace, isTrusted) {
|
|
|
18263
18988
|
systemDefaults,
|
|
18264
18989
|
user,
|
|
18265
18990
|
safeWorkspace,
|
|
18266
|
-
system
|
|
18991
|
+
tagMcpServerScope(system, "system")
|
|
18267
18992
|
);
|
|
18268
18993
|
}
|
|
18269
18994
|
__name(mergeSettings, "mergeSettings");
|
|
@@ -18404,10 +19129,10 @@ function getUserLevelEnvPaths() {
|
|
|
18404
19129
|
const homeDir = homedir();
|
|
18405
19130
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18406
19131
|
const paths = /* @__PURE__ */ new Set([
|
|
18407
|
-
|
|
18408
|
-
|
|
19132
|
+
path4.normalize(path4.join(homeDir, ".env")),
|
|
19133
|
+
path4.normalize(path4.join(globalQwenDir, ".env"))
|
|
18409
19134
|
]);
|
|
18410
|
-
const legacyQwenEnv =
|
|
19135
|
+
const legacyQwenEnv = path4.normalize(path4.join(homeDir, QWEN_DIR, ".env"));
|
|
18411
19136
|
paths.add(legacyQwenEnv);
|
|
18412
19137
|
return paths;
|
|
18413
19138
|
}
|
|
@@ -18423,9 +19148,9 @@ function preResolveHomeEnvOverrides() {
|
|
|
18423
19148
|
}
|
|
18424
19149
|
const initialQwenHome = process2.env["QWEN_HOME"];
|
|
18425
19150
|
const initialQwenDir = Storage.getGlobalQwenDir();
|
|
18426
|
-
const candidates = [
|
|
19151
|
+
const candidates = [path4.join(initialQwenDir, ".env")];
|
|
18427
19152
|
if (!initialQwenHome) {
|
|
18428
|
-
candidates.push(
|
|
19153
|
+
candidates.push(path4.join(path4.dirname(initialQwenDir), ".env"));
|
|
18429
19154
|
}
|
|
18430
19155
|
for (const candidate of candidates) {
|
|
18431
19156
|
readHomeEnvInto(candidate);
|
|
@@ -18434,7 +19159,7 @@ function preResolveHomeEnvOverrides() {
|
|
|
18434
19159
|
if (discoveredQwenHome && discoveredQwenHome !== initialQwenHome) {
|
|
18435
19160
|
const discoveredDir = Storage.getGlobalQwenDir();
|
|
18436
19161
|
if (discoveredDir !== initialQwenDir) {
|
|
18437
|
-
readHomeEnvInto(
|
|
19162
|
+
readHomeEnvInto(path4.join(discoveredDir, ".env"));
|
|
18438
19163
|
}
|
|
18439
19164
|
}
|
|
18440
19165
|
}
|
|
@@ -18456,9 +19181,9 @@ function readHomeEnvInto(file) {
|
|
|
18456
19181
|
__name(readHomeEnvInto, "readHomeEnvInto");
|
|
18457
19182
|
function getHomeEnvFallbackVars() {
|
|
18458
19183
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18459
|
-
const candidates = [
|
|
19184
|
+
const candidates = [path4.join(globalQwenDir, ".env")];
|
|
18460
19185
|
if (!process2.env["QWEN_HOME"]) {
|
|
18461
|
-
candidates.push(
|
|
19186
|
+
candidates.push(path4.join(path4.dirname(globalQwenDir), ".env"));
|
|
18462
19187
|
}
|
|
18463
19188
|
const result = {};
|
|
18464
19189
|
for (const candidate of candidates) {
|
|
@@ -18494,13 +19219,13 @@ function detectQwenHomeRedirectWithoutMigration(activeUserSettingsPath) {
|
|
|
18494
19219
|
} finally {
|
|
18495
19220
|
process2.env["QWEN_HOME"] = savedQwenHome;
|
|
18496
19221
|
}
|
|
18497
|
-
if (
|
|
19222
|
+
if (path4.resolve(activeQwenDir) === path4.resolve(legacyQwenDir)) {
|
|
18498
19223
|
return null;
|
|
18499
19224
|
}
|
|
18500
19225
|
if (fs6.existsSync(activeUserSettingsPath)) {
|
|
18501
19226
|
return null;
|
|
18502
19227
|
}
|
|
18503
|
-
const legacyUserSettings =
|
|
19228
|
+
const legacyUserSettings = path4.join(legacyQwenDir, "settings.json");
|
|
18504
19229
|
if (!fs6.existsSync(legacyUserSettings)) {
|
|
18505
19230
|
return null;
|
|
18506
19231
|
}
|
|
@@ -18511,15 +19236,15 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18511
19236
|
const homeDir = homedir();
|
|
18512
19237
|
const isTrusted = isWorkspaceTrusted(settings).isTrusted;
|
|
18513
19238
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18514
|
-
const legacyQwenDir =
|
|
18515
|
-
const hasCustomConfigDir =
|
|
18516
|
-
const canUseEnvFile = /* @__PURE__ */ __name((filePath) => isTrusted !== false || userLevelPaths.has(
|
|
19239
|
+
const legacyQwenDir = path4.normalize(path4.join(homeDir, QWEN_DIR));
|
|
19240
|
+
const hasCustomConfigDir = path4.normalize(globalQwenDir) !== legacyQwenDir;
|
|
19241
|
+
const canUseEnvFile = /* @__PURE__ */ __name((filePath) => isTrusted !== false || userLevelPaths.has(path4.normalize(filePath)), "canUseEnvFile");
|
|
18517
19242
|
const findHomeCandidate = /* @__PURE__ */ __name(() => {
|
|
18518
|
-
const candidates = [
|
|
19243
|
+
const candidates = [path4.join(globalQwenDir, ".env")];
|
|
18519
19244
|
if (hasCustomConfigDir) {
|
|
18520
|
-
candidates.push(
|
|
19245
|
+
candidates.push(path4.join(legacyQwenDir, ".env"));
|
|
18521
19246
|
}
|
|
18522
|
-
candidates.push(
|
|
19247
|
+
candidates.push(path4.join(homeDir, ".env"));
|
|
18523
19248
|
for (const candidate of candidates) {
|
|
18524
19249
|
if (fs6.existsSync(candidate) && canUseEnvFile(candidate)) {
|
|
18525
19250
|
return candidate;
|
|
@@ -18527,7 +19252,7 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18527
19252
|
}
|
|
18528
19253
|
return null;
|
|
18529
19254
|
}, "findHomeCandidate");
|
|
18530
|
-
let currentDir =
|
|
19255
|
+
let currentDir = path4.resolve(startDir);
|
|
18531
19256
|
let visitedHomeDir = false;
|
|
18532
19257
|
while (true) {
|
|
18533
19258
|
if (currentDir === homeDir) {
|
|
@@ -18535,16 +19260,16 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18535
19260
|
const found = findHomeCandidate();
|
|
18536
19261
|
if (found) return found;
|
|
18537
19262
|
} else {
|
|
18538
|
-
const geminiEnvPath =
|
|
19263
|
+
const geminiEnvPath = path4.join(currentDir, QWEN_DIR, ".env");
|
|
18539
19264
|
if (fs6.existsSync(geminiEnvPath) && canUseEnvFile(geminiEnvPath)) {
|
|
18540
19265
|
return geminiEnvPath;
|
|
18541
19266
|
}
|
|
18542
|
-
const envPath =
|
|
19267
|
+
const envPath = path4.join(currentDir, ".env");
|
|
18543
19268
|
if (fs6.existsSync(envPath) && canUseEnvFile(envPath)) {
|
|
18544
19269
|
return envPath;
|
|
18545
19270
|
}
|
|
18546
19271
|
}
|
|
18547
|
-
const parentDir =
|
|
19272
|
+
const parentDir = path4.dirname(currentDir);
|
|
18548
19273
|
if (parentDir === currentDir || !parentDir) {
|
|
18549
19274
|
return visitedHomeDir ? null : findHomeCandidate();
|
|
18550
19275
|
}
|
|
@@ -18577,9 +19302,9 @@ function loadEnvironment(settings) {
|
|
|
18577
19302
|
const envFileContent = fs6.readFileSync(envFilePath, "utf-8");
|
|
18578
19303
|
const parsedEnv = dotenv.parse(envFileContent);
|
|
18579
19304
|
const excludedVars = settings?.advanced?.excludedEnvVars || DEFAULT_EXCLUDED_ENV_VARS;
|
|
18580
|
-
const normalizedEnvFilePath =
|
|
19305
|
+
const normalizedEnvFilePath = path4.normalize(envFilePath);
|
|
18581
19306
|
const isHomeScopedEnvFile = userLevelPaths.has(normalizedEnvFilePath);
|
|
18582
|
-
const isQwenScopedEnvFile = isHomeScopedEnvFile ||
|
|
19307
|
+
const isQwenScopedEnvFile = isHomeScopedEnvFile || path4.basename(path4.dirname(normalizedEnvFilePath)) === QWEN_DIR;
|
|
18583
19308
|
for (const key in parsedEnv) {
|
|
18584
19309
|
if (Object.hasOwn(parsedEnv, key)) {
|
|
18585
19310
|
if (!isHomeScopedEnvFile && PROJECT_ENV_HARDCODED_EXCLUSIONS.includes(key)) {
|
|
@@ -18590,6 +19315,10 @@ function loadEnvironment(settings) {
|
|
|
18590
19315
|
}
|
|
18591
19316
|
if (!Object.hasOwn(process2.env, key)) {
|
|
18592
19317
|
process2.env[key] = parsedEnv[key];
|
|
19318
|
+
dotEnvSourcedKeys.add(key);
|
|
19319
|
+
}
|
|
19320
|
+
if (!lastReloadSnapshotSeeded) {
|
|
19321
|
+
lastReloadSnapshot.set(key, parsedEnv[key]);
|
|
18593
19322
|
}
|
|
18594
19323
|
}
|
|
18595
19324
|
}
|
|
@@ -18603,13 +19332,110 @@ function loadEnvironment(settings) {
|
|
|
18603
19332
|
}
|
|
18604
19333
|
if (!Object.hasOwn(process2.env, key) && typeof value === "string") {
|
|
18605
19334
|
process2.env[key] = value;
|
|
19335
|
+
settingsEnvSourcedKeys.add(key);
|
|
19336
|
+
}
|
|
19337
|
+
if (!lastReloadSnapshotSeeded && typeof value === "string" && !lastReloadSnapshot.has(key)) {
|
|
19338
|
+
lastReloadSnapshot.set(key, value);
|
|
18606
19339
|
}
|
|
18607
19340
|
}
|
|
18608
19341
|
}
|
|
19342
|
+
lastReloadSnapshotSeeded = true;
|
|
18609
19343
|
}
|
|
18610
19344
|
__name(loadEnvironment, "loadEnvironment");
|
|
19345
|
+
function reloadEnvironment(settings, workspaceCwd) {
|
|
19346
|
+
const userLevelPaths = getUserLevelEnvPaths();
|
|
19347
|
+
const envFilePath = findEnvFile(settings, workspaceCwd, userLevelPaths);
|
|
19348
|
+
if (process2.env["CLOUD_SHELL"] === "true") {
|
|
19349
|
+
setUpCloudShellEnvironment(envFilePath);
|
|
19350
|
+
}
|
|
19351
|
+
let dotEnvReadFailed = false;
|
|
19352
|
+
const newDotEnvKeys = /* @__PURE__ */ new Map();
|
|
19353
|
+
const newSettingsEnvKeys = /* @__PURE__ */ new Map();
|
|
19354
|
+
if (envFilePath) {
|
|
19355
|
+
try {
|
|
19356
|
+
const envFileContent = fs6.readFileSync(envFilePath, "utf-8");
|
|
19357
|
+
const parsedEnv = dotenv.parse(envFileContent);
|
|
19358
|
+
const excludedVars = settings?.advanced?.excludedEnvVars || DEFAULT_EXCLUDED_ENV_VARS;
|
|
19359
|
+
const normalizedEnvFilePath = path4.normalize(envFilePath);
|
|
19360
|
+
const isHomeScopedEnvFile = userLevelPaths.has(normalizedEnvFilePath);
|
|
19361
|
+
const isQwenScopedEnvFile = isHomeScopedEnvFile || path4.basename(path4.dirname(normalizedEnvFilePath)) === QWEN_DIR;
|
|
19362
|
+
for (const key in parsedEnv) {
|
|
19363
|
+
if (!Object.hasOwn(parsedEnv, key)) continue;
|
|
19364
|
+
if (RELOAD_EXCLUDED_KEYS.has(key)) continue;
|
|
19365
|
+
if (!isHomeScopedEnvFile && PROJECT_ENV_HARDCODED_EXCLUSIONS.includes(key)) {
|
|
19366
|
+
continue;
|
|
19367
|
+
}
|
|
19368
|
+
if (!isQwenScopedEnvFile && excludedVars.includes(key)) continue;
|
|
19369
|
+
newDotEnvKeys.set(key, parsedEnv[key]);
|
|
19370
|
+
}
|
|
19371
|
+
} catch {
|
|
19372
|
+
dotEnvReadFailed = true;
|
|
19373
|
+
}
|
|
19374
|
+
}
|
|
19375
|
+
if (settings.env) {
|
|
19376
|
+
for (const [key, value] of Object.entries(settings.env)) {
|
|
19377
|
+
if (RELOAD_EXCLUDED_KEYS.has(key)) continue;
|
|
19378
|
+
if (PROJECT_ENV_HARDCODED_EXCLUSIONS.includes(key)) continue;
|
|
19379
|
+
if (typeof value !== "string") continue;
|
|
19380
|
+
if (newDotEnvKeys.has(key)) continue;
|
|
19381
|
+
if (dotEnvReadFailed && lastReloadSnapshot.has(key)) continue;
|
|
19382
|
+
newSettingsEnvKeys.set(key, value);
|
|
19383
|
+
}
|
|
19384
|
+
}
|
|
19385
|
+
const allNewKeys = /* @__PURE__ */ new Set([
|
|
19386
|
+
...newDotEnvKeys.keys(),
|
|
19387
|
+
...newSettingsEnvKeys.keys()
|
|
19388
|
+
]);
|
|
19389
|
+
const updatedKeys = [];
|
|
19390
|
+
const removedKeys = [];
|
|
19391
|
+
if (!dotEnvReadFailed) {
|
|
19392
|
+
const previouslyKnown = /* @__PURE__ */ new Set([
|
|
19393
|
+
...lastReloadSnapshot.keys(),
|
|
19394
|
+
...dotEnvSourcedKeys,
|
|
19395
|
+
...settingsEnvSourcedKeys
|
|
19396
|
+
]);
|
|
19397
|
+
for (const key of previouslyKnown) {
|
|
19398
|
+
if (!allNewKeys.has(key) && !RELOAD_EXCLUDED_KEYS.has(key)) {
|
|
19399
|
+
delete process2.env[key];
|
|
19400
|
+
removedKeys.push(key);
|
|
19401
|
+
}
|
|
19402
|
+
}
|
|
19403
|
+
}
|
|
19404
|
+
for (const [key, value] of newDotEnvKeys) {
|
|
19405
|
+
if (process2.env[key] !== value) {
|
|
19406
|
+
updatedKeys.push(key);
|
|
19407
|
+
}
|
|
19408
|
+
process2.env[key] = value;
|
|
19409
|
+
}
|
|
19410
|
+
for (const [key, value] of newSettingsEnvKeys) {
|
|
19411
|
+
if (process2.env[key] !== value) {
|
|
19412
|
+
updatedKeys.push(key);
|
|
19413
|
+
}
|
|
19414
|
+
process2.env[key] = value;
|
|
19415
|
+
}
|
|
19416
|
+
if (!dotEnvReadFailed) {
|
|
19417
|
+
dotEnvSourcedKeys.clear();
|
|
19418
|
+
for (const key of newDotEnvKeys.keys()) {
|
|
19419
|
+
dotEnvSourcedKeys.add(key);
|
|
19420
|
+
}
|
|
19421
|
+
lastReloadSnapshot.clear();
|
|
19422
|
+
for (const [key, value] of newDotEnvKeys) {
|
|
19423
|
+
lastReloadSnapshot.set(key, value);
|
|
19424
|
+
}
|
|
19425
|
+
for (const [key, value] of newSettingsEnvKeys) {
|
|
19426
|
+
lastReloadSnapshot.set(key, value);
|
|
19427
|
+
}
|
|
19428
|
+
}
|
|
19429
|
+
settingsEnvSourcedKeys.clear();
|
|
19430
|
+
for (const key of newSettingsEnvKeys.keys()) {
|
|
19431
|
+
settingsEnvSourcedKeys.add(key);
|
|
19432
|
+
}
|
|
19433
|
+
return { updatedKeys, removedKeys };
|
|
19434
|
+
}
|
|
19435
|
+
__name(reloadEnvironment, "reloadEnvironment");
|
|
18611
19436
|
var CORRUPTED_SUFFIX = ".corrupted";
|
|
18612
19437
|
function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars = true) {
|
|
19438
|
+
const opts = typeof consumeCorruptionEnvVars === "object" ? consumeCorruptionEnvVars : { consumeCorruptionEnvVars };
|
|
18613
19439
|
preResolveHomeEnvOverrides();
|
|
18614
19440
|
const userSettingsPath = getUserSettingsPath();
|
|
18615
19441
|
const qwenHomeRedirectWarning = detectQwenHomeRedirectWithoutMigration(userSettingsPath);
|
|
@@ -18621,8 +19447,8 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18621
19447
|
const systemSettingsPath = getSystemSettingsPath();
|
|
18622
19448
|
const systemDefaultsPath = getSystemDefaultsPath();
|
|
18623
19449
|
const migratedInMemorScopes = /* @__PURE__ */ new Set();
|
|
18624
|
-
const resolvedWorkspaceDir =
|
|
18625
|
-
const resolvedHomeDir =
|
|
19450
|
+
const resolvedWorkspaceDir = path4.resolve(workspaceDir);
|
|
19451
|
+
const resolvedHomeDir = path4.resolve(homedir());
|
|
18626
19452
|
let realWorkspaceDir = resolvedWorkspaceDir;
|
|
18627
19453
|
try {
|
|
18628
19454
|
realWorkspaceDir = fs6.realpathSync(resolvedWorkspaceDir);
|
|
@@ -18692,7 +19518,7 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18692
19518
|
}
|
|
18693
19519
|
}
|
|
18694
19520
|
const envCorruptedPath = process2.env[ENV_CORRUPTED_PATH];
|
|
18695
|
-
if (consumeCorruptionEnvVars && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
|
|
19521
|
+
if ((opts.consumeCorruptionEnvVars ?? true) && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
|
|
18696
19522
|
corruptedSaved = true;
|
|
18697
19523
|
recoveredFromEnvVar = process2.env[ENV_WAS_RECOVERED] === "1";
|
|
18698
19524
|
delete process2.env[ENV_CORRUPTED_PATH];
|
|
@@ -18823,7 +19649,9 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18823
19649
|
workspaceSettings,
|
|
18824
19650
|
isTrusted
|
|
18825
19651
|
);
|
|
18826
|
-
|
|
19652
|
+
if (!opts.skipLoadEnvironment) {
|
|
19653
|
+
loadEnvironment(tempMergedSettings);
|
|
19654
|
+
}
|
|
18827
19655
|
if (settingsErrors.length > 0) {
|
|
18828
19656
|
const errorMessages = settingsErrors.map(
|
|
18829
19657
|
(error) => `Error in ${error.path}: ${error.message}`
|
|
@@ -18881,7 +19709,7 @@ function createSettingsUpdate(key, value) {
|
|
|
18881
19709
|
__name(createSettingsUpdate, "createSettingsUpdate");
|
|
18882
19710
|
function saveSettings(settingsFile, updates = settingsFile.originalSettings, replacePath = []) {
|
|
18883
19711
|
try {
|
|
18884
|
-
const dirPath =
|
|
19712
|
+
const dirPath = path4.dirname(settingsFile.path);
|
|
18885
19713
|
if (!fs6.existsSync(dirPath)) {
|
|
18886
19714
|
fs6.mkdirSync(dirPath, { recursive: true });
|
|
18887
19715
|
}
|
|
@@ -18912,26 +19740,26 @@ init_esbuild_shims();
|
|
|
18912
19740
|
|
|
18913
19741
|
// node_modules/read-package-up/index.js
|
|
18914
19742
|
init_esbuild_shims();
|
|
18915
|
-
import
|
|
19743
|
+
import path7 from "node:path";
|
|
18916
19744
|
|
|
18917
19745
|
// node_modules/find-up-simple/index.js
|
|
18918
19746
|
init_esbuild_shims();
|
|
18919
19747
|
import process3 from "node:process";
|
|
18920
19748
|
import fsPromises from "node:fs/promises";
|
|
18921
19749
|
import { fileURLToPath } from "node:url";
|
|
18922
|
-
import
|
|
19750
|
+
import path5 from "node:path";
|
|
18923
19751
|
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
18924
19752
|
async function findUp(name, {
|
|
18925
19753
|
cwd = process3.cwd(),
|
|
18926
19754
|
type = "file",
|
|
18927
19755
|
stopAt
|
|
18928
19756
|
} = {}) {
|
|
18929
|
-
let directory =
|
|
18930
|
-
const { root } =
|
|
18931
|
-
stopAt =
|
|
18932
|
-
const isAbsoluteName =
|
|
19757
|
+
let directory = path5.resolve(toPath(cwd) ?? "");
|
|
19758
|
+
const { root } = path5.parse(directory);
|
|
19759
|
+
stopAt = path5.resolve(directory, toPath(stopAt ?? root));
|
|
19760
|
+
const isAbsoluteName = path5.isAbsolute(name);
|
|
18933
19761
|
while (directory) {
|
|
18934
|
-
const filePath = isAbsoluteName ? name :
|
|
19762
|
+
const filePath = isAbsoluteName ? name : path5.join(directory, name);
|
|
18935
19763
|
try {
|
|
18936
19764
|
const stats = await fsPromises.stat(filePath);
|
|
18937
19765
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
|
|
@@ -18942,7 +19770,7 @@ async function findUp(name, {
|
|
|
18942
19770
|
if (directory === stopAt || directory === root) {
|
|
18943
19771
|
break;
|
|
18944
19772
|
}
|
|
18945
|
-
directory =
|
|
19773
|
+
directory = path5.dirname(directory);
|
|
18946
19774
|
}
|
|
18947
19775
|
}
|
|
18948
19776
|
__name(findUp, "findUp");
|
|
@@ -18950,7 +19778,7 @@ __name(findUp, "findUp");
|
|
|
18950
19778
|
// node_modules/read-pkg/index.js
|
|
18951
19779
|
init_esbuild_shims();
|
|
18952
19780
|
import fsPromises2 from "node:fs/promises";
|
|
18953
|
-
import
|
|
19781
|
+
import path6 from "node:path";
|
|
18954
19782
|
|
|
18955
19783
|
// node_modules/parse-json/index.js
|
|
18956
19784
|
init_esbuild_shims();
|
|
@@ -19089,7 +19917,7 @@ function toPath2(urlOrPath) {
|
|
|
19089
19917
|
__name(toPath2, "toPath");
|
|
19090
19918
|
|
|
19091
19919
|
// node_modules/read-pkg/index.js
|
|
19092
|
-
var getPackagePath = /* @__PURE__ */ __name((cwd) =>
|
|
19920
|
+
var getPackagePath = /* @__PURE__ */ __name((cwd) => path6.resolve(toPath2(cwd) ?? ".", "package.json"), "getPackagePath");
|
|
19093
19921
|
var _readPackage = /* @__PURE__ */ __name((file, normalize3) => {
|
|
19094
19922
|
const json = typeof file === "string" ? parseJson(file) : file;
|
|
19095
19923
|
if (normalize3) {
|
|
@@ -19110,7 +19938,7 @@ async function readPackageUp(options) {
|
|
|
19110
19938
|
return;
|
|
19111
19939
|
}
|
|
19112
19940
|
return {
|
|
19113
|
-
packageJson: await readPackage({ ...options, cwd:
|
|
19941
|
+
packageJson: await readPackage({ ...options, cwd: path7.dirname(filePath) }),
|
|
19114
19942
|
path: filePath
|
|
19115
19943
|
};
|
|
19116
19944
|
}
|
|
@@ -19118,9 +19946,9 @@ __name(readPackageUp, "readPackageUp");
|
|
|
19118
19946
|
|
|
19119
19947
|
// packages/cli/src/utils/package.ts
|
|
19120
19948
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
19121
|
-
import
|
|
19949
|
+
import path8 from "node:path";
|
|
19122
19950
|
var __filename = fileURLToPath3(import.meta.url);
|
|
19123
|
-
var __dirname =
|
|
19951
|
+
var __dirname = path8.dirname(__filename);
|
|
19124
19952
|
var packageJson;
|
|
19125
19953
|
async function getPackageJson() {
|
|
19126
19954
|
if (packageJson) {
|
|
@@ -19138,16 +19966,10 @@ __name(getPackageJson, "getPackageJson");
|
|
|
19138
19966
|
// packages/cli/src/utils/version.ts
|
|
19139
19967
|
async function getCliVersion() {
|
|
19140
19968
|
const pkgJson = await getPackageJson();
|
|
19141
|
-
return "0.18.
|
|
19969
|
+
return "0.18.1";
|
|
19142
19970
|
}
|
|
19143
19971
|
__name(getCliVersion, "getCliVersion");
|
|
19144
19972
|
|
|
19145
|
-
// packages/cli/src/utils/systemInfo.ts
|
|
19146
|
-
init_esbuild_shims();
|
|
19147
|
-
import process4 from "node:process";
|
|
19148
|
-
import os from "node:os";
|
|
19149
|
-
import { execFile } from "node:child_process";
|
|
19150
|
-
|
|
19151
19973
|
// packages/cli/src/ui/utils/formatters.ts
|
|
19152
19974
|
init_esbuild_shims();
|
|
19153
19975
|
var formatMemoryUsage = /* @__PURE__ */ __name((bytes) => {
|
|
@@ -19231,25 +20053,86 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds, options) => {
|
|
|
19231
20053
|
return parts.join(" ");
|
|
19232
20054
|
}, "formatDuration");
|
|
19233
20055
|
|
|
20056
|
+
// packages/cli/src/config/loadedSettingsAdapter.ts
|
|
20057
|
+
init_esbuild_shims();
|
|
20058
|
+
function createLoadedSettingsAdapter(settings, scope) {
|
|
20059
|
+
const persistScope = scope ?? getPersistScopeForModelSelection(settings);
|
|
20060
|
+
const settingsFile = settings.forScope(persistScope);
|
|
20061
|
+
let settingsSnapshot = null;
|
|
20062
|
+
let originalSnapshot = null;
|
|
20063
|
+
return {
|
|
20064
|
+
getValue(key) {
|
|
20065
|
+
return getNestedProperty(settings.merged, key);
|
|
20066
|
+
},
|
|
20067
|
+
setValue(key, value) {
|
|
20068
|
+
for (const part of key.split(".")) {
|
|
20069
|
+
if (part === "__proto__" || part === "constructor" || part === "prototype") {
|
|
20070
|
+
throw new Error(
|
|
20071
|
+
`Refusing to write settings key with reserved segment: ${key}`
|
|
20072
|
+
);
|
|
20073
|
+
}
|
|
20074
|
+
}
|
|
20075
|
+
settings.setValue(persistScope, key, value);
|
|
20076
|
+
},
|
|
20077
|
+
getModelProviders() {
|
|
20078
|
+
return settings.merged.modelProviders ?? {};
|
|
20079
|
+
},
|
|
20080
|
+
persist() {
|
|
20081
|
+
},
|
|
20082
|
+
backup() {
|
|
20083
|
+
backupSettingsFile(settingsFile.path);
|
|
20084
|
+
settingsSnapshot = structuredClone(settingsFile.settings);
|
|
20085
|
+
originalSnapshot = structuredClone(settingsFile.originalSettings);
|
|
20086
|
+
},
|
|
20087
|
+
restore() {
|
|
20088
|
+
const restored = restoreSettingsFromBackup(settingsFile.path);
|
|
20089
|
+
if (!restored) {
|
|
20090
|
+
console.error(
|
|
20091
|
+
`[loadedSettingsAdapter] On-disk rollback of ${settingsFile.path} failed; in-memory state was restored but the file may be inconsistent. Re-run /auth or inspect the file directly to recover.`
|
|
20092
|
+
);
|
|
20093
|
+
}
|
|
20094
|
+
if (settingsSnapshot !== null) {
|
|
20095
|
+
settingsFile.settings = settingsSnapshot;
|
|
20096
|
+
}
|
|
20097
|
+
if (originalSnapshot !== null) {
|
|
20098
|
+
settingsFile.originalSettings = originalSnapshot;
|
|
20099
|
+
}
|
|
20100
|
+
settings.recomputeMerged();
|
|
20101
|
+
},
|
|
20102
|
+
cleanupBackup() {
|
|
20103
|
+
cleanupSettingsBackup(settingsFile.path);
|
|
20104
|
+
settingsSnapshot = null;
|
|
20105
|
+
originalSnapshot = null;
|
|
20106
|
+
}
|
|
20107
|
+
};
|
|
20108
|
+
}
|
|
20109
|
+
__name(createLoadedSettingsAdapter, "createLoadedSettingsAdapter");
|
|
20110
|
+
|
|
20111
|
+
// packages/cli/src/utils/systemInfo.ts
|
|
20112
|
+
init_esbuild_shims();
|
|
20113
|
+
import process4 from "node:process";
|
|
20114
|
+
import os from "node:os";
|
|
20115
|
+
import { execFile } from "node:child_process";
|
|
20116
|
+
|
|
19234
20117
|
// packages/cli/src/generated/git-commit.ts
|
|
19235
20118
|
init_esbuild_shims();
|
|
19236
|
-
var GIT_COMMIT_INFO = "
|
|
20119
|
+
var GIT_COMMIT_INFO = "40697db8e";
|
|
19237
20120
|
|
|
19238
20121
|
// packages/cli/src/utils/systemInfo.ts
|
|
19239
20122
|
var debugLogger4 = createDebugLogger("STATUS");
|
|
19240
20123
|
var VERSION_PROBE_TIMEOUT_MS = 5e3;
|
|
19241
20124
|
function probeVersion(binary) {
|
|
19242
|
-
return new Promise((
|
|
20125
|
+
return new Promise((resolve3) => {
|
|
19243
20126
|
execFile(
|
|
19244
20127
|
binary,
|
|
19245
20128
|
["--version"],
|
|
19246
20129
|
{ timeout: VERSION_PROBE_TIMEOUT_MS, encoding: "utf-8" },
|
|
19247
20130
|
(err, stdout) => {
|
|
19248
20131
|
if (err) {
|
|
19249
|
-
|
|
20132
|
+
resolve3("unknown");
|
|
19250
20133
|
return;
|
|
19251
20134
|
}
|
|
19252
|
-
|
|
20135
|
+
resolve3(typeof stdout === "string" ? stdout.trim() : "unknown");
|
|
19253
20136
|
}
|
|
19254
20137
|
);
|
|
19255
20138
|
});
|
|
@@ -19387,6 +20270,9 @@ __name(formatLspStatusSnapshot, "formatLspStatusSnapshot");
|
|
|
19387
20270
|
|
|
19388
20271
|
export {
|
|
19389
20272
|
require_strip_json_comments,
|
|
20273
|
+
resolveColor,
|
|
20274
|
+
subtleBandColor,
|
|
20275
|
+
supportsTrueColor,
|
|
19390
20276
|
lightTheme,
|
|
19391
20277
|
darkTheme,
|
|
19392
20278
|
ansiTheme,
|
|
@@ -19396,13 +20282,16 @@ export {
|
|
|
19396
20282
|
DefaultLight,
|
|
19397
20283
|
DefaultDark,
|
|
19398
20284
|
loadTrustedFolders,
|
|
20285
|
+
isFolderTrustEnabled,
|
|
19399
20286
|
isWorkspaceTrusted,
|
|
19400
20287
|
getPersistScopeForModelSelection,
|
|
19401
20288
|
TOGGLE_TYPES,
|
|
19402
20289
|
OUTPUT_LANGUAGE_AUTO,
|
|
19403
20290
|
isAutoLanguage,
|
|
19404
20291
|
resolveOutputLanguage,
|
|
20292
|
+
getOutputLanguageFilePath,
|
|
19405
20293
|
updateOutputLanguageFile,
|
|
20294
|
+
writeOutputLanguageAndRegisterPath,
|
|
19406
20295
|
initializeLlmOutputLanguage,
|
|
19407
20296
|
getSettingDefinition,
|
|
19408
20297
|
requiresRestart,
|
|
@@ -19418,9 +20307,6 @@ export {
|
|
|
19418
20307
|
saveModifiedSettings,
|
|
19419
20308
|
getDisplayValue,
|
|
19420
20309
|
isDefaultValue,
|
|
19421
|
-
backupSettingsFile,
|
|
19422
|
-
restoreSettingsFromBackup,
|
|
19423
|
-
cleanupSettingsBackup,
|
|
19424
20310
|
SETTINGS_DIRECTORY_NAME,
|
|
19425
20311
|
getUserSettingsDir,
|
|
19426
20312
|
ENV_CORRUPTED_PATH,
|
|
@@ -19430,6 +20316,7 @@ export {
|
|
|
19430
20316
|
createMinimalSettings,
|
|
19431
20317
|
preResolveHomeEnvOverrides,
|
|
19432
20318
|
loadEnvironment,
|
|
20319
|
+
reloadEnvironment,
|
|
19433
20320
|
CORRUPTED_SUFFIX,
|
|
19434
20321
|
loadSettings,
|
|
19435
20322
|
require_debug,
|
|
@@ -19447,6 +20334,33 @@ export {
|
|
|
19447
20334
|
DEFAULT_RING_SIZE,
|
|
19448
20335
|
SubscriberLimitExceededError,
|
|
19449
20336
|
EventBus,
|
|
20337
|
+
canonicalizeWorkspace,
|
|
20338
|
+
MAX_WORKSPACE_PATH_LENGTH,
|
|
20339
|
+
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
|
|
20340
|
+
isNotCurrentlyGeneratingCancelError,
|
|
20341
|
+
SessionNotFoundError,
|
|
20342
|
+
RestoreInProgressError,
|
|
20343
|
+
InvalidSessionScopeError,
|
|
20344
|
+
SessionLimitExceededError,
|
|
20345
|
+
PromptQueueFullError,
|
|
20346
|
+
WorkspaceMismatchError,
|
|
20347
|
+
InvalidClientIdError,
|
|
20348
|
+
SessionShellDisabledError,
|
|
20349
|
+
SessionShellClientRequiredError,
|
|
20350
|
+
InvalidPermissionOptionError,
|
|
20351
|
+
InvalidSessionMetadataError,
|
|
20352
|
+
PermissionPolicyNotImplementedError,
|
|
20353
|
+
CancelSentinelCollisionError,
|
|
20354
|
+
PermissionForbiddenError,
|
|
20355
|
+
WorkspaceInitConflictError,
|
|
20356
|
+
WorkspaceInitPathEscapeError,
|
|
20357
|
+
WorkspaceInitSymlinkError,
|
|
20358
|
+
WorkspaceInitRaceError,
|
|
20359
|
+
McpServerNotFoundError,
|
|
20360
|
+
McpServerRestartFailedError,
|
|
20361
|
+
SessionBusyError,
|
|
20362
|
+
InvalidRewindTargetError,
|
|
20363
|
+
BranchWhilePromptActiveError,
|
|
19450
20364
|
STATUS_SCHEMA_VERSION,
|
|
19451
20365
|
SERVE_ERROR_KINDS,
|
|
19452
20366
|
BridgeTimeoutError,
|
|
@@ -19454,6 +20368,9 @@ export {
|
|
|
19454
20368
|
MissingCliEntryError,
|
|
19455
20369
|
SERVE_STATUS_EXT_METHODS,
|
|
19456
20370
|
SERVE_CONTROL_EXT_METHODS,
|
|
20371
|
+
IDLE_HOOK_EVENTS,
|
|
20372
|
+
createIdleWorkspaceExtensionsStatus,
|
|
20373
|
+
createIdleWorkspaceHooksStatus,
|
|
19457
20374
|
createIdleWorkspaceMemoryStatus,
|
|
19458
20375
|
createIdleWorkspaceMcpStatus,
|
|
19459
20376
|
createIdleWorkspaceSkillsStatus,
|
|
@@ -19468,7 +20385,8 @@ export {
|
|
|
19468
20385
|
formatDuration,
|
|
19469
20386
|
getNpmVersion,
|
|
19470
20387
|
getGitVersion,
|
|
19471
|
-
getExtendedSystemInfo
|
|
20388
|
+
getExtendedSystemInfo,
|
|
20389
|
+
createLoadedSettingsAdapter
|
|
19472
20390
|
};
|
|
19473
20391
|
/**
|
|
19474
20392
|
* @license
|
|
@@ -19485,6 +20403,18 @@ export {
|
|
|
19485
20403
|
* Copyright 2025 Google LLC
|
|
19486
20404
|
* SPDX-License-Identifier: Apache-2.0
|
|
19487
20405
|
*/
|
|
20406
|
+
/**
|
|
20407
|
+
* @license
|
|
20408
|
+
* Copyright 2025 Qwen Team
|
|
20409
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
20410
|
+
*
|
|
20411
|
+
* Adapter that lets core's `applyProviderInstallPlan` write through
|
|
20412
|
+
* `LoadedSettings` while preserving CLI-specific guarantees:
|
|
20413
|
+
* - scope resolution via `getPersistScopeForModelSelection`
|
|
20414
|
+
* - on-disk `.orig` backup of the target settings file
|
|
20415
|
+
* - in-memory snapshot of `settings` / `originalSettings` for rollback
|
|
20416
|
+
* - merged-settings recomputation after restore
|
|
20417
|
+
*/
|
|
19488
20418
|
/**
|
|
19489
20419
|
* @license
|
|
19490
20420
|
* Copyright 2026 Google LLC
|