@teamclaws/teamclaw 2026.4.3-1 → 2026.4.4

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/src/ui/app.js CHANGED
@@ -1286,7 +1286,30 @@
1286
1286
  }
1287
1287
 
1288
1288
  function showError(message) {
1289
- window.alert(message);
1289
+ // Non-blocking toast instead of a native alert(): native dialogs freeze
1290
+ // the page and steal focus, and multiple rapid errors queue up behind
1291
+ // each other. Toasts stack, auto-dismiss, and are click-dismissible.
1292
+ let container = document.getElementById("toast-container");
1293
+ if (!container) {
1294
+ container = document.createElement("div");
1295
+ container.id = "toast-container";
1296
+ container.style.cssText = "position:fixed;bottom:24px;right:24px;z-index:2000;display:flex;flex-direction:column;gap:10px;max-width:min(420px,80vw);";
1297
+ document.body.appendChild(container);
1298
+ }
1299
+ const toast = document.createElement("div");
1300
+ toast.className = "app-toast app-toast-error";
1301
+ toast.style.cssText = "background:#7f1d1d;color:#fff;padding:12px 16px;border-radius:10px;"
1302
+ + "box-shadow:0 8px 24px rgba(0,0,0,0.35);font-size:13px;line-height:1.45;"
1303
+ + "cursor:pointer;opacity:0;transition:opacity 0.25s ease;";
1304
+ toast.textContent = message;
1305
+ container.appendChild(toast);
1306
+ requestAnimationFrame(function () { toast.style.opacity = "1"; });
1307
+ const dismiss = function () {
1308
+ toast.style.opacity = "0";
1309
+ setTimeout(function () { toast.remove(); }, 250);
1310
+ };
1311
+ toast.onclick = dismiss;
1312
+ setTimeout(dismiss, 5000);
1290
1313
  }
1291
1314
 
1292
1315
  async function apiRequest(path, options) {
@@ -1974,14 +1997,35 @@
1974
1997
  }
1975
1998
 
1976
1999
  container.innerHTML = workers.map(function (worker) {
2000
+ var staleBadge = worker.staleRemovable
2001
+ ? '<span class="worker-status stale" title="Ghost record from a previous gateway process">stale</span>'
2002
+ : "";
1977
2003
  return (
1978
- '<div class="worker-card">' +
2004
+ '<div class="worker-card' + (worker.staleRemovable ? " worker-card-stale" : "") + '" data-worker-id="' + escapeHtml(worker.id) + '">' +
1979
2005
  ' <span class="worker-icon">' + escapeHtml(worker.label || worker.role).charAt(0) + '</span>' +
1980
2006
  ' <span class="worker-label">' + escapeHtml(worker.label || worker.role) + '</span>' +
1981
2007
  ' <span class="worker-status ' + escapeHtml(worker.status || "offline") + '">' + escapeHtml(worker.status || "offline") + "</span>" +
2008
+ staleBadge +
2009
+ (worker.staleRemovable
2010
+ ? '<button class="btn btn-small worker-remove-btn" type="button" data-remove-worker="' + escapeHtml(worker.id) + '">Remove</button>'
2011
+ : "") +
1982
2012
  "</div>"
1983
2013
  );
1984
2014
  }).join("");
2015
+
2016
+ container.querySelectorAll("[data-remove-worker]").forEach(function (btn) {
2017
+ btn.addEventListener("click", function () {
2018
+ var workerId = btn.getAttribute("data-remove-worker");
2019
+ if (!workerId) return;
2020
+ btn.disabled = true;
2021
+ apiRequest("/workers/" + encodeURIComponent(workerId), { method: "DELETE" })
2022
+ .then(function () {
2023
+ showError("Removed stale worker record " + workerId);
2024
+ refreshAll();
2025
+ })
2026
+ .catch(function (err) { showError(err instanceof Error ? err.message : "Failed to remove worker"); btn.disabled = false; });
2027
+ });
2028
+ });
1985
2029
  }
1986
2030
 
1987
2031
  function renderTasks(tasks) {
@@ -3061,9 +3105,227 @@
3061
3105
  }
3062
3106
  }
3063
3107
 
