@mmmbuto/qwen-code-termux 0.16.1-termux → 0.18.0-termux

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 (185) hide show
  1. package/README.md +79 -109
  2. package/bundled/new-app/SKILL.md +22 -0
  3. package/bundled/qc-helper/SKILL.md +29 -24
  4. package/bundled/qc-helper/docs/_meta.ts +1 -0
  5. package/bundled/qc-helper/docs/configuration/_meta.ts +0 -3
  6. package/bundled/qc-helper/docs/configuration/settings.md +37 -31
  7. package/bundled/qc-helper/docs/configuration/themes.md +39 -0
  8. package/bundled/qc-helper/docs/features/_meta.ts +1 -3
  9. package/bundled/qc-helper/docs/features/approval-mode.md +35 -35
  10. package/bundled/qc-helper/docs/features/auto-mode.md +54 -9
  11. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  12. package/bundled/qc-helper/docs/features/channels/feishu.md +170 -0
  13. package/bundled/qc-helper/docs/features/commands.md +115 -35
  14. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  15. package/bundled/qc-helper/docs/features/headless.md +32 -0
  16. package/bundled/qc-helper/docs/features/markdown-rendering.md +21 -1
  17. package/bundled/qc-helper/docs/features/memory.md +22 -5
  18. package/bundled/qc-helper/docs/features/scheduled-tasks.md +1 -1
  19. package/bundled/qc-helper/docs/features/status-line.md +168 -32
  20. package/bundled/qc-helper/docs/features/sub-agents.md +60 -0
  21. package/bundled/qc-helper/docs/features/worktree.md +345 -0
  22. package/bundled/qc-helper/docs/overview.md +4 -4
  23. package/bundled/qc-helper/docs/quickstart.md +4 -4
  24. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  25. package/bundled/qc-helper/docs/qwen-serve.md +234 -24
  26. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +16 -0
  27. package/bundled/qc-helper/docs/support/Uninstall.md +19 -1
  28. package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
  29. package/bundled/simplify/SKILL.md +123 -0
  30. package/chunks/agent-IDS4HMOX.js +56 -0
  31. package/chunks/agent-headless-5Q2EUSPS.js +50 -0
  32. package/chunks/{anthropicContentGenerator-SSGKR6DO.js → anthropicContentGenerator-2HBRNQ3B.js} +52 -9
  33. package/chunks/{askUserQuestion-PJWUUXKN.js → askUserQuestion-75TDJVK2.js} +45 -3
  34. package/chunks/{ca-UZ7BANMN.js → ca-BARBRL6N.js} +89 -5
  35. package/chunks/{chunk-GGNTZ2NH.js → chunk-2Y5SYSD3.js} +368 -597
  36. package/chunks/{chunk-2LA2TREA.js → chunk-3AA2DK35.js} +1448 -207
  37. package/chunks/{chunk-I2V5WXHJ.js → chunk-3AUHFMSK.js} +80 -38
  38. package/chunks/chunk-3DHXZ6EV.js +241 -0
  39. package/chunks/{chunk-PR4T27R7.js → chunk-3HTIVKZE.js} +42 -8
  40. package/chunks/chunk-3HX5LZ6R.js +1798 -0
  41. package/chunks/chunk-3PJXIDKI.js +2517 -0
  42. package/chunks/{chunk-MYAKAFEC.js → chunk-55ZMG67I.js} +7451 -3517
  43. package/chunks/{chunk-66CXYE4B.js → chunk-5IFG2VC4.js} +293 -242
  44. package/chunks/chunk-64WXLC72.js +98 -0
  45. package/chunks/{chunk-C6WMLUNB.js → chunk-72LDN5PP.js} +1 -1
  46. package/chunks/{chunk-F23NCRJ2.js → chunk-A7B4ISQP.js} +1 -1
  47. package/chunks/chunk-B7HXHOHU.js +393 -0
  48. package/chunks/{chunk-XEGHDASV.js → chunk-D3RHSPAS.js} +435 -540
  49. package/chunks/{chunk-XKS5KBFJ.js → chunk-EYENRK4D.js} +694 -384
  50. package/chunks/chunk-H6BD2ELD.js +36 -0
  51. package/chunks/{chunk-XP27SJMH.js → chunk-HR7SV7AY.js} +79 -48
  52. package/chunks/{chunk-D5NTAHYL.js → chunk-IDX6COTE.js} +7 -2
  53. package/chunks/{chunk-SHT4VJWU.js → chunk-IWKSG2AR.js} +2 -2
  54. package/chunks/chunk-J37FGIOA.js +1623 -0
  55. package/chunks/chunk-J5MDQKJL.js +2230 -0
  56. package/chunks/{chunk-USE2VQ5P.js → chunk-JTQAQBTV.js} +21 -0
  57. package/chunks/{chunk-NCTLV2NB.js → chunk-KQJMQJPI.js} +1 -1
  58. package/chunks/{chunk-5FBA5XC2.js → chunk-KRIHGKNA.js} +1 -1
  59. package/chunks/chunk-LD2XBG6Z.js +102 -0
  60. package/chunks/{chunk-MAY32HXD.js → chunk-M6VTDSVR.js} +3 -1
  61. package/chunks/chunk-MRO43B25.js +30 -0
  62. package/chunks/{chunk-N4WOREMD.js → chunk-NVFMZBX2.js} +43 -3
  63. package/chunks/chunk-OHEGWO4L.js +264 -0
  64. package/chunks/{chunk-K6O2NBMF.js → chunk-OQ7NJIY7.js} +4604 -6397
  65. package/chunks/chunk-QQDPRDVW.js +25 -0
  66. package/chunks/{chunk-KXZ4TJB4.js → chunk-SEGYWKIH.js} +1 -1
  67. package/chunks/chunk-SKBPNJEW.js +45 -0
  68. package/chunks/{chunk-4AOCVI6J.js → chunk-SNGELLWX.js} +52 -6
  69. package/chunks/{chunk-3OCRHZA3.js → chunk-TD4OPI4T.js} +56742 -44104
  70. package/chunks/{chunk-DQ4QTG7E.js → chunk-VV4F63BD.js} +11 -11
  71. package/chunks/chunk-XBY7E2FX.js +605 -0
  72. package/chunks/{chunk-JKMBWLFB.js → chunk-YILFYI5W.js} +48 -26
  73. package/chunks/chunk-YOGAOMYB.js +159 -0
  74. package/chunks/{chunk-QWSRH265.js → chunk-Z2Z3GUXZ.js} +777 -776
  75. package/chunks/{chunk-SDHRQFOS.js → chunk-ZTZ4DDQE.js} +2 -2
  76. package/chunks/computer-use-W2TYQNEE.js +825 -0
  77. package/chunks/contextCommand-6FGX3A7J.js +52 -0
  78. package/chunks/{cron-create-3ZBBN7WB.js → cron-create-APL5LU6I.js} +3 -3
  79. package/chunks/{cron-delete-NAGKKIIG.js → cron-delete-4SBJSCN4.js} +3 -3
  80. package/chunks/{cron-list-PAGRXNAI.js → cron-list-2AMGOMVO.js} +3 -3
  81. package/chunks/{de-V4IE2OOZ.js → de-YGKK2BC4.js} +89 -5
  82. package/chunks/{devtools-TWVXEJQB.js → devtools-FM6GJPYG.js} +2 -1
  83. package/chunks/{dist-4L54HRX2.js → dist-4LXD6L6X.js} +24 -5
  84. package/chunks/dist-H6ONXVLG.js +94146 -0
  85. package/chunks/{dist-XKWIWPWQ.js → dist-KAZ3SEBX.js} +1083 -3856
  86. package/chunks/{dist-BXDUQ2QY.js → dist-PK7DFCAW.js} +1 -1
  87. package/chunks/{edit-NVO3FOAK.js → edit-ZCEZC264.js} +30 -22
  88. package/chunks/{en-HGJ2SPLM.js → en-DHGYHIHX.js} +127 -6
  89. package/chunks/{enter-worktree-UEBG4WFC.js → enter-worktree-BBHCFCHG.js} +30 -20
  90. package/chunks/enterPlanMode-3M6KTD3B.js +158 -0
  91. package/chunks/{exit-worktree-UZ3MAQZN.js → exit-worktree-73YPIEQO.js} +27 -19
  92. package/chunks/exitPlanMode-TYZM6BAE.js +703 -0
  93. package/chunks/{fr-CJULI7ZX.js → fr-JXBKPJKQ.js} +89 -5
  94. package/chunks/{geminiContentGenerator-3UZFXGNT.js → geminiContentGenerator-7N2V3VW2.js} +8 -6
  95. package/chunks/{getMachineId-bsd-JXOSIJV2.js → getMachineId-bsd-4CASPIU4.js} +4 -4
  96. package/chunks/{getMachineId-darwin-TE4QRR42.js → getMachineId-darwin-HPQPEMZR.js} +4 -4
  97. package/chunks/{getMachineId-linux-S3OL52XK.js → getMachineId-linux-AUARKYHL.js} +3 -3
  98. package/chunks/{getMachineId-unsupported-DWUSBAPX.js → getMachineId-unsupported-S32ZDA2T.js} +3 -3
  99. package/chunks/{getMachineId-win-AAC5P3AP.js → getMachineId-win-4EFLHYIJ.js} +4 -4
  100. package/chunks/{glob-KNHSFFFG.js → glob-5XBCPQ2A.js} +27 -19
  101. package/chunks/{grep-LACWDZW4.js → grep-VIUU3A7X.js} +30 -19
  102. package/chunks/{ja-L7CHRQEW.js → ja-TGPZSP2B.js} +89 -5
  103. package/chunks/{keychain-token-storage-335UOLJ6.js → keychain-token-storage-6IU6ORQN.js} +3 -3
  104. package/chunks/{ls-AGXQOKSG.js → ls-JRGYIGLY.js} +4 -4
  105. package/chunks/{lsp-UDMUHNPA.js → lsp-SHMKFOAC.js} +3 -3
  106. package/chunks/{monitor-ETKWPJEH.js → monitor-6R4LIJL5.js} +40 -25
  107. package/chunks/{multipart-parser-3QWGTLK3.js → multipart-parser-AJ4WASWR.js} +2 -2
  108. package/chunks/{notebook-edit-QJJLPNYT.js → notebook-edit-5E7ULDVQ.js} +28 -20
  109. package/chunks/{openaiContentGenerator-CNNN424U.js → openaiContentGenerator-ZVHFKM3O.js} +17 -14
  110. package/chunks/{pt-M6JULLEQ.js → pt-TIBG6BIO.js} +89 -5
  111. package/chunks/{qwenContentGenerator-BOLCGK3R.js → qwenContentGenerator-B2VTVSPJ.js} +31 -23
  112. package/chunks/{qwenOAuth2-EEJGROP7.js → qwenOAuth2-2KCKWDCF.js} +6 -4
  113. package/chunks/read-file-GIT7BCDR.js +27 -0
  114. package/chunks/ripGrep-MWKFVYMS.js +48 -0
  115. package/chunks/{ru-QILM4HBC.js → ru-JBCHCK4L.js} +89 -5
  116. package/chunks/scheduler-5VOOYGBH.js +308 -0
  117. package/chunks/send-message-4QNWQJF4.js +244 -0
  118. package/chunks/{serve-OLSI7WSR.js → serve-MN6HZBWN.js} +14262 -7414
  119. package/chunks/shell-NQZQGFM2.js +56 -0
  120. package/chunks/{skill-D6YRHTTI.js → skill-WCFW4644.js} +145 -119
  121. package/chunks/{src-TMOD5X6F.js → src-7XL4G4DC.js} +88 -46
  122. package/chunks/{src-4QH4FZ6I.js → src-IHA6DTUV.js} +452 -62
  123. package/chunks/{syntheticOutput-5PVFDDJ4.js → syntheticOutput-YTYS2ZMQ.js} +4 -4
  124. package/chunks/task-create-MPORPYN6.js +19 -0
  125. package/chunks/task-list-R2YDYPZT.js +151 -0
  126. package/chunks/{task-stop-AJKPSR6R.js → task-stop-SYWJYBCM.js} +3 -3
  127. package/chunks/task-update-E4NSLKMQ.js +408 -0
  128. package/chunks/team-create-7R7KA5IP.js +314 -0
  129. package/chunks/team-delete-25OIWUPN.js +116 -0
  130. package/chunks/{todoWrite-VLAUG4CA.js → todoWrite-4YHMIF4X.js} +16 -5
  131. package/chunks/{tool-search-MZGHUUKD.js → tool-search-YBRVZCLI.js} +29 -11
  132. package/chunks/{tts-notification-K3X7X7MN.js → tts-notification-7SOEMQK4.js} +5 -4
  133. package/chunks/{web-fetch-OILB464A.js → web-fetch-MFIRHIHI.js} +5 -5
  134. package/chunks/workflow-5RIKVCIE.js +960 -0
  135. package/chunks/{write-file-BIQAA57V.js → write-file-DMQTJZOM.js} +32 -24
  136. package/chunks/{zh-PWL2NKY3.js → zh-7H5OQC4I.js} +135 -11
  137. package/chunks/{zh-TW-S3YGWICZ.js → zh-TW-P4IDHD3M.js} +128 -11
  138. package/cli.js +45402 -20570
  139. package/examples/agent/agents/diary.md +86 -0
  140. package/examples/agent/qwen-extension.json +5 -0
  141. package/examples/commands/commands/fs/grep-code.md +3 -0
  142. package/examples/commands/qwen-extension.json +5 -0
  143. package/examples/context/QWEN.md +8 -0
  144. package/examples/context/qwen-extension.json +5 -0
  145. package/examples/mcp-server/example.ts +60 -0
  146. package/examples/mcp-server/package.json +18 -0
  147. package/examples/mcp-server/qwen-extension.json +12 -0
  148. package/examples/mcp-server/tsconfig.json +13 -0
  149. package/examples/skills/qwen-extension.json +5 -0
  150. package/examples/skills/skills/synonyms/SKILL.md +48 -0
  151. package/examples/starter/QWEN.md +30 -0
  152. package/examples/starter/README.md +59 -0
  153. package/examples/starter/agents/diary.md +86 -0
  154. package/examples/starter/commands/writing/polish.md +13 -0
  155. package/examples/starter/example.ts +64 -0
  156. package/examples/starter/package.json +18 -0
  157. package/examples/starter/qwen-extension.json +12 -0
  158. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  159. package/examples/starter/tsconfig.json +13 -0
  160. package/fzfWorker.js +1083 -0
  161. package/locales/ca.js +118 -5
  162. package/locales/de.js +117 -5
  163. package/locales/en.js +169 -7
  164. package/locales/fr.js +119 -5
  165. package/locales/ja.js +114 -5
  166. package/locales/pt.js +117 -5
  167. package/locales/ru.js +116 -5
  168. package/locales/zh-TW.js +161 -12
  169. package/locales/zh.js +169 -12
  170. package/package.json +4 -2
  171. package/scripts/postinstall.cjs +2 -1
  172. package/bundled/qc-helper/docs/features/checkpointing.md +0 -77
  173. package/chunks/agent-7ZN3CRHR.js +0 -48
  174. package/chunks/chunk-6PCB2DEF.js +0 -434
  175. package/chunks/chunk-EM6ETG2K.js +0 -60
  176. package/chunks/chunk-G7YTSRES.js +0 -150
  177. package/chunks/contextCommand-7IBASARL.js +0 -44
  178. package/chunks/exitPlanMode-PZAMWIRW.js +0 -227
  179. package/chunks/multipart-parser-IXGBIOIN.js +0 -384
  180. package/chunks/read-file-CCUEUFG2.js +0 -24
  181. package/chunks/ripGrep-TADOH2HK.js +0 -40
  182. package/chunks/send-message-YL44UZFC.js +0 -151
  183. package/chunks/shell-7KKKC5G7.js +0 -48
  184. package/chunks/src-IPWIHNMI.js +0 -1406
  185. package/chunks/undici-F6ZOXSS5.js +0 -8
