@teamclaws/teamclaw 2026.11.1 → 2026.11.2

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.
@@ -409,7 +409,7 @@ export function createTeamAutoScheduler(deps: TeamAutoSchedulerDeps) {
409
409
  }
410
410
  sweeping.add(repo.id);
411
411
  try {
412
- const { candidates, issues, pulls } = await sweepRepo(repo, client);
412
+ const { candidates, issues, pulls, newCommits, commits } = await sweepRepo(repo, client);
413
413
  const dryRun = !repo.dryRunDone && s.budget.firstSweepDryRun;
414
414
  if (dryRun) {
415
415
  // One observing pass, then act. Flip unconditionally - flipping only
@@ -422,7 +422,7 @@ export function createTeamAutoScheduler(deps: TeamAutoSchedulerDeps) {
422
422
  // Advance only for acting sweeps: a dry-run must leave the cursors
423
423
  // untouched so the reported actions are actually performed next time
424
424
  // instead of being marked as already-seen.
425
- advanceCursors(repo, issues, pulls);
425
+ advanceCursors(repo, issues, pulls, Date.now(), commits);
426
426
  }
427
427
  // Joint full reviews bypass the per-sweep cap: they append AFTER issue/
428
428
  // pull candidates, so a busy repo would otherwise starve them forever
@@ -433,6 +433,11 @@ export function createTeamAutoScheduler(deps: TeamAutoSchedulerDeps) {
433
433
  const capped = [...fullReviews, ...regular];
434
434
  let created = 0;
435
435
  const summary: string[] = [`found ${candidates.length} candidate(s)`];
436
+ // #265: surface the commits delta so the third signal source is
437
+ // observable in sweep summaries (was silently dead before).
438
+ if (newCommits.length > 0) {
439
+ summary.push(`${newCommits.length} new commit(s) (HEAD ${newCommits[0].sha.slice(0, 7)})`);
440
+ }
436
441
 
437
442
  if (capped.length && dryRun) {
438
443
  summary.push(...capped.map((c) => `DRY-RUN would ${c.kind}: ${c.title}`));
@@ -470,6 +475,7 @@ export function createTeamAutoScheduler(deps: TeamAutoSchedulerDeps) {
470
475
  recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "sweep", text: "sweep recovered, auto-pause cleared" });
471
476
  }
472
477
  repo.sweepFailures = 0;
478
+ repo.lastAttemptAt = Date.now(); // #266: success is also an attempt
473
479
  recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "sweep", text: repo.lastSweepSummary ?? "sweep complete" });
474
480
  await saveTeamAutoStore(s);
