project-graph-mcp 2.3.0 → 2.3.2
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/package.json +1 -3
- package/project-graph-mcp-2.3.0.tgz +0 -0
- package/src/network/web-server.js +1 -1
- package/vendor/symbiote-node/engine/AgentUICommands.js +100 -0
- package/vendor/symbiote-node/engine/Executor.js +371 -0
- package/vendor/symbiote-node/engine/Graph.js +314 -0
- package/vendor/symbiote-node/engine/GraphServer.js +353 -0
- package/vendor/symbiote-node/engine/HandlerLoader.js +145 -0
- package/vendor/symbiote-node/engine/History.js +83 -0
- package/vendor/symbiote-node/engine/Lifecycle.js +118 -0
- package/vendor/symbiote-node/engine/Persistence.js +84 -0
- package/vendor/symbiote-node/engine/Registry.js +264 -0
- package/vendor/symbiote-node/engine/SocketTypes.js +79 -0
- package/vendor/symbiote-node/engine/cli.js +404 -0
- package/vendor/symbiote-node/engine/index.js +56 -0
- package/vendor/symbiote-node/engine/nanoid.js +28 -0
- package/vendor/symbiote-node/engine/package.json +26 -0
- package/vendor/symbiote-node/engine/packs/ai/beat-detect.handler.js +215 -0
- package/vendor/symbiote-node/engine/packs/ai/content-adapt.handler.js +238 -0
- package/vendor/symbiote-node/engine/packs/ai/face-detect.handler.js +287 -0
- package/vendor/symbiote-node/engine/packs/ai/grok-generate.handler.js +565 -0
- package/vendor/symbiote-node/engine/packs/ai/kling-lipsync.handler.js +414 -0
- package/vendor/symbiote-node/engine/packs/ai/lesson-generate.handler.js +343 -0
- package/vendor/symbiote-node/engine/packs/ai/opencode.handler.js +164 -0
- package/vendor/symbiote-node/engine/packs/ai/replicate-lipsync.handler.js +341 -0
- package/vendor/symbiote-node/engine/packs/ai/tts.handler.js +241 -0
- package/vendor/symbiote-node/engine/packs/ai/whisper.handler.js +191 -0
- package/vendor/symbiote-node/engine/packs/data/db-query.handler.js +67 -0
- package/vendor/symbiote-node/engine/packs/data/news-accumulate.handler.js +281 -0
- package/vendor/symbiote-node/engine/packs/data/personas.handler.js +160 -0
- package/vendor/symbiote-node/engine/packs/data/prompt-loader.handler.js +193 -0
- package/vendor/symbiote-node/engine/packs/data/roles.handler.js +216 -0
- package/vendor/symbiote-node/engine/packs/data/rss-feed.handler.js +244 -0
- package/vendor/symbiote-node/engine/packs/debug/inject.handler.js +52 -0
- package/vendor/symbiote-node/engine/packs/flow/agent.handler.js +73 -0
- package/vendor/symbiote-node/engine/packs/flow/if.handler.js +107 -0
- package/vendor/symbiote-node/engine/packs/flow/loop.handler.js +58 -0
- package/vendor/symbiote-node/engine/packs/flow/merge.handler.js +60 -0
- package/vendor/symbiote-node/engine/packs/flow/retry.handler.js +65 -0
- package/vendor/symbiote-node/engine/packs/flow/switch.handler.js +64 -0
- package/vendor/symbiote-node/engine/packs/flow/wait-all.handler.js +39 -0
- package/vendor/symbiote-node/engine/packs/io/http-request.handler.js +82 -0
- package/vendor/symbiote-node/engine/packs/io/read-file.handler.js +60 -0
- package/vendor/symbiote-node/engine/packs/io/write-file.handler.js +63 -0
- package/vendor/symbiote-node/engine/packs/transform/anchor-match.handler.js +494 -0
- package/vendor/symbiote-node/engine/packs/transform/effects-skeleton.handler.js +417 -0
- package/vendor/symbiote-node/engine/packs/transform/json-parse.handler.js +43 -0
- package/vendor/symbiote-node/engine/packs/transform/lipsync-select.handler.js +339 -0
- package/vendor/symbiote-node/engine/packs/transform/riopla-adapt.handler.js +432 -0
- package/vendor/symbiote-node/engine/packs/transform/set.handler.js +57 -0
- package/vendor/symbiote-node/engine/packs/transform/template-builder.handler.js +134 -0
- package/vendor/symbiote-node/engine/packs/transform/template.handler.js +79 -0
- package/vendor/symbiote-node/engine/packs/transform/timeline-build.handler.js +399 -0
- package/vendor/symbiote-node/engine/packs/util/delay.handler.js +39 -0
- package/vendor/symbiote-node/engine/packs/util/log.handler.js +44 -0
- package/vendor/symbiote-node/engine/packs/video-pack.js +323 -0
- package/vendor/symbiote-node/package.json +2 -2
- package/web/app.js +6 -3
- package/web/components/canvas-graph.js +50 -11
- package/web/components/code-block.js +1 -1
- package/web/components/event-feed/MiniGraphWidget.js +105 -15
- package/web/components/follow-ribbon.js +134 -0
- package/web/follow-controller.js +241 -0
- package/web/panels/code-viewer.js +1 -1
- package/web/panels/dep-graph.js +21 -42
- package/web/style.css +6 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ai/face-detect — Face detection via HTTP API (InsightFace SCRFD GPU)
|
|
3
|
+
*
|
|
4
|
+
* Client for remote face detection service on mr-agent.rnd-pro.com:5050.
|
|
5
|
+
* Supports SSH tunnel for local access.
|
|
6
|
+
*
|
|
7
|
+
* Operations:
|
|
8
|
+
* - analyze: Video face detection (suitable for lipsync?)
|
|
9
|
+
* - track: Dense face tracking with mouth + bbox
|
|
10
|
+
* - track-gpu: GPU InsightFace tracking with landmarks, age, gender
|
|
11
|
+
* - mouth: Mouth position detection (for speech bubble placement)
|
|
12
|
+
* - frames-gpu: Face tracking on WebP frame sequences
|
|
13
|
+
*
|
|
14
|
+
* Based on Mr-Computer/modules/ai-music-video/src/utils/face-detector.js
|
|
15
|
+
*
|
|
16
|
+
* @module agi-graph/packs/ai/face-detect
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { execSync } from 'child_process';
|
|
20
|
+
import { promises as fs } from 'fs';
|
|
21
|
+
import path from 'path';
|
|
22
|
+
import os from 'os';
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
type: 'ai/face-detect',
|
|
26
|
+
category: 'ai',
|
|
27
|
+
icon: 'face',
|
|
28
|
+
|
|
29
|
+
driver: {
|
|
30
|
+
description: 'Face detection via HTTP API — tracking, mouth position, landmarks',
|
|
31
|
+
inputs: [
|
|
32
|
+
{ name: 'mediaPath', type: 'string' },
|
|
33
|
+
],
|
|
34
|
+
outputs: [
|
|
35
|
+
{ name: 'result', type: 'any' },
|
|
36
|
+
{ name: 'detected', type: 'boolean' },
|
|
37
|
+
{ name: 'error', type: 'string' },
|
|
38
|
+
],
|
|
39
|
+
params: {
|
|
40
|
+
operation: { type: 'string', default: 'analyze', description: 'analyze | track | track-gpu | mouth | frames-gpu' },
|
|
41
|
+
endpoint: { type: 'string', default: 'http://localhost:5050', description: 'Face detection service URL' },
|
|
42
|
+
minCoverage: { type: 'number', default: 5, description: 'Minimum face coverage % (analyze mode)' },
|
|
43
|
+
step: { type: 'int', default: 3, description: 'Frame sampling interval (track modes)' },
|
|
44
|
+
fps: { type: 'int', default: 30, description: 'FPS for frames-gpu mode' },
|
|
45
|
+
remoteHost: { type: 'string', default: 'mr-agent@mr-agent.rnd-pro.com', description: 'SSH host for SCP uploads' },
|
|
46
|
+
useRemotePath: { type: 'boolean', default: false, description: 'Send file path instead of uploading (when on same server)' },
|
|
47
|
+
timeout: { type: 'int', default: 120000, description: 'Max wait time (ms)' },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
lifecycle: {
|
|
52
|
+
validate: (inputs) => {
|
|
53
|
+
if (!inputs.mediaPath) return false;
|
|
54
|
+
return true;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
cacheKey: (inputs, params) =>
|
|
58
|
+
`face:${params.operation}:${params.step}:${inputs.mediaPath}`,
|
|
59
|
+
|
|
60
|
+
execute: async (inputs, params) => {
|
|
61
|
+
const { mediaPath } = inputs;
|
|
62
|
+
const op = params.operation || 'analyze';
|
|
63
|
+
|
|
64
|
+
const ops = { analyze, track, 'track-gpu': trackGpu, mouth, 'frames-gpu': framesGpu };
|
|
65
|
+
const handler = ops[op];
|
|
66
|
+
if (!handler) {
|
|
67
|
+
return { result: null, detected: false, error: `Unknown operation: ${op}` };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return handler(mediaPath, params);
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Check if running on the mr-agent server
|
|
77
|
+
* @returns {boolean}
|
|
78
|
+
*/
|
|
79
|
+
function isOnServer() {
|
|
80
|
+
try {
|
|
81
|
+
return os.hostname().includes('mr-agent') || os.hostname().includes('rnd-pro');
|
|
82
|
+
} catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Upload file to remote server via SCP if needed
|
|
89
|
+
* @param {string} localPath - Local file path
|
|
90
|
+
* @param {string} host - SSH host
|
|
91
|
+
* @returns {{remotePath: string, cleanup: boolean}}
|
|
92
|
+
*/
|
|
93
|
+
async function prepareRemotePath(localPath, host, params) {
|
|
94
|
+
if (params.useRemotePath || isOnServer()) {
|
|
95
|
+
return { remotePath: path.resolve(localPath), cleanup: false };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const filename = `face_${Date.now()}_${path.basename(localPath)}`;
|
|
99
|
+
const remotePath = `/tmp/${filename}`;
|
|
100
|
+
|
|
101
|
+
execSync(`scp -q "${path.resolve(localPath)}" "${host}:${remotePath}"`, {
|
|
102
|
+
stdio: 'pipe', timeout: 60000,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return { remotePath, cleanup: true };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Clean up remote file
|
|
110
|
+
* @param {string} remotePath
|
|
111
|
+
* @param {string} host
|
|
112
|
+
*/
|
|
113
|
+
function cleanupRemote(remotePath, host) {
|
|
114
|
+
try {
|
|
115
|
+
execSync(`ssh ${host} "rm -f ${remotePath}"`, {
|
|
116
|
+
stdio: 'pipe', timeout: 10000,
|
|
117
|
+
});
|
|
118
|
+
} catch { /* ignore */ }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* analyze — Video face detection suitability
|
|
123
|
+
*/
|
|
124
|
+
async function analyze(mediaPath, params) {
|
|
125
|
+
const endpoint = params.endpoint || 'http://localhost:5050';
|
|
126
|
+
const host = params.remoteHost || 'mr-agent@mr-agent.rnd-pro.com';
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
if (params.useRemotePath || isOnServer()) {
|
|
130
|
+
const response = await fetch(`${endpoint}/analyze?min_coverage=${params.minCoverage || 5}`, {
|
|
131
|
+
method: 'POST',
|
|
132
|
+
headers: { 'Content-Type': 'application/json' },
|
|
133
|
+
body: JSON.stringify({ video_path: path.resolve(mediaPath) }),
|
|
134
|
+
signal: AbortSignal.timeout(params.timeout || 120000),
|
|
135
|
+
});
|
|
136
|
+
const result = await response.json();
|
|
137
|
+
return { result, detected: result.suitable || false, error: null };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Upload via curl for remote analysis
|
|
141
|
+
const { remotePath, cleanup } = await prepareRemotePath(mediaPath, host, params);
|
|
142
|
+
try {
|
|
143
|
+
const response = await fetch(`${endpoint}/analyze?min_coverage=${params.minCoverage || 5}`, {
|
|
144
|
+
method: 'POST',
|
|
145
|
+
headers: { 'Content-Type': 'application/json' },
|
|
146
|
+
body: JSON.stringify({ video_path: remotePath }),
|
|
147
|
+
signal: AbortSignal.timeout(params.timeout || 120000),
|
|
148
|
+
});
|
|
149
|
+
const result = await response.json();
|
|
150
|
+
return { result, detected: result.suitable || false, error: null };
|
|
151
|
+
} finally {
|
|
152
|
+
if (cleanup) cleanupRemote(remotePath, host);
|
|
153
|
+
}
|
|
154
|
+
} catch (err) {
|
|
155
|
+
return { result: null, detected: false, error: err.message };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* track — Dense face tracking with mouth + bbox
|
|
161
|
+
*/
|
|
162
|
+
async function track(mediaPath, params) {
|
|
163
|
+
const endpoint = params.endpoint || 'http://localhost:5050';
|
|
164
|
+
const host = params.remoteHost || 'mr-agent@mr-agent.rnd-pro.com';
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
const { remotePath, cleanup } = await prepareRemotePath(mediaPath, host, params);
|
|
168
|
+
try {
|
|
169
|
+
const response = await fetch(`${endpoint}/track-face`, {
|
|
170
|
+
method: 'POST',
|
|
171
|
+
headers: { 'Content-Type': 'application/json' },
|
|
172
|
+
body: JSON.stringify({ video_path: remotePath, step: params.step || 3 }),
|
|
173
|
+
signal: AbortSignal.timeout(params.timeout || 120000),
|
|
174
|
+
});
|
|
175
|
+
const result = await response.json();
|
|
176
|
+
result.detected = (result.detectedFrames || 0) > 0;
|
|
177
|
+
return { result, detected: result.detected, error: null };
|
|
178
|
+
} finally {
|
|
179
|
+
if (cleanup) cleanupRemote(remotePath, host);
|
|
180
|
+
}
|
|
181
|
+
} catch (err) {
|
|
182
|
+
return { result: null, detected: false, error: err.message };
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* track-gpu — InsightFace GPU tracking with landmarks, bbox, age, gender
|
|
188
|
+
*/
|
|
189
|
+
async function trackGpu(mediaPath, params) {
|
|
190
|
+
const endpoint = params.endpoint || 'http://localhost:5050';
|
|
191
|
+
const host = params.remoteHost || 'mr-agent@mr-agent.rnd-pro.com';
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
const { remotePath, cleanup } = await prepareRemotePath(mediaPath, host, params);
|
|
195
|
+
try {
|
|
196
|
+
const response = await fetch(`${endpoint}/track-face-gpu`, {
|
|
197
|
+
method: 'POST',
|
|
198
|
+
headers: { 'Content-Type': 'application/json' },
|
|
199
|
+
body: JSON.stringify({ video_path: remotePath, step: params.step || 1 }),
|
|
200
|
+
signal: AbortSignal.timeout(params.timeout || 120000),
|
|
201
|
+
});
|
|
202
|
+
const result = await response.json();
|
|
203
|
+
result.detected = (result.detectedFrames || 0) > 0;
|
|
204
|
+
return { result, detected: result.detected, error: null };
|
|
205
|
+
} finally {
|
|
206
|
+
if (cleanup) cleanupRemote(remotePath, host);
|
|
207
|
+
}
|
|
208
|
+
} catch (err) {
|
|
209
|
+
return { result: null, detected: false, error: err.message };
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* mouth — Mouth position detection (for speech bubble placement)
|
|
215
|
+
*/
|
|
216
|
+
async function mouth(mediaPath, params) {
|
|
217
|
+
const endpoint = params.endpoint || 'http://localhost:5050';
|
|
218
|
+
const host = params.remoteHost || 'mr-agent@mr-agent.rnd-pro.com';
|
|
219
|
+
|
|
220
|
+
try {
|
|
221
|
+
const { remotePath, cleanup } = await prepareRemotePath(mediaPath, host, params);
|
|
222
|
+
try {
|
|
223
|
+
const response = await fetch(`${endpoint}/analyze-mouth`, {
|
|
224
|
+
method: 'POST',
|
|
225
|
+
headers: { 'Content-Type': 'application/json' },
|
|
226
|
+
body: JSON.stringify({ video_path: remotePath }),
|
|
227
|
+
signal: AbortSignal.timeout(params.timeout || 120000),
|
|
228
|
+
});
|
|
229
|
+
const result = await response.json();
|
|
230
|
+
return { result, detected: result.detected || false, error: null };
|
|
231
|
+
} finally {
|
|
232
|
+
if (cleanup) cleanupRemote(remotePath, host);
|
|
233
|
+
}
|
|
234
|
+
} catch (err) {
|
|
235
|
+
return { result: null, detected: false, error: err.message };
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* frames-gpu — GPU face tracking on WebP frame sequences
|
|
241
|
+
*/
|
|
242
|
+
async function framesGpu(mediaPath, params) {
|
|
243
|
+
const endpoint = params.endpoint || 'http://localhost:5050';
|
|
244
|
+
const host = params.remoteHost || 'mr-agent@mr-agent.rnd-pro.com';
|
|
245
|
+
|
|
246
|
+
try {
|
|
247
|
+
let remotePath = path.resolve(mediaPath);
|
|
248
|
+
let cleanup = false;
|
|
249
|
+
|
|
250
|
+
// If not on server, rsync frames directory to remote
|
|
251
|
+
if (!params.useRemotePath && !isOnServer()) {
|
|
252
|
+
const dirName = `face_frames_${Date.now()}`;
|
|
253
|
+
remotePath = `/tmp/${dirName}`;
|
|
254
|
+
|
|
255
|
+
execSync(`rsync -az --quiet "${path.resolve(mediaPath)}/" "${host}:${remotePath}/"`, {
|
|
256
|
+
stdio: 'pipe', timeout: 120000,
|
|
257
|
+
});
|
|
258
|
+
cleanup = true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
try {
|
|
262
|
+
const response = await fetch(`${endpoint}/track-face-frames-gpu`, {
|
|
263
|
+
method: 'POST',
|
|
264
|
+
headers: { 'Content-Type': 'application/json' },
|
|
265
|
+
body: JSON.stringify({
|
|
266
|
+
frames_dir: remotePath,
|
|
267
|
+
fps: params.fps || 30,
|
|
268
|
+
step: params.step || 1,
|
|
269
|
+
}),
|
|
270
|
+
signal: AbortSignal.timeout(params.timeout || 120000),
|
|
271
|
+
});
|
|
272
|
+
const result = await response.json();
|
|
273
|
+
result.detected = (result.detectedFrames || 0) > 0;
|
|
274
|
+
return { result, detected: result.detected, error: null };
|
|
275
|
+
} finally {
|
|
276
|
+
if (cleanup) {
|
|
277
|
+
try {
|
|
278
|
+
execSync(`ssh ${host} "rm -rf ${remotePath}"`, {
|
|
279
|
+
stdio: 'pipe', timeout: 10000,
|
|
280
|
+
});
|
|
281
|
+
} catch { /* ignore */ }
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
} catch (err) {
|
|
285
|
+
return { result: null, detected: false, error: err.message };
|
|
286
|
+
}
|
|
287
|
+
}
|