@qwen-code/qwen-code 0.18.0-preview.1 → 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/SKILL.md +1 -2
- package/bundled/qc-helper/docs/_meta.ts +1 -0
- package/bundled/qc-helper/docs/configuration/settings.md +20 -24
- package/bundled/qc-helper/docs/features/_meta.ts +0 -3
- package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
- package/bundled/qc-helper/docs/features/commands.md +47 -23
- package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
- package/bundled/qc-helper/docs/features/scheduled-tasks.md +1 -1
- package/bundled/qc-helper/docs/features/sub-agents.md +60 -0
- 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-SXS4NQWS.js → agent-LOTJK6AH.js} +25 -19
- package/chunks/agent-headless-TU3EPMYU.js +50 -0
- package/chunks/{anthropicContentGenerator-4QBVSFSJ.js → anthropicContentGenerator-2HBRNQ3B.js} +7 -7
- package/chunks/{askUserQuestion-NOOLRWCJ.js → askUserQuestion-OGCMIBQM.js} +45 -3
- package/chunks/{ca-WRHFBIDH.js → ca-BARBRL6N.js} +48 -1
- package/chunks/{chunk-JMLIPZUU.js → chunk-2Y5SYSD3.js} +361 -583
- package/chunks/chunk-3DHXZ6EV.js +241 -0
- package/chunks/{chunk-AVLOK27J.js → chunk-3HTIVKZE.js} +1 -1
- package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
- package/chunks/chunk-64WXLC72.js +98 -0
- package/chunks/{chunk-F6FLCHCS.js → chunk-6YIUGZTC.js} +1069 -211
- package/chunks/{chunk-C6WMLUNB.js → chunk-72LDN5PP.js} +1 -1
- package/chunks/{chunk-ERREX2ES.js → chunk-7BCMOPIM.js} +64 -24
- package/chunks/{chunk-6VFG3EUJ.js → chunk-A7B4ISQP.js} +1 -1
- package/chunks/{chunk-F5ORN4YO.js → chunk-B7HXHOHU.js} +1 -1
- package/chunks/{chunk-5RNZ2QKF.js → chunk-BIVG75CP.js} +1 -1
- package/chunks/{chunk-MVX64PNU.js → chunk-EYENRK4D.js} +1 -1
- package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
- package/chunks/{chunk-SCHRFI7O.js → chunk-HLPLOD42.js} +1 -1
- package/chunks/{chunk-R5PDRHEF.js → chunk-HR7SV7AY.js} +68 -47
- package/chunks/{chunk-JSYEZAYV.js → chunk-IDX6COTE.js} +2 -2
- package/chunks/{chunk-6KH2Q7XN.js → chunk-IWAYOW5Q.js} +17482 -11669
- package/chunks/chunk-J5MDQKJL.js +2230 -0
- package/chunks/{chunk-USE2VQ5P.js → chunk-JTQAQBTV.js} +21 -0
- package/chunks/{chunk-ZW7GBCRE.js → chunk-LBP46COL.js} +1014 -163
- package/chunks/chunk-LD2XBG6Z.js +102 -0
- package/chunks/{chunk-KOA52UTF.js → chunk-LEJ42GNY.js} +14 -14
- package/chunks/{chunk-D46KOV3C.js → chunk-M6VTDSVR.js} +1 -1
- package/chunks/{chunk-SHUT5MQY.js → chunk-MFBBBTNY.js} +1 -1
- package/chunks/{chunk-PLYZAP4W.js → chunk-OHEGWO4L.js} +101 -23
- package/chunks/{chunk-NQZ33PWX.js → chunk-PL3MVCWD.js} +11 -11
- package/chunks/chunk-QQDPRDVW.js +25 -0
- package/chunks/chunk-R7ODSGTK.js +159 -0
- package/chunks/{chunk-GBEPNWYB.js → chunk-SEGYWKIH.js} +1 -1
- package/chunks/chunk-SKBPNJEW.js +45 -0
- package/chunks/{chunk-UABFCMPA.js → chunk-SNGELLWX.js} +3 -1
- package/chunks/chunk-XBY7E2FX.js +605 -0
- package/chunks/{chunk-G763GDO6.js → chunk-XV4HCEVI.js} +36 -3
- package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
- package/chunks/{chunk-BBTV54KB.js → chunk-ZTZ4DDQE.js} +2 -2
- package/chunks/{computer-use-CT6MU6P3.js → computer-use-3RH2DOM6.js} +25 -19
- package/chunks/contextCommand-K347QT6O.js +52 -0
- package/chunks/{cron-create-PIPMXQN4.js → cron-create-YJL3KFWI.js} +3 -3
- package/chunks/{cron-delete-6Y5XIDMS.js → cron-delete-WKWSJZQA.js} +3 -3
- package/chunks/{cron-list-A4WNRUWZ.js → cron-list-B52XEXAZ.js} +3 -3
- package/chunks/{de-M5RPB2NB.js → de-YGKK2BC4.js} +48 -1
- 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-A4YK7AIB.js → edit-KU4PJGEX.js} +26 -20
- package/chunks/{en-UMYKQAZE.js → en-DHGYHIHX.js} +77 -2
- package/chunks/{enter-worktree-VNEQINLC.js → enter-worktree-PPYIDCWI.js} +25 -19
- package/chunks/enterPlanMode-5CZDMCB4.js +158 -0
- package/chunks/{exit-worktree-AVSMXC33.js → exit-worktree-UY3CGHKC.js} +25 -19
- package/chunks/exitPlanMode-3DN4QNSG.js +703 -0
- package/chunks/{fr-MPYXXXPW.js → fr-JXBKPJKQ.js} +48 -1
- package/chunks/{geminiContentGenerator-CR2WGARL.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-5V32KOG5.js → glob-OFNQSS52.js} +25 -19
- package/chunks/{grep-PUTEPBR4.js → grep-6J2MSUM5.js} +28 -19
- package/chunks/{ja-NFZ32AB3.js → ja-TGPZSP2B.js} +48 -1
- package/chunks/{keychain-token-storage-UHGOCDD6.js → keychain-token-storage-6IU6ORQN.js} +3 -3
- package/chunks/{ls-34DLNYCD.js → ls-V3O6A5PT.js} +4 -4
- package/chunks/{lsp-NCDEHH3V.js → lsp-G2OCIFUA.js} +3 -3
- package/chunks/{monitor-EJBR5VCR.js → monitor-FKLHV423.js} +25 -19
- package/chunks/{notebook-edit-DZHGPP2L.js → notebook-edit-KTBYFKWG.js} +26 -20
- package/chunks/{openaiContentGenerator-4QNV3CHM.js → openaiContentGenerator-L5KSWQY7.js} +15 -14
- package/chunks/{pt-BR43FRBA.js → pt-TIBG6BIO.js} +48 -1
- package/chunks/{qwenContentGenerator-3XOCEMQO.js → qwenContentGenerator-PYOXLMBW.js} +27 -21
- package/chunks/{qwenOAuth2-KRJT35QH.js → qwenOAuth2-2KCKWDCF.js} +6 -5
- package/chunks/{read-file-VZ2SQQIX.js → read-file-JQVRK4NU.js} +11 -11
- package/chunks/ripGrep-2L4LPNAJ.js +48 -0
- package/chunks/{ru-DQCW2KHD.js → ru-JBCHCK4L.js} +48 -1
- package/chunks/{scheduler-H32DZVDV.js → scheduler-FGNXY4JQ.js} +25 -19
- package/chunks/send-message-SZFWNOCL.js +244 -0
- package/chunks/{serve-56G4B5W6.js → serve-N2IBLA3G.js} +13592 -4979
- package/chunks/{shell-Q77KNP4N.js → shell-PTEG6UX4.js} +25 -19
- package/chunks/{skill-CLWFJYBG.js → skill-X4NTK4NH.js} +64 -113
- package/chunks/{src-47L2LUOU.js → src-GLLQ3R5W.js} +307 -32
- package/chunks/{syntheticOutput-T5SWX3YF.js → syntheticOutput-IKAY5F6X.js} +4 -4
- package/chunks/task-create-MQICOJFV.js +19 -0
- package/chunks/task-list-RIHJCH32.js +151 -0
- package/chunks/{task-stop-3VHAQMYM.js → task-stop-FWZRFANS.js} +3 -3
- package/chunks/task-update-2LHPXOYM.js +408 -0
- package/chunks/team-create-2E4PF4KN.js +314 -0
- package/chunks/team-delete-DAUDQS4J.js +116 -0
- package/chunks/{todoWrite-EAGJGKO5.js → todoWrite-HTUACZES.js} +5 -5
- package/chunks/{tool-search-Q75AYDTP.js → tool-search-KTVULRES.js} +11 -11
- package/chunks/{web-fetch-SS6IKK6N.js → web-fetch-CZ7LLKPE.js} +5 -5
- package/chunks/workflow-L2ZUUDT2.js +960 -0
- package/chunks/{write-file-RENGC25N.js → write-file-ZEB2JDYH.js} +26 -20
- package/chunks/{zh-6VFXOAR5.js → zh-7H5OQC4I.js} +82 -7
- package/chunks/{zh-TW-IQZ4AD5M.js → zh-TW-P4IDHD3M.js} +79 -7
- package/cli.js +11248 -5119
- package/examples/agent/qwen-extension.json +1 -0
- package/examples/commands/qwen-extension.json +1 -0
- package/examples/context/qwen-extension.json +1 -0
- package/examples/mcp-server/qwen-extension.json +1 -0
- package/examples/skills/qwen-extension.json +1 -0
- package/examples/starter/QWEN.md +30 -0
- package/examples/starter/README.md +59 -0
- package/examples/starter/agents/diary.md +86 -0
- package/examples/starter/commands/writing/polish.md +13 -0
- package/examples/starter/example.ts +64 -0
- package/examples/starter/package.json +18 -0
- package/examples/starter/qwen-extension.json +12 -0
- package/examples/starter/skills/synonyms/SKILL.md +48 -0
- package/examples/starter/tsconfig.json +13 -0
- package/fzfWorker.js +1083 -0
- package/locales/ca.js +51 -0
- package/locales/de.js +51 -0
- package/locales/en.js +89 -2
- package/locales/fr.js +53 -2
- package/locales/ja.js +52 -2
- package/locales/pt.js +52 -2
- package/locales/ru.js +53 -2
- package/locales/zh-TW.js +90 -11
- package/locales/zh.js +94 -11
- package/package.json +3 -2
- package/bundled/qc-helper/docs/features/checkpointing.md +0 -77
- package/chunks/contextCommand-YODJQYIV.js +0 -46
- package/chunks/exitPlanMode-5SQYVROD.js +0 -229
- package/chunks/ripGrep-SBIZCPOL.js +0 -42
- package/chunks/send-message-YYF56TS7.js +0 -151
|
@@ -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
|
}
|
|
@@ -14964,26 +15546,6 @@ var SETTINGS_SCHEMA = {
|
|
|
14964
15546
|
}
|
|
14965
15547
|
}
|
|
14966
15548
|
},
|
|
14967
|
-
checkpointing: {
|
|
14968
|
-
type: "object",
|
|
14969
|
-
label: "Checkpointing",
|
|
14970
|
-
category: "General",
|
|
14971
|
-
requiresRestart: true,
|
|
14972
|
-
default: {},
|
|
14973
|
-
description: "Session checkpointing settings.",
|
|
14974
|
-
showInDialog: false,
|
|
14975
|
-
properties: {
|
|
14976
|
-
enabled: {
|
|
14977
|
-
type: "boolean",
|
|
14978
|
-
label: "Enable Checkpointing",
|
|
14979
|
-
category: "General",
|
|
14980
|
-
requiresRestart: true,
|
|
14981
|
-
default: false,
|
|
14982
|
-
description: "Enable session checkpointing for recovery",
|
|
14983
|
-
showInDialog: false
|
|
14984
|
-
}
|
|
14985
|
-
}
|
|
14986
|
-
},
|
|
14987
15549
|
debugKeystrokeLogging: {
|
|
14988
15550
|
type: "boolean",
|
|
14989
15551
|
label: "Debug Keystroke Logging",
|
|
@@ -15548,7 +16110,7 @@ var SETTINGS_SCHEMA = {
|
|
|
15548
16110
|
type: "object",
|
|
15549
16111
|
properties: {
|
|
15550
16112
|
propagateTraceContext: {
|
|
15551
|
-
description: "Requires `telemetry.enabled: true`. Inject W3C `traceparent`
|
|
16113
|
+
description: "Requires `telemetry.enabled: true`. Inject W3C `traceparent` on outbound `fetch` requests (LLM SDK calls, MCP StreamableHTTP, WebFetch, ...) AND as a `TRACEPARENT` environment variable in shell child processes (Bash tool, hooks, monitor). When enabled, any existing `TRACEPARENT` in the parent environment is overwritten with qwen-code's own trace context. Default: false \u2014 trace context stays internal to the operator's OTLP collector. Set true when you want cross-process trace stitching with an OTel-aware LLM provider (e.g. ARMS+DashScope) or need shell scripts / CLI tools to participate in distributed tracing.",
|
|
15552
16114
|
type: "boolean",
|
|
15553
16115
|
default: false
|
|
15554
16116
|
}
|
|
@@ -15717,8 +16279,8 @@ var SETTINGS_SCHEMA = {
|
|
|
15717
16279
|
label: "Split Tool Result Media",
|
|
15718
16280
|
category: "Generation Configuration",
|
|
15719
16281
|
requiresRestart: false,
|
|
15720
|
-
default:
|
|
15721
|
-
description: 'When true, media (images / audio / video / files) returned by
|
|
16282
|
+
default: true,
|
|
16283
|
+
description: 'When true, media (images / audio / video / files) returned by tool calls \u2014 including the built-in read_file and MCP tools \u2014 is split into a follow-up user message instead of being embedded in the `role: "tool"` message. The OpenAI Chat Completions spec only permits text on tool messages, so strict OpenAI-compatible servers (e.g., doubao / new-api / LM Studio) silently drop or reject embedded media and the model never sees an image read via read_file (QwenLM/qwen-code#4876, #3616). Default true is spec-compliant and safe for permissive providers; set false only to restore the legacy embed-in-tool-message behavior.',
|
|
15722
16284
|
parentKey: "generationConfig",
|
|
15723
16285
|
showInDialog: false
|
|
15724
16286
|
},
|
|
@@ -16340,6 +16902,15 @@ var SETTINGS_SCHEMA = {
|
|
|
16340
16902
|
description: "The number of lines to keep when truncating tool output.",
|
|
16341
16903
|
showInDialog: false
|
|
16342
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
|
+
},
|
|
16343
16914
|
computerUse: {
|
|
16344
16915
|
type: "object",
|
|
16345
16916
|
label: "Computer Use",
|
|
@@ -16362,6 +16933,51 @@ var SETTINGS_SCHEMA = {
|
|
|
16362
16933
|
}
|
|
16363
16934
|
}
|
|
16364
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
|
+
},
|
|
16365
16981
|
mcp: {
|
|
16366
16982
|
type: "object",
|
|
16367
16983
|
label: "MCP",
|
|
@@ -16849,8 +17465,17 @@ var SETTINGS_SCHEMA = {
|
|
|
16849
17465
|
label: "Enable Cron/Loop Tools",
|
|
16850
17466
|
category: "Experimental",
|
|
16851
17467
|
requiresRestart: true,
|
|
17468
|
+
default: true,
|
|
17469
|
+
description: "Enable in-session cron/loop tools. When enabled, the model can create recurring prompts using cron_create, cron_list, and cron_delete tools. Can be disabled via QWEN_CODE_DISABLE_CRON=1 environment variable.",
|
|
17470
|
+
showInDialog: true
|
|
17471
|
+
},
|
|
17472
|
+
agentTeam: {
|
|
17473
|
+
type: "boolean",
|
|
17474
|
+
label: "Enable Agent Team",
|
|
17475
|
+
category: "Experimental",
|
|
17476
|
+
requiresRestart: true,
|
|
16852
17477
|
default: false,
|
|
16853
|
-
description: "Enable
|
|
17478
|
+
description: "Enable agent team collaboration tools (experimental). When enabled, the model can create agent teams and coordinate work using team_create, team_delete, send_message, task_create, task_update, and task_list tools. Can also be enabled via QWEN_CODE_ENABLE_AGENT_TEAM=1 environment variable.",
|
|
16854
17479
|
showInDialog: true
|
|
16855
17480
|
},
|
|
16856
17481
|
emitToolUseSummaries: {
|
|
@@ -16987,8 +17612,8 @@ function getDefaultValue(key) {
|
|
|
16987
17612
|
return getFlattenedSchema()[key]?.default;
|
|
16988
17613
|
}
|
|
16989
17614
|
__name(getDefaultValue, "getDefaultValue");
|
|
16990
|
-
function getNestedValue(obj,
|
|
16991
|
-
const [first, ...rest] =
|
|
17615
|
+
function getNestedValue(obj, path9) {
|
|
17616
|
+
const [first, ...rest] = path9;
|
|
16992
17617
|
if (!first || !(first in obj)) {
|
|
16993
17618
|
return void 0;
|
|
16994
17619
|
}
|
|
@@ -17002,8 +17627,8 @@ function getNestedValue(obj, path8) {
|
|
|
17002
17627
|
return void 0;
|
|
17003
17628
|
}
|
|
17004
17629
|
__name(getNestedValue, "getNestedValue");
|
|
17005
|
-
function getNestedProperty(obj,
|
|
17006
|
-
return getNestedValue(obj,
|
|
17630
|
+
function getNestedProperty(obj, path9) {
|
|
17631
|
+
return getNestedValue(obj, path9.split("."));
|
|
17007
17632
|
}
|
|
17008
17633
|
__name(getNestedProperty, "getNestedProperty");
|
|
17009
17634
|
function getEffectiveValue(key, settings, mergedSettings) {
|
|
@@ -17011,12 +17636,12 @@ function getEffectiveValue(key, settings, mergedSettings) {
|
|
|
17011
17636
|
if (!definition) {
|
|
17012
17637
|
return void 0;
|
|
17013
17638
|
}
|
|
17014
|
-
const
|
|
17015
|
-
let value = getNestedValue(settings,
|
|
17639
|
+
const path9 = key.split(".");
|
|
17640
|
+
let value = getNestedValue(settings, path9);
|
|
17016
17641
|
if (value !== void 0) {
|
|
17017
17642
|
return value;
|
|
17018
17643
|
}
|
|
17019
|
-
value = getNestedValue(mergedSettings,
|
|
17644
|
+
value = getNestedValue(mergedSettings, path9);
|
|
17020
17645
|
if (value !== void 0) {
|
|
17021
17646
|
return value;
|
|
17022
17647
|
}
|
|
@@ -17067,8 +17692,8 @@ function getDialogSettingKeys() {
|
|
|
17067
17692
|
}
|
|
17068
17693
|
__name(getDialogSettingKeys, "getDialogSettingKeys");
|
|
17069
17694
|
function settingExistsInScope(key, scopeSettings) {
|
|
17070
|
-
const
|
|
17071
|
-
const value = getNestedValue(scopeSettings,
|
|
17695
|
+
const path9 = key.split(".");
|
|
17696
|
+
const value = getNestedValue(scopeSettings, path9);
|
|
17072
17697
|
return value !== void 0;
|
|
17073
17698
|
}
|
|
17074
17699
|
__name(settingExistsInScope, "settingExistsInScope");
|
|
@@ -17081,8 +17706,8 @@ function pathHasUnsafeSegment(keys) {
|
|
|
17081
17706
|
return false;
|
|
17082
17707
|
}
|
|
17083
17708
|
__name(pathHasUnsafeSegment, "pathHasUnsafeSegment");
|
|
17084
|
-
function setNestedPropertyForce(obj,
|
|
17085
|
-
const keys =
|
|
17709
|
+
function setNestedPropertyForce(obj, path9, value) {
|
|
17710
|
+
const keys = path9.split(".");
|
|
17086
17711
|
if (pathHasUnsafeSegment(keys)) return;
|
|
17087
17712
|
const lastKey = keys.pop();
|
|
17088
17713
|
if (!lastKey) return;
|
|
@@ -17096,8 +17721,8 @@ function setNestedPropertyForce(obj, path8, value) {
|
|
|
17096
17721
|
current[lastKey] = value;
|
|
17097
17722
|
}
|
|
17098
17723
|
__name(setNestedPropertyForce, "setNestedPropertyForce");
|
|
17099
|
-
function setNestedPropertySafe(obj,
|
|
17100
|
-
const keys =
|
|
17724
|
+
function setNestedPropertySafe(obj, path9, value) {
|
|
17725
|
+
const keys = path9.split(".");
|
|
17101
17726
|
if (pathHasUnsafeSegment(keys)) return;
|
|
17102
17727
|
const lastKey = keys.pop();
|
|
17103
17728
|
if (!lastKey) return;
|
|
@@ -17116,8 +17741,8 @@ function setNestedPropertySafe(obj, path8, value) {
|
|
|
17116
17741
|
current[lastKey] = value;
|
|
17117
17742
|
}
|
|
17118
17743
|
__name(setNestedPropertySafe, "setNestedPropertySafe");
|
|
17119
|
-
function deleteNestedPropertySafe(obj,
|
|
17120
|
-
const keys =
|
|
17744
|
+
function deleteNestedPropertySafe(obj, path9) {
|
|
17745
|
+
const keys = path9.split(".");
|
|
17121
17746
|
const lastKey = keys.pop();
|
|
17122
17747
|
if (!lastKey) return;
|
|
17123
17748
|
let current = obj;
|
|
@@ -17149,10 +17774,10 @@ function getRestartRequiredFromModified(modifiedSettings) {
|
|
|
17149
17774
|
__name(getRestartRequiredFromModified, "getRestartRequiredFromModified");
|
|
17150
17775
|
function saveModifiedSettings(modifiedSettings, pendingSettings, loadedSettings, scope) {
|
|
17151
17776
|
modifiedSettings.forEach((settingKey) => {
|
|
17152
|
-
const
|
|
17777
|
+
const path9 = settingKey.split(".");
|
|
17153
17778
|
const value = getNestedValue(
|
|
17154
17779
|
pendingSettings,
|
|
17155
|
-
|
|
17780
|
+
path9
|
|
17156
17781
|
);
|
|
17157
17782
|
const existsInOriginalFile = settingExistsInScope(
|
|
17158
17783
|
settingKey,
|
|
@@ -17254,12 +17879,12 @@ function isPlainObject(item) {
|
|
|
17254
17879
|
return !!item && typeof item === "object" && !Array.isArray(item);
|
|
17255
17880
|
}
|
|
17256
17881
|
__name(isPlainObject, "isPlainObject");
|
|
17257
|
-
function mergeRecursively(target, source, getMergeStrategyForPath2,
|
|
17882
|
+
function mergeRecursively(target, source, getMergeStrategyForPath2, path9 = []) {
|
|
17258
17883
|
for (const key of Object.keys(source)) {
|
|
17259
17884
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
17260
17885
|
continue;
|
|
17261
17886
|
}
|
|
17262
|
-
const newPath = [...
|
|
17887
|
+
const newPath = [...path9, key];
|
|
17263
17888
|
const srcValue = source[key];
|
|
17264
17889
|
const objValue = target[key];
|
|
17265
17890
|
const mergeStrategy = getMergeStrategyForPath2(newPath);
|
|
@@ -18104,10 +18729,10 @@ __name(needsMigration, "needsMigration");
|
|
|
18104
18729
|
|
|
18105
18730
|
// packages/cli/src/config/settings.ts
|
|
18106
18731
|
var debugLogger3 = createDebugLogger("SETTINGS");
|
|
18107
|
-
function getMergeStrategyForPath(
|
|
18732
|
+
function getMergeStrategyForPath(path9) {
|
|
18108
18733
|
let current = void 0;
|
|
18109
18734
|
let currentSchema = getSettingsSchema();
|
|
18110
|
-
for (const key of
|
|
18735
|
+
for (const key of path9) {
|
|
18111
18736
|
if (!currentSchema || !currentSchema[key]) {
|
|
18112
18737
|
return void 0;
|
|
18113
18738
|
}
|
|
@@ -18123,7 +18748,7 @@ function getUserSettingsPath() {
|
|
|
18123
18748
|
}
|
|
18124
18749
|
__name(getUserSettingsPath, "getUserSettingsPath");
|
|
18125
18750
|
function getUserSettingsDir() {
|
|
18126
|
-
return
|
|
18751
|
+
return path4.dirname(getUserSettingsPath());
|
|
18127
18752
|
}
|
|
18128
18753
|
__name(getUserSettingsDir, "getUserSettingsDir");
|
|
18129
18754
|
var DEFAULT_EXCLUDED_ENV_VARS = ["DEBUG", "DEBUG_MODE"];
|
|
@@ -18135,6 +18760,30 @@ var PROJECT_ENV_HARDCODED_EXCLUSIONS = [
|
|
|
18135
18760
|
ENV_CORRUPTED_PATH,
|
|
18136
18761
|
ENV_WAS_RECOVERED
|
|
18137
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;
|
|
18138
18787
|
var SETTINGS_VERSION = 4;
|
|
18139
18788
|
var SETTINGS_VERSION_KEY = "$version";
|
|
18140
18789
|
function getSystemSettingsPath() {
|
|
@@ -18154,8 +18803,8 @@ function getSystemDefaultsPath() {
|
|
|
18154
18803
|
if (process2.env["QWEN_CODE_SYSTEM_DEFAULTS_PATH"]) {
|
|
18155
18804
|
return process2.env["QWEN_CODE_SYSTEM_DEFAULTS_PATH"];
|
|
18156
18805
|
}
|
|
18157
|
-
return
|
|
18158
|
-
|
|
18806
|
+
return path4.join(
|
|
18807
|
+
path4.dirname(getSystemSettingsPath()),
|
|
18159
18808
|
"system-defaults.json"
|
|
18160
18809
|
);
|
|
18161
18810
|
}
|
|
@@ -18415,10 +19064,10 @@ function getUserLevelEnvPaths() {
|
|
|
18415
19064
|
const homeDir = homedir();
|
|
18416
19065
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18417
19066
|
const paths = /* @__PURE__ */ new Set([
|
|
18418
|
-
|
|
18419
|
-
|
|
19067
|
+
path4.normalize(path4.join(homeDir, ".env")),
|
|
19068
|
+
path4.normalize(path4.join(globalQwenDir, ".env"))
|
|
18420
19069
|
]);
|
|
18421
|
-
const legacyQwenEnv =
|
|
19070
|
+
const legacyQwenEnv = path4.normalize(path4.join(homeDir, QWEN_DIR, ".env"));
|
|
18422
19071
|
paths.add(legacyQwenEnv);
|
|
18423
19072
|
return paths;
|
|
18424
19073
|
}
|
|
@@ -18434,9 +19083,9 @@ function preResolveHomeEnvOverrides() {
|
|
|
18434
19083
|
}
|
|
18435
19084
|
const initialQwenHome = process2.env["QWEN_HOME"];
|
|
18436
19085
|
const initialQwenDir = Storage.getGlobalQwenDir();
|
|
18437
|
-
const candidates = [
|
|
19086
|
+
const candidates = [path4.join(initialQwenDir, ".env")];
|
|
18438
19087
|
if (!initialQwenHome) {
|
|
18439
|
-
candidates.push(
|
|
19088
|
+
candidates.push(path4.join(path4.dirname(initialQwenDir), ".env"));
|
|
18440
19089
|
}
|
|
18441
19090
|
for (const candidate of candidates) {
|
|
18442
19091
|
readHomeEnvInto(candidate);
|
|
@@ -18445,7 +19094,7 @@ function preResolveHomeEnvOverrides() {
|
|
|
18445
19094
|
if (discoveredQwenHome && discoveredQwenHome !== initialQwenHome) {
|
|
18446
19095
|
const discoveredDir = Storage.getGlobalQwenDir();
|
|
18447
19096
|
if (discoveredDir !== initialQwenDir) {
|
|
18448
|
-
readHomeEnvInto(
|
|
19097
|
+
readHomeEnvInto(path4.join(discoveredDir, ".env"));
|
|
18449
19098
|
}
|
|
18450
19099
|
}
|
|
18451
19100
|
}
|
|
@@ -18467,9 +19116,9 @@ function readHomeEnvInto(file) {
|
|
|
18467
19116
|
__name(readHomeEnvInto, "readHomeEnvInto");
|
|
18468
19117
|
function getHomeEnvFallbackVars() {
|
|
18469
19118
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18470
|
-
const candidates = [
|
|
19119
|
+
const candidates = [path4.join(globalQwenDir, ".env")];
|
|
18471
19120
|
if (!process2.env["QWEN_HOME"]) {
|
|
18472
|
-
candidates.push(
|
|
19121
|
+
candidates.push(path4.join(path4.dirname(globalQwenDir), ".env"));
|
|
18473
19122
|
}
|
|
18474
19123
|
const result = {};
|
|
18475
19124
|
for (const candidate of candidates) {
|
|
@@ -18505,13 +19154,13 @@ function detectQwenHomeRedirectWithoutMigration(activeUserSettingsPath) {
|
|
|
18505
19154
|
} finally {
|
|
18506
19155
|
process2.env["QWEN_HOME"] = savedQwenHome;
|
|
18507
19156
|
}
|
|
18508
|
-
if (
|
|
19157
|
+
if (path4.resolve(activeQwenDir) === path4.resolve(legacyQwenDir)) {
|
|
18509
19158
|
return null;
|
|
18510
19159
|
}
|
|
18511
19160
|
if (fs6.existsSync(activeUserSettingsPath)) {
|
|
18512
19161
|
return null;
|
|
18513
19162
|
}
|
|
18514
|
-
const legacyUserSettings =
|
|
19163
|
+
const legacyUserSettings = path4.join(legacyQwenDir, "settings.json");
|
|
18515
19164
|
if (!fs6.existsSync(legacyUserSettings)) {
|
|
18516
19165
|
return null;
|
|
18517
19166
|
}
|
|
@@ -18522,15 +19171,15 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18522
19171
|
const homeDir = homedir();
|
|
18523
19172
|
const isTrusted = isWorkspaceTrusted(settings).isTrusted;
|
|
18524
19173
|
const globalQwenDir = Storage.getGlobalQwenDir();
|
|
18525
|
-
const legacyQwenDir =
|
|
18526
|
-
const hasCustomConfigDir =
|
|
18527
|
-
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");
|
|
18528
19177
|
const findHomeCandidate = /* @__PURE__ */ __name(() => {
|
|
18529
|
-
const candidates = [
|
|
19178
|
+
const candidates = [path4.join(globalQwenDir, ".env")];
|
|
18530
19179
|
if (hasCustomConfigDir) {
|
|
18531
|
-
candidates.push(
|
|
19180
|
+
candidates.push(path4.join(legacyQwenDir, ".env"));
|
|
18532
19181
|
}
|
|
18533
|
-
candidates.push(
|
|
19182
|
+
candidates.push(path4.join(homeDir, ".env"));
|
|
18534
19183
|
for (const candidate of candidates) {
|
|
18535
19184
|
if (fs6.existsSync(candidate) && canUseEnvFile(candidate)) {
|
|
18536
19185
|
return candidate;
|
|
@@ -18538,7 +19187,7 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18538
19187
|
}
|
|
18539
19188
|
return null;
|
|
18540
19189
|
}, "findHomeCandidate");
|
|
18541
|
-
let currentDir =
|
|
19190
|
+
let currentDir = path4.resolve(startDir);
|
|
18542
19191
|
let visitedHomeDir = false;
|
|
18543
19192
|
while (true) {
|
|
18544
19193
|
if (currentDir === homeDir) {
|
|
@@ -18546,16 +19195,16 @@ function findEnvFile(settings, startDir, userLevelPaths = getUserLevelEnvPaths()
|
|
|
18546
19195
|
const found = findHomeCandidate();
|
|
18547
19196
|
if (found) return found;
|
|
18548
19197
|
} else {
|
|
18549
|
-
const geminiEnvPath =
|
|
19198
|
+
const geminiEnvPath = path4.join(currentDir, QWEN_DIR, ".env");
|
|
18550
19199
|
if (fs6.existsSync(geminiEnvPath) && canUseEnvFile(geminiEnvPath)) {
|
|
18551
19200
|
return geminiEnvPath;
|
|
18552
19201
|
}
|
|
18553
|
-
const envPath =
|
|
19202
|
+
const envPath = path4.join(currentDir, ".env");
|
|
18554
19203
|
if (fs6.existsSync(envPath) && canUseEnvFile(envPath)) {
|
|
18555
19204
|
return envPath;
|
|
18556
19205
|
}
|
|
18557
19206
|
}
|
|
18558
|
-
const parentDir =
|
|
19207
|
+
const parentDir = path4.dirname(currentDir);
|
|
18559
19208
|
if (parentDir === currentDir || !parentDir) {
|
|
18560
19209
|
return visitedHomeDir ? null : findHomeCandidate();
|
|
18561
19210
|
}
|
|
@@ -18588,9 +19237,9 @@ function loadEnvironment(settings) {
|
|
|
18588
19237
|
const envFileContent = fs6.readFileSync(envFilePath, "utf-8");
|
|
18589
19238
|
const parsedEnv = dotenv.parse(envFileContent);
|
|
18590
19239
|
const excludedVars = settings?.advanced?.excludedEnvVars || DEFAULT_EXCLUDED_ENV_VARS;
|
|
18591
|
-
const normalizedEnvFilePath =
|
|
19240
|
+
const normalizedEnvFilePath = path4.normalize(envFilePath);
|
|
18592
19241
|
const isHomeScopedEnvFile = userLevelPaths.has(normalizedEnvFilePath);
|
|
18593
|
-
const isQwenScopedEnvFile = isHomeScopedEnvFile ||
|
|
19242
|
+
const isQwenScopedEnvFile = isHomeScopedEnvFile || path4.basename(path4.dirname(normalizedEnvFilePath)) === QWEN_DIR;
|
|
18594
19243
|
for (const key in parsedEnv) {
|
|
18595
19244
|
if (Object.hasOwn(parsedEnv, key)) {
|
|
18596
19245
|
if (!isHomeScopedEnvFile && PROJECT_ENV_HARDCODED_EXCLUSIONS.includes(key)) {
|
|
@@ -18601,6 +19250,10 @@ function loadEnvironment(settings) {
|
|
|
18601
19250
|
}
|
|
18602
19251
|
if (!Object.hasOwn(process2.env, key)) {
|
|
18603
19252
|
process2.env[key] = parsedEnv[key];
|
|
19253
|
+
dotEnvSourcedKeys.add(key);
|
|
19254
|
+
}
|
|
19255
|
+
if (!lastReloadSnapshotSeeded) {
|
|
19256
|
+
lastReloadSnapshot.set(key, parsedEnv[key]);
|
|
18604
19257
|
}
|
|
18605
19258
|
}
|
|
18606
19259
|
}
|
|
@@ -18614,13 +19267,110 @@ function loadEnvironment(settings) {
|
|
|
18614
19267
|
}
|
|
18615
19268
|
if (!Object.hasOwn(process2.env, key) && typeof value === "string") {
|
|
18616
19269
|
process2.env[key] = value;
|
|
19270
|
+
settingsEnvSourcedKeys.add(key);
|
|
19271
|
+
}
|
|
19272
|
+
if (!lastReloadSnapshotSeeded && typeof value === "string" && !lastReloadSnapshot.has(key)) {
|
|
19273
|
+
lastReloadSnapshot.set(key, value);
|
|
18617
19274
|
}
|
|
18618
19275
|
}
|
|
18619
19276
|
}
|
|
19277
|
+
lastReloadSnapshotSeeded = true;
|
|
18620
19278
|
}
|
|
18621
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");
|
|
18622
19371
|
var CORRUPTED_SUFFIX = ".corrupted";
|
|
18623
19372
|
function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars = true) {
|
|
19373
|
+
const opts = typeof consumeCorruptionEnvVars === "object" ? consumeCorruptionEnvVars : { consumeCorruptionEnvVars };
|
|
18624
19374
|
preResolveHomeEnvOverrides();
|
|
18625
19375
|
const userSettingsPath = getUserSettingsPath();
|
|
18626
19376
|
const qwenHomeRedirectWarning = detectQwenHomeRedirectWithoutMigration(userSettingsPath);
|
|
@@ -18632,8 +19382,8 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18632
19382
|
const systemSettingsPath = getSystemSettingsPath();
|
|
18633
19383
|
const systemDefaultsPath = getSystemDefaultsPath();
|
|
18634
19384
|
const migratedInMemorScopes = /* @__PURE__ */ new Set();
|
|
18635
|
-
const resolvedWorkspaceDir =
|
|
18636
|
-
const resolvedHomeDir =
|
|
19385
|
+
const resolvedWorkspaceDir = path4.resolve(workspaceDir);
|
|
19386
|
+
const resolvedHomeDir = path4.resolve(homedir());
|
|
18637
19387
|
let realWorkspaceDir = resolvedWorkspaceDir;
|
|
18638
19388
|
try {
|
|
18639
19389
|
realWorkspaceDir = fs6.realpathSync(resolvedWorkspaceDir);
|
|
@@ -18703,7 +19453,7 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18703
19453
|
}
|
|
18704
19454
|
}
|
|
18705
19455
|
const envCorruptedPath = process2.env[ENV_CORRUPTED_PATH];
|
|
18706
|
-
if (consumeCorruptionEnvVars && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
|
|
19456
|
+
if ((opts.consumeCorruptionEnvVars ?? true) && envCorruptedPath && envCorruptedPath === corruptedPath && scope === "User" /* User */) {
|
|
18707
19457
|
corruptedSaved = true;
|
|
18708
19458
|
recoveredFromEnvVar = process2.env[ENV_WAS_RECOVERED] === "1";
|
|
18709
19459
|
delete process2.env[ENV_CORRUPTED_PATH];
|
|
@@ -18834,7 +19584,9 @@ function loadSettings(workspaceDir = process2.cwd(), consumeCorruptionEnvVars =
|
|
|
18834
19584
|
workspaceSettings,
|
|
18835
19585
|
isTrusted
|
|
18836
19586
|
);
|
|
18837
|
-
|
|
19587
|
+
if (!opts.skipLoadEnvironment) {
|
|
19588
|
+
loadEnvironment(tempMergedSettings);
|
|
19589
|
+
}
|
|
18838
19590
|
if (settingsErrors.length > 0) {
|
|
18839
19591
|
const errorMessages = settingsErrors.map(
|
|
18840
19592
|
(error) => `Error in ${error.path}: ${error.message}`
|
|
@@ -18892,7 +19644,7 @@ function createSettingsUpdate(key, value) {
|
|
|
18892
19644
|
__name(createSettingsUpdate, "createSettingsUpdate");
|
|
18893
19645
|
function saveSettings(settingsFile, updates = settingsFile.originalSettings, replacePath = []) {
|
|
18894
19646
|
try {
|
|
18895
|
-
const dirPath =
|
|
19647
|
+
const dirPath = path4.dirname(settingsFile.path);
|
|
18896
19648
|
if (!fs6.existsSync(dirPath)) {
|
|
18897
19649
|
fs6.mkdirSync(dirPath, { recursive: true });
|
|
18898
19650
|
}
|
|
@@ -18923,26 +19675,26 @@ init_esbuild_shims();
|
|
|
18923
19675
|
|
|
18924
19676
|
// node_modules/read-package-up/index.js
|
|
18925
19677
|
init_esbuild_shims();
|
|
18926
|
-
import
|
|
19678
|
+
import path7 from "node:path";
|
|
18927
19679
|
|
|
18928
19680
|
// node_modules/find-up-simple/index.js
|
|
18929
19681
|
init_esbuild_shims();
|
|
18930
19682
|
import process3 from "node:process";
|
|
18931
19683
|
import fsPromises from "node:fs/promises";
|
|
18932
19684
|
import { fileURLToPath } from "node:url";
|
|
18933
|
-
import
|
|
19685
|
+
import path5 from "node:path";
|
|
18934
19686
|
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
18935
19687
|
async function findUp(name, {
|
|
18936
19688
|
cwd = process3.cwd(),
|
|
18937
19689
|
type = "file",
|
|
18938
19690
|
stopAt
|
|
18939
19691
|
} = {}) {
|
|
18940
|
-
let directory =
|
|
18941
|
-
const { root } =
|
|
18942
|
-
stopAt =
|
|
18943
|
-
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);
|
|
18944
19696
|
while (directory) {
|
|
18945
|
-
const filePath = isAbsoluteName ? name :
|
|
19697
|
+
const filePath = isAbsoluteName ? name : path5.join(directory, name);
|
|
18946
19698
|
try {
|
|
18947
19699
|
const stats = await fsPromises.stat(filePath);
|
|
18948
19700
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
|
|
@@ -18953,7 +19705,7 @@ async function findUp(name, {
|
|
|
18953
19705
|
if (directory === stopAt || directory === root) {
|
|
18954
19706
|
break;
|
|
18955
19707
|
}
|
|
18956
|
-
directory =
|
|
19708
|
+
directory = path5.dirname(directory);
|
|
18957
19709
|
}
|
|
18958
19710
|
}
|
|
18959
19711
|
__name(findUp, "findUp");
|
|
@@ -18961,7 +19713,7 @@ __name(findUp, "findUp");
|
|
|
18961
19713
|
// node_modules/read-pkg/index.js
|
|
18962
19714
|
init_esbuild_shims();
|
|
18963
19715
|
import fsPromises2 from "node:fs/promises";
|
|
18964
|
-
import
|
|
19716
|
+
import path6 from "node:path";
|
|
18965
19717
|
|
|
18966
19718
|
// node_modules/parse-json/index.js
|
|
18967
19719
|
init_esbuild_shims();
|
|
@@ -19100,7 +19852,7 @@ function toPath2(urlOrPath) {
|
|
|
19100
19852
|
__name(toPath2, "toPath");
|
|
19101
19853
|
|
|
19102
19854
|
// node_modules/read-pkg/index.js
|
|
19103
|
-
var getPackagePath = /* @__PURE__ */ __name((cwd) =>
|
|
19855
|
+
var getPackagePath = /* @__PURE__ */ __name((cwd) => path6.resolve(toPath2(cwd) ?? ".", "package.json"), "getPackagePath");
|
|
19104
19856
|
var _readPackage = /* @__PURE__ */ __name((file, normalize3) => {
|
|
19105
19857
|
const json = typeof file === "string" ? parseJson(file) : file;
|
|
19106
19858
|
if (normalize3) {
|
|
@@ -19121,7 +19873,7 @@ async function readPackageUp(options) {
|
|
|
19121
19873
|
return;
|
|
19122
19874
|
}
|
|
19123
19875
|
return {
|
|
19124
|
-
packageJson: await readPackage({ ...options, cwd:
|
|
19876
|
+
packageJson: await readPackage({ ...options, cwd: path7.dirname(filePath) }),
|
|
19125
19877
|
path: filePath
|
|
19126
19878
|
};
|
|
19127
19879
|
}
|
|
@@ -19129,9 +19881,9 @@ __name(readPackageUp, "readPackageUp");
|
|
|
19129
19881
|
|
|
19130
19882
|
// packages/cli/src/utils/package.ts
|
|
19131
19883
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
19132
|
-
import
|
|
19884
|
+
import path8 from "node:path";
|
|
19133
19885
|
var __filename = fileURLToPath3(import.meta.url);
|
|
19134
|
-
var __dirname =
|
|
19886
|
+
var __dirname = path8.dirname(__filename);
|
|
19135
19887
|
var packageJson;
|
|
19136
19888
|
async function getPackageJson() {
|
|
19137
19889
|
if (packageJson) {
|
|
@@ -19149,16 +19901,10 @@ __name(getPackageJson, "getPackageJson");
|
|
|
19149
19901
|
// packages/cli/src/utils/version.ts
|
|
19150
19902
|
async function getCliVersion() {
|
|
19151
19903
|
const pkgJson = await getPackageJson();
|
|
19152
|
-
return "0.18.0
|
|
19904
|
+
return "0.18.0";
|
|
19153
19905
|
}
|
|
19154
19906
|
__name(getCliVersion, "getCliVersion");
|
|
19155
19907
|
|
|
19156
|
-
// packages/cli/src/utils/systemInfo.ts
|
|
19157
|
-
init_esbuild_shims();
|
|
19158
|
-
import process4 from "node:process";
|
|
19159
|
-
import os from "node:os";
|
|
19160
|
-
import { execFile } from "node:child_process";
|
|
19161
|
-
|
|
19162
19908
|
// packages/cli/src/ui/utils/formatters.ts
|
|
19163
19909
|
init_esbuild_shims();
|
|
19164
19910
|
var formatMemoryUsage = /* @__PURE__ */ __name((bytes) => {
|
|
@@ -19242,25 +19988,86 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds, options) => {
|
|
|
19242
19988
|
return parts.join(" ");
|
|
19243
19989
|
}, "formatDuration");
|
|
19244
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
|
+
|
|
19245
20052
|
// packages/cli/src/generated/git-commit.ts
|
|
19246
20053
|
init_esbuild_shims();
|
|
19247
|
-
var GIT_COMMIT_INFO = "
|
|
20054
|
+
var GIT_COMMIT_INFO = "a7b8a3655";
|
|
19248
20055
|
|
|
19249
20056
|
// packages/cli/src/utils/systemInfo.ts
|
|
19250
20057
|
var debugLogger4 = createDebugLogger("STATUS");
|
|
19251
20058
|
var VERSION_PROBE_TIMEOUT_MS = 5e3;
|
|
19252
20059
|
function probeVersion(binary) {
|
|
19253
|
-
return new Promise((
|
|
20060
|
+
return new Promise((resolve3) => {
|
|
19254
20061
|
execFile(
|
|
19255
20062
|
binary,
|
|
19256
20063
|
["--version"],
|
|
19257
20064
|
{ timeout: VERSION_PROBE_TIMEOUT_MS, encoding: "utf-8" },
|
|
19258
20065
|
(err, stdout) => {
|
|
19259
20066
|
if (err) {
|
|
19260
|
-
|
|
20067
|
+
resolve3("unknown");
|
|
19261
20068
|
return;
|
|
19262
20069
|
}
|
|
19263
|
-
|
|
20070
|
+
resolve3(typeof stdout === "string" ? stdout.trim() : "unknown");
|
|
19264
20071
|
}
|
|
19265
20072
|
);
|
|
19266
20073
|
});
|
|
@@ -19398,6 +20205,9 @@ __name(formatLspStatusSnapshot, "formatLspStatusSnapshot");
|
|
|
19398
20205
|
|
|
19399
20206
|
export {
|
|
19400
20207
|
require_strip_json_comments,
|
|
20208
|
+
resolveColor,
|
|
20209
|
+
subtleBandColor,
|
|
20210
|
+
supportsTrueColor,
|
|
19401
20211
|
lightTheme,
|
|
19402
20212
|
darkTheme,
|
|
19403
20213
|
ansiTheme,
|
|
@@ -19407,13 +20217,16 @@ export {
|
|
|
19407
20217
|
DefaultLight,
|
|
19408
20218
|
DefaultDark,
|
|
19409
20219
|
loadTrustedFolders,
|
|
20220
|
+
isFolderTrustEnabled,
|
|
19410
20221
|
isWorkspaceTrusted,
|
|
19411
20222
|
getPersistScopeForModelSelection,
|
|
19412
20223
|
TOGGLE_TYPES,
|
|
19413
20224
|
OUTPUT_LANGUAGE_AUTO,
|
|
19414
20225
|
isAutoLanguage,
|
|
19415
20226
|
resolveOutputLanguage,
|
|
20227
|
+
getOutputLanguageFilePath,
|
|
19416
20228
|
updateOutputLanguageFile,
|
|
20229
|
+
writeOutputLanguageAndRegisterPath,
|
|
19417
20230
|
initializeLlmOutputLanguage,
|
|
19418
20231
|
getSettingDefinition,
|
|
19419
20232
|
requiresRestart,
|
|
@@ -19429,9 +20242,6 @@ export {
|
|
|
19429
20242
|
saveModifiedSettings,
|
|
19430
20243
|
getDisplayValue,
|
|
19431
20244
|
isDefaultValue,
|
|
19432
|
-
backupSettingsFile,
|
|
19433
|
-
restoreSettingsFromBackup,
|
|
19434
|
-
cleanupSettingsBackup,
|
|
19435
20245
|
SETTINGS_DIRECTORY_NAME,
|
|
19436
20246
|
getUserSettingsDir,
|
|
19437
20247
|
ENV_CORRUPTED_PATH,
|
|
@@ -19441,6 +20251,7 @@ export {
|
|
|
19441
20251
|
createMinimalSettings,
|
|
19442
20252
|
preResolveHomeEnvOverrides,
|
|
19443
20253
|
loadEnvironment,
|
|
20254
|
+
reloadEnvironment,
|
|
19444
20255
|
CORRUPTED_SUFFIX,
|
|
19445
20256
|
loadSettings,
|
|
19446
20257
|
require_debug,
|
|
@@ -19458,6 +20269,30 @@ export {
|
|
|
19458
20269
|
DEFAULT_RING_SIZE,
|
|
19459
20270
|
SubscriberLimitExceededError,
|
|
19460
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,
|
|
19461
20296
|
STATUS_SCHEMA_VERSION,
|
|
19462
20297
|
SERVE_ERROR_KINDS,
|
|
19463
20298
|
BridgeTimeoutError,
|
|
@@ -19465,6 +20300,9 @@ export {
|
|
|
19465
20300
|
MissingCliEntryError,
|
|
19466
20301
|
SERVE_STATUS_EXT_METHODS,
|
|
19467
20302
|
SERVE_CONTROL_EXT_METHODS,
|
|
20303
|
+
IDLE_HOOK_EVENTS,
|
|
20304
|
+
createIdleWorkspaceExtensionsStatus,
|
|
20305
|
+
createIdleWorkspaceHooksStatus,
|
|
19468
20306
|
createIdleWorkspaceMemoryStatus,
|
|
19469
20307
|
createIdleWorkspaceMcpStatus,
|
|
19470
20308
|
createIdleWorkspaceSkillsStatus,
|
|
@@ -19479,7 +20317,8 @@ export {
|
|
|
19479
20317
|
formatDuration,
|
|
19480
20318
|
getNpmVersion,
|
|
19481
20319
|
getGitVersion,
|
|
19482
|
-
getExtendedSystemInfo
|
|
20320
|
+
getExtendedSystemInfo,
|
|
20321
|
+
createLoadedSettingsAdapter
|
|
19483
20322
|
};
|
|
19484
20323
|
/**
|
|
19485
20324
|
* @license
|
|
@@ -19496,6 +20335,18 @@ export {
|
|
|
19496
20335
|
* Copyright 2025 Google LLC
|
|
19497
20336
|
* SPDX-License-Identifier: Apache-2.0
|
|
19498
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
|
+
*/
|
|
19499
20350
|
/**
|
|
19500
20351
|
* @license
|
|
19501
20352
|
* Copyright 2026 Google LLC
|