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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/bundled/loop/SKILL.md +2 -1
  2. package/bundled/qc-helper/docs/_meta.ts +1 -0
  3. package/bundled/qc-helper/docs/configuration/auth.md +1 -1
  4. package/bundled/qc-helper/docs/configuration/model-providers.md +12 -5
  5. package/bundled/qc-helper/docs/configuration/settings.md +33 -32
  6. package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
  7. package/bundled/qc-helper/docs/features/commands.md +33 -11
  8. package/bundled/qc-helper/docs/features/dual-output.md +37 -3
  9. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  10. package/bundled/qc-helper/docs/features/skills.md +29 -3
  11. package/bundled/qc-helper/docs/features/sub-agents.md +34 -12
  12. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  13. package/bundled/qc-helper/docs/qwen-serve.md +246 -28
  14. package/chunks/{agent-QB7TZ4HW.js → agent-XT7NHZ5H.js} +25 -24
  15. package/chunks/agent-headless-LNRE63ZL.js +51 -0
  16. package/chunks/{anthropicContentGenerator-M45EVVRM.js → anthropicContentGenerator-DCI26OQF.js} +7 -7
  17. package/chunks/{askUserQuestion-WM2KHM3K.js → askUserQuestion-ITYUTWLR.js} +45 -3
  18. package/chunks/{ca-BARBRL6N.js → ca-RK4QPLIX.js} +18 -1
  19. package/chunks/{chunk-CWV3SJZS.js → chunk-3NRO6NHX.js} +2 -2
  20. package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
  21. package/chunks/{chunk-QCG6KPNM.js → chunk-6T7Y7USE.js} +18017 -11621
  22. package/chunks/{chunk-CNHFPN7T.js → chunk-7KPZFE5A.js} +1 -1
  23. package/chunks/{chunk-2ZTWI7KH.js → chunk-A2ZIEEGJ.js} +30 -22
  24. package/chunks/{chunk-JUGRPQAB.js → chunk-B4ZF2KSI.js} +1 -1
  25. package/chunks/chunk-BJ5HQ23U.js +178 -0
  26. package/chunks/{chunk-HXJE7VOG.js → chunk-BXYRCW2C.js} +1074 -144
  27. package/chunks/{chunk-ICOI4E4S.js → chunk-CPVI5J2L.js} +101 -23
  28. package/chunks/{chunk-HV3ZZ7G4.js → chunk-DHZREJTG.js} +2 -2
  29. package/chunks/{chunk-GX7VH5JQ.js → chunk-FIQECJTQ.js} +1 -1
  30. package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
  31. package/chunks/{chunk-JXAZUMDW.js → chunk-HA2UEYZP.js} +7 -4
  32. package/chunks/{chunk-USE2VQ5P.js → chunk-HED55F43.js} +26 -1
  33. package/chunks/{chunk-PAEBHDIO.js → chunk-HQUWWSSP.js} +1 -1
  34. package/chunks/{chunk-MVIVIPCU.js → chunk-IDYDPBBN.js} +361 -583
  35. package/chunks/{chunk-JVQOQ3OU.js → chunk-IQHSD7K5.js} +1 -1
  36. package/chunks/{chunk-NW5QBUYO.js → chunk-IS7UA4W3.js} +14 -14
  37. package/chunks/{chunk-UAMOBVVW.js → chunk-LXYWINWF.js} +1 -1
  38. package/chunks/{chunk-P4J26VDS.js → chunk-LYRSMKLS.js} +2 -2
  39. package/chunks/{chunk-Y7R6H6FT.js → chunk-LYSND7KR.js} +9 -4
  40. package/chunks/{chunk-LR62TEET.js → chunk-NNIYWQIS.js} +1 -1
  41. package/chunks/chunk-OMX7CUOE.js +356 -0
  42. package/chunks/{chunk-CNSMKPK6.js → chunk-QILTEBWS.js} +1 -1
  43. package/chunks/chunk-QQDPRDVW.js +25 -0
  44. package/chunks/{chunk-ZK4AMNIU.js → chunk-RON7LFNH.js} +1294 -314
  45. package/chunks/chunk-SFRV6BGY.js +243 -0
  46. package/chunks/{chunk-AVW55ZCO.js → chunk-WJ3SND6W.js} +37 -16
  47. package/chunks/{chunk-HGJPQK33.js → chunk-WPTCDQN6.js} +188 -534
  48. package/chunks/{chunk-7YKXFA3D.js → chunk-XZTNBSMW.js} +11 -11
  49. package/chunks/{chunk-C6WMLUNB.js → chunk-Y7KMDUEP.js} +1 -1
  50. package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
  51. package/chunks/{chunk-KC6ZMJ5X.js → chunk-ZMIBJS45.js} +1 -1
  52. package/chunks/chunk-ZOFNJQNJ.js +607 -0
  53. package/chunks/computer-use-4YX3JGBV.js +2052 -0
  54. package/chunks/contextCommand-KS2H7MW5.js +53 -0
  55. package/chunks/cron-create-CAPUKK7I.js +184 -0
  56. package/chunks/{cron-delete-ZGUXWBTG.js → cron-delete-G3KAR26Q.js} +28 -5
  57. package/chunks/{cron-list-QNNZGMN3.js → cron-list-ZA4ZIUS5.js} +40 -7
  58. package/chunks/{de-YGKK2BC4.js → de-FGPM4KW5.js} +18 -1
  59. package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
  60. package/chunks/{dist-ZMQ4TXD5.js → dist-7YWFWOCJ.js} +2 -2
  61. package/chunks/{dist-R2SXPG74.js → dist-VEGFONCF.js} +2 -2
  62. package/chunks/{dist-TE5QKMGR.js → dist-X4EXN7W6.js} +1 -1
  63. package/chunks/{dist-BXDUQ2QY.js → dist-YLS6NI7H.js} +1 -1
  64. package/chunks/{edit-6UBTS2J5.js → edit-2ARPEO4B.js} +26 -25
  65. package/chunks/{en-HSQQNQUB.js → en-VP6XPGEC.js} +9 -2
  66. package/chunks/{enter-worktree-NN7LIXCM.js → enter-worktree-IXNXNAW5.js} +25 -24
  67. package/chunks/enterPlanMode-TAKAGAYP.js +159 -0
  68. package/chunks/{exit-worktree-GGSS5KIE.js → exit-worktree-LHTRV7ML.js} +25 -24
  69. package/chunks/exitPlanMode-MK5UAITL.js +743 -0
  70. package/chunks/{fr-JXBKPJKQ.js → fr-ATYBVCLT.js} +18 -1
  71. package/chunks/{geminiContentGenerator-I4H2NLJG.js → geminiContentGenerator-HFJIGO77.js} +7 -7
  72. package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
  73. package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
  74. package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
  75. package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
  76. package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
  77. package/chunks/{glob-OLCX57MD.js → glob-I2USLUSC.js} +25 -24
  78. package/chunks/{grep-7HXIMDOW.js → grep-WBIF7THR.js} +37 -30
  79. package/chunks/{ja-TGPZSP2B.js → ja-W2QEA2OI.js} +18 -1
  80. package/chunks/{keychain-token-storage-LB46DAEK.js → keychain-token-storage-QSTRHKKL.js} +3 -3
  81. package/chunks/{ls-6PEZUK6O.js → ls-2R5RHLX5.js} +4 -4
  82. package/chunks/{lsp-JZSJOVT7.js → lsp-XKH6ZIAN.js} +3 -3
  83. package/chunks/{monitor-SQO7MVAV.js → monitor-WU7UFATU.js} +25 -24
  84. package/chunks/{notebook-edit-72L3EBAL.js → notebook-edit-KUHYPXEM.js} +26 -25
  85. package/chunks/{openaiContentGenerator-FTR7CDWF.js → openaiContentGenerator-5PLHYJQL.js} +15 -15
  86. package/chunks/{pt-TIBG6BIO.js → pt-ZKEWJFBW.js} +18 -1
  87. package/chunks/{qwenContentGenerator-U5UFQ566.js → qwenContentGenerator-TSKW73KY.js} +27 -26
  88. package/chunks/{qwenOAuth2-EFSECGHF.js → qwenOAuth2-KK433U33.js} +6 -5
  89. package/chunks/{read-file-UA64EEQC.js → read-file-VIPF2PS6.js} +11 -11
  90. package/chunks/ripGrep-XLIZTYE7.js +49 -0
  91. package/chunks/{ru-JBCHCK4L.js → ru-VEKTPJ74.js} +18 -1
  92. package/chunks/{scheduler-VBASHOCA.js → scheduler-O66SLJGU.js} +25 -24
  93. package/chunks/{send-message-OYJZ5TPG.js → send-message-CTME7DXD.js} +3 -3
  94. package/chunks/{serve-A7E2OJDR.js → serve-BWOLYT62.js} +13164 -3840
  95. package/chunks/{shell-3NFOT6F5.js → shell-XE7UYKOO.js} +25 -24
  96. package/chunks/{skill-RA5YUREY.js → skill-RZWM6XMC.js} +64 -113
  97. package/chunks/{src-NFCMARMT.js → src-L5P7K4MH.js} +176 -44
  98. package/chunks/{syntheticOutput-DETQ2YM6.js → syntheticOutput-ZJGSU7OQ.js} +4 -4
  99. package/chunks/{task-create-Y3ZKTJIG.js → task-create-EE6JEM7G.js} +8 -7
  100. package/chunks/{task-list-ONXJ3I3A.js → task-list-EESYAC65.js} +7 -6
  101. package/chunks/{task-stop-UHDC4N5B.js → task-stop-XZVCFFYY.js} +3 -3
  102. package/chunks/{task-update-TCNOU3P5.js → task-update-EIO4HNE3.js} +21 -9
  103. package/chunks/{team-create-6SR4OVRG.js → team-create-R2H7Y3SG.js} +28 -26
  104. package/chunks/{team-delete-EJ4U4DDP.js → team-delete-A7LXPGV7.js} +9 -6
  105. package/chunks/{todoWrite-TEYDRS5L.js → todoWrite-VRKSGAWM.js} +5 -5
  106. package/chunks/{tool-search-OD435A3X.js → tool-search-USSQMTMS.js} +11 -11
  107. package/chunks/{web-fetch-6W67H5PO.js → web-fetch-GHAZUA54.js} +5 -5
  108. package/chunks/workflow-5LNNLNUR.js +1414 -0
  109. package/chunks/{write-file-475L5OPP.js → write-file-2I7HP24C.js} +26 -25
  110. package/chunks/{zh-VCLWO26Y.js → zh-OIXDDQHB.js} +10 -3
  111. package/chunks/{zh-TW-G3HFHVVT.js → zh-TW-6YFNCKTA.js} +10 -3
  112. package/cli-entry.js +19 -0
  113. package/cli.js +11064 -6628
  114. package/examples/starter/QWEN.md +30 -0
  115. package/examples/starter/README.md +59 -0
  116. package/examples/starter/agents/diary.md +86 -0
  117. package/examples/starter/commands/writing/polish.md +13 -0
  118. package/examples/starter/example.ts +64 -0
  119. package/examples/starter/package.json +18 -0
  120. package/examples/starter/qwen-extension.json +12 -0
  121. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  122. package/examples/starter/tsconfig.json +13 -0
  123. package/fzfWorker.js +1083 -0
  124. package/locales/ca.js +20 -2
  125. package/locales/de.js +21 -2
  126. package/locales/en.js +13 -4
  127. package/locales/fr.js +22 -2
  128. package/locales/ja.js +22 -2
  129. package/locales/pt.js +21 -2
  130. package/locales/ru.js +20 -2
  131. package/locales/zh-TW.js +11 -4
  132. package/locales/zh.js +11 -4
  133. package/package.json +5 -3
  134. package/chunks/agent-headless-APVHH7QM.js +0 -50
  135. package/chunks/chunk-AJIR24J2.js +0 -59
  136. package/chunks/chunk-SKBPNJEW.js +0 -45
  137. package/chunks/chunk-XBFVXFB2.js +0 -216
  138. package/chunks/computer-use-B7VIUI7F.js +0 -825
  139. package/chunks/contextCommand-63RZ3O5R.js +0 -52
  140. package/chunks/cron-create-FI5LJVUS.js +0 -140
  141. package/chunks/exitPlanMode-H323NHB2.js +0 -235
  142. package/chunks/ripGrep-WSYCWZVK.js +0 -48
  143. package/chunks/workflow-62DHH4EO.js +0 -708
