@lightcone-ai/daemon 0.14.0 → 0.14.1
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/mcp-servers/official/page-understanding/index.js +93 -0
- package/mcp-servers/official/page-understanding/manifest.json +20 -0
- package/mcp-servers/official/video-narration-planner/core.js +1436 -0
- package/mcp-servers/official/video-narration-planner/index.js +98 -0
- package/mcp-servers/official/video-narration-planner/manifest.json +30 -0
- package/mcp-servers/sophon-data/index.js +449 -0
- package/mcp-servers/sophon-data/manifest.json +19 -0
- package/package.json +1 -1
- package/src/_vendor/video/composer/index.js +377 -0
- package/src/agent-manager.js +10 -1
- package/src/chat-bridge.js +398 -15
- package/src/drivers/claude.js +10 -3
- package/src/mcp-config.js +1 -0
- package/src/workspace-file-upload.js +71 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
analyzePage,
|
|
8
|
+
analyzePageFromHtmlFixture,
|
|
9
|
+
validatePageUnderstanding,
|
|
10
|
+
} from '../../../../src/video/understanding/index.js';
|
|
11
|
+
|
|
12
|
+
function toText(payload) {
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function toError(message) {
|
|
19
|
+
return {
|
|
20
|
+
isError: true,
|
|
21
|
+
content: [{ type: 'text', text: `Error: ${message}` }],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const AnalyzePageOptionsSchema = z.object({
|
|
26
|
+
settleMs: z.number().int().min(500).max(30000).optional(),
|
|
27
|
+
timeoutMs: z.number().int().min(5000).max(240000).optional(),
|
|
28
|
+
viewportWidth: z.number().int().min(360).max(2160).optional(),
|
|
29
|
+
viewportHeight: z.number().int().min(480).max(3840).optional(),
|
|
30
|
+
minTextBins: z.number().int().min(3).max(40).optional(),
|
|
31
|
+
minBinChars: z.number().int().min(12).max(200).optional(),
|
|
32
|
+
allowVisionFallback: z.boolean().optional(),
|
|
33
|
+
useLlm: z.boolean().optional(),
|
|
34
|
+
fixture_mode: z.boolean().optional(),
|
|
35
|
+
}).passthrough();
|
|
36
|
+
|
|
37
|
+
const server = new McpServer({
|
|
38
|
+
name: 'official-page-understanding',
|
|
39
|
+
version: '0.1.0',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
server.tool(
|
|
43
|
+
'analyze_page',
|
|
44
|
+
'Analyze webpage structure for short-video narration planning. Returns page_understanding schema.',
|
|
45
|
+
{
|
|
46
|
+
url: z.string().url().describe('Target page URL.'),
|
|
47
|
+
persona: z.string().optional().describe('Audience persona, e.g. "校招求职学生".'),
|
|
48
|
+
options: AnalyzePageOptionsSchema.optional(),
|
|
49
|
+
},
|
|
50
|
+
async ({ url, persona = '', options = {} }) => {
|
|
51
|
+
try {
|
|
52
|
+
let payload;
|
|
53
|
+
if (options?.fixture_mode) {
|
|
54
|
+
payload = await analyzePageFromHtmlFixture({
|
|
55
|
+
url,
|
|
56
|
+
hostname: new URL(url).hostname,
|
|
57
|
+
persona,
|
|
58
|
+
bins: [
|
|
59
|
+
{ y_center: 380, text: '这是一个用于 smoke test 的结构化 bin 内容。' },
|
|
60
|
+
{ y_center: 980, text: '该页面包含若干重点段落,用于验证 schema 输出。' },
|
|
61
|
+
],
|
|
62
|
+
hotspots: [
|
|
63
|
+
{ y: 420, reason: '标题区域', weight: 9, type: 'h1' },
|
|
64
|
+
{ y: 1100, reason: '正文重点', weight: 8, type: 'h2' },
|
|
65
|
+
],
|
|
66
|
+
meta: {
|
|
67
|
+
title: 'Fixture Page',
|
|
68
|
+
og_title: 'Fixture Page',
|
|
69
|
+
og_description: 'Fixture mode output for analyze_page smoke test.',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
payload = await analyzePage({
|
|
74
|
+
url,
|
|
75
|
+
persona,
|
|
76
|
+
options,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const validation = validatePageUnderstanding(payload);
|
|
81
|
+
if (!validation.ok) {
|
|
82
|
+
return toError(`page_understanding_validation_failed: ${validation.errors.join('; ')}`);
|
|
83
|
+
}
|
|
84
|
+
return toText(payload);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
return toError(error?.message ?? 'analyze_page_failed');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const transport = new StdioServerTransport();
|
|
92
|
+
await server.connect(transport);
|
|
93
|
+
console.error('[page-understanding] MCP Server started');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "page-understanding",
|
|
3
|
+
"name": "Official Page Understanding MCP",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"runtime": "node",
|
|
6
|
+
"entrypoint": "index.js",
|
|
7
|
+
"tool_declarations": [
|
|
8
|
+
{ "name": "analyze_page", "classification": "cacheable" }
|
|
9
|
+
],
|
|
10
|
+
"smoke_test": {
|
|
11
|
+
"tool": "analyze_page",
|
|
12
|
+
"arguments": {
|
|
13
|
+
"url": "https://example.com",
|
|
14
|
+
"persona": "通用用户",
|
|
15
|
+
"options": {
|
|
16
|
+
"fixture_mode": true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|