Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
feat(workflow): bind graph agent node to durable sessions via sessionRef
Abdurrahman Fakhrul96839a297983
diff --git a/frontend/slices/workflows/components/workflow-inspector.tsx b/frontend/slices/workflows/components/workflow-inspector.tsxindex 03ce88b9..6d569bf4 100644--- a/frontend/slices/workflows/components/workflow-inspector.tsx+++ b/frontend/slices/workflows/components/workflow-inspector.tsx@@ -41,7 +41,7 @@ export function WorkflowInspector({graph,graphs,node,onNode,onDeleteNode,onGraph{node.type==="script"&&<WorkflowScriptField project={projectValue} value={String(node.config.script_id??"")} onChange={(value)=>value?setConfig("script_id",value):removeConfig("script_id")}/>}{node.type==="tool"&&<><WorkflowToolDirectoryField value={String(node.config.tool??"")} onChange={(value)=>setConfig("tool",value)}/><JsonField label="Arguments JSON" value={node.config.arguments??{}} onChange={(value)=>setConfig("arguments",value)}/></>}{node.type==="channel_send"&&<><Field label="Channel ID"><Input value={String(node.config.channelId??"")} placeholder="Channel UUID from Channels" onChange={(e)=>setConfig("channelId",e.target.value)}/></Field><Field label="Target override"><Input value={String(node.config.target??"")} placeholder="Use channel default when empty" onChange={(e)=>e.target.value?setConfig("target",e.target.value):removeConfig("target")}/></Field><JsonField label="Text / binding JSON" value={node.config.text??{"$ref":"input.event.text"}} onChange={(value)=>setConfig("text",value)}/><Button size="sm" variant="outline" className="w-full" onClick={()=>openWindow("channels","Channels")}>Open Channels</Button></>}\n {node.type==="integration"&&<>{["user","provider","connection","operation"].map((key)=><Field key={key} label={key[0]!.toUpperCase()+key.slice(1)}><Input value={String(node.config[key]??"")} onChange={(e)=>setConfig(key,e.target.value)}/></Field>)}</>}- {node.type==="agent"&&<Field label="Agent objective"><Textarea value={String(node.config.message??"")} onChange={(e)=>setConfig("message",e.target.value)}/></Field>}+ {node.type==="agent"&&<><Field label="Session label"><Input placeholder="agent-context-session" value={String(node.config.sessionRef??"")} onChange={(e)=>setConfig("sessionRef",e.target.value)}/></Field><Field label="Agent objective"><Textarea value={String(node.config.message??"")} onChange={(e)=>setConfig("message",e.target.value)}/></Field></>}{node.type==="subflow"&&<><Field label="Workflow graph"><select className={selectClass} value={String(node.config.workflowId??"")} onChange={(e)=>e.target.value?setConfig("workflowId",e.target.value):removeConfig("workflowId")}><option value="">Legacy project flow</option>{graphs.filter((item)=>item.id!==graph.id).map((item)=><option key={item.id} value={item.id}>{item.name}</option>)}</select></Field>{!node.config.workflowId&&<Field label="Legacy flow id"><Input value={String(node.config.flow??"")} onChange={(e)=>setConfig("flow",e.target.value)}/></Field>}</>}{node.type==="repeat"&&<><Field label="Workflow to repeat"><select className={selectClass} value={String(node.config.workflowId??"")} onChange={(e)=>e.target.value?setConfig("workflowId",e.target.value):removeConfig("workflowId")}><option value="">Select saved workflow</option>{graphs.filter((item)=>item.id!==graph.id).map((item)=><option key={item.id} value={item.id}>{item.name}</option>)}</select></Field><JsonField label="Input JSON / bindings" value={node.config.input??{}} onChange={(value)=>setConfig("input",value)}/><Field label="Condition path"><Input value={String(node.config.path??"result.output")} placeholder="result.output.ok" onChange={(e)=>setConfig("path",e.target.value)}/></Field><label className="flex items-center justify-between"><span>Compare exact value</span><Switch checked={Object.hasOwn(node.config,"equals")} onCheckedChange={(checked)=>checked?setConfig("equals",true):removeConfig("equals")}/></label>{Object.hasOwn(node.config,"equals")&&<JsonField label="Expected JSON" value={node.config.equals} onChange={(value)=>setConfig("equals",value)}/>}<Field label="Max iterations"><Input type="number" min={1} max={50} value={number(node.config.maxIterations,5)} onChange={(e)=>setConfig("maxIterations",Number(e.target.value))}/></Field><Field label="Delay between iterations ms"><Input type="number" min={0} max={600000} value={number(node.config.delayMs,1000)} onChange={(e)=>setConfig("delayMs",Number(e.target.value))}/></Field><Field label="Max repeat duration ms"><Input type="number" min={1000} max={840000} value={number(node.config.maxDurationMs,600000)} onChange={(e)=>setConfig("maxDurationMs",Number(e.target.value))}/></Field><p className="text-[10px] text-muted-foreground">Each child run receives <code>input.repeat.iteration</code> and the previous iteration output. Route <code>done</code> when the condition matches or <code>exhausted</code> when limits are reached.</p></>}{node.type==="wait"&&<Field label="Delay ms"><Input type="number" min={0} max={600000} value={number(node.config.delayMs,1000)} onChange={(e)=>setConfig("delayMs",Number(e.target.value))}/></Field>}diff --git a/lib/workflow/graph-runtime.ts b/lib/workflow/graph-runtime.tsindex 4f1c6b12..f6698082 100644--- a/lib/workflow/graph-runtime.ts+++ b/lib/workflow/graph-runtime.ts@@ -170,6 +170,10 @@ async function executeNode(node: WorkflowGraphNode, run: WorkflowGraphRun, graphif (node.type === "script") { if (!project || typeof config.script_id !== "string") throw new Error("script node requires project and script_id"); return { output: await callTool("project_script_run", { project, script_id: config.script_id, ...(context.workflowId ? { workflow_id: context.workflowId } : {}) }, context, resolve), log: `Script ${config.script_id} completed.` }; }if (node.type === "agent") {if (typeof config.message !== "string" || !config.message.trim()) throw new Error("agent node requires message");+ if (typeof config.sessionRef === "string" && config.sessionRef.trim()) {+ const { runDurableSessionTurn } = await import("@/lib/agent/session-turn");+ return { output: await runDurableSessionTurn({ principal, sessionRef: config.sessionRef.trim(), objective: config.message, capabilities: context.capabilities, authority: context, persist: true }), log: `Durable agent turn completed for session ${config.sessionRef.trim()}.` };+ }if (typeof config.orgSeatId === "string" && config.orgSeatId) {const seat = await resolveOrganizationSeat(config.orgSeatId), target = seat.target;if (config.orgTargetDigest !== organizationTargetDigest(seat)) throw new Error("organization execution binding changed; review and save the workflow before running it");diff --git a/lib/workflow/node-catalog.ts b/lib/workflow/node-catalog.tsindex e75bf16a..9d2b4a8c 100644--- a/lib/workflow/node-catalog.ts+++ b/lib/workflow/node-catalog.ts@@ -23,7 +23,7 @@ export const WORKFLOW_NODE_CATALOG:WorkflowNodeCatalogItem[]=[{type:"integration",title:"Integration",category:"Actions",description:"Execute through an existing MSO integration connection; credentials stay outside the graph.",defaults:{}},{type:"channel_send",title:"Channel Send",category:"Actions",description:"Send text through an existing MSO Channel. Channel credentials remain in Integrations.",defaults:{channelId:"",text:{"$ref":"input.event.text"}}},{type:"script",title:"Script",category:"Actions",description:"Run a saved validated RASMIC script by project and script id.",defaults:{}},- {type:"agent",title:"Agent",category:"AI",description:"Run an organization seat or focused project agent action.",defaults:{wait:true,max_scope:"write"}},+ {type:"agent",title:"Agent",category:"AI",description:"Run an organization seat or focused project agent action.",defaults:{wait:true,max_scope:"write",sessionRef:""}},{type:"subflow",title:"Execute Workflow",category:"Flow",description:"Run a saved Workflow Graph or a legacy project flow as a reusable sub-workflow.",defaults:{}},{type:"project",title:"Project",category:"Context",description:"Resolve canonical project identity/path at runtime.",defaults:{}},{type:"folder",title:"Folder",category:"Context",description:"Resolve a real folder inside a canonical project.",defaults:{path:"."}},