@@ -7,43 +7,44 @@ import {
7
7
  buildLongRunningForegroundHint,
8
8
  detectBlockedSleepPattern,
9
9
  parseNumstat
10
- } from "./chunk-QCG6KPNM.js";
10
+ } from "./chunk-6T7Y7USE.js";
11
11
  import "./chunk-K5PGHDBN.js";
12
- import "./chunk-SKBPNJEW.js";
12
+ import "./chunk-HQUWWSSP.js";
13
13
  import "./chunk-O4PICXES.js";
14
14
  import "./chunk-TW522KN6.js";
15
- import "./chunk-AJIR24J2.js";
16
- import "./chunk-HGJPQK33.js";
17
- import "./chunk-XBFVXFB2.js";
15
+ import "./chunk-BJ5HQ23U.js";
16
+ import "./chunk-SFRV6BGY.js";
17
+ import "./chunk-ZOFNJQNJ.js";
18
+ import "./chunk-WPTCDQN6.js";
19
+ import "./chunk-OMX7CUOE.js";
18
20
  import "./chunk-MLZQVCF3.js";
19
- import "./chunk-PAEBHDIO.js";
20
21
  import "./chunk-LD2XBG6Z.js";
21
- import "./chunk-ICOI4E4S.js";
22
- import "./chunk-KC6ZMJ5X.js";
22
+ import "./chunk-CPVI5J2L.js";
23
+ import "./chunk-ZMIBJS45.js";
23
24
  import "./chunk-77WXWU44.js";
