@teamclaws/teamclaw 2026.4.3-1 → 2026.4.4

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.
@@ -50,7 +50,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
50
50
  label: "Ask Team Peer",
51
51
  description: "Send a question to another team member by role",
52
52
  parameters: Type.Object({
53
- targetRole: Type.String({ description: "Exact target role ID (pm, architect, developer, qa, release-engineer, infra-engineer, devops, security-engineer, designer, marketing)" }),
53
+ targetRole: Type.String({ description: "Exact target role ID (pm, architect, developer, qa, release-engineer, infra-engineer, devops, security-engineer, designer, marketing, data-engineer)" }),
54
54
  question: Type.String({ description: "The question to ask" }),
55
55
  taskId: Type.Optional(Type.String({ description: "Related task ID if any" })),
56
56
  summary: Type.Optional(Type.String({ description: "Short structured summary for this question" })),
@@ -61,7 +61,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
61
61
  async execute(_id: string, params: Record<string, unknown>) {
62
62
  const identity = await resolveIdentity();
63
63
  if (!identity) {
64
- return { content: [{ type: "text" as const, text: "Not registered with a team. Cannot send messages." }] };
64
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team. Cannot send messages." }] };
65
65
  }
66
66
 
67
67
  const targetRole = String(params.targetRole ?? "");
@@ -69,7 +69,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
69
69
  const normalizedTargetRole = normalizeContractRole(targetRole);
70
70
 
71
71
  if (!targetRole || !question) {
72
- return { content: [{ type: "text" as const, text: "targetRole and question are required." }] };
72
+ return { details: {}, content: [{ type: "text" as const, text: "targetRole and question are required." }] };
73
73
  }
74
74
 
75
75
  try {
@@ -99,12 +99,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
99
99
  });
100
100
 
101
101
  if (!res.ok) {
102
- return { content: [{ type: "text" as const, text: `Failed to send message: ${res.status}` }] };
102
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to send message: ${res.status}` }] };
103
103
  }
104
104
 
105
- return { content: [{ type: "text" as const, text: `Message sent to ${targetRole}.` }] };
105
+ return { details: {}, content: [{ type: "text" as const, text: `Message sent to ${targetRole}.` }] };
106
106
  } catch (err) {
107
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
107
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
108
108
  }
109
109
  },
110
110
  },
@@ -124,12 +124,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
124
124
  async execute(_id: string, params: Record<string, unknown>) {
125
125
  const identity = await resolveIdentity();
126
126
  if (!identity) {
127
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
127
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
128
128
  }
129
129
 
130
130
  const message = String(params.message ?? "");
131
131
  if (!message) {
132
- return { content: [{ type: "text" as const, text: "message is required." }] };
132
+ return { details: {}, content: [{ type: "text" as const, text: "message is required." }] };
133
133
  }
134
134
 
135
135
  try {
@@ -157,12 +157,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
157
157
  });
158
158
 
159
159
  if (!res.ok) {
160
- return { content: [{ type: "text" as const, text: `Failed to broadcast: ${res.status}` }] };
160
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to broadcast: ${res.status}` }] };
161
161
  }
162
162
 
163
- return { content: [{ type: "text" as const, text: "Broadcast sent to all team members." }] };
163
+ return { details: {}, content: [{ type: "text" as const, text: "Broadcast sent to all team members." }] };
164
164
  } catch (err) {
165
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
165
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
166
166
  }
167
167
  },
168
168
  },
@@ -181,7 +181,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
181
181
  async execute(_id: string, params: Record<string, unknown>) {
182
182
  const identity = await resolveIdentity();
183
183
  if (!identity) {
184
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
184
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
185
185
  }
186
186
 
187
187
  const targetRole = String(params.targetRole ?? "");
@@ -189,7 +189,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
189
189
  const taskId = String(params.taskId ?? "");
190
190
 
191
191
  if (!targetRole || !reviewContent) {
192
- return { content: [{ type: "text" as const, text: "targetRole and reviewContent are required." }] };
192
+ return { details: {}, content: [{ type: "text" as const, text: "targetRole and reviewContent are required." }] };
193
193
  }
194
194
 
195
195
  try {
@@ -218,12 +218,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
218
218
  });