475
481
  if (created > 0) {
@@ -487,6 +493,7 @@ export function createTeamAutoScheduler(deps: TeamAutoSchedulerDeps) {
487
493
  // backoff below, and a success clears the state in the block above.
488
494
  repo.sweepFailures = (repo.sweepFailures ?? 0) + 1;
489
495
  repo.lastSweepErrorAt = Date.now();
496
+ repo.lastAttemptAt = repo.lastSweepErrorAt; // #266: failures must be visible without inferring from lastSweepErrorAt
490
497
  repo.pausedReason = `sweep failed: ${message}`;
491
498
  recordActivity(s, { at: Date.now(), repoId: repo.id, kind: "sweep", text: `sweep failed (auto-retry in ~${sweepBackoffMinutes(repo.sweepFailures)}min): ${message}` });
492
499
  await saveTeamAutoStore(s).catch(() => {});
@@ -70,6 +70,11 @@ export type TeamAutoRepo = {
70
70
  sweepFailures?: number;
71
71
  /** Epoch ms of the last auto-pausing sweep failure. */
72
72
  lastSweepErrorAt?: number;
73
+ /** Epoch ms of the last sweep ATTEMPT (success or failure), #266:
74
+ * lastSweepAt/lastSweepSummary stay success-scoped while lastAttemptAt
75
+ * answers "did the scheduler try recently" without the two surfaces
76
+ * contradicting each other when read side by side. */
77
+ lastAttemptAt?: number;
73
78
  dryRunDone: boolean;
74
79
  /** Bind-time provisioning state; ready/undefined means sweepable. */
75
80
  provision?: TeamAutoRepoProvision;
package/src/ui/app.js CHANGED
@@ -76,6 +76,15 @@
76
76
  "tab.planning": "Planning",
77
77
  "tab.tasks": "Tasks",
78
78
  "tab.workspace": "Workspace",
79
+ "common.showOlder": "Show older ({n})",
80
+ "tab.settings": "Settings",
81
+ "settings.models.title": "Model settings",
82
+ "settings.models.hint": "Default model and per-role overrides.",
83
+ "settings.workers.title": "Worker scaling (hot)",
84
+ "settings.workers.hint": "Applies immediately without restarting the gateway. Lowering a cap never kills busy workers.",
85
+ "settings.workers.max": "Max workers / role",
86
+ "settings.workers.min": "Min warm / role",
87
+ "settings.workers.ttl": "Idle TTL (ms)",
79
88
  "tab.teamauto": "TeamAuto",
80
89
  "tab.clarifications": "Clarifications",
81
90
  "tab.messages": "Messages",
@@ -362,6 +371,15 @@
362
371
  "tab.planning": "规划",
363
372
  "tab.tasks": "任务",
364
373
  "tab.workspace": "工作区",
374
+ "common.showOlder": "显示更早({n})",
375
+ "tab.settings": "设置",
376
+ "settings.models.title": "模型设置",
377
+ "settings.models.hint": "默认模型与按角色覆盖。",
378
+ "settings.workers.title": "Worker 弹性伸缩(热)",
379
+ "settings.workers.hint": "立即生效无需重启 gateway。下调上限不会终止忙碌 worker。",
380
+ "settings.workers.max": "每角色最大 worker",
381
+ "settings.workers.min": "每角色保活下限",
382
+ "settings.workers.ttl": "空闲回收 TTL(毫秒)",
365
383
  "tab.teamauto": "TeamAuto",
366
384
  "tab.clarifications": "澄清",
367
385
  "tab.messages": "消息",
@@ -1417,12 +1435,16 @@
1417
1435
  var selectedPlanningRunId = null;
1418
1436
 
1419
1437
  function renderPlanningTab(runs) {
1438
+ lastRenderedData.planning = runs || [];
1420
1439
  var sessionList = $("#planning-session-list");
1421
1440
  if (!sessionList) return;
1422
1441
 
1423
1442
  var planningRuns = (runs || [])
1424
1443
  .filter(function (r) { return r && r.manifest; })
1425
1444
  .sort(function (a, b) { return (b.updatedAt || 0) - (a.updatedAt || 0); });
1445
+ var planningWindow = splitByRecency(planningRuns, function (r) { return r.updatedAt || r.createdAt; }, "planning");
1446
+ planningRuns = planningWindow.shown;
1447
+ var planningOlderHtml = olderToggleHtml(planningWindow.olderCount, "planning");
1426
1448
 
1427
1449
  if (planningRuns.length === 0) {
1428
1450
  sessionList.innerHTML = '<div class="empty-state">' + escapeHtml(t("empty.noPlanningSessions")) + "</div>";
@@ -1452,7 +1474,7 @@
1452
1474
  ' <div class="planning-session-meta">' + escapeHtml(humanizeStatus(status)) + " · " + roles + " roles" + (assessments.length ? " · " + needed + " confirmed" : "") + " · " + escapeHtml(formatTime(run.updatedAt) || "") + "</div>" +
1453
1475
  "</button>"
1454
1476
  );
1455
- }).join("");
1477
+ }).join("") + planningOlderHtml;
1456
1478
 
1457
1479
  // Render selected run
1458
1480
  renderPlanningDetail(planningRuns.find(function (r) { return r.id === selectedPlanningRunId; }));
@@ -3078,7 +3100,38 @@
3078
3100
  return haystack.includes(keyword);
3079
3101
  }
3080
3102
 
