@claude-flow/plugin-legal-contracts 3.0.0-alpha.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.
- package/README.md +391 -0
- package/dist/bridges/attention-bridge.d.ts +83 -0
- package/dist/bridges/attention-bridge.d.ts.map +1 -0
- package/dist/bridges/attention-bridge.js +348 -0
- package/dist/bridges/attention-bridge.js.map +1 -0
- package/dist/bridges/dag-bridge.d.ts +75 -0
- package/dist/bridges/dag-bridge.d.ts.map +1 -0
- package/dist/bridges/dag-bridge.js +423 -0
- package/dist/bridges/dag-bridge.js.map +1 -0
- package/dist/bridges/index.d.ts +8 -0
- package/dist/bridges/index.d.ts.map +1 -0
- package/dist/bridges/index.js +8 -0
- package/dist/bridges/index.js.map +1 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +149 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +93 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +966 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/types.d.ts +840 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +272 -0
- package/dist/types.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DAG Bridge for Obligation Tracking
|
|
3
|
+
*
|
|
4
|
+
* Provides directed acyclic graph operations for obligation dependency
|
|
5
|
+
* tracking using ruvector-dag-wasm for high-performance graph algorithms.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Obligation dependency graph construction
|
|
9
|
+
* - Critical path analysis
|
|
10
|
+
* - Topological sorting
|
|
11
|
+
* - Cycle detection
|
|
12
|
+
* - Float/slack calculation
|
|
13
|
+
*
|
|
14
|
+
* Based on ADR-034: Legal Contract Analysis Plugin
|
|
15
|
+
*
|
|
16
|
+
* @module v3/plugins/legal-contracts/bridges/dag-bridge
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* DAG Bridge Implementation
|
|
20
|
+
*/
|
|
21
|
+
export class DAGBridge {
|
|
22
|
+
// WASM module for future performance optimization (currently uses JS fallback)
|
|
23
|
+
wasmModule = null;
|
|
24
|
+
initialized = false;
|
|
25
|
+
/**
|
|
26
|
+
* Initialize the WASM module
|
|
27
|
+
*/
|
|
28
|
+
async initialize() {
|
|
29
|
+
if (this.initialized)
|
|
30
|
+
return;
|
|
31
|
+
try {
|
|
32
|
+
// Dynamic import of WASM module
|
|
33
|
+
// In production, this would load from @claude-flow/ruvector-upstream
|
|
34
|
+
this.wasmModule = await this.loadWasmModule();
|
|
35
|
+
this.initialized = true;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Fallback to pure JS implementation if WASM not available
|
|
39
|
+
console.warn('WASM DAG module not available, using JS fallback');
|
|
40
|
+
this.wasmModule = null;
|
|
41
|
+
this.initialized = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if initialized
|
|
46
|
+
*/
|
|
47
|
+
isInitialized() {
|
|
48
|
+
return this.initialized;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build obligation dependency graph
|
|
52
|
+
*/
|
|
53
|
+
async buildDependencyGraph(obligations) {
|
|
54
|
+
if (!this.initialized) {
|
|
55
|
+
await this.initialize();
|
|
56
|
+
}
|
|
57
|
+
// Create node lookup
|
|
58
|
+
const nodeMap = new Map();
|
|
59
|
+
obligations.forEach((obl, index) => {
|
|
60
|
+
nodeMap.set(obl.id, index);
|
|
61
|
+
});
|
|
62
|
+
// Build edges from dependencies
|
|
63
|
+
const edges = [];
|
|
64
|
+
for (const obligation of obligations) {
|
|
65
|
+
// depends_on edges (this obligation depends on others)
|
|
66
|
+
for (const depId of obligation.dependsOn) {
|
|
67
|
+
if (nodeMap.has(depId)) {
|
|
68
|
+
edges.push({
|
|
69
|
+
from: depId,
|
|
70
|
+
to: obligation.id,
|
|
71
|
+
type: 'depends_on',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// blocks edges (this obligation blocks others)
|
|
76
|
+
for (const blockId of obligation.blocks) {
|
|
77
|
+
if (nodeMap.has(blockId)) {
|
|
78
|
+
edges.push({
|
|
79
|
+
from: obligation.id,
|
|
80
|
+
to: blockId,
|
|
81
|
+
type: 'blocks',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Find critical path
|
|
87
|
+
const criticalPathIds = await this.findCriticalPathInternal(obligations, nodeMap, edges);
|
|
88
|
+
// Calculate dates and float
|
|
89
|
+
const { earliestStart, latestFinish, floatDays } = await this.calculateSchedule(obligations, nodeMap, edges);
|
|
90
|
+
// Build nodes
|
|
91
|
+
const nodes = obligations.map(obligation => {
|
|
92
|
+
return {
|
|
93
|
+
obligation,
|
|
94
|
+
dependencies: obligation.dependsOn,
|
|
95
|
+
dependents: obligation.blocks,
|
|
96
|
+
onCriticalPath: criticalPathIds.has(obligation.id),
|
|
97
|
+
earliestStart: earliestStart.get(obligation.id),
|
|
98
|
+
latestFinish: latestFinish.get(obligation.id),
|
|
99
|
+
floatDays: floatDays.get(obligation.id),
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
return { nodes, edges };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Find critical path through obligations
|
|
106
|
+
*/
|
|
107
|
+
async findCriticalPath(graph) {
|
|
108
|
+
if (!this.initialized) {
|
|
109
|
+
await this.initialize();
|
|
110
|
+
}
|
|
111
|
+
// Extract obligations from nodes
|
|
112
|
+
const obligations = graph.nodes.map(n => n.obligation);
|
|
113
|
+
const nodeMap = new Map();
|
|
114
|
+
obligations.forEach((obl, index) => {
|
|
115
|
+
nodeMap.set(obl.id, index);
|
|
116
|
+
});
|
|
117
|
+
const criticalIds = await this.findCriticalPathInternal(obligations, nodeMap, graph.edges);
|
|
118
|
+
// Return in topological order
|
|
119
|
+
const sorted = await this.topologicalSort(obligations);
|
|
120
|
+
return sorted
|
|
121
|
+
.filter(o => criticalIds.has(o.id))
|
|
122
|
+
.map(o => o.id);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Perform topological sort of obligations
|
|
126
|
+
*/
|
|
127
|
+
async topologicalSort(obligations) {
|
|
128
|
+
if (!this.initialized) {
|
|
129
|
+
await this.initialize();
|
|
130
|
+
}
|
|
131
|
+
if (obligations.length === 0) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
// Create node lookup
|
|
135
|
+
const nodeMap = new Map();
|
|
136
|
+
const indexMap = new Map();
|
|
137
|
+
obligations.forEach((obl, index) => {
|
|
138
|
+
nodeMap.set(obl.id, index);
|
|
139
|
+
indexMap.set(index, obl);
|
|
140
|
+
});
|
|
141
|
+
// Build adjacency list
|
|
142
|
+
const adj = obligations.map(() => []);
|
|
143
|
+
const inDegree = new Array(obligations.length).fill(0);
|
|
144
|
+
for (const obligation of obligations) {
|
|
145
|
+
const fromIndex = nodeMap.get(obligation.id);
|
|
146
|
+
if (fromIndex === undefined)
|
|
147
|
+
continue;
|
|
148
|
+
for (const depId of obligation.blocks) {
|
|
149
|
+
const toIndex = nodeMap.get(depId);
|
|
150
|
+
if (toIndex !== undefined) {
|
|
151
|
+
adj[fromIndex]?.push(toIndex);
|
|
152
|
+
inDegree[toIndex] = (inDegree[toIndex] ?? 0) + 1;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Kahn's algorithm
|
|
157
|
+
const queue = [];
|
|
158
|
+
for (let i = 0; i < inDegree.length; i++) {
|
|
159
|
+
if (inDegree[i] === 0) {
|
|
160
|
+
queue.push(i);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const sorted = [];
|
|
164
|
+
while (queue.length > 0) {
|
|
165
|
+
const current = queue.shift();
|
|
166
|
+
const obligation = indexMap.get(current);
|
|
167
|
+
if (obligation) {
|
|
168
|
+
sorted.push(obligation);
|
|
169
|
+
}
|
|
170
|
+
for (const neighbor of adj[current] ?? []) {
|
|
171
|
+
inDegree[neighbor] = (inDegree[neighbor] ?? 1) - 1;
|
|
172
|
+
if (inDegree[neighbor] === 0) {
|
|
173
|
+
queue.push(neighbor);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// If not all nodes are in sorted, there's a cycle
|
|
178
|
+
if (sorted.length !== obligations.length) {
|
|
179
|
+
console.warn('Cycle detected in obligation dependencies');
|
|
180
|
+
}
|
|
181
|
+
return sorted;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Detect cycles in dependency graph
|
|
185
|
+
*/
|
|
186
|
+
async detectCycles(graph) {
|
|
187
|
+
if (!this.initialized) {
|
|
188
|
+
await this.initialize();
|
|
189
|
+
}
|
|
190
|
+
const obligations = graph.nodes.map(n => n.obligation);
|
|
191
|
+
// Create node lookup
|
|
192
|
+
const nodeMap = new Map();
|
|
193
|
+
const indexMap = new Map();
|
|
194
|
+
obligations.forEach((obl, index) => {
|
|
195
|
+
nodeMap.set(obl.id, index);
|
|
196
|
+
indexMap.set(index, obl.id);
|
|
197
|
+
});
|
|
198
|
+
// Build adjacency list
|
|
199
|
+
const adj = obligations.map(() => []);
|
|
200
|
+
for (const edge of graph.edges) {
|
|
201
|
+
const fromIndex = nodeMap.get(edge.from);
|
|
202
|
+
const toIndex = nodeMap.get(edge.to);
|
|
203
|
+
if (fromIndex !== undefined && toIndex !== undefined) {
|
|
204
|
+
adj[fromIndex]?.push(toIndex);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Find cycles using DFS
|
|
208
|
+
const cycles = [];
|
|
209
|
+
const visited = new Array(obligations.length).fill(false);
|
|
210
|
+
const recStack = new Array(obligations.length).fill(false);
|
|
211
|
+
const parent = new Array(obligations.length).fill(-1);
|
|
212
|
+
const findCycle = (node, path) => {
|
|
213
|
+
visited[node] = true;
|
|
214
|
+
recStack[node] = true;
|
|
215
|
+
path.push(node);
|
|
216
|
+
for (const neighbor of adj[node] ?? []) {
|
|
217
|
+
if (!visited[neighbor]) {
|
|
218
|
+
parent[neighbor] = node;
|
|
219
|
+
findCycle(neighbor, [...path]);
|
|
220
|
+
}
|
|
221
|
+
else if (recStack[neighbor]) {
|
|
222
|
+
// Found cycle
|
|
223
|
+
const cycleStart = path.indexOf(neighbor);
|
|
224
|
+
if (cycleStart >= 0) {
|
|
225
|
+
const cycle = path.slice(cycleStart).map(i => indexMap.get(i) ?? '');
|
|
226
|
+
cycles.push(cycle);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
recStack[node] = false;
|
|
231
|
+
};
|
|
232
|
+
for (let i = 0; i < obligations.length; i++) {
|
|
233
|
+
if (!visited[i]) {
|
|
234
|
+
findCycle(i, []);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return cycles;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Calculate slack/float for each obligation
|
|
241
|
+
*/
|
|
242
|
+
async calculateFloat(graph, projectEnd) {
|
|
243
|
+
if (!this.initialized) {
|
|
244
|
+
await this.initialize();
|
|
245
|
+
}
|
|
246
|
+
const obligations = graph.nodes.map(n => n.obligation);
|
|
247
|
+
const nodeMap = new Map();
|
|
248
|
+
obligations.forEach((obl, index) => {
|
|
249
|
+
nodeMap.set(obl.id, index);
|
|
250
|
+
});
|
|
251
|
+
const { floatDays } = await this.calculateSchedule(obligations, nodeMap, graph.edges, projectEnd);
|
|
252
|
+
return floatDays;
|
|
253
|
+
}
|
|
254
|
+
// ============================================================================
|
|
255
|
+
// Private Helper Methods
|
|
256
|
+
// ============================================================================
|
|
257
|
+
/**
|
|
258
|
+
* Load WASM module dynamically
|
|
259
|
+
*/
|
|
260
|
+
async loadWasmModule() {
|
|
261
|
+
// In production, this would load from @claude-flow/ruvector-upstream
|
|
262
|
+
// For now, throw to trigger JS fallback
|
|
263
|
+
throw new Error('WASM module loading not implemented');
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Find critical path internally
|
|
267
|
+
*/
|
|
268
|
+
async findCriticalPathInternal(obligations, nodeMap, edges) {
|
|
269
|
+
const criticalIds = new Set();
|
|
270
|
+
// Build adjacency list and weights
|
|
271
|
+
const adj = new Map();
|
|
272
|
+
const weights = new Map();
|
|
273
|
+
for (let i = 0; i < obligations.length; i++) {
|
|
274
|
+
adj.set(i, []);
|
|
275
|
+
// Use estimated duration as weight (default 1 day)
|
|
276
|
+
const obligation = obligations[i];
|
|
277
|
+
weights.set(i, this.estimateDuration(obligation));
|
|
278
|
+
}
|
|
279
|
+
for (const edge of edges) {
|
|
280
|
+
const fromIndex = nodeMap.get(edge.from);
|
|
281
|
+
const toIndex = nodeMap.get(edge.to);
|
|
282
|
+
if (fromIndex !== undefined && toIndex !== undefined) {
|
|
283
|
+
adj.get(fromIndex)?.push(toIndex);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// Find longest path using dynamic programming
|
|
287
|
+
const sorted = await this.topologicalSort(obligations);
|
|
288
|
+
const dist = new Map();
|
|
289
|
+
const predecessor = new Map();
|
|
290
|
+
// Initialize distances
|
|
291
|
+
for (let i = 0; i < obligations.length; i++) {
|
|
292
|
+
dist.set(i, 0);
|
|
293
|
+
}
|
|
294
|
+
// Process in topological order
|
|
295
|
+
for (const obligation of sorted) {
|
|
296
|
+
const u = nodeMap.get(obligation.id);
|
|
297
|
+
if (u === undefined)
|
|
298
|
+
continue;
|
|
299
|
+
for (const v of adj.get(u) ?? []) {
|
|
300
|
+
const newDist = (dist.get(u) ?? 0) + (weights.get(v) ?? 1);
|
|
301
|
+
if (newDist > (dist.get(v) ?? 0)) {
|
|
302
|
+
dist.set(v, newDist);
|
|
303
|
+
predecessor.set(v, u);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// Find the end node with maximum distance
|
|
308
|
+
let maxDist = 0;
|
|
309
|
+
let endNode = 0;
|
|
310
|
+
for (const [node, d] of dist) {
|
|
311
|
+
if (d > maxDist) {
|
|
312
|
+
maxDist = d;
|
|
313
|
+
endNode = node;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// Trace back critical path
|
|
317
|
+
let current = endNode;
|
|
318
|
+
while (current !== undefined) {
|
|
319
|
+
const obligation = obligations[current];
|
|
320
|
+
if (obligation) {
|
|
321
|
+
criticalIds.add(obligation.id);
|
|
322
|
+
}
|
|
323
|
+
current = predecessor.get(current);
|
|
324
|
+
}
|
|
325
|
+
return criticalIds;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Calculate schedule (earliest start, latest finish, float)
|
|
329
|
+
*/
|
|
330
|
+
async calculateSchedule(obligations, _nodeMap, edges, projectEnd) {
|
|
331
|
+
const now = new Date();
|
|
332
|
+
const endDate = projectEnd ?? new Date(now.getTime() + 365 * 24 * 60 * 60 * 1000);
|
|
333
|
+
const earliestStart = new Map();
|
|
334
|
+
const latestFinish = new Map();
|
|
335
|
+
const floatDays = new Map();
|
|
336
|
+
// Build adjacency lists
|
|
337
|
+
const successors = new Map();
|
|
338
|
+
const predecessors = new Map();
|
|
339
|
+
for (const obligation of obligations) {
|
|
340
|
+
successors.set(obligation.id, []);
|
|
341
|
+
predecessors.set(obligation.id, []);
|
|
342
|
+
}
|
|
343
|
+
for (const edge of edges) {
|
|
344
|
+
successors.get(edge.from)?.push(edge.to);
|
|
345
|
+
predecessors.get(edge.to)?.push(edge.from);
|
|
346
|
+
}
|
|
347
|
+
// Forward pass - calculate earliest start
|
|
348
|
+
const sorted = await this.topologicalSort(obligations);
|
|
349
|
+
for (const obligation of sorted) {
|
|
350
|
+
const preds = predecessors.get(obligation.id) ?? [];
|
|
351
|
+
let earliest = obligation.dueDate ?? now;
|
|
352
|
+
for (const predId of preds) {
|
|
353
|
+
const predObl = obligations.find(o => o.id === predId);
|
|
354
|
+
const predEarliest = earliestStart.get(predId);
|
|
355
|
+
if (predEarliest && predObl) {
|
|
356
|
+
const predEnd = new Date(predEarliest.getTime() + this.estimateDuration(predObl) * 24 * 60 * 60 * 1000);
|
|
357
|
+
if (predEnd > earliest) {
|
|
358
|
+
earliest = predEnd;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
earliestStart.set(obligation.id, earliest);
|
|
363
|
+
}
|
|
364
|
+
// Backward pass - calculate latest finish
|
|
365
|
+
const reverseSorted = [...sorted].reverse();
|
|
366
|
+
for (const obligation of reverseSorted) {
|
|
367
|
+
const succs = successors.get(obligation.id) ?? [];
|
|
368
|
+
let latest = endDate;
|
|
369
|
+
for (const succId of succs) {
|
|
370
|
+
const succLatest = latestFinish.get(succId);
|
|
371
|
+
if (succLatest && succLatest < latest) {
|
|
372
|
+
latest = new Date(succLatest.getTime() - this.estimateDuration(obligation) * 24 * 60 * 60 * 1000);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
latestFinish.set(obligation.id, latest);
|
|
376
|
+
}
|
|
377
|
+
// Calculate float
|
|
378
|
+
for (const obligation of obligations) {
|
|
379
|
+
const es = earliestStart.get(obligation.id);
|
|
380
|
+
const lf = latestFinish.get(obligation.id);
|
|
381
|
+
if (es && lf) {
|
|
382
|
+
const duration = this.estimateDuration(obligation);
|
|
383
|
+
const latestStart = new Date(lf.getTime() - duration * 24 * 60 * 60 * 1000);
|
|
384
|
+
const floatMs = latestStart.getTime() - es.getTime();
|
|
385
|
+
floatDays.set(obligation.id, Math.max(0, floatMs / (24 * 60 * 60 * 1000)));
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
floatDays.set(obligation.id, 0);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return { earliestStart, latestFinish, floatDays };
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Estimate duration in days for an obligation
|
|
395
|
+
*/
|
|
396
|
+
estimateDuration(obligation) {
|
|
397
|
+
if (!obligation)
|
|
398
|
+
return 1;
|
|
399
|
+
// Default durations by type
|
|
400
|
+
const typeDurations = {
|
|
401
|
+
payment: 1,
|
|
402
|
+
delivery: 7,
|
|
403
|
+
notification: 3,
|
|
404
|
+
approval: 5,
|
|
405
|
+
compliance: 30,
|
|
406
|
+
reporting: 5,
|
|
407
|
+
confidentiality: 0,
|
|
408
|
+
performance: 14,
|
|
409
|
+
insurance: 7,
|
|
410
|
+
renewal: 30,
|
|
411
|
+
termination: 30,
|
|
412
|
+
};
|
|
413
|
+
return typeDurations[obligation.type] ?? 7;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Create and export default bridge instance
|
|
418
|
+
*/
|
|
419
|
+
export function createDAGBridge() {
|
|
420
|
+
return new DAGBridge();
|
|
421
|
+
}
|
|
422
|
+
export default DAGBridge;
|
|
423
|
+
//# sourceMappingURL=dag-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dag-bridge.js","sourceRoot":"","sources":["../../src/bridges/dag-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAgDH;;GAEG;AACH,MAAM,OAAO,SAAS;IACpB,+EAA+E;IACvE,UAAU,GAAyB,IAAI,CAAC;IACxC,WAAW,GAAG,KAAK,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAE7B,IAAI,CAAC;YACH,gCAAgC;YAChC,qEAAqE;YACrE,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC9C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;YAC3D,OAAO,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;YACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QA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AC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;IACpD,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,UAAkC;QACzD,IAAI,CAAC,UAAU;YAAE,OAAO,CAAC,CAAC;QAE1B,4BAA4B;QAC5B,MAAM,aAAa,GAA2B;YAC5C,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,CAAC;YACX,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,CAAC;YACX,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,CAAC;YACZ,eAAe,EAAE,CAAC;YAClB,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,CAAC;YACZ,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;SAChB,CAAC;QAEF,OAAO,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,SAAS,EAAE,CAAC;AACzB,CAAC;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legal Contracts Plugin - Bridges Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* @module @claude-flow/plugin-legal-contracts/bridges
|
|
5
|
+
*/
|
|
6
|
+
export { AttentionBridge, createAttentionBridge, } from './attention-bridge.js';
|
|
7
|
+
export { DAGBridge, createDAGBridge, } from './dag-bridge.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridges/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,SAAS,EACT,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legal Contracts Plugin - Bridges Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* @module @claude-flow/plugin-legal-contracts/bridges
|
|
5
|
+
*/
|
|
6
|
+
export { AttentionBridge, createAttentionBridge, } from './attention-bridge.js';
|
|
7
|
+
export { DAGBridge, createDAGBridge, } from './dag-bridge.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridges/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,SAAS,EACT,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legal Contracts Plugin for Claude Flow V3
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive legal contract analysis plugin combining hyperbolic embeddings
|
|
5
|
+
* for legal ontology navigation with fast vector search for clause similarity.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Clause extraction and classification
|
|
9
|
+
* - Risk assessment with severity scoring
|
|
10
|
+
* - Contract comparison with attention-based alignment
|
|
11
|
+
* - Obligation tracking with DAG analysis
|
|
12
|
+
* - Playbook matching for negotiation support
|
|
13
|
+
*
|
|
14
|
+
* Based on ADR-034: Legal Contract Analysis Plugin
|
|
15
|
+
*
|
|
16
|
+
* @module @claude-flow/plugin-legal-contracts
|
|
17
|
+
*/
|
|
18
|
+
export * from './types.js';
|
|
19
|
+
export { AttentionBridge, createAttentionBridge } from './bridges/attention-bridge.js';
|
|
20
|
+
export { DAGBridge, createDAGBridge } from './bridges/dag-bridge.js';
|
|
21
|
+
export { clauseExtractTool, riskAssessTool, contractCompareTool, obligationTrackTool, playbookMatchTool, legalContractsTools, toolHandlers, createToolContext, } from './mcp-tools.js';
|
|
22
|
+
export type { MCPTool, ToolContext, MCPToolResult } from './mcp-tools.js';
|
|
23
|
+
import type { LegalContractsConfig, IAttentionBridge, IDAGBridge } from './types.js';
|
|
24
|
+
/**
|
|
25
|
+
* Plugin metadata
|
|
26
|
+
*/
|
|
27
|
+
export declare const pluginMetadata: {
|
|
28
|
+
name: string;
|
|
29
|
+
version: string;
|
|
30
|
+
description: string;
|
|
31
|
+
author: string;
|
|
32
|
+
category: string;
|
|
33
|
+
keywords: string[];
|
|
34
|
+
homepage: string;
|
|
35
|
+
repository: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Plugin state
|
|
39
|
+
*/
|
|
40
|
+
export type PluginState = 'uninitialized' | 'initializing' | 'ready' | 'error' | 'shutdown';
|
|
41
|
+
/**
|
|
42
|
+
* Legal Contracts Plugin Class
|
|
43
|
+
*/
|
|
44
|
+
export declare class LegalContractsPlugin {
|
|
45
|
+
private state;
|
|
46
|
+
private config;
|
|
47
|
+
private attentionBridge;
|
|
48
|
+
private dagBridge;
|
|
49
|
+
constructor(config?: Partial<LegalContractsConfig>);
|
|
50
|
+
/**
|
|
51
|
+
* Get plugin metadata
|
|
52
|
+
*/
|
|
53
|
+
getMetadata(): {
|
|
54
|
+
name: string;
|
|
55
|
+
version: string;
|
|
56
|
+
description: string;
|
|
57
|
+
author: string;
|
|
58
|
+
category: string;
|
|
59
|
+
keywords: string[];
|
|
60
|
+
homepage: string;
|
|
61
|
+
repository: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Get current state
|
|
65
|
+
*/
|
|
66
|
+
getState(): PluginState;
|
|
67
|
+
/**
|
|
68
|
+
* Initialize the plugin
|
|
69
|
+
*/
|
|
70
|
+
initialize(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Shutdown the plugin
|
|
73
|
+
*/
|
|
74
|
+
shutdown(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Get MCP tools provided by this plugin
|
|
77
|
+
*/
|
|
78
|
+
getMCPTools(): import("./mcp-tools.js").MCPTool<unknown, unknown>[];
|
|
79
|
+
/**
|
|
80
|
+
* Get tool context for execution
|
|
81
|
+
*/
|
|
82
|
+
getToolContext(): {
|
|
83
|
+
get: <T>(key: string) => T | undefined;
|
|
84
|
+
set: <T>(key: string, value: T) => void;
|
|
85
|
+
bridges: {
|
|
86
|
+
attention: IAttentionBridge;
|
|
87
|
+
dag: IDAGBridge;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Get configuration
|
|
92
|
+
*/
|
|
93
|
+
getConfig(): LegalContractsConfig;
|
|
94
|
+
/**
|
|
95
|
+
* Update configuration
|
|
96
|
+
*/
|
|
97
|
+
updateConfig(config: Partial<LegalContractsConfig>): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create plugin instance
|
|
101
|
+
*/
|
|
102
|
+
export declare function createPlugin(config?: Partial<LegalContractsConfig>): LegalContractsPlugin;
|
|
103
|
+
/**
|
|
104
|
+
* Default export
|
|
105
|
+
*/
|
|
106
|
+
export default LegalContractsPlugin;
|
|
107
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE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