@teamclaws/teamclaw 2026.5.0 → 2026.7.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.
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/src/controller/controller-service.ts +6 -0
- package/src/controller/http-server.ts +145 -1
- package/src/controller/tunnel-manager.ts +386 -0
- package/src/controller/websocket.ts +2 -1
- package/src/controller/worker-provisioning.ts +49 -1
- package/src/teamauto/schedule.ts +136 -0
- package/src/teamauto/scheduler.ts +31 -25
- package/src/ui/app.js +357 -1
- package/src/ui/index.html +6 -0
- package/src/ui/style.css +9 -0
package/src/ui/app.js
CHANGED
|
@@ -87,6 +87,36 @@
|
|
|
87
87
|
"empty.noTasksWithStatus": "No tasks with status \"{status}\"",
|
|
88
88
|
"empty.noClarifications": "No clarification requests",
|
|
89
89
|
"empty.noControllerActivity": "No controller activity yet",
|
|
90
|
+
"toast.taskCompleted": "Task completed",
|
|
91
|
+
"toast.taskFailed": "Task failed",
|
|
92
|
+
"toast.clarificationRequested": "Clarification needed",
|
|
93
|
+
"toast.clarificationAnswered": "Clarification answered",
|
|
94
|
+
"toast.teamautoPrefix": "TeamAuto",
|
|
95
|
+
"toast.workerOnline": "Worker online",
|
|
96
|
+
"toast.workerOffline": "Worker offline",
|
|
97
|
+
"toast.taskCreated": "Task created",
|
|
98
|
+
"toast.taskUpdated": "Task updated",
|
|
99
|
+
"toast.messageNew": "New message",
|
|
100
|
+
"toast.settingsTitle": "Toast notifications",
|
|
101
|
+
"toast.enableAll": "Enable all",
|
|
102
|
+
"toast.disableAll": "Disable all",
|
|
103
|
+
"toast.freqTaskCompleted": "Low - once per task",
|
|
104
|
+
"toast.freqTaskCreated": "Medium - once per flow stage",
|
|
105
|
+
"toast.freqTaskUpdated": "High - several times per task lifecycle",
|
|
106
|
+
"toast.freqClarification": "Rare - only when a worker needs a human decision",
|
|
107
|
+
"toast.freqWorker": "Topology-dependent - external workers rare; provisioned workers may cycle every task (idle TTL 120s)",
|
|
108
|
+
"toast.freqTeamauto": "Low - per sweep, claim, or write-back",
|
|
109
|
+
"toast.freqMessageNew": "High - every controller message",
|
|
110
|
+
"toast.taBind": "TeamAuto: repo bound",
|
|
111
|
+
"toast.taProvision": "TeamAuto: repo ready",
|
|
112
|
+
"toast.taTask": "TeamAuto: task queued",
|
|
113
|
+
"toast.taSweep": "TeamAuto: sweep finished",
|
|
114
|
+
"toast.taWriteback": "TeamAuto: write-back posted",
|
|
115
|
+
"toast.freqTaBind": "Rare - once per repo at bind time",
|
|
116
|
+
"toast.freqTaProvision": "Rare - once per repo after clone + norms",
|
|
117
|
+
"toast.freqTaTask": "Medium - each claimed issue/PR per sweep",
|
|
118
|
+
"toast.freqTaSweep": "Highest - every sweep cycle of every bound repo (cron)",
|
|
119
|
+
"toast.freqTaWriteback": "Medium - each comment/PR posted to GitHub",
|
|
90
120
|
"empty.noMessages": "No messages yet",
|
|
91
121
|
"empty.noPlanningSessions": "No planning sessions yet",
|
|
92
122
|
"empty.noKickoffData": "No kickoff data",
|
|
@@ -114,6 +144,7 @@
|
|
|
114
144
|
"teamauto.provisioning": "preparing",
|
|
115
145
|
"teamauto.provisionFailed": "setup failed",
|
|
116
146
|
"teamauto.hint": "Pick one of your GitHub repositories. TeamClaw sweeps it on its own schedule, reviews issues/PRs, takes ownership of unassigned issues, and posts results with teamclaw markers.",
|
|
147
|
+
"teamauto.scheduleHint": "Schedules: */N * * * * (every N min), M * * * * (hourly at :M), 0 */N * * * (every N h), M H * * * (daily at H:M), @hourly, @daily, @weekly, @monthly. Sweeps align to the clock and survive restarts.",
|
|
117
148
|
"teamauto.loginFirst": "Sign in to GitHub first (top-right Login).",
|
|
118
149
|
"teamauto.loadingRepos": "Loading your repos...",
|
|
119
150
|
"teamauto.noCandidates": "No selectable repos (check GitHub login). You can type owner/repo manually:",
|
|
@@ -215,6 +246,36 @@
|
|
|
215
246
|
"empty.noTasksWithStatus": "没有状态为“{status}”的任务",
|
|
216
247
|
"empty.noClarifications": "暂无澄清请求",
|
|
217
248
|
"empty.noControllerActivity": "暂无 controller 活动",
|
|
249
|
+
"toast.taskCompleted": "任务完成",
|
|
250
|
+
"toast.taskFailed": "任务失败",
|
|
251
|
+
"toast.clarificationRequested": "需要澄清",
|
|
252
|
+
"toast.clarificationAnswered": "澄清已回答",
|
|
253
|
+
"toast.teamautoPrefix": "TeamAuto",
|
|
254
|
+
"toast.workerOnline": "Worker 上线",
|
|
255
|
+
"toast.workerOffline": "Worker 下线",
|
|
256
|
+
"toast.taskCreated": "任务已创建",
|
|
257
|
+
"toast.taskUpdated": "任务更新",
|
|
258
|
+
"toast.messageNew": "新消息",
|
|
259
|
+
"toast.settingsTitle": "Toast 通知管理",
|
|
260
|
+
"toast.enableAll": "全部启用",
|
|
261
|
+
"toast.disableAll": "全部关闭",
|
|
262
|
+
"toast.freqTaskCompleted": "低 - 每任务一次",
|
|
263
|
+
"toast.freqTaskCreated": "中 - 每阶段一次",
|
|
264
|
+
"toast.freqTaskUpdated": "高 - 每任务生命周期多次",
|
|
265
|
+
"toast.freqClarification": "很少 - 仅当 worker 需要人来决策时",
|
|
266
|
+
"toast.freqWorker": "视拓扑而定 - 外部 worker 很少;按需供给 worker 可能每任务上下线一次(空闲 120 秒回收)",
|
|
267
|
+
"toast.freqTeamauto": "低 - 每次扫描/认领/回写",
|
|
268
|
+
"toast.freqMessageNew": "高 - 每条 controller 消息",
|
|
269
|
+
"toast.taBind": "TeamAuto:仓库已绑定",
|
|
270
|
+
"toast.taProvision": "TeamAuto:仓库就绪",
|
|
271
|
+
"toast.taTask": "TeamAuto:任务入队",
|
|
272
|
+
"toast.taSweep": "TeamAuto:扫描完成",
|
|
273
|
+
"toast.taWriteback": "TeamAuto:已回写",
|
|
274
|
+
"toast.freqTaBind": "很少 - 每仓库绑定一次",
|
|
275
|
+
"toast.freqTaProvision": "很少 - 每仓库克隆学习完成后一次",
|
|
276
|
+
"toast.freqTaTask": "中 - 每次扫描认领的 issue/PR",
|
|
277
|
+
"toast.freqTaSweep": "最高 - 每个绑定仓库每个周期都触发(cron)",
|
|
278
|
+
"toast.freqTaWriteback": "中 - 每次向 GitHub 发评论/PR",
|
|
218
279
|
"empty.noMessages": "暂无消息",
|
|
219
280
|
"empty.noPlanningSessions": "暂无规划会话",
|
|
220
281
|
"empty.noKickoffData": "暂无 kickoff 数据",
|
|
@@ -242,6 +303,7 @@
|
|
|
242
303
|
"teamauto.provisioning": "准备中",
|
|
243
304
|
"teamauto.provisionFailed": "准备失败",
|
|
244
305
|
"teamauto.hint": "选择你的 GitHub 仓库。TeamClaw 按各自节奏定时扫描,自主 review issue/PR、认领未分配 issue,并以 teamclaw 标识写回结果。",
|
|
306
|
+
"teamauto.scheduleHint": "支持的表达式:*/N * * * *(每 N 分钟)、M * * * *(每小时第 M 分)、0 */N * * *(每 N 小时)、M H * * *(每天 H:M)、@hourly、@daily、@weekly、@monthly。扫描按墙钟对齐,重启后自动恢复。",
|
|
245
307
|
"teamauto.loginFirst": "请先登录 GitHub(右上角 Login)。",
|
|
246
308
|
"teamauto.loadingRepos": "正在加载你的仓库...",
|
|
247
309
|
"teamauto.noCandidates": "无可选仓库(请检查 GitHub 登录),可手动输入 owner/repo:",
|
|
@@ -1395,6 +1457,201 @@
|
|
|
1395
1457
|
setTimeout(dismiss, 5000);
|
|
1396
1458
|
}
|
|
1397
1459
|
|
|
1460
|
+
var TOAST_PREFS_KEY = "teamclaw.toast.prefs.v1";
|
|
1461
|
+
var TOAST_EVENT_DEFS = [
|
|
1462
|
+
{ id: "task:completed", titleKey: "toast.taskCompleted", freqKey: "toast.freqTaskCompleted" },
|
|
1463
|
+
{ id: "task:created", titleKey: "toast.taskCreated", freqKey: "toast.freqTaskCreated" },
|
|
1464
|
+
{ id: "task:updated", titleKey: "toast.taskUpdated", freqKey: "toast.freqTaskUpdated" },
|
|
1465
|
+
{ id: "clarification:requested", titleKey: "toast.clarificationRequested", freqKey: "toast.freqClarification" },
|
|
1466
|
+
{ id: "clarification:answered", titleKey: "toast.clarificationAnswered", freqKey: "toast.freqClarification" },
|
|
1467
|
+
{ id: "worker:online", titleKey: "toast.workerOnline", freqKey: "toast.freqWorker" },
|
|
1468
|
+
{ id: "worker:offline", titleKey: "toast.workerOffline", freqKey: "toast.freqWorker" },
|
|
1469
|
+
{ id: "teamauto:activity", titleKey: "toast.teamautoPrefix", freqKey: "toast.freqTeamauto" },
|
|
1470
|
+
{ id: "teamauto:activity:bind", titleKey: "toast.taBind", freqKey: "toast.freqTaBind" },
|
|
1471
|
+
{ id: "teamauto:activity:provision", titleKey: "toast.taProvision", freqKey: "toast.freqTaProvision" },
|
|
1472
|
+
{ id: "teamauto:activity:task", titleKey: "toast.taTask", freqKey: "toast.freqTaTask" },
|
|
1473
|
+
{ id: "teamauto:activity:sweep", titleKey: "toast.taSweep", freqKey: "toast.freqTaSweep" },
|
|
1474
|
+
{ id: "teamauto:activity:writeback", titleKey: "toast.taWriteback", freqKey: "toast.freqTaWriteback" },
|
|
1475
|
+
{ id: "message:new", titleKey: "toast.messageNew", freqKey: "toast.freqMessageNew" },
|
|
1476
|
+
];
|
|
1477
|
+
|
|
1478
|
+
function loadToastPrefs() {
|
|
1479
|
+
try {
|
|
1480
|
+
var raw = window.localStorage.getItem(TOAST_PREFS_KEY);
|
|
1481
|
+
if (raw) {
|
|
1482
|
+
var parsed = JSON.parse(raw);
|
|
1483
|
+
if (parsed && typeof parsed === "object") {
|
|
1484
|
+
return parsed;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
} catch (_err) {}
|
|
1488
|
+
return {};
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
function toastEnabled(eventId) {
|
|
1492
|
+
// All event toasts are enabled by default; users opt out per event.
|
|
1493
|
+
return loadToastPrefs()[eventId] !== false;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
function setToastPref(eventId, enabled) {
|
|
1497
|
+
var prefs = loadToastPrefs();
|
|
1498
|
+
prefs[eventId] = !!enabled;
|
|
1499
|
+
try {
|
|
1500
|
+
window.localStorage.setItem(TOAST_PREFS_KEY, JSON.stringify(prefs));
|
|
1501
|
+
} catch (_err) {}
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
function workerEventLabel(data) {
|
|
1505
|
+
data = data || {};
|
|
1506
|
+
return String(data.id || data.workerId || data.name || data.role || "");
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
function messageEventLabel(data) {
|
|
1510
|
+
data = data || {};
|
|
1511
|
+
var from = data.fromRole || data.role || data.sender || "";
|
|
1512
|
+
var text = String(data.text || data.content || data.body || "").slice(0, 80);
|
|
1513
|
+
return (from ? from + ": " : "") + text;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
function toggleToastSettingsPanel() {
|
|
1517
|
+
var existing = document.getElementById("toast-settings-panel");
|
|
1518
|
+
if (existing) {
|
|
1519
|
+
existing.remove();
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
var panel = document.createElement("div");
|
|
1523
|
+
panel.id = "toast-settings-panel";
|
|
1524
|
+
panel.style.cssText = "position:fixed;top:64px;right:16px;z-index:2100;background:#111827;color:#fff;"
|
|
1525
|
+
+ "border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,0.4);padding:16px;"
|
|
1526
|
+
+ "min-width:320px;max-width:min(430px,92vw);font-size:13px;line-height:1.5;";
|
|
1527
|
+
var head = document.createElement("div");
|
|
1528
|
+
head.style.cssText = "display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;";
|
|
1529
|
+
var title = document.createElement("div");
|
|
1530
|
+
title.style.fontWeight = "600";
|
|
1531
|
+
title.textContent = t("toast.settingsTitle");
|
|
1532
|
+
var close = document.createElement("button");
|
|
1533
|
+
close.type = "button";
|
|
1534
|
+
close.textContent = t("teamauto.close");
|
|
1535
|
+
close.style.cssText = "background:none;border:1px solid rgba(255,255,255,0.3);color:#fff;border-radius:6px;padding:2px 8px;cursor:pointer;font-size:12px;";
|
|
1536
|
+
close.addEventListener("click", function () { panel.remove(); });
|
|
1537
|
+
head.appendChild(title);
|
|
1538
|
+
head.appendChild(close);
|
|
1539
|
+
panel.appendChild(head);
|
|
1540
|
+
var prefs = loadToastPrefs();
|
|
1541
|
+
TOAST_EVENT_DEFS.forEach(function (def) {
|
|
1542
|
+
var row = document.createElement("label");
|
|
1543
|
+
row.style.cssText = "display:flex;gap:10px;align-items:flex-start;padding:7px 0;border-top:1px solid rgba(255,255,255,0.08);cursor:pointer;";
|
|
1544
|
+
var box = document.createElement("input");
|
|
1545
|
+
box.type = "checkbox";
|
|
1546
|
+
box.checked = prefs[def.id] !== false;
|
|
1547
|
+
box.style.marginTop = "3px";
|
|
1548
|
+
box.addEventListener("change", function () {
|
|
1549
|
+
setToastPref(def.id, box.checked);
|
|
1550
|
+
});
|
|
1551
|
+
var text = document.createElement("div");
|
|
1552
|
+
var name = document.createElement("div");
|
|
1553
|
+
name.style.fontWeight = "600";
|
|
1554
|
+
name.textContent = t(def.titleKey);
|
|
1555
|
+
var freq = document.createElement("div");
|
|
1556
|
+
freq.style.cssText = "opacity:0.65;font-size:12px;";
|
|
1557
|
+
freq.textContent = t(def.freqKey);
|
|
1558
|
+
text.appendChild(name);
|
|
1559
|
+
text.appendChild(freq);
|
|
1560
|
+
row.appendChild(box);
|
|
1561
|
+
row.appendChild(text);
|
|
1562
|
+
panel.appendChild(row);
|
|
1563
|
+
});
|
|
1564
|
+
var foot = document.createElement("div");
|
|
1565
|
+
foot.style.cssText = "display:flex;gap:8px;justify-content:flex-end;margin-top:10px;";
|
|
1566
|
+
var allOn = document.createElement("button");
|
|
1567
|
+
allOn.type = "button";
|
|
1568
|
+
allOn.textContent = t("toast.enableAll");
|
|
1569
|
+
var allOff = document.createElement("button");
|
|
1570
|
+
allOff.type = "button";
|
|
1571
|
+
allOff.textContent = t("toast.disableAll");
|
|
1572
|
+
[allOn, allOff].forEach(function (btn) {
|
|
1573
|
+
btn.style.cssText = "background:rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.25);color:#fff;border-radius:6px;padding:4px 10px;cursor:pointer;font-size:12px;";
|
|
1574
|
+
});
|
|
1575
|
+
allOn.addEventListener("click", function () {
|
|
1576
|
+
TOAST_EVENT_DEFS.forEach(function (def) { setToastPref(def.id, true); });
|
|
1577
|
+
panel.remove();
|
|
1578
|
+
toggleToastSettingsPanel();
|
|
1579
|
+
});
|
|
1580
|
+
allOff.addEventListener("click", function () {
|
|
1581
|
+
TOAST_EVENT_DEFS.forEach(function (def) { setToastPref(def.id, false); });
|
|
1582
|
+
panel.remove();
|
|
1583
|
+
toggleToastSettingsPanel();
|
|
1584
|
+
});
|
|
1585
|
+
foot.appendChild(allOff);
|
|
1586
|
+
foot.appendChild(allOn);
|
|
1587
|
+
panel.appendChild(foot);
|
|
1588
|
+
document.body.appendChild(panel);
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
var toastSettingsToggle = $("#toast-settings-toggle");
|
|
1592
|
+
if (toastSettingsToggle) {
|
|
1593
|
+
toastSettingsToggle.addEventListener("click", function (event) {
|
|
1594
|
+
event.stopPropagation();
|
|
1595
|
+
toggleToastSettingsPanel();
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
const recentNoticeKeys = {};
|
|
1600
|
+
|
|
1601
|
+
function showNotice(eventId, kind, title, body) {
|
|
1602
|
+
// Status-change toasts (task/worker/clarification/TeamAuto events).
|
|
1603
|
+
// Per-event toggles persist in localStorage (all on by default);
|
|
1604
|
+
// deduped against event bursts and capped so a busy team cannot
|
|
1605
|
+
// flood the corner.
|
|
1606
|
+
if (!toastEnabled(eventId)) {
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
const now = Date.now();
|
|
1610
|
+
const dedupeKey = kind + "|" + title + "|" + body;
|
|
1611
|
+
if (recentNoticeKeys[dedupeKey] && now - recentNoticeKeys[dedupeKey] < 4000) {
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
recentNoticeKeys[dedupeKey] = now;
|
|
1615
|
+
if (Object.keys(recentNoticeKeys).length > 200) {
|
|
1616
|
+
for (var staleKey in recentNoticeKeys) {
|
|
1617
|
+
if (now - recentNoticeKeys[staleKey] >= 4000) {
|
|
1618
|
+
delete recentNoticeKeys[staleKey];
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
let container = document.getElementById("toast-container");
|
|
1623
|
+
if (!container) {
|
|
1624
|
+
container = document.createElement("div");
|
|
1625
|
+
container.id = "toast-container";
|
|
1626
|
+
container.style.cssText = "position:fixed;bottom:24px;right:24px;z-index:2000;display:flex;flex-direction:column;gap:10px;max-width:min(420px,80vw);";
|
|
1627
|
+
document.body.appendChild(container);
|
|
1628
|
+
}
|
|
1629
|
+
while (container.children.length >= 6) {
|
|
1630
|
+
container.removeChild(container.firstChild);
|
|
1631
|
+
}
|
|
1632
|
+
const toast = document.createElement("div");
|
|
1633
|
+
const bg = kind === "success" ? "#14532d" : kind === "attention" ? "#7f1d1d" : "#1e3a5f";
|
|
1634
|
+
toast.style.cssText = "background:" + bg + ";color:#fff;padding:12px 16px;border-radius:10px;"
|
|
1635
|
+
+ "box-shadow:0 8px 24px rgba(0,0,0,0.35);font-size:13px;line-height:1.45;"
|
|
1636
|
+
+ "cursor:pointer;opacity:0;transition:opacity 0.25s ease;";
|
|
1637
|
+
const titleEl = document.createElement("div");
|
|
1638
|
+
titleEl.style.cssText = "font-weight:600;";
|
|
1639
|
+
titleEl.textContent = title;
|
|
1640
|
+
const bodyEl = document.createElement("div");
|
|
1641
|
+
bodyEl.style.cssText = "opacity:.85;margin-top:2px;";
|
|
1642
|
+
bodyEl.textContent = body;
|
|
1643
|
+
toast.appendChild(titleEl);
|
|
1644
|
+
toast.appendChild(bodyEl);
|
|
1645
|
+
container.appendChild(toast);
|
|
1646
|
+
requestAnimationFrame(function () { toast.style.opacity = "1"; });
|
|
1647
|
+
const dismiss = function () {
|
|
1648
|
+
toast.style.opacity = "0";
|
|
1649
|
+
setTimeout(function () { toast.remove(); }, 250);
|
|
1650
|
+
};
|
|
1651
|
+
toast.onclick = dismiss;
|
|
1652
|
+
setTimeout(dismiss, 6000);
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1398
1655
|
async function apiRequest(path, options) {
|
|
1399
1656
|
const res = await fetch(API_BASE + path, options);
|
|
1400
1657
|
let data = {};
|
|
@@ -1961,18 +2218,67 @@
|
|
|
1961
2218
|
handleTaskExecutionEvent(event.data || {});
|
|
1962
2219
|
break;
|
|
1963
2220
|
case "worker:online":
|
|
2221
|
+
refreshAll();
|
|
2222
|
+
showNotice("worker:online", "info", t("toast.workerOnline"), workerEventLabel(event.data));
|
|
2223
|
+
break;
|
|
1964
2224
|
case "worker:offline":
|
|
2225
|
+
refreshAll();
|
|
2226
|
+
showNotice("worker:offline", "info", t("toast.workerOffline"), workerEventLabel(event.data));
|
|
2227
|
+
break;
|
|
1965
2228
|
case "task:created":
|
|
2229
|
+
refreshAll();
|
|
2230
|
+
if (selectedTaskId && taskId && taskId === selectedTaskId) {
|
|
2231
|
+
refreshTaskDetail(true);
|
|
2232
|
+
}
|
|
2233
|
+
showNotice("task:created", "info", t("toast.taskCreated"), (event.data || {}).title || taskId || "");
|
|
2234
|
+
break;
|
|
1966
2235
|
case "task:updated":
|
|
1967
|
-
|
|
2236
|
+
refreshAll();
|
|
2237
|
+
if (selectedTaskId && taskId && taskId === selectedTaskId) {
|
|
2238
|
+
refreshTaskDetail(true);
|
|
2239
|
+
}
|
|
2240
|
+
showNotice("task:updated", "info", t("toast.taskUpdated"), (event.data || {}).title || taskId || "");
|
|
2241
|
+
break;
|
|
1968
2242
|
case "message:new":
|
|
2243
|
+
refreshAll();
|
|
2244
|
+
showNotice("message:new", "info", t("toast.messageNew"), messageEventLabel(event.data));
|
|
2245
|
+
break;
|
|
2246
|
+
case "task:completed": {
|
|
2247
|
+
refreshAll();
|
|
2248
|
+
if (selectedTaskId && taskId && taskId === selectedTaskId) {
|
|
2249
|
+
refreshTaskDetail(true);
|
|
2250
|
+
}
|
|
2251
|
+
const doneData = event.data || {};
|
|
2252
|
+
const doneStatus = String(doneData.status || "").toLowerCase();
|
|
2253
|
+
const doneFailed = doneStatus === "failed" || doneStatus === "blocked";
|
|
2254
|
+
showNotice("task:completed", doneFailed ? "attention" : "success",
|
|
2255
|
+
t(doneFailed ? "toast.taskFailed" : "toast.taskCompleted"),
|
|
2256
|
+
doneData.title || taskId || "");
|
|
2257
|
+
break;
|
|
2258
|
+
}
|
|
1969
2259
|
case "clarification:requested":
|
|
2260
|
+
refreshAll();
|
|
2261
|
+
if (selectedTaskId && taskId && taskId === selectedTaskId) {
|
|
2262
|
+
refreshTaskDetail(true);
|
|
2263
|
+
}
|
|
2264
|
+
showNotice("clarification:requested", "attention", t("toast.clarificationRequested"), (event.data || {}).question || taskId || "");
|
|
2265
|
+
break;
|
|
1970
2266
|
case "clarification:answered":
|
|
1971
2267
|
refreshAll();
|
|
1972
2268
|
if (selectedTaskId && taskId && taskId === selectedTaskId) {
|
|
1973
2269
|
refreshTaskDetail(true);
|
|
1974
2270
|
}
|
|
2271
|
+
showNotice("clarification:answered", "info", t("toast.clarificationAnswered"), (event.data || {}).question || taskId || "");
|
|
2272
|
+
break;
|
|
2273
|
+
case "teamauto:activity": {
|
|
2274
|
+
const entry = event.data || {};
|
|
2275
|
+
const kindId = "teamauto:activity:" + String(entry.kind || "activity");
|
|
2276
|
+
if (toastEnabled("teamauto:activity") && toastEnabled(kindId)) {
|
|
2277
|
+
showNotice(kindId, "info", t("toast.teamautoPrefix") + " - " + String(entry.kind || "activity"),
|
|
2278
|
+
String(entry.repoId || "") + (entry.text ? " - " + String(entry.text) : ""));
|
|
2279
|
+
}
|
|
1975
2280
|
break;
|
|
2281
|
+
}
|
|
1976
2282
|
case "report:ready":
|
|
1977
2283
|
handleReportReady(event.data || {});
|
|
1978
2284
|
break;
|
|
@@ -3856,4 +4162,54 @@ function closeModelSettings() {
|
|
|
3856
4162
|
if (activeTab === "teamauto") { refreshTeamAutoTab(); }
|
|
3857
4163
|
}, 10000);
|
|
3858
4164
|
|
|
4165
|
+
|
|
4166
|
+
// Tunnel sharing (internet gate for the local web UI).
|
|
4167
|
+
function initTunnelPanel() {
|
|
4168
|
+
const wrap = document.getElementById("tunnel-panel");
|
|
4169
|
+
if (!wrap || wrap.dataset.bound) return;
|
|
4170
|
+
wrap.dataset.bound = "true";
|
|
4171
|
+
// Visitor view: when the dashboard itself is reached through a tunnel
|
|
4172
|
+
// domain, management APIs are gated - degrade to a provenance badge
|
|
4173
|
+
// instead of a spinner that can never resolve.
|
|
4174
|
+
const host = (location.hostname || "").toLowerCase();
|
|
4175
|
+
const isLocalView = host === "127.0.0.1" || host === "localhost" || host.endsWith(".local");
|
|
4176
|
+
if (!isLocalView) {
|
|
4177
|
+
wrap.innerHTML = '<h3>Internet Tunnel</h3><div class="tunnel-state"><span class="tunnel-note">This dashboard is shared via a TeamClaw tunnel.</span></div>';
|
|
4178
|
+
return;
|
|
4179
|
+
}
|
|
4180
|
+
const render = (st) => {
|
|
4181
|
+
var progress = st.startOp && st.startOp.running
|
|
4182
|
+
? '<div class="tunnel-note">Starting tunnel: ' + escapeHtml(st.startOp.phase) + '…</div>'
|
|
4183
|
+
: (st.install && st.install.running
|
|
4184
|
+
? '<div class="tunnel-note">cloudflared ' + escapeHtml(st.install.phase) + (st.install.percent != null ? ' ' + st.install.percent + '%' : '') + '…</div>'
|
|
4185
|
+
: '');
|
|
4186
|
+
if (progress) { wrap.querySelector(".tunnel-state").innerHTML = progress; return; }
|
|
4187
|
+
wrap.querySelector(".tunnel-state").innerHTML = st.active
|
|
4188
|
+
? '<div class="tunnel-on">Live: <a href="https://' + st.hostname + '" target="_blank" rel="noopener">https://' + st.hostname + '</a></div>'
|
|
4189
|
+
+ '<div class="tunnel-token">Gate token: <b>' + st.gateToken + '</b></div>'
|
|
4190
|
+
+ '<button class="btn btn-small" data-act="stop">Stop sharing</button>'
|
|
4191
|
+
: st.cloudflaredInstalled === false
|
|
4192
|
+
? '<div class="tunnel-note">cloudflared connector is not installed.</div>'
|
|
4193
|
+
+ '<button class="btn btn-small btn-primary" data-act="install">Install cloudflared</button>'
|
|
4194
|
+
: '<button class="btn btn-small btn-primary" data-act="start">Share via tunnel</button>'
|
|
4195
|
+
+ '<span class="tunnel-note">requires GitHub login</span>';
|
|
4196
|
+
};
|
|
4197
|
+
const refresh = () => apiGet("/tunnel/status").then((st) => render(st || {})).catch(() => {});
|
|
4198
|
+
wrap.addEventListener("click", (e) => {
|
|
4199
|
+
const act = e.target.getAttribute && e.target.getAttribute("data-act");
|
|
4200
|
+
if (!act) return;
|
|
4201
|
+
e.target.disabled = true;
|
|
4202
|
+
var call = act === "start" ? apiRequest("/tunnel/start", { method: "POST" })
|
|
4203
|
+
: act === "install" ? apiRequest("/tunnel/install-cloudflared", { method: "POST" })
|
|
4204
|
+
: apiRequest("/tunnel/stop", { method: "POST" });
|
|
4205
|
+
call.then(refresh).catch((err) => { wrap.querySelector(".tunnel-state").innerHTML = '<div class="tunnel-err">' + escapeHtml(String(err.message || err)) + "</div>"; });
|
|
4206
|
+
});
|
|
4207
|
+
refresh();
|
|
4208
|
+
setInterval(refresh, 5000);
|
|
4209
|
+
}
|
|
4210
|
+
// Script loads at end of body: DOM is already parsed - run immediately
|
|
4211
|
+
// (DOMContentLoaded may have already fired).
|
|
4212
|
+
initTunnelPanel();
|
|
3859
4213
|
})();
|
|
4214
|
+
|
|
4215
|
+
|
package/src/ui/index.html
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
<div class="header-status">
|
|
26
26
|
<span id="connection-status" class="status-dot disconnected"></span>
|
|
27
27
|
<button id="language-toggle" class="header-mini-btn" type="button">中文</button>
|
|
28
|
+
<button id="toast-settings-toggle" class="header-mini-btn" type="button" title="Toast notifications">Toasts</button>
|
|
28
29
|
<button id="worker-install-toggle" class="header-mini-btn" type="button" hidden>Add worker</button>
|
|
29
30
|
<span id="team-name">Team</span>
|
|
30
31
|
<button id="github-corner-login" class="header-mini-btn" type="button">Login</button>
|
|
@@ -130,6 +131,10 @@
|
|
|
130
131
|
|
|
131
132
|
<!-- Workspace Tab -->
|
|
132
133
|
<div id="tab-workspace" class="tab-panel">
|
|
134
|
+
<div class="tunnel-card" id="tunnel-panel">
|
|
135
|
+
<h3>Internet Tunnel</h3>
|
|
136
|
+
<div class="tunnel-state"><span class="tunnel-note">loading…</span></div>
|
|
137
|
+
</div>
|
|
133
138
|
<div class="workspace-browser">
|
|
134
139
|
<aside class="workspace-sidebar-panel">
|
|
135
140
|
<div class="workspace-panel-header">
|
|
@@ -205,6 +210,7 @@
|
|
|
205
210
|
<button id="teamauto-bind" class="btn btn-primary btn-small" type="button" data-i18n="teamauto.bind">Bind</button>
|
|
206
211
|
</div>
|
|
207
212
|
<div id="teamauto-bind-msg" class="teamauto-msg"></div>
|
|
213
|
+
<p class="teamauto-hint" data-i18n="teamauto.scheduleHint">Schedules: */N * * * * (every N min), M * * * * (hourly at :M), 0 */N * * * (every N h), M H * * * (daily at H:M), @hourly, @daily, @weekly, @monthly. Sweeps align to the clock and survive restarts.</p>
|
|
208
214
|
<div id="teamauto-bind-overlay" class="ta-bind-overlay is-hidden" role="dialog" aria-modal="true">
|
|
209
215
|
<div class="ta-bind-dialog">
|
|
210
216
|
<div class="ta-bind-title" id="teamauto-bind-title">Binding...</div>
|
package/src/ui/style.css
CHANGED
|
@@ -2551,3 +2551,12 @@ body {
|
|
|
2551
2551
|
.task-keyword-input { margin-left: auto; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border, #2a2f3a); background: var(--bg-primary); color: var(--text-primary); font-size: 12.5px; width: 200px; }
|
|
2552
2552
|
.task-keyword-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
|
|
2553
2553
|
.tasks-show-more { display: block; margin: 14px auto 4px; }
|
|
2554
|
+
|
|
2555
|
+
/* Tunnel sharing panel (workspace tab) */
|
|
2556
|
+
.tunnel-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-secondary); padding: 14px 18px; margin: 18px 0; }
|
|
2557
|
+
.tunnel-card h3 { font-size: 13px; margin-bottom: 8px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-secondary); }
|
|
2558
|
+
.tunnel-on a { color: var(--accent); font-family: var(--mono); }
|
|
2559
|
+
.tunnel-token { margin: 8px 0; font-size: 13px; }
|
|
2560
|
+
.tunnel-token b { font-family: var(--mono); letter-spacing: .15em; color: var(--accent); }
|
|
2561
|
+
.tunnel-note { margin-left: 10px; color: var(--text-muted); font-size: 12px; }
|
|
2562
|
+
.tunnel-err { color: var(--danger); font-size: 12.5px; margin-top: 8px; }
|