@qwen-code/qwen-code 0.18.0-preview.2 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/bundled/qc-helper/docs/_meta.ts +1 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +3 -5
  3. package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
  4. package/bundled/qc-helper/docs/features/commands.md +33 -11
  5. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  6. package/bundled/qc-helper/docs/features/sub-agents.md +32 -11
  7. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  8. package/bundled/qc-helper/docs/qwen-serve.md +234 -24
  9. package/chunks/{agent-QB7TZ4HW.js → agent-LOTJK6AH.js} +23 -23
  10. package/chunks/{agent-headless-APVHH7QM.js → agent-headless-TU3EPMYU.js} +23 -23
  11. package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-2HBRNQ3B.js} +7 -7
  12. package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-OGCMIBQM.js} +45 -3
  13. package/chunks/{chunk-MVIVIPCU.js → chunk-2Y5SYSD3.js} +361 -583
  14. package/chunks/chunk-3DHXZ6EV.js +241 -0
  15. package/chunks/{chunk-JVQOQ3OU.js → chunk-3HTIVKZE.js} +1 -1
  16. package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
  17. package/chunks/{chunk-ZK4AMNIU.js → chunk-6YIUGZTC.js} +1041 -210
  18. package/chunks/{chunk-C6WMLUNB.js → chunk-72LDN5PP.js} +1 -1
  19. package/chunks/{chunk-AVW55ZCO.js → chunk-7BCMOPIM.js} +11 -9
  20. package/chunks/{chunk-JUGRPQAB.js → chunk-A7B4ISQP.js} +1 -1
  21. package/chunks/{chunk-UAMOBVVW.js → chunk-B7HXHOHU.js} +1 -1
  22. package/chunks/{chunk-CNSMKPK6.js → chunk-BIVG75CP.js} +1 -1
  23. package/chunks/{chunk-LR62TEET.js → chunk-EYENRK4D.js} +1 -1
  24. package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
  25. package/chunks/{chunk-PAEBHDIO.js → chunk-HLPLOD42.js} +1 -1
  26. package/chunks/{chunk-JXAZUMDW.js → chunk-HR7SV7AY.js} +1 -2
  27. package/chunks/{chunk-P4J26VDS.js → chunk-IDX6COTE.js} +2 -2
  28. package/chunks/{chunk-QCG6KPNM.js → chunk-IWAYOW5Q.js} +14760 -10735
  29. package/chunks/{chunk-HGJPQK33.js → chunk-J5MDQKJL.js} +518 -519
  30. package/chunks/{chunk-USE2VQ5P.js → chunk-JTQAQBTV.js} +21 -0
  31. package/chunks/{chunk-HXJE7VOG.js → chunk-LBP46COL.js} +1001 -139
  32. package/chunks/{chunk-NW5QBUYO.js → chunk-LEJ42GNY.js} +14 -14
  33. package/chunks/{chunk-Y7R6H6FT.js → chunk-M6VTDSVR.js} +1 -1
  34. package/chunks/{chunk-CNHFPN7T.js → chunk-MFBBBTNY.js} +1 -1
  35. package/chunks/{chunk-ICOI4E4S.js → chunk-OHEGWO4L.js} +101 -23
  36. package/chunks/{chunk-7YKXFA3D.js → chunk-PL3MVCWD.js} +5 -5
  37. package/chunks/chunk-QQDPRDVW.js +25 -0
  38. package/chunks/{chunk-HV3ZZ7G4.js → chunk-R7ODSGTK.js} +2 -2
  39. package/chunks/{chunk-GX7VH5JQ.js → chunk-SEGYWKIH.js} +1 -1
  40. package/chunks/{chunk-KC6ZMJ5X.js → chunk-SNGELLWX.js} +1 -1
  41. package/chunks/chunk-XBY7E2FX.js +605 -0
  42. package/chunks/{chunk-2ZTWI7KH.js → chunk-XV4HCEVI.js} +22 -1
  43. package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
  44. package/chunks/{chunk-CWV3SJZS.js → chunk-ZTZ4DDQE.js} +2 -2
  45. package/chunks/{computer-use-B7VIUI7F.js → computer-use-3RH2DOM6.js} +23 -23
  46. package/chunks/contextCommand-K347QT6O.js +52 -0
  47. package/chunks/{cron-create-FI5LJVUS.js → cron-create-YJL3KFWI.js} +3 -3
  48. package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-WKWSJZQA.js} +3 -3
  49. package/chunks/{cron-list-QNNZGMN3.js → cron-list-B52XEXAZ.js} +3 -3
  50. package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
  51. package/chunks/{dist-R2SXPG74.js → dist-4LXD6L6X.js} +2 -2
  52. package/chunks/{dist-TE5QKMGR.js → dist-H6ONXVLG.js} +1 -1
  53. package/chunks/{dist-ZMQ4TXD5.js → dist-KAZ3SEBX.js} +2 -2
  54. package/chunks/{dist-BXDUQ2QY.js → dist-PK7DFCAW.js} +1 -1
  55. package/chunks/{edit-6UBTS2J5.js → edit-KU4PJGEX.js} +24 -24
  56. package/chunks/{en-HSQQNQUB.js → en-DHGYHIHX.js} +4 -0
  57. package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-PPYIDCWI.js} +23 -23
  58. package/chunks/enterPlanMode-5CZDMCB4.js +158 -0
  59. package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-UY3CGHKC.js} +23 -23
  60. package/chunks/exitPlanMode-3DN4QNSG.js +703 -0
  61. package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-7A6I2RWB.js} +7 -7
  62. package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
  63. package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
  64. package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
  65. package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
  66. package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
  67. package/chunks/{glob-OLCX57MD.js → glob-OFNQSS52.js} +23 -23
  68. package/chunks/{grep-7HXIMDOW.js → grep-6J2MSUM5.js} +26 -23
  69. package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-6IU6ORQN.js} +3 -3
  70. package/chunks/{ls-6PEZUK6O.js → ls-V3O6A5PT.js} +4 -4
  71. package/chunks/{lsp-JZSJOVT7.js → lsp-G2OCIFUA.js} +3 -3
  72. package/chunks/{monitor-SQO7MVAV.js → monitor-FKLHV423.js} +23 -23
  73. package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-KTBYFKWG.js} +24 -24
  74. package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-L5KSWQY7.js} +15 -15
  75. package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-PYOXLMBW.js} +25 -25
  76. package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-2KCKWDCF.js} +6 -5
  77. package/chunks/{read-file-UA64EEQC.js → read-file-JQVRK4NU.js} +11 -11
  78. package/chunks/{ripGrep-WSYCWZVK.js → ripGrep-2L4LPNAJ.js} +23 -23
  79. package/chunks/{scheduler-VBASHOCA.js → scheduler-FGNXY4JQ.js} +23 -23
  80. package/chunks/{send-message-OYJZ5TPG.js → send-message-SZFWNOCL.js} +3 -3
  81. package/chunks/{serve-A7E2OJDR.js → serve-N2IBLA3G.js} +13581 -4977
  82. package/chunks/{shell-3NFOT6F5.js → shell-PTEG6UX4.js} +23 -23
  83. package/chunks/{skill-RA5YUREY.js → skill-X4NTK4NH.js} +64 -113
  84. package/chunks/{src-NFCMARMT.js → src-GLLQ3R5W.js} +154 -38
  85. package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-IKAY5F6X.js} +4 -4
  86. package/chunks/{task-create-Y3ZKTJIG.js → task-create-MQICOJFV.js} +7 -7
  87. package/chunks/{task-list-ONXJ3I3A.js → task-list-RIHJCH32.js} +6 -6
  88. package/chunks/{task-stop-UHDC4N5B.js → task-stop-FWZRFANS.js} +3 -3
  89. package/chunks/{task-update-TCNOU3P5.js → task-update-2LHPXOYM.js} +20 -9
  90. package/chunks/{team-create-6SR4OVRG.js → team-create-2E4PF4KN.js} +26 -25
  91. package/chunks/{team-delete-EJ4U4DDP.js → team-delete-DAUDQS4J.js} +8 -6
  92. package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-HTUACZES.js} +5 -5
  93. package/chunks/{tool-search-OD435A3X.js → tool-search-KTVULRES.js} +11 -11
  94. package/chunks/{web-fetch-6W67H5PO.js → web-fetch-CZ7LLKPE.js} +5 -5
  95. package/chunks/{workflow-62DHH4EO.js → workflow-L2ZUUDT2.js} +268 -16
  96. package/chunks/{write-file-475L5OPP.js → write-file-ZEB2JDYH.js} +24 -24
  97. package/chunks/{zh-VCLWO26Y.js → zh-7H5OQC4I.js} +5 -1
  98. package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-P4IDHD3M.js} +5 -1
  99. package/cli.js +5955 -3128
  100. package/examples/starter/QWEN.md +30 -0
  101. package/examples/starter/README.md +59 -0
  102. package/examples/starter/agents/diary.md +86 -0
  103. package/examples/starter/commands/writing/polish.md +13 -0
  104. package/examples/starter/example.ts +64 -0
  105. package/examples/starter/package.json +18 -0
  106. package/examples/starter/qwen-extension.json +12 -0
  107. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  108. package/examples/starter/tsconfig.json +13 -0
  109. package/fzfWorker.js +1083 -0
  110. package/locales/en.js +6 -0
  111. package/locales/zh-TW.js +5 -0
  112. package/locales/zh.js +5 -0
  113. package/package.json +3 -2
  114. package/chunks/chunk-AJIR24J2.js +0 -59
  115. package/chunks/chunk-XBFVXFB2.js +0 -216
  116. package/chunks/contextCommand-63RZ3O5R.js +0 -52
  117. package/chunks/exitPlanMode-H323NHB2.js +0 -235