3103
+ // ---- 24h recency window + lazy "show older" (#recent-window) ----
3104
+ // Planning / Tasks / Clarifications / Messages only list items from the
3105
+ // last 24h by default; older items appear after an explicit click.
3106
+ const TWENTY_FOUR_H_MS = 24 * 60 * 60 * 1000;
3107
+ const showOlderSections = { tasks: false, planning: false, clarifications: false, messages: false };
3108
+ const lastRenderedData = { tasks: [], planning: [], clarifications: [], messages: [] };
3109
+ function splitByRecency(items, tsOf, section) {
3110
+ const cutoff = Date.now() - TWENTY_FOUR_H_MS;
3111
+ const recent = [];
3112
+ const older = [];
3113
+ for (const item of items || []) {
3114
+ ((tsOf(item) || 0) >= cutoff ? recent : older).push(item);
3115
+ }
3116
+ return showOlderSections[section] ? { shown: recent.concat(older), olderCount: 0 } : { shown: recent, olderCount: older.length };
3117
+ }
3118
+ function olderToggleHtml(count, section) {
3119
+ if (!count) return "";
3120
+ return '<div style="text-align:center;padding:8px"><button type="button" class="btn btn-small" data-show-older="' + section + '">' +
3121
+ escapeHtml(t("common.showOlder", { n: count })) + "</button></div>";
3122
+ }
3123
+ document.addEventListener("click", function (event) {
3124
+ const btn = event.target instanceof Element && event.target.closest("[data-show-older]");
3125
+ if (!btn || btn.tagName !== "BUTTON") return;
3126
+ showOlderSections[btn.getAttribute("data-show-older")] = true;
3127
+ renderTasks(lastRenderedData.tasks);
3128
+ renderPlanningTab(lastRenderedData.planning);
3129
+ renderClarifications(lastRenderedData.clarifications);
3130
+ renderMessages(lastRenderedData.messages);
3131
+ });
3132
+
3081
3133
  function renderTasks(tasks) {
3134
+ lastRenderedData.tasks = tasks || [];
3082
3135
  const container = $("#tasks-board");
3083
3136
  if (!container) return;
3084
3137
 
@@ -3099,10 +3152,13 @@
3099
3152
  }
3100
3153
 
3101
3154
  const sorted = filtered.slice().sort(taskComparator);
3155
+ // #recent-window: 24h recency first, older tasks behind the lazy toggle
3156
+ // (applied before the terminal chunking, so both windows stay fast).
3157
+ const recency = splitByRecency(sorted, function (task) { return task.updatedAt || task.createdAt; }, "tasks");
3102
3158
  // Active tasks render in full; terminal ones chunk so long-lived installs
3103
3159
  // with hundreds of completed tasks stay fast and meaningful.
3104
- const activeTasks = sorted.filter(function (task) { return !TERMINAL_STATUSES[task.status]; });
3105
- const terminalTasks = sorted.filter(function (task) { return TERMINAL_STATUSES[task.status]; });
3160
+ const activeTasks = recency.shown.filter(function (task) { return !TERMINAL_STATUSES[task.status]; });
3161
+ const terminalTasks = recency.shown.filter(function (task) { return TERMINAL_STATUSES[task.status]; });
3106
3162
  const visibleTerminal = terminalTasks.slice(0, terminalTasksVisible);
3107
3163
  const hiddenTerminal = terminalTasks.length - visibleTerminal.length;
3108
3164
  const visibleList = activeTasks.concat(visibleTerminal);
@@ -3154,7 +3210,7 @@
3154
3210
  " </div>" +
3155
3211
  "</div>"
3156
3212
  );
3157
- }).join("") + showMoreHtml;
3213
+ }).join("") + showMoreHtml + olderToggleHtml(recency.olderCount, "tasks");
3158
3214
 
3159
3215
  const showMoreBtn = $("#tasks-show-more");
3160
3216
  if (showMoreBtn) {
@@ -3808,6 +3864,7 @@
3808
3864
  }
3809
3865
 
3810
3866
  function renderClarifications(clarifications) {
3867
+ lastRenderedData.clarifications = clarifications || [];
3811
3868
  const container = $("#clarifications-list");
3812
3869
  if (!container) return;
3813
3870
 
@@ -3816,14 +3873,21 @@
3816
3873
  return;
3817
3874
  }
3818
3875
 
3819
- container.innerHTML = renderClarificationCards(sortClarifications(clarifications), { linkToTask: true });
3876
+ const clWindow = splitByRecency(sortClarifications(clarifications), function (c) { return c.createdAt || c.updatedAt; }, "clarifications");
3877
+ if (clWindow.shown.length === 0) {
3878
+ container.innerHTML = olderToggleHtml(clWindow.olderCount, "clarifications");
3879
+ return;
3880
+ }
3881
+ container.innerHTML = renderClarificationCards(clWindow.shown, { linkToTask: true }) +
3882
+ olderToggleHtml(clWindow.olderCount, "clarifications");
3820
3883
  }
3821
3884
 
