@teamclaws/teamclaw 2026.4.3-2 → 2026.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,8 @@ It supports:
10
10
  - clarifications, workspace browsing, controller UI visibility, and a matching desktop client
11
11
  - Git-based collaboration
12
12
  - on-demand worker provisioning with `process`, `docker`, and `kubernetes`
13
+ - GitHub OAuth device-flow login and TeamAuto: scheduled issue/PR sweeps, joint multi-role full reviews, and write tasks delivered as pull requests from task-isolated git worktrees (read/write collaboration contract)
14
+ - checkpoint/resume: interrupted tasks continue where they stopped after a restart, reusing the same session and worktree
13
15
 
14
16
  ## Install
15
17
 
@@ -19,7 +21,7 @@ For the easiest guided setup, run:
19
21
  npx -y @teamclaws/teamclaw install
20
22
  ```
21
23
 
22
- The guided installer automatically uses OpenClaw's break-glass install flag for TeamClaw, because TeamClaw legitimately needs host orchestration capabilities that the built-in scanner marks as critical.
24
+ 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
25
 
24
26
  This installer can:
25
27
 
@@ -51,13 +53,17 @@ npx -y @teamclaws/teamclaw install --agent-mode main
51
53
  If you only want to install the plugin manually, use:
52
54
 
53
55
  ```bash
56
+ # OpenClaw 2026.10+
57
+ openclaw plugins install --accept-capabilities @teamclaws/teamclaw
58
+
59
+ # Legacy hosts (<2026.10)
54
60
  openclaw plugins install --dangerously-force-unsafe-install @teamclaws/teamclaw
55
61
  ```
56
62
 
57
63
  If you want to force the ClawHub package path, use:
58
64
 
59
65
  ```bash
60
- openclaw plugins install --dangerously-force-unsafe-install clawhub:@teamclaws/teamclaw
66
+ openclaw plugins install --accept-capabilities clawhub:@teamclaws/teamclaw
61
67
  ```
62
68
 
63
69
  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} during plugin installation.`,
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
- const result = installPluginWithCommand(candidate.command, candidate.args, env);
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 list = Array.isArray(agents.list) ? agents.list.filter(isRecord) : [];
1493
- const existingIndex = list.findIndex((entry) => entry.id === agentId);
1494
- const nextEntry = {
1495
- ...(existingIndex >= 0 ? list[existingIndex] : {}),
1496
- id: agentId,
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
- if (existingIndex >= 0) {
1500
- list[existingIndex] = nextEntry;
1501
- } else {
1502
- list.push(nextEntry);
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.security !== "string" || !exec.security.trim()) {
1532
- exec.security = TEAMCLAW_RECOMMENDED_EXEC_SECURITY;
1533
- }
1534
- if (typeof exec.ask !== "string" || !exec.ask.trim()) {
1535
- exec.ask = TEAMCLAW_RECOMMENDED_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 = 10;
1797
+ teamclawConfig.workerProvisioningMaxPerRole = 1;
1701
1798
  teamclawConfig.workerProvisioningImage = "";
1702
1799
  teamclawConfig.workerProvisioningPassEnv = [];
1703
1800
  teamclawConfig.workerProvisioningExtraEnv = {};
package/index.ts CHANGED
@@ -118,6 +118,21 @@ function registerWorker(api: OpenClawPluginApi, config: ReturnType<typeof parseP
118
118
  }
119
119
  }
120
120
 
121
+ async function reportCheckpoint(taskId: string, checkpoint: { lastAssistantMessage: string; progressNote?: string; sessionKey: string }): Promise<void> {
122
+ if (!currentControllerUrl) {
123
+ return;
124
+ }
125
+ try {
126
+ await fetch(`${currentControllerUrl}/api/v1/tasks/${taskId}/checkpoint`, {
127
+ method: "POST",
128
+ headers: { "Content-Type": "application/json" },
129
+ body: JSON.stringify({ ...checkpoint, workerId: currentWorkerId ?? undefined }),
130
+ });
131
+ } catch {
132
+ // Checkpointing is best-effort; a lost heartbeat only costs resume freshness.
133
+ }
134
+ }
135
+
121
136
  const getWorkerSessionKey = (assignment: TaskAssignmentPayload) =>
122
137
  assignment.executionSessionKey?.trim() || `teamclaw-task-${assignment.taskId}`;
123
138
 
@@ -126,10 +141,12 @@ function registerWorker(api: OpenClawPluginApi, config: ReturnType<typeof parseP
126
141
  logger,
127
142
  role: config.role,
128
143
  taskTimeoutMs: config.taskTimeoutMs,
144
+ config,
129
145
  getSessionKey: getWorkerSessionKey,
130
146
  getIdempotencyKey: (assignment) =>
131
147
  assignment.executionIdempotencyKey?.trim() || `teamclaw-${assignment.taskId}`,
132
148
  reportExecutionEvent,
149
+ reportCheckpoint,
133
150
  });
