Skip to content

Commit 8cb53c7

Browse files
authored
perf(doctor): keep bundled doctor contract closures dependency-light (#120698)
* perf(doctor): keep bundled doctor contract closures dependency-light Doctor contract enumeration cold-loads each plugin's doctor-contract-api closure via jiti, so a static value import of openclaw/plugin-sdk/runtime-doctor pulled the state-db/kysely graph (~4.3s per closure) into listPluginDoctorLegacyConfigRules / listPluginDoctorStateMigrationEntries. - migrate all light doctor-contract closures (66 files) to the dependency-light openclaw/plugin-sdk/runtime-doctor-migrations subpath - voice-call: load detect/repairOpenClawStateDatabaseSchema* lazily inside the migration bodies; keep only a type-only static runtime-doctor import - matrix: split pure credential record shapes/normalizers into credentials-state.ts so the doctor closure no longer imports the sync plugin-state store through credentials-read - guard: doctor-contract-closure-guard.test.ts now forbids static value imports of runtime-doctor in closures alongside agent-runtime * fix(matrix): keep credential revocation record type module-local Knip production scan flags the export as consumer-less; the type is only referenced by the exported union and revocation guard signature.
1 parent 970a826 commit 8cb53c7

74 files changed

Lines changed: 201 additions & 167 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎extensions/acpx/doctor-contract-api.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import type {
1111
OpenKeyedStoreOptions,
1212
PluginDoctorStateMigrationContext,
13-
} from "openclaw/plugin-sdk/runtime-doctor";
13+
} from "openclaw/plugin-sdk/runtime-doctor-migrations";
1414
import { afterEach, beforeEach, describe, expect, it } from "vitest";
1515
import { stateMigrations } from "./doctor-contract-api.js";
1616
import { openAcpxProcessLeaseStateStore, type AcpxProcessLease } from "./src/process-lease.js";

‎extensions/acpx/doctor-contract-api.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from "node:path";
44
import {
55
archiveLegacyStateSource,
66
type PluginDoctorStateMigration,
7-
} from "openclaw/plugin-sdk/runtime-doctor";
7+
} from "openclaw/plugin-sdk/runtime-doctor-migrations";
88
import {
99
normalizeAcpxProcessLease,
1010
normalizeAcpxProcessLeaseFile,

‎extensions/active-memory/doctor-contract-api.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import type {
1111
OpenKeyedStoreOptions,
1212
PluginDoctorStateMigrationContext,
13-
} from "openclaw/plugin-sdk/runtime-doctor";
13+
} from "openclaw/plugin-sdk/runtime-doctor-migrations";
1414
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
1515
import { stateMigrations } from "./doctor-contract-api.js";
1616

‎extensions/active-memory/doctor-contract-api.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import path from "node:path";
77
import {
88
defineLegacyJsonStateMigration,
99
type PluginDoctorStateMigration,
10-
} from "openclaw/plugin-sdk/runtime-doctor";
10+
} from "openclaw/plugin-sdk/runtime-doctor-migrations";
1111

1212
type ActiveMemoryToggleEntry = {
1313
sessionKey: string;

‎extensions/anthropic/doctor-contract-api.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Doctor contract metadata for Anthropic and Claude CLI state. It declares
33
* session/auth ownership so doctor cleanup can route stale state correctly.
44
*/
5-
import type { DoctorSessionRouteStateOwner } from "openclaw/plugin-sdk/runtime-doctor";
5+
import type { DoctorSessionRouteStateOwner } from "openclaw/plugin-sdk/runtime-doctor-migrations";
66

77
/** Anthropic currently has no legacy config migrations. */
88
export const legacyConfigRules = [];

‎extensions/canvas/doctor-contract-api.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { tmpdir } from "node:os";
33
import path from "node:path";
44
import { fileURLToPath } from "node:url";
55
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
6-
import type { PluginDoctorStateMigration } from "openclaw/plugin-sdk/runtime-doctor";
6+
import type { PluginDoctorStateMigration } from "openclaw/plugin-sdk/runtime-doctor-migrations";
77
import { afterEach, describe, expect, it, vi } from "vitest";
88
import { stateMigrations } from "./doctor-contract-api.js";
99

‎extensions/canvas/doctor-contract-api.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import fs from "node:fs/promises";
33
import path from "node:path";
44
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
5-
import type { PluginDoctorStateMigration } from "openclaw/plugin-sdk/runtime-doctor";
5+
import type { PluginDoctorStateMigration } from "openclaw/plugin-sdk/runtime-doctor-migrations";
66
import { pathExists } from "openclaw/plugin-sdk/security-runtime";
77
import {
88
asOptionalRecord as readRecord,

‎extensions/clickclack/src/doctor-contract.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ChannelDoctorConfigMutation } from "openclaw/plugin-sdk/channel-contract";
22
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
3-
import { asObjectRecord } from "openclaw/plugin-sdk/runtime-doctor";
3+
import { asObjectRecord } from "openclaw/plugin-sdk/runtime-doctor-migrations";
44

55
function stripTimeoutSeconds(value: unknown): { value: unknown; changed: boolean } {
66
const record = asObjectRecord(value);

‎extensions/codex/doctor-contract-api.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import type {
1010
OpenKeyedStoreOptions,
1111
PluginDoctorStateMigrationContext,
12-
} from "openclaw/plugin-sdk/runtime-doctor";
12+
} from "openclaw/plugin-sdk/runtime-doctor-migrations";
1313
import { getSessionEntry, upsertSessionEntry } from "openclaw/plugin-sdk/session-store-runtime";
1414
import { afterEach, describe, expect, it } from "vitest";
1515
import {

‎extensions/codex/doctor-contract-api.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* ownership warnings.
44
*/
55
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
6-
import type { DoctorSessionRouteStateOwner } from "openclaw/plugin-sdk/runtime-doctor";
6+
import type { DoctorSessionRouteStateOwner } from "openclaw/plugin-sdk/runtime-doctor-migrations";
77

88
type LegacyConfigRule = {
99
path: string[];

0 commit comments

Comments
 (0)