Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(claude): loop/cron node shows full task + Play (manual trigger)

enes449815254a60
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index c4fd0a579..4aa351c54 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -151,13 +151,15 @@ export function Canvas() {
position: ephemeralPos[lid] ?? { x: parent.position.x - 250, y: parent.position.y + ph + 60 },
draggable: true,
data: {
- title: st.loop.prompt ?? '',
+ title: st.loop.task ?? '',
color: '#bf7af0',
group: null,
loopCount: st.loop.count,
loopItems: st.loop.items,
loopActive: st.state === 'working',
- loopKind: st.loop.kind
+ loopKind: st.loop.kind,
+ loopSchedule: st.loop.schedule,
+ loopTask: st.loop.task
}
} as CanvasNode)
eEdges.push({
@@ -952,7 +954,7 @@ export function Canvas() {
an.clearForParent(e.nodeId) // new turn → drop the previous fan-out
{
const m = (e.prompt ?? '').match(/^\s*\/(loop|schedule|cron)\b/)
- if (m) cs.setLoop(e.nodeId, true, m[1] as 'loop' | 'schedule' | 'cron', e.prompt)
+ if (m) cs.setLoop(e.nodeId, true, m[1] as 'loop' | 'schedule' | 'cron', { task: e.prompt })
}
break
case 'Stop':
@@ -987,10 +989,7 @@ export function Canvas() {
if (sk === 'loop' || sk === 'schedule' || sk === 'cron') kind = sk
} else if (tool === 'CronCreate') kind = 'cron'
else if (tool === 'ScheduleWakeup') kind = 'loop'
- if (kind) {
- const label = [e.schedule, e.taskLabel].filter(Boolean).join(' · ')
- cs.setLoop(e.nodeId, true, kind, label || undefined)
- }
+ if (kind) cs.setLoop(e.nodeId, true, kind, { schedule: e.schedule, task: e.taskLabel })
}
break
}
diff --git a/src/renderer/nodes/LoopNode.tsx b/src/renderer/nodes/LoopNode.tsx
index 759dd6f34..5ad58e9aa 100644
--- a/src/renderer/nodes/LoopNode.tsx
+++ b/src/renderer/nodes/LoopNode.tsx
@@ -3,13 +3,16 @@ import { Handle, Position, type NodeProps } from '@xyflow/react'
import type { CanvasNode } from '../state/workspace'
/**
- * Ephemeral node visualizing a /loop running on a Claude terminal: iteration count and a
- * per-iteration summary list. Click to expand. Connected by an edge to its parent node.
+ * Ephemeral node visualizing a /loop, /schedule or /cron set up on a Claude terminal.
+ * Shows the kind, schedule, full task, and (for in-session loops) per-iteration summaries.
+ * The Play button re-issues the task to the parent terminal (manual trigger).
*/
-export function LoopNode({ data }: NodeProps<CanvasNode>) {
+export function LoopNode({ id, data }: NodeProps<CanvasNode>) {
const count = (data.loopCount as number) ?? 0
const items = (data.loopItems as string[]) ?? []
const active = !!data.loopActive
+ const schedule = (data.loopSchedule as string) || ''
+ const task = (data.loopTask as string) || ''
const kind = (data.loopKind as string) || 'loop'
const label = kind.charAt(0).toUpperCase() + kind.slice(1)
const [expanded, setExpanded] = useState(false)
@@ -19,6 +22,11 @@ export function LoopNode({ data }: NodeProps<CanvasNode>) {
if (expanded && bodyRef.current) bodyRef.current.scrollTop = bodyRef.current.scrollHeight
}, [items.length, expanded])
+ const trigger = (e: React.MouseEvent) => {
+ e.stopPropagation()
+ if (task) void window.nodeTerminal.pty.sendText(id.replace(/^loop-/, ''), task)
+ }
+
return (
<div className={`loop-node${active ? ' working' : ''}`}>
<Handle type="target" position={Position.Top} isConnectable={false} />
@@ -31,20 +39,26 @@ export function LoopNode({ data }: NodeProps<CanvasNode>) {
<span className="loop-node__dot" />
<span className="loop-node__type">{label}</span>
{count > 0 && <span className="loop-node__count">×{count}</span>}
+ {schedule && <span className="loop-node__sched">{schedule}</span>}
+ {task && (
+ <button className="loop-node__play" title="Run now (manual trigger)" onClick={trigger}>
+ ▶
+ </button>
+ )}
</div>
- {data.title && !expanded && <div className="loop-node__task">{data.title as string}</div>}
+ {(task || schedule) && !expanded && (
+ <div className="loop-node__task">{task || schedule}</div>
+ )}
{expanded && (
<div className="loop-node__items nodrag nowheel" ref={bodyRef}>
- {data.title ? <div className="loop-node__task-full">{data.title as string}</div> : null}
- {items.length ? (
- items.map((it, i) => (
- <div key={i} className="loop-node__item">
- <span className="loop-node__item-n">{i + 1}.</span> {it}
- </div>
- ))
- ) : (
- <span className="loop-node__empty">No iterations yet.</span>
- )}
+ {task ? <div className="loop-node__task-full">{task}</div> : null}
+ {items.length
+ ? items.map((it, i) => (
+ <div key={i} className="loop-node__item">
+ <span className="loop-node__item-n">{i + 1}.</span> {it}
+ </div>
+ ))
+ : !task && <span className="loop-node__empty">No activity yet.</span>}
</div>
)}
</div>
diff --git a/src/renderer/state/claudeStatus.ts b/src/renderer/state/claudeStatus.ts
index e3e28d448..3b8533b31 100644
--- a/src/renderer/state/claudeStatus.ts
+++ b/src/renderer/state/claudeStatus.ts
@@ -17,7 +17,16 @@ export interface ClaudeNodeStatus {
/** Claude session id (from hooks) — used to resume/branch the conversation. */
sessionId?: string
/** Set when running /loop, /schedule or /cron (heuristic); shown as a connected node. */
- loop?: { count: number; prompt?: string; items: string[]; kind: 'loop' | 'schedule' | 'cron' }
+ loop?: {
+ count: number
+ kind: 'loop' | 'schedule' | 'cron'
+ /** Schedule expression (cron) shown as a sub-label. */
+ schedule?: string
+ /** The task/prompt — shown in full and re-issued by the node's Play button. */
+ task?: string
+ /** Per-iteration summaries (in-session /loop). */
+ items: string[]
+ }
}
interface ClaudeStatusState {
@@ -31,7 +40,12 @@ interface ClaudeStatusState {
markUnread(id: string): void
clearUnread(id: string): void
/** Start (active=true, resets) or stop a /loop, /schedule or /cron indicator. */
- setLoop(id: string, active: boolean, kind?: 'loop' | 'schedule' | 'cron', prompt?: string): void
+ setLoop(
+ id: string,
+ active: boolean,
+ kind?: 'loop' | 'schedule' | 'cron',
+ opts?: { schedule?: string; task?: string }
+ ): void
/** Record a /loop iteration (count++ and append its summary). No-op if not looping. */
bumpLoop(id: string, message?: string): void
remove(id: string): void
@@ -123,11 +137,16 @@ export const useClaudeStatus = create<ClaudeStatusState>((set) => ({
return { byId }
}),
- setLoop: (id, active, kind = 'loop', prompt) =>
+ setLoop: (id, active, kind = 'loop', opts) =>
set((s) => {
const prev = s.byId[id] ?? EMPTY
if (active)
- return { byId: { ...s.byId, [id]: { ...prev, loop: { count: 0, prompt, items: [], kind } } } }
+ return {
+ byId: {
+ ...s.byId,
+ [id]: { ...prev, loop: { count: 0, kind, schedule: opts?.schedule, task: opts?.task, items: [] } }
+ }
+ }
if (!prev.loop) return s
const { loop: _drop, ...rest } = prev
return { byId: { ...s.byId, [id]: rest } }
@@ -139,7 +158,7 @@ export const useClaudeStatus = create<ClaudeStatusState>((set) => ({
// Only count in-session /loop turns; /schedule and /cron run in the background.
if (!prev?.loop || prev.loop.kind !== 'loop') return s
const items = message
- ? [...prev.loop.items, message.replace(/\s+/g, ' ').trim().slice(0, 200)].slice(-50)
+ ? [...prev.loop.items, message.trim().slice(0, 4000)].slice(-100)
: prev.loop.items
return {
byId: { ...s.byId, [id]: { ...prev, loop: { ...prev.loop, count: prev.loop.count + 1, items } } }
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 5a832fa79..dab29bde1 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -2668,13 +2668,39 @@ body,
}
.loop-node__count {
- margin-left: auto;
font-size: 10.5px;
font-weight: 700;
color: #bf7af0;
font-variant-numeric: tabular-nums;
}
+.loop-node__sched {
+ font-size: 10px;
+ color: var(--muted);
+ font-variant-numeric: tabular-nums;
+ white-space: nowrap;
+}
+
+.loop-node__play {
+ margin-left: auto;
+ flex: none;
+ width: 22px;
+ height: 22px;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ background: rgba(191, 122, 240, 0.18);
+ border: 1px solid #bf7af0;
+ border-radius: 6px;
+ color: #bf7af0;
+ font-size: 10px;
+ cursor: pointer;
+}
+
+.loop-node__play:hover {
+ background: rgba(191, 122, 240, 0.32);
+}
+
.loop-node__task {
margin-top: 6px;
color: var(--muted);