@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/src/roles.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { RoleDefinition, RoleId } from "./types.js";
|
|
2
2
|
import { buildRoleOperatingRules, buildWorkerMemoryContractRules, composePrompt } from "./prompt-policy.js";
|
|
3
3
|
|
|
4
|
+
const TEAMCLAW_ROLE_IDS_TEXT = [
|
|
5
|
+
"pm",
|
|
6
|
+
"architect",
|
|
7
|
+
"developer",
|
|
8
|
+
"qa",
|
|
9
|
+
"release-engineer",
|
|
10
|
+
"infra-engineer",
|
|
11
|
+
"devops",
|
|
12
|
+
"security-engineer",
|
|
13
|
+
"designer",
|
|
14
|
+
"marketing",
|
|
15
|
+
"data-engineer",
|
|
16
|
+
];
|
|
17
|
+
|
|
4
18
|
const ROLES: RoleDefinition[] = [
|
|
5
19
|
{
|
|
6
20
|
id: "pm",
|
|
@@ -257,6 +271,44 @@ const ROLES: RoleDefinition[] = [
|
|
|
257
271
|
].join("\n"),
|
|
258
272
|
suggestedNextRoles: ["pm", "designer"],
|
|
259
273
|
},
|
|
274
|
+
{
|
|
275
|
+
id: "data-engineer",
|
|
276
|
+
label: "Data Engineer",
|
|
277
|
+
icon: "\uD83D\uDCCA",
|
|
278
|
+
description: "Data pipeline design, ETL, data modeling",
|
|
279
|
+
capabilities: [
|
|
280
|
+
"data-modeling", "etl-pipeline", "data-quality", "sql-optimization",
|
|
281
|
+
],
|
|
282
|
+
recommendedSkills: ["find-skills"],
|
|
283
|
+
systemPrompt: [
|
|
284
|
+
"You are a Data Engineer in a virtual software team.",
|
|
285
|
+
"Your core responsibilities include designing, building, and maintaining data pipelines,",
|
|
286
|
+
"ETL processes, data models, and ensuring data quality across systems.",
|
|
287
|
+
"",
|
|
288
|
+
"Scope of expertise:",
|
|
289
|
+
"- Data Pipeline Design: batch and streaming pipelines (Apache Spark, Airflow, dbt, Flink, Kafka)",
|
|
290
|
+
"- ETL/ELT Processes: extraction, transformation, loading patterns; incremental vs. full refresh strategies",
|
|
291
|
+
"- Data Modeling: dimensional modeling (star/snowflake schemas), Data Vault, event-sourced modeling, normalization vs. denormalization trade-offs",
|
|
292
|
+
"- Data Quality: validation frameworks, anomaly detection, data profiling, SLA monitoring, lineage tracking",
|
|
293
|
+
"- SQL Optimization: query performance tuning, indexing strategies, execution plan analysis, partitioning",
|
|
294
|
+
"- Data Storage: relational databases (PostgreSQL, MySQL), data warehouses (Snowflake, BigQuery, Redshift), data lakes (Delta Lake, Iceberg, Hudi)",
|
|
295
|
+
"- Orchestration: workflow scheduling, dependency management, idempotent pipeline design, backfill strategies",
|
|
296
|
+
"- Data Integration: API ingestion, CDC (Change Data Capture), schema evolution, data contracts",
|
|
297
|
+
"",
|
|
298
|
+
"When receiving tasks:",
|
|
299
|
+
"1. Always produce concrete, actionable data specifications (not vague guidance).",
|
|
300
|
+
"2. Include schema definitions (DDL), pipeline DAGs or flow diagrams (in ASCII/mermaid if helpful), and configuration snippets.",
|
|
301
|
+
"3. Consider data freshness, latency, and throughput requirements when choosing pipeline architectures.",
|
|
302
|
+
"4. Design for data quality from the start: include validation checks, monitoring, and alerting in every pipeline.",
|
|
303
|
+
"5. Prefer idempotent and reversible transformations to simplify recovery and debugging.",
|
|
304
|
+
"6. Document data lineage and ownership so downstream consumers can trace data origins.",
|
|
305
|
+
"7. Collaborate closely with Developers on data API contracts and with Architects on storage infrastructure.",
|
|
306
|
+
"8. If the required data sources, credentials, or infrastructure are unavailable in the current environment, explicitly report the blocker and request clarification instead of inventing a nonexistent system.",
|
|
307
|
+
"",
|
|
308
|
+
"Output format: Provide structured specifications with clear sections for pipeline architecture, data models (schema DDL), quality rules, and operational runbooks.",
|
|
309
|
+
].join("\n"),
|
|
310
|
+
suggestedNextRoles: ["developer", "infra-engineer"],
|
|
311
|
+
},
|
|
260
312
|
];
|
|
261
313
|
|
|
262
314
|
for (const role of ROLES) {
|
package/src/state.ts
CHANGED
|
@@ -2,12 +2,74 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import type {
|
|
5
|
+
RoleId,
|
|
5
6
|
StartupProvisioningReadiness,
|
|
6
7
|
TeamProvisioningState,
|
|
7
8
|
TeamState,
|
|
8
9
|
WorkerIdentity,
|
|
9
10
|
} from "./types.js";
|
|
10
11
|
|
|
12
|
+
const STATE_VERSION = 2;
|
|
13
|
+
|
|
14
|
+
function migrateState(raw: unknown): TeamState | null {
|
|
15
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const state = raw as Record<string, unknown>;
|
|
19
|
+
|
|
20
|
+
// Basic structural guard — same checks as the old loadTeamState
|
|
21
|
+
if (
|
|
22
|
+
typeof state.teamName !== "string" ||
|
|
23
|
+
typeof state.createdAt !== "number" ||
|
|
24
|
+
typeof state.updatedAt !== "number" ||
|
|
25
|
+
!state.workers ||
|
|
26
|
+
!state.tasks
|
|
27
|
+
) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Ensure required nested objects exist (defensive, same as before)
|
|
32
|
+
if (!state.controllerRuns || typeof state.controllerRuns !== "object") {
|
|
33
|
+
state.controllerRuns = {};
|
|
34
|
+
}
|
|
35
|
+
if (!state.projects || typeof state.projects !== "object") {
|
|
36
|
+
state.projects = {};
|
|
37
|
+
}
|
|
38
|
+
if (!Array.isArray(state.messages)) {
|
|
39
|
+
state.messages = [];
|
|
40
|
+
}
|
|
41
|
+
if (!state.clarifications || typeof state.clarifications !== "object") {
|
|
42
|
+
state.clarifications = {};
|
|
43
|
+
}
|
|
44
|
+
if (state.repo && typeof state.repo !== "object") {
|
|
45
|
+
delete state.repo;
|
|
46
|
+
}
|
|
47
|
+
if (!state.provisioning || typeof state.provisioning !== "object") {
|
|
48
|
+
state.provisioning = createEmptyProvisioningState();
|
|
49
|
+
} else {
|
|
50
|
+
const prov = state.provisioning as Record<string, unknown>;
|
|
51
|
+
if (!prov.workers || typeof prov.workers !== "object") {
|
|
52
|
+
prov.workers = {};
|
|
53
|
+
}
|
|
54
|
+
prov.startupReadiness = normalizeStartupReadiness(prov.startupReadiness);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const version = typeof state.version === "number" ? state.version : 1;
|
|
58
|
+
|
|
59
|
+
if (version > STATE_VERSION) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`Saved team state is version ${version}, but this software only supports up to version ${STATE_VERSION}. ` +
|
|
62
|
+
"Please update TeamClaw to a newer version that supports this state format.",
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Version 1 → 2: no new required fields beyond `version` itself.
|
|
67
|
+
// startupReadiness was already optional and handled by normalizeStartupReadiness above.
|
|
68
|
+
state.version = STATE_VERSION;
|
|
69
|
+
|
|
70
|
+
return state as unknown as TeamState;
|
|
71
|
+
}
|
|
72
|
+
|
|
11
73
|
function resolvePluginStateDir(): string {
|
|
12
74
|
const explicitStateDir = process.env.OPENCLAW_STATE_DIR?.trim();
|
|
13
75
|
if (explicitStateDir) {
|
|
@@ -54,7 +116,7 @@ function normalizeStartupReadiness(value: unknown): StartupProvisioningReadiness
|
|
|
54
116
|
startedAt,
|
|
55
117
|
checkedAt,
|
|
56
118
|
attempts,
|
|
57
|
-
requiredRoles,
|
|
119
|
+
requiredRoles: requiredRoles as RoleId[],
|
|
58
120
|
readyWorkerIds,
|
|
59
121
|
message,
|
|
60
122
|
};
|
|
@@ -87,39 +149,8 @@ async function loadTeamState(teamName: string): Promise<TeamState | null> {
|
|
|
87
149
|
const filePath = path.join(STATE_DIR, `${teamName}-team-state.json`);
|
|
88
150
|
try {
|
|
89
151
|
const raw = await fs.readFile(filePath, "utf8");
|
|
90
|
-
const parsed = JSON.parse(raw)
|
|
91
|
-
|
|
92
|
-
typeof parsed.teamName !== "string" ||
|
|
93
|
-
typeof parsed.createdAt !== "number" ||
|
|
94
|
-
typeof parsed.updatedAt !== "number" ||
|
|
95
|
-
!parsed.workers ||
|
|
96
|
-
!parsed.tasks
|
|
97
|
-
) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
if (!parsed.controllerRuns || typeof parsed.controllerRuns !== "object") {
|
|
101
|
-
parsed.controllerRuns = {};
|
|
102
|
-
}
|
|
103
|
-
if (!parsed.projects || typeof parsed.projects !== "object") {
|
|
104
|
-
parsed.projects = {};
|
|
105
|
-
}
|
|
106
|
-
if (!Array.isArray(parsed.messages)) {
|
|
107
|
-
parsed.messages = [];
|
|
108
|
-
}
|
|
109
|
-
if (!parsed.clarifications || typeof parsed.clarifications !== "object") {
|
|
110
|
-
parsed.clarifications = {};
|
|
111
|
-
}
|
|
112
|
-
if (parsed.repo && typeof parsed.repo !== "object") {
|
|
113
|
-
delete parsed.repo;
|
|
114
|
-
}
|
|
115
|
-
if (!parsed.provisioning || typeof parsed.provisioning !== "object") {
|
|
116
|
-
parsed.provisioning = createEmptyProvisioningState();
|
|
117
|
-
}
|
|
118
|
-
if (!parsed.provisioning.workers || typeof parsed.provisioning.workers !== "object") {
|
|
119
|
-
parsed.provisioning.workers = {};
|
|
120
|
-
}
|
|
121
|
-
parsed.provisioning.startupReadiness = normalizeStartupReadiness(parsed.provisioning.startupReadiness);
|
|
122
|
-
return parsed;
|
|
152
|
+
const parsed = JSON.parse(raw);
|
|
153
|
+
return migrateState(parsed);
|
|
123
154
|
} catch {
|
|
124
155
|
return null;
|
|
125
156
|
}
|
|
@@ -128,6 +159,7 @@ async function loadTeamState(teamName: string): Promise<TeamState | null> {
|
|
|
128
159
|
async function saveTeamState(state: TeamState): Promise<void> {
|
|
129
160
|
await ensureDir(STATE_DIR);
|
|
130
161
|
const filePath = path.join(STATE_DIR, `${state.teamName}-team-state.json`);
|
|
162
|
+
state.version = STATE_VERSION;
|
|
131
163
|
state.updatedAt = Date.now();
|
|
132
164
|
state.provisioning = state.provisioning && typeof state.provisioning === "object"
|
|
133
165
|
? state.provisioning
|
package/src/task-executor.ts
CHANGED
|
@@ -14,6 +14,12 @@ import {
|
|
|
14
14
|
import { getRole } from "./roles.js";
|
|
15
15
|
import type { RoleId, TaskAssignmentPayload, TaskExecutionEventInput, WorkerTaskResultContract } from "./types.js";
|
|
16
16
|
|
|
17
|
+
const TEAMCLAW_ROLE_IDS_TEXT = [
|
|
18
|
+
"pm", "architect", "developer", "qa",
|
|
19
|
+
"release-engineer", "infra-engineer", "devops", "security-engineer",
|
|
20
|
+
"designer", "marketing", "data-engineer",
|
|
21
|
+
];
|
|
22
|
+
|
|
17
23
|
const SESSION_PROGRESS_POLL_INTERVAL_MS = 1000;
|
|
18
24
|
const SESSION_PROGRESS_MESSAGE_LIMIT = 200;
|
|
19
25
|
const MAX_SESSION_PROGRESS_MESSAGE_CHARS = 4000;
|
|
@@ -58,11 +64,15 @@ export type TaskExecutorResult = {
|
|
|
58
64
|
contract?: Record<string, unknown>;
|
|
59
65
|
};
|
|
60
66
|
|
|
67
|
+
import type { PluginConfig } from "./types.js";
|
|
68
|
+
|
|
61
69
|
export type RoleTaskExecutorDeps = {
|
|
62
70
|
runtime: OpenClawPluginApi["runtime"];
|
|
63
71
|
logger: PluginLogger;
|
|
64
72
|
role: RoleId;
|
|
65
73
|
taskTimeoutMs: number;
|
|
74
|
+
/** Full plugin config; used for per-role model overrides. */
|
|
75
|
+
config?: Pick<PluginConfig, "roleModelOverrides">;
|
|
66
76
|
getSessionKey: (assignment: TaskAssignmentPayload) => string;
|
|
67
77
|
getIdempotencyKey?: (assignment: TaskAssignmentPayload) => string;
|
|
68
78
|
reportExecutionEvent?: (taskId: string, event: TaskExecutionEventInput) => Promise<void> | void;
|
|
@@ -82,6 +92,7 @@ export function createRoleTaskExecutor(deps: RoleTaskExecutorDeps) {
|
|
|
82
92
|
const taskMessage = buildTaskMessage(taskDescription, taskId, roleDef?.label ?? role, {
|
|
83
93
|
inlineContract: true,
|
|
84
94
|
projectDir: assignment.projectDir,
|
|
95
|
+
teamContext: assignment.teamContext,
|
|
85
96
|
});
|
|
86
97
|
const workspaceDir = resolveTeamClawWorkspaceDir();
|
|
87
98
|
logger.info(`TeamClaw: executing task ${taskId} as ${role} via subagent`);
|
|
@@ -89,10 +100,30 @@ export function createRoleTaskExecutor(deps: RoleTaskExecutorDeps) {
|
|
|
89
100
|
function buildSubagentRunOptions(
|
|
90
101
|
options: Parameters<typeof runtime.subagent.run>[0],
|
|
91
102
|
): Parameters<typeof runtime.subagent.run>[0] {
|
|
92
|
-
|
|
103
|
+
// OpenClaw 2026.10+ renamed the subagent working-directory override from
|
|
104
|
+
// `workspaceDir` to `cwd`. Pass both so the run lands in the project
|
|
105
|
+
// workspace on legacy and current hosts (each host ignores the key it
|
|
106
|
+
// does not know).
|
|
107
|
+
const enrichedOptions: Parameters<typeof runtime.subagent.run>[0] & {
|
|
108
|
+
workspaceDir?: string;
|
|
109
|
+
cwd?: string;
|
|
110
|
+
} = {
|
|
93
111
|
...options,
|
|
94
112
|
workspaceDir,
|
|
113
|
+
cwd: options.cwd ?? workspaceDir,
|
|
95
114
|
};
|
|
115
|
+
// Per-role model override ("provider/model"): takes precedence over the
|
|
116
|
+
// teamclaw agent entry model for this role's subagent runs.
|
|
117
|
+
const roleModel = deps.config?.roleModelOverrides?.[role];
|
|
118
|
+
if (roleModel) {
|
|
119
|
+
const slashIndex = roleModel.indexOf("/");
|
|
120
|
+
if (slashIndex > 0) {
|
|
121
|
+
enrichedOptions.provider = roleModel.slice(0, slashIndex);
|
|
122
|
+
enrichedOptions.model = roleModel.slice(slashIndex + 1);
|
|
123
|
+
} else {
|
|
124
|
+
enrichedOptions.model = roleModel;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
96
127
|
return enrichedOptions;
|
|
97
128
|
}
|
|
98
129
|
|
|
@@ -891,10 +922,11 @@ function buildTaskMessage(
|
|
|
891
922
|
taskDescription: string,
|
|
892
923
|
taskId: string,
|
|
893
924
|
roleLabel: string,
|
|
894
|
-
options?: { inlineContract?: boolean; projectDir?: string },
|
|
925
|
+
options?: { inlineContract?: boolean; projectDir?: string; teamContext?: TaskAssignmentPayload["teamContext"] },
|
|
895
926
|
): string {
|
|
896
927
|
const rules = [
|
|
897
928
|
...buildTaskExecutionRules(RATE_LIMIT_WAITING_SENTINEL),
|
|
929
|
+
"Before your final reply, you MUST call teamclaw_submit_result_contract to deliver the structured result for this task. Do not end your turn without it.",
|
|
898
930
|
...buildWorkerMemoryContractRules(),
|
|
899
931
|
...buildVerificationPolicy(),
|
|
900
932
|
...buildDeliverableMetadataPolicy(),
|
|
@@ -925,6 +957,65 @@ function buildTaskMessage(
|
|
|
925
957
|
);
|
|
926
958
|
}
|
|
927
959
|
|
|
960
|
+
if (options?.teamContext) {
|
|
961
|
+
const contextLines: string[] = [];
|
|
962
|
+
if (options.teamContext.requirementSummary) {
|
|
963
|
+
contextLines.push(`Requirement summary: ${options.teamContext.requirementSummary}`);
|
|
964
|
+
}
|
|
965
|
+
if (options.teamContext.projectName) {
|
|
966
|
+
contextLines.push(`Project name: ${options.teamContext.projectName}`);
|
|
967
|
+
}
|
|
968
|
+
if (options.teamContext.requiredRoles && options.teamContext.requiredRoles.length > 0) {
|
|
969
|
+
contextLines.push(`Required TeamClaw roles: ${options.teamContext.requiredRoles.join(", ")}`);
|
|
970
|
+
}
|
|
971
|
+
const appendTaskBucket = (
|
|
972
|
+
label: string,
|
|
973
|
+
entries: Array<{ id: string; title: string; assignedRole?: string; status: string; summary?: string }> | undefined,
|
|
974
|
+
) => {
|
|
975
|
+
if (!entries || entries.length === 0) {
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
contextLines.push("", label);
|
|
979
|
+
for (const entry of entries) {
|
|
980
|
+
const roleText = entry.assignedRole ? ` (${entry.assignedRole})` : "";
|
|
981
|
+
const summaryText = entry.summary ? `: ${entry.summary}` : "";
|
|
982
|
+
contextLines.push(`- [${entry.id}] ${entry.title}${roleText} [${entry.status}]${summaryText}`);
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
appendTaskBucket("Active same-requirement tasks:", options.teamContext.activeTasks);
|
|
986
|
+
appendTaskBucket("Blocked same-requirement tasks:", options.teamContext.blockedTasks);
|
|
987
|
+
appendTaskBucket("Recent completed upstream tasks:", options.teamContext.recentCompletedTasks);
|
|
988
|
+
if (options.teamContext.pendingClarifications && options.teamContext.pendingClarifications.length > 0) {
|
|
989
|
+
contextLines.push("", "Pending clarifications:");
|
|
990
|
+
for (const clarification of options.teamContext.pendingClarifications) {
|
|
991
|
+
contextLines.push(`- ${clarification.question}${clarification.blockingReason ? ` — ${clarification.blockingReason}` : ""}`);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
if (options.teamContext.answeredClarifications && options.teamContext.answeredClarifications.length > 0) {
|
|
995
|
+
contextLines.push("", "Recently answered clarifications (treat these as authoritative and do not ask the same question again unless the answer is still objectively missing or invalid):");
|
|
996
|
+
for (const clarification of options.teamContext.answeredClarifications) {
|
|
997
|
+
const meta = [
|
|
998
|
+
clarification.answeredBy ? `answered by ${clarification.answeredBy}` : "",
|
|
999
|
+
clarification.blockingReason ? `was blocked by ${clarification.blockingReason}` : "",
|
|
1000
|
+
].filter(Boolean).join("; ");
|
|
1001
|
+
contextLines.push(`- Q: ${clarification.question}`);
|
|
1002
|
+
contextLines.push(` A: ${clarification.answer}${meta ? ` (${meta})` : ""}`);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
if (options.teamContext.kickoffSummary) {
|
|
1006
|
+
contextLines.push("", "Team kickoff consensus:", options.teamContext.kickoffSummary);
|
|
1007
|
+
}
|
|
1008
|
+
if (options.teamContext.handoffPlan) {
|
|
1009
|
+
contextLines.push("", `Current handoff plan: ${options.teamContext.handoffPlan}`);
|
|
1010
|
+
}
|
|
1011
|
+
if (options.teamContext.notes) {
|
|
1012
|
+
contextLines.push("", `Controller notes: ${options.teamContext.notes}`);
|
|
1013
|
+
}
|
|
1014
|
+
if (contextLines.length > 0) {
|
|
1015
|
+
sections.push("", "## TeamClaw Requirement Context", ...contextLines);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
928
1019
|
sections.push("", "## Execution Rules", ...rules);
|
|
929
1020
|
return sections.join("\n");
|
|
930
1021
|
}
|
package/src/types.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type TaskStatus =
|
|
|
15
15
|
|
|
16
16
|
export type TaskPriority = "low" | "medium" | "high" | "critical";
|
|
17
17
|
|
|
18
|
-
export type TaskExecutionEventType = "lifecycle" | "progress" | "output" | "error";
|
|
18
|
+
export type TaskExecutionEventType = "lifecycle" | "progress" | "output" | "error" | "warning";
|
|
19
19
|
|
|
20
20
|
export type TaskExecutionStatus = "pending" | "running" | "completed" | "failed";
|
|
21
21
|
|
|
@@ -73,7 +73,8 @@ export type RoleId =
|
|
|
73
73
|
| "devops"
|
|
74
74
|
| "security-engineer"
|
|
75
75
|
| "designer"
|
|
76
|
-
| "marketing"
|
|
76
|
+
| "marketing"
|
|
77
|
+
| "data-engineer";
|
|
77
78
|
|
|
78
79
|
export type RoleDefinition = {
|
|
79
80
|
id: RoleId;
|
|
@@ -109,6 +110,7 @@ export type TaskInfo = {
|
|
|
109
110
|
assignedWorkerId?: string;
|
|
110
111
|
createdBy: string;
|
|
111
112
|
recommendedSkills?: string[];
|
|
113
|
+
controllerRunId?: string;
|
|
112
114
|
controllerSessionKey?: string;
|
|
113
115
|
projectId?: string;
|
|
114
116
|
projectDir?: string;
|
|
@@ -156,6 +158,7 @@ export type TaskAssignmentPayload = {
|
|
|
156
158
|
blockedTasks?: Array<{ id: string; title: string; assignedRole?: RoleId; status: TaskStatus; summary?: string }>;
|
|
157
159
|
recentCompletedTasks?: Array<{ id: string; title: string; assignedRole?: RoleId; status: TaskStatus; summary?: string }>;
|
|
158
160
|
pendingClarifications?: Array<{ question: string; blockingReason?: string }>;
|
|
161
|
+
answeredClarifications?: Array<{ question: string; answer: string; answeredBy?: string; blockingReason?: string }>;
|
|
159
162
|
handoffPlan?: string;
|
|
160
163
|
notes?: string;
|
|
161
164
|
kickoffSummary?: string;
|
|
@@ -272,6 +275,10 @@ export type KickoffPlan = {
|
|
|
272
275
|
assessments: KickoffAssessment[];
|
|
273
276
|
/** Whether the kickoff phase has completed. */
|
|
274
277
|
completed: boolean;
|
|
278
|
+
/** Optional controller summary captured after the kickoff phase. */
|
|
279
|
+
summary?: string;
|
|
280
|
+
/** Timestamp (ms) recording when the kickoff phase was triggered. */
|
|
281
|
+
triggeredAt?: number;
|
|
275
282
|
};
|
|
276
283
|
|
|
277
284
|
export type ControllerManifestCreatedTask = {
|
|
@@ -470,6 +477,12 @@ export type PluginConfig = {
|
|
|
470
477
|
teamName: string;
|
|
471
478
|
heartbeatIntervalMs: number;
|
|
472
479
|
processModel: ProcessModel;
|
|
480
|
+
/**
|
|
481
|
+
* Optional per-role model overrides as "provider/model" strings. When set,
|
|
482
|
+
* task execution for that role passes provider/model to subagent.run;
|
|
483
|
+
* otherwise the teamclaw agent entry model applies.
|
|
484
|
+
*/
|
|
485
|
+
roleModelOverrides?: Partial<Record<RoleId, string>>;
|
|
473
486
|
taskTimeoutMs: number;
|
|
474
487
|
gitEnabled: boolean;
|
|
475
488
|
gitRemoteUrl: string;
|
|
@@ -499,6 +512,7 @@ export type PluginConfig = {
|
|
|
499
512
|
workerProvisioningKubernetesWorkspacePersistentVolumeClaim: string;
|
|
500
513
|
workerProvisioningKubernetesLabels: Record<string, string>;
|
|
501
514
|
workerProvisioningKubernetesAnnotations: Record<string, string>;
|
|
515
|
+
maxConcurrentTasks: number;
|
|
502
516
|
};
|
|
503
517
|
|
|
504
518
|
export type WorkerIdentity = {
|
|
@@ -509,6 +523,8 @@ export type WorkerIdentity = {
|
|
|
509
523
|
};
|
|
510
524
|
|
|
511
525
|
export type TeamState = {
|
|
526
|
+
/** Schema version for forward-compatible state migration. */
|
|
527
|
+
version?: number;
|
|
512
528
|
teamName: string;
|
|
513
529
|
workers: Record<string, WorkerInfo>;
|
|
514
530
|
tasks: Record<string, TaskInfo>;
|
|
@@ -569,6 +585,21 @@ export type HeartbeatPayload = {
|
|
|
569
585
|
timestamp: number;
|
|
570
586
|
};
|
|
571
587
|
|
|
588
|
+
function parseRoleModelOverrides(raw: unknown): Partial<Record<RoleId, string>> | undefined {
|
|
589
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
590
|
+
return undefined;
|
|
591
|
+
}
|
|
592
|
+
const result: Partial<Record<RoleId, string>> = {};
|
|
593
|
+
let hasAny = false;
|
|
594
|
+
for (const [key, value] of Object.entries(raw as Record<string, unknown>)) {
|
|
595
|
+
if (VALID_ROLES.includes(key as RoleId) && typeof value === "string" && value.trim()) {
|
|
596
|
+
result[key as RoleId] = value.trim();
|
|
597
|
+
hasAny = true;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return hasAny ? result : undefined;
|
|
601
|
+
}
|
|
602
|
+
|
|
572
603
|
export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConfig {
|
|
573
604
|
const mode = (typeof raw.mode === "string" && (raw.mode === "controller" || raw.mode === "worker"))
|
|
574
605
|
? raw.mode
|
|
@@ -598,7 +629,7 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
598
629
|
|
|
599
630
|
const taskTimeoutMs = typeof raw.taskTimeoutMs === "number" && raw.taskTimeoutMs >= 1000
|
|
600
631
|
? raw.taskTimeoutMs
|
|
601
|
-
:
|
|
632
|
+
: 600_000;
|
|
602
633
|
|
|
603
634
|
const gitEnabled = typeof raw.gitEnabled === "boolean" ? raw.gitEnabled : true;
|
|
604
635
|
|
|
@@ -695,6 +726,20 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
695
726
|
const workerProvisioningKubernetesLabels = parseStringRecord(raw.workerProvisioningKubernetesLabels);
|
|
696
727
|
const workerProvisioningKubernetesAnnotations = parseStringRecord(raw.workerProvisioningKubernetesAnnotations);
|
|
697
728
|
|
|
729
|
+
const rawMaxConcurrentTasks = raw.maxConcurrentTasks;
|
|
730
|
+
let maxConcurrentTasks: number;
|
|
731
|
+
if (rawMaxConcurrentTasks === undefined) {
|
|
732
|
+
maxConcurrentTasks = 5;
|
|
733
|
+
} else if (typeof rawMaxConcurrentTasks !== "number" || !Number.isInteger(rawMaxConcurrentTasks)) {
|
|
734
|
+
throw new Error(`maxConcurrentTasks must be an integer between 1 and 50, got ${rawMaxConcurrentTasks}`);
|
|
735
|
+
} else if (rawMaxConcurrentTasks < 1) {
|
|
736
|
+
throw new Error(`maxConcurrentTasks must be an integer between 1 and 50, got ${rawMaxConcurrentTasks}`);
|
|
737
|
+
} else if (rawMaxConcurrentTasks > 50) {
|
|
738
|
+
throw new Error(`maxConcurrentTasks must be an integer between 1 and 50, got ${rawMaxConcurrentTasks}`);
|
|
739
|
+
} else {
|
|
740
|
+
maxConcurrentTasks = rawMaxConcurrentTasks;
|
|
741
|
+
}
|
|
742
|
+
|
|
698
743
|
return {
|
|
699
744
|
mode,
|
|
700
745
|
port,
|
|
@@ -703,6 +748,7 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
703
748
|
teamName,
|
|
704
749
|
heartbeatIntervalMs,
|
|
705
750
|
processModel,
|
|
751
|
+
roleModelOverrides: parseRoleModelOverrides(raw.roleModelOverrides),
|
|
706
752
|
taskTimeoutMs,
|
|
707
753
|
gitEnabled,
|
|
708
754
|
gitRemoteUrl,
|
|
@@ -732,6 +778,7 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
732
778
|
workerProvisioningKubernetesWorkspacePersistentVolumeClaim,
|
|
733
779
|
workerProvisioningKubernetesLabels,
|
|
734
780
|
workerProvisioningKubernetesAnnotations,
|
|
781
|
+
maxConcurrentTasks,
|
|
735
782
|
};
|
|
736
783
|
}
|
|
737
784
|
|
|
@@ -794,5 +841,5 @@ const VALID_PROVISIONING_TYPES: WorkerProvisioningType[] = [
|
|
|
794
841
|
const VALID_ROLES: RoleId[] = [
|
|
795
842
|
"pm", "architect", "developer", "qa",
|
|
796
843
|
"release-engineer", "infra-engineer", "devops", "security-engineer",
|
|
797
|
-
"designer", "marketing",
|
|
844
|
+
"designer", "marketing", "data-engineer",
|
|
798
845
|
];
|