3108
+ var WORKSPACE_PROMPT_DISMISSED_KEY = "teamclaw.workspacePromptDismissed";
3109
+
3110
+ function updateWorkspacePathIndicator() {
3111
+ var el = $("#workspace-current-path-value");
3112
+ if (!el) return;
3113
+ apiGet("/workspace/status").then(function (data) {
3114
+ if (data && typeof data.workspaceDir === "string") {
3115
+ el.textContent = data.workspaceDir + (data.isDefault ? " (default)" : "");
3116
+ el.title = data.workspaceDir;
3117
+ }
3118
+ }).catch(function () { /* leave placeholder */ });
3119
+ }
3120
+
3121
+ function openWorkspacePromptModal(currentPath) {
3122
+ var modal = $("#workspace-prompt-modal");
3123
+ var pathEl = $("#workspace-prompt-path");
3124
+ var input = $("#workspace-prompt-input");
3125
+ if (!modal || !pathEl || !input) return;
3126
+ pathEl.textContent = currentPath || "(unknown)";
3127
+ input.value = currentPath || "";
3128
+ modal.classList.add("open");
3129
+ modal.setAttribute("aria-hidden", "false");
3130
+ }
3131
+
3132
+ function closeWorkspacePromptModal() {
3133
+ var modal = $("#workspace-prompt-modal");
3134
+ if (!modal) return;
3135
+ modal.classList.remove("open");
3136
+ modal.setAttribute("aria-hidden", "true");
3137
+ }
3138
+
3139
+ function promptWorkspaceIfDefault() {
3140
+ if (localStorage.getItem(WORKSPACE_PROMPT_DISMISSED_KEY) === "1") {
3141
+ return;
3142
+ }
3143
+ apiGet("/workspace/status").then(function (data) {
3144
+ if (!data || data.isDefault !== true) {
3145
+ return;
3146
+ }
3147
+ openWorkspacePromptModal(data.workspaceDir);
3148
+ }).catch(function () {
3149
+ // status endpoint unavailable - skip the prompt silently
3150
+ });
3151
+ }
3152
+
3153
+ function bindWorkspacePrompt() {
3154
+ var modal = $("#workspace-prompt-modal");
3155
+ if (!modal || modal.dataset.bound === "true") return;
3156
+ modal.dataset.bound = "true";
3157
+
3158
+ modal.addEventListener("click", function (event) {
3159
+ if (event.target && event.target.hasAttribute && event.target.hasAttribute("data-workspace-prompt-close")) {
3160
+ localStorage.setItem(WORKSPACE_PROMPT_DISMISSED_KEY, "1");
3161
+ closeWorkspacePromptModal();
3162
+ }
3163
+ });
3164
+
3165
+ var browse = $("#workspace-prompt-browse");
3166
+ var input = $("#workspace-prompt-input");
3167
+ var apply = $("#workspace-prompt-apply");
3168
+
3169
+ if (browse) {
3170
+ browse.addEventListener("click", function () {
3171
+ if (typeof window.showDirectoryPicker === "function") {
3172
+ window.showDirectoryPicker({ mode: "readwrite", id: "teamclaw-workspace" })
3173
+ .then(function (handle) {
3174
+ if (input) {
3175
+ input.value = handle.name || input.value;
3176
+ input.dataset.verifiedPath = "";
3177
+ }
3178
+ showError("Browser directory picker cannot return full server paths; please type the absolute path instead.");
3179
+ })
3180
+ .catch(function () {
3181
+ /* user cancelled */
3182
+ });
3183
+ } else {
3184
+ showError("This browser does not support a native directory picker; please type the absolute path instead.");
3185
+ }
3186
+ });
3187
+ }
3188
+
3189
+ if (apply) {
3190
+ apply.addEventListener("click", function () {
3191
+ var value = input && typeof input.value === "string" ? input.value.trim() : "";
3192
+ if (!value || value.indexOf("/") !== 0) {
3193
+ showError("Please enter an absolute path starting with /");
3194
+ return;
3195
+ }
3196
+ apply.disabled = true;
3197
+ apiPost("/workspace/change-dir", { workspaceDir: value }).then(function () {
3198
+ localStorage.setItem(WORKSPACE_PROMPT_DISMISSED_KEY, "1");
3199
+ closeWorkspacePromptModal();
3200
+ showError("Workspace updated to " + value + ". Restart the gateway (openclaw gateway restart) to apply it.");
3201
+ updateWorkspacePathIndicator();
3202
+ }).catch(function (err) {
3203
+ showError(err instanceof Error ? err.message : "Failed to update workspace directory");
3204
+ }).finally(function () {
3205
+ apply.disabled = false;
3206
+ });
3207
+ });
3208
+ }
3209
+ }
3210
+
3064
3211
  applyStaticTranslations();
