docs: document channel core helpers · openclaw/openclaw@ca9249e
steipete
·
2026-06-04
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Stateful progress-draft compositor for channel streaming previews. |
| 2 | +// It merges tool, reasoning, and commentary updates until the final reply replaces them. |
1 | 3 | import { formatReasoningMessage } from "../agents/embedded-agent-utils.js"; |
2 | 4 | import { findCodeRegions, isInsideCode } from "../shared/text/code-regions.js"; |
3 | 5 | import { stripInlineDirectiveTagsForDelivery } from "../utils/directive-tags.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Small progress-draft line helpers shared by streaming renderers. |
1 | 2 | import type { ChannelProgressDraftLine } from "./streaming.js"; |
2 | 3 | |
3 | 4 | /** Progress draft state can mix legacy plain text lines with keyed structured lines. */ |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Read-only channel account inspection facade for setup and status diagnostics. |
1 | 2 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
2 | 3 | import { getBundledChannelAccountInspector } from "./plugins/bundled.js"; |
3 | 4 | import { getLoadedChannelPlugin } from "./plugins/registry.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Cached lookup view for active channel plugin registry entries and aliases. |
1 | 2 | import { normalizeOptionalLowercaseString } from "@openclaw/normalization-core/string-coerce"; |
2 | 3 | import type { |
3 | 4 | ActivePluginChannelRegistration, |
4 | 5 | ActivePluginChannelRegistry, |
5 | 6 | } from "../plugins/channel-registry-state.types.js"; |
6 | 7 | import { getActivePluginChannelRegistrySnapshotFromState } from "../plugins/runtime-channel-state.js"; |
7 | 8 | |
8 | | -// Cached lookup view for the active channel plugin registry. The cache is keyed |
9 | | -// by registry object/version so request-time callers avoid rebuilding alias maps. |
10 | 9 | export type RegisteredChannelPluginEntry = ActivePluginChannelRegistration & { |
11 | 10 | plugin: ActivePluginChannelRegistration["plugin"] & { |
12 | 11 | id?: string | null; |
@@ -34,6 +33,7 @@ function setLookupEntry(
|
34 | 33 | key: string | undefined, |
35 | 34 | entry: RegisteredChannelPluginEntry, |
36 | 35 | ): void { |
| 36 | +// First writer wins so canonical ids keep priority over later aliases. |
37 | 37 | if (key && !map.has(key)) { |
38 | 38 | map.set(key, entry); |
39 | 39 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Channel id normalization through the active plugin registry. |
1 | 2 | import { normalizeOptionalLowercaseString } from "@openclaw/normalization-core/string-coerce"; |
2 | 3 | import type { ChannelId } from "./plugins/channel-id.types.js"; |
3 | 4 | import { findRegisteredChannelPluginEntry } from "./registry-lookup.js"; |
4 | 5 | |
5 | | -// Normalizes user/config channel identifiers through the active plugin registry |
6 | | -// so aliases resolve to canonical channel ids. |
| 6 | +/** Normalizes user/config channel identifiers so aliases resolve to canonical channel ids. */ |
7 | 7 | export function normalizeAnyChannelId(raw?: string | null): ChannelId | null { |
8 | 8 | const key = normalizeOptionalLowercaseString(raw); |
9 | 9 | if (!key) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Public channel registry facade for channel ids, metadata, and setup copy. |
1 | 2 | import { |
2 | 3 | normalizeOptionalLowercaseString, |
3 | 4 | normalizeOptionalString, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Reply-prefix context helpers shared by channel reply dispatchers. |
1 | 2 | import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; |
2 | 3 | import { resolveAgentIdentity, resolveEffectiveMessagesConfig } from "../agents/identity.js"; |
3 | 4 | import type { GetReplyOptions } from "../auto-reply/get-reply-options.types.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Route projection helpers between sessions, delivery context, and channel routes. |
1 | 2 | import type { SessionEntry } from "../config/sessions/types.js"; |
2 | 3 | import type { |
3 | 4 | ConversationRef, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Channel run-state tracker used to publish busy/activity status. |
1 | 2 | type RunStateStatusPatch = { |
2 | 3 | busy?: boolean; |
3 | 4 | activeRuns?: number; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Sender display-label helpers shared by channel ingress and audit surfaces. |
1 | 2 | import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; |
2 | 3 | |
3 | | -// Sender display helpers shared by channel ingress and audit surfaces. The |
4 | | -// resolved label keeps a human-readable name plus stable id when both differ. |
5 | 4 | export type SenderLabelParams = { |
6 | 5 | name?: string; |
7 | 6 | username?: string; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。