code-graph-context 2.6.1 → 2.7.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/core/utils/graph-factory.js +1 -1
- package/dist/mcp/constants.js +75 -2
- package/dist/mcp/handlers/graph-generator.handler.js +1 -0
- package/dist/mcp/mcp.server.js +2 -2
- package/dist/mcp/service-init.js +1 -1
- package/dist/mcp/services/watch-manager.js +24 -10
- package/dist/mcp/tools/index.js +8 -0
- package/dist/mcp/tools/parse-typescript-project.tool.js +4 -3
- package/dist/mcp/tools/session-bookmark.tool.js +314 -0
- package/dist/mcp/tools/session-note.tool.js +343 -0
- package/dist/mcp/tools/swarm-claim-task.tool.js +4 -11
- package/dist/mcp/tools/swarm-cleanup.tool.js +25 -13
- package/dist/mcp/tools/swarm-complete-task.tool.js +8 -33
- package/dist/mcp/tools/swarm-constants.js +2 -1
- package/dist/mcp/tools/swarm-get-tasks.tool.js +5 -12
- package/dist/mcp/tools/swarm-orchestrate.tool.js +5 -3
- package/dist/mcp/tools/swarm-pheromone.tool.js +11 -4
- package/dist/mcp/tools/swarm-post-task.tool.js +5 -15
- package/dist/mcp/tools/swarm-sense.tool.js +9 -1
- package/dist/storage/neo4j/neo4j.service.js +9 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import { Neo4jService } from '../../storage/neo4j/neo4j.service.js';
|
|
7
7
|
import { TOOL_NAMES, TOOL_METADATA } from '../constants.js';
|
|
8
8
|
import { createErrorResponse, createSuccessResponse, resolveProjectIdOrError, debugLog } from '../utils.js';
|
|
9
|
-
import { TASK_PRIORITIES, TASK_TYPES, generateTaskId
|
|
9
|
+
import { TASK_PRIORITIES, TASK_TYPES, generateTaskId } from './swarm-constants.js';
|
|
10
10
|
/**
|
|
11
11
|
* Query to get node IDs for a file path (fallback when no nodeIds provided)
|
|
12
12
|
* Uses ENDS WITH for flexible matching (handles absolute vs relative paths)
|
|
@@ -135,10 +135,7 @@ export const createSwarmPostTaskTool = (server) => {
|
|
|
135
135
|
.default([])
|
|
136
136
|
.describe('Task IDs that must be completed before this task can start'),
|
|
137
137
|
createdBy: z.string().describe('Agent ID or identifier of who created this task'),
|
|
138
|
-
metadata: z
|
|
139
|
-
.record(z.unknown())
|
|
140
|
-
.optional()
|
|
141
|
-
.describe('Additional metadata (context, acceptance criteria, etc.)'),
|
|
138
|
+
metadata: z.record(z.unknown()).optional().describe('Additional metadata (context, acceptance criteria, etc.)'),
|
|
142
139
|
},
|
|
143
140
|
}, async ({ projectId, swarmId, title, description, type = 'implement', priority = 'normal', targetNodeIds = [], targetFilePaths = [], dependencies = [], createdBy, metadata, }) => {
|
|
144
141
|
const neo4jService = new Neo4jService();
|
|
@@ -162,10 +159,7 @@ export const createSwarmPostTaskTool = (server) => {
|
|
|
162
159
|
projectId: resolvedProjectId,
|
|
163
160
|
});
|
|
164
161
|
if (fileNodes.length > 0) {
|
|
165
|
-
resolvedNodeIds = [
|
|
166
|
-
...resolvedNodeIds,
|
|
167
|
-
...fileNodes.map((n) => n.id).filter(Boolean),
|
|
168
|
-
];
|
|
162
|
+
resolvedNodeIds = [...resolvedNodeIds, ...fileNodes.map((n) => n.id).filter(Boolean)];
|
|
169
163
|
}
|
|
170
164
|
}
|
|
171
165
|
}
|
|
@@ -198,9 +192,7 @@ export const createSwarmPostTaskTool = (server) => {
|
|
|
198
192
|
});
|
|
199
193
|
if (depCheck.length > 0) {
|
|
200
194
|
dependencyStatus = {
|
|
201
|
-
totalDeps: typeof depCheck[0].totalDeps === 'object'
|
|
202
|
-
? depCheck[0].totalDeps.toNumber()
|
|
203
|
-
: depCheck[0].totalDeps,
|
|
195
|
+
totalDeps: typeof depCheck[0].totalDeps === 'object' ? depCheck[0].totalDeps.toNumber() : depCheck[0].totalDeps,
|
|
204
196
|
incompleteDeps: typeof depCheck[0].incompleteDeps === 'object'
|
|
205
197
|
? depCheck[0].incompleteDeps.toNumber()
|
|
206
198
|
: depCheck[0].incompleteDeps,
|
|
@@ -232,9 +224,7 @@ export const createSwarmPostTaskTool = (server) => {
|
|
|
232
224
|
targetFilePaths: task.targetFilePaths,
|
|
233
225
|
dependencies: task.dependencies,
|
|
234
226
|
createdBy: task.createdBy,
|
|
235
|
-
createdAt: typeof task.createdAt === 'object'
|
|
236
|
-
? task.createdAt.toNumber()
|
|
237
|
-
: task.createdAt,
|
|
227
|
+
createdAt: typeof task.createdAt === 'object' ? task.createdAt.toNumber() : task.createdAt,
|
|
238
228
|
},
|
|
239
229
|
dependencyStatus: {
|
|
240
230
|
isBlocked,
|
|
@@ -21,6 +21,7 @@ const SENSE_PHEROMONES_QUERY = `
|
|
|
21
21
|
AND ($agentIds IS NULL OR size($agentIds) = 0 OR p.agentId IN $agentIds)
|
|
22
22
|
AND ($swarmId IS NULL OR p.swarmId = $swarmId)
|
|
23
23
|
AND ($excludeAgentId IS NULL OR p.agentId <> $excludeAgentId)
|
|
24
|
+
AND ($sessionId IS NULL OR p.sessionId = $sessionId)
|
|
24
25
|
|
|
25
26
|
// Calculate current intensity with exponential decay
|
|
26
27
|
WITH p,
|
|
@@ -49,6 +50,7 @@ const SENSE_PHEROMONES_QUERY = `
|
|
|
49
50
|
p.timestamp AS timestamp,
|
|
50
51
|
p.data AS data,
|
|
51
52
|
p.halfLife AS halfLifeMs,
|
|
53
|
+
p.sessionId AS sessionId,
|
|
52
54
|
CASE WHEN target IS NOT NULL THEN labels(target)[0] ELSE null END AS targetType,
|
|
53
55
|
CASE WHEN target IS NOT NULL THEN target.name ELSE null END AS targetName,
|
|
54
56
|
CASE WHEN target IS NOT NULL THEN target.filePath ELSE null END AS targetFilePath
|
|
@@ -108,6 +110,10 @@ export const createSwarmSenseTool = (server) => {
|
|
|
108
110
|
.string()
|
|
109
111
|
.optional()
|
|
110
112
|
.describe('Exclude pheromones from this agent ID (useful for seeing what OTHER agents are doing)'),
|
|
113
|
+
sessionId: z
|
|
114
|
+
.string()
|
|
115
|
+
.optional()
|
|
116
|
+
.describe('Filter pheromones by session ID. Use to recover context after compaction or session restart.'),
|
|
111
117
|
minIntensity: z
|
|
112
118
|
.number()
|
|
113
119
|
.min(0)
|
|
@@ -130,7 +136,7 @@ export const createSwarmSenseTool = (server) => {
|
|
|
130
136
|
.default(false)
|
|
131
137
|
.describe('Run cleanup of fully decayed pheromones (intensity < 0.01)'),
|
|
132
138
|
},
|
|
133
|
-
}, async ({ projectId, types, nodeIds, agentIds, swarmId, excludeAgentId, minIntensity = 0.3, limit = 50, includeStats = false, cleanup = false, }) => {
|
|
139
|
+
}, async ({ projectId, types, nodeIds, agentIds, swarmId, excludeAgentId, sessionId, minIntensity = 0.3, limit = 50, includeStats = false, cleanup = false, }) => {
|
|
134
140
|
const neo4jService = new Neo4jService();
|
|
135
141
|
// Resolve project ID
|
|
136
142
|
const projectResult = await resolveProjectIdOrError(projectId, neo4jService);
|
|
@@ -162,6 +168,7 @@ export const createSwarmSenseTool = (server) => {
|
|
|
162
168
|
agentIds: agentIds ?? null,
|
|
163
169
|
swarmId: swarmId ?? null,
|
|
164
170
|
excludeAgentId: excludeAgentId ?? null,
|
|
171
|
+
sessionId: sessionId ?? null,
|
|
165
172
|
minIntensity,
|
|
166
173
|
limit: Math.floor(limit),
|
|
167
174
|
});
|
|
@@ -177,6 +184,7 @@ export const createSwarmSenseTool = (server) => {
|
|
|
177
184
|
originalIntensity: p.originalIntensity,
|
|
178
185
|
agentId: p.agentId,
|
|
179
186
|
swarmId: p.swarmId,
|
|
187
|
+
sessionId: p.sessionId ?? null,
|
|
180
188
|
timestamp: ts,
|
|
181
189
|
age: ts ? `${Math.round((Date.now() - ts) / 1000)}s ago` : null,
|
|
182
190
|
data: p.data ? JSON.parse(p.data) : null,
|
|
@@ -138,7 +138,15 @@ export const QUERIES = {
|
|
|
138
138
|
`,
|
|
139
139
|
CREATE_EMBEDDED_VECTOR_INDEX: `
|
|
140
140
|
CREATE VECTOR INDEX embedded_nodes_idx IF NOT EXISTS
|
|
141
|
-
FOR (n:Embedded) ON (n.embedding)
|
|
141
|
+
FOR (n:Embedded) ON (n.embedding)
|
|
142
|
+
OPTIONS {indexConfig: {
|
|
143
|
+
\`vector.dimensions\`: 3072,
|
|
144
|
+
\`vector.similarity_function\`: 'cosine'
|
|
145
|
+
}}
|
|
146
|
+
`,
|
|
147
|
+
CREATE_SESSION_NOTES_VECTOR_INDEX: `
|
|
148
|
+
CREATE VECTOR INDEX session_notes_idx IF NOT EXISTS
|
|
149
|
+
FOR (n:SessionNote) ON (n.embedding)
|
|
142
150
|
OPTIONS {indexConfig: {
|
|
143
151
|
\`vector.dimensions\`: 3072,
|
|
144
152
|
\`vector.similarity_function\`: 'cosine'
|
package/package.json
CHANGED