# pub.techne.draft.commons.defs

> Shared views for the Commons API. Draft tier. Every record view is a record some repo published, as the commons indexed it; the operator views (releases) are the commons' own state; a takedown is an operator's own verdict record.

- Kind: defs
- Authority: commons.draft.techne.pub
- Lexicon: 1
- Published by [lexicons.techne.town](https://lexicon.garden/identity/did:plc:cbtfheqpi4g6vlrha4tpoh53), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.commons.defs)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.commons.defs/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.commons.defs/analytics)

## #chainStage (`pub.techne.draft.commons.defs#chainStage`)

Type: object

### Properties

- `rules` (array, required): Rule names, in the order they run.
  - `items` (string)
- `stage` (string, required)
  - Constraints: knownValues: source | curated

## #clusterView (`pub.techne.draft.commons.defs#clusterView`)

Type: object

A cluster as the curator published it: the curated record, its provenance, and the member records the provenance names. Only clusters whose curated record sits in the curator's own repo, and whose curator is trusted for both the curated record's collection and provenance, appear.

### Properties

- `curated` (ref, required)
  - Reference: `#recordView`
- `labels` (array): Trusted labels on the curated record now (unnegated, from a `src` whose declaration an admin writer (the commons root, or an operator the root names) vouches for with that value in `labels`). Shown only: labels hide nothing (a `spam` or `obscene` verdict does).
  - `items` (ref)
    - Reference: `#labelView`
- `members` (array, required): The provenance's `sources` that are still visible. A deleted member, or one whose account is not active, is left out.
  - `items` (ref)
    - Reference: `#recordView`
- `provenance` (ref, required)
  - Reference: `#sidecarView`
- `readiness` (string, required): Copied from the provenance.
  - Constraints: knownValues: complete | partial | superseded
- `rollup` (ref, required)
  - Reference: `#rollupView`
- `supersededBy` (string · at-uri): When `readiness` is `superseded`: the survivor, the other side of the curator's own trusted sameAs naming this curated record. It is set only when that record is visible, in the curator's repo, and of a collection the curator is endorsed for; ties go to the latest sameAs `createdAt`, then its AT-URI. Single hop: the survivor may itself be superseded (follow it with getCluster), and a curator that merged both ways can make two records name each other.

## #countGroup (`pub.techne.draft.commons.defs#countGroup`)

Type: object

### Properties

- `count` (integer, required)
- `handle` (string · handle): groupBy author only: the author's current handle (#identity), when one was announced. For display only.
- `key` (string, required)
- `latestAt` (string · datetime): When the newest record in this group was first indexed (an edit or a delete never moves it). Absent when unknown.

## #criterion (`pub.techne.draft.commons.defs#criterion`)

Type: object

One eligibility criterion, as the rules runner declares it.

### Properties

- `anyOf` (array): For `anyOf`.
  - `items` (ref)
    - Reference: `#criterion`
- `field` (string): For `has`.
- `is` (string, required): `has`: the field named in `field` is present and not blank. `notEnded`: the event's end (or start + 3 h) is in the future, or it has no schedule. `noRecordLocation`: no location is a place record. `noPoint`: the record states no coordinates of its own. `located`: some location is stated (place record, address, coordinates or cell). `mode`: the event's attendance mode is `mode`. `anyOf`: at least one criterion in `anyOf` holds. `notArea`: the place is not an area (`kind` is not `area`).
  - Constraints: knownValues: has | notEnded | noRecordLocation | noPoint | located | mode | anyOf | notArea
- `mode` (string): For `mode`.
  - Constraints: knownValues: virtual | hybrid | inperson

## #indexedPart (`pub.techne.draft.commons.defs#indexedPart`)

Type: object

What indexRecord did with one record the chain answer named.

### Properties

- `cid` (string · cid, required): The CID the chain answer named.
- `outcome` (string, required): `indexed`: stored from the author's PDS. `unchanged`: the commons already held it. `stale`: the index holds a newer version. `mismatch`: the author's PDS holds a different CID now (the firehose brings the current one). `missing`: the author's PDS does not hold it. `refused`: the shared check refused it.
  - Constraints: knownValues: indexed | unchanged | stale | mismatch | missing | refused
- `uri` (string · at-uri, required)

## #labelView (`pub.techne.draft.commons.defs#labelView`)

Type: object

A com.atproto.label.defs#label as the commons ingested it, with its trust verdict now.

### Properties

- `cid` (string · cid)
- `cts` (string · datetime, required)
- `neg` (boolean, required)
- `src` (string · did, required)
- `trusted` (boolean, required): An admin writer (the commons root, or an operator the root names) vouches for `src`'s declaration with this value in `labels` now.
- `uri` (string · uri, required)
- `val` (string, required)
  - Constraints: maxLength: 128

## #latencyView (`pub.techne.draft.commons.defs#latencyView`)

Type: object

Milliseconds over the window. A percentile backed by fewer than five samples is withheld (absent), so no figure is one record's timing.

### Properties

- `count` (integer, required)
- `maxMs` (integer)
- `p50Ms` (integer)
- `p95Ms` (integer)

## #metricsView (`pub.techne.draft.commons.defs#metricsView`)

Type: object

The rules runner's public latency summary (its /v1/metrics). `submitToCurated` is submit to visible for a record whose listing does not wait on moderation; `submitToLabelled` is submit to visible when it does.

### Properties

- `chain` (ref): Synchronous chain requests (POST /v1/chain), end to end.
  - Reference: `#latencyView`
- `chainPending` (integer): Chain requests in the window that answered pending.
- `clusterLockHold` (ref)
  - Reference: `#latencyView`
- `clusterLockHoldsLastHour` (integer): Holds of the cluster lock within the last hour.
- `clusterLockWait` (ref): How long each hold of the cluster lock waited for it first.
  - Reference: `#latencyView`
- `curatorWaitingOnCluster` (integer): Curator jobs still waiting for their record's cluster an hour after that version was stored: a wait no cluster refresh ends (e.g. a component past the size cap).
- `nearDuplicatePlaces` (ref): The latest daily list of places that may be duplicates. Absent before the first one.
  - Reference: `#nearDuplicatePlacesView`
- `providerBudgets` (array): The paid provider's daily budgets. Absent when the runner has no paid provider configured.
  - `items` (ref)
    - Reference: `#providerBudgetView`
- `rules` (array)
  - `items` (ref)
    - Reference: `#ruleLatency`
- `submitToCurated` (ref)
  - Reference: `#latencyView`
- `submitToLabelled` (ref)
  - Reference: `#latencyView`
- `windowHours` (integer, required)

## #nearDuplicatePair (`pub.techne.draft.commons.defs#nearDuplicatePair`)

Type: object

### Properties

- `a` (ref, required)
  - Reference: `#nearDuplicatePlace`
- `b` (ref, required)
  - Reference: `#nearDuplicatePlace`
- `distanceM` (integer, required): Metres between the closest members of the two.

## #nearDuplicatePlace (`pub.techne.draft.commons.defs#nearDuplicatePlace`)

Type: object

### Properties

- `name` (string, required): The name of the member that matched.
- `uri` (string · at-uri, required): The curated place record.

## #nearDuplicatePlacesView (`pub.techne.draft.commons.defs#nearDuplicatePlacesView`)

Type: object

Pairs of live curated places within 50 m whose names contain one another (whole words, case and punctuation folded) and that no rule has joined or judged (no distinctFrom, no containedIn between them), computed at most once a day.

### Properties

- `computedAt` (string · datetime, required)
- `pairs` (integer, required): How many pairs of curated places.
- `top` (array, required): The closest pairs first.
  - Constraints: maxLength: 50
  - `items` (ref)
    - Reference: `#nearDuplicatePair`

## #providerBudgetView (`pub.techne.draft.commons.defs#providerBudgetView`)

Type: object

One daily provider budget on the rules runner: its cap (the runaway-loop guard), today's spend (UTC), and the grants that extend it.

### Properties

- `budget` (string, required)
  - Constraints: knownValues: shared | own | research | summary
- `cap` (integer, required): Calls a UTC day may spend without a grant.
- `grantRemaining` (integer, required): Calls left in this budget's live grants.
- `grants` (array, required): Live grants, and grants that ended in the last 7 days.
  - `items` (ref)
    - Reference: `#providerGrantView`
- `spentToday` (integer, required): Calls reserved today, within the cap and from grants.

## #providerGrantView (`pub.techne.draft.commons.defs#providerGrantView`)

Type: object

One recorded allowance of paid provider (Jev or Claude) calls beyond the daily cap, granted by an operator for an intentional batch (a backfill). It adds calls only while it is live: before `expiresAt` and with calls left.

### Properties

- `budget` (string, required): Which daily budget it extends: `shared` (every caller's Jev runs, FEATURES_DAILY_CALL_CAP), `own` (Beacon's own writes, FEATURES_OWN_DAILY_CALL_CAP), `research` (Claude venue research, RESEARCH_DAILY_CALL_CAP) or `summary` (Claude's short line, SUMMARY_DAILY_CALL_CAP).
  - Constraints: knownValues: shared | own | research | summary
- `calls` (integer, required): Calls granted.
- `createdAt` (string · datetime, required)
- `expiresAt` (string · datetime, required)
- `grantedBy` (string, required): Who granted it: the operator's DID, or `operator-token` for the shared token.
- `id` (integer, required)
- `live` (boolean, required): Not expired and not used up: it adds calls now.
- `reason` (string, required)
- `used` (integer, required): Calls spent from it so far.

## #recordProof (`pub.techne.draft.commons.defs#recordProof`)

Type: object

A record's proof from its author's repo, as the commons fetched (com.atproto.sync.getRecord) and verified it when it indexed the record: the CAR holds the repo's signed commit, the MST path to the record's key and the record block. Check it yourself against the #atproto key in the author's DID document (the lexicons repo's techne-lexicon-check, feature `proof`: `proof::verify_record`). Served only when it proves the CID served.

### Properties

- `car` (bytes, required): The CAR file, as the author's PDS answered com.atproto.sync.getRecord.
  - Constraints: maxLength: 4194304
- `commit` (string · cid, required): The signed commit's CID (the CAR's root).
- `rev` (string, required): The signed commit's revision: a TID (techne-lexicon-check's verifier refuses a commit whose rev is not one).

