@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,178 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
Mutex
|
|
5
|
+
} from "./chunk-OMX7CUOE.js";
|
|
6
|
+
import {
|
|
7
|
+
atomicWriteJSON
|
|
8
|
+
} from "./chunk-LXYWINWF.js";
|
|
9
|
+
import {
|
|
10
|
+
Storage,
|
|
11
|
+
createDebugLogger,
|
|
12
|
+
getProjectHash
|
|
13
|
+
} from "./chunk-HA2UEYZP.js";
|
|
14
|
+
import {
|
|
15
|
+
init_esbuild_shims
|
|
16
|
+
} from "./chunk-A4BMJM77.js";
|
|
17
|
+
import {
|
|
18
|
+
__name
|
|
19
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
20
|
+
|
|
21
|
+
// packages/core/src/services/cronTasksFile.ts
|
|
22
|
+
init_esbuild_shims();
|
|
23
|
+
import * as fs from "node:fs/promises";
|
|
24
|
+
import * as path from "node:path";
|
|
25
|
+
var debugLogger = createDebugLogger("CRON_TASKS_FILE");
|
|
26
|
+
var TASKS_FILENAME = "scheduled_tasks.json";
|
|
27
|
+
var CRON_TASKS_DISPLAY_PATH = `~/.qwen/tmp/<project-hash>/${TASKS_FILENAME}`;
|
|
28
|
+
var UPDATE_LOCK_RETRY_MS = 15;
|
|
29
|
+
var UPDATE_LOCK_STALE_MS = 2e3;
|
|
30
|
+
var UPDATE_LOCK_TIMEOUT_MS = 3e3;
|
|
31
|
+
var updateStaleSeq = 0;
|
|
32
|
+
var updateMutexes = /* @__PURE__ */ new Map();
|
|
33
|
+
function getUpdateMutex(filePath) {
|
|
34
|
+
let mutex = updateMutexes.get(filePath);
|
|
35
|
+
if (!mutex) {
|
|
36
|
+
mutex = new Mutex();
|
|
37
|
+
updateMutexes.set(filePath, mutex);
|
|
38
|
+
}
|
|
39
|
+
return mutex;
|
|
40
|
+
}
|
|
41
|
+
__name(getUpdateMutex, "getUpdateMutex");
|
|
42
|
+
function getCronFilePath(projectRoot) {
|
|
43
|
+
return path.join(
|
|
44
|
+
Storage.getGlobalTempDir(),
|
|
45
|
+
getProjectHash(projectRoot),
|
|
46
|
+
TASKS_FILENAME
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
__name(getCronFilePath, "getCronFilePath");
|
|
50
|
+
async function readCronTasks(projectRoot) {
|
|
51
|
+
const filePath = getCronFilePath(projectRoot);
|
|
52
|
+
let raw;
|
|
53
|
+
try {
|
|
54
|
+
raw = await fs.readFile(filePath, "utf-8");
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (err.code === "ENOENT") return [];
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
let parsed;
|
|
60
|
+
try {
|
|
61
|
+
parsed = JSON.parse(raw);
|
|
62
|
+
} catch {
|
|
63
|
+
throw new Error(
|
|
64
|
+
`Malformed JSON in ${filePath} \u2014 fix or delete the file; refusing to treat it as an empty schedule.`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
if (!Array.isArray(parsed)) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Expected a JSON array in ${filePath} \u2014 fix or delete the file; refusing to treat it as an empty schedule.`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
const valid = parsed.filter(isValidTask);
|
|
73
|
+
if (valid.length !== parsed.length) {
|
|
74
|
+
debugLogger.warn(
|
|
75
|
+
`Dropped ${parsed.length - valid.length} invalid task entr${parsed.length - valid.length === 1 ? "y" : "ies"} from ${filePath}; a later write will persist without ${parsed.length - valid.length === 1 ? "it" : "them"}.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return valid;
|
|
79
|
+
}
|
|
80
|
+
__name(readCronTasks, "readCronTasks");
|
|
81
|
+
async function writeCronTasks(projectRoot, tasks) {
|
|
82
|
+
const filePath = getCronFilePath(projectRoot);
|
|
83
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
84
|
+
await atomicWriteJSON(filePath, tasks, { noFollow: true });
|
|
85
|
+
}
|
|
86
|
+
__name(writeCronTasks, "writeCronTasks");
|
|
87
|
+
async function acquireUpdateLock(filePath) {
|
|
88
|
+
const lockPath = `${filePath}.lock`;
|
|
89
|
+
await fs.mkdir(path.dirname(lockPath), { recursive: true });
|
|
90
|
+
const deadline = Date.now() + UPDATE_LOCK_TIMEOUT_MS;
|
|
91
|
+
for (; ; ) {
|
|
92
|
+
if (Date.now() > deadline) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`Timed out waiting for scheduled-tasks lock (${lockPath})`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
await fs.writeFile(lockPath, String(process.pid), { flag: "wx" });
|
|
99
|
+
return async () => {
|
|
100
|
+
await fs.unlink(lockPath).catch(() => {
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
} catch (err) {
|
|
104
|
+
if (err.code !== "EEXIST") throw err;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
const stat2 = await fs.stat(lockPath);
|
|
108
|
+
if (Date.now() - stat2.mtimeMs > UPDATE_LOCK_STALE_MS) {
|
|
109
|
+
const stalePath = `${lockPath}.stale.${process.pid}.${updateStaleSeq++}`;
|
|
110
|
+
try {
|
|
111
|
+
await fs.rename(lockPath, stalePath);
|
|
112
|
+
} catch {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const moved = await fs.stat(stalePath).catch(() => null);
|
|
116
|
+
if (moved && Date.now() - moved.mtimeMs <= UPDATE_LOCK_STALE_MS) {
|
|
117
|
+
await fs.link(stalePath, lockPath).catch(() => {
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
await fs.unlink(stalePath).catch(() => {
|
|
121
|
+
});
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
} catch {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
await new Promise((resolve) => setTimeout(resolve, UPDATE_LOCK_RETRY_MS));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
__name(acquireUpdateLock, "acquireUpdateLock");
|
|
131
|
+
async function updateCronTasks(projectRoot, mutate) {
|
|
132
|
+
const filePath = getCronFilePath(projectRoot);
|
|
133
|
+
return getUpdateMutex(filePath).runExclusive(async () => {
|
|
134
|
+
const release = await acquireUpdateLock(filePath);
|
|
135
|
+
try {
|
|
136
|
+
const tasks = await readCronTasks(projectRoot);
|
|
137
|
+
const next = mutate(tasks);
|
|
138
|
+
if (next !== tasks) {
|
|
139
|
+
await writeCronTasks(projectRoot, next);
|
|
140
|
+
}
|
|
141
|
+
} finally {
|
|
142
|
+
await release();
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
__name(updateCronTasks, "updateCronTasks");
|
|
147
|
+
async function addCronTask(projectRoot, task) {
|
|
148
|
+
await updateCronTasks(projectRoot, (tasks) => [...tasks, task]);
|
|
149
|
+
}
|
|
150
|
+
__name(addCronTask, "addCronTask");
|
|
151
|
+
async function removeCronTasks(projectRoot, ids) {
|
|
152
|
+
const idSet = new Set(ids);
|
|
153
|
+
const current = await readCronTasks(projectRoot);
|
|
154
|
+
if (!current.some((t) => idSet.has(t.id))) return 0;
|
|
155
|
+
let removed = 0;
|
|
156
|
+
await updateCronTasks(projectRoot, (tasks) => {
|
|
157
|
+
const remaining = tasks.filter((t) => !idSet.has(t.id));
|
|
158
|
+
removed = tasks.length - remaining.length;
|
|
159
|
+
return removed === 0 ? tasks : remaining;
|
|
160
|
+
});
|
|
161
|
+
return removed;
|
|
162
|
+
}
|
|
163
|
+
__name(removeCronTasks, "removeCronTasks");
|
|
164
|
+
function isValidTask(value) {
|
|
165
|
+
if (typeof value !== "object" || value === null) return false;
|
|
166
|
+
const obj = value;
|
|
167
|
+
return typeof obj["id"] === "string" && typeof obj["cron"] === "string" && typeof obj["prompt"] === "string" && typeof obj["recurring"] === "boolean" && typeof obj["createdAt"] === "number" && (obj["lastFiredAt"] === null || typeof obj["lastFiredAt"] === "number");
|
|
168
|
+
}
|
|
169
|
+
__name(isValidTask, "isValidTask");
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
CRON_TASKS_DISPLAY_PATH,
|
|
173
|
+
getCronFilePath,
|
|
174
|
+
readCronTasks,
|
|
175
|
+
updateCronTasks,
|
|
176
|
+
addCronTask,
|
|
177
|
+
removeCronTasks
|
|
178
|
+
};
|
|
@@ -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";
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-J2S4EL5Y.js";
|
|
12
12
|
|
|
13
|
+
// packages/core/src/tools/skill-utils.ts
|
|
14
|
+
init_esbuild_shims();
|
|
15
|
+
|
|
13
16
|
// packages/core/src/utils/xml.ts
|
|
14
17
|
init_esbuild_shims();
|
|
15
18
|
function escapeXml(text) {
|
|
@@ -85,6 +88,99 @@ function escapeSystemReminderTags(text) {
|
|
|
85
88
|
}
|
|
86
89
|
__name(escapeSystemReminderTags, "escapeSystemReminderTags");
|
|
87
90
|
|
|
91
|
+
// packages/core/src/tools/skill-utils.ts
|
|
92
|
+
function buildSkillLlmContent(baseDir, body) {
|
|
93
|
+
return `Base directory for this skill: ${baseDir}
|
|
94
|
+
Important: ALWAYS resolve absolute paths from this base directory when working with skills.
|
|
95
|
+
|
|
96
|
+
${body}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
__name(buildSkillLlmContent, "buildSkillLlmContent");
|
|
100
|
+
async function collectAvailableSkillEntries(skillManager, config) {
|
|
101
|
+
const allSkills = await skillManager.listSkills();
|
|
102
|
+
const disabledNames = config.getDisabledSkillNames();
|
|
103
|
+
const isDisabled = /* @__PURE__ */ __name((name) => disabledNames.has(name.toLowerCase()), "isDisabled");
|
|
104
|
+
const availableSkills = allSkills.filter(
|
|
105
|
+
(s) => !s.disableModelInvocation && skillManager.isSkillActive(s) && !isDisabled(s.name)
|
|
106
|
+
);
|
|
107
|
+
const pendingConditionalSkillNames = new Set(
|
|
108
|
+
allSkills.filter(
|
|
109
|
+
(s) => !s.disableModelInvocation && s.paths && s.paths.length > 0 && !skillManager.isSkillActive(s) && !isDisabled(s.name)
|
|
110
|
+
).map((s) => s.name)
|
|
111
|
+
);
|
|
112
|
+
const provider = config.getModelInvocableCommandsProvider();
|
|
113
|
+
const allCommands = provider ? provider() : [];
|
|
114
|
+
const fileBasedSkillNames = new Set(
|
|
115
|
+
allSkills.filter((s) => !s.disableModelInvocation && !isDisabled(s.name)).map((s) => s.name)
|
|
116
|
+
);
|
|
117
|
+
const modelInvocableCommands = allCommands.filter(
|
|
118
|
+
(cmd) => !fileBasedSkillNames.has(cmd.name)
|
|
119
|
+
);
|
|
120
|
+
const entries = [
|
|
121
|
+
...availableSkills.map((s) => ({
|
|
122
|
+
name: s.name,
|
|
123
|
+
description: s.description,
|
|
124
|
+
whenToUse: s.whenToUse,
|
|
125
|
+
level: s.level
|
|
126
|
+
})),
|
|
127
|
+
...modelInvocableCommands.map((c) => ({
|
|
128
|
+
name: c.name,
|
|
129
|
+
description: c.description
|
|
130
|
+
}))
|
|
131
|
+
];
|
|
132
|
+
return {
|
|
133
|
+
availableSkills,
|
|
134
|
+
pendingConditionalSkillNames,
|
|
135
|
+
modelInvocableCommands,
|
|
136
|
+
entries
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
__name(collectAvailableSkillEntries, "collectAvailableSkillEntries");
|
|
140
|
+
function compareSkillEntries(a, b) {
|
|
141
|
+
const aGroup = a.level !== void 0 ? 0 : 1;
|
|
142
|
+
const bGroup = b.level !== void 0 ? 0 : 1;
|
|
143
|
+
if (aGroup !== bGroup) return aGroup - bGroup;
|
|
144
|
+
return a.name.localeCompare(b.name);
|
|
145
|
+
}
|
|
146
|
+
__name(compareSkillEntries, "compareSkillEntries");
|
|
147
|
+
function renderAvailableSkillsBlock(entries) {
|
|
148
|
+
return [...entries].sort(compareSkillEntries).map((entry) => {
|
|
149
|
+
if (entry.level !== void 0) {
|
|
150
|
+
const descText = `${escapeXml(entry.description)}${entry.whenToUse ? ` \u2014 ${escapeXml(entry.whenToUse)}` : ""} (${entry.level})`;
|
|
151
|
+
return `<skill>
|
|
152
|
+
<name>
|
|
153
|
+
${escapeXml(entry.name)}
|
|
154
|
+
</name>
|
|
155
|
+
<description>
|
|
156
|
+
${descText}
|
|
157
|
+
</description>
|
|
158
|
+
<location>
|
|
159
|
+
${entry.level}
|
|
160
|
+
</location>
|
|
161
|
+
</skill>`;
|
|
162
|
+
}
|
|
163
|
+
return `<skill>
|
|
164
|
+
<name>
|
|
165
|
+
${escapeXml(entry.name)}
|
|
166
|
+
</name>
|
|
167
|
+
<description>
|
|
168
|
+
${escapeXml(entry.description)}
|
|
169
|
+
</description>
|
|
170
|
+
</skill>`;
|
|
171
|
+
}).join("\n");
|
|
172
|
+
}
|
|
173
|
+
__name(renderAvailableSkillsBlock, "renderAvailableSkillsBlock");
|
|
174
|
+
function applySkillAllowedTools(permissionManager, allowedTools) {
|
|
175
|
+
if (!permissionManager || !allowedTools?.length) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
for (const rule of allowedTools) {
|
|
179
|
+
permissionManager.addSessionAllowRule(rule);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
__name(applySkillAllowedTools, "applySkillAllowedTools");
|
|
183
|
+
|
|
88
184
|
// packages/core/src/hooks/registerSkillHooks.ts
|
|
89
185
|
init_esbuild_shims();
|
|
90
186
|
var debugLogger = createDebugLogger("SKILL_HOOKS");
|
|
@@ -147,32 +243,14 @@ function prepareHookConfig(hook, skillRoot) {
|
|
|
147
243
|
}
|
|
148
244
|
__name(prepareHookConfig, "prepareHookConfig");
|
|
149
245
|
|
|
150
|
-
// packages/core/src/tools/skill-utils.ts
|
|
151
|
-
init_esbuild_shims();
|
|
152
|
-
function buildSkillLlmContent(baseDir, body) {
|
|
153
|
-
return `Base directory for this skill: ${baseDir}
|
|
154
|
-
Important: ALWAYS resolve absolute paths from this base directory when working with skills.
|
|
155
|
-
|
|
156
|
-
${body}
|
|
157
|
-
`;
|
|
158
|
-
}
|
|
159
|
-
__name(buildSkillLlmContent, "buildSkillLlmContent");
|
|
160
|
-
function applySkillAllowedTools(permissionManager, allowedTools) {
|
|
161
|
-
if (!permissionManager || !allowedTools?.length) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
for (const rule of allowedTools) {
|
|
165
|
-
permissionManager.addSessionAllowRule(rule);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
__name(applySkillAllowedTools, "applySkillAllowedTools");
|
|
169
|
-
|
|
170
246
|
export {
|
|
171
247
|
escapeXml,
|
|
172
248
|
escapeSystemReminderTags,
|
|
173
|
-
registerSkillHooks,
|
|
174
249
|
buildSkillLlmContent,
|
|
175
|
-
|
|
250
|
+
collectAvailableSkillEntries,
|
|
251
|
+
renderAvailableSkillsBlock,
|
|
252
|
+
applySkillAllowedTools,
|
|
253
|
+
registerSkillHooks
|
|
176
254
|
};
|
|
177
255
|
/**
|
|
178
256
|
* @license
|