@virsanghavi/axis-server 1.1.2 → 1.2.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/mcp-server.mjs +32 -0
- package/package.json +1 -1
package/dist/mcp-server.mjs
CHANGED
|
@@ -827,6 +827,7 @@ var NerveCenter = class {
|
|
|
827
827
|
delete this.state.locks[filePath];
|
|
828
828
|
await this.saveState();
|
|
829
829
|
}
|
|
830
|
+
this.logLockEvent("FORCE_UNLOCKED", filePath, "admin", void 0, reason);
|
|
830
831
|
await this.appendToNotepad(`
|
|
831
832
|
- [FORCE UNLOCK] ${filePath} unlocked by admin. Reason: ${reason}`);
|
|
832
833
|
return `File ${filePath} has been forcibly unlocked.`;
|
|
@@ -849,6 +850,31 @@ ${lockSummary || "No active locks."}
|
|
|
849
850
|
## Live Notepad
|
|
850
851
|
${notepad}`;
|
|
851
852
|
}
|
|
853
|
+
// --- Lock Event Logging ---
|
|
854
|
+
async logLockEvent(eventType, filePath, requestingAgent, blockingAgent, intent) {
|
|
855
|
+
try {
|
|
856
|
+
if (this.contextManager.apiUrl) {
|
|
857
|
+
await this.callCoordination("lock-events", "POST", {
|
|
858
|
+
eventType,
|
|
859
|
+
filePath,
|
|
860
|
+
requestingAgent,
|
|
861
|
+
blockingAgent: blockingAgent || null,
|
|
862
|
+
intent: intent || null
|
|
863
|
+
});
|
|
864
|
+
} else if (this.useSupabase && this.supabase && this._projectId) {
|
|
865
|
+
await this.supabase.from("lock_events").insert({
|
|
866
|
+
project_id: this._projectId,
|
|
867
|
+
event_type: eventType,
|
|
868
|
+
file_path: filePath,
|
|
869
|
+
requesting_agent: requestingAgent,
|
|
870
|
+
blocking_agent: blockingAgent || null,
|
|
871
|
+
intent: intent || null
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
} catch (e) {
|
|
875
|
+
logger.warn(`[logLockEvent] Failed to log ${eventType} event: ${e.message}`);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
852
878
|
// --- Decision & Orchestration ---
|
|
853
879
|
async proposeFileAccess(agentId, filePath, intent, userPrompt) {
|
|
854
880
|
return await this.mutex.runExclusive(async () => {
|
|
@@ -864,6 +890,7 @@ ${notepad}`;
|
|
|
864
890
|
});
|
|
865
891
|
if (result.status === "DENIED") {
|
|
866
892
|
logger.info(`[proposeFileAccess] DENIED by server: ${result.message}`);
|
|
893
|
+
this.logLockEvent("BLOCKED", filePath, agentId, result.current_lock?.agent_id, intent);
|
|
867
894
|
return {
|
|
868
895
|
status: "REQUIRES_ORCHESTRATION",
|
|
869
896
|
message: result.message || `File '${filePath}' is locked by another agent`,
|
|
@@ -871,6 +898,7 @@ ${notepad}`;
|
|
|
871
898
|
};
|
|
872
899
|
}
|
|
873
900
|
logger.info(`[proposeFileAccess] GRANTED by server`);
|
|
901
|
+
this.logLockEvent("GRANTED", filePath, agentId, void 0, intent);
|
|
874
902
|
await this.appendToNotepad(`
|
|
875
903
|
- [LOCK] ${agentId} locked ${filePath}
|
|
876
904
|
Intent: ${intent}`);
|
|
@@ -900,6 +928,7 @@ ${notepad}`;
|
|
|
900
928
|
if (error) throw error;
|
|
901
929
|
const row = Array.isArray(data) ? data[0] : data;
|
|
902
930
|
if (row && row.status === "DENIED") {
|
|
931
|
+
this.logLockEvent("BLOCKED", filePath, agentId, row.owner_id, intent);
|
|
903
932
|
return {
|
|
904
933
|
status: "REQUIRES_ORCHESTRATION",
|
|
905
934
|
message: `Conflict: File '${filePath}' is locked by '${row.owner_id}'`,
|
|
@@ -911,6 +940,7 @@ ${notepad}`;
|
|
|
911
940
|
}
|
|
912
941
|
};
|
|
913
942
|
}
|
|
943
|
+
this.logLockEvent("GRANTED", filePath, agentId, void 0, intent);
|
|
914
944
|
await this.appendToNotepad(`
|
|
915
945
|
- [LOCK] ${agentId} locked ${filePath}
|
|
916
946
|
Intent: ${intent}`);
|
|
@@ -923,6 +953,7 @@ ${notepad}`;
|
|
|
923
953
|
if (existing) {
|
|
924
954
|
const isStale = Date.now() - existing.timestamp > this.lockTimeout;
|
|
925
955
|
if (!isStale && existing.agentId !== agentId) {
|
|
956
|
+
this.logLockEvent("BLOCKED", filePath, agentId, existing.agentId, intent);
|
|
926
957
|
return {
|
|
927
958
|
status: "REQUIRES_ORCHESTRATION",
|
|
928
959
|
message: `Conflict: File '${filePath}' is currently locked by '${existing.agentId}'`,
|
|
@@ -932,6 +963,7 @@ ${notepad}`;
|
|
|
932
963
|
}
|
|
933
964
|
this.state.locks[filePath] = { agentId, filePath, intent, userPrompt, timestamp: Date.now() };
|
|
934
965
|
await this.saveState();
|
|
966
|
+
this.logLockEvent("GRANTED", filePath, agentId, void 0, intent);
|
|
935
967
|
await this.appendToNotepad(`
|
|
936
968
|
- [LOCK] ${agentId} locked ${filePath}
|
|
937
969
|
Intent: ${intent}`);
|