## #recordView (`pub.techne.draft.commons.defs#recordView`)

Type: object

One indexed public record. A record is never returned when its author deleted it, its author's account is not active, a `!takedown` verdict is on it from a verdict writer vouched for `!takedown` (an operator writes one as themselves, in their own repo), a `spam` or `obscene` verdict is on this version from a verdict writer vouched for that value, or it is a curated record every source of which is hidden. Labels hide nothing. A recordView carries no provenance and no trust verdict (see #sidecarView for those). `indexedAt` is when this AppView indexed the record: it is local to this AppView, not a portable order.

### Properties

- `author` (string · did, required): The repo the record lives in.
- `authorHandle` (string · handle): The author's current handle, as the network last announced it (#identity); absent when none was announced. For display only: the author is its DID.
- `cid` (string · cid, required)
- `collection` (string · nsid, required)
- `indexedAt` (string · datetime, required)
- `rkey` (string · record-key, required)
- `uri` (string · at-uri, required)
- `value` (unknown, required): The record body.

## #rejectionView (`pub.techne.draft.commons.defs#rejectionView`)

Type: object

### Properties

- `author` (string · did, required)
- `cid` (string · cid)
- `collection` (string · nsid, required)
- `reason` (string, required)
- `seenAt` (string · datetime, required)
- `uri` (string · at-uri, required)

## #releaseComponent (`pub.techne.draft.commons.defs#releaseComponent`)

Type: object

### Properties

- `commit` (string, required): A hex commit id.
  - Constraints: minLength: 7, maxLength: 40
- `digest` (string): `sha256:` and 64 hex digits: the digest of the tested build. Required when `service` or `image` is given, so the deploy pulls exactly that build without rebuilding.
  - Constraints: maxLength: 100
- `image` (string)
  - Constraints: maxLength: 500
- `repo` (string, required): e.g. regenos, almanac-mirror, aei.
  - Constraints: minLength: 1, maxLength: 200
- `service` (string)
  - Constraints: maxLength: 100

## #releaseView (`pub.techne.draft.commons.defs#releaseView`)

Type: object

### Properties

- `by` (string, required): Which operator recorded it: its DID, or `operator-token` for the shared token.
- `components` (array, required)
  - `items` (ref)
    - Reference: `#releaseComponent`
- `createdAt` (string · datetime, required)
- `id` (integer, required)
- `name` (string, required)
- `note` (string)

## #rollupView (`pub.techne.draft.commons.defs#rollupView`)

Type: object

Whether a curated record is fully processed, rolled up when you read: its provenance (the merge receipt) says `complete`, and every rule at stage `curated` that an admin writer (the commons root, or an operator the root names) vouches for has a trusted pub.techne.draft.receipt for the curated record's current CID.

### Properties

- `complete` (boolean, required)
- `merge` (string, required): The provenance's readiness.
  - Constraints: knownValues: complete | partial | superseded
- `postMerge` (array, required): The vouched rules at stage `curated` and their receipts (the field keeps its old name).
  - `items` (ref)
    - Reference: `#ruleReceiptView`

## #ruleLatency (`pub.techne.draft.commons.defs#ruleLatency`)

Type: object

### Properties

- `outcomes` (ref)
  - Reference: `#ruleOutcomes`
- `phases` (ref)
  - Reference: `#rulePhases`
- `rule` (string, required): The rule's name.
- `run` (ref, required): Claims that got to the rule's run (real, failed or lost), not those put off or finished without a run.
  - Reference: `#latencyView`

## #ruleOutcomes (`pub.techne.draft.commons.defs#ruleOutcomes`)

Type: object

What the rule's claims in the window came to, by count. `real`: the rule ran; `deferred`: put off without getting anywhere (waiting on an input, or the rule asked to run later having written nothing); `ineligible`: finished without a run; `failed`: the run failed; `lost`: the claim went stale; `unclassified`: recorded before these classes.

### Properties

- `deferred` (integer, required)
- `failed` (integer, required)
- `ineligible` (integer, required)
- `lost` (integer, required)
- `real` (integer, required)
- `unclassified` (integer, required)

## #rulePhases (`pub.techne.draft.commons.defs#rulePhases`)

Type: object

Where the time of the rule's real runs went: its own run, then the keying its finish did; `lockWait` is the part of the keying spent waiting for the cluster lock.

### Properties

- `keying` (ref, required)
  - Reference: `#latencyView`
- `lockWait` (ref, required)
  - Reference: `#latencyView`
- `run` (ref, required)
  - Reference: `#latencyView`

## #ruleReceiptView (`pub.techne.draft.commons.defs#ruleReceiptView`)

Type: object

One vouched rule at stage `curated` and its receipt for the curated record, if any.

### Properties

