@teamclaws/teamclaw 2026.8.1 → 2026.11.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 (184) hide show
  1. package/cli.mjs +318 -17
  2. package/dist/index.js +54 -32
  3. package/dist/src/config.js +57 -2
  4. package/dist/src/controller/auth-routes.js +129 -0
  5. package/dist/src/controller/clarification-routes.js +315 -0
  6. package/dist/src/controller/controller-intake.js +895 -0
  7. package/dist/src/controller/controller-planning.js +814 -0
  8. package/dist/src/controller/controller-routes.js +195 -0
  9. package/dist/src/controller/controller-runs.js +175 -0
  10. package/dist/src/controller/controller-service.js +338 -50
  11. package/dist/src/controller/controller-tools.js +14 -7
  12. package/dist/src/controller/github-auth.js +2 -1
  13. package/dist/src/controller/http-server.js +290 -6003
  14. package/dist/src/controller/kickoff-orchestrator.js +33 -43
  15. package/dist/src/controller/message-delivery.js +31 -0
  16. package/dist/src/controller/message-routes.js +114 -0
  17. package/dist/src/controller/orchestration-manifest.js +11 -93
  18. package/dist/src/controller/preview-manager.js +51 -3
  19. package/dist/src/controller/preview-proxy.js +98 -0
  20. package/dist/src/controller/profile-switch.js +309 -0
  21. package/dist/src/controller/project-registry.js +294 -0
  22. package/dist/src/controller/prompt-injector.js +19 -9
  23. package/dist/src/controller/provisioning/backend-contract.js +9 -0
  24. package/dist/src/controller/provisioning/container-shared.js +64 -0
  25. package/dist/src/controller/provisioning/docker.js +214 -0
  26. package/dist/src/controller/provisioning/kubernetes.js +244 -0
  27. package/dist/src/controller/provisioning/plugin-root.js +41 -0
  28. package/dist/src/controller/provisioning/process-supervisor.js +190 -0
  29. package/dist/src/controller/provisioning-config.js +239 -0
  30. package/dist/src/controller/repo-routes.js +129 -0
  31. package/dist/src/controller/report-routes.js +56 -0
  32. package/dist/src/controller/role-inference.js +231 -20
  33. package/dist/src/controller/route-table.js +375 -0
  34. package/dist/src/controller/security.js +775 -0
  35. package/dist/src/controller/status-routes.js +287 -0
  36. package/dist/src/controller/task-assignment.js +511 -0
  37. package/dist/src/controller/task-cleanup.js +258 -0
  38. package/dist/src/controller/task-execution.js +271 -0
  39. package/dist/src/controller/task-results.js +471 -0
  40. package/dist/src/controller/task-router.js +74 -4
  41. package/dist/src/controller/task-routes.js +703 -0
  42. package/dist/src/controller/teamauto-routes.js +124 -0
  43. package/dist/src/controller/tunnel-manager.js +41 -8
  44. package/dist/src/controller/tunnel-routes.js +225 -0
  45. package/dist/src/controller/ui-assets.js +68 -0
  46. package/dist/src/controller/websocket.js +6 -2
  47. package/dist/src/controller/webui-routes.js +49 -0
  48. package/dist/src/controller/worker-provisioning.js +69 -953
  49. package/dist/src/controller/worker-routes.js +188 -0
  50. package/dist/src/controller/workflow-routes.js +407 -0
  51. package/dist/src/controller/workspace-routes.js +200 -0
  52. package/dist/src/git-collaboration.js +4 -9
  53. package/dist/src/identity.js +15 -3
  54. package/dist/src/interaction-contracts.js +7 -7
  55. package/dist/src/openclaw-workspace.js +40 -18
  56. package/dist/src/profile-loader.js +604 -0
  57. package/dist/src/profiles/banking.json +202 -0
  58. package/dist/src/profiles/crossborder-ecom.json +253 -0
  59. package/dist/src/profiles/insurance.json +157 -0
  60. package/dist/src/profiles/knowledge/hs-structure.md +97 -0
  61. package/dist/src/profiles/knowledge/incoterms-2020.md +188 -0
  62. package/dist/src/profiles/knowledge/vat-principles.md +85 -0
  63. package/dist/src/profiles/schema.json +281 -0
  64. package/dist/src/profiles/securities.json +137 -0
  65. package/dist/src/profiles/software-rd.json +264 -0
  66. package/dist/src/profiles/trading-co.json +200 -0
  67. package/dist/src/prompt-policy.js +42 -17
  68. package/dist/src/protocol.js +66 -3
  69. package/dist/src/role-ids.js +29 -0
  70. package/dist/src/roles.js +54 -13
  71. package/dist/src/session-roles.js +14 -0
  72. package/dist/src/shared/clarification-schema.js +65 -0
  73. package/dist/src/shared/github-auth.js +15 -0
  74. package/dist/src/shared/kickoff-prompt.js +37 -0
  75. package/dist/src/shared/utils.js +47 -0
  76. package/dist/src/state.js +275 -11
  77. package/dist/src/task-executor.js +7 -17
  78. package/dist/src/teamauto/github-client.js +18 -0
  79. package/dist/src/teamauto/repo-sync.js +228 -6
  80. package/dist/src/teamauto/scanner.js +40 -12
  81. package/dist/src/teamauto/scheduler.js +231 -12
  82. package/dist/src/types.js +77 -16
  83. package/dist/src/ui/app.js +1434 -82
  84. package/dist/src/ui/github-login.html +1 -0
  85. package/dist/src/ui/index.html +144 -45
  86. package/dist/src/ui/style.css +194 -0
  87. package/dist/src/worker/http-handler.js +59 -0
  88. package/dist/src/worker/prompt-injector.js +44 -8
  89. package/dist/src/worker/skill-installer.js +6 -10
  90. package/dist/src/worker/tools.js +20 -10
  91. package/dist/src/worker/worker-service.js +93 -7
  92. package/index.ts +61 -32
  93. package/openclaw.plugin.json +50 -2
  94. package/package.json +3 -2
  95. package/src/config.ts +57 -2
  96. package/src/controller/auth-routes.ts +157 -0
  97. package/src/controller/clarification-routes.ts +404 -0
  98. package/src/controller/controller-intake.ts +1113 -0
  99. package/src/controller/controller-planning.ts +1037 -0
  100. package/src/controller/controller-routes.ts +237 -0
  101. package/src/controller/controller-runs.ts +239 -0
  102. package/src/controller/controller-service.ts +422 -50
  103. package/src/controller/controller-tools.ts +16 -9
  104. package/src/controller/github-auth.ts +28 -63
  105. package/src/controller/http-server.ts +336 -6964
  106. package/src/controller/kickoff-orchestrator.ts +69 -45
  107. package/src/controller/message-delivery.ts +52 -0
  108. package/src/controller/message-routes.ts +137 -0
  109. package/src/controller/orchestration-manifest.ts +14 -100
  110. package/src/controller/preview-manager.ts +53 -3
  111. package/src/controller/preview-proxy.ts +127 -0
  112. package/src/controller/profile-switch.ts +396 -0
  113. package/src/controller/project-registry.ts +361 -0
  114. package/src/controller/prompt-injector.ts +23 -8
  115. package/src/controller/provisioning/backend-contract.ts +51 -0
  116. package/src/controller/provisioning/container-shared.ts +84 -0
  117. package/src/controller/provisioning/docker.ts +260 -0
  118. package/src/controller/provisioning/kubernetes.ts +263 -0
  119. package/src/controller/provisioning/plugin-root.ts +42 -0
  120. package/src/controller/provisioning/process-supervisor.ts +214 -0
  121. package/src/controller/provisioning-config.ts +289 -0
  122. package/src/controller/repo-routes.ts +163 -0
  123. package/src/controller/report-routes.ts +64 -0
  124. package/src/controller/role-inference.ts +260 -22
  125. package/src/controller/route-table.ts +597 -0
  126. package/src/controller/security.ts +899 -0
  127. package/src/controller/status-routes.ts +354 -0
  128. package/src/controller/task-assignment.ts +622 -0
  129. package/src/controller/task-cleanup.ts +344 -0
  130. package/src/controller/task-execution.ts +399 -0
  131. package/src/controller/task-results.ts +556 -0
  132. package/src/controller/task-router.ts +98 -6
  133. package/src/controller/task-routes.ts +812 -0
  134. package/src/controller/teamauto-routes.ts +121 -0
  135. package/src/controller/tunnel-manager.ts +45 -8
  136. package/src/controller/tunnel-routes.ts +231 -0
  137. package/src/controller/ui-assets.ts +70 -0
  138. package/src/controller/websocket.ts +32 -4
  139. package/src/controller/webui-routes.ts +55 -0
  140. package/src/controller/worker-provisioning.ts +83 -1121
  141. package/src/controller/worker-routes.ts +241 -0
  142. package/src/controller/workflow-routes.ts +498 -0
  143. package/src/controller/workspace-routes.ts +222 -0
  144. package/src/git-collaboration.ts +4 -9
  145. package/src/identity.ts +16 -3
  146. package/src/interaction-contracts.ts +7 -7
  147. package/src/openclaw-workspace.ts +44 -18
  148. package/src/profile-loader.ts +816 -0
  149. package/src/profiles/banking.json +202 -0
  150. package/src/profiles/crossborder-ecom.json +253 -0
  151. package/src/profiles/insurance.json +157 -0
  152. package/src/profiles/knowledge/hs-structure.md +97 -0
  153. package/src/profiles/knowledge/incoterms-2020.md +188 -0
  154. package/src/profiles/knowledge/vat-principles.md +85 -0
  155. package/src/profiles/schema.json +281 -0
  156. package/src/profiles/securities.json +137 -0
  157. package/src/profiles/software-rd.json +264 -0
  158. package/src/profiles/trading-co.json +200 -0
  159. package/src/prompt-policy.ts +44 -17
  160. package/src/protocol.ts +72 -2
  161. package/src/role-ids.ts +31 -0
  162. package/src/roles.ts +60 -14
  163. package/src/session-roles.ts +14 -0
  164. package/src/shared/clarification-schema.ts +81 -0
  165. package/src/shared/github-auth.ts +92 -0
  166. package/src/shared/kickoff-prompt.ts +47 -0
  167. package/src/shared/utils.ts +51 -0
  168. package/src/state.ts +326 -10
  169. package/src/task-executor.ts +7 -18
  170. package/src/teamauto/github-client.ts +23 -1
  171. package/src/teamauto/repo-sync.ts +248 -7
  172. package/src/teamauto/scanner.ts +47 -13
  173. package/src/teamauto/scheduler.ts +261 -17
  174. package/src/teamauto/store.ts +12 -0
  175. package/src/types.ts +263 -17
  176. package/src/ui/app.js +1434 -82
  177. package/src/ui/github-login.html +1 -0
  178. package/src/ui/index.html +144 -45
  179. package/src/ui/style.css +194 -0
  180. package/src/worker/http-handler.ts +64 -1
  181. package/src/worker/prompt-injector.ts +48 -8
  182. package/src/worker/skill-installer.ts +6 -10
  183. package/src/worker/tools.ts +21 -10
  184. package/src/worker/worker-service.ts +101 -7