134
151
 
135
152
  function resolveProjectSyncPaths(projectDir: string | undefined): { sharedProjectDir: string; localProjectDir: string } | null {
@@ -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.3-2",
5
+ "version": "2026.5.0",
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"
@@ -55,6 +82,15 @@
55
82
  "label": "Git Author Email",
56
83
  "help": "Author email for TeamClaw-managed workspace commits"
57
84
  },
85
+ "githubClientId": {
86
+ "label": "GitHub Client ID",
87
+ "help": "GitHub App OAuth client ID used by the GitHub login feature"
88
+ },
89
+ "githubClientSecret": {
90
+ "label": "GitHub Client Secret",
91
+ "hint": "optional - prefer the TEAMCLAW_GITHUB_CLIENT_SECRET env var",
92
+ "help": "GitHub App OAuth client secret; the TEAMCLAW_GITHUB_CLIENT_SECRET environment variable takes precedence"
93
+ },
58
94
  "agentIsolationMode": {
59
95
  "label": "Agent Isolation Mode",
60
96
  "help": "Use a dedicated TeamClaw agent/workspace by default, or the legacy shared main-agent mode"
@@ -191,9 +227,16 @@
191
227
  },
192
228
  "taskTimeoutMs": {
193
229
  "type": "number",
194
- "default": 1800000,
230
+ "default": 600000,
195
231
  "description": "Inactivity threshold in milliseconds before TeamClaw probes a stalled role task instead of failing it"
196
232
  },
233
+ "maxConcurrentTasks": {
234
+ "type": "integer",
235
+ "default": 5,
236
+ "minimum": 1,
237
+ "maximum": 50,
238
+ "description": "Maximum number of tasks that can be in 'in_progress' status simultaneously"
239
+ },
197
240
  "gitEnabled": {
198
241
  "type": "boolean",
199
242
  "default": true,
@@ -219,6 +262,16 @@
219
262
  "default": "teamclaw@local",
220
263
  "description": "Git author email used for TeamClaw-managed workspace commits"
221
264
  },
265
+ "githubClientId": {
266
+ "type": "string",
267
+ "default": "Iv23liqWmzrS3swGiIvK",
268
+ "description": "GitHub App OAuth client ID for the GitHub login feature"
269
+ },
270
+ "githubClientSecret": {
271
+ "type": "string",
272
+ "default": "",
273
+ "description": "GitHub App OAuth client secret; the TEAMCLAW_GITHUB_CLIENT_SECRET environment variable takes precedence"
274
+ },
222
275
  "agentIsolationMode": {
223
276
  "type": "string",
224
277
  "enum": [
@@ -273,7 +326,8 @@
273
326
  "devops",
274
327
  "security-engineer",
275
328
  "designer",
276
- "marketing"
329
+ "marketing",
330
+ "data-engineer"
277
331
  ]
278
332
  }
279
333
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamclaws/teamclaw",
3
- "version": "2026.4.3-2",
3
+ "version": "2026.5.0",
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
- "tsconfig.json"
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.3.24",
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: 1800000,
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,
@@ -69,6 +76,16 @@ function buildConfigSchema() {
69
76
  default: "teamclaw@local",
70
77
  description: "Git author email used for TeamClaw-managed workspace commits",
71
78
  },