@@ -692,6 +692,27 @@ var ChannelBase = class {
692
692
  }
693
693
  }
694
694
  const sessionId = await this.router.resolve(this.name, envelope.senderId, envelope.chatId, envelope.threadId, this.config.cwd);
695
+ if (envelope.text.startsWith("!")) {
696
+ const cmd = envelope.text.slice(1).trim();
697
+ const bridgeShellCommand = this.bridge["shellCommand"];
698
+ if (cmd && typeof bridgeShellCommand === "function") {
699
+ try {
700
+ const result2 = await bridgeShellCommand(sessionId, cmd);
701
+ const longestRun = Math.max(0, ...Array.from((result2.output || "").matchAll(/`+/g), (m) => m[0].length));
702
+ const fence = "`".repeat(Math.max(3, longestRun + 1));
703
+ const output = result2.output ? `${fence}
704
+ ${result2.output}
705
+ ${fence}` : "(no output)";
706
+ const exitLine = result2.exitCode !== null && result2.exitCode !== 0 ? `
707
+ Exit code: ${result2.exitCode}` : "";
708
+ await this.sendMessage(envelope.chatId, `$ ${cmd}
709
+ ${output}${exitLine}`);
710
+ } catch (error) {
711
+ await this.sendMessage(envelope.chatId, `Shell command failed: ${error instanceof Error ? error.message : String(error)}`);
712
+ }
713
+ return;
714
+ }
715
+ }
695
716
  let promptText = envelope.text;
696
717
  if (envelope.referencedText) {
697
718
  promptText = `[Replying to: "${envelope.referencedText}"]
@@ -5,7 +5,7 @@ import {
5
5
  BaseToolInvocation,
6
6
  ToolDisplayNames,
7
7
  ToolNames
8
- } from "./chunk-XEGHDASV.js";
8
+ } from "./chunk-D3RHSPAS.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  ToolNames
5
- } from "./chunk-XEGHDASV.js";
5
+ } from "./chunk-D3RHSPAS.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -0,0 +1,102 @@
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
+ // packages/core/src/agents/team/identity.ts
11
+ init_esbuild_shims();
12
+ import { AsyncLocalStorage } from "node:async_hooks";
13
+ var teammateIdentityStore = new AsyncLocalStorage();
14
+ function getTeammateContext() {
15
+ return teammateIdentityStore.getStore();
16
+ }
17
+ __name(getTeammateContext, "getTeammateContext");
18
+ function isInProcessTeammate() {
19
+ return teammateIdentityStore.getStore() !== void 0;
20
+ }
21
+ __name(isInProcessTeammate, "isInProcessTeammate");
22
+ function getAgentName() {
23
+ return teammateIdentityStore.getStore()?.agentName;
24
+ }
25
+ __name(getAgentName, "getAgentName");
26
+ function getTeamName() {
27
+ return teammateIdentityStore.getStore()?.teamName;
28
+ }
29
+ __name(getTeamName, "getTeamName");
30
+ function resolveActiveTeamName(fallback) {
31
+ return getTeamName() ?? fallback;
32
+ }
33
+ __name(resolveActiveTeamName, "resolveActiveTeamName");
34
+ var isTeammate = isInProcessTeammate;
35
+ function isTeamLead() {
36
+ return teammateIdentityStore.getStore()?.isTeamLead ?? false;
37
+ }
38
+ __name(isTeamLead, "isTeamLead");
39
+ function getTeammateColor() {
40
+ return teammateIdentityStore.getStore()?.color;
41
+ }
42
+ __name(getTeammateColor, "getTeammateColor");
43
+ function runWithTeammateIdentity(identity, fn) {
44
+ return teammateIdentityStore.run(identity, fn);
45
+ }
46
+ __name(runWithTeammateIdentity, "runWithTeammateIdentity");
47
+
48
+ // packages/core/src/agents/team/types.ts
49
+ init_esbuild_shims();
50
+ var MAX_TEAMMATES = 10;
51
+ var LEADER_NAME = "leader";
52
+ var TEAMS_DIR = "teams";
53
+ var TASKS_DIR = "tasks";
54
+ var TEAM_CONFIG_FILENAME = "config.json";
55
+ var INBOXES_DIR = "inboxes";
56
+ var TEAMMATE_COLORS = [
57
+ "#FF6B6B",
58
+ // red
59
+ "#4ECDC4",
60
+ // teal
61
+ "#45B7D1",
62
+ // blue
63
+ "#FFA07A",
64
+ // salmon
65
+ "#98D8C8",
66
+ // mint
67
+ "#DDA0DD",
68
+ // plum
69
+ "#F0E68C",
70
+ // khaki
71
+ "#87CEEB",
72
+ // sky blue
73
+ "#FFB347",
74
+ // orange
75
+ "#B0E0E6"
76
+ // powder blue
77
+ ];
78
+
79
+ export {
80
+ teammateIdentityStore,
81
+ getTeammateContext,
82
+ isInProcessTeammate,
83
+ getAgentName,
84
+ getTeamName,
85
+ resolveActiveTeamName,
86
+ isTeammate,
87
+ isTeamLead,
88
+ getTeammateColor,
89
+ runWithTeammateIdentity,
90
+ MAX_TEAMMATES,
91
+ LEADER_NAME,
92
+ TEAMS_DIR,
93
+ TASKS_DIR,
94
+ TEAM_CONFIG_FILENAME,
95
+ INBOXES_DIR,
96
+ TEAMMATE_COLORS
97
+ };
98
+ /**
99
+ * @license
100
+ * Copyright 2025 Qwen
101
+ * SPDX-License-Identifier: Apache-2.0
102
+ */
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  createDebugLogger
5
- } from "./chunk-XP27SJMH.js";
5
+ } from "./chunk-HR7SV7AY.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-A4BMJM77.js";
@@ -474,6 +474,8 @@ var PATTERNS = [
474
474
  // -------------------
475
475
  // MiniMax
476
476
  // -------------------
477
+ [/^minimax-m3/i, LIMITS["1m"]],
478
+ // MiniMax-M3: 1,000,000
477
479
  [/^minimax-m2\.5/i, LIMITS["192k"]],
478
480
  // MiniMax-M2.5: 196,608
479
481
  [/^minimax-/i, LIMITS["200k"]],
@@ -0,0 +1,30 @@
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
+ // packages/cli/src/utils/housekeeping/lastInteractionAt.ts
11
+ init_esbuild_shims();
12
+ var lastInteractionAt = Date.now();
13
+ function noteInteraction() {
14
+ lastInteractionAt = Date.now();
15
+ }
16
+ __name(noteInteraction, "noteInteraction");
17
+ function msSinceLastInteraction() {
18
+ return Date.now() - lastInteractionAt;
19
+ }
20
+ __name(msSinceLastInteraction, "msSinceLastInteraction");
21
+
22
+ export {
23
+ noteInteraction,
24
+ msSinceLastInteraction
25
+ };
26
+ /**
27
+ * @license
28
+ * Copyright 2025 Google LLC
29
+ * SPDX-License-Identifier: Apache-2.0
30
+ */
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-OFEVLU4C.js";
6
6
  import {
7
7
  SchemaValidator
8
- } from "./chunk-XEGHDASV.js";
8
+ } from "./chunk-D3RHSPAS.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -15,6 +15,7 @@ import {
15
15
 
16
16
  // packages/core/src/utils/sideQuery.ts
17
17
  init_esbuild_shims();
18
+ import { readFile } from "node:fs/promises";
18
19
  function buildDefaultPromptId(purpose) {
19
20
  return purpose ? `side-query:${purpose}` : "side-query";
20
21
  }
@@ -31,6 +32,41 @@ function applyThinkingDefault(callerConfig) {
31
32
  };
32
33
  }
33
34
  __name(applyThinkingDefault, "applyThinkingDefault");
35
+ async function getOutputLanguageInstruction(config) {
36
+ const outputLanguageFilePath = config.getOutputLanguageFilePath?.();
37
+ if (!outputLanguageFilePath) return void 0;
38
+ try {
39
+ const preference = (await readFile(outputLanguageFilePath, "utf8")).trim();
40
+ if (!preference) return void 0;
41
+ return [
42
+ "Follow the user-visible output language preference below for this side query.",
43
+ preference
44
+ ].join("\n\n");
45
+ } catch {
46
+ return void 0;
47
+ }
48
+ }
49
+ __name(getOutputLanguageInstruction, "getOutputLanguageInstruction");
50
+ function appendSystemInstruction(systemInstruction, outputLanguageInstruction) {
51
+ if (!outputLanguageInstruction) return systemInstruction;
52
+ if (systemInstruction === void 0) return outputLanguageInstruction;
53
+ if (typeof systemInstruction === "string") {
54
+ return `${systemInstruction}
55
+
56
+ ${outputLanguageInstruction}`;
57
+ }
58
+ if (Array.isArray(systemInstruction)) {
59
+ return [...systemInstruction, { text: outputLanguageInstruction }];
60
+ }
61
+ if (typeof systemInstruction === "object" && "parts" in systemInstruction && Array.isArray(systemInstruction.parts)) {
62
+ return {
63
+ ...systemInstruction,
64
+ parts: [...systemInstruction.parts, { text: outputLanguageInstruction }]
65
+ };
66
+ }
67
+ return [systemInstruction, { text: outputLanguageInstruction }];
68
+ }
69
+ __name(appendSystemInstruction, "appendSystemInstruction");
34
70
  function isJsonOptions(options) {
35
71
  return options.schema !== void 0 && options.schema !== null;
36
72
  }
@@ -39,13 +75,17 @@ async function runSideQuery(config, options) {
39
75
  const model = resolveDefaultModel(config, options.model);
40
76
  const promptId = options.promptId ?? buildDefaultPromptId(options.purpose);
41
77
  const requestConfig = applyThinkingDefault(options.config);
78
+ const systemInstruction = appendSystemInstruction(
79
+ options.systemInstruction,
80
+ await getOutputLanguageInstruction(config)
81
+ );
42
82
  if (isJsonOptions(options)) {
43
83
  const response = await config.getBaseLlmClient().generateJson({
44
84
  contents: options.contents,
45
85
  schema: options.schema,
46
86
  abortSignal: options.abortSignal,
47
87
  model,
48
- systemInstruction: options.systemInstruction,
88
+ systemInstruction,
49
89
  promptId,
50
90
  config: requestConfig,
51
91
  ...options.maxAttempts !== void 0 && {
@@ -65,7 +105,7 @@ async function runSideQuery(config, options) {
65
105
  const result = await config.getBaseLlmClient().generateText({
66
106
  contents: options.contents,
67
107
  model,
68
- systemInstruction: options.systemInstruction,
108
+ systemInstruction,
69
109
  abortSignal: options.abortSignal,
70
110
  promptId,
71
111
  config: requestConfig,
@@ -0,0 +1,264 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ createDebugLogger
5
+ } from "./chunk-HR7SV7AY.js";
6
+ import {
7
+ init_esbuild_shims
8
+ } from "./chunk-A4BMJM77.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-J2S4EL5Y.js";
12
+
13
+ // packages/core/src/tools/skill-utils.ts
14
+ init_esbuild_shims();
15
+
16
+ // packages/core/src/utils/xml.ts
17
+ init_esbuild_shims();
18
+ function escapeXml(text) {
19
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
20
+ }
21
+ __name(escapeXml, "escapeXml");
22
+ var XML_TAG_CANDIDATE_RE = /<[^<>]*>/g;
23
+ function isXmlWhitespace(char) {
24
+ return char !== void 0 && /\s/.test(char);
25
+ }
26
+ __name(isXmlWhitespace, "isXmlWhitespace");
27
+ function isSystemReminderTagIgnorable(char) {
28
+ const codePoint = char.codePointAt(0);
29
+ if (codePoint === void 0) return false;
30
+ return codePoint === 173 || codePoint === 1564 || codePoint === 12644 || codePoint === 65279 || codePoint === 65440 || codePoint >= 0 && codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint >= 4447 && codePoint <= 4448 || codePoint >= 6068 && codePoint <= 6069 || codePoint >= 6155 && codePoint <= 6159 || codePoint >= 8203 && codePoint <= 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8288 && codePoint <= 8303 || codePoint >= 65024 && codePoint <= 65039 || codePoint >= 65520 && codePoint <= 65528 || codePoint >= 113824 && codePoint <= 113827 || codePoint >= 119155 && codePoint <= 119162 || codePoint >= 917504 && codePoint <= 921599;
31
+ }
32
+ __name(isSystemReminderTagIgnorable, "isSystemReminderTagIgnorable");
33
+ function normalizeSystemReminderCandidateTag(tag) {
34
+ let normalized = "";
35
+ for (const char of tag) {
36
+ if (!isSystemReminderTagIgnorable(char)) {
37
+ normalized += char;
38
+ }
39
+ }
40
+ return normalized.toLowerCase();
41
+ }
42
+ __name(normalizeSystemReminderCandidateTag, "normalizeSystemReminderCandidateTag");
43
+ function getSystemReminderTagKind(tag) {
44
+ const normalized = normalizeSystemReminderCandidateTag(tag);
45
+ const len = normalized.length;
46
+ if (len < 2 || normalized[0] !== "<" || normalized[len - 1] !== ">") {
47
+ return void 0;
48
+ }
49
+ let i = 1;
50
+ while (i < len && isXmlWhitespace(normalized[i])) i++;
51
+ let closing = false;
52
+ if (normalized[i] === "/") {
53
+ closing = true;
54
+ i++;
55
+ }
56
+ while (i < len && isXmlWhitespace(normalized[i])) i++;
57
+ const TAG_NAME = "system-reminder";
58
+ if (normalized.slice(i, i + TAG_NAME.length) !== TAG_NAME) {
59
+ return void 0;
60
+ }
61
+ i += TAG_NAME.length;
62
+ if (i < len - 1 && isXmlWhitespace(normalized[i])) {
63
+ while (i < len && isXmlWhitespace(normalized[i])) i++;
64
+ while (i < len && normalized[i] !== ">") i++;
65
+ }
66
+ while (i < len && isXmlWhitespace(normalized[i])) i++;
67
+ if (normalized[i] === "/") i++;
68
+ while (i < len && isXmlWhitespace(normalized[i])) i++;
69
+ if (i !== len - 1 || normalized[i] !== ">") {
70
+ return void 0;
71
+ }
72
+ return closing ? "closing" : "other";
73
+ }
74
+ __name(getSystemReminderTagKind, "getSystemReminderTagKind");
75
+ function escapeSystemReminderTag(tag) {
76
+ const tagKind = getSystemReminderTagKind(tag);
77
+ if (tagKind === "closing") {
78
+ return "<\\/system-reminder>";
79
+ }
80
+ if (tagKind === "other") {
81
+ return escapeXml(tag);
82
+ }
83
+ return tag;
84
+ }
85
+ __name(escapeSystemReminderTag, "escapeSystemReminderTag");
86
+ function escapeSystemReminderTags(text) {
87
+ return text.replace(XML_TAG_CANDIDATE_RE, escapeSystemReminderTag);
88
+ }
89
+ __name(escapeSystemReminderTags, "escapeSystemReminderTags");
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
+
184
+ // packages/core/src/hooks/registerSkillHooks.ts
185
+ init_esbuild_shims();
186
+ var debugLogger = createDebugLogger("SKILL_HOOKS");
187
+ function registerSkillHooks(sessionHooksManager, sessionId, skill) {
188
+ if (!skill.hooks) {
189
+ debugLogger.debug(`Skill '${skill.name}' has no hooks to register`);
190
+ return 0;
191
+ }
192
+ const hooksSettings = skill.hooks;
193
+ let registeredCount = 0;
194
+ for (const eventName of Object.keys(hooksSettings)) {
195
+ const matchers = hooksSettings[eventName];
196
+ if (!matchers) continue;
197
+ for (const matcher of matchers) {
198
+ const matcherPattern = matcher.matcher || "";
199
+ for (const hook of matcher.hooks) {
200
+ if (hook.type === "function" /* Function */) {
201
+ debugLogger.debug(
202
+ "Skipping function hook from skill (not supported in frontmatter)"
203
+ );
204
+ continue;
205
+ }
206
+ const hookConfig = prepareHookConfig(
207
+ hook,
208
+ skill.skillRoot
209
+ );
210
+ sessionHooksManager.addSessionHook(
211
+ sessionId,
212
+ eventName,
213
+ matcherPattern,
214
+ hookConfig,
215
+ { skillRoot: skill.skillRoot }
216
+ );
217
+ registeredCount++;
218
+ debugLogger.debug(
219
+ `Registered hook for ${eventName} with matcher '${matcherPattern}' from skill '${skill.name}'`
220
+ );
221
+ }
222
+ }
223
+ }
224
+ if (registeredCount > 0) {
225
+ debugLogger.info(
226
+ `Registered ${registeredCount} hooks from skill '${skill.name}'`
227
+ );
228
+ }
229
+ return registeredCount;
230
+ }
231
+ __name(registerSkillHooks, "registerSkillHooks");
232
+ function prepareHookConfig(hook, skillRoot) {
233
+ if (hook.type === "command" && skillRoot) {
234
+ return {
235
+ ...hook,
236
+ env: {
237
+ ...hook.env,
238
+ QWEN_SKILL_ROOT: skillRoot
239
+ }
240
+ };
241
+ }
242
+ return hook;
243
+ }
244
+ __name(prepareHookConfig, "prepareHookConfig");
245
+
246
+ export {
247
+ escapeXml,
248
+ escapeSystemReminderTags,
249
+ buildSkillLlmContent,
250
+ collectAvailableSkillEntries,
251
+ renderAvailableSkillsBlock,
252
+ applySkillAllowedTools,
253
+ registerSkillHooks
254
+ };
255
+ /**
256
+ * @license
257
+ * Copyright 2025 Qwen
258
+ * SPDX-License-Identifier: Apache-2.0
259
+ */
260
+ /**
261
+ * @license
262
+ * Copyright 2026 Qwen Team
263
+ * SPDX-License-Identifier: Apache-2.0
264
+ */