3065
3212
  renderWorkspaceTree(workspaceTree);
3066
3213
  renderWorkspaceFile();
3067
3214
  refreshAll().then(applyInitialUiState).catch(function () {});
3068
3215
  connectWebSocket();
3216
+ bindWorkspacePrompt();
3217
+ promptWorkspaceIfDefault();
3218
+ updateWorkspacePathIndicator();
3219
+ bindModelSettings();
3220
+
3221
+ function bindModelSettings() {
3222
+ /* Module-level IIFE helper: delegated here to keep startup order simple. */
3223
+ var opener = document.createElement("button");
3224
+ opener.className = "btn btn-small";
3225
+ opener.type = "button";
3226
+ opener.id = "model-settings-open";
3227
+ opener.textContent = "Models";
3228
+ var refreshBtn = document.querySelector("#workspace-tree-refresh");
3229
+ if (refreshBtn && refreshBtn.parentElement) {
3230
+ refreshBtn.parentElement.appendChild(opener);
3231
+ opener.addEventListener("click", openModelSettings);
3232
+ }
3233
+
3234
+ var modal = document.querySelector("#model-settings-modal");
3235
+ if (!modal || modal.dataset.bound === "true") return;
3236
+ modal.dataset.bound = "true";
3237
+
3238
+ modal.addEventListener("click", function (event) {
3239
+ if (event.target && event.target.hasAttribute && event.target.hasAttribute("data-model-settings-close")) {
3240
+ closeModelSettings();
3241
+ }
3242
+ });
3243
+
3244
+ var save = document.querySelector("#model-settings-save");
3245
+ if (save) {
3246
+ save.addEventListener("click", function () {
3247
+ var defaultSelect = document.querySelector("#model-settings-default");
3248
+ var payload = { roleModelOverrides: {} };
3249
+ if (defaultSelect && defaultSelect.value) {
3250
+ payload.defaultModel = defaultSelect.value;
3251
+ }
3252
+ modal.querySelectorAll("[data-role-model]").forEach(function (sel) {
3253
+ var role = sel.getAttribute("data-role-model");
3254
+ if (role && sel.value) {
3255
+ payload.roleModelOverrides[role] = sel.value;
3256
+ }
3257
+ });
3258
+ save.disabled = true;
3259
+ apiRequest("/models/config", {
3260
+ method: "PUT",
3261
+ headers: { "Content-Type": "application/json" },
3262
+ body: JSON.stringify(payload),
3263
+ }).then(function () {
3264
+ showError("Model settings saved. Hot-reload applies; restart the gateway if needed.");
3265
+ closeModelSettings();
3266
+ }).catch(function (err) {
3267
+ showError(err instanceof Error ? err.message : "Failed to save model settings");
3268
+ }).finally(function () {
3269
+ save.disabled = false;
3270
+ });
3271
+ });
3272
+ }
3273
+ }
3274
+
3275
+ function openModelSettings() {
3276
+ var modal = document.querySelector("#model-settings-modal");
3277
+ if (!modal) return;
3278
+ apiGet("/models/config").then(function (catalog) {
3279
+ var options = [];
3280
+ (catalog.providers || []).forEach(function (provider) {
3281
+ (provider.models || []).forEach(function (modelId) {
3282
+ options.push({ value: provider.id + "/" + modelId, label: provider.id + " / " + modelId });
3283
+ });
3284
+ if (!provider.models || provider.models.length === 0) {
3285
+ options.push({ value: provider.id, label: provider.id + " (provider default)" });
3286
+ }
3287
+ });
3288
+ if (catalog.defaultModel && !options.some(function (opt) { return opt.value === catalog.defaultModel; })) {
3289
+ options.unshift({ value: catalog.defaultModel, label: catalog.defaultModel + " (current)" });
3290
+ }
3291
+
3292
+ var defaultSelect = document.querySelector("#model-settings-default");
3293
+ if (defaultSelect) {
3294
+ defaultSelect.innerHTML = options.map(function (opt) {
3295
+ return '<option value="' + escapeHtml(opt.value) + '">' + escapeHtml(opt.label) + "</option>";
3296
+ }).join("");
3297
+ defaultSelect.value = catalog.defaultModel || (options.length ? options[0].value : "");
3298
+ }
3299
+
3300
+ var rolesEl = document.querySelector("#model-settings-roles");
3301
+ if (rolesEl) {
3302
+ rolesEl.innerHTML = (catalog.roles || []).map(function (role) {
3303
+ var current = (catalog.roleModelOverrides || {})[role.id] || "";
3304
+ return (
3305
+ '<label class="model-settings-field">' +
3306
+ ' <span class="model-settings-label">' + escapeHtml(role.label) + '</span>' +
3307
+ ' <select data-role-model="' + escapeHtml(role.id) + '">' +
3308
+ ' <option value="">(use default)</option>' +
3309
+ options.map(function (opt) {
3310
+ return '<option value="' + escapeHtml(opt.value) + '"' + (current === opt.value ? " selected" : "") + '>' + escapeHtml(opt.label) + "</option>";
3311
+ }).join("") +
3312
+ " </select>" +
3313
+ "</label>"
3314
+ );
3315
+ }).join("");
3316
+ }
3317
+
3318
+ modal.classList.add("open");
3319
+ modal.setAttribute("aria-hidden", "false");
3320
+ }).catch(function (err) {
3321
+ showError(err instanceof Error ? err.message : "Failed to load model catalog");
3322
+ });
3323
+ }
3324
+
3325
+ function closeModelSettings() {
3326
+ var modal = document.querySelector("#model-settings-modal");
3327
+ if (!modal) return;
3328
+ modal.classList.remove("open");
3329
+ modal.setAttribute("aria-hidden", "true");
3330
+ }
3069
3331
  })();
