{#if loading} {:else if !entity}

Entity "{slug}" not found.

{:else}

{entity.slug}

{#snippet detailsContent()}
Type
{entity.type}
State
{#if entity.state}{entity.state}{:else}{/if}
Health
{#if entity.health} {entity.health} · checked {relativeTime(entity.last_check_at)} {:else} not monitored {/if}
Version
{entity.version}
Created
{relativeTime(entity.created_at)}
Updated
{relativeTime(entity.updated_at)}
{#if entity.maintenance_until}
Maintenance until
{new Date(entity.maintenance_until).toLocaleString()}
{/if}
{/snippet} {#snippet monitoringContent()}
{#each checks as check (check.id)}
{check.kind} every {check.interval_s}s
{:else}

No checks configured for this entity.

{/each}
{/snippet} {#snippet contentContent()} {#if ownContent}
{@html renderMarkdown(ownContent.content)}
{:else}

No content.

{/if} {/snippet} {#snippet attributesContent()} {#if entity.attributes && Object.keys(entity.attributes).length} {@const rows = classifyAttributes(entity.attributes)}
{#each rows as row (row.key)} {#if row.kind === 'long-text'}

{row.key}

{row.value}

{:else if row.kind === 'changelog'}

{row.key} ({row.value.length})

{#each row.value as entry}
{#if entry.date}{entry.date}{/if} {#if entry.title}{entry.title}{/if}
{#if entry.body}

{entry.body}

{/if}
{/each}
{:else if row.kind === 'flat-object'}

{row.key}

{#each Object.entries(row.value) as [subKey, subValue]}
{subKey}
{String(subValue)}
{/each}
{:else}
{row.key}
{#if row.value !== null && typeof row.value === 'object'}
{JSON.stringify(row.value, null, 2)}
{:else} {String(row.value)} {/if}
{/if} {/each}
{:else}

No attributes.

{/if} {/snippet} {#snippet relationRow(rel: Relationship)}
{#if onSelectEntity} —{rel.type}→ {:else} {truncateMiddle(rel.source)} —{rel.type}→ {truncateMiddle(rel.target)} {/if}
{/snippet} {#snippet relationsContent()} {#if outgoingRelations.length === 0 && incomingRelations.length === 0}

No direct relations.

{:else}
{#if outgoingRelations.length}
Outgoing ({outgoingRelations.length})
{#each outgoingRelations as rel} {@render relationRow(rel)} {/each}
{/if} {#if incomingRelations.length}
Incoming ({incomingRelations.length})
{#each incomingRelations as rel} {@render relationRow(rel)} {/each}
{/if}
{/if} {/snippet} {#snippet metricsContent()} {#if metrics.length}
{#each metrics as series (series.metric)}

{series.metric} ({series.rollup})

{/each}
{:else}

No metrics tracked.

{/if} {/snippet} {#snippet signalsContent()}
{#each signals as signal (signal.id)}
{signal.kind}
{signal.severity} {signal.state}
{#if ['raised', 'acknowledged', 'acting'].includes(signal.state)}
{#if signal.state === 'raised'} {/if}
{/if}
{:else}

None.

{/each}
{/snippet} {#snippet tasksContent()}
{#each tasks as { task, executionCount } (task.id)} {@const title = typeof task.attributes?.title === 'string' ? task.attributes.title : task.name} {@const outcome = typeof task.attributes?.outcome === 'string' ? task.attributes.outcome : undefined}
{#if onSelectEntity} {:else} {title} {/if}
{#if outcome} {outcome} {/if} {executionCount} action{executionCount === 1 ? '' : 's'}
{:else}

No tasks have acted on this entity.

{/each}
{/snippet} {#snippet knowledgeContent()}
{#each knowledge as hit (hit.id)}
{hit.type}{hit.title}
{:else}

None linked.

{/each}
{/snippet} {#snippet eventsContent()}
{#each events as ev (ev.id)}
{new Date(ev.ts).toLocaleString()} {ev.type}
{:else}

No events yet.

{/each}
{/snippet} {#snippet agentActivityContent()}
{#each agentActivity as activity (activity.id)}
{new Date(activity.ts).toLocaleString()} {activity.activity_type}
{activity.agent_id}{activity.tool_name ? ` · ${activity.tool_name}` : ''}
{:else}

No agent activity.

{/each}
{/snippet} {#snippet auditContent()}
{#each auditEntries as entry (entry.id)}
{new Date(entry.ts).toLocaleString()} {entry.actor_type}
{entry.actor_id ?? '—'} · {entry.action}
{:else}

No audit entries.

{/each}
{/snippet} {@const sections = [ ...(ownContent ? [{ key: 'content', title: 'Content', count: 1, content: contentContent }] : []), { key: 'details', title: 'Details', count: 1, content: detailsContent }, { key: 'monitoring', title: 'Monitoring', count: checks.length, content: monitoringContent }, { key: 'attributes', title: 'Attributes', count: Object.keys(entity.attributes ?? {}).length, content: attributesContent }, { key: 'relations', title: 'Relations', count: outgoingRelations.length + incomingRelations.length, content: relationsContent }, { key: 'metrics', title: 'Metrics', count: metrics.length, content: metricsContent }, { key: 'signals', title: 'Signals', count: signals.length, content: signalsContent }, { key: 'tasks', title: 'Tasks', count: tasks.length, content: tasksContent }, { key: 'knowledge', title: 'Knowledge', count: knowledge.length, content: knowledgeContent }, { key: 'events', title: 'Recent events', count: events.length, content: eventsContent }, { key: 'agentActivity', title: 'Agent activity', count: agentActivity.length, content: agentActivityContent }, { key: 'audit', title: 'Audit trail', count: auditEntries.length, content: auditContent } ].sort((a, b) => (b.count > 0 ? 1 : 0) - (a.count > 0 ? 1 : 0))} {#each sections as section (section.key)} 0}> {@render section.content()} {/each} {/if}