mindgraph-mcp 0.14.8 → 0.14.9
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/cli.js +48 -4
- package/dist/index.js +47 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2651,6 +2651,38 @@ async function handleCommit(client2, args) {
|
|
|
2651
2651
|
return err3(`Unknown commit action: ${action}`);
|
|
2652
2652
|
}
|
|
2653
2653
|
}
|
|
2654
|
+
async function repositoryScopeUidsForTask(client2, options) {
|
|
2655
|
+
const scopeUids = [...new Set(options.scopeUids ?? [])];
|
|
2656
|
+
const cwd = options.invocationContext?.cwd;
|
|
2657
|
+
const repoId = options.invocationContext?.repoId;
|
|
2658
|
+
if (!options.repo && !cwd && !repoId) {
|
|
2659
|
+
return options.scopeUids;
|
|
2660
|
+
}
|
|
2661
|
+
const agentId = options.agentId ?? process.env.MINDGRAPH_AGENT_ID ?? "mcp";
|
|
2662
|
+
const fallbackSpaceUid = options.repoSpaceUid ?? `space:agent:${agentId}`;
|
|
2663
|
+
const env = { ...process.env };
|
|
2664
|
+
if (!options.repo && repoId) {
|
|
2665
|
+
env.MINDGRAPH_REPO_ID = repoId;
|
|
2666
|
+
}
|
|
2667
|
+
const adapter = new CodegraphAdapter({
|
|
2668
|
+
cwd: cwd ?? process.cwd(),
|
|
2669
|
+
env
|
|
2670
|
+
});
|
|
2671
|
+
const repository = await adapter.resolveRepository(options.repo, fallbackSpaceUid);
|
|
2672
|
+
const anchored = await anchorRepository(
|
|
2673
|
+
client2,
|
|
2674
|
+
repository,
|
|
2675
|
+
repository.spaceUid ?? fallbackSpaceUid,
|
|
2676
|
+
agentId
|
|
2677
|
+
);
|
|
2678
|
+
if (!anchored.uid) {
|
|
2679
|
+
throw new Error(
|
|
2680
|
+
`repository scope ${repository.repoId} could not be materialized (${anchored.status ?? "missing uid"})`
|
|
2681
|
+
);
|
|
2682
|
+
}
|
|
2683
|
+
scopeUids.push(anchored.uid);
|
|
2684
|
+
return [...new Set(scopeUids)];
|
|
2685
|
+
}
|
|
2654
2686
|
async function handlePlan(client2, args) {
|
|
2655
2687
|
const {
|
|
2656
2688
|
action,
|
|
@@ -2681,6 +2713,9 @@ async function handlePlan(client2, args) {
|
|
|
2681
2713
|
release_lease,
|
|
2682
2714
|
override_reason,
|
|
2683
2715
|
scope_uids,
|
|
2716
|
+
repo,
|
|
2717
|
+
repo_space_uid,
|
|
2718
|
+
invocation_context,
|
|
2684
2719
|
limit,
|
|
2685
2720
|
confidence,
|
|
2686
2721
|
salience,
|
|
@@ -2710,7 +2745,14 @@ async function handlePlan(client2, args) {
|
|
|
2710
2745
|
case "checkpoint_iteration":
|
|
2711
2746
|
case "block_task":
|
|
2712
2747
|
case "complete_task":
|
|
2713
|
-
case "abandon_iteration":
|
|
2748
|
+
case "abandon_iteration": {
|
|
2749
|
+
const resolvedScopeUids = action === "create_task" ? await repositoryScopeUidsForTask(client2, {
|
|
2750
|
+
scopeUids: scope_uids,
|
|
2751
|
+
repo,
|
|
2752
|
+
repoSpaceUid: repo_space_uid,
|
|
2753
|
+
invocationContext: invocation_context,
|
|
2754
|
+
agentId: agent_id
|
|
2755
|
+
}) : scope_uids;
|
|
2714
2756
|
return ok3(
|
|
2715
2757
|
await client2.plan({
|
|
2716
2758
|
action,
|
|
@@ -2738,7 +2780,7 @@ async function handlePlan(client2, args) {
|
|
|
2738
2780
|
allow_takeover,
|
|
2739
2781
|
release_lease,
|
|
2740
2782
|
override_reason,
|
|
2741
|
-
scope_uids,
|
|
2783
|
+
scope_uids: resolvedScopeUids,
|
|
2742
2784
|
limit,
|
|
2743
2785
|
input_snapshot,
|
|
2744
2786
|
output_snapshot,
|
|
@@ -2753,6 +2795,7 @@ async function handlePlan(client2, args) {
|
|
|
2753
2795
|
agent_id
|
|
2754
2796
|
})
|
|
2755
2797
|
);
|
|
2798
|
+
}
|
|
2756
2799
|
// Execution tracking
|
|
2757
2800
|
case "start_execution":
|
|
2758
2801
|
return ok3(
|
|
@@ -3310,6 +3353,7 @@ var init_tools = __esm({
|
|
|
3310
3353
|
"use strict";
|
|
3311
3354
|
init_error_detail();
|
|
3312
3355
|
init_code_tool();
|
|
3356
|
+
init_codegraph();
|
|
3313
3357
|
init_sync_tool();
|
|
3314
3358
|
TOOLS = [
|
|
3315
3359
|
{
|
|
@@ -3774,7 +3818,7 @@ var init_tools = __esm({
|
|
|
3774
3818
|
scope_uids: {
|
|
3775
3819
|
type: "array",
|
|
3776
3820
|
items: { type: "string" },
|
|
3777
|
-
description: "
|
|
3821
|
+
description: "Required target UIDs for create_task and ordinary target UIDs that bound deterministic resume selection"
|
|
3778
3822
|
},
|
|
3779
3823
|
limit: {
|
|
3780
3824
|
type: "number",
|
|
@@ -4917,7 +4961,7 @@ Capture knowledge when the user shares something worth remembering:
|
|
|
4917
4961
|
server = new import_server.Server(
|
|
4918
4962
|
{
|
|
4919
4963
|
name: "mindgraph",
|
|
4920
|
-
version: "0.14.
|
|
4964
|
+
version: "0.14.9"
|
|
4921
4965
|
},
|
|
4922
4966
|
{
|
|
4923
4967
|
capabilities: {
|
package/dist/index.js
CHANGED
|
@@ -1889,7 +1889,7 @@ var TOOLS = [
|
|
|
1889
1889
|
scope_uids: {
|
|
1890
1890
|
type: "array",
|
|
1891
1891
|
items: { type: "string" },
|
|
1892
|
-
description: "
|
|
1892
|
+
description: "Required target UIDs for create_task and ordinary target UIDs that bound deterministic resume selection"
|
|
1893
1893
|
},
|
|
1894
1894
|
limit: {
|
|
1895
1895
|
type: "number",
|
|
@@ -2687,6 +2687,38 @@ async function handleCommit(client2, args) {
|
|
|
2687
2687
|
return err3(`Unknown commit action: ${action}`);
|
|
2688
2688
|
}
|
|
2689
2689
|
}
|
|
2690
|
+
async function repositoryScopeUidsForTask(client2, options) {
|
|
2691
|
+
const scopeUids = [...new Set(options.scopeUids ?? [])];
|
|
2692
|
+
const cwd = options.invocationContext?.cwd;
|
|
2693
|
+
const repoId = options.invocationContext?.repoId;
|
|
2694
|
+
if (!options.repo && !cwd && !repoId) {
|
|
2695
|
+
return options.scopeUids;
|
|
2696
|
+
}
|
|
2697
|
+
const agentId = options.agentId ?? process.env.MINDGRAPH_AGENT_ID ?? "mcp";
|
|
2698
|
+
const fallbackSpaceUid = options.repoSpaceUid ?? `space:agent:${agentId}`;
|
|
2699
|
+
const env = { ...process.env };
|
|
2700
|
+
if (!options.repo && repoId) {
|
|
2701
|
+
env.MINDGRAPH_REPO_ID = repoId;
|
|
2702
|
+
}
|
|
2703
|
+
const adapter = new CodegraphAdapter({
|
|
2704
|
+
cwd: cwd ?? process.cwd(),
|
|
2705
|
+
env
|
|
2706
|
+
});
|
|
2707
|
+
const repository = await adapter.resolveRepository(options.repo, fallbackSpaceUid);
|
|
2708
|
+
const anchored = await anchorRepository(
|
|
2709
|
+
client2,
|
|
2710
|
+
repository,
|
|
2711
|
+
repository.spaceUid ?? fallbackSpaceUid,
|
|
2712
|
+
agentId
|
|
2713
|
+
);
|
|
2714
|
+
if (!anchored.uid) {
|
|
2715
|
+
throw new Error(
|
|
2716
|
+
`repository scope ${repository.repoId} could not be materialized (${anchored.status ?? "missing uid"})`
|
|
2717
|
+
);
|
|
2718
|
+
}
|
|
2719
|
+
scopeUids.push(anchored.uid);
|
|
2720
|
+
return [...new Set(scopeUids)];
|
|
2721
|
+
}
|
|
2690
2722
|
async function handlePlan(client2, args) {
|
|
2691
2723
|
const {
|
|
2692
2724
|
action,
|
|
@@ -2717,6 +2749,9 @@ async function handlePlan(client2, args) {
|
|
|
2717
2749
|
release_lease,
|
|
2718
2750
|
override_reason,
|
|
2719
2751
|
scope_uids,
|
|
2752
|
+
repo,
|
|
2753
|
+
repo_space_uid,
|
|
2754
|
+
invocation_context,
|
|
2720
2755
|
limit,
|
|
2721
2756
|
confidence,
|
|
2722
2757
|
salience,
|
|
@@ -2746,7 +2781,14 @@ async function handlePlan(client2, args) {
|
|
|
2746
2781
|
case "checkpoint_iteration":
|
|
2747
2782
|
case "block_task":
|
|
2748
2783
|
case "complete_task":
|
|
2749
|
-
case "abandon_iteration":
|
|
2784
|
+
case "abandon_iteration": {
|
|
2785
|
+
const resolvedScopeUids = action === "create_task" ? await repositoryScopeUidsForTask(client2, {
|
|
2786
|
+
scopeUids: scope_uids,
|
|
2787
|
+
repo,
|
|
2788
|
+
repoSpaceUid: repo_space_uid,
|
|
2789
|
+
invocationContext: invocation_context,
|
|
2790
|
+
agentId: agent_id
|
|
2791
|
+
}) : scope_uids;
|
|
2750
2792
|
return ok3(
|
|
2751
2793
|
await client2.plan({
|
|
2752
2794
|
action,
|
|
@@ -2774,7 +2816,7 @@ async function handlePlan(client2, args) {
|
|
|
2774
2816
|
allow_takeover,
|
|
2775
2817
|
release_lease,
|
|
2776
2818
|
override_reason,
|
|
2777
|
-
scope_uids,
|
|
2819
|
+
scope_uids: resolvedScopeUids,
|
|
2778
2820
|
limit,
|
|
2779
2821
|
input_snapshot,
|
|
2780
2822
|
output_snapshot,
|
|
@@ -2789,6 +2831,7 @@ async function handlePlan(client2, args) {
|
|
|
2789
2831
|
agent_id
|
|
2790
2832
|
})
|
|
2791
2833
|
);
|
|
2834
|
+
}
|
|
2792
2835
|
// Execution tracking
|
|
2793
2836
|
case "start_execution":
|
|
2794
2837
|
return ok3(
|
|
@@ -3955,7 +3998,7 @@ if (PROFILE === "coding") {
|
|
|
3955
3998
|
var server = new import_server.Server(
|
|
3956
3999
|
{
|
|
3957
4000
|
name: "mindgraph",
|
|
3958
|
-
version: "0.14.
|
|
4001
|
+
version: "0.14.9"
|
|
3959
4002
|
},
|
|
3960
4003
|
{
|
|
3961
4004
|
capabilities: {
|