Skip to content

Commit 5677907

Browse files
committed
fix: restore LogicalTraversal type declarations for traverse property
Keep LogicalTraversal interface and traverse property in index.d.ts and type-surface manifest — the runtime traverse property is still used by consumers via graph.traverse.bfs() etc. Only TraversalService alias and createWriter() are removed as breaking changes.
1 parent 024b0bb commit 5677907

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

contracts/type-surface.m8.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@
132132
"name": {
133133
"type": "string",
134134
"readonly": true
135+
},
136+
"traverse": {
137+
"type": "LogicalTraversal"
135138
}
136139
}
137140
},
@@ -1167,6 +1170,9 @@
11671170
"readonly": true,
11681171
"getter": true
11691172
},
1173+
"traverse": {
1174+
"type": "LogicalTraversal"
1175+
},
11701176
"setSeekCache": {
11711177
"params": [
11721178
{
@@ -1578,6 +1584,9 @@
15781584
"LogLevelValue": {
15791585
"kind": "type"
15801586
},
1587+
"LogicalTraversal": {
1588+
"kind": "interface"
1589+
},
15811590
"MaybeGCResult": {
15821591
"kind": "interface"
15831592
},

index.d.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,81 @@ export type WeightedCostSelector =
253253
| { weightFn?: EdgeWeightFn; nodeWeightFn?: never }
254254
| { nodeWeightFn?: NodeWeightFn; weightFn?: never };
255255

256+
/** @deprecated Traversal facade that delegates to GraphTraversal. Use GraphTraversal directly. */
257+
export interface LogicalTraversal {
258+
bfs(start: string, options?: TraverseFacadeOptions): Promise<string[]>;
259+
dfs(start: string, options?: TraverseFacadeOptions): Promise<string[]>;
260+
shortestPath(from: string, to: string, options?: TraverseFacadeOptions): Promise<{ found: boolean; path: string[]; length: number }>;
261+
connectedComponent(start: string, options?: {
262+
maxDepth?: number;
263+
labelFilter?: string | string[];
264+
}): Promise<string[]>;
265+
isReachable(from: string, to: string, options?: TraverseFacadeOptions & {
266+
signal?: AbortSignal;
267+
}): Promise<{ reachable: boolean }>;
268+
weightedShortestPath(from: string, to: string, options?: WeightedCostSelector & {
269+
dir?: 'out' | 'in' | 'both';
270+
labelFilter?: string | string[];
271+
signal?: AbortSignal;
272+
}): Promise<{ path: string[]; totalCost: number }>;
273+
aStarSearch(from: string, to: string, options?: WeightedCostSelector & {
274+
dir?: 'out' | 'in' | 'both';
275+
labelFilter?: string | string[];
276+
heuristicFn?: (nodeId: string, goalId: string) => number;
277+
signal?: AbortSignal;
278+
}): Promise<{ path: string[]; totalCost: number; nodesExplored: number }>;
279+
bidirectionalAStar(from: string, to: string, options?: WeightedCostSelector & {
280+
labelFilter?: string | string[];
281+
forwardHeuristic?: (nodeId: string, goalId: string) => number;
282+
backwardHeuristic?: (nodeId: string, goalId: string) => number;
283+
signal?: AbortSignal;
284+
}): Promise<{ path: string[]; totalCost: number; nodesExplored: number }>;
285+
topologicalSort(start: string | string[], options?: {
286+
dir?: 'out' | 'in' | 'both';
287+
labelFilter?: string | string[];
288+
throwOnCycle?: boolean;
289+
signal?: AbortSignal;
290+
}): Promise<{ sorted: string[]; hasCycle: boolean }>;
291+
commonAncestors(nodes: string[], options?: {
292+
maxDepth?: number;
293+
labelFilter?: string | string[];
294+
maxResults?: number;
295+
signal?: AbortSignal;
296+
}): Promise<{ ancestors: string[] }>;
297+
weightedLongestPath(from: string, to: string, options?: WeightedCostSelector & {
298+
dir?: 'out' | 'in' | 'both';
299+
labelFilter?: string | string[];
300+
signal?: AbortSignal;
301+
}): Promise<{ path: string[]; totalCost: number }>;
302+
levels(start: string | string[], options?: {
303+
dir?: 'out' | 'in' | 'both';
304+
labelFilter?: string | string[];
305+
signal?: AbortSignal;
306+
}): Promise<{ levels: Map<string, number>; maxLevel: number }>;
307+
transitiveReduction(start: string | string[], options?: {
308+
dir?: 'out' | 'in' | 'both';
309+
labelFilter?: string | string[];
310+
signal?: AbortSignal;
311+
}): Promise<{ edges: Array<{ from: string; to: string; label: string }>; removed: number }>;
312+
transitiveClosure(start: string | string[], options?: {
313+
dir?: 'out' | 'in' | 'both';
314+
labelFilter?: string | string[];
315+
maxEdges?: number;
316+
signal?: AbortSignal;
317+
}): Promise<{ edges: Array<{ from: string; to: string }> }>;
318+
transitiveClosureStream(start: string | string[], options?: {
319+
dir?: 'out' | 'in' | 'both';
320+
labelFilter?: string | string[];
321+
maxEdges?: number;
322+
signal?: AbortSignal;
323+
}): AsyncGenerator<{ from: string; to: string }, void, unknown>;
324+
rootAncestors(start: string, options?: {
325+
labelFilter?: string | string[];
326+
maxDepth?: number;
327+
signal?: AbortSignal;
328+
}): Promise<{ roots: string[] }>;
329+
}
330+
256331
/**
257332
* Options for BFS/DFS traversal.
258333
*/
@@ -1350,6 +1425,8 @@ export class Observer {
13501425
/** Pinned snapshot hash (null only for internal delegate-mode instances) */
13511426
readonly stateHash: string | null;
13521427

1428+
/** Logical graph traversal helpers scoped to this observer */
1429+
traverse: LogicalTraversal;
13531430

13541431
/** Checks if a node exists and is visible to this observer */
13551432
hasNode(nodeId: string): Promise<boolean>;
@@ -1377,6 +1454,8 @@ export class Worldline {
13771454
/** Pinned source for this worldline handle */
13781455
readonly source: WorldlineSource;
13791456

1457+
/** Full-aperture traversal helpers over this pinned source. */
1458+
traverse: LogicalTraversal;
13801459

13811460
/** Returns a new worldline handle pinned to a different source */
13821461
seek(options?: WorldlineOptions): Promise<Worldline>;
@@ -2048,6 +2127,10 @@ declare class WarpCoreBase {
20482127
materializeAt(checkpointSha: string): Promise<WarpStateV5>;
20492128

20502129
/**
2130+
* Logical graph traversal helpers.
2131+
*/
2132+
traverse: LogicalTraversal;
2133+
20512134
/**
20522135
* Creates a fluent query builder over the currently visible materialized state.
20532136
*
@@ -2366,6 +2449,8 @@ declare class WarpCoreBase {
23662449
/** Gets or creates a Writer, optionally resolving from git config. */
23672450
writer(writerId?: string): Promise<Writer>;
23682451

2452+
/**
2453+
* Creates a new Writer with a fresh canonical ID.
23692454
/** Checks GC thresholds and runs GC if needed. */
23702455
maybeRunGC(): MaybeGCResult;
23712456

0 commit comments

Comments
 (0)