@qwen-code/qwen-code 0.18.0 → 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/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 -87
- package/bundled/qc-helper/docs/features/dual-output.md +37 -3
- package/bundled/qc-helper/docs/features/skills.md +29 -3
- package/bundled/qc-helper/docs/features/sub-agents.md +2 -1
- package/bundled/qc-helper/docs/qwen-serve.md +32 -23
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +30 -30
- package/chunks/{agent-LOTJK6AH.js → agent-PXMT2XR5.js} +21 -20
- package/chunks/{agent-headless-TU3EPMYU.js → agent-headless-SY7VJUHV.js} +21 -20
- package/chunks/{anthropicContentGenerator-2HBRNQ3B.js → anthropicContentGenerator-DCI26OQF.js} +4 -4
- package/chunks/{askUserQuestion-OGCMIBQM.js → askUserQuestion-NDNFGC35.js} +2 -2
- package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
- package/chunks/{chunk-BIVG75CP.js → chunk-26QELEL2.js} +1 -1
- package/chunks/{chunk-ZTZ4DDQE.js → chunk-3NRO6NHX.js} +2 -2
- package/chunks/{chunk-XV4HCEVI.js → chunk-6WPY6ES3.js} +41 -22
- package/chunks/{chunk-6YIUGZTC.js → chunk-A3OEZT2F.js} +281 -132
- package/chunks/{chunk-LBP46COL.js → chunk-ABRZC6FA.js} +83 -15
- package/chunks/{chunk-A7B4ISQP.js → chunk-B4ZF2KSI.js} +1 -1
- package/chunks/chunk-BJ5HQ23U.js +178 -0
- package/chunks/{chunk-OHEGWO4L.js → chunk-CPVI5J2L.js} +1 -1
- package/chunks/{chunk-SEGYWKIH.js → chunk-FIQECJTQ.js} +1 -1
- package/chunks/{chunk-IWAYOW5Q.js → chunk-H4ZDM3N6.js} +6588 -4196
- package/chunks/{chunk-HR7SV7AY.js → chunk-HA2UEYZP.js} +6 -2
- package/chunks/{chunk-2Y5SYSD3.js → chunk-IDYDPBBN.js} +3 -3
- package/chunks/{chunk-3HTIVKZE.js → chunk-IQHSD7K5.js} +1 -1
- package/chunks/{chunk-MFBBBTNY.js → chunk-JZFEL3RB.js} +1 -1
- package/chunks/{chunk-B7HXHOHU.js → chunk-LXYWINWF.js} +1 -1
- package/chunks/{chunk-IDX6COTE.js → chunk-LYRSMKLS.js} +2 -2
- package/chunks/{chunk-M6VTDSVR.js → chunk-LYSND7KR.js} +9 -4
- package/chunks/{chunk-7BCMOPIM.js → chunk-M5PJ5QAF.js} +31 -12
- package/chunks/{chunk-EYENRK4D.js → chunk-NNIYWQIS.js} +1 -1
- package/chunks/chunk-OMX7CUOE.js +356 -0
- package/chunks/{chunk-R7ODSGTK.js → chunk-OT6JA3KQ.js} +2 -2
- package/chunks/{chunk-72LDN5PP.js → chunk-QP4R5FTG.js} +1 -1
- package/chunks/{chunk-3DHXZ6EV.js → chunk-SFRV6BGY.js} +6 -4
- package/chunks/{chunk-LEJ42GNY.js → chunk-TSBXGR73.js} +6 -6
- package/chunks/{chunk-PL3MVCWD.js → chunk-UOB6KPGG.js} +11 -11
- package/chunks/{chunk-JTQAQBTV.js → chunk-VU6A2OBJ.js} +20 -6
- package/chunks/{chunk-HLPLOD42.js → chunk-VXHYMZXW.js} +1 -1
- package/chunks/{chunk-J5MDQKJL.js → chunk-WPTCDQN6.js} +2 -347
- package/chunks/{chunk-SNGELLWX.js → chunk-ZMIBJS45.js} +1 -1
- package/chunks/{chunk-XBY7E2FX.js → chunk-ZOFNJQNJ.js} +6 -4
- package/chunks/computer-use-7SEQDSHB.js +2052 -0
- package/chunks/{contextCommand-K347QT6O.js → contextCommand-KM5OWV65.js} +23 -22
- package/chunks/cron-create-7CXEAJ2K.js +184 -0
- package/chunks/{cron-delete-WKWSJZQA.js → cron-delete-2FQYYNQ6.js} +27 -4
- package/chunks/{cron-list-B52XEXAZ.js → cron-list-QCAJ73XE.js} +39 -6
- package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
- package/chunks/{dist-4LXD6L6X.js → dist-2UCAYOX7.js} +2 -2
- package/chunks/{dist-H6ONXVLG.js → dist-33LHH26D.js} +1 -1
- package/chunks/{dist-PK7DFCAW.js → dist-KF43SZZV.js} +1 -1
- package/chunks/{dist-KAZ3SEBX.js → dist-PF2IYSMD.js} +1 -1
- package/chunks/{edit-KU4PJGEX.js → edit-BMUKPLA7.js} +23 -24
- package/chunks/{en-DHGYHIHX.js → en-VP6XPGEC.js} +5 -2
- package/chunks/{enter-worktree-PPYIDCWI.js → enter-worktree-LXJ5WJ5A.js} +21 -20
- package/chunks/{enterPlanMode-5CZDMCB4.js → enterPlanMode-QWRZ54ZF.js} +21 -20
- package/chunks/{exit-worktree-UY3CGHKC.js → exit-worktree-5HTQPNZO.js} +21 -20
- package/chunks/{exitPlanMode-3DN4QNSG.js → exitPlanMode-5WQAXNDA.js} +71 -31
- package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
- package/chunks/{geminiContentGenerator-7A6I2RWB.js → geminiContentGenerator-CAKHT5YE.js} +4 -4
- package/chunks/{glob-OFNQSS52.js → glob-5DN6NSCD.js} +21 -20
- package/chunks/{grep-6J2MSUM5.js → grep-BJILOLCD.js} +30 -26
- package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
- package/chunks/{keychain-token-storage-6IU6ORQN.js → keychain-token-storage-QSTRHKKL.js} +2 -2
- package/chunks/{ls-V3O6A5PT.js → ls-XVGXRYWD.js} +3 -3
- package/chunks/{lsp-G2OCIFUA.js → lsp-S6SHPULC.js} +2 -2
- package/chunks/{monitor-FKLHV423.js → monitor-SUEMSRN3.js} +21 -20
- package/chunks/{notebook-edit-KTBYFKWG.js → notebook-edit-6F6Z5P6U.js} +22 -21
- package/chunks/{openaiContentGenerator-L5KSWQY7.js → openaiContentGenerator-DO27LL6O.js} +11 -11
- package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
- package/chunks/{qwenContentGenerator-PYOXLMBW.js → qwenContentGenerator-DQLGLQSH.js} +23 -22
- package/chunks/{qwenOAuth2-2KCKWDCF.js → qwenOAuth2-KK433U33.js} +4 -4
- package/chunks/{read-file-JQVRK4NU.js → read-file-3TBLYTOQ.js} +8 -8
- package/chunks/{ripGrep-2L4LPNAJ.js → ripGrep-3INYT3QV.js} +21 -20
- package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
- package/chunks/{scheduler-FGNXY4JQ.js → scheduler-23KQW6CX.js} +21 -20
- package/chunks/{send-message-SZFWNOCL.js → send-message-SMNR5DBG.js} +2 -2
- package/chunks/{serve-N2IBLA3G.js → serve-Y5E4LKUI.js} +998 -278
- package/chunks/{shell-PTEG6UX4.js → shell-4H6XQXVY.js} +21 -20
- package/chunks/{skill-X4NTK4NH.js → skill-SE6FECZR.js} +10 -10
- package/chunks/{src-GLLQ3R5W.js → src-76DUBH3A.js} +42 -26
- package/chunks/{syntheticOutput-IKAY5F6X.js → syntheticOutput-KMNF7YG6.js} +3 -3
- package/chunks/{task-create-MQICOJFV.js → task-create-LIJHK75G.js} +7 -6
- package/chunks/{task-list-RIHJCH32.js → task-list-S4GNSILM.js} +6 -5
- package/chunks/{task-stop-FWZRFANS.js → task-stop-3GBRYJHM.js} +2 -2
- package/chunks/{task-update-2LHPXOYM.js → task-update-F3UTVJMS.js} +7 -6
- package/chunks/{team-create-2E4PF4KN.js → team-create-Q5DTDDH4.js} +21 -20
- package/chunks/{team-delete-DAUDQS4J.js → team-delete-54434EB7.js} +6 -5
- package/chunks/{todoWrite-HTUACZES.js → todoWrite-4ENGSBUX.js} +4 -4
- package/chunks/{tool-search-KTVULRES.js → tool-search-ABZMSDTU.js} +8 -8
- package/chunks/{web-fetch-CZ7LLKPE.js → web-fetch-RHZMF3MP.js} +4 -4
- package/chunks/{workflow-L2ZUUDT2.js → workflow-NEMDQB75.js} +503 -49
- package/chunks/{write-file-ZEB2JDYH.js → write-file-VAEHZPSL.js} +22 -21
- package/chunks/{zh-7H5OQC4I.js → zh-OIXDDQHB.js} +5 -2
- package/chunks/{zh-TW-P4IDHD3M.js → zh-TW-6YFNCKTA.js} +5 -2
- package/cli-entry.js +19 -0
- package/cli.js +6643 -4971
- package/locales/ca.js +20 -2
- package/locales/de.js +21 -2
- package/locales/en.js +7 -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 +6 -4
- package/locales/zh.js +6 -4
- package/package.json +4 -3
- package/chunks/chunk-SKBPNJEW.js +0 -45
- package/chunks/computer-use-3RH2DOM6.js +0 -825
- package/chunks/cron-create-YJL3KFWI.js +0 -140
|
@@ -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";
|
|
@@ -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);
|
|
@@ -877,7 +887,11 @@ var AcpBridge = class extends EventEmitter {
|
|
|
877
887
|
}
|
|
878
888
|
async start() {
|
|
879
889
|
const { cliEntryPath, cwd } = this.options;
|
|
880
|
-
const args = [
|
|
890
|
+
const args = [
|
|
891
|
+
...process.execArgv.filter((a) => !/^--inspect(-brk)?($|=)/.test(a)),
|
|
892
|
+
cliEntryPath,
|
|
893
|
+
"--acp"
|
|
894
|
+
];
|
|
881
895
|
if (this.options.model) {
|
|
882
896
|
args.push("--model", this.options.model);
|
|
883
897
|
}
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
} from "./chunk-LD2XBG6Z.js";
|
|
11
11
|
import {
|
|
12
12
|
atomicWriteJSON
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LXYWINWF.js";
|
|
14
14
|
import {
|
|
15
15
|
Storage,
|
|
16
16
|
isNodeError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HA2UEYZP.js";
|
|
18
18
|
import {
|
|
19
19
|
init_esbuild_shims
|
|
20
20
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -1854,352 +1854,7 @@ async function listTeamNames() {
|
|
|
1854
1854
|
}
|
|
1855
1855
|
__name(listTeamNames, "listTeamNames");
|
|
1856
1856
|
|
|
1857
|
-
// node_modules/async-mutex/index.mjs
|
|
1858
|
-
init_esbuild_shims();
|
|
1859
|
-
var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
|
|
1860
|
-
var E_ALREADY_LOCKED = new Error("mutex already locked");
|
|
1861
|
-
var E_CANCELED = new Error("request for lock canceled");
|
|
1862
|
-
var __awaiter$2 = function(thisArg, _arguments, P, generator) {
|
|
1863
|
-
function adopt(value) {
|
|
1864
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1865
|
-
resolve(value);
|
|
1866
|
-
});
|
|
1867
|
-
}
|
|
1868
|
-
__name(adopt, "adopt");
|
|
1869
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1870
|
-
function fulfilled(value) {
|
|
1871
|
-
try {
|
|
1872
|
-
step(generator.next(value));
|
|
1873
|
-
} catch (e) {
|
|
1874
|
-
reject(e);
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
__name(fulfilled, "fulfilled");
|
|
1878
|
-
function rejected(value) {
|
|
1879
|
-
try {
|
|
1880
|
-
step(generator["throw"](value));
|
|
1881
|
-
} catch (e) {
|
|
1882
|
-
reject(e);
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
__name(rejected, "rejected");
|
|
1886
|
-
function step(result) {
|
|
1887
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1888
|
-
}
|
|
1889
|
-
__name(step, "step");
|
|
1890
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1891
|
-
});
|
|
1892
|
-
};
|
|
1893
|
-
var Semaphore = class {
|
|
1894
|
-
static {
|
|
1895
|
-
__name(this, "Semaphore");
|
|
1896
|
-
}
|
|
1897
|
-
constructor(_value, _cancelError = E_CANCELED) {
|
|
1898
|
-
this._value = _value;
|
|
1899
|
-
this._cancelError = _cancelError;
|
|
1900
|
-
this._queue = [];
|
|
1901
|
-
this._weightedWaiters = [];
|
|
1902
|
-
}
|
|
1903
|
-
acquire(weight = 1, priority = 0) {
|
|
1904
|
-
if (weight <= 0)
|
|
1905
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
1906
|
-
return new Promise((resolve, reject) => {
|
|
1907
|
-
const task = { resolve, reject, weight, priority };
|
|
1908
|
-
const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
|
|
1909
|
-
if (i === -1 && weight <= this._value) {
|
|
1910
|
-
this._dispatchItem(task);
|
|
1911
|
-
} else {
|
|
1912
|
-
this._queue.splice(i + 1, 0, task);
|
|
1913
|
-
}
|
|
1914
|
-
});
|
|
1915
|
-
}
|
|
1916
|
-
runExclusive(callback_1) {
|
|
1917
|
-
return __awaiter$2(this, arguments, void 0, function* (callback, weight = 1, priority = 0) {
|
|
1918
|
-
const [value, release] = yield this.acquire(weight, priority);
|
|
1919
|
-
try {
|
|
1920
|
-
return yield callback(value);
|
|
1921
|
-
} finally {
|
|
1922
|
-
release();
|
|
1923
|
-
}
|
|
1924
|
-
});
|
|
1925
|
-
}
|
|
1926
|
-
waitForUnlock(weight = 1, priority = 0) {
|
|
1927
|
-
if (weight <= 0)
|
|
1928
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
1929
|
-
if (this._couldLockImmediately(weight, priority)) {
|
|
1930
|
-
return Promise.resolve();
|
|
1931
|
-
} else {
|
|
1932
|
-
return new Promise((resolve) => {
|
|
1933
|
-
if (!this._weightedWaiters[weight - 1])
|
|
1934
|
-
this._weightedWaiters[weight - 1] = [];
|
|
1935
|
-
insertSorted(this._weightedWaiters[weight - 1], { resolve, priority });
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
isLocked() {
|
|
1940
|
-
return this._value <= 0;
|
|
1941
|
-
}
|
|
1942
|
-
getValue() {
|
|
1943
|
-
return this._value;
|
|
1944
|
-
}
|
|
1945
|
-
setValue(value) {
|
|
1946
|
-
this._value = value;
|
|
1947
|
-
this._dispatchQueue();
|
|
1948
|
-
}
|
|
1949
|
-
release(weight = 1) {
|
|
1950
|
-
if (weight <= 0)
|
|
1951
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
1952
|
-
this._value += weight;
|
|
1953
|
-
this._dispatchQueue();
|
|
1954
|
-
}
|
|
1955
|
-
cancel() {
|
|
1956
|
-
this._queue.forEach((entry) => entry.reject(this._cancelError));
|
|
1957
|
-
this._queue = [];
|
|
1958
|
-
}
|
|
1959
|
-
_dispatchQueue() {
|
|
1960
|
-
this._drainUnlockWaiters();
|
|
1961
|
-
while (this._queue.length > 0 && this._queue[0].weight <= this._value) {
|
|
1962
|
-
this._dispatchItem(this._queue.shift());
|
|
1963
|
-
this._drainUnlockWaiters();
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
_dispatchItem(item) {
|
|
1967
|
-
const previousValue = this._value;
|
|
1968
|
-
this._value -= item.weight;
|
|
1969
|
-
item.resolve([previousValue, this._newReleaser(item.weight)]);
|
|
1970
|
-
}
|
|
1971
|
-
_newReleaser(weight) {
|
|
1972
|
-
let called = false;
|
|
1973
|
-
return () => {
|
|
1974
|
-
if (called)
|
|
1975
|
-
return;
|
|
1976
|
-
called = true;
|
|
1977
|
-
this.release(weight);
|
|
1978
|
-
};
|
|
1979
|
-
}
|
|
1980
|
-
_drainUnlockWaiters() {
|
|
1981
|
-
if (this._queue.length === 0) {
|
|
1982
|
-
for (let weight = this._value; weight > 0; weight--) {
|
|
1983
|
-
const waiters = this._weightedWaiters[weight - 1];
|
|
1984
|
-
if (!waiters)
|
|
1985
|
-
continue;
|
|
1986
|
-
waiters.forEach((waiter) => waiter.resolve());
|
|
1987
|
-
this._weightedWaiters[weight - 1] = [];
|
|
1988
|
-
}
|
|
1989
|
-
} else {
|
|
1990
|
-
const queuedPriority = this._queue[0].priority;
|
|
1991
|
-
for (let weight = this._value; weight > 0; weight--) {
|
|
1992
|
-
const waiters = this._weightedWaiters[weight - 1];
|
|
1993
|
-
if (!waiters)
|
|
1994
|
-
continue;
|
|
1995
|
-
const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
|
|
1996
|
-
(i === -1 ? waiters : waiters.splice(0, i)).forEach((waiter) => waiter.resolve());
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
_couldLockImmediately(weight, priority) {
|
|
2001
|
-
return (this._queue.length === 0 || this._queue[0].priority < priority) && weight <= this._value;
|
|
2002
|
-
}
|
|
2003
|
-
};
|
|
2004
|
-
function insertSorted(a, v) {
|
|
2005
|
-
const i = findIndexFromEnd(a, (other) => v.priority <= other.priority);
|
|
2006
|
-
a.splice(i + 1, 0, v);
|
|
2007
|
-
}
|
|
2008
|
-
__name(insertSorted, "insertSorted");
|
|
2009
|
-
function findIndexFromEnd(a, predicate) {
|
|
2010
|
-
for (let i = a.length - 1; i >= 0; i--) {
|
|
2011
|
-
if (predicate(a[i])) {
|
|
2012
|
-
return i;
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
return -1;
|
|
2016
|
-
}
|
|
2017
|
-
__name(findIndexFromEnd, "findIndexFromEnd");
|
|
2018
|
-
var __awaiter$1 = function(thisArg, _arguments, P, generator) {
|
|
2019
|
-
function adopt(value) {
|
|
2020
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
2021
|
-
resolve(value);
|
|
2022
|
-
});
|
|
2023
|
-
}
|
|
2024
|
-
__name(adopt, "adopt");
|
|
2025
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2026
|
-
function fulfilled(value) {
|
|
2027
|
-
try {
|
|
2028
|
-
step(generator.next(value));
|
|
2029
|
-
} catch (e) {
|
|
2030
|
-
reject(e);
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
__name(fulfilled, "fulfilled");
|
|
2034
|
-
function rejected(value) {
|
|
2035
|
-
try {
|
|
2036
|
-
step(generator["throw"](value));
|
|
2037
|
-
} catch (e) {
|
|
2038
|
-
reject(e);
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
__name(rejected, "rejected");
|
|
2042
|
-
function step(result) {
|
|
2043
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2044
|
-
}
|
|
2045
|
-
__name(step, "step");
|
|
2046
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2047
|
-
});
|
|
2048
|
-
};
|
|
2049
|
-
var Mutex = class {
|
|
2050
|
-
static {
|
|
2051
|
-
__name(this, "Mutex");
|
|
2052
|
-
}
|
|
2053
|
-
constructor(cancelError) {
|
|
2054
|
-
this._semaphore = new Semaphore(1, cancelError);
|
|
2055
|
-
}
|
|
2056
|
-
acquire() {
|
|
2057
|
-
return __awaiter$1(this, arguments, void 0, function* (priority = 0) {
|
|
2058
|
-
const [, releaser] = yield this._semaphore.acquire(1, priority);
|
|
2059
|
-
return releaser;
|
|
2060
|
-
});
|
|
2061
|
-
}
|
|
2062
|
-
runExclusive(callback, priority = 0) {
|
|
2063
|
-
return this._semaphore.runExclusive(() => callback(), 1, priority);
|
|
2064
|
-
}
|
|
2065
|
-
isLocked() {
|
|
2066
|
-
return this._semaphore.isLocked();
|
|
2067
|
-
}
|
|
2068
|
-
waitForUnlock(priority = 0) {
|
|
2069
|
-
return this._semaphore.waitForUnlock(1, priority);
|
|
2070
|
-
}
|
|
2071
|
-
release() {
|
|
2072
|
-
if (this._semaphore.isLocked())
|
|
2073
|
-
this._semaphore.release();
|
|
2074
|
-
}
|
|
2075
|
-
cancel() {
|
|
2076
|
-
return this._semaphore.cancel();
|
|
2077
|
-
}
|
|
2078
|
-
};
|
|
2079
|
-
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
2080
|
-
function adopt(value) {
|
|
2081
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
2082
|
-
resolve(value);
|
|
2083
|
-
});
|
|
2084
|
-
}
|
|
2085
|
-
__name(adopt, "adopt");
|
|
2086
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2087
|
-
function fulfilled(value) {
|
|
2088
|
-
try {
|
|
2089
|
-
step(generator.next(value));
|
|
2090
|
-
} catch (e) {
|
|
2091
|
-
reject(e);
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
__name(fulfilled, "fulfilled");
|
|
2095
|
-
function rejected(value) {
|
|
2096
|
-
try {
|
|
2097
|
-
step(generator["throw"](value));
|
|
2098
|
-
} catch (e) {
|
|
2099
|
-
reject(e);
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
__name(rejected, "rejected");
|
|
2103
|
-
function step(result) {
|
|
2104
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2105
|
-
}
|
|
2106
|
-
__name(step, "step");
|
|
2107
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2108
|
-
});
|
|
2109
|
-
};
|
|
2110
|
-
function withTimeout(sync, timeout, timeoutError = E_TIMEOUT) {
|
|
2111
|
-
return {
|
|
2112
|
-
acquire: /* @__PURE__ */ __name((weightOrPriority, priority) => {
|
|
2113
|
-
let weight;
|
|
2114
|
-
if (isSemaphore(sync)) {
|
|
2115
|
-
weight = weightOrPriority;
|
|
2116
|
-
} else {
|
|
2117
|
-
weight = void 0;
|
|
2118
|
-
priority = weightOrPriority;
|
|
2119
|
-
}
|
|
2120
|
-
if (weight !== void 0 && weight <= 0) {
|
|
2121
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
2122
|
-
}
|
|
2123
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
2124
|
-
let isTimeout = false;
|
|
2125
|
-
const handle = setTimeout(() => {
|
|
2126
|
-
isTimeout = true;
|
|
2127
|
-
reject(timeoutError);
|
|
2128
|
-
}, timeout);
|
|
2129
|
-
try {
|
|
2130
|
-
const ticket = yield isSemaphore(sync) ? sync.acquire(weight, priority) : sync.acquire(priority);
|
|
2131
|
-
if (isTimeout) {
|
|
2132
|
-
const release = Array.isArray(ticket) ? ticket[1] : ticket;
|
|
2133
|
-
release();
|
|
2134
|
-
} else {
|
|
2135
|
-
clearTimeout(handle);
|
|
2136
|
-
resolve(ticket);
|
|
2137
|
-
}
|
|
2138
|
-
} catch (e) {
|
|
2139
|
-
if (!isTimeout) {
|
|
2140
|
-
clearTimeout(handle);
|
|
2141
|
-
reject(e);
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
}));
|
|
2145
|
-
}, "acquire"),
|
|
2146
|
-
runExclusive(callback, weight, priority) {
|
|
2147
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2148
|
-
let release = /* @__PURE__ */ __name(() => void 0, "release");
|
|
2149
|
-
try {
|
|
2150
|
-
const ticket = yield this.acquire(weight, priority);
|
|
2151
|
-
if (Array.isArray(ticket)) {
|
|
2152
|
-
release = ticket[1];
|
|
2153
|
-
return yield callback(ticket[0]);
|
|
2154
|
-
} else {
|
|
2155
|
-
release = ticket;
|
|
2156
|
-
return yield callback();
|
|
2157
|
-
}
|
|
2158
|
-
} finally {
|
|
2159
|
-
release();
|
|
2160
|
-
}
|
|
2161
|
-
});
|
|
2162
|
-
},
|
|
2163
|
-
release(weight) {
|
|
2164
|
-
sync.release(weight);
|
|
2165
|
-
},
|
|
2166
|
-
cancel() {
|
|
2167
|
-
return sync.cancel();
|
|
2168
|
-
},
|
|
2169
|
-
waitForUnlock: /* @__PURE__ */ __name((weightOrPriority, priority) => {
|
|
2170
|
-
let weight;
|
|
2171
|
-
if (isSemaphore(sync)) {
|
|
2172
|
-
weight = weightOrPriority;
|
|
2173
|
-
} else {
|
|
2174
|
-
weight = void 0;
|
|
2175
|
-
priority = weightOrPriority;
|
|
2176
|
-
}
|
|
2177
|
-
if (weight !== void 0 && weight <= 0) {
|
|
2178
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
2179
|
-
}
|
|
2180
|
-
return new Promise((resolve, reject) => {
|
|
2181
|
-
const handle = setTimeout(() => reject(timeoutError), timeout);
|
|
2182
|
-
(isSemaphore(sync) ? sync.waitForUnlock(weight, priority) : sync.waitForUnlock(priority)).then(() => {
|
|
2183
|
-
clearTimeout(handle);
|
|
2184
|
-
resolve();
|
|
2185
|
-
});
|
|
2186
|
-
});
|
|
2187
|
-
}, "waitForUnlock"),
|
|
2188
|
-
isLocked: /* @__PURE__ */ __name(() => sync.isLocked(), "isLocked"),
|
|
2189
|
-
getValue: /* @__PURE__ */ __name(() => sync.getValue(), "getValue"),
|
|
2190
|
-
setValue: /* @__PURE__ */ __name((value) => sync.setValue(value), "setValue")
|
|
2191
|
-
};
|
|
2192
|
-
}
|
|
2193
|
-
__name(withTimeout, "withTimeout");
|
|
2194
|
-
function isSemaphore(sync) {
|
|
2195
|
-
return sync.getValue !== void 0;
|
|
2196
|
-
}
|
|
2197
|
-
__name(isSemaphore, "isSemaphore");
|
|
2198
|
-
|
|
2199
1857
|
export {
|
|
2200
|
-
E_TIMEOUT,
|
|
2201
|
-
Mutex,
|
|
2202
|
-
withTimeout,
|
|
2203
1858
|
getTeamsRootDir,
|
|
2204
1859
|
getTeamDir,
|
|
2205
1860
|
getTeamFilePath,
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
|
-
Mutex,
|
|
5
4
|
getTasksDir,
|
|
6
5
|
require_proper_lockfile
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WPTCDQN6.js";
|
|
7
|
+
import {
|
|
8
|
+
Mutex
|
|
9
|
+
} from "./chunk-OMX7CUOE.js";
|
|
8
10
|
import {
|
|
9
11
|
atomicWriteJSON
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LXYWINWF.js";
|
|
11
13
|
import {
|
|
12
14
|
createDebugLogger,
|
|
13
15
|
isNodeError
|
|
14
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HA2UEYZP.js";
|
|
15
17
|
import {
|
|
16
18
|
init_esbuild_shims
|
|
17
19
|
} from "./chunk-A4BMJM77.js";
|