




















@@ -24,6 +24,16 @@ const DEFAULT_NO_OUTPUT_POLL_MS = 15_000;
2424const DEFAULT_MAX_RELAY_LIFETIME_MS = 6 * 60 * 60 * 1000;
2525const STREAM_BUFFER_MAX_CHARS = 4_000;
2626const STREAM_SNIPPET_MAX_CHARS = 220;
27+const HIDDEN_ACP_STATUS_TAGS = new Set([
28+"agent_thought_chunk",
29+"available_commands_update",
30+"config_option_update",
31+"current_mode_update",
32+"session_info_update",
33+"tool_call",
34+"tool_call_update",
35+"usage_update",
36+]);
27372838function compactWhitespace(value: string): string {
2939return value.replace(/\s+/g, " ").trim();
@@ -53,6 +63,20 @@ function formatProxyEnvSummary(keys: string[]): string {
5363return `proxy env: ${keys.join(", ")}`;
5464}
556566+function shouldRelayAcpStatusProgress(params: {
67+eventType: string | undefined;
68+tag: string | undefined;
69+text: string | undefined;
70+}): boolean {
71+if (params.eventType !== "status" || !params.text) {
72+return false;
73+}
74+if (!params.tag) {
75+return true;
76+}
77+return !HIDDEN_ACP_STATUS_TAGS.has(params.tag);
78+}
79+5680function resolveAcpStreamLogPathFromSessionFile(sessionFile: string, sessionId: string): string {
5781const baseDir = path.dirname(path.resolve(sessionFile));
5882return path.join(baseDir, `${sessionId}.acp-stream.jsonl`);
@@ -311,6 +335,32 @@ export function startAcpSpawnParentStreamRelay(params: {
311335flushTimer.unref?.();
312336};
313337338+const appendVisibleProgress = (delta: string) => {
339+if (stallNotified) {
340+stallNotified = false;
341+recordTaskRunProgressByRunId({
342+ runId,
343+runtime: "acp",
344+sessionKey: params.childSessionKey,
345+lastEventAt: Date.now(),
346+eventSummary: "Resumed output.",
347+});
348+emit(`${relayLabel} resumed output.`, `${contextPrefix}:resumed`);
349+}
350+351+lastProgressAt = Date.now();
352+firstVisibleOutputAt ??= lastProgressAt;
353+pendingText += delta;
354+if (pendingText.length > STREAM_BUFFER_MAX_CHARS) {
355+pendingText = pendingText.slice(-STREAM_BUFFER_MAX_CHARS);
356+}
357+if (pendingText.length >= STREAM_SNIPPET_MAX_CHARS || delta.includes("\n\n")) {
358+flushPending();
359+return;
360+}
361+scheduleFlush();
362+};
363+314364const buildNoOutputNotice = () => {
315365const seconds = Math.round(noOutputNoticeMs / 1000);
316366if (!promptSubmittedAt) {
@@ -405,29 +455,7 @@ export function startAcpSpawnParentStreamRelay(params: {
405455return;
406456}
407457408-if (stallNotified) {
409-stallNotified = false;
410-recordTaskRunProgressByRunId({
411- runId,
412-runtime: "acp",
413-sessionKey: params.childSessionKey,
414-lastEventAt: Date.now(),
415-eventSummary: "Resumed output.",
416-});
417-emit(`${relayLabel} resumed output.`, `${contextPrefix}:resumed`);
418-}
419-420-lastProgressAt = Date.now();
421-firstVisibleOutputAt ??= lastProgressAt;
422-pendingText += delta;
423-if (pendingText.length > STREAM_BUFFER_MAX_CHARS) {
424-pendingText = pendingText.slice(-STREAM_BUFFER_MAX_CHARS);
425-}
426-if (pendingText.length >= STREAM_SNIPPET_MAX_CHARS || delta.includes("\n\n")) {
427-flushPending();
428-return;
429-}
430-scheduleFlush();
458+appendVisibleProgress(delta);
431459return;
432460}
433461@@ -451,8 +479,21 @@ export function startAcpSpawnParentStreamRelay(params: {
451479}
452480if (phase === "runtime_event") {
453481const eventType = normalizeOptionalString(data?.eventType);
482+const text = normalizeOptionalString(data?.text);
483+const tag = normalizeOptionalString(data?.tag);
454484firstRuntimeEventAt ??= Date.now();
455485lastRuntimeEventType = eventType;
486+if (
487+shouldRelayAssistantCommentary &&
488+shouldRelayAcpStatusProgress({
489+ eventType,
490+ tag,
491+ text,
492+})
493+) {
494+appendVisibleProgress(`${text}\n\n`);
495+return;
496+}
456497lastProgressAt = Date.now();
457498return;
458499}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。