mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
refactor: consolidate coercion contracts (#122458)
* refactor: consolidate coercion contracts Centralize exact string, record, numeric, date, Boolean, argument, and structured-error coercions while preserving call-site semantics. Migrate canonical-name collisions and deprecated internal SDK bypasses, deleting 55 net production/tooling lines. Expand declaration ownership enforcement to 101 allowed helpers and add a narrow export-completeness audit. * fix: preserve standalone script coercions Keep copied Control UI tooling self-contained and retain the trusted release harness module-relative source seam when the harness runs against an old target cwd.
This commit is contained in:
committed by
GitHub
parent
66fe424590
commit
b080dd1e76
@@ -8,6 +8,7 @@ import {
|
||||
type StableChannelIngressIdentityParams,
|
||||
} from "openclaw/plugin-sdk/channel-ingress-runtime";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
||||
import { parseDateStringTimestampMs } from "openclaw/plugin-sdk/number-runtime";
|
||||
import {
|
||||
normalizeAgentId,
|
||||
type ResolvedAgentRoute,
|
||||
@@ -249,6 +250,7 @@ export async function resolveClickClackInboundAccess(params: {
|
||||
preparedRoute,
|
||||
};
|
||||
}
|
||||
const botLoopNowMs = parseDateStringTimestampMs(params.message.created_at);
|
||||
const botLoopProtection =
|
||||
isBotAuthor && params.message.author_id !== params.account.botUserId && params.account.botUserId
|
||||
? {
|
||||
@@ -263,9 +265,7 @@ export async function resolveClickClackInboundAccess(params: {
|
||||
senderId: params.message.author_id,
|
||||
receiverId: params.account.botUserId,
|
||||
eventId: params.message.id,
|
||||
...(Number.isFinite(Date.parse(params.message.created_at))
|
||||
? { nowMs: Date.parse(params.message.created_at) }
|
||||
: {}),
|
||||
...(botLoopNowMs !== undefined ? { nowMs: botLoopNowMs } : {}),
|
||||
config: effectiveBotPolicy.botLoopProtection,
|
||||
defaultsConfig: cfg.channels?.defaults?.botLoopProtection,
|
||||
defaultEnabled: true,
|
||||
|
||||
Reference in New Issue
Block a user