Skip to content

Commit 9ebe38b

Browse files
committed
refactor: untangle remaining plugin sdk boundaries
1 parent afc0172 commit 9ebe38b

File tree

492 files changed

+5638
-2858
lines changed

Some content is hidden

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

492 files changed

+5638
-2858
lines changed

extensions/acpx/src/test-utils/runtime-fixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from "node:fs";
22
import { chmod, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
33
import path from "node:path";
4-
import { resolvePreferredOpenClawTmpDir } from "../../../../src/infra/tmp-openclaw-dir.js";
4+
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/infra-runtime";
55
import type { ResolvedAcpxPluginConfig } from "../config.js";
66
import { ACPX_PINNED_VERSION } from "../config.js";
77
import { AcpxRuntime } from "../runtime.js";

extensions/anthropic/index.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
2+
import { parseDurationMs } from "openclaw/plugin-sdk/cli-runtime";
13
import {
24
emptyPluginConfigSchema,
35
type OpenClawPluginApi,
@@ -7,26 +9,25 @@ import {
79
} from "openclaw/plugin-sdk/core";
810
import {
911
CLAUDE_CLI_PROFILE_ID,
12+
applyAuthProfileConfig,
13+
buildTokenProfileId,
14+
createProviderApiKeyAuthMethod,
15+
ensureApiKeyFromOptionEnvOrPrompt,
1016
listProfilesForProvider,
11-
upsertAuthProfile,
12-
} from "../../src/agents/auth-profiles.js";
13-
import { suggestOAuthProfileIdForLegacyDefault } from "../../src/agents/auth-profiles/repair.js";
14-
import type { AuthProfileStore } from "../../src/agents/auth-profiles/types.js";
15-
import { normalizeModelCompat } from "../../src/agents/model-compat.js";
16-
import { formatCliCommand } from "../../src/cli/command-format.js";
17-
import { parseDurationMs } from "../../src/cli/parse-duration.js";
18-
import {
17+
normalizeApiKeyInput,
18+
suggestOAuthProfileIdForLegacyDefault,
19+
type AuthProfileStore,
20+
type ProviderAuthResult,
21+
normalizeSecretInput,
1922
normalizeSecretInputModeInput,
2023
promptSecretRefForSetup,
2124
resolveSecretInputModeForEnvSelection,
22-
} from "../../src/commands/auth-choice.apply-helpers.js";
23-
import { buildTokenProfileId, validateAnthropicSetupToken } from "../../src/commands/auth-token.js";
24-
import { applyAuthProfileConfig } from "../../src/commands/onboard-auth.js";
25-
import { fetchClaudeUsage } from "../../src/infra/provider-usage.fetch.js";
26-
import { createProviderApiKeyAuthMethod } from "../../src/plugins/provider-api-key-auth.js";
27-
import type { ProviderAuthResult } from "../../src/plugins/types.js";
28-
import { normalizeSecretInput } from "../../src/utils/normalize-secret-input.js";
29-
import { anthropicMediaUnderstandingProvider } from "./media-understanding-provider.js";
25+
upsertAuthProfile,
26+
validateAnthropicSetupToken,
27+
validateApiKeyInput,
28+
} from "openclaw/plugin-sdk/provider-auth";
29+
import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-models";
30+
import { fetchClaudeUsage } from "openclaw/plugin-sdk/provider-usage";
3031

3132
const PROVIDER_ID = "anthropic";
3233
const DEFAULT_ANTHROPIC_MODEL = "anthropic/claude-sonnet-4-6";
@@ -395,7 +396,6 @@ const anthropicPlugin = {
395396
profileId: ctx.profileId,
396397
}),
397398
});
398-
api.registerMediaUnderstandingProvider(anthropicMediaUnderstandingProvider);
399399
},
400400
};
401401

