mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:30:43 +00:00
refactor: trim unused acp exports
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ type AcpSessionInteractionMode = "interactive" | "parent-owned-background";
|
||||
|
||||
type SessionInteractionEntry = Pick<SessionEntry, "spawnedBy" | "parentSessionKey" | "acp">;
|
||||
|
||||
export function resolveAcpSessionInteractionMode(
|
||||
function resolveAcpSessionInteractionMode(
|
||||
entry?: SessionInteractionEntry | null,
|
||||
): AcpSessionInteractionMode {
|
||||
// Parent-owned ACP sessions are background work delegated from another session.
|
||||
|
||||
Reference in New Issue
Block a user