@@ -4,6 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>TeamClaw - GitHub Login</title>
7
+ <!-- i18n: the inline bilingual STR map in this page is INTENTIONALLY independent (standalone auth document; the app.js dictionary lives inside its own IIFE scope and is not reachable from here). It does NOT participate in tests/test-i18n-parity.mjs — edit the page's STR map directly. Unification was considered and rejected (DECIDED 2026-11-10, i18n shared-package re-evaluation closure). -->
7
8
  <style>
8
9
  :root { color-scheme: dark; }
9
10
  * { box-sizing: border-box; }
package/src/ui/index.html CHANGED
@@ -24,14 +24,19 @@
24
24
  </div>
25
25
  <div class="header-status">
26
26
  <span id="connection-status" class="status-dot disconnected"></span>
27
- <a id="tunnel-live-pill" class="tunnel-live-pill" hidden target="_blank" rel="noopener" title="Managed tunnel is live - open in a new tab"></a>
28
- <button id="tunnel-settings-toggle" class="header-mini-btn" type="button" title="Internet tunnel settings">Tunnel</button>
27
+ <a id="tunnel-live-pill" class="tunnel-live-pill" hidden target="_blank" rel="noopener" data-i18n-title="header.tunnelLiveTitle"></a>
28
+ <button id="tunnel-settings-toggle" class="header-mini-btn" type="button" data-i18n-title="ctl.tunnel.title" data-i18n="ctl.tab.tunnel">Tunnel</button>
29
29
  <button id="language-toggle" class="header-mini-btn" type="button">中文</button>
