(function () { const text = (value) => String(value ?? '').slice(0, 4000).replace(/[&<>"']/g, (character) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[character]); const value = (input) => text(typeof input === 'object' ? JSON.stringify(input) : input); function frozen(snapshot) { if (!snapshot) return '

Frozen-input evidence not recorded.

'; if (snapshot.unavailable) return '

Frozen-input evidence unreadable.

'; return `

Frozen input commit ${text(snapshot.commit)}

Input digest ${text(snapshot.digest ?? snapshot.inputDigest)}

Copy strategy: ${text(snapshot.copyStrategy ?? 'not recorded')}. Recorded capture, not a new integrity check.

`; } function phase(label, observation) { if (!observation) return `

${label}: not recorded.

`; const entries = Object.entries(observation.report?.conditions ?? {}).slice(0, 100); return `

${label}: ${observation.valid === true ? 'contract valid' : 'invalid or unknown'}

${observation.reason ? `

${text(observation.reason)}

` : ''}
${entries.map(([key, observed]) => `
${text(key)}
${value(observed)}
`).join('')}
`; } function render(checks = {}) { const pending = (checks.prepared ?? []).filter((item) => ['prepared', 'running', 'abandoned'].includes(item.state)).slice(0, 40); const receipts = (checks.receipts ?? []).slice(0, 40); return `

Recorded check evidence. Running records do not prove a live executor; interrupted runs need review, not automatic rerun.

${pending.map((item) => `
${text(item.checkId)} · ${text(item.areaId)} · ${item.state === 'running' ? 'Running — completion unconfirmed' : item.state === 'abandoned' ? 'Abandoned — not qualified' : 'Prepared — awaiting execution'}

Preparation ${text(item.id)} · ${text(item.createdAt)}

${frozen(item.snapshot)} ${item.state === 'abandoned' ? `

${item.recovery?.cleanupStatus === 'completed' ? 'Captured-input cleanup completed (recorded).' : item.recovery?.cleanupStatus === 'pending' ? 'Captured-input cleanup pending. Owner review is required.' : 'Captured-input cleanup unconfirmed. Inspect the recovery record before acting.'}

${item.recovery?.recordedAt ? `

Recovery recorded ${text(item.recovery.recordedAt)}

` : ''} ${item.recovery?.cleanupReason ? `

Cleanup reason: ${text(item.recovery.cleanupReason)}

` : ''}

Stopped executors: ${item.recovery?.stoppedExecutors === 'owner-attested' ? 'owner-attested, not independently verified descendant termination' : 'unconfirmed'}. Recovery does not release resource leases or create a check pass. Use the owner-confirmed CLI recovery workflow; this view does not recover or rerun work.

` : ''}
`).join('')} ${receipts.length ? receipts.map((receipt) => `
${text(receipt.checkId)} · ${text(receipt.areaId)} · ${text(receipt.result)}

Commit ${text(receipt.commit)} · ${text(receipt.finishedAt)}

${receipt.invalidReason ? `

Qualification invalid: ${text(receipt.invalidReason)}

` : ''}${frozen(receipt.snapshot)} ${receipt.conditions ? (receipt.conditions.unavailable ? '

Condition evidence unreadable.

' : `

Conditions are project-reported pre/post observations, not independent sensor truth or continuous monitoring.

${phase('Before measurement', receipt.conditions.before)}${phase('After measurement', receipt.conditions.after)}`) : '

No condition observations recorded; this is not proof that runtime conditions were verified.

'}
`).join('') : '

No exact-commit check receipts.

'} ${checks.coverage ? `

${text(checks.coverage)}

` : ''}`; } globalThis.TorchCheckEvidence = Object.freeze({ render }); })();