@qwen-code/qwen-code 0.18.0-preview.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/_meta.ts +1 -0
- package/bundled/qc-helper/docs/configuration/settings.md +3 -5
- 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/followup-suggestions.md +2 -2
- package/bundled/qc-helper/docs/features/sub-agents.md +32 -11
- package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
- package/bundled/qc-helper/docs/qwen-serve.md +234 -24
- package/chunks/{agent-QB7TZ4HW.js → agent-LOTJK6AH.js} +23 -23
- package/chunks/{agent-headless-APVHH7QM.js → agent-headless-TU3EPMYU.js} +23 -23
- package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-2HBRNQ3B.js} +7 -7
- package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-OGCMIBQM.js} +45 -3
- package/chunks/{chunk-MVIVIPCU.js → chunk-2Y5SYSD3.js} +361 -583
- package/chunks/chunk-3DHXZ6EV.js +241 -0
- package/chunks/{chunk-JVQOQ3OU.js → chunk-3HTIVKZE.js} +1 -1
- package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
- package/chunks/{chunk-ZK4AMNIU.js → chunk-6YIUGZTC.js} +1041 -210
- package/chunks/{chunk-C6WMLUNB.js → chunk-72LDN5PP.js} +1 -1
- package/chunks/{chunk-AVW55ZCO.js → chunk-7BCMOPIM.js} +11 -9
- package/chunks/{chunk-JUGRPQAB.js → chunk-A7B4ISQP.js} +1 -1
- package/chunks/{chunk-UAMOBVVW.js → chunk-B7HXHOHU.js} +1 -1
- package/chunks/{chunk-CNSMKPK6.js → chunk-BIVG75CP.js} +1 -1
- package/chunks/{chunk-LR62TEET.js → chunk-EYENRK4D.js} +1 -1
- package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
- package/chunks/{chunk-PAEBHDIO.js → chunk-HLPLOD42.js} +1 -1
- package/chunks/{chunk-JXAZUMDW.js → chunk-HR7SV7AY.js} +1 -2
- package/chunks/{chunk-P4J26VDS.js → chunk-IDX6COTE.js} +2 -2
- package/chunks/{chunk-QCG6KPNM.js → chunk-IWAYOW5Q.js} +14760 -10735
- package/chunks/{chunk-HGJPQK33.js → chunk-J5MDQKJL.js} +518 -519
- package/chunks/{chunk-USE2VQ5P.js → chunk-JTQAQBTV.js} +21 -0
- package/chunks/{chunk-HXJE7VOG.js → chunk-LBP46COL.js} +1001 -139
- package/chunks/{chunk-NW5QBUYO.js → chunk-LEJ42GNY.js} +14 -14
- package/chunks/{chunk-Y7R6H6FT.js → chunk-M6VTDSVR.js} +1 -1
- package/chunks/{chunk-CNHFPN7T.js → chunk-MFBBBTNY.js} +1 -1
- package/chunks/{chunk-ICOI4E4S.js → chunk-OHEGWO4L.js} +101 -23
- package/chunks/{chunk-7YKXFA3D.js → chunk-PL3MVCWD.js} +5 -5
- package/chunks/chunk-QQDPRDVW.js +25 -0
- package/chunks/{chunk-HV3ZZ7G4.js → chunk-R7ODSGTK.js} +2 -2
- package/chunks/{chunk-GX7VH5JQ.js → chunk-SEGYWKIH.js} +1 -1
- package/chunks/{chunk-KC6ZMJ5X.js → chunk-SNGELLWX.js} +1 -1
- package/chunks/chunk-XBY7E2FX.js +605 -0
- package/chunks/{chunk-2ZTWI7KH.js → chunk-XV4HCEVI.js} +22 -1
- package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
- package/chunks/{chunk-CWV3SJZS.js → chunk-ZTZ4DDQE.js} +2 -2
- package/chunks/{computer-use-B7VIUI7F.js → computer-use-3RH2DOM6.js} +23 -23
- package/chunks/contextCommand-K347QT6O.js +52 -0
- package/chunks/{cron-create-FI5LJVUS.js → cron-create-YJL3KFWI.js} +3 -3
- package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-WKWSJZQA.js} +3 -3
- package/chunks/{cron-list-QNNZGMN3.js → cron-list-B52XEXAZ.js} +3 -3
- package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
- package/chunks/{dist-R2SXPG74.js → dist-4LXD6L6X.js} +2 -2
- package/chunks/{dist-TE5QKMGR.js → dist-H6ONXVLG.js} +1 -1
- package/chunks/{dist-ZMQ4TXD5.js → dist-KAZ3SEBX.js} +2 -2
- package/chunks/{dist-BXDUQ2QY.js → dist-PK7DFCAW.js} +1 -1
- package/chunks/{edit-6UBTS2J5.js → edit-KU4PJGEX.js} +24 -24
- package/chunks/{en-HSQQNQUB.js → en-DHGYHIHX.js} +4 -0
- package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-PPYIDCWI.js} +23 -23
- package/chunks/enterPlanMode-5CZDMCB4.js +158 -0
- package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-UY3CGHKC.js} +23 -23
- package/chunks/exitPlanMode-3DN4QNSG.js +703 -0
- package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-7A6I2RWB.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-OFNQSS52.js} +23 -23
- package/chunks/{grep-7HXIMDOW.js → grep-6J2MSUM5.js} +26 -23
- package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-6IU6ORQN.js} +3 -3
- package/chunks/{ls-6PEZUK6O.js → ls-V3O6A5PT.js} +4 -4
- package/chunks/{lsp-JZSJOVT7.js → lsp-G2OCIFUA.js} +3 -3
- package/chunks/{monitor-SQO7MVAV.js → monitor-FKLHV423.js} +23 -23
- package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-KTBYFKWG.js} +24 -24
- package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-L5KSWQY7.js} +15 -15
- package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-PYOXLMBW.js} +25 -25
- package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-2KCKWDCF.js} +6 -5
- package/chunks/{read-file-UA64EEQC.js → read-file-JQVRK4NU.js} +11 -11
- package/chunks/{ripGrep-WSYCWZVK.js → ripGrep-2L4LPNAJ.js} +23 -23
- package/chunks/{scheduler-VBASHOCA.js → scheduler-FGNXY4JQ.js} +23 -23
- package/chunks/{send-message-OYJZ5TPG.js → send-message-SZFWNOCL.js} +3 -3
- package/chunks/{serve-A7E2OJDR.js → serve-N2IBLA3G.js} +13581 -4977
- package/chunks/{shell-3NFOT6F5.js → shell-PTEG6UX4.js} +23 -23
- package/chunks/{skill-RA5YUREY.js → skill-X4NTK4NH.js} +64 -113
- package/chunks/{src-NFCMARMT.js → src-GLLQ3R5W.js} +154 -38
- package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-IKAY5F6X.js} +4 -4
- package/chunks/{task-create-Y3ZKTJIG.js → task-create-MQICOJFV.js} +7 -7
- package/chunks/{task-list-ONXJ3I3A.js → task-list-RIHJCH32.js} +6 -6
- package/chunks/{task-stop-UHDC4N5B.js → task-stop-FWZRFANS.js} +3 -3
- package/chunks/{task-update-TCNOU3P5.js → task-update-2LHPXOYM.js} +20 -9
- package/chunks/{team-create-6SR4OVRG.js → team-create-2E4PF4KN.js} +26 -25
- package/chunks/{team-delete-EJ4U4DDP.js → team-delete-DAUDQS4J.js} +8 -6
- package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-HTUACZES.js} +5 -5
- package/chunks/{tool-search-OD435A3X.js → tool-search-KTVULRES.js} +11 -11
- package/chunks/{web-fetch-6W67H5PO.js → web-fetch-CZ7LLKPE.js} +5 -5
- package/chunks/{workflow-62DHH4EO.js → workflow-L2ZUUDT2.js} +268 -16
- package/chunks/{write-file-475L5OPP.js → write-file-ZEB2JDYH.js} +24 -24
- package/chunks/{zh-VCLWO26Y.js → zh-7H5OQC4I.js} +5 -1
- package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-P4IDHD3M.js} +5 -1
- package/cli.js +5955 -3128
- 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/en.js +6 -0
- package/locales/zh-TW.js +5 -0
- package/locales/zh.js +5 -0
- package/package.json +3 -2
- package/chunks/chunk-AJIR24J2.js +0 -59
- package/chunks/chunk-XBFVXFB2.js +0 -216
- package/chunks/contextCommand-63RZ3O5R.js +0 -52
- package/chunks/exitPlanMode-H323NHB2.js +0 -235
|
@@ -6,30 +6,31 @@ import {
|
|
|
6
6
|
getLanguageSettingsOptions,
|
|
7
7
|
t,
|
|
8
8
|
writeStderrLine
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PL3MVCWD.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_STOP_HOOK_BLOCK_CAP,
|
|
12
|
+
DEFAULT_TOOL_OUTPUT_BATCH_BUDGET,
|
|
12
13
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
|
|
13
14
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
|
14
15
|
IdeClient,
|
|
15
16
|
SkillError,
|
|
16
17
|
ideContextStore,
|
|
17
18
|
require_main
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IWAYOW5Q.js";
|
|
19
20
|
import {
|
|
20
21
|
isWithinRoot,
|
|
21
22
|
stripRuntimeSnapshotPrefix
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-6YIUGZTC.js";
|
|
23
24
|
import {
|
|
24
25
|
atomicWriteFileSync
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-B7HXHOHU.js";
|
|
26
27
|
import {
|
|
27
28
|
FatalConfigError,
|
|
28
29
|
QWEN_DIR,
|
|
29
30
|
Storage,
|
|
30
31
|
createDebugLogger,
|
|
31
32
|
getErrorMessage
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-HR7SV7AY.js";
|
|
33
34
|
import {
|
|
34
35
|
init_esbuild_shims
|
|
35
36
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -12001,13 +12002,13 @@ var require_hosts = __commonJS({
|
|
|
12001
12002
|
var defaults = {
|
|
12002
12003
|
sshtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin("#", committish)}`, "sshtemplate"),
|
|
12003
12004
|
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:
|
|
12005
|
+
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, editpath, path: path9 }) => `https://${domain}/${user}/${project}${maybeJoin("/", editpath, "/", maybeEncode(committish || "HEAD"), "/", path9)}`, "edittemplate"),
|
|
12005
12006
|
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:
|
|
12007
|
+
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"),
|
|
12008
|
+
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
12009
|
docstemplate: /* @__PURE__ */ __name(({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}#readme`, "docstemplate"),
|
|
12009
12010
|
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:
|
|
12011
|
+
filetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, path: path9 }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish || "HEAD")}/${path9}`, "filetemplate"),
|
|
12011
12012
|
shortcuttemplate: /* @__PURE__ */ __name(({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin("#", committish)}`, "shortcuttemplate"),
|
|
12012
12013
|
pathtemplate: /* @__PURE__ */ __name(({ user, project, committish }) => `${user}/${project}${maybeJoin("#", committish)}`, "pathtemplate"),
|
|
12013
12014
|
bugstemplate: /* @__PURE__ */ __name(({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`, "bugstemplate"),
|
|
@@ -12022,7 +12023,7 @@ var require_hosts = __commonJS({
|
|
|
12022
12023
|
treepath: "tree",
|
|
12023
12024
|
blobpath: "blob",
|
|
12024
12025
|
editpath: "edit",
|
|
12025
|
-
filetemplate: /* @__PURE__ */ __name(({ auth, user, project, committish, path:
|
|
12026
|
+
filetemplate: /* @__PURE__ */ __name(({ auth, user, project, committish, path: path9 }) => `https://${maybeJoin(auth, "@")}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish || "HEAD")}/${path9}`, "filetemplate"),
|
|
12026
12027
|
gittemplate: /* @__PURE__ */ __name(({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "gittemplate"),
|
|
12027
12028
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`, "tarballtemplate"),
|
|
12028
12029
|
extract: /* @__PURE__ */ __name((url) => {
|
|
@@ -12048,7 +12049,7 @@ var require_hosts = __commonJS({
|
|
|
12048
12049
|
treepath: "src",
|
|
12049
12050
|
blobpath: "src",
|
|
12050
12051
|
editpath: "?mode=edit",
|
|
12051
|
-
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, treepath, path:
|
|
12052
|
+
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, treepath, path: path9, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish || "HEAD"), "/", path9, editpath)}`, "edittemplate"),
|
|
12052
12053
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish || "HEAD")}.tar.gz`, "tarballtemplate"),
|
|
12053
12054
|
extract: /* @__PURE__ */ __name((url) => {
|
|
12054
12055
|
let [, user, project, aux] = url.pathname.split("/", 4);
|
|
@@ -12073,11 +12074,11 @@ var require_hosts = __commonJS({
|
|
|
12073
12074
|
httpstemplate: /* @__PURE__ */ __name(({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "httpstemplate"),
|
|
12074
12075
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish || "HEAD")}`, "tarballtemplate"),
|
|
12075
12076
|
extract: /* @__PURE__ */ __name((url) => {
|
|
12076
|
-
const
|
|
12077
|
-
if (
|
|
12077
|
+
const path9 = url.pathname.slice(1);
|
|
12078
|
+
if (path9.includes("/-/") || path9.includes("/archive.tar.gz")) {
|
|
12078
12079
|
return;
|
|
12079
12080
|
}
|
|
12080
|
-
const segments =
|
|
12081
|
+
const segments = path9.split("/");
|
|
12081
12082
|
let project = segments.pop();
|
|
12082
12083
|
if (project.endsWith(".git")) {
|
|
12083
12084
|
project = project.slice(0, -4);
|
|
@@ -12097,11 +12098,11 @@ var require_hosts = __commonJS({
|
|
|
12097
12098
|
sshurltemplate: /* @__PURE__ */ __name(({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin("#", committish)}`, "sshurltemplate"),
|
|
12098
12099
|
edittemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", maybeEncode(committish))}/${editpath}`, "edittemplate"),
|
|
12099
12100
|
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:
|
|
12101
|
+
browsetreetemplate: /* @__PURE__ */ __name(({ domain, project, committish, path: path9, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path9))}`, "browsetreetemplate"),
|
|
12102
|
+
browseblobtemplate: /* @__PURE__ */ __name(({ domain, project, committish, path: path9, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path9))}`, "browseblobtemplate"),
|
|
12102
12103
|
docstemplate: /* @__PURE__ */ __name(({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`, "docstemplate"),
|
|
12103
12104
|
httpstemplate: /* @__PURE__ */ __name(({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin("#", committish)}`, "httpstemplate"),
|
|
12104
|
-
filetemplate: /* @__PURE__ */ __name(({ user, project, committish, path:
|
|
12105
|
+
filetemplate: /* @__PURE__ */ __name(({ user, project, committish, path: path9 }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin("/", maybeEncode(committish))}/${path9}`, "filetemplate"),
|
|
12105
12106
|
shortcuttemplate: /* @__PURE__ */ __name(({ type, project, committish }) => `${type}:${project}${maybeJoin("#", committish)}`, "shortcuttemplate"),
|
|
12106
12107
|
pathtemplate: /* @__PURE__ */ __name(({ project, committish }) => `${project}${maybeJoin("#", committish)}`, "pathtemplate"),
|
|
12107
12108
|
bugstemplate: /* @__PURE__ */ __name(({ domain, project }) => `https://${domain}/${project}`, "bugstemplate"),
|
|
@@ -12133,7 +12134,7 @@ var require_hosts = __commonJS({
|
|
|
12133
12134
|
domain: "git.sr.ht",
|
|
12134
12135
|
treepath: "tree",
|
|
12135
12136
|
blobpath: "tree",
|
|
12136
|
-
filetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, path:
|
|
12137
|
+
filetemplate: /* @__PURE__ */ __name(({ domain, user, project, committish, path: path9 }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || "HEAD"}/${path9}`, "filetemplate"),
|
|
12137
12138
|
httpstemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin("#", committish)}`, "httpstemplate"),
|
|
12138
12139
|
tarballtemplate: /* @__PURE__ */ __name(({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || "HEAD"}.tar.gz`, "tarballtemplate"),
|
|
12139
12140
|
bugstemplate: /* @__PURE__ */ __name(() => null, "bugstemplate"),
|
|
@@ -12327,8 +12328,8 @@ var require_lib3 = __commonJS({
|
|
|
12327
12328
|
return null;
|
|
12328
12329
|
}
|
|
12329
12330
|
const proto = /(?:git\+)http:$/.test(protocol) ? "http:" : "https:";
|
|
12330
|
-
const
|
|
12331
|
-
return `${proto}//${hostname}${
|
|
12331
|
+
const path9 = pathname.replace(/\.git$/, "");
|
|
12332
|
+
return `${proto}//${hostname}${path9}`;
|
|
12332
12333
|
} catch {
|
|
12333
12334
|
return null;
|
|
12334
12335
|
}
|
|
@@ -12424,25 +12425,25 @@ var require_lib3 = __commonJS({
|
|
|
12424
12425
|
sshurl(opts) {
|
|
12425
12426
|
return this.#fill(this.sshurltemplate, opts);
|
|
12426
12427
|
}
|
|
12427
|
-
browse(
|
|
12428
|
-
if (typeof
|
|
12429
|
-
return this.#fill(this.browsetemplate,
|
|
12428
|
+
browse(path9, ...args) {
|
|
12429
|
+
if (typeof path9 !== "string") {
|
|
12430
|
+
return this.#fill(this.browsetemplate, path9);
|
|
12430
12431
|
}
|
|
12431
12432
|
if (typeof args[0] !== "string") {
|
|
12432
|
-
return this.#fill(this.browsetreetemplate, { ...args[0], path:
|
|
12433
|
+
return this.#fill(this.browsetreetemplate, { ...args[0], path: path9 });
|
|
12433
12434
|
}
|
|
12434
|
-
return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path:
|
|
12435
|
+
return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path: path9 });
|
|
12435
12436
|
}
|
|
12436
12437
|
// If the path is known to be a file, then browseFile should be used. For some hosts
|
|
12437
12438
|
// the url is the same as browse, but for others like GitHub a file can use both `/tree/`
|
|
12438
12439
|
// and `/blob/` in the path. When using a default committish of `HEAD` then the `/tree/`
|
|
12439
12440
|
// path will redirect to a specific commit. Using the `/blob/` path avoids this and
|
|
12440
12441
|
// does not redirect to a different commit.
|
|
12441
|
-
browseFile(
|
|
12442
|
+
browseFile(path9, ...args) {
|
|
12442
12443
|
if (typeof args[0] !== "string") {
|
|
12443
|
-
return this.#fill(this.browseblobtemplate, { ...args[0], path:
|
|
12444
|
+
return this.#fill(this.browseblobtemplate, { ...args[0], path: path9 });
|
|
12444
12445
|
}
|
|
12445
|
-
return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path:
|
|
12446
|
+
return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path: path9 });
|
|
12446
12447
|
}
|
|
12447
12448
|
docs(opts) {
|
|
12448
12449
|
return this.#fill(this.docstemplate, opts);
|
|
@@ -12465,11 +12466,11 @@ var require_lib3 = __commonJS({
|
|
|
12465
12466
|
tarball(opts) {
|
|
12466
12467
|
return this.#fill(this.tarballtemplate, { ...opts, noCommittish: false });
|
|
12467
12468
|
}
|
|
12468
|
-
file(
|
|
12469
|
-
return this.#fill(this.filetemplate, { ...opts, path:
|
|
12469
|
+
file(path9, opts) {
|
|
12470
|
+
return this.#fill(this.filetemplate, { ...opts, path: path9 });
|
|
12470
12471
|
}
|
|
12471
|
-
edit(
|
|
12472
|
-
return this.#fill(this.edittemplate, { ...opts, path:
|
|
12472
|
+
edit(path9, opts) {
|
|
12473
|
+
return this.#fill(this.edittemplate, { ...opts, path: path9 });
|
|
12473
12474
|
}
|
|
12474
12475
|
getDefaultRepresentation() {
|
|
12475
12476
|
return this.default;
|
|
@@ -13122,6 +13123,11 @@ var DEFAULT_RING_SIZE = 8e3;
|
|
|
13122
13123
|
var WARN_THRESHOLD_RATIO = 0.75;
|
|
13123
13124
|
var WARN_RESET_RATIO = 0.375;
|
|
13124
13125
|
var DEFAULT_MAX_SUBSCRIBERS = 64;
|
|
13126
|
+
function getServerTimestamp(meta) {
|
|
13127
|
+
const existing = meta?.["serverTimestamp"];
|
|
13128
|
+
return typeof existing === "number" && Number.isFinite(existing) ? existing : Date.now();
|
|
13129
|
+
}
|
|
13130
|
+
__name(getServerTimestamp, "getServerTimestamp");
|
|
13125
13131
|
var SubscriberLimitExceededError = class extends Error {
|
|
13126
13132
|
static {
|
|
13127
13133
|
__name(this, "SubscriberLimitExceededError");
|
|
@@ -13134,9 +13140,10 @@ var SubscriberLimitExceededError = class extends Error {
|
|
|
13134
13140
|
}
|
|
13135
13141
|
};
|
|
13136
13142
|
var EventBus = class {
|
|
13137
|
-
constructor(ringSize = DEFAULT_RING_SIZE, maxSubscribers = DEFAULT_MAX_SUBSCRIBERS) {
|
|
13143
|
+
constructor(ringSize = DEFAULT_RING_SIZE, maxSubscribers = DEFAULT_MAX_SUBSCRIBERS, compactionEngine) {
|
|
13138
13144
|
this.ringSize = ringSize;
|
|
13139
13145
|
this.maxSubscribers = maxSubscribers;
|
|
13146
|
+
this.compactionEngine = compactionEngine;
|
|
13140
13147
|
}
|
|
13141
13148
|
static {
|
|
13142
13149
|
__name(this, "EventBus");
|
|
@@ -13145,6 +13152,9 @@ var EventBus = class {
|
|
|
13145
13152
|
ring = [];
|
|
13146
13153
|
subs = /* @__PURE__ */ new Set();
|
|
13147
13154
|
closed = false;
|
|
13155
|
+
snapshotReplay() {
|
|
13156
|
+
return this.compactionEngine?.snapshot();
|
|
13157
|
+
}
|
|
13148
13158
|
/** Most recent id ever assigned by `publish`. 0 if no events published. */
|
|
13149
13159
|
get lastEventId() {
|
|
13150
13160
|
return this.nextId - 1;
|
|
@@ -13158,7 +13168,7 @@ var EventBus = class {
|
|
|
13158
13168
|
* (with `id` + `v` assigned) on success, or `undefined` when the
|
|
13159
13169
|
* bus is closed.
|
|
13160
13170
|
*
|
|
13161
|
-
* **Never throws** (
|
|
13171
|
+
* **Never throws** (never-throws contract). Closing the bus mid-publish
|
|
13162
13172
|
* is the only abnormal path and is handled as a return-undefined
|
|
13163
13173
|
* no-op; subscriber-enqueue failures are caught internally and
|
|
13164
13174
|
* translated to per-subscriber eviction. Call sites can rely on
|
|
@@ -13169,12 +13179,21 @@ var EventBus = class {
|
|
|
13169
13179
|
*/
|
|
13170
13180
|
publish(input) {
|
|
13171
13181
|
if (this.closed) return void 0;
|
|
13182
|
+
const existingMeta = input._meta;
|
|
13172
13183
|
const event = {
|
|
13173
13184
|
id: this.nextId++,
|
|
13174
13185
|
v: EVENT_SCHEMA_VERSION,
|
|
13175
|
-
...input
|
|
13186
|
+
...input,
|
|
13187
|
+
_meta: {
|
|
13188
|
+
...existingMeta ?? {},
|
|
13189
|
+
serverTimestamp: getServerTimestamp(existingMeta)
|
|
13190
|
+
}
|
|
13176
13191
|
};
|
|
13177
13192
|
this.ring.push(event);
|
|
13193
|
+
try {
|
|
13194
|
+
this.compactionEngine?.ingest(event);
|
|
13195
|
+
} catch {
|
|
13196
|
+
}
|
|
13178
13197
|
if (this.ring.length > this.ringSize) this.ring.shift();
|
|
13179
13198
|
for (const sub of Array.from(this.subs)) {
|
|
13180
13199
|
if (sub.evicted) continue;
|
|
@@ -13247,11 +13266,61 @@ var EventBus = class {
|
|
|
13247
13266
|
};
|
|
13248
13267
|
this.subs.add(sub);
|
|
13249
13268
|
if (opts.lastEventId !== void 0) {
|
|
13269
|
+
const epochReset = opts.lastEventId >= this.nextId;
|
|
13270
|
+
if (epochReset) {
|
|
13271
|
+
queue.forcePush({
|
|
13272
|
+
v: EVENT_SCHEMA_VERSION,
|
|
13273
|
+
type: "state_resync_required",
|
|
13274
|
+
data: {
|
|
13275
|
+
reason: "epoch_reset",
|
|
13276
|
+
lastDeliveredId: opts.lastEventId,
|
|
13277
|
+
// Ring is typically empty right after a restart; fall back to
|
|
13278
|
+
// `nextId` (the first id this epoch will assign) so the field
|
|
13279
|
+
// stays meaningful ("fresh sequence starts here").
|
|
13280
|
+
earliestAvailableId: this.ring[0]?.id ?? this.nextId
|
|
13281
|
+
}
|
|
13282
|
+
});
|
|
13283
|
+
} else {
|
|
13284
|
+
const earliestInRing = this.ring[0]?.id;
|
|
13285
|
+
if (earliestInRing !== void 0 && earliestInRing > opts.lastEventId + 1) {
|
|
13286
|
+
queue.forcePush({
|
|
13287
|
+
v: EVENT_SCHEMA_VERSION,
|
|
13288
|
+
type: "state_resync_required",
|
|
13289
|
+
data: {
|
|
13290
|
+
reason: "ring_evicted",
|
|
13291
|
+
lastDeliveredId: opts.lastEventId,
|
|
13292
|
+
earliestAvailableId: earliestInRing
|
|
13293
|
+
}
|
|
13294
|
+
});
|
|
13295
|
+
}
|
|
13296
|
+
}
|
|
13297
|
+
const replayFrom = epochReset ? 0 : opts.lastEventId;
|
|
13298
|
+
let replayedCount = 0;
|
|
13299
|
+
let lastReplayedId;
|
|
13250
13300
|
for (const e of this.ring) {
|
|
13251
|
-
if (e.id !== void 0 && e.id >
|
|
13301
|
+
if (e.id !== void 0 && e.id > replayFrom) {
|
|
13252
13302
|
queue.forcePush(e);
|
|
13303
|
+
replayedCount += 1;
|
|
13304
|
+
lastReplayedId = e.id;
|
|
13305
|
+
}
|
|
13306
|
+
}
|
|
13307
|
+
queue.forcePush({
|
|
13308
|
+
v: EVENT_SCHEMA_VERSION,
|
|
13309
|
+
type: "replay_complete",
|
|
13310
|
+
data: {
|
|
13311
|
+
// Note: `lastReplayedEventId`
|
|
13312
|
+
// is the canonical wire name — the old `lastEventId` collided
|
|
13313
|
+
// semantically with the SSE protocol's `Last-Event-ID` (envelope
|
|
13314
|
+
// `id`) in raw daemon traces. Emit both: `lastReplayedEventId`
|
|
13315
|
+
// for current SDKs and `lastEventId` as a deprecated alias so
|
|
13316
|
+
// pre-rename consumers keep working (additive, non-breaking).
|
|
13317
|
+
...lastReplayedId !== void 0 ? {
|
|
13318
|
+
lastReplayedEventId: lastReplayedId,
|
|
13319
|
+
lastEventId: lastReplayedId
|
|
13320
|
+
} : {},
|
|
13321
|
+
replayedCount
|
|
13253
13322
|
}
|
|
13254
|
-
}
|
|
13323
|
+
});
|
|
13255
13324
|
}
|
|
13256
13325
|
let disposed = false;
|
|
13257
13326
|
const dispose = /* @__PURE__ */ __name(() => {
|
|
@@ -13293,6 +13362,7 @@ var EventBus = class {
|
|
|
13293
13362
|
this.closed = true;
|
|
13294
13363
|
for (const sub of this.subs) sub.queue.close();
|
|
13295
13364
|
this.subs.clear();
|
|
13365
|
+
this.compactionEngine?.close();
|
|
13296
13366
|
}
|
|
13297
13367
|
};
|
|
13298
13368
|
function emptyAsyncIterable() {
|
|
@@ -13396,13 +13466,322 @@ var BoundedAsyncQueue = class {
|
|
|
13396
13466
|
done: true
|
|
13397
13467
|
});
|
|
13398
13468
|
}
|
|
13399
|
-
return new Promise((
|
|
13469
|
+
return new Promise((resolve3) => this.resolvers.push(resolve3));
|
|
13400
13470
|
}
|
|
13401
13471
|
};
|
|
13402
13472
|
|
|
13403
13473
|
// packages/cli/src/serve/eventBus.ts
|
|
13404
13474
|
init_esbuild_shims();
|
|
13405
13475
|
|
|
13476
|
+
// packages/acp-bridge/src/bridgeErrors.ts
|
|
13477
|
+
init_esbuild_shims();
|
|
13478
|
+
|
|
13479
|
+
// packages/acp-bridge/src/workspacePaths.ts
|
|
13480
|
+
init_esbuild_shims();
|
|
13481
|
+
import { realpathSync } from "node:fs";
|
|
13482
|
+
import * as path from "node:path";
|
|
13483
|
+
function canonicalizeWorkspace(p) {
|
|
13484
|
+
const resolved = path.resolve(p);
|
|
13485
|
+
try {
|
|
13486
|
+
return realpathSync.native(resolved);
|
|
13487
|
+
} catch (err) {
|
|
13488
|
+
if (err && typeof err === "object" && err.code === "ENOENT") {
|
|
13489
|
+
return resolved;
|
|
13490
|
+
}
|
|
13491
|
+
throw err;
|
|
13492
|
+
}
|
|
13493
|
+
}
|
|
13494
|
+
__name(canonicalizeWorkspace, "canonicalizeWorkspace");
|
|
13495
|
+
var MAX_WORKSPACE_PATH_LENGTH = 4096;
|
|
13496
|
+
|
|
13497
|
+
// packages/acp-bridge/src/bridgeErrors.ts
|
|
13498
|
+
var NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE = "Not currently generating";
|
|
13499
|
+
function isNotCurrentlyGeneratingCancelError(err) {
|
|
13500
|
+
if (!err || typeof err !== "object") return false;
|
|
13501
|
+
const maybe = err;
|
|
13502
|
+
if (isNotCurrentlyGeneratingText(maybe.message)) return true;
|
|
13503
|
+
if (!maybe.data || typeof maybe.data !== "object") return false;
|
|
13504
|
+
return isNotCurrentlyGeneratingText(
|
|
13505
|
+
maybe.data.details
|
|
13506
|
+
);
|
|
13507
|
+
}
|
|
13508
|
+
__name(isNotCurrentlyGeneratingCancelError, "isNotCurrentlyGeneratingCancelError");
|
|
13509
|
+
function isNotCurrentlyGeneratingText(value) {
|
|
13510
|
+
return typeof value === "string" && /\bnot currently generating\b/i.test(value);
|
|
13511
|
+
}
|
|
13512
|
+
__name(isNotCurrentlyGeneratingText, "isNotCurrentlyGeneratingText");
|
|
13513
|
+
var SessionNotFoundError = class extends Error {
|
|
13514
|
+
static {
|
|
13515
|
+
__name(this, "SessionNotFoundError");
|
|
13516
|
+
}
|
|
13517
|
+
sessionId;
|
|
13518
|
+
constructor(sessionId, extra) {
|
|
13519
|
+
super(`No session with id "${sessionId}"` + (extra ? `. ${extra}` : ""));
|
|
13520
|
+
this.name = "SessionNotFoundError";
|
|
13521
|
+
this.sessionId = sessionId;
|
|
13522
|
+
}
|
|
13523
|
+
};
|
|
13524
|
+
var RestoreInProgressError = class extends Error {
|
|
13525
|
+
static {
|
|
13526
|
+
__name(this, "RestoreInProgressError");
|
|
13527
|
+
}
|
|
13528
|
+
sessionId;
|
|
13529
|
+
activeAction;
|
|
13530
|
+
requestedAction;
|
|
13531
|
+
constructor(sessionId, activeAction, requestedAction) {
|
|
13532
|
+
super(
|
|
13533
|
+
`Session "${sessionId}" is already being restored via session/${activeAction}; retry session/${requestedAction} after it completes`
|
|
13534
|
+
);
|
|
13535
|
+
this.name = "RestoreInProgressError";
|
|
13536
|
+
this.sessionId = sessionId;
|
|
13537
|
+
this.activeAction = activeAction;
|
|
13538
|
+
this.requestedAction = requestedAction;
|
|
13539
|
+
}
|
|
13540
|
+
};
|
|
13541
|
+
var InvalidSessionScopeError = class extends Error {
|
|
13542
|
+
static {
|
|
13543
|
+
__name(this, "InvalidSessionScopeError");
|
|
13544
|
+
}
|
|
13545
|
+
sessionScope;
|
|
13546
|
+
constructor(sessionScope) {
|
|
13547
|
+
super(
|
|
13548
|
+
`Invalid sessionScope: ${JSON.stringify(sessionScope)}. Expected 'single' or 'thread'.`
|
|
13549
|
+
);
|
|
13550
|
+
this.name = "InvalidSessionScopeError";
|
|
13551
|
+
this.sessionScope = sessionScope;
|
|
13552
|
+
}
|
|
13553
|
+
};
|
|
13554
|
+
var SessionLimitExceededError = class extends Error {
|
|
13555
|
+
static {
|
|
13556
|
+
__name(this, "SessionLimitExceededError");
|
|
13557
|
+
}
|
|
13558
|
+
limit;
|
|
13559
|
+
constructor(limit) {
|
|
13560
|
+
super(`Session limit reached (${limit})`);
|
|
13561
|
+
this.name = "SessionLimitExceededError";
|
|
13562
|
+
this.limit = limit;
|
|
13563
|
+
}
|
|
13564
|
+
};
|
|
13565
|
+
var WorkspaceMismatchError = class extends Error {
|
|
13566
|
+
static {
|
|
13567
|
+
__name(this, "WorkspaceMismatchError");
|
|
13568
|
+
}
|
|
13569
|
+
bound;
|
|
13570
|
+
requested;
|
|
13571
|
+
constructor(bound, requested) {
|
|
13572
|
+
const safeRequested = requested.length > MAX_WORKSPACE_PATH_LENGTH ? `${requested.slice(0, MAX_WORKSPACE_PATH_LENGTH)}\u2026[truncated]` : requested;
|
|
13573
|
+
super(
|
|
13574
|
+
`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).`
|
|
13575
|
+
);
|
|
13576
|
+
this.name = "WorkspaceMismatchError";
|
|
13577
|
+
this.bound = bound;
|
|
13578
|
+
this.requested = safeRequested;
|
|
13579
|
+
}
|
|
13580
|
+
};
|
|
13581
|
+
var InvalidClientIdError = class extends Error {
|
|
13582
|
+
static {
|
|
13583
|
+
__name(this, "InvalidClientIdError");
|
|
13584
|
+
}
|
|
13585
|
+
sessionId;
|
|
13586
|
+
clientId;
|
|
13587
|
+
constructor(sessionId, clientId) {
|
|
13588
|
+
super(`Client id "${clientId}" is not registered for session ${sessionId}`);
|
|
13589
|
+
this.name = "InvalidClientIdError";
|
|
13590
|
+
this.sessionId = sessionId;
|
|
13591
|
+
this.clientId = clientId;
|
|
13592
|
+
}
|
|
13593
|
+
};
|
|
13594
|
+
var InvalidPermissionOptionError = class extends Error {
|
|
13595
|
+
static {
|
|
13596
|
+
__name(this, "InvalidPermissionOptionError");
|
|
13597
|
+
}
|
|
13598
|
+
requestId;
|
|
13599
|
+
optionId;
|
|
13600
|
+
constructor(requestId, optionId) {
|
|
13601
|
+
super(
|
|
13602
|
+
`Permission ${requestId}: optionId "${optionId}" is not in the set of options the agent offered.`
|
|
13603
|
+
);
|
|
13604
|
+
this.name = "InvalidPermissionOptionError";
|
|
13605
|
+
this.requestId = requestId;
|
|
13606
|
+
this.optionId = optionId;
|
|
13607
|
+
}
|
|
13608
|
+
};
|
|
13609
|
+
var InvalidSessionMetadataError = class extends Error {
|
|
13610
|
+
static {
|
|
13611
|
+
__name(this, "InvalidSessionMetadataError");
|
|
13612
|
+
}
|
|
13613
|
+
field;
|
|
13614
|
+
constructor(field, reason) {
|
|
13615
|
+
super(`Invalid session metadata: ${field} ${reason}`);
|
|
13616
|
+
this.name = "InvalidSessionMetadataError";
|
|
13617
|
+
this.field = field;
|
|
13618
|
+
}
|
|
13619
|
+
};
|
|
13620
|
+
var PermissionPolicyNotImplementedError = class extends Error {
|
|
13621
|
+
static {
|
|
13622
|
+
__name(this, "PermissionPolicyNotImplementedError");
|
|
13623
|
+
}
|
|
13624
|
+
policy;
|
|
13625
|
+
constructor(policy) {
|
|
13626
|
+
super(
|
|
13627
|
+
`Permission policy "${policy}" is declared in the contract but not yet implemented in this daemon build.`
|
|
13628
|
+
);
|
|
13629
|
+
this.name = "PermissionPolicyNotImplementedError";
|
|
13630
|
+
this.policy = policy;
|
|
13631
|
+
}
|
|
13632
|
+
};
|
|
13633
|
+
var CancelSentinelCollisionError = class extends Error {
|
|
13634
|
+
static {
|
|
13635
|
+
__name(this, "CancelSentinelCollisionError");
|
|
13636
|
+
}
|
|
13637
|
+
requestId;
|
|
13638
|
+
sentinel;
|
|
13639
|
+
constructor(requestId, sentinel) {
|
|
13640
|
+
super(
|
|
13641
|
+
`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.`
|
|
13642
|
+
);
|
|
13643
|
+
this.name = "CancelSentinelCollisionError";
|
|
13644
|
+
this.requestId = requestId;
|
|
13645
|
+
this.sentinel = sentinel;
|
|
13646
|
+
}
|
|
13647
|
+
};
|
|
13648
|
+
var PermissionForbiddenError = class extends Error {
|
|
13649
|
+
static {
|
|
13650
|
+
__name(this, "PermissionForbiddenError");
|
|
13651
|
+
}
|
|
13652
|
+
requestId;
|
|
13653
|
+
sessionId;
|
|
13654
|
+
reason;
|
|
13655
|
+
constructor(requestId, sessionId, reason) {
|
|
13656
|
+
super(
|
|
13657
|
+
`Permission ${requestId} on session ${sessionId}: vote rejected by policy (${reason}).`
|
|
13658
|
+
);
|
|
13659
|
+
this.name = "PermissionForbiddenError";
|
|
13660
|
+
this.requestId = requestId;
|
|
13661
|
+
this.sessionId = sessionId;
|
|
13662
|
+
this.reason = reason;
|
|
13663
|
+
}
|
|
13664
|
+
};
|
|
13665
|
+
var WorkspaceInitConflictError = class extends Error {
|
|
13666
|
+
static {
|
|
13667
|
+
__name(this, "WorkspaceInitConflictError");
|
|
13668
|
+
}
|
|
13669
|
+
path;
|
|
13670
|
+
existingSize;
|
|
13671
|
+
constructor(path9, existingSize) {
|
|
13672
|
+
super(
|
|
13673
|
+
`Workspace file ${path9} already exists (${existingSize} bytes); pass {force: true} to overwrite.`
|
|
13674
|
+
);
|
|
13675
|
+
this.name = "WorkspaceInitConflictError";
|
|
13676
|
+
this.path = path9;
|
|
13677
|
+
this.existingSize = existingSize;
|
|
13678
|
+
}
|
|
13679
|
+
};
|
|
13680
|
+
var WorkspaceInitPathEscapeError = class extends Error {
|
|
13681
|
+
static {
|
|
13682
|
+
__name(this, "WorkspaceInitPathEscapeError");
|
|
13683
|
+
}
|
|
13684
|
+
filename;
|
|
13685
|
+
boundWorkspace;
|
|
13686
|
+
constructor(filename, boundWorkspace) {
|
|
13687
|
+
super(
|
|
13688
|
+
`Configured workspace context filename ${JSON.stringify(filename)} resolves outside the bound workspace ${JSON.stringify(boundWorkspace)}. Refusing to write.`
|
|
13689
|
+
);
|
|
13690
|
+
this.name = "WorkspaceInitPathEscapeError";
|
|
13691
|
+
this.filename = filename;
|
|
13692
|
+
this.boundWorkspace = boundWorkspace;
|
|
13693
|
+
}
|
|
13694
|
+
};
|
|
13695
|
+
var WorkspaceInitSymlinkError = class extends Error {
|
|
13696
|
+
static {
|
|
13697
|
+
__name(this, "WorkspaceInitSymlinkError");
|
|
13698
|
+
}
|
|
13699
|
+
target;
|
|
13700
|
+
kind;
|
|
13701
|
+
constructor(target, kind, detail) {
|
|
13702
|
+
super(detail);
|
|
13703
|
+
this.name = "WorkspaceInitSymlinkError";
|
|
13704
|
+
this.target = target;
|
|
13705
|
+
this.kind = kind;
|
|
13706
|
+
}
|
|
13707
|
+
};
|
|
13708
|
+
var WorkspaceInitRaceError = class extends Error {
|
|
13709
|
+
static {
|
|
13710
|
+
__name(this, "WorkspaceInitRaceError");
|
|
13711
|
+
}
|
|
13712
|
+
target;
|
|
13713
|
+
kind;
|
|
13714
|
+
constructor(target, kind, detail) {
|
|
13715
|
+
super(detail);
|
|
13716
|
+
this.name = "WorkspaceInitRaceError";
|
|
13717
|
+
this.target = target;
|
|
13718
|
+
this.kind = kind;
|
|
13719
|
+
}
|
|
13720
|
+
};
|
|
13721
|
+
var McpServerNotFoundError = class extends Error {
|
|
13722
|
+
static {
|
|
13723
|
+
__name(this, "McpServerNotFoundError");
|
|
13724
|
+
}
|
|
13725
|
+
serverName;
|
|
13726
|
+
constructor(serverName) {
|
|
13727
|
+
super(`MCP server not configured: ${JSON.stringify(serverName)}`);
|
|
13728
|
+
this.name = "McpServerNotFoundError";
|
|
13729
|
+
this.serverName = serverName;
|
|
13730
|
+
}
|
|
13731
|
+
};
|
|
13732
|
+
var McpServerRestartFailedError = class extends Error {
|
|
13733
|
+
static {
|
|
13734
|
+
__name(this, "McpServerRestartFailedError");
|
|
13735
|
+
}
|
|
13736
|
+
serverName;
|
|
13737
|
+
mcpStatus;
|
|
13738
|
+
constructor(serverName, mcpStatus) {
|
|
13739
|
+
super(
|
|
13740
|
+
`MCP server ${JSON.stringify(serverName)} did not reach a connected state after restart (status: ${mcpStatus}).`
|
|
13741
|
+
);
|
|
13742
|
+
this.name = "McpServerRestartFailedError";
|
|
13743
|
+
this.serverName = serverName;
|
|
13744
|
+
this.mcpStatus = mcpStatus;
|
|
13745
|
+
}
|
|
13746
|
+
};
|
|
13747
|
+
var SessionBusyError = class extends Error {
|
|
13748
|
+
static {
|
|
13749
|
+
__name(this, "SessionBusyError");
|
|
13750
|
+
}
|
|
13751
|
+
sessionId;
|
|
13752
|
+
constructor(sessionId, message) {
|
|
13753
|
+
super(message ?? `Session ${sessionId} is busy (prompt running)`);
|
|
13754
|
+
this.name = "SessionBusyError";
|
|
13755
|
+
this.sessionId = sessionId;
|
|
13756
|
+
}
|
|
13757
|
+
};
|
|
13758
|
+
var InvalidRewindTargetError = class extends Error {
|
|
13759
|
+
static {
|
|
13760
|
+
__name(this, "InvalidRewindTargetError");
|
|
13761
|
+
}
|
|
13762
|
+
sessionId;
|
|
13763
|
+
constructor(sessionId, message) {
|
|
13764
|
+
super(
|
|
13765
|
+
message ?? `Cannot rewind to the requested turn (compressed or does not exist)`
|
|
13766
|
+
);
|
|
13767
|
+
this.name = "InvalidRewindTargetError";
|
|
13768
|
+
this.sessionId = sessionId;
|
|
13769
|
+
}
|
|
13770
|
+
};
|
|
13771
|
+
var BranchWhilePromptActiveError = class extends Error {
|
|
13772
|
+
static {
|
|
13773
|
+
__name(this, "BranchWhilePromptActiveError");
|
|
13774
|
+
}
|
|
13775
|
+
sessionId;
|
|
13776
|
+
constructor(sessionId) {
|
|
13777
|
+
super(
|
|
13778
|
+
`Cannot branch session ${sessionId}: a prompt is currently active`
|
|
13779
|
+
);
|
|
13780
|
+
this.name = "BranchWhilePromptActiveError";
|
|
13781
|
+
this.sessionId = sessionId;
|
|
13782
|
+
}
|
|
13783
|
+
};
|
|
13784
|
+
|
|
13406
13785
|
// packages/acp-bridge/src/status.ts
|
|
13407
13786
|
init_esbuild_shims();
|
|
13408
13787
|
var STATUS_SCHEMA_VERSION = 1;
|
|
@@ -13415,10 +13794,17 @@ var SERVE_ERROR_KINDS = [
|
|
|
13415
13794
|
"missing_file",
|
|
13416
13795
|
"parse_error",
|
|
13417
13796
|
"stat_failed",
|
|
13418
|
-
//
|
|
13797
|
+
// Budget refusal under `--mcp-budget-mode=enforce`.
|
|
13419
13798
|
// Surfaced on per-server `mcp_server` cells (refused at discovery)
|
|
13420
13799
|
// and on the workspace-level `mcp_budget` cell (any refusal this pass).
|
|
13421
|
-
"budget_exhausted"
|
|
13800
|
+
"budget_exhausted",
|
|
13801
|
+
// Runtime MCP mutation routes
|
|
13802
|
+
"mcp_budget_would_exceed",
|
|
13803
|
+
"mcp_server_spawn_failed",
|
|
13804
|
+
"invalid_config",
|
|
13805
|
+
// Prompt deadline + writer idle timeout
|
|
13806
|
+
"prompt_deadline_exceeded",
|
|
13807
|
+
"writer_idle_timeout"
|
|
13422
13808
|
];
|
|
13423
13809
|
var BridgeTimeoutError = class extends Error {
|
|
13424
13810
|
static {
|
|
@@ -13427,7 +13813,7 @@ var BridgeTimeoutError = class extends Error {
|
|
|
13427
13813
|
label;
|
|
13428
13814
|
timeoutMs;
|
|
13429
13815
|
constructor(label, timeoutMs) {
|
|
13430
|
-
super(`
|
|
13816
|
+
super(`AcpSessionBridge ${label} timed out after ${timeoutMs}ms`);
|
|
13431
13817
|
this.name = "BridgeTimeoutError";
|
|
13432
13818
|
this.label = label;
|
|
13433
13819
|
this.timeoutMs = timeoutMs;
|
|
@@ -13457,18 +13843,123 @@ var MissingCliEntryError = class extends Error {
|
|
|
13457
13843
|
};
|
|
13458
13844
|
var SERVE_STATUS_EXT_METHODS = {
|
|
13459
13845
|
workspaceMcp: "qwen/status/workspace/mcp",
|
|
13846
|
+
workspaceMcpTools: "qwen/status/workspace/mcp/tools",
|
|
13460
13847
|
workspaceSkills: "qwen/status/workspace/skills",
|
|
13848
|
+
workspaceTools: "qwen/status/workspace/tools",
|
|
13461
13849
|
workspaceProviders: "qwen/status/workspace/providers",
|
|
13462
13850
|
workspaceMemory: "qwen/status/workspace/memory",
|
|
13463
13851
|
workspaceAgents: "qwen/status/workspace/agents",
|
|
13464
13852
|
workspacePreflight: "qwen/status/workspace/preflight",
|
|
13465
13853
|
sessionContext: "qwen/status/session/context",
|
|
13466
|
-
|
|
13854
|
+
sessionContextUsage: "qwen/status/session/context_usage",
|
|
13855
|
+
sessionSupportedCommands: "qwen/status/session/supported_commands",
|
|
13856
|
+
sessionTasks: "qwen/status/session/tasks",
|
|
13857
|
+
sessionStats: "qwen/status/session/stats",
|
|
13858
|
+
sessionRewindSnapshots: "qwen/status/session/rewind_snapshots",
|
|
13859
|
+
workspaceHooks: "qwen/status/workspace/hooks",
|
|
13860
|
+
sessionHooks: "qwen/status/session/hooks",
|
|
13861
|
+
workspaceExtensions: "qwen/status/workspace/extensions"
|
|
13467
13862
|
};
|
|
13468
13863
|
var SERVE_CONTROL_EXT_METHODS = {
|
|
13864
|
+
sessionClose: "qwen/control/session/close",
|
|
13469
13865
|
sessionApprovalMode: "qwen/control/session/approval_mode",
|
|
13470
|
-
|
|
13866
|
+
sessionBranch: "qwen/control/session/branch",
|
|
13867
|
+
sessionRecap: "qwen/control/session/recap",
|
|
13868
|
+
sessionBtw: "qwen/control/session/btw",
|
|
13869
|
+
sessionShellHistory: "qwen/control/session/shell_history",
|
|
13870
|
+
sessionLanguage: "qwen/control/session/language",
|
|
13871
|
+
sessionRewind: "qwen/control/session/rewind",
|
|
13872
|
+
workspaceMcpRestart: "qwen/control/workspace/mcp/restart",
|
|
13873
|
+
workspaceMcpManage: "qwen/control/workspace/mcp/manage",
|
|
13874
|
+
workspaceAgentGenerate: "qwen/control/workspace/agents/generate",
|
|
13875
|
+
// Runtime MCP server mutation ext-methods
|
|
13876
|
+
sessionTaskCancel: "qwen/control/session/task/cancel",
|
|
13877
|
+
sessionGoalClear: "qwen/control/session/goal/clear",
|
|
13878
|
+
workspaceMcpRuntimeAdd: "qwen/control/workspace/mcp/runtime-add",
|
|
13879
|
+
workspaceMcpRuntimeRemove: "qwen/control/workspace/mcp/runtime-remove",
|
|
13880
|
+
workspaceReload: "qwen/control/workspace/reload"
|
|
13881
|
+
};
|
|
13882
|
+
var IDLE_HOOK_EVENTS = {
|
|
13883
|
+
PreToolUse: { description: "Before tool execution", matcherKind: "toolName" },
|
|
13884
|
+
PostToolUse: { description: "After tool execution", matcherKind: "toolName" },
|
|
13885
|
+
PostToolUseFailure: {
|
|
13886
|
+
description: "After tool execution fails",
|
|
13887
|
+
matcherKind: "toolName"
|
|
13888
|
+
},
|
|
13889
|
+
PostToolBatch: { description: "After a batch of tool calls resolves" },
|
|
13890
|
+
Notification: {
|
|
13891
|
+
description: "When notifications are sent",
|
|
13892
|
+
matcherKind: "notificationType"
|
|
13893
|
+
},
|
|
13894
|
+
UserPromptSubmit: { description: "When the user submits a prompt" },
|
|
13895
|
+
UserPromptExpansion: {
|
|
13896
|
+
description: "When a slash command expands into a prompt",
|
|
13897
|
+
matcherKind: "commandName"
|
|
13898
|
+
},
|
|
13899
|
+
SessionStart: {
|
|
13900
|
+
description: "When a new session is started",
|
|
13901
|
+
matcherKind: "sessionTrigger"
|
|
13902
|
+
},
|
|
13903
|
+
Stop: { description: "Right before Qwen Code concludes its response" },
|
|
13904
|
+
SubagentStart: {
|
|
13905
|
+
description: "When a subagent is started",
|
|
13906
|
+
matcherKind: "agentType"
|
|
13907
|
+
},
|
|
13908
|
+
SubagentStop: {
|
|
13909
|
+
description: "Right before a subagent concludes its response",
|
|
13910
|
+
matcherKind: "agentType"
|
|
13911
|
+
},
|
|
13912
|
+
PreCompact: {
|
|
13913
|
+
description: "Before conversation compaction",
|
|
13914
|
+
matcherKind: "trigger"
|
|
13915
|
+
},
|
|
13916
|
+
PostCompact: {
|
|
13917
|
+
description: "After conversation compaction",
|
|
13918
|
+
matcherKind: "trigger"
|
|
13919
|
+
},
|
|
13920
|
+
SessionEnd: {
|
|
13921
|
+
description: "When a session is ending",
|
|
13922
|
+
matcherKind: "sessionTrigger"
|
|
13923
|
+
},
|
|
13924
|
+
PermissionRequest: {
|
|
13925
|
+
description: "When a permission dialog is displayed",
|
|
13926
|
+
matcherKind: "toolName"
|
|
13927
|
+
},
|
|
13928
|
+
PermissionDenied: {
|
|
13929
|
+
description: "When a tool call is denied",
|
|
13930
|
+
matcherKind: "toolName"
|
|
13931
|
+
},
|
|
13932
|
+
StopFailure: {
|
|
13933
|
+
description: "When the turn ends due to an API error",
|
|
13934
|
+
matcherKind: "error"
|
|
13935
|
+
},
|
|
13936
|
+
TodoCreated: { description: "When a new todo item is created" },
|
|
13937
|
+
TodoCompleted: { description: "When a todo item is marked as completed" },
|
|
13938
|
+
InstructionsLoaded: {
|
|
13939
|
+
description: "When an instruction or context file is loaded",
|
|
13940
|
+
matcherKind: "filePath"
|
|
13941
|
+
}
|
|
13471
13942
|
};
|
|
13943
|
+
function createIdleWorkspaceExtensionsStatus(workspaceCwd) {
|
|
13944
|
+
return {
|
|
13945
|
+
v: STATUS_SCHEMA_VERSION,
|
|
13946
|
+
workspaceCwd,
|
|
13947
|
+
initialized: false,
|
|
13948
|
+
extensions: []
|
|
13949
|
+
};
|
|
13950
|
+
}
|
|
13951
|
+
__name(createIdleWorkspaceExtensionsStatus, "createIdleWorkspaceExtensionsStatus");
|
|
13952
|
+
function createIdleWorkspaceHooksStatus(workspaceCwd) {
|
|
13953
|
+
return {
|
|
13954
|
+
v: STATUS_SCHEMA_VERSION,
|
|
13955
|
+
workspaceCwd,
|
|
13956
|
+
initialized: false,
|
|
13957
|
+
disabled: false,
|
|
13958
|
+
hooks: [],
|
|
13959
|
+
events: IDLE_HOOK_EVENTS
|
|
13960
|
+
};
|
|
13961
|
+
}
|
|
13962
|
+
__name(createIdleWorkspaceHooksStatus, "createIdleWorkspaceHooksStatus");
|
|
13472
13963
|
function createIdleWorkspaceMemoryStatus(workspaceCwd) {
|
|
13473
13964
|
return {
|
|
13474
13965
|
v: STATUS_SCHEMA_VERSION,
|
|
@@ -13589,7 +14080,7 @@ init_esbuild_shims();
|
|
|
13589
14080
|
// packages/cli/src/utils/languageUtils.ts
|
|
13590
14081
|
init_esbuild_shims();
|
|
13591
14082
|
import * as fs from "node:fs";
|
|
13592
|
-
import * as
|
|
14083
|
+
import * as path2 from "node:path";
|
|
13593
14084
|
var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
|
|
13594
14085
|
var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "qwen-code:llm-output-language:";
|
|
13595
14086
|
var OUTPUT_LANGUAGE_AUTO = "auto";
|
|
@@ -13615,7 +14106,7 @@ function resolveOutputLanguage(value) {
|
|
|
13615
14106
|
}
|
|
13616
14107
|
__name(resolveOutputLanguage, "resolveOutputLanguage");
|
|
13617
14108
|
function getOutputLanguageFilePath() {
|
|
13618
|
-
return
|
|
14109
|
+
return path2.join(
|
|
13619
14110
|
Storage.getGlobalQwenDir(),
|
|
13620
14111
|
LLM_OUTPUT_LANGUAGE_RULE_FILENAME
|
|
13621
14112
|
);
|
|
@@ -13678,19 +14169,27 @@ function readOutputLanguageFromFile() {
|
|
|
13678
14169
|
}
|
|
13679
14170
|
}
|
|
13680
14171
|
__name(readOutputLanguageFromFile, "readOutputLanguageFromFile");
|
|
13681
|
-
function writeOutputLanguageFile(language) {
|
|
13682
|
-
const filePath = getOutputLanguageFilePath();
|
|
14172
|
+
function writeOutputLanguageFile(language, targetPath) {
|
|
14173
|
+
const filePath = targetPath ?? getOutputLanguageFilePath();
|
|
13683
14174
|
const content = generateOutputLanguageFileContent(language);
|
|
13684
|
-
const dir =
|
|
14175
|
+
const dir = path2.dirname(filePath);
|
|
13685
14176
|
fs.mkdirSync(dir, { recursive: true });
|
|
13686
14177
|
fs.writeFileSync(filePath, content, "utf-8");
|
|
13687
14178
|
}
|
|
13688
14179
|
__name(writeOutputLanguageFile, "writeOutputLanguageFile");
|
|
13689
|
-
function updateOutputLanguageFile(settingValue) {
|
|
14180
|
+
function updateOutputLanguageFile(settingValue, targetPath) {
|
|
13690
14181
|
const resolved = resolveOutputLanguage(settingValue);
|
|
13691
|
-
writeOutputLanguageFile(resolved);
|
|
14182
|
+
writeOutputLanguageFile(resolved, targetPath);
|
|
13692
14183
|
}
|
|
13693
14184
|
__name(updateOutputLanguageFile, "updateOutputLanguageFile");
|
|
14185
|
+
function writeOutputLanguageAndRegisterPath(settingValue, config) {
|
|
14186
|
+
const targetPath = config?.getOutputLanguageFilePath();
|
|
14187
|
+
updateOutputLanguageFile(settingValue, targetPath);
|
|
14188
|
+
if (!targetPath) {
|
|
14189
|
+
config?.setOutputLanguageFilePath(getOutputLanguageFilePath());
|
|
14190
|
+
}
|
|
14191
|
+
}
|
|
14192
|
+
__name(writeOutputLanguageAndRegisterPath, "writeOutputLanguageAndRegisterPath");
|
|
13694
14193
|
function initializeLlmOutputLanguage(outputLanguage) {
|
|
13695
14194
|
const currentFileLanguage = readOutputLanguageFromFile();
|
|
13696
14195
|
if (currentFileLanguage) {
|
|
@@ -13705,7 +14204,7 @@ __name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
|
|
|
13705
14204
|
init_esbuild_shims();
|
|
13706
14205
|
var dotenv = __toESM(require_main(), 1);
|
|
13707
14206
|
import * as fs6 from "node:fs";
|
|
13708
|
-
import * as
|
|
14207
|
+
import * as path4 from "node:path";
|
|
13709
14208
|
import { homedir, platform } from "node:os";
|
|
13710
14209
|
import process2 from "node:process";
|
|
13711
14210
|
var import_strip_json_comments2 = __toESM(require_strip_json_comments(), 1);
|
|
@@ -13898,6 +14397,89 @@ function resolveColor(colorValue) {
|
|
|
13898
14397
|
return void 0;
|
|
13899
14398
|
}
|
|
13900
14399
|
__name(resolveColor, "resolveColor");
|
|
14400
|
+
var INK_NAME_TO_HEX = {
|
|
14401
|
+
black: "#000000",
|
|
14402
|
+
red: "#ff0000",
|
|
14403
|
+
green: "#00ff00",
|
|
14404
|
+
yellow: "#ffff00",
|
|
14405
|
+
blue: "#0000ff",
|
|
14406
|
+
cyan: "#00ffff",
|
|
14407
|
+
magenta: "#ff00ff",
|
|
14408
|
+
white: "#ffffff",
|
|
14409
|
+
gray: "#808080",
|
|
14410
|
+
grey: "#808080",
|
|
14411
|
+
blackbright: "#808080",
|
|
14412
|
+
redbright: "#ff8080",
|
|
14413
|
+
greenbright: "#80ff80",
|
|
14414
|
+
yellowbright: "#ffff80",
|
|
14415
|
+
bluebright: "#8080ff",
|
|
14416
|
+
cyanbright: "#80ffff",
|
|
14417
|
+
magentabright: "#ff80ff",
|
|
14418
|
+
whitebright: "#ffffff"
|
|
14419
|
+
};
|
|
14420
|
+
function toHex(color) {
|
|
14421
|
+
const resolved = (resolveColor(color) ?? color).toLowerCase();
|
|
14422
|
+
if (resolved.startsWith("#")) {
|
|
14423
|
+
if (/^#[0-9a-f]{3}$/.test(resolved)) {
|
|
14424
|
+
return `#${resolved.slice(1).split("").map((c) => c + c).join("")}`;
|
|
14425
|
+
}
|
|
14426
|
+
if (/^#[0-9a-f]{6}$/.test(resolved)) {
|
|
14427
|
+
return resolved;
|
|
14428
|
+
}
|
|
14429
|
+
return void 0;
|
|
14430
|
+
}
|
|
14431
|
+
return INK_NAME_TO_HEX[resolved];
|
|
14432
|
+
}
|
|
14433
|
+
__name(toHex, "toHex");
|
|
14434
|
+
function interpolateColor(color1, color2, factor) {
|
|
14435
|
+
if (factor <= 0) {
|
|
14436
|
+
return color1;
|
|
14437
|
+
}
|
|
14438
|
+
if (factor >= 1) {
|
|
14439
|
+
return color2;
|
|
14440
|
+
}
|
|
14441
|
+
const h1 = toHex(color1);
|
|
14442
|
+
const h2 = toHex(color2);
|
|
14443
|
+
if (!h1 || !h2) {
|
|
14444
|
+
return "";
|
|
14445
|
+
}
|
|
14446
|
+
const r1 = parseInt(h1.slice(1, 3), 16);
|
|
14447
|
+
const g1 = parseInt(h1.slice(3, 5), 16);
|
|
14448
|
+
const b1 = parseInt(h1.slice(5, 7), 16);
|
|
14449
|
+
const r2 = parseInt(h2.slice(1, 3), 16);
|
|
14450
|
+
const g2 = parseInt(h2.slice(3, 5), 16);
|
|
14451
|
+
const b2 = parseInt(h2.slice(5, 7), 16);
|
|
14452
|
+
const lerp = /* @__PURE__ */ __name((a, b) => Math.round(a + (b - a) * factor), "lerp");
|
|
14453
|
+
const toByte = /* @__PURE__ */ __name((n) => Math.max(0, Math.min(255, n)).toString(16).padStart(2, "0"), "toByte");
|
|
14454
|
+
return `#${toByte(lerp(r1, r2))}${toByte(lerp(g1, g2))}${toByte(lerp(b1, b2))}`;
|
|
14455
|
+
}
|
|
14456
|
+
__name(interpolateColor, "interpolateColor");
|
|
14457
|
+
function subtleBandColor(bgColor, factor = 0.06) {
|
|
14458
|
+
const hex = toHex(bgColor);
|
|
14459
|
+
if (!hex) {
|
|
14460
|
+
return "";
|
|
14461
|
+
}
|
|
14462
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
14463
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
14464
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
14465
|
+
const isDark = (r * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
14466
|
+
const target = isDark ? "#ffffff" : "#000000";
|
|
14467
|
+
return interpolateColor(hex, target, factor);
|
|
14468
|
+
}
|
|
14469
|
+
__name(subtleBandColor, "subtleBandColor");
|
|
14470
|
+
var _supportsTrueColor;
|
|
14471
|
+
function supportsTrueColor() {
|
|
14472
|
+
if (_supportsTrueColor !== void 0) return _supportsTrueColor;
|
|
14473
|
+
const colorterm = process.env["COLORTERM"];
|
|
14474
|
+
if (colorterm === "truecolor" || colorterm === "24bit" || colorterm === "kmscon") {
|
|
14475
|
+
return _supportsTrueColor = true;
|
|
14476
|
+
}
|
|
14477
|
+
if (process.stdout.getColorDepth && process.stdout.getColorDepth() >= 24) {
|
|
14478
|
+
return _supportsTrueColor = true;
|
|
14479
|
+
}
|
|
14480
|
+
return _supportsTrueColor = false;
|
|
14481
|
+
}
|
|
14482
|
+
__name(supportsTrueColor, "supportsTrueColor");
|
|
13901
14483
|
|
|
13902
14484
|
// packages/cli/src/ui/themes/theme.ts
|
|
13903
14485
|
var lightTheme = {
|
|
@@ -14516,14 +15098,14 @@ var DefaultDark = new Theme(
|
|
|
14516
15098
|
// packages/cli/src/config/trustedFolders.ts
|
|
14517
15099
|
init_esbuild_shims();
|
|
14518
15100
|
import * as fs2 from "node:fs";
|
|
14519
|
-
import * as
|
|
15101
|
+
import * as path3 from "node:path";
|
|
14520
15102
|
var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
|
|
14521
15103
|
var TRUSTED_FOLDERS_FILENAME = "trustedFolders.json";
|
|
14522
15104
|
function getTrustedFoldersPath() {
|
|
14523
15105
|
if (process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"]) {
|
|
14524
15106
|
return process.env["QWEN_CODE_TRUSTED_FOLDERS_PATH"];
|
|
14525
15107
|
}
|
|
14526
|
-
return
|
|
15108
|
+
return path3.join(Storage.getGlobalQwenDir(), TRUSTED_FOLDERS_FILENAME);
|
|
14527
15109
|
}
|
|
14528
15110
|
__name(getTrustedFoldersPath, "getTrustedFoldersPath");
|
|
14529
15111
|
var LoadedTrustedFolders = class {
|
|
@@ -14535,8 +15117,8 @@ var LoadedTrustedFolders = class {
|
|
|
14535
15117
|
__name(this, "LoadedTrustedFolders");
|
|
14536
15118
|
}
|
|
14537
15119
|
get rules() {
|
|
14538
|
-
return Object.entries(this.user.config).map(([
|
|
14539
|
-
path:
|
|
15120
|
+
return Object.entries(this.user.config).map(([path9, trustLevel]) => ({
|
|
15121
|
+
path: path9,
|
|
14540
15122
|
trustLevel
|
|
14541
15123
|
}));
|
|
14542
15124
|
}
|
|
@@ -14556,7 +15138,7 @@ var LoadedTrustedFolders = class {
|
|
|
14556
15138
|
trustedPaths.push(rule.path);
|
|
14557
15139
|
break;
|
|
14558
15140
|
case "TRUST_PARENT" /* TRUST_PARENT */:
|
|
14559
|
-
trustedPaths.push(
|
|
15141
|
+
trustedPaths.push(path3.dirname(rule.path));
|
|
14560
15142
|
break;
|
|
14561
15143
|
case "DO_NOT_TRUST" /* DO_NOT_TRUST */:
|
|
14562
15144
|
untrustedPaths.push(rule.path);
|
|
@@ -14571,14 +15153,14 @@ var LoadedTrustedFolders = class {
|
|
|
14571
15153
|
}
|
|
14572
15154
|
}
|
|
14573
15155
|
for (const untrustedPath of untrustedPaths) {
|
|
14574
|
-
if (
|
|
15156
|
+
if (path3.normalize(location) === path3.normalize(untrustedPath)) {
|
|
14575
15157
|
return false;
|
|
14576
15158
|
}
|
|
14577
15159
|
}
|
|
14578
15160
|
return void 0;
|
|
14579
15161
|
}
|
|
14580
|
-
setValue(
|
|
14581
|
-
this.user.config[
|
|
15162
|
+
setValue(path9, trustLevel) {
|
|
15163
|
+
this.user.config[path9] = trustLevel;
|
|
14582
15164
|
saveTrustedFolders(this.user);
|
|
14583
15165
|
}
|
|
14584
15166
|
};
|
|
@@ -14618,7 +15200,7 @@ function loadTrustedFolders() {
|
|
|
14618
15200
|
__name(loadTrustedFolders, "loadTrustedFolders");
|
|
14619
15201
|
function saveTrustedFolders(trustedFoldersFile) {
|
|
14620
15202
|
try {
|
|
14621
|
-
const dirPath =
|
|
15203
|
+
const dirPath = path3.dirname(trustedFoldersFile.path);
|
|
14622
15204
|
if (!fs2.existsSync(dirPath)) {
|
|
14623
15205
|
fs2.mkdirSync(dirPath, { recursive: true });
|
|
14624
15206
|
}
|
|
@@ -16320,6 +16902,15 @@ var SETTINGS_SCHEMA = {
|
|
|
16320
16902
|
description: "The number of lines to keep when truncating tool output.",
|
|
16321
16903
|
showInDialog: false
|
|
16322
16904
|
},
|
|
16905
|
+
toolOutputBatchBudget: {
|
|
16906
|
+
type: "number",
|
|
16907
|
+
label: "Tool Output Batch Budget",
|
|
16908
|
+
category: "General",
|
|
16909
|
+
requiresRestart: true,
|
|
16910
|
+
default: DEFAULT_TOOL_OUTPUT_BATCH_BUDGET,
|
|
16911
|
+
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.",
|
|
16912
|
+
showInDialog: false
|
|
16913
|
+
},
|
|
16323
16914
|
computerUse: {
|
|
16324
16915
|
type: "object",
|
|
16325
16916
|
label: "Computer Use",
|
|
@@ -16342,6 +16933,51 @@ var SETTINGS_SCHEMA = {
|
|
|
16342
16933
|
}
|
|
16343
16934
|
}
|
|
16344
16935
|
},
|
|
16936
|
+
policy: {
|
|
16937
|
+
type: "object",
|
|
16938
|
+
label: "Daemon Policy",
|
|
16939
|
+
category: "Daemon",
|
|
16940
|
+
requiresRestart: true,
|
|
16941
|
+
default: {},
|
|
16942
|
+
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.",
|
|
16943
|
+
showInDialog: false,
|
|
16944
|
+
properties: {
|
|
16945
|
+
permissionStrategy: {
|
|
16946
|
+
type: "enum",
|
|
16947
|
+
label: "Permission Mediation Policy",
|
|
16948
|
+
category: "Daemon",
|
|
16949
|
+
requiresRestart: true,
|
|
16950
|
+
default: "first-responder",
|
|
16951
|
+
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.',
|
|
16952
|
+
showInDialog: true,
|
|
16953
|
+
options: [
|
|
16954
|
+
{ value: "first-responder", label: "First Responder" },
|
|
16955
|
+
{ value: "designated", label: "Designated Originator" },
|
|
16956
|
+
{ value: "consensus", label: "Consensus Quorum" },
|
|
16957
|
+
{ value: "local-only", label: "Local Only" }
|
|
16958
|
+
]
|
|
16959
|
+
},
|
|
16960
|
+
consensusQuorum: {
|
|
16961
|
+
type: "number",
|
|
16962
|
+
label: "Consensus Quorum Override",
|
|
16963
|
+
category: "Daemon",
|
|
16964
|
+
requiresRestart: true,
|
|
16965
|
+
default: void 0,
|
|
16966
|
+
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.",
|
|
16967
|
+
showInDialog: false,
|
|
16968
|
+
// runQwenServe.ts validates `Number.isInteger(n) && n >= 1` and
|
|
16969
|
+
// refuses to boot otherwise. Override the generated schema so IDE
|
|
16970
|
+
// (VSCode, JetBrains via JSON Schema) flags `0`, `-1`, `1.5`
|
|
16971
|
+
// BEFORE the user restarts the daemon. The bare `type:'number'`
|
|
16972
|
+
// mapping accepts all of these.
|
|
16973
|
+
jsonSchemaOverride: {
|
|
16974
|
+
type: "integer",
|
|
16975
|
+
minimum: 1,
|
|
16976
|
+
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."
|
|
16977
|
+
}
|
|
16978
|
+
}
|
|
16979
|
+
}
|
|
16980
|
+
},
|
|
16345
16981
|
mcp: {
|
|
16346
16982
|
type: "object",
|
|
16347
16983
|
label: "MCP",
|
|
@@ -16976,8 +17612,8 @@ function getDefaultValue(key) {
|
|
|
16976
17612
|
return getFlattenedSchema()[key]?.default;
|
|
16977
17613
|
}
|
|
16978
17614
|
__name(getDefaultValue, "getDefaultValue");
|
|
16979
|
-
function getNestedValue(obj,
|
|
16980
|
-
const [first, ...rest] =
|
|
17615
|
+
function getNestedValue(obj, path9) {
|
|
17616
|
+
const [first, ...rest] = path9;
|
|
16981
17617
|
if (!first || !(first in obj)) {
|
|
16982
17618
|
return void 0;
|
|
16983
17619
|
}
|
|
@@ -16991,8 +17627,8 @@ function getNestedValue(obj, path8) {
|
|
|
16991
17627
|
return void 0;
|
|
16992
17628
|
}
|
|
16993
17629
|
__name(getNestedValue, "getNestedValue");
|
|
16994
|
-
function getNestedProperty(obj,
|
|
16995
|
-
return getNestedValue(obj,
|
|
17630
|
+
function getNestedProperty(obj, path9) {
|
|
17631
|
+
return getNestedValue(obj, path9.split("."));
|
|
16996
17632
|
}
|
|
16997
17633
|
__name(getNestedProperty, "getNestedProperty");
|
|
16998
17634
|
function getEffectiveValue(key, settings, mergedSettings) {
|
|
@@ -17000,12 +17636,12 @@ function getEffectiveValue(key, settings, mergedSettings) {
|
|
|
17000
17636
|
if (!definition) {
|
|
17001
17637
|
return void 0;
|
|
17002
17638
|
}
|
|
17003
|
-
const
|
|
17004
|
-
let value = getNestedValue(settings,
|
|
17639
|
+
const path9 = key.split(".");
|
|
17640
|
+
let value = getNestedValue(settings, path9);
|
|
17005
17641
|
if (value !== void 0) {
|
|
17006
17642
|
return value;
|
|
17007
17643
|
}
|
|
17008
|
-
value = getNestedValue(mergedSettings,
|
|
17644
|
+
value = getNestedValue(mergedSettings, path9);
|
|
17009
17645
|
if (value !== void 0) {
|
|
17010
17646
|
return value;
|
|
17011
17647
|
}
|
|
@@ -17056,8 +17692,8 @@ function getDialogSettingKeys() {
|
|
|
17056
17692
|
}
|
|
17057
17693
|
__name(getDialogSettingKeys, "getDialogSettingKeys");
|
|
17058
17694
|
function settingExistsInScope(key, scopeSettings) {
|
|
17059
|
-
const
|
|
17060
|
-
const value = getNestedValue(scopeSettings,
|
|
17695
|
+
const path9 = key.split(".");
|
|
17696
|
+
const value = getNestedValue(scopeSettings, path9);
|
|
17061
17697
|
return value !== void 0;
|
|
17062
17698
|
}
|
|
17063
17699
|
__name(settingExistsInScope, "settingExistsInScope");
|
|
@@ -17070,8 +17706,8 @@ function pathHasUnsafeSegment(keys) {
|
|
|
17070
17706
|
return false;
|
|
17071
17707
|
}
|
|
17072
17708
|
__name(pathHasUnsafeSegment, "pathHasUnsafeSegment");
|
|
17073
|
-
function setNestedPropertyForce(obj,
|
|
17074
|
-
const keys =
|
|
17709
|
+
function setNestedPropertyForce(obj, path9, value) {
|
|
17710
|
+
const keys = path9.split(".");
|
|
17075
17711
|
if (pathHasUnsafeSegment(keys)) return;
|
|
17076
17712
|
const lastKey = keys.pop();
|
|
17077
17713
|
if (!lastKey) return;
|
|
@@ -17085,8 +17721,8 @@ function setNestedPropertyForce(obj, path8, value) {
|
|
|
17085
17721
|
current[lastKey] = value;
|
|
17086
17722
|
}
|
|
17087
17723
|
__name(setNestedPropertyForce, "setNestedPropertyForce");
|
|
17088
|
-
function setNestedPropertySafe(obj,
|
|
17089
|
-
const keys =
|
|
17724
|
+
function setNestedPropertySafe(obj, path9, value) {
|
|
17725
|
+
const keys = path9.split(".");
|
|
17090
17726
|
if (pathHasUnsafeSegment(keys)) return;
|
|
17091
17727
|
const lastKey = keys.pop();
|
|
17092
17728
|
if (!lastKey) return;
|
|
@@ -17105,8 +17741,8 @@ function setNestedPropertySafe(obj, path8, value) {
|
|
|
17105
17741
|
current[lastKey] = value;
|
|
17106
17742
|
}
|
|
17107
17743
|
__name(setNestedPropertySafe, "setNestedPropertySafe");
|
|
17108
|
-
function deleteNestedPropertySafe(obj,
|
|
17109
|
-
const keys =
|
|
17744
|
+
function deleteNestedPropertySafe(obj, path9) {
|
|
17745
|
+
const keys = path9.split(".");
|
|
17110
17746
|
const lastKey = keys.pop();
|
|
17111
17747
|
if (!lastKey) return;
|
|
17112
17748
|
let current = obj;
|
|
@@ -17138,10 +17774,10 @@ function getRestartRequiredFromModified(modifiedSettings) {
|
|
|
17138
17774
|
__name(getRestartRequiredFromModified, "getRestartRequiredFromModified");
|
|
17139
17775
|
function saveModifiedSettings(modifiedSettings, pendingSettings, loadedSettings, scope) {
|
|
17140
17776
|
modifiedSettings.forEach((settingKey) => {
|
|
17141
|
-
const
|
|
17777
|
+
const path9 = settingKey.split(".");
|
|
17142
17778
|
const value = getNestedValue(
|
|
17143
17779
|
pendingSettings,
|
|
17144
|
-
|
|
17780
|
+
path9
|
|
17145
17781
|
);
|
|
17146
17782
|
const existsInOriginalFile = settingExistsInScope(
|
|
17147
17783
|
settingKey,
|
|
@@ -17243,12 +17879,12 @@ function isPlainObject(item) {
|
|
|
17243
17879
|
return !!item && typeof item === "object" && !Array.isArray(item);
|
|
17244
17880
|
}
|
|
17245
17881
|
__name(isPlainObject, "isPlainObject");
|
|
17246
|
-
function mergeRecursively(target, source, getMergeStrategyForPath2,
|
|
17882
|
+
function mergeRecursively(target, source, getMergeStrategyForPath2, path9 = []) {
|
|
17247
17883
|
for (const key of Object.keys(source)) {
|
|
17248
17884
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
17249
17885
|
continue;
|
|
17250
17886
|
}
|
|
17251
|
-
const newPath = [...
|
|
17887
|
+
const newPath = [...path9, key];
|
|
17252
17888
|
const srcValue = source[key];
|
|
17253
17889
|
const objValue = target[key];
|
|
17254
17890
|
const mergeStrategy = getMergeStrategyForPath2(newPath);
|
|
@@ -18093,10 +18729,10 @@ __name(needsMigration, "needsMigration");
|
|
|
18093
18729
|
|
|
18094
18730
|
// packages/cli/src/config/settings.ts
|
|
18095
18731
|
var debugLogger3 = createDebugLogger("SETTINGS");
|
|
18096
|
-
function getMergeStrategyForPath(
|
|
18732
|
+
function getMergeStrategyForPath(path9) {
|
|
18097
18733
|
let current = void 0;
|
|
18098
18734
|
let currentSchema = getSettingsSchema();
|
|
18099
|
-
for (const key of
|
|
18735
|
+
for (const key of path9) {
|
|
18100
18736
|
if (!currentSchema || !currentSchema[key]) {
|
|
18101
18737
|
return void 0;
|
|
18102
18738
|
}
|
|
@@ -18112,7 +18748,7 @@ function getUserSettingsPath() {
|
|
|
18112
18748
|
}
|
|
18113
18749
|
__name(getUserSettingsPath, "getUserSettingsPath");
|
|
18114
18750
|
function getUserSettingsDir() {
|
|
18115
|
-
return
|
|
18751
|
+
return path4.dirname(getUserSettingsPath());
|
|
18116
18752
|
}
|
|
18117
18753
|
__name(getUserSettingsDir, "getUserSettingsDir");
|
|
18118
18754
|
var DEFAULT_EXCLUDED_ENV_VARS = ["DEBUG", "DEBUG_MODE"];
|
|
@@ -18124,6 +18760,30 @@ var PROJECT_ENV_HARDCODED_EXCLUSIONS = [
|
|
|
18124
18760
|
ENV_CORRUPTED_PATH,
|
|
18125
18761
|
ENV_WAS_RECOVERED
|
|
18126
18762
|
];
|
|
18763
|
+
var RELOAD_EXCLUDED_KEYS = /* @__PURE__ */ new Set([
|
|
18764
|
+
...PROJECT_ENV_HARDCODED_EXCLUSIONS,
|
|
18765
|
+
"QWEN_SERVER_TOKEN",
|
|
18766
|
+
"QWEN_CLI_ENTRY",
|
|
18767
|
+
"NODE_OPTIONS",
|
|
18768
|
+
"NODE_PATH",
|
|
18769
|
+
"NODE_TLS_REJECT_UNAUTHORIZED",
|
|
18770
|
+
"LD_PRELOAD",
|
|
18771
|
+
"LD_AUDIT",
|
|
18772
|
+
"LD_LIBRARY_PATH",
|
|
18773
|
+
"DYLD_INSERT_LIBRARIES",
|
|
18774
|
+
"DYLD_LIBRARY_PATH",
|
|
18775
|
+
"BASH_ENV",
|
|
18776
|
+
"ENV",
|
|
18777
|
+
"PATH",
|
|
18778
|
+
"HOME",
|
|
18779
|
+
"TMPDIR",
|
|
18780
|
+
"TMP",
|
|
18781
|
+
"TEMP"
|
|
18782
|
+
]);
|
|
18783
|
+
var dotEnvSourcedKeys = /* @__PURE__ */ new Set();
|
|
18784
|
+
var settingsEnvSourcedKeys = /* @__PURE__ */ new Set();
|
|
18785
|
+
var lastReloadSnapshot = /* @__PURE__ */ new Map();
|
|
18786
|
+
var lastReloadSnapshotSeeded = false;
|
|
18127
18787
|
var SETTINGS_VERSION = 4;
|
|
18128
18788
|
var SETTINGS_VERSION_KEY = "$version";
|
|
18129
18789
|
function getSystemSettingsPath() {
|
|
@@ -18143,8 +18803,8 @@ function getSystemDefaultsPath() {
|
|
|
18143
18803
|
if (process2.env["QWEN_CODE_SYSTEM_DEFAULTS_PATH"]) {
|
|
18144
18804
|
return process2.env["QWEN_CODE_SYSTEM_DEFAULTS_PATH"];
|
|
18145
18805
|
}
|
|
18146
|
-
return
|
|
18147
|
-
|
|
18806
|
+
return path4.join(
|
|
18807
|
+
path4.dirname(getSystemSettingsPath()),
|
|
18148
18808
|
"system-defaults.json"
|
|
18149
18809
|
);
|
|
18150
18810
|
}
|
|
@@ -18404,10 +19064,10 @@ function getUserLevelEnvPaths() {
|
|
|
18404
19064
|
const homeDir = homedir();
|
|
18405
19065
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18406
19066
|
const paths = /* @__PURE__ */ new Set([
|
|
18407
|
-
|
|
18408
|
-
|
|
19067
|
+
path4.normalize(path4.join(homeDir, ".env")),
|
|
19068
|
+
path4.normalize(path4.join(globalQwenDir, ".env"))
|
|
18409
19069
|
]);
|
|
18410
|
-
const legacyQwenEnv =
|
|
19070
|
+
const legacyQwenEnv = path4.normalize(path4.join(homeDir, QWEN_DIR, ".env"));
|
|
18411
19071
|
paths.add(legacyQwenEnv);
|
|
18412
19072
|
return paths;
|
|
18413
19073
|
}
|
|
@@ -18423,9 +19083,9 @@ function preResolveHomeEnvOverrides() {
|
|
|
18423
19083
|
}
|
|
18424
19084
|
const initialQwenHome = process2.env["QWEN_HOME"];
|
|
18425
19085
|
const initialQwenDir = Storage.getGlobalQwenDir();
|
|
18426
|
-
const candidates = [
|
|
19086
|
+
const candidates = [path4.join(initialQwenDir, ".env")];
|
|
18427
19087
|
if (!initialQwenHome) {
|
|
18428
|
-
candidates.push(
|
|
19088
|
+
candidates.push(path4.join(path4.dirname(initialQwenDir), ".env"));
|
|
18429
19089
|
}
|
|
18430
19090
|
for (const candidate of candidates) {
|
|
18431
19091
|
readHomeEnvInto(candidate);
|
|
@@ -18434,7 +19094,7 @@ function preResolveHomeEnvOverrides() {
|
|
|
18434
19094
|
if (discoveredQwenHome && discoveredQwenHome !== initialQwenHome) {
|
|
18435
19095
|
const discoveredDir = Storage.getGlobalQwenDir();
|
|
18436
19096
|
if (discoveredDir !== initialQwenDir) {
|
|
18437
|
-
readHomeEnvInto(
|
|
19097
|
+
readHomeEnvInto(path4.join(discoveredDir, ".env"));
|
|
18438
19098
|
}
|
|
18439
19099
|
}
|
|
18440
19100
|
}
|
|
@@ -18456,9 +19116,9 @@ function readHomeEnvInto(file) {
|
|
|
18456
19116
|
__name(readHomeEnvInto, "readHomeEnvInto");
|
|
18457
19117
|
function getHomeEnvFallbackVars() {
|
|
18458
19118
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18459
|
-
const candidates = [
|
|
19119
|
+
const candidates = [path4.join(globalQwenDir, ".env")];
|
|
18460
19120
|
if (!process2.env["QWEN_HOME"]) {
|
|
18461
|
-
candidates.push(
|
|
19121
|
+
candidates.push(path4.join(path4.dirname(globalQwenDir), ".env"));
|
|
18462
19122
|
}
|
|
18463
19123
|
const result = {};
|
|
18464
19124
|
for (const candidate of candidates) {
|
|
@@ -18494,13 +19154,13 @@ function detectQwenHomeRedirectWithoutMigration(activeUserSettingsPath) {
|
|
|
18494
19154
|
} finally {
|
|
18495
19155
|
process2.env["QWEN_HOME"] = savedQwenHome;
|
|
18496
19156
|
}
|
|
18497
|
-
if (
|
|
19157
|
+
if (path4.resolve(activeQwenDir) === path4.resolve(legacyQwenDir)) {
|
|
18498
19158
|
return null;
|
|
18499
19159
|
}
|
|
18500
19160
|
if (fs6.existsSync(activeUserSettingsPath)) {
|
|
18501
19161
|
return null;
|
|
18502
19162
|
}
|
|
18503
|
-
const legacyUserSettings =
|
|
19163
|
+
const legacyUserSettings = path4.join(legacyQwenDir, "settings.json");
|
|
18504
19164
|
if (!fs6.existsSync(legacyUserSettings)) {
|
|
18505
19165
|
return null;
|
|
18506
19166
|
}
|
|
@@ -18511,15 +19171,15 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18511
19171
|
const homeDir = homedir();
|
|
18512
19172
|
const isTrusted = isWorkspaceTrusted(settings).isTrusted;
|
|
18513
19173
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18514
|
-
const legacyQwenDir =
|
|
18515
|
-
const hasCustomConfigDir =
|
|
18516
|
-
const canUseEnvFile = /* @__PURE__ */ __name((filePath) => isTrusted !== false || userLevelPaths.has(
|
|
19174
|
+
const legacyQwenDir = path4.normalize(path4.join(homeDir, QWEN_DIR));
|
|
19175
|
+
const hasCustomConfigDir = path4.normalize(globalQwenDir) !== legacyQwenDir;
|
|
19176
|
+
const canUseEnvFile = /* @__PURE__ */ __name((filePath) => isTrusted !== false || userLevelPaths.has(path4.normalize(filePath)), "canUseEnvFile");
|
|
18517
19177
|
const findHomeCandidate = /* @__PURE__ */ __name(() => {
|
|
18518
|
-
const candidates = [
|
|
19178
|
+
const candidates = [path4.join(globalQwenDir, ".env")];
|
|
18519
19179
|
if (hasCustomConfigDir) {
|
|
18520
|
-
candidates.push(
|
|
19180
|
+
candidates.push(path4.join(legacyQwenDir, ".env"));
|
|
18521
19181
|
}
|
|
18522
|
-
candidates.push(
|
|
19182
|
+
candidates.push(path4.join(homeDir, ".env"));
|
|
18523
19183
|
for (const candidate of candidates) {
|
|
18524
19184
|
if (fs6.existsSync(candidate) && canUseEnvFile(candidate)) {
|
|
18525
19185
|
return candidate;
|
|
@@ -18527,7 +19187,7 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18527
19187
|
}
|
|
18528
19188
|
return null;
|
|
18529
19189
|
}, "findHomeCandidate");
|
|
18530
|
-
let currentDir =
|
|
19190
|
+
let currentDir = path4.resolve(startDir);
|
|
18531
19191
|
let visitedHomeDir = false;
|
|
18532
19192
|
while (true) {
|
|
18533
19193
|
if (currentDir === homeDir) {
|
|
@@ -18535,16 +19195,16 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18535
19195
|
const found = findHomeCandidate();
|
|
18536
19196
|
if (found) return found;
|
|
18537
19197
|
} else {
|
|
18538
|
-
const geminiEnvPath =
|
|
19198
|
+
const geminiEnvPath = path4.join(currentDir, QWEN_DIR, ".env");
|
|
18539
19199
|
if (fs6.existsSync(geminiEnvPath) && canUseEnvFile(geminiEnvPath)) {
|
|
18540
19200
|
return geminiEnvPath;
|
|
18541
19201
|
}
|
|
18542
|
-
const envPath =
|
|
19202
|
+
const envPath = path4.join(currentDir, ".env");
|
|
18543
19203
|
if (fs6.existsSync(envPath) && canUseEnvFile(envPath)) {
|
|
18544
19204
|
return envPath;
|
|
18545
19205
|
}
|
|
18546
19206
|
}
|
|
18547
|
-
const parentDir =
|
|
19207
|
+
const parentDir = path4.dirname(currentDir);
|
|
18548
19208
|
if (parentDir === currentDir || !parentDir) {
|
|
18549
19209
|
return visitedHomeDir ? null : findHomeCandidate();
|
|
18550
19210
|
}
|
|
@@ -18577,9 +19237,9 @@ function loadEnvironment(settings) {
|
|
|
18577
19237
|
const envFileContent = fs6.readFileSync(envFilePath, "utf-8");
|
|
18578
19238
|
const parsedEnv = dotenv.parse(envFileContent);
|
|
18579
19239
|
const excludedVars = settings?.advanced?.excludedEnvVars || DEFAULT_EXCLUDED_ENV_VARS;
|
|
18580
|
-
const normalizedEnvFilePath =
|
|
19240
|
+
const normalizedEnvFilePath = path4.normalize(envFilePath);
|
|
18581
19241
|
const isHomeScopedEnvFile = userLevelPaths.has(normalizedEnvFilePath);
|
|
18582
|
-
const isQwenScopedEnvFile = isHomeScopedEnvFile ||
|
|
19242
|
+
const isQwenScopedEnvFile = isHomeScopedEnvFile || path4.basename(path4.dirname(normalizedEnvFilePath)) === QWEN_DIR;
|
|
18583
19243
|
for (const key in parsedEnv) {
|
|
18584
19244
|
if (Object.hasOwn(parsedEnv, key)) {
|
|
18585
19245
|
if (!isHomeScopedEnvFile && PROJECT_ENV_HARDCODED_EXCLUSIONS.includes(key)) {
|
|
@@ -18590,6 +19250,10 @@ function loadEnvironment(settings) {
|
|
|
18590
19250
|
}
|
|
18591
19251
|
if (!Object.hasOwn(process2.env, key)) {
|
|
18592
19252
|
process2.env[key] = parsedEnv[key];
|
|
19253
|
+
dotEnvSourcedKeys.add(key);
|
|
19254
|
+
}
|
|
19255
|
+
if (!lastReloadSnapshotSeeded) {
|
|
19256
|
+
lastReloadSnapshot.set(key, parsedEnv[key]);
|
|
18593
19257
|
}
|
|
18594
19258
|
}
|
|
18595
19259
|
}
|
|
@@ -18603,13 +19267,110 @@ function loadEnvironment(settings) {
|
|
|
18603
19267
|
}
|
|
18604
19268
|
if (!Object.hasOwn(process2.env, key) && typeof value === "string") {
|
|
18605
19269
|
process2.env[key] = value;
|
|
19270
|
+
settingsEnvSourcedKeys.add(key);
|
|
19271
|
+
}
|
|
19272
|
+
if (!lastReloadSnapshotSeeded && typeof value === "string" && !lastReloadSnapshot.has(key)) {
|
|
19273
|
+
lastReloadSnapshot.set(key, value);
|
|
18606
19274
|
}
|
|
18607
19275
|
}
|
|
18608
19276
|
}
|
|
19277
|
+
lastReloadSnapshotSeeded = true;
|
|
18609
19278
|
}
|
|
18610
19279
|
__name(loadEnvironment, "loadEnvironment");
|
|
19280
|
+
function reloadEnvironment(settings, workspaceCwd) {
|
|
19281
|
+
const userLevelPaths = getUserLevelEnvPaths();
|
|
19282
|
+
const envFilePath = findEnvFile(settings, workspaceCwd, userLevelPaths);
|
|
19283
|
+
if (process2.env["CLOUD_SHELL"] === "true") {
|
|
19284
|
+
setUpCloudShellEnvironment(envFilePath);
|
|
19285
|
+
}
|
|
19286
|
+
let dotEnvReadFailed = false;
|
|
19287
|
+
const newDotEnvKeys = /* @__PURE__ */ new Map();
|
|
19288
|
+
const newSettingsEnvKeys = /* @__PURE__ */ new Map();
|
|
19289
|
+
if (envFilePath) {
|
|
19290
|
+
try {
|
|
19291
|
+
const envFileContent = fs6.readFileSync(envFilePath, "utf-8");
|
|
19292
|
+
const parsedEnv = dotenv.parse(envFileContent);
|
|
19293
|
+
const excludedVars = settings?.advanced?.excludedEnvVars || DEFAULT_EXCLUDED_ENV_VARS;
|
|
19294
|
+
const normalizedEnvFilePath = path4.normalize(envFilePath);
|
|
19295
|
+
const isHomeScopedEnvFile = userLevelPaths.has(normalizedEnvFilePath);
|
|
19296
|
+
const isQwenScopedEnvFile = isHomeScopedEnvFile || path4.basename(path4.dirname(normalizedEnvFilePath)) === QWEN_DIR;
|
|
19297
|
+
for (const key in parsedEnv) {
|
|
19298
|
+
if (!Object.hasOwn(parsedEnv, key)) continue;
|
|
19299
|
+
if (RELOAD_EXCLUDED_KEYS.has(key)) continue;
|
|
19300
|
+
if (!isHomeScopedEnvFile && PROJECT_ENV_HARDCODED_EXCLUSIONS.includes(key)) {
|
|
19301
|
+
continue;
|
|
19302
|
+
}
|
|
19303
|
+
if (!isQwenScopedEnvFile && excludedVars.includes(key)) continue;
|
|
19304
|
+
newDotEnvKeys.set(key, parsedEnv[key]);
|
|
19305
|
+
}
|
|
19306
|
+
} catch {
|
|
19307
|
+
dotEnvReadFailed = true;
|
|
19308
|
+
}
|
|
19309
|
+
}
|
|
19310
|
+
if (settings.env) {
|
|
19311
|
+
for (const [key, value] of Object.entries(settings.env)) {
|
|
19312
|
+
if (RELOAD_EXCLUDED_KEYS.has(key)) continue;
|
|
19313
|
+
if (PROJECT_ENV_HARDCODED_EXCLUSIONS.includes(key)) continue;
|
|
19314
|
+
if (typeof value !== "string") continue;
|
|
19315
|
+
if (newDotEnvKeys.has(key)) continue;
|
|
19316
|
+
if (dotEnvReadFailed && lastReloadSnapshot.has(key)) continue;
|
|
19317
|
+
newSettingsEnvKeys.set(key, value);
|
|
19318
|
+
}
|
|
19319
|
+
}
|
|
19320
|
+
const allNewKeys = /* @__PURE__ */ new Set([
|
|
19321
|
+
...newDotEnvKeys.keys(),
|
|
19322
|
+
...newSettingsEnvKeys.keys()
|
|
19323
|
+
]);
|
|
19324
|
+
const updatedKeys = [];
|
|
19325
|
+
const removedKeys = [];
|
|
19326
|
+
if (!dotEnvReadFailed) {
|
|
19327
|
+
const previouslyKnown = /* @__PURE__ */ new Set([
|
|
19328
|
+
...lastReloadSnapshot.keys(),
|
|
19329
|
+
...dotEnvSourcedKeys,
|
|
19330
|
+
...settingsEnvSourcedKeys
|
|
19331
|
+
]);
|
|
19332
|
+
for (const key of previouslyKnown) {
|
|
19333
|
+
if (!allNewKeys.has(key) && !RELOAD_EXCLUDED_KEYS.has(key)) {
|
|
19334
|
+
delete process2.env[key];
|
|
19335
|
+
removedKeys.push(key);
|
|
19336
|
+
}
|
|
19337
|
+
}
|
|
19338
|
+
}
|
|
19339
|
+
for (const [key, value] of newDotEnvKeys) {
|
|
19340
|
+
if (process2.env[key] !== value) {
|
|
19341
|
+
updatedKeys.push(key);
|
|
19342
|
+
}
|
|
19343
|
+
process2.env[key] = value;
|
|
19344
|
+
}
|
|
19345
|
+
for (const [key, value] of newSettingsEnvKeys) {
|
|
19346
|
+
if (process2.env[key] !== value) {
|
|
19347
|
+
updatedKeys.push(key);
|
|
19348
|
+
}
|
|
19349
|
+
process2.env[key] = value;
|
|
19350
|
+
}
|
|
19351
|
+
if (!dotEnvReadFailed) {
|
|
19352
|
+
dotEnvSourcedKeys.clear();
|
|
19353
|
+
for (const key of newDotEnvKeys.keys()) {
|
|
19354
|
+
dotEnvSourcedKeys.add(key);
|
|
19355
|
+
}
|
|
19356
|
+
lastReloadSnapshot.clear();
|
|
19357
|
+
for (const [key, value] of newDotEnvKeys) {
|
|
19358
|
+
lastReloadSnapshot.set(key, value);
|
|
19359
|
+
}
|
|
19360
|
+
for (const [key, value] of newSettingsEnvKeys) {
|
|
19361
|
+
lastReloadSnapshot.set(key, value);
|
|
19362
|
+
}
|
|
19363
|
+
}
|
|
19364
|
+
settingsEnvSourcedKeys.clear();
|
|
19365
|
+
for (const key of newSettingsEnvKeys.keys()) {
|
|
19366
|
+
settingsEnvSourcedKeys.add(key);
|
|
19367
|
+
}
|
|
19368
|
+
return { updatedKeys, removedKeys };
|
|
19369
|
+
}
|
|
19370
|
+
__name(reloadEnvironment, "reloadEnvironment");
|
|
18611
19371
|
var CORRUPTED_SUFFIX = ".corrupted";
|
|
18612
19372
|
function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars = true) {
|
|
19373
|
+
const opts = typeof consumeCorruptionEnvVars === "object" ? consumeCorruptionEnvVars : { consumeCorruptionEnvVars };
|
|
18613
19374
|
preResolveHomeEnvOverrides();
|
|
18614
19375
|
const userSettingsPath = getUserSettingsPath();
|
|
18615
19376
|
const qwenHomeRedirectWarning = detectQwenHomeRedirectWithoutMigration(userSettingsPath);
|
|
@@ -18621,8 +19382,8 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18621
19382
|
const systemSettingsPath = getSystemSettingsPath();
|
|
18622
19383
|
const systemDefaultsPath = getSystemDefaultsPath();
|
|
18623
19384
|
const migratedInMemorScopes = /* @__PURE__ */ new Set();
|
|
18624
|
-
const resolvedWorkspaceDir =
|
|
18625
|
-
const resolvedHomeDir =
|
|
19385
|
+
const resolvedWorkspaceDir = path4.resolve(workspaceDir);
|
|
19386
|
+
const resolvedHomeDir = path4.resolve(homedir());
|
|
18626
19387
|
let realWorkspaceDir = resolvedWorkspaceDir;
|
|
18627
19388
|
try {
|
|
18628
19389
|
realWorkspaceDir = fs6.realpathSync(resolvedWorkspaceDir);
|
|
@@ -18692,7 +19453,7 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18692
19453
|
}
|
|
18693
19454
|
}
|
|
18694
19455
|
const envCorruptedPath = process2.env[ENV_CORRUPTED_PATH];
|
|
18695
|
-
if (consumeCorruptionEnvVars && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
|
|
19456
|
+
if ((opts.consumeCorruptionEnvVars ?? true) && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
|
|
18696
19457
|
corruptedSaved = true;
|
|
18697
19458
|
recoveredFromEnvVar = process2.env[ENV_WAS_RECOVERED] === "1";
|
|
18698
19459
|
delete process2.env[ENV_CORRUPTED_PATH];
|
|
@@ -18823,7 +19584,9 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18823
19584
|
workspaceSettings,
|
|
18824
19585
|
isTrusted
|
|
18825
19586
|
);
|
|
18826
|
-
|
|
19587
|
+
if (!opts.skipLoadEnvironment) {
|
|
19588
|
+
loadEnvironment(tempMergedSettings);
|
|
19589
|
+
}
|
|
18827
19590
|
if (settingsErrors.length > 0) {
|
|
18828
19591
|
const errorMessages = settingsErrors.map(
|
|
18829
19592
|
(error) => `Error in ${error.path}: ${error.message}`
|
|
@@ -18881,7 +19644,7 @@ function createSettingsUpdate(key, value) {
|
|
|
18881
19644
|
__name(createSettingsUpdate, "createSettingsUpdate");
|
|
18882
19645
|
function saveSettings(settingsFile, updates = settingsFile.originalSettings, replacePath = []) {
|
|
18883
19646
|
try {
|
|
18884
|
-
const dirPath =
|
|
19647
|
+
const dirPath = path4.dirname(settingsFile.path);
|
|
18885
19648
|
if (!fs6.existsSync(dirPath)) {
|
|
18886
19649
|
fs6.mkdirSync(dirPath, { recursive: true });
|
|
18887
19650
|
}
|
|
@@ -18912,26 +19675,26 @@ init_esbuild_shims();
|
|
|
18912
19675
|
|
|
18913
19676
|
// node_modules/read-package-up/index.js
|
|
18914
19677
|
init_esbuild_shims();
|
|
18915
|
-
import
|
|
19678
|
+
import path7 from "node:path";
|
|
18916
19679
|
|
|
18917
19680
|
// node_modules/find-up-simple/index.js
|
|
18918
19681
|
init_esbuild_shims();
|
|
18919
19682
|
import process3 from "node:process";
|
|
18920
19683
|
import fsPromises from "node:fs/promises";
|
|
18921
19684
|
import { fileURLToPath } from "node:url";
|
|
18922
|
-
import
|
|
19685
|
+
import path5 from "node:path";
|
|
18923
19686
|
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
18924
19687
|
async function findUp(name, {
|
|
18925
19688
|
cwd = process3.cwd(),
|
|
18926
19689
|
type = "file",
|
|
18927
19690
|
stopAt
|
|
18928
19691
|
} = {}) {
|
|
18929
|
-
let directory =
|
|
18930
|
-
const { root } =
|
|
18931
|
-
stopAt =
|
|
18932
|
-
const isAbsoluteName =
|
|
19692
|
+
let directory = path5.resolve(toPath(cwd) ?? "");
|
|
19693
|
+
const { root } = path5.parse(directory);
|
|
19694
|
+
stopAt = path5.resolve(directory, toPath(stopAt ?? root));
|
|
19695
|
+
const isAbsoluteName = path5.isAbsolute(name);
|
|
18933
19696
|
while (directory) {
|
|
18934
|
-
const filePath = isAbsoluteName ? name :
|
|
19697
|
+
const filePath = isAbsoluteName ? name : path5.join(directory, name);
|
|
18935
19698
|
try {
|
|
18936
19699
|
const stats = await fsPromises.stat(filePath);
|
|
18937
19700
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
|
|
@@ -18942,7 +19705,7 @@ async function findUp(name, {
|
|
|
18942
19705
|
if (directory === stopAt || directory === root) {
|
|
18943
19706
|
break;
|
|
18944
19707
|
}
|
|
18945
|
-
directory =
|
|
19708
|
+
directory = path5.dirname(directory);
|
|
18946
19709
|
}
|
|
18947
19710
|
}
|
|
18948
19711
|
__name(findUp, "findUp");
|
|
@@ -18950,7 +19713,7 @@ __name(findUp, "findUp");
|
|
|
18950
19713
|
// node_modules/read-pkg/index.js
|
|
18951
19714
|
init_esbuild_shims();
|
|
18952
19715
|
import fsPromises2 from "node:fs/promises";
|
|
18953
|
-
import
|
|
19716
|
+
import path6 from "node:path";
|
|
18954
19717
|
|
|
18955
19718
|
// node_modules/parse-json/index.js
|
|
18956
19719
|
init_esbuild_shims();
|
|
@@ -19089,7 +19852,7 @@ function toPath2(urlOrPath) {
|
|
|
19089
19852
|
__name(toPath2, "toPath");
|
|
19090
19853
|
|
|
19091
19854
|
// node_modules/read-pkg/index.js
|
|
19092
|
-
var getPackagePath = /* @__PURE__ */ __name((cwd) =>
|
|
19855
|
+
var getPackagePath = /* @__PURE__ */ __name((cwd) => path6.resolve(toPath2(cwd) ?? ".", "package.json"), "getPackagePath");
|
|
19093
19856
|
var _readPackage = /* @__PURE__ */ __name((file, normalize3) => {
|
|
19094
19857
|
const json = typeof file === "string" ? parseJson(file) : file;
|
|
19095
19858
|
if (normalize3) {
|
|
@@ -19110,7 +19873,7 @@ async function readPackageUp(options) {
|
|
|
19110
19873
|
return;
|
|
19111
19874
|
}
|
|
19112
19875
|
return {
|
|
19113
|
-
packageJson: await readPackage({ ...options, cwd:
|
|
19876
|
+
packageJson: await readPackage({ ...options, cwd: path7.dirname(filePath) }),
|
|
19114
19877
|
path: filePath
|
|
19115
19878
|
};
|
|
19116
19879
|
}
|
|
@@ -19118,9 +19881,9 @@ __name(readPackageUp, "readPackageUp");
|
|
|
19118
19881
|
|
|
19119
19882
|
// packages/cli/src/utils/package.ts
|
|
19120
19883
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
19121
|
-
import
|
|
19884
|
+
import path8 from "node:path";
|
|
19122
19885
|
var __filename = fileURLToPath3(import.meta.url);
|
|
19123
|
-
var __dirname =
|
|
19886
|
+
var __dirname = path8.dirname(__filename);
|
|
19124
19887
|
var packageJson;
|
|
19125
19888
|
async function getPackageJson() {
|
|
19126
19889
|
if (packageJson) {
|
|
@@ -19138,16 +19901,10 @@ __name(getPackageJson, "getPackageJson");
|
|
|
19138
19901
|
// packages/cli/src/utils/version.ts
|
|
19139
19902
|
async function getCliVersion() {
|
|
19140
19903
|
const pkgJson = await getPackageJson();
|
|
19141
|
-
return "0.18.0
|
|
19904
|
+
return "0.18.0";
|
|
19142
19905
|
}
|
|
19143
19906
|
__name(getCliVersion, "getCliVersion");
|
|
19144
19907
|
|
|
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
19908
|
// packages/cli/src/ui/utils/formatters.ts
|
|
19152
19909
|
init_esbuild_shims();
|
|
19153
19910
|
var formatMemoryUsage = /* @__PURE__ */ __name((bytes) => {
|
|
@@ -19231,25 +19988,86 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds, options) => {
|
|
|
19231
19988
|
return parts.join(" ");
|
|
19232
19989
|
}, "formatDuration");
|
|
19233
19990
|
|
|
19991
|
+
// packages/cli/src/config/loadedSettingsAdapter.ts
|
|
19992
|
+
init_esbuild_shims();
|
|
19993
|
+
function createLoadedSettingsAdapter(settings, scope) {
|
|
19994
|
+
const persistScope = scope ?? getPersistScopeForModelSelection(settings);
|
|
19995
|
+
const settingsFile = settings.forScope(persistScope);
|
|
19996
|
+
let settingsSnapshot = null;
|
|
19997
|
+
let originalSnapshot = null;
|
|
19998
|
+
return {
|
|
19999
|
+
getValue(key) {
|
|
20000
|
+
return getNestedProperty(settings.merged, key);
|
|
20001
|
+
},
|
|
20002
|
+
setValue(key, value) {
|
|
20003
|
+
for (const part of key.split(".")) {
|
|
20004
|
+
if (part === "__proto__" || part === "constructor" || part === "prototype") {
|
|
20005
|
+
throw new Error(
|
|
20006
|
+
`Refusing to write settings key with reserved segment: ${key}`
|
|
20007
|
+
);
|
|
20008
|
+
}
|
|
20009
|
+
}
|
|
20010
|
+
settings.setValue(persistScope, key, value);
|
|
20011
|
+
},
|
|
20012
|
+
getModelProviders() {
|
|
20013
|
+
return settings.merged.modelProviders ?? {};
|
|
20014
|
+
},
|
|
20015
|
+
persist() {
|
|
20016
|
+
},
|
|
20017
|
+
backup() {
|
|
20018
|
+
backupSettingsFile(settingsFile.path);
|
|
20019
|
+
settingsSnapshot = structuredClone(settingsFile.settings);
|
|
20020
|
+
originalSnapshot = structuredClone(settingsFile.originalSettings);
|
|
20021
|
+
},
|
|
20022
|
+
restore() {
|
|
20023
|
+
const restored = restoreSettingsFromBackup(settingsFile.path);
|
|
20024
|
+
if (!restored) {
|
|
20025
|
+
console.error(
|
|
20026
|
+
`[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.`
|
|
20027
|
+
);
|
|
20028
|
+
}
|
|
20029
|
+
if (settingsSnapshot !== null) {
|
|
20030
|
+
settingsFile.settings = settingsSnapshot;
|
|
20031
|
+
}
|
|
20032
|
+
if (originalSnapshot !== null) {
|
|
20033
|
+
settingsFile.originalSettings = originalSnapshot;
|
|
20034
|
+
}
|
|
20035
|
+
settings.recomputeMerged();
|
|
20036
|
+
},
|
|
20037
|
+
cleanupBackup() {
|
|
20038
|
+
cleanupSettingsBackup(settingsFile.path);
|
|
20039
|
+
settingsSnapshot = null;
|
|
20040
|
+
originalSnapshot = null;
|
|
20041
|
+
}
|
|
20042
|
+
};
|
|
20043
|
+
}
|
|
20044
|
+
__name(createLoadedSettingsAdapter, "createLoadedSettingsAdapter");
|
|
20045
|
+
|
|
20046
|
+
// packages/cli/src/utils/systemInfo.ts
|
|
20047
|
+
init_esbuild_shims();
|
|
20048
|
+
import process4 from "node:process";
|
|
20049
|
+
import os from "node:os";
|
|
20050
|
+
import { execFile } from "node:child_process";
|
|
20051
|
+
|
|
19234
20052
|
// packages/cli/src/generated/git-commit.ts
|
|
19235
20053
|
init_esbuild_shims();
|
|
19236
|
-
var GIT_COMMIT_INFO = "
|
|
20054
|
+
var GIT_COMMIT_INFO = "a7b8a3655";
|
|
19237
20055
|
|
|
19238
20056
|
// packages/cli/src/utils/systemInfo.ts
|
|
19239
20057
|
var debugLogger4 = createDebugLogger("STATUS");
|
|
19240
20058
|
var VERSION_PROBE_TIMEOUT_MS = 5e3;
|
|
19241
20059
|
function probeVersion(binary) {
|
|
19242
|
-
return new Promise((
|
|
20060
|
+
return new Promise((resolve3) => {
|
|
19243
20061
|
execFile(
|
|
19244
20062
|
binary,
|
|
19245
20063
|
["--version"],
|
|
19246
20064
|
{ timeout: VERSION_PROBE_TIMEOUT_MS, encoding: "utf-8" },
|
|
19247
20065
|
(err, stdout) => {
|
|
19248
20066
|
if (err) {
|
|
19249
|
-
|
|
20067
|
+
resolve3("unknown");
|
|
19250
20068
|
return;
|
|
19251
20069
|
}
|
|
19252
|
-
|
|
20070
|
+
resolve3(typeof stdout === "string" ? stdout.trim() : "unknown");
|
|
19253
20071
|
}
|
|
19254
20072
|
);
|
|
19255
20073
|
});
|
|
@@ -19387,6 +20205,9 @@ __name(formatLspStatusSnapshot, "formatLspStatusSnapshot");
|
|
|
19387
20205
|
|
|
19388
20206
|
export {
|
|
19389
20207
|
require_strip_json_comments,
|
|
20208
|
+
resolveColor,
|
|
20209
|
+
subtleBandColor,
|
|
20210
|
+
supportsTrueColor,
|
|
19390
20211
|
lightTheme,
|
|
19391
20212
|
darkTheme,
|
|
19392
20213
|
ansiTheme,
|
|
@@ -19396,13 +20217,16 @@ export {
|
|
|
19396
20217
|
DefaultLight,
|
|
19397
20218
|
DefaultDark,
|
|
19398
20219
|
loadTrustedFolders,
|
|
20220
|
+
isFolderTrustEnabled,
|
|
19399
20221
|
isWorkspaceTrusted,
|
|
19400
20222
|
getPersistScopeForModelSelection,
|
|
19401
20223
|
TOGGLE_TYPES,
|
|
19402
20224
|
OUTPUT_LANGUAGE_AUTO,
|
|
19403
20225
|
isAutoLanguage,
|
|
19404
20226
|
resolveOutputLanguage,
|
|
20227
|
+
getOutputLanguageFilePath,
|
|
19405
20228
|
updateOutputLanguageFile,
|
|
20229
|
+
writeOutputLanguageAndRegisterPath,
|
|
19406
20230
|
initializeLlmOutputLanguage,
|
|
19407
20231
|
getSettingDefinition,
|
|
19408
20232
|
requiresRestart,
|
|
@@ -19418,9 +20242,6 @@ export {
|
|
|
19418
20242
|
saveModifiedSettings,
|
|
19419
20243
|
getDisplayValue,
|
|
19420
20244
|
isDefaultValue,
|
|
19421
|
-
backupSettingsFile,
|
|
19422
|
-
restoreSettingsFromBackup,
|
|
19423
|
-
cleanupSettingsBackup,
|
|
19424
20245
|
SETTINGS_DIRECTORY_NAME,
|
|
19425
20246
|
getUserSettingsDir,
|
|
19426
20247
|
ENV_CORRUPTED_PATH,
|
|
@@ -19430,6 +20251,7 @@ export {
|
|
|
19430
20251
|
createMinimalSettings,
|
|
19431
20252
|
preResolveHomeEnvOverrides,
|
|
19432
20253
|
loadEnvironment,
|
|
20254
|
+
reloadEnvironment,
|
|
19433
20255
|
CORRUPTED_SUFFIX,
|
|
19434
20256
|
loadSettings,
|
|
19435
20257
|
require_debug,
|
|
@@ -19447,6 +20269,30 @@ export {
|
|
|
19447
20269
|
DEFAULT_RING_SIZE,
|
|
19448
20270
|
SubscriberLimitExceededError,
|
|
19449
20271
|
EventBus,
|
|
20272
|
+
canonicalizeWorkspace,
|
|
20273
|
+
MAX_WORKSPACE_PATH_LENGTH,
|
|
20274
|
+
NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
|
|
20275
|
+
isNotCurrentlyGeneratingCancelError,
|
|
20276
|
+
SessionNotFoundError,
|
|
20277
|
+
RestoreInProgressError,
|
|
20278
|
+
InvalidSessionScopeError,
|
|
20279
|
+
SessionLimitExceededError,
|
|
20280
|
+
WorkspaceMismatchError,
|
|
20281
|
+
InvalidClientIdError,
|
|
20282
|
+
InvalidPermissionOptionError,
|
|
20283
|
+
InvalidSessionMetadataError,
|
|
20284
|
+
PermissionPolicyNotImplementedError,
|
|
20285
|
+
CancelSentinelCollisionError,
|
|
20286
|
+
PermissionForbiddenError,
|
|
20287
|
+
WorkspaceInitConflictError,
|
|
20288
|
+
WorkspaceInitPathEscapeError,
|
|
20289
|
+
WorkspaceInitSymlinkError,
|
|
20290
|
+
WorkspaceInitRaceError,
|
|
20291
|
+
McpServerNotFoundError,
|
|
20292
|
+
McpServerRestartFailedError,
|
|
20293
|
+
SessionBusyError,
|
|
20294
|
+
InvalidRewindTargetError,
|
|
20295
|
+
BranchWhilePromptActiveError,
|
|
19450
20296
|
STATUS_SCHEMA_VERSION,
|
|
19451
20297
|
SERVE_ERROR_KINDS,
|
|
19452
20298
|
BridgeTimeoutError,
|
|
@@ -19454,6 +20300,9 @@ export {
|
|
|
19454
20300
|
MissingCliEntryError,
|
|
19455
20301
|
SERVE_STATUS_EXT_METHODS,
|
|
19456
20302
|
SERVE_CONTROL_EXT_METHODS,
|
|
20303
|
+
IDLE_HOOK_EVENTS,
|
|
20304
|
+
createIdleWorkspaceExtensionsStatus,
|
|
20305
|
+
createIdleWorkspaceHooksStatus,
|
|
19457
20306
|
createIdleWorkspaceMemoryStatus,
|
|
19458
20307
|
createIdleWorkspaceMcpStatus,
|
|
19459
20308
|
createIdleWorkspaceSkillsStatus,
|
|
@@ -19468,7 +20317,8 @@ export {
|
|
|
19468
20317
|
formatDuration,
|
|
19469
20318
|
getNpmVersion,
|
|
19470
20319
|
getGitVersion,
|
|
19471
|
-
getExtendedSystemInfo
|
|
20320
|
+
getExtendedSystemInfo,
|
|
20321
|
+
createLoadedSettingsAdapter
|
|
19472
20322
|
};
|
|
19473
20323
|
/**
|
|
19474
20324
|
* @license
|
|
@@ -19485,6 +20335,18 @@ export {
|
|
|
19485
20335
|
* Copyright 2025 Google LLC
|
|
19486
20336
|
* SPDX-License-Identifier: Apache-2.0
|
|
19487
20337
|
*/
|
|
20338
|
+
/**
|
|
20339
|
+
* @license
|
|
20340
|
+
* Copyright 2025 Qwen Team
|
|
20341
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
20342
|
+
*
|
|
20343
|
+
* Adapter that lets core's `applyProviderInstallPlan` write through
|
|
20344
|
+
* `LoadedSettings` while preserving CLI-specific guarantees:
|
|
20345
|
+
* - scope resolution via `getPersistScopeForModelSelection`
|
|
20346
|
+
* - on-disk `.orig` backup of the target settings file
|
|
20347
|
+
* - in-memory snapshot of `settings` / `originalSettings` for rollback
|
|
20348
|
+
* - merged-settings recomputation after restore
|
|
20349
|
+
*/
|
|
19488
20350
|
/**
|
|
19489
20351
|
* @license
|
|
19490
20352
|
* Copyright 2026 Google LLC
|