219
219
 
220
220
  if (!res.ok) {
221
- return { content: [{ type: "text" as const, text: `Failed to request review: ${res.status}` }] };
221
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to request review: ${res.status}` }] };
222
222
  }
223
223
 
224
- return { content: [{ type: "text" as const, text: `Review request sent to ${targetRole}.` }] };
224
+ return { details: {}, content: [{ type: "text" as const, text: `Review request sent to ${targetRole}.` }] };
225
225
  } catch (err) {
226
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
226
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
227
227
  }
228
228
  },
229
229
  },
@@ -242,7 +242,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
242
242
  async execute(_id: string, params: Record<string, unknown>) {
243
243
  const identity = await resolveIdentity();
244
244
  if (!identity) {
245
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
245
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
246
246
  }
247
247
 
248
248
  const taskId = String(params.taskId ?? "");
@@ -250,7 +250,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
250
250
  const reason = String(params.reason ?? "");
251
251
 
252
252
  if (!taskId || !targetRole) {
253
- return { content: [{ type: "text" as const, text: "taskId and targetRole are required." }] };
253
+ return { details: {}, content: [{ type: "text" as const, text: "taskId and targetRole are required." }] };
254
254
  }
255
255
 
256
256
  try {
@@ -273,12 +273,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
273
273
  });
274
274
 
275
275
  if (!res.ok) {
276
- return { content: [{ type: "text" as const, text: `Failed to suggest handoff: ${res.status}` }] };
276
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to suggest handoff: ${res.status}` }] };
277
277
  }
278
278
 
279
- return { content: [{ type: "text" as const, text: `Handoff suggested to ${targetRole}.` }] };
279
+ return { details: {}, content: [{ type: "text" as const, text: `Handoff suggested to ${targetRole}.` }] };
280
280
  } catch (err) {
281
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
281
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
282
282
  }
283
283
  },
284
284
  },
@@ -321,12 +321,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
321
321
  async execute(_id: string, params: Record<string, unknown>) {
322
322
  const identity = await resolveIdentity();
323
323
  if (!identity) {
324
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
324
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
325
325
  }
326
326
 
327
327
  const taskId = String(params.taskId ?? "");
328
328
  if (!taskId) {
329
- return { content: [{ type: "text" as const, text: "taskId is required." }] };
329
+ return { details: {}, content: [{ type: "text" as const, text: "taskId is required." }] };
330
330
  }
331
331
 
332
332
  const contract = normalizeWorkerTaskResultContract({
@@ -342,7 +342,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
342
342
  notes: params.notes,
343
343
  });
344
344
  if (!contract) {
345
- return { content: [{ type: "text" as const, text: "summary is required for teamclaw_submit_result_contract." }] };
345
+ return { details: {}, content: [{ type: "text" as const, text: "summary is required for teamclaw_submit_result_contract." }] };
346
346
  }
347
347
 
348
348
  try {
@@ -352,16 +352,17 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
352
352
  body: JSON.stringify({ contract, workerId: identity.workerId }),
353
353
  });
354
354
  if (!res.ok) {
355
- return { content: [{ type: "text" as const, text: `Failed to submit result contract: ${res.status}` }] };
355
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to submit result contract: ${res.status}` }] };
356
356
  }
357
357
  return {
358
+ details: {},
358
359
  content: [{
359
360
  type: "text" as const,
360
361
  text: `Result contract recorded for ${taskId}: ${contract.outcome} / ${contract.summary}`,
361
362
  }],
362
363
  };
363
364
  } catch (err) {
364
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
365
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
365
366
  }
366
367
  },
367
368
  },
@@ -379,7 +380,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
379
380
  async execute(_id: string, params: Record<string, unknown>) {
380
381
  const identity = await resolveIdentity();
381
382
  if (!identity) {
382
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
383
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
383
384
  }
384
385
 
385
386
  const taskId = String(params.taskId ?? "");
@@ -395,7 +396,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
395
396
  : [];
396
397
 
397
398
  if (!taskId || !reason) {
398
- return { content: [{ type: "text" as const, text: "taskId and reason are required." }] };
399
+ return { details: {}, content: [{ type: "text" as const, text: "taskId and reason are required." }] };
399
400
  }
400
401
 
401
402
  try {
@@ -413,17 +414,18 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
413
414
  });
414
415
 
415
416
  if (!res.ok) {
416
- return { content: [{ type: "text" as const, text: `Failed to request parallel help: ${res.status}` }] };
417
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to request parallel help: ${res.status}` }] };
417
418
  }
