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.
Files changed (66) hide show
  1. package/package.json +1 -3
  2. package/project-graph-mcp-2.3.0.tgz +0 -0
  3. package/src/network/web-server.js +1 -1
  4. package/vendor/symbiote-node/engine/AgentUICommands.js +100 -0
  5. package/vendor/symbiote-node/engine/Executor.js +371 -0
  6. package/vendor/symbiote-node/engine/Graph.js +314 -0
  7. package/vendor/symbiote-node/engine/GraphServer.js +353 -0
  8. package/vendor/symbiote-node/engine/HandlerLoader.js +145 -0
  9. package/vendor/symbiote-node/engine/History.js +83 -0
  10. package/vendor/symbiote-node/engine/Lifecycle.js +118 -0
  11. package/vendor/symbiote-node/engine/Persistence.js +84 -0
  12. package/vendor/symbiote-node/engine/Registry.js +264 -0
  13. package/vendor/symbiote-node/engine/SocketTypes.js +79 -0
  14. package/vendor/symbiote-node/engine/cli.js +404 -0
  15. package/vendor/symbiote-node/engine/index.js +56 -0
  16. package/vendor/symbiote-node/engine/nanoid.js +28 -0
  17. package/vendor/symbiote-node/engine/package.json +26 -0
  18. package/vendor/symbiote-node/engine/packs/ai/beat-detect.handler.js +215 -0
  19. package/vendor/symbiote-node/engine/packs/ai/content-adapt.handler.js +238 -0
  20. package/vendor/symbiote-node/engine/packs/ai/face-detect.handler.js +287 -0
  21. package/vendor/symbiote-node/engine/packs/ai/grok-generate.handler.js +565 -0
  22. package/vendor/symbiote-node/engine/packs/ai/kling-lipsync.handler.js +414 -0
  23. package/vendor/symbiote-node/engine/packs/ai/lesson-generate.handler.js +343 -0
  24. package/vendor/symbiote-node/engine/packs/ai/opencode.handler.js +164 -0
  25. package/vendor/symbiote-node/engine/packs/ai/replicate-lipsync.handler.js +341 -0
  26. package/vendor/symbiote-node/engine/packs/ai/tts.handler.js +241 -0
  27. package/vendor/symbiote-node/engine/packs/ai/whisper.handler.js +191 -0
  28. package/vendor/symbiote-node/engine/packs/data/db-query.handler.js +67 -0
  29. package/vendor/symbiote-node/engine/packs/data/news-accumulate.handler.js +281 -0
  30. package/vendor/symbiote-node/engine/packs/data/personas.handler.js +160 -0
  31. package/vendor/symbiote-node/engine/packs/data/prompt-loader.handler.js +193 -0
  32. package/vendor/symbiote-node/engine/packs/data/roles.handler.js +216 -0
  33. package/vendor/symbiote-node/engine/packs/data/rss-feed.handler.js +244 -0
  34. package/vendor/symbiote-node/engine/packs/debug/inject.handler.js +52 -0
  35. package/vendor/symbiote-node/engine/packs/flow/agent.handler.js +73 -0
  36. package/vendor/symbiote-node/engine/packs/flow/if.handler.js +107 -0
  37. package/vendor/symbiote-node/engine/packs/flow/loop.handler.js +58 -0
  38. package/vendor/symbiote-node/engine/packs/flow/merge.handler.js +60 -0
  39. package/vendor/symbiote-node/engine/packs/flow/retry.handler.js +65 -0
  40. package/vendor/symbiote-node/engine/packs/flow/switch.handler.js +64 -0
  41. package/vendor/symbiote-node/engine/packs/flow/wait-all.handler.js +39 -0
  42. package/vendor/symbiote-node/engine/packs/io/http-request.handler.js +82 -0
  43. package/vendor/symbiote-node/engine/packs/io/read-file.handler.js +60 -0
  44. package/vendor/symbiote-node/engine/packs/io/write-file.handler.js +63 -0
  45. package/vendor/symbiote-node/engine/packs/transform/anchor-match.handler.js +494 -0
  46. package/vendor/symbiote-node/engine/packs/transform/effects-skeleton.handler.js +417 -0
  47. package/vendor/symbiote-node/engine/packs/transform/json-parse.handler.js +43 -0
  48. package/vendor/symbiote-node/engine/packs/transform/lipsync-select.handler.js +339 -0
  49. package/vendor/symbiote-node/engine/packs/transform/riopla-adapt.handler.js +432 -0
  50. package/vendor/symbiote-node/engine/packs/transform/set.handler.js +57 -0
  51. package/vendor/symbiote-node/engine/packs/transform/template-builder.handler.js +134 -0
  52. package/vendor/symbiote-node/engine/packs/transform/template.handler.js +79 -0
  53. package/vendor/symbiote-node/engine/packs/transform/timeline-build.handler.js +399 -0
  54. package/vendor/symbiote-node/engine/packs/util/delay.handler.js +39 -0
  55. package/vendor/symbiote-node/engine/packs/util/log.handler.js +44 -0
  56. package/vendor/symbiote-node/engine/packs/video-pack.js +323 -0
  57. package/vendor/symbiote-node/package.json +2 -2
  58. package/web/app.js +6 -3
  59. package/web/components/canvas-graph.js +50 -11
  60. package/web/components/code-block.js +1 -1
  61. package/web/components/event-feed/MiniGraphWidget.js +105 -15
  62. package/web/components/follow-ribbon.js +134 -0
  63. package/web/follow-controller.js +241 -0
  64. package/web/panels/code-viewer.js +1 -1
  65. package/web/panels/dep-graph.js +21 -42
  66. 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
+ }