- `current` (boolean, required): The receipt names the curated record's current CID.
- `labelerDeclared` (boolean): Not filled: the commons reads no #atproto_label key from DID documents now (atproto labels are an export only), so no receipt depends on one.
- `name` (string): From the rule's vouched publisher declaration (its `name`).
- `outputs` (array)
  - `items` (string · at-uri)
- `receipt` (string · at-uri): The rule's latest trusted receipt for this curated record, at any CID. getRecord on it answers the receipt with its proof (#recordProof).
- `rule` (string · did, required)

## #ruleView (`pub.techne.draft.commons.defs#ruleView`)

Type: object

A rule: what its host declares and whether an admin writer (the commons root, or an operator the root names) vouches for its declaration now.

### Properties

- `codeRepo` (string)
- `commit` (string)
- `declarationDiffers` (array): Which of these the host's live declaration says otherwise than the vouched publisher declaration (lists compared as sets). Only when both exist; absent when they agree. An operator endorses again to bring them together.
  - `items` (string)
    - Constraints: knownValues: reads | writes | stage | matches | labels
- `description` (string): What the rule does, in one or two plain sentences, from its host's declaration, else its publisher declaration.
- `did` (string · did, required)
- `endorsed` (boolean, required)
- `endorsedCommit` (string): The commit the vouched declaration names; differs from `commit` when the host runs newer code than the admin writer vouched for.
- `endorsement` (string · at-uri)
- `handle` (string): The rule DID's current handle, as the network last announced it (#identity); else as its host reports it. For display; never used to identify the rule.
- `host` (string, required)
  - Constraints: knownValues: runner | apicoop | endorsed-only
- `labels` (array): The label values the rule may emit, as its host declares them; its publisher declaration lists them, and a reader honours a label only if the src's vouched declaration lists that value.
  - `items` (string)
- `matches` (array): The record collections the rule's sameAs and distinctFrom pairs may join. Absent for a rule that writes neither.
  - `items` (string)
- `name` (string, required)
- `paused` (boolean): The host has paused the rule (no new jobs).
- `reads` (array, required): Generated from the rule's code: its triggers and what its needs read.
  - `items` (string)
- `stage` (string)
  - Constraints: knownValues: source | curated
- `title` (string): What a person reading the pipeline calls the rule, from its host's declaration, else its publisher declaration. Absent: show `name`.
- `trigger` (string): When the rule runs, in words, for a rule no record criteria describe. For the commons' adjudicator and takedowns rules this is `never`: operators write pair decisions and takedowns themselves.
- `triggers` (array): The collections whose records queue a job for the rule, as its host declares them. Absent for an account known only from its publisher declaration, or one no record triggers.
  - `items` (string)
- `version` (string)
- `when` (array): The rule's eligibility as its host declares it. Empty or absent: always eligible.
  - `items` (ref)
    - Reference: `#whenCollection`
- `writes` (array, required)
  - `items` (string)

## #scraperAlert (`pub.techne.draft.commons.defs#scraperAlert`)

Type: object

### Properties

- `floor` (boolean, required): true: the value is below a `min…` floor; false: above a ceiling.
- `measure` (string, required)
  - Constraints: knownValues: records | missingLocation | missingStartsAt
- `source` (string, required): The source id (or the scraper's name, for a scraper with one account).
- `threshold` (string, required): The bound it broke, as a decimal string.
- `value` (string, required): The measure's value, as a decimal string.

## #scraperRunView (`pub.techne.draft.commons.defs#scraperRunView`)

Type: object

### Properties

- `alerts` (array): The thresholds the run's measures broke (the scraper type's default, then config.alerts, then config.alerts.sources.<id>). Empty when none.
  - `items` (ref)
    - Reference: `#scraperAlert`
- `codeRef` (string, required): The code reference the run was claimed with.
- `codeSha` (string): The commit or image digest the runner reports it actually ran.
- `errors` (integer)
- `finishedAt` (string · datetime)
- `id` (integer, required)
- `log` (string): The end of the run's output, at most 8000 characters.
- `measures` (unknown): An ok run's measures per source it ran: `{source id: {records, missingLocation, missingStartsAt}}`. `records` is the events the run saw (their source sidecars say seen on the run's day); the others are shares of them, null when it saw none.
- `missing` (integer): Known items it did not see this time.
- `published` (integer): Records it wrote.
- `requestedBy` (string): The operator whose runScraper started it; absent for a scheduled run.
- `runner` (string): Which runner claimed it.
- `saw` (integer): Source items the scraper saw.
- `scraper` (string, required)
- `startedAt` (string · datetime, required)
- `status` (string, required): `running` until the runner reports; `lost` once a claim finds it has not reported within the commons' 12 h lease.
  - Constraints: knownValues: running | ok | failed | lost

## #scraperView (`pub.techne.draft.commons.defs#scraperView`)

Type: object

### Properties

- `account` (string · did, required): The source account it publishes as.
- `cadenceSecs` (integer, required)
- `codeRef` (string, required): The pinned code: a git commit SHA of the scrapers repository, or a container image pinned by digest (`<registry>/<name>@sha256:<64 hex>`) under a registry the commons allows.
- `config` (unknown, required): The JSON object handed to the scraper.
- `createdAt` (string · datetime, required)
- `enabled` (boolean, required)
- `lastRun` (ref)
  - Reference: `pub.techne.draft.commons.defs#scraperRunView`
- `name` (string, required)
- `nextRunAt` (string · datetime): When it is due: while a runScraper request waits, its time (enabled or not); otherwise, while enabled, the start of its last run that was not lost plus its cadence, or now when none was. A lost run does not push it out: the runner does not wait for one either. Absent while it is disabled with no run asked for.
- `runRequestedAt` (string · datetime): An operator asked for a run now (runScraper) that is not claimed yet.
- `runRequestedBy` (string): The operator who asked (runScraper): its DID, or `operator-token` for the shared token.
- `updatedAt` (string · datetime, required)
- `updatedBy` (string, required): Which operator last registered or changed it: its DID, or `operator-token` for the shared token.

## #serviceHealth (`pub.techne.draft.commons.defs#serviceHealth`)

Type: object

### Properties

- `detail` (string): Why it is not healthy, in a few words. For an anonymous caller only the reported status or HTTP code, never a connection error.
- `httpStatus` (integer)
- `latencyMs` (integer, required)
- `name` (string, required)
- `service` (string): The service name its /health reports.
- `sha` (string): The commit it reports running.
- `state` (string, required)
  - Constraints: knownValues: healthy | failing | unreachable
- `url` (string · uri): The /health URL read. Operator only.

## #sidecarView (`pub.techne.draft.commons.defs#sidecarView`)

Type: object