@@ -0,0 +1,241 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ Mutex,
5
+ getInboxesDir,
6
+ require_proper_lockfile
7
+ } from "./chunk-J5MDQKJL.js";
8
+ import {
9
+ atomicWriteJSON
10
+ } from "./chunk-B7HXHOHU.js";
11
+ import {
12
+ createDebugLogger,
13
+ isNodeError
14
+ } from "./chunk-HR7SV7AY.js";
15
+ import {
16
+ init_esbuild_shims
17
+ } from "./chunk-A4BMJM77.js";
18
+ import {
19
+ __name,
20
+ __toESM
21
+ } from "./chunk-J2S4EL5Y.js";
22
+
23
+ // packages/core/src/agents/team/leaderPermissionBridge.ts
24
+ init_esbuild_shims();
25
+ var leaderCallbacks = null;
26
+ function registerLeader(callbacks) {
27
+ leaderCallbacks = callbacks;
28
+ }
29
+ __name(registerLeader, "registerLeader");
30
+ function getLeader() {
31
+ return leaderCallbacks;
32
+ }
33
+ __name(getLeader, "getLeader");
34
+ function unregisterLeader() {
35
+ leaderCallbacks = null;
36
+ }
37
+ __name(unregisterLeader, "unregisterLeader");
38
+ function forwardApproval(teammateName, teammateColor, details) {
39
+ if (!leaderCallbacks) {
40
+ return false;
41
+ }
42
+ leaderCallbacks.enqueueApproval({
43
+ teammateName,
44
+ teammateColor,
45
+ details
46
+ });
47
+ return true;
48
+ }
49
+ __name(forwardApproval, "forwardApproval");
50
+ function wrapConfirmWithBadge(original, teammateName, respond, _teammateColor) {
51
+ return {
52
+ ...original,
53
+ title: `[${teammateName}] ${original.title}`,
54
+ onConfirm: /* @__PURE__ */ __name(async (outcome, payload) => {
55
+ await respond(outcome, payload);
56
+ }, "onConfirm")
57
+ };
58
+ }
59
+ __name(wrapConfirmWithBadge, "wrapConfirmWithBadge");
60
+
61
+ // packages/core/src/agents/team/mailbox.ts
62
+ init_esbuild_shims();
63
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
64
+ import * as fs from "node:fs/promises";
65
+ import * as path from "node:path";
66
+ var debug = createDebugLogger("AGENTS_TEAM_MAILBOX");
67
+ var LOCK_OPTIONS = {
68
+ retries: {
69
+ retries: 10,
70
+ minTimeout: 5,
71
+ maxTimeout: 100,
72
+ factor: 2,
73
+ // Jitter the backoff so cross-process contenders don't retry in
74
+ // lockstep (thundering herd) and starve each other out of the
75
+ // retry budget.
76
+ randomize: true
77
+ },
78
+ stale: 5e3,
79
+ // Stale locks from crashed processes are expected in multi-agent
80
+ // scenarios; log at debug level for traceability without noise.
81
+ onCompromised: /* @__PURE__ */ __name((err) => {
82
+ debug.debug("mailbox lock compromised:", err?.message ?? err);
83
+ }, "onCompromised")
84
+ };
85
+ var inboxLocks = /* @__PURE__ */ new Map();
86
+ function getInboxLock(inboxPath) {
87
+ let lock = inboxLocks.get(inboxPath);
88
+ if (!lock) {
89
+ lock = new Mutex();
90
+ inboxLocks.set(inboxPath, lock);
91
+ }
92
+ return lock;
93
+ }
94
+ __name(getInboxLock, "getInboxLock");
95
+ function disposeInboxLocks(teamName) {
96
+ const dir = getInboxesDir(teamName);
97
+ let evicted = 0;
98
+ for (const key of inboxLocks.keys()) {
99
+ if (path.dirname(key) === dir) {
100
+ inboxLocks.delete(key);
101
+ evicted++;
102
+ }
103
+ }
104
+ return evicted;
105
+ }
106
+ __name(disposeInboxLocks, "disposeInboxLocks");
107
+ async function withInboxLock(inboxPath, fn) {
108
+ return getInboxLock(inboxPath).runExclusive(async () => {
109
+ const release = await import_proper_lockfile.default.lock(inboxPath, LOCK_OPTIONS);
110
+ try {
111
+ return await fn();
112
+ } finally {
113
+ await release();
114
+ }
115
+ });
116
+ }
117
+ __name(withInboxLock, "withInboxLock");
118
+ function getInboxPath(teamName, agentName) {
119
+ return path.join(getInboxesDir(teamName), `${agentName}.json`);
120
+ }
121
+ __name(getInboxPath, "getInboxPath");
122
+ async function readInbox(teamName, agentName) {
123
+ const inboxPath = getInboxPath(teamName, agentName);
124
+ try {
125
+ const raw = await fs.readFile(inboxPath, "utf-8");
126
+ return JSON.parse(raw);
127
+ } catch (err) {
128
+ if (isNodeError(err) && err.code === "ENOENT") return [];
129
+ throw err;
130
+ }
131
+ }
132
+ __name(readInbox, "readInbox");
133
+ var READ_RETENTION_MS = 5 * 60 * 1e3;
134
+ async function writeMessage(teamName, toAgentName, message) {
135
+ const inboxPath = getInboxPath(teamName, toAgentName);
136
+ await ensureInboxFile(inboxPath);
137
+ await withInboxLock(inboxPath, async () => {
138
+ const messages = await readInboxRaw(inboxPath);
139
+ const cutoff = Date.now() - READ_RETENTION_MS;
140
+ const compacted = messages.filter((m) => {
141
+ if (!m.read) return true;
142
+ const ts = Date.parse(m.timestamp);
143
+ return Number.isNaN(ts) || ts >= cutoff;
144
+ });
145
+ compacted.push(message);
146
+ await atomicWriteJSON(inboxPath, compacted);
147
+ });
148
+ }
149
+ __name(writeMessage, "writeMessage");
150
+ async function consumeUnread(teamName, agentName, type) {
151
+ const inboxPath = getInboxPath(teamName, agentName);
152
+ await ensureInboxFile(inboxPath);
153
+ return withInboxLock(inboxPath, async () => {
154
+ const messages = await readInboxRaw(inboxPath);
155
+ const predicate = /* @__PURE__ */ __name((m) => !m.read && (type === void 0 || m.type === type), "predicate");
156
+ const matching = messages.filter(predicate);
157
+ if (matching.length === 0) return [];
158
+ const updated = messages.map(
159
+ (m) => predicate(m) ? { ...m, read: true } : m
160
+ );
161
+ await atomicWriteJSON(inboxPath, updated);
162
+ return matching;
163
+ });
164
+ }
165
+ __name(consumeUnread, "consumeUnread");
166
+ async function clearInbox(teamName, agentName) {
167
+ const inboxPath = getInboxPath(teamName, agentName);
168
+ try {
169
+ await fs.unlink(inboxPath);
170
+ } catch (err) {
171
+ if (!isNodeError(err) || err.code !== "ENOENT") throw err;
172
+ }
173
+ }
174
+ __name(clearInbox, "clearInbox");
175
+ async function clearAllInboxes(teamName) {
176
+ const dir = getInboxesDir(teamName);
177
+ await fs.rm(dir, { recursive: true, force: true });
178
+ disposeInboxLocks(teamName);
179
+ }
180
+ __name(clearAllInboxes, "clearAllInboxes");
181
+ async function sendStructuredMessage(teamName, toAgentName, opts) {
182
+ await writeMessage(teamName, toAgentName, {
183
+ from: opts.from,
184
+ text: opts.text,
185
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
186
+ read: false,
187
+ type: opts.type,
188
+ color: opts.color,
189
+ summary: opts.summary
190
+ });
191
+ }
192
+ __name(sendStructuredMessage, "sendStructuredMessage");
193
+ async function ensureInboxFile(inboxPath) {
194
+ await fs.mkdir(path.dirname(inboxPath), { recursive: true });
195
+ try {
196
+ await fs.writeFile(inboxPath, "[]\n", { flag: "wx" });
197
+ } catch (err) {
198
+ if (!isNodeError(err) || err.code !== "EEXIST") throw err;
199
+ }
200
+ }
201
+ __name(ensureInboxFile, "ensureInboxFile");
202
+ async function readInboxRaw(inboxPath) {
203
+ try {
204
+ const raw = await fs.readFile(inboxPath, "utf-8");
205
+ return JSON.parse(raw);
206
+ } catch (err) {
207
+ if (isNodeError(err) && err.code === "ENOENT") return [];
208
+ const errMsg = err instanceof Error ? err.message : String(err);
209
+ debug.warn(`Quarantining corrupt inbox at ${inboxPath}: ${errMsg}`);
210
+ try {
211
+ await fs.rename(inboxPath, `${inboxPath}.corrupt-${Date.now()}`);
212
+ } catch (renameErr) {
213
+ const renameMsg = renameErr instanceof Error ? renameErr.message : String(renameErr);
214
+ debug.warn(`Failed to quarantine ${inboxPath}: ${renameMsg}`);
215
+ throw err instanceof Error ? err : new Error(`Failed to read inbox at ${inboxPath}: ${errMsg}`);
216
+ }
217
+ return [];
218
+ }
219
+ }
220
+ __name(readInboxRaw, "readInboxRaw");
221
+
222
+ export {
223
+ registerLeader,
224
+ getLeader,
225
+ unregisterLeader,
226
+ forwardApproval,
227
+ wrapConfirmWithBadge,
228
+ disposeInboxLocks,
229
+ getInboxPath,
230
+ readInbox,
231
+ writeMessage,
232
+ consumeUnread,
233
+ clearInbox,
234
+ clearAllInboxes,
235
+ sendStructuredMessage
236
+ };
237
+ /**
238
+ * @license
239
+ * Copyright 2025 Qwen
240
+ * SPDX-License-Identifier: Apache-2.0
241
+ */
@@ -5,7 +5,7 @@ import {
5
5
  Storage,
6
6
  resolvePath,
7
7
  sanitizeCwd
8
- } from "./chunk-JXAZUMDW.js";
8
+ } from "./chunk-HR7SV7AY.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  import_websocket
5
- } from "./chunk-SZOEIL6S.js";
5
+ } from "./chunk-H6BD2ELD.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";