package/src/ui/index.html CHANGED
@@ -124,8 +124,12 @@
124
124
  </div>
125
125
  <button id="workspace-tree-refresh" class="btn btn-small" type="button" data-i18n="action.refresh">Refresh</button>
126
126
  </div>
127
+ <div class="workspace-current-path">
128
+ <span class="workspace-current-path-label">Location</span>
129
+ <code id="workspace-current-path-value">...</code>
130
+ </div>
127
131
  <div id="workspace-tree" class="workspace-tree">
128
- <div class="empty-state">Workspace tree loading…</div>
132
+ <div class="empty-state">Workspace tree loading...</div>
129
133
  </div>
130
134
  </aside>
131
135
 
@@ -216,6 +220,7 @@
216
220
  <option value="security-engineer">Security Engineer</option>
217
221
  <option value="designer">UI/UX Designer</option>
218
222
  <option value="marketing">Marketing Specialist</option>
223
+ <option value="data-engineer">Data Engineer</option>
219
224
  </select>
220
225
  </div>
221
226
  </div>
@@ -226,6 +231,52 @@
226
231
  </div>
227
232
  </main>
228
233
 
234
+ <div id="workspace-prompt-modal" class="workspace-prompt-modal" aria-hidden="true">
235
+ <div class="workspace-prompt-backdrop" data-workspace-prompt-close></div>
236
+ <section class="workspace-prompt-panel" role="dialog" aria-modal="true" aria-labelledby="workspace-prompt-title">
237
+ <header class="workspace-prompt-header">
238
+ <div class="workspace-prompt-kicker">Workspace setup</div>
239
+ <h2 id="workspace-prompt-title">Choose a workspace directory</h2>
240
+ </header>
241
+ <div class="workspace-prompt-body">
242
+ <p class="workspace-prompt-current">Current workspace (default):</p>
243
+ <p><code id="workspace-prompt-path"></code></p>
244
+ <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>
245
+ <div class="workspace-prompt-controls">
246
+ <input id="workspace-prompt-input" class="workspace-prompt-input" type="text" placeholder="/absolute/path/to/teamclaw_workspace" spellcheck="false" />
247
+ <div class="workspace-prompt-actions">
248
+ <button id="workspace-prompt-browse" class="btn" type="button">Browse...</button>
249
+ <button id="workspace-prompt-apply" class="btn btn-primary" type="button">Apply</button>
250
+ <button id="workspace-prompt-dismiss" class="btn btn-small" type="button" data-workspace-prompt-close>Keep default</button>
251
+ </div>
252
+ </div>
253
+ <p class="workspace-prompt-note">Applies after a gateway restart. Existing files are not moved automatically.</p>
254
+ </div>
255
+ </section>
256
+ </div>
257
+
258
+ <div id="model-settings-modal" class="workspace-prompt-modal" aria-hidden="true">
259
+ <div class="workspace-prompt-backdrop" data-model-settings-close></div>
260
+ <section class="workspace-prompt-panel" role="dialog" aria-modal="true" aria-labelledby="model-settings-title">
261
+ <header class="workspace-prompt-header">
262
+ <div class="workspace-prompt-kicker">Model settings</div>
263
+ <h2 id="model-settings-title">Team models</h2>
264
+ </header>
265
+ <div class="workspace-prompt-body">
266
+ <label class="model-settings-field">
267
+ <span class="model-settings-label">Default model (controller &amp; all roles)</span>
268
+ <select id="model-settings-default"></select>
269
+ </label>
270
+ <div id="model-settings-roles" class="model-settings-roles"></div>
271
+ <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>
272
+ <div class="workspace-prompt-actions">
273
+ <button id="model-settings-save" class="btn btn-primary" type="button">Save</button>
274
+ <button id="model-settings-close" class="btn btn-small" type="button" data-model-settings-close>Cancel</button>
275
+ </div>
276
+ </div>
277
+ </section>
278
+ </div>
279
+
229
280
  <div id="clarification-prompt-modal" class="clarification-prompt-modal" aria-hidden="true">
