


























@@ -389,6 +389,58 @@ describe("session.message websocket events", () => {
389389});
390390});
391391392+test("does not broadcast hidden runtime-context custom messages as live chat messages", async () => {
393+const storePath = await createSessionStoreFile();
394+await writeSessionStore({
395+entries: {
396+"hidden-runtime": {
397+sessionId: "sess-hidden-runtime",
398+updatedAt: Date.now(),
399+},
400+},
401+ storePath,
402+});
403+404+await withOperatorSessionSubscriber(async (ws) => {
405+const changedEventPromise = waitForSessionsChangedMessagePhase(
406+ws,
407+"agent:main:hidden-runtime",
408+);
409+await expectNoMessageWithin({
410+watch: (timeoutMs) =>
411+onceMessage(
412+ws,
413+(message) =>
414+message.type === "event" &&
415+message.event === "session.message" &&
416+(message.payload as { sessionKey?: string } | undefined)?.sessionKey ===
417+"agent:main:hidden-runtime",
418+timeoutMs,
419+),
420+action: () => {
421+emitSessionTranscriptUpdate({
422+sessionFile: path.join(path.dirname(storePath), "sess-hidden-runtime.jsonl"),
423+sessionKey: "agent:main:hidden-runtime",
424+messageId: "runtime-context-1",
425+messageSeq: 1,
426+message: {
427+role: "custom",
428+customType: "openclaw.runtime-context",
429+content: "secret runtime context",
430+display: false,
431+},
432+});
433+},
434+});
435+436+const changedEvent = await changedEventPromise;
437+expectRecordFields(changedEvent.payload, {
438+sessionKey: "agent:main:hidden-runtime",
439+phase: "message",
440+});
441+});
442+});
443+392444test("includes live usage metadata on session.message and sessions.changed transcript events", async () => {
393445const storePath = await createSessionStoreFile();
394446await writeSessionStore({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。