Skip to content

Commit baefd06

Browse files
authored
fix(deps): keep package runtime dependencies single-owned (#126119)
* fix(deps): consolidate shared runtime helpers * test(concurrency): support current test lib target * fix(time): preserve year-scale plugin durations * fix(agents): preserve empty subagent completions
1 parent 0767902 commit baefd06

34 files changed

Lines changed: 252 additions & 171 deletions

‎config/knip.config.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,24 +265,18 @@ const bundledPluginIgnoredRuntimeDependencies = [
265265

266266
const rootBundledPluginRuntimeDependencies = [
267267
"@anthropic-ai/sdk",
268-
"@anthropic-ai/vertex-sdk",
269268
"@google/genai",
270269
"@grammyjs/runner",
271270
"@grammyjs/transformer-throttler",
272271
"@homebridge/ciao",
273272
"@mozilla/readability",
274273
"@silvia-odwyer/photon-node",
275274
"@trycua/cua-driver",
276-
"@slack/bolt",
277-
"@slack/types",
278-
"@slack/web-api",
279275
"grammy",
280276
"linkedom",
281277
"minimatch",
282278
"node-edge-tts",
283-
"openshell",
284279
"clawpdf",
285-
"tokenjuice",
286280
] as const;
287281

288282
// Root installation and build workflows deliberately mirror these dependencies from their

‎extensions/discord/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"discord-api-types": "0.38.52",
1414
"libopus-wasm": "0.2.0",
1515
"mdast-util-from-markdown": "2.0.3",
16-
"p-map": "7.0.6",
1716
"typebox": "1.3.6",
1817
"undici": "8.9.0",
1918
"ws": "8.21.1",

‎extensions/discord/src/monitor/thread-bindings.lifecycle.ts‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { readAcpSessionEntry, type AcpSessionStoreEntry } from "openclaw/plugin-sdk/acp-runtime";
2+
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
23
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
34
// Discord plugin module implements thread bindings.lifecycle behavior.
45
import {
56
normalizeOptionalLowercaseString,
67
normalizeOptionalString,
78
uniqueStrings,
89
} from "openclaw/plugin-sdk/string-coerce-runtime";
9-
import pMap from "p-map";
1010
import { parseDiscordTarget } from "../targets.js";
1111
import { resolveChannelIdForBinding } from "./thread-bindings.discord-api.js";
1212
import { getThreadBindingManager } from "./thread-bindings.manager.js";
@@ -266,9 +266,8 @@ export async function reconcileAcpThreadBindingsOnStartup(params: {
266266
}
267267

268268
if (params.healthProbe && probeTargets.length > 0) {
269-
const probeResults = await pMap(
270-
probeTargets,
271-
async ({ binding, sessionKey, session }) => {
269+
const { results: probeResults } = await runTasksWithConcurrency({
270+
tasks: probeTargets.map(({ binding, sessionKey, session }) => async () => {
272271
try {
273272
const result = await params.healthProbe?.({
274273
cfg: params.cfg,
@@ -288,12 +287,11 @@ export async function reconcileAcpThreadBindingsOnStartup(params: {
288287
status: "uncertain" satisfies AcpThreadBindingHealthStatus,
289288
};
290289
}
291-
},
292-
{
293-
concurrency: ACP_STARTUP_HEALTH_PROBE_CONCURRENCY_LIMIT,
294-
stopOnError: true,
295-
},
296-
);
290+
}),
291+
limit: ACP_STARTUP_HEALTH_PROBE_CONCURRENCY_LIMIT,
292+
errorMode: "stop",
293+
throwOnError: true,
294+
});
297295

298296
for (const probeResult of probeResults) {
299297
if (probeResult.status === "stale") {

‎extensions/google-meet/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"type": "module",
1010
"dependencies": {
1111
"jszip": "3.10.1",
12-
"pretty-ms": "9.3.0",
1312
"typebox": "1.3.6"
1413
},
1514
"devDependencies": {

‎extensions/google-meet/src/cli-shared.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
parseStrictPositiveInteger,
1313
} from "openclaw/plugin-sdk/number-runtime";
1414
import { replaceFileAtomic } from "openclaw/plugin-sdk/security-runtime";
15-
import prettyMilliseconds from "pretty-ms";
15+
import { formatDurationCompact } from "openclaw/plugin-sdk/time-runtime";
1616
import type { GoogleMeetCalendarLookupResult } from "./calendar.js";
1717
import type { GoogleMeetModeInput, GoogleMeetTransport } from "./config.js";
1818
import type { GoogleMeetRuntime } from "./runtime.js";
@@ -355,9 +355,8 @@ export function formatDuration(value: number | undefined): string {
355355
if (value === undefined) {
356356
return "n/a";
357357
}
358-
return prettyMilliseconds(Math.max(0, Math.round(value / 1000) * 1000), {
359-
unitCount: 2,
360-
});
358+
const roundedMs = Math.max(0, Math.round(value / 1000) * 1000);
359+
return formatDurationCompact(roundedMs, { showYears: true, spaced: true }) ?? "0ms";
361360
}
362361

363362
export function writeDoctorStatus(status: Awaited<ReturnType<GoogleMeetRuntime["status"]>>): void {

‎extensions/memory-wiki/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"type": "module",
77
"dependencies": {
88
"mdast-util-from-markdown": "2.0.3",
9-
"p-map": "7.0.6",
109
"typebox": "1.3.6",
1110
"yaml": "2.9.0",
1211
"zod": "4.4.3"

‎extensions/memory-wiki/src/import-runs-state.ts‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { createHash } from "node:crypto";
33
import fs from "node:fs/promises";
44
import path from "node:path";
5+
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
56
import { resolveNonNegativeIntegerOption } from "openclaw/plugin-sdk/number-runtime";
67
import type {
78
OpenKeyedStoreOptions,
@@ -12,7 +13,6 @@ import {
1213
normalizeOptionalString,
1314
normalizeUniqueTrimmedStringList,
1415
} from "openclaw/plugin-sdk/string-coerce-runtime";
15-
import pMap, { pMapSkip } from "p-map";
1616
import { walkMemoryWikiDirectory } from "./bounded-walk.js";
1717

1818
const LEGACY_IMPORT_RUN_READ_CONCURRENCY = 16;
@@ -510,12 +510,16 @@ export async function readLegacyMemoryWikiImportRunRecords(
510510
}
511511
throw error;
512512
});
513-
return await pMap(
514-
entries.filter((entry) => entry.kind === "file"),
515-
async (entry) => {
516-
const raw = await fs.readFile(path.join(importRunsDir, entry.relativePath), "utf8");
517-
return normalizeMemoryWikiImportRunRecord(JSON.parse(raw) as unknown) ?? pMapSkip;
518-
},
519-
{ concurrency: LEGACY_IMPORT_RUN_READ_CONCURRENCY, stopOnError: true },
520-
);
513+
const { results } = await runTasksWithConcurrency({
514+
tasks: entries
515+
.filter((entry) => entry.kind === "file")
516+
.map((entry) => async () => {
517+
const raw = await fs.readFile(path.join(importRunsDir, entry.relativePath), "utf8");
518+
return normalizeMemoryWikiImportRunRecord(JSON.parse(raw) as unknown);
519+
}),
520+
limit: LEGACY_IMPORT_RUN_READ_CONCURRENCY,
521+
errorMode: "stop",
522+
throwOnError: true,
523+
});
524+
return results.filter((record): record is ChatGptImportRunRecord => record !== null);
521525
}

‎extensions/memory-wiki/src/query.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import fs from "node:fs/promises";
33
import path from "node:path";
44
import { filterMemorySearchHitsBySessionVisibility } from "@openclaw/memory-core/api.js";
5+
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
56
import type { MemorySearchResult } from "openclaw/plugin-sdk/memory-core-host-runtime-files";
67
import { resolveDefaultAgentId, resolveSessionAgentId } from "openclaw/plugin-sdk/memory-host-core";
78
import { getActiveMemorySearchManager } from "openclaw/plugin-sdk/memory-host-search";
@@ -10,7 +11,6 @@ import {
1011
normalizeLowercaseStringOrEmpty,
1112
uniqueStrings,
1213
} from "openclaw/plugin-sdk/string-coerce-runtime";
13-
import pMap, { pMapSkip } from "p-map";
1414
import type { OpenClawConfig } from "../api.js";
1515
import { walkMemoryWikiDirectory } from "./bounded-walk.js";
1616
import { assessClaimFreshness, isClaimContestedStatus } from "./claim-health.js";
@@ -230,16 +230,18 @@ async function readQueryableWikiPagesByPaths(
230230
rootDir: string,
231231
files: string[],
232232
): Promise<QueryableWikiPage[]> {
233-
return await pMap(
234-
files,
235-
async (relativePath) => {
233+
const { results } = await runTasksWithConcurrency({
234+
tasks: files.map((relativePath) => async () => {
236235
const absolutePath = path.join(rootDir, relativePath);
237236
const raw = await fs.readFile(absolutePath, "utf8");
238237
const summary = toWikiPageSummary({ absolutePath, relativePath, raw });
239-
return summary ? { ...summary, raw } : pMapSkip;
240-
},
241-
{ concurrency: QUERY_PAGE_READ_CONCURRENCY, stopOnError: true },
242-
);
238+
return summary ? { ...summary, raw } : null;
239+
}),
240+
limit: QUERY_PAGE_READ_CONCURRENCY,
241+
errorMode: "stop",
242+
throwOnError: true,
243+
});
244+
return results.filter((page): page is QueryableWikiPage => page !== null);
243245
}
244246

245247
async function readQueryDigestBundle(

‎extensions/memory-wiki/src/unsafe-local.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import { createHash } from "node:crypto";
33
import fs from "node:fs/promises";
44
import path from "node:path";
5+
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
56
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
6-
import pMap from "p-map";
77
import { walkMemoryWikiDirectory } from "./bounded-walk.js";
88
import type { BridgeMemoryWikiResult } from "./bridge.js";
99
import type { ResolvedMemoryWikiConfig } from "./config.js";
@@ -253,9 +253,8 @@ export async function syncMemoryWikiUnsafeLocalSources(
253253
group: "unsafe-local",
254254
incomingCount: new Set([...artifacts.map((artifact) => artifact.syncKey), ...activeKeys]).size,
255255
});
256-
const results = await pMap(
257-
artifacts,
258-
async (artifact) => {
256+
const { results } = await runTasksWithConcurrency({
257+
tasks: artifacts.map((artifact) => async () => {
259258
const stats = await fs.stat(artifact.absolutePath);
260259
activeKeys.add(artifact.syncKey);
261260
return await writeUnsafeLocalSourcePage({
@@ -265,9 +264,11 @@ export async function syncMemoryWikiUnsafeLocalSources(
265264
sourceSize: stats.size,
266265
state,
267266
});
268-
},
269-
{ concurrency: UNSAFE_LOCAL_SYNC_CONCURRENCY, stopOnError: true },
270-
);
267+
}),
268+
limit: UNSAFE_LOCAL_SYNC_CONCURRENCY,
269+
errorMode: "stop",
270+
throwOnError: true,
271+
});
271272

272273
const removedCount = await pruneImportedSourceEntries({
273274
vaultRoot: config.vault.path,

‎extensions/qa-lab/package.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"@copilotkit/aimock": "1.37.4",
99
"@modelcontextprotocol/sdk": "1.30.0",
1010
"@openclaw/crabline": "0.1.11",
11-
"p-limit": "7.3.1",
12-
"p-map": "7.0.6",
1311
"playwright-core": "1.62.1",
14-
"pretty-ms": "9.3.0",
1512
"semver": "7.8.5",
1613
"ws": "8.21.1",
1714
"yaml": "2.9.0",

0 commit comments

Comments
 (0)