octie-cli 1.0.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/README.md +523 -0
- package/dist/cli/commands/approve.d.ts +27 -0
- package/dist/cli/commands/approve.d.ts.map +1 -0
- package/dist/cli/commands/approve.js +119 -0
- package/dist/cli/commands/approve.js.map +1 -0
- package/dist/cli/commands/batch.d.ts +15 -0
- package/dist/cli/commands/batch.d.ts.map +1 -0
- package/dist/cli/commands/batch.js +521 -0
- package/dist/cli/commands/batch.js.map +1 -0
- package/dist/cli/commands/create.d.ts +9 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +321 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/delete.d.ts +9 -0
- package/dist/cli/commands/delete.d.ts.map +1 -0
- package/dist/cli/commands/delete.js +143 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/export.d.ts +9 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +66 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/find.d.ts +16 -0
- package/dist/cli/commands/find.d.ts.map +1 -0
- package/dist/cli/commands/find.js +252 -0
- package/dist/cli/commands/find.js.map +1 -0
- package/dist/cli/commands/get.d.ts +9 -0
- package/dist/cli/commands/get.d.ts.map +1 -0
- package/dist/cli/commands/get.js +74 -0
- package/dist/cli/commands/get.js.map +1 -0
- package/dist/cli/commands/graph.d.ts +9 -0
- package/dist/cli/commands/graph.d.ts.map +1 -0
- package/dist/cli/commands/graph.js +200 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/import.d.ts +9 -0
- package/dist/cli/commands/import.d.ts.map +1 -0
- package/dist/cli/commands/import.js +807 -0
- package/dist/cli/commands/import.js.map +1 -0
- package/dist/cli/commands/init.d.ts +9 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +57 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +9 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +175 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/merge.d.ts +9 -0
- package/dist/cli/commands/merge.d.ts.map +1 -0
- package/dist/cli/commands/merge.js +113 -0
- package/dist/cli/commands/merge.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +9 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +94 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/update.d.ts +9 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +423 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/wire.d.ts +15 -0
- package/dist/cli/commands/wire.d.ts.map +1 -0
- package/dist/cli/commands/wire.js +164 -0
- package/dist/cli/commands/wire.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +100 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/output/json.d.ts +16 -0
- package/dist/cli/output/json.d.ts.map +1 -0
- package/dist/cli/output/json.js +29 -0
- package/dist/cli/output/json.js.map +1 -0
- package/dist/cli/output/markdown.d.ts +15 -0
- package/dist/cli/output/markdown.d.ts.map +1 -0
- package/dist/cli/output/markdown.js +206 -0
- package/dist/cli/output/markdown.js.map +1 -0
- package/dist/cli/output/table.d.ts +23 -0
- package/dist/cli/output/table.d.ts.map +1 -0
- package/dist/cli/output/table.js +150 -0
- package/dist/cli/output/table.js.map +1 -0
- package/dist/cli/utils/helpers.d.ts +126 -0
- package/dist/cli/utils/helpers.d.ts.map +1 -0
- package/dist/cli/utils/helpers.js +325 -0
- package/dist/cli/utils/helpers.js.map +1 -0
- package/dist/core/graph/algorithms.d.ts +11 -0
- package/dist/core/graph/algorithms.d.ts.map +1 -0
- package/dist/core/graph/algorithms.js +14 -0
- package/dist/core/graph/algorithms.js.map +1 -0
- package/dist/core/graph/cycle.d.ts +155 -0
- package/dist/core/graph/cycle.d.ts.map +1 -0
- package/dist/core/graph/cycle.js +297 -0
- package/dist/core/graph/cycle.js.map +1 -0
- package/dist/core/graph/index.d.ts +223 -0
- package/dist/core/graph/index.d.ts.map +1 -0
- package/dist/core/graph/index.js +475 -0
- package/dist/core/graph/index.js.map +1 -0
- package/dist/core/graph/operations.d.ts +240 -0
- package/dist/core/graph/operations.d.ts.map +1 -0
- package/dist/core/graph/operations.js +503 -0
- package/dist/core/graph/operations.js.map +1 -0
- package/dist/core/graph/sort.d.ts +76 -0
- package/dist/core/graph/sort.d.ts.map +1 -0
- package/dist/core/graph/sort.js +254 -0
- package/dist/core/graph/sort.js.map +1 -0
- package/dist/core/graph/traversal.d.ts +122 -0
- package/dist/core/graph/traversal.d.ts.map +1 -0
- package/dist/core/graph/traversal.js +336 -0
- package/dist/core/graph/traversal.js.map +1 -0
- package/dist/core/models/task-node.d.ts +328 -0
- package/dist/core/models/task-node.d.ts.map +1 -0
- package/dist/core/models/task-node.js +1090 -0
- package/dist/core/models/task-node.js.map +1 -0
- package/dist/core/registry/index.d.ts +102 -0
- package/dist/core/registry/index.d.ts.map +1 -0
- package/dist/core/registry/index.js +249 -0
- package/dist/core/registry/index.js.map +1 -0
- package/dist/core/registry/root-guard.d.ts +19 -0
- package/dist/core/registry/root-guard.d.ts.map +1 -0
- package/dist/core/registry/root-guard.js +28 -0
- package/dist/core/registry/root-guard.js.map +1 -0
- package/dist/core/storage/atomic-write.d.ts +181 -0
- package/dist/core/storage/atomic-write.d.ts.map +1 -0
- package/dist/core/storage/atomic-write.js +379 -0
- package/dist/core/storage/atomic-write.js.map +1 -0
- package/dist/core/storage/file-store.d.ts +148 -0
- package/dist/core/storage/file-store.d.ts.map +1 -0
- package/dist/core/storage/file-store.js +423 -0
- package/dist/core/storage/file-store.js.map +1 -0
- package/dist/core/storage/indexer.d.ts +138 -0
- package/dist/core/storage/indexer.d.ts.map +1 -0
- package/dist/core/storage/indexer.js +350 -0
- package/dist/core/storage/indexer.js.map +1 -0
- package/dist/core/utils/status-helpers.d.ts +59 -0
- package/dist/core/utils/status-helpers.d.ts.map +1 -0
- package/dist/core/utils/status-helpers.js +149 -0
- package/dist/core/utils/status-helpers.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +504 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +182 -0
- package/dist/types/index.js.map +1 -0
- package/dist/web/routes/graph.d.ts +17 -0
- package/dist/web/routes/graph.d.ts.map +1 -0
- package/dist/web/routes/graph.js +277 -0
- package/dist/web/routes/graph.js.map +1 -0
- package/dist/web/routes/projects.d.ts +14 -0
- package/dist/web/routes/projects.d.ts.map +1 -0
- package/dist/web/routes/projects.js +102 -0
- package/dist/web/routes/projects.js.map +1 -0
- package/dist/web/routes/tasks.d.ts +17 -0
- package/dist/web/routes/tasks.d.ts.map +1 -0
- package/dist/web/routes/tasks.js +538 -0
- package/dist/web/routes/tasks.js.map +1 -0
- package/dist/web/server.d.ts +121 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +389 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web-ui/assets/index-BB0qvF1y.css +1 -0
- package/dist/web-ui/assets/index-Vmm72oKY.js +34 -0
- package/dist/web-ui/index.html +14 -0
- package/dist/web-ui/vite.svg +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Graph data structure
|
|
3
|
+
*
|
|
4
|
+
* Implements a directed graph using adjacency lists for O(1) node lookup
|
|
5
|
+
* and O(k) edge traversal where k is the number of edges.
|
|
6
|
+
*
|
|
7
|
+
* Graph Structure:
|
|
8
|
+
* - nodes: Map<taskId, TaskNode> for O(1) node lookup
|
|
9
|
+
* - outgoingEdges: Map<taskId, Set<targetTaskIds>> for forward traversal
|
|
10
|
+
* - incomingEdges: Map<taskId, Set<sourceTaskIds>> for reverse traversal
|
|
11
|
+
*
|
|
12
|
+
* @module core/graph
|
|
13
|
+
*/
|
|
14
|
+
import { TaskNotFoundError, ValidationError, AmbiguousIdError } from '../../types/index.js';
|
|
15
|
+
import { TaskNode } from '../models/task-node.js';
|
|
16
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
17
|
+
/**
|
|
18
|
+
* TaskGraphStore class
|
|
19
|
+
*
|
|
20
|
+
* Manages the task graph data structure with efficient lookup and traversal.
|
|
21
|
+
* Uses Map and Set for optimal performance:
|
|
22
|
+
* - O(1) node lookup by ID
|
|
23
|
+
* - O(k) edge traversal where k = edge count
|
|
24
|
+
* - O(1) edge existence checking
|
|
25
|
+
*/
|
|
26
|
+
export class TaskGraphStore {
|
|
27
|
+
/** Primary node storage (hash map for O(1) lookup) */
|
|
28
|
+
_nodes;
|
|
29
|
+
/** Outgoing edges: node -> nodes it points to */
|
|
30
|
+
_outgoingEdges;
|
|
31
|
+
/** Incoming edges: node -> nodes pointing to it */
|
|
32
|
+
_incomingEdges;
|
|
33
|
+
/** Graph metadata */
|
|
34
|
+
_metadata;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new TaskGraphStore
|
|
37
|
+
* @param metadata - Optional project metadata
|
|
38
|
+
*/
|
|
39
|
+
constructor(metadata) {
|
|
40
|
+
this._nodes = new Map();
|
|
41
|
+
this._outgoingEdges = new Map();
|
|
42
|
+
this._incomingEdges = new Map();
|
|
43
|
+
this._metadata = metadata || {
|
|
44
|
+
project_name: 'Untitled Project',
|
|
45
|
+
version: '1.0.0',
|
|
46
|
+
created_at: new Date().toISOString(),
|
|
47
|
+
updated_at: new Date().toISOString(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the number of tasks in the graph
|
|
52
|
+
*/
|
|
53
|
+
get size() {
|
|
54
|
+
return this._nodes.size;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get the graph metadata
|
|
58
|
+
*/
|
|
59
|
+
get metadata() {
|
|
60
|
+
return { ...this._metadata };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Update graph metadata
|
|
64
|
+
* @param metadata - New metadata values (partial update)
|
|
65
|
+
*/
|
|
66
|
+
setMetadata(metadata) {
|
|
67
|
+
this._metadata = {
|
|
68
|
+
...this._metadata,
|
|
69
|
+
...metadata,
|
|
70
|
+
updated_at: new Date().toISOString(),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get a task node by ID
|
|
75
|
+
* @param id - Task ID to look up
|
|
76
|
+
* @returns Task node or undefined if not found
|
|
77
|
+
* @complexity O(1)
|
|
78
|
+
*/
|
|
79
|
+
getNode(id) {
|
|
80
|
+
return this._nodes.get(id);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get a task node by ID or throw error
|
|
84
|
+
* @param id - Task ID to look up
|
|
85
|
+
* @returns Task node
|
|
86
|
+
* @throws {TaskNotFoundError} If task not found
|
|
87
|
+
* @complexity O(1)
|
|
88
|
+
*/
|
|
89
|
+
getNodeOrThrow(id) {
|
|
90
|
+
const node = this._nodes.get(id);
|
|
91
|
+
if (!node) {
|
|
92
|
+
throw new TaskNotFoundError(id);
|
|
93
|
+
}
|
|
94
|
+
return node;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check if a task exists
|
|
98
|
+
* @param id - Task ID to check
|
|
99
|
+
* @returns True if task exists
|
|
100
|
+
* @complexity O(1)
|
|
101
|
+
*/
|
|
102
|
+
hasNode(id) {
|
|
103
|
+
return this._nodes.has(id);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get a task node by short UUID prefix (first 7-8 characters)
|
|
107
|
+
* @param prefix - Short UUID prefix to look up
|
|
108
|
+
* @returns Task node or undefined if not found
|
|
109
|
+
* @throws {AmbiguousIdError} If multiple tasks match the prefix
|
|
110
|
+
* @complexity O(n) where n is the number of tasks
|
|
111
|
+
*/
|
|
112
|
+
getNodeByPrefix(prefix) {
|
|
113
|
+
const matches = [];
|
|
114
|
+
const lowerPrefix = prefix.toLowerCase();
|
|
115
|
+
for (const [id, node] of this._nodes) {
|
|
116
|
+
if (id.toLowerCase().startsWith(lowerPrefix)) {
|
|
117
|
+
matches.push(node);
|
|
118
|
+
if (matches.length > 1) {
|
|
119
|
+
throw new AmbiguousIdError(prefix, matches.map(m => m.id));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return matches[0];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get a task node by ID or prefix
|
|
127
|
+
* @param id - Task ID or short UUID prefix to look up
|
|
128
|
+
* @returns Task node or undefined if not found
|
|
129
|
+
* @complexity O(1) for full ID, O(n) for prefix
|
|
130
|
+
*/
|
|
131
|
+
getNodeByIdOrPrefix(id) {
|
|
132
|
+
// Try exact match first (O(1))
|
|
133
|
+
const exactMatch = this.getNode(id);
|
|
134
|
+
if (exactMatch)
|
|
135
|
+
return exactMatch;
|
|
136
|
+
// Fall back to prefix search (O(n))
|
|
137
|
+
return this.getNodeByPrefix(id);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Generate a unique task ID with collision detection
|
|
141
|
+
* Ensures that the first 7 characters of the UUID are unique across all tasks
|
|
142
|
+
* @returns A unique task ID
|
|
143
|
+
* @throws {Error} If unable to generate unique ID after many attempts
|
|
144
|
+
*/
|
|
145
|
+
generateUniqueId() {
|
|
146
|
+
const MAX_ATTEMPTS = 100;
|
|
147
|
+
const PREFIX_LENGTH = 7;
|
|
148
|
+
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
149
|
+
const id = uuidv4();
|
|
150
|
+
const prefix = id.substring(0, PREFIX_LENGTH);
|
|
151
|
+
// Check if any existing task has the same prefix
|
|
152
|
+
let prefixExists = false;
|
|
153
|
+
for (const existingId of this._nodes.keys()) {
|
|
154
|
+
if (existingId.substring(0, PREFIX_LENGTH) === prefix) {
|
|
155
|
+
prefixExists = true;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (!prefixExists) {
|
|
160
|
+
return id;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
throw new Error(`Failed to generate unique ID after ${MAX_ATTEMPTS} attempts. Too many tasks?`);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get all task IDs in the graph
|
|
167
|
+
* @returns Array of task IDs
|
|
168
|
+
*/
|
|
169
|
+
getAllTaskIds() {
|
|
170
|
+
return Array.from(this._nodes.keys());
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get all task nodes in the graph
|
|
174
|
+
* @returns Array of task nodes
|
|
175
|
+
*/
|
|
176
|
+
getAllTasks() {
|
|
177
|
+
return Array.from(this._nodes.values());
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Add a task node to the graph
|
|
181
|
+
* @param node - Task node to add
|
|
182
|
+
* @throws {ValidationError} If task ID already exists
|
|
183
|
+
* @complexity O(1)
|
|
184
|
+
*/
|
|
185
|
+
addNode(node) {
|
|
186
|
+
if (this._nodes.has(node.id)) {
|
|
187
|
+
throw new ValidationError(`Task with ID '${node.id}' already exists in graph.`, 'id');
|
|
188
|
+
}
|
|
189
|
+
this._nodes.set(node.id, node);
|
|
190
|
+
this._outgoingEdges.set(node.id, new Set(node.edges));
|
|
191
|
+
// Only initialize incoming edges if not already set (from previous node additions)
|
|
192
|
+
if (!this._incomingEdges.has(node.id)) {
|
|
193
|
+
this._incomingEdges.set(node.id, new Set());
|
|
194
|
+
}
|
|
195
|
+
// Update incoming edges for all outgoing edges
|
|
196
|
+
for (const targetId of node.edges) {
|
|
197
|
+
if (!this._incomingEdges.has(targetId)) {
|
|
198
|
+
this._incomingEdges.set(targetId, new Set());
|
|
199
|
+
}
|
|
200
|
+
this._incomingEdges.get(targetId).add(node.id);
|
|
201
|
+
}
|
|
202
|
+
this._metadata.updated_at = new Date().toISOString();
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Remove a task node from the graph
|
|
206
|
+
* @param id - Task ID to remove
|
|
207
|
+
* @throws {TaskNotFoundError} If task not found
|
|
208
|
+
* @complexity O(k) where k is the number of edges
|
|
209
|
+
*/
|
|
210
|
+
removeNode(id) {
|
|
211
|
+
if (!this._nodes.has(id)) {
|
|
212
|
+
throw new TaskNotFoundError(id);
|
|
213
|
+
}
|
|
214
|
+
// Remove all edges pointing to this node
|
|
215
|
+
const incomingSources = this._incomingEdges.get(id) || new Set();
|
|
216
|
+
for (const sourceId of incomingSources) {
|
|
217
|
+
this._outgoingEdges.get(sourceId)?.delete(id);
|
|
218
|
+
// Also update the source node's edges field
|
|
219
|
+
const sourceNode = this._nodes.get(sourceId);
|
|
220
|
+
if (sourceNode) {
|
|
221
|
+
sourceNode.edges = sourceNode.edges.filter(eid => eid !== id);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Remove all edges from this node
|
|
225
|
+
const outgoingTargets = this._outgoingEdges.get(id) || new Set();
|
|
226
|
+
for (const targetId of outgoingTargets) {
|
|
227
|
+
this._incomingEdges.get(targetId)?.delete(id);
|
|
228
|
+
}
|
|
229
|
+
// Remove the node and edge maps
|
|
230
|
+
this._nodes.delete(id);
|
|
231
|
+
this._outgoingEdges.delete(id);
|
|
232
|
+
this._incomingEdges.delete(id);
|
|
233
|
+
this._metadata.updated_at = new Date().toISOString();
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Update a task node in the graph
|
|
237
|
+
* @param node - Task node with updated values
|
|
238
|
+
* @throws {TaskNotFoundError} If task not found
|
|
239
|
+
* @complexity O(1)
|
|
240
|
+
*/
|
|
241
|
+
updateNode(node) {
|
|
242
|
+
if (!this._nodes.has(node.id)) {
|
|
243
|
+
throw new TaskNotFoundError(node.id);
|
|
244
|
+
}
|
|
245
|
+
this._nodes.set(node.id, node);
|
|
246
|
+
this._metadata.updated_at = new Date().toISOString();
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get outgoing edges for a node
|
|
250
|
+
* @param nodeId - Source task ID
|
|
251
|
+
* @returns Array of target task IDs
|
|
252
|
+
* @complexity O(k) where k is the number of outgoing edges
|
|
253
|
+
*/
|
|
254
|
+
getOutgoingEdges(nodeId) {
|
|
255
|
+
return Array.from(this._outgoingEdges.get(nodeId) || []);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get incoming edges for a node
|
|
259
|
+
* @param nodeId - Target task ID
|
|
260
|
+
* @returns Array of source task IDs
|
|
261
|
+
* @complexity O(k) where k is the number of incoming edges
|
|
262
|
+
*/
|
|
263
|
+
getIncomingEdges(nodeId) {
|
|
264
|
+
return Array.from(this._incomingEdges.get(nodeId) || []);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Add an edge between two nodes
|
|
268
|
+
* @param fromId - Source task ID
|
|
269
|
+
* @param toId - Target task ID
|
|
270
|
+
* @throws {TaskNotFoundError} If either task not found
|
|
271
|
+
* @throws {ValidationError} If edge already exists
|
|
272
|
+
* @complexity O(1)
|
|
273
|
+
*/
|
|
274
|
+
addEdge(fromId, toId) {
|
|
275
|
+
if (!this._nodes.has(fromId)) {
|
|
276
|
+
throw new TaskNotFoundError(fromId);
|
|
277
|
+
}
|
|
278
|
+
if (!this._nodes.has(toId)) {
|
|
279
|
+
throw new TaskNotFoundError(toId);
|
|
280
|
+
}
|
|
281
|
+
// Initialize edge sets if needed
|
|
282
|
+
if (!this._outgoingEdges.has(fromId)) {
|
|
283
|
+
this._outgoingEdges.set(fromId, new Set());
|
|
284
|
+
}
|
|
285
|
+
if (!this._incomingEdges.has(toId)) {
|
|
286
|
+
this._incomingEdges.set(toId, new Set());
|
|
287
|
+
}
|
|
288
|
+
// Check if edge already exists
|
|
289
|
+
if (this._outgoingEdges.get(fromId).has(toId)) {
|
|
290
|
+
throw new ValidationError(`Edge from '${fromId}' to '${toId}' already exists.`, 'edges');
|
|
291
|
+
}
|
|
292
|
+
// Add edge
|
|
293
|
+
this._outgoingEdges.get(fromId).add(toId);
|
|
294
|
+
this._incomingEdges.get(toId).add(fromId);
|
|
295
|
+
// Update task node's edge list
|
|
296
|
+
const fromNode = this._nodes.get(fromId);
|
|
297
|
+
if (!fromNode.edges.includes(toId)) {
|
|
298
|
+
fromNode.edges.push(toId);
|
|
299
|
+
}
|
|
300
|
+
this._metadata.updated_at = new Date().toISOString();
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Remove an edge between two nodes
|
|
304
|
+
* @param fromId - Source task ID
|
|
305
|
+
* @param toId - Target task ID
|
|
306
|
+
* @throws {TaskNotFoundError} If either task not found
|
|
307
|
+
* @throws {ValidationError} If edge doesn't exist
|
|
308
|
+
* @complexity O(1)
|
|
309
|
+
*/
|
|
310
|
+
removeEdge(fromId, toId) {
|
|
311
|
+
if (!this._nodes.has(fromId)) {
|
|
312
|
+
throw new TaskNotFoundError(fromId);
|
|
313
|
+
}
|
|
314
|
+
if (!this._nodes.has(toId)) {
|
|
315
|
+
throw new TaskNotFoundError(toId);
|
|
316
|
+
}
|
|
317
|
+
const outgoingSet = this._outgoingEdges.get(fromId);
|
|
318
|
+
if (!outgoingSet || !outgoingSet.has(toId)) {
|
|
319
|
+
throw new ValidationError(`Edge from '${fromId}' to '${toId}' does not exist.`, 'edges');
|
|
320
|
+
}
|
|
321
|
+
// Remove edge
|
|
322
|
+
outgoingSet.delete(toId);
|
|
323
|
+
this._incomingEdges.get(toId)?.delete(fromId);
|
|
324
|
+
// Update task node's edge list
|
|
325
|
+
const fromNode = this._nodes.get(fromId);
|
|
326
|
+
const edgeIndex = fromNode.edges.indexOf(toId);
|
|
327
|
+
if (edgeIndex > -1) {
|
|
328
|
+
fromNode.edges.splice(edgeIndex, 1);
|
|
329
|
+
}
|
|
330
|
+
this._metadata.updated_at = new Date().toISOString();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Check if an edge exists
|
|
334
|
+
* @param fromId - Source task ID
|
|
335
|
+
* @param toId - Target task ID
|
|
336
|
+
* @returns True if edge exists
|
|
337
|
+
* @complexity O(1)
|
|
338
|
+
*/
|
|
339
|
+
hasEdge(fromId, toId) {
|
|
340
|
+
const outgoingSet = this._outgoingEdges.get(fromId);
|
|
341
|
+
return outgoingSet ? outgoingSet.has(toId) : false;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Get root tasks (tasks with no incoming edges)
|
|
345
|
+
* @returns Array of root task IDs
|
|
346
|
+
* @complexity O(n) where n is the number of tasks
|
|
347
|
+
*/
|
|
348
|
+
getRootTasks() {
|
|
349
|
+
const roots = [];
|
|
350
|
+
for (const [id, incomingSet] of this._incomingEdges) {
|
|
351
|
+
if (incomingSet.size === 0) {
|
|
352
|
+
roots.push(id);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return roots;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Get orphan tasks (tasks with no edges at all)
|
|
359
|
+
* @returns Array of orphan task IDs
|
|
360
|
+
* @complexity O(n) where n is the number of tasks
|
|
361
|
+
*/
|
|
362
|
+
getOrphanTasks() {
|
|
363
|
+
const orphans = [];
|
|
364
|
+
for (const [id] of this._nodes) {
|
|
365
|
+
const outgoing = this._outgoingEdges.get(id)?.size ?? 0;
|
|
366
|
+
const incoming = this._incomingEdges.get(id)?.size ?? 0;
|
|
367
|
+
if (outgoing === 0 && incoming === 0) {
|
|
368
|
+
orphans.push(id);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return orphans;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Get leaf tasks (tasks with no outgoing edges)
|
|
375
|
+
* @returns Array of leaf task IDs
|
|
376
|
+
* @complexity O(n) where n is the number of tasks
|
|
377
|
+
*/
|
|
378
|
+
getLeafTasks() {
|
|
379
|
+
const leaves = [];
|
|
380
|
+
for (const [id, outgoingSet] of this._outgoingEdges) {
|
|
381
|
+
if (outgoingSet.size === 0) {
|
|
382
|
+
leaves.push(id);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return leaves;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Clear all tasks and edges from the graph
|
|
389
|
+
* Keeps metadata but resets the graph structure
|
|
390
|
+
*/
|
|
391
|
+
clear() {
|
|
392
|
+
this._nodes.clear();
|
|
393
|
+
this._outgoingEdges.clear();
|
|
394
|
+
this._incomingEdges.clear();
|
|
395
|
+
this._metadata.updated_at = new Date().toISOString();
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Convert graph to TaskGraph interface
|
|
399
|
+
* @returns TaskGraph interface representation
|
|
400
|
+
*/
|
|
401
|
+
toInterface() {
|
|
402
|
+
return {
|
|
403
|
+
nodes: new Map(this._nodes),
|
|
404
|
+
outgoingEdges: new Map(Array.from(this._outgoingEdges.entries()).map(([id, set]) => [id, new Set(set)])),
|
|
405
|
+
incomingEdges: new Map(Array.from(this._incomingEdges.entries()).map(([id, set]) => [id, new Set(set)])),
|
|
406
|
+
metadata: this._metadata,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Create TaskGraphStore from TaskGraph interface
|
|
411
|
+
* @param graph - TaskGraph interface
|
|
412
|
+
* @returns New TaskGraphStore instance
|
|
413
|
+
*/
|
|
414
|
+
static fromInterface(graph) {
|
|
415
|
+
const store = new TaskGraphStore(graph.metadata);
|
|
416
|
+
// Add all nodes (convert interface to class instance)
|
|
417
|
+
for (const [id, node] of graph.nodes) {
|
|
418
|
+
const taskNode = TaskNode.fromJSON(node);
|
|
419
|
+
store._nodes.set(id, taskNode);
|
|
420
|
+
}
|
|
421
|
+
// Copy edge maps
|
|
422
|
+
for (const [id, set] of graph.outgoingEdges) {
|
|
423
|
+
store._outgoingEdges.set(id, new Set(set));
|
|
424
|
+
}
|
|
425
|
+
for (const [id, set] of graph.incomingEdges) {
|
|
426
|
+
store._incomingEdges.set(id, new Set(set));
|
|
427
|
+
}
|
|
428
|
+
return store;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Serialize graph to JSON-compatible object
|
|
432
|
+
* @returns JSON-serializable object
|
|
433
|
+
*/
|
|
434
|
+
toJSON() {
|
|
435
|
+
const nodes = {};
|
|
436
|
+
for (const [id, node] of this._nodes) {
|
|
437
|
+
nodes[id] = node;
|
|
438
|
+
}
|
|
439
|
+
const outgoingEdges = {};
|
|
440
|
+
for (const [id, set] of this._outgoingEdges) {
|
|
441
|
+
outgoingEdges[id] = Array.from(set);
|
|
442
|
+
}
|
|
443
|
+
const incomingEdges = {};
|
|
444
|
+
for (const [id, set] of this._incomingEdges) {
|
|
445
|
+
incomingEdges[id] = Array.from(set);
|
|
446
|
+
}
|
|
447
|
+
return {
|
|
448
|
+
nodes,
|
|
449
|
+
outgoingEdges,
|
|
450
|
+
incomingEdges,
|
|
451
|
+
metadata: this._metadata,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Deserialize graph from JSON object
|
|
456
|
+
* @param json - JSON object from toJSON()
|
|
457
|
+
* @returns New TaskGraphStore instance
|
|
458
|
+
*/
|
|
459
|
+
static fromJSON(json) {
|
|
460
|
+
const store = new TaskGraphStore(json.metadata);
|
|
461
|
+
// Add nodes
|
|
462
|
+
for (const [id, node] of Object.entries(json.nodes)) {
|
|
463
|
+
store._nodes.set(id, node);
|
|
464
|
+
}
|
|
465
|
+
// Add edges
|
|
466
|
+
for (const [id, targets] of Object.entries(json.outgoingEdges)) {
|
|
467
|
+
store._outgoingEdges.set(id, new Set(targets));
|
|
468
|
+
}
|
|
469
|
+
for (const [id, sources] of Object.entries(json.incomingEdges)) {
|
|
470
|
+
store._incomingEdges.set(id, new Set(sources));
|
|
471
|
+
}
|
|
472
|
+
return store;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IACzB,sDAAsD;IAC9C,MAAM,CAAwB;IAEtC,iDAAiD;IACzC,cAAc,CAA2B;IAEjD,mDAAmD;IAC3C,cAAc,CAA2B;IAEjD,qBAAqB;IACb,SAAS,CAAkB;IAEnC;;;OAGG;IACH,YAAY,QAA0B;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI;YAC3B,YAAY,EAAE,kBAAkB;YAChC,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAAkC;QAC5C,IAAI,CAAC,SAAS,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