fix(web): render the chat session tree from parent/sub-session lineage
The sidebar treated every workspace session as a root and only nested the manifest sub-agents, so sub-session files showed up as siblings (the same child twice); sub-sessions the plugin marked hidden were listed anyway. - build the tree from `parentId` in a pure `buildSessionTree` model: orphans are promoted to roots, cycles and duplicate ids are guarded, real child-session rows win over the manifest projection, and the routed row force-opens its ancestors - honour the plugin's `:PiSessions` visibility (`visible: false`) with a "show hidden sub-sessions" toggle, the routed-row exception and a dedicated all-hidden empty state - keep tree metadata across WS snapshots, reducer events, id migration and parent removal; prefer a root row for the `/chat` index and add a "back to parent" action - document the session-row and `pi2:subagents` list metadata in the protocol
This commit is contained in:
1 parent
7e780515ac
commit
06e70204e7
15 files changed
+1133
-240
No files matched your search
@@ -131,6 +131,16 @@ export interface Subagent {
|
||||
createdAt?: number;
|
||||
lastActiveAt?: number;
|
||||
live?: boolean;
|
||||
/**
|
||||
* List metadata only: the manifest parent (lineage) id of this subagent.
|
||||
* Never emitted by the reducer.
|
||||
*/
|
||||
parentId?: string;
|
||||
/**
|
||||
* List metadata only: the plugin's `:PiSessions` visibility decision for this
|
||||
* subagent (`false` = hidden by default). Never emitted by the reducer.
|
||||
*/
|
||||
visible?: boolean;
|
||||
children?: Subagent[];
|
||||
}
|
||||
|
||||
@@ -176,6 +186,19 @@ export interface SessionState {
|
||||
subagents: Subagent[];
|
||||
attention: AttentionItem[];
|
||||
entries: Entry[];
|
||||
/**
|
||||
* List metadata only (REST session row / snapshot enrichment), never emitted
|
||||
* by the reducer: the parent session id; `null` marks a root session.
|
||||
*/
|
||||
parentId?: string | null;
|
||||
/**
|
||||
* List metadata only: the plugin's `:PiSessions` visibility decision for this
|
||||
* session (`false` = hidden unless the user asks for hidden rows). Never
|
||||
* emitted by the reducer.
|
||||
*/
|
||||
visible?: boolean;
|
||||
/** List metadata only: the subagent task description carried by the list row. Never emitted by the reducer. */
|
||||
task?: string;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
Reference in new issue
Block a user