3822
3885
  function renderMessages(messages) {
3886
+ lastRenderedData.messages = messages || [];
3823
3887
  const container = $("#messages-feed");
3824
3888
  if (!container) return;
3825
3889
 
3826
- const recent = (messages || [])
3890
+ var recent = (messages || [])
3827
3891
  .concat(controllerConversation || [])
3828
3892
  .sort(function (left, right) {
3829
3893
  return (right.createdAt || 0) - (left.createdAt || 0);
@@ -3834,7 +3898,13 @@
3834
3898
  return;
3835
3899
  }
3836
3900
 
3837
- container.innerHTML = renderMessageCards(recent);
3901
+ const msgWindow = splitByRecency(recent, function (m) { return m.createdAt; }, "messages");
3902
+ if (msgWindow.shown.length === 0) {
3903
+ container.innerHTML = olderToggleHtml(msgWindow.olderCount, "messages");
3904
+ return;
3905
+ }
3906
+ container.innerHTML = renderMessageCards(msgWindow.shown) +
3907
+ olderToggleHtml(msgWindow.olderCount, "messages");
3838
3908
  }
3839
3909
 
3840
3910
  function renderRoles(roles) {
@@ -4058,6 +4128,9 @@
4058
4128
  if (activeTab === "workspace") {
4059
4129
  refreshWorkspaceTree(false);
4060
4130
  }
4131
+ if (activeTab === "settings") {
4132
+ renderWorkerSettingsPanel();
4133
+ }
4061
4134
  if (activeTab === "teamauto") {
4062
4135
  refreshTeamAutoTab();
4063
4136
  }
@@ -5050,10 +5123,13 @@
5050
5123
  opener.setAttribute("data-i18n", "ctl.tab.models");
5051
5124
  opener.textContent = t("ctl.tab.models");
5052
5125
  var refreshBtn = document.querySelector("#workspace-tree-refresh");
5053
- if (refreshBtn && refreshBtn.parentElement) {
5054
- refreshBtn.parentElement.appendChild(opener);
5055
- opener.addEventListener("click", openModelSettings);
5056
- }
5126
+ // Settings tab (#hot-config): the models opener now lives in the Settings
5127
+ // tab slot instead of the workspace header (its old home raised "why is
5128
+ // models inside workspace"). Workspace fallback only if the slot is absent.
5129
+ var settingsSlot = document.querySelector("#settings-models-slot");
5130
+ var mount = settingsSlot || (refreshBtn && refreshBtn.parentElement) || document.body;
5131
+ mount.appendChild(opener);
5132
+ opener.addEventListener("click", openModelSettings);
5057
5133
 
5058
5134
  var modal = document.querySelector("#model-settings-modal");
5059
5135
  if (!modal || modal.dataset.bound === "true") return;
@@ -5173,6 +5249,63 @@ function refreshGithubAuthStatus() {
5173
5249
  });
5174
5250
  }
5175
5251
 
