


























@@ -2,58 +2,57 @@ import { describe, expect, it } from "vitest";
22import {
33isParentOwnedBackgroundAcpSession,
44isRequesterParentOfBackgroundAcpSession,
5-resolveAcpSessionInteractionMode,
65} from "./session-interaction-mode.js";
7687const parentKey = "agent:main:main";
98const otherKey = "agent:peer:some-other";
10911-describe("resolveAcpSessionInteractionMode", () => {
10+describe("isParentOwnedBackgroundAcpSession", () => {
1211it("returns interactive when entry is undefined", () => {
13-expect(resolveAcpSessionInteractionMode(undefined)).toBe("interactive");
12+expect(isParentOwnedBackgroundAcpSession(undefined)).toBe(false);
1413});
15141615it("returns parent-owned-background for persistent sessions with spawnedBy set", () => {
1716expect(
18-resolveAcpSessionInteractionMode({
17+isParentOwnedBackgroundAcpSession({
1918acp: { mode: "persistent" } as never,
2019spawnedBy: parentKey,
2120}),
22-).toBe("parent-owned-background");
21+).toBe(true);
2322});
24232524it("returns interactive for persistent ACP sessions without parent linkage", () => {
2625expect(
27-resolveAcpSessionInteractionMode({
26+isParentOwnedBackgroundAcpSession({
2827acp: { mode: "persistent" } as never,
2928}),
30-).toBe("interactive");
29+).toBe(false);
3130});
32313332it("returns parent-owned-background for oneshot sessions with spawnedBy set", () => {
3433expect(
35-resolveAcpSessionInteractionMode({
34+isParentOwnedBackgroundAcpSession({
3635acp: { mode: "oneshot" } as never,
3736spawnedBy: parentKey,
3837}),
39-).toBe("parent-owned-background");
38+).toBe(true);
4039});
41404241it("returns parent-owned-background for oneshot sessions with parentSessionKey set", () => {
4342expect(
44-resolveAcpSessionInteractionMode({
43+isParentOwnedBackgroundAcpSession({
4544acp: { mode: "oneshot" } as never,
4645parentSessionKey: parentKey,
4746}),
48-).toBe("parent-owned-background");
47+).toBe(true);
4948});
50495150it("returns interactive for a oneshot session without any parent linkage", () => {
5251expect(
53-resolveAcpSessionInteractionMode({
52+isParentOwnedBackgroundAcpSession({
5453acp: { mode: "oneshot" } as never,
5554}),
56-).toBe("interactive");
55+).toBe(false);
5756});
5857});
5958此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。