@papyruslabsai/seshat-mcp 0.9.0 → 0.11.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/dist/index.js +2 -2
- package/dist/tools/diff.js +15 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -542,7 +542,7 @@ const TOOLS = [
|
|
|
542
542
|
},
|
|
543
543
|
{
|
|
544
544
|
name: 'conflict_matrix',
|
|
545
|
-
description: 'Given multiple tasks, classify every task pair into conflict tiers to determine parallelization safety. Tier 1 (different files, safe), Tier 2 (same file, different symbols, safe), Tier 3 (same symbol,
|
|
545
|
+
description: 'Given multiple tasks, classify every task pair into conflict tiers to determine parallelization safety. Tier 1 (different files, safe), Tier 2 (same file, different symbols, safe via surgical splicing), Tier 3 (same symbol, MUST sequence to maintain splice integrity). Returns a pairwise matrix and a suggested execution plan.',
|
|
546
546
|
inputSchema: {
|
|
547
547
|
type: 'object',
|
|
548
548
|
properties: {
|
|
@@ -564,7 +564,7 @@ const TOOLS = [
|
|
|
564
564
|
dimensions: {
|
|
565
565
|
type: 'array',
|
|
566
566
|
items: { type: 'string' },
|
|
567
|
-
description: 'Optional: Code scopes this task will modify (
|
|
567
|
+
description: 'Optional: Code scopes this task will modify. (Legacy support, no longer required for Tier 2 safety).',
|
|
568
568
|
},
|
|
569
569
|
expand_blast_radius: {
|
|
570
570
|
type: 'boolean',
|
package/dist/tools/diff.js
CHANGED
|
@@ -261,25 +261,8 @@ export async function diffBundle(args) {
|
|
|
261
261
|
}
|
|
262
262
|
return result;
|
|
263
263
|
}
|
|
264
|
-
// ─── Conflict Tier Classification ─────────────────────────────────
|
|
265
|
-
const ZONE_1 = new Set(['edges', 'imports']); // Header / Dependencies
|
|
266
|
-
const ZONE_2 = new Set(['struct', 'constraints', 'traits', 'ownership']); // Signature / Modifiers
|
|
267
|
-
const ZONE_3 = new Set(['semantics', 'data', 'runtime']); // Logic / Implementation
|
|
268
|
-
function getZones(scopes) {
|
|
269
|
-
const zones = new Set();
|
|
270
|
-
for (const s of scopes) {
|
|
271
|
-
const lower = s.toLowerCase();
|
|
272
|
-
if (ZONE_1.has(lower))
|
|
273
|
-
zones.add(1);
|
|
274
|
-
if (ZONE_2.has(lower))
|
|
275
|
-
zones.add(2);
|
|
276
|
-
if (ZONE_3.has(lower))
|
|
277
|
-
zones.add(3);
|
|
278
|
-
}
|
|
279
|
-
return zones;
|
|
280
|
-
}
|
|
281
264
|
function classifyConflictTier(taskA, taskB) {
|
|
282
|
-
// Check symbol overlap
|
|
265
|
+
// Check symbol overlap → Tier 3 (MUST sequence)
|
|
283
266
|
const sharedEntities = [];
|
|
284
267
|
for (const id of taskA.entityIds) {
|
|
285
268
|
if (taskB.entityIds.has(id)) {
|
|
@@ -287,27 +270,9 @@ function classifyConflictTier(taskA, taskB) {
|
|
|
287
270
|
}
|
|
288
271
|
}
|
|
289
272
|
if (sharedEntities.length > 0) {
|
|
290
|
-
// Both touch same symbol. Check scopes to see if we can downgrade from Tier 4 (Sequential) to Tier 3 (Parallelizable Orthogonal)
|
|
291
|
-
if (taskA.dimensions.size > 0 && taskB.dimensions.size > 0) {
|
|
292
|
-
const zonesA = getZones(taskA.dimensions);
|
|
293
|
-
const zonesB = getZones(taskB.dimensions);
|
|
294
|
-
let spatialCollision = false;
|
|
295
|
-
for (const z of zonesA) {
|
|
296
|
-
if (zonesB.has(z))
|
|
297
|
-
spatialCollision = true;
|
|
298
|
-
}
|
|
299
|
-
if (!spatialCollision) {
|
|
300
|
-
return {
|
|
301
|
-
tier: 3,
|
|
302
|
-
reason: `${sharedEntities.length} shared symbols, but orthogonal change scopes (Tier 3) — safe to parallelize`,
|
|
303
|
-
sharedFiles: [],
|
|
304
|
-
sharedEntities,
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
273
|
return {
|
|
309
|
-
tier:
|
|
310
|
-
reason: `${sharedEntities.length} shared symbols
|
|
274
|
+
tier: 3,
|
|
275
|
+
reason: `${sharedEntities.length} shared symbols — MUST sequence to maintain surgical splice integrity`,
|
|
311
276
|
sharedFiles: [],
|
|
312
277
|
sharedEntities,
|
|
313
278
|
};
|
|
@@ -327,26 +292,27 @@ function classifyConflictTier(taskA, taskB) {
|
|
|
327
292
|
sharedEntities: [],
|
|
328
293
|
};
|
|
329
294
|
}
|
|
295
|
+
// Same file, different symbols → Tier 2 (Safe via Surgical Splicer)
|
|
330
296
|
return {
|
|
331
297
|
tier: 2,
|
|
332
|
-
reason: `${sharedFiles.length} shared files but different symbols — safe to parallelize`,
|
|
298
|
+
reason: `${sharedFiles.length} shared files but different symbols — safe to parallelize via surgical splicing`,
|
|
333
299
|
sharedFiles,
|
|
334
300
|
sharedEntities: [],
|
|
335
301
|
};
|
|
336
302
|
}
|
|
337
303
|
// ─── Execution Plan Builder ───────────────────────────────────────
|
|
338
304
|
/**
|
|
339
|
-
* Build execution plan from tier-
|
|
340
|
-
* Tasks with no tier-
|
|
341
|
-
* Tasks in the same tier-
|
|
305
|
+
* Build execution plan from tier-3 conflict graph using connected components.
|
|
306
|
+
* Tasks with no tier-3 edges to each other run in parallel.
|
|
307
|
+
* Tasks in the same tier-3 component run sequentially.
|
|
342
308
|
*/
|
|
343
|
-
function buildExecutionPlan(taskIds,
|
|
344
|
-
// Build adjacency list for tier-
|
|
309
|
+
function buildExecutionPlan(taskIds, tier3Edges) {
|
|
310
|
+
// Build adjacency list for tier-3 conflicts
|
|
345
311
|
const adj = new Map();
|
|
346
312
|
for (const id of taskIds) {
|
|
347
313
|
adj.set(id, new Set());
|
|
348
314
|
}
|
|
349
|
-
for (const [a, b] of
|
|
315
|
+
for (const [a, b] of tier3Edges) {
|
|
350
316
|
adj.get(a)?.add(b);
|
|
351
317
|
adj.get(b)?.add(a);
|
|
352
318
|
}
|
|
@@ -454,7 +420,7 @@ export function conflictMatrix(args) {
|
|
|
454
420
|
}
|
|
455
421
|
// Pairwise comparison
|
|
456
422
|
const matrix = [];
|
|
457
|
-
const
|
|
423
|
+
const tier3Edges = [];
|
|
458
424
|
for (let i = 0; i < resolvedTasks.length; i++) {
|
|
459
425
|
for (let j = i + 1; j < resolvedTasks.length; j++) {
|
|
460
426
|
const taskA = resolvedTasks[i];
|
|
@@ -471,14 +437,14 @@ export function conflictMatrix(args) {
|
|
|
471
437
|
if (result.sharedEntities.length > 0)
|
|
472
438
|
entry.sharedEntities = result.sharedEntities;
|
|
473
439
|
matrix.push(entry);
|
|
474
|
-
if (result.tier ===
|
|
475
|
-
|
|
440
|
+
if (result.tier === 3) {
|
|
441
|
+
tier3Edges.push([taskA.id, taskB.id]);
|
|
476
442
|
}
|
|
477
443
|
}
|
|
478
444
|
}
|
|
479
445
|
// Build execution plan
|
|
480
446
|
const taskIds = resolvedTasks.map(t => t.id);
|
|
481
|
-
const executionPlan = buildExecutionPlan(taskIds,
|
|
447
|
+
const executionPlan = buildExecutionPlan(taskIds, tier3Edges);
|
|
482
448
|
const result = {
|
|
483
449
|
taskCount: tasks.length,
|
|
484
450
|
matrix,
|
package/package.json
CHANGED