(() => { const text = (value) => String(value ?? '').slice(0, 1200).replace(/[&<>"']/g, (character) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[character]); function render(activity) { if (!activity?.available) return '
Commit activity unavailable. No inactivity conclusion can be drawn. Use task history and current session state to review work.
'; const tasks = (activity.tasks ?? []).filter((task) => ['stale', 'unknown'].includes(task.status)) .sort((a, b) => Number(Boolean(b.ownerRequested)) - Number(Boolean(a.ownerRequested)) || (b.ageDays ?? -1) - (a.ageDays ?? -1) || String(a.taskId).localeCompare(String(b.taskId))); const stale = tasks.filter((task) => task.status === 'stale'); const unknown = tasks.filter((task) => task.status === 'unknown'); const group = (title, items) => `${text(task.taskId)}
${task.ownerRequested ? 'Owner request. ' : ''}${task.status === 'stale' ? `${text(task.ageDays)} days without a named commit.` : 'Absence of recent progress is unknown.'} ${task.expectedWaiting ? 'Blocked: waiting may be expected; review the dependency.' : ''}
${task.lastActivity ? `Last named commit ${text(task.lastActivity.commit)} at ${text(task.lastActivity.committedAt)}.
Closure mentioned in a commit; only verified landing can close the task.
' : ''}None in this observation.
'} ${items.length > 40 ? `Showing 40 of ${items.length}; inspect CLI activity for the remainder.
` : ''}`; return `Named-commit activity as of ${text(activity.generatedAt)}. Metadata edits do not reset inactivity. This is not a measure of uncommitted work.
${activity.complete ? 'Managed history scan complete within configured bounds.' : 'History coverage incomplete: unknown work must not be classified as neglected.'} Scanned ${text(activity.scannedCommits)} commits; review threshold ${text(activity.staleDays)} days.
${(activity.unavailableBranches ?? []).length ? `Unavailable branches: ${activity.unavailableBranches.map(text).join(', ')}.
` : ''} ${activity.truncated ? 'Commit scan truncated.
' : ''} ${(activity.futureCommits ?? []).length ? 'Future-dated commits excluded from activity; review repository clocks.
' : ''} ${group('Stale work — owner requests first', stale)}${group('Unknown activity — owner requests first', unknown)}Review against the authoritative work board. Observation never changes task state or closes work.
`; } globalThis.TorchTaskActivity = Object.freeze({ render }); })();