mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 18:33:37 +00:00
fix: expose spawned session owners in sessions list
This commit is contained in:
@@ -167,6 +167,13 @@ describe("sessions tools", () => {
|
||||
updatedAt: 12,
|
||||
parentSessionKey: "agent:main:main",
|
||||
},
|
||||
{
|
||||
key: "agent:main:subagent:worker",
|
||||
kind: "direct",
|
||||
sessionId: "s-subagent-worker",
|
||||
updatedAt: 13,
|
||||
spawnedBy: "agent:main:main",
|
||||
},
|
||||
{
|
||||
key: "cron:job-1",
|
||||
kind: "direct",
|
||||
@@ -203,6 +210,7 @@ describe("sessions tools", () => {
|
||||
sessions?: Array<{
|
||||
key?: string;
|
||||
channel?: string;
|
||||
spawnedBy?: string;
|
||||
status?: string;
|
||||
startedAt?: number;
|
||||
runtimeMs?: number;
|
||||
@@ -212,7 +220,7 @@ describe("sessions tools", () => {
|
||||
messages?: Array<{ role?: string }>;
|
||||
}>;
|
||||
};
|
||||
expect(details.sessions).toHaveLength(4);
|
||||
expect(details.sessions).toHaveLength(5);
|
||||
const main = details.sessions?.find((s) => s.key === "main");
|
||||
expect(main?.channel).toBe("whatsapp");
|
||||
expect(main?.messages?.length).toBe(1);
|
||||
@@ -228,6 +236,9 @@ describe("sessions tools", () => {
|
||||
const dashboardChild = details.sessions?.find((s) => s.key === "agent:main:dashboard:child");
|
||||
expect(dashboardChild?.parentSessionKey).toBe("agent:main:main");
|
||||
|
||||
const subagentWorker = details.sessions?.find((s) => s.key === "agent:main:subagent:worker");
|
||||
expect(subagentWorker?.spawnedBy).toBe("agent:main:main");
|
||||
|
||||
const cronOnly = await tool.execute("call2", { kinds: ["cron"] });
|
||||
const cronDetails = cronOnly.details as {
|
||||
sessions?: Array<Record<string, unknown>>;
|
||||
|
||||
@@ -52,6 +52,7 @@ export type SessionListRow = {
|
||||
key: string;
|
||||
kind: SessionKind;
|
||||
channel: string;
|
||||
spawnedBy?: string;
|
||||
label?: string;
|
||||
displayName?: string;
|
||||
parentSessionKey?: string;
|
||||
|
||||
@@ -193,6 +193,14 @@ export function createSessionsListTool(opts?: {
|
||||
key: displayKey,
|
||||
kind,
|
||||
channel: derivedChannel,
|
||||
spawnedBy:
|
||||
typeof entry.spawnedBy === "string"
|
||||
? resolveDisplaySessionKey({
|
||||
key: entry.spawnedBy,
|
||||
alias,
|
||||
mainKey,
|
||||
})
|
||||
: undefined,
|
||||
label: typeof entry.label === "string" ? entry.label : undefined,
|
||||
displayName: typeof entry.displayName === "string" ? entry.displayName : undefined,
|
||||
parentSessionKey:
|
||||
|
||||
Reference in New Issue
Block a user