fix(ci): restore provider runtime seams

This commit is contained in:
Vincent Koc
2026-04-04 23:13:54 +09:00
parent c09e128587
commit fa34f3a9d5
4 changed files with 17 additions and 10 deletions

View File

@@ -1,16 +1,10 @@
import type { StreamFn } from "@mariozechner/pi-agent-core";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
import { buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";
import {
createBedrockNoCacheWrapper,
isAnthropicBedrockModel,
streamWithPayloadPatch,
} from "openclaw/plugin-sdk/provider-stream";
import {
mergeImplicitBedrockProvider,
resolveBedrockConfigApiKey,
resolveImplicitBedrockProvider,
} from "./api.js";
type GuardrailConfig = {
guardrailIdentifier: string;
@@ -49,14 +43,23 @@ export async function registerAmazonBedrockPlugin(api: OpenClawPluginApi): Promi
// initialization during test bootstrap cannot trip TDZ reads.
const providerId = "amazon-bedrock";
const claude46ModelRe = /claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i;
const anthropicByModelReplayHooks = buildProviderReplayFamilyHooks({
family: "anthropic-by-model",
});
const bedrockContextOverflowPatterns = [
/ValidationException.*(?:input is too long|max input token|input token.*exceed)/i,
/ValidationException.*(?:exceeds? the (?:maximum|max) (?:number of )?(?:input )?tokens)/i,
/ModelStreamErrorException.*(?:Input is too long|too many input tokens)/i,
] as const;
// Defer provider-owned helper loading until registration so test/plugin-loader
// cycles cannot re-enter this module before its constants initialize.
const [
{ buildProviderReplayFamilyHooks },
{ mergeImplicitBedrockProvider, resolveBedrockConfigApiKey, resolveImplicitBedrockProvider },
] = await Promise.all([
import("openclaw/plugin-sdk/provider-model-shared"),
import("./api.js"),
]);
const anthropicByModelReplayHooks = buildProviderReplayFamilyHooks({
family: "anthropic-by-model",
});
const guardrail = (api.pluginConfig as Record<string, unknown> | undefined)?.guardrail as
| GuardrailConfig
| undefined;

View File

@@ -119,6 +119,10 @@
"types": "./dist/plugin-sdk/config-runtime.d.ts",
"default": "./dist/plugin-sdk/config-runtime.js"
},
"./plugin-sdk/telegram-command-config": {
"types": "./dist/plugin-sdk/telegram-command-config.d.ts",
"default": "./dist/plugin-sdk/telegram-command-config.js"
},
"./plugin-sdk/config-schema": {
"types": "./dist/plugin-sdk/config-schema.d.ts",
"default": "./dist/plugin-sdk/config-schema.js"

View File

@@ -19,6 +19,7 @@
"approval-reply-runtime",
"approval-runtime",
"config-runtime",
"telegram-command-config",
"config-schema",
"reply-runtime",
"reply-dispatch-runtime",

View File

@@ -336,7 +336,6 @@ describe("plugin-sdk root alias", () => {
expect(packageJson.exports?.["./plugin-sdk/slack-targets"]).toBeUndefined();
expect(packageJson.exports?.["./plugin-sdk/telegram-account"]).toBeUndefined();
expect(packageJson.exports?.["./plugin-sdk/telegram-allow-from"]).toBeUndefined();
expect(packageJson.exports?.["./plugin-sdk/telegram-command-config"]).toBeUndefined();
expect(packageJson.exports?.["./plugin-sdk/telegram-surface"]).toBeUndefined();
expect(packageJson.exports?.["./plugin-sdk/whatsapp-auth-presence"]).toBeUndefined();
expect(packageJson.exports?.["./plugin-sdk/whatsapp-core"]).toBeUndefined();