230
281
  <div class="clarification-prompt-backdrop" data-clarification-prompt-close></div>
231
282
  <section class="clarification-prompt-panel" role="dialog" aria-modal="true" aria-labelledby="clarification-prompt-title">
package/src/ui/style.css CHANGED
@@ -2265,3 +2265,148 @@ body {
2265
2265
  justify-content: flex-end;
2266
2266
  }
2267
2267
  }
2268
+
2269
+ /* Workspace location indicator (workspace tab sidebar) */
2270
+ .workspace-current-path {
2271
+ display: flex;
2272
+ flex-direction: column;
2273
+ gap: 2px;
2274
+ padding: 8px 12px;
2275
+ margin: 8px 0;
2276
+ background: rgba(255, 255, 255, 0.04);
2277
+ border: 1px solid rgba(255, 255, 255, 0.08);
2278
+ border-radius: 8px;
2279
+ }
2280
+ .workspace-current-path-label {
2281
+ font-size: 10px;
2282
+ letter-spacing: 0.08em;
2283
+ text-transform: uppercase;
2284
+ opacity: 0.55;
2285
+ }
2286
+ #workspace-current-path-value {
2287
+ font-size: 11px;
2288
+ word-break: break-all;
2289
+ opacity: 0.9;
2290
+ }
2291
+
2292
+ /* Workspace setup prompt (centered modal) */
2293
+ .workspace-prompt-modal {
2294
+ position: fixed;
2295
+ inset: 0;
2296
+ display: none;
2297
+ align-items: center;
2298
+ justify-content: center;
2299
+ z-index: 1200;
2300
+ padding: 24px;
2301
+ }
2302
+ .workspace-prompt-modal.open {
2303
+ display: flex;
2304
+ }
2305
+ .workspace-prompt-backdrop {
2306
+ position: absolute;
2307
+ inset: 0;
2308
+ background: rgba(8, 10, 14, 0.6);
2309
+ backdrop-filter: blur(2px);
2310
+ }
2311
+ .workspace-prompt-panel {
2312
+ position: relative;
2313
+ width: 100%;
2314
+ max-width: 560px;
2315
+ max-height: 90vh;
2316
+ overflow-y: auto;
2317
+ background: var(--bg-panel, #171a21);
2318
+ border: 1px solid rgba(255, 255, 255, 0.1);
2319
+ border-radius: 14px;
2320
+ padding: 24px 28px;
2321
+ box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
2322
+ }
2323
+ .workspace-prompt-kicker {
2324
+ font-size: 11px;
2325
+ letter-spacing: 0.12em;
2326
+ text-transform: uppercase;
2327
+ opacity: 0.55;
2328
+ margin-bottom: 4px;
2329
+ }
2330
+ .workspace-prompt-header h2 {
2331
+ margin: 0 0 12px;
2332
+ font-size: 18px;
2333
+ }
2334
+ .workspace-prompt-body p {
2335
+ margin: 6px 0;
2336
+ line-height: 1.5;
2337
+ }
2338
+ .workspace-prompt-current {
2339
+ opacity: 0.7;
2340
+ margin-bottom: 2px;
2341
+ }
2342
+ .workspace-prompt-hint {
2343
+ opacity: 0.85;
2344
+ }
2345
+ .workspace-prompt-controls {
2346
+ display: flex;
2347
+ flex-direction: column;
2348
+ gap: 10px;
2349
+ margin: 16px 0 8px;
2350
+ }
2351
+ .workspace-prompt-input {
2352
+ width: 100%;
2353
+ box-sizing: border-box;
2354
+ padding: 9px 12px;
2355
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
2356
+ font-size: 13px;
2357
+ border-radius: 8px;
2358
+ border: 1px solid rgba(255, 255, 255, 0.14);
2359
+ background: rgba(0, 0, 0, 0.25);
2360
+ color: inherit;
2361
+ }
2362
+ .workspace-prompt-actions {
2363
+ display: flex;
2364
+ gap: 10px;
2365
+ align-items: center;
2366
+ justify-content: flex-end;
2367
+ flex-wrap: wrap;
2368
+ }
2369
+ .workspace-prompt-note {
2370
+ font-size: 12px;
2371
+ opacity: 0.55;
2372
+ }
2373
+
2374
+ /* Stale provisioned-worker records (ghost rows from previous gateway runs) */
2375
+ .worker-card-stale {
2376
+ opacity: 0.55;
2377
+ }
2378
+ .worker-status.stale {
2379
+ background: rgba(255, 165, 0, 0.18);
2380
+ color: #e6a23c;
2381
+ border: 1px solid rgba(230, 162, 60, 0.4);
2382
+ }
2383
+ .worker-remove-btn {
2384
+ margin-left: auto;
2385
+ }
2386
+
2387
+ /* Model settings dialog */
2388
+ .model-settings-field {
2389
+ display: flex;
2390
+ flex-direction: column;
2391
+ gap: 4px;
2392
+ margin: 10px 0;
2393
+ }
2394
+ .model-settings-label {
2395
+ font-size: 12px;
2396
+ opacity: 0.75;
2397
+ }
2398
+ .model-settings-field select {
2399
+ padding: 7px 10px;
2400
+ border-radius: 8px;
2401
+ border: 1px solid rgba(255, 255, 255, 0.14);
2402
+ background: rgba(0, 0, 0, 0.25);
2403
+ color: inherit;
2404
+ }
2405
+ .model-settings-roles {
2406
+ max-height: 320px;
2407
+ overflow-y: auto;
2408
+ padding-right: 4px;
2409
+ margin-top: 12px;
2410
+ border-top: 1px solid rgba(255, 255, 255, 0.08);
2411
+ padding-top: 4px;
2412
+ }
@@ -3,6 +3,12 @@ import { getRole } from "../roles.js";
3
3
  import { buildWorkerSessionRules, composePrompt } from "../prompt-policy.js";
4
4
  import { MessageQueue } from "./message-queue.js";
5
5
 
6
+ const TEAMCLAW_ROLE_IDS_TEXT = [
7
+ "pm", "architect", "developer", "qa",
8
+ "release-engineer", "infra-engineer", "devops", "security-engineer",
9
+ "designer", "marketing", "data-engineer",
10
+ ];
11
+
6
12
  export function createWorkerPromptInjector(
7
13
  config: PluginConfig,
8
14
  getIdentity: () => WorkerIdentity | null,
@@ -23,6 +29,8 @@ export function createWorkerPromptInjector(
23
29
  `## TeamClaw Role: ${roleDef.label} ${roleDef.icon}`,
24
30
  roleDef.systemPrompt,
25
31
  ...buildWorkerSessionRules(),
32
+ "Important: submit structured collaboration contracts for all handoffs, reviews, progress updates, and result deliveries so the controller can route work without parsing freeform prose.",
33
+ "Do not use sessions_yield or end your turn while background work, coding agents, or process sessions are still running.",
26
34
  `Worker ID: ${identity.workerId}`,
27
35
  `Controller: ${identity.controllerUrl}`,
28
36
  ];