@qwen-code/qwen-code 0.18.0-preview.1 → 0.18.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.
Files changed (141) hide show
  1. package/bundled/qc-helper/SKILL.md +1 -2
  2. package/bundled/qc-helper/docs/_meta.ts +1 -0
  3. package/bundled/qc-helper/docs/configuration/settings.md +20 -24
  4. package/bundled/qc-helper/docs/features/_meta.ts +0 -3
  5. package/bundled/qc-helper/docs/features/approval-mode.md +10 -14
  6. package/bundled/qc-helper/docs/features/commands.md +47 -23
  7. package/bundled/qc-helper/docs/features/followup-suggestions.md +2 -2
  8. package/bundled/qc-helper/docs/features/scheduled-tasks.md +1 -1
  9. package/bundled/qc-helper/docs/features/sub-agents.md +60 -0
  10. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +221 -0
  11. package/bundled/qc-helper/docs/qwen-serve.md +234 -24
  12. package/chunks/{agent-SXS4NQWS.js → agent-LOTJK6AH.js} +25 -19
  13. package/chunks/agent-headless-TU3EPMYU.js +50 -0
  14. package/chunks/{anthropicContentGenerator-4QBVSFSJ.js → anthropicContentGenerator-2HBRNQ3B.js} +7 -7
  15. package/chunks/{askUserQuestion-NOOLRWCJ.js → askUserQuestion-OGCMIBQM.js} +45 -3
  16. package/chunks/{ca-WRHFBIDH.js → ca-BARBRL6N.js} +48 -1
  17. package/chunks/{chunk-JMLIPZUU.js → chunk-2Y5SYSD3.js} +361 -583
  18. package/chunks/chunk-3DHXZ6EV.js +241 -0
  19. package/chunks/{chunk-AVLOK27J.js → chunk-3HTIVKZE.js} +1 -1
  20. package/chunks/{chunk-BNESGOSJ.js → chunk-55ZMG67I.js} +1 -1
  21. package/chunks/chunk-64WXLC72.js +98 -0
  22. package/chunks/{chunk-F6FLCHCS.js → chunk-6YIUGZTC.js} +1069 -211
  23. package/chunks/{chunk-C6WMLUNB.js → chunk-72LDN5PP.js} +1 -1
  24. package/chunks/{chunk-ERREX2ES.js → chunk-7BCMOPIM.js} +64 -24
  25. package/chunks/{chunk-6VFG3EUJ.js → chunk-A7B4ISQP.js} +1 -1
  26. package/chunks/{chunk-F5ORN4YO.js → chunk-B7HXHOHU.js} +1 -1
  27. package/chunks/{chunk-5RNZ2QKF.js → chunk-BIVG75CP.js} +1 -1
  28. package/chunks/{chunk-MVX64PNU.js → chunk-EYENRK4D.js} +1 -1
  29. package/chunks/{chunk-SZOEIL6S.js → chunk-H6BD2ELD.js} +1 -0
  30. package/chunks/{chunk-SCHRFI7O.js → chunk-HLPLOD42.js} +1 -1
  31. package/chunks/{chunk-R5PDRHEF.js → chunk-HR7SV7AY.js} +68 -47
  32. package/chunks/{chunk-JSYEZAYV.js → chunk-IDX6COTE.js} +2 -2
  33. package/chunks/{chunk-6KH2Q7XN.js → chunk-IWAYOW5Q.js} +17482 -11669
  34. package/chunks/chunk-J5MDQKJL.js +2230 -0
  35. package/chunks/{chunk-USE2VQ5P.js → chunk-JTQAQBTV.js} +21 -0
  36. package/chunks/{chunk-ZW7GBCRE.js → chunk-LBP46COL.js} +1014 -163
  37. package/chunks/chunk-LD2XBG6Z.js +102 -0
  38. package/chunks/{chunk-KOA52UTF.js → chunk-LEJ42GNY.js} +14 -14
  39. package/chunks/{chunk-D46KOV3C.js → chunk-M6VTDSVR.js} +1 -1
  40. package/chunks/{chunk-SHUT5MQY.js → chunk-MFBBBTNY.js} +1 -1
  41. package/chunks/{chunk-PLYZAP4W.js → chunk-OHEGWO4L.js} +101 -23
  42. package/chunks/{chunk-NQZ33PWX.js → chunk-PL3MVCWD.js} +11 -11
  43. package/chunks/chunk-QQDPRDVW.js +25 -0
  44. package/chunks/chunk-R7ODSGTK.js +159 -0
  45. package/chunks/{chunk-GBEPNWYB.js → chunk-SEGYWKIH.js} +1 -1
  46. package/chunks/chunk-SKBPNJEW.js +45 -0
  47. package/chunks/{chunk-UABFCMPA.js → chunk-SNGELLWX.js} +3 -1
  48. package/chunks/chunk-XBY7E2FX.js +605 -0
  49. package/chunks/{chunk-G763GDO6.js → chunk-XV4HCEVI.js} +36 -3
  50. package/chunks/{chunk-WFVXF3OM.js → chunk-Z2Z3GUXZ.js} +1 -0
  51. package/chunks/{chunk-BBTV54KB.js → chunk-ZTZ4DDQE.js} +2 -2
  52. package/chunks/{computer-use-CT6MU6P3.js → computer-use-3RH2DOM6.js} +25 -19
  53. package/chunks/contextCommand-K347QT6O.js +52 -0
  54. package/chunks/{cron-create-PIPMXQN4.js → cron-create-YJL3KFWI.js} +3 -3
  55. package/chunks/{cron-delete-6Y5XIDMS.js → cron-delete-WKWSJZQA.js} +3 -3
  56. package/chunks/{cron-list-A4WNRUWZ.js → cron-list-B52XEXAZ.js} +3 -3
  57. package/chunks/{de-M5RPB2NB.js → de-YGKK2BC4.js} +48 -1
  58. package/chunks/{devtools-IXE4UP72.js → devtools-FM6GJPYG.js} +1 -1
  59. package/chunks/{dist-R2SXPG74.js → dist-4LXD6L6X.js} +2 -2
  60. package/chunks/{dist-TE5QKMGR.js → dist-H6ONXVLG.js} +1 -1
  61. package/chunks/{dist-ZMQ4TXD5.js → dist-KAZ3SEBX.js} +2 -2
  62. package/chunks/{dist-BXDUQ2QY.js → dist-PK7DFCAW.js} +1 -1
  63. package/chunks/{edit-A4YK7AIB.js → edit-KU4PJGEX.js} +26 -20
  64. package/chunks/{en-UMYKQAZE.js → en-DHGYHIHX.js} +77 -2
  65. package/chunks/{enter-worktree-VNEQINLC.js → enter-worktree-PPYIDCWI.js} +25 -19
  66. package/chunks/enterPlanMode-5CZDMCB4.js +158 -0
  67. package/chunks/{exit-worktree-AVSMXC33.js → exit-worktree-UY3CGHKC.js} +25 -19
  68. package/chunks/exitPlanMode-3DN4QNSG.js +703 -0
  69. package/chunks/{fr-MPYXXXPW.js → fr-JXBKPJKQ.js} +48 -1
  70. package/chunks/{geminiContentGenerator-CR2WGARL.js → geminiContentGenerator-7A6I2RWB.js} +7 -7
  71. package/chunks/{getMachineId-bsd-F7GNPTER.js → getMachineId-bsd-4CASPIU4.js} +1 -1
  72. package/chunks/{getMachineId-darwin-T73DJL27.js → getMachineId-darwin-HPQPEMZR.js} +1 -1
  73. package/chunks/{getMachineId-linux-MKQTFPQM.js → getMachineId-linux-AUARKYHL.js} +1 -1
  74. package/chunks/{getMachineId-unsupported-MUR5KOQE.js → getMachineId-unsupported-S32ZDA2T.js} +1 -1
  75. package/chunks/{getMachineId-win-CDYFC6ZM.js → getMachineId-win-4EFLHYIJ.js} +1 -1
  76. package/chunks/{glob-5V32KOG5.js → glob-OFNQSS52.js} +25 -19
  77. package/chunks/{grep-PUTEPBR4.js → grep-6J2MSUM5.js} +28 -19
  78. package/chunks/{ja-NFZ32AB3.js → ja-TGPZSP2B.js} +48 -1
  79. package/chunks/{keychain-token-storage-UHGOCDD6.js → keychain-token-storage-6IU6ORQN.js} +3 -3
  80. package/chunks/{ls-34DLNYCD.js → ls-V3O6A5PT.js} +4 -4
  81. package/chunks/{lsp-NCDEHH3V.js → lsp-G2OCIFUA.js} +3 -3
  82. package/chunks/{monitor-EJBR5VCR.js → monitor-FKLHV423.js} +25 -19
  83. package/chunks/{notebook-edit-DZHGPP2L.js → notebook-edit-KTBYFKWG.js} +26 -20
  84. package/chunks/{openaiContentGenerator-4QNV3CHM.js → openaiContentGenerator-L5KSWQY7.js} +15 -14
  85. package/chunks/{pt-BR43FRBA.js → pt-TIBG6BIO.js} +48 -1
  86. package/chunks/{qwenContentGenerator-3XOCEMQO.js → qwenContentGenerator-PYOXLMBW.js} +27 -21
  87. package/chunks/{qwenOAuth2-KRJT35QH.js → qwenOAuth2-2KCKWDCF.js} +6 -5
  88. package/chunks/{read-file-VZ2SQQIX.js → read-file-JQVRK4NU.js} +11 -11
  89. package/chunks/ripGrep-2L4LPNAJ.js +48 -0
  90. package/chunks/{ru-DQCW2KHD.js → ru-JBCHCK4L.js} +48 -1
  91. package/chunks/{scheduler-H32DZVDV.js → scheduler-FGNXY4JQ.js} +25 -19
  92. package/chunks/send-message-SZFWNOCL.js +244 -0
  93. package/chunks/{serve-56G4B5W6.js → serve-N2IBLA3G.js} +13592 -4979
  94. package/chunks/{shell-Q77KNP4N.js → shell-PTEG6UX4.js} +25 -19
  95. package/chunks/{skill-CLWFJYBG.js → skill-X4NTK4NH.js} +64 -113
  96. package/chunks/{src-47L2LUOU.js → src-GLLQ3R5W.js} +307 -32
  97. package/chunks/{syntheticOutput-T5SWX3YF.js → syntheticOutput-IKAY5F6X.js} +4 -4
  98. package/chunks/task-create-MQICOJFV.js +19 -0
  99. package/chunks/task-list-RIHJCH32.js +151 -0
  100. package/chunks/{task-stop-3VHAQMYM.js → task-stop-FWZRFANS.js} +3 -3
  101. package/chunks/task-update-2LHPXOYM.js +408 -0
  102. package/chunks/team-create-2E4PF4KN.js +314 -0
  103. package/chunks/team-delete-DAUDQS4J.js +116 -0
  104. package/chunks/{todoWrite-EAGJGKO5.js → todoWrite-HTUACZES.js} +5 -5
  105. package/chunks/{tool-search-Q75AYDTP.js → tool-search-KTVULRES.js} +11 -11
  106. package/chunks/{web-fetch-SS6IKK6N.js → web-fetch-CZ7LLKPE.js} +5 -5
  107. package/chunks/workflow-L2ZUUDT2.js +960 -0
  108. package/chunks/{write-file-RENGC25N.js → write-file-ZEB2JDYH.js} +26 -20
  109. package/chunks/{zh-6VFXOAR5.js → zh-7H5OQC4I.js} +82 -7
  110. package/chunks/{zh-TW-IQZ4AD5M.js → zh-TW-P4IDHD3M.js} +79 -7
  111. package/cli.js +11248 -5119
  112. package/examples/agent/qwen-extension.json +1 -0
  113. package/examples/commands/qwen-extension.json +1 -0
  114. package/examples/context/qwen-extension.json +1 -0
  115. package/examples/mcp-server/qwen-extension.json +1 -0
  116. package/examples/skills/qwen-extension.json +1 -0
  117. package/examples/starter/QWEN.md +30 -0
  118. package/examples/starter/README.md +59 -0
  119. package/examples/starter/agents/diary.md +86 -0
  120. package/examples/starter/commands/writing/polish.md +13 -0
  121. package/examples/starter/example.ts +64 -0
  122. package/examples/starter/package.json +18 -0
  123. package/examples/starter/qwen-extension.json +12 -0
  124. package/examples/starter/skills/synonyms/SKILL.md +48 -0
  125. package/examples/starter/tsconfig.json +13 -0
  126. package/fzfWorker.js +1083 -0
  127. package/locales/ca.js +51 -0
  128. package/locales/de.js +51 -0
  129. package/locales/en.js +89 -2
  130. package/locales/fr.js +53 -2
  131. package/locales/ja.js +52 -2
  132. package/locales/pt.js +52 -2
  133. package/locales/ru.js +53 -2
  134. package/locales/zh-TW.js +90 -11
  135. package/locales/zh.js +94 -11
  136. package/package.json +3 -2
  137. package/bundled/qc-helper/docs/features/checkpointing.md +0 -77
  138. package/chunks/contextCommand-YODJQYIV.js +0 -46
  139. package/chunks/exitPlanMode-5SQYVROD.js +0 -229
  140. package/chunks/ripGrep-SBIZCPOL.js +0 -42
  141. package/chunks/send-message-YYF56TS7.js +0 -151
