@teamclaws/teamclaw 2026.4.4 → 2026.6.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.
@@ -0,0 +1,296 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>TeamClaw - GitHub Login</title>
7
+ <style>
8
+ :root { color-scheme: dark; }
9
+ * { box-sizing: border-box; }
10
+ body {
11
+ margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center;
12
+ background: #0f1117; color: #e6e8ee;
13
+ font-family: -apple-system, "system-ui", "PingFang SC", "Microsoft YaHei", sans-serif;
14
+ padding: 24px;
15
+ }
16
+ main { width: 100%; max-width: 460px; background: #161923; border: 1px solid #2a2f3a; border-radius: 16px; padding: 32px 36px; text-align: center; }
17
+ h1 { font-size: 20px; margin: 0 0 6px; }
18
+ .sub { color: #a8b0c0; font-size: 14px; line-height: 1.6; margin: 0 0 20px; }
19
+ .hidden { display: none !important; }
20
+ .btn {
21
+ display: inline-block; appearance: none; border: 1px solid #2a2f3a; border-radius: 8px;
22
+ background: #21262d; color: #e6e8ee; padding: 10px 18px; font-size: 14px; cursor: pointer; text-decoration: none;
23
+ }
24
+ .btn:hover { background: #283040; }
25
+ .btn-primary { background: #238636; border-color: #2ea043; font-weight: 600; }
26
+ .btn-primary:hover { background: #2ea043; }
27
+ .btn-block { display: block; width: 100%; margin-top: 14px; padding: 12px; font-size: 15px; }
28
+ .btn[disabled] { opacity: 0.5; cursor: default; }
29
+ .device-box { border: 1px dashed #3d4450; border-radius: 12px; padding: 18px 14px 14px; margin: 18px 0 4px; background: rgba(128,128,128,0.06); }
30
+ .device-code {
31
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
32
+ font-size: 36px; font-weight: 700; letter-spacing: 6px; margin: 8px 0 12px; user-select: all;
33
+ }
34
+ .copy-row {
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ gap: 10px;
39
+ margin: 4px 0 12px;
40
+ }
41
+
42
+ .copy-state {
43
+ color: #3fb950;
44
+ font-size: 13px;
45
+ }
46
+
47
+ .countdown { color: #a8b0c0; font-size: 13px; margin-top: 8px; }
48
+ .countdown b { color: #e6e8ee; }
49
+ .avatar { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 10px; }
50
+ .account { font-size: 16px; font-weight: 600; }
51
+ .meta { color: #a8b0c0; font-size: 13px; margin-top: 6px; }
52
+ .ok-badge { font-size: 34px; }
53
+ .error {
54
+ background: rgba(229,83,75,0.12); border: 1px solid rgba(229,83,75,0.5); color: #f0a6a2;
55
+ border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin-top: 14px; text-align: left;
56
+ }
57
+ .footer-note { color: #6e7681; font-size: 12px; margin-top: 18px; }
58
+ a.link { color: #58a6ff; }
59
+ </style>
60
+ </head>
61
+ <body>
62
+ <main id="app">
63
+ <div id="view-loading">
64
+ <h1>TeamClaw GitHub</h1>
65
+ <p class="sub" id="t-loading">Loading...</p>
66
+ </div>
67
+
68
+ <div id="view-idle" class="hidden">
69
+ <h1 id="t-idle-title">Sign in with GitHub</h1>
70
+ <p class="sub" id="t-idle-sub">Authorize TeamClaw to access the GitHub API on your behalf. Device flow: no client secret needed.</p>
71
+ <button id="btn-start" class="btn btn-primary btn-block" type="button">Sign in with GitHub</button>
72
+ <div id="idle-error" class="error hidden"></div>
73
+ </div>
74
+
75
+ <div id="view-device" class="hidden">
76
+ <h1 id="t-device-title">Enter this code on GitHub</h1>
77
+ <p class="sub" id="t-device-sub">The code is copied to your clipboard. Open the GitHub device page below, paste the code there, and confirm.</p>
78
+ <div class="device-box">
79
+ <div class="device-code" id="device-code">------</div>
80
+ <div class="copy-row">
81
+ <span id="copy-state" class="copy-state hidden">Copied to clipboard</span>
82
+ <button id="btn-copy" class="btn" type="button">Copy code</button>
83
+ </div>
84
+ <div class="countdown" id="t-expires"><span id="t-expires-label">Expires in</span> <b id="countdown">--:--</b></div>
85
+ </div>
86
+ <a id="btn-open" class="btn btn-primary btn-block" href="https://github.com/login/device" target="_blank" rel="noopener">Open github.com/login/device</a>
87
+ <p class="footer-note" id="t-waiting">Waiting for authorization... this page updates automatically.</p>
88
+ </div>
89
+
90
+ <div id="view-success" class="hidden">
91
+ <div class="ok-badge">&#10003;</div>
92
+ <h1 id="t-success-title">Signed in to GitHub</h1>
93
+ <img id="account-avatar" class="avatar hidden" alt="">
94
+ <div class="account" id="account-login"></div>
95
+ <div class="meta" id="account-meta"></div>
96
+ <button id="btn-logout" class="btn btn-block" type="button">Sign out</button>
97
+ <p class="footer-note" id="t-close">You can close this page and return to TeamClaw.</p>
98
+ </div>
99
+ </main>
100
+
101
+ <script>
102
+ (function () {
103
+ "use strict";
104
+ var zh = (navigator.language || "").toLowerCase().indexOf("zh") === 0;
105
+ var STR = zh ? {
106
+ loading: "加载中...",
107
+ idleTitle: "使用 GitHub 登录",
108
+ idleSub: "授权 TeamClaw 以你的身份访问 GitHub API。设备流方式,无需 Client Secret。",
109
+ start: "使用 GitHub 登录",
110
+ deviceTitle: "在 GitHub 上输入此代码",
111
+ deviceSub: "代码已复制到剪贴板。点击下方按钮打开 GitHub 设备页,粘贴代码并确认。",
112
+ copy: "复制代码",
113
+ copied: "已复制到剪贴板",
114
+ copyFailed: "请手动复制代码",
115
+ open: "打开 github.com/login/device",
116
+ expires: "有效期剩余",
117
+ waiting: "等待授权中...本页面会自动更新。",
118
+ successTitle: "GitHub 登录成功",
119
+ signOut: "退出登录",
120
+ close: "可以关闭本页返回 TeamClaw。",
121
+ validUntil: "令牌有效期至",
122
+ noExpiry: "令牌长期有效"
123
+ } : {
124
+ loading: "Loading...",
125
+ idleTitle: "Sign in with GitHub",
126
+ idleSub: "Authorize TeamClaw to access the GitHub API on your behalf. Device flow: no client secret needed.",
127
+ start: "Sign in with GitHub",
128
+ deviceTitle: "Enter this code on GitHub",
129
+ deviceSub: "The code is copied to your clipboard. Open the GitHub device page below, paste the code, and confirm.",
130
+ copy: "Copy code",
131
+ copied: "Copied to clipboard",
132
+ copyFailed: "Copy failed - select the code manually",
133
+ open: "Open github.com/login/device",
134
+ expires: "Expires in",
135
+ waiting: "Waiting for authorization... this page updates automatically.",
136
+ successTitle: "Signed in to GitHub",
137
+ signOut: "Sign out",
138
+ close: "You can close this page and return to TeamClaw.",
139
+ validUntil: "Token valid until",
140
+ noExpiry: "Token does not expire"
141
+ };
142
+
143
+ var API = "/api/v1/auth/github";
144
+ var $ = function (id) { return document.getElementById(id); };
145
+ var views = { loading: $("view-loading"), idle: $("view-idle"), device: $("view-device"), success: $("view-success") };
146
+ function show(name) { Object.keys(views).forEach(function (k) { views[k].classList.toggle("hidden", k !== name); }); }
147
+
148
+ $("t-loading").textContent = STR.loading;
149
+ $("t-idle-title").textContent = STR.idleTitle;
150
+ $("t-idle-sub").textContent = STR.idleSub;
151
+ $("btn-start").textContent = STR.start;
152
+ $("t-device-title").textContent = STR.deviceTitle;
153
+ $("t-device-sub").textContent = STR.deviceSub;
154
+ $("btn-copy").textContent = STR.copy;
155
+ $("btn-open").textContent = STR.open;
156
+ $("copy-state").textContent = STR.copied;
157
+ $("t-waiting").textContent = STR.waiting;
158
+ $("t-success-title").textContent = STR.successTitle;
159
+ $("btn-logout").textContent = STR.signOut;
160
+ $("t-close").textContent = STR.close;
161
+
162
+ var countdownTimer = null;
163
+ function setCountdown(expiresAt) {
164
+ if (countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; }
165
+ var label = $("t-expires-label");
166
+ if (label) { label.textContent = STR.expires; }
167
+ function tick() {
168
+ var el = $("countdown");
169
+ if (!el) return;
170
+ var left = Math.max(0, Math.floor((expiresAt - Date.now()) / 1000));
171
+ var m = Math.floor(left / 60), s = left % 60;
172
+ el.textContent = (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
173
+ if (left <= 0 && countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; refresh(); }
174
+ }
175
+ tick();
176
+ countdownTimer = setInterval(tick, 1000);
177
+ }
178
+
179
+ function showCopiedState(ok) {
180
+ var state = $("copy-state");
181
+ if (!state) return;
182
+ state.textContent = ok ? STR.copied : STR.copyFailed;
183
+ state.classList.remove("hidden");
184
+ }
185
+
186
+ function copyCode(value) {
187
+ if (!value) return;
188
+ if (navigator.clipboard && navigator.clipboard.writeText) {
189
+ navigator.clipboard.writeText(value).then(function () {
190
+ showCopiedState(true);
191
+ }).catch(function () {
192
+ showCopiedState(false);
193
+ });
194
+ return;
195
+ }
196
+ try {
197
+ var helper = document.createElement("textarea");
198
+ helper.value = value;
199
+ helper.style.position = "fixed";
200
+ helper.style.opacity = "0";
201
+ document.body.appendChild(helper);
202
+ helper.select();
203
+ document.execCommand("copy");
204
+ document.body.removeChild(helper);
205
+ showCopiedState(true);
206
+ } catch (e) {
207
+ showCopiedState(false);
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Render the device-code view. autoCopy is true only when a real user
213
+ * click just produced the code: clipboard writes need the document
214
+ * focused and (in some engines) transient user activation, so we never
215
+ * attempt them from background polling.
216
+ */
217
+ function showDevice(device, autoCopy) {
218
+ var codeEl = $("device-code");
219
+ codeEl.textContent = device.userCode || "------";
220
+ var openBtn = $("btn-open");
221
+ if (openBtn) { openBtn.href = device.verificationUri; }
222
+ show("device");
223
+ try { setCountdown(device.expiresAt); } catch (e) { /* countdown is cosmetic - never hide the code */ }
224
+ if (autoCopy) { copyCode(device.userCode || ""); }
225
+ }
226
+
227
+ function render(status) {
228
+ if (status.authenticated && status.account) {
229
+ if (countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; }
230
+ var av = $("account-avatar");
231
+ if (status.account.avatarUrl) { av.src = status.account.avatarUrl; av.classList.remove("hidden"); } else { av.classList.add("hidden"); }
232
+ $("account-login").textContent = "@" + status.account.login;
233
+ $("account-meta").textContent = status.expiresAt
234
+ ? STR.validUntil + " " + new Date(status.expiresAt).toLocaleString()
235
+ : STR.noExpiry;
236
+ show("success");
237
+ return;
238
+ }
239
+ if (status.device) {
240
+ // Poll path: display only. No clipboard attempt, no navigation.
241
+ showDevice(status.device, false);
242
+ return;
243
+ }
244
+ if (countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; }
245
+ show("idle");
246
+ }
247
+
248
+ var refreshing = false;
249
+ function refresh() {
250
+ if (refreshing) return Promise.resolve();
251
+ refreshing = true;
252
+ return fetch(API + "/status").then(function (r) { return r.json(); }).then(function (status) {
253
+ refreshing = false;
254
+ render(status);
255
+ }).catch(function () { refreshing = false; });
256
+ }
257
+
258
+ $("btn-start").addEventListener("click", function () {
259
+ var btn = $("btn-start");
260
+ var errBox = $("idle-error");
261
+ errBox.classList.add("hidden");
262
+ btn.disabled = true;
263
+ btn.textContent = STR.loading;
264
+ // Two-step flow: this click only requests the device code and renders
265
+ // it (with a gesture-chained clipboard copy). The user then explicitly
266
+ // clicks the open button to jump to GitHub - no automatic navigation.
267
+ fetch(API + "/login", { method: "POST" }).then(function (r) {
268
+ return r.json().then(function (body) { return { ok: r.ok, body: body }; });
269
+ }).then(function (result) {
270
+ if (!result.ok) { throw new Error(result.body && result.body.error ? result.body.error : "login failed"); }
271
+ if (result.body && result.body.userCode) {
272
+ showDevice(result.body, true);
273
+ }
274
+ return refresh();
275
+ }).catch(function (err) {
276
+ errBox.textContent = err instanceof Error ? err.message : String(err);
277
+ errBox.classList.remove("hidden");
278
+ }).finally(function () { btn.disabled = false; btn.textContent = STR.start; });
279
+ });
280
+
281
+ $("btn-copy").addEventListener("click", function () {
282
+ copyCode($("device-code").textContent);
283
+ });
284
+
285
+ $("btn-logout").addEventListener("click", function () {
286
+ var btn = $("btn-logout");
287
+ btn.disabled = true;
288
+ fetch(API + "/logout", { method: "POST" }).then(function () { return refresh(); }).finally(function () { btn.disabled = false; });
289
+ });
290
+
291
+ refresh();
292
+ setInterval(refresh, 2500);
293
+ })();
294
+ </script>
295
+ </body>
296
+ </html>
package/src/ui/index.html CHANGED
@@ -1,6 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='1' y='1' width='30' height='30' rx='8' fill='%2314120d' stroke='%235a4f3a' stroke-width='1.5'/%3E%3Cg stroke='%23d9a664' stroke-linecap='round' fill='none' stroke-width='4.4' transform='translate(16 16) rotate(-10) scale(0.66) translate(-16.5 -17)'%3E%3Cpath d='M5 28C8 20 12 11 17 4'/%3E%3Cpath d='M11 30C14 22 18 13 23 6'/%3E%3Cpath d='M18 29C20.5 22 24 14 28 8'/%3E%3C/g%3E%3C/svg%3E">
4
5
  <meta charset="UTF-8">
5
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
7
  <title>TeamClaw - Virtual Team Dashboard</title>
@@ -11,14 +12,27 @@
11
12
  <body>
12
13
  <header class="header">
13
14
  <div class="header-brand">
14
- <img class="header-logo" src="/ui/assets/teamclaw-app-icon.png" alt="TeamClaw logo">
15
+ <svg class="header-logo" width="32" height="32" viewBox="0 0 32 32" role="img" aria-label="TeamClaw logo">
16
+ <rect x="1" y="1" width="30" height="30" rx="8" fill="#14120d" stroke="#5a4f3a" stroke-width="1.5"/>
17
+ <g stroke="#d9a664" stroke-linecap="round" fill="none" stroke-width="4.4" transform="translate(16 16) rotate(-10) scale(0.66) translate(-16.5 -17)">
18
+ <path d="M5 28C8 20 12 11 17 4"/>
19
+ <path d="M11 30C14 22 18 13 23 6"/>
20
+ <path d="M18 29C20.5 22 24 14 28 8"/>
21
+ </g>
22
+ </svg>
15
23
  <h1 class="header-title">TeamClaw</h1>
16
24
  </div>
17
25
  <div class="header-status">
18
26
  <span id="connection-status" class="status-dot disconnected"></span>
19
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>
20
29
  <button id="worker-install-toggle" class="header-mini-btn" type="button" hidden>Add worker</button>
21
30
  <span id="team-name">Team</span>
31
+ <button id="github-corner-login" class="header-mini-btn" type="button">Login</button>
32
+ <span id="github-corner-user" class="github-corner-user hidden" role="button" tabindex="0" title="GitHub: click to sign out">
33
+ <img id="github-corner-avatar" class="github-corner-avatar hidden" alt="">
34
+ <span id="github-corner-name"></span>
35
+ </span>
22
36
  </div>
23
37
  </header>
24
38
 
@@ -57,6 +71,7 @@
57
71
  <span id="clarifications-tab-signal" class="tab-signal"></span>
58
72
  </button>
59
73
  <button class="tab" data-tab="messages"><span class="tab-label" data-i18n="tab.messages">Messages</span></button>
74
+ <button class="tab" data-tab="teamauto"><span class="tab-label" data-i18n="tab.teamauto">TeamAuto</span></button>
60
75
  <button class="tab" data-tab="create-task" data-i18n="tab.manualTask">Manual Task</button>
61
76
  </div>
62
77
 
@@ -107,6 +122,7 @@
107
122
  <button class="filter-btn" data-filter="blocked">Blocked</button>
108
123
  <button class="filter-btn" data-filter="completed">Completed</button>
109
124
  <button class="filter-btn" data-filter="failed">Failed</button>
125
+ <input id="task-keyword" class="task-keyword-input" type="search" placeholder="Filter by keyword..." spellcheck="false" autocomplete="off" />
110
126
  </div>
111
127
  <div id="tasks-board" class="tasks-board">
112
128
  <div class="empty-state" data-i18n="empty.noTasks">No tasks yet</div>
@@ -115,6 +131,10 @@
115
131
 
116
132
  <!-- Workspace Tab -->
117
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>
118
138
  <div class="workspace-browser">
119
139
  <aside class="workspace-sidebar-panel">
120
140
  <div class="workspace-panel-header">
@@ -179,6 +199,37 @@
179
199
  </div>
180
200
 
181
201
  <!-- Create Task Tab -->
202
+ <!-- TeamAuto Tab -->
203
+ <div id="tab-teamauto" class="tab-panel">
204
+ <div class="teamauto-wrap">
205
+ <div class="teamauto-bind card">
206
+ <div class="teamauto-bind-row">
207
+ <select id="teamauto-repo-select" class="teamauto-select"></select>
208
+ <button id="teamauto-repos-refresh" class="btn btn-small" type="button" data-i18n="teamauto.refreshRepos">Refresh repos</button>
209
+ <input id="teamauto-schedule" class="teamauto-schedule-input" type="text" placeholder="*/30 * * * *" spellcheck="false">
210
+ <button id="teamauto-bind" class="btn btn-primary btn-small" type="button" data-i18n="teamauto.bind">Bind</button>
211
+ </div>
212
+ <div id="teamauto-bind-msg" class="teamauto-msg"></div>
213
+ <div id="teamauto-bind-overlay" class="ta-bind-overlay is-hidden" role="dialog" aria-modal="true">
214
+ <div class="ta-bind-dialog">
215
+ <div class="ta-bind-title" id="teamauto-bind-title">Binding...</div>
216
+ <ol class="ta-bind-steps">
217
+ <li data-stage="1"><span class="ta-step-dot"></span><span class="ta-step-label" data-i18n="teamauto.bindStageVerify">Verifying access</span></li>
218
+ <li data-stage="2"><span class="ta-step-dot"></span><span class="ta-step-label" data-i18n="teamauto.bindStageClone">Cloning repository</span></li>
219
+ <li data-stage="3"><span class="ta-step-dot"></span><span class="ta-step-label" data-i18n="teamauto.bindStageNorms">Learning repo conventions</span></li>
220
+ </ol>
221
+ <div class="ta-bind-note" id="teamauto-bind-note"></div>
222
+ <button id="teamauto-bind-overlay-close" class="btn btn-small is-hidden" type="button" data-i18n="teamauto.close">Close</button>
223
+ </div>
224
+ </div>
225
+ <p class="teamauto-hint" data-i18n="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.</p>
226
+ </div>
227
+ <div id="teamauto-repos" class="teamauto-repos"></div>
228
+ <h3 class="teamauto-section-title" data-i18n="teamauto.activity">Activity</h3>
229
+ <div id="teamauto-activity" class="teamauto-activity"></div>
230
+ </div>
231
+ </div>
232
+
182
233
  <div id="tab-create-task" class="tab-panel">
183
234
  <div class="panel-note">
184
235
  <span data-i18n="manualTask.note">Raw human requirements should go to the controller conversation first. Use this form only for explicit manual task injection or testing.</span>