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

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 (107) hide show
  1. package/bundled/qc-helper/SKILL.md +1 -2
  2. package/bundled/qc-helper/docs/configuration/settings.md +17 -19
  3. package/bundled/qc-helper/docs/features/_meta.ts +0 -3
  4. package/bundled/qc-helper/docs/features/commands.md +14 -12
  5. package/bundled/qc-helper/docs/features/scheduled-tasks.md +1 -1
  6. package/bundled/qc-helper/docs/features/sub-agents.md +39 -0
  7. package/chunks/{agent-6J2FFD7S.js → agent-QB7TZ4HW.js} +22 -16
  8. package/chunks/agent-headless-APVHH7QM.js +50 -0
  9. package/chunks/{anthropicContentGenerator-4QBVSFSJ.js → anthropicContentGenerator-M45EVVRM.js} +4 -4
  10. package/chunks/{askUserQuestion-NOOLRWCJ.js → askUserQuestion-WM2KHM3K.js} +2 -2
  11. package/chunks/{ca-WRHFBIDH.js → ca-BARBRL6N.js} +48 -1
  12. package/chunks/{chunk-G763GDO6.js → chunk-2ZTWI7KH.js} +15 -3
  13. package/chunks/chunk-64WXLC72.js +98 -0
  14. package/chunks/{chunk-UQZQP5PA.js → chunk-7YKXFA3D.js} +11 -11
  15. package/chunks/chunk-AJIR24J2.js +59 -0
  16. package/chunks/{chunk-UXBKX55L.js → chunk-AVW55ZCO.js} +61 -23
  17. package/chunks/{chunk-SHUT5MQY.js → chunk-CNHFPN7T.js} +1 -1
  18. package/chunks/{chunk-5RNZ2QKF.js → chunk-CNSMKPK6.js} +1 -1
  19. package/chunks/{chunk-BBTV54KB.js → chunk-CWV3SJZS.js} +2 -2
  20. package/chunks/{chunk-GBEPNWYB.js → chunk-GX7VH5JQ.js} +1 -1
  21. package/chunks/chunk-HGJPQK33.js +2231 -0
  22. package/chunks/chunk-HV3ZZ7G4.js +159 -0
  23. package/chunks/{chunk-BPZQVC2P.js → chunk-HXJE7VOG.js} +25 -32
  24. package/chunks/{chunk-PLYZAP4W.js → chunk-ICOI4E4S.js} +1 -1
  25. package/chunks/{chunk-6VFG3EUJ.js → chunk-JUGRPQAB.js} +1 -1
  26. package/chunks/{chunk-AVLOK27J.js → chunk-JVQOQ3OU.js} +1 -1
  27. package/chunks/{chunk-R5PDRHEF.js → chunk-JXAZUMDW.js} +67 -45
  28. package/chunks/{chunk-UABFCMPA.js → chunk-KC6ZMJ5X.js} +3 -1
  29. package/chunks/chunk-LD2XBG6Z.js +102 -0
  30. package/chunks/{chunk-MVX64PNU.js → chunk-LR62TEET.js} +1 -1
  31. package/chunks/{chunk-JMLIPZUU.js → chunk-MVIVIPCU.js} +3 -3
  32. package/chunks/{chunk-IKOMHTCC.js → chunk-NW5QBUYO.js} +6 -6
  33. package/chunks/{chunk-JSYEZAYV.js → chunk-P4J26VDS.js} +2 -2
  34. package/chunks/{chunk-SCHRFI7O.js → chunk-PAEBHDIO.js} +1 -1
  35. package/chunks/{chunk-BUOJN3MM.js → chunk-QCG6KPNM.js} +3685 -1897
  36. package/chunks/chunk-SKBPNJEW.js +45 -0
  37. package/chunks/{chunk-F5ORN4YO.js → chunk-UAMOBVVW.js} +1 -1
  38. package/chunks/chunk-XBFVXFB2.js +216 -0
  39. package/chunks/{chunk-D46KOV3C.js → chunk-Y7R6H6FT.js} +1 -1
  40. package/chunks/{chunk-3H7ENG2Q.js → chunk-ZK4AMNIU.js} +113 -41
  41. package/chunks/{computer-use-6LZXL3UW.js → computer-use-B7VIUI7F.js} +22 -16
  42. package/chunks/contextCommand-63RZ3O5R.js +52 -0
  43. package/chunks/{cron-create-PIPMXQN4.js → cron-create-FI5LJVUS.js} +2 -2
  44. package/chunks/{cron-delete-6Y5XIDMS.js → cron-delete-ZGUXWBTG.js} +2 -2
  45. package/chunks/{cron-list-A4WNRUWZ.js → cron-list-QNNZGMN3.js} +2 -2
  46. package/chunks/{de-M5RPB2NB.js → de-YGKK2BC4.js} +48 -1
  47. package/chunks/{edit-J7D6VMPQ.js → edit-6UBTS2J5.js} +23 -17
  48. package/chunks/{en-UMYKQAZE.js → en-HSQQNQUB.js} +73 -2
  49. package/chunks/{enter-worktree-NDJTVGYJ.js → enter-worktree-NN7LIXCM.js} +22 -16
  50. package/chunks/{exit-worktree-UB6XYYAX.js → exit-worktree-GGSS5KIE.js} +22 -16
  51. package/chunks/{exitPlanMode-V6X2KL4X.js → exitPlanMode-H323NHB2.js} +22 -16
  52. package/chunks/{fr-MPYXXXPW.js → fr-JXBKPJKQ.js} +48 -1
  53. package/chunks/{geminiContentGenerator-3AKHMB3P.js → geminiContentGenerator-I4H2NLJG.js} +4 -4
  54. package/chunks/{glob-PBG5DRG4.js → glob-OLCX57MD.js} +22 -16
  55. package/chunks/{grep-VQ56EWQ7.js → grep-7HXIMDOW.js} +22 -16
  56. package/chunks/{ja-NFZ32AB3.js → ja-TGPZSP2B.js} +48 -1
  57. package/chunks/{keychain-token-storage-UHGOCDD6.js → keychain-token-storage-LB46DAEK.js} +2 -2
  58. package/chunks/{ls-34DLNYCD.js → ls-6PEZUK6O.js} +3 -3
  59. package/chunks/{lsp-NCDEHH3V.js → lsp-JZSJOVT7.js} +2 -2
  60. package/chunks/{monitor-J3YCSOEH.js → monitor-SQO7MVAV.js} +22 -16
  61. package/chunks/{notebook-edit-AL3CBYJ6.js → notebook-edit-72L3EBAL.js} +23 -17
  62. package/chunks/{openaiContentGenerator-3U6UARHS.js → openaiContentGenerator-FTR7CDWF.js} +12 -11
  63. package/chunks/{pt-BR43FRBA.js → pt-TIBG6BIO.js} +48 -1
  64. package/chunks/{qwenContentGenerator-JRFHJRH6.js → qwenContentGenerator-U5UFQ566.js} +24 -18
  65. package/chunks/{qwenOAuth2-KRJT35QH.js → qwenOAuth2-EFSECGHF.js} +4 -4
  66. package/chunks/{read-file-ZF6EIVE3.js → read-file-UA64EEQC.js} +8 -8
  67. package/chunks/{ripGrep-N2ZT7M6Z.js → ripGrep-WSYCWZVK.js} +22 -16
  68. package/chunks/{ru-DQCW2KHD.js → ru-JBCHCK4L.js} +48 -1
  69. package/chunks/{scheduler-OS37FUFT.js → scheduler-VBASHOCA.js} +22 -16
  70. package/chunks/send-message-OYJZ5TPG.js +244 -0
  71. package/chunks/{serve-ABOLLDNN.js → serve-A7E2OJDR.js} +45 -36
  72. package/chunks/{shell-XGN7IDUS.js → shell-3NFOT6F5.js} +22 -16
  73. package/chunks/{skill-YQQ6CR4U.js → skill-RA5YUREY.js} +10 -10
  74. package/chunks/{src-LORPPHWB.js → src-NFCMARMT.js} +186 -23
  75. package/chunks/{syntheticOutput-T5SWX3YF.js → syntheticOutput-DETQ2YM6.js} +3 -3
  76. package/chunks/task-create-Y3ZKTJIG.js +19 -0
  77. package/chunks/task-list-ONXJ3I3A.js +151 -0
  78. package/chunks/{task-stop-3VHAQMYM.js → task-stop-UHDC4N5B.js} +2 -2
  79. package/chunks/task-update-TCNOU3P5.js +397 -0
  80. package/chunks/team-create-6SR4OVRG.js +313 -0
  81. package/chunks/team-delete-EJ4U4DDP.js +114 -0
  82. package/chunks/{todoWrite-EAGJGKO5.js → todoWrite-TEYDRS5L.js} +4 -4
  83. package/chunks/{tool-search-PDOJPXJJ.js → tool-search-OD435A3X.js} +8 -8
  84. package/chunks/{web-fetch-SS6IKK6N.js → web-fetch-6W67H5PO.js} +4 -4
  85. package/chunks/workflow-62DHH4EO.js +708 -0
  86. package/chunks/{write-file-VWWCN7LI.js → write-file-475L5OPP.js} +23 -17
  87. package/chunks/{zh-TW-IQZ4AD5M.js → zh-TW-G3HFHVVT.js} +74 -6
  88. package/chunks/{zh-6VFXOAR5.js → zh-VCLWO26Y.js} +77 -6
  89. package/cli.js +6429 -3123
  90. package/examples/agent/qwen-extension.json +1 -0
  91. package/examples/commands/qwen-extension.json +1 -0
  92. package/examples/context/qwen-extension.json +1 -0
  93. package/examples/mcp-server/qwen-extension.json +1 -0
  94. package/examples/skills/qwen-extension.json +1 -0
  95. package/locales/ca.js +51 -0
  96. package/locales/de.js +51 -0
  97. package/locales/en.js +83 -2
  98. package/locales/fr.js +53 -2
  99. package/locales/ja.js +52 -2
  100. package/locales/pt.js +52 -2
  101. package/locales/ru.js +53 -2
  102. package/locales/zh-TW.js +85 -11
  103. package/locales/zh.js +89 -11
  104. package/package.json +2 -2
  105. package/bundled/qc-helper/docs/features/checkpointing.md +0 -77
  106. package/chunks/contextCommand-ZV5QQ2LA.js +0 -46
  107. package/chunks/send-message-YYF56TS7.js +0 -151
