logical.journalPathfunctionno test imports itfunction journalPath(at: string): stringThe file of a day's entries, by the day of the instant (UTC).
The journal and the due assets, pure: where a day's entries are kept (journal/YYYY/MM/DD.jsonl), an entry as a line and the lines read back, the digest of a state, which kind of entry a look makes (every look, or only a change and a heartbeat, as the policy says; a failure always), and which assets are due to be looked at, by their cadences.
import { journalPath } from "./journal.ts";
journalPath("2026-12-01T10:00:00Z"); // "journal/2026/12/01.jsonl"logical.journalPathfunctionno test imports itfunction journalPath(at: string): stringThe file of a day's entries, by the day of the instant (UTC).
logical.statePathfunctionno test imports itfunction statePath(id: string): stringThe path of the state of an asset.
logical.encodeEntryfunctionno test imports itfunction encodeEntry(e: Document & { readonly seq: number; readonly previous: string; readonly type: string; readonly subject: string; readonly evidence: string; readonly digest: string; } & {}): stringAn entry as one line: its canonical form and a line break.
logical.decodeEntriesfunctionno test imports itfunction decodeEntries(text: string): Result<readonly (Document & { readonly seq: number; readonly previous: string; readonly type: string; readonly subject: string; readonly evidence: string; readonly digest: string; } & {})[], string>The entries of a text of lines, or the line that is not one.
logical.textDigestfunctionno test imports itfunction textDigest(text: string): Promise<string>The digest of a text: the SHA-256 of its bytes, in hexadecimal.
logical.Foundtypeno test imports ittype Found = { readonly kind: "state"; readonly digest: string } | { readonly kind: "failure"; readonly failure: CaptureFailure };What a look found: the state (its digest), or a failure.
logical.Beforetypeno test imports ittype Before = { readonly digest: string | undefined; readonly lastJournaledAt: string | undefined };What is known of an asset before the look: the digest of its kept state and when it was last journaled.
logical.entryTypeForfunctionno test imports itfunction entryTypeFor(found: Found, before: Before, policy: CapturePolicy, now: string): "capture.changed" | "capture.refused" | "capture.unchanged" | "capture.unreachable" | "capture.unreadable" | "push.failed" | "seal" | undefinedThe kind of entry a look makes, or nothing where it makes none. A state that differs from the kept one is capture.changed; one that is the same is capture.unchanged where every capture is journaled, and, where only changes and a heartbeat are, only when the asset was last journaled a heartbeat ago or more; a failure is always an entry.
logical.isJournalTypefunctionno test imports itfunction isJournalType(text: string): text is "capture.changed" | "capture.refused" | "capture.unchanged" | "capture.unreachable" | "capture.unreadable" | "push.failed" | "seal"The kinds of entry the journal knows.
logical.dueAssetsfunctionno test imports itfunction dueAssets(policy: CapturePolicy, assets: readonly Observed[], lastAttempt: (id: string) => string | undefined, now: string): readonly string[]The ids of the assets that are due to be looked at: the cadence of each (its own, or that of its state) has run since it was last looked at, within a second; an asset never looked at is due.
journalPathfunctionfunction journalPath(at: string): stringThe file of a day's entries, by the day of the instant (UTC).
statePathfunctionfunction statePath(id: string): stringThe path of the state of an asset.
encodeEntryfunctionfunction encodeEntry(e: Document & { readonly seq: number; readonly previous: string; readonly type: string; readonly subject: string; readonly evidence: string; readonly digest: string; } & {}): stringAn entry as one line: its canonical form and a line break.
decodeEntriesfunctionfunction decodeEntries(text: string): Result<readonly (Document & { readonly seq: number; readonly previous: string; readonly type: string; readonly subject: string; readonly evidence: string; readonly digest: string; } & {})[], string>The entries of a text of lines, or the line that is not one.
textDigestfunctionfunction textDigest(text: string): Promise<string>The digest of a text: the SHA-256 of its bytes, in hexadecimal.
Foundtypeno test imports ittype Found = { readonly kind: "state"; readonly digest: string } | { readonly kind: "failure"; readonly failure: CaptureFailure };What a look found: the state (its digest), or a failure.
Beforetypeno test imports ittype Before = { readonly digest: string | undefined; readonly lastJournaledAt: string | undefined };What is known of an asset before the look: the digest of its kept state and when it was last journaled.
entryTypeForfunctionfunction entryTypeFor(found: Found, before: Before, policy: CapturePolicy, now: string): "capture.changed" | "capture.refused" | "capture.unchanged" | "capture.unreachable" | "capture.unreadable" | "push.failed" | "seal" | undefinedThe kind of entry a look makes, or nothing where it makes none. A state that differs from the kept one is capture.changed; one that is the same is capture.unchanged where every capture is journaled, and, where only changes and a heartbeat are, only when the asset was last journaled a heartbeat ago or more; a failure is always an entry.
isJournalTypefunctionno test imports itfunction isJournalType(text: string): text is "capture.changed" | "capture.refused" | "capture.unchanged" | "capture.unreachable" | "capture.unreadable" | "push.failed" | "seal"The kinds of entry the journal knows.
dueAssetsfunctionfunction dueAssets(policy: CapturePolicy, assets: readonly Observed[], lastAttempt: (id: string) => string | undefined, now: string): readonly string[]The ids of the assets that are due to be looked at: the cadence of each (its own, or that of its state) has run since it was last looked at, within a second; an asset never looked at is due.