mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-07 17:04:42 +00:00
* feat(plugin): expose stable sidebar entity data across hosts Collections return interned references and preserve their arrays when membership and order stay unchanged. Entity selectors share one hook with identity defaults for full snapshots and shallow defaults for selections. The app caches host projections and shares underlying store and host subscriptions. Browser render counts exercise the real session store and plugin provider without memoized rows. Terminal hooks consume the collection source port; daemon-wide terminal discovery is the separate terminal phase. * feat(plugin): let users select a sidebar view An exclusive view replaces the sidebar content while the host retains navigation, callouts, and footer. The device remembers the selection, unavailable views fall back to the default, and throwing views provide recovery. Device-scoped plugin settings persist locally with schema validation and revision conflicts. Web E2E and Android tablet QA cover selection, preserved chrome, disabled-view fallback, and error recovery. * feat(plugin): add sidebar view examples and ref actions Keep sidebar layout and gestures inside the plugin while routing entity handles to their owning hosts. Examples cover empty projects, pinned workspaces, task sections, nested agents and device-local label folders. * feat(plugin): observe terminals across connected hosts Share host-wide terminal observations across plugin surfaces and gate them on terminalCollection. Keep directory observations compatible, and carry creation time in worker v6 state so v5 terminals can drain with an unknown timestamp.
110 lines
2.9 KiB
TypeScript
110 lines
2.9 KiB
TypeScript
import { ScrollView, View } from "react-native";
|
|
import {
|
|
useProjects,
|
|
useWorkspaces,
|
|
useAgents,
|
|
useAgent,
|
|
type AgentRef,
|
|
type WorkspaceRef,
|
|
type ProjectRef,
|
|
type PluginSidebarViewProps,
|
|
} from "@getpaseo/plugin/client";
|
|
import { AgentRow, ProjectHeading, WorkspaceRow } from "./rows";
|
|
const indent = { paddingLeft: 12 };
|
|
function AgentTree({ reference, view }: { reference: AgentRef; view: PluginSidebarViewProps }) {
|
|
const agent = useAgent(reference);
|
|
const children = useAgents({
|
|
where: (item) =>
|
|
item.parentAgent?.key === reference.key && item.workspace.key === agent?.workspace.key,
|
|
orderBy: "createdAt",
|
|
});
|
|
return (
|
|
<View>
|
|
<AgentRow reference={reference} view={view} />
|
|
<View style={indent}>
|
|
{children.map((child) => (
|
|
<AgentTree key={child.key} reference={child} view={view} />
|
|
))}
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
function RootWithParent({
|
|
reference,
|
|
parent,
|
|
workspace,
|
|
view,
|
|
}: {
|
|
reference: AgentRef;
|
|
parent: AgentRef;
|
|
workspace: WorkspaceRef;
|
|
view: PluginSidebarViewProps;
|
|
}) {
|
|
const parents = useAgents({
|
|
where: (item) => item.ref.key === parent.key && item.workspace.key === workspace.key,
|
|
});
|
|
return parents.length > 0 ? null : <AgentTree reference={reference} view={view} />;
|
|
}
|
|
function Root({
|
|
reference,
|
|
workspace,
|
|
view,
|
|
}: {
|
|
reference: AgentRef;
|
|
workspace: WorkspaceRef;
|
|
view: PluginSidebarViewProps;
|
|
}) {
|
|
const agent = useAgent(reference);
|
|
if (!agent) return null;
|
|
return agent.parentAgent ? (
|
|
<RootWithParent
|
|
reference={reference}
|
|
parent={agent.parentAgent}
|
|
workspace={workspace}
|
|
view={view}
|
|
/>
|
|
) : (
|
|
<AgentTree reference={reference} view={view} />
|
|
);
|
|
}
|
|
function Workspace({ reference, view }: { reference: WorkspaceRef; view: PluginSidebarViewProps }) {
|
|
const agents = useAgents({
|
|
where: (item) => item.workspace.key === reference.key,
|
|
orderBy: "createdAt",
|
|
});
|
|
return (
|
|
<View>
|
|
<WorkspaceRow reference={reference} view={view} />
|
|
<View style={indent}>
|
|
{agents.map((agent) => (
|
|
<Root key={agent.key} reference={agent} workspace={reference} view={view} />
|
|
))}
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
function Project({ reference, view }: { reference: ProjectRef; view: PluginSidebarViewProps }) {
|
|
const workspaces = useWorkspaces({
|
|
where: (item) => item.project.key === reference.key,
|
|
orderBy: "name",
|
|
});
|
|
return (
|
|
<View>
|
|
<ProjectHeading reference={reference} view={view} />
|
|
{workspaces.map((workspace) => (
|
|
<Workspace key={workspace.key} reference={workspace} view={view} />
|
|
))}
|
|
</View>
|
|
);
|
|
}
|
|
export function Nested(view: PluginSidebarViewProps) {
|
|
const projects = useProjects({ orderBy: "displayName" });
|
|
return (
|
|
<ScrollView>
|
|
{projects.map((reference) => (
|
|
<Project key={reference.key} reference={reference} view={view} />
|
|
))}
|
|
</ScrollView>
|
|
);
|
|
}
|