@teamclaws/teamclaw 2026.8.0 → 2026.11.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/cli.mjs +46 -15
- package/dist/api.js +1 -0
- package/dist/index.js +325 -0
- package/dist/src/config.js +412 -0
- package/dist/src/controller/clarification-routes.js +315 -0
- package/dist/src/controller/controller-capacity.js +14 -0
- package/dist/src/controller/controller-intake.js +895 -0
- package/dist/src/controller/controller-planning.js +813 -0
- package/dist/src/controller/controller-runs.js +175 -0
- package/dist/src/controller/controller-service.js +624 -0
- package/dist/src/controller/controller-tools.js +587 -0
- package/dist/src/controller/delivery-report.js +458 -0
- package/dist/src/controller/github-auth.js +564 -0
- package/dist/src/controller/http-server.js +284 -0
- package/dist/src/controller/kickoff-orchestrator.js +246 -0
- package/dist/src/controller/managed-gateway-process.js +286 -0
- package/dist/src/controller/message-delivery.js +28 -0
- package/dist/src/controller/message-router.js +38 -0
- package/dist/src/controller/message-routes.js +114 -0
- package/dist/src/controller/orchestration-manifest.js +151 -0
- package/dist/src/controller/preview-manager.js +586 -0
- package/dist/src/controller/preview-proxy.js +98 -0
- package/dist/src/controller/profile-switch.js +289 -0
- package/dist/src/controller/project-registry.js +294 -0
- package/dist/src/controller/prompt-injector.js +197 -0
- package/dist/src/controller/repo-routes.js +63 -0
- package/dist/src/controller/role-inference.js +246 -0
- package/dist/src/controller/route-table.js +1353 -0
- package/dist/src/controller/task-assignment.js +508 -0
- package/dist/src/controller/task-cleanup.js +258 -0
- package/dist/src/controller/task-execution.js +240 -0
- package/dist/src/controller/task-results.js +461 -0
- package/dist/src/controller/task-router.js +137 -0
- package/dist/src/controller/task-routes.js +703 -0
- package/dist/src/controller/teamauto-routes.js +124 -0
- package/dist/src/controller/tunnel-manager.js +548 -0
- package/dist/src/controller/ui-assets.js +68 -0
- package/dist/src/controller/websocket.js +42 -0
- package/dist/src/controller/worker-provisioning.js +1674 -0
- package/dist/src/controller/worker-routes.js +188 -0
- package/dist/src/discovery.js +86 -0
- package/dist/src/git-collaboration.js +694 -0
- package/dist/src/identity.js +132 -0
- package/dist/src/install-defaults.js +1 -0
- package/dist/src/interaction-contracts.js +531 -0
- package/dist/src/networking.js +91 -0
- package/dist/src/openclaw-workspace.js +925 -0
- package/dist/src/profile-loader.js +486 -0
- package/dist/src/profiles/banking.json +178 -0
- package/dist/src/profiles/crossborder-ecom.json +253 -0
- package/dist/src/profiles/insurance.json +157 -0
- package/dist/src/profiles/knowledge/hs-structure.md +97 -0
- package/dist/src/profiles/knowledge/incoterms-2020.md +188 -0
- package/dist/src/profiles/knowledge/vat-principles.md +85 -0
- package/dist/src/profiles/schema.json +201 -0
- package/dist/src/profiles/securities.json +137 -0
- package/dist/src/profiles/software-rd.json +264 -0
- package/dist/src/profiles/trading-co.json +200 -0
- package/dist/src/prompt-policy.js +386 -0
- package/dist/src/protocol.js +58 -0
- package/dist/src/role-ids.js +29 -0
- package/dist/src/roles.js +390 -0
- package/dist/src/session-roles.js +14 -0
- package/dist/src/state.js +361 -0
- package/dist/src/task-executor.js +1023 -0
- package/dist/src/teamauto/github-client.js +210 -0
- package/dist/src/teamauto/norms.js +85 -0
- package/dist/src/teamauto/repo-sync.js +423 -0
- package/dist/src/teamauto/scanner.js +207 -0
- package/dist/src/teamauto/schedule.js +123 -0
- package/dist/src/teamauto/scheduler.js +907 -0
- package/dist/src/teamauto/store.js +133 -0
- package/dist/src/types.js +290 -0
- package/dist/src/ui/app.js +4860 -0
- package/dist/src/ui/assets/teamclaw-app-icon.png +0 -0
- package/dist/src/ui/github-login.html +296 -0
- package/dist/src/ui/index.html +447 -0
- package/dist/src/ui/style.css +2805 -0
- package/dist/src/worker/http-handler.js +146 -0
- package/dist/src/worker/message-queue.js +24 -0
- package/dist/src/worker/prompt-injector.js +78 -0
- package/dist/src/worker/skill-installer.js +255 -0
- package/dist/src/worker/tools.js +541 -0
- package/dist/src/worker/worker-service.js +307 -0
- package/dist/src/workspace-browser.js +269 -0
- package/openclaw.plugin.json +28 -1
- package/package.json +3 -2
- package/src/config.ts +33 -2
- package/src/controller/clarification-routes.ts +404 -0
- package/src/controller/controller-intake.ts +1113 -0
- package/src/controller/controller-planning.ts +1029 -0
- package/src/controller/controller-runs.ts +239 -0
- package/src/controller/controller-service.ts +295 -41
- package/src/controller/controller-tools.ts +11 -7
- package/src/controller/http-server.ts +294 -6971
- package/src/controller/kickoff-orchestrator.ts +70 -7
- package/src/controller/message-delivery.ts +49 -0
- package/src/controller/message-routes.ts +137 -0
- package/src/controller/orchestration-manifest.ts +6 -29
- package/src/controller/preview-proxy.ts +127 -0
- package/src/controller/profile-switch.ts +366 -0
- package/src/controller/project-registry.ts +361 -0
- package/src/controller/prompt-injector.ts +23 -8
- package/src/controller/repo-routes.ts +91 -0
- package/src/controller/role-inference.ts +260 -22
- package/src/controller/route-table.ts +1616 -0
- package/src/controller/task-assignment.ts +618 -0
- package/src/controller/task-cleanup.ts +344 -0
- package/src/controller/task-execution.ts +356 -0
- package/src/controller/task-results.ts +544 -0
- package/src/controller/task-router.ts +98 -6
- package/src/controller/task-routes.ts +812 -0
- package/src/controller/teamauto-routes.ts +121 -0
- package/src/controller/ui-assets.ts +70 -0
- package/src/controller/websocket.ts +13 -1
- package/src/controller/worker-provisioning.ts +32 -4
- package/src/controller/worker-routes.ts +241 -0
- package/src/identity.ts +3 -2
- package/src/interaction-contracts.ts +7 -7
- package/src/openclaw-workspace.ts +44 -18
- package/src/profile-loader.ts +650 -0
- package/src/profiles/banking.json +178 -0
- package/src/profiles/crossborder-ecom.json +253 -0
- package/src/profiles/insurance.json +157 -0
- package/src/profiles/knowledge/hs-structure.md +97 -0
- package/src/profiles/knowledge/incoterms-2020.md +188 -0
- package/src/profiles/knowledge/vat-principles.md +85 -0
- package/src/profiles/schema.json +201 -0
- package/src/profiles/securities.json +137 -0
- package/src/profiles/software-rd.json +264 -0
- package/src/profiles/trading-co.json +200 -0
- package/src/prompt-policy.ts +27 -13
- package/src/role-ids.ts +31 -0
- package/src/roles.ts +60 -14
- package/src/session-roles.ts +14 -0
- package/src/state.ts +236 -9
- package/src/task-executor.ts +7 -18
- package/src/teamauto/github-client.ts +21 -0
- package/src/teamauto/repo-sync.ts +246 -6
- package/src/teamauto/scanner.ts +47 -13
- package/src/teamauto/scheduler.ts +259 -16
- package/src/teamauto/store.ts +12 -0
- package/src/types.ts +133 -16
- package/src/ui/app.js +592 -24
- package/src/ui/index.html +44 -11
- package/src/ui/style.css +194 -0
- package/src/worker/prompt-injector.ts +48 -8
- package/src/worker/skill-installer.ts +3 -1
- package/src/worker/worker-service.ts +83 -3
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { generateId } from "../protocol.js";
|
|
2
|
+
import { deriveProjectSlug } from "../openclaw-workspace.js";
|
|
3
|
+
import { buildTaskExecutionSummary, MAX_TASK_EXECUTION_EVENTS } from "./task-execution.js";
|
|
4
|
+
import { extractExplicitProjectNameHint, resolveExistingProjectIdentityFromMessage, resolveProjectIdentityForSession, resolveProjectIdentityForTaskId, syncProjectRegistryEntry, } from "./project-registry.js";
|
|
5
|
+
const MAX_CONTROLLER_RUNS = 40;
|
|
6
|
+
export function ensureControllerRunExecution(run) {
|
|
7
|
+
if (!run.execution) {
|
|
8
|
+
run.execution = {
|
|
9
|
+
status: run.status,
|
|
10
|
+
runId: run.runId,
|
|
11
|
+
startedAt: run.startedAt,
|
|
12
|
+
endedAt: run.completedAt,
|
|
13
|
+
lastUpdatedAt: run.updatedAt,
|
|
14
|
+
events: [],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (!Array.isArray(run.execution.events)) {
|
|
18
|
+
run.execution.events = [];
|
|
19
|
+
}
|
|
20
|
+
run.execution.status = run.status;
|
|
21
|
+
run.execution.runId = run.runId ?? run.execution.runId;
|
|
22
|
+
run.execution.startedAt = run.startedAt ?? run.execution.startedAt;
|
|
23
|
+
run.execution.endedAt = run.completedAt ?? run.execution.endedAt;
|
|
24
|
+
run.execution.lastUpdatedAt = run.updatedAt ?? run.execution.lastUpdatedAt;
|
|
25
|
+
return run.execution;
|
|
26
|
+
}
|
|
27
|
+
export function appendControllerRunEvent(run, input) {
|
|
28
|
+
const now = input.createdAt ?? Date.now();
|
|
29
|
+
const execution = ensureControllerRunExecution(run);
|
|
30
|
+
if (input.runId) {
|
|
31
|
+
run.runId = input.runId;
|
|
32
|
+
execution.runId = input.runId;
|
|
33
|
+
}
|
|
34
|
+
if (input.sessionKey) {
|
|
35
|
+
execution.sessionKey = input.sessionKey;
|
|
36
|
+
}
|
|
37
|
+
if (input.status) {
|
|
38
|
+
run.status = input.status;
|
|
39
|
+
execution.status = input.status;
|
|
40
|
+
}
|
|
41
|
+
if ((input.status === "running" || input.phase === "run_started") && !run.startedAt) {
|
|
42
|
+
run.startedAt = now;
|
|
43
|
+
execution.startedAt = now;
|
|
44
|
+
}
|
|
45
|
+
if (run.status === "completed" || run.status === "failed") {
|
|
46
|
+
run.completedAt = run.completedAt ?? now;
|
|
47
|
+
execution.endedAt = execution.endedAt ?? now;
|
|
48
|
+
}
|
|
49
|
+
run.updatedAt = now;
|
|
50
|
+
execution.lastUpdatedAt = now;
|
|
51
|
+
const event = {
|
|
52
|
+
id: generateId(),
|
|
53
|
+
type: input.type,
|
|
54
|
+
createdAt: now,
|
|
55
|
+
message: input.message,
|
|
56
|
+
phase: input.phase,
|
|
57
|
+
source: input.source,
|
|
58
|
+
stream: input.stream,
|
|
59
|
+
};
|
|
60
|
+
execution.events.push(event);
|
|
61
|
+
if (execution.events.length > MAX_TASK_EXECUTION_EVENTS) {
|
|
62
|
+
execution.events = execution.events.slice(-MAX_TASK_EXECUTION_EVENTS);
|
|
63
|
+
}
|
|
64
|
+
return event;
|
|
65
|
+
}
|
|
66
|
+
export function trimControllerRuns(state) {
|
|
67
|
+
const runs = Object.values(state.controllerRuns)
|
|
68
|
+
.sort((left, right) => left.updatedAt - right.updatedAt);
|
|
69
|
+
if (runs.length <= MAX_CONTROLLER_RUNS) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
for (const run of runs.slice(0, runs.length - MAX_CONTROLLER_RUNS)) {
|
|
73
|
+
delete state.controllerRuns[run.id];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export function serializeControllerRun(run, includeExecutionEvents = true) {
|
|
77
|
+
if (!run) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const payload = { ...run };
|
|
81
|
+
if (!run.execution) {
|
|
82
|
+
return payload;
|
|
83
|
+
}
|
|
84
|
+
payload.execution = includeExecutionEvents
|
|
85
|
+
? {
|
|
86
|
+
status: run.execution.status,
|
|
87
|
+
runId: run.execution.runId,
|
|
88
|
+
startedAt: run.execution.startedAt,
|
|
89
|
+
endedAt: run.execution.endedAt,
|
|
90
|
+
lastUpdatedAt: run.execution.lastUpdatedAt,
|
|
91
|
+
events: run.execution.events.map((event) => ({ ...event })),
|
|
92
|
+
}
|
|
93
|
+
: buildTaskExecutionSummary(run.execution);
|
|
94
|
+
return payload;
|
|
95
|
+
}
|
|
96
|
+
export function buildControllerRunTitle(message, source, sourceTaskTitle) {
|
|
97
|
+
if (source === "task_follow_up") {
|
|
98
|
+
const normalizedSourceTitle = String(sourceTaskTitle || "").replace(/\s+/g, " ").trim();
|
|
99
|
+
if (normalizedSourceTitle) {
|
|
100
|
+
const compactSourceTitle = normalizedSourceTitle.length <= 72
|
|
101
|
+
? normalizedSourceTitle
|
|
102
|
+
: `${normalizedSourceTitle.slice(0, 72).trimEnd()}…`;
|
|
103
|
+
return `Controller follow-up after ${compactSourceTitle}`;
|
|
104
|
+
}
|
|
105
|
+
return "Controller workflow follow-up";
|
|
106
|
+
}
|
|
107
|
+
const normalized = message.replace(/\s+/g, " ").trim();
|
|
108
|
+
if (!normalized) {
|
|
109
|
+
return "Controller intake";
|
|
110
|
+
}
|
|
111
|
+
if (normalized.length <= 100) {
|
|
112
|
+
return normalized;
|
|
113
|
+
}
|
|
114
|
+
return `${normalized.slice(0, 100).trimEnd()}…`;
|
|
115
|
+
}
|
|
116
|
+
export function createControllerRun(message, sessionKey, deps, options) {
|
|
117
|
+
const now = Date.now();
|
|
118
|
+
const existingState = deps.getTeamState();
|
|
119
|
+
const inheritedProject = options?.sourceTaskId
|
|
120
|
+
? resolveProjectIdentityForTaskId(options.sourceTaskId, existingState)
|
|
121
|
+
: resolveProjectIdentityForSession(sessionKey, existingState)
|
|
122
|
+
?? resolveExistingProjectIdentityFromMessage(message, existingState);
|
|
123
|
+
const explicitProjectId = extractExplicitProjectNameHint(message);
|
|
124
|
+
const projectId = inheritedProject?.projectId ?? explicitProjectId;
|
|
125
|
+
const projectDir = inheritedProject?.projectDir ?? projectId ?? deriveProjectSlug(message);
|
|
126
|
+
const run = {
|
|
127
|
+
id: generateId(),
|
|
128
|
+
title: buildControllerRunTitle(message, options?.source ?? "human", options?.sourceTaskTitle),
|
|
129
|
+
sessionKey,
|
|
130
|
+
projectId: projectId || undefined,
|
|
131
|
+
projectDir,
|
|
132
|
+
source: options?.source ?? "human",
|
|
133
|
+
sourceTaskId: options?.sourceTaskId,
|
|
134
|
+
sourceTaskTitle: options?.sourceTaskTitle,
|
|
135
|
+
request: message,
|
|
136
|
+
createdTaskIds: [],
|
|
137
|
+
status: "pending",
|
|
138
|
+
createdAt: now,
|
|
139
|
+
updatedAt: now,
|
|
140
|
+
};
|
|
141
|
+
const state = deps.updateTeamState((teamState) => {
|
|
142
|
+
syncProjectRegistryEntry(teamState, {
|
|
143
|
+
projectId: run.projectId,
|
|
144
|
+
projectDir: run.projectDir,
|
|
145
|
+
aliases: [run.projectId, extractExplicitProjectNameHint(message)],
|
|
146
|
+
summary: run.title,
|
|
147
|
+
updatedAt: now,
|
|
148
|
+
});
|
|
149
|
+
teamState.controllerRuns[run.id] = run;
|
|
150
|
+
trimControllerRuns(teamState);
|
|
151
|
+
});
|
|
152
|
+
const createdRun = state.controllerRuns[run.id] ?? run;
|
|
153
|
+
deps.wsServer.broadcastUpdate({ type: "controller:run", data: serializeControllerRun(createdRun) });
|
|
154
|
+
return createdRun;
|
|
155
|
+
}
|
|
156
|
+
export function updateControllerRun(runId, deps, updater) {
|
|
157
|
+
const state = deps.updateTeamState((teamState) => {
|
|
158
|
+
const run = teamState.controllerRuns[runId];
|
|
159
|
+
if (!run) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
updater(run);
|
|
163
|
+
trimControllerRuns(teamState);
|
|
164
|
+
});
|
|
165
|
+
const updatedRun = state.controllerRuns[runId];
|
|
166
|
+
if (updatedRun) {
|
|
167
|
+
deps.wsServer.broadcastUpdate({ type: "controller:run", data: serializeControllerRun(updatedRun) });
|
|
168
|
+
}
|
|
169
|
+
return updatedRun;
|
|
170
|
+
}
|
|
171
|
+
export function recordControllerRunEvent(runId, input, deps) {
|
|
172
|
+
return updateControllerRun(runId, deps, (run) => {
|
|
173
|
+
appendControllerRunEvent(run, input);
|
|
174
|
+
});
|
|
175
|
+
}
|