@lix-js/sdk 0.6.0-preview.2 → 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 (165) hide show
  1. package/SKILL.md +4 -5
  2. package/dist/engine-wasm/wasm/lix_engine.js +1 -1
  3. package/dist/engine-wasm/wasm/lix_engine.wasm +0 -0
  4. package/dist/generated/builtin-schemas.d.ts +87 -162
  5. package/dist/generated/builtin-schemas.js +139 -236
  6. package/dist/open-lix.d.ts +1 -1
  7. package/dist-engine-src/src/binary_cas/types.rs +0 -6
  8. package/dist-engine-src/src/catalog/context.rs +412 -0
  9. package/dist-engine-src/src/catalog/mod.rs +10 -0
  10. package/dist-engine-src/src/catalog/schema.rs +4 -0
  11. package/dist-engine-src/src/catalog/snapshot.rs +1114 -0
  12. package/dist-engine-src/src/cel/mod.rs +1 -1
  13. package/dist-engine-src/src/cel/provider.rs +1 -1
  14. package/dist-engine-src/src/commit_graph/context.rs +328 -1015
  15. package/dist-engine-src/src/commit_graph/mod.rs +2 -3
  16. package/dist-engine-src/src/commit_graph/types.rs +7 -43
  17. package/dist-engine-src/src/commit_graph/walker.rs +57 -81
  18. package/dist-engine-src/src/commit_store/codec.rs +887 -0
  19. package/dist-engine-src/src/commit_store/context.rs +944 -0
  20. package/dist-engine-src/src/commit_store/materialization.rs +84 -0
  21. package/dist-engine-src/src/commit_store/mod.rs +16 -0
  22. package/dist-engine-src/src/commit_store/storage.rs +600 -0
  23. package/dist-engine-src/src/commit_store/types.rs +215 -0
  24. package/dist-engine-src/src/common/identity.rs +15 -5
  25. package/dist-engine-src/src/common/json_pointer.rs +67 -0
  26. package/dist-engine-src/src/common/metadata.rs +17 -12
  27. package/dist-engine-src/src/common/mod.rs +5 -5
  28. package/dist-engine-src/src/domain.rs +324 -0
  29. package/dist-engine-src/src/engine.rs +29 -43
  30. package/dist-engine-src/src/entity_identity.rs +238 -118
  31. package/dist-engine-src/src/functions/context.rs +17 -52
  32. package/dist-engine-src/src/functions/deterministic.rs +1 -1
  33. package/dist-engine-src/src/functions/mod.rs +1 -1
  34. package/dist-engine-src/src/functions/provider.rs +4 -4
  35. package/dist-engine-src/src/functions/state.rs +39 -66
  36. package/dist-engine-src/src/functions/types.rs +1 -1
  37. package/dist-engine-src/src/init.rs +204 -151
  38. package/dist-engine-src/src/json_store/context.rs +354 -60
  39. package/dist-engine-src/src/json_store/encoded.rs +6 -6
  40. package/dist-engine-src/src/json_store/mod.rs +4 -1
  41. package/dist-engine-src/src/json_store/store.rs +884 -11
  42. package/dist-engine-src/src/json_store/types.rs +166 -1
  43. package/dist-engine-src/src/lib.rs +10 -9
  44. package/dist-engine-src/src/live_state/context.rs +608 -830
  45. package/dist-engine-src/src/live_state/mod.rs +3 -3
  46. package/dist-engine-src/src/live_state/overlay.rs +7 -7
  47. package/dist-engine-src/src/live_state/reader.rs +5 -5
  48. package/dist-engine-src/src/live_state/types.rs +19 -36
  49. package/dist-engine-src/src/live_state/visibility.rs +19 -14
  50. package/dist-engine-src/src/plugin/archive.rs +3 -6
  51. package/dist-engine-src/src/plugin/install.rs +0 -18
  52. package/dist-engine-src/src/plugin/plugin_manifest.json +0 -1
  53. package/dist-engine-src/src/schema/annotations/defaults.rs +2 -7
  54. package/dist-engine-src/src/schema/builtin/lix_account.json +0 -1
  55. package/dist-engine-src/src/schema/builtin/lix_active_account.json +0 -1
  56. package/dist-engine-src/src/schema/builtin/lix_binary_blob_ref.json +0 -1
  57. package/dist-engine-src/src/schema/builtin/lix_change.json +11 -10
  58. package/dist-engine-src/src/schema/builtin/lix_change_author.json +0 -1
  59. package/dist-engine-src/src/schema/builtin/lix_commit.json +8 -46
  60. package/dist-engine-src/src/schema/builtin/lix_commit_edge.json +29 -22
  61. package/dist-engine-src/src/schema/builtin/lix_directory_descriptor.json +0 -1
  62. package/dist-engine-src/src/schema/builtin/lix_file_descriptor.json +0 -1
  63. package/dist-engine-src/src/schema/builtin/lix_key_value.json +0 -1
  64. package/dist-engine-src/src/schema/builtin/lix_label.json +10 -3
  65. package/dist-engine-src/src/schema/builtin/lix_label_assignment.json +74 -0
  66. package/dist-engine-src/src/schema/builtin/lix_registered_schema.json +2 -8
  67. package/dist-engine-src/src/schema/builtin/lix_version_descriptor.json +0 -1
  68. package/dist-engine-src/src/schema/builtin/lix_version_ref.json +0 -1
  69. package/dist-engine-src/src/schema/builtin/mod.rs +10 -59
  70. package/dist-engine-src/src/schema/compatibility.rs +787 -0
  71. package/dist-engine-src/src/schema/definition.json +47 -17
  72. package/dist-engine-src/src/schema/definition.rs +202 -96
  73. package/dist-engine-src/src/schema/key.rs +9 -77
  74. package/dist-engine-src/src/schema/mod.rs +4 -4
  75. package/dist-engine-src/src/schema/tests.rs +133 -92
  76. package/dist-engine-src/src/session/context.rs +40 -42
  77. package/dist-engine-src/src/session/create_version.rs +22 -14
  78. package/dist-engine-src/src/session/execute.rs +45 -14
  79. package/dist-engine-src/src/session/merge/apply.rs +4 -4
  80. package/dist-engine-src/src/session/merge/conflicts.rs +3 -2
  81. package/dist-engine-src/src/session/merge/stats.rs +1 -1
  82. package/dist-engine-src/src/session/merge/version.rs +35 -45
  83. package/dist-engine-src/src/session/mod.rs +4 -2
  84. package/dist-engine-src/src/session/optimization9_sql2_bench.rs +100 -0
  85. package/dist-engine-src/src/session/switch_version.rs +16 -28
  86. package/dist-engine-src/src/sql2/change_provider.rs +14 -20
  87. package/dist-engine-src/src/sql2/classify.rs +61 -26
  88. package/dist-engine-src/src/sql2/context.rs +22 -18
  89. package/dist-engine-src/src/sql2/directory_history_provider.rs +28 -20
  90. package/dist-engine-src/src/sql2/directory_provider.rs +131 -83
  91. package/dist-engine-src/src/sql2/entity_history_provider.rs +10 -14
  92. package/dist-engine-src/src/sql2/entity_provider.rs +680 -169
  93. package/dist-engine-src/src/sql2/error.rs +21 -1
  94. package/dist-engine-src/src/sql2/execute.rs +325 -264
  95. package/dist-engine-src/src/sql2/file_history_provider.rs +29 -21
  96. package/dist-engine-src/src/sql2/file_provider.rs +533 -108
  97. package/dist-engine-src/src/sql2/filesystem_planner.rs +58 -94
  98. package/dist-engine-src/src/sql2/filesystem_visibility.rs +37 -23
  99. package/dist-engine-src/src/sql2/history_projection.rs +3 -27
  100. package/dist-engine-src/src/sql2/history_provider.rs +11 -17
  101. package/dist-engine-src/src/sql2/history_route.rs +22 -8
  102. package/dist-engine-src/src/sql2/lix_state_provider.rs +178 -96
  103. package/dist-engine-src/src/sql2/mod.rs +6 -3
  104. package/dist-engine-src/src/sql2/predicate_typecheck.rs +246 -0
  105. package/dist-engine-src/src/sql2/public_bind/assignment.rs +46 -0
  106. package/dist-engine-src/src/sql2/public_bind/capability.rs +41 -0
  107. package/dist-engine-src/src/sql2/public_bind/dml.rs +166 -0
  108. package/dist-engine-src/src/sql2/public_bind/mod.rs +25 -0
  109. package/dist-engine-src/src/sql2/public_bind/table.rs +168 -0
  110. package/dist-engine-src/src/sql2/read_only.rs +10 -12
  111. package/dist-engine-src/src/sql2/session.rs +7 -10
  112. package/dist-engine-src/src/sql2/udfs/lix_timestamp.rs +76 -0
  113. package/dist-engine-src/src/sql2/udfs/mod.rs +8 -1
  114. package/dist-engine-src/src/sql2/udfs/public_call.rs +211 -0
  115. package/dist-engine-src/src/sql2/version_provider.rs +46 -31
  116. package/dist-engine-src/src/sql2/version_scope.rs +4 -4
  117. package/dist-engine-src/src/storage_bench.rs +1782 -325
  118. package/dist-engine-src/src/test_support.rs +183 -36
  119. package/dist-engine-src/src/tracked_state/by_file_index.rs +20 -24
  120. package/dist-engine-src/src/tracked_state/codec.rs +1519 -181
  121. package/dist-engine-src/src/tracked_state/context.rs +1155 -271
  122. package/dist-engine-src/src/tracked_state/diff.rs +249 -57
  123. package/dist-engine-src/src/tracked_state/materialization.rs +365 -103
  124. package/dist-engine-src/src/tracked_state/materializer.rs +488 -0
  125. package/dist-engine-src/src/tracked_state/merge.rs +37 -19
  126. package/dist-engine-src/src/tracked_state/mod.rs +8 -7
  127. package/dist-engine-src/src/tracked_state/storage.rs +138 -6
  128. package/dist-engine-src/src/tracked_state/tree.rs +695 -252
  129. package/dist-engine-src/src/tracked_state/types.rs +176 -6
  130. package/dist-engine-src/src/transaction/commit.rs +695 -435
  131. package/dist-engine-src/src/transaction/context.rs +551 -310
  132. package/dist-engine-src/src/transaction/live_state_overlay.rs +9 -8
  133. package/dist-engine-src/src/transaction/mod.rs +2 -0
  134. package/dist-engine-src/src/transaction/normalization.rs +311 -447
  135. package/dist-engine-src/src/transaction/prep.rs +37 -0
  136. package/dist-engine-src/src/transaction/schema_resolver.rs +93 -71
  137. package/dist-engine-src/src/transaction/staging.rs +701 -406
  138. package/dist-engine-src/src/transaction/types.rs +231 -122
  139. package/dist-engine-src/src/transaction/validation.rs +2717 -1698
  140. package/dist-engine-src/src/untracked_state/codec.rs +40 -96
  141. package/dist-engine-src/src/untracked_state/context.rs +21 -5
  142. package/dist-engine-src/src/untracked_state/materialization.rs +10 -104
  143. package/dist-engine-src/src/untracked_state/mod.rs +3 -5
  144. package/dist-engine-src/src/untracked_state/storage.rs +105 -57
  145. package/dist-engine-src/src/untracked_state/types.rs +63 -13
  146. package/dist-engine-src/src/version/context.rs +1 -13
  147. package/dist-engine-src/src/version/lifecycle.rs +221 -0
  148. package/dist-engine-src/src/version/mod.rs +3 -2
  149. package/dist-engine-src/src/version/refs.rs +12 -103
  150. package/dist-engine-src/src/version/stage_rows.rs +15 -19
  151. package/package.json +1 -1
  152. package/dist-engine-src/src/changelog/codec.rs +0 -321
  153. package/dist-engine-src/src/changelog/context.rs +0 -92
  154. package/dist-engine-src/src/changelog/materialization.rs +0 -121
  155. package/dist-engine-src/src/changelog/mod.rs +0 -13
  156. package/dist-engine-src/src/changelog/reader.rs +0 -20
  157. package/dist-engine-src/src/changelog/storage.rs +0 -220
  158. package/dist-engine-src/src/changelog/types.rs +0 -38
  159. package/dist-engine-src/src/schema/builtin/lix_change_set.json +0 -18
  160. package/dist-engine-src/src/schema/builtin/lix_change_set_element.json +0 -75
  161. package/dist-engine-src/src/schema/builtin/lix_entity_label.json +0 -63
  162. package/dist-engine-src/src/schema_registry.rs +0 -294
  163. package/dist-engine-src/src/sql2/commit_derived_provider.rs +0 -591
  164. package/dist-engine-src/src/tracked_state/rebuild.rs +0 -771
  165. package/dist-engine-src/src/tracked_state/tree_types.rs +0 -176