24
- import "./chunk-JUGRPQAB.js";
25
- import "./chunk-64WXLC72.js";
26
- import "./chunk-ZK4AMNIU.js";
25
+ import "./chunk-B4ZF2KSI.js";
26
+ import "./chunk-RON7LFNH.js";
27
27
  import "./chunk-3PJXIDKI.js";
28
28
  import "./chunk-UWCTAVOD.js";
29
29
  import "./chunk-OFEVLU4C.js";
30
- import "./chunk-JVQOQ3OU.js";
31
- import "./chunk-P4J26VDS.js";
32
- import "./chunk-CNSMKPK6.js";
33
- import "./chunk-2ZTWI7KH.js";
34
- import "./chunk-MVIVIPCU.js";
35
- import "./chunk-GX7VH5JQ.js";
36
- import "./chunk-UAMOBVVW.js";
37
- import "./chunk-LR62TEET.js";
38
- import "./chunk-Y7R6H6FT.js";
39
- import "./chunk-BNESGOSJ.js";
40
- import "./chunk-SZOEIL6S.js";
30
+ import "./chunk-IQHSD7K5.js";
31
+ import "./chunk-LYRSMKLS.js";
32
+ import "./chunk-QILTEBWS.js";
33
+ import "./chunk-A2ZIEEGJ.js";
34
+ import "./chunk-IDYDPBBN.js";
35
+ import "./chunk-FIQECJTQ.js";
36
+ import "./chunk-64WXLC72.js";
37
+ import "./chunk-LXYWINWF.js";
38
+ import "./chunk-NNIYWQIS.js";
39
+ import "./chunk-LYSND7KR.js";
40
+ import "./chunk-55ZMG67I.js";
41
+ import "./chunk-H6BD2ELD.js";
41
42
  import "./chunk-5IFG2VC4.js";
