





























@@ -13,6 +13,7 @@ import { loadSessions } from "../controllers/sessions.ts";
1313import { pushUniqueTrimmedSelectOption } from "../select-options.ts";
1414import {
1515buildAgentMainSessionKey,
16+isSubagentSessionKey,
1617normalizeAgentId,
1718parseAgentSessionKey,
1819} from "../session-key.ts";
@@ -564,6 +565,7 @@ type SessionOptionEntry = {
564565label: string;
565566scopeLabel: string;
566567title: string;
568+parentKey?: string;
567569};
568570569571export type SessionOptionGroup = {
@@ -674,7 +676,7 @@ export function resolveSessionOptionGroups(
674676return created;
675677};
676678677-const addOption = (key: string) => {
679+const addOption = (key: string, parentKey?: string, isChild?: boolean) => {
678680if (!key || seenKeys.has(key)) {
679681return;
680682}
@@ -688,12 +690,16 @@ export function resolveSessionOptionGroups(
688690)
689691 : ensureGroup("other", "Other Sessions");
690692const scopeLabel = normalizeOptionalString(parsed?.rest) ?? key;
691-const label = resolveSessionScopedOptionLabel(key, row, parsed?.rest);
693+let label = resolveSessionScopedOptionLabel(key, row, parsed?.rest);
694+if (isChild) {
695+label = `└─ ${label}`;
696+}
692697group.options.push({
693698 key,
694699 label,
695700 scopeLabel,
696701title: key,
702+ ...(parentKey ? { parentKey } : {}),
697703});
698704};
699705@@ -710,7 +716,12 @@ export function resolveSessionOptionGroups(
710716if (hideCron && row.key !== sessionKey && isCronSessionKey(row.key)) {
711717continue;
712718}
713-addOption(row.key);
719+const isSubagent = isSubagentSessionKey(row.key) || !!row.spawnedBy;
720+if (isSubagent && row.spawnedBy && byKey.has(row.spawnedBy)) {
721+addOption(row.key, row.spawnedBy, true);
722+} else {
723+addOption(row.key);
724+}
714725}
715726if (byKey.has(sessionKey)) {
716727addOption(sessionKey);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。