@qwen-code/qwen-code 0.18.0 → 0.18.1-preview.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/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 +5 -4
- package/bundled/qc-helper/docs/qwen-serve.md +32 -23
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +30 -30
- package/bundled/review/SKILL.md +3 -1
- package/bundled/simplify/SKILL.md +1 -1
- package/chunks/{agent-LOTJK6AH.js → agent-WK5GYOPC.js} +21 -20
- package/chunks/{agent-headless-TU3EPMYU.js → agent-headless-KZJALDQF.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-LBP46COL.js → chunk-27STU35P.js} +83 -15
- package/chunks/{chunk-ZTZ4DDQE.js → chunk-3NRO6NHX.js} +2 -2
- package/chunks/{chunk-XV4HCEVI.js → chunk-6WPY6ES3.js} +41 -22
- package/chunks/{chunk-A7B4ISQP.js → chunk-B4ZF2KSI.js} +1 -1
- package/chunks/chunk-BJ5HQ23U.js +178 -0
- package/chunks/{chunk-PL3MVCWD.js → chunk-BW7CMDF3.js} +11 -11
- package/chunks/{chunk-OHEGWO4L.js → chunk-CPVI5J2L.js} +1 -1
- package/chunks/{chunk-LEJ42GNY.js → chunk-DYCU43TE.js} +6 -6
- package/chunks/{chunk-6YIUGZTC.js → chunk-E322ZT4P.js} +281 -132
- package/chunks/{chunk-SEGYWKIH.js → chunk-FIQECJTQ.js} +1 -1
- 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-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-IWAYOW5Q.js → chunk-Q3NN2XUW.js} +6661 -4210
- package/chunks/{chunk-72LDN5PP.js → chunk-QP4R5FTG.js} +1 -1
- package/chunks/{chunk-7BCMOPIM.js → chunk-RLFLJVHU.js} +31 -12
- package/chunks/{chunk-3DHXZ6EV.js → chunk-SFRV6BGY.js} +6 -4
- 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-4ELNIZMF.js +2052 -0
- package/chunks/{contextCommand-K347QT6O.js → contextCommand-E2V26QGD.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-IC3ECG44.js} +23 -24
- package/chunks/{en-DHGYHIHX.js → en-VP6XPGEC.js} +5 -2
- package/chunks/{enter-worktree-PPYIDCWI.js → enter-worktree-ETQWM7BB.js} +21 -20
- package/chunks/{enterPlanMode-5CZDMCB4.js → enterPlanMode-VL3F45RF.js} +21 -20
- package/chunks/{exit-worktree-UY3CGHKC.js → exit-worktree-F5BJXBFB.js} +21 -20
- package/chunks/{exitPlanMode-3DN4QNSG.js → exitPlanMode-VOC7G5FJ.js} +71 -31
- package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
- package/chunks/{geminiContentGenerator-7A6I2RWB.js → geminiContentGenerator-7D2QZ5FE.js} +4 -4
- package/chunks/{glob-OFNQSS52.js → glob-XTABUPPR.js} +21 -20
- package/chunks/{grep-6J2MSUM5.js → grep-MRCXYH2N.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-LNRRNJJB.js} +21 -20
- package/chunks/{notebook-edit-KTBYFKWG.js → notebook-edit-IS3UYVGM.js} +22 -21
- package/chunks/{openaiContentGenerator-L5KSWQY7.js → openaiContentGenerator-P772OZ6K.js} +11 -11
- package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
- package/chunks/{qwenContentGenerator-PYOXLMBW.js → qwenContentGenerator-Y6YGZRHH.js} +23 -22
- package/chunks/{qwenOAuth2-2KCKWDCF.js → qwenOAuth2-KK433U33.js} +4 -4
- package/chunks/{read-file-JQVRK4NU.js → read-file-2JIJ646W.js} +8 -8
- package/chunks/{ripGrep-2L4LPNAJ.js → ripGrep-Z74CN4MW.js} +21 -20
- package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
- package/chunks/{scheduler-FGNXY4JQ.js → scheduler-KFG4TT3A.js} +21 -20
- package/chunks/{send-message-SZFWNOCL.js → send-message-SMNR5DBG.js} +2 -2
- package/chunks/{serve-N2IBLA3G.js → serve-XDZAE3KF.js} +998 -278
- package/chunks/{shell-PTEG6UX4.js → shell-BTAJJJHO.js} +21 -20
- package/chunks/{skill-X4NTK4NH.js → skill-LSM726DP.js} +10 -10
- package/chunks/{src-GLLQ3R5W.js → src-JMUZP4A4.js} +44 -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-S5ZBN464.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-NUOEJ4LF.js} +8 -8
- package/chunks/{web-fetch-CZ7LLKPE.js → web-fetch-RHZMF3MP.js} +4 -4
- package/chunks/{workflow-L2ZUUDT2.js → workflow-ZI3ZXNU6.js} +503 -49
- package/chunks/{write-file-ZEB2JDYH.js → write-file-MHQLLZWY.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 +6645 -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
|
@@ -640,6 +640,9 @@ var Storage = class _Storage {
|
|
|
640
640
|
const targetDir = path2.join(tempDir, hash);
|
|
641
641
|
return targetDir;
|
|
642
642
|
}
|
|
643
|
+
getToolResultsDir() {
|
|
644
|
+
return path2.join(this.getProjectTempDir(), "tool-results");
|
|
645
|
+
}
|
|
643
646
|
ensureProjectTempDirExists() {
|
|
644
647
|
fs2.mkdirSync(this.getProjectTempDir(), { recursive: true });
|
|
645
648
|
}
|
|
@@ -810,9 +813,9 @@ var globalSession = null;
|
|
|
810
813
|
var sessionContext = new AsyncLocalStorage2();
|
|
811
814
|
function isDebugLogFileEnabled() {
|
|
812
815
|
const value = process.env["QWEN_DEBUG_LOG_FILE"];
|
|
813
|
-
if (!value) return
|
|
816
|
+
if (!value) return false;
|
|
814
817
|
const normalized = value.trim().toLowerCase();
|
|
815
|
-
return !["0", "false", "off", "no"].includes(normalized);
|
|
818
|
+
return !["", "0", "false", "off", "no"].includes(normalized);
|
|
816
819
|
}
|
|
817
820
|
__name(isDebugLogFileEnabled, "isDebugLogFileEnabled");
|
|
818
821
|
function getActiveSession() {
|
|
@@ -964,6 +967,7 @@ export {
|
|
|
964
967
|
updateSymlink,
|
|
965
968
|
setSessionContext,
|
|
966
969
|
getCurrentSessionId,
|
|
970
|
+
getActiveSpanTraceContext,
|
|
967
971
|
getTraceContext,
|
|
968
972
|
formatTraceparent,
|
|
969
973
|
setShellTracePropagation,
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
formatFetchErrorForUser
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FIQECJTQ.js";
|
|
6
6
|
import {
|
|
7
7
|
combineAbortSignals
|
|
8
8
|
} from "./chunk-64WXLC72.js";
|
|
9
9
|
import {
|
|
10
10
|
atomicWriteFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LXYWINWF.js";
|
|
12
12
|
import {
|
|
13
13
|
Storage,
|
|
14
14
|
createDebugLogger
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HA2UEYZP.js";
|
|
16
16
|
import {
|
|
17
17
|
init_esbuild_shims
|
|
18
18
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
atomicWriteFileSync
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LXYWINWF.js";
|
|
6
6
|
import {
|
|
7
7
|
Storage,
|
|
8
8
|
createDebugLogger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HA2UEYZP.js";
|
|
10
10
|
import {
|
|
11
11
|
init_esbuild_shims
|
|
12
12
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
createDebugLogger
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HA2UEYZP.js";
|
|
6
6
|
import {
|
|
7
7
|
init_esbuild_shims
|
|
8
8
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -467,10 +467,15 @@ var PATTERNS = [
|
|
|
467
467
|
// -------------------
|
|
468
468
|
// Zhipu GLM
|
|
469
469
|
// -------------------
|
|
470
|
-
|
|
471
|
-
//
|
|
470
|
+
// 1M context is the forward default for new GLM releases (GLM-5.2+, GLM-6.x,
|
|
471
|
+
// and beyond) so they need no future code change. Confirmed 200K families
|
|
472
|
+
// (GLM-5 / 5.0 / 5.1, GLM-4.x and older) are pinned explicitly first.
|
|
473
|
+
[/^glm-5(\.[01])?(-|$)/, 202752],
|
|
474
|
+
// GLM-5 / 5.0 / 5.1: 200K
|
|
475
|
+
[/^glm-(?:[5-9]|\d{2,})/, LIMITS["1m"]],
|
|
476
|
+
// GLM-5.2+, 6.x..9.x, 10.x+: 1M
|
|
472
477
|
[/^glm-/, 202752],
|
|
473
|
-
// GLM fallback:
|
|
478
|
+
// GLM <=4.x / non-numeric fallback: 200K
|
|
474
479
|
// -------------------
|
|
475
480
|
// MiniMax
|
|
476
481
|
// -------------------
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
init_esbuild_shims
|
|
5
|
+
} from "./chunk-A4BMJM77.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
9
|
+
|
|
10
|
+
// node_modules/async-mutex/index.mjs
|
|
11
|
+
init_esbuild_shims();
|
|
12
|
+
var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
|
|
13
|
+
var E_ALREADY_LOCKED = new Error("mutex already locked");
|
|
14
|
+
var E_CANCELED = new Error("request for lock canceled");
|
|
15
|
+
var __awaiter$2 = function(thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) {
|
|
17
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
18
|
+
resolve(value);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
__name(adopt, "adopt");
|
|
22
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
23
|
+
function fulfilled(value) {
|
|
24
|
+
try {
|
|
25
|
+
step(generator.next(value));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
reject(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
__name(fulfilled, "fulfilled");
|
|
31
|
+
function rejected(value) {
|
|
32
|
+
try {
|
|
33
|
+
step(generator["throw"](value));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__name(rejected, "rejected");
|
|
39
|
+
function step(result) {
|
|
40
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
41
|
+
}
|
|
42
|
+
__name(step, "step");
|
|
43
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var Semaphore = class {
|
|
47
|
+
static {
|
|
48
|
+
__name(this, "Semaphore");
|
|
49
|
+
}
|
|
50
|
+
constructor(_value, _cancelError = E_CANCELED) {
|
|
51
|
+
this._value = _value;
|
|
52
|
+
this._cancelError = _cancelError;
|
|
53
|
+
this._queue = [];
|
|
54
|
+
this._weightedWaiters = [];
|
|
55
|
+
}
|
|
56
|
+
acquire(weight = 1, priority = 0) {
|
|
57
|
+
if (weight <= 0)
|
|
58
|
+
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const task = { resolve, reject, weight, priority };
|
|
61
|
+
const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
|
|
62
|
+
if (i === -1 && weight <= this._value) {
|
|
63
|
+
this._dispatchItem(task);
|
|
64
|
+
} else {
|
|
65
|
+
this._queue.splice(i + 1, 0, task);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
runExclusive(callback_1) {
|
|
70
|
+
return __awaiter$2(this, arguments, void 0, function* (callback, weight = 1, priority = 0) {
|
|
71
|
+
const [value, release] = yield this.acquire(weight, priority);
|
|
72
|
+
try {
|
|
73
|
+
return yield callback(value);
|
|
74
|
+
} finally {
|
|
75
|
+
release();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
waitForUnlock(weight = 1, priority = 0) {
|
|
80
|
+
if (weight <= 0)
|
|
81
|
+
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
82
|
+
if (this._couldLockImmediately(weight, priority)) {
|
|
83
|
+
return Promise.resolve();
|
|
84
|
+
} else {
|
|
85
|
+
return new Promise((resolve) => {
|
|
86
|
+
if (!this._weightedWaiters[weight - 1])
|
|
87
|
+
this._weightedWaiters[weight - 1] = [];
|
|
88
|
+
insertSorted(this._weightedWaiters[weight - 1], { resolve, priority });
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
isLocked() {
|
|
93
|
+
return this._value <= 0;
|
|
94
|
+
}
|
|
95
|
+
getValue() {
|
|
96
|
+
return this._value;
|
|
97
|
+
}
|
|
98
|
+
setValue(value) {
|
|
99
|
+
this._value = value;
|
|
100
|
+
this._dispatchQueue();
|
|
101
|
+
}
|
|
102
|
+
release(weight = 1) {
|
|
103
|
+
if (weight <= 0)
|
|
104
|
+
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
105
|
+
this._value += weight;
|
|
106
|
+
this._dispatchQueue();
|
|
107
|
+
}
|
|
108
|
+
cancel() {
|
|
109
|
+
this._queue.forEach((entry) => entry.reject(this._cancelError));
|
|
110
|
+
this._queue = [];
|
|
111
|
+
}
|
|
112
|
+
_dispatchQueue() {
|
|
113
|
+
this._drainUnlockWaiters();
|
|
114
|
+
while (this._queue.length > 0 && this._queue[0].weight <= this._value) {
|
|
115
|
+
this._dispatchItem(this._queue.shift());
|
|
116
|
+
this._drainUnlockWaiters();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
_dispatchItem(item) {
|
|
120
|
+
const previousValue = this._value;
|
|
121
|
+
this._value -= item.weight;
|
|
122
|
+
item.resolve([previousValue, this._newReleaser(item.weight)]);
|
|
123
|
+
}
|
|
124
|
+
_newReleaser(weight) {
|
|
125
|
+
let called = false;
|
|
126
|
+
return () => {
|
|
127
|
+
if (called)
|
|
128
|
+
return;
|
|
129
|
+
called = true;
|
|
130
|
+
this.release(weight);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
_drainUnlockWaiters() {
|
|
134
|
+
if (this._queue.length === 0) {
|
|
135
|
+
for (let weight = this._value; weight > 0; weight--) {
|
|
136
|
+
const waiters = this._weightedWaiters[weight - 1];
|
|
137
|
+
if (!waiters)
|
|
138
|
+
continue;
|
|
139
|
+
waiters.forEach((waiter) => waiter.resolve());
|
|
140
|
+
this._weightedWaiters[weight - 1] = [];
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
const queuedPriority = this._queue[0].priority;
|
|
144
|
+
for (let weight = this._value; weight > 0; weight--) {
|
|
145
|
+
const waiters = this._weightedWaiters[weight - 1];
|
|
146
|
+
if (!waiters)
|
|
147
|
+
continue;
|
|
148
|
+
const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
|
|
149
|
+
(i === -1 ? waiters : waiters.splice(0, i)).forEach((waiter) => waiter.resolve());
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
_couldLockImmediately(weight, priority) {
|
|
154
|
+
return (this._queue.length === 0 || this._queue[0].priority < priority) && weight <= this._value;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
function insertSorted(a, v) {
|
|
158
|
+
const i = findIndexFromEnd(a, (other) => v.priority <= other.priority);
|
|
159
|
+
a.splice(i + 1, 0, v);
|
|
160
|
+
}
|
|
161
|
+
__name(insertSorted, "insertSorted");
|
|
162
|
+
function findIndexFromEnd(a, predicate) {
|
|
163
|
+
for (let i = a.length - 1; i >= 0; i--) {
|
|
164
|
+
if (predicate(a[i])) {
|
|
165
|
+
return i;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return -1;
|
|
169
|
+
}
|
|
170
|
+
__name(findIndexFromEnd, "findIndexFromEnd");
|
|
171
|
+
var __awaiter$1 = function(thisArg, _arguments, P, generator) {
|
|
172
|
+
function adopt(value) {
|
|
173
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
174
|
+
resolve(value);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
__name(adopt, "adopt");
|
|
178
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
179
|
+
function fulfilled(value) {
|
|
180
|
+
try {
|
|
181
|
+
step(generator.next(value));
|
|
182
|
+
} catch (e) {
|
|
183
|
+
reject(e);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
__name(fulfilled, "fulfilled");
|
|
187
|
+
function rejected(value) {
|
|
188
|
+
try {
|
|
189
|
+
step(generator["throw"](value));
|
|
190
|
+
} catch (e) {
|
|
191
|
+
reject(e);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
__name(rejected, "rejected");
|
|
195
|
+
function step(result) {
|
|
196
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
197
|
+
}
|
|
198
|
+
__name(step, "step");
|
|
199
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
var Mutex = class {
|
|
203
|
+
static {
|
|
204
|
+
__name(this, "Mutex");
|
|
205
|
+
}
|
|
206
|
+
constructor(cancelError) {
|
|
207
|
+
this._semaphore = new Semaphore(1, cancelError);
|
|
208
|
+
}
|
|
209
|
+
acquire() {
|
|
210
|
+
return __awaiter$1(this, arguments, void 0, function* (priority = 0) {
|
|
211
|
+
const [, releaser] = yield this._semaphore.acquire(1, priority);
|
|
212
|
+
return releaser;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
runExclusive(callback, priority = 0) {
|
|
216
|
+
return this._semaphore.runExclusive(() => callback(), 1, priority);
|
|
217
|
+
}
|
|
218
|
+
isLocked() {
|
|
219
|
+
return this._semaphore.isLocked();
|
|
220
|
+
}
|
|
221
|
+
waitForUnlock(priority = 0) {
|
|
222
|
+
return this._semaphore.waitForUnlock(1, priority);
|
|
223
|
+
}
|
|
224
|
+
release() {
|
|
225
|
+
if (this._semaphore.isLocked())
|
|
226
|
+
this._semaphore.release();
|
|
227
|
+
}
|
|
228
|
+
cancel() {
|
|
229
|
+
return this._semaphore.cancel();
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
233
|
+
function adopt(value) {
|
|
234
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
235
|
+
resolve(value);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
__name(adopt, "adopt");
|
|
239
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
240
|
+
function fulfilled(value) {
|
|
241
|
+
try {
|
|
242
|
+
step(generator.next(value));
|
|
243
|
+
} catch (e) {
|
|
244
|
+
reject(e);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
__name(fulfilled, "fulfilled");
|
|
248
|
+
function rejected(value) {
|
|
249
|
+
try {
|
|
250
|
+
step(generator["throw"](value));
|
|
251
|
+
} catch (e) {
|
|
252
|
+
reject(e);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
__name(rejected, "rejected");
|
|
256
|
+
function step(result) {
|
|
257
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
258
|
+
}
|
|
259
|
+
__name(step, "step");
|
|
260
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
function withTimeout(sync, timeout, timeoutError = E_TIMEOUT) {
|
|
264
|
+
return {
|
|
265
|
+
acquire: /* @__PURE__ */ __name((weightOrPriority, priority) => {
|
|
266
|
+
let weight;
|
|
267
|
+
if (isSemaphore(sync)) {
|
|
268
|
+
weight = weightOrPriority;
|
|
269
|
+
} else {
|
|
270
|
+
weight = void 0;
|
|
271
|
+
priority = weightOrPriority;
|
|
272
|
+
}
|
|
273
|
+
if (weight !== void 0 && weight <= 0) {
|
|
274
|
+
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
275
|
+
}
|
|
276
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
277
|
+
let isTimeout = false;
|
|
278
|
+
const handle = setTimeout(() => {
|
|
279
|
+
isTimeout = true;
|
|
280
|
+
reject(timeoutError);
|
|
281
|
+
}, timeout);
|
|
282
|
+
try {
|
|
283
|
+
const ticket = yield isSemaphore(sync) ? sync.acquire(weight, priority) : sync.acquire(priority);
|
|
284
|
+
if (isTimeout) {
|
|
285
|
+
const release = Array.isArray(ticket) ? ticket[1] : ticket;
|
|
286
|
+
release();
|
|
287
|
+
} else {
|
|
288
|
+
clearTimeout(handle);
|
|
289
|
+
resolve(ticket);
|
|
290
|
+
}
|
|
291
|
+
} catch (e) {
|
|
292
|
+
if (!isTimeout) {
|
|
293
|
+
clearTimeout(handle);
|
|
294
|
+
reject(e);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}));
|
|
298
|
+
}, "acquire"),
|
|
299
|
+
runExclusive(callback, weight, priority) {
|
|
300
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
301
|
+
let release = /* @__PURE__ */ __name(() => void 0, "release");
|
|
302
|
+
try {
|
|
303
|
+
const ticket = yield this.acquire(weight, priority);
|
|
304
|
+
if (Array.isArray(ticket)) {
|
|
305
|
+
release = ticket[1];
|
|
306
|
+
return yield callback(ticket[0]);
|
|
307
|
+
} else {
|
|
308
|
+
release = ticket;
|
|
309
|
+
return yield callback();
|
|
310
|
+
}
|
|
311
|
+
} finally {
|
|
312
|
+
release();
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
release(weight) {
|
|
317
|
+
sync.release(weight);
|
|
318
|
+
},
|
|
319
|
+
cancel() {
|
|
320
|
+
return sync.cancel();
|
|
321
|
+
},
|
|
322
|
+
waitForUnlock: /* @__PURE__ */ __name((weightOrPriority, priority) => {
|
|
323
|
+
let weight;
|
|
324
|
+
if (isSemaphore(sync)) {
|
|
325
|
+
weight = weightOrPriority;
|
|
326
|
+
} else {
|
|
327
|
+
weight = void 0;
|
|
328
|
+
priority = weightOrPriority;
|
|
329
|
+
}
|
|
330
|
+
if (weight !== void 0 && weight <= 0) {
|
|
331
|
+
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
332
|
+
}
|
|
333
|
+
return new Promise((resolve, reject) => {
|
|
334
|
+
const handle = setTimeout(() => reject(timeoutError), timeout);
|
|
335
|
+
(isSemaphore(sync) ? sync.waitForUnlock(weight, priority) : sync.waitForUnlock(priority)).then(() => {
|
|
336
|
+
clearTimeout(handle);
|
|
337
|
+
resolve();
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
}, "waitForUnlock"),
|
|
341
|
+
isLocked: /* @__PURE__ */ __name(() => sync.isLocked(), "isLocked"),
|
|
342
|
+
getValue: /* @__PURE__ */ __name(() => sync.getValue(), "getValue"),
|
|
343
|
+
setValue: /* @__PURE__ */ __name((value) => sync.setValue(value), "setValue")
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
__name(withTimeout, "withTimeout");
|
|
347
|
+
function isSemaphore(sync) {
|
|
348
|
+
return sync.getValue !== void 0;
|
|
349
|
+
}
|
|
350
|
+
__name(isSemaphore, "isSemaphore");
|
|
351
|
+
|
|
352
|
+
export {
|
|
353
|
+
E_TIMEOUT,
|
|
354
|
+
Mutex,
|
|
355
|
+
withTimeout
|
|
356
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
4
|
createTask
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZOFNJQNJ.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveActiveTeamName
|
|
8
8
|
} from "./chunk-LD2XBG6Z.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
BaseToolInvocation,
|
|
12
12
|
ToolDisplayNames,
|
|
13
13
|
ToolNames
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6WPY6ES3.js";
|
|
15
15
|
import {
|
|
16
16
|
init_esbuild_shims
|
|
17
17
|
} from "./chunk-A4BMJM77.js";
|