videobook-engine 2.0.1 → 5.0.1

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 (171) hide show
  1. package/README.md +99 -68
  2. package/dist/artifacts.d.ts +4 -9
  3. package/dist/artifacts.d.ts.map +1 -1
  4. package/dist/artifacts.js +78 -138
  5. package/dist/artifacts.js.map +1 -1
  6. package/dist/books.d.ts +1 -1
  7. package/dist/books.d.ts.map +1 -1
  8. package/dist/books.js +18 -10
  9. package/dist/books.js.map +1 -1
  10. package/dist/cas.d.ts +27 -1
  11. package/dist/cas.d.ts.map +1 -1
  12. package/dist/cas.js +78 -6
  13. package/dist/cas.js.map +1 -1
  14. package/dist/catalog-metadata.d.ts +56 -0
  15. package/dist/catalog-metadata.d.ts.map +1 -0
  16. package/dist/catalog-metadata.js +42 -0
  17. package/dist/catalog-metadata.js.map +1 -0
  18. package/dist/communications.js +4 -2
  19. package/dist/communications.js.map +1 -1
  20. package/dist/context.d.ts +9 -6
  21. package/dist/context.d.ts.map +1 -1
  22. package/dist/context.js +42 -51
  23. package/dist/context.js.map +1 -1
  24. package/dist/domain.d.ts +39 -2
  25. package/dist/domain.d.ts.map +1 -1
  26. package/dist/domain.js +846 -64
  27. package/dist/domain.js.map +1 -1
  28. package/dist/edit-policy.d.ts +3 -0
  29. package/dist/edit-policy.d.ts.map +1 -0
  30. package/dist/edit-policy.js +6 -0
  31. package/dist/edit-policy.js.map +1 -0
  32. package/dist/edits.d.ts +10 -0
  33. package/dist/edits.d.ts.map +1 -0
  34. package/dist/edits.js +1392 -0
  35. package/dist/edits.js.map +1 -0
  36. package/dist/engine-types.d.ts +171 -86
  37. package/dist/engine-types.d.ts.map +1 -1
  38. package/dist/engine-types.js +32 -0
  39. package/dist/engine-types.js.map +1 -1
  40. package/dist/engine.d.ts +89 -26
  41. package/dist/engine.d.ts.map +1 -1
  42. package/dist/engine.js +27 -21
  43. package/dist/engine.js.map +1 -1
  44. package/dist/files.d.ts.map +1 -1
  45. package/dist/files.js +32 -28
  46. package/dist/files.js.map +1 -1
  47. package/dist/fork.d.ts +148 -0
  48. package/dist/fork.d.ts.map +1 -0
  49. package/dist/fork.js +602 -0
  50. package/dist/fork.js.map +1 -0
  51. package/dist/generations.d.ts +9 -0
  52. package/dist/generations.d.ts.map +1 -0
  53. package/dist/generations.js +175 -0
  54. package/dist/generations.js.map +1 -0
  55. package/dist/history.d.ts +2 -5
  56. package/dist/history.d.ts.map +1 -1
  57. package/dist/history.js +183 -640
  58. package/dist/history.js.map +1 -1
  59. package/dist/index.d.ts +21 -7
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +15 -5
  62. package/dist/index.js.map +1 -1
  63. package/dist/job-queue.d.ts +2 -0
  64. package/dist/job-queue.d.ts.map +1 -1
  65. package/dist/job-queue.js +29 -2
  66. package/dist/job-queue.js.map +1 -1
  67. package/dist/media.d.ts +3 -3
  68. package/dist/media.d.ts.map +1 -1
  69. package/dist/media.js +6 -5
  70. package/dist/media.js.map +1 -1
  71. package/dist/merge-policy.d.ts +83 -0
  72. package/dist/merge-policy.d.ts.map +1 -0
  73. package/dist/merge-policy.js +203 -0
  74. package/dist/merge-policy.js.map +1 -0
  75. package/dist/metadata.d.ts.map +1 -1
  76. package/dist/metadata.js +17 -23
  77. package/dist/metadata.js.map +1 -1
  78. package/dist/migration.d.ts +9 -0
  79. package/dist/migration.d.ts.map +1 -0
  80. package/dist/migration.js +564 -0
  81. package/dist/migration.js.map +1 -0
  82. package/dist/mvp-contract-fixtures.d.ts +244 -0
  83. package/dist/mvp-contract-fixtures.d.ts.map +1 -0
  84. package/dist/mvp-contract-fixtures.js +556 -0
  85. package/dist/mvp-contract-fixtures.js.map +1 -0
  86. package/dist/mvp-contracts.d.ts +761 -0
  87. package/dist/mvp-contracts.d.ts.map +1 -0
  88. package/dist/mvp-contracts.js +59 -0
  89. package/dist/mvp-contracts.js.map +1 -0
  90. package/dist/mvp-time.d.ts +54 -0
  91. package/dist/mvp-time.d.ts.map +1 -0
  92. package/dist/mvp-time.js +148 -0
  93. package/dist/mvp-time.js.map +1 -0
  94. package/dist/notebook/types.d.ts +85 -8
  95. package/dist/notebook/types.d.ts.map +1 -1
  96. package/dist/notebook-grid.d.ts +37 -0
  97. package/dist/notebook-grid.d.ts.map +1 -0
  98. package/dist/notebook-grid.js +160 -0
  99. package/dist/notebook-grid.js.map +1 -0
  100. package/dist/notebook-media-artifact.d.ts +23 -0
  101. package/dist/notebook-media-artifact.d.ts.map +1 -0
  102. package/dist/notebook-media-artifact.js +67 -0
  103. package/dist/notebook-media-artifact.js.map +1 -0
  104. package/dist/notebook-mentions.d.ts +20 -0
  105. package/dist/notebook-mentions.d.ts.map +1 -0
  106. package/dist/notebook-mentions.js +53 -0
  107. package/dist/notebook-mentions.js.map +1 -0
  108. package/dist/order-keys.d.ts +22 -0
  109. package/dist/order-keys.d.ts.map +1 -0
  110. package/dist/order-keys.js +262 -0
  111. package/dist/order-keys.js.map +1 -0
  112. package/dist/runtime-services.js +8 -11
  113. package/dist/runtime-services.js.map +1 -1
  114. package/dist/schema.d.ts +8 -5
  115. package/dist/schema.d.ts.map +1 -1
  116. package/dist/schema.js +624 -141
  117. package/dist/schema.js.map +1 -1
  118. package/dist/search-benchmark.d.ts +4 -0
  119. package/dist/search-benchmark.d.ts.map +1 -0
  120. package/dist/search-benchmark.js +144 -0
  121. package/dist/search-benchmark.js.map +1 -0
  122. package/dist/sequences.d.ts +20 -0
  123. package/dist/sequences.d.ts.map +1 -0
  124. package/dist/sequences.js +825 -0
  125. package/dist/sequences.js.map +1 -0
  126. package/dist/similarity.js +10 -10
  127. package/dist/similarity.js.map +1 -1
  128. package/dist/status.js +8 -10
  129. package/dist/status.js.map +1 -1
  130. package/dist/storage.d.ts +3 -1
  131. package/dist/storage.d.ts.map +1 -1
  132. package/dist/storage.js +388 -7
  133. package/dist/storage.js.map +1 -1
  134. package/dist/store.d.ts +64 -3
  135. package/dist/store.d.ts.map +1 -1
  136. package/dist/store.js +354 -68
  137. package/dist/store.js.map +1 -1
  138. package/dist/streams.d.ts +10 -0
  139. package/dist/streams.d.ts.map +1 -0
  140. package/dist/streams.js +183 -0
  141. package/dist/streams.js.map +1 -0
  142. package/dist/temporal-models.d.ts +48 -0
  143. package/dist/temporal-models.d.ts.map +1 -0
  144. package/dist/temporal-models.js +278 -0
  145. package/dist/temporal-models.js.map +1 -0
  146. package/dist/temporal-search.d.ts +29 -0
  147. package/dist/temporal-search.d.ts.map +1 -0
  148. package/dist/temporal-search.js +1551 -0
  149. package/dist/temporal-search.js.map +1 -0
  150. package/dist/transcripts.d.ts +16 -0
  151. package/dist/transcripts.d.ts.map +1 -0
  152. package/dist/transcripts.js +519 -0
  153. package/dist/transcripts.js.map +1 -0
  154. package/docs/engine-layout.md +345 -110
  155. package/docs/mvp-prd.md +918 -0
  156. package/fixtures/media/vancat.mp4 +0 -0
  157. package/fixtures/media/vancat_profile.jpg +0 -0
  158. package/fixtures/v5/contract-fixtures.json +1532 -0
  159. package/package.json +42 -5
  160. package/dist/history-types.d.ts +0 -74
  161. package/dist/history-types.d.ts.map +0 -1
  162. package/dist/history-types.js +0 -2
  163. package/dist/history-types.js.map +0 -1
  164. package/dist/resolver.d.ts +0 -15
  165. package/dist/resolver.d.ts.map +0 -1
  166. package/dist/resolver.js +0 -81
  167. package/dist/resolver.js.map +0 -1
  168. package/dist/timeline.d.ts +0 -9
  169. package/dist/timeline.d.ts.map +0 -1
  170. package/dist/timeline.js +0 -236
  171. package/dist/timeline.js.map +0 -1
