mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 23:20:22 +00:00
Respect source channel for agent event surfacing (#36030)
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
isMarkdownCapableMessageChannel,
|
||||
resolveMessageChannel,
|
||||
} from "../../utils/message-channel.js";
|
||||
import { isInternalMessageChannel } from "../../utils/message-channel.js";
|
||||
import { stripHeartbeatToken } from "../heartbeat.js";
|
||||
import type { TemplateContext } from "../templating.js";
|
||||
import type { VerboseLevel } from "../thinking.js";
|
||||
@@ -113,11 +114,17 @@ export async function runAgentTurnWithFallback(params: {
|
||||
didNotifyAgentRunStart = true;
|
||||
params.opts?.onAgentRunStart?.(runId);
|
||||
};
|
||||
const shouldSurfaceToControlUi = isInternalMessageChannel(
|
||||
params.followupRun.run.messageProvider ??
|
||||
params.sessionCtx.Surface ??
|
||||
params.sessionCtx.Provider,
|
||||
);
|
||||
if (params.sessionKey) {
|
||||
registerAgentRunContext(runId, {
|
||||
sessionKey: params.sessionKey,
|
||||
verboseLevel: params.resolvedVerboseLevel,
|
||||
isHeartbeat: params.isHeartbeat,
|
||||
isControlUiVisible: shouldSurfaceToControlUi,
|
||||
});
|
||||
}
|
||||
let runResult: Awaited<ReturnType<typeof runEmbeddedPiAgent>>;
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { TypingMode } from "../../config/types.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import { registerAgentRunContext } from "../../infra/agent-events.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { isInternalMessageChannel } from "../../utils/message-channel.js";
|
||||
import { stripHeartbeatToken } from "../heartbeat.js";
|
||||
import type { OriginatingChannelType } from "../templating.js";
|
||||
import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../tokens.js";
|
||||
@@ -131,10 +132,17 @@ export function createFollowupRunner(params: {
|
||||
return async (queued: FollowupRun) => {
|
||||
try {
|
||||
const runId = crypto.randomUUID();
|
||||
const shouldSurfaceToControlUi = isInternalMessageChannel(
|
||||
resolveOriginMessageProvider({
|
||||
originatingChannel: queued.originatingChannel,
|
||||
provider: queued.run.messageProvider,
|
||||
}),
|
||||
);
|
||||
if (queued.run.sessionKey) {
|
||||
registerAgentRunContext(runId, {
|
||||
sessionKey: queued.run.sessionKey,
|
||||
verboseLevel: queued.run.verboseLevel,
|
||||
isControlUiVisible: shouldSurfaceToControlUi,
|
||||
});
|
||||
}
|
||||
let autoCompactionCompleted = false;
|
||||
|
||||
Reference in New Issue
Block a user