@lightcone-ai/daemon 0.14.17 → 0.14.19
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/keyword-research/index.js +95 -56
- package/mcp-servers/official/keyword-research/keyword-fixtures.json +58 -0
- package/mcp-servers/official/page-understanding/index.js +20 -1
- package/mcp-servers/official/page-understanding/manifest.json +8 -0
- package/mcp-servers/official/platform-policy-db/index.js +117 -163
- package/mcp-servers/official/platform-policy-db/policy-fixtures.json +170 -0
- package/mcp-servers/official/video-narration-planner/core.js +154 -116
- package/mcp-servers/official/video-narration-planner/index.js +29 -0
- package/mcp-servers/official/video-narration-planner/manifest.json +14 -0
- package/mcp-servers/official/video-narration-planner/planner-config.json +112 -0
- package/mcp-servers/official-common/tool-access-policy.js +90 -0
- package/package.json +3 -1
- package/src/_vendor/video/understanding/analyze-page.js +684 -0
- package/src/_vendor/video/understanding/heuristics.js +826 -0
- package/src/_vendor/video/understanding/index.js +11 -0
- package/src/_vendor/video/understanding/llm-client.js +261 -0
- package/src/_vendor/video/understanding/schema.js +254 -0
- package/src/_vendor/video/understanding/site-selectors.js +47 -0
- package/src/agent-manager.js +205 -22
- package/src/chat-bridge.js +55 -12
- package/src/index.js +2 -1
- package/src/lifecycle-protocol.js +51 -0
- package/src/runtime-config.js +5 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
|
|
3
|
+
function isPlainObject(value) {
|
|
4
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function normalizeToken(value) {
|
|
8
|
+
return String(value ?? '').trim();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function normalizeId(value) {
|
|
12
|
+
return normalizeToken(value).toLowerCase();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function normalizeToolList(value) {
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
return value
|
|
18
|
+
.map(item => normalizeToken(item).toLowerCase())
|
|
19
|
+
.filter(Boolean);
|
|
20
|
+
}
|
|
21
|
+
const direct = normalizeToken(value).toLowerCase();
|
|
22
|
+
return direct ? [direct] : [];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function normalizeRule(rawRule) {
|
|
26
|
+
if (!isPlainObject(rawRule)) return null;
|
|
27
|
+
|
|
28
|
+
const workspaceId = normalizeId(rawRule.workspace_id ?? rawRule.workspaceId);
|
|
29
|
+
const agentId = normalizeId(rawRule.agent_id ?? rawRule.agentId);
|
|
30
|
+
const tools = normalizeToolList(
|
|
31
|
+
rawRule.tools
|
|
32
|
+
?? rawRule.tool_names
|
|
33
|
+
?? rawRule.toolNames
|
|
34
|
+
?? rawRule.tool
|
|
35
|
+
);
|
|
36
|
+
const message = normalizeToken(rawRule.message ?? rawRule.error ?? rawRule.reason);
|
|
37
|
+
|
|
38
|
+
if (!workspaceId || !agentId || tools.length === 0 || !message) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
workspaceId,
|
|
44
|
+
agentId,
|
|
45
|
+
tools,
|
|
46
|
+
message,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function loadToolBlockRulesFromManifest(manifestUrl) {
|
|
51
|
+
if (!manifestUrl) return [];
|
|
52
|
+
let rawManifest = null;
|
|
53
|
+
try {
|
|
54
|
+
rawManifest = JSON.parse(readFileSync(manifestUrl, 'utf8'));
|
|
55
|
+
} catch {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
if (!isPlainObject(rawManifest)) return [];
|
|
59
|
+
|
|
60
|
+
const rawRules = Array.isArray(rawManifest.tool_block_rules)
|
|
61
|
+
? rawManifest.tool_block_rules
|
|
62
|
+
: Array.isArray(rawManifest.toolBlockRules)
|
|
63
|
+
? rawManifest.toolBlockRules
|
|
64
|
+
: [];
|
|
65
|
+
|
|
66
|
+
return rawRules
|
|
67
|
+
.map(rule => normalizeRule(rule))
|
|
68
|
+
.filter(Boolean);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function findToolBlockRule(rules, {
|
|
72
|
+
toolName = '',
|
|
73
|
+
workspaceId = '',
|
|
74
|
+
agentId = '',
|
|
75
|
+
} = {}) {
|
|
76
|
+
if (!Array.isArray(rules) || rules.length === 0) return null;
|
|
77
|
+
|
|
78
|
+
const targetTool = normalizeToken(toolName).toLowerCase();
|
|
79
|
+
const targetWorkspaceId = normalizeId(workspaceId);
|
|
80
|
+
const targetAgentId = normalizeId(agentId);
|
|
81
|
+
if (!targetTool || !targetWorkspaceId || !targetAgentId) return null;
|
|
82
|
+
|
|
83
|
+
for (const rule of rules) {
|
|
84
|
+
if (!rule || rule.workspaceId !== targetWorkspaceId || rule.agentId !== targetAgentId) continue;
|
|
85
|
+
if (rule.tools.includes('*') || rule.tools.includes(targetTool)) {
|
|
86
|
+
return rule;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightcone-ai/daemon",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
"postpack": "node scripts/unvendor-shared.js"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@mozilla/readability": "^0.6.0",
|
|
21
22
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
22
23
|
"dotenv": "^17.4.0",
|
|
23
24
|
"mysql2": "^3.14.0",
|
|
25
|
+
"playwright-core": "^1.59.1",
|
|
24
26
|
"ws": "^8.20.0",
|
|
25
27
|
"zod": "^3.24.0"
|
|
26
28
|
}
|