package/dist/fork.d.ts ADDED
@@ -0,0 +1,148 @@
1
+ import type { CatalogBackupConfig, ContentStore, EngineIdentity } from "./engine-types.js";
2
+ import { type Engine } from "./engine.js";
3
+ /**
4
+ * Fork bootstrap and merge-back integration (ve-mim.7; see
5
+ * docs/engine-layout.md "Forks and merge-back integration").
6
+ *
7
+ * A fork is, from the engine's point of view:
8
+ *
9
+ * 1. a platform fork — creating the hosted copy of the catalog and giving it
10
+ * a URL is the hosting layer's job, out of engine scope;
11
+ * 2. a clone of the catalog into a local engine root (`bootstrapFork`);
12
+ * 3. a public-read object store keyed by SHA-256. `ContentStore` stays the
13
+ * abstraction; the existing `ensureLocal` lazy fetch in src/cas.ts makes
14
+ * upstream objects readable to forkers on first touch. Whether the
15
+ * fork's store proxies to upstream's is a hosting concern — the engine
16
+ * only ever sees one `ContentStore` per engine root.
17
+ *
18
+ * The live-engine never-pulls rule stands: an open engine never fetches,
19
+ * pulls, or merges. Integration happens in a DEDICATED merge-back flow
20
+ * (`mergeBack`) that runs on a throwaway copy of a closed catalog database
21
+ * in a temp directory, never on the user's open live catalog.
22
+ *
23
+ * ve-wsu routing (doltlite 0.11.37, verified empirically):
24
+ *
25
+ * - `dolt_clone` of the full 28-table catalog produces a malformed database
26
+ * (`invalid rootpage` on a secondary autoindex; the file cannot even be
27
+ * opened for reads). `bootstrapFork` therefore bootstraps from a byte
28
+ * snapshot of a healthy catalog database; a URL clone is attempted and
29
+ * health-validated, and surfaces a typed FEATURE_UNAVAILABLE error while
30
+ * the upstream bug stands.
31
+ * - `dolt_merge`'s uncommitted-changes guard misfires on the full catalog
32
+ * (every table reports phantom `modified` status with zero row diffs).
33
+ * Committing the phantom dirt passes the guard, but the merge then dies
34
+ * in schema loading (`schema conflict on table 'sqlite_autoindex_*'`),
35
+ * and `dolt_checkout` corrupts the working set, so no branch dance can
36
+ * produce a true two-parent merge commit either. `mergeBack` therefore
37
+ * performs the same three-way merge at the projection layer
38
+ * (`dolt_merge_base` + `dolt_at_<table>` snapshots, which are unaffected)
39
+ * under the exact src/merge-policy.ts policy, and lands a forward
40
+ * integration commit on main that records the integrated fork head in a
41
+ * `merged-revision` trailer. When ve-wsu is fixed, the projection merge
42
+ * in `mergeRefs` is the single swap point for `mergeWithPolicy` +
43
+ * `dolt_merge`.
44
+ */
45
+ export interface ForkBootstrapOptions {
46
+ dataDir: string;
47
+ workspaceDir: string;
48
+ /**
49
+ * Byte snapshot of a healthy upstream catalog database (a copy of its
50
+ * `videobook.db` taken while the upstream engine was closed). This is the
51
+ * bootstrap that works with doltlite 0.11.37; the hosting layer provides
52
+ * the snapshot when it creates the platform fork.
53
+ */
54
+ snapshotPath?: string;
55
+ /**
56
+ * Upstream catalog remote URL to `dolt_clone`. Currently blocked by
57
+ * ve-wsu for full engine catalogs; the clone is attempted and the result
58
+ * health-validated so this path starts working unchanged once doltlite
59
+ * is fixed. Mutually exclusive with `snapshotPath`.
60
+ */
61
+ upstreamUrl?: string;
62
+ remoteObjects?: ContentStore;
63
+ objectPrefix?: string;
64
+ /** Remote registration for the fork's own catalog remote (push target). */
65
+ catalogBackup?: CatalogBackupConfig;
66
+ identity?: EngineIdentity;
67
+ }
68
+ export interface MergeBackOptions {
69
+ /**
70
+ * Path to a healthy upstream catalog database file (its `videobook.db`).
71
+ * The file is only read — it is copied into a temp workspace and all
72
+ * merging happens there. The upstream engine must be closed (or pass a
73
+ * snapshot taken while it was closed) so the copy is consistent.
74
+ */
75
+ upstreamDbPath: string;
76
+ /**
77
+ * Upstream catalog remote to push the integration commit to. Defaults to
78
+ * the `origin` remote already registered in the upstream database.
79
+ */
80
+ upstreamRemote?: CatalogBackupConfig;
81
+ /** Fork catalog remote to fetch the fork's commits from. */
82
+ forkRemote: {
83
+ name?: string;
84
+ url: string;
85
+ };
86
+ forkBranch?: string;
87
+ /** Upstream object store: fork objects are uploaded here before push. */
88
+ upstreamObjects?: ContentStore;
89
+ /** Fork object store (public-read): source of the fork's new objects. */
90
+ forkObjects?: ContentStore;
91
+ objectPrefix?: string;
92
+ /** Commit author for the integration commit. */
93
+ author?: string;
94
+ /** Directory for the throwaway merge workspace (defaults to a temp dir). */
95
+ workDir?: string;
96
+ /** Keep the merge workspace for inspection instead of deleting it. */
97
+ keepWorkDir?: boolean;
98
+ }
99
+ export interface MergeBackResult {
100
+ /** HEAD of upstream main after the flow (the integration commit). */
101
+ integrationCommit: string;
102
+ /** Merge base used for the three-way merge. */
103
+ baseRevision: string;
104
+ /** Upstream main head before the merge. */
105
+ oursRevision: string;
106
+ /** Integrated fork head, recorded in the commit's merged-revision trailer. */
107
+ theirsRevision: string;
108
+ /** True when the fork was already fully integrated (no commit minted). */
109
+ alreadyIntegrated: boolean;
110
+ /** Fork object hashes uploaded to the upstream object store. */
111
+ uploadedObjects: string[];
112
+ reconciledTranscripts: number;
113
+ reconciledSequences: number;
114
+ /** Merge workspace path when `keepWorkDir` was set. */
115
+ workDir?: string;
116
+ }
117
+ export interface RowConflict {
118
+ table: string;
119
+ key: Record<string, unknown>;
120
+ reason: string;
121
+ }
122
+ /**
123
+ * Bootstraps a fork: clones the upstream catalog into a new local engine
124
+ * root and opens it as a normal engine. The fork is a full citizen from
125
+ * there — it commits on its own main, backs up to its own catalog remote,
126
+ * and reads upstream objects lazily through its configured `ContentStore`.
127
+ * It never pulls; integration is the merge-back flow's job.
128
+ */
129
+ export declare function bootstrapFork(options: ForkBootstrapOptions): Promise<Engine>;
130
+ /**
131
+ * Integrates a fork back into upstream main.
132
+ *
133
+ * Runs entirely in a throwaway copy of the upstream catalog inside a temp
134
+ * directory: fetches the fork, merges under the engine merge policy
135
+ * (same-schema precondition, constraint verification, deterministic
136
+ * singleton reconcile; artifact identity is artifact_id, so there is no
137
+ * name-conflict class to check), uploads the fork's new
138
+ * objects to the upstream object store BEFORE the catalog ref moves — the
139
+ * same objects-before-push ordering as engine.storage.backup — lands one
140
+ * forward integration commit on main, and pushes it.
141
+ *
142
+ * The caller's open engines are never touched: the upstream database file
143
+ * is only read (copied), and the fork is only fetched from. Conflicts and
144
+ * violations surface as the typed MERGE_CONFLICT / MERGE_VIOLATION /
145
+ * SCHEMA_INCOMPATIBLE errors from src/merge-policy.ts.
146
+ */
147
+ export declare function mergeBack(options: MergeBackOptions): Promise<MergeBackResult>;
148
+ //# sourceMappingURL=fork.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../src/fork.ts"],"names":[],"mappings":"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