@qwen-code/qwen-code 0.18.0-preview.2 → 0.18.1-nightly.20260616.a68b2e1e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/loop/SKILL.md +2 -1
- package/bundled/qc-helper/docs/_meta.ts +1 -0
- package/bundled/qc-helper/docs/common-workflow.md +4 -4
- package/bundled/qc-helper/docs/configuration/auth.md +1 -1
- package/bundled/qc-helper/docs/configuration/model-providers.md +13 -6
- package/bundled/qc-helper/docs/configuration/settings.md +90 -89
- package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
- package/bundled/qc-helper/docs/features/commands.md +33 -11
- package/bundled/qc-helper/docs/features/dual-output.md +37 -3
- package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
- package/bundled/qc-helper/docs/features/skills.md +29 -3
- package/bundled/qc-helper/docs/features/sub-agents.md +34 -12
- package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
- package/bundled/qc-helper/docs/qwen-serve.md +250 -31
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +30 -30
- package/chunks/{agent-QB7TZ4HW.js → agent-PXMT2XR5.js} +25 -24
- package/chunks/agent-headless-SY7VJUHV.js +51 -0
- package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-DCI26OQF.js} +7 -7
- package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-NDNFGC35.js} +45 -3
- package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
- package/chunks/{chunk-CNSMKPK6.js → chunk-26QELEL2.js} +1 -1
- package/chunks/{chunk-CWV3SJZS.js → chunk-3NRO6NHX.js} +2 -2
- package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
- package/chunks/{chunk-2ZTWI7KH.js → chunk-6WPY6ES3.js} +62 -22
- package/chunks/{chunk-ZK4AMNIU.js → chunk-A3OEZT2F.js} +1294 -314
- package/chunks/{chunk-HXJE7VOG.js → chunk-ABRZC6FA.js} +1074 -144
- package/chunks/{chunk-JUGRPQAB.js → chunk-B4ZF2KSI.js} +1 -1
- package/chunks/chunk-BJ5HQ23U.js +178 -0
- package/chunks/{chunk-ICOI4E4S.js → chunk-CPVI5J2L.js} +101 -23
- package/chunks/{chunk-GX7VH5JQ.js → chunk-FIQECJTQ.js} +1 -1
- package/chunks/{chunk-QCG6KPNM.js → chunk-H4ZDM3N6.js} +18039 -11622
- package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
- package/chunks/{chunk-JXAZUMDW.js → chunk-HA2UEYZP.js} +7 -4
- package/chunks/{chunk-MVIVIPCU.js → chunk-IDYDPBBN.js} +361 -583
- package/chunks/{chunk-JVQOQ3OU.js → chunk-IQHSD7K5.js} +1 -1
- package/chunks/{chunk-CNHFPN7T.js → chunk-JZFEL3RB.js} +1 -1
- package/chunks/{chunk-UAMOBVVW.js → chunk-LXYWINWF.js} +1 -1
- package/chunks/{chunk-P4J26VDS.js → chunk-LYRSMKLS.js} +2 -2
- package/chunks/{chunk-Y7R6H6FT.js → chunk-LYSND7KR.js} +9 -4
- package/chunks/{chunk-AVW55ZCO.js → chunk-M5PJ5QAF.js} +37 -16
- package/chunks/{chunk-LR62TEET.js → chunk-NNIYWQIS.js} +1 -1
- package/chunks/chunk-OMX7CUOE.js +356 -0
- package/chunks/{chunk-HV3ZZ7G4.js → chunk-OT6JA3KQ.js} +2 -2
- package/chunks/{chunk-C6WMLUNB.js → chunk-QP4R5FTG.js} +1 -1
- package/chunks/chunk-QQDPRDVW.js +25 -0
- package/chunks/chunk-SFRV6BGY.js +243 -0
- package/chunks/{chunk-NW5QBUYO.js → chunk-TSBXGR73.js} +14 -14
- package/chunks/{chunk-7YKXFA3D.js → chunk-UOB6KPGG.js} +11 -11
- package/chunks/{chunk-USE2VQ5P.js → chunk-VU6A2OBJ.js} +41 -6
- package/chunks/{chunk-PAEBHDIO.js → chunk-VXHYMZXW.js} +1 -1
- package/chunks/{chunk-HGJPQK33.js → chunk-WPTCDQN6.js} +188 -534
- package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
- package/chunks/{chunk-KC6ZMJ5X.js → chunk-ZMIBJS45.js} +1 -1
- package/chunks/chunk-ZOFNJQNJ.js +607 -0
- package/chunks/computer-use-7SEQDSHB.js +2052 -0
- package/chunks/contextCommand-KM5OWV65.js +53 -0
- package/chunks/cron-create-7CXEAJ2K.js +184 -0
- package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-2FQYYNQ6.js} +28 -5
- package/chunks/{cron-list-QNNZGMN3.js → cron-list-QCAJ73XE.js} +40 -7
- package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
- package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
- package/chunks/{dist-R2SXPG74.js → dist-2UCAYOX7.js} +2 -2
- package/chunks/{dist-TE5QKMGR.js → dist-33LHH26D.js} +1 -1
- package/chunks/{dist-BXDUQ2QY.js → dist-KF43SZZV.js} +1 -1
- package/chunks/{dist-ZMQ4TXD5.js → dist-PF2IYSMD.js} +2 -2
- package/chunks/{edit-6UBTS2J5.js → edit-BMUKPLA7.js} +27 -28
- package/chunks/{en-HSQQNQUB.js → en-VP6XPGEC.js} +9 -2
- package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-LXJ5WJ5A.js} +25 -24
- package/chunks/enterPlanMode-QWRZ54ZF.js +159 -0
- package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-5HTQPNZO.js} +25 -24
- package/chunks/exitPlanMode-5WQAXNDA.js +743 -0
- package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
- package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-CAKHT5YE.js} +7 -7
- package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
- package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
- package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
- package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
- package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
- package/chunks/{glob-OLCX57MD.js → glob-5DN6NSCD.js} +25 -24
- package/chunks/{grep-7HXIMDOW.js → grep-BJILOLCD.js} +37 -30
- package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
- package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-QSTRHKKL.js} +3 -3
- package/chunks/{ls-6PEZUK6O.js → ls-XVGXRYWD.js} +4 -4
- package/chunks/{lsp-JZSJOVT7.js → lsp-S6SHPULC.js} +3 -3
- package/chunks/{monitor-SQO7MVAV.js → monitor-SUEMSRN3.js} +25 -24
- package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-6F6Z5P6U.js} +26 -25
- package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-DO27LL6O.js} +15 -15
- package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
- package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-DQLGLQSH.js} +27 -26
- package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-KK433U33.js} +6 -5
- package/chunks/{read-file-UA64EEQC.js → read-file-3TBLYTOQ.js} +11 -11
- package/chunks/ripGrep-3INYT3QV.js +49 -0
- package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
- package/chunks/{scheduler-VBASHOCA.js → scheduler-23KQW6CX.js} +25 -24
- package/chunks/{send-message-OYJZ5TPG.js → send-message-SMNR5DBG.js} +3 -3
- package/chunks/{serve-A7E2OJDR.js → serve-Y5E4LKUI.js} +13164 -3840
- package/chunks/{shell-3NFOT6F5.js → shell-4H6XQXVY.js} +25 -24
- package/chunks/{skill-RA5YUREY.js → skill-SE6FECZR.js} +64 -113
- package/chunks/{src-NFCMARMT.js → src-76DUBH3A.js} +176 -44
- package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-KMNF7YG6.js} +4 -4
- package/chunks/{task-create-Y3ZKTJIG.js → task-create-LIJHK75G.js} +8 -7
- package/chunks/{task-list-ONXJ3I3A.js → task-list-S4GNSILM.js} +7 -6
- package/chunks/{task-stop-UHDC4N5B.js → task-stop-3GBRYJHM.js} +3 -3
- package/chunks/{task-update-TCNOU3P5.js → task-update-F3UTVJMS.js} +21 -9
- package/chunks/{team-create-6SR4OVRG.js → team-create-Q5DTDDH4.js} +28 -26
- package/chunks/{team-delete-EJ4U4DDP.js → team-delete-54434EB7.js} +9 -6
- package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-4ENGSBUX.js} +5 -5
- package/chunks/{tool-search-OD435A3X.js → tool-search-ABZMSDTU.js} +11 -11
- package/chunks/{web-fetch-6W67H5PO.js → web-fetch-RHZMF3MP.js} +5 -5
- package/chunks/workflow-NEMDQB75.js +1414 -0
- package/chunks/{write-file-475L5OPP.js → write-file-VAEHZPSL.js} +26 -25
- package/chunks/{zh-VCLWO26Y.js → zh-OIXDDQHB.js} +10 -3
- package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-6YFNCKTA.js} +10 -3
- package/cli-entry.js +19 -0
- package/cli.js +11155 -6656
- package/examples/starter/QWEN.md +30 -0
- package/examples/starter/README.md +59 -0
- package/examples/starter/agents/diary.md +86 -0
- package/examples/starter/commands/writing/polish.md +13 -0
- package/examples/starter/example.ts +64 -0
- package/examples/starter/package.json +18 -0
- package/examples/starter/qwen-extension.json +12 -0
- package/examples/starter/skills/synonyms/SKILL.md +48 -0
- package/examples/starter/tsconfig.json +13 -0
- package/fzfWorker.js +1083 -0
- package/locales/ca.js +20 -2
- package/locales/de.js +21 -2
- package/locales/en.js +13 -4
- package/locales/fr.js +22 -2
- package/locales/ja.js +22 -2
- package/locales/pt.js +21 -2
- package/locales/ru.js +20 -2
- package/locales/zh-TW.js +11 -4
- package/locales/zh.js +11 -4
- package/package.json +5 -3
- package/chunks/agent-headless-APVHH7QM.js +0 -50
- package/chunks/chunk-AJIR24J2.js +0 -59
- package/chunks/chunk-SKBPNJEW.js +0 -45
- package/chunks/chunk-XBFVXFB2.js +0 -216
- package/chunks/computer-use-B7VIUI7F.js +0 -825
- package/chunks/contextCommand-63RZ3O5R.js +0 -52
- package/chunks/cron-create-FI5LJVUS.js +0 -140
- package/chunks/exitPlanMode-H323NHB2.js +0 -235
- package/chunks/ripGrep-WSYCWZVK.js +0 -48
- package/chunks/workflow-62DHH4EO.js +0 -708
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
getInboxesDir,
|
|
5
|
+
require_proper_lockfile
|
|
6
|
+
} from "./chunk-WPTCDQN6.js";
|
|
7
|
+
import {
|
|
8
|
+
Mutex
|
|
9
|
+
} from "./chunk-OMX7CUOE.js";
|
|
10
|
+
import {
|
|
11
|
+
atomicWriteJSON
|
|
12
|
+
} from "./chunk-LXYWINWF.js";
|
|
13
|
+
import {
|
|
14
|
+
createDebugLogger,
|
|
15
|
+
isNodeError
|
|
16
|
+
} from "./chunk-HA2UEYZP.js";
|
|
17
|
+
import {
|
|
18
|
+
init_esbuild_shims
|
|
19
|
+
} from "./chunk-A4BMJM77.js";
|
|
20
|
+
import {
|
|
21
|
+
__name,
|
|
22
|
+
__toESM
|
|
23
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
24
|
+
|
|
25
|
+
// packages/core/src/agents/team/leaderPermissionBridge.ts
|
|
26
|
+
init_esbuild_shims();
|
|
27
|
+
var leaderCallbacks = null;
|
|
28
|
+
function registerLeader(callbacks) {
|
|
29
|
+
leaderCallbacks = callbacks;
|
|
30
|
+
}
|
|
31
|
+
__name(registerLeader, "registerLeader");
|
|
32
|
+
function getLeader() {
|
|
33
|
+
return leaderCallbacks;
|
|
34
|
+
}
|
|
35
|
+
__name(getLeader, "getLeader");
|
|
36
|
+
function unregisterLeader() {
|
|
37
|
+
leaderCallbacks = null;
|
|
38
|
+
}
|
|
39
|
+
__name(unregisterLeader, "unregisterLeader");
|
|
40
|
+
function forwardApproval(teammateName, teammateColor, details) {
|
|
41
|
+
if (!leaderCallbacks) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
leaderCallbacks.enqueueApproval({
|
|
45
|
+
teammateName,
|
|
46
|
+
teammateColor,
|
|
47
|
+
details
|
|
48
|
+
});
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
__name(forwardApproval, "forwardApproval");
|
|
52
|
+
function wrapConfirmWithBadge(original, teammateName, respond, _teammateColor) {
|
|
53
|
+
return {
|
|
54
|
+
...original,
|
|
55
|
+
title: `[${teammateName}] ${original.title}`,
|
|
56
|
+
onConfirm: /* @__PURE__ */ __name(async (outcome, payload) => {
|
|
57
|
+
await respond(outcome, payload);
|
|
58
|
+
}, "onConfirm")
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
__name(wrapConfirmWithBadge, "wrapConfirmWithBadge");
|
|
62
|
+
|
|
63
|
+
// packages/core/src/agents/team/mailbox.ts
|
|
64
|
+
init_esbuild_shims();
|
|
65
|
+
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
66
|
+
import * as fs from "node:fs/promises";
|
|
67
|
+
import * as path from "node:path";
|
|
68
|
+
var debug = createDebugLogger("AGENTS_TEAM_MAILBOX");
|
|
69
|
+
var LOCK_OPTIONS = {
|
|
70
|
+
retries: {
|
|
71
|
+
retries: 10,
|
|
72
|
+
minTimeout: 5,
|
|
73
|
+
maxTimeout: 100,
|
|
74
|
+
factor: 2,
|
|
75
|
+
// Jitter the backoff so cross-process contenders don't retry in
|
|
76
|
+
// lockstep (thundering herd) and starve each other out of the
|
|
77
|
+
// retry budget.
|
|
78
|
+
randomize: true
|
|
79
|
+
},
|
|
80
|
+
stale: 5e3,
|
|
81
|
+
// Stale locks from crashed processes are expected in multi-agent
|
|
82
|
+
// scenarios; log at debug level for traceability without noise.
|
|
83
|
+
onCompromised: /* @__PURE__ */ __name((err) => {
|
|
84
|
+
debug.debug("mailbox lock compromised:", err?.message ?? err);
|
|
85
|
+
}, "onCompromised")
|
|
86
|
+
};
|
|
87
|
+
var inboxLocks = /* @__PURE__ */ new Map();
|
|
88
|
+
function getInboxLock(inboxPath) {
|
|
89
|
+
let lock = inboxLocks.get(inboxPath);
|
|
90
|
+
if (!lock) {
|
|
91
|
+
lock = new Mutex();
|
|
92
|
+
inboxLocks.set(inboxPath, lock);
|
|
93
|
+
}
|
|
94
|
+
return lock;
|
|
95
|
+
}
|
|
96
|
+
__name(getInboxLock, "getInboxLock");
|
|
97
|
+
function disposeInboxLocks(teamName) {
|
|
98
|
+
const dir = getInboxesDir(teamName);
|
|
99
|
+
let evicted = 0;
|
|
100
|
+
for (const key of inboxLocks.keys()) {
|
|
101
|
+
if (path.dirname(key) === dir) {
|
|
102
|
+
inboxLocks.delete(key);
|
|
103
|
+
evicted++;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return evicted;
|
|
107
|
+
}
|
|
108
|
+
__name(disposeInboxLocks, "disposeInboxLocks");
|
|
109
|
+
async function withInboxLock(inboxPath, fn) {
|
|
110
|
+
return getInboxLock(inboxPath).runExclusive(async () => {
|
|
111
|
+
const release = await import_proper_lockfile.default.lock(inboxPath, LOCK_OPTIONS);
|
|
112
|
+
try {
|
|
113
|
+
return await fn();
|
|
114
|
+
} finally {
|
|
115
|
+
await release();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
__name(withInboxLock, "withInboxLock");
|
|
120
|
+
function getInboxPath(teamName, agentName) {
|
|
121
|
+
return path.join(getInboxesDir(teamName), `${agentName}.json`);
|
|
122
|
+
}
|
|
123
|
+
__name(getInboxPath, "getInboxPath");
|
|
124
|
+
async function readInbox(teamName, agentName) {
|
|
125
|
+
const inboxPath = getInboxPath(teamName, agentName);
|
|
126
|
+
try {
|
|
127
|
+
const raw = await fs.readFile(inboxPath, "utf-8");
|
|
128
|
+
return JSON.parse(raw);
|
|
129
|
+
} catch (err) {
|
|
130
|
+
if (isNodeError(err) && err.code === "ENOENT") return [];
|
|
131
|
+
throw err;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
__name(readInbox, "readInbox");
|
|
135
|
+
var READ_RETENTION_MS = 5 * 60 * 1e3;
|
|
136
|
+
async function writeMessage(teamName, toAgentName, message) {
|
|
137
|
+
const inboxPath = getInboxPath(teamName, toAgentName);
|
|
138
|
+
await ensureInboxFile(inboxPath);
|
|
139
|
+
await withInboxLock(inboxPath, async () => {
|
|
140
|
+
const messages = await readInboxRaw(inboxPath);
|
|
141
|
+
const cutoff = Date.now() - READ_RETENTION_MS;
|
|
142
|
+
const compacted = messages.filter((m) => {
|
|
143
|
+
if (!m.read) return true;
|
|
144
|
+
const ts = Date.parse(m.timestamp);
|
|
145
|
+
return Number.isNaN(ts) || ts >= cutoff;
|
|
146
|
+
});
|
|
147
|
+
compacted.push(message);
|
|
148
|
+
await atomicWriteJSON(inboxPath, compacted);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
__name(writeMessage, "writeMessage");
|
|
152
|
+
async function consumeUnread(teamName, agentName, type) {
|
|
153
|
+
const inboxPath = getInboxPath(teamName, agentName);
|
|
154
|
+
await ensureInboxFile(inboxPath);
|
|
155
|
+
return withInboxLock(inboxPath, async () => {
|
|
156
|
+
const messages = await readInboxRaw(inboxPath);
|
|
157
|
+
const predicate = /* @__PURE__ */ __name((m) => !m.read && (type === void 0 || m.type === type), "predicate");
|
|
158
|
+
const matching = messages.filter(predicate);
|
|
159
|
+
if (matching.length === 0) return [];
|
|
160
|
+
const updated = messages.map(
|
|
161
|
+
(m) => predicate(m) ? { ...m, read: true } : m
|
|
162
|
+
);
|
|
163
|
+
await atomicWriteJSON(inboxPath, updated);
|
|
164
|
+
return matching;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
__name(consumeUnread, "consumeUnread");
|
|
168
|
+
async function clearInbox(teamName, agentName) {
|
|
169
|
+
const inboxPath = getInboxPath(teamName, agentName);
|
|
170
|
+
try {
|
|
171
|
+
await fs.unlink(inboxPath);
|
|
172
|
+
} catch (err) {
|
|
173
|
+
if (!isNodeError(err) || err.code !== "ENOENT") throw err;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
__name(clearInbox, "clearInbox");
|
|
177
|
+
async function clearAllInboxes(teamName) {
|
|
178
|
+
const dir = getInboxesDir(teamName);
|
|
179
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
180
|
+
disposeInboxLocks(teamName);
|
|
181
|
+
}
|
|
182
|
+
__name(clearAllInboxes, "clearAllInboxes");
|
|
183
|
+
async function sendStructuredMessage(teamName, toAgentName, opts) {
|
|
184
|
+
await writeMessage(teamName, toAgentName, {
|
|
185
|
+
from: opts.from,
|
|
186
|
+
text: opts.text,
|
|
187
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
188
|
+
read: false,
|
|
189
|
+
type: opts.type,
|
|
190
|
+
color: opts.color,
|
|
191
|
+
summary: opts.summary
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
__name(sendStructuredMessage, "sendStructuredMessage");
|
|
195
|
+
async function ensureInboxFile(inboxPath) {
|
|
196
|
+
await fs.mkdir(path.dirname(inboxPath), { recursive: true });
|
|
197
|
+
try {
|
|
198
|
+
await fs.writeFile(inboxPath, "[]\n", { flag: "wx" });
|
|
199
|
+
} catch (err) {
|
|
200
|
+
if (!isNodeError(err) || err.code !== "EEXIST") throw err;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
__name(ensureInboxFile, "ensureInboxFile");
|
|
204
|
+
async function readInboxRaw(inboxPath) {
|
|
205
|
+
try {
|
|
206
|
+
const raw = await fs.readFile(inboxPath, "utf-8");
|
|
207
|
+
return JSON.parse(raw);
|
|
208
|
+
} catch (err) {
|
|
209
|
+
if (isNodeError(err) && err.code === "ENOENT") return [];
|
|
210
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
211
|
+
debug.warn(`Quarantining corrupt inbox at ${inboxPath}: ${errMsg}`);
|
|
212
|
+
try {
|
|
213
|
+
await fs.rename(inboxPath, `${inboxPath}.corrupt-${Date.now()}`);
|
|
214
|
+
} catch (renameErr) {
|
|
215
|
+
const renameMsg = renameErr instanceof Error ? renameErr.message : String(renameErr);
|
|
216
|
+
debug.warn(`Failed to quarantine ${inboxPath}: ${renameMsg}`);
|
|
217
|
+
throw err instanceof Error ? err : new Error(`Failed to read inbox at ${inboxPath}: ${errMsg}`);
|
|
218
|
+
}
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
__name(readInboxRaw, "readInboxRaw");
|
|
223
|
+
|
|
224
|
+
export {
|
|
225
|
+
registerLeader,
|
|
226
|
+
getLeader,
|
|
227
|
+
unregisterLeader,
|
|
228
|
+
forwardApproval,
|
|
229
|
+
wrapConfirmWithBadge,
|
|
230
|
+
disposeInboxLocks,
|
|
231
|
+
getInboxPath,
|
|
232
|
+
readInbox,
|
|
233
|
+
writeMessage,
|
|
234
|
+
consumeUnread,
|
|
235
|
+
clearInbox,
|
|
236
|
+
clearAllInboxes,
|
|
237
|
+
sendStructuredMessage
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* @license
|
|
241
|
+
* Copyright 2025 Qwen
|
|
242
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
243
|
+
*/
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
t
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UOB6KPGG.js";
|
|
6
6
|
import {
|
|
7
7
|
computeThresholds,
|
|
8
8
|
getCoreSystemPrompt
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-H4ZDM3N6.js";
|
|
10
10
|
import {
|
|
11
11
|
buildSkillLlmContent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CPVI5J2L.js";
|
|
13
13
|
import {
|
|
14
14
|
DiscoveredMCPTool,
|
|
15
15
|
uiTelemetryService
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-A3OEZT2F.js";
|
|
17
17
|
import {
|
|
18
18
|
ToolNames
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6WPY6ES3.js";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_TOKEN_LIMIT
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LYSND7KR.js";
|
|
23
23
|
import {
|
|
24
24
|
init_esbuild_shims
|
|
25
25
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -752,7 +752,7 @@ function fmtTokens(tokens) {
|
|
|
752
752
|
}
|
|
753
753
|
__name(fmtTokens, "fmtTokens");
|
|
754
754
|
function fmtCategoryRow(label, tokens, contextWindowSize, indent = " ") {
|
|
755
|
-
const percentage = (tokens / contextWindowSize * 100).toFixed(1);
|
|
755
|
+
const percentage = contextWindowSize > 0 ? (tokens / contextWindowSize * 100).toFixed(1) : "0.0";
|
|
756
756
|
const right = `${fmtTokens(tokens)} tokens (${percentage}%)`;
|
|
757
757
|
const leftPart = `${indent}${label}`;
|
|
758
758
|
const totalWidth = 56;
|
|
@@ -899,7 +899,8 @@ var contextCommand = {
|
|
|
899
899
|
kind: "built-in" /* BUILT_IN */,
|
|
900
900
|
supportedModes: ["interactive", "non_interactive", "acp"],
|
|
901
901
|
action: /* @__PURE__ */ __name(async (context, args) => {
|
|
902
|
-
const
|
|
902
|
+
const normalizedArgs = args?.trim().toLowerCase();
|
|
903
|
+
const showDetails = normalizedArgs === "detail" || normalizedArgs === "-d";
|
|
903
904
|
const executionMode = context.executionMode ?? "interactive";
|
|
904
905
|
const { config } = context.services;
|
|
905
906
|
if (!config) {
|
|
@@ -923,13 +924,12 @@ var contextCommand = {
|
|
|
923
924
|
if (executionMode === "interactive") {
|
|
924
925
|
context.ui.addItem(contextUsageItem, Date.now());
|
|
925
926
|
return;
|
|
926
|
-
} else {
|
|
927
|
-
return {
|
|
928
|
-
type: "message",
|
|
929
|
-
messageType: "info",
|
|
930
|
-
content: formatContextUsageText(contextUsageItem)
|
|
931
|
-
};
|
|
932
927
|
}
|
|
928
|
+
return {
|
|
929
|
+
type: "message",
|
|
930
|
+
messageType: "info",
|
|
931
|
+
content: formatContextUsageText(contextUsageItem)
|
|
932
|
+
};
|
|
933
933
|
}, "action"),
|
|
934
934
|
subCommands: [
|
|
935
935
|
{
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
resolveBundleDir
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-H4ZDM3N6.js";
|
|
6
6
|
import {
|
|
7
7
|
Storage
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HA2UEYZP.js";
|
|
9
9
|
import {
|
|
10
10
|
init_esbuild_shims
|
|
11
11
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -169,15 +169,15 @@ init_esbuild_shims();
|
|
|
169
169
|
|
|
170
170
|
// import("./locales/**/*.js") in packages/cli/src/i18n/index.ts
|
|
171
171
|
var globImport_locales_js = __glob({
|
|
172
|
-
"./locales/ca.js": () => import("./ca-
|
|
173
|
-
"./locales/de.js": () => import("./de-
|
|
174
|
-
"./locales/en.js": () => import("./en-
|
|
175
|
-
"./locales/fr.js": () => import("./fr-
|
|
176
|
-
"./locales/ja.js": () => import("./ja-
|
|
177
|
-
"./locales/pt.js": () => import("./pt-
|
|
178
|
-
"./locales/ru.js": () => import("./ru-
|
|
179
|
-
"./locales/zh-TW.js": () => import("./zh-TW-
|
|
180
|
-
"./locales/zh.js": () => import("./zh-
|
|
172
|
+
"./locales/ca.js": () => import("./ca-RK4QPLIX.js"),
|
|
173
|
+
"./locales/de.js": () => import("./de-FGPM4KW5.js"),
|
|
174
|
+
"./locales/en.js": () => import("./en-VP6XPGEC.js"),
|
|
175
|
+
"./locales/fr.js": () => import("./fr-ATYBVCLT.js"),
|
|
176
|
+
"./locales/ja.js": () => import("./ja-W2QEA2OI.js"),
|
|
177
|
+
"./locales/pt.js": () => import("./pt-ZKEWJFBW.js"),
|
|
178
|
+
"./locales/ru.js": () => import("./ru-VEKTPJ74.js"),
|
|
179
|
+
"./locales/zh-TW.js": () => import("./zh-TW-6YFNCKTA.js"),
|
|
180
|
+
"./locales/zh.js": () => import("./zh-OIXDDQHB.js")
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
// packages/cli/src/i18n/index.ts
|
|
@@ -380,6 +380,15 @@ var SessionRouter = class {
|
|
|
380
380
|
return `${channelName}:${senderId}:${chatId}`;
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Sender-scoped key prefix for by-sender (no chatId) scans. The trailing
|
|
385
|
+
* ':' delimiter ensures a sender id matches as a whole segment — without it
|
|
386
|
+
* sender "bob" would also match another sender "bobby"
|
|
387
|
+
* (key `${channelName}:bobby:${chatId}`).
|
|
388
|
+
*/
|
|
389
|
+
senderPrefix(channelName, senderId) {
|
|
390
|
+
return `${channelName}:${senderId}:`;
|
|
391
|
+
}
|
|
383
392
|
async resolve(channelName, senderId, chatId, threadId, cwd) {
|
|
384
393
|
const key = this.routingKey(channelName, senderId, chatId, threadId);
|
|
385
394
|
const existing = this.toSession.get(key);
|
|
@@ -398,11 +407,12 @@ var SessionRouter = class {
|
|
|
398
407
|
return this.toTarget.get(sessionId);
|
|
399
408
|
}
|
|
400
409
|
hasSession(channelName, senderId, chatId) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
410
|
+
if (chatId) {
|
|
411
|
+
return this.toSession.has(this.routingKey(channelName, senderId, chatId));
|
|
412
|
+
}
|
|
413
|
+
const prefix = this.senderPrefix(channelName, senderId);
|
|
404
414
|
for (const k of this.toSession.keys()) {
|
|
405
|
-
if (k.startsWith(
|
|
415
|
+
if (k.startsWith(prefix))
|
|
406
416
|
return true;
|
|
407
417
|
}
|
|
408
418
|
return false;
|
|
@@ -418,7 +428,7 @@ var SessionRouter = class {
|
|
|
418
428
|
if (sessionId)
|
|
419
429
|
removedIds.push(sessionId);
|
|
420
430
|
} else {
|
|
421
|
-
const prefix =
|
|
431
|
+
const prefix = this.senderPrefix(channelName, senderId);
|
|
422
432
|
for (const k of [...this.toSession.keys()]) {
|
|
423
433
|
if (k.startsWith(prefix)) {
|
|
424
434
|
const sessionId = this.deleteByKey(k);
|
|
@@ -692,6 +702,27 @@ var ChannelBase = class {
|
|
|
692
702
|
}
|
|
693
703
|
}
|
|
694
704
|
const sessionId = await this.router.resolve(this.name, envelope.senderId, envelope.chatId, envelope.threadId, this.config.cwd);
|
|
705
|
+
if (envelope.text.startsWith("!")) {
|
|
706
|
+
const cmd = envelope.text.slice(1).trim();
|
|
707
|
+
const bridgeShellCommand = this.bridge["shellCommand"];
|
|
708
|
+
if (cmd && typeof bridgeShellCommand === "function") {
|
|
709
|
+
try {
|
|
710
|
+
const result2 = await bridgeShellCommand(sessionId, cmd);
|
|
711
|
+
const longestRun = Math.max(0, ...Array.from((result2.output || "").matchAll(/`+/g), (m) => m[0].length));
|
|
712
|
+
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
713
|
+
const output = result2.output ? `${fence}
|
|
714
|
+
${result2.output}
|
|
715
|
+
${fence}` : "(no output)";
|
|
716
|
+
const exitLine = result2.exitCode !== null && result2.exitCode !== 0 ? `
|
|
717
|
+
Exit code: ${result2.exitCode}` : "";
|
|
718
|
+
await this.sendMessage(envelope.chatId, `$ ${cmd}
|
|
719
|
+
${output}${exitLine}`);
|
|
720
|
+
} catch (error) {
|
|
721
|
+
await this.sendMessage(envelope.chatId, `Shell command failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
722
|
+
}
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
695
726
|
let promptText = envelope.text;
|
|
696
727
|
if (envelope.referencedText) {
|
|
697
728
|
promptText = `[Replying to: "${envelope.referencedText}"]
|
|
@@ -856,7 +887,11 @@ var AcpBridge = class extends EventEmitter {
|
|
|
856
887
|
}
|
|
857
888
|
async start() {
|
|
858
889
|
const { cliEntryPath, cwd } = this.options;
|
|
859
|
-
const args = [
|
|
890
|
+
const args = [
|
|
891
|
+
...process.execArgv.filter((a) => !/^--inspect(-brk)?($|=)/.test(a)),
|
|
892
|
+
cliEntryPath,
|
|
893
|
+
"--acp"
|
|
894
|
+
];
|
|
860
895
|
if (this.options.model) {
|
|
861
896
|
args.push("--model", this.options.model);
|
|
862
897
|
}
|