package/SKILL.md CHANGED
@@ -45,7 +45,7 @@ Do not use this skill for raw SQLite access, private engine/wasm internals, SDK
45
45
 
46
46
  1. Install `@lix-js/sdk` and `better-sqlite3`.
47
47
  2. Open with `createBetterSqlite3Backend({ path })`; do not open `.lix` with raw SQLite.
48
- 3. Register a schema with `x-lix-key`, `x-lix-version`, `x-lix-primary-key`, and `additionalProperties: false`.
48
+ 3. Register a schema with `x-lix-key`, `x-lix-primary-key`, and `additionalProperties: false`.
49
49
  4. Write rows through the generated table named by `x-lix-key`.
50
50
  5. Use `<schema>_by_version` plus `lixcol_version_id` for side-by-side version reads/writes.
51
51
  6. Query `lix_change` for audit/history instead of hand-rolling audit tables.
@@ -57,6 +57,7 @@ Do not use this skill for raw SQLite access, private engine/wasm internals, SDK
57
57
  - Use `createBetterSqlite3Backend()` for persistent apps, demos, and tests.
58
58
  - Use numbered SQL placeholders: `$1`, `$2`, `$3`; bare `?` is rejected.
59
59
  - Use `lix_json($1)` when inserting JSON text into JSON-typed columns.
