mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-21 01:51:39 -06:00
d7627d6f4c
* refactor(prompt): plain inbound context labels with a provenance marker
Replaces trust-worded inbound context labels ("(untrusted metadata)",
"(untrusted, for context)") with plain labels plus a fixed provenance
marker suffix appended to every OpenClaw-injected context header.
Detection keys on the marker, not label text, so strippers stay correct
across UI, TUI, replay, /trace segmentation, memory recall, and the Swift
chat preprocessor. Drops sanitizeInboundSystemTags in favor of the marker
boundary plus trusted system-prompt narration.
Renames the untrusted-named plugin SDK context identifiers to
channel-provenance names, keeping deprecated aliases registered for
removal after 2026-09-08.
Adds `openclaw doctor --fix` migrations that rewrite legacy inbound
labels in stored SQLite transcripts and purge legacy envelope-
contaminated LanceDB recall rows.
* fix(ci): resolve gate failures for plain inbound context labels
- doctor sqlite readers: open read-only connections via openNodeSqliteDatabase
so the Kysely connection-boundary guardrail holds; unexport the now-internal
transcript snapshot type (Knip unused-export gate).
- compat registry: split the record table into registry-records.ts and
plugin-sdk-subpath-records.ts. The new compat record pushed registry.ts past
the 700-line oxlint cap; suppressions are disallowed, so follow the existing
sibling record-module pattern. Public exports and PluginCompatCode literals
unchanged.
- acp-runtime test: assert current finalization behavior (newline normalization
only). The bracket de-fang and System: rewrite it expected were removed with
sanitizeInboundSystemTags; forged system lines are neutralized at the
system-event queue, the single chokepoint feeding the System:-per-line render.
- regenerate docs_map and the plugin SDK API baseline manifest.
* fix(prompt): harden inbound context label migration and drop in-band sanitizer
Review follow-ups on the plain-label + provenance-marker change:
- Remove src/security/system-tags.ts. Rewriting inbound text to neutralize
look-alike `System:`/`[System]` markers corrupted legitimate user text and is
not a real injection boundary; role separation plus external-content wrapping
is. Explicit product decision, recorded at the system-event queue.
- Narrow the LanceDB legacy-row purge so it cannot delete benign memories. It
now requires a complete known legacy sentinel line, a legacy label followed by
a fenced JSON body, or the complete legacy external-content header. The prior
predicates matched ordinary prose such as `Notes (untrusted metadata):`, and
deletion is irreversible.
- Make explicit-empty canonical ChannelStructuredContext win over the deprecated
alias via a present/absent result instead of collapsing `[]` to undefined.
- Keep `\r?` in the active-memory doctor rule. It is the only rule spanning the
header's line break, migrated assistant rows skip newline normalization, and
without it the marked-header replace wins and the body strips to empty. Added
a CRLF regression test.
- Fix stale comments that described removed behavior, and cover the Swift
prose-block strip path.
Claude-Session: https://claude.ai/code/session_01WNzsPddQmxy9Y7jKD4wAxH
74 lines
2.7 KiB
TypeScript
74 lines
2.7 KiB
TypeScript
// Shared agent/reply runtime helpers for channel plugins. Keep channel plugins
|
|
// off direct src/auto-reply imports by routing common reply primitives here.
|
|
|
|
export {
|
|
chunkMarkdownText,
|
|
chunkMarkdownTextWithMode,
|
|
chunkText,
|
|
chunkTextWithMode,
|
|
resolveChunkMode,
|
|
resolveTextChunkLimit,
|
|
} from "../auto-reply/chunk.js";
|
|
export type { ChunkMode } from "../auto-reply/chunk.js";
|
|
export {
|
|
dispatchInboundMessage,
|
|
dispatchInboundMessageWithBufferedDispatcher,
|
|
dispatchInboundMessageWithDispatcher,
|
|
settleReplyDispatcher,
|
|
} from "../auto-reply/dispatch.js";
|
|
export {
|
|
normalizeGroupActivation,
|
|
parseActivationCommand,
|
|
} from "../auto-reply/group-activation.js";
|
|
export {
|
|
HEARTBEAT_PROMPT,
|
|
DEFAULT_HEARTBEAT_ACK_MAX_CHARS,
|
|
resolveHeartbeatPrompt,
|
|
stripHeartbeatToken,
|
|
} from "../auto-reply/heartbeat.js";
|
|
export { resolveHeartbeatReplyPayload } from "../auto-reply/heartbeat-reply-payload.js";
|
|
export { getReplyFromConfig } from "../auto-reply/reply/get-reply.js";
|
|
export { HEARTBEAT_TOKEN, isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
|
export { isAbortRequestText } from "../auto-reply/reply/abort.js";
|
|
export { isBtwRequestText } from "../auto-reply/reply/btw-command.js";
|
|
export { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
|
export { finalizeInboundContextForSdk as finalizeInboundContext } from "../auto-reply/reply/inbound-context.js";
|
|
export {
|
|
createInboundDebouncer,
|
|
resolveInboundDebounceMs,
|
|
} from "../auto-reply/inbound-debounce.js";
|
|
export {
|
|
dispatchReplyWithBufferedBlockDispatcher,
|
|
dispatchReplyWithDispatcher,
|
|
} from "../auto-reply/reply/provider-dispatcher.js";
|
|
export {
|
|
createReplyDispatcher,
|
|
createReplyDispatcherWithTyping,
|
|
} from "../auto-reply/reply/reply-dispatcher.js";
|
|
export type {
|
|
ReplyDispatchBeforeDeliverOptions,
|
|
ReplyDispatchKind,
|
|
ReplyDispatcher,
|
|
ReplyFollowupAdmissionBarrierTimeoutPolicy,
|
|
} from "../auto-reply/reply/reply-dispatcher.types.js";
|
|
export type {
|
|
ReplyDispatcherOptions,
|
|
ReplyDispatcherWithTypingOptions,
|
|
} from "../auto-reply/reply/reply-dispatcher.js";
|
|
export { createReplyReferencePlanner } from "../auto-reply/reply/reply-reference.js";
|
|
export type {
|
|
GetReplyOptions,
|
|
BlockReplyContext,
|
|
SourceReplyDeliveryMode,
|
|
} from "../auto-reply/get-reply-options.types.js";
|
|
export type { ReplyPayload } from "./reply-payload.js";
|
|
export type {
|
|
ChannelStructuredContextEntry,
|
|
FinalizedMsgContext,
|
|
MsgContext,
|
|
UntrustedStructuredContextEntry,
|
|
} from "../auto-reply/templating.js";
|
|
export type { CommandTurnContext } from "../auto-reply/command-turn-context.js";
|
|
export { generateConversationLabel } from "../auto-reply/reply/conversation-label-generator.js";
|
|
export type { ConversationLabelParams } from "../auto-reply/reply/conversation-label-generator.js";
|