@@ -1,229 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import "./chunk-6KH2Q7XN.js";
4
- import "./chunk-K5PGHDBN.js";
5
- import "./chunk-O4PICXES.js";
6
- import "./chunk-TW522KN6.js";
7
- import "./chunk-MLZQVCF3.js";
8
- import "./chunk-SCHRFI7O.js";
9
- import "./chunk-PLYZAP4W.js";
10
- import "./chunk-UABFCMPA.js";
11
- import "./chunk-77WXWU44.js";
12
- import "./chunk-6VFG3EUJ.js";
13
- import "./chunk-F6FLCHCS.js";
14
- import "./chunk-3PJXIDKI.js";
15
- import "./chunk-UWCTAVOD.js";
16
- import "./chunk-OFEVLU4C.js";
17
- import "./chunk-AVLOK27J.js";
18
- import "./chunk-JSYEZAYV.js";
19
- import "./chunk-5RNZ2QKF.js";
20
- import {
21
- BaseDeclarativeTool,
22
- BaseToolInvocation,
23
- ToolDisplayNames,
24
- ToolNames
25
- } from "./chunk-G763GDO6.js";
26
- import "./chunk-JMLIPZUU.js";
27
- import "./chunk-GBEPNWYB.js";
28
- import "./chunk-F5ORN4YO.js";
29
- import "./chunk-MVX64PNU.js";
30
- import "./chunk-D46KOV3C.js";
31
- import "./chunk-BNESGOSJ.js";
32
- import "./chunk-SZOEIL6S.js";
33
- import "./chunk-5IFG2VC4.js";
34
- import {
35
- createDebugLogger
36
- } from "./chunk-R5PDRHEF.js";
37
- import "./chunk-ZERZSAZL.js";
38
- import "./chunk-QN5NZ3UQ.js";
39
- import "./chunk-BR4QREVK.js";
40
- import "./chunk-WFVXF3OM.js";
41
- import {
42
- init_esbuild_shims
43
- } from "./chunk-A4BMJM77.js";
44
- import {
45
- __name
46
- } from "./chunk-J2S4EL5Y.js";
47
-
48
- // packages/core/src/tools/exitPlanMode.ts
49
- init_esbuild_shims();
50
- var debugLogger = createDebugLogger("EXIT_PLAN_MODE");
51
- var exitPlanModeToolDescription = `Use this tool when you are in plan mode and have finished presenting your plan and are ready to code. This will prompt the user to exit plan mode.
52
-
53
- ## When to Use This Tool
54
- IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
55
-
56
- ## Before Using This Tool
57
- Ensure your plan is complete and unambiguous:
58
- - If you have unresolved questions about requirements or approach, use AskUserQuestion first (in earlier phases)
59
- - Once your plan is finalized, use THIS tool to request approval
60
-
61
- **Important:** Do NOT use AskUserQuestion to ask "Is this plan okay?" or "Should I proceed?" - that's exactly what THIS tool does. ExitPlanMode inherently requests user approval of your plan.
62
-
63
- ## Examples
64
- 1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.
65
- 2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.
66
- 3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach.
67
- `;
68
- var exitPlanModeToolSchemaData = {
69
- name: "exit_plan_mode",
70
- description: exitPlanModeToolDescription,
71
- parametersJsonSchema: {
72
- type: "object",
73
- properties: {
74
- plan: {
75
- type: "string",
76
- description: "The plan you came up with, that you want to run by the user for approval. Supports markdown. The plan should be pretty concise."
77
- }
78
- },
79
- required: ["plan"],
80
- additionalProperties: false,
81
- $schema: "http://json-schema.org/draft-07/schema#"
82
- }
83
- };
84
- var ExitPlanModeToolInvocation = class extends BaseToolInvocation {
85
- constructor(config, params) {
86
- super(params);
87
- this.config = config;
88
- }
89
- static {
90
- __name(this, "ExitPlanModeToolInvocation");
91
- }
92
- wasApproved = false;
93
- getDescription() {
94
- return "Plan:";
95
- }
96
- /**
97
- * Plan mode exit always requires user confirmation.
98
- */
99
- async getDefaultPermission() {
100
- return "ask";
101
- }
102
- async getConfirmationDetails(_abortSignal) {
103
- const prePlanMode = this.config.getPrePlanMode();
104
- const details = {
105
- type: "plan",
106
- title: "Would you like to proceed?",
107
- plan: this.params.plan,
108
- prePlanMode,
109
- onConfirm: /* @__PURE__ */ __name(async (outcome) => {
110
- switch (outcome) {
111
- case "restore_previous" /* RestorePrevious */:
112
- this.wasApproved = true;
113
- this.setApprovalModeSafely(prePlanMode);
114
- break;
115
- case "proceed_always" /* ProceedAlways */:
116
- this.wasApproved = true;
117
- this.setApprovalModeSafely("auto-edit" /* AUTO_EDIT */);
118
- break;
119
- case "proceed_once" /* ProceedOnce */:
120
- this.wasApproved = true;
121
- this.setApprovalModeSafely("default" /* DEFAULT */);
122
- break;
123
- case "cancel" /* Cancel */:
124
- this.wasApproved = false;
125
- this.setApprovalModeSafely("plan" /* PLAN */);
126
- break;
127
- default:
128
- this.wasApproved = true;
129
- this.setApprovalModeSafely("default" /* DEFAULT */);
130
- break;
131
- }
132
- }, "onConfirm")
133
- };
134
- return details;
135
- }
136
- setApprovalModeSafely(mode) {
137
- try {
138
- this.config.setApprovalMode(mode);
139
- } catch (error) {
140
- const errorMessage = error instanceof Error ? error.message : String(error);
141
- debugLogger.error(
142
- `[ExitPlanModeTool] Failed to set approval mode to "${mode}": ${errorMessage}`
143
- );
144
- }
145
- }
146
- async execute(_signal) {
147
- const { plan } = this.params;
148
- try {
149
- const isYolo = this.config.getApprovalMode() === "yolo" /* YOLO */;
150
- const effectivelyApproved = this.wasApproved || isYolo;
151
- if (!effectivelyApproved) {
152
- const rejectionMessage = "Plan execution was not approved. Remaining in plan mode.";
153
- return {
154
- llmContent: rejectionMessage,
155
- returnDisplay: rejectionMessage
156
- };
157
- }
158
- try {
159
- this.config.savePlan(plan);
160
- } catch (error) {
161
- debugLogger.warn(
162
- `[ExitPlanModeTool] Failed to save plan to disk: ${error instanceof Error ? error.message : String(error)}`
163
- );
164
- }
165
- const llmMessage = `User has approved your plan. You can now start coding. Start with updating your todo list if applicable.`;
166
- const displayMessage = "User approved the plan.";
167
- return {
168
- llmContent: llmMessage,
169
- returnDisplay: {
170
- type: "plan_summary",
171
- message: displayMessage,
172
- plan
173
- }
174
- };
175
- } catch (error) {
176
- const errorMessage = error instanceof Error ? error.message : String(error);
177
- debugLogger.error(
178
- `[ExitPlanModeTool] Error executing exit_plan_mode: ${errorMessage}`
179
- );
180
- const errorLlmContent = `Failed to present plan: ${errorMessage}`;
181
- return {
182
- llmContent: errorLlmContent,
183
- returnDisplay: `Error presenting plan: ${errorMessage}`
184
- };
185
- }
186
- }
187
- };
188
- var ExitPlanModeTool = class _ExitPlanModeTool extends BaseDeclarativeTool {
189
- constructor(config) {
190
- super(
191
- _ExitPlanModeTool.Name,
192
- ToolDisplayNames.EXIT_PLAN_MODE,
193
- exitPlanModeToolDescription,
194
- "think" /* Think */,
195
- exitPlanModeToolSchemaData.parametersJsonSchema,
196
- true,
197
- // isOutputMarkdown
198
- false,
199
- // canUpdateOutput
200
- true,
201
- // shouldDefer — only used when leaving plan mode
202
- false,
203
- // alwaysLoad
204
- "plan mode exit approve"
205
- );
206
- this.config = config;
207
- }
208
- static {
209
- __name(this, "ExitPlanModeTool");
210
- }
211
- static Name = ToolNames.EXIT_PLAN_MODE;
212
- validateToolParams(params) {
213
- if (!params.plan || typeof params.plan !== "string" || params.plan.trim() === "") {
214
- return 'Parameter "plan" must be a non-empty string.';
215
- }
216
- return null;
217
- }
218
- createInvocation(params) {
219
- return new ExitPlanModeToolInvocation(this.config, params);
220
- }
221
- };
222
- export {
223
- ExitPlanModeTool
224
- };
225
- /**
226
- * @license
227
- * Copyright 2025 Qwen
228
- * SPDX-License-Identifier: Apache-2.0
229
- */
@@ -1,42 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import {
4
- RipGrepTool,
5
- _resetRipGrepCachesForTest
6
- } from "./chunk-6KH2Q7XN.js";
7
- import "./chunk-K5PGHDBN.js";
8
- import "./chunk-O4PICXES.js";
9
- import "./chunk-TW522KN6.js";
10
- import "./chunk-MLZQVCF3.js";
11
- import "./chunk-SCHRFI7O.js";
12
- import "./chunk-PLYZAP4W.js";
13
- import "./chunk-UABFCMPA.js";
14
- import "./chunk-77WXWU44.js";
15
- import "./chunk-6VFG3EUJ.js";
16
- import "./chunk-F6FLCHCS.js";
17
- import "./chunk-3PJXIDKI.js";
18
- import "./chunk-UWCTAVOD.js";
19
- import "./chunk-OFEVLU4C.js";
20
- import "./chunk-AVLOK27J.js";
21
- import "./chunk-JSYEZAYV.js";
22
- import "./chunk-5RNZ2QKF.js";
23
- import "./chunk-G763GDO6.js";
24
- import "./chunk-JMLIPZUU.js";
25
- import "./chunk-GBEPNWYB.js";
26
- import "./chunk-F5ORN4YO.js";
27
- import "./chunk-MVX64PNU.js";
28
- import "./chunk-D46KOV3C.js";
29
- import "./chunk-BNESGOSJ.js";
30
- import "./chunk-SZOEIL6S.js";
31
- import "./chunk-5IFG2VC4.js";
32
- import "./chunk-R5PDRHEF.js";
33
- import "./chunk-ZERZSAZL.js";
34
- import "./chunk-QN5NZ3UQ.js";
35
- import "./chunk-BR4QREVK.js";
36
- import "./chunk-WFVXF3OM.js";
37
- import "./chunk-A4BMJM77.js";
38
- import "./chunk-J2S4EL5Y.js";
39
- export {
40
- RipGrepTool,
41
- _resetRipGrepCachesForTest
42
- };
@@ -1,151 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import {
4
- BaseDeclarativeTool,
5
- BaseToolInvocation,
6
- ToolDisplayNames,
7
- ToolNames
8
- } from "./chunk-G763GDO6.js";
9
- import "./chunk-R5PDRHEF.js";
10
- import "./chunk-WFVXF3OM.js";
11
- import {
12
- init_esbuild_shims
13
- } from "./chunk-A4BMJM77.js";
14
- import {
15
- __name
16
- } from "./chunk-J2S4EL5Y.js";
17
-
18
- // packages/core/src/tools/send-message.ts
19
- init_esbuild_shims();
20
- var SendMessageInvocation = class extends BaseToolInvocation {
21
- constructor(config, params) {
22
- super(params);
23
- this.config = config;
24
- }
25
- static {
26
- __name(this, "SendMessageInvocation");
27
- }
28
- getDescription() {
29
- return `Send message to task ${this.params.task_id}`;
30
- }
31
- /**
32
- * Send-message routes free-form text into a running background task,
33
- * which will then execute it as a new instruction with full tool
34
- * access. Treat it as a privileged sink — the L4 default must not be
35
- * 'allow', because that would let the scheduler auto-approve in
36
- * AUTO mode (where 'allow' short-circuits the classifier). 'ask' lets
37
- * AUTO route through the classifier so the destination task and
38
- * message text can be inspected.
39
- */
40
- async getDefaultPermission() {
41
- return "ask";
42
- }
43
- async execute(_signal) {
44
- const registry = this.config.getBackgroundTaskRegistry();
45
- const entry = registry.get(this.params.task_id);
46
- if (!entry) {
47
- return {
48
- llmContent: `Error: No background task found with ID "${this.params.task_id}".`,
49
- returnDisplay: "Task not found.",
50
- error: {
51
- message: `Task not found: ${this.params.task_id}`,
52
- type: "send_message_not_found" /* SEND_MESSAGE_NOT_FOUND */
53
- }
54
- };
55
- }
56
- if (entry.status === "paused") {
57
- const resumed = await this.config.resumeBackgroundAgent(
58
- this.params.task_id,
59
- this.params.message
60
- );
61
- if (!resumed) {
62
- return {
63
- llmContent: `Error: Background task "${this.params.task_id}" could not be resumed.`,
64
- returnDisplay: "Task could not be resumed.",
65
- error: {
66
- message: `Task could not be resumed: ${this.params.task_id}`,
67
- type: "send_message_not_running" /* SEND_MESSAGE_NOT_RUNNING */
68
- }
69
- };
70
- }
71
- return {
72
- llmContent: `Background task "${this.params.task_id}" resumed with your message as the first continuation instruction.`,
73
- returnDisplay: `Resumed ${entry.description}`
74
- };
75
- }
76
- if (entry.status !== "running") {
77
- return {
78
- llmContent: `Error: Background task "${this.params.task_id}" is not running (status: ${entry.status}). Cannot send messages to stopped tasks.`,
79
- returnDisplay: `Task not running (${entry.status}).`,
80
- error: {
81
- message: `Task is ${entry.status}: ${this.params.task_id}`,
82
- type: "send_message_not_running" /* SEND_MESSAGE_NOT_RUNNING */
83
- }
84
- };
85
- }
86
- registry.queueMessage(this.params.task_id, this.params.message);
87
- return {
88
- llmContent: `Message queued for delivery to background task "${this.params.task_id}". The task will receive it at the next tool-round boundary.`,
89
- returnDisplay: `Message queued for ${entry.description}`
90
- };
91
- }
92
- };
93
- var SendMessageTool = class _SendMessageTool extends BaseDeclarativeTool {
94
- constructor(config) {
95
- super(
96
- _SendMessageTool.Name,
97
- ToolDisplayNames.SEND_MESSAGE,
98
- "Send a text message to a background task. Running tasks receive it at the next tool-round boundary. Paused recovered tasks are resumed first and use the message as their first continuation instruction.",
99
- "other" /* Other */,
100
- {
101
- type: "object",
102
- properties: {
103
- task_id: {
104
- type: "string",
105
- description: "The ID of the background task (from the launch response or a recovered paused task)."
106
- },
107
- message: {
108
- type: "string",
109
- description: "The text message to send to the task."
110
- }
111
- },
112
- required: ["task_id", "message"],
113
- additionalProperties: false
114
- },
115
- true,
116
- // isOutputMarkdown
117
- false,
118
- // canUpdateOutput
119
- true,
120
- // shouldDefer — sending messages to tasks is infrequent
121
- false,
122
- // alwaysLoad
123
- "send message task communicate notify"
124
- );
125
- this.config = config;
126
- }
127
- static {
128
- __name(this, "SendMessageTool");
129
- }
130
- static Name = ToolNames.SEND_MESSAGE;
131
- createInvocation(params) {
132
- return new SendMessageInvocation(this.config, params);
133
- }
134
- /**
135
- * Forward both fields verbatim to the classifier — `task_id` identifies
136
- * the privileged sink and the `message` itself is the new instruction
137
- * the background task will execute, so the classifier needs the full
138
- * text to evaluate the action's safety.
139
- */
140
- toAutoClassifierInput(params) {
141
- return { task_id: params.task_id, message: params.message };
142
- }
143
- };
144
- export {
145
- SendMessageTool
146
- };
147
- /**
148
- * @license
149
- * Copyright 2025 Qwen
150
- * SPDX-License-Identifier: Apache-2.0
151
- */