42
- import "./chunk-JXAZUMDW.js";
43
+ import "./chunk-HA2UEYZP.js";
43
44
  import "./chunk-ZERZSAZL.js";
44
45
  import "./chunk-QN5NZ3UQ.js";
45
46
  import "./chunk-BR4QREVK.js";
46
- import "./chunk-WFVXF3OM.js";
47
+ import "./chunk-Z2Z3GUXZ.js";
47
48
  import "./chunk-A4BMJM77.js";
48
49
  import "./chunk-J2S4EL5Y.js";
49
50
  export {
@@ -3,38 +3,38 @@
3
3
  import {
4
4
  applySkillAllowedTools,
5
5
  buildSkillLlmContent,
6
- escapeXml,
6
+ collectAvailableSkillEntries,
7
7
  registerSkillHooks
8
- } from "./chunk-ICOI4E4S.js";
9
- import "./chunk-KC6ZMJ5X.js";
8
+ } from "./chunk-CPVI5J2L.js";
9
+ import "./chunk-ZMIBJS45.js";
10
10
  import {
11
11
  SkillLaunchEvent,
12
12
  logSkillLaunch
13
- } from "./chunk-ZK4AMNIU.js";
13
+ } from "./chunk-RON7LFNH.js";
14
14
  import "./chunk-3PJXIDKI.js";
