@lix-js/sdk 0.6.0-preview.1 → 0.6.0-preview.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/SKILL.md +304 -320
  2. package/dist/engine-wasm/wasm/lix_engine.d.ts +5 -0
  3. package/dist/engine-wasm/wasm/lix_engine.js +9 -13
  4. package/dist/engine-wasm/wasm/lix_engine.wasm +0 -0
  5. package/dist/engine-wasm/wasm/lix_engine.wasm.d.ts +1 -0
  6. package/dist/generated/builtin-schemas.d.ts +87 -162
  7. package/dist/generated/builtin-schemas.js +139 -236
  8. package/dist/open-lix.d.ts +103 -14
  9. package/dist/open-lix.js +3 -0
  10. package/dist/sqlite/index.js +99 -22
  11. package/dist-engine-src/README.md +18 -0
  12. package/dist-engine-src/src/backend/kv.rs +358 -0
  13. package/dist-engine-src/src/backend/mod.rs +12 -0
  14. package/dist-engine-src/src/backend/testing.rs +658 -0
  15. package/dist-engine-src/src/backend/types.rs +96 -0
  16. package/dist-engine-src/src/binary_cas/chunking.rs +31 -0
  17. package/dist-engine-src/src/binary_cas/codec.rs +346 -0
  18. package/dist-engine-src/src/binary_cas/context.rs +139 -0
  19. package/dist-engine-src/src/binary_cas/kv.rs +1063 -0
  20. package/dist-engine-src/src/binary_cas/mod.rs +11 -0
  21. package/dist-engine-src/src/binary_cas/types.rs +121 -0
  22. package/dist-engine-src/src/catalog/context.rs +412 -0
  23. package/dist-engine-src/src/catalog/mod.rs +10 -0
  24. package/dist-engine-src/src/catalog/schema.rs +4 -0
  25. package/dist-engine-src/src/catalog/snapshot.rs +1114 -0
  26. package/dist-engine-src/src/cel/context.rs +86 -0
  27. package/dist-engine-src/src/cel/error.rs +19 -0
  28. package/dist-engine-src/src/cel/mod.rs +8 -0
  29. package/dist-engine-src/src/cel/provider.rs +9 -0
  30. package/dist-engine-src/src/cel/runtime.rs +167 -0
  31. package/dist-engine-src/src/cel/value.rs +50 -0
  32. package/dist-engine-src/src/commit_graph/context.rs +901 -0
  33. package/dist-engine-src/src/commit_graph/mod.rs +11 -0
  34. package/dist-engine-src/src/commit_graph/types.rs +109 -0
  35. package/dist-engine-src/src/commit_graph/walker.rs +756 -0
  36. package/dist-engine-src/src/commit_store/codec.rs +887 -0
  37. package/dist-engine-src/src/commit_store/context.rs +944 -0
  38. package/dist-engine-src/src/commit_store/materialization.rs +84 -0
  39. package/dist-engine-src/src/commit_store/mod.rs +16 -0
  40. package/dist-engine-src/src/commit_store/storage.rs +600 -0
  41. package/dist-engine-src/src/commit_store/types.rs +215 -0
  42. package/dist-engine-src/src/common/error.rs +313 -0
  43. package/dist-engine-src/src/common/fingerprint.rs +3 -0
  44. package/dist-engine-src/src/common/fs_path.rs +1336 -0
  45. package/dist-engine-src/src/common/identity.rs +145 -0
  46. package/dist-engine-src/src/common/json_pointer.rs +67 -0
  47. package/dist-engine-src/src/common/metadata.rs +40 -0
  48. package/dist-engine-src/src/common/mod.rs +23 -0
  49. package/dist-engine-src/src/common/types.rs +105 -0
  50. package/dist-engine-src/src/common/wire.rs +222 -0
  51. package/dist-engine-src/src/domain.rs +324 -0
  52. package/dist-engine-src/src/engine.rs +225 -0
  53. package/dist-engine-src/src/entity_identity.rs +405 -0
  54. package/dist-engine-src/src/functions/context.rs +292 -0
  55. package/dist-engine-src/src/functions/deterministic.rs +113 -0
  56. package/dist-engine-src/src/functions/mod.rs +18 -0
  57. package/dist-engine-src/src/functions/provider.rs +130 -0
  58. package/dist-engine-src/src/functions/state.rs +336 -0
  59. package/dist-engine-src/src/functions/types.rs +37 -0
  60. package/dist-engine-src/src/init.rs +558 -0
  61. package/dist-engine-src/src/json_store/compression.rs +77 -0
  62. package/dist-engine-src/src/json_store/context.rs +423 -0
  63. package/dist-engine-src/src/json_store/encoded.rs +15 -0
  64. package/dist-engine-src/src/json_store/mod.rs +12 -0
  65. package/dist-engine-src/src/json_store/store.rs +1109 -0
  66. package/dist-engine-src/src/json_store/types.rs +217 -0
  67. package/dist-engine-src/src/lib.rs +62 -0
  68. package/dist-engine-src/src/live_state/context.rs +2019 -0
  69. package/dist-engine-src/src/live_state/mod.rs +15 -0
  70. package/dist-engine-src/src/live_state/overlay.rs +75 -0
  71. package/dist-engine-src/src/live_state/reader.rs +23 -0
  72. package/dist-engine-src/src/live_state/types.rs +222 -0
  73. package/dist-engine-src/src/live_state/visibility.rs +223 -0
  74. package/dist-engine-src/src/plugin/archive.rs +438 -0
  75. package/dist-engine-src/src/plugin/component.rs +183 -0
  76. package/dist-engine-src/src/plugin/install.rs +619 -0
  77. package/dist-engine-src/src/plugin/manifest.rs +516 -0
  78. package/dist-engine-src/src/plugin/materializer.rs +477 -0
  79. package/dist-engine-src/src/plugin/mod.rs +33 -0
  80. package/dist-engine-src/src/plugin/plugin_manifest.json +118 -0
  81. package/dist-engine-src/src/plugin/storage.rs +74 -0
  82. package/dist-engine-src/src/schema/annotations/defaults.rs +275 -0
  83. package/dist-engine-src/src/schema/annotations/mod.rs +1 -0
  84. package/dist-engine-src/src/schema/builtin/lix_account.json +21 -0
  85. package/dist-engine-src/src/schema/builtin/lix_active_account.json +29 -0
  86. package/dist-engine-src/src/schema/builtin/lix_binary_blob_ref.json +29 -0
  87. package/dist-engine-src/src/schema/builtin/lix_change.json +63 -0
  88. package/dist-engine-src/src/schema/builtin/lix_change_author.json +45 -0
  89. package/dist-engine-src/src/schema/builtin/lix_commit.json +24 -0
  90. package/dist-engine-src/src/schema/builtin/lix_commit_edge.json +53 -0
  91. package/dist-engine-src/src/schema/builtin/lix_directory_descriptor.json +52 -0
  92. package/dist-engine-src/src/schema/builtin/lix_file_descriptor.json +52 -0
  93. package/dist-engine-src/src/schema/builtin/lix_key_value.json +40 -0
  94. package/dist-engine-src/src/schema/builtin/lix_label.json +29 -0
  95. package/dist-engine-src/src/schema/builtin/lix_label_assignment.json +74 -0
  96. package/dist-engine-src/src/schema/builtin/lix_registered_schema.json +25 -0
  97. package/dist-engine-src/src/schema/builtin/lix_version_descriptor.json +34 -0
  98. package/dist-engine-src/src/schema/builtin/lix_version_ref.json +48 -0
  99. package/dist-engine-src/src/schema/builtin/mod.rs +222 -0
  100. package/dist-engine-src/src/schema/compatibility.rs +787 -0
  101. package/dist-engine-src/src/schema/definition.json +187 -0
  102. package/dist-engine-src/src/schema/definition.rs +742 -0
  103. package/dist-engine-src/src/schema/key.rs +138 -0
  104. package/dist-engine-src/src/schema/mod.rs +20 -0
  105. package/dist-engine-src/src/schema/seed.rs +14 -0
  106. package/dist-engine-src/src/schema/tests.rs +780 -0
  107. package/dist-engine-src/src/session/context.rs +364 -0
  108. package/dist-engine-src/src/session/create_version.rs +88 -0
  109. package/dist-engine-src/src/session/execute.rs +478 -0
  110. package/dist-engine-src/src/session/merge/analysis.rs +102 -0
  111. package/dist-engine-src/src/session/merge/apply.rs +23 -0
  112. package/dist-engine-src/src/session/merge/conflicts.rs +63 -0
  113. package/dist-engine-src/src/session/merge/mod.rs +11 -0
  114. package/dist-engine-src/src/session/merge/stats.rs +65 -0
  115. package/dist-engine-src/src/session/merge/version.rs +427 -0
  116. package/dist-engine-src/src/session/mod.rs +27 -0
  117. package/dist-engine-src/src/session/optimization9_sql2_bench.rs +100 -0
  118. package/dist-engine-src/src/session/switch_version.rs +109 -0
  119. package/dist-engine-src/src/sql2/change_provider.rs +331 -0
  120. package/dist-engine-src/src/sql2/classify.rs +182 -0
  121. package/dist-engine-src/src/sql2/context.rs +311 -0
  122. package/dist-engine-src/src/sql2/directory_history_provider.rs +631 -0
  123. package/dist-engine-src/src/sql2/directory_provider.rs +2453 -0
  124. package/dist-engine-src/src/sql2/dml.rs +148 -0
  125. package/dist-engine-src/src/sql2/entity_history_provider.rs +440 -0
  126. package/dist-engine-src/src/sql2/entity_provider.rs +3211 -0
  127. package/dist-engine-src/src/sql2/error.rs +216 -0
  128. package/dist-engine-src/src/sql2/execute.rs +3440 -0
  129. package/dist-engine-src/src/sql2/file_history_provider.rs +910 -0
  130. package/dist-engine-src/src/sql2/file_provider.rs +3679 -0
  131. package/dist-engine-src/src/sql2/filesystem_planner.rs +1490 -0
  132. package/dist-engine-src/src/sql2/filesystem_predicates.rs +159 -0
  133. package/dist-engine-src/src/sql2/filesystem_visibility.rs +383 -0
  134. package/dist-engine-src/src/sql2/history_projection.rs +56 -0
  135. package/dist-engine-src/src/sql2/history_provider.rs +412 -0
  136. package/dist-engine-src/src/sql2/history_route.rs +657 -0
  137. package/dist-engine-src/src/sql2/lix_state_provider.rs +2512 -0
  138. package/dist-engine-src/src/sql2/mod.rs +46 -0
  139. package/dist-engine-src/src/sql2/predicate_typecheck.rs +246 -0
  140. package/dist-engine-src/src/sql2/public_bind/assignment.rs +46 -0
  141. package/dist-engine-src/src/sql2/public_bind/capability.rs +41 -0
  142. package/dist-engine-src/src/sql2/public_bind/dml.rs +166 -0
  143. package/dist-engine-src/src/sql2/public_bind/mod.rs +25 -0
  144. package/dist-engine-src/src/sql2/public_bind/table.rs +168 -0
  145. package/dist-engine-src/src/sql2/read_only.rs +63 -0
  146. package/dist-engine-src/src/sql2/record_batch.rs +17 -0
  147. package/dist-engine-src/src/sql2/result_metadata.rs +29 -0
  148. package/dist-engine-src/src/sql2/runtime.rs +60 -0
  149. package/dist-engine-src/src/sql2/session.rs +132 -0
  150. package/dist-engine-src/src/sql2/udfs/common.rs +295 -0
  151. package/dist-engine-src/src/sql2/udfs/lix_active_version_commit_id.rs +53 -0
  152. package/dist-engine-src/src/sql2/udfs/lix_empty_blob.rs +47 -0
  153. package/dist-engine-src/src/sql2/udfs/lix_json.rs +100 -0
  154. package/dist-engine-src/src/sql2/udfs/lix_json_get.rs +99 -0
  155. package/dist-engine-src/src/sql2/udfs/lix_json_get_text.rs +99 -0
  156. package/dist-engine-src/src/sql2/udfs/lix_text_decode.rs +82 -0
  157. package/dist-engine-src/src/sql2/udfs/lix_text_encode.rs +85 -0
  158. package/dist-engine-src/src/sql2/udfs/lix_timestamp.rs +76 -0
  159. package/dist-engine-src/src/sql2/udfs/lix_uuid_v7.rs +76 -0
  160. package/dist-engine-src/src/sql2/udfs/mod.rs +89 -0
  161. package/dist-engine-src/src/sql2/udfs/public_call.rs +211 -0
  162. package/dist-engine-src/src/sql2/version_provider.rs +1202 -0
  163. package/dist-engine-src/src/sql2/version_scope.rs +394 -0
  164. package/dist-engine-src/src/sql2/write_normalization.rs +345 -0
  165. package/dist-engine-src/src/storage/context.rs +356 -0
  166. package/dist-engine-src/src/storage/mod.rs +14 -0
  167. package/dist-engine-src/src/storage/read_scope.rs +88 -0
  168. package/dist-engine-src/src/storage/types.rs +501 -0
  169. package/dist-engine-src/src/storage_bench.rs +4863 -0
  170. package/dist-engine-src/src/test_support.rs +228 -0
  171. package/dist-engine-src/src/tracked_state/by_file_index.rs +98 -0
  172. package/dist-engine-src/src/tracked_state/codec.rs +2085 -0
  173. package/dist-engine-src/src/tracked_state/context.rs +1867 -0
  174. package/dist-engine-src/src/tracked_state/diff.rs +686 -0
  175. package/dist-engine-src/src/tracked_state/materialization.rs +403 -0
  176. package/dist-engine-src/src/tracked_state/materializer.rs +488 -0
  177. package/dist-engine-src/src/tracked_state/merge.rs +492 -0
  178. package/dist-engine-src/src/tracked_state/mod.rs +32 -0
  179. package/dist-engine-src/src/tracked_state/storage.rs +375 -0
  180. package/dist-engine-src/src/tracked_state/tree.rs +3187 -0
  181. package/dist-engine-src/src/tracked_state/types.rs +231 -0
  182. package/dist-engine-src/src/transaction/commit.rs +1484 -0
  183. package/dist-engine-src/src/transaction/context.rs +1548 -0
  184. package/dist-engine-src/src/transaction/live_state_overlay.rs +35 -0
  185. package/dist-engine-src/src/transaction/mod.rs +13 -0
  186. package/dist-engine-src/src/transaction/normalization.rs +890 -0
  187. package/dist-engine-src/src/transaction/prep.rs +37 -0
  188. package/dist-engine-src/src/transaction/schema_resolver.rs +149 -0
  189. package/dist-engine-src/src/transaction/staging.rs +1731 -0
  190. package/dist-engine-src/src/transaction/types.rs +460 -0
  191. package/dist-engine-src/src/transaction/validation.rs +5830 -0
  192. package/dist-engine-src/src/untracked_state/codec.rs +307 -0
  193. package/dist-engine-src/src/untracked_state/context.rs +98 -0
  194. package/dist-engine-src/src/untracked_state/materialization.rs +63 -0
  195. package/dist-engine-src/src/untracked_state/mod.rs +15 -0
  196. package/dist-engine-src/src/untracked_state/storage.rs +396 -0
  197. package/dist-engine-src/src/untracked_state/types.rs +146 -0
  198. package/dist-engine-src/src/version/context.rs +40 -0
  199. package/dist-engine-src/src/version/lifecycle.rs +221 -0
  200. package/dist-engine-src/src/version/mod.rs +13 -0
  201. package/dist-engine-src/src/version/refs.rs +330 -0
  202. package/dist-engine-src/src/version/stage_rows.rs +67 -0
  203. package/dist-engine-src/src/version/types.rs +21 -0
  204. package/dist-engine-src/src/wasm/mod.rs +60 -0
  205. package/package.json +68 -64