30
- <button id="toast-settings-toggle" class="header-mini-btn" type="button" title="Toast notifications">Toasts</button>
31
- <button id="worker-install-toggle" class="header-mini-btn" type="button" hidden>Add worker</button>
32
- <span id="team-name">Team</span>
33
- <button id="github-corner-login" class="header-mini-btn" type="button">Login</button>
34
- <span id="github-corner-user" class="github-corner-user hidden" role="button" tabindex="0" title="GitHub: click to sign out">
30
+ <button id="toast-settings-toggle" class="header-mini-btn" type="button" data-i18n-title="toast.settingsTitle" data-i18n="header.toasts">Toasts</button>
31
+ <button id="worker-install-toggle" class="header-mini-btn" type="button" hidden data-i18n="worker.add">Add worker</button>
32
+ <!-- Team profile indicator (Phase 5.1): shows the active profile's
33
+ icon + localized name; click opens #team-profile-modal. Static
34
+ fallback text/title only cover the pre-fetch paint; refreshAll
35
+ and renderTeamProfileHeaderButton overwrite both. -->
36
+ <button id="team-profile-toggle" class="header-mini-btn team-profile-toggle" type="button" data-i18n-title="teamProfile.kicker" data-i18n="header.teamFallback">Team</button>
37
+ <span id="team-name" data-i18n="header.teamFallback">Team</span>
38
+ <button id="github-corner-login" class="header-mini-btn" type="button" data-i18n="ctl.gh.login">Login</button>
39
+ <span id="github-corner-user" class="github-corner-user hidden" role="button" tabindex="0" data-i18n-title="header.githubUserTitle">
35
40
  <img id="github-corner-avatar" class="github-corner-avatar hidden" alt="">
36
41
  <span id="github-corner-name"></span>
37
42
  </span>
@@ -54,6 +59,12 @@
54
59
 
55
60
  <div class="content">
56
61
  <div id="runtime-alert" class="runtime-alert hidden"></div>
