@manifesto-ai/lineage 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/index.d.ts +411 -0
- package/dist/index.js +814 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Manifesto AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @manifesto-ai/lineage
|
|
2
|
+
|
|
3
|
+
> Split-native lineage protocol for identity, history, and sealing.
|
|
4
|
+
|
|
5
|
+
`@manifesto-ai/lineage` is the package to use when you need deterministic world identity, branch history, and snapshot sealing directly. It is the lower substrate that `@manifesto-ai/governance` and `@manifesto-ai/world` build on.
|
|
6
|
+
|
|
7
|
+
> **Current Contract Note:** The current public package contract is documented in [docs/lineage-SPEC-2.0.0v.md](docs/lineage-SPEC-2.0.0v.md). The v1.x lineage docs remain available as historical split-era baselines.
|
|
8
|
+
|
|
9
|
+
## What This Package Owns
|
|
10
|
+
|
|
11
|
+
- snapshot and world identity computation
|
|
12
|
+
- branch, head, and epoch reads
|
|
13
|
+
- seal protocol and prepared commits
|
|
14
|
+
- lineage persistence and replay
|
|
15
|
+
- in-memory lineage storage
|
|
16
|
+
|
|
17
|
+
## When to Use It
|
|
18
|
+
|
|
19
|
+
Use `@manifesto-ai/lineage` directly when you want:
|
|
20
|
+
|
|
21
|
+
- world history without governance
|
|
22
|
+
- deterministic identity and resume support
|
|
23
|
+
- custom persistence or replay tooling
|
|
24
|
+
- isolated tests for hashing, branch, and sealing behavior
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import {
|
|
30
|
+
createInMemoryLineageStore,
|
|
31
|
+
createLineageService,
|
|
32
|
+
} from "@manifesto-ai/lineage";
|
|
33
|
+
|
|
34
|
+
const store = createInMemoryLineageStore();
|
|
35
|
+
const lineage = createLineageService(store);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Docs
|
|
39
|
+
|
|
40
|
+
- [Docs Landing](docs/README.md)
|
|
41
|
+
- [Lineage Guide](docs/GUIDE.md)
|
|
42
|
+
- [Lineage Specification](docs/lineage-SPEC-2.0.0v.md)
|
|
43
|
+
- [Historical v1 Baseline](docs/lineage-SPEC-1.0.1v.md)
|
|
44
|
+
- [VERSION-INDEX](docs/VERSION-INDEX.md)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { Snapshot, Patch, ErrorValue, Requirement } from '@manifesto-ai/core';
|
|
2
|
+
export { Patch, Snapshot } from '@manifesto-ai/core';
|
|
3
|
+
|
|
4
|
+
type WorldId = string;
|
|
5
|
+
type BranchId = string;
|
|
6
|
+
type SchemaHash = string;
|
|
7
|
+
type ProvenanceRef = string;
|
|
8
|
+
type AttemptId = string;
|
|
9
|
+
interface ArtifactRef {
|
|
10
|
+
readonly uri: string;
|
|
11
|
+
readonly hash: string;
|
|
12
|
+
}
|
|
13
|
+
type TerminalStatus = "completed" | "failed";
|
|
14
|
+
interface CurrentErrorSignature {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
readonly source: {
|
|
17
|
+
readonly actionId: string;
|
|
18
|
+
readonly nodePath: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface SnapshotHashInput {
|
|
22
|
+
readonly data: Record<string, unknown>;
|
|
23
|
+
readonly system: {
|
|
24
|
+
readonly terminalStatus: TerminalStatus;
|
|
25
|
+
readonly currentError: CurrentErrorSignature | null;
|
|
26
|
+
readonly pendingDigest: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface World {
|
|
30
|
+
readonly worldId: WorldId;
|
|
31
|
+
readonly schemaHash: SchemaHash;
|
|
32
|
+
readonly snapshotHash: string;
|
|
33
|
+
readonly parentWorldId: WorldId | null;
|
|
34
|
+
readonly terminalStatus: TerminalStatus;
|
|
35
|
+
}
|
|
36
|
+
interface WorldEdge {
|
|
37
|
+
readonly edgeId: string;
|
|
38
|
+
readonly from: WorldId;
|
|
39
|
+
readonly to: WorldId;
|
|
40
|
+
}
|
|
41
|
+
interface WorldLineage {
|
|
42
|
+
readonly genesis: WorldId;
|
|
43
|
+
readonly worlds: ReadonlyMap<WorldId, World>;
|
|
44
|
+
readonly edges: ReadonlyMap<string, WorldEdge>;
|
|
45
|
+
}
|
|
46
|
+
interface PersistedPatchDeltaV2 {
|
|
47
|
+
readonly _patchFormat: 2;
|
|
48
|
+
readonly patches: readonly Patch[];
|
|
49
|
+
}
|
|
50
|
+
interface SealGenesisInput {
|
|
51
|
+
readonly schemaHash: SchemaHash;
|
|
52
|
+
readonly terminalSnapshot: Snapshot;
|
|
53
|
+
readonly createdAt: number;
|
|
54
|
+
readonly branchName?: string;
|
|
55
|
+
readonly proposalRef?: ProvenanceRef;
|
|
56
|
+
readonly traceRef?: ArtifactRef;
|
|
57
|
+
}
|
|
58
|
+
interface SealNextInput {
|
|
59
|
+
readonly schemaHash: SchemaHash;
|
|
60
|
+
readonly baseWorldId: WorldId;
|
|
61
|
+
readonly branchId: BranchId;
|
|
62
|
+
readonly terminalSnapshot: Snapshot;
|
|
63
|
+
readonly createdAt: number;
|
|
64
|
+
readonly patchDelta?: PersistedPatchDeltaV2;
|
|
65
|
+
readonly proposalRef?: ProvenanceRef;
|
|
66
|
+
readonly decisionRef?: ProvenanceRef;
|
|
67
|
+
readonly traceRef?: ArtifactRef;
|
|
68
|
+
}
|
|
69
|
+
interface BranchInfo {
|
|
70
|
+
readonly id: BranchId;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly head: WorldId;
|
|
73
|
+
readonly tip: WorldId;
|
|
74
|
+
readonly headAdvancedAt: number;
|
|
75
|
+
readonly epoch: number;
|
|
76
|
+
readonly schemaHash: SchemaHash;
|
|
77
|
+
readonly createdAt: number;
|
|
78
|
+
}
|
|
79
|
+
interface PersistedBranchEntry {
|
|
80
|
+
readonly id: BranchId;
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly head: WorldId;
|
|
83
|
+
readonly tip: WorldId;
|
|
84
|
+
readonly headAdvancedAt: number;
|
|
85
|
+
readonly epoch: number;
|
|
86
|
+
readonly schemaHash: SchemaHash;
|
|
87
|
+
readonly createdAt: number;
|
|
88
|
+
}
|
|
89
|
+
interface PersistedBranchState {
|
|
90
|
+
readonly branches: readonly PersistedBranchEntry[];
|
|
91
|
+
readonly activeBranchId: BranchId;
|
|
92
|
+
}
|
|
93
|
+
interface WorldHead {
|
|
94
|
+
readonly worldId: WorldId;
|
|
95
|
+
readonly branchId: BranchId;
|
|
96
|
+
readonly branchName: string;
|
|
97
|
+
readonly createdAt: number;
|
|
98
|
+
readonly schemaHash: SchemaHash;
|
|
99
|
+
}
|
|
100
|
+
interface BranchSwitchResult {
|
|
101
|
+
readonly previousBranchId: BranchId;
|
|
102
|
+
readonly targetBranchId: BranchId;
|
|
103
|
+
readonly sourceBranchEpochAfter: number;
|
|
104
|
+
}
|
|
105
|
+
interface PreparedBranchMutation {
|
|
106
|
+
readonly kind: "advance";
|
|
107
|
+
readonly branchId: BranchId;
|
|
108
|
+
readonly expectedHead: WorldId;
|
|
109
|
+
readonly nextHead: WorldId;
|
|
110
|
+
readonly headAdvanced: boolean;
|
|
111
|
+
readonly expectedTip: WorldId;
|
|
112
|
+
readonly nextTip: WorldId;
|
|
113
|
+
readonly headAdvancedAt: number | null;
|
|
114
|
+
readonly expectedEpoch: number;
|
|
115
|
+
readonly nextEpoch: number;
|
|
116
|
+
}
|
|
117
|
+
interface PreparedBranchBootstrap {
|
|
118
|
+
readonly kind: "bootstrap";
|
|
119
|
+
readonly branch: PersistedBranchEntry;
|
|
120
|
+
readonly activeBranchId: BranchId;
|
|
121
|
+
}
|
|
122
|
+
type PreparedBranchChange = PreparedBranchMutation | PreparedBranchBootstrap;
|
|
123
|
+
interface SealAttempt {
|
|
124
|
+
readonly attemptId: AttemptId;
|
|
125
|
+
readonly worldId: WorldId;
|
|
126
|
+
readonly branchId: BranchId;
|
|
127
|
+
readonly baseWorldId: WorldId | null;
|
|
128
|
+
readonly parentWorldId: WorldId | null;
|
|
129
|
+
readonly proposalRef?: ProvenanceRef;
|
|
130
|
+
readonly decisionRef?: ProvenanceRef;
|
|
131
|
+
readonly createdAt: number;
|
|
132
|
+
readonly traceRef?: ArtifactRef;
|
|
133
|
+
readonly patchDelta?: PersistedPatchDeltaV2;
|
|
134
|
+
readonly reused: boolean;
|
|
135
|
+
}
|
|
136
|
+
interface PreparedLineageRecords {
|
|
137
|
+
readonly worldId: WorldId;
|
|
138
|
+
readonly world: World;
|
|
139
|
+
readonly terminalSnapshot: Snapshot;
|
|
140
|
+
readonly hashInput: SnapshotHashInput;
|
|
141
|
+
readonly attempt: SealAttempt;
|
|
142
|
+
}
|
|
143
|
+
interface PreparedGenesisCommit extends PreparedLineageRecords {
|
|
144
|
+
readonly kind: "genesis";
|
|
145
|
+
readonly branchId: BranchId;
|
|
146
|
+
readonly terminalStatus: "completed";
|
|
147
|
+
readonly edge: null;
|
|
148
|
+
readonly branchChange: PreparedBranchBootstrap;
|
|
149
|
+
}
|
|
150
|
+
interface PreparedNextCommit extends PreparedLineageRecords {
|
|
151
|
+
readonly kind: "next";
|
|
152
|
+
readonly branchId: BranchId;
|
|
153
|
+
readonly terminalStatus: TerminalStatus;
|
|
154
|
+
readonly edge: WorldEdge;
|
|
155
|
+
readonly forkCreated: boolean;
|
|
156
|
+
readonly branchChange: PreparedBranchMutation;
|
|
157
|
+
}
|
|
158
|
+
type PreparedLineageCommit = PreparedGenesisCommit | PreparedNextCommit;
|
|
159
|
+
interface LineageStore {
|
|
160
|
+
putWorld(world: World): Promise<void>;
|
|
161
|
+
getWorld(worldId: WorldId): Promise<World | null>;
|
|
162
|
+
putSnapshot(worldId: WorldId, snapshot: Snapshot): Promise<void>;
|
|
163
|
+
getSnapshot(worldId: WorldId): Promise<Snapshot | null>;
|
|
164
|
+
putAttempt(attempt: SealAttempt): Promise<void>;
|
|
165
|
+
getAttempts(worldId: WorldId): Promise<readonly SealAttempt[]>;
|
|
166
|
+
getAttemptsByBranch(branchId: BranchId): Promise<readonly SealAttempt[]>;
|
|
167
|
+
putHashInput?(snapshotHash: string, input: SnapshotHashInput): Promise<void>;
|
|
168
|
+
getHashInput?(snapshotHash: string): Promise<SnapshotHashInput | null>;
|
|
169
|
+
putEdge(edge: WorldEdge): Promise<void>;
|
|
170
|
+
getEdges(worldId: WorldId): Promise<readonly WorldEdge[]>;
|
|
171
|
+
getBranchHead(branchId: BranchId): Promise<WorldId | null>;
|
|
172
|
+
getBranchTip(branchId: BranchId): Promise<WorldId | null>;
|
|
173
|
+
getBranchEpoch(branchId: BranchId): Promise<number>;
|
|
174
|
+
mutateBranch(mutation: PreparedBranchMutation): Promise<void>;
|
|
175
|
+
putBranch(branch: PersistedBranchEntry): Promise<void>;
|
|
176
|
+
getBranches(): Promise<readonly PersistedBranchEntry[]>;
|
|
177
|
+
getActiveBranchId(): Promise<BranchId | null>;
|
|
178
|
+
switchActiveBranch(sourceBranchId: BranchId, targetBranchId: BranchId): Promise<void>;
|
|
179
|
+
commitPrepared(prepared: PreparedLineageCommit): Promise<void>;
|
|
180
|
+
}
|
|
181
|
+
interface LineageService {
|
|
182
|
+
prepareSealGenesis(input: SealGenesisInput): Promise<PreparedGenesisCommit>;
|
|
183
|
+
prepareSealNext(input: SealNextInput): Promise<PreparedNextCommit>;
|
|
184
|
+
commitPrepared(prepared: PreparedLineageCommit): Promise<void>;
|
|
185
|
+
createBranch(name: string, headWorldId: WorldId): Promise<BranchId>;
|
|
186
|
+
getBranch(branchId: BranchId): Promise<BranchInfo | null>;
|
|
187
|
+
getBranches(): Promise<readonly BranchInfo[]>;
|
|
188
|
+
getActiveBranch(): Promise<BranchInfo>;
|
|
189
|
+
switchActiveBranch(targetBranchId: BranchId): Promise<BranchSwitchResult>;
|
|
190
|
+
getWorld(worldId: WorldId): Promise<World | null>;
|
|
191
|
+
getSnapshot(worldId: WorldId): Promise<Snapshot | null>;
|
|
192
|
+
getAttempts(worldId: WorldId): Promise<readonly SealAttempt[]>;
|
|
193
|
+
getAttemptsByBranch(branchId: BranchId): Promise<readonly SealAttempt[]>;
|
|
194
|
+
getLineage(): Promise<WorldLineage>;
|
|
195
|
+
getHeads(): Promise<readonly WorldHead[]>;
|
|
196
|
+
getLatestHead(): Promise<WorldHead | null>;
|
|
197
|
+
restore(worldId: WorldId): Promise<Snapshot>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare function computeHash(value: unknown): string;
|
|
201
|
+
declare function isPlatformNamespace(key: string): boolean;
|
|
202
|
+
declare function stripPlatformNamespaces(data: Record<string, unknown> | null | undefined): Record<string, unknown>;
|
|
203
|
+
declare function deriveTerminalStatus(snapshot: Snapshot): TerminalStatus;
|
|
204
|
+
declare function normalizeContext(ctx: Record<string, unknown>): Record<string, unknown> | undefined;
|
|
205
|
+
declare function toCurrentErrorSignature(error: ErrorValue): CurrentErrorSignature;
|
|
206
|
+
declare function computePendingDigest(pendingRequirements: readonly Requirement[]): string;
|
|
207
|
+
declare function createSnapshotHashInput(snapshot: Snapshot): SnapshotHashInput;
|
|
208
|
+
declare function computeSnapshotHash(snapshot: Snapshot): string;
|
|
209
|
+
declare function computeWorldId(schemaHash: string, snapshotHash: string, parentWorldId: WorldId | null): WorldId;
|
|
210
|
+
|
|
211
|
+
interface WorldRecordResult {
|
|
212
|
+
readonly world: World;
|
|
213
|
+
readonly hashInput: SnapshotHashInput;
|
|
214
|
+
readonly worldId: WorldId;
|
|
215
|
+
}
|
|
216
|
+
declare function createWorldRecord(schemaHash: string, terminalSnapshot: Snapshot, parentWorldId: WorldId | null): WorldRecordResult;
|
|
217
|
+
declare function createWorldEdge(from: WorldId, to: WorldId): WorldEdge;
|
|
218
|
+
declare function createGenesisBranchEntry(input: SealGenesisInput, worldId: WorldId): PersistedBranchEntry;
|
|
219
|
+
declare function createSealGenesisAttempt(branchId: BranchId, worldId: WorldId, input: SealGenesisInput): SealAttempt;
|
|
220
|
+
declare function createSealNextAttempt(branchId: BranchId, worldId: WorldId, parentWorldId: WorldId, input: SealNextInput): SealAttempt;
|
|
221
|
+
|
|
222
|
+
declare function toBranchInfo(entry: PersistedBranchEntry): BranchInfo;
|
|
223
|
+
declare function toWorldHead(branch: PersistedBranchEntry, world: World): WorldHead;
|
|
224
|
+
declare function getHeadsFromStore(store: LineageStore): Promise<readonly WorldHead[]>;
|
|
225
|
+
declare function selectLatestHead(heads: readonly WorldHead[]): WorldHead | null;
|
|
226
|
+
declare function restoreSnapshot(store: LineageStore, worldId: WorldId): Promise<Snapshot>;
|
|
227
|
+
declare function buildWorldLineage(store: LineageStore): Promise<WorldLineage>;
|
|
228
|
+
|
|
229
|
+
type InMemoryLineageStoreState = {
|
|
230
|
+
worlds: Map<WorldId, World>;
|
|
231
|
+
snapshots: Map<WorldId, Snapshot>;
|
|
232
|
+
hashInputs: Map<string, SnapshotHashInput>;
|
|
233
|
+
edges: Map<string, WorldEdge>;
|
|
234
|
+
edgesByWorld: Map<WorldId, Set<string>>;
|
|
235
|
+
attempts: Map<string, SealAttempt>;
|
|
236
|
+
attemptsByWorld: Map<WorldId, string[]>;
|
|
237
|
+
attemptsByBranch: Map<BranchId, string[]>;
|
|
238
|
+
branches: Map<BranchId, PersistedBranchEntry>;
|
|
239
|
+
activeBranchId: BranchId | null;
|
|
240
|
+
};
|
|
241
|
+
declare class InMemoryLineageStore implements LineageStore {
|
|
242
|
+
private readonly worlds;
|
|
243
|
+
private readonly snapshots;
|
|
244
|
+
private readonly hashInputs;
|
|
245
|
+
private readonly edges;
|
|
246
|
+
private readonly edgesByWorld;
|
|
247
|
+
private readonly attempts;
|
|
248
|
+
private readonly attemptsByWorld;
|
|
249
|
+
private readonly attemptsByBranch;
|
|
250
|
+
private readonly branches;
|
|
251
|
+
private activeBranchId;
|
|
252
|
+
putWorld(world: World): Promise<void>;
|
|
253
|
+
getWorld(worldId: WorldId): Promise<World | null>;
|
|
254
|
+
putSnapshot(worldId: WorldId, snapshot: Snapshot): Promise<void>;
|
|
255
|
+
getSnapshot(worldId: WorldId): Promise<Snapshot | null>;
|
|
256
|
+
putAttempt(attempt: SealAttempt): Promise<void>;
|
|
257
|
+
getAttempts(worldId: WorldId): Promise<readonly SealAttempt[]>;
|
|
258
|
+
getAttemptsByBranch(branchId: BranchId): Promise<readonly SealAttempt[]>;
|
|
259
|
+
putHashInput(snapshotHash: string, input: SnapshotHashInput): Promise<void>;
|
|
260
|
+
getHashInput(snapshotHash: string): Promise<SnapshotHashInput | null>;
|
|
261
|
+
putEdge(edge: WorldEdge): Promise<void>;
|
|
262
|
+
getEdges(worldId: WorldId): Promise<readonly WorldEdge[]>;
|
|
263
|
+
getBranchHead(branchId: BranchId): Promise<WorldId | null>;
|
|
264
|
+
getBranchTip(branchId: BranchId): Promise<WorldId | null>;
|
|
265
|
+
getBranchEpoch(branchId: BranchId): Promise<number>;
|
|
266
|
+
mutateBranch(mutation: PreparedBranchMutation): Promise<void>;
|
|
267
|
+
putBranch(branch: PersistedBranchEntry): Promise<void>;
|
|
268
|
+
getBranches(): Promise<readonly PersistedBranchEntry[]>;
|
|
269
|
+
getActiveBranchId(): Promise<BranchId | null>;
|
|
270
|
+
switchActiveBranch(sourceBranchId: BranchId, targetBranchId: BranchId): Promise<void>;
|
|
271
|
+
commitPrepared(prepared: PreparedLineageCommit): Promise<void>;
|
|
272
|
+
listWorlds(): readonly World[];
|
|
273
|
+
listEdges(): readonly WorldEdge[];
|
|
274
|
+
snapshotState(): InMemoryLineageStoreState;
|
|
275
|
+
restoreState(state: InMemoryLineageStoreState): void;
|
|
276
|
+
private indexEdge;
|
|
277
|
+
private indexAttempt;
|
|
278
|
+
}
|
|
279
|
+
declare function createInMemoryLineageStore(): InMemoryLineageStore;
|
|
280
|
+
|
|
281
|
+
declare class DefaultLineageService implements LineageService {
|
|
282
|
+
private readonly store;
|
|
283
|
+
constructor(store: LineageStore);
|
|
284
|
+
prepareSealGenesis(input: SealGenesisInput): Promise<{
|
|
285
|
+
kind: "genesis";
|
|
286
|
+
branchId: string;
|
|
287
|
+
worldId: string;
|
|
288
|
+
world: World;
|
|
289
|
+
terminalSnapshot: {
|
|
290
|
+
data: unknown;
|
|
291
|
+
computed: Record<string, unknown>;
|
|
292
|
+
system: {
|
|
293
|
+
status: "error" | "idle" | "computing" | "pending";
|
|
294
|
+
lastError: {
|
|
295
|
+
code: string;
|
|
296
|
+
message: string;
|
|
297
|
+
source: {
|
|
298
|
+
actionId: string;
|
|
299
|
+
nodePath: string;
|
|
300
|
+
};
|
|
301
|
+
timestamp: number;
|
|
302
|
+
context?: Record<string, unknown> | undefined;
|
|
303
|
+
} | null;
|
|
304
|
+
pendingRequirements: {
|
|
305
|
+
id: string;
|
|
306
|
+
type: string;
|
|
307
|
+
params: Record<string, unknown>;
|
|
308
|
+
actionId: string;
|
|
309
|
+
flowPosition: {
|
|
310
|
+
nodePath: string;
|
|
311
|
+
snapshotVersion: number;
|
|
312
|
+
};
|
|
313
|
+
createdAt: number;
|
|
314
|
+
}[];
|
|
315
|
+
currentAction: string | null;
|
|
316
|
+
};
|
|
317
|
+
input: unknown;
|
|
318
|
+
meta: {
|
|
319
|
+
version: number;
|
|
320
|
+
timestamp: number;
|
|
321
|
+
randomSeed: string;
|
|
322
|
+
schemaHash: string;
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
hashInput: SnapshotHashInput;
|
|
326
|
+
attempt: SealAttempt;
|
|
327
|
+
terminalStatus: "completed";
|
|
328
|
+
edge: null;
|
|
329
|
+
branchChange: {
|
|
330
|
+
kind: "bootstrap";
|
|
331
|
+
branch: PersistedBranchEntry;
|
|
332
|
+
activeBranchId: string;
|
|
333
|
+
};
|
|
334
|
+
}>;
|
|
335
|
+
prepareSealNext(input: SealNextInput): Promise<{
|
|
336
|
+
kind: "next";
|
|
337
|
+
branchId: string;
|
|
338
|
+
worldId: string;
|
|
339
|
+
world: World;
|
|
340
|
+
terminalSnapshot: {
|
|
341
|
+
data: unknown;
|
|
342
|
+
computed: Record<string, unknown>;
|
|
343
|
+
system: {
|
|
344
|
+
status: "error" | "idle" | "computing" | "pending";
|
|
345
|
+
lastError: {
|
|
346
|
+
code: string;
|
|
347
|
+
message: string;
|
|
348
|
+
source: {
|
|
349
|
+
actionId: string;
|
|
350
|
+
nodePath: string;
|
|
351
|
+
};
|
|
352
|
+
timestamp: number;
|
|
353
|
+
context?: Record<string, unknown> | undefined;
|
|
354
|
+
} | null;
|
|
355
|
+
pendingRequirements: {
|
|
356
|
+
id: string;
|
|
357
|
+
type: string;
|
|
358
|
+
params: Record<string, unknown>;
|
|
359
|
+
actionId: string;
|
|
360
|
+
flowPosition: {
|
|
361
|
+
nodePath: string;
|
|
362
|
+
snapshotVersion: number;
|
|
363
|
+
};
|
|
364
|
+
createdAt: number;
|
|
365
|
+
}[];
|
|
366
|
+
currentAction: string | null;
|
|
367
|
+
};
|
|
368
|
+
input: unknown;
|
|
369
|
+
meta: {
|
|
370
|
+
version: number;
|
|
371
|
+
timestamp: number;
|
|
372
|
+
randomSeed: string;
|
|
373
|
+
schemaHash: string;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
hashInput: SnapshotHashInput;
|
|
377
|
+
attempt: SealAttempt;
|
|
378
|
+
terminalStatus: TerminalStatus;
|
|
379
|
+
edge: WorldEdge;
|
|
380
|
+
forkCreated: boolean;
|
|
381
|
+
branchChange: {
|
|
382
|
+
kind: "advance";
|
|
383
|
+
branchId: string;
|
|
384
|
+
expectedHead: string;
|
|
385
|
+
nextHead: string;
|
|
386
|
+
headAdvanced: boolean;
|
|
387
|
+
expectedTip: string;
|
|
388
|
+
nextTip: string;
|
|
389
|
+
headAdvancedAt: number | null;
|
|
390
|
+
expectedEpoch: number;
|
|
391
|
+
nextEpoch: number;
|
|
392
|
+
};
|
|
393
|
+
}>;
|
|
394
|
+
commitPrepared(prepared: Parameters<LineageService["commitPrepared"]>[0]): Promise<void>;
|
|
395
|
+
createBranch(name: string, headWorldId: WorldId): Promise<BranchId>;
|
|
396
|
+
getBranch(branchId: BranchId): Promise<BranchInfo | null>;
|
|
397
|
+
getBranches(): Promise<readonly BranchInfo[]>;
|
|
398
|
+
getActiveBranch(): Promise<BranchInfo>;
|
|
399
|
+
switchActiveBranch(targetBranchId: BranchId): Promise<BranchSwitchResult>;
|
|
400
|
+
getWorld(worldId: WorldId): Promise<World | null>;
|
|
401
|
+
getSnapshot(worldId: WorldId): Promise<Snapshot | null>;
|
|
402
|
+
getAttempts(worldId: WorldId): Promise<readonly SealAttempt[]>;
|
|
403
|
+
getAttemptsByBranch(branchId: BranchId): Promise<readonly SealAttempt[]>;
|
|
404
|
+
getLineage(): Promise<WorldLineage>;
|
|
405
|
+
getHeads(): Promise<readonly WorldHead[]>;
|
|
406
|
+
getLatestHead(): Promise<WorldHead | null>;
|
|
407
|
+
restore(worldId: WorldId): Promise<Snapshot>;
|
|
408
|
+
}
|
|
409
|
+
declare function createLineageService(store: LineageStore): LineageService;
|
|
410
|
+
|
|
411
|
+
export { type ArtifactRef, type AttemptId, type BranchId, type BranchInfo, type BranchSwitchResult, type CurrentErrorSignature, DefaultLineageService, InMemoryLineageStore, type LineageService, type LineageStore, type PersistedBranchEntry, type PersistedBranchState, type PersistedPatchDeltaV2, type PreparedBranchBootstrap, type PreparedBranchChange, type PreparedBranchMutation, type PreparedGenesisCommit, type PreparedLineageCommit, type PreparedLineageRecords, type PreparedNextCommit, type ProvenanceRef, type SchemaHash, type SealAttempt, type SealGenesisInput, type SealNextInput, type SnapshotHashInput, type TerminalStatus, type World, type WorldEdge, type WorldHead, type WorldId, type WorldLineage, type WorldRecordResult, buildWorldLineage, computeHash, computePendingDigest, computeSnapshotHash, computeWorldId, createGenesisBranchEntry, createInMemoryLineageStore, createLineageService, createSealGenesisAttempt, createSealNextAttempt, createSnapshotHashInput, createWorldEdge, createWorldRecord, deriveTerminalStatus, getHeadsFromStore, isPlatformNamespace, normalizeContext, restoreSnapshot, selectLatestHead, stripPlatformNamespaces, toBranchInfo, toCurrentErrorSignature, toWorldHead };
|