@@ -2,7 +2,6 @@
2
2
  // Source of truth: packages/engine/src/schema/builtin/*.json
3
3
  export const LixAccountSchema = {
4
4
  "x-lix-key": "lix_account",
5
- "x-lix-version": "1",
6
5
  "x-lix-primary-key": [
7
6
  "/id"
8
7
  ],
@@ -24,7 +23,6 @@ export const LixAccountSchema = {
24
23
  };
25
24
  export const LixActiveAccountSchema = {
26
25
  "x-lix-key": "lix_active_account",
27
- "x-lix-version": "1",
28
26
  "x-lix-primary-key": [
29
27
  "/account_id"
30
28
  ],
@@ -54,7 +52,6 @@ export const LixActiveAccountSchema = {
54
52
  };
55
53
  export const LixBinaryBlobRefSchema = {
56
54
  "x-lix-key": "lix_binary_blob_ref",
57
- "x-lix-version": "1",
58
55
  "description": "Metadata pointer from a file version to its binary payload in internal CAS storage.",
59
56
  "x-lix-primary-key": [
60
57
  "/id"
@@ -84,8 +81,7 @@ export const LixBinaryBlobRefSchema = {
84
81
  };
85
82
  export const LixChangeSchema = {
86
83
  "x-lix-key": "lix_change",
87
- "x-lix-version": "1",
88
- "description": "Canonical immutable change fact. This surface represents the authoritative stream of journaled change facts. Commit lineage and non-commit scope are modeled separately around these facts.",
84
+ "description": "A change records one edit to a Lix entity, including what changed, when it changed, and which entity was affected.",
89
85
  "x-lix-primary-key": [
90
86
  "/id"
91
87
  ],
@@ -94,20 +90,20 @@ export const LixChangeSchema = {
94
90
  "id": {
95
91
  "type": "string",
96
92
  "x-lix-default": "lix_uuid_v7()",
97
- "description": "Stable change identifier (UUIDv7). Referenced from `lix_commit.change_ids` and `lix_change_set_element.change_id`."
93
+ "description": "Stable identifier for this change."
98
94
  },
99
95
  "entity_id": {
100
- "type": "string",
101
- "description": "The entity this change applies to, scoped by (`schema_key`, `file_id`)."
96
+ "type": "array",
97
+ "description": "Canonical JSON primary-key tuple for the entity this change applies to, scoped by (`schema_key`, `file_id`). Values are ordered according to the target schema's `x-lix-primary-key`.",
98
+ "items": {
99
+ "type": "string"
100
+ },
101
+ "minItems": 1
102
102
  },
103
103
  "schema_key": {
104
104
  "type": "string",
105
105
  "description": "Schema identifier of the entity (e.g. `lix_file_descriptor`, `lix_commit`, or a user-registered key)."
106
106
  },
107
- "schema_version": {
108
- "type": "string",
109
- "description": "Schema version the snapshot_content was written against (matches `x-lix-version` on the schema at write time)."
110
- },
111
107
  "file_id": {
112
108
  "type": [
113
109
  "string",
@@ -124,6 +120,9 @@ export const LixChangeSchema = {
124
120
  },
125
121
  "created_at": {
126
122
  "type": "string",
123
+ "examples": [
124
+ "2026-05-08T17:42:31.123Z"
125
+ ],
127
126
  "description": "ISO-8601 timestamp at which the change was recorded (set via `lix_timestamp()` at write time)."
128
127
  },
129
128
  "snapshot_content": {
@@ -138,7 +137,6 @@ export const LixChangeSchema = {
138
137
  "id",
139
138
  "entity_id",
140
139
  "schema_key",
141
- "schema_version",
142
140
  "file_id",
143
141
  "created_at"
144
142
  ],
@@ -146,7 +144,6 @@ export const LixChangeSchema = {
146
144
  };
147
145
  export const LixChangeAuthorSchema = {
148
146
  "x-lix-key": "lix_change_author",
149
- "x-lix-version": "1",
150
147
  "x-lix-primary-key": [
151
148
  "/change_id",
152
149
  "/account_id"
@@ -190,9 +187,14 @@ export const LixChangeAuthorSchema = {
190
187
  ],
191
188
  "additionalProperties": false
192
189
  };
193
- export const LixChangeSetSchema = {
194
- "x-lix-key": "lix_change_set",
195
- "x-lix-version": "1",
190
+ export const LixCommitSchema = {
191
+ "x-lix-key": "lix_commit",
192
+ "description": "A commit is a stable point in project history. Versions point to commits. Use lix_commit_edge to inspect parent commits.",
193
+ "examples": [
194
+ {
195
+ "id": "commit_01jexample"
196
+ }
197
+ ],
196
198
  "x-lix-primary-key": [
197
199
  "/id"
198
200
  ],
@@ -200,7 +202,8 @@ export const LixChangeSetSchema = {
200
202
  "properties": {
201
203
  "id": {
202
204
  "type": "string",
203
- "x-lix-default": "lix_uuid_v7()"
205
+ "x-lix-default": "lix_uuid_v7()",
206
+ "description": "Stable identifier of this commit."
204
207
  }
205
208
  },
206
209
  "required": [
@@ -208,149 +211,30 @@ export const LixChangeSetSchema = {
208
211
  ],
209
212
  "additionalProperties": false
210
213
  };
211
- export const LixChangeSetElementSchema = {
212
- "x-lix-key": "lix_change_set_element",
213
- "x-lix-version": "1",
214
- "description": "Derived relational index mapping a change_set to the canonical changes introduced by its commit relative to the commit's first parent. Rebuildable from `lix_commit.change_ids` plus the referenced `lix_change` rows; the unique constraint enforces at most one change per (entity, schema, file) tuple within a single change_set.",
215
- "x-lix-primary-key": [
216
- "/change_set_id",
217
- "/change_id"
218
- ],
219
- "x-lix-unique": [
220
- [
221
- "/change_set_id",
222
- "/entity_id",
223
- "/schema_key",
224
- "/file_id"
225
- ]
226
- ],
227
- "x-lix-foreign-keys": [
214
+ export const LixCommitEdgeSchema = {
215
+ "x-lix-key": "lix_commit_edge",
216
+ "description": "Direct parent relationship between two commits. Merge commits have one row per parent. The first parent is useful for showing mainline history or comparing a merge commit against the commit that was checked out before the merge.",
217
+ "examples": [
228
218
  {
229
- "properties": [
230
- "/change_set_id"
231
- ],
232
- "references": {
233
- "schemaKey": "lix_change_set",
234
- "properties": [
235
- "/id"
236
- ]
237
- }
219
+ "parent_id": "commit-main",
220
+ "child_id": "commit-merge",
221
+ "parent_order": 0
238
222
  },
239
223
  {
240
- "properties": [
241
- "/change_id"
242
- ],
243
- "references": {
244
- "schemaKey": "lix_change",
245
- "properties": [
246
- "/id"
247
- ]
248
- }
249
- }
250
- ],
251
- "type": "object",
252
- "properties": {
253
- "change_set_id": {
254
- "type": "string",
255
- "description": "The change_set this element belongs to (references `lix_change_set.id`)."
256
- },
257
- "change_id": {
258
- "type": "string",
259
- "description": "The canonical change introduced/adopted by the change_set's commit (references `lix_change.id`)."
260
- },
261
- "entity_id": {
262
- "type": "string",
263
- "description": "Denormalized from the referenced `lix_change` for fast entity-scoped queries and to anchor the unique constraint."
264
- },
265
- "schema_key": {
266
- "type": "string",
267
- "description": "Denormalized schema identifier from the referenced `lix_change`; part of the per-change_set uniqueness tuple."
268
- },
269
- "file_id": {
270
- "type": [
271
- "string",
272
- "null"
273
- ],
274
- "description": "Denormalized file scope from the referenced `lix_change`; NULL for engine-internal entities. Part of the per-change_set uniqueness tuple."
224
+ "parent_id": "commit-feature",
225
+ "child_id": "commit-merge",
226
+ "parent_order": 1
275
227
  }
276
- },
277
- "required": [
278
- "change_set_id",
279
- "change_id",
280
- "entity_id",
281
- "schema_key",
282
- "file_id"
283
228
  ],
284
- "additionalProperties": false
285
- };
286
- export const LixCommitSchema = {
287
- "x-lix-key": "lix_commit",
288
- "x-lix-version": "1",
289
- "description": "Commit header change. Canonical commit membership is stored in change_ids as the ordered list of canonical changes whose effects this commit introduces relative to its first parent. A merge commit may reference canonical changes originally authored in another parent instead of copying them. Derived projections such as lix_change_set_element must be rebuildable from this header plus the referenced change rows. Version head pointers such as lix_version_ref are maintained separately and are not commit members.",
290
229
  "x-lix-primary-key": [
291
- "/id"
292
- ],
293
- "x-lix-foreign-keys": [
294
- {
295
- "properties": [
296
- "/change_set_id"
297
- ],
298
- "references": {
299
- "schemaKey": "lix_change_set",
300
- "properties": [
301
- "/id"
302
- ]
303
- }
304
- }
230
+ "/child_id",
231
+ "/parent_order"
305
232
  ],
306
- "type": "object",
307
- "properties": {
308
- "id": {
309
- "type": "string",
310
- "x-lix-default": "lix_uuid_v7()",
311
- "description": "Stable commit identifier."
312
- },
313
- "change_set_id": {
314
- "type": "string",
315
- "description": "Commit-local grouping identifier used by derived relational indexes and projections such as lix_change_set_element."
316
- },
317
- "change_ids": {
318
- "type": "array",
319
- "default": [],
320
- "items": {
321
- "type": "string"
322
- },
323
- "description": "Canonical ordered membership list of non-header change IDs whose effects this commit introduces relative to its first parent. Merge commits may reference existing changes from another parent instead of minting equivalent copies. Derived indexes such as lix_change_set_element must be rebuildable from this list. This does not include lix_version_ref pointer rows."
324
- },
325
- "author_account_ids": {
326
- "type": "array",
327
- "default": [],
328
- "items": {
329
- "type": "string"
330
- },
331
- "description": "Ordered set of author account IDs associated with this commit."
332
- },
333
- "parent_commit_ids": {
334
- "type": "array",
335
- "default": [],
336
- "items": {
337
- "type": "string"
338
- },
339
- "description": "Parent commit IDs for commit graph topology."
340
- }
341
- },
342
- "required": [
343
- "id",
344
- "change_set_id"
345
- ],
346
- "additionalProperties": false
347
- };
348
- export const LixCommitEdgeSchema = {
349
- "x-lix-key": "lix_commit_edge",
350
- "x-lix-version": "1",
351
- "x-lix-primary-key": [
352
- "/parent_id",
353
- "/child_id"
233
+ "x-lix-unique": [
234
+ [
235
+ "/parent_id",
236
+ "/child_id"
237
+ ]
354
238
  ],
355
239
  "x-lix-foreign-keys": [
356
240
  {
@@ -379,21 +263,32 @@ export const LixCommitEdgeSchema = {
379
263
  "type": "object",
380
264
  "properties": {
381
265
  "parent_id": {
382
- "type": "string"
266
+ "type": "string",
267
+ "description": "Identifier of the parent commit."
383
268
  },
384
269
  "child_id": {
385
- "type": "string"
270
+ "type": "string",
271
+ "description": "Identifier of the child commit."
272
+ },
273
+ "parent_order": {
274
+ "type": "integer",
275
+ "minimum": 0,
276
+ "examples": [
277
+ 0,
278
+ 1
279
+ ],
280
+ "description": "Zero-based position of this parent in the child commit's ordered parent list. The first parent has order 0; additional merge parents have order 1, 2, and so on."
386
281
  }
387
282
  },
388
283
  "required": [
389
284
  "parent_id",
390
- "child_id"
285
+ "child_id",
286
+ "parent_order"
391
287
  ],
392
288
  "additionalProperties": false
393
289
  };
394
290
  export const LixDirectoryDescriptorSchema = {
395
291
  "x-lix-key": "lix_directory_descriptor",
396
- "x-lix-version": "1",
397
292
  "x-lix-primary-key": [
398
293
  "/id"
399
294
  ],
@@ -444,72 +339,8 @@ export const LixDirectoryDescriptorSchema = {
444
339
  ],
445
340
  "additionalProperties": false
446
341
  };
447
- export const LixEntityLabelSchema = {
448
- "x-lix-key": "lix_entity_label",
449
- "x-lix-version": "1",
450
- "x-lix-primary-key": [
451
- "/entity_id",
452
- "/schema_key",
453
- "/file_id",
454
- "/label_id"
455
- ],
456
- "x-lix-foreign-keys": [
457
- {
458
- "properties": [
459
- "/entity_id",
460
- "/schema_key",
461
- "/file_id"
462
- ],
463
- "references": {
464
- "schemaKey": "lix_state",
465
- "properties": [
466
- "/entity_id",
467
- "/schema_key",
468
- "/file_id"
469
- ]
470
- }
471
- },
472
- {
473
- "properties": [
474
- "/label_id"
475
- ],
476
- "references": {
477
- "schemaKey": "lix_label",
478
- "properties": [
479
- "/id"
480
- ]
481
- }
482
- }
483
- ],
484
- "type": "object",
485
- "properties": {
486
- "entity_id": {
487
- "type": "string"
488
- },
489
- "schema_key": {
490
- "type": "string"
491
- },
492
- "file_id": {
493
- "type": [
494
- "string",
495
- "null"
496
- ]
497
- },
498
- "label_id": {
499
- "type": "string"
500
- }
501
- },
502
- "required": [
503
- "entity_id",
504
- "schema_key",
505
- "file_id",
506
- "label_id"
507
- ],
508
- "additionalProperties": false
509
- };
510
342
  export const LixFileDescriptorSchema = {
511
343
  "x-lix-key": "lix_file_descriptor",
512
- "x-lix-version": "1",
513
344
  "x-lix-primary-key": [
514
345
  "/id"
515
346
  ],
@@ -562,7 +393,6 @@ export const LixFileDescriptorSchema = {
562
393
  };
563
394
  export const LixKeyValueSchema = {
564
395
  "x-lix-key": "lix_key_value",
565
- "x-lix-version": "1",
566
396
  "x-lix-primary-key": [
567
397
  "/key"
568
398
  ],
@@ -603,18 +433,25 @@ export const LixKeyValueSchema = {
603
433
  };
604
434
  export const LixLabelSchema = {
605
435
  "x-lix-key": "lix_label",
606
- "x-lix-version": "1",
436
+ "description": "Catalog of labels that can be assigned to arbitrary live Lix rows through lix_label_assignment.",
607
437
  "x-lix-primary-key": [
608
438
  "/id"
609
439
  ],
440
+ "x-lix-unique": [
441
+ [
442
+ "/name"
443
+ ]
444
+ ],
610
445
  "type": "object",
611
446
  "properties": {
612
447
  "id": {
613
448
  "type": "string",
614
- "x-lix-default": "lix_uuid_v7()"
449
+ "x-lix-default": "lix_uuid_v7()",
450
+ "description": "Stable label identifier. Label assignments reference this value."
615
451
  },
616
452
  "name": {
617
- "type": "string"
453
+ "type": "string",
454
+ "description": "Human-readable label name. Unique across labels."
618
455
  }
619
456
  },
620
457
  "required": [
@@ -623,12 +460,84 @@ export const LixLabelSchema = {
623
460
  ],
624
461
  "additionalProperties": false
625
462
  };
463
+ export const LixLabelAssignmentSchema = {
464
+ "x-lix-key": "lix_label_assignment",
465
+ "description": "Mapping table that assigns a label to any live Lix row addressed by (target_entity_id, target_schema_key, target_file_id). The state foreign-key tuple is ordered as [0] target_entity_id, [1] target_schema_key, [2] target_file_id.",
466
+ "x-lix-primary-key": [
467
+ "/id"
468
+ ],
469
+ "x-lix-unique": [
470
+ [
471
+ "/target_entity_id",
472
+ "/target_schema_key",
473
+ "/target_file_id",
474
+ "/label_id"
475
+ ]
476
+ ],
477
+ "x-lix-state-foreign-keys": [
478
+ [
479
+ "/target_entity_id",
480
+ "/target_schema_key",
481
+ "/target_file_id"
482
+ ]
483
+ ],
484
+ "x-lix-foreign-keys": [
485
+ {
486
+ "properties": [
487
+ "/label_id"
488
+ ],
489
+ "references": {
490
+ "schemaKey": "lix_label",
491
+ "properties": [
492
+ "/id"
493
+ ]
494
+ }
495
+ }
496
+ ],
497
+ "type": "object",
498
+ "properties": {
499
+ "id": {
500
+ "type": "string",
501
+ "x-lix-default": "lix_uuid_v7()",
502
+ "description": "Stable identifier for this label assignment row."
503
+ },
504
+ "target_entity_id": {
505
+ "type": "array",
506
+ "description": "Target row entity_id. This is slot [0] in x-lix-state-foreign-keys and must be the canonical JSON array of string primary-key parts.",
507
+ "items": {
508
+ "type": "string"
509
+ },
510
+ "minItems": 1
511
+ },
512
+ "target_schema_key": {
513
+ "type": "string",
514
+ "description": "Target row schema key. This is slot [1] in x-lix-state-foreign-keys."
515
+ },
516
+ "target_file_id": {
517
+ "type": [
518
+ "string",
519
+ "null"
520
+ ],
521
+ "description": "Target row file scope. This is slot [2] in x-lix-state-foreign-keys; null targets global rows."
522
+ },
523
+ "label_id": {
524
+ "type": "string",
525
+ "description": "Label assigned to the target row. References lix_label.id."
526
+ }
527
+ },
528
+ "required": [
529
+ "id",
530
+ "target_entity_id",
531
+ "target_schema_key",
532
+ "target_file_id",
533
+ "label_id"
534
+ ],
535
+ "additionalProperties": false
536
+ };
626
537
  export const LixRegisteredSchemaSchema = {
627
538
  "x-lix-key": "lix_registered_schema",
628
- "x-lix-version": "1",
629
539
  "x-lix-primary-key": [
630
- "/value/x-lix-key",
631
- "/value/x-lix-version"
540
+ "/value/x-lix-key"
632
541
  ],
633
542
  "type": "object",
634
543
  "properties": {
@@ -637,14 +546,10 @@ export const LixRegisteredSchemaSchema = {
637
546
  "properties": {
638
547
  "x-lix-key": {
639
548
  "type": "string"
640
- },
641
- "x-lix-version": {
642
- "type": "string"
643
549
  }
644
550
  },
645
551
  "required": [
646
- "x-lix-key",
647
- "x-lix-version"
552
+ "x-lix-key"
648
553
  ],
649
554
  "additionalProperties": true
650
555
  }
@@ -656,7 +561,6 @@ export const LixRegisteredSchemaSchema = {
656
561
  };
657
562
  export const LixVersionDescriptorSchema = {
658
563
  "x-lix-key": "lix_version_descriptor",
659
- "x-lix-version": "1",
660
564
  "description": "User-facing version metadata (name and visibility) for a branch-like version. The stable identity of a version; the matching `lix_version_ref` carries the moving head pointer. The catalog's `lix_version` surface joins this descriptor with its ref to present a single user-visible version row.",
661
565
  "x-lix-primary-key": [
662
566
  "/id"
@@ -691,7 +595,6 @@ export const LixVersionDescriptorSchema = {
691
595
  };
692
596
  export const LixVersionRefSchema = {
693
597
  "x-lix-key": "lix_version_ref",
694
- "x-lix-version": "1",
695
598
  "description": "Version head pointer. Records which commit a version should currently resolve to in the local runtime. Intentionally not part of canonical commit membership: refs may be reset client-side after sync without introducing content conflicts. Each `lix_version_descriptor.id` has exactly one `lix_version_ref` row.",
696
599
  "x-lix-primary-key": [
697
600
  "/id"