62
+ <!-- Device-pairing security suggestion banner (issue #23): non-blocking,
63
+ rendered only while protection is off AND a non-LAN peer was
64
+ observed (the /team/status security.suggested signal). The Enable
65
+ call is loopback-only server side; remote browsers never get an
66
+ actionable enable path. -->
67
+ <div id="security-suggest-banner" class="runtime-alert" hidden></div>
57
68
  <section id="external-worker-install" class="worker-install-card hidden"></section>
58
69
  <div class="tabs">
59
70
  <button class="tab" data-tab="planning">
@@ -84,7 +95,7 @@
84
95
  <aside class="planning-sessions">
85
96
  <div class="planning-sessions-header">Sessions</div>
86
97
  <div id="planning-session-list" class="planning-session-list">
87
- <div class="empty-state">No planning sessions yet</div>
98
+ <div class="empty-state" data-i18n="empty.noPlanningSessions">No planning sessions yet</div>
88
99
  </div>
89
100
  </aside>
90
101
  <div class="planning-main">
@@ -126,6 +137,13 @@
126
137
  <button class="filter-btn" data-filter="failed">Failed</button>
127
138
  <input id="task-keyword" class="task-keyword-input" type="search" placeholder="Filter by keyword..." spellcheck="false" autocomplete="off" />
128
139
  </div>
140
+ <!-- Workflow template button group (design 2.4 / PR #243 API
141
+ contract): buttons come from GET /api/v1/team/profile ->
142
+ profile.workflows[] (renderWorkflowLauncher in app.js).
143
+ hidden by default so profiles without workflows (software-rd)
144
+ never show it - purely data-driven, no per-profile branches.
145
+ Click posts /api/v1/workflows/{id}/start. -->
146
+ <div id="workflow-launcher" class="task-filters workflow-launcher" role="group" hidden></div>
129
147
  <div id="tasks-board" class="tasks-board">
130
148
  <div class="empty-state" data-i18n="empty.noTasks">No tasks yet</div>
131
149
  </div>
@@ -143,11 +161,11 @@
143
161
  <button id="workspace-tree-refresh" class="btn btn-small" type="button" data-i18n="action.refresh">Refresh</button>
144
162
  </div>
145
163
  <div class="workspace-current-path">
146
- <span class="workspace-current-path-label">Location</span>
164
+ <span class="workspace-current-path-label" data-i18n="workspace.location">Location</span>
147
165
  <code id="workspace-current-path-value">...</code>
148
166
  </div>
149
167
  <div id="workspace-tree" class="workspace-tree">
150
- <div class="empty-state">Workspace tree loading...</div>
168
+ <div class="empty-state" data-i18n="empty.workspaceLoading">Workspace tree loading…</div>
151
169
  </div>
152
170
  </aside>
153
171
 
@@ -200,6 +218,11 @@
200
218
  <!-- TeamAuto Tab -->
201
219
  <div id="tab-teamauto" class="tab-panel">
202
220
  <div class="teamauto-wrap">
221
+ <div class="ta-subtabs" role="tablist">
222
+ <button type="button" class="ta-subtab active" data-ta-pane="config" data-i18n="teamauto.tabConfig">Config</button>
223
+ <button type="button" class="ta-subtab" data-ta-pane="activity" data-i18n="teamauto.activity">Activity</button>
224
+ </div>
225
+ <div class="ta-pane" data-ta-pane-body="config">
203
226
  <div class="teamauto-bind card">
204
227
  <div class="teamauto-bind-row">
205
228
  <select id="teamauto-repo-select" class="teamauto-select"></select>
@@ -224,8 +247,11 @@
224
247
  <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>
225
248
  </div>
226
249
  <div id="teamauto-repos" class="teamauto-repos"></div>
250
+ </div>
251
+ <div class="ta-pane is-hidden" data-ta-pane-body="activity">
227
252
  <h3 class="teamauto-section-title" data-i18n="teamauto.activity">Activity</h3>
228
253
  <div id="teamauto-activity" class="teamauto-activity"></div>
254
+ </div>
229
255
  </div>
230
256
  </div>
231
257
 
@@ -258,19 +284,11 @@
258
284
  </div>
259
285
  <div class="form-group">
260
286
  <label for="task-role" data-i18n="manualTask.assignedRole">Assigned Role</label>
287
+ <!-- Role options are rendered by app.js from GET /api/v1/roles
288
+ (renderTaskRoleOptions) so profile-driven role sets need no
289
+ HTML change. Only the Auto-assign placeholder lives here. -->
261
290
  <select id="task-role">
262
291
  <option value="" data-i18n="manualTask.autoAssign">Auto-assign</option>
263
- <option value="pm">Product Manager</option>
264
- <option value="architect">Software Architect</option>
265
- <option value="developer">Developer</option>
266
- <option value="qa">QA Engineer</option>
267
- <option value="release-engineer">Release Engineer</option>
268
- <option value="infra-engineer">Infra Engineer</option>
269
- <option value="devops">DevOps Engineer</option>
270
- <option value="security-engineer">Security Engineer</option>
271
- <option value="designer">UI/UX Designer</option>
272
- <option value="marketing">Marketing Specialist</option>
273
- <option value="data-engineer">Data Engineer</option>
274
292
  </select>
275
293
  </div>
276
294
  </div>
@@ -285,22 +303,22 @@
285
303
  <div class="workspace-prompt-backdrop" data-workspace-prompt-close></div>
286
304
  <section class="workspace-prompt-panel" role="dialog" aria-modal="true" aria-labelledby="workspace-prompt-title">
287
305
  <header class="workspace-prompt-header">
288
- <div class="workspace-prompt-kicker">Workspace setup</div>
289
- <h2 id="workspace-prompt-title">Choose a workspace directory</h2>
306
+ <div class="workspace-prompt-kicker" data-i18n="ws.kicker">Workspace setup</div>
307
+ <h2 id="workspace-prompt-title" data-i18n="ctl.ws.title">Choose a workspace directory</h2>
290
308
  </header>
291
309
  <div class="workspace-prompt-body">
292
- <p class="workspace-prompt-current">Current workspace (default):</p>
310
+ <p class="workspace-prompt-current" data-i18n="ctl.ws.current">Current workspace (default):</p>
293
311
  <p><code id="workspace-prompt-path"></code></p>
294
- <p class="workspace-prompt-hint">TeamClaw is using the default workspace location. You can move it anywhere on this machine (for example a project parent directory) before creating tasks.</p>
312
+ <p class="workspace-prompt-hint" data-i18n="ctl.ws.hint">TeamClaw is using the default workspace location. You can move it anywhere on this machine (for example a project parent directory) before creating tasks.</p>
295
313
  <div class="workspace-prompt-controls">
296
314
  <input id="workspace-prompt-input" class="workspace-prompt-input" type="text" placeholder="/absolute/path/to/teamclaw_workspace" spellcheck="false" />
297
315
  <div class="workspace-prompt-actions">
298
- <button id="workspace-prompt-browse" class="btn" type="button">Browse...</button>
299
- <button id="workspace-prompt-apply" class="btn btn-primary" type="button">Apply</button>
300
- <button id="workspace-prompt-dismiss" class="btn btn-small" type="button" data-workspace-prompt-close>Keep default</button>
316
+ <button id="workspace-prompt-browse" class="btn" type="button" data-i18n="ws.browse">Browse...</button>
317
+ <button id="workspace-prompt-apply" class="btn btn-primary" type="button" data-i18n="ctl.ws.apply">Apply</button>
318
+ <button id="workspace-prompt-dismiss" class="btn btn-small" type="button" data-workspace-prompt-close data-i18n="ws.keepDefault">Keep default</button>
301
319
  </div>
302
320
  </div>
303
- <p class="workspace-prompt-note">Applies after a gateway restart. Existing files are not moved automatically.</p>
321
+ <p class="workspace-prompt-note" data-i18n="ws.restartNote">Applies after a gateway restart. Existing files are not moved automatically.</p>
304
322
  </div>
305
323
  </section>
306
324
  </div>
@@ -309,19 +327,100 @@
309
327
  <div class="workspace-prompt-backdrop" data-model-settings-close></div>
310
328
  <section class="workspace-prompt-panel" role="dialog" aria-modal="true" aria-labelledby="model-settings-title">
311
329
  <header class="workspace-prompt-header">
312
- <div class="workspace-prompt-kicker">Model settings</div>
313
- <h2 id="model-settings-title">Team models</h2>
330
+ <div class="workspace-prompt-kicker" data-i18n="models.kicker">Model settings</div>
331
+ <h2 id="model-settings-title" data-i18n="ctl.models.title">Team models</h2>
314
332
  </header>
315
333
  <div class="workspace-prompt-body">
316
334
  <label class="model-settings-field">
317
- <span class="model-settings-label">Default model (controller &amp; all roles)</span>
335
+ <span class="model-settings-label" data-i18n="ctl.models.default">Default model (controller &amp; all roles)</span>
318
336
  <select id="model-settings-default"></select>
319
337
  </label>
320
338
  <div id="model-settings-roles" class="model-settings-roles"></div>
321
- <p class="workspace-prompt-note">Changes hot-reload when possible; restart the gateway (openclaw gateway restart) if a selection does not take effect. Per-role selections override the default for that role.</p>
339
+ <p class="workspace-prompt-note" data-i18n="ctl.models.hint">Changes hot-reload when possible; restart the gateway (openclaw gateway restart) if a selection does not take effect. Per-role selections override the default for that role.</p>
340
+ <div class="workspace-prompt-actions">
341
+ <button id="model-settings-save" class="btn btn-primary" type="button" data-i18n="ctl.models.save">Save</button>
342
+ <button id="model-settings-close" class="btn btn-small" type="button" data-model-settings-close data-i18n="action.cancel">Cancel</button>
343
+ </div>
344
+ </div>
345
+ </section>
346
+ </div>
347
+
348
+ <!-- Team profile switcher modal (Phase 5.1): step 1 lists
349
+ GET /api/v1/profiles cards, step 2 confirms the archive consequences
350
+ before POST /api/v1/team/profile; the archived-teams section lists
351
+ GET /api/v1/archived-teams metadata (read-only). -->
352
+ <div id="team-profile-modal" class="workspace-prompt-modal" aria-hidden="true">
353
+ <div class="workspace-prompt-backdrop" data-team-profile-close></div>
354
+ <section class="workspace-prompt-panel team-profile-panel" role="dialog" aria-modal="true" aria-labelledby="team-profile-title">
355
+ <header class="workspace-prompt-header">
356
+ <div class="workspace-prompt-kicker" data-i18n="teamProfile.kicker">Team profile</div>
357
+ <h2 id="team-profile-title" data-i18n="teamProfile.title">Switch team profile</h2>
358
+ </header>
359
+ <div class="workspace-prompt-body">
360
+ <div id="team-profile-transition" class="team-profile-transition" hidden></div>
361
+ <div id="team-profile-list" class="team-profile-list"></div>
362
+ <div id="team-profile-confirm" class="team-profile-confirm" hidden>
363
+ <div id="team-profile-confirm-body" class="team-profile-confirm-body"></div>
364
+ <div class="workspace-prompt-actions">
365
+ <button id="team-profile-confirm-btn" class="btn btn-primary" type="button" data-i18n="teamProfile.confirmButton">Switch team</button>
366
+ <button id="team-profile-confirm-back" class="btn btn-small" type="button" data-i18n="teamProfile.cancel">Back</button>
367
+ </div>
368
+ </div>
369
+ <p id="team-profile-switch-status" class="team-profile-switch-status" hidden></p>
370
+ <!-- Role display (Phase 4 lightweight customization): per-browser
371
+ visibility + rename layer over GET /roles - localStorage only,
372
+ the profile JSON and the API stay untouched (full editing is
373
+ v2). Rows render in app.js from the /roles registry mirror. -->
374
+ <section class="team-profile-archived" id="role-display-section">
375
+ <h3 data-i18n="roleDisplay.title">Role display</h3>
376
+ <p class="workspace-prompt-note" data-i18n="roleDisplay.hint">Hide roles this team does not use, or rename them for your team. Saved in this browser only (display layer) - the team profile itself is not modified.</p>
377
+ <div id="role-display-list" class="team-profile-archives"></div>
378
+ <div class="workspace-prompt-actions">
379
+ <button id="role-display-save" class="btn btn-primary" type="button" data-i18n="roleDisplay.save">Save</button>
380
+ <button id="role-display-reset" class="btn btn-small" type="button" data-i18n="roleDisplay.reset">Reset to defaults</button>
381
+ </div>
382
+ </section>
383
+ <section class="team-profile-archived">
384
+ <h3 data-i18n="teamProfile.archivedTitle">Archived teams</h3>
385
+ <div id="team-profile-archives" class="team-profile-archives"></div>
386
+ </section>
387
+ <!-- Device-pairing security section (issue #23): status line always
388
+ reflects /team/status.security; the device list / revoke / reset
389
+ controls fetch GET /api/v1/security (paired browsers only). -->
390
+ <section class="team-profile-archived" id="security-devices-section">
391
+ <h3 data-i18n="security.devicesTitle">Device security</h3>
392
+ <div id="security-devices-status" style="font-size:12.5px;margin-bottom:8px"></div>
393
+ <div id="security-devices-list" class="team-profile-archives"></div>
394
+ <div id="security-devices-actions" class="workspace-prompt-actions"></div>
395
+ </section>
396
+ </div>
397
+ </section>
398
+ </div>
399
+
400
+ <!-- Device pairing modal (issue #23): opened right after POST
401
+ /api/v1/security/enable succeeds, or when the devices section issues a
402
+ new code. Shows the one-shot 60s pairing code, the countdown, and the
403
+ copyable CLI command for the next device. Closing needs no further
404
+ action: this browser was paired by the enable response's session
405
+ cookie, so it never logs in. -->
406
+ <div id="security-pair-modal" class="workspace-prompt-modal" aria-hidden="true">
407
+ <div class="workspace-prompt-backdrop" data-security-pair-close></div>
408
+ <section class="workspace-prompt-panel" role="dialog" aria-modal="true" aria-labelledby="security-pair-title" style="max-width:560px">
409
+ <header class="workspace-prompt-header">
410
+ <div>
411
+ <div class="workspace-prompt-kicker" data-i18n="security.devicesTitle">Device security</div>
412
+ <h2 id="security-pair-title" data-i18n="security.pairTitle">Pair your devices</h2>
413
+ </div>
414
+ <button id="security-pair-close" class="btn btn-small" type="button" data-security-pair-close data-i18n="action.close">Close</button>
415
+ </header>
416
+ <div class="workspace-prompt-body">
417
+ <p data-i18n="security.pairHint">This browser is paired automatically. To pair another device (worker, desktop or CLI), run this command within 60 seconds:</p>
418
+ <div id="security-pair-code" style="font-family:ui-monospace,Menlo,Consolas,monospace;font-size:32px;letter-spacing:6px;font-weight:700;text-align:center;margin:10px 0 4px"></div>
419
+ <div id="security-pair-countdown" style="text-align:center;font-size:12.5px;opacity:.75;margin-bottom:10px"></div>
420
+ <pre id="security-pair-command" class="worker-install-command" style="margin:0 0 12px"><code></code></pre>
322
421
  <div class="workspace-prompt-actions">
323
- <button id="model-settings-save" class="btn btn-primary" type="button">Save</button>
324
- <button id="model-settings-close" class="btn btn-small" type="button" data-model-settings-close>Cancel</button>
422
+ <button id="security-pair-copy" class="btn" type="button" data-i18n="action.copyCommand">Copy command</button>
423
+ <button id="security-pair-new" class="btn" type="button" data-i18n="security.pairNewCode">New pairing code</button>
325
424
  </div>
326
425
  </div>
327
426
  </section>
@@ -362,19 +461,19 @@
362
461
 
363
462
  <div class="task-detail-tabs">
364
463
  <button class="task-detail-tab active" type="button" data-task-detail-tab="details">
365
- <span>Task details</span>
464
+ <span data-i18n="task.details">Task details</span>
366
465
  <span class="task-detail-tab-count" data-task-detail-tab-count="details"></span>
367
466
  </button>
368
467
  <button class="task-detail-tab" type="button" data-task-detail-tab="timeline">
369
- <span>Timeline</span>
468
+ <span data-i18n="task.timeline">Timeline</span>
370
469
  <span class="task-detail-tab-count" data-task-detail-tab-count="timeline"></span>
371
470
  </button>
372
471
  <button class="task-detail-tab" type="button" data-task-detail-tab="clarifications">
373
- <span>Clarifications</span>
472
+ <span data-i18n="tab.clarifications">Clarifications</span>
374
473
  <span class="task-detail-tab-count" data-task-detail-tab-count="clarifications"></span>
375
474
  </button>
376
475
  <button class="task-detail-tab" type="button" data-task-detail-tab="messages">
377
- <span>Messages</span>
476
+ <span data-i18n="task.messages">Messages</span>
378
477
  <span class="task-detail-tab-count" data-task-detail-tab-count="messages"></span>
379
478
  </button>
380
479
  </div>
@@ -390,8 +489,8 @@
390
489
 
391
490
  <footer class="footer">
392
491
  <div class="command-bar">
393
- <input type="text" id="command-input" placeholder="Send a controller message or slash command... (e.g., 继续工作, /status, /assign task-id developer)" autocomplete="off">
394
- <button id="command-send" class="btn btn-small">Send to Controller</button>
492
+ <input type="text" id="command-input" placeholder="Send a controller message or slash command... (e.g., 继续工作, /status, /assign task-id developer)" data-i18n-placeholder="command.placeholder" autocomplete="off">
493
+ <button id="command-send" class="btn btn-small" data-i18n="command.send">Send to Controller</button>
395
494
  </div>
396
495
  </footer>
397
496
 
@@ -400,12 +499,12 @@
400
499
  active). -->
401
500
  <div id="tunnel-popover" class="tunnel-popover" hidden>
402
501
  <div class="tunnel-popover-backdrop" data-act="close"></div>
403
- <div class="tunnel-popover-card" role="dialog" aria-modal="true" aria-label="Internet tunnel settings">
502
+ <div class="tunnel-popover-card" role="dialog" aria-modal="true" data-i18n-aria="ctl.tunnel.title">
404
503
  <div class="tunnel-popover-head">
405
- <h3>Internet Tunnel</h3>
406
- <button class="tunnel-popover-close" data-act="close" type="button" aria-label="Close">×</button>
504
+ <h3 data-i18n="ctl.tunnel.title">Internet Tunnel</h3>
505
+ <button class="tunnel-popover-close" data-act="close" type="button" aria-label="Close" data-i18n-aria="action.close">×</button>
407
506
  </div>
408
- <div class="tunnel-state"><span class="tunnel-note">loading…</span></div>
507
+ <div class="tunnel-state"><span class="tunnel-note" data-i18n="ctl.tunnel.loading">loading…</span></div>
409
508
  </div>
410
509
  </div>
411
510
 
package/src/ui/style.css CHANGED
@@ -652,6 +652,28 @@ body {
652
652
  color: var(--text-secondary);
653
653
  }
654
654
 
655
+ /* TeamAuto sub-tabs (Config / Activity) */
656
+ .ta-subtabs {
657
+ display: flex;
658
+ gap: 8px;
659
+ margin-bottom: 12px;
660
+ }
661
+ .ta-subtab {
662
+ border: 1px solid var(--border-color, rgba(255,255,255,0.15));
663
+ background: transparent;
664
+ color: var(--text-secondary);
665
+ border-radius: 8px;
666
+ padding: 4px 14px;
667
+ font-size: 12px;
668
+ cursor: pointer;
669
+ }
670
+ .ta-subtab.active {
671
+ background: var(--accent-soft, rgba(226,183,111,0.15));
672
+ color: var(--accent, #e2b76f);
673
+ border-color: var(--accent, #e2b76f);
674
+ }
675
+ .ta-pane.is-hidden { display: none; }
676
+
655
677
  .clarification-reason,
656
678
  .clarification-context,
657
679
  .clarification-answer {
@@ -660,6 +682,46 @@ body {
660
682
  line-height: 1.5;
661
683
  }
662
684
 
685
+ /* Markdown-rendered clarification context (worker-authored) */
686
+ .clarification-context-md h1,
687
+ .clarification-context-md h2,
688
+ .clarification-context-md h3,
689
+ .clarification-context-md h4 {
690
+ font-size: 13px;
691
+ font-weight: 600;
692
+ margin: 10px 0 4px;
693
+ color: var(--text-primary);
694
+ }
695
+ .clarification-context-md p { margin: 6px 0; }
696
+ .clarification-context-md ul,
697
+ .clarification-context-md ol { margin: 6px 0; padding-left: 18px; }
698
+ .clarification-context-md li { margin: 2px 0; }
699
+ .clarification-context-md code {
700
+ font-family: var(--font-mono, ui-monospace, monospace);
701
+ font-size: 12px;
702
+ background: var(--bg-tertiary, rgba(255,255,255,0.06));
703
+ padding: 1px 4px;
704
+ border-radius: 4px;
705
+ }
706
+ .clarification-context-md pre {
707
+ margin: 8px 0;
708
+ padding: 8px 10px;
709
+ overflow-x: auto;
710
+ background: var(--bg-tertiary, rgba(255,255,255,0.06));
711
+ border-radius: 6px;
712
+ }
713
+ .clarification-context-md pre code { background: none; padding: 0; }
714
+ .clarification-context-md blockquote {
715
+ margin: 6px 0;
716
+ padding: 2px 10px;
717
+ border-left: 3px solid var(--border-color, rgba(255,255,255,0.15));
718
+ color: var(--text-secondary);
719
+ }
720
+ .clarification-context-md table { border-collapse: collapse; margin: 8px 0; font-size: 12px; }
721
+ .clarification-context-md th,
722
+ .clarification-context-md td { border: 1px solid var(--border-color, rgba(255,255,255,0.15)); padding: 4px 8px; }
723
+ .clarification-context-md a { color: var(--accent, #e2b76f); }
724
+
663
725
  .clarification-answer-meta {
664
726
  color: var(--text-secondary);
665
727
  font-size: 12px;
@@ -2609,3 +2671,135 @@ body {
2609
2671
  .tunnel-popover-card .tunnel-on { word-break: break-all; }
2610
2672
  .tunnel-note { margin-left: 10px; color: var(--text-muted); font-size: 12px; }
2611
2673
  .tunnel-err { color: var(--danger); font-size: 12.5px; margin-top: 8px; }
2674
+
2675
+ /* ==================== Team profile switcher (Phase 5.1) ==================== */
2676
+ /* Capability gate (GET /team/profile capabilities.teamauto): the tab node is
2677
+ hidden, not removed, so the DOM keeps the full 7-tab contract. `.tab`
2678
+ sets display:inline-flex which would beat the UA [hidden] rule, so the
2679
+ hidden state needs an explicit rule. */
2680
+ .tab[hidden] { display: none; }
2681
+
2682
+ .team-profile-toggle {
2683
+ max-width: 220px;
2684
+ overflow: hidden;
2685
+ text-overflow: ellipsis;
2686
+ white-space: nowrap;
2687
+ }
2688
+
2689
+ .team-profile-panel { max-width: 640px; }
2690
+
2691
+ .team-profile-transition {
2692
+ margin: 0 0 10px;
2693
+ padding: 8px 12px;
2694
+ border-radius: 8px;
2695
+ font-size: 12.5px;
2696
+ background: rgba(230, 162, 60, 0.12);
2697
+ border: 1px solid rgba(230, 162, 60, 0.4);
2698
+ color: var(--warning, #e6a23c);
2699
+ }
2700
+
2701
+ .team-profile-list {
2702
+ display: flex;
2703
+ flex-direction: column;
2704
+ gap: 10px;
2705
+ margin: 6px 0 4px;
2706
+ }
2707
+
2708
+ .team-profile-card {
2709
+ display: flex;
2710
+ align-items: flex-start;
2711
+ gap: 12px;
2712
+ width: 100%;
2713
+ box-sizing: border-box;
2714
+ text-align: left;
2715
+ padding: 12px 14px;
2716
+ border-radius: 10px;
2717
+ border: 1px solid var(--border);
2718
+ background: var(--bg-tertiary);
2719
+ color: var(--text-primary);
2720
+ cursor: pointer;
2721
+ }
2722
+ .team-profile-card:hover { border-color: var(--accent); }
2723
+ .team-profile-card.active {
2724
+ border-color: var(--accent);
2725
+ background: rgba(217, 166, 100, 0.08);
2726
+ cursor: default;
2727
+ }
2728
+ .team-profile-card.is-locked { opacity: 0.6; }
2729
+
2730
+ .team-profile-card-icon { font-size: 20px; line-height: 1.3; }
2731
+ .team-profile-card-main {
2732
+ flex: 1;
2733
+ min-width: 0;
2734
+ display: flex;
2735
+ flex-direction: column;
2736
+ gap: 3px;
2737
+ }
2738
+ .team-profile-card-name { font-weight: 600; font-size: 13.5px; }
2739
+ .team-profile-card-name-alt { font-weight: 400; opacity: 0.65; font-size: 12.5px; }
2740
+ .team-profile-card-desc { font-size: 12.5px; opacity: 0.75; line-height: 1.45; }
2741
+ .team-profile-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
2742
+
2743
+ .team-profile-chip {
2744
+ display: inline-block;
2745
+ padding: 1px 8px;
2746
+ border-radius: 999px;
2747
+ font-size: 11px;
2748
+ border: 1px solid var(--border);
2749
+ opacity: 0.85;
2750
+ }
2751
+ .team-profile-chip.pending {
2752
+ border-color: rgba(230, 162, 60, 0.5);
2753
+ background: rgba(230, 162, 60, 0.14);
2754
+ color: var(--warning, #e6a23c);
2755
+ opacity: 1;
2756
+ }
2757
+ .team-profile-card-current {
2758
+ flex-shrink: 0;
2759
+ padding: 2px 10px;
2760
+ border-radius: 999px;
2761
+ font-size: 11px;
2762
+ border: 1px solid var(--accent);
2763
+ color: var(--accent);
2764
+ }
2765
+
2766
+ .team-profile-confirm-body h3 { margin: 2px 0 10px; font-size: 15px; }
2767
+ .team-profile-confirm-warning {
2768
+ margin: 6px 0;
2769
+ padding: 8px 12px;
2770
+ border-radius: 8px;
2771
+ font-size: 12.5px;
2772
+ background: rgba(230, 90, 90, 0.1);
2773
+ border: 1px solid rgba(230, 90, 90, 0.35);
2774
+ color: var(--danger, #ff7b7b);
2775
+ }
2776
+
2777
+ .team-profile-switch-status {
2778
+ margin: 8px 0 0;
2779
+ font-size: 12.5px;
2780
+ opacity: 0.75;
2781
+ }
2782
+
2783
+ .team-profile-archived {
2784
+ margin-top: 16px;
2785
+ padding-top: 10px;
2786
+ border-top: 1px solid rgba(255, 255, 255, 0.08);
2787
+ }
2788
+ .team-profile-archived h3 { margin: 0 0 8px; font-size: 13px; opacity: 0.8; }
2789
+ .team-profile-archives {
2790
+ max-height: 180px;
2791
+ overflow-y: auto;
2792
+ display: flex;
2793
+ flex-direction: column;
2794
+ gap: 6px;
2795
+ }
2796
+ .team-profile-archive-row {
2797
+ display: flex;
2798
+ flex-wrap: wrap;
2799
+ gap: 10px;
2800
+ align-items: baseline;
2801
+ font-size: 12.5px;
2802
+ }
2803
+ .team-profile-archive-team { font-weight: 600; }
2804
+ .team-profile-archive-profile { opacity: 0.7; }
2805
+ .team-profile-archive-meta { margin-left: auto; opacity: 0.6; font-size: 12px; }
@@ -1,3 +1,4 @@
1
+ import { timingSafeEqual } from "node:crypto";
1
2
  import type { IncomingMessage, ServerResponse } from "node:http";
2
3
  import type { PluginLogger } from "../../api.js";
3
4
  import type { TaskAssignmentPayload, TeamMessage } from "../types.js";
@@ -10,8 +11,57 @@ export type TaskCanceller = (taskId: string) => Promise<boolean> | boolean;
10
11
  export type TaskCancelChecker = (taskId: string) => boolean;
11
12
  export type KickoffAssessor = (requirement: string, role: string) => Promise<Record<string, unknown>>;
12
13
 
14
+ // ---------------------------------------------------------------------------
15
+ // Inbound API auth (issue #222, coordinated scope after #23/#227).
16
+ //
17
+ // The controller's device gate (#23) protects controller->world traffic; the
18
+ // REVERSE direction (controller dispatching tasks/messages INTO this worker)
19
+ // had no check at all, so any pod/host that can reach the worker port could
20
+ // submit tasks and poison results (review finding C2). Token model, chosen
21
+ // for minimal invasion with no NEW pairing surface:
22
+ //
23
+ // expected tokens = { config.securityToken, env TEAMCLAW_LAUNCH_TOKEN }
24
+ //
25
+ // - Provisioned workers: the provisioner already generates a per-worker
26
+ // launch token, delivers it via the TEAMCLAW_LAUNCH_TOKEN env, and the
27
+ // controller keeps it in the provisioning record - reuse it (it is
28
+ // already decoupled from the #23 device registry, so option (a)'s shape
29
+ // without a second token).
30
+ // - Manual/external workers: the operator syncs `securityToken` to the
31
+ // same value on the controller and the worker (documentation stance for
32
+ // self-managed fleets); provisioning-record tokens take precedence on
33
+ // the controller side.
34
+ // - BOTH are accepted (either match passes): pairing a provisioned worker
35
+ // later (`teamclaw pair` overwrites config.securityToken) must never
36
+ // lock the controller out of its own dispatch path.
37
+ // - Neither set => L0: zero checks, byte-identical historical behavior.
38
+ //
39
+ // /api/v1/health stays exempt: kubelet/docker probes (helm charts probe
40
+ // this path) cannot attach headers, mirroring the controller gate's health
41
+ // exemption. Comparison is constant-time on the raw token (a single shared
42
+ // secret per direction; hashing buys nothing here).
43
+ // ---------------------------------------------------------------------------
44
+
45
+ /** Constant-time string equality; length mismatch short-circuits (leaks only length, never content). */
46
+ function constantTimeEqual(a: string, b: string): boolean {
47
+ const left = Buffer.from(a, "utf8");
48
+ const right = Buffer.from(b, "utf8");
49
+ return left.length === right.length && timingSafeEqual(left, right);
50
+ }
51
+
52
+ /**
53
+ * The non-empty token values this worker accepts on inbound /api requests
54
+ * (config.securityToken and/or the provisioner's TEAMCLAW_LAUNCH_TOKEN).
55
+ * Empty result = L0 (no inbound auth).
56
+ */
57
+ export function resolveWorkerInboundTokens(config: { securityToken?: string }): string[] {
58
+ const configured = config.securityToken?.trim();
59
+ const launch = process.env.TEAMCLAW_LAUNCH_TOKEN?.trim();
60
+ return [configured, launch].filter((token): token is string => Boolean(token));
61
+ }
62
+
13
63
  export function createWorkerHttpHandler(
14
- config: { role: string; port: number },
64
+ config: { role: string; port: number; securityToken?: string },
15
65
  logger: PluginLogger,
16
66
  messageQueue: MessageQueue,
17
67
  workerId: string,
@@ -21,6 +71,7 @@ export function createWorkerHttpHandler(
21
71
  isTaskCancelled?: TaskCancelChecker,
22
72
  kickoffAssessor?: KickoffAssessor,
23
73
  ) {
74
+ const inboundTokens = resolveWorkerInboundTokens(config);
24
75
  return async (req: IncomingMessage, res: ServerResponse) => {
25
76
  // CORS preflight
26
77
  if (req.method === "OPTIONS") {
@@ -36,6 +87,18 @@ export function createWorkerHttpHandler(
36
87
  const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
37
88
  const pathname = url.pathname;
38
89
 
90
+ // Inbound device gate (issue #222): every /api route except the health
91
+ // probe requires X-TeamClaw-Token while this worker holds an expected
92
+ // token. No expected token configured => proceed (L0, zero change).
93
+ if (inboundTokens.length > 0 && pathname.startsWith("/api/") && pathname !== "/api/v1/health") {
94
+ const presented = typeof req.headers["x-teamclaw-token"] === "string" ? req.headers["x-teamclaw-token"].trim() : "";
95
+ if (!presented || !inboundTokens.some((expected) => constantTimeEqual(expected, presented))) {
96
+ logger.warn(`Worker: rejected unauthenticated ${req.method ?? "?"} ${pathname} from ${req.socket.remoteAddress ?? "unknown"}`);
97
+ sendError(res, 401, "unauthorized: this worker requires the X-TeamClaw-Token header (the controller's dispatch token for this worker, or the value synced into securityToken)");
98
+ return;
99
+ }
100
+ }
101
+
39
102
  try {
40
103
  // GET /api/v1/health
41
104
  if (req.method === "GET" && pathname === "/api/v1/health") {