From a3628310e47883f0b406c5765c8b0046212499f8 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 09:48:55 +0100 Subject: [PATCH] refactor: trim unused acp exports --- src/acp/persistent-bindings.resolve.ts | 10 ---------- src/acp/session-interaction-mode.test.ts | 25 ++++++++++++------------ src/acp/session-interaction-mode.ts | 2 +- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/acp/persistent-bindings.resolve.ts b/src/acp/persistent-bindings.resolve.ts index 2ab4b809c16..da533d2ab61 100644 --- a/src/acp/persistent-bindings.resolve.ts +++ b/src/acp/persistent-bindings.resolve.ts @@ -1,10 +1,8 @@ import { resolveConfiguredBindingRecord, resolveConfiguredBindingRecordBySessionKey, - resolveConfiguredBindingRecordForConversation, } from "../channels/plugins/binding-registry.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; -import type { ConversationRef } from "../infra/outbound/session-binding-service.js"; import { resolveConfiguredAcpBindingSpecFromRecord, toResolvedConfiguredAcpBinding, @@ -23,14 +21,6 @@ export function resolveConfiguredAcpBindingRecord(params: { return resolved ? toResolvedConfiguredAcpBinding(resolved.record) : null; } -export function resolveConfiguredAcpBindingRecordForConversation(params: { - cfg: OpenClawConfig; - conversation: ConversationRef; -}): ResolvedConfiguredAcpBinding | null { - const resolved = resolveConfiguredBindingRecordForConversation(params); - return resolved ? toResolvedConfiguredAcpBinding(resolved.record) : null; -} - export function resolveConfiguredAcpBindingSpecBySessionKey(params: { cfg: OpenClawConfig; sessionKey: string; diff --git a/src/acp/session-interaction-mode.test.ts b/src/acp/session-interaction-mode.test.ts index 04713d4e541..5b77ee8079f 100644 --- a/src/acp/session-interaction-mode.test.ts +++ b/src/acp/session-interaction-mode.test.ts @@ -2,58 +2,57 @@ import { describe, expect, it } from "vitest"; import { isParentOwnedBackgroundAcpSession, isRequesterParentOfBackgroundAcpSession, - resolveAcpSessionInteractionMode, } from "./session-interaction-mode.js"; const parentKey = "agent:main:main"; const otherKey = "agent:peer:some-other"; -describe("resolveAcpSessionInteractionMode", () => { +describe("isParentOwnedBackgroundAcpSession", () => { it("returns interactive when entry is undefined", () => { - expect(resolveAcpSessionInteractionMode(undefined)).toBe("interactive"); + expect(isParentOwnedBackgroundAcpSession(undefined)).toBe(false); }); it("returns parent-owned-background for persistent sessions with spawnedBy set", () => { expect( - resolveAcpSessionInteractionMode({ + isParentOwnedBackgroundAcpSession({ acp: { mode: "persistent" } as never, spawnedBy: parentKey, }), - ).toBe("parent-owned-background"); + ).toBe(true); }); it("returns interactive for persistent ACP sessions without parent linkage", () => { expect( - resolveAcpSessionInteractionMode({ + isParentOwnedBackgroundAcpSession({ acp: { mode: "persistent" } as never, }), - ).toBe("interactive"); + ).toBe(false); }); it("returns parent-owned-background for oneshot sessions with spawnedBy set", () => { expect( - resolveAcpSessionInteractionMode({ + isParentOwnedBackgroundAcpSession({ acp: { mode: "oneshot" } as never, spawnedBy: parentKey, }), - ).toBe("parent-owned-background"); + ).toBe(true); }); it("returns parent-owned-background for oneshot sessions with parentSessionKey set", () => { expect( - resolveAcpSessionInteractionMode({ + isParentOwnedBackgroundAcpSession({ acp: { mode: "oneshot" } as never, parentSessionKey: parentKey, }), - ).toBe("parent-owned-background"); + ).toBe(true); }); it("returns interactive for a oneshot session without any parent linkage", () => { expect( - resolveAcpSessionInteractionMode({ + isParentOwnedBackgroundAcpSession({ acp: { mode: "oneshot" } as never, }), - ).toBe("interactive"); + ).toBe(false); }); }); diff --git a/src/acp/session-interaction-mode.ts b/src/acp/session-interaction-mode.ts index 56d9866090c..071a576a39e 100644 --- a/src/acp/session-interaction-mode.ts +++ b/src/acp/session-interaction-mode.ts @@ -5,7 +5,7 @@ type AcpSessionInteractionMode = "interactive" | "parent-owned-background"; type SessionInteractionEntry = Pick; -export function resolveAcpSessionInteractionMode( +function resolveAcpSessionInteractionMode( entry?: SessionInteractionEntry | null, ): AcpSessionInteractionMode { // Parent-owned ACP sessions are background work delegated from another session.