5252
+ // Hot worker-provisioning config (#hot-config): renders into the Settings
5253
+ // tab's static form (#tab-settings). PATCH /team/config applies in-memory to
5254
+ // the running controller (no restart) and persists to the host openclaw.json
5255
+ // where the deployment shape allows it.
5256
+ var workerSettingsBound = false;
5257
+ function renderWorkerSettingsPanel() {
5258
+ var modal = document.getElementById("wk-save");
5259
+ if (!modal) return;
5260
+ apiRequest("/team/config").then(function (cfg) {
5261
+ if (cfg.workerProvisioningMaxPerRole != null) {
5262
+ var mx = document.getElementById("wk-max");
5263
+ if (mx) mx.value = cfg.workerProvisioningMaxPerRole;
5264
+ }
5265
+ if (cfg.workerProvisioningMinPerRole != null) {
5266
+ var mn = document.getElementById("wk-min");
5267
+ if (mn) mn.value = cfg.workerProvisioningMinPerRole;
5268
+ }
5269
+ if (cfg.workerProvisioningIdleTtlMs != null) {
5270
+ var ttl = document.getElementById("wk-ttl");
5271
+ if (ttl) ttl.value = cfg.workerProvisioningIdleTtlMs;
5272
+ }
5273
+ var mode = document.getElementById("wk-mode");
5274
+ if (mode) {
5275
+ mode.textContent = "provisioning: " + (cfg.workerProvisioningType || "process") +
5276
+ (cfg.persistenceMode === "memory-only" ? " | persistence: memory-only (restart reverts)" : " | persistence: host config");
5277
+ }
5278
+ }).catch(function (err) {
5279
+ var mode = document.getElementById("wk-mode");
5280
+ if (mode) mode.textContent = (err && err.message) || "load failed";
5281
+ });
5282
+ if (workerSettingsBound) return;
5283
+ workerSettingsBound = true;
5284
+ document.getElementById("wk-save").addEventListener("click", function () {
5285
+ var payload = {};
5286
+ var mxEl = document.getElementById("wk-max");
5287
+ var mnEl = document.getElementById("wk-min");
5288
+ var ttlEl = document.getElementById("wk-ttl");
5289
+ var mx = Number(mxEl && mxEl.value);
5290
+ var mn = Number(mnEl && mnEl.value);
5291
+ var ttl = Number(ttlEl && ttlEl.value);
5292
+ if (mxEl && mxEl.value !== "" && Number.isFinite(mx)) payload.workerProvisioningMaxPerRole = mx;
5293
+ if (mnEl && mnEl.value !== "" && Number.isFinite(mn)) payload.workerProvisioningMinPerRole = mn;
5294
+ if (ttlEl && ttlEl.value !== "" && Number.isFinite(ttl)) payload.workerProvisioningIdleTtlMs = ttl;
5295
+ if (!Object.keys(payload).length) return;
5296
+ var save = document.getElementById("wk-save");
5297
+ save.disabled = true;
5298
+ apiRequest("/team/config", { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) })
5299
+ .then(function (out) {
5300
+ document.getElementById("wk-result").textContent = out && out.persisted === false ? "Applied (memory only)" : "Applied";
5301
+ })
5302
+ .catch(function (err) {
5303
+ document.getElementById("wk-result").textContent = (err && err.message) || "failed";
5304
+ })
5305
+ .finally(function () { save.disabled = false; });
5306
+ });
5307
+ }
5308
+
5176
5309
  function openModelSettings() {
5177
5310
  var modal = document.querySelector("#model-settings-modal");
5178
5311
  if (!modal) return;
package/src/ui/index.html CHANGED
@@ -78,6 +78,7 @@
78
78
  <span id="tasks-tab-signal" class="tab-signal"></span>
79
79
  </button>
80
80
  <button class="tab" data-tab="workspace"><span class="tab-label" data-i18n="tab.workspace">Workspace</span></button>
81
+ <button class="tab" data-tab="settings"><span class="tab-label" data-i18n="tab.settings">Settings</span></button>
81
82
  <button class="tab" data-tab="clarifications">
82
83
  <span class="tab-label" data-i18n="tab.clarifications">Clarifications</span>
83
84
  <span id="clarifications-tab-count" class="tab-badge">0</span>
@@ -150,6 +151,28 @@
150
151
  </div>
151
152
 
152
153
  <!-- Workspace Tab -->
154
+ <div id="tab-settings" class="tab-panel">
155
+ <div class="panel-note" style="padding:12px 14px">
156
+ <h3 data-i18n="settings.models.title" style="margin:0 0 6px">Model settings</h3>
157
+ <p data-i18n="settings.models.hint" style="margin:0 0 8px;color:#666">Default model and per-role overrides.</p>
158
+ <div id="settings-models-slot"></div>
159
+ </div>
160
+ <div class="panel-note" style="padding:12px 14px;margin-top:10px">
161
+ <h3 data-i18n="settings.workers.title" style="margin:0 0 6px">Worker scaling (hot)</h3>
162
+ <p data-i18n="settings.workers.hint" style="margin:0 0 8px;color:#666">Applies immediately without restarting the gateway. Lowering a cap never kills busy workers.</p>
163
+ <div style="display:flex;gap:10px;flex-wrap:wrap;align-items:end">
164
+ <label style="display:flex;flex-direction:column;gap:4px;font-size:12px"><span data-i18n="settings.workers.max">Max workers / role</span>
165
+ <input id="wk-max" type="number" min="1" max="50" style="width:90px" /></label>
166
+ <label style="display:flex;flex-direction:column;gap:4px;font-size:12px"><span data-i18n="settings.workers.min">Min warm / role</span>
167
+ <input id="wk-min" type="number" min="0" max="50" style="width:90px" /></label>
168
+ <label style="display:flex;flex-direction:column;gap:4px;font-size:12px"><span data-i18n="settings.workers.ttl">Idle TTL (ms)</span>
169
+ <input id="wk-ttl" type="number" min="1000" max="86400000" step="1000" style="width:120px" /></label>
170
+ <button id="wk-save" type="button" class="btn btn-small">Apply</button>
171
+ <span id="wk-result" style="margin-left:8px;color:#080"></span>
172
+ </div>
173
+ <p id="wk-mode" style="margin:8px 0 0;color:#666;font-size:12px"></p>
174
+ </div>
175
+ </div>
153
176
  <div id="tab-workspace" class="tab-panel">
154
177
  <div class="workspace-browser">
155
178
  <aside class="workspace-sidebar-panel">