15
15
  import "./chunk-UWCTAVOD.js";
16
16
  import "./chunk-OFEVLU4C.js";
17
- import "./chunk-JVQOQ3OU.js";
18
- import "./chunk-P4J26VDS.js";
19
- import "./chunk-CNSMKPK6.js";
17
+ import "./chunk-IQHSD7K5.js";
18
+ import "./chunk-LYRSMKLS.js";
19
+ import "./chunk-QILTEBWS.js";
20
20
  import {
21
21
  BaseDeclarativeTool,
22
22
  BaseToolInvocation,
23
23
  ToolDisplayNames,
24
24
  ToolNames
25
- } from "./chunk-2ZTWI7KH.js";
26
- import "./chunk-UAMOBVVW.js";
27
- import "./chunk-Y7R6H6FT.js";
28
- import "./chunk-BNESGOSJ.js";
29
- import "./chunk-SZOEIL6S.js";
25
+ } from "./chunk-A2ZIEEGJ.js";
26
+ import "./chunk-LXYWINWF.js";
27
+ import "./chunk-LYSND7KR.js";
28
+ import "./chunk-55ZMG67I.js";
29
+ import "./chunk-H6BD2ELD.js";
30
30
  import "./chunk-5IFG2VC4.js";
31
31
  import {
32
32
  createDebugLogger
33
- } from "./chunk-JXAZUMDW.js";
33
+ } from "./chunk-HA2UEYZP.js";
34
34
  import "./chunk-ZERZSAZL.js";
35
35
  import "./chunk-QN5NZ3UQ.js";
36
36
  import "./chunk-BR4QREVK.js";
37
- import "./chunk-WFVXF3OM.js";
37
+ import "./chunk-Z2Z3GUXZ.js";
38
38
  import {
39
39
  init_esbuild_shims
40
40
  } from "./chunk-A4BMJM77.js";
