@teamclaws/teamclaw 2026.7.1 → 2026.8.1

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 (60) hide show
  1. package/README.md +8 -0
  2. package/dist/api.js +1 -0
  3. package/dist/index.js +325 -0
  4. package/dist/src/config.js +381 -0
  5. package/dist/src/controller/controller-capacity.js +14 -0
  6. package/dist/src/controller/controller-service.js +393 -0
  7. package/dist/src/controller/controller-tools.js +582 -0
  8. package/dist/src/controller/delivery-report.js +458 -0
  9. package/dist/src/controller/github-auth.js +564 -0
  10. package/dist/src/controller/http-server.js +6032 -0
  11. package/dist/src/controller/kickoff-orchestrator.js +220 -0
  12. package/dist/src/controller/managed-gateway-process.js +286 -0
  13. package/dist/src/controller/message-router.js +38 -0
  14. package/dist/src/controller/orchestration-manifest.js +173 -0
  15. package/dist/src/controller/preview-manager.js +586 -0
  16. package/dist/src/controller/prompt-injector.js +187 -0
  17. package/dist/src/controller/role-inference.js +35 -0
  18. package/dist/src/controller/task-router.js +67 -0
  19. package/dist/src/controller/tunnel-manager.js +548 -0
  20. package/dist/src/controller/websocket.js +42 -0
  21. package/dist/src/controller/worker-provisioning.js +1648 -0
  22. package/dist/src/discovery.js +86 -0
  23. package/dist/src/git-collaboration.js +694 -0
  24. package/dist/src/identity.js +131 -0
  25. package/dist/src/install-defaults.js +1 -0
  26. package/dist/src/interaction-contracts.js +531 -0
  27. package/dist/src/networking.js +91 -0
  28. package/dist/src/openclaw-workspace.js +903 -0
  29. package/dist/src/prompt-policy.js +373 -0
  30. package/dist/src/protocol.js +58 -0
  31. package/dist/src/roles.js +349 -0
  32. package/dist/src/state.js +183 -0
  33. package/dist/src/task-executor.js +1033 -0
  34. package/dist/src/teamauto/github-client.js +192 -0
  35. package/dist/src/teamauto/norms.js +85 -0
  36. package/dist/src/teamauto/repo-sync.js +201 -0
  37. package/dist/src/teamauto/scanner.js +179 -0
  38. package/dist/src/teamauto/schedule.js +123 -0
  39. package/dist/src/teamauto/scheduler.js +688 -0
  40. package/dist/src/teamauto/store.js +133 -0
  41. package/dist/src/types.js +243 -0
  42. package/dist/src/ui/app.js +4292 -0
  43. package/dist/src/ui/assets/teamclaw-app-icon.png +0 -0
  44. package/dist/src/ui/github-login.html +296 -0
  45. package/dist/src/ui/index.html +414 -0
  46. package/dist/src/ui/style.css +2611 -0
  47. package/dist/src/worker/http-handler.js +146 -0
  48. package/dist/src/worker/message-queue.js +24 -0
  49. package/dist/src/worker/prompt-injector.js +42 -0
  50. package/dist/src/worker/skill-installer.js +253 -0
  51. package/dist/src/worker/tools.js +541 -0
  52. package/dist/src/worker/worker-service.js +234 -0
  53. package/dist/src/workspace-browser.js +269 -0
  54. package/openclaw.plugin.json +1 -1
  55. package/package.json +9 -7
  56. package/src/controller/http-server.ts +26 -1
  57. package/src/controller/tunnel-manager.ts +139 -15
  58. package/src/ui/app.js +97 -20
  59. package/src/ui/index.html +16 -4
  60. package/src/ui/style.css +49 -0