extensions/brave/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
import { emptyPluginConfigSchema, type OpenClawPluginApi } from "openclaw/plugin-sdk/core";
12
import {
23
createPluginBackedWebSearchProvider,
34
getTopLevelCredentialValue,
45
setTopLevelCredentialValue,
5-
} from "../../src/agents/tools/web-search-plugin-factory.js";
6-
import { emptyPluginConfigSchema } from "../../src/plugins/config-schema.js";
7-
import type { OpenClawPluginApi } from "../../src/plugins/types.js";
6+
} from "openclaw/plugin-sdk/provider-web-search";
87

98
const bravePlugin = {
109
id: "brave",

extensions/byteplus/index.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { emptyPluginConfigSchema, type OpenClawPluginApi } from "openclaw/plugin-sdk/core";
2-
import { ensureModelAllowlistEntry } from "../../src/commands/model-allowlist.js";
3-
import { createProviderApiKeyAuthMethod } from "../../src/plugins/provider-api-key-auth.js";
4-
import { buildPairedProviderApiKeyCatalog } from "../../src/plugins/provider-catalog.js";
2+
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth";
3+
import { ensureModelAllowlistEntry } from "openclaw/plugin-sdk/provider-onboard";
54
import { buildBytePlusCodingProvider, buildBytePlusProvider } from "./provider-catalog.js";
65

76
const PROVIDER_ID = "byteplus";
@@ -46,15 +45,18 @@ const byteplusPlugin = {
4645
],
4746
catalog: {
4847
order: "paired",
49-
run: (ctx) =>
50-
buildPairedProviderApiKeyCatalog({
51-
ctx,
52-
providerId: PROVIDER_ID,
53-
buildProviders: () => ({
54-
byteplus: buildBytePlusProvider(),
55-
"byteplus-plan": buildBytePlusCodingProvider(),
56-
}),
57-
}),
48+
run: async (ctx) => {
49+
const apiKey = ctx.resolveProviderApiKey(PROVIDER_ID).apiKey;
50+
if (!apiKey) {
51+
return null;
52+
}
53+
return {
54+
providers: {
55+
byteplus: { ...buildBytePlusProvider(), apiKey },
56+
"byteplus-plan": { ...buildBytePlusCodingProvider(), apiKey },
57+
},
58+
};
59+
},
5860
},
5961
});
6062
},

extensions/byteplus/provider-catalog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
BYTEPLUS_CODING_BASE_URL,
55
BYTEPLUS_CODING_MODEL_CATALOG,
66
BYTEPLUS_MODEL_CATALOG,
7-
} from "../../src/agents/byteplus-models.js";
8-
import type { ModelProviderConfig } from "../../src/config/types.models.js";
7+
type ModelProviderConfig,
8+
} from "openclaw/plugin-sdk/provider-models";
99