@@ -0,0 +1,19 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ TaskCreateTool,
5
+ truncateForConfirmation
6
+ } from "./chunk-HV3ZZ7G4.js";
7
+ import "./chunk-HGJPQK33.js";
8
+ import "./chunk-XBFVXFB2.js";
9
+ import "./chunk-LD2XBG6Z.js";
10
+ import "./chunk-2ZTWI7KH.js";
11
+ import "./chunk-UAMOBVVW.js";
12
+ import "./chunk-JXAZUMDW.js";
13
+ import "./chunk-WFVXF3OM.js";
14
+ import "./chunk-A4BMJM77.js";
15
+ import "./chunk-J2S4EL5Y.js";
16
+ export {
17
+ TaskCreateTool,
18
+ truncateForConfirmation
19
+ };
@@ -0,0 +1,151 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ listTasks
5
+ } from "./chunk-HGJPQK33.js";
6
+ import "./chunk-XBFVXFB2.js";
7
+ import {
8
+ getTeamName,
9
+ resolveActiveTeamName
10
+ } from "./chunk-LD2XBG6Z.js";
11
+ import {
12
+ BaseDeclarativeTool,
13
+ BaseToolInvocation,
14
+ ToolDisplayNames,
15
+ ToolNames
16
+ } from "./chunk-2ZTWI7KH.js";
17
+ import "./chunk-UAMOBVVW.js";
18
+ import "./chunk-JXAZUMDW.js";
19
+ import "./chunk-WFVXF3OM.js";
20
+ import {
21
+ init_esbuild_shims
22
+ } from "./chunk-A4BMJM77.js";
23
+ import {
24
+ __name
25
+ } from "./chunk-J2S4EL5Y.js";
26
+
27
+ // packages/core/src/tools/task-list.ts
28
+ init_esbuild_shims();
29
+ var TaskListInvocation = class extends BaseToolInvocation {
30
+ constructor(config, params) {
31
+ super(params);
32
+ this.config = config;
33
+ }
34
+ static {
35
+ __name(this, "TaskListInvocation");
36
+ }
37
+ getDescription() {
38
+ const filters = [];
39
+ if (this.params.status) {
40
+ filters.push(`status=${this.params.status}`);
41
+ }
42
+ if (this.params.owner) {
43
+ filters.push(`owner=${this.params.owner}`);
44
+ }
45
+ if (this.params.blockedBy) {
46
+ filters.push(`blockedBy=${this.params.blockedBy}`);
47
+ }
48
+ return filters.length > 0 ? `List tasks (${filters.join(", ")})` : "List all tasks";
49
+ }
50
+ async execute() {
51
+ const teamName = resolveActiveTeamName(
52
+ this.config.getTeamContext()?.teamName
53
+ );
54
+ if (!teamName) {
55
+ const msg = "No active team. Create a team first.";
56
+ return {
57
+ llmContent: msg,
58
+ returnDisplay: msg,
59
+ error: { message: msg }
60
+ };
61
+ }
62
+ const tasks = await listTasks(teamName, {
63
+ status: this.params.status,
64
+ owner: this.params.owner,
65
+ blockedBy: this.params.blockedBy
66
+ });
67
+ if (tasks.length === 0) {
68
+ const llmContent2 = "No tasks found.";
69
+ return { llmContent: llmContent2, returnDisplay: llmContent2 };
70
+ }
71
+ const lines = tasks.map(
72
+ (t) => `#${t.id} [${t.status}]` + (t.owner ? ` @${t.owner}` : "") + ` \u2014 ${t.subject}`
73
+ );
74
+ const manager = this.config.getTeamManager();
75
+ if (manager && !getTeamName()) {
76
+ try {
77
+ const msgs = await manager.getLeaderMessages();
78
+ if (msgs.length > 0) {
79
+ lines.push("");
80
+ lines.push("--- Teammate messages ---");
81
+ for (const wrapped of manager.formatLeaderEnvelope(msgs)) {
82
+ lines.push(wrapped);
83
+ }
84
+ }
85
+ } catch {
86
+ }
87
+ if (manager.hasActiveTeammates()) {
88
+ lines.push("");
89
+ lines.push(
90
+ "NOTE: Teammates are still working. Their results will be delivered as messages \u2014 do NOT call task_list again to check. End your turn and wait for teammate messages."
91
+ );
92
+ }
93
+ }
94
+ const llmContent = lines.join("\n");
95
+ const display = {
96
+ type: "task_list",
97
+ tasks: tasks.map((t) => ({
98
+ id: t.id,
99
+ subject: t.subject,
100
+ status: t.status,
101
+ owner: t.owner
102
+ }))
103
+ };
104
+ return { llmContent, returnDisplay: display };
105
+ }
106
+ };
107
+ var TaskListTool = class _TaskListTool extends BaseDeclarativeTool {
108
+ constructor(config) {
109
+ super(
110
+ _TaskListTool.Name,
111
+ ToolDisplayNames.TASK_LIST,
112
+ "List tasks in the team task list. All filter parameters are optional.",
113
+ "read" /* Read */,
114
+ {
115
+ type: "object",
116
+ properties: {
117
+ status: {
118
+ type: "string",
119
+ enum: ["pending", "in_progress", "completed"],
120
+ description: "Filter by task status."
121
+ },
122
+ owner: {
123
+ type: "string",
124
+ description: "Filter by owner agent name."
125
+ },
126
+ blockedBy: {
127
+ type: "string",
128
+ description: "Filter for tasks blocked by this task ID."
129
+ }
130
+ },
131
+ additionalProperties: false
132
+ }
133
+ );
134
+ this.config = config;
135
+ }
136
+ static {
137
+ __name(this, "TaskListTool");
138
+ }
139
+ static Name = ToolNames.TASK_LIST;
140
+ createInvocation(params) {
141
+ return new TaskListInvocation(this.config, params);
142
+ }
143
+ };
144
+ export {
145
+ TaskListTool
146
+ };
147
+ /**
148
+ * @license
149
+ * Copyright 2025 Qwen
150
+ * SPDX-License-Identifier: Apache-2.0
151
+ */
@@ -5,8 +5,8 @@ import {
5
5
  BaseToolInvocation,
6
6
  ToolDisplayNames,
7
7
  ToolNames
8
- } from "./chunk-G763GDO6.js";
9
- import "./chunk-R5PDRHEF.js";
8
+ } from "./chunk-2ZTWI7KH.js";
9
+ import "./chunk-JXAZUMDW.js";
10
10
  import "./chunk-WFVXF3OM.js";
