@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/README.md +6 -2
- package/cli.mjs +116 -19
- package/index.ts +1 -0
- package/openclaw.plugin.json +38 -3
- package/package.json +8 -3
- package/src/config.ts +13 -1
- package/src/controller/controller-service.ts +22 -0
- package/src/controller/controller-tools.ts +34 -22
- package/src/controller/http-server.ts +1115 -27
- package/src/controller/prompt-injector.ts +7 -1
- package/src/controller/websocket.ts +5 -0
- package/src/controller/worker-provisioning.ts +2 -2
- package/src/discovery.ts +6 -4
- package/src/git-collaboration.ts +33 -0
- package/src/interaction-contracts.ts +2 -2
- package/src/openclaw-workspace.ts +477 -32
- package/src/prompt-policy.ts +11 -1
- package/src/roles.ts +52 -0
- package/src/state.ts +66 -34
- package/src/task-executor.ts +93 -2
- package/src/types.ts +51 -4
- package/src/ui/app.js +264 -2
- package/src/ui/index.html +52 -1
- package/src/ui/style.css +145 -0
- package/src/worker/prompt-injector.ts +8 -0
- package/src/worker/tools.ts +48 -45
- package/src/worker/worker-service.ts +21 -0
- package/tsconfig.build.json +13 -0
- package/tsconfig.json +1 -5
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ For the easiest guided setup, run:
|
|
|
19
19
|
npx -y @teamclaws/teamclaw install
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
The guided installer
|
|
22
|
+
The guided installer handles OpenClaw's install consent automatically: it starts with the legacy break-glass flag and, on OpenClaw 2026.10+ hosts where that flag is a deprecated no-op, retries with `--accept-capabilities` when the host requires capability consent. TeamClaw legitimately needs host orchestration capabilities that the built-in scanner marks as critical.
|
|
23
23
|
|
|
24
24
|
This installer can:
|
|
25
25
|
|
|
@@ -51,13 +51,17 @@ npx -y @teamclaws/teamclaw install --agent-mode main
|
|
|
51
51
|
If you only want to install the plugin manually, use:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
+
# OpenClaw 2026.10+
|
|
55
|
+
openclaw plugins install --accept-capabilities @teamclaws/teamclaw
|
|
56
|
+
|
|
57
|
+
# Legacy hosts (<2026.10)
|
|
54
58
|
openclaw plugins install --dangerously-force-unsafe-install @teamclaws/teamclaw
|
|
55
59
|
```
|
|
56
60
|
|
|
57
61
|
If you want to force the ClawHub package path, use:
|
|
58
62
|
|
|
59
63
|
```bash
|
|
60
|
-
openclaw plugins install --
|
|
64
|
+
openclaw plugins install --accept-capabilities clawhub:@teamclaws/teamclaw
|
|
61
65
|
```
|
|
62
66
|
|
|
63
67
|
Then enable and configure TeamClaw in your `openclaw.json`.
|
package/cli.mjs
CHANGED
|
@@ -19,6 +19,19 @@ const PACKAGE_VERSION = packageMetadata.version;
|
|
|
19
19
|
const PACKAGE_INSTALL_SPEC = `${PACKAGE_NAME}@${PACKAGE_VERSION}`;
|
|
20
20
|
const PLUGIN_ID = "teamclaw";
|
|
21
21
|
const DANGEROUS_INSTALL_FLAG = "--dangerously-force-unsafe-install";
|
|
22
|
+
const CAPABILITY_CONSENT_FLAG = "--accept-capabilities";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* OpenClaw 2026.10+ replaced the legacy break-glass install flag (now a
|
|
26
|
+
* deprecated no-op) with a capability-consent flow. When a host enforces
|
|
27
|
+
* that flow, the install fails and asks the user to rerun with
|
|
28
|
+
* --accept-capabilities, so detect that failure and retry once with the
|
|
29
|
+
* consent flag appended. Legacy hosts (<2026.10) succeed on the first
|
|
30
|
+
* attempt with the legacy flag and never hit the retry path.
|
|
31
|
+
*/
|
|
32
|
+
function isCapabilityConsentRequired(output) {
|
|
33
|
+
return /accept-capabilities|capability[\s-]?consent|CapabilityConsentRequired/i.test(String(output || ""));
|
|
34
|
+
}
|
|
22
35
|
const DEFAULT_TEAMCLAW_IMAGE = "ghcr.io/topcheer/teamclaw-openclaw:latest";
|
|
23
36
|
const DEFAULT_CONTROLLER_PORT = 9527;
|
|
24
37
|
const DEFAULT_WORKER_PORT = 9528;
|
|
@@ -53,6 +66,7 @@ const ROLE_OPTIONS = [
|
|
|
53
66
|
{ value: "security-engineer", label: "Security Engineer" },
|
|
54
67
|
{ value: "designer", label: "UI/UX Designer" },
|
|
55
68
|
{ value: "marketing", label: "Marketing Specialist" },
|
|
69
|
+
{ value: "data-engineer", label: "Data Engineer" },
|
|
56
70
|
];
|
|
57
71
|
|
|
58
72
|
const INSTALL_MODE_OPTIONS = [
|
|
@@ -389,6 +403,11 @@ function cloneJsonValue(value) {
|
|
|
389
403
|
|
|
390
404
|
function resolveConfiguredAgentEntryRecord(config, agentId) {
|
|
391
405
|
const agents = isRecord(config.agents) ? config.agents : {};
|
|
406
|
+
// OpenClaw 2026.10+ keyed agents.entries take precedence over the legacy list.
|
|
407
|
+
const keyed = isRecord(agents.entries) ? agents.entries[agentId] : null;
|
|
408
|
+
if (isRecord(keyed)) {
|
|
409
|
+
return keyed;
|
|
410
|
+
}
|
|
392
411
|
const list = Array.isArray(agents.list) ? agents.list : [];
|
|
393
412
|
for (const entry of list) {
|
|
394
413
|
if (!isRecord(entry) || entry.id !== agentId) {
|
|
@@ -479,6 +498,12 @@ function getCurrentWorkspacePath(config) {
|
|
|
479
498
|
|
|
480
499
|
function getCurrentTeamClawAgentWorkspacePath(config) {
|
|
481
500
|
const agents = isRecord(config.agents) ? config.agents : {};
|
|
501
|
+
const keyed = isRecord(agents.entries)
|
|
502
|
+
? agents.entries[TEAMCLAW_AGENT_ID]
|
|
503
|
+
: null;
|
|
504
|
+
if (isRecord(keyed) && typeof keyed.workspace === "string") {
|
|
505
|
+
return expandUserPath(keyed.workspace);
|
|
506
|
+
}
|
|
482
507
|
const list = Array.isArray(agents.list) ? agents.list : [];
|
|
483
508
|
for (const entry of list) {
|
|
484
509
|
if (!isRecord(entry) || entry.id !== TEAMCLAW_AGENT_ID) {
|
|
@@ -887,13 +912,23 @@ function listLanUiUrls(port) {
|
|
|
887
912
|
|
|
888
913
|
function installPluginWithCommand(command, args, env) {
|
|
889
914
|
const result = spawnSync(command, args, {
|
|
890
|
-
stdio: "inherit",
|
|
915
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
891
916
|
env,
|
|
917
|
+
encoding: "utf8",
|
|
892
918
|
});
|
|
919
|
+
const stdout = result.stdout ?? "";
|
|
920
|
+
const stderr = result.stderr ?? "";
|
|
921
|
+
if (stdout) {
|
|
922
|
+
process.stdout.write(stdout);
|
|
923
|
+
}
|
|
924
|
+
if (stderr) {
|
|
925
|
+
process.stderr.write(stderr);
|
|
926
|
+
}
|
|
893
927
|
return {
|
|
894
928
|
status: result.status ?? 1,
|
|
895
929
|
signal: result.signal ?? null,
|
|
896
930
|
error: result.error ?? null,
|
|
931
|
+
output: `${stdout}\n${stderr}`,
|
|
897
932
|
};
|
|
898
933
|
}
|
|
899
934
|
|
|
@@ -1021,7 +1056,7 @@ function attemptPluginInstall({ configPath }) {
|
|
|
1021
1056
|
}
|
|
1022
1057
|
}
|
|
1023
1058
|
console.log(
|
|
1024
|
-
`\nTeamClaw uses host-level orchestration capabilities, so OpenClaw requires ${DANGEROUS_INSTALL_FLAG}
|
|
1059
|
+
`\nTeamClaw uses host-level orchestration capabilities, so OpenClaw requires an install consent flag during plugin installation (legacy: ${DANGEROUS_INSTALL_FLAG}; OpenClaw 2026.10+: ${CAPABILITY_CONSENT_FLAG}).`,
|
|
1025
1060
|
);
|
|
1026
1061
|
const candidates = [
|
|
1027
1062
|
{
|
|
@@ -1072,7 +1107,19 @@ function attemptPluginInstall({ configPath }) {
|
|
|
1072
1107
|
for (let index = 0; index < candidates.length; index += 1) {
|
|
1073
1108
|
const candidate = candidates[index];
|
|
1074
1109
|
console.log(`\nInstalling ${candidate.targetDescription} with ${candidate.label}...`);
|
|
1075
|
-
|
|
1110
|
+
let result = installPluginWithCommand(candidate.command, candidate.args, env);
|
|
1111
|
+
if (
|
|
1112
|
+
result.status !== 0 &&
|
|
1113
|
+
!candidate.args.includes(CAPABILITY_CONSENT_FLAG) &&
|
|
1114
|
+
isCapabilityConsentRequired(result.output)
|
|
1115
|
+
) {
|
|
1116
|
+
console.log("OpenClaw requires capability consent; retrying with --accept-capabilities...");
|
|
1117
|
+
result = installPluginWithCommand(
|
|
1118
|
+
candidate.command,
|
|
1119
|
+
[...candidate.args, CAPABILITY_CONSENT_FLAG],
|
|
1120
|
+
env,
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1076
1123
|
if (result.status === 0 && !result.error) {
|
|
1077
1124
|
return {
|
|
1078
1125
|
ok: true,
|
|
@@ -1489,22 +1536,54 @@ async function collectInstallChoices(configPath, config, prompter, options) {
|
|
|
1489
1536
|
}
|
|
1490
1537
|
|
|
1491
1538
|
function upsertAgentListEntry(agents, agentId, update) {
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1539
|
+
const legacyList = Array.isArray(agents.list) ? agents.list.filter(isRecord) : [];
|
|
1540
|
+
// OpenClaw 2026.10+ rejects agents.list ("moved to keyed agents.entries").
|
|
1541
|
+
// Write the keyed shape whenever the host already uses it, or when there is
|
|
1542
|
+
// no legacy list to stay compatible with; only keep the array on hosts that
|
|
1543
|
+
// still have one.
|
|
1544
|
+
const useKeyedEntries = isRecord(agents.entries) || legacyList.length === 0;
|
|
1545
|
+
if (!useKeyedEntries) {
|
|
1546
|
+
const existingIndex = legacyList.findIndex((entry) => entry.id === agentId);
|
|
1547
|
+
const nextEntry = {
|
|
1548
|
+
...(existingIndex >= 0 ? legacyList[existingIndex] : {}),
|
|
1549
|
+
id: agentId,
|
|
1550
|
+
...update,
|
|
1551
|
+
};
|
|
1552
|
+
if (existingIndex >= 0) {
|
|
1553
|
+
legacyList[existingIndex] = nextEntry;
|
|
1554
|
+
} else {
|
|
1555
|
+
legacyList.push(nextEntry);
|
|
1556
|
+
}
|
|
1557
|
+
agents.list = legacyList;
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
const entries = isRecord(agents.entries) ? agents.entries : {};
|
|
1561
|
+
// Fold legacy list entries into the keyed map once, then drop the list.
|
|
1562
|
+
for (const legacyEntry of legacyList) {
|
|
1563
|
+
const legacyId = isRecord(legacyEntry) && typeof legacyEntry.id === "string" ? legacyEntry.id : "";
|
|
1564
|
+
if (!legacyId || isRecord(entries[legacyId])) {
|
|
1565
|
+
continue;
|
|
1566
|
+
}
|
|
1567
|
+
const migrated = { ...legacyEntry };
|
|
1568
|
+
delete migrated.id;
|
|
1569
|
+
entries[legacyId] = migrated;
|
|
1570
|
+
}
|
|
1571
|
+
const existingKeyed = isRecord(entries[agentId]) ? entries[agentId] : {};
|
|
1572
|
+
entries[agentId] = {
|
|
1573
|
+
...existingKeyed,
|
|
1497
1574
|
...update,
|
|
1498
1575
|
};
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1576
|
+
agents.entries = entries;
|
|
1577
|
+
delete agents.list;
|
|
1578
|
+
if (Object.keys(entries).length > 1) {
|
|
1579
|
+
agents.ownership = "explicit";
|
|
1503
1580
|
}
|
|
1504
|
-
agents.list = list;
|
|
1505
1581
|
}
|
|
1506
1582
|
|
|
1507
1583
|
function removeAgentListEntry(agents, agentId) {
|
|
1584
|
+
if (isRecord(agents.entries)) {
|
|
1585
|
+
delete agents.entries[agentId];
|
|
1586
|
+
}
|
|
1508
1587
|
if (!Array.isArray(agents.list)) {
|
|
1509
1588
|
return;
|
|
1510
1589
|
}
|
|
@@ -1528,11 +1607,18 @@ function applyTeamClawHostRuntimeDefaults(next) {
|
|
|
1528
1607
|
|
|
1529
1608
|
const tools = ensureRecord(next, "tools");
|
|
1530
1609
|
const exec = ensureRecord(tools, "exec");
|
|
1531
|
-
if (typeof exec.
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
exec.ask
|
|
1610
|
+
if (typeof exec.mode === "string" && exec.mode.trim()) {
|
|
1611
|
+
// OpenClaw 2026.10+ forbids mixing mode with security/ask in one exec
|
|
1612
|
+
// object; mode="full" is the equivalent of security="full" + ask="off".
|
|
1613
|
+
delete exec.security;
|
|
1614
|
+
delete exec.ask;
|
|
1615
|
+
} else {
|
|
1616
|
+
if (typeof exec.security !== "string" || !exec.security.trim()) {
|
|
1617
|
+
exec.security = TEAMCLAW_RECOMMENDED_EXEC_SECURITY;
|
|
1618
|
+
}
|
|
1619
|
+
if (typeof exec.ask !== "string" || !exec.ask.trim()) {
|
|
1620
|
+
exec.ask = TEAMCLAW_RECOMMENDED_EXEC_ASK;
|
|
1621
|
+
}
|
|
1536
1622
|
}
|
|
1537
1623
|
}
|
|
1538
1624
|
|
|
@@ -1542,6 +1628,17 @@ function collectTeamClawHostRuntimeWarnings(config) {
|
|
|
1542
1628
|
const tools = isRecord(config.tools) ? config.tools : null;
|
|
1543
1629
|
const exec = tools && isRecord(tools.exec) ? tools.exec : null;
|
|
1544
1630
|
|
|
1631
|
+
if (typeof exec?.mode === "string" && exec.mode.trim()) {
|
|
1632
|
+
// Modern hosts configure tools.exec.mode; mode="full" maps to the
|
|
1633
|
+
// recommended security/ask defaults, so only warn on stricter modes.
|
|
1634
|
+
if (exec.mode.trim() !== TEAMCLAW_RECOMMENDED_EXEC_SECURITY) {
|
|
1635
|
+
warnings.push(
|
|
1636
|
+
`tools.exec.mode is set to "${exec.mode.trim()}" (TeamClaw works best with "${TEAMCLAW_RECOMMENDED_EXEC_SECURITY}"; stricter settings can block task execution or trigger repeated approvals).`,
|
|
1637
|
+
);
|
|
1638
|
+
}
|
|
1639
|
+
return warnings;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1545
1642
|
const execSecurity = typeof exec?.security === "string" ? exec.security.trim() : "";
|
|
1546
1643
|
if (execSecurity && execSecurity !== TEAMCLAW_RECOMMENDED_EXEC_SECURITY) {
|
|
1547
1644
|
warnings.push(
|
|
@@ -1697,7 +1794,7 @@ function applyInstallerChoices(config, choices, configPath) {
|
|
|
1697
1794
|
teamclawConfig.workerProvisioningDisabled = false;
|
|
1698
1795
|
teamclawConfig.workerProvisioningControllerUrl = "";
|
|
1699
1796
|
teamclawConfig.workerProvisioningRoles = [];
|
|
1700
|
-
teamclawConfig.workerProvisioningMaxPerRole =
|
|
1797
|
+
teamclawConfig.workerProvisioningMaxPerRole = 1;
|
|
1701
1798
|
teamclawConfig.workerProvisioningImage = "";
|
|
1702
1799
|
teamclawConfig.workerProvisioningPassEnv = [];
|
|
1703
1800
|
teamclawConfig.workerProvisioningExtraEnv = {};
|
package/index.ts
CHANGED
|
@@ -126,6 +126,7 @@ function registerWorker(api: OpenClawPluginApi, config: ReturnType<typeof parseP
|
|
|
126
126
|
logger,
|
|
127
127
|
role: config.role,
|
|
128
128
|
taskTimeoutMs: config.taskTimeoutMs,
|
|
129
|
+
config,
|
|
129
130
|
getSessionKey: getWorkerSessionKey,
|
|
130
131
|
getIdempotencyKey: (assignment) =>
|
|
131
132
|
assignment.executionIdempotencyKey?.trim() || `teamclaw-${assignment.taskId}`,
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,29 @@
|
|
|
2
2
|
"id": "teamclaw",
|
|
3
3
|
"name": "TeamClaw",
|
|
4
4
|
"description": "Virtual team collaboration - multiple OpenClaw instances form a virtual software company with role-based task routing.",
|
|
5
|
-
"version": "2026.4.
|
|
5
|
+
"version": "2026.4.4",
|
|
6
|
+
"activation": {
|
|
7
|
+
"onStartup": true
|
|
8
|
+
},
|
|
9
|
+
"contracts": {
|
|
10
|
+
"tools": [
|
|
11
|
+
"teamclaw_ask_peer",
|
|
12
|
+
"teamclaw_assign_task",
|
|
13
|
+
"teamclaw_broadcast",
|
|
14
|
+
"teamclaw_create_task",
|
|
15
|
+
"teamclaw_get_team_status",
|
|
16
|
+
"teamclaw_list_tasks",
|
|
17
|
+
"teamclaw_report_progress",
|
|
18
|
+
"teamclaw_request_clarification",
|
|
19
|
+
"teamclaw_request_kickoff",
|
|
20
|
+
"teamclaw_request_parallel_help",
|
|
21
|
+
"teamclaw_request_review",
|
|
22
|
+
"teamclaw_send_message",
|
|
23
|
+
"teamclaw_submit_manifest",
|
|
24
|
+
"teamclaw_submit_result_contract",
|
|
25
|
+
"teamclaw_suggest_handoff"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
6
28
|
"skills": [
|
|
7
29
|
"./skills"
|
|
8
30
|
],
|
|
@@ -35,6 +57,11 @@
|
|
|
35
57
|
"label": "Task Stall Threshold",
|
|
36
58
|
"help": "In milliseconds, how long TeamClaw waits without visible progress before probing the task instead of failing it"
|
|
37
59
|
},
|
|
60
|
+
"maxConcurrentTasks": {
|
|
61
|
+
"label": "Max Concurrent Tasks",
|
|
62
|
+
"hint": "number",
|
|
63
|
+
"help": "Maximum number of tasks that can be in 'in_progress' status at the same time (1–50)"
|
|
64
|
+
},
|
|
38
65
|
"gitEnabled": {
|
|
39
66
|
"label": "Git Collaboration",
|
|
40
67
|
"help": "Enable automatic git-backed workspace bootstrapping and worker repo sync"
|
|
@@ -191,9 +218,16 @@
|
|
|
191
218
|
},
|
|
192
219
|
"taskTimeoutMs": {
|
|
193
220
|
"type": "number",
|
|
194
|
-
"default":
|
|
221
|
+
"default": 600000,
|
|
195
222
|
"description": "Inactivity threshold in milliseconds before TeamClaw probes a stalled role task instead of failing it"
|
|
196
223
|
},
|
|
224
|
+
"maxConcurrentTasks": {
|
|
225
|
+
"type": "integer",
|
|
226
|
+
"default": 5,
|
|
227
|
+
"minimum": 1,
|
|
228
|
+
"maximum": 50,
|
|
229
|
+
"description": "Maximum number of tasks that can be in 'in_progress' status simultaneously"
|
|
230
|
+
},
|
|
197
231
|
"gitEnabled": {
|
|
198
232
|
"type": "boolean",
|
|
199
233
|
"default": true,
|
|
@@ -273,7 +307,8 @@
|
|
|
273
307
|
"devops",
|
|
274
308
|
"security-engineer",
|
|
275
309
|
"designer",
|
|
276
|
-
"marketing"
|
|
310
|
+
"marketing",
|
|
311
|
+
"data-engineer"
|
|
277
312
|
]
|
|
278
313
|
}
|
|
279
314
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamclaws/teamclaw",
|
|
3
|
-
"version": "2026.4.
|
|
3
|
+
"version": "2026.4.4",
|
|
4
4
|
"description": "OpenClaw virtual software team orchestration plugin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -38,9 +38,12 @@
|
|
|
38
38
|
"openclaw.plugin.json",
|
|
39
39
|
"skills/",
|
|
40
40
|
"src/",
|
|
41
|
-
"
|
|
41
|
+
"dist/",
|
|
42
|
+
"tsconfig.json",
|
|
43
|
+
"tsconfig.build.json"
|
|
42
44
|
],
|
|
43
45
|
"scripts": {
|
|
46
|
+
"build": "tsc -p tsconfig.build.json && node -e \"require('fs').cpSync('src/ui','dist/src/ui',{recursive:true})\"",
|
|
44
47
|
"manifest:sync": "cd .. && node scripts/sync-teamclaw-plugin-manifest.mjs src",
|
|
45
48
|
"pack:dry-run": "npm pack --dry-run --json --ignore-scripts",
|
|
46
49
|
"release:check": "cd .. && node scripts/teamclaw-package-check.mjs src",
|
|
@@ -50,10 +53,12 @@
|
|
|
50
53
|
"@sinclair/typebox": "0.34.48",
|
|
51
54
|
"bonjour-service": "^1.3.0",
|
|
52
55
|
"json5": "^2.2.3",
|
|
53
|
-
"openclaw": "2026.
|
|
56
|
+
"openclaw": "2026.10.9",
|
|
54
57
|
"ws": "^8.19.0"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
60
|
+
"@types/node": "^24",
|
|
61
|
+
"@types/ws": "^8.18.2",
|
|
57
62
|
"typescript": "^5.9.0"
|
|
58
63
|
},
|
|
59
64
|
"publishConfig": {
|
package/src/config.ts
CHANGED
|
@@ -41,9 +41,16 @@ function buildConfigSchema() {
|
|
|
41
41
|
},
|
|
42
42
|
taskTimeoutMs: {
|
|
43
43
|
type: "number" as const,
|
|
44
|
-
default:
|
|
44
|
+
default: 600000,
|
|
45
45
|
description: "Inactivity threshold in milliseconds before TeamClaw probes a stalled role task instead of failing it",
|
|
46
46
|
},
|
|
47
|
+
maxConcurrentTasks: {
|
|
48
|
+
type: "integer" as const,
|
|
49
|
+
default: 5,
|
|
50
|
+
minimum: 1,
|
|
51
|
+
maximum: 50,
|
|
52
|
+
description: "Maximum number of tasks that can be in 'in_progress' status simultaneously",
|
|
53
|
+
},
|
|
47
54
|
gitEnabled: {
|
|
48
55
|
type: "boolean" as const,
|
|
49
56
|
default: true,
|
|
@@ -227,6 +234,11 @@ function buildConfigSchema() {
|
|
|
227
234
|
label: "Task Stall Threshold",
|
|
228
235
|
help: "In milliseconds, how long TeamClaw waits without visible progress before probing the task instead of failing it",
|
|
229
236
|
},
|
|
237
|
+
maxConcurrentTasks: {
|
|
238
|
+
label: "Max Concurrent Tasks",
|
|
239
|
+
hint: "number",
|
|
240
|
+
help: "Maximum number of tasks that can be in 'in_progress' status at the same time (1–50)",
|
|
241
|
+
},
|
|
230
242
|
gitEnabled: {
|
|
231
243
|
label: "Git Collaboration",
|
|
232
244
|
help: "Enable automatic git-backed workspace bootstrapping and worker repo sync",
|
|
@@ -55,6 +55,7 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
|
|
|
55
55
|
return {
|
|
56
56
|
id: "teamclaw-controller",
|
|
57
57
|
async start(_ctx: OpenClawPluginServiceContext) {
|
|
58
|
+
const serviceStartedAt = Date.now();
|
|
58
59
|
await ensureOpenClawWorkspaceMemoryDir(logger);
|
|
59
60
|
const repoState = await ensureControllerGitRepo(config, logger).catch((err) => {
|
|
60
61
|
logger.warn(`Controller: failed to prepare git collaboration repo: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -93,6 +94,27 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
|
|
|
93
94
|
return teamState!;
|
|
94
95
|
};
|
|
95
96
|
|
|
97
|
+
// Provisioned workers die with the previous gateway process. Their
|
|
98
|
+
// persisted entries flip to offline once heartbeats stop but were
|
|
99
|
+
// never removed, so every gateway restart accumulated ghost rows in
|
|
100
|
+
// the workers list. Clear them on startup: provisioned-* entries that
|
|
101
|
+
// are offline (or whose heartbeat predates this process) cannot be
|
|
102
|
+
// alive because no worker for them exists yet.
|
|
103
|
+
const ghostWorkerIds = Object.values(teamState.workers)
|
|
104
|
+
.filter((worker) =>
|
|
105
|
+
worker.id.startsWith("provisioned-")
|
|
106
|
+
&& (worker.status === "offline" || !worker.lastHeartbeat || worker.lastHeartbeat < serviceStartedAt),
|
|
107
|
+
)
|
|
108
|
+
.map((worker) => worker.id);
|
|
109
|
+
if (ghostWorkerIds.length > 0) {
|
|
110
|
+
updateState((state) => {
|
|
111
|
+
for (const workerId of ghostWorkerIds) {
|
|
112
|
+
delete state.workers[workerId];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
logger.info(`Controller: removed ${ghostWorkerIds.length} stale provisioned worker record(s) from a previous gateway process`);
|
|
116
|
+
}
|
|
117
|
+
|
|
96
118
|
workerProvisioningManager = new WorkerProvisioningManager({
|
|
97
119
|
config,
|
|
98
120
|
logger,
|
|
@@ -38,6 +38,9 @@ const EXECUTION_READY_BLOCKERS: Array<{ pattern: RegExp; reason: string }> = [
|
|
|
38
38
|
{ pattern: /\bwait(?:ing)?\s+for\b/i, reason: "it says the work should wait for another output first" },
|
|
39
39
|
{ pattern: /依赖于|前置条件|前置依赖|前提条件|前序任务|上游任务/u, reason: "it explicitly mentions a predecessor dependency" },
|
|
40
40
|
{ pattern: /待.*完成|等待.*完成/u, reason: "it is described as work for a later phase" },
|
|
41
|
+
{ pattern: /前提/u, reason: "it mentions a prerequisite condition that may not be satisfied yet" },
|
|
42
|
+
{ pattern: /blocked\s*-\s*by/i, reason: "it explicitly says the task is blocked by another item" },
|
|
43
|
+
{ pattern: /需要.*先完成/u, reason: "it states another piece of work must complete first" },
|
|
41
44
|
];
|
|
42
45
|
|
|
43
46
|
const VALID_ROLE_IDS = new Set([
|
|
@@ -79,6 +82,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
79
82
|
const kickoffHandler = deps.getKickoffHandler?.();
|
|
80
83
|
if (!kickoffHandler) {
|
|
81
84
|
return {
|
|
85
|
+
details: {},
|
|
82
86
|
content: [{
|
|
83
87
|
type: "text" as const,
|
|
84
88
|
text: "Kickoff meeting is not available in this deployment. Proceed with direct task creation.",
|
|
@@ -88,7 +92,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
88
92
|
|
|
89
93
|
const requirement = String(params.requirement ?? "").trim();
|
|
90
94
|
if (!requirement) {
|
|
91
|
-
return { content: [{ type: "text" as const, text: "requirement is required." }] };
|
|
95
|
+
return { details: {}, content: [{ type: "text" as const, text: "requirement is required." }] };
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
const rawRoles = Array.isArray(params.candidateRoles) ? params.candidateRoles : [];
|
|
@@ -97,7 +101,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
97
101
|
.filter((r): r is RoleId => VALID_ROLE_IDS.has(r));
|
|
98
102
|
|
|
99
103
|
if (candidateRoles.length === 0) {
|
|
100
|
-
return { content: [{ type: "text" as const, text: "At least one valid candidate role is required." }] };
|
|
104
|
+
return { details: {}, content: [{ type: "text" as const, text: "At least one valid candidate role is required." }] };
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
const complexity = (params.complexity === "simple" || params.complexity === "medium" || params.complexity === "complex")
|
|
@@ -107,6 +111,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
107
111
|
try {
|
|
108
112
|
const result = await kickoffHandler(candidateRoles, complexity, requirement);
|
|
109
113
|
return {
|
|
114
|
+
details: {},
|
|
110
115
|
content: [{
|
|
111
116
|
type: "text" as const,
|
|
112
117
|
text: result.summary,
|
|
@@ -114,6 +119,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
114
119
|
};
|
|
115
120
|
} catch (err) {
|
|
116
121
|
return {
|
|
122
|
+
details: {},
|
|
117
123
|
content: [{
|
|
118
124
|
type: "text" as const,
|
|
119
125
|
text: `Kickoff meeting failed: ${err instanceof Error ? err.message : String(err)}. Proceed with controller-only planning.`,
|
|
@@ -130,7 +136,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
130
136
|
title: Type.String({ description: "Task title" }),
|
|
131
137
|
description: Type.String({ description: "Execution-ready task description with scope, expected deliverable, constraints, resolved clarifications, and no unmet predecessor dependency" }),
|
|
132
138
|
priority: Type.Optional(Type.String({ description: "Priority: low, medium, high, critical" })),
|
|
133
|
-
assignedRole: Type.Optional(Type.String({ description: "Exact target role ID (pm, architect, developer, qa, release-engineer, infra-engineer, devops, security-engineer, designer, marketing)" })),
|
|
139
|
+
assignedRole: Type.Optional(Type.String({ description: "Exact target role ID (pm, architect, developer, qa, release-engineer, infra-engineer, devops, security-engineer, designer, marketing, data-engineer)" })),
|
|
134
140
|
projectName: Type.Optional(Type.String({ description: "Stable project key to reuse or create for this task (for example: ggcode, todo-rest-api)." })),
|
|
135
141
|
recommendedSkills: Type.Optional(
|
|
136
142
|
Type.Array(
|
|
@@ -145,12 +151,13 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
145
151
|
const description = String(params.description ?? "");
|
|
146
152
|
const normalizedSessionKey = typeof sessionKey === "string" ? sessionKey.trim() : "";
|
|
147
153
|
if (!title) {
|
|
148
|
-
return { content: [{ type: "text" as const, text: "title is required." }] };
|
|
154
|
+
return { details: {}, content: [{ type: "text" as const, text: "title is required." }] };
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
const state = getTeamState();
|
|
152
158
|
if (shouldBlockControllerWithoutWorkers(config, state)) {
|
|
153
159
|
return {
|
|
160
|
+
details: {},
|
|
154
161
|
content: [{
|
|
155
162
|
type: "text" as const,
|
|
156
163
|
text: `${buildControllerNoWorkersMessage()} Stop after reporting this block to the human.`,
|
|
@@ -161,6 +168,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
161
168
|
const blocker = detectExecutionReadyBlocker(description);
|
|
162
169
|
if (blocker) {
|
|
163
170
|
return {
|
|
171
|
+
details: {},
|
|
164
172
|
content: [{
|
|
165
173
|
type: "text" as const,
|
|
166
174
|
text: `Refusing to create task "${title}" because it is not execution-ready: ${blocker}. Only create tasks that can start immediately; keep downstream work in the controller plan until prerequisites are already complete.`,
|
|
@@ -170,6 +178,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
170
178
|
const overlapBlocker = detectActiveTaskOverlap(title, description, state);
|
|
171
179
|
if (overlapBlocker) {
|
|
172
180
|
return {
|
|
181
|
+
details: {},
|
|
173
182
|
content: [{
|
|
174
183
|
type: "text" as const,
|
|
175
184
|
text: `Refusing to create task "${title}" because it is not execution-ready: ${overlapBlocker}. Wait for the active task to finish or narrow the new task so it does not edit the same service scope in parallel.`,
|
|
@@ -195,7 +204,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
195
204
|
|
|
196
205
|
if (!res.ok) {
|
|
197
206
|
const err = await res.text();
|
|
198
|
-
return { content: [{ type: "text" as const, text: `Failed to create task: ${err}` }] };
|
|
207
|
+
return { details: {}, content: [{ type: "text" as const, text: `Failed to create task: ${err}` }] };
|
|
199
208
|
}
|
|
200
209
|
|
|
201
210
|
const data = await res.json() as { task: TaskInfo };
|
|
@@ -212,13 +221,14 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
212
221
|
: "";
|
|
213
222
|
|
|
214
223
|
return {
|
|
224
|
+
details: {},
|
|
215
225
|
content: [{
|
|
216
226
|
type: "text" as const,
|
|
217
227
|
text: `Task created: ${task.title} [${task.id}] [${task.priority}]${assigned}${recommended}`,
|
|
218
228
|
}],
|
|
219
229
|
};
|
|
220
230
|
} catch (err) {
|
|
221
|
-
return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
231
|
+
return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
222
232
|
}
|
|
223
233
|
},
|
|
224
234
|
},
|
|
@@ -295,6 +305,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
295
305
|
const normalizedSessionKey = typeof sessionKey === "string" ? sessionKey.trim() : "";
|
|
296
306
|
if (!normalizedSessionKey) {
|
|
297
307
|
return {
|
|
308
|
+
details: {},
|
|
298
309
|
content: [{
|
|
299
310
|
type: "text" as const,
|
|
300
311
|
text: "Cannot record controller manifest because the current TeamClaw controller session key is missing.",
|
|
@@ -304,7 +315,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
304
315
|
|
|
305
316
|
const requirementSummary = String(params.requirementSummary ?? "").trim();
|
|
306
317
|
if (!requirementSummary) {
|
|
307
|
-
return { content: [{ type: "text" as const, text: "requirementSummary is required." }] };
|
|
318
|
+
return { details: {}, content: [{ type: "text" as const, text: "requirementSummary is required." }] };
|
|
308
319
|
}
|
|
309
320
|
|
|
310
321
|
const clarificationSchemas = normalizeClarificationQuestionSchemas(params.clarificationSchemas);
|
|
@@ -337,17 +348,18 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
337
348
|
|
|
338
349
|
if (!res.ok) {
|
|
339
350
|
const err = await res.text();
|
|
340
|
-
return { content: [{ type: "text" as const, text: `Failed to record controller manifest: ${err}` }] };
|
|
351
|
+
return { details: {}, content: [{ type: "text" as const, text: `Failed to record controller manifest: ${err}` }] };
|
|
341
352
|
}
|
|
342
353
|
|
|
343
354
|
return {
|
|
355
|
+
details: {},
|
|
344
356
|
content: [{
|
|
345
357
|
type: "text" as const,
|
|
346
358
|
text: `Controller manifest recorded: roles=${manifest.requiredRoles.join(", ") || "none"} created=${manifest.createdTasks.length} deferred=${manifest.deferredTasks.length}${manifest.requirementFullyComplete ? " requirementFullyComplete=true" : ""}`,
|
|
347
359
|
}],
|
|
348
360
|
};
|
|
349
361
|
} catch (err) {
|
|
350
|
-
return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
362
|
+
return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
351
363
|
}
|
|
352
364
|
},
|
|
353
365
|
},
|
|
@@ -366,12 +378,12 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
366
378
|
if (status) url.searchParams.set("status", status);
|
|
367
379
|
const res = await fetch(url.toString());
|
|
368
380
|
if (!res.ok) {
|
|
369
|
-
return { content: [{ type: "text" as const, text: `Failed to list tasks: ${res.status}` }] };
|
|
381
|
+
return { details: {}, content: [{ type: "text" as const, text: `Failed to list tasks: ${res.status}` }] };
|
|
370
382
|
}
|
|
371
383
|
|
|
372
384
|
const data = await res.json() as { tasks: TaskInfo[] };
|
|
373
385
|
if (data.tasks.length === 0) {
|
|
374
|
-
return { content: [{ type: "text" as const, text: "No tasks found." }] };
|
|
386
|
+
return { details: {}, content: [{ type: "text" as const, text: "No tasks found." }] };
|
|
375
387
|
}
|
|
376
388
|
|
|
377
389
|
const lines = data.tasks.map((t) => {
|
|
@@ -379,9 +391,9 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
379
391
|
return `[${t.status}] ${t.priority.toUpperCase()} ${t.title} (${t.id})${assignee}`;
|
|
380
392
|
});
|
|
381
393
|
|
|
382
|
-
return { content: [{ type: "text" as const, text: lines.join("\n") }] };
|
|
394
|
+
return { details: {}, content: [{ type: "text" as const, text: lines.join("\n") }] };
|
|
383
395
|
} catch (err) {
|
|
384
|
-
return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
396
|
+
return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
385
397
|
}
|
|
386
398
|
},
|
|
387
399
|
},
|
|
@@ -396,7 +408,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
396
408
|
async execute(_id: string, params: Record<string, unknown>) {
|
|
397
409
|
const taskId = String(params.taskId ?? "");
|
|
398
410
|
if (!taskId) {
|
|
399
|
-
return { content: [{ type: "text" as const, text: "taskId is required." }] };
|
|
411
|
+
return { details: {}, content: [{ type: "text" as const, text: "taskId is required." }] };
|
|
400
412
|
}
|
|
401
413
|
|
|
402
414
|
try {
|
|
@@ -411,15 +423,15 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
411
423
|
|
|
412
424
|
if (!res.ok) {
|
|
413
425
|
const err = await res.text();
|
|
414
|
-
return { content: [{ type: "text" as const, text: `Failed to assign task: ${err}` }] };
|
|
426
|
+
return { details: {}, content: [{ type: "text" as const, text: `Failed to assign task: ${err}` }] };
|
|
415
427
|
}
|
|
416
428
|
|
|
417
429
|
const data = await res.json() as { task: TaskInfo; worker?: { id: string; label: string } };
|
|
418
430
|
const worker = data.worker;
|
|
419
431
|
const workerInfo = worker ? ` assigned to ${worker.label} (${worker.id})` : " (no available worker)";
|
|
420
|
-
return { content: [{ type: "text" as const, text: `Task assigned: ${data.task.title}${workerInfo}` }] };
|
|
432
|
+
return { details: {}, content: [{ type: "text" as const, text: `Task assigned: ${data.task.title}${workerInfo}` }] };
|
|
421
433
|
} catch (err) {
|
|
422
|
-
return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
434
|
+
return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
423
435
|
}
|
|
424
436
|
},
|
|
425
437
|
},
|
|
@@ -440,7 +452,7 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
440
452
|
async execute(_id: string, params: Record<string, unknown>) {
|
|
441
453
|
const content = String(params.content ?? "");
|
|
442
454
|
if (!content) {
|
|
443
|
-
return { content: [{ type: "text" as const, text: "content is required." }] };
|
|
455
|
+
return { details: {}, content: [{ type: "text" as const, text: "content is required." }] };
|
|
444
456
|
}
|
|
445
457
|
|
|
446
458
|
try {
|
|
@@ -476,16 +488,16 @@ export function createControllerTools(deps: ControllerToolsDeps) {
|
|
|
476
488
|
});
|
|
477
489
|
|
|
478
490
|
if (!res.ok) {
|
|
479
|
-
return { content: [{ type: "text" as const, text: `Failed to send message: ${res.status}` }] };
|
|
491
|
+
return { details: {}, content: [{ type: "text" as const, text: `Failed to send message: ${res.status}` }] };
|
|
480
492
|
}
|
|
481
493
|
|
|
482
494
|
const data = await res.json() as { status: string; recipients?: number };
|
|
483
495
|
if (params.toRole) {
|
|
484
|
-
return { content: [{ type: "text" as const, text: `Message sent to ${params.toRole}: ${data.status}` }] };
|
|
496
|
+
return { details: {}, content: [{ type: "text" as const, text: `Message sent to ${params.toRole}: ${data.status}` }] };
|
|
485
497
|
}
|
|
486
|
-
return { content: [{ type: "text" as const, text: `Broadcast sent to ${data.recipients ?? 0} recipients` }] };
|
|
498
|
+
return { details: {}, content: [{ type: "text" as const, text: `Broadcast sent to ${data.recipients ?? 0} recipients` }] };
|
|
487
499
|
} catch (err) {
|
|
488
|
-
return { content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
500
|
+
return { details: {}, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }] };
|
|
489
501
|
}
|
|
490
502
|
},
|
|
491
503
|
},
|