418
419
 
419
420
  return {
421
+ details: {},
420
422
  content: [{
421
423
  type: "text" as const,
422
424
  text: `Parallel help requested for ${taskId}${requestedWorkerCount ? ` (target ${targetRole} workers: ${requestedWorkerCount})` : ""}.`,
423
425
  }],
424
426
  };
425
427
  } catch (err) {
426
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
428
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
427
429
  }
428
430
  },
429
431
  },
@@ -457,7 +459,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
457
459
  async execute(_id: string, params: Record<string, unknown>) {
458
460
  const identity = await resolveIdentity();
459
461
  if (!identity) {
460
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
462
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
461
463
  }
462
464
 
463
465
  const taskId = String(params.taskId ?? "");
@@ -467,7 +469,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
467
469
  const questionSchema = normalizeClarificationQuestionSchema(params.questionSchema);
468
470
 
469
471
  if (!taskId || !question || !blockingReason) {
470
- return { content: [{ type: "text" as const, text: "taskId, question, and blockingReason are required." }] };
472
+ return { details: {}, content: [{ type: "text" as const, text: "taskId, question, and blockingReason are required." }] };
471
473
  }
472
474
 
473
475
  try {
@@ -487,12 +489,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
487
489
  });
488
490
 
489
491
  if (!res.ok) {
490
- return { content: [{ type: "text" as const, text: `Failed to request clarification: ${res.status}` }] };
492
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to request clarification: ${res.status}` }] };
491
493
  }
492
494
 
493
- return { content: [{ type: "text" as const, text: "Clarification requested. The task is now blocked until a human answers." }] };
495
+ return { details: {}, content: [{ type: "text" as const, text: "Clarification requested. The task is now blocked until a human answers." }] };
494
496
  } catch (err) {
495
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
497
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
496
498
  }
497
499
  },
498
500
  },
@@ -504,18 +506,18 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
504
506
  async execute(_id: string) {
505
507
  const identity = await resolveIdentity();
506
508
  if (!identity) {
507
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
509
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
508
510
  }
509
511
 
510
512
  try {
511
513
  const res = await fetch(`${identity.controllerUrl}/api/v1/team/status`);
512
514
  if (!res.ok) {
513
- return { content: [{ type: "text" as const, text: `Failed to get status: ${res.status}` }] };
515
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to get status: ${res.status}` }] };
514
516
  }
515
517
  const data = await res.json() as Record<string, unknown>;
516
- return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
518
+ return { details: {}, content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
517
519
  } catch (err) {
518
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
520
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
519
521
  }
520
522
  },
521
523
  },
