# Default limits and fixed numbers

> Test vectors: Default limits and fixed numbers. Shown here as it is in conformance/vectors/limits.json.

Protocol `0.1`. Covers: SPEC.md sections 3 to 13.

[Download limits.json](./limits.json): the file itself, as the conformance suite reads it.

## How to use it

The complete error code list of SPEC section 6, and numeric limits the spec states.

## Notes

Only numbers the spec states. Lengths in characters are UTF-16 code units unless the key says code points.

## Fixed values

| key | value |
|---|---|
| `pointerInitialCredit` | `512` |
| `pointerMaxPoints` | `2729` |
| `peerSendBufferBytes` | `max(8 MiB, 4 x maxText)` |
| `canonicalMaxDepth` | `100` |
| `agentNameMaxCodePoints` | `64` |
| `withdrawnNoticeMs` | `1500` |
| `humanGiveUpMs` | `5000` |
| `defaultPort` | `7346` |
| `subprotocol` | `reins.v1` |
| `maxResultBytes` | `32768` |
| `maxNameChars` | `120` |
| `maxValueChars` | `200` |
| `sealMacTextChars` | `43` |
| `sealMacBytes` | `32` |
| `defaultSessionsPerCredential` | `4` |
| `cursorLabelMaxChars` | `40` |
| `uiEventMinIntervalMs` | `100` |
| `heartbeatDropFactor` | `2.5` |
| `playbackNote` | `section 11 says "in proportion to the lag and up to 4x"; section 15 fixes the curve: 1 up to 120 ms, linear to 4 at 600 ms` |
| `commandFrameBudgetMs` | `6` |

## defaultLimits

```json
{
  "maxText": 262144,
  "maxBinary": 16384,
  "heartbeatMs": 15000,
  "reqTimeoutMs": 15000,
  "consentTimeoutMs": 60000
}
```

## linkQueue

```json
{
  "maxMessages": 4096,
  "maxBytes": 16777216
}
```

## preAuthQueue

```json
{
  "maxMessages": 16,
  "maxBytes": 65536
}
```

## hubMethodBucket

```json
{
  "rate": 10,
  "burst": 20
}
```

## admission

```json
{
  "surfaceRate": 2,
  "surfaceBurst": "2 x maxSurfaces",
  "allOriginsFactor": {
    "rate": 5,
    "burst": 2
  },
  "agentRate": 2,
  "agentBurst": 20
}
```

## coolOff

```json
{
  "firstMs": 2000,
  "maxMs": 60000,
  "revokeAfterRefusals": 3
}
```

## stickyPrivacy

```json
{
  "remembered": 32,
  "sameParentMs": 1000
}
```

## versions

```json
[
  "0.1"
]
```

## manifest

```json
{
  "maxBytes": 65536,
  "maxActions": 256,
  "maxViews": 64
}
```

## handshake

```json
{
  "nonceBytes": 32,
  "secretBytes": 32,
  "minKeyChars": 32,
  "helloTimeoutMs": 5000,
  "failDelayMs": 200,
  "failDelayMaxMs": 3000,
  "failWindowMs": 60000,
  "maxPending": 16,
  "confirmTimeoutMs": 5000
}
```

## sealKind

```json
{
  "text": 116,
  "binary": 98
}
```

## attach

```json
{
  "burst": 3,
  "refillEveryMs": 2000
}
```

## capacity

```json
{
  "surfaces": 64,
  "agents": 32,
  "sessionsPerCredential": 4,
  "streamsPerAgent": 8
}
```

## read

```json
{
  "defaultMax": 2000,
  "capMax": 8000
}
```

## consent

```json
{
  "maxEntries": 40,
  "maxDepth": 4,
  "maxCodePoints": 2000,
  "perAgent": 1,
  "total": 4,
  "armMs": 500
}
```

## panel

```json
{
  "confirmArmMs": 500,
  "settleMs": 500,
  "activityEntries": 50,
  "maxSessions": 32
}
```

## chat

```json
{
  "maxTextChars": 4000,
  "maxNoteChars": 80,
  "transcriptMessages": 200,
  "readDefault": 20,
  "readMax": 50,
  "readBytes": 131072,
  "statusTtlMs": 120000,
  "personPerSecondPerAgent": 5,
  "personBurstPerAgent": 10,
  "undeliveredNoticesPerSecond": 20,
  "mcpWaitDefaultMs": 90000,
  "mcpWaitMaxMs": 150000,
  "mcpKeepaliveMs": 45000
}
```

## pointer

```json
{
  "dropBufferBytes": 262144,
  "stallBufferBytes": 1048576,
  "creditBatchFraction": 0.25
}
```

## playback

5 entries.

| `queuedMs` | `rate` |
|---|---|
| `0` | `1` |
| `120` | `1` |
| `360` | `2.5` |
| `600` | `4` |
| `5000` | `4` |

## glide

```json
{
  "formula": "clamp(120 + 110 * log2(1 + d / 40), 120, 900)",
  "cases": [
    {
      "d": 0,
      "ms": 120
    },
    {
      "d": 40,
      "ms": 230
    },
    {
      "d": 120,
      "ms": 340
    },
    {
      "d": 600,
      "ms": 560
    },
    {
      "d": 1000000,
      "ms": 900
    }
  ]
}
```

## audit

```json
{
  "maxBacklog": 1000,
  "refusalsPerSecond": 20,
  "personRecordsPerSecond": 20,
  "personChangesPerSecond": 20,
  "droppedRelayRecordsPerSecond": 20
}
```

Generated by `conformance/tools/make-vectors.mjs` from the formulas in the specification, with `node:crypto` only.
