mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 18:33:37 +00:00
fix: expose parent session keys in sessions list
This commit is contained in:
@@ -160,6 +160,13 @@ describe("sessions tools", () => {
|
||||
estimatedCostUsd: 0.0042,
|
||||
childSessions: ["agent:main:subagent:worker"],
|
||||
},
|
||||
{
|
||||
key: "agent:main:dashboard:child",
|
||||
kind: "direct",
|
||||
sessionId: "s-dashboard-child",
|
||||
updatedAt: 12,
|
||||
parentSessionKey: "agent:main:main",
|
||||
},
|
||||
{
|
||||
key: "cron:job-1",
|
||||
kind: "direct",
|
||||
@@ -201,10 +208,11 @@ describe("sessions tools", () => {
|
||||
runtimeMs?: number;
|
||||
estimatedCostUsd?: number;
|
||||
childSessions?: string[];
|
||||
parentSessionKey?: string;
|
||||
messages?: Array<{ role?: string }>;
|
||||
}>;
|
||||
};
|
||||
expect(details.sessions).toHaveLength(3);
|
||||
expect(details.sessions).toHaveLength(4);
|
||||
const main = details.sessions?.find((s) => s.key === "main");
|
||||
expect(main?.channel).toBe("whatsapp");
|
||||
expect(main?.messages?.length).toBe(1);
|
||||
@@ -217,6 +225,9 @@ describe("sessions tools", () => {
|
||||
expect(group?.estimatedCostUsd).toBe(0.0042);
|
||||
expect(group?.childSessions).toEqual(["agent:main:subagent:worker"]);
|
||||
|
||||
const dashboardChild = details.sessions?.find((s) => s.key === "agent:main:dashboard:child");
|
||||
expect(dashboardChild?.parentSessionKey).toBe("agent:main:main");
|
||||
|
||||
const cronOnly = await tool.execute("call2", { kinds: ["cron"] });
|
||||
const cronDetails = cronOnly.details as {
|
||||
sessions?: Array<Record<string, unknown>>;
|
||||
|
||||
@@ -54,6 +54,7 @@ export type SessionListRow = {
|
||||
channel: string;
|
||||
label?: string;
|
||||
displayName?: string;
|
||||
parentSessionKey?: string;
|
||||
deliveryContext?: SessionListDeliveryContext;
|
||||
updatedAt?: number | null;
|
||||
sessionId?: string;
|
||||
|
||||
@@ -195,6 +195,14 @@ export function createSessionsListTool(opts?: {
|
||||
channel: derivedChannel,
|
||||
label: typeof entry.label === "string" ? entry.label : undefined,
|
||||
displayName: typeof entry.displayName === "string" ? entry.displayName : undefined,
|
||||
parentSessionKey:
|
||||
typeof entry.parentSessionKey === "string"
|
||||
? resolveDisplaySessionKey({
|
||||
key: entry.parentSessionKey,
|
||||
alias,
|
||||
mainKey,
|
||||
})
|
||||
: undefined,
|
||||
deliveryContext:
|
||||
deliveryChannel || deliveryTo || deliveryAccountId
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user