1010
export function buildBytePlusProvider(): ModelProviderConfig {
1111
return {

extensions/cloudflare-ai-gateway/index.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import { emptyPluginConfigSchema, type OpenClawPluginApi } from "openclaw/plugin-sdk/core";
2-
import { upsertAuthProfile } from "../../src/agents/auth-profiles.js";
3-
import { ensureAuthProfileStore, listProfilesForProvider } from "../../src/agents/auth-profiles.js";
4-
import {
5-
buildCloudflareAiGatewayModelDefinition,
6-
resolveCloudflareAiGatewayBaseUrl,
7-
} from "../../src/agents/cloudflare-ai-gateway.js";
8-
import { resolveNonEnvSecretRefApiKeyMarker } from "../../src/agents/model-auth-markers.js";
92
import {
3+
applyAuthProfileConfig,
4+
buildApiKeyCredential,
5+
coerceSecretRef,
6+
ensureApiKeyFromOptionEnvOrPrompt,
7+
ensureAuthProfileStore,
8+
listProfilesForProvider,
109
normalizeApiKeyInput,
10+
normalizeOptionalSecretInput,
11+
resolveNonEnvSecretRefApiKeyMarker,
12+
type SecretInput,
13+
upsertAuthProfile,
1114
validateApiKeyInput,
12-
} from "../../src/commands/auth-choice.api-key.js";
13-
import { ensureApiKeyFromOptionEnvOrPrompt } from "../../src/commands/auth-choice.apply-helpers.js";
14-
import { buildApiKeyCredential } from "../../src/commands/auth-credentials.js";
15-
import { applyAuthProfileConfig } from "../../src/commands/onboard-auth.js";
16-
import type { SecretInput } from "../../src/config/types.secrets.js";
17-
import { coerceSecretRef } from "../../src/config/types.secrets.js";
18-
import { normalizeOptionalSecretInput } from "../../src/utils/normalize-secret-input.js";
15+
} from "openclaw/plugin-sdk/provider-auth";
16+
import {
17+
buildCloudflareAiGatewayModelDefinition,
18+
resolveCloudflareAiGatewayBaseUrl,
19+
} from "openclaw/plugin-sdk/provider-models";
1920
import {
2021
applyCloudflareAiGatewayConfig,
2122
buildCloudflareAiGatewayConfigPatch,

extensions/cloudflare-ai-gateway/onboard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {
22
buildCloudflareAiGatewayModelDefinition,
33
CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF,
44
resolveCloudflareAiGatewayBaseUrl,
5-
} from "../../src/agents/cloudflare-ai-gateway.js";
5+
} from "openclaw/plugin-sdk/provider-models";
66
import {
77
applyAgentDefaultModelPrimary,
88
applyProviderConfigWithDefaultModel,
9-
} from "../../src/commands/onboard-auth.config-shared.js";
10-
import type { OpenClawConfig } from "../../src/config/config.js";
9+
type OpenClawConfig,
10+
} from "openclaw/plugin-sdk/provider-onboard";
1111

1212
export { CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF };
1313

extensions/discord/src/account-inspect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {
22
hasConfiguredSecretInput,
33
normalizeSecretInputString,
4-
} from "../../../src/config/types.secrets.js";
4+
} from "openclaw/plugin-sdk/config-runtime";
55
import {
66
DEFAULT_ACCOUNT_ID,
77
normalizeAccountId,
88
type OpenClawConfig,
99
type DiscordAccountConfig,
10-
} from "../../../src/plugin-sdk-internal/discord.js";
10+
} from "openclaw/plugin-sdk/discord";
1111
import {
1212
mergeDiscordAccountConfig,
1313
resolveDefaultDiscordAccountId,

extensions/discord/src/accounts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import {
33
createAccountListHelpers,
44
normalizeAccountId,
55
resolveAccountEntry,
6-
} from "../../../src/plugin-sdk-internal/accounts.js";
6+
} from "openclaw/plugin-sdk/account-resolution";
77
import type {
8-
OpenClawConfig,
98
DiscordAccountConfig,
109
DiscordActionConfig,
11-
} from "../../../src/plugin-sdk-internal/discord.js";
10+
OpenClawConfig,
11+
} from "openclaw/plugin-sdk/discord";
1212
import { resolveDiscordToken } from "./token.js";
1313

1414
export type ResolvedDiscordAccount = {

extensions/discord/src/actions/handle-action.guild-admin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import {
44
readNumberParam,
55
readStringArrayParam,
66
readStringParam,
7-
} from "../../../../src/agents/tools/common.js";
7+
} from "openclaw/plugin-sdk/agent-runtime";
88
import {
99
isDiscordModerationAction,
1010
readDiscordModerationCommand,
11-
} from "../../../../src/agents/tools/discord-actions-moderation-shared.js";
12-
import { handleDiscordAction } from "../../../../src/agents/tools/discord-actions.js";
13-
import type { ChannelMessageActionContext } from "../../../../src/channels/plugins/types.js";
11+
} from "openclaw/plugin-sdk/agent-runtime";
12+
import { handleDiscordAction } from "openclaw/plugin-sdk/agent-runtime";
13+
import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-runtime";
1414

1515
type Ctx = Pick<
1616
ChannelMessageActionContext,

0 commit comments

Comments
 (0)