@git-stunts/git-warp 10.8.0 → 11.3.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.
- package/README.md +53 -32
- package/SECURITY.md +64 -0
- package/bin/cli/commands/check.js +168 -0
- package/bin/cli/commands/doctor/checks.js +422 -0
- package/bin/cli/commands/doctor/codes.js +46 -0
- package/bin/cli/commands/doctor/index.js +239 -0
- package/bin/cli/commands/doctor/types.js +89 -0
- package/bin/cli/commands/history.js +80 -0
- package/bin/cli/commands/info.js +139 -0
- package/bin/cli/commands/install-hooks.js +128 -0
- package/bin/cli/commands/materialize.js +99 -0
- package/bin/cli/commands/patch.js +142 -0
- package/bin/cli/commands/path.js +88 -0
- package/bin/cli/commands/query.js +235 -0
- package/bin/cli/commands/registry.js +32 -0
- package/bin/cli/commands/seek.js +598 -0
- package/bin/cli/commands/tree.js +230 -0
- package/bin/cli/commands/trust.js +154 -0
- package/bin/cli/commands/verify-audit.js +114 -0
- package/bin/cli/commands/view.js +46 -0
- package/bin/cli/infrastructure.js +350 -0
- package/bin/cli/schemas.js +177 -0
- package/bin/cli/shared.js +244 -0
- package/bin/cli/types.js +96 -0
- package/bin/presenters/index.js +41 -9
- package/bin/presenters/json.js +14 -12
- package/bin/presenters/text.js +286 -28
- package/bin/warp-graph.js +5 -2346
- package/index.d.ts +111 -21
- package/index.js +2 -0
- package/package.json +10 -8
- package/src/domain/WarpGraph.js +109 -3252
- package/src/domain/crdt/ORSet.js +8 -8
- package/src/domain/errors/EmptyMessageError.js +2 -2
- package/src/domain/errors/ForkError.js +1 -1
- package/src/domain/errors/IndexError.js +1 -1
- package/src/domain/errors/OperationAbortedError.js +1 -1
- package/src/domain/errors/QueryError.js +3 -3
- package/src/domain/errors/SchemaUnsupportedError.js +1 -1
- package/src/domain/errors/ShardCorruptionError.js +2 -2
- package/src/domain/errors/ShardLoadError.js +2 -2
- package/src/domain/errors/ShardValidationError.js +4 -4
- package/src/domain/errors/StorageError.js +2 -2
- package/src/domain/errors/SyncError.js +1 -1
- package/src/domain/errors/TraversalError.js +1 -1
- package/src/domain/errors/TrustError.js +29 -0
- package/src/domain/errors/WarpError.js +2 -2
- package/src/domain/errors/WormholeError.js +1 -1
- package/src/domain/errors/index.js +1 -0
- package/src/domain/services/AuditMessageCodec.js +137 -0
- package/src/domain/services/AuditReceiptService.js +471 -0
- package/src/domain/services/AuditVerifierService.js +707 -0
- package/src/domain/services/BitmapIndexBuilder.js +3 -3
- package/src/domain/services/BitmapIndexReader.js +28 -19
- package/src/domain/services/BoundaryTransitionRecord.js +18 -17
- package/src/domain/services/CheckpointSerializerV5.js +17 -16
- package/src/domain/services/CheckpointService.js +2 -2
- package/src/domain/services/CommitDagTraversalService.js +13 -13
- package/src/domain/services/DagPathFinding.js +7 -7
- package/src/domain/services/DagTopology.js +1 -1
- package/src/domain/services/DagTraversal.js +1 -1
- package/src/domain/services/HealthCheckService.js +1 -1
- package/src/domain/services/HookInstaller.js +1 -1
- package/src/domain/services/HttpSyncServer.js +120 -55
- package/src/domain/services/IndexRebuildService.js +7 -7
- package/src/domain/services/IndexStalenessChecker.js +4 -3
- package/src/domain/services/JoinReducer.js +11 -11
- package/src/domain/services/LogicalTraversal.js +1 -1
- package/src/domain/services/MessageCodecInternal.js +4 -1
- package/src/domain/services/MessageSchemaDetector.js +2 -2
- package/src/domain/services/MigrationService.js +1 -1
- package/src/domain/services/ObserverView.js +8 -8
- package/src/domain/services/PatchBuilderV2.js +42 -26
- package/src/domain/services/ProvenanceIndex.js +1 -1
- package/src/domain/services/ProvenancePayload.js +1 -1
- package/src/domain/services/QueryBuilder.js +3 -3
- package/src/domain/services/StateDiff.js +14 -11
- package/src/domain/services/StateSerializerV5.js +2 -2
- package/src/domain/services/StreamingBitmapIndexBuilder.js +26 -24
- package/src/domain/services/SyncAuthService.js +71 -4
- package/src/domain/services/SyncProtocol.js +25 -11
- package/src/domain/services/TemporalQuery.js +9 -6
- package/src/domain/services/TranslationCost.js +7 -5
- package/src/domain/services/WarpMessageCodec.js +4 -1
- package/src/domain/services/WormholeService.js +16 -7
- package/src/domain/trust/TrustCanonical.js +42 -0
- package/src/domain/trust/TrustCrypto.js +111 -0
- package/src/domain/trust/TrustEvaluator.js +195 -0
- package/src/domain/trust/TrustRecordService.js +281 -0
- package/src/domain/trust/TrustStateBuilder.js +222 -0
- package/src/domain/trust/canonical.js +68 -0
- package/src/domain/trust/reasonCodes.js +64 -0
- package/src/domain/trust/schemas.js +160 -0
- package/src/domain/trust/verdict.js +42 -0
- package/src/domain/types/TickReceipt.js +1 -1
- package/src/domain/types/WarpErrors.js +45 -0
- package/src/domain/types/WarpOptions.js +29 -0
- package/src/domain/types/WarpPersistence.js +41 -0
- package/src/domain/types/WarpTypes.js +2 -2
- package/src/domain/types/WarpTypesV2.js +2 -2
- package/src/domain/types/git-cas.d.ts +20 -0
- package/src/domain/utils/MinHeap.js +6 -5
- package/src/domain/utils/RefLayout.js +59 -0
- package/src/domain/utils/canonicalStringify.js +5 -4
- package/src/domain/utils/roaring.js +31 -5
- package/src/domain/warp/PatchSession.js +26 -17
- package/src/domain/warp/Writer.js +18 -3
- package/src/domain/warp/_internal.js +26 -0
- package/src/domain/warp/_wire.js +58 -0
- package/src/domain/warp/_wiredMethods.d.ts +254 -0
- package/src/domain/warp/checkpoint.methods.js +401 -0
- package/src/domain/warp/fork.methods.js +323 -0
- package/src/domain/warp/materialize.methods.js +238 -0
- package/src/domain/warp/materializeAdvanced.methods.js +350 -0
- package/src/domain/warp/patch.methods.js +554 -0
- package/src/domain/warp/provenance.methods.js +286 -0
- package/src/domain/warp/query.methods.js +280 -0
- package/src/domain/warp/subscribe.methods.js +272 -0
- package/src/domain/warp/sync.methods.js +554 -0
- package/src/globals.d.ts +64 -0
- package/src/infrastructure/adapters/BunHttpAdapter.js +14 -9
- package/src/infrastructure/adapters/CasSeekCacheAdapter.js +9 -4
- package/src/infrastructure/adapters/DenoHttpAdapter.js +5 -6
- package/src/infrastructure/adapters/GitGraphAdapter.js +79 -11
- package/src/infrastructure/adapters/InMemoryGraphAdapter.js +36 -0
- package/src/infrastructure/adapters/NodeHttpAdapter.js +2 -2
- package/src/infrastructure/adapters/WebCryptoAdapter.js +2 -2
- package/src/ports/CommitPort.js +10 -0
- package/src/ports/RefPort.js +17 -0
- package/src/visualization/layouts/converters.js +2 -2
- package/src/visualization/layouts/elkAdapter.js +1 -1
- package/src/visualization/layouts/elkLayout.js +10 -7
- package/src/visualization/layouts/index.js +1 -1
- package/src/visualization/renderers/ascii/seek.js +16 -6
- package/src/visualization/renderers/svg/index.js +1 -1
- package/src/hooks/post-merge.sh +0 -60
|
@@ -71,6 +71,9 @@ export class Writer {
|
|
|
71
71
|
|
|
72
72
|
/** @type {import('../../ports/CodecPort.js').default|undefined} */
|
|
73
73
|
this._codec = codec || defaultCodec;
|
|
74
|
+
|
|
75
|
+
/** @type {boolean} */
|
|
76
|
+
this._commitInProgress = false;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
/**
|
|
@@ -163,6 +166,7 @@ export class Writer {
|
|
|
163
166
|
*
|
|
164
167
|
* @param {(p: PatchSession) => void | Promise<void>} build - Function to build the patch
|
|
165
168
|
* @returns {Promise<string>} The commit SHA of the new patch
|
|
169
|
+
* @throws {WriterError} COMMIT_IN_PROGRESS if called while another commitPatch() is in progress (not reentrant)
|
|
166
170
|
* @throws {WriterError} EMPTY_PATCH if no operations were added
|
|
167
171
|
* @throws {WriterError} WRITER_REF_ADVANCED if CAS fails (ref moved since beginPatch)
|
|
168
172
|
* @throws {WriterError} PERSIST_WRITE_FAILED if git operations fail
|
|
@@ -174,8 +178,19 @@ export class Writer {
|
|
|
174
178
|
* });
|
|
175
179
|
*/
|
|
176
180
|
async commitPatch(build) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
if (this._commitInProgress) {
|
|
182
|
+
throw new WriterError(
|
|
183
|
+
'COMMIT_IN_PROGRESS',
|
|
184
|
+
'commitPatch() is not reentrant. Use beginPatch() for nested or concurrent patches.',
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
this._commitInProgress = true;
|
|
188
|
+
try {
|
|
189
|
+
const patch = await this.beginPatch();
|
|
190
|
+
await build(patch);
|
|
191
|
+
return await patch.commit();
|
|
192
|
+
} finally {
|
|
193
|
+
this._commitInProgress = false;
|
|
194
|
+
}
|
|
180
195
|
}
|
|
181
196
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants and re-exports for WarpGraph method files.
|
|
3
|
+
*
|
|
4
|
+
* Method files (`*.methods.js`) import from here to avoid
|
|
5
|
+
* brittle relative paths back into the domain root.
|
|
6
|
+
*
|
|
7
|
+
* @module domain/warp/_internal
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ── Error constructors ──────────────────────────────────────────────────────
|
|
11
|
+
export { default as QueryError } from '../errors/QueryError.js';
|
|
12
|
+
export { default as ForkError } from '../errors/ForkError.js';
|
|
13
|
+
export { default as SyncError } from '../errors/SyncError.js';
|
|
14
|
+
export { default as OperationAbortedError } from '../errors/OperationAbortedError.js';
|
|
15
|
+
|
|
16
|
+
// ── Shared constants ────────────────────────────────────────────────────────
|
|
17
|
+
export const DEFAULT_ADJACENCY_CACHE_SIZE = 3;
|
|
18
|
+
export const E_NO_STATE_MSG = 'No materialized state. Call materialize() before querying, or use autoMaterialize: true (the default). See https://github.com/git-stunts/git-warp#materialization';
|
|
19
|
+
export const E_STALE_STATE_MSG = 'State is stale (patches written since last materialize). Call materialize() to refresh. See https://github.com/git-stunts/git-warp#materialization';
|
|
20
|
+
|
|
21
|
+
// ── Sync constants ──────────────────────────────────────────────────────────
|
|
22
|
+
export const DEFAULT_SYNC_SERVER_MAX_BYTES = 4 * 1024 * 1024;
|
|
23
|
+
export const DEFAULT_SYNC_WITH_RETRIES = 3;
|
|
24
|
+
export const DEFAULT_SYNC_WITH_BASE_DELAY_MS = 250;
|
|
25
|
+
export const DEFAULT_SYNC_WITH_MAX_DELAY_MS = 2000;
|
|
26
|
+
export const DEFAULT_SYNC_WITH_TIMEOUT_MS = 10_000;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prototype wiring helper for WarpGraph method extraction.
|
|
3
|
+
*
|
|
4
|
+
* Assigns exported functions from `*.methods.js` modules onto a class
|
|
5
|
+
* prototype, with duplicate-name detection at import time.
|
|
6
|
+
*
|
|
7
|
+
* @module domain/warp/_wire
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wires exported functions from method modules onto a class prototype.
|
|
12
|
+
*
|
|
13
|
+
* Each module is expected to export named functions. The function names
|
|
14
|
+
* become method names on the prototype. Duplicates across modules are
|
|
15
|
+
* detected eagerly and throw at import time (not at call time).
|
|
16
|
+
*
|
|
17
|
+
* @param {Function} Class - The class constructor whose prototype to extend
|
|
18
|
+
* @param {Array<Record<string, Function>>} methodModules - Array of method module namespace objects
|
|
19
|
+
* @throws {Error} If a method name appears in more than one module
|
|
20
|
+
*/
|
|
21
|
+
export function wireWarpMethods(Class, methodModules) {
|
|
22
|
+
/** @type {Map<string, string>} name → source module index (for error messages) */
|
|
23
|
+
const seen = new Map();
|
|
24
|
+
const existing = new Set(Object.getOwnPropertyNames(Class.prototype));
|
|
25
|
+
|
|
26
|
+
for (let i = 0; i < methodModules.length; i++) {
|
|
27
|
+
const mod = methodModules[i];
|
|
28
|
+
for (const [name, fn] of Object.entries(mod)) {
|
|
29
|
+
if (typeof fn !== 'function') {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (existing.has(name)) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
`wireWarpMethods: method "${name}" already exists on ${Class.name}.prototype — ` +
|
|
36
|
+
`attempted to overwrite from module index ${i}`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (seen.has(name)) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`wireWarpMethods: duplicate method "${name}" — ` +
|
|
43
|
+
`already defined in module index ${seen.get(name)}, ` +
|
|
44
|
+
`attempted again in module index ${i}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
seen.set(name, String(i));
|
|
49
|
+
|
|
50
|
+
Object.defineProperty(Class.prototype, name, {
|
|
51
|
+
value: fn,
|
|
52
|
+
writable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
enumerable: false,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript augmentation for WarpGraph wired methods.
|
|
3
|
+
*
|
|
4
|
+
* Methods in *.methods.js are wired onto WarpGraph.prototype at runtime
|
|
5
|
+
* via wireWarpMethods(). This declaration file makes them visible to tsc.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { PatchBuilderV2 } from '../services/PatchBuilderV2.js';
|
|
9
|
+
import type { Writer } from './Writer.js';
|
|
10
|
+
import type { WarpStateV5 } from '../services/JoinReducer.js';
|
|
11
|
+
import type { PatchV2 } from '../types/WarpTypesV2.js';
|
|
12
|
+
import type { StateDiffResult } from '../services/StateDiff.js';
|
|
13
|
+
import type { TickReceipt } from '../types/TickReceipt.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Observer configuration for view creation and translation cost.
|
|
17
|
+
*/
|
|
18
|
+
interface ObserverConfig {
|
|
19
|
+
match: string;
|
|
20
|
+
expose?: string[];
|
|
21
|
+
redact?: string[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Translation cost result.
|
|
26
|
+
*/
|
|
27
|
+
interface TranslationCostResult {
|
|
28
|
+
cost: number;
|
|
29
|
+
breakdown: { nodeLoss: number; edgeLoss: number; propLoss: number };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Lightweight status snapshot.
|
|
34
|
+
*/
|
|
35
|
+
interface WarpGraphStatus {
|
|
36
|
+
cachedState: 'fresh' | 'stale' | 'none';
|
|
37
|
+
patchesSinceCheckpoint: number;
|
|
38
|
+
tombstoneRatio: number;
|
|
39
|
+
writers: number;
|
|
40
|
+
frontier: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Sync request message.
|
|
45
|
+
*/
|
|
46
|
+
interface SyncRequest {
|
|
47
|
+
type: 'sync-request';
|
|
48
|
+
frontier: Record<string, string>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sync response message.
|
|
53
|
+
*/
|
|
54
|
+
interface SyncResponse {
|
|
55
|
+
type: 'sync-response';
|
|
56
|
+
frontier: Record<string, string>;
|
|
57
|
+
patches: Array<{ writerId: string; sha: string; patch: unknown }>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Result of applySyncResponse().
|
|
62
|
+
*/
|
|
63
|
+
interface ApplySyncResult {
|
|
64
|
+
state: WarpStateV5;
|
|
65
|
+
frontier: Map<string, number>;
|
|
66
|
+
applied: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Sync options for syncWith().
|
|
71
|
+
*/
|
|
72
|
+
interface SyncWithOptions {
|
|
73
|
+
path?: string;
|
|
74
|
+
retries?: number;
|
|
75
|
+
baseDelayMs?: number;
|
|
76
|
+
maxDelayMs?: number;
|
|
77
|
+
timeoutMs?: number;
|
|
78
|
+
signal?: AbortSignal;
|
|
79
|
+
onStatus?: (event: {
|
|
80
|
+
type: string;
|
|
81
|
+
attempt: number;
|
|
82
|
+
durationMs?: number;
|
|
83
|
+
status?: number;
|
|
84
|
+
error?: Error;
|
|
85
|
+
}) => void;
|
|
86
|
+
auth?: { secret: string; keyId?: string };
|
|
87
|
+
/** Auto-materialize after sync; when true, result includes `state` */
|
|
88
|
+
materialize?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* GC execution result.
|
|
93
|
+
*/
|
|
94
|
+
interface GCExecuteResult {
|
|
95
|
+
nodesCompacted: number;
|
|
96
|
+
edgesCompacted: number;
|
|
97
|
+
tombstonesRemoved: number;
|
|
98
|
+
durationMs: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* GC metrics.
|
|
103
|
+
*/
|
|
104
|
+
interface GCMetrics {
|
|
105
|
+
nodeCount: number;
|
|
106
|
+
edgeCount: number;
|
|
107
|
+
tombstoneCount: number;
|
|
108
|
+
tombstoneRatio: number;
|
|
109
|
+
patchesSinceCompaction: number;
|
|
110
|
+
lastCompactionTime: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Result of maybeRunGC().
|
|
115
|
+
*/
|
|
116
|
+
interface MaybeGCResult {
|
|
117
|
+
ran: boolean;
|
|
118
|
+
result: GCExecuteResult | null;
|
|
119
|
+
reasons: string[];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Join receipt from CRDT merge.
|
|
124
|
+
*/
|
|
125
|
+
interface JoinReceipt {
|
|
126
|
+
nodesAdded: number;
|
|
127
|
+
nodesRemoved: number;
|
|
128
|
+
edgesAdded: number;
|
|
129
|
+
edgesRemoved: number;
|
|
130
|
+
propsChanged: number;
|
|
131
|
+
frontierMerged: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Wormhole edge.
|
|
136
|
+
*/
|
|
137
|
+
interface WormholeEdge {
|
|
138
|
+
fromSha: string;
|
|
139
|
+
toSha: string;
|
|
140
|
+
writerId: string;
|
|
141
|
+
payload: unknown;
|
|
142
|
+
patchCount: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Checkpoint data returned by _loadLatestCheckpoint.
|
|
147
|
+
*/
|
|
148
|
+
interface CheckpointData {
|
|
149
|
+
state: WarpStateV5;
|
|
150
|
+
frontier: Map<string, string>;
|
|
151
|
+
stateHash: string;
|
|
152
|
+
schema: number;
|
|
153
|
+
provenanceIndex?: unknown;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export {};
|
|
157
|
+
|
|
158
|
+
declare module '../WarpGraph.js' {
|
|
159
|
+
export default interface WarpGraph {
|
|
160
|
+
// ── query.methods.js ──────────────────────────────────────────────────
|
|
161
|
+
hasNode(nodeId: string): Promise<boolean>;
|
|
162
|
+
getNodeProps(nodeId: string): Promise<Map<string, unknown> | null>;
|
|
163
|
+
getEdgeProps(from: string, to: string, label: string): Promise<Record<string, unknown> | null>;
|
|
164
|
+
neighbors(nodeId: string, direction?: 'outgoing' | 'incoming' | 'both', edgeLabel?: string): Promise<Array<{ nodeId: string; label: string; direction: 'outgoing' | 'incoming' }>>;
|
|
165
|
+
getStateSnapshot(): Promise<WarpStateV5 | null>;
|
|
166
|
+
getNodes(): Promise<string[]>;
|
|
167
|
+
getEdges(): Promise<Array<{ from: string; to: string; label: string; props: Record<string, unknown> }>>;
|
|
168
|
+
getPropertyCount(): Promise<number>;
|
|
169
|
+
query(): import('../services/QueryBuilder.js').default;
|
|
170
|
+
observer(name: string, config: ObserverConfig): Promise<import('../services/ObserverView.js').default>;
|
|
171
|
+
translationCost(configA: ObserverConfig, configB: ObserverConfig): Promise<TranslationCostResult>;
|
|
172
|
+
|
|
173
|
+
// ── subscribe.methods.js ──────────────────────────────────────────────
|
|
174
|
+
subscribe(options: { onChange: (diff: StateDiffResult) => void; onError?: (error: Error) => void; replay?: boolean }): { unsubscribe: () => void };
|
|
175
|
+
watch(pattern: string, options: { onChange: (diff: StateDiffResult) => void; onError?: (error: Error) => void; poll?: number }): { unsubscribe: () => void };
|
|
176
|
+
_notifySubscribers(diff: StateDiffResult, currentState: WarpStateV5): void;
|
|
177
|
+
|
|
178
|
+
// ── provenance.methods.js ─────────────────────────────────────────────
|
|
179
|
+
patchesFor(entityId: string): Promise<string[]>;
|
|
180
|
+
materializeSlice(nodeId: string, options?: { receipts?: boolean }): Promise<{ state: WarpStateV5; patchCount: number; receipts?: TickReceipt[] }>;
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- internal method; `any` avoids breaking provenance.methods.js callers
|
|
182
|
+
_computeBackwardCone(nodeId: string): Promise<Map<string, any>>;
|
|
183
|
+
loadPatchBySha(sha: string): Promise<{ patch: PatchV2; sha: string }>;
|
|
184
|
+
_loadPatchBySha(sha: string): Promise<{ patch: PatchV2; sha: string }>;
|
|
185
|
+
_loadPatchesBySha(shas: string[]): Promise<Array<{ patch: PatchV2; sha: string }>>;
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- internal method; `any` avoids breaking provenance.methods.js callers
|
|
187
|
+
_sortPatchesCausally(patches: Array<{ patch: any; sha: string }>): Array<{ patch: any; sha: string }>;
|
|
188
|
+
|
|
189
|
+
// ── fork.methods.js ───────────────────────────────────────────────────
|
|
190
|
+
fork(options: { from: string; at: string; forkName?: string; forkWriterId?: string }): Promise<WarpGraph>;
|
|
191
|
+
createWormhole(fromSha: string, toSha: string): Promise<WormholeEdge>;
|
|
192
|
+
_isAncestor(ancestorSha: string, descendantSha: string): Promise<boolean>;
|
|
193
|
+
_relationToCheckpointHead(ckHead: string, incomingSha: string): Promise<string>;
|
|
194
|
+
_validatePatchAgainstCheckpoint(writerId: string, incomingSha: string, checkpoint: unknown): Promise<void>;
|
|
195
|
+
|
|
196
|
+
// ── sync.methods.js ───────────────────────────────────────────────────
|
|
197
|
+
getFrontier(): Promise<Map<string, string>>;
|
|
198
|
+
hasFrontierChanged(): Promise<boolean>;
|
|
199
|
+
status(): Promise<WarpGraphStatus>;
|
|
200
|
+
createSyncRequest(): Promise<SyncRequest>;
|
|
201
|
+
processSyncRequest(request: SyncRequest): Promise<SyncResponse>;
|
|
202
|
+
applySyncResponse(response: SyncResponse): ApplySyncResult;
|
|
203
|
+
syncNeeded(remoteFrontier: Map<string, string>): Promise<boolean>;
|
|
204
|
+
syncWith(remote: string | WarpGraph, options?: SyncWithOptions): Promise<{ applied: number; attempts: number; state?: WarpStateV5 }>;
|
|
205
|
+
serve(options: {
|
|
206
|
+
port: number;
|
|
207
|
+
host?: string;
|
|
208
|
+
path?: string;
|
|
209
|
+
maxRequestBytes?: number;
|
|
210
|
+
httpPort: unknown;
|
|
211
|
+
auth?: unknown;
|
|
212
|
+
allowedWriters?: string[];
|
|
213
|
+
}): Promise<{ close(): Promise<void>; url: string }>;
|
|
214
|
+
|
|
215
|
+
// ── checkpoint.methods.js ─────────────────────────────────────────────
|
|
216
|
+
createCheckpoint(): Promise<string>;
|
|
217
|
+
syncCoverage(): Promise<void>;
|
|
218
|
+
_loadLatestCheckpoint(): Promise<CheckpointData | null>;
|
|
219
|
+
_loadPatchesSince(checkpoint: CheckpointData): Promise<Array<{ patch: PatchV2; sha: string }>>;
|
|
220
|
+
_validateMigrationBoundary(): Promise<void>;
|
|
221
|
+
_hasSchema1Patches(): Promise<boolean>;
|
|
222
|
+
_maybeRunGC(state: WarpStateV5): void;
|
|
223
|
+
maybeRunGC(): MaybeGCResult;
|
|
224
|
+
runGC(): GCExecuteResult;
|
|
225
|
+
getGCMetrics(): GCMetrics | null;
|
|
226
|
+
|
|
227
|
+
// ── patch.methods.js ──────────────────────────────────────────────────
|
|
228
|
+
createPatch(): Promise<PatchBuilderV2>;
|
|
229
|
+
patch(build: (p: PatchBuilderV2) => void | Promise<void>): Promise<string>;
|
|
230
|
+
_nextLamport(): Promise<{ lamport: number; parentSha: string | null }>;
|
|
231
|
+
_loadWriterPatches(writerId: string, stopAtSha?: string | null): Promise<Array<{ patch: PatchV2; sha: string }>>;
|
|
232
|
+
getWriterPatches(writerId: string, stopAtSha?: string | null): Promise<Array<{ patch: PatchV2; sha: string }>>;
|
|
233
|
+
_onPatchCommitted(writerId: string, opts?: { patch?: PatchV2; sha?: string }): Promise<void>;
|
|
234
|
+
writer(writerId?: string): Promise<Writer>;
|
|
235
|
+
createWriter(opts?: { persist?: 'config' | 'none'; alias?: string }): Promise<Writer>;
|
|
236
|
+
_ensureFreshState(): Promise<void>;
|
|
237
|
+
discoverWriters(): Promise<string[]>;
|
|
238
|
+
discoverTicks(): Promise<{ ticks: number[]; maxTick: number; perWriter: Map<string, { ticks: number[]; tipSha: string | null; tickShas: Record<number, string> }> }>;
|
|
239
|
+
join(otherState: WarpStateV5): { state: WarpStateV5; receipt: JoinReceipt };
|
|
240
|
+
_frontierEquals(a: Map<string, number>, b: Map<string, number>): boolean;
|
|
241
|
+
|
|
242
|
+
// ── materialize.methods.js ────────────────────────────────────────────
|
|
243
|
+
materialize(options: { receipts: true; ceiling?: number | null }): Promise<{ state: WarpStateV5; receipts: TickReceipt[] }>;
|
|
244
|
+
materialize(options?: { receipts?: false; ceiling?: number | null }): Promise<WarpStateV5>;
|
|
245
|
+
_materializeGraph(): Promise<{ state: WarpStateV5; stateHash: string; adjacency: unknown }>;
|
|
246
|
+
|
|
247
|
+
// ── materializeAdvanced.methods.js ────────────────────────────────────
|
|
248
|
+
_resolveCeiling(options?: { ceiling?: number | null }): number | null;
|
|
249
|
+
_buildAdjacency(state: WarpStateV5): { outgoing: Map<string, Array<{ neighborId: string; label: string }>>; incoming: Map<string, Array<{ neighborId: string; label: string }>> };
|
|
250
|
+
_setMaterializedState(state: WarpStateV5): Promise<{ state: WarpStateV5; stateHash: string; adjacency: unknown }>;
|
|
251
|
+
_materializeWithCeiling(ceiling: number, collectReceipts: boolean, t0: number): Promise<WarpStateV5 | { state: WarpStateV5; receipts: TickReceipt[] }>;
|
|
252
|
+
materializeAt(checkpointSha: string): Promise<WarpStateV5>;
|
|
253
|
+
}
|
|
254
|
+
}
|