@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.
@@ -11,10 +11,16 @@ import {
11
11
  composePrompt,
12
12
  } from "../prompt-policy.js";
13
13
  import { hasOnDemandWorkerProvisioning, shouldBlockControllerWithoutWorkers } from "./controller-capacity.js";
14
- import { resolveTeamClawWorkspaceDir } from "../workspace-browser.js";
14
+ import { resolveTeamClawWorkspaceDir } from "../openclaw-workspace.js";
15
15
  import fs from "node:fs";
16
16
  import path from "node:path";
17
17
 
18
+ const TEAMCLAW_ROLE_IDS_TEXT = [
19
+ "pm", "architect", "developer", "qa",
20
+ "release-engineer", "infra-engineer", "devops", "security-engineer",
21
+ "designer", "marketing", "data-engineer",
22
+ ];
23
+
18
24
  export type ControllerPromptDeps = {
19
25
  config: PluginConfig;
20
26
  getTeamState: () => TeamState | null;
@@ -6,13 +6,18 @@ export type WsEvent =
6
6
  | { type: "worker:online"; data: unknown }
7
7
  | { type: "worker:offline"; data: unknown }
8
8
  | { type: "controller:run"; data: unknown }
9
+ | { type: "controller:run_deleted"; data: unknown }
9
10
  | { type: "task:created"; data: unknown }
10
11
  | { type: "task:updated"; data: unknown }
11
12
  | { type: "task:completed"; data: unknown }
13
+ | { type: "task:deleted"; data: unknown }
12
14
  | { type: "task:execution"; data: unknown }
13
15
  | { type: "message:new"; data: unknown }
14
16
  | { type: "clarification:requested"; data: unknown }
15
17
  | { type: "clarification:answered"; data: unknown }
18
+ | { type: "clarification:deleted"; data: unknown }
19
+ | { type: "message:deleted"; data: unknown }
20
+ | { type: "project:deleted"; data: unknown }
16
21
  | { type: "requirement:complete"; data: unknown }
17
22
  | { type: "report:ready"; data: unknown };
18
23
 
@@ -1866,10 +1866,10 @@ async function runCommand(command: string, args: string[], stdin?: string): Prom
1866
1866
  child.stdin?.end();
1867
1867
  }
1868
1868
 
1869
- child.stdout?.on("data", (chunk: Uint8Array | string) => {
1869
+ child.stdout?.on("data", (chunk: Buffer) => {
1870
1870
  stdout += chunk.toString("utf8");
1871
1871
  });
1872
- child.stderr?.on("data", (chunk: Uint8Array | string) => {
1872
+ child.stderr?.on("data", (chunk: Buffer) => {
1873
1873
  stderr += chunk.toString("utf8");
1874
1874
  });
1875
1875
  child.on("error", reject);
package/src/discovery.ts CHANGED
@@ -2,9 +2,11 @@ import type { PluginLogger } from "../api.js";
2
2
  import type { DiscoveryResult } from "./types.js";
3
3
  import { MDNS_TYPE } from "./protocol.js";
4
4
 
5
+ type BonjourCtor = typeof import("bonjour-service");
6
+
5
7
  export class MDnsAdvertiser {
6
- private service: InstanceType<typeof import("bonjour-service").default> | null = null;
7
- private advertisement: ReturnType<InstanceType<typeof import("bonjour-service").default>["publish"]> | null = null;
8
+ private service: InstanceType<BonjourCtor> | null = null;
9
+ private advertisement: ReturnType<InstanceType<BonjourCtor>["publish"]> | null = null;
8
10
  private logger: PluginLogger;
9
11
 
10
12
  constructor(logger: PluginLogger) {
@@ -13,7 +15,7 @@ export class MDnsAdvertiser {
13
15
 
14
16
  async start(port: number, teamName: string): Promise<void> {
15
17
  try {
16
- const Bonjour = (await import("bonjour-service")).default;
18
+ const Bonjour = ((await import("bonjour-service")) as unknown as { default: BonjourCtor }).default;
17
19
  this.service = new Bonjour();
18
20
  this.advertisement = this.service.publish({
19
21
  name: `teamclaw-${teamName}-controller`,
@@ -88,7 +90,7 @@ export class MDnsBrowser {
88
90
  resolve();
89
91
  });
90
92
 
91
- browser.on("error", (err) => {
93
+ (browser as unknown as { on: (event: "error", listener: (err: unknown) => void) => void }).on("error", (err) => {
92
94
  this.logger.warn(`mDNS: browse error: ${String(err)}`);
93
95
  });
94
96
  });
@@ -163,6 +163,39 @@ export async function exportControllerGitBundle(
163
163
  });
164
164
  }
165
165
 
166
+ export async function removeTrackedWorkspaceSubtree(
167
+ config: PluginConfig,
168
+ logger: PluginLogger,
169
+ absoluteTargetPath: string,
170
+ ): Promise<void> {
171
+ const workspaceDir = resolveTeamClawWorkspaceDir();
172
+ return await withRepoLock(workspaceDir, async () => {
173
+ if (!config.gitEnabled) {
174
+ return;
175
+ }
176
+ if (!await pathExists(path.join(workspaceDir, ".git"))) {
177
+ return;
178
+ }
179
+
180
+ const targetPath = path.resolve(absoluteTargetPath);
181
+ const relative = path.relative(workspaceDir, targetPath);
182
+ if (!relative || relative === "." || relative.startsWith("..") || path.isAbsolute(relative)) {
183
+ throw new Error(`Refusing to remove tracked paths outside the TeamClaw workspace: ${absoluteTargetPath}`);
184
+ }
185
+
186
+ const trackedResult = await tryGit(["ls-files", "--", relative], { cwd: workspaceDir });
187
+ if (trackedResult.exitCode !== 0) {
188
+ throw new Error(formatCommandError(`git ls-files -- ${relative}`, trackedResult));
189
+ }
190
+ if (!trackedResult.stdout.trim()) {
191
+ return;
192
+ }
193
+
194
+ logger.info(`TeamClaw: removing tracked workspace paths under ${relative}`);
195
+ await runGit(["rm", "-r", "--ignore-unmatch", "--", relative], { cwd: workspaceDir });
196
+ });
197
+ }
198
+
166
199
  export async function importControllerGitBundle(
167
200
  config: PluginConfig,
168
201
  logger: PluginLogger,
@@ -310,7 +310,7 @@ function normalizeResultDeliverables(raw: unknown): WorkerTaskResultDeliverable[
310
310
  }
311
311
  return raw
312
312
  .filter((entry): entry is Record<string, unknown> => !!entry && typeof entry === "object")
313
- .map((entry) => {
313
+ .map((entry): WorkerTaskResultDeliverable | null => {
314
314
  const kind = typeof entry.kind === "string" && RESULT_DELIVERABLE_KINDS.has(entry.kind as WorkerTaskResultDeliverable["kind"])
315
315
  ? entry.kind as WorkerTaskResultDeliverable["kind"]
316
316
  : "note";
@@ -332,7 +332,7 @@ function normalizeResultFollowUps(raw: unknown): WorkerTaskResultFollowUp[] {
332
332
  }
333
333
  return raw
334
334
  .filter((entry): entry is Record<string, unknown> => !!entry && typeof entry === "object")
335
- .map((entry) => {
335
+ .map((entry): WorkerTaskResultFollowUp | null => {
336
336
  const type = typeof entry.type === "string" && RESULT_FOLLOW_UP_TYPES.has(entry.type as WorkerTaskResultFollowUp["type"])
337
337
  ? entry.type as WorkerTaskResultFollowUp["type"]
338
338
  : null;