@@ -536,7 +538,7 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
536
538
  async execute(_id: string, params: Record<string, unknown>) {
537
539
  const identity = await resolveIdentity();
538
540
  if (!identity) {
539
- return { content: [{ type: "text" as const, text: "Not registered with a team." }] };
541
+ return { details: {}, content: [{ type: "text" as const, text: "Not registered with a team." }] };
540
542
  }
541
543
 
542
544
  const taskId = String(params.taskId ?? "");
@@ -544,13 +546,14 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
544
546
  const status = typeof params.status === "string" ? params.status : undefined;
545
547
 
546
548
  if (!taskId) {
547
- return { content: [{ type: "text" as const, text: "taskId is required." }] };
549
+ return { details: {}, content: [{ type: "text" as const, text: "taskId is required." }] };
548
550
  }
549
551
  if (!progress) {
550
- return { content: [{ type: "text" as const, text: "progress or summary is required." }] };
552
+ return { details: {}, content: [{ type: "text" as const, text: "progress or summary is required." }] };
551
553
  }
552
554
  if (status && !ALLOWED_PROGRESS_STATUSES.has(status)) {
553
555
  return {
556
+ details: {},
554
557
  content: [{
555
558
  type: "text" as const,
556
559
  text: "status must be in_progress or review. Do not mark tasks completed or failed via teamclaw_report_progress; finish by returning the deliverable or surfacing the error.",
@@ -584,12 +587,12 @@ export function createWorkerTools(deps: WorkerToolsDeps) {
584
587
  });
585
588
 
586
589
  if (!res.ok) {
587
- return { content: [{ type: "text" as const, text: `Failed to report progress: ${res.status}` }] };
590
+ return { details: {}, content: [{ type: "text" as const, text: `Failed to report progress: ${res.status}` }] };
588
591
  }
589
592
 
590
- return { content: [{ type: "text" as const, text: "Progress reported." }] };
593
+ return { details: {}, content: [{ type: "text" as const, text: "Progress reported." }] };
591
594
  } catch (err) {
592
- return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
595
+ return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
593
596
  }
594
597
  },
595
598
  },
@@ -31,6 +31,7 @@ export function createWorkerService(deps: WorkerServiceDeps): OpenClawPluginServ
31
31
  let activeTaskId: string | undefined;
32
32
  const activeTaskSessionKeys = new Map<string, string>();
33
33
  const cancelledTaskIds = new Set<string>();
34
+ let consecutiveHeartbeatFailures = 0;
34
35
 
35
36
  const taskExecutor = externalTaskExecutor
36
37
  ? async (assignment: TaskAssignmentPayload): Promise<{ text: string; contract?: Record<string, unknown> }> => {
@@ -208,10 +209,30 @@ export function createWorkerService(deps: WorkerServiceDeps): OpenClawPluginServ
208
209
  });
209
210
 
210
211
  if (!res.ok) {
212
+ consecutiveHeartbeatFailures += 1;
211
213
  logger.warn(`Worker: heartbeat failed (${res.status})`);
214
+ if (consecutiveHeartbeatFailures >= 3) {
215
+ logger.warn("Worker: controller heartbeat failed repeatedly; clearing identity and forcing re-registration");
216
+ await identityManager.clear();
217
+ controllerUrl = null;
218
+ workerId = null;
219
+ consecutiveHeartbeatFailures = 0;
220
+ await startServer();
221
+ }
222
+ } else {
223
+ consecutiveHeartbeatFailures = 0;
212
224
  }
213
225
  } catch (err) {
226
+ consecutiveHeartbeatFailures += 1;
214
227
  logger.warn(`Worker: heartbeat error: ${err instanceof Error ? err.message : String(err)}`);
228
+ if (consecutiveHeartbeatFailures >= 3) {
229
+ logger.warn("Worker: controller heartbeat errored repeatedly; clearing identity and forcing re-registration");
230
+ await identityManager.clear();
231
+ controllerUrl = null;
232
+ workerId = null;
233
+ consecutiveHeartbeatFailures = 0;
234
+ await startServer();
235
+ }
215
236
  }
216
237
  }, config.heartbeatIntervalMs);
217
238
 
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "allowImportingTsExtensions": false,
6
+ "outDir": "dist",
7
+ "declaration": false,
8
+ "declarationMap": false,
9
+ "sourceMap": false
10
+ },
11
+ "include": ["./**/*.ts", "./*.ts"],
12
+ "exclude": ["node_modules", "dist", "cli.mjs"]
13
+ }
package/tsconfig.json CHANGED
@@ -11,11 +11,7 @@
11
11
  "resolveJsonModule": true,
12
12
  "skipLibCheck": true,
13
13
  "strict": true,
14
- "target": "es2023",
15
- "paths": {
16
- "openclaw/plugin-sdk": ["../openclaw/src/plugin-sdk/index.ts"],
17
- "openclaw/plugin-sdk/*": ["../openclaw/src/plugin-sdk/*"]
18
- }
14
+ "target": "es2023"
19
15
  },
20
16
  "include": ["./**/*.ts", "./*.ts"],
21
17
  "exclude": ["node_modules", "dist"]