autonomous-flow-daemon 1.6.0 → 1.9.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/CHANGELOG.md +85 -85
- package/LICENSE +21 -21
- package/README-ko.md +282 -0
- package/README.md +282 -266
- package/mcp-config.json +10 -10
- package/package.json +4 -2
- package/src/adapters/index.ts +370 -370
- package/src/cli.ts +162 -127
- package/src/commands/benchmark.ts +187 -187
- package/src/commands/correlate.ts +180 -0
- package/src/commands/dashboard.ts +404 -0
- package/src/commands/evolution.ts +84 -1
- package/src/commands/fix.ts +158 -158
- package/src/commands/lang.ts +41 -41
- package/src/commands/plugin.ts +110 -0
- package/src/commands/restart.ts +14 -14
- package/src/commands/score.ts +276 -276
- package/src/commands/start.ts +155 -155
- package/src/commands/status.ts +157 -157
- package/src/commands/stop.ts +68 -68
- package/src/commands/suggest.ts +211 -0
- package/src/commands/sync.ts +329 -16
- package/src/constants.ts +32 -32
- package/src/core/boast.ts +280 -280
- package/src/core/config.ts +49 -49
- package/src/core/correlation-engine.ts +265 -0
- package/src/core/db.ts +145 -117
- package/src/core/discovery.ts +65 -65
- package/src/core/federation.ts +129 -0
- package/src/core/hologram/engine.ts +71 -71
- package/src/core/hologram/fallback.ts +11 -11
- package/src/core/hologram/go-extractor.ts +203 -0
- package/src/core/hologram/incremental.ts +227 -227
- package/src/core/hologram/py-extractor.ts +132 -132
- package/src/core/hologram/rust-extractor.ts +244 -0
- package/src/core/hologram/ts-extractor.ts +406 -320
- package/src/core/hologram/types.ts +27 -25
- package/src/core/hologram.ts +73 -71
- package/src/core/i18n/messages.ts +309 -309
- package/src/core/locale.ts +88 -88
- package/src/core/log-rotate.ts +33 -33
- package/src/core/log-utils.ts +38 -38
- package/src/core/lru-map.ts +61 -61
- package/src/core/notify.ts +74 -74
- package/src/core/plugin-manager.ts +225 -0
- package/src/core/rule-suggestion.ts +127 -0
- package/src/core/validator-generator.ts +224 -0
- package/src/core/workspace.ts +28 -28
- package/src/daemon/client.ts +78 -65
- package/src/daemon/event-batcher.ts +108 -108
- package/src/daemon/guards.ts +13 -13
- package/src/daemon/http-routes.ts +376 -293
- package/src/daemon/mcp-handler.ts +575 -270
- package/src/daemon/mcp-subscriptions.ts +81 -0
- package/src/daemon/mesh.ts +51 -0
- package/src/daemon/server.ts +655 -590
- package/src/daemon/types.ts +121 -100
- package/src/daemon/workspace-map.ts +104 -92
- package/src/platform.ts +60 -60
- package/src/version.ts +15 -15
- package/README.ko.md +0 -266
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Subscription Manager — v1.9.0 MCP Phase 3
|
|
3
|
+
*
|
|
4
|
+
* MCP 2024-11-05 스펙의 `resources/subscribe` 프로토콜 구현.
|
|
5
|
+
* 구독된 URI에 대해 `notifications/resources/updated`를 push-based로 전송한다.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** 구독 중인 URI 집합 관리 + 알림 발송 */
|
|
9
|
+
export class SubscriptionManager {
|
|
10
|
+
private subscriptions = new Set<string>();
|
|
11
|
+
private active = false;
|
|
12
|
+
|
|
13
|
+
/** MCP stdio 모드 활성화 (서버 시작 시 호출) */
|
|
14
|
+
enable(): void {
|
|
15
|
+
this.active = true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
subscribe(uri: string): void {
|
|
19
|
+
this.subscriptions.add(uri);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
unsubscribe(uri: string): void {
|
|
23
|
+
this.subscriptions.delete(uri);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
isSubscribed(uri: string): boolean {
|
|
27
|
+
return this.subscriptions.has(uri);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 구독된 URI에 notifications/resources/updated 발송.
|
|
32
|
+
* MCP 모드가 아니거나 구독자가 없으면 no-op.
|
|
33
|
+
*/
|
|
34
|
+
dispatchResourceUpdated(uri: string): void {
|
|
35
|
+
if (!this.active || !this.subscriptions.has(uri)) return;
|
|
36
|
+
try {
|
|
37
|
+
process.stdout.write(
|
|
38
|
+
JSON.stringify({
|
|
39
|
+
jsonrpc: "2.0",
|
|
40
|
+
method: "notifications/resources/updated",
|
|
41
|
+
params: { uri },
|
|
42
|
+
}) + "\n"
|
|
43
|
+
);
|
|
44
|
+
} catch { /* crash-only */ }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* notifications/resources/list_changed 발송.
|
|
49
|
+
* 새로운 동적 리소스가 생성될 때 호출.
|
|
50
|
+
*/
|
|
51
|
+
dispatchListChanged(): void {
|
|
52
|
+
if (!this.active) return;
|
|
53
|
+
try {
|
|
54
|
+
process.stdout.write(
|
|
55
|
+
JSON.stringify({
|
|
56
|
+
jsonrpc: "2.0",
|
|
57
|
+
method: "notifications/resources/list_changed",
|
|
58
|
+
}) + "\n"
|
|
59
|
+
);
|
|
60
|
+
} catch { /* crash-only */ }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* notifications/message 발송 (레벨: "debug" | "info" | "warning" | "error").
|
|
65
|
+
*/
|
|
66
|
+
dispatchMessage(level: "debug" | "info" | "warning" | "error", data: string): void {
|
|
67
|
+
if (!this.active) return;
|
|
68
|
+
try {
|
|
69
|
+
process.stdout.write(
|
|
70
|
+
JSON.stringify({
|
|
71
|
+
jsonrpc: "2.0",
|
|
72
|
+
method: "notifications/message",
|
|
73
|
+
params: { level, data },
|
|
74
|
+
}) + "\n"
|
|
75
|
+
);
|
|
76
|
+
} catch { /* crash-only */ }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 모듈 수준 싱글톤 — server.ts와 mcp-handler.ts가 공유 */
|
|
81
|
+
export const subscriptionManager = new SubscriptionManager();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
|
|
5
|
+
const MESH_DIR = join(homedir(), ".afd");
|
|
6
|
+
const MESH_FILE = join(MESH_DIR, "mesh.json");
|
|
7
|
+
|
|
8
|
+
export interface MeshEntry {
|
|
9
|
+
workspace: string;
|
|
10
|
+
port: number;
|
|
11
|
+
pid: number;
|
|
12
|
+
registeredAt: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function readRegistry(): MeshEntry[] {
|
|
16
|
+
if (!existsSync(MESH_FILE)) return [];
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(readFileSync(MESH_FILE, "utf-8")) as MeshEntry[];
|
|
19
|
+
} catch {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function writeRegistry(entries: MeshEntry[]): void {
|
|
25
|
+
mkdirSync(MESH_DIR, { recursive: true });
|
|
26
|
+
writeFileSync(MESH_FILE, JSON.stringify(entries, null, 2));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isAlive(pid: number): boolean {
|
|
30
|
+
try {
|
|
31
|
+
process.kill(pid, 0);
|
|
32
|
+
return true;
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function registerMesh(workspace: string, port: number, pid: number): void {
|
|
39
|
+
const entries = readRegistry().filter(e => e.workspace !== workspace && isAlive(e.pid));
|
|
40
|
+
entries.push({ workspace, port, pid, registeredAt: Date.now() });
|
|
41
|
+
writeRegistry(entries);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function deregisterMesh(workspace: string): void {
|
|
45
|
+
const entries = readRegistry().filter(e => e.workspace !== workspace && isAlive(e.pid));
|
|
46
|
+
writeRegistry(entries);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function listMeshPeers(currentWorkspace: string): MeshEntry[] {
|
|
50
|
+
return readRegistry().filter(e => e.workspace !== currentWorkspace && isAlive(e.pid));
|
|
51
|
+
}
|