lix 0.15.0

Embeddable version control for apps and AI agents.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
openapi: 3.1.0
info:
  title: Lix Server Protocol
  version: "1"
  description: Canonical HTTP surface implemented by lix::server_protocol.
servers:
  - url: https://host.example
security:
  - bearerAuth: []
  - cookieAuth: []
  - {}
paths:
  /lix/v1/{lix_id}:
    parameters:
      - $ref: "#/components/parameters/LixId"
    get:
      operationId: handshake
      parameters:
        - $ref: "#/components/parameters/SessionId"
        - name: activeBranchId
          in: query
          schema: { type: string, minLength: 1 }
          description: Allowed only while creating a session.
      responses:
        "200":
          description: Session created or resumed.
          headers:
            Cache-Control: { schema: { type: string, const: no-store } }
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Handshake" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/session:
    parameters:
      - $ref: "#/components/parameters/LixId"
    delete:
      operationId: deleteSession
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      responses:
        "204": { description: Session deleted. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/execute:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: execute
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json: { schema: { $ref: "#/components/schemas/ExecuteRequest" } }
      responses:
        "200": { $ref: "#/components/responses/Execute" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/execute-batch:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: executeBatch
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [statements]
              properties:
                statements:
                  type: array
                  items: { $ref: "#/components/schemas/ExecuteBatchStatement" }
                options: { $ref: "#/components/schemas/ExecuteOptions" }
                cacheBlobs: { type: boolean }
      responses:
        "200":
          description: Ordered statement results.
          content:
            application/json:
              schema:
                type: array
                items: { $ref: "#/components/schemas/ExecuteResponse" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/sync/push:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: syncPush
      description: Atomically stores at most 512 total immutable commits plus compare-and-swap branch-ref updates. Commit identity makes retries idempotent; oversized batches must be split on dependency-complete boundaries.
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/SyncProtocolVersion"
      requestBody:
        required: true
        content:
          application/json: { schema: { $ref: "#/components/schemas/SyncPushRequest" } }
      responses:
        "200":
          description: The commit and branch advancement are durable.
          content: { application/json: { schema: { $ref: "#/components/schemas/SyncPushResponse" } } }
        "409":
          description: The branch no longer has the expected head, or an immutable identity names different content.
          content: { application/json: { schema: { $ref: "#/components/schemas/ErrorEnvelope" } } }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/sync/pull:
    parameters:
      - $ref: "#/components/parameters/LixId"
    get:
      operationId: syncPull
      description: Returns a hot-state snapshot when after is omitted. Otherwise long-polls complete repository commit/ref events after a repository cursor.
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/SyncProtocolVersion"
        - name: after
          in: query
          schema: { type: integer, minimum: 0 }
        - name: limit
          in: query
          schema: { type: integer, minimum: 1, maximum: 512, default: 128 }
        - name: snapshotBranchId
          in: query
          schema: { type: string, minLength: 1 }
          description: With snapshotHeadCommitId, requests a stateless hot-row page pinned to this branch.
        - name: snapshotHeadCommitId
          in: query
          schema: { type: string, minLength: 1 }
          description: Immutable branch head used to serve a stable snapshot row page.
        - name: snapshotAfter
          in: query
          schema: { type: string, minLength: 1, maxLength: 4096 }
          description: Opaque continuation returned by the preceding row page.
      responses:
        "200":
          description: Pinned hot metadata, one immutable row page, or the next ordered repository event page.
          content:
            application/json:
              schema:
                oneOf:
                  - { $ref: "#/components/schemas/SyncPullResponse" }
                  - { $ref: "#/components/schemas/SyncSnapshotRowPage" }
        "413":
          description: The encoded response exceeds the 64 MiB protocol limit.
          content: { application/json: { schema: { $ref: "#/components/schemas/ErrorEnvelope" } } }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/sync/history:
    parameters:
      - $ref: "#/components/parameters/LixId"
    get:
      operationId: syncHistory
      description: Fetches one bounded first-parent history page without changing live sync state.
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/SyncProtocolVersion"
        - name: head
          in: query
          required: true
          schema: { type: string, minLength: 1, maxLength: 255 }
        - name: limit
          in: query
          required: true
          schema: { type: integer, minimum: 1, maximum: 100 }
      responses:
        "200":
          description: Oldest-to-newest commits plus a complete-state fence when the first parent lies outside the page.
          content: { application/json: { schema: { $ref: "#/components/schemas/SyncHistoryResponse" } } }
        "413":
          description: The encoded response exceeds the 64 MiB protocol limit.
          content: { application/json: { schema: { $ref: "#/components/schemas/ErrorEnvelope" } } }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/sync/blob:
    parameters:
      - $ref: "#/components/parameters/LixId"
    get:
      operationId: syncGetBlobs
      description: Loads up to 16 canonical FastCDC manifests by their BLAKE3-derived blob identities.
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/SyncProtocolVersion"
        - $ref: "#/components/parameters/BlobIds"
      responses:
        "200":
          description: Canonical flat manifests in the requested order.
          content:
            application/json:
              schema:
                type: array
                minItems: 1
                maxItems: 16
                items: { $ref: "#/components/schemas/SyncBlobManifest" }
        "404": { $ref: "#/components/responses/Error" }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: syncRegisterBlob
      description: Reports missing chunks, or atomically registers a complete verified manifest.
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/SyncProtocolVersion"
      requestBody:
        required: true
        content:
          application/json: { schema: { $ref: "#/components/schemas/SyncBlobManifest" } }
      responses:
        "200":
          description: Missing chunks to upload, or confirmation that the blob is complete.
          content: { application/json: { schema: { $ref: "#/components/schemas/SyncBlobRegistration" } } }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/sync/chunk:
    parameters:
      - $ref: "#/components/parameters/LixId"
    get:
      operationId: syncGetChunk
      description: Loads one authenticated raw BLAKE3-addressed chunk.
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/SyncProtocolVersion"
        - $ref: "#/components/parameters/ChunkId"
      responses:
        "200":
          description: Exact raw chunk bytes.
          headers:
            Cache-Control: { schema: { type: string } }
          content:
            application/octet-stream:
              schema: { type: string, contentEncoding: binary, minLength: 1, maxLength: 4194304 }
        "404": { $ref: "#/components/responses/Error" }
        default: { $ref: "#/components/responses/Error" }
    put:
      operationId: syncPutChunk
      description: Stores raw bytes only when their BLAKE3 digest equals chunkId.
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/SyncProtocolVersion"
        - $ref: "#/components/parameters/ChunkId"
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema: { type: string, contentEncoding: binary, minLength: 1, maxLength: 4194304 }
      responses:
        "204": { description: Chunk is durably present. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/transaction/begin:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: beginTransaction
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      responses:
        "200":
          description: Transaction capability.
          content:
            application/json:
              schema:
                type: object
                required: [transactionId]
                properties: { transactionId: { type: string } }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/transaction/execute:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: transactionExecute
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/TransactionId"
      requestBody:
        required: true
        content:
          application/json: { schema: { $ref: "#/components/schemas/ExecuteRequest" } }
      responses:
        "200": { $ref: "#/components/responses/Execute" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/transaction/commit:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: commitTransaction
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/TransactionId"
      responses:
        "204": { description: Transaction committed. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/transaction/rollback:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: rollbackTransaction
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/TransactionId"
      responses:
        "204": { description: Transaction rolled back. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/file:
    parameters:
      - $ref: "#/components/parameters/LixId"
    get:
      operationId: readFile
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/FilePath"
        - name: Range
          in: header
          schema: { type: string, pattern: "^bytes=[0-9]+-[0-9]*$" }
      responses:
        "200": { $ref: "#/components/responses/File" }
        "206": { $ref: "#/components/responses/File" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/file/upsert:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: upsertFile
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/FilePath"
        - $ref: "#/components/parameters/IdempotencyKey"
        - name: Lix-Upload-Id
          in: header
          schema: { type: string }
        - name: Content-Range
          in: header
          schema: { type: string }
      requestBody:
        required: true
        content:
          application/octet-stream: { schema: { type: string, contentEncoding: binary } }
      responses:
        "200": { $ref: "#/components/responses/Execute" }
        "308": { description: Resumable upload part accepted. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/file/upsert-batch:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: upsertFileBatch
      parameters:
        - $ref: "#/components/parameters/RequiredSessionId"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema: { type: string, contentEncoding: binary }
      responses:
        "200": { $ref: "#/components/responses/Execute" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/branch/create:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: createBranch
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [name]
              properties:
                id: { type: string }
                name: { type: string, minLength: 1 }
                fromCommitId: { type: string }
      responses:
        "200": { description: Branch created. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/undo:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: undo
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      responses:
        "200": { description: Undo committed. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/redo:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: redo
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      responses:
        "200": { description: Redo committed. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/branch/switch:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: switchBranch
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [branchId]
              properties: { branchId: { type: string, minLength: 1 } }
      responses:
        "200": { description: Session switched. }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/observe:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: observe
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      requestBody:
        required: true
        content:
          application/json: { schema: { $ref: "#/components/schemas/ExecuteRequest" } }
      responses:
        "200": { $ref: "#/components/responses/EventStream" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/observe/multiplex:
    parameters:
      - $ref: "#/components/parameters/LixId"
    post:
      operationId: observeMultiplex
      parameters: [{ $ref: "#/components/parameters/RequiredSessionId" }]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [subscriptions]
              properties:
                subscriptions:
                  type: array
                  minItems: 1
                  maxItems: 32
                  items:
                    allOf:
                      - $ref: "#/components/schemas/ExecuteRequest"
                      - type: object
                        required: [id]
                        properties: { id: { type: string } }
      responses:
        "200": { $ref: "#/components/responses/EventStream" }
        default: { $ref: "#/components/responses/Error" }
  /lix/v1/{lix_id}/snapshot:
    parameters:
      - $ref: "#/components/parameters/LixId"
    get:
      operationId: exportSnapshot
      description: Streams a deterministic complete point-in-time copy of the Lix.
      security:
        - bearerAuth: []
        - cookieAuth: []
      responses:
        "200":
          description: Canonical Lix snapshot stream.
          headers:
            Cache-Control:
              schema: { type: string, const: "no-store, no-transform" }
          content:
            application/vnd.lix.snapshot:
              schema: { type: string, format: binary }
        default: { $ref: "#/components/responses/Error" }
components:
  securitySchemes:
    bearerAuth: { type: http, scheme: bearer }
    cookieAuth: { type: apiKey, in: cookie, name: session }
  parameters:
    LixId:
      name: lix_id
      in: path
      required: true
      description: Immutable canonical Lix UUID.
      schema:
        type: string
        format: uuid
        pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    SessionId:
      name: Lix-Session-Id
      in: header
      required: false
      schema: { type: string }
    RequiredSessionId:
      name: Lix-Session-Id
      in: header
      required: true
      schema: { type: string }
    SyncProtocolVersion:
      name: lix-sync-protocol-version
      in: header
      required: true
      description: Exact sync wire-protocol version advertised by the handshake.
      schema: { type: integer, const: 6 }
    TransactionId:
      name: Lix-Transaction-Id
      in: header
      required: true
      schema: { type: string }
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema: { type: string, minLength: 1, maxLength: 255 }
    RequiredIdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema: { type: string, minLength: 1, maxLength: 255 }
    FilePath:
      name: path
      in: query
      required: true
      schema: { type: string, minLength: 1 }
    BlobIds:
      name: blobIds
      in: query
      required: true
      description: One through 16 distinct lowercase BLAKE3 identities separated by commas.
      schema: { type: string, pattern: "^[0-9a-f]{64}(,[0-9a-f]{64}){0,15}$" }
    ChunkId:
      name: chunkId
      in: query
      required: true
      schema: { type: string, pattern: "^[0-9a-f]{64}$" }
  responses:
    Execute:
      description: SQL result.
      content:
        application/json: { schema: { $ref: "#/components/schemas/ExecuteResponse" } }
    File:
      description: Raw file contents. Lix-File-Found distinguishes missing and empty files.
      headers:
        Lix-File-Found: { schema: { type: string, enum: ["true", "false"] } }
        Accept-Ranges: { schema: { type: string, const: bytes } }
      content:
        application/octet-stream: { schema: { type: string, contentEncoding: binary } }
    EventStream:
      description: Server-sent `next` and `error` events.
      content:
        text/event-stream: { schema: { type: string } }
    Error:
      description: Canonical protocol error.
      content:
        application/json: { schema: { $ref: "#/components/schemas/ErrorEnvelope" } }
  schemas:
    Handshake:
      type: object
      required: [protocolVersion, syncProtocolVersion, activeBranchId, activeAccountId, sessionId, capabilities]
      properties:
        protocolVersion: { type: integer, const: 6 }
        syncProtocolVersion: { type: integer, const: 6 }
        activeBranchId: { type: string }
        activeAccountId: { type: string }
        sessionId: { type: string }
        capabilities:
          type: object
          required: [binaryFileUpsert, binaryFileUpsertBatch, binaryFileRead, syncPush, syncPull, syncHistory, syncBlob, syncChunk]
          properties:
            binaryFileUpsert: { type: boolean }
            binaryFileUpsertBatch: { type: boolean }
            binaryFileRead: { type: boolean }
            syncPush: { type: boolean }
            syncPull: { type: boolean }
            syncHistory: { type: boolean }
            syncBlob: { type: boolean }
            syncChunk: { type: boolean }
    ExecuteOptions:
      type: object
      properties: { originKey: { type: string } }
    ExecuteRequest:
      type: object
      required: [sql]
      properties:
        sql: { type: string, minLength: 1 }
        params: { type: array, items: {} }
        options: { $ref: "#/components/schemas/ExecuteOptions" }
        cacheBlobs: { type: boolean }
    ExecuteBatchStatement:
      type: object
      required: [sql]
      properties:
        sql: { type: string, minLength: 1 }
        params: { type: array, items: {} }
        label: { type: string }
    ExecuteResponse:
      type: object
      required: [columns, rows, rowsAffected, notices]
      properties:
        columns: { type: array, items: { type: string } }
        rows: { type: array, items: { type: array, items: {} } }
        rowsAffected: { type: integer, minimum: 0 }
        notices: { type: array, items: { type: object } }
    SyncRowPkPart:
      oneOf:
        - type: object
          additionalProperties: false
          required: [type, value]
          properties:
            type: { const: uuid }
            value: { type: string, format: uuid }
        - type: object
          additionalProperties: false
          required: [type, value]
          properties:
            type: { const: integer }
            value: { type: integer }
        - type: object
          additionalProperties: false
          required: [type, value]
          properties:
            type: { const: string }
            value: { type: string }
        - type: object
          additionalProperties: false
          required: [type, value]
          properties:
            type: { const: bytes }
            value: { type: string, contentEncoding: base64 }
    SyncRowPk:
      type: array
      minItems: 1
      items: { $ref: "#/components/schemas/SyncRowPkPart" }
      description: Sync-only physical row identity components in declared primary-key order; this is not the public SQL/SDK lix_row_ref.
    SyncCommitMember:
      type: object
      required: [changeId, authored, schemaKey, rowPk, deleted, rowCreatedAt, rowUpdatedAt, changeAccountId, changeCreatedAt]
      properties:
        changeId: { type: string, minLength: 1 }
        authored: { type: boolean }
        schemaKey: { type: string, minLength: 1, maxLength: 255 }
        fileId: { type: [string, "null"], maxLength: 255 }
        rowPk: { $ref: "#/components/schemas/SyncRowPk" }
        deleted: { type: boolean }
        snapshot: {}
        metadata: {}
        rowCreatedAt: { type: string, minLength: 1 }
        rowUpdatedAt: { type: string, minLength: 1 }
        changeAccountId: { type: string, minLength: 1 }
        changeCreatedAt: { type: string, minLength: 1 }
        originKey: { type: [string, "null"] }
    SyncCommit:
      type: object
      required: [commitId, parentCommitIds, accountId, createdAt, selectedSourceCommitId, members]
      properties:
        commitId: { type: string, minLength: 1 }
        parentCommitIds: { type: array, items: { type: string, minLength: 1 } }
        accountId: { type: string, minLength: 1 }
        createdAt: { type: string, minLength: 1 }
        selectedSourceCommitId:
          type: [string, "null"]
          description: Exactly parentCommitIds[1] for a merge with selected members; null otherwise.
        stateAlias:
          oneOf:
            - { $ref: "#/components/schemas/SyncCommitStateAlias" }
            - { type: "null" }
          description: Authenticated complete-state source for a metadata-only checkpoint commit; omitted or null for ordinary and merge commits.
        members: { type: array, items: { $ref: "#/components/schemas/SyncCommitMember" } }
    SyncCommitStateAlias:
      type: object
      additionalProperties: false
      required: [sourceCommitId, stateRootId]
      properties:
        sourceCommitId: { type: string, minLength: 1 }
        stateRootId: { type: string, pattern: "^[0-9a-f]{64}$" }
    SyncRefUpdate:
      type: object
      required: [branchId, expectedHeadCommitId, expectedCheckpointCommitId, headCommitId, checkpointCommitId]
      properties:
        branchId: { type: string, minLength: 1 }
        expectedHeadCommitId: { type: [string, "null"] }
        expectedCheckpointCommitId: { type: [string, "null"] }
        headCommitId: { type: [string, "null"] }
        checkpointCommitId:
          type: [string, "null"]
          description: Branch working-diff checkpoint at headCommitId. Required and non-null for a headed update; null only when deleting the branch.
    SyncPushRequest:
      type: object
      required: [commits, refUpdates, inlineBlobs]
      properties:
        commits: { type: array, maxItems: 512, items: { $ref: "#/components/schemas/SyncCommit" } }
        refUpdates: { type: array, maxItems: 512, items: { $ref: "#/components/schemas/SyncRefUpdate" } }
        inlineBlobs:
          type: array
          description: Self-contained small blobs referenced by commits. Larger blobs use the manifest and chunk endpoints.
          items: { $ref: "#/components/schemas/SyncBlobManifest" }
    SyncPushResponse:
      type: object
      required: [cursor]
      properties:
        cursor: { type: integer, minimum: 0 }
    SyncCommitHeader:
      type: object
      required: [commitId, parentCommitIds, accountId, createdAt, generation, firstParentJumpCommitId, firstParentJumpSpan]
      properties:
        commitId: { type: string }
        parentCommitIds: { type: array, items: { type: string } }
        accountId: { type: string }
        createdAt: { type: string }
        generation: { type: integer, minimum: 0 }
        firstParentJumpCommitId: { type: [string, "null"] }
        firstParentJumpSpan: { type: [integer, "null"], minimum: 1 }
    SyncSnapshotRow:
      type: object
      required: [branchId, schemaKey, rowPk, changeId, commitId, createdAt, updatedAt, changeAccountId, changeCreatedAt]
      properties:
        branchId: { type: string }
        schemaKey: { type: string }
        fileId: { type: [string, "null"] }
        rowPk: { $ref: "#/components/schemas/SyncRowPk" }
        snapshot: {}
        metadata: {}
        changeId: { type: string }
        commitId: { type: string }
        createdAt: { type: string }
        updatedAt: { type: string }
        changeAccountId: { type: string, minLength: 1 }
        changeCreatedAt: { type: string, minLength: 1 }
        originKey: { type: [string, "null"] }
    SyncBranchHead:
      type: object
      required: [branchId, headCommitId, checkpointCommitId, checkpointStateRootId, hotStateRootId]
      properties:
        branchId: { type: string }
        headCommitId: { type: [string, "null"] }
        checkpointCommitId:
          type: [string, "null"]
          description: Branch working-diff checkpoint whose baseline is installed with this snapshot. Non-null exactly when headCommitId is non-null.
        checkpointStateRootId:
          type: string
          pattern: "^[0-9a-f]{64}$"
          description: BLAKE3 root of the live tombstone-filtered snapshot rows at checkpointCommitId.
        hotStateRootId:
          type: string
          pattern: "^[0-9a-f]{64}$"
          description: BLAKE3 root of the live tombstone-filtered snapshot rows at this immutable head.
    SyncSnapshotRowPage:
      type: object
      required: [branchId, headCommitId, rows, continuation]
      properties:
        branchId: { type: string, minLength: 1 }
        headCommitId: { type: string, minLength: 1 }
        rows: { type: array, maxItems: 512, items: { $ref: "#/components/schemas/SyncSnapshotRow" } }
        continuation: { type: [string, "null"], maxLength: 4096 }
    SyncEvent:
      type: object
      required: [cursor, commits, refUpdates, inlineBlobs]
      properties:
        cursor: { type: integer, minimum: 1 }
        commits: { type: array, maxItems: 512, items: { $ref: "#/components/schemas/SyncCommit" } }
        refUpdates: { type: array, maxItems: 512, items: { $ref: "#/components/schemas/SyncRefUpdate" } }
        inlineBlobs:
          type: array
          items: { $ref: "#/components/schemas/SyncBlobManifest" }
    SyncPullResponse:
      oneOf:
        - type: object
          required: [kind, cursor, lixId, defaultBranchId, branches]
          properties:
            kind: { type: string, const: snapshot }
            cursor: { type: integer, minimum: 0 }
            lixId: { type: string, minLength: 1 }
            defaultBranchId: { type: string, minLength: 1 }
            branches: { type: array, items: { $ref: "#/components/schemas/SyncBranchHead" } }
        - type: object
          required: [kind, cursor, events]
          properties:
            kind: { type: string, const: delta }
            cursor: { type: integer, minimum: 0 }
            events: { type: array, maxItems: 512, items: { $ref: "#/components/schemas/SyncEvent" } }
    SyncHistoryResponse:
      type: object
      required: [commits, commitHeaders, boundaries]
      properties:
        commits: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/SyncCommit" } }
        commitHeaders: { type: array, items: { $ref: "#/components/schemas/SyncCommitHeader" } }
        boundaries: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/SyncHistoryBoundary" } }
    SyncHistoryBoundary:
      type: object
      required: [commitId, liveStateRootId]
      properties:
        commitId: { type: string, minLength: 1 }
        liveStateRootId: { type: string, pattern: "^[0-9a-f]{64}$" }
    SyncBlobChunk:
      type: object
      required: [chunkId, sizeBytes]
      properties:
        chunkId: { type: string, pattern: "^[0-9a-f]{64}$" }
        sizeBytes: { type: integer, minimum: 1, maximum: 4194304 }
    SyncBlobManifest:
      type: object
      required: [blobId, sizeBytes, chunks]
      properties:
        blobId: { type: string, pattern: "^[0-9a-f]{64}$" }
        sizeBytes: { type: integer, minimum: 0 }
        chunks:
          type: array
          maxItems: 16384
          items: { $ref: "#/components/schemas/SyncBlobChunk" }
        inlineBytesBase64:
          type: string
          maxLength: 87384
    SyncBlobRegistration:
      type: object
      required: [missingChunkIds, complete]
      properties:
        missingChunkIds:
          type: array
          maxItems: 16384
          items: { type: string, pattern: "^[0-9a-f]{64}$" }
        complete: { type: boolean }
    ErrorEnvelope:
      type: object
      required: [error]
      properties:
        error:
          type: object
          required: [code, message]
          properties:
            code: { type: string }
            message: { type: string }
            hint: { type: string }
            details: {}