mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-09 00:34:04 +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
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
export type { OpenClawConfig } from "../config/config.js";
|
|
|
|
export { createAccountActionGate } from "../channels/plugins/account-action-gate.js";
|
|
export {
|
|
createAccountListHelpers,
|
|
describeAccountSnapshot,
|
|
listCombinedAccountIds,
|
|
mergeAccountConfig,
|
|
resolveListedDefaultAccountId,
|
|
resolveMergedAccountConfig,
|
|
} from "../channels/plugins/account-helpers.js";
|
|
export { normalizeChatType } from "../channels/chat-type.js";
|
|
export { resolveAccountEntry, resolveNormalizedAccountEntry } from "../routing/account-lookup.js";
|
|
export {
|
|
DEFAULT_ACCOUNT_ID,
|
|
normalizeAccountId,
|
|
normalizeOptionalAccountId,
|
|
} from "../routing/session-key.js";
|
|
export { normalizeE164, pathExists, resolveUserPath } from "../utils.js";
|
|
export { resolveDiscordAccount, type ResolvedDiscordAccount } from "./discord-account.js";
|
|
export { resolveSlackAccount, type ResolvedSlackAccount } from "./slack-account.js";
|
|
export { resolveTelegramAccount, type ResolvedTelegramAccount } from "./telegram-account.js";
|
|
export { resolveSignalAccount, type ResolvedSignalAccount } from "./signal-account.js";
|
|
|
|
/** Resolve an account by id, then fall back to the default account when the primary lacks credentials. */
|
|
export function resolveAccountWithDefaultFallback<TAccount>(params: {
|
|
accountId?: string | null;
|
|
normalizeAccountId: (accountId?: string | null) => string;
|
|
resolvePrimary: (accountId: string) => TAccount;
|
|
hasCredential: (account: TAccount) => boolean;
|
|
resolveDefaultAccountId: () => string;
|
|
}): TAccount {
|
|
const hasExplicitAccountId = Boolean(params.accountId?.trim());
|
|
const normalizedAccountId = params.normalizeAccountId(params.accountId);
|
|
const primary = params.resolvePrimary(normalizedAccountId);
|
|
if (hasExplicitAccountId || params.hasCredential(primary)) {
|
|
return primary;
|
|
}
|
|
|
|
const fallbackId = params.resolveDefaultAccountId();
|
|
if (fallbackId === normalizedAccountId) {
|
|
return primary;
|
|
}
|
|
const fallback = params.resolvePrimary(fallbackId);
|
|
if (!params.hasCredential(fallback)) {
|
|
return primary;
|
|
}
|
|
return fallback;
|
|
}
|
|
|
|
/** List normalized configured account ids from a raw channel account record map. */
|
|
export function listConfiguredAccountIds(params: {
|
|
accounts: Record<string, unknown> | undefined;
|
|
normalizeAccountId: (accountId: string) => string;
|
|
}): string[] {
|
|
if (!params.accounts) {
|
|
return [];
|
|
}
|
|
const ids = new Set<string>();
|
|
for (const key of Object.keys(params.accounts)) {
|
|
if (!key) {
|
|
continue;
|
|
}
|
|
ids.add(params.normalizeAccountId(key));
|
|
}
|
|
return [...ids];
|
|
}
|