60
+ - Use scalar SQL functions `SELECT lix_uuid_v7()` and `SELECT lix_timestamp()` when consumer code needs Lix-generated UUID v7 ids or ISO timestamps. Do not call them as table functions with `SELECT * FROM ...`.
60
61
  - Use stable, namespaced, lowercase schema keys like `acme_section`, not generic names like `task`.
61
62
  - Always include `x-lix-primary-key` and `additionalProperties: false` on app schemas.
62
63
  - Use version names from the user's vocabulary, such as `"Marketing edit"` or `"Q3 pricing draft"`.
@@ -134,7 +135,6 @@ await lix.execute(
134
135
  JSON.stringify({
135
136
  $schema: "https://json-schema.org/draft/2020-12/schema",
136
137
  "x-lix-key": "acme_note",
137
- "x-lix-version": "1",
138
138
  "x-lix-primary-key": ["/id"],
139
139
  type: "object",
140
140
  required: ["id", "title", "done"],
@@ -217,7 +217,7 @@ await lix.execute(
217
217
  Schema basics:
218
218
 
219
219
  - `x-lix-key` becomes the generated SQL table name.
220
- - `x-lix-version` versions your schema contract.
220
+ - Compatible schema amendments are keyed by `x-lix-key`.
221
221
  - `x-lix-primary-key` tells Lix how to derive entity identity.
222
222
  - Primary-key entries are JSON Pointers with a leading slash, such as `["/id"]` or `["/owner/email"]`.
223
223
  - Use `additionalProperties: false` so accidental fields fail fast.
@@ -229,7 +229,6 @@ Uniqueness is not inferred from ordinary JSON Schema fields. If a non-primary-ke
229
229
  ```ts
230
230
  const companyDomainSchema = {
231
231
  "x-lix-key": "crm_company_domain",
232
- "x-lix-version": "1",
233
232
  "x-lix-primary-key": ["/id"],
234
233
  "x-lix-unique": [["/domain"]],
235
234
  type: "object",
@@ -389,7 +388,7 @@ Columns consumers usually need:
389
388
 
390
389
  `lix_change` is an immutable SQL table of changes across registered schemas and versions. Use it for audit logs, blame, history, activity feeds, and undo-style UI.
391
390
 
392
- Important columns include `id`, `entity_id`, `schema_key`, `schema_version`, `snapshot_content`, `created_at`, and `lixcol_*` metadata.
391
+ Important columns include `id`, `entity_id`, `schema_key`, `snapshot_content`, `created_at`, and `lixcol_*` metadata.
393
392
 
394
393
  ```ts
395
394
  // Audit log for one entity, oldest to newest.
@@ -430,7 +430,7 @@ function __wbg_get_imports() {
430
430
  return ret;
431
431
  },
432
432
  __wbindgen_cast_0000000000000001: function (arg0, arg1) {
433
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3067, function: Function { arguments: [Externref], shim_idx: 3068, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
433
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3074, function: Function { arguments: [Externref], shim_idx: 3075, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
434
434
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h259bf120b5b35fc5, wasm_bindgen__convert__closures_____invoke__ha15a27e9815e3c81);
435
435
  return ret;
436
436
  },
@@ -1,6 +1,5 @@
1
1
  export declare const LixAccountSchema: {
2
2
  readonly "x-lix-key": "lix_account";
3
- readonly "x-lix-version": "1";
4
3
  readonly "x-lix-primary-key": readonly ["/id"];
5
4
  readonly type: "object";
6
5
  readonly properties: {
@@ -17,7 +16,6 @@ export declare const LixAccountSchema: {
17
16
  };
18
17
  export declare const LixActiveAccountSchema: {
19
18
  readonly "x-lix-key": "lix_active_account";
20
- readonly "x-lix-version": "1";
21
19
  readonly "x-lix-primary-key": readonly ["/account_id"];
22
20
  readonly "x-lix-foreign-keys": readonly [{
23
21
  readonly properties: readonly ["/account_id"];
@@ -37,7 +35,6 @@ export declare const LixActiveAccountSchema: {
37
35
  };
38
36
  export declare const LixBinaryBlobRefSchema: {
39
37
  readonly "x-lix-key": "lix_binary_blob_ref";
40
- readonly "x-lix-version": "1";
41
38
  readonly description: "Metadata pointer from a file version to its binary payload in internal CAS storage.";
42
39
  readonly "x-lix-primary-key": readonly ["/id"];
43
40
  readonly type: "object";
@@ -61,28 +58,27 @@ export declare const LixBinaryBlobRefSchema: {
61
58
  };
62
59
  export declare const LixChangeSchema: {
63
60
  readonly "x-lix-key": "lix_change";
64
- readonly "x-lix-version": "1";
65
- readonly 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.";
61
+ readonly description: "A change records one edit to a Lix entity, including what changed, when it changed, and which entity was affected.";
66
62
  readonly "x-lix-primary-key": readonly ["/id"];
67
63
  readonly type: "object";
68
64
  readonly properties: {
69
65
  readonly id: {
70
66
  readonly type: "string";
71
67
  readonly "x-lix-default": "lix_uuid_v7()";
72
- readonly description: "Stable change identifier (UUIDv7). Referenced from `lix_commit.change_ids` and `lix_change_set_element.change_id`.";
68
+ readonly description: "Stable identifier for this change.";
73
69
  };
74
70
  readonly entity_id: {
75
- readonly type: "string";
76
- readonly description: "The entity this change applies to, scoped by (`schema_key`, `file_id`).";
71
+ readonly type: "array";
72
+ readonly 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`.";
73
+ readonly items: {
74
+ readonly type: "string";
75
+ };
76
+ readonly minItems: 1;
77
77
  };
78
78
  readonly schema_key: {
79
79
  readonly type: "string";
80
80
  readonly description: "Schema identifier of the entity (e.g. `lix_file_descriptor`, `lix_commit`, or a user-registered key).";
81
81
  };
82
- readonly schema_version: {
83
- readonly type: "string";
84
- readonly description: "Schema version the snapshot_content was written against (matches `x-lix-version` on the schema at write time).";
85
- };
86
82
  readonly file_id: {
87
83
  readonly type: readonly ["string", "null"];
88
84
  readonly description: "Filesystem-scoped file identifier when the change belongs to a file; NULL for engine-internal entities (commits, versions, settings).";
@@ -93,6 +89,7 @@ export declare const LixChangeSchema: {
93
89
  };
94
90
  readonly created_at: {
95
91
  readonly type: "string";
92
+ readonly examples: readonly ["2026-05-08T17:42:31.123Z"];
96
93
  readonly description: "ISO-8601 timestamp at which the change was recorded (set via `lix_timestamp()` at write time).";
97
94
  };
98
95
  readonly snapshot_content: {
@@ -100,12 +97,11 @@ export declare const LixChangeSchema: {
100
97
  readonly description: "Entity JSON body at this change; NULL represents a tombstone (deletion).";
101
98
  };
102
99
  };
103
- readonly required: readonly ["id", "entity_id", "schema_key", "schema_version", "file_id", "created_at"];
100
+ readonly required: readonly ["id", "entity_id", "schema_key", "file_id", "created_at"];
104
101
  readonly additionalProperties: false;
105
102
  };
106
103
  export declare const LixChangeAuthorSchema: {
107
104
  readonly "x-lix-key": "lix_change_author";
108
- readonly "x-lix-version": "1";
109
105
  readonly "x-lix-primary-key": readonly ["/change_id", "/account_id"];
110
106
  readonly "x-lix-foreign-keys": readonly [{
111
107
  readonly properties: readonly ["/change_id"];
@@ -132,120 +128,38 @@ export declare const LixChangeAuthorSchema: {
132
128
  readonly required: readonly ["change_id", "account_id"];
133
129
  readonly additionalProperties: false;
134
130
  };
135
- export declare const LixChangeSetSchema: {
136
- readonly "x-lix-key": "lix_change_set";
137
- readonly "x-lix-version": "1";
138
- readonly "x-lix-primary-key": readonly ["/id"];
139
- readonly type: "object";
140
- readonly properties: {
141
- readonly id: {
142
- readonly type: "string";
143
- readonly "x-lix-default": "lix_uuid_v7()";
144
- };
145
- };
146
- readonly required: readonly ["id"];
147
- readonly additionalProperties: false;
148
- };
149
- export declare const LixChangeSetElementSchema: {
150
- readonly "x-lix-key": "lix_change_set_element";
151
- readonly "x-lix-version": "1";
152
- readonly 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.";
153
- readonly "x-lix-primary-key": readonly ["/change_set_id", "/change_id"];
154
- readonly "x-lix-unique": readonly [readonly ["/change_set_id", "/entity_id", "/schema_key", "/file_id"]];
155
- readonly "x-lix-foreign-keys": readonly [{
156
- readonly properties: readonly ["/change_set_id"];
157
- readonly references: {
158
- readonly schemaKey: "lix_change_set";
159
- readonly properties: readonly ["/id"];
160
- };
161
- }, {
162
- readonly properties: readonly ["/change_id"];
163
- readonly references: {
164
- readonly schemaKey: "lix_change";
165
- readonly properties: readonly ["/id"];
166
- };
167
- }];
168
- readonly type: "object";
169
- readonly properties: {
170
- readonly change_set_id: {
171
- readonly type: "string";
172
- readonly description: "The change_set this element belongs to (references `lix_change_set.id`).";
173
- };
174
- readonly change_id: {
175
- readonly type: "string";
176
- readonly description: "The canonical change introduced/adopted by the change_set's commit (references `lix_change.id`).";
177
- };
178
- readonly entity_id: {
179
- readonly type: "string";
180
- readonly description: "Denormalized from the referenced `lix_change` for fast entity-scoped queries and to anchor the unique constraint.";
181
- };
182
- readonly schema_key: {
183
- readonly type: "string";
184
- readonly description: "Denormalized schema identifier from the referenced `lix_change`; part of the per-change_set uniqueness tuple.";
185
- };
186
- readonly file_id: {
187
- readonly type: readonly ["string", "null"];
188
- readonly description: "Denormalized file scope from the referenced `lix_change`; NULL for engine-internal entities. Part of the per-change_set uniqueness tuple.";
189
- };
190
- };
191
- readonly required: readonly ["change_set_id", "change_id", "entity_id", "schema_key", "file_id"];
192
- readonly additionalProperties: false;
193
- };
194
131
  export declare const LixCommitSchema: {
195
132
  readonly "x-lix-key": "lix_commit";
196
- readonly "x-lix-version": "1";
197
- readonly 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.";
198
- readonly "x-lix-primary-key": readonly ["/id"];
199
- readonly "x-lix-foreign-keys": readonly [{
200
- readonly properties: readonly ["/change_set_id"];
201
- readonly references: {
202
- readonly schemaKey: "lix_change_set";
203
- readonly properties: readonly ["/id"];
204
- };
133
+ readonly description: "A commit is a stable point in project history. Versions point to commits. Use lix_commit_edge to inspect parent commits.";
134
+ readonly examples: readonly [{
135
+ readonly id: "commit_01jexample";
205
136
  }];
137
+ readonly "x-lix-primary-key": readonly ["/id"];
206
138
  readonly type: "object";
207
139
  readonly properties: {
208
140
  readonly id: {
209
141
  readonly type: "string";
210
142
  readonly "x-lix-default": "lix_uuid_v7()";
211
- readonly description: "Stable commit identifier.";
212
- };
213
- readonly change_set_id: {
214
- readonly type: "string";
215
- readonly description: "Commit-local grouping identifier used by derived relational indexes and projections such as lix_change_set_element.";
216
- };
217
- readonly change_ids: {
218
- readonly type: "array";
219
- readonly default: readonly [];
220
- readonly items: {
221
- readonly type: "string";
222
- };
223
- readonly 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.";
224
- };
225
- readonly author_account_ids: {
226
- readonly type: "array";
227
- readonly default: readonly [];
228
- readonly items: {
229
- readonly type: "string";
230
- };
231
- readonly description: "Ordered set of author account IDs associated with this commit.";
232
- };
233
- readonly parent_commit_ids: {
234
- readonly type: "array";
235
- readonly default: readonly [];
236
- readonly items: {
237
- readonly type: "string";
238
- };
239
- readonly description: "Parent commit IDs for commit graph topology.";
143
+ readonly description: "Stable identifier of this commit.";
240
144
  };
241
145
  };
242
- readonly required: readonly ["id", "change_set_id"];
146
+ readonly required: readonly ["id"];
243
147
  readonly additionalProperties: false;
244
148
  };
245
149
  export declare const LixCommitEdgeSchema: {
246
150
  readonly "x-lix-key": "lix_commit_edge";
247
- readonly "x-lix-version": "1";
248
- readonly "x-lix-primary-key": readonly ["/parent_id", "/child_id"];
151
+ readonly 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.";
152
+ readonly examples: readonly [{
153
+ readonly parent_id: "commit-main";
154
+ readonly child_id: "commit-merge";
155
+ readonly parent_order: 0;
156
+ }, {
157
+ readonly parent_id: "commit-feature";
158
+ readonly child_id: "commit-merge";
159
+ readonly parent_order: 1;
160
+ }];
161
+ readonly "x-lix-primary-key": readonly ["/child_id", "/parent_order"];
162
+ readonly "x-lix-unique": readonly [readonly ["/parent_id", "/child_id"]];
249
163
  readonly "x-lix-foreign-keys": readonly [{
250
164
  readonly properties: readonly ["/parent_id"];
251
165
  readonly references: {
@@ -263,17 +177,24 @@ export declare const LixCommitEdgeSchema: {
263
177
  readonly properties: {
264
178
  readonly parent_id: {
265
179
  readonly type: "string";
180
+ readonly description: "Identifier of the parent commit.";
266
181
  };
267
182
  readonly child_id: {
268
183
  readonly type: "string";
184
+ readonly description: "Identifier of the child commit.";
185
+ };
186
+ readonly parent_order: {
187
+ readonly type: "integer";
188
+ readonly minimum: 0;
189
+ readonly examples: readonly [0, 1];
190
+ readonly 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.";
269
191
  };
270
192
  };
271
- readonly required: readonly ["parent_id", "child_id"];
193
+ readonly required: readonly ["parent_id", "child_id", "parent_order"];
272
194
  readonly additionalProperties: false;
273
195
  };
274
196
  export declare const LixDirectoryDescriptorSchema: {
275
197
  readonly "x-lix-key": "lix_directory_descriptor";
276
- readonly "x-lix-version": "1";
277
198
  readonly "x-lix-primary-key": readonly ["/id"];
278
199
  readonly "x-lix-unique": readonly [readonly ["/parent_id", "/name"]];
279
200
  readonly "x-lix-foreign-keys": readonly [{
@@ -304,44 +225,8 @@ export declare const LixDirectoryDescriptorSchema: {
304
225
  readonly required: readonly ["id", "parent_id", "name"];
305
226
  readonly additionalProperties: false;
306
227
  };
307
- export declare const LixEntityLabelSchema: {
308
- readonly "x-lix-key": "lix_entity_label";
309
- readonly "x-lix-version": "1";
310
- readonly "x-lix-primary-key": readonly ["/entity_id", "/schema_key", "/file_id", "/label_id"];
311
- readonly "x-lix-foreign-keys": readonly [{
312
- readonly properties: readonly ["/entity_id", "/schema_key", "/file_id"];
313
- readonly references: {
314
- readonly schemaKey: "lix_state";
315
- readonly properties: readonly ["/entity_id", "/schema_key", "/file_id"];
316
- };
317
- }, {
318
- readonly properties: readonly ["/label_id"];
319
- readonly references: {
320
- readonly schemaKey: "lix_label";
321
- readonly properties: readonly ["/id"];
322
- };
323
- }];
324
- readonly type: "object";
325
- readonly properties: {
326
- readonly entity_id: {
327
- readonly type: "string";
328
- };
329
- readonly schema_key: {
330
- readonly type: "string";
331
- };
332
- readonly file_id: {
333
- readonly type: readonly ["string", "null"];
334
- };
335
- readonly label_id: {
336
- readonly type: "string";
337
- };
338
- };
339
- readonly required: readonly ["entity_id", "schema_key", "file_id", "label_id"];
340
- readonly additionalProperties: false;
341
- };
342
228
  export declare const LixFileDescriptorSchema: {
343
229
  readonly "x-lix-key": "lix_file_descriptor";
344
- readonly "x-lix-version": "1";
345
230
  readonly "x-lix-primary-key": readonly ["/id"];
346
231
  readonly "x-lix-unique": readonly [readonly ["/directory_id", "/name"]];
347
232
  readonly "x-lix-foreign-keys": readonly [{
@@ -374,7 +259,6 @@ export declare const LixFileDescriptorSchema: {
374
259
  };
375
260
  export declare const LixKeyValueSchema: {
376
261
  readonly "x-lix-key": "lix_key_value";
377
- readonly "x-lix-version": "1";
378
262
  readonly "x-lix-primary-key": readonly ["/key"];
379
263
  readonly type: "object";
380
264
  readonly properties: {
@@ -403,25 +287,71 @@ export declare const LixKeyValueSchema: {
403
287
  };
404
288
  export declare const LixLabelSchema: {
405
289
  readonly "x-lix-key": "lix_label";
406
- readonly "x-lix-version": "1";
290
+ readonly description: "Catalog of labels that can be assigned to arbitrary live Lix rows through lix_label_assignment.";
407
291
  readonly "x-lix-primary-key": readonly ["/id"];
292
+ readonly "x-lix-unique": readonly [readonly ["/name"]];
408
293
  readonly type: "object";
409
294
  readonly properties: {
410
295
  readonly id: {
411
296
  readonly type: "string";
412
297
  readonly "x-lix-default": "lix_uuid_v7()";
298
+ readonly description: "Stable label identifier. Label assignments reference this value.";
413
299
  };
414
300
  readonly name: {
415
301
  readonly type: "string";
302
+ readonly description: "Human-readable label name. Unique across labels.";
416
303
  };
417
304
  };
418
305
  readonly required: readonly ["id", "name"];
419
306
  readonly additionalProperties: false;
420
307
  };
308
+ export declare const LixLabelAssignmentSchema: {
309
+ readonly "x-lix-key": "lix_label_assignment";
310
+ readonly 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.";
311
+ readonly "x-lix-primary-key": readonly ["/id"];
312
+ readonly "x-lix-unique": readonly [readonly ["/target_entity_id", "/target_schema_key", "/target_file_id", "/label_id"]];
313
+ readonly "x-lix-state-foreign-keys": readonly [readonly ["/target_entity_id", "/target_schema_key", "/target_file_id"]];
314
+ readonly "x-lix-foreign-keys": readonly [{
315
+ readonly properties: readonly ["/label_id"];
316
+ readonly references: {
317
+ readonly schemaKey: "lix_label";
318
+ readonly properties: readonly ["/id"];
319
+ };
320
+ }];
321
+ readonly type: "object";
322
+ readonly properties: {
323
+ readonly id: {
324
+ readonly type: "string";
325
+ readonly "x-lix-default": "lix_uuid_v7()";
326
+ readonly description: "Stable identifier for this label assignment row.";
327
+ };
328
+ readonly target_entity_id: {
329
+ readonly type: "array";
330
+ readonly 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.";
331
+ readonly items: {
332
+ readonly type: "string";
333
+ };
334
+ readonly minItems: 1;
335
+ };
336
+ readonly target_schema_key: {
337
+ readonly type: "string";
338
+ readonly description: "Target row schema key. This is slot [1] in x-lix-state-foreign-keys.";
339
+ };
340
+ readonly target_file_id: {
341
+ readonly type: readonly ["string", "null"];
342
+ readonly description: "Target row file scope. This is slot [2] in x-lix-state-foreign-keys; null targets global rows.";
343
+ };
344
+ readonly label_id: {
345
+ readonly type: "string";
346
+ readonly description: "Label assigned to the target row. References lix_label.id.";
347
+ };
348
+ };
349
+ readonly required: readonly ["id", "target_entity_id", "target_schema_key", "target_file_id", "label_id"];
350
+ readonly additionalProperties: false;
351
+ };
421
352
  export declare const LixRegisteredSchemaSchema: {
422
353
  readonly "x-lix-key": "lix_registered_schema";
423
- readonly "x-lix-version": "1";
424
- readonly "x-lix-primary-key": readonly ["/value/x-lix-key", "/value/x-lix-version"];
354
+ readonly "x-lix-primary-key": readonly ["/value/x-lix-key"];
425
355
  readonly type: "object";
426
356
  readonly properties: {
427
357
  readonly value: {
@@ -430,11 +360,8 @@ export declare const LixRegisteredSchemaSchema: {
430
360
  readonly "x-lix-key": {
431
361
  readonly type: "string";
432
362
  };
433
- readonly "x-lix-version": {
434
- readonly type: "string";
435
- };
436
363
  };
437
- readonly required: readonly ["x-lix-key", "x-lix-version"];
364
+ readonly required: readonly ["x-lix-key"];
438
365
  readonly additionalProperties: true;
439
366
  };
440
367
  };
@@ -443,7 +370,6 @@ export declare const LixRegisteredSchemaSchema: {
443
370
  };
444
371
  export declare const LixVersionDescriptorSchema: {
445
372
  readonly "x-lix-key": "lix_version_descriptor";
446
- readonly "x-lix-version": "1";
447
373
  readonly 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.";
448
374
  readonly "x-lix-primary-key": readonly ["/id"];
449
375
  readonly "x-lix-unique": readonly [readonly ["/name"]];
@@ -469,7 +395,6 @@ export declare const LixVersionDescriptorSchema: {
469
395
  };
470
396
  export declare const LixVersionRefSchema: {
471
397
  readonly "x-lix-key": "lix_version_ref";
472
- readonly "x-lix-version": "1";
473
398
  readonly 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.";
474
399
  readonly "x-lix-primary-key": readonly ["/id"];
475
400
  readonly "x-lix-foreign-keys": readonly [{