frontend-app-api: add session boundary app initialization

Instantiate the app shell up to app/root.children during sign-in, then rebuild the full tree after sign-in without cloning the app tree.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-12 13:54:18 +01:00
parent d8d8b6a7f3
commit 00381fa7b2
2 changed files with 8 additions and 3 deletions
@@ -509,6 +509,9 @@ export function instantiateAppNodeTree(
apis: ApiHolder,
collector: ErrorCollector,
extensionFactoryMiddleware?: ExtensionFactoryMiddleware,
options?: {
stopAtAttachment?(ctx: { node: AppNode; input: string }): boolean;
},
): boolean {
function createInstance(node: AppNode): AppNodeInstance | undefined {
if (node.instance) {
@@ -521,6 +524,9 @@ export function instantiateAppNodeTree(
const instantiatedAttachments = new Map<string, AppNode[]>();
for (const [input, children] of node.edges.attachments) {
if (options?.stopAtAttachment?.({ node, input })) {
continue;
}
const instantiatedChildren = children.flatMap(child => {
const childInstance = createInstance(child);
if (!childInstance) {