@teamclaws/teamclaw 2026.4.3-2 → 2026.5.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.
@@ -38,6 +38,9 @@ const EXECUTION_READY_BLOCKERS: Array<{ pattern: RegExp; reason: string }> = [
38
38
  { pattern: /\bwait(?:ing)?\s+for\b/i, reason: "it says the work should wait for another output first" },
39
39
  { pattern: /依赖于|前置条件|前置依赖|前提条件|前序任务|上游任务/u, reason: "it explicitly mentions a predecessor dependency" },
40
40
  { pattern: /待.*完成|等待.*完成/u, reason: "it is described as work for a later phase" },
41
+ { pattern: /前提/u, reason: "it mentions a prerequisite condition that may not be satisfied yet" },
42
+ { pattern: /blocked\s*-\s*by/i, reason: "it explicitly says the task is blocked by another item" },
43
+ { pattern: /需要.*先完成/u, reason: "it states another piece of work must complete first" },
41
44
  ];
42
45
 
43
46
  const VALID_ROLE_IDS = new Set([
@@ -79,6 +82,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
79
82
  const kickoffHandler = deps.getKickoffHandler?.();
80
83
  if (!kickoffHandler) {
81
84
  return {
85
+ details: {},
82
86
  content: [{
83
87
  type: "text" as const,
84
88
  text: "Kickoff meeting is not available in this deployment. Proceed with direct task creation.",
@@ -88,7 +92,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
88
92
 
89
93
  const requirement = String(params.requirement ?? "").trim();
90
94
  if (!requirement) {
91
- return { content: [{ type: "text" as const, text: "requirement is required." }] };
95
+ return { details: {}, content: [{ type: "text" as const, text: "requirement is required." }] };
92
96
  }
93
97
 
94
98
  const rawRoles = Array.isArray(params.candidateRoles) ? params.candidateRoles : [];
@@ -97,7 +101,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
97
101
  .filter((r): r is RoleId => VALID_ROLE_IDS.has(r));
98
102
 
99
103
  if (candidateRoles.length === 0) {
100
- return { content: [{ type: "text" as const, text: "At least one valid candidate role is required." }] };
104
+ return { details: {}, content: [{ type: "text" as const, text: "At least one valid candidate role is required." }] };
101
105
  }
102
106
 
103
107
  const complexity = (params.complexity === "simple" || params.complexity === "medium" || params.complexity === "complex")
@@ -107,6 +111,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
107
111
  try {
108
112
  const result = await kickoffHandler(candidateRoles, complexity, requirement);
109
113
  return {
114
+ details: {},
110
115
  content: [{
111
116
  type: "text" as const,
112
117
  text: result.summary,
@@ -114,6 +119,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
114
119
  };
115
120
  } catch (err) {
116
121
  return {
122
+ details: {},
117
123
  content: [{
118
124
  type: "text" as const,
119
125
  text: `Kickoff meeting failed: ${err instanceof Error ? err.message : String(err)}. Proceed with controller-only planning.`,
@@ -130,7 +136,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
130
136
  title: Type.String({ description: "Task title" }),
131
137
  description: Type.String({ description: "Execution-ready task description with scope, expected deliverable, constraints, resolved clarifications, and no unmet predecessor dependency" }),
132
138
  priority: Type.Optional(Type.String({ description: "Priority: low, medium, high, critical" })),
133
- assignedRole: Type.Optional(Type.String({ description: "Exact target role ID (pm, architect, developer, qa, release-engineer, infra-engineer, devops, security-engineer, designer, marketing)" })),
139
+ assignedRole: Type.Optional(Type.String({ description: "Exact target role ID (pm, architect, developer, qa, release-engineer, infra-engineer, devops, security-engineer, designer, marketing, data-engineer)" })),
134
140
  projectName: Type.Optional(Type.String({ description: "Stable project key to reuse or create for this task (for example: ggcode, todo-rest-api)." })),
135
141
  recommendedSkills: Type.Optional(
136
142
  Type.Array(
@@ -145,12 +151,13 @@ export function createControllerTools(deps: ControllerToolsDeps) {
145
151
  const description = String(params.description ?? "");
146
152
  const normalizedSessionKey = typeof sessionKey === "string" ? sessionKey.trim() : "";
147
153
  if (!title) {
148
- return { content: [{ type: "text" as const, text: "title is required." }] };
154
+ return { details: {}, content: [{ type: "text" as const, text: "title is required." }] };
149
155
  }
150
156
 
151
157
  const state = getTeamState();
152
158
  if (shouldBlockControllerWithoutWorkers(config, state)) {
153
159
  return {
160
+ details: {},
154
161
  content: [{
155
162
  type: "text" as const,
156
163
  text: `${buildControllerNoWorkersMessage()} Stop after reporting this block to the human.`,
@@ -161,6 +168,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
161
168
  const blocker = detectExecutionReadyBlocker(description);
162
169
  if (blocker) {
163
170
  return {
171
+ details: {},
164
172
  content: [{
165
173
  type: "text" as const,
166
174
  text: `Refusing to create task "${title}" because it is not execution-ready: ${blocker}. Only create tasks that can start immediately; keep downstream work in the controller plan until prerequisites are already complete.`,
@@ -170,6 +178,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
170
178
  const overlapBlocker = detectActiveTaskOverlap(title, description, state);
171
179
  if (overlapBlocker) {
172
180
  return {
181
+ details: {},
173
182
  content: [{
174
183
  type: "text" as const,
175
184
  text: `Refusing to create task "${title}" because it is not execution-ready: ${overlapBlocker}. Wait for the active task to finish or narrow the new task so it does not edit the same service scope in parallel.`,
@@ -195,7 +204,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
195
204
 
196
205
  if (!res.ok) {
197
206
  const err = await res.text();
198
- return { content: [{ type: "text" as const, text: `Failed to create task: ${err}` }] };
207
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to create task: ${err}` }] };
199
208
  }
200
209
 
201
210
  const data = await res.json() as { task: TaskInfo };
@@ -212,13 +221,14 @@ export function createControllerTools(deps: ControllerToolsDeps) {
212
221
  : "";
213
222
 
214
223
  return {
224
+ details: {},
215
225
  content: [{
216
226
  type: "text" as const,
217
227
  text: `Task created: ${task.title} [${task.id}] [${task.priority}]${assigned}${recommended}`,
218
228
  }],
219
229
  };
220
230
  } catch (err) {
221
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
231
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
222
232
  }
223
233
  },
224
234
  },
@@ -295,6 +305,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
295
305
  const normalizedSessionKey = typeof sessionKey === "string" ? sessionKey.trim() : "";
296
306
  if (!normalizedSessionKey) {
297
307
  return {
308
+ details: {},
298
309
  content: [{
299
310
  type: "text" as const,
300
311
  text: "Cannot record controller manifest because the current TeamClaw controller session key is missing.",
@@ -304,7 +315,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
304
315
 
305
316
  const requirementSummary = String(params.requirementSummary ?? "").trim();
306
317
  if (!requirementSummary) {
307
- return { content: [{ type: "text" as const, text: "requirementSummary is required." }] };
318
+ return { details: {}, content: [{ type: "text" as const, text: "requirementSummary is required." }] };
308
319
  }
309
320
 
310
321
  const clarificationSchemas = normalizeClarificationQuestionSchemas(params.clarificationSchemas);
@@ -337,17 +348,18 @@ export function createControllerTools(deps: ControllerToolsDeps) {
337
348
 
338
349
  if (!res.ok) {
339
350
  const err = await res.text();
340
- return { content: [{ type: "text" as const, text: `Failed to record controller manifest: ${err}` }] };
351
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to record controller manifest: ${err}` }] };
341
352
  }
342
353
 
343
354
  return {
355
+ details: {},
344
356
  content: [{
345
357
  type: "text" as const,
346
358
  text: `Controller manifest recorded: roles=${manifest.requiredRoles.join(", ") || "none"} created=${manifest.createdTasks.length} deferred=${manifest.deferredTasks.length}${manifest.requirementFullyComplete ? " requirementFullyComplete=true" : ""}`,
347
359
  }],
348
360
  };
349
361
  } catch (err) {
350
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
362
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
351
363
  }
352
364
  },
353
365
  },
@@ -366,12 +378,12 @@ export function createControllerTools(deps: ControllerToolsDeps) {
366
378
  if (status) url.searchParams.set("status", status);
367
379
  const res = await fetch(url.toString());
368
380
  if (!res.ok) {
369
- return { content: [{ type: "text" as const, text: `Failed to list tasks: ${res.status}` }] };
381
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to list tasks: ${res.status}` }] };
370
382
  }
371
383
 
372
384
  const data = await res.json() as { tasks: TaskInfo[] };
373
385
  if (data.tasks.length === 0) {
374
- return { content: [{ type: "text" as const, text: "No tasks found." }] };
386
+ return { details: {}, content: [{ type: "text" as const, text: "No tasks found." }] };
375
387
  }
376
388
 
377
389
  const lines = data.tasks.map((t) => {
@@ -379,9 +391,9 @@ export function createControllerTools(deps: ControllerToolsDeps) {
379
391
  return `[${t.status}] ${t.priority.toUpperCase()} ${t.title} (${t.id})${assignee}`;
380
392
  });
381
393
 
382
- return { content: [{ type: "text" as const, text: lines.join("\n") }] };
394
+ return { details: {}, content: [{ type: "text" as const, text: lines.join("\n") }] };
383
395
  } catch (err) {
384
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
396
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
385
397
  }
386
398
  },
387
399
  },
@@ -396,7 +408,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
396
408
  async execute(_id: string, params: Record<string, unknown>) {
397
409
  const taskId = String(params.taskId ?? "");
398
410
  if (!taskId) {
399
- return { content: [{ type: "text" as const, text: "taskId is required." }] };
411
+ return { details: {}, content: [{ type: "text" as const, text: "taskId is required." }] };
400
412
  }
401
413
 
402
414
  try {
@@ -411,15 +423,15 @@ export function createControllerTools(deps: ControllerToolsDeps) {
411
423
 
412
424
  if (!res.ok) {
413
425
  const err = await res.text();
414
- return { content: [{ type: "text" as const, text: `Failed to assign task: ${err}` }] };
426
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to assign task: ${err}` }] };
415
427
  }
416
428
 
417
429
  const data = await res.json() as { task: TaskInfo; worker?: { id: string; label: string } };
418
430
  const worker = data.worker;
419
431
  const workerInfo = worker ? ` assigned to ${worker.label} (${worker.id})` : " (no available worker)";
420
- return { content: [{ type: "text" as const, text: `Task assigned: ${data.task.title}${workerInfo}` }] };
432
+ return { details: {}, content: [{ type: "text" as const, text: `Task assigned: ${data.task.title}${workerInfo}` }] };
421
433
  } catch (err) {
422
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
434
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
423
435
  }
424
436
  },
425
437
  },
@@ -440,7 +452,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
440
452
  async execute(_id: string, params: Record<string, unknown>) {
441
453
  const content = String(params.content ?? "");
442
454
  if (!content) {
443
- return { content: [{ type: "text" as const, text: "content is required." }] };
455
+ return { details: {}, content: [{ type: "text" as const, text: "content is required." }] };
444
456
  }
445
457
 
446
458
  try {
@@ -476,16 +488,16 @@ export function createControllerTools(deps: ControllerToolsDeps) {
476
488
  });
477
489
 
478
490
  if (!res.ok) {
479
- return { content: [{ type: "text" as const, text: `Failed to send message: ${res.status}` }] };
491
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to send message: ${res.status}` }] };
480
492
  }
481
493
 
482
494
  const data = await res.json() as { status: string; recipients?: number };
483
495
  if (params.toRole) {
484
- return { content: [{ type: "text" as const, text: `Message sent to ${params.toRole}: ${data.status}` }] };
496
+ return { details: {}, content: [{ type: "text" as const, text: `Message sent to ${params.toRole}: ${data.status}` }] };
485
497
  }
486
- return { content: [{ type: "text" as const, text: `Broadcast sent to ${data.recipients ?? 0} recipients` }] };
498
+ return { details: {}, content: [{ type: "text" as const, text: `Broadcast sent to ${data.recipients ?? 0} recipients` }] };
487
499
  } catch (err) {
488
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
500
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
489
501
  }
490
502
  },
491
503
  },