# page.corvus.core

> Published by [corvus.page](https://lexicon.garden/identity/did:plc:3qc4cbzcriye72qqqodeda26)

✓ This is the authoritative definition for this NSID.

## Description

Shared primitives used across the corvus lexicons: id types (`#opId`, `#atomId`), the generic value primitives the applier materializes scalar / counter / set / sequence fields into (`#register`, `#counter`, `#orSet`, `#seq`), and the supporting types for `#seq` (`#run`, `#tombstone`). The `#block` def captures the envelope shape every variant in `page.corvus.block` inlines (`id`, `parent`, `afterSibling`); `#children` is a sentinel referenced by `editableAs` on ordered-children fields. Variants in `page.corvus.block` declare each editable field's primitive shape via `editableAs`; the applier materializes the field into a `page.corvus.materialized#blockProperty` using the named primitive.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:3qc4cbzcriye72qqqodeda26/page.corvus.core)
- [Documentation](https://lexicon.garden/lexicon/did:plc:3qc4cbzcriye72qqqodeda26/page.corvus.core/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:3qc4cbzcriye72qqqodeda26/page.corvus.core/examples)

## Definitions

### `page.corvus.core#run`

**Type**: `object`

A contiguous range of live atoms in a `#sq`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `opId` | `string` | Yes | the op hash of the op that minted the run |
| `value` | `unknown` | Yes | The run's payload — a string for text sequences (one atom per character), an array for list sequences (one atom per element). |
| `atomIdx` | `integer` | Yes | the index of the first atom in the run (inclusive) |

### `page.corvus.core#set`

**Type**: `object`

OR-set materialization.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `items` | `array` | Yes | The OR-set as items |

### `page.corvus.core#counter`

**Type**: `object`

PN-counter materialization.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `integer` | Yes | Sum of applied increment deltas. May be negative. |

### `page.corvus.core#setItem`

**Type**: `object`

An OR-set item

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `opId` | `string` | Yes | the op id of the operation that last updated this item in the set |
| `value` | `unknown` | Yes | The value of the OR-set item |
| `removed` | `boolean` | Yes | whether the item is removed |

### `page.corvus.core#register`

**Type**: `object`

LWW scalar register materialization.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `opId` | `string` | Yes | the op hash of the op that last wrote to the register |
| `value` | `unknown` | Yes | Committed value (LWW winner). |

### `page.corvus.core#sequence`

**Type**: `object`

RGA sequence materialization (text or list).

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `items` | `array` | Yes | The sequence as runs and tombstones in document order. |

### `page.corvus.core#tombstone`

**Type**: `object`

A contiguous range of deleted atoms in a `#sq`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `opId` | `string` | Yes | the op id of the operation that minted the tombstone |
| `length` | `integer` | Yes | Number of consecutive tombstoned atoms in the range. |
| `atomIdx` | `integer` | Yes | the index of the first atom in the tombstone |

## Raw Schema

```json
{
  "id": "page.corvus.core",
  "defs": {
    "run": {
      "type": "object",
      "required": [
        "opId",
        "atomIdx",
        "value"
      ],
      "properties": {
        "opId": {
          "type": "string",
          "description": "the op hash of the op that minted the run"
        },
        "value": {
          "type": "unknown",
          "description": "The run's payload — a string for text sequences (one atom per character), an array for list sequences (one atom per element)."
        },
        "atomIdx": {
          "type": "integer",
          "description": "the index of the first atom in the run (inclusive)"
        }
      },
      "description": "A contiguous range of live atoms in a `#sq`"
    },
    "set": {
      "type": "object",
      "required": [
        "items"
      ],
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "ref": "#setItem",
            "type": "ref"
          },
          "description": "The OR-set as items"
        }
      },
      "description": "OR-set materialization."
    },
    "counter": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "integer",
          "description": "Sum of applied increment deltas. May be negative."
        }
      },
      "description": "PN-counter materialization."
    },
    "setItem": {
      "type": "object",
      "required": [
        "value",
        "opId",
        "removed"
      ],
      "properties": {
        "opId": {
          "type": "string",
          "description": "the op id of the operation that last updated this item in the set"
        },
        "value": {
          "type": "unknown",
          "description": "The value of the OR-set item"
        },
        "removed": {
          "type": "boolean",
          "description": "whether the item is removed"
        }
      },
      "description": "An OR-set item"
    },
    "register": {
      "type": "object",
      "required": [
        "value",
        "opId"
      ],
      "properties": {
        "opId": {
          "type": "string",
          "description": "the op hash of the op that last wrote to the register"
        },
        "value": {
          "type": "unknown",
          "description": "Committed value (LWW winner)."
        }
      },
      "description": "LWW scalar register materialization."
    },
    "sequence": {
      "type": "object",
      "required": [
        "items"
      ],
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "refs": [
              "#run",
              "#tombstone"
            ],
            "type": "union",
            "closed": true
          },
          "description": "The sequence as runs and tombstones in document order."
        }
      },
      "description": "RGA sequence materialization (text or list)."
    },
    "tombstone": {
      "type": "object",
      "required": [
        "opId",
        "atomIdx",
        "length"
      ],
      "properties": {
        "opId": {
          "type": "string",
          "description": "the op id of the operation that minted the tombstone"
        },
        "length": {
          "type": "integer",
          "description": "Number of consecutive tombstoned atoms in the range."
        },
        "atomIdx": {
          "type": "integer",
          "description": "the index of the first atom in the tombstone"
        }
      },
      "description": "A contiguous range of deleted atoms in a `#sq`"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "description": "Shared primitives used across the corvus lexicons: id types (`#opId`, `#atomId`), the generic value primitives the applier materializes scalar / counter / set / sequence fields into (`#register`, `#counter`, `#orSet`, `#seq`), and the supporting types for `#seq` (`#run`, `#tombstone`). The `#block` def captures the envelope shape every variant in `page.corvus.block` inlines (`id`, `parent`, `afterSibling`); `#children` is a sentinel referenced by `editableAs` on ordered-children fields. Variants in `page.corvus.block` declare each editable field's primitive shape via `editableAs`; the applier materializes the field into a `page.corvus.materialized#blockProperty` using the named primitive."
}
```