79
+ githubClientId: {
80
+ type: "string" as const,
81
+ default: "Iv23liqWmzrS3swGiIvK",
82
+ description: "GitHub App OAuth client ID for the GitHub login feature",
83
+ },
84
+ githubClientSecret: {
85
+ type: "string" as const,
86
+ default: "",
87
+ description: "GitHub App OAuth client secret; the TEAMCLAW_GITHUB_CLIENT_SECRET environment variable takes precedence",
88
+ },
72
89
  agentIsolationMode: {
73
90
  type: "string" as const,
74
91
  enum: ["independent", "main"],
@@ -227,6 +244,11 @@ function buildConfigSchema() {
227
244
  label: "Task Stall Threshold",
228
245
  help: "In milliseconds, how long TeamClaw waits without visible progress before probing the task instead of failing it",
229
246
  },
247
+ maxConcurrentTasks: {
248
+ label: "Max Concurrent Tasks",
249
+ hint: "number",
250
+ help: "Maximum number of tasks that can be in 'in_progress' status at the same time (1–50)",
251
+ },
230
252
  gitEnabled: {
231
253
  label: "Git Collaboration",
232
254
  help: "Enable automatic git-backed workspace bootstrapping and worker repo sync",
@@ -247,6 +269,15 @@ function buildConfigSchema() {
247
269
  label: "Git Author Email",
248
270
  help: "Author email for TeamClaw-managed workspace commits",
249
271
  },
272
+ githubClientId: {
273
+ label: "GitHub Client ID",
274
+ help: "GitHub App OAuth client ID used by the GitHub login feature",
275
+ },
276
+ githubClientSecret: {
277
+ label: "GitHub Client Secret",
278
+ hint: "optional - prefer the TEAMCLAW_GITHUB_CLIENT_SECRET env var",
279
+ help: "GitHub App OAuth client secret; the TEAMCLAW_GITHUB_CLIENT_SECRET environment variable takes precedence",
280
+ },
250
281
  agentIsolationMode: {
251
282
  label: "Agent Isolation Mode",
252
283
  help: "Use a dedicated TeamClaw agent/workspace by default, or the legacy shared main-agent mode",
@@ -5,7 +5,7 @@ import type { KickoffAssessment, PluginConfig, RoleId, TeamState } from "../type
5
5
  import { loadTeamState, saveTeamState } from "../state.js";
6
6
  import { MDnsAdvertiser } from "../discovery.js";
7
7
  import { WORKER_TIMEOUT_MS } from "../protocol.js";
8
- import { createControllerHttpServer } from "./http-server.js";
8
+ import { createControllerHttpServer, autoAssignPendingTasks } from "./http-server.js";
9
9
  import { TaskRouter } from "./task-router.js";
10
10
  import { MessageRouter } from "./message-router.js";
11
11
  import { TeamWebSocketServer } from "./websocket.js";
@@ -15,6 +15,8 @@ import { WorkerProvisioningManager } from "./worker-provisioning.js";
15
15
  import { PreviewManager } from "./preview-manager.js";
16
16
  import { runKickoffMeeting, buildKickoffAssessmentPrompt, ASSESSMENT_TIMEOUT_MS } from "./kickoff-orchestrator.js";
17
17
  import { resolvePreferredLanAddress } from "../networking.js";
18
+ import { createTeamAutoScheduler, type TeamAutoScheduler } from "../teamauto/scheduler.js";
19
+ import { getGithubAuthManager } from "./github-auth.js";
18
20
 
19
21
  export type KickoffHandler = (
20
22
  candidateRoles: RoleId[],
@@ -50,11 +52,13 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
50
52
  let wsServer: TeamWebSocketServer;
51
53
  let timeoutTimer: ReturnType<typeof setInterval> | null = null;
52
54
  let workerProvisioningManager: WorkerProvisioningManager | null = null;
55
+ let teamAutoSchedulerRef: TeamAutoScheduler | null = null;
53
56
  let previewManager: PreviewManager;
54
57
 
55
58
  return {
56
59
  id: "teamclaw-controller",
57
60
  async start(_ctx: OpenClawPluginServiceContext) {
61
+ const serviceStartedAt = Date.now();
58
62
  await ensureOpenClawWorkspaceMemoryDir(logger);
59
63
  const repoState = await ensureControllerGitRepo(config, logger).catch((err) => {
60
64
  logger.warn(`Controller: failed to prepare git collaboration repo: ${err instanceof Error ? err.message : String(err)}`);
@@ -93,6 +97,27 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
93
97
  return teamState!;
94
98
  };
95
99
 
100
+ // Provisioned workers die with the previous gateway process. Their
101
+ // persisted entries flip to offline once heartbeats stop but were
102
+ // never removed, so every gateway restart accumulated ghost rows in
103
+ // the workers list. Clear them on startup: provisioned-* entries that
104
+ // are offline (or whose heartbeat predates this process) cannot be
105
+ // alive because no worker for them exists yet.
106
+ const ghostWorkerIds = Object.values(teamState.workers)
107
+ .filter((worker) =>
108
+ worker.id.startsWith("provisioned-")
109
+ && (worker.status === "offline" || !worker.lastHeartbeat || worker.lastHeartbeat < serviceStartedAt),
110
+ )
111
+ .map((worker) => worker.id);
112
+ if (ghostWorkerIds.length > 0) {
113
+ updateState((state) => {
114
+ for (const workerId of ghostWorkerIds) {
115
+ delete state.workers[workerId];
116
+ }
117
+ });
118
+ logger.info(`Controller: removed ${ghostWorkerIds.length} stale provisioned worker record(s) from a previous gateway process`);
119
+ }
120
+
96
121
  workerProvisioningManager = new WorkerProvisioningManager({
97
122
  config,
98
123
  logger,
@@ -117,6 +142,9 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
117
142
 
118
143
  // Clean up orphaned tasks — tasks assigned to workers that no longer
119
144
  // exist OR that are offline (stale entries surviving from a previous run).
145
+ // Resume support: instead of silently restarting, keep the checkpoint and
146
+ // count resume attempts; past MAX the task fails fast instead of looping.
147
+ const MAX_RESUME_ATTEMPTS = 3;
120
148
  {
121
149
  let orphanCleaned = false;
122
150
  for (const task of Object.values(teamState.tasks)) {
@@ -126,9 +154,22 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
126
154
  ) {
127
155
  const worker = teamState.workers[task.assignedWorkerId];
128
156
  if (!worker || worker.status === "offline") {
129
- logger.info(`Controller: resetting orphaned task ${task.id} (worker ${task.assignedWorkerId} ${worker ? "offline" : "missing"})`);
157
+ const attempt = (task.resumeAttempt ?? 0) + 1;
158
+ if (attempt > MAX_RESUME_ATTEMPTS) {
159
+ logger.warn(`Controller: task ${task.id} exceeded ${MAX_RESUME_ATTEMPTS} resume attempts - failing`);
160
+ task.status = "failed";
161
+ task.error = `resumed ${MAX_RESUME_ATTEMPTS} times without completing (last checkpoint: ${task.checkpoint?.lastAssistantMessage?.slice(0, 200) ?? "none"})`;
162
+ task.updatedAt = Date.now();
163
+ orphanCleaned = true;
164
+ continue;
165
+ }
166
+ logger.info(`Controller: resetting orphaned task ${task.id} for resume attempt ${attempt} (worker ${task.assignedWorkerId} ${worker ? "offline" : "missing"})`);
130
167
  task.status = "pending";
131
168
  task.assignedWorkerId = undefined;
169
+ task.resumeAttempt = attempt;
170
+ if (task.checkpoint) {
171
+ task.checkpoint.attempt = attempt;
172
+ }
132
173
  task.updatedAt = Date.now();
133
174
  orphanCleaned = true;
134
175
  }
@@ -167,6 +208,7 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
167
208
  workerProvisioningManager,
168
209
  previewManager,
169
210
  getKickoffHandler: () => serviceKickoffHandler,
211
+ getTeamAutoScheduler: () => teamAutoSchedulerRef,
170
212
  });
171
213
 
172
214
  const PORT_RETRY_STEP = 10;
@@ -212,6 +254,24 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
212
254
  workerProvisioningManager.setActualPort(actualPort);
213
255
  }
214
256
 
257
+ // TeamAuto: autonomous repo collaboration (bind repos via /api/v1/teamauto/*).
258
+ try {
259
+ const auth = getGithubAuthManager(config, logger);
260
+ const httpDepsForAutoAssign = { config, logger, getTeamState: () => teamState, updateTeamState: updateState, taskRouter, messageRouter, wsServer } as Parameters<typeof autoAssignPendingTasks>[0];
261
+ teamAutoSchedulerRef = createTeamAutoScheduler({
262
+ logger,
263
+ auth,
264
+ getTeamState: () => teamState,
265
+ updateTeamState: updateState,
266
+ onTasksCreated: async () => {
267
+ await autoAssignPendingTasks(httpDepsForAutoAssign);
268
+ },
269
+ });
270
+ await teamAutoSchedulerRef.start();
271
+ } catch (err) {
272
+ logger.warn(`Controller: TeamAuto scheduler failed to start: ${err instanceof Error ? err.message : String(err)}`);
273
+ }
274
+
215
275
  // Start mDNS advertising with the actual port
216
276
  await mdnsAdvertiser.start(actualPort, config.teamName);
217
277
 
@@ -307,6 +367,10 @@ export function createControllerService(deps: ControllerServiceDeps): OpenClawPl
307
367
  clearInterval(timeoutTimer);
308
368
  timeoutTimer = null;
309
369
  }
370
+ try {
371
+ await teamAutoSchedulerRef?.stop();
372
+ } catch { /* scheduler already stopped */ }
373
+ teamAutoSchedulerRef = null;
310
374
  if (workerProvisioningManager) {
311
375
  await workerProvisioningManager.stop();
312
376
  }