@@ -0,0 +1,458 @@
1
+ /**
2
+ * Delivery Report — auto-generated project completion report for TeamClaw sessions.
3
+ *
4
+ * When all tasks in a controller session finish, this module aggregates
5
+ * task results, deliverables, previews, and timeline into a self-contained
6
+ * HTML page that can be shared via URL or pushed to notification channels.
7
+ */
8
+ // ── Report generation ────────────────────────────────────────────────
9
+ export function generateDeliveryReport(sessionKey, state, normalizeSessionKey) {
10
+ const normalizedKey = normalizeSessionKey(sessionKey);
11
+ // Collect all controller runs for this session
12
+ const runs = Object.values(state.controllerRuns)
13
+ .filter((r) => normalizeSessionKey(r.sessionKey) === normalizedKey)
14
+ .sort((a, b) => a.createdAt - b.createdAt);
15
+ if (runs.length === 0)
16
+ return null;
17
+ // Collect all task IDs across all runs
18
+ const allTaskIds = Array.from(new Set(runs.flatMap((r) => r.createdTaskIds)));
19
+ const tasks = allTaskIds
20
+ .map((id) => state.tasks[id])
21
+ .filter((t) => !!t)
22
+ .sort((a, b) => a.createdAt - b.createdAt);
23
+ if (tasks.length === 0)
24
+ return null;
25
+ // Determine overall status
26
+ const failedTasks = tasks.filter((t) => t.status === "failed");
27
+ const completedTasks = tasks.filter((t) => t.status === "completed");
28
+ const activeTasks = tasks.filter((t) => t.status === "in_progress" || t.status === "pending" || t.status === "assigned");
29
+ let status = "completed";
30
+ if (failedTasks.length > 0 && completedTasks.length === 0)
31
+ status = "failed";
32
+ else if (activeTasks.length > 0 || failedTasks.length > 0)
33
+ status = "partial";
34
+ // Find the best project name and summary
35
+ const latestManifest = [...runs].reverse().find((r) => r.manifest)?.manifest;
36
+ const firstManifest = runs.find((r) => r.manifest)?.manifest;
37
+ const projectName = latestManifest?.projectName || firstManifest?.projectName || runs[0].projectDir || "Untitled Project";
38
+ const requirementSummary = firstManifest?.requirementSummary || runs[0].request || "";
39
+ // Timeline
40
+ const sessionStart = runs[0].createdAt;
41
+ const lastCompletion = Math.max(...tasks.map((t) => t.completedAt ?? t.updatedAt));
42
+ const totalDurationMs = lastCompletion - sessionStart;
43
+ // Build phases
44
+ const phases = tasks.map((task) => ({
45
+ taskId: task.id,
46
+ title: task.title,
47
+ role: task.assignedRole ?? "unknown",
48
+ status: task.status,
49
+ durationMs: (task.completedAt ?? task.updatedAt) - task.createdAt,
50
+ summary: task.resultContract?.summary ?? task.result?.slice(0, 200) ?? "",
51
+ keyPoints: task.resultContract?.keyPoints ?? [],
52
+ error: task.error,
53
+ }));
54
+ // Collect deliverables
55
+ const deliverables = [];
56
+ for (const task of tasks) {
57
+ if (!task.resultContract?.deliverables)
58
+ continue;
59
+ for (const [di, d] of task.resultContract.deliverables.entries()) {
60
+ const preview = resolvePreviewInfo(d, task.id, di, state);
61
+ deliverables.push({
62
+ taskId: task.id,
63
+ kind: d.kind,
64
+ path: d.value,
65
+ summary: d.summary ?? "",
66
+ artifactType: d.artifactType,
67
+ previewUrl: preview.url,
68
+ previewError: preview.error,
69
+ });
70
+ }
71
+ }
72
+ // Aggregate highlights
73
+ const keyPoints = tasks.flatMap((t) => t.resultContract?.keyPoints ?? []);
74
+ const blockers = tasks.flatMap((t) => t.resultContract?.blockers ?? []);
75
+ const followUps = tasks.flatMap((t) => (t.resultContract?.followUps ?? []).map((f) => `${f.type}${f.targetRole ? ` (${f.targetRole})` : ""}: ${f.reason}`));
76
+ const notes = latestManifest?.notes ?? "";
77
+ const rolesUsed = Array.from(new Set(tasks.map((t) => t.assignedRole).filter(Boolean)));
78
+ return {
79
+ id: `report-${normalizedKey}`,
80
+ sessionKey: normalizedKey,
81
+ generatedAt: Date.now(),
82
+ projectName,
83
+ requirementSummary,
84
+ status,
85
+ totalDurationMs,
86
+ phases,
87
+ deliverables,
88
+ keyPoints,
89
+ blockers,
90
+ followUps,
91
+ notes,
92
+ runCount: runs.length,
93
+ taskCount: tasks.length,
94
+ rolesUsed,
95
+ };
96
+ }
97
+ function isPreviewableArtifactType(d) {
98
+ return d.artifactType === "web-app" || d.artifactType === "static-site" || d.artifactType === "rest-api";
99
+ }
100
+ function resolvePreviewInfo(deliverable, taskId, deliverableIndex, state) {
101
+ if (deliverable.liveUrl)
102
+ return { url: deliverable.liveUrl };
103
+ // Non-previewable deliverables (plain files, notes, commands) should never
104
+ // show preview errors — they don't have previews to fail.
105
+ if (!isPreviewableArtifactType(deliverable))
106
+ return {};
107
+ // Find preview record for this specific deliverable
108
+ const previewId = `preview-${taskId}-${deliverableIndex}`;
109
+ const exact = (state.previews ?? {})[previewId];
110
+ if (exact) {
111
+ if (exact.status === "healthy") {
112
+ const url = deliverable.artifactType === "rest-api" && exact.previewReadyPath && exact.previewReadyPath !== "/"
113
+ ? exact.liveUrl.replace(/\/$/, "") + exact.previewReadyPath
114
+ : exact.liveUrl;
115
+ return { url };
116
+ }
117
+ if (exact.status === "failed")
118
+ return { error: exact.lastError ?? "Preview failed" };
119
+ if (exact.status === "stopped")
120
+ return { error: "Preview stopped" };
121
+ return { error: "Preview is still starting…" };
122
+ }
123
+ // Fallback: find any healthy preview for this task
124
+ const previews = Object.values(state.previews ?? {});
125
+ const match = previews.find((p) => p.taskId === taskId && p.status === "healthy");
126
+ if (match) {
127
+ const url = deliverable.artifactType === "rest-api" && match.previewReadyPath && match.previewReadyPath !== "/"
128
+ ? match.liveUrl.replace(/\/$/, "") + match.previewReadyPath
129
+ : match.liveUrl;
130
+ return { url };
131
+ }
132
+ const failed = previews.find((p) => p.taskId === taskId && p.status === "failed");
133
+ if (failed)
134
+ return { error: failed.lastError ?? "Preview failed" };
135
+ return {};
136
+ }
137
+ // ── Session completion detection ─────────────────────────────────────
138
+ export function isSessionComplete(sessionKey, state, normalizeSessionKey) {
139
+ const normalizedKey = normalizeSessionKey(sessionKey);
140
+ const runs = Object.values(state.controllerRuns)
141
+ .filter((r) => normalizeSessionKey(r.sessionKey) === normalizedKey)
142
+ .sort((a, b) => b.createdAt - a.createdAt);
143
+ if (runs.length === 0)
144
+ return false;
145
+ // Collect all tasks for this session
146
+ const taskIds = new Set(runs.flatMap((r) => r.createdTaskIds));
147
+ if (taskIds.size === 0)
148
+ return false;
149
+ // Check if any task is still active
150
+ for (const taskId of taskIds) {
151
+ const task = state.tasks[taskId];
152
+ if (!task)
153
+ continue;
154
+ if (task.status !== "completed" && task.status !== "failed") {
155
+ return false;
156
+ }
157
+ }
158
+ // Check if the latest run still has active deferred tasks
159
+ const latestWithManifest = runs.find((r) => r.manifest);
160
+ if (latestWithManifest?.manifest?.deferredTasks?.length) {
161
+ // There are deferred tasks — a follow-up run should advance them.
162
+ // Only consider complete if the latest run also says requirementFullyComplete.
163
+ if (!latestWithManifest.manifest.requirementFullyComplete) {
164
+ return false;
165
+ }
166
+ }
167
+ // Check if any run is still actively executing
168
+ const activeRun = runs.find((r) => r.status === "pending" || r.status === "running");
169
+ if (activeRun)
170
+ return false;
171
+ return true;
172
+ }
173
+ // ── HTML rendering ───────────────────────────────────────────────────
174
+ function escapeHtml(text) {
175
+ return text
176
+ .replace(/&/g, "&")
177
+ .replace(/</g, "&lt;")
178
+ .replace(/>/g, "&gt;")
179
+ .replace(/"/g, "&quot;");
180
+ }
181
+ const IMAGE_EXTENSIONS = new Set([".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".ico", ".bmp"]);
182
+ function isImagePath(filePath) {
183
+ const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
184
+ return IMAGE_EXTENSIONS.has(ext);
185
+ }
186
+ function formatDuration(ms) {
187
+ if (ms < 1000)
188
+ return "<1s";
189
+ const totalSec = Math.floor(ms / 1000);
190
+ if (totalSec < 60)
191
+ return `${totalSec}s`;
192
+ const min = Math.floor(totalSec / 60);
193
+ const sec = totalSec % 60;
194
+ if (min < 60)
195
+ return sec > 0 ? `${min}m ${sec}s` : `${min}m`;
196
+ const hr = Math.floor(min / 60);
197
+ const remMin = min % 60;
198
+ return remMin > 0 ? `${hr}h ${remMin}m` : `${hr}h`;
199
+ }
200
+ const STATUS_EMOJI = {
201
+ completed: "✅",
202
+ failed: "❌",
203
+ partial: "⚠️",
204
+ in_progress: "🔄",
205
+ pending: "⏳",
206
+ assigned: "📋",
207
+ blocked: "🚫",
208
+ };
209
+ export function renderReportHtml(report) {
210
+ const statusEmoji = STATUS_EMOJI[report.status] ?? "❓";
211
+ const statusLabel = report.status === "completed"
212
+ ? "Completed"
213
+ : report.status === "failed"
214
+ ? "Failed"
215
+ : "Partial";
216
+ const phasesHtml = report.phases
217
+ .map((phase) => {
218
+ const emoji = STATUS_EMOJI[phase.status] ?? "❓";
219
+ const duration = formatDuration(phase.durationMs);
220
+ const errorHtml = phase.error
221
+ ? `<div class="phase-error">Error: ${escapeHtml(phase.error.slice(0, 200))}</div>`
222
+ : "";
223
+ const keyPointsHtml = phase.keyPoints.length > 0
224
+ ? `<ul class="phase-keypoints">${phase.keyPoints.map((kp) => `<li>${escapeHtml(kp)}</li>`).join("")}</ul>`
225
+ : "";
226
+ return `
227
+ <div class="phase-card phase-${phase.status}">
228
+ <div class="phase-header">
229
+ <span class="phase-emoji">${emoji}</span>
230
+ <span class="phase-title">${escapeHtml(phase.title)}</span>
231
+ <span class="phase-role">${escapeHtml(phase.role)}</span>
232
+ <span class="phase-duration">${duration}</span>
233
+ </div>
234
+ <div class="phase-summary">${escapeHtml(phase.summary)}</div>
235
+ ${errorHtml}
236
+ ${keyPointsHtml}
237
+ </div>`;
238
+ })
239
+ .join("\n");
240
+ const deliverablesHtml = report.deliverables
241
+ .map((d) => {
242
+ const kindIcon = d.artifactType === "rest-api"
243
+ ? "🔌"
244
+ : d.artifactType === "web-app" || d.artifactType === "static-site"
245
+ ? "🌐"
246
+ : d.artifactType === "document"
247
+ ? "📝"
248
+ : d.kind === "directory"
249
+ ? "📁"
250
+ : d.kind === "command"
251
+ ? "💻"
252
+ : isImagePath(d.path)
253
+ ? "🖼️"
254
+ : "📄";
255
+ let previewHtml = "";
256
+ if (d.previewUrl) {
257
+ const previewLabel = d.artifactType === "rest-api"
258
+ ? "📖 Open API Documentation"
259
+ : "🔗 Open Live Preview";
260
+ previewHtml = `<div class="deliverable-preview">
261
+ <a href="${escapeHtml(d.previewUrl)}" target="_blank" class="preview-link">${previewLabel}</a>
262
+ <iframe src="${escapeHtml(d.previewUrl)}" class="preview-iframe" loading="lazy" sandbox="allow-scripts allow-same-origin allow-forms"></iframe>
263
+ </div>`;
264
+ }
265
+ else if (d.previewError) {
266
+ previewHtml = `<div class="preview-error">⚠️ ${escapeHtml(d.previewError)}</div>`;
267
+ }
268
+ else if (d.kind === "command") {
269
+ previewHtml = `<div class="deliverable-run-hint">💡 Run: <code>${escapeHtml(d.path)}</code></div>`;
270
+ }
271
+ else if (d.artifactType === "document") {
272
+ previewHtml = `<div class="deliverable-doc-hint">📖 Document — view in workspace at <code>${escapeHtml(d.path)}</code></div>`;
273
+ }
274
+ else if (isImagePath(d.path)) {
275
+ // Serve image via workspace file endpoint if available
276
+ previewHtml = `<div class="deliverable-image-hint">🖼️ Image file — open from workspace</div>`;
277
+ }
278
+ return `
279
+ <div class="deliverable-card">
280
+ <div class="deliverable-header">
281
+ <span class="deliverable-icon">${kindIcon}</span>
282
+ <span class="deliverable-path">${escapeHtml(d.path)}</span>
283
+ </div>
284
+ <div class="deliverable-summary">${escapeHtml(d.summary)}</div>
285
+ ${previewHtml}
286
+ </div>`;
287
+ })
288
+ .join("\n");
289
+ const keyPointsHtml = report.keyPoints.length > 0
290
+ ? `<section class="section">
291
+ <h2>💡 Key Points</h2>
292
+ <ul>${report.keyPoints.map((kp) => `<li>${escapeHtml(kp)}</li>`).join("")}</ul>
293
+ </section>`
294
+ : "";
295
+ const blockersHtml = report.blockers.length > 0
296
+ ? `<section class="section section-warning">
297
+ <h2>🚧 Blockers</h2>
298
+ <ul>${report.blockers.map((b) => `<li>${escapeHtml(b)}</li>`).join("")}</ul>
299
+ </section>`
300
+ : "";
301
+ const followUpsHtml = report.followUps.length > 0
302
+ ? `<section class="section">
303
+ <h2>📌 Follow-ups</h2>
304
+ <ul>${report.followUps.map((f) => `<li>${escapeHtml(f)}</li>`).join("")}</ul>
305
+ </section>`
306
+ : "";
307
+ const notesHtml = report.notes
308
+ ? `<section class="section"><h2>📝 Notes</h2><p>${escapeHtml(report.notes)}</p></section>`
309
+ : "";
310
+ return `<!DOCTYPE html>
311
+ <html lang="en">
312
+ <head>
313
+ <meta charset="UTF-8">
314
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
315
+ <title>TeamClaw Report — ${escapeHtml(report.projectName)}</title>
316
+ <style>
317
+ :root {
318
+ --bg: #f8f9fa; --card: #fff; --border: #e2e8f0; --text: #1a202c;
319
+ --muted: #718096; --accent: #3182ce; --success: #38a169; --danger: #e53e3e;
320
+ --warning: #d69e2e; --radius: 10px; --shadow: 0 1px 3px rgba(0,0,0,.08);
321
+ }
322
+ * { box-sizing: border-box; margin: 0; padding: 0; }
323
+ body {
324
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
325
+ background: var(--bg); color: var(--text); line-height: 1.6;
326
+ max-width: 900px; margin: 0 auto; padding: 24px 16px;
327
+ }
328
+ .header {
329
+ background: linear-gradient(135deg, #2d3748, #1a365d);
330
+ color: #fff; border-radius: var(--radius); padding: 32px; margin-bottom: 24px;
331
+ }
332
+ .header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
333
+ .header-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; opacity: .85; }
334
+ .header-meta span { display: flex; align-items: center; gap: 4px; }
335
+ .requirement {
336
+ background: rgba(255,255,255,.1); border-radius: 6px;
337
+ padding: 12px; margin-top: 16px; font-size: .9rem; line-height: 1.5;
338
+ }
339
+ .section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
340
+ padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
341
+ .section h2 { font-size: 1.1rem; margin-bottom: 12px; }
342
+ .section ul { padding-left: 20px; }
343
+ .section li { margin-bottom: 4px; font-size: .9rem; }
344
+ .section-warning { border-left: 4px solid var(--warning); }
345
+
346
+ /* Pipeline */
347
+ .pipeline { display: flex; flex-direction: column; gap: 8px; }
348
+ .phase-card {
349
+ background: var(--card); border: 1px solid var(--border); border-radius: 8px;
350
+ padding: 14px 16px; box-shadow: var(--shadow); position: relative;
351
+ }
352
+ .phase-card.phase-completed { border-left: 4px solid var(--success); }
353
+ .phase-card.phase-failed { border-left: 4px solid var(--danger); }
354
+ .phase-card.phase-in_progress { border-left: 4px solid var(--accent); }
355
+ .phase-header {
356
+ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px;
357
+ }
358
+ .phase-title { font-weight: 600; flex: 1; }
359
+ .phase-role {
360
+ background: #edf2f7; color: var(--muted); font-size: .75rem; padding: 2px 8px;
361
+ border-radius: 12px; text-transform: uppercase; letter-spacing: .5px;
362
+ }
363
+ .phase-duration { font-size: .8rem; color: var(--muted); }
364
+ .phase-summary { font-size: .85rem; color: #4a5568; }
365
+ .phase-error { font-size: .85rem; color: var(--danger); margin-top: 6px; }
366
+ .phase-keypoints { font-size: .8rem; color: var(--muted); margin-top: 6px; padding-left: 18px; }
367
+
368
+ /* Deliverables */
369
+ .deliverable-card {
370
+ background: var(--card); border: 1px solid var(--border); border-radius: 8px;
371
+ padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
372
+ }
373
+ .deliverable-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
374
+ .deliverable-icon { font-size: 1.3rem; }
375
+ .deliverable-path { font-family: "SF Mono", Monaco, monospace; font-size: .85rem; color: var(--accent); }
376
+ .deliverable-summary { font-size: .85rem; color: #4a5568; }
377
+ .deliverable-preview { margin-top: 12px; }
378
+ .preview-link {
379
+ display: inline-block; margin-bottom: 8px; font-size: .85rem;
380
+ color: var(--accent); text-decoration: none; font-weight: 500;
381
+ }
382
+ .preview-link:hover { text-decoration: underline; }
383
+ .preview-iframe {
384
+ width: 100%; height: 400px; border: 1px solid var(--border);
385
+ border-radius: 6px; background: #fff;
386
+ }
387
+ .preview-error {
388
+ margin-top: 8px; padding: 10px 14px; background: #fff5f5; border: 1px solid #fed7d7;
389
+ border-radius: 6px; font-size: .85rem; color: var(--danger);
390
+ }
391
+ .deliverable-run-hint {
392
+ margin-top: 8px; padding: 8px 12px; background: #ebf8ff; border: 1px solid #bee3f8;
393
+ border-radius: 6px; font-size: .85rem; color: #2a4365;
394
+ }
395
+ .deliverable-run-hint code {
396
+ background: #e2e8f0; padding: 1px 6px; border-radius: 4px; font-size: .82rem;
397
+ }
398
+ .deliverable-doc-hint {
399
+ margin-top: 8px; padding: 8px 12px; background: #f0fff4; border: 1px solid #c6f6d5;
400
+ border-radius: 6px; font-size: .85rem; color: #22543d;
401
+ }
402
+ .deliverable-doc-hint code, .deliverable-image-hint code {
403
+ background: #e2e8f0; padding: 1px 6px; border-radius: 4px; font-size: .82rem;
404
+ }
405
+ .deliverable-image-hint {
406
+ margin-top: 8px; padding: 8px 12px; background: #faf5ff; border: 1px solid #e9d8fd;
407
+ border-radius: 6px; font-size: .85rem; color: #44337a;
408
+ }
409
+
410
+ .footer {
411
+ text-align: center; font-size: .8rem; color: var(--muted);
412
+ padding: 16px 0; margin-top: 8px;
413
+ }
414
+
415
+ @media (max-width: 600px) {
416
+ body { padding: 12px 8px; }
417
+ .header { padding: 20px 16px; }
418
+ .header h1 { font-size: 1.2rem; }
419
+ .preview-iframe { height: 280px; }
420
+ }
421
+ </style>
422
+ </head>
423
+ <body>
424
+ <div class="header">
425
+ <h1>${statusEmoji} ${escapeHtml(report.projectName)}</h1>
426
+ <div class="header-meta">
427
+ <span>Status: <strong>${statusLabel}</strong></span>
428
+ <span>⏱️ ${formatDuration(report.totalDurationMs)}</span>
429
+ <span>📋 ${report.taskCount} task${report.taskCount !== 1 ? "s" : ""}</span>
430
+ <span>👥 ${report.rolesUsed.join(", ") || "—"}</span>
431
+ </div>
432
+ <div class="requirement">${escapeHtml(report.requirementSummary)}</div>
433
+ </div>
434
+
435
+ <section class="section">
436
+ <h2>📋 Task Pipeline</h2>
437
+ <div class="pipeline">
438
+ ${phasesHtml}
439
+ </div>
440
+ </section>
441
+
442
+ ${report.deliverables.length > 0 ? `
443
+ <section class="section">
444
+ <h2>📦 Deliverables</h2>
445
+ ${deliverablesHtml}
446
+ </section>` : ""}
447
+
448
+ ${keyPointsHtml}
449
+ ${blockersHtml}
450
+ ${followUpsHtml}
451
+ ${notesHtml}
452
+
453
+ <div class="footer">
454
+ Generated by TeamClaw · ${new Date(report.generatedAt).toLocaleString()}
455
+ </div>
456
+ </body>
457
+ </html>`;
458
+ }