11
11
  import {
12
12
  init_esbuild_shims
@@ -0,0 +1,397 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ truncateForConfirmation
5
+ } from "./chunk-HV3ZZ7G4.js";
6
+ import {
7
+ TaskOwnershipError,
8
+ assertValidTaskId,
9
+ deleteTask,
10
+ getTask,
11
+ listTasks,
12
+ updateTask
13
+ } from "./chunk-HGJPQK33.js";
14
+ import "./chunk-XBFVXFB2.js";
15
+ import {
16
+ getAgentName,
17
+ isTeammate,
18
+ resolveActiveTeamName
19
+ } from "./chunk-LD2XBG6Z.js";
20
+ import {
21
+ BaseDeclarativeTool,
22
+ BaseToolInvocation,
23
+ ToolDisplayNames,
24
+ ToolNames
25
+ } from "./chunk-2ZTWI7KH.js";
26
+ import "./chunk-UAMOBVVW.js";
27
+ import "./chunk-JXAZUMDW.js";
28
+ import "./chunk-WFVXF3OM.js";
29
+ import {
30
+ init_esbuild_shims
31
+ } from "./chunk-A4BMJM77.js";
32
+ import {
33
+ __name
34
+ } from "./chunk-J2S4EL5Y.js";
35
+
36
+ // packages/core/src/tools/task-update.ts
37
+ init_esbuild_shims();
38
+ async function findDependencyCycle(teamName, taskId, addBlocks, addBlockedBy) {
39
+ const tasks = await listTasks(teamName);
40
+ const adjacency = /* @__PURE__ */ new Map();
41
+ const edge = /* @__PURE__ */ __name((from, to) => {
42
+ let set = adjacency.get(from);
43
+ if (!set) {
44
+ set = /* @__PURE__ */ new Set();
45
+ adjacency.set(from, set);
46
+ }
47
+ set.add(to);
48
+ }, "edge");
49
+ for (const task of tasks) {
50
+ for (const id of task.blocks) edge(task.id, id);
51
+ for (const id of task.blockedBy) edge(id, task.id);
52
+ }
53
+ for (const id of addBlocks) edge(taskId, id);
54
+ for (const id of addBlockedBy) edge(id, taskId);
55
+ const path = [];
56
+ const visited = /* @__PURE__ */ new Set();
57
+ const walk = /* @__PURE__ */ __name((node) => {
58
+ path.push(node);
59
+ for (const next of adjacency.get(node) ?? []) {
60
+ if (next === taskId) return [...path, taskId];
61
+ if (visited.has(next)) continue;
62
+ visited.add(next);
63
+ const found = walk(next);
64
+ if (found) return found;
65
+ }
66
+ path.pop();
67
+ return null;
68
+ }, "walk");
69
+ visited.add(taskId);
70
+ return walk(taskId);
71
+ }
72
+ __name(findDependencyCycle, "findDependencyCycle");
73
+ var TaskUpdateInvocation = class extends BaseToolInvocation {
74
+ constructor(config, params) {
75
+ super(params);
76
+ this.config = config;
77
+ }
78
+ static {
79
+ __name(this, "TaskUpdateInvocation");
80
+ }
81
+ getDescription() {
82
+ const parts = [`Task #${this.params.taskId}`];
83
+ if (this.params.status) {
84
+ parts.push(`\u2192 ${this.params.status}`);
85
+ }
86
+ if (this.params.owner) {
87
+ parts.push(`owner: ${this.params.owner}`);
88
+ }
89
+ return parts.join(" ");
90
+ }
91
+ /**
92
+ * Mutating a task's `subject`/`description` rewrites the prompt an idle
93
+ * teammate will auto-claim and execute with full tool access — the same
94
+ * privileged-sink shape as `send_message` and `task_create`. The base
95
+ * default `'allow'` short-circuits the classifier in AUTO mode, so
96
+ * override to `'ask'` to keep that injection path under the classifier /
97
+ * human-in-the-loop.
98
+ */
99
+ async getDefaultPermission() {
100
+ return "ask";
101
+ }
102
+ /**
103
+ * Surface the rewritten instruction text at approval time: an updated
104
+ * `description` is what a claiming teammate will execute, so the
105
+ * dialog must show it — getDescription()'s one-liner only carries
106
+ * status/owner. See task-create.ts for the same rationale.
107
+ */
108
+ getConfirmationDetails(_abortSignal) {
109
+ const lines = [this.getDescription()];
110
+ if (this.params.subject !== void 0) {
111
+ lines.push(`subject: ${this.params.subject}`);
112
+ }
113
+ if (this.params.addBlocks?.length) {
114
+ lines.push(`blocks: ${this.params.addBlocks.join(", ")}`);
115
+ }
116
+ if (this.params.addBlockedBy?.length) {
117
+ lines.push(`blocked by: ${this.params.addBlockedBy.join(", ")}`);
118
+ }
119
+ if (this.params.description !== void 0) {
120
+ lines.push("", truncateForConfirmation(this.params.description));
121
+ }
122
+ const details = {
123
+ type: "info",
124
+ title: "Confirm TaskUpdate",
125
+ prompt: lines.join("\n"),
126
+ onConfirm: /* @__PURE__ */ __name(async () => {
127
+ }, "onConfirm")
128
+ };
129
+ return Promise.resolve(details);
130
+ }
131
+ async execute() {
132
+ const teamName = resolveActiveTeamName(
133
+ this.config.getTeamContext()?.teamName
134
+ );
135
+ if (!teamName) {
136
+ const msg = "No active team. Create a team first.";
137
+ return {
138
+ llmContent: msg,
139
+ returnDisplay: msg,
140
+ error: { message: msg }
141
+ };
142
+ }
143
+ const { taskId } = this.params;
144
+ try {
145
+ assertValidTaskId(taskId);
146
+ for (const id of this.params.addBlocks ?? []) {
147
+ assertValidTaskId(id);
148
+ }
149
+ for (const id of this.params.addBlockedBy ?? []) {
150
+ assertValidTaskId(id);
151
+ }
152
+ } catch (err) {
153
+ const msg = err instanceof Error ? err.message : String(err);
154
+ return {
155
+ llmContent: msg,
156
+ returnDisplay: msg,
157
+ error: { message: msg }
158
+ };
159
+ }
160
+ const teammateCallerName = isTeammate() ? getAgentName() : void 0;
161
+ if (this.params.status === "deleted") {
162
+ let ok;
163
+ try {
164
+ ok = await deleteTask(
165
+ teamName,
166
+ taskId,
167
+ teammateCallerName !== void 0 ? { callerName: teammateCallerName } : void 0
168
+ );
169
+ } catch (err) {
170
+ if (err instanceof TaskOwnershipError) {
171
+ return {
172
+ llmContent: err.message,
173
+ returnDisplay: err.message,
174
+ error: { message: err.message }
175
+ };
176
+ }
177
+ throw err;
178
+ }
179
+ if (!ok) {
180
+ const msg2 = `Task #${taskId} not found.`;
181
+ return {
182
+ llmContent: msg2,
183
+ returnDisplay: msg2,
184
+ error: { message: msg2 }
185
+ };
186
+ }
187
+ const msg = `Task #${taskId} deleted.`;
188
+ return { llmContent: msg, returnDisplay: msg };
189
+ }
190
+ if (this.params.addBlocks?.includes(taskId) || this.params.addBlockedBy?.includes(taskId)) {
191
+ const msg = `Cannot update task #${taskId}: a task cannot block or be blocked by itself.`;
192
+ return {
193
+ llmContent: msg,
194
+ returnDisplay: msg,
195
+ error: { message: msg }
196
+ };
197
+ }
198
+ const referencedIds = /* @__PURE__ */ new Set();
199
+ for (const id of this.params.addBlocks ?? []) {
200
+ if (id !== taskId) referencedIds.add(id);
201
+ }
202
+ for (const id of this.params.addBlockedBy ?? []) {
203
+ if (id !== taskId) referencedIds.add(id);
204
+ }
205
+ if (referencedIds.size > 0) {
206
+ const missing = [];
207
+ await Promise.all(
208
+ Array.from(referencedIds).map(async (id) => {
209
+ const t = await getTask(teamName, id);
210
+ if (!t) missing.push(id);
211
+ })
212
+ );
213
+ if (missing.length > 0) {
214
+ const ids = missing.sort().map((id) => `#${id}`).join(", ");
215
+ const msg = `Cannot update task #${taskId}: referenced task${missing.length === 1 ? "" : "s"} ${ids} not found.`;
216
+ return {
217
+ llmContent: msg,
218
+ returnDisplay: msg,
219
+ error: { message: msg }
220
+ };
221
+ }
222
+ const cycle = await findDependencyCycle(
223
+ teamName,
224
+ taskId,
225
+ this.params.addBlocks ?? [],
226
+ this.params.addBlockedBy ?? []
227
+ );
228
+ if (cycle) {
229
+ const msg = `Cannot update task #${taskId}: this would create a dependency cycle (${cycle.map((id) => `#${id}`).join(" \u2192 ")}).`;
230
+ return {
231
+ llmContent: msg,
232
+ returnDisplay: msg,
233
+ error: { message: msg }
234
+ };
235
+ }
236
+ }
237
+ const autoOwner = this.params.status === "in_progress" && this.params.owner === void 0 ? getAgentName() : void 0;
238
+ if (this.params.status === "in_progress" && !this.params.owner && !autoOwner) {
239
+ const msg = `Cannot move task #${taskId} to in_progress without an owner. Specify the "owner" parameter.`;
240
+ return {
241
+ llmContent: msg,
242
+ returnDisplay: msg,
243
+ error: { message: msg }
244
+ };
245
+ }
246
+ let task;
247
+ try {
248
+ task = await updateTask(
249
+ teamName,
250
+ taskId,
251
+ {
252
+ status: this.params.status,
253
+ owner: this.params.owner ?? autoOwner,
254
+ subject: this.params.subject,
255
+ description: this.params.description,
256
+ activeForm: this.params.activeForm,
257
+ metadata: this.params.metadata,
258
+ addBlocks: this.params.addBlocks,
259
+ addBlockedBy: this.params.addBlockedBy
260
+ },
261
+ teammateCallerName !== void 0 ? { callerName: teammateCallerName } : void 0
262
+ );
263
+ } catch (err) {
264
+ if (err instanceof TaskOwnershipError) {
265
+ return {
266
+ llmContent: err.message,
267
+ returnDisplay: err.message,
268
+ error: { message: err.message }
269
+ };
270
+ }
271
+ throw err;
272
+ }
273
+ if (!task) {
274
+ const msg = `Task #${taskId} not found.`;
275
+ return {
276
+ llmContent: msg,
277
+ returnDisplay: msg,
278
+ error: { message: msg }
279
+ };
280
+ }
281
+ const reciprocalUpdates = [];
282
+ if (this.params.addBlocks?.length && this.params.status !== "completed") {
283
+ for (const blockedId of this.params.addBlocks) {
284
+ if (blockedId === taskId) continue;
285
+ reciprocalUpdates.push(
286
+ updateTask(teamName, blockedId, { addBlockedBy: [taskId] })
287
+ );
288
+ }
289
+ }
290
+ if (this.params.addBlockedBy?.length) {
291
+ for (const blockerId of this.params.addBlockedBy) {
292
+ if (blockerId === taskId) continue;
293
+ reciprocalUpdates.push(
294
+ updateTask(teamName, blockerId, { addBlocks: [taskId] })
295
+ );
296
+ }
297
+ }
298
+ if (reciprocalUpdates.length > 0) {
299
+ await Promise.all(reciprocalUpdates);
300
+ }
301
+ const llmContent = `Task #${taskId} updated (status: ${task.status}` + (task.owner ? `, owner: ${task.owner}` : "") + ").";
302
+ return { llmContent, returnDisplay: llmContent };
303
+ }
304
+ };
305
+ var TaskUpdateTool = class _TaskUpdateTool extends BaseDeclarativeTool {
306
+ constructor(config) {
307
+ super(
308
+ _TaskUpdateTool.Name,
309
+ ToolDisplayNames.TASK_UPDATE,
310
+ 'Update an existing task. Can change status, owner, subject, description, and blocking relationships. Set status to "deleted" to remove a task. Setting status to "in_progress" auto-assigns you as owner if no owner is set.',
311
+ "other" /* Other */,
312
+ {
313
+ type: "object",
314
+ properties: {
315
+ taskId: {
316
+ type: "string",
317
+ description: "ID of the task to update."
318
+ },
319
+ status: {
320
+ type: "string",
321
+ enum: ["pending", "in_progress", "completed", "deleted"],
322
+ description: "New task status."
323
+ },
324
+ owner: {
325
+ type: "string",
326
+ description: "New owner agent name. Set to empty string to unassign."
327
+ },
328
+ subject: {
329
+ type: "string",
330
+ maxLength: 200,
331
+ description: "Updated task title."
332
+ },
333
+ description: {
334
+ type: "string",
335
+ maxLength: 1e4,
336
+ description: "Updated task description."
337
+ },
338
+ activeForm: {
339
+ type: "string",
340
+ maxLength: 200,
341
+ description: "Present tense label for UI."
342
+ },
343
+ metadata: {
344
+ type: "object",
345
+ description: "Metadata to merge. Set a key to null to delete it."
346
+ },
347
+ addBlocks: {
348
+ type: "array",
349
+ items: { type: "string" },
350
+ description: "Task IDs that this task blocks."
351
+ },
352
+ addBlockedBy: {
353
+ type: "array",
354
+ items: { type: "string" },
355
+ description: "Task IDs that block this task."
356
+ }
357
+ },
358
+ required: ["taskId"],
359
+ additionalProperties: false
360
+ }
361
+ );
362
+ this.config = config;
363
+ }
364
+ static {
365
+ __name(this, "TaskUpdateTool");
366
+ }
367
+ static Name = ToolNames.TASK_UPDATE;
368
+ createInvocation(params) {
369
+ return new TaskUpdateInvocation(this.config, params);
370
+ }
371
+ /**
372
+ * Forward the mutating fields to the classifier. Without this the
373
+ * base `''` sentinel projects to `task_update({})` and the AUTO
374
+ * classifier rules on an empty call — the rewritten instruction
375
+ * text and ownership/edge changes that `'ask'` exists to inspect
376
+ * would be invisible to it. See task-create.ts / send-message.ts.
377
+ */
378
+ toAutoClassifierInput(params) {
379
+ return {
380
+ taskId: params.taskId,
381
+ status: params.status,
382
+ owner: params.owner,
383
+ subject: params.subject,
384
+ description: params.description,
385
+ addBlocks: params.addBlocks,
386
+ addBlockedBy: params.addBlockedBy
387
+ };
388
+ }
389
+ };
390
+ export {
391
+ TaskUpdateTool
392
+ };
393
+ /**
394
+ * @license
395
+ * Copyright 2025 Qwen
396
+ * SPDX-License-Identifier: Apache-2.0
397
+ */