mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-06-03 07:30:36 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
import {
|
|
createBedrockNoCacheWrapper,
|
|
isAnthropicBedrockModel,
|
|
} from "openclaw/plugin-sdk/provider-stream";
|
|
import {
|
|
mergeImplicitBedrockProvider,
|
|
resolveBedrockConfigApiKey,
|
|
resolveImplicitBedrockProvider,
|
|
} from "./api.js";
|
|
|
|
const PROVIDER_ID = "amazon-bedrock";
|
|
const CLAUDE_46_MODEL_RE = /claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i;
|
|
|
|
export default definePluginEntry({
|
|
id: PROVIDER_ID,
|
|
name: "Amazon Bedrock Provider",
|
|
description: "Bundled Amazon Bedrock provider policy plugin",
|
|
register(api) {
|
|
api.registerProvider({
|
|
id: PROVIDER_ID,
|
|
label: "Amazon Bedrock",
|
|
docsPath: "/providers/models",
|
|
auth: [],
|
|
catalog: {
|
|
order: "simple",
|
|
run: async (ctx) => {
|
|
const implicit = await resolveImplicitBedrockProvider({
|
|
config: ctx.config,
|
|
env: ctx.env,
|
|
});
|
|
if (!implicit) {
|
|
return null;
|
|
}
|
|
return {
|
|
provider: mergeImplicitBedrockProvider({
|
|
existing: ctx.config.models?.providers?.[PROVIDER_ID],
|
|
implicit,
|
|
}),
|
|
};
|
|
},
|
|
},
|
|
resolveConfigApiKey: ({ env }) => resolveBedrockConfigApiKey(env),
|
|
wrapStreamFn: ({ modelId, streamFn }) =>
|
|
isAnthropicBedrockModel(modelId) ? streamFn : createBedrockNoCacheWrapper(streamFn),
|
|
resolveDefaultThinkingLevel: ({ modelId }) =>
|
|
CLAUDE_46_MODEL_RE.test(modelId.trim()) ? "adaptive" : undefined,
|
|
});
|
|
},
|
|
});
|