@@ -46,6 +46,31 @@ import {
46
46
  init_esbuild_shims();
47
47
  import path from "path";
48
48
  var debugLogger = createDebugLogger("SKILL");
49
+ var SKILL_TOOL_DESCRIPTION = `Execute a skill within the main conversation
50
+
51
+ <skills_instructions>
52
+ When users ask you to perform tasks, check if any of the available skills can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
53
+
54
+ How to invoke:
55
+ - Use this tool with the skill name only (no arguments)
56
+ - Examples:
57
+ - \`skill: "pdf"\` - invoke the pdf skill
58
+ - \`skill: "xlsx"\` - invoke the xlsx skill
59
+ - \`skill: "ms-office-suite:pdf"\` - invoke using fully qualified name
60
+ - \`skill: "mcp-prompt", args: "topic"\` - invoke a model-invocable command with arguments
61
+
62
+ Important:
63
+ - Available skills are listed in <system-reminder> messages in the conversation; only use skills listed there.
64
+ - When a skill is relevant, you must invoke this tool IMMEDIATELY as your first action
65
+ - NEVER just announce or mention a skill in your text response without actually calling this tool
66
+ - This is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task
67
+ - Do not invoke a skill that is already running
68
+ - Do not use this tool for built-in CLI commands (like /help, /clear, etc.)
69
+ - When executing scripts or loading referenced files, ALWAYS resolve absolute paths from skill's base directory. Examples:
70
+ - \`bash scripts/init.sh\` -> \`bash /path/to/skill/scripts/init.sh\`
71
+ - \`python scripts/helper.py\` -> \`python /path/to/skill/scripts/helper.py\`
72
+ - \`reference.md\` -> \`/path/to/skill/reference.md\`
73
+ </skills_instructions>`;
49
74
  var SkillTool = class _SkillTool extends BaseDeclarativeTool {
50
75
  constructor(config) {
51
76
  const initialSchema = {
@@ -67,8 +92,8 @@ var SkillTool = class _SkillTool extends BaseDeclarativeTool {
67
92
  super(
68
93
  _SkillTool.Name,
69
94
  ToolDisplayNames.SKILL,
70
- "Execute a skill within the main conversation. Loading available skills...",
71
- // Initial description
95
+ SKILL_TOOL_DESCRIPTION,
96
+ // Static; live skill list is injected via system-reminders.
72
97
  "read" /* Read */,
73
98
  initialSchema,
74
99
  false,
@@ -105,115 +130,41 @@ var SkillTool = class _SkillTool extends BaseDeclarativeTool {
105
130
  // SkillTool instances (subagents share the parent's SkillManager) can
106
131
  // detach their listener at teardown — without this the SkillManager
107
132
  // accumulates listeners across subagent lifetimes, and each path
108
- // activation would serialize through every stale listener's
109
- // refreshSkills / setTools round-trip.
133
+ // activation would serialize through every stale listener's refreshSkills run.
110
134
  removeChangeListener;
111
135
  /**
112
- * Asynchronously initializes the tool by loading available skills
113
- * and updating the description and schema.
136
+ * Refreshes the in-memory runtime sets `availableSkills`,
137
+ * `pendingConditionalSkillNames`, `modelInvocableCommands` that back
138
+ * `validateToolParams` / `execute`. Invoked on construction and whenever the
139
+ * SkillManager fires a change (skill-file edit, conditional activation, config
140
+ * toggle, or MCP-prompt provider change).
141
+ *
142
+ * It deliberately does NOT mutate the tool declaration or call
143
+ * `geminiClient.setTools()`. The Skill tool's description is static
144
+ * (`SKILL_TOOL_DESCRIPTION`), so the skill set no longer affects the tools
145
+ * block — and the tools block is the front of the tools → system → messages
146
+ * prompt-cache prefix, where any byte change invalidates the whole cached
147
+ * prefix. These runtime sets are in-memory only and never serialized into a
148
+ * request, so refreshing them is prompt-cache-neutral. The model's view of the
149
+ * available skills comes from the `<available_skills>` snapshot in the startup
150
+ * prelude plus per-turn `<system-reminder>` deltas.
114
151
  */
115
152
  async refreshSkills() {
116
153
  try {
117
- const allSkills = await this.skillManager.listSkills();
118
- const disabledNames = this.config.getDisabledSkillNames();
119
- const isDisabled = /* @__PURE__ */ __name((name) => disabledNames.has(name.toLowerCase()), "isDisabled");
120
- this.availableSkills = allSkills.filter(
121
- (s) => !s.disableModelInvocation && this.skillManager.isSkillActive(s) && !isDisabled(s.name)
154
+ const collected = await collectAvailableSkillEntries(
155
+ this.skillManager,
156
+ this.config
122
157
  );
123
- this.pendingConditionalSkillNames = new Set(
124
- allSkills.filter(
125
- (s) => !s.disableModelInvocation && s.paths && s.paths.length > 0 && !this.skillManager.isSkillActive(s) && !isDisabled(s.name)
126
- ).map((s) => s.name)
127
- );
128
- const provider = this.config.getModelInvocableCommandsProvider();
129
- const allCommands = provider ? provider() : [];
130
- const fileBasedSkillNames = new Set(
131
- allSkills.filter((s) => !s.disableModelInvocation && !isDisabled(s.name)).map((s) => s.name)
132
- );
133
- this.modelInvocableCommands = allCommands.filter(
134
- (cmd) => !fileBasedSkillNames.has(cmd.name)
135
- );
136
- this.updateDescriptionAndSchema();
158
+ this.availableSkills = collected.availableSkills;
159
+ this.pendingConditionalSkillNames = collected.pendingConditionalSkillNames;
160
+ this.modelInvocableCommands = collected.modelInvocableCommands;
137
161
  } catch (error) {
138
162
  debugLogger.warn("Failed to load skills for Skills tool:", error);
139
163
  this.availableSkills = [];
140
164
  this.pendingConditionalSkillNames = /* @__PURE__ */ new Set();
141
165
  this.modelInvocableCommands = [];
142
- this.updateDescriptionAndSchema();
143
- } finally {
144
- const geminiClient = this.config.getGeminiClient();
145
- if (geminiClient) {
146
- await geminiClient.setTools();
147
- }
148
166
  }
149
167
  }
150
- /**
151
- * Updates the tool's description and schema based on available skills and
152
- * model-invocable commands (e.g. bundled skills, file commands, MCP prompts).
153
- */
154
- updateDescriptionAndSchema() {
155
- const allSkillEntries = [];
156
- for (const skill of this.availableSkills) {
157
- const descText = `${escapeXml(skill.description)}${skill.whenToUse ? ` \u2014 ${escapeXml(skill.whenToUse)}` : ""} (${skill.level})`;
158
- allSkillEntries.push(`<skill>
159
- <name>
160
- ${escapeXml(skill.name)}
161
- </name>
162
- <description>
163
- ${descText}
164
- </description>
165
- <location>
166
- ${skill.level}
167
- </location>
168
- </skill>`);
169
- }
170
- for (const cmd of this.modelInvocableCommands) {
171
- allSkillEntries.push(`<skill>
172
- <name>
173
- ${escapeXml(cmd.name)}
174
- </name>
175
- <description>
176
- ${escapeXml(cmd.description)}
177
- </description>
178
- </skill>`);
179
- }
180
- let skillDescriptions = "";
181
- if (allSkillEntries.length === 0) {
182
- skillDescriptions = "No skills are currently configured. Skills can be created by adding directories with SKILL.md files to .qwen/skills/ or ~/.qwen/skills/.";
183
- } else {
184
- skillDescriptions = allSkillEntries.join("\n");
185
- }
186
- const baseDescription = `Execute a skill within the main conversation
187
-
188
- <skills_instructions>
189
- When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
190
-
191
- How to invoke:
192
- - Use this tool with the skill name only (no arguments)
193
- - Examples:
194
- - \`skill: "pdf"\` - invoke the pdf skill
195
- - \`skill: "xlsx"\` - invoke the xlsx skill
196
- - \`skill: "ms-office-suite:pdf"\` - invoke using fully qualified name
197
- - \`skill: "mcp-prompt", args: "topic"\` - invoke a model-invocable command with arguments
198
-
199
- Important:
200
- - When a skill is relevant, you must invoke this tool IMMEDIATELY as your first action
201
- - NEVER just announce or mention a skill in your text response without actually calling this tool
202
- - This is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task
203
- - Only use skills listed in <available_skills> below
204
- - Do not invoke a skill that is already running
205
- - Do not use this tool for built-in CLI commands (like /help, /clear, etc.)
206
- - When executing scripts or loading referenced files, ALWAYS resolve absolute paths from skill's base directory. Examples:
207
- - \`bash scripts/init.sh\` -> \`bash /path/to/skill/scripts/init.sh\`
208
- - \`python scripts/helper.py\` -> \`python /path/to/skill/scripts/helper.py\`
209
- - \`reference.md\` -> \`/path/to/skill/reference.md\`
210
- </skills_instructions>
211
-
212
- <available_skills>
213
- ${skillDescriptions}
214
- </available_skills>`;
215
- this.description = baseDescription;
216
- }
217
168
  validateToolParams(params) {
218
169
  if (!params.skill || typeof params.skill !== "string" || params.skill.trim() === "") {
219
170
  return 'Parameter "skill" must be a non-empty string.';
@@ -282,7 +233,7 @@ ${skillDescriptions}
282
233
  * SkillManager would accumulate one stale listener per subagent
283
234
  * lifetime — and `notifyChangeListeners` is now `await`-ed
284
235
  * sequentially, so each path activation would serialize through every
285
- * accumulated listener's refreshSkills + setTools round-trip.
236
+ * accumulated listener's refreshSkills run.
286
237
  */
287
238
  dispose() {
288
239
  this.removeChangeListener();