mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 18:46:07 +00:00
Summary: - The branch stamps Gateway chat run registrations and abort markers with ordering metadata, uses freshness checks for chat projection suppression, and updates abort/restart/maintenance tests and related types. - PR surface: Source +79, Tests +103. Total +182 across 13 files. - Reproducibility: yes. source-level: on current main, seed abortedRuns for a client run id, register a same-k ... end; the presence-only checks suppress both projections. I did not execute tests in this read-only review. Automerge notes: - PR branch already contained follow-up commit before automerge: ci: re-trigger checks against current main - PR branch already contained follow-up commit before automerge: Merge upstream/main into stale-abort marker fix - PR branch already contained follow-up commit before automerge: Merge remote-tracking branch 'upstream/main' into nex/91013-conflict-… Validation: - ClawSweeper review passed for head6f13d6f7c2. - Required merge gates passed before the squash merge. Prepared head SHA:6f13d6f7c2Review: https://github.com/openclaw/openclaw/pull/91013#issuecomment-4640475472 Co-authored-by: nxmxbbd <32288+nxmxbbd@users.noreply.github.com>
51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
// Gateway node event types.
|
|
// Defines the narrowed context and event envelope for node-originated handlers.
|
|
import type { ModelCatalogEntry } from "../agents/model-catalog.js";
|
|
import type { CliDeps } from "../cli/deps.types.js";
|
|
import type { HealthSummary } from "../commands/health.js";
|
|
import type { ChatAbortControllerEntry } from "./chat-abort.js";
|
|
import type { ChatAbortMarker, ChatRunEntry, ChatRunRegistration } from "./server-chat.js";
|
|
import type { DedupeEntry } from "./server-shared.js";
|
|
|
|
/** Runtime context available to node event handlers. */
|
|
export type NodeEventContext = {
|
|
deps: CliDeps;
|
|
broadcast: (event: string, payload: unknown, opts?: { dropIfSlow?: boolean }) => void;
|
|
nodeSendToSession: (sessionKey: string, event: string, payload: unknown) => void;
|
|
nodeSubscribe: (nodeId: string, sessionKey: string) => void;
|
|
nodeUnsubscribe: (nodeId: string, sessionKey: string) => void;
|
|
broadcastVoiceWakeChanged: (triggers: string[]) => void;
|
|
addChatRun: (sessionId: string, entry: ChatRunRegistration) => void;
|
|
removeChatRun: (
|
|
sessionId: string,
|
|
clientRunId: string,
|
|
sessionKey?: string,
|
|
) => ChatRunEntry | undefined;
|
|
chatAbortControllers: Map<string, ChatAbortControllerEntry>;
|
|
chatAbortedRuns: Map<string, ChatAbortMarker>;
|
|
chatRunBuffers: Map<string, string>;
|
|
chatDeltaSentAt: Map<string, number>;
|
|
dedupe: Map<string, DedupeEntry>;
|
|
agentRunSeq: Map<string, number>;
|
|
getHealthCache: () => HealthSummary | null;
|
|
refreshHealthSnapshot: (opts?: {
|
|
probe?: boolean;
|
|
includeSensitive?: boolean;
|
|
}) => Promise<HealthSummary>;
|
|
loadGatewayModelCatalog: () => Promise<ModelCatalogEntry[]>;
|
|
authorizeNodeSystemRunEvent: (params: {
|
|
nodeId: string;
|
|
connId?: string;
|
|
runId?: string;
|
|
sessionKey: string;
|
|
terminal: boolean;
|
|
}) => boolean;
|
|
logGateway: { warn: (msg: string) => void };
|
|
};
|
|
|
|
/** Raw event envelope received from connected node clients. */
|
|
export type NodeEvent = {
|
|
event: string;
|
|
payloadJSON?: string | null;
|
|
};
|