A record about another record (a rule's assertion, a profile, a provenance), with the commons' trust verdict. A sidecar is trusted only while its author's own pub.techne.draft.publisher declaration (rkey `self`) lists the sidecar's collection in `writes` and an admin writer vouches for that declaration: a pub.techne.draft.credential in the repo of the commons root, or of an operator the root names, pinned to the declaration's current CID, with no pub.techne.draft.credentialRevocation at the address it names or at the same rkey in the root's repo. An edited declaration is untrusted until an admin writer re-issues. The verdict is computed when you read, so revoking the credential untrusts every sidecar that account published, past ones included.

### Properties

- `author` (string · did, required)
- `authorHandle` (string · handle): The author's current handle, as the network last announced it (#identity); absent when none was announced. For display only: the author is its DID.
- `cid` (string · cid, required)
- `collection` (string · nsid, required)
- `endorsement` (string · at-uri): The vouched declaration (the author's publisher/self) that makes it trusted. Present exactly when `trusted` is true.
- `indexedAt` (string · datetime, required)
- `rkey` (string · record-key, required)
- `trusted` (boolean, required)
- `uri` (string · at-uri, required)
- `value` (unknown, required)

## #statusView (`pub.techne.draft.commons.defs#statusView`)

Type: object

### Properties

- `accountsError` (string): Why the accounts could not be signed in to. The text only for an operator; anonymous callers see `unavailable`.
- `adjudicator` (string · did): The commons' adjudicator account. It writes no new pair decisions (operators write them in their own repos); the ones it wrote before stay trusted while an admin writer vouches for it.
- `apicoop` (string · did): The commons' own account.
- `commonsRoot` (string · did): The commons root: its credentials, and those of the operators it names, decide trust.
- `labels` (object, required)
- `operatorActions` (boolean, required): An operator credential is configured.
- `providerBudgets` (array): As getMetrics: caps, today's spend and grants. Absent without a runner or a paid provider.
  - `items` (ref)
    - Reference: `#providerBudgetView`
- `rejections` (integer, required)
- `runner` (boolean, required): A rules runner is configured.
- `services` (array): Each staging service the commons is configured to watch (HEALTH_URLS), read from its /health when this was asked.
  - `items` (ref)
    - Reference: `#serviceHealth`
- `sha` (string, required)
- `stewards` (string · did): The stewards collective: its open pub.techne.draft.membership records (subject = a steward's DID) are the steward list, public; Beacon's Featured is the stewards' public event listings. Only commons operators change it (setSteward). A steward here is a role-10 (member) membership of the "Stewards" collective, not the role-40 "steward" of membership.json's role registry. Absent when the commons pins none (STEWARDS_DID).
- `takedowns` (integer, required)

## #takedownView (`pub.techne.draft.commons.defs#takedownView`)

Type: object

### Properties

- `by` (string, required): The verdict's author: the DID that wrote the `!takedown` verdict in its own repo (an operator; or the Commons API's own account, for takedowns it wrote before operators wrote them as themselves).
- `createdAt` (string · datetime, required)
- `reason` (string, required)
- `uri` (string · at-uri, required)

## #visibilityView (`pub.techne.draft.commons.defs#visibilityView`)

Type: object

Submit to visible as the commons measures it: for each curated record that became listable in the commons in the window (a trusted provenance over a visible curated record, as listClusters lists it), from the latest `createdAt` among its source records to when the commons indexed what made it listable (its provenance, its curated record, or the credential that trusted it), the first time only. The PDS to Jetstream delay, the rules and the curator, and the commons' indexing are all inside it. A record whose submit predates the window (a backfill) is counted in `older`, one whose `createdAt` is after it became listable (a skewed or forged clock) in `future`; neither is in the latency.

### Properties

- `future` (integer, required)
  - Constraints: minimum: 0
- `older` (integer, required)
  - Constraints: minimum: 0
- `submitToVisible` (ref, required)
  - Reference: `#latencyView`
- `windowHours` (integer, required)

## #whenCollection (`pub.techne.draft.commons.defs#whenCollection`)

Type: object

A rule's eligibility for one collection pattern it reads: a record is queued only when every criterion holds. A collection with no entry is always eligible.

### Properties

- `all` (array, required)
  - `items` (ref)
    - Reference: `#criterion`
- `collection` (string, required): An NSID or a `prefix.*` pattern.
- `outputs` (array): Per output collection: what must also hold for the rule to write it.
  - `items` (ref)
    - Reference: `#whenOutput`

## #whenOutput (`pub.techne.draft.commons.defs#whenOutput`)

Type: object

### Properties

- `all` (array, required)
  - `items` (ref)
    - Reference: `#criterion`
- `output` (string, required): The collection the rule writes.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "chainStage": {
      "properties": {
        "rules": {
          "description": "Rule names, in the order they run.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "stage": {
          "knownValues": [
            "source",
            "curated"
          ],
          "type": "string"
        }
      },
      "required": [
        "stage",
        "rules"
      ],
      "type": "object"
    },
    "clusterView": {
      "description": "A cluster as the curator published it: the curated record, its provenance, and the member records the provenance names. Only clusters whose curated record sits in the curator's own repo, and whose curator is trusted for both the curated record's collection and provenance, appear.",
      "properties": {
        "curated": {
          "ref": "#recordView",
          "type": "ref"
        },
        "labels": {
          "description": "Trusted labels on the curated record now (unnegated, from a `src` whose declaration an admin writer (the commons root, or an operator the root names) vouches for with that value in `labels`). Shown only: labels hide nothing (a `spam` or `obscene` verdict does).",
          "items": {
            "ref": "#labelView",
            "type": "ref"
          },
          "type": "array"
        },
        "members": {
          "description": "The provenance's `sources` that are still visible. A deleted member, or one whose account is not active, is left out.",
          "items": {
            "ref": "#recordView",
            "type": "ref"
          },
          "type": "array"
        },
        "provenance": {
          "ref": "#sidecarView",
          "type": "ref"
        },
        "readiness": {
          "description": "Copied from the provenance.",
          "knownValues": [
            "complete",
            "partial",
            "superseded"
          ],
          "type": "string"
        },
        "rollup": {
          "ref": "#rollupView",
          "type": "ref"
        },
        "supersededBy": {
          "description": "When `readiness` is `superseded`: the survivor, the other side of the curator's own trusted sameAs naming this curated record. It is set only when that record is visible, in the curator's repo, and of a collection the curator is endorsed for; ties go to the latest sameAs `createdAt`, then its AT-URI. Single hop: the survivor may itself be superseded (follow it with getCluster), and a curator that merged both ways can make two records name each other.",
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "curated",
        "provenance",
        "readiness",
        "members",
        "rollup"
      ],
      "type": "object"
    },
    "countGroup": {
      "properties": {
        "count": {
          "type": "integer"
        },
        "handle": {
          "description": "groupBy author only: the author's current handle (#identity), when one was announced. For display only.",
          "format": "handle",
          "type": "string"
        },
        "key": {
          "type": "string"
        },
        "latestAt": {
          "description": "When the newest record in this group was first indexed (an edit or a delete never moves it). Absent when unknown.",
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "key",
        "count"
      ],
      "type": "object"
    },
    "criterion": {
      "description": "One eligibility criterion, as the rules runner declares it.",
      "properties": {
        "anyOf": {
          "description": "For `anyOf`.",
          "items": {
            "ref": "#criterion",
            "type": "ref"
          },
          "type": "array"
        },
        "field": {
          "description": "For `has`.",
          "type": "string"
        },
        "is": {
          "description": "`has`: the field named in `field` is present and not blank. `notEnded`: the event's end (or start + 3 h) is in the future, or it has no schedule. `noRecordLocation`: no location is a place record. `noPoint`: the record states no coordinates of its own. `located`: some location is stated (place record, address, coordinates or cell). `mode`: the event's attendance mode is `mode`. `anyOf`: at least one criterion in `anyOf` holds. `notArea`: the place is not an area (`kind` is not `area`).",
          "knownValues": [
            "has",
            "notEnded",
            "noRecordLocation",
            "noPoint",
            "located",
            "mode",
            "anyOf",
            "notArea"
          ],
          "type": "string"
        },
        "mode": {
          "description": "For `mode`.",
          "knownValues": [
            "virtual",
            "hybrid",
            "inperson"
          ],
          "type": "string"
        }
      },
      "required": [
        "is"
      ],
      "type": "object"
    },
    "indexedPart": {
      "description": "What indexRecord did with one record the chain answer named.",
      "properties": {
        "cid": {
          "description": "The CID the chain answer named.",
          "format": "cid",
          "type": "string"
        },
        "outcome": {
          "description": "`indexed`: stored from the author's PDS. `unchanged`: the commons already held it. `stale`: the index holds a newer version. `mismatch`: the author's PDS holds a different CID now (the firehose brings the current one). `missing`: the author's PDS does not hold it. `refused`: the shared check refused it.",
          "knownValues": [
            "indexed",
            "unchanged",
            "stale",
            "mismatch",
            "missing",
            "refused"
          ],
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "cid",
        "outcome"
      ],
      "type": "object"
    },
    "labelView": {
      "description": "A com.atproto.label.defs#label as the commons ingested it, with its trust verdict now.",
      "properties": {
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "cts": {
          "format": "datetime",
          "type": "string"
        },
        "neg": {
          "type": "boolean"
        },
        "src": {
          "format": "did",
          "type": "string"
        },
        "trusted": {
          "description": "An admin writer (the commons root, or an operator the root names) vouches for `src`'s declaration with this value in `labels` now.",
          "type": "boolean"
        },
        "uri": {
          "format": "uri",
          "type": "string"
        },
        "val": {
          "maxLength": 128,
          "type": "string"
        }
      },
      "required": [
        "src",
        "uri",
        "val",
        "neg",
        "cts",
        "trusted"
      ],
      "type": "object"
    },
    "latencyView": {
      "description": "Milliseconds over the window. A percentile backed by fewer than five samples is withheld (absent), so no figure is one record's timing.",
      "properties": {
        "count": {
          "type": "integer"
        },
        "maxMs": {
          "type": "integer"
        },
        "p50Ms": {
          "type": "integer"
        },
        "p95Ms": {
          "type": "integer"
        }
      },
      "required": [
        "count"
      ],
      "type": "object"
    },
    "metricsView": {
      "description": "The rules runner's public latency summary (its /v1/metrics). `submitToCurated` is submit to visible for a record whose listing does not wait on moderation; `submitToLabelled` is submit to visible when it does.",
      "properties": {
        "chain": {
          "description": "Synchronous chain requests (POST /v1/chain), end to end.",
          "ref": "#latencyView",
          "type": "ref"
        },
        "chainPending": {
          "description": "Chain requests in the window that answered pending.",
          "type": "integer"
        },
        "clusterLockHold": {
          "ref": "#latencyView",
          "type": "ref"
        },
        "clusterLockHoldsLastHour": {
          "description": "Holds of the cluster lock within the last hour.",
          "type": "integer"
        },
        "clusterLockWait": {
          "description": "How long each hold of the cluster lock waited for it first.",
          "ref": "#latencyView",
          "type": "ref"
        },
        "curatorWaitingOnCluster": {
          "description": "Curator jobs still waiting for their record's cluster an hour after that version was stored: a wait no cluster refresh ends (e.g. a component past the size cap).",
          "type": "integer"
        },
        "nearDuplicatePlaces": {
          "description": "The latest daily list of places that may be duplicates. Absent before the first one.",
          "ref": "#nearDuplicatePlacesView",
          "type": "ref"
        },
        "providerBudgets": {
          "description": "The paid provider's daily budgets. Absent when the runner has no paid provider configured.",
          "items": {
            "ref": "#providerBudgetView",
            "type": "ref"
          },
          "type": "array"
        },
        "rules": {
          "items": {
            "ref": "#ruleLatency",
            "type": "ref"
          },
          "type": "array"
        },
        "submitToCurated": {
          "ref": "#latencyView",
          "type": "ref"
        },
        "submitToLabelled": {
          "ref": "#latencyView",
          "type": "ref"
        },
        "windowHours": {
          "type": "integer"
        }
      },
      "required": [
        "windowHours"
      ],
      "type": "object"
    },
    "nearDuplicatePair": {
      "properties": {
        "a": {
          "ref": "#nearDuplicatePlace",
          "type": "ref"
        },
        "b": {
          "ref": "#nearDuplicatePlace",
          "type": "ref"
        },
        "distanceM": {
          "description": "Metres between the closest members of the two.",
          "type": "integer"
        }
      },
      "required": [
        "distanceM",
        "a",
        "b"
      ],
      "type": "object"
    },
    "nearDuplicatePlace": {
      "properties": {
        "name": {
          "description": "The name of the member that matched.",
          "type": "string"
        },
        "uri": {
          "description": "The curated place record.",
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "name"
      ],
      "type": "object"
    },
    "nearDuplicatePlacesView": {
      "description": "Pairs of live curated places within 50 m whose names contain one another (whole words, case and punctuation folded) and that no rule has joined or judged (no distinctFrom, no containedIn between them), computed at most once a day.",
      "properties": {
        "computedAt": {
          "format": "datetime",
          "type": "string"
        },
        "pairs": {
          "description": "How many pairs of curated places.",
          "type": "integer"
        },
        "top": {
          "description": "The closest pairs first.",
          "items": {
            "ref": "#nearDuplicatePair",
            "type": "ref"
          },
          "maxLength": 50,
          "type": "array"
        }
      },
      "required": [
        "computedAt",
        "pairs",
        "top"
      ],
      "type": "object"
    },
    "providerBudgetView": {
      "description": "One daily provider budget on the rules runner: its cap (the runaway-loop guard), today's spend (UTC), and the grants that extend it.",
      "properties": {
        "budget": {
          "knownValues": [
            "shared",
            "own",
            "research",
            "summary"
          ],
          "type": "string"
        },
        "cap": {
          "description": "Calls a UTC day may spend without a grant.",
          "type": "integer"
        },
        "grantRemaining": {
          "description": "Calls left in this budget's live grants.",
          "type": "integer"
        },
        "grants": {
          "description": "Live grants, and grants that ended in the last 7 days.",
          "items": {
            "ref": "#providerGrantView",
            "type": "ref"
          },
          "type": "array"
        },
        "spentToday": {
          "description": "Calls reserved today, within the cap and from grants.",
          "type": "integer"
        }
      },
      "required": [
        "budget",
        "cap",
        "spentToday",
        "grantRemaining",
        "grants"
      ],
      "type": "object"
    },
    "providerGrantView": {
      "description": "One recorded allowance of paid provider (Jev or Claude) calls beyond the daily cap, granted by an operator for an intentional batch (a backfill). It adds calls only while it is live: before `expiresAt` and with calls left.",
      "properties": {
        "budget": {
          "description": "Which daily budget it extends: `shared` (every caller's Jev runs, FEATURES_DAILY_CALL_CAP), `own` (Beacon's own writes, FEATURES_OWN_DAILY_CALL_CAP), `research` (Claude venue research, RESEARCH_DAILY_CALL_CAP) or `summary` (Claude's short line, SUMMARY_DAILY_CALL_CAP).",
          "knownValues": [
            "shared",
            "own",
            "research",
            "summary"
          ],
          "type": "string"
        },
        "calls": {
          "description": "Calls granted.",
          "type": "integer"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "expiresAt": {
          "format": "datetime",
          "type": "string"
        },
        "grantedBy": {
          "description": "Who granted it: the operator's DID, or `operator-token` for the shared token.",
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "live": {
          "description": "Not expired and not used up: it adds calls now.",
          "type": "boolean"
        },
        "reason": {
          "type": "string"
        },
        "used": {
          "description": "Calls spent from it so far.",
          "type": "integer"
        }
      },
      "required": [
        "id",
        "budget",
        "calls",
        "used",
        "expiresAt",
        "reason",
        "grantedBy",
        "createdAt",
        "live"
      ],
      "type": "object"
    },
    "recordProof": {
      "description": "A record's proof from its author's repo, as the commons fetched (com.atproto.sync.getRecord) and verified it when it indexed the record: the CAR holds the repo's signed commit, the MST path to the record's key and the record block. Check it yourself against the #atproto key in the author's DID document (the lexicons repo's techne-lexicon-check, feature `proof`: `proof::verify_record`). Served only when it proves the CID served.",
      "properties": {
        "car": {
          "description": "The CAR file, as the author's PDS answered com.atproto.sync.getRecord.",
          "maxLength": 4194304,
          "type": "bytes"
        },
        "commit": {
          "description": "The signed commit's CID (the CAR's root).",
          "format": "cid",
          "type": "string"
        },
        "rev": {
          "description": "The signed commit's revision: a TID (techne-lexicon-check's verifier refuses a commit whose rev is not one).",
          "type": "string"
        }
      },
      "required": [
        "car",
        "commit",
        "rev"
      ],
      "type": "object"
    },
    "recordView": {
      "description": "One indexed public record. A record is never returned when its author deleted it, its author's account is not active, a `!takedown` verdict is on it from a verdict writer vouched for `!takedown` (an operator writes one as themselves, in their own repo), a `spam` or `obscene` verdict is on this version from a verdict writer vouched for that value, or it is a curated record every source of which is hidden. Labels hide nothing. A recordView carries no provenance and no trust verdict (see #sidecarView for those). `indexedAt` is when this AppView indexed the record: it is local to this AppView, not a portable order.",
      "properties": {
        "author": {
          "description": "The repo the record lives in.",
          "format": "did",
          "type": "string"
        },
        "authorHandle": {
          "description": "The author's current handle, as the network last announced it (#identity); absent when none was announced. For display only: the author is its DID.",
          "format": "handle",
          "type": "string"
        },
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "collection": {
          "format": "nsid",
          "type": "string"
        },
        "indexedAt": {
          "format": "datetime",
          "type": "string"
        },
        "rkey": {
          "format": "record-key",
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        },
        "value": {
          "description": "The record body.",
          "type": "unknown"
        }
      },
      "required": [
        "uri",
        "cid",
        "author",
        "collection",
        "rkey",
        "value",
        "indexedAt"
      ],
      "type": "object"
    },
    "rejectionView": {
      "properties": {
        "author": {
          "format": "did",
          "type": "string"
        },
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "collection": {
          "format": "nsid",
          "type": "string"
        },
        "reason": {
          "type": "string"
        },
        "seenAt": {
          "format": "datetime",
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "author",
        "collection",
        "reason",
        "seenAt"
      ],
      "type": "object"
    },
    "releaseComponent": {
      "properties": {
        "commit": {
          "description": "A hex commit id.",
          "maxLength": 40,
          "minLength": 7,
          "type": "string"
        },
        "digest": {
          "description": "`sha256:` and 64 hex digits: the digest of the tested build. Required when `service` or `image` is given, so the deploy pulls exactly that build without rebuilding.",
          "maxLength": 100,
          "type": "string"
        },
        "image": {
          "maxLength": 500,
          "type": "string"
        },
        "repo": {
          "description": "e.g. regenos, almanac-mirror, aei.",
          "maxLength": 200,
          "minLength": 1,
          "type": "string"
        },
        "service": {
          "maxLength": 100,
          "type": "string"
        }
      },
      "required": [
        "repo",
        "commit"
      ],
      "type": "object"
    },
    "releaseView": {
      "properties": {
        "by": {
          "description": "Which operator recorded it: its DID, or `operator-token` for the shared token.",
          "type": "string"
        },
        "components": {
          "items": {
            "ref": "#releaseComponent",
            "type": "ref"
          },
          "type": "array"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "components",
        "createdAt",
        "by"
      ],
      "type": "object"
    },
    "rollupView": {
      "description": "Whether a curated record is fully processed, rolled up when you read: its provenance (the merge receipt) says `complete`, and every rule at stage `curated` that an admin writer (the commons root, or an operator the root names) vouches for has a trusted pub.techne.draft.receipt for the curated record's current CID.",
      "properties": {
        "complete": {
          "type": "boolean"
        },
        "merge": {
          "description": "The provenance's readiness.",
          "knownValues": [
            "complete",
            "partial",
            "superseded"
          ],
          "type": "string"
        },
        "postMerge": {
          "description": "The vouched rules at stage `curated` and their receipts (the field keeps its old name).",
          "items": {
            "ref": "#ruleReceiptView",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "complete",
        "merge",
        "postMerge"
      ],
      "type": "object"
    },
    "ruleLatency": {
      "properties": {
        "outcomes": {
          "ref": "#ruleOutcomes",
          "type": "ref"
        },
        "phases": {
          "ref": "#rulePhases",
          "type": "ref"
        },
        "rule": {
          "description": "The rule's name.",
          "type": "string"
        },
        "run": {
          "description": "Claims that got to the rule's run (real, failed or lost), not those put off or finished without a run.",
          "ref": "#latencyView",
          "type": "ref"
        }
      },
      "required": [
        "rule",
        "run"
      ],
      "type": "object"
    },
    "ruleOutcomes": {
      "description": "What the rule's claims in the window came to, by count. `real`: the rule ran; `deferred`: put off without getting anywhere (waiting on an input, or the rule asked to run later having written nothing); `ineligible`: finished without a run; `failed`: the run failed; `lost`: the claim went stale; `unclassified`: recorded before these classes.",
      "properties": {
        "deferred": {
          "type": "integer"
        },
        "failed": {
          "type": "integer"
        },
        "ineligible": {
          "type": "integer"
        },
        "lost": {
          "type": "integer"
        },
        "real": {
          "type": "integer"
        },
        "unclassified": {
          "type": "integer"
        }
      },
      "required": [
        "real",
        "deferred",
        "ineligible",
        "failed",
        "lost",
        "unclassified"
      ],
      "type": "object"
    },
    "rulePhases": {
      "description": "Where the time of the rule's real runs went: its own run, then the keying its finish did; `lockWait` is the part of the keying spent waiting for the cluster lock.",
      "properties": {
        "keying": {
          "ref": "#latencyView",
          "type": "ref"
        },
        "lockWait": {
          "ref": "#latencyView",
          "type": "ref"
        },
        "run": {
          "ref": "#latencyView",
          "type": "ref"
        }
      },
      "required": [
        "run",
        "keying",
        "lockWait"
      ],
      "type": "object"
    },
    "ruleReceiptView": {
      "description": "One vouched rule at stage `curated` and its receipt for the curated record, if any.",
      "properties": {
        "current": {
          "description": "The receipt names the curated record's current CID.",
          "type": "boolean"
        },
        "labelerDeclared": {
          "description": "Not filled: the commons reads no #atproto_label key from DID documents now (atproto labels are an export only), so no receipt depends on one.",
          "type": "boolean"
        },
        "name": {
          "description": "From the rule's vouched publisher declaration (its `name`).",
          "type": "string"
        },
        "outputs": {
          "items": {
            "format": "at-uri",
            "type": "string"
          },
          "type": "array"
        },
        "receipt": {
          "description": "The rule's latest trusted receipt for this curated record, at any CID. getRecord on it answers the receipt with its proof (#recordProof).",
          "format": "at-uri",
          "type": "string"
        },
        "rule": {
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "rule",
        "current"
      ],
      "type": "object"
    },
    "ruleView": {
      "description": "A rule: what its host declares and whether an admin writer (the commons root, or an operator the root names) vouches for its declaration now.",
      "properties": {
        "codeRepo": {
          "type": "string"
        },
        "commit": {
          "type": "string"
        },
        "declarationDiffers": {
          "description": "Which of these the host's live declaration says otherwise than the vouched publisher declaration (lists compared as sets). Only when both exist; absent when they agree. An operator endorses again to bring them together.",
          "items": {
            "knownValues": [
              "reads",
              "writes",
              "stage",
              "matches",
              "labels"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "description": "What the rule does, in one or two plain sentences, from its host's declaration, else its publisher declaration.",
          "type": "string"
        },
        "did": {
          "format": "did",
          "type": "string"
        },
        "endorsed": {
          "type": "boolean"
        },
        "endorsedCommit": {
          "description": "The commit the vouched declaration names; differs from `commit` when the host runs newer code than the admin writer vouched for.",
          "type": "string"
        },
        "endorsement": {
          "format": "at-uri",
          "type": "string"
        },
        "handle": {
          "description": "The rule DID's current handle, as the network last announced it (#identity); else as its host reports it. For display; never used to identify the rule.",
          "type": "string"
        },
        "host": {
          "knownValues": [
            "runner",
            "apicoop",
            "endorsed-only"
          ],
          "type": "string"
        },
        "labels": {
          "description": "The label values the rule may emit, as its host declares them; its publisher declaration lists them, and a reader honours a label only if the src's vouched declaration lists that value.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "matches": {
          "description": "The record collections the rule's sameAs and distinctFrom pairs may join. Absent for a rule that writes neither.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "name": {
          "type": "string"
        },
        "paused": {
          "description": "The host has paused the rule (no new jobs).",
          "type": "boolean"
        },
        "reads": {
          "description": "Generated from the rule's code: its triggers and what its needs read.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "stage": {
          "knownValues": [
            "source",
            "curated"
          ],
          "type": "string"
        },
        "title": {
          "description": "What a person reading the pipeline calls the rule, from its host's declaration, else its publisher declaration. Absent: show `name`.",
          "type": "string"
        },
        "trigger": {
          "description": "When the rule runs, in words, for a rule no record criteria describe. For the commons' adjudicator and takedowns rules this is `never`: operators write pair decisions and takedowns themselves.",
          "type": "string"
        },
        "triggers": {
          "description": "The collections whose records queue a job for the rule, as its host declares them. Absent for an account known only from its publisher declaration, or one no record triggers.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "version": {
          "type": "string"
        },
        "when": {
          "description": "The rule's eligibility as its host declares it. Empty or absent: always eligible.",
          "items": {
            "ref": "#whenCollection",
            "type": "ref"
          },
          "type": "array"
        },
        "writes": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "did",
        "name",
        "reads",
        "writes",
        "host",
        "endorsed"
      ],
      "type": "object"
    },
    "scraperAlert": {
      "properties": {
        "floor": {
          "description": "true: the value is below a `min…` floor; false: above a ceiling.",
          "type": "boolean"
        },
        "measure": {
          "knownValues": [
            "records",
            "missingLocation",
            "missingStartsAt"
          ],
          "type": "string"
        },
        "source": {
          "description": "The source id (or the scraper's name, for a scraper with one account).",
          "type": "string"
        },
        "threshold": {
          "description": "The bound it broke, as a decimal string.",
          "type": "string"
        },
        "value": {
          "description": "The measure's value, as a decimal string.",
          "type": "string"
        }
      },
      "required": [
        "source",
        "measure",
        "value",
        "threshold",
        "floor"
      ],
      "type": "object"
    },
    "scraperRunView": {
      "properties": {
        "alerts": {
          "description": "The thresholds the run's measures broke (the scraper type's default, then config.alerts, then config.alerts.sources.<id>). Empty when none.",
          "items": {
            "ref": "#scraperAlert",
            "type": "ref"
          },
          "type": "array"
        },
        "codeRef": {
          "description": "The code reference the run was claimed with.",
          "type": "string"
        },
        "codeSha": {
          "description": "The commit or image digest the runner reports it actually ran.",
          "type": "string"
        },
        "errors": {
          "type": "integer"
        },
        "finishedAt": {
          "format": "datetime",
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "log": {
          "description": "The end of the run's output, at most 8000 characters.",
          "type": "string"
        },
        "measures": {
          "description": "An ok run's measures per source it ran: `{source id: {records, missingLocation, missingStartsAt}}`. `records` is the events the run saw (their source sidecars say seen on the run's day); the others are shares of them, null when it saw none.",
          "type": "unknown"
        },
        "missing": {
          "description": "Known items it did not see this time.",
          "type": "integer"
        },
        "published": {
          "description": "Records it wrote.",
          "type": "integer"
        },
        "requestedBy": {
          "description": "The operator whose runScraper started it; absent for a scheduled run.",
          "type": "string"
        },
        "runner": {
          "description": "Which runner claimed it.",
          "type": "string"
        },
        "saw": {
          "description": "Source items the scraper saw.",
          "type": "integer"
        },
        "scraper": {
          "type": "string"
        },
        "startedAt": {
          "format": "datetime",
          "type": "string"
        },
        "status": {
          "description": "`running` until the runner reports; `lost` once a claim finds it has not reported within the commons' 12 h lease.",
          "knownValues": [
            "running",
            "ok",
            "failed",
            "lost"
          ],
          "type": "string"
        }
      },
      "required": [
        "id",
        "scraper",
        "status",
        "startedAt",
        "codeRef"
      ],
      "type": "object"
    },
    "scraperView": {
      "properties": {
        "account": {
          "description": "The source account it publishes as.",
          "format": "did",
          "type": "string"
        },
        "cadenceSecs": {
          "type": "integer"
        },
        "codeRef": {
          "description": "The pinned code: a git commit SHA of the scrapers repository, or a container image pinned by digest (`<registry>/<name>@sha256:<64 hex>`) under a registry the commons allows.",
          "type": "string"
        },
        "config": {
          "description": "The JSON object handed to the scraper.",
          "type": "unknown"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "lastRun": {
          "ref": "pub.techne.draft.commons.defs#scraperRunView",
          "type": "ref"
        },
        "name": {
          "type": "string"
        },
        "nextRunAt": {
          "description": "When it is due: while a runScraper request waits, its time (enabled or not); otherwise, while enabled, the start of its last run that was not lost plus its cadence, or now when none was. A lost run does not push it out: the runner does not wait for one either. Absent while it is disabled with no run asked for.",
          "format": "datetime",
          "type": "string"
        },
        "runRequestedAt": {
          "description": "An operator asked for a run now (runScraper) that is not claimed yet.",
          "format": "datetime",
          "type": "string"
        },
        "runRequestedBy": {
          "description": "The operator who asked (runScraper): its DID, or `operator-token` for the shared token.",
          "type": "string"
        },
        "updatedAt": {
          "format": "datetime",
          "type": "string"
        },
        "updatedBy": {
          "description": "Which operator last registered or changed it: its DID, or `operator-token` for the shared token.",
          "type": "string"
        }
      },
      "required": [
        "name",
        "account",
        "cadenceSecs",
        "enabled",
        "config",
        "codeRef",
        "createdAt",
        "updatedAt",
        "updatedBy"
      ],
      "type": "object"
    },
    "serviceHealth": {
      "properties": {
        "detail": {
          "description": "Why it is not healthy, in a few words. For an anonymous caller only the reported status or HTTP code, never a connection error.",
          "type": "string"
        },
        "httpStatus": {
          "type": "integer"
        },
        "latencyMs": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "service": {
          "description": "The service name its /health reports.",
          "type": "string"
        },
        "sha": {
          "description": "The commit it reports running.",
          "type": "string"
        },
        "state": {
          "knownValues": [
            "healthy",
            "failing",
            "unreachable"
          ],
          "type": "string"
        },
        "url": {
          "description": "The /health URL read. Operator only.",
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "name",
        "state",
        "latencyMs"
      ],
      "type": "object"
    },
    "sidecarView": {
      "description": "A record about another record (a rule's assertion, a profile, a provenance), with the commons' trust verdict. A sidecar is trusted only while its author's own pub.techne.draft.publisher declaration (rkey `self`) lists the sidecar's collection in `writes` and an admin writer vouches for that declaration: a pub.techne.draft.credential in the repo of the commons root, or of an operator the root names, pinned to the declaration's current CID, with no pub.techne.draft.credentialRevocation at the address it names or at the same rkey in the root's repo. An edited declaration is untrusted until an admin writer re-issues. The verdict is computed when you read, so revoking the credential untrusts every sidecar that account published, past ones included.",
      "properties": {
        "author": {
          "format": "did",
          "type": "string"
        },
        "authorHandle": {
          "description": "The author's current handle, as the network last announced it (#identity); absent when none was announced. For display only: the author is its DID.",
          "format": "handle",
          "type": "string"
        },
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "collection": {
          "format": "nsid",
          "type": "string"
        },
        "endorsement": {
          "description": "The vouched declaration (the author's publisher/self) that makes it trusted. Present exactly when `trusted` is true.",
          "format": "at-uri",
          "type": "string"
        },
        "indexedAt": {
          "format": "datetime",
          "type": "string"
        },
        "rkey": {
          "format": "record-key",
          "type": "string"
        },
        "trusted": {
          "type": "boolean"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        },
        "value": {
          "type": "unknown"
        }
      },
      "required": [
        "uri",
        "cid",
        "author",
        "collection",
        "rkey",
        "value",
        "indexedAt",
        "trusted"
      ],
      "type": "object"
    },
    "statusView": {
      "properties": {
        "accountsError": {
          "description": "Why the accounts could not be signed in to. The text only for an operator; anonymous callers see `unavailable`.",
          "type": "string"
        },
        "adjudicator": {
          "description": "The commons' adjudicator account. It writes no new pair decisions (operators write them in their own repos); the ones it wrote before stay trusted while an admin writer vouches for it.",
          "format": "did",
          "type": "string"
        },
        "apicoop": {
          "description": "The commons' own account.",
          "format": "did",
          "type": "string"
        },
        "commonsRoot": {
          "description": "The commons root: its credentials, and those of the operators it names, decide trust.",
          "format": "did",
          "type": "string"
        },
        "labels": {
          "properties": {
            "count": {
              "type": "integer"
            },
            "cursor": {
              "type": "string"
            },
            "lastError": {
              "description": "The last poll's error (the commons polls no labels now; this is from when it did). The text only for an operator; anonymous callers see `unavailable`.",
              "type": "string"
            },
            "lastPollAt": {
              "format": "datetime",
              "type": "string"
            },
            "notice": {
              "description": "Not filled (see `undeclared`).",
              "type": "string"
            },
            "undeclared": {
              "description": "Not filled: the commons reads no #atproto_label key from DID documents now, and labels decide nothing (they are an export only).",
              "items": {
                "format": "did",
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "count"
          ],
          "type": "object"
        },
        "operatorActions": {
          "description": "An operator credential is configured.",
          "type": "boolean"
        },
        "providerBudgets": {
          "description": "As getMetrics: caps, today's spend and grants. Absent without a runner or a paid provider.",
          "items": {
            "ref": "#providerBudgetView",
            "type": "ref"
          },
          "type": "array"
        },
        "rejections": {
          "type": "integer"
        },
        "runner": {
          "description": "A rules runner is configured.",
          "type": "boolean"
        },
        "services": {
          "description": "Each staging service the commons is configured to watch (HEALTH_URLS), read from its /health when this was asked.",
          "items": {
            "ref": "#serviceHealth",
            "type": "ref"
          },
          "type": "array"
        },
        "sha": {
          "type": "string"
        },
        "stewards": {
          "description": "The stewards collective: its open pub.techne.draft.membership records (subject = a steward's DID) are the steward list, public; Beacon's Featured is the stewards' public event listings. Only commons operators change it (setSteward). A steward here is a role-10 (member) membership of the \"Stewards\" collective, not the role-40 \"steward\" of membership.json's role registry. Absent when the commons pins none (STEWARDS_DID).",
          "format": "did",
          "type": "string"
        },
        "takedowns": {
          "type": "integer"
        }
      },
      "required": [
        "sha",
        "operatorActions",
        "runner",
        "labels",
        "rejections",
        "takedowns"
      ],
      "type": "object"
    },
    "takedownView": {
      "properties": {
        "by": {
          "description": "The verdict's author: the DID that wrote the `!takedown` verdict in its own repo (an operator; or the Commons API's own account, for takedowns it wrote before operators wrote them as themselves).",
          "type": "string"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "reason": {
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "uri",
        "reason",
        "createdAt",
        "by"
      ],
      "type": "object"
    },
    "visibilityView": {
      "description": "Submit to visible as the commons measures it: for each curated record that became listable in the commons in the window (a trusted provenance over a visible curated record, as listClusters lists it), from the latest `createdAt` among its source records to when the commons indexed what made it listable (its provenance, its curated record, or the credential that trusted it), the first time only. The PDS to Jetstream delay, the rules and the curator, and the commons' indexing are all inside it. A record whose submit predates the window (a backfill) is counted in `older`, one whose `createdAt` is after it became listable (a skewed or forged clock) in `future`; neither is in the latency.",
      "properties": {
        "future": {
          "minimum": 0,
          "type": "integer"
        },
        "older": {
          "minimum": 0,
          "type": "integer"
        },
        "submitToVisible": {
          "ref": "#latencyView",
          "type": "ref"
        },
        "windowHours": {
          "type": "integer"
        }
      },
      "required": [
        "windowHours",
        "submitToVisible",
        "older",
        "future"
      ],
      "type": "object"
    },
    "whenCollection": {
      "description": "A rule's eligibility for one collection pattern it reads: a record is queued only when every criterion holds. A collection with no entry is always eligible.",
      "properties": {
        "all": {
          "items": {
            "ref": "#criterion",
            "type": "ref"
          },
          "type": "array"
        },
        "collection": {
          "description": "An NSID or a `prefix.*` pattern.",
          "type": "string"
        },
        "outputs": {
          "description": "Per output collection: what must also hold for the rule to write it.",
          "items": {
            "ref": "#whenOutput",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "collection",
        "all"
      ],
      "type": "object"
    },
    "whenOutput": {
      "properties": {
        "all": {
          "items": {
            "ref": "#criterion",
            "type": "ref"
          },
          "type": "array"
        },
        "output": {
          "description": "The collection the rule writes.",
          "type": "string"
        }
      },
      "required": [
        "output",
        "all"
      ],
      "type": "object"
    }
  },
  "description": "Shared views for the Commons API. Draft tier. Every record view is a record some repo published, as the commons indexed it; the operator views (releases) are the commons' own state; a takedown is an operator's own verdict record.",
  "id": "pub.techne.draft.commons.defs",
  "lexicon": 1
}
```
