@lightcone-ai/daemon 0.23.2 → 0.23.4
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.
|
@@ -21,6 +21,11 @@ import { z } from 'zod';
|
|
|
21
21
|
const SERVER_URL = process.env.SERVER_URL ?? '';
|
|
22
22
|
const MACHINE_API_KEY = process.env.MACHINE_API_KEY ?? '';
|
|
23
23
|
const AGENT_ID = process.env.AGENT_ID ?? '';
|
|
24
|
+
// Daemon sets LIGHTCONE_AGENT_RUNTIME (claude / codex / kimi) when it
|
|
25
|
+
// spawns the MCP server, so the server-side handler can route to a
|
|
26
|
+
// vision/LLM backend matching the calling agent's own LLM stack
|
|
27
|
+
// (avoid e.g. a codex agent silently using a claude vision call).
|
|
28
|
+
const AGENT_RUNTIME = process.env.LIGHTCONE_AGENT_RUNTIME ?? '';
|
|
24
29
|
|
|
25
30
|
function toTextContent(payload) {
|
|
26
31
|
let text;
|
|
@@ -37,12 +42,16 @@ async function forwardToServer(serverId, toolName, args) {
|
|
|
37
42
|
throw new Error('thin-proxy missing SERVER_URL / MACHINE_API_KEY / AGENT_ID env');
|
|
38
43
|
}
|
|
39
44
|
const url = `${SERVER_URL}/internal/agent/${encodeURIComponent(AGENT_ID)}/mcp/${encodeURIComponent(serverId)}/${encodeURIComponent(toolName)}`;
|
|
45
|
+
const headers = {
|
|
46
|
+
'Content-Type': 'application/json',
|
|
47
|
+
'Authorization': `Bearer ${MACHINE_API_KEY}`,
|
|
48
|
+
};
|
|
49
|
+
if (AGENT_RUNTIME) {
|
|
50
|
+
headers['X-Lightcone-Agent-Runtime'] = AGENT_RUNTIME;
|
|
51
|
+
}
|
|
40
52
|
const res = await fetch(url, {
|
|
41
53
|
method: 'POST',
|
|
42
|
-
headers
|
|
43
|
-
'Content-Type': 'application/json',
|
|
44
|
-
'Authorization': `Bearer ${MACHINE_API_KEY}`,
|
|
45
|
-
},
|
|
54
|
+
headers,
|
|
46
55
|
body: JSON.stringify(args ?? {}),
|
|
47
56
|
});
|
|
48
57
|
let body = null;
|
package/package.json
CHANGED
package/src/agent-manager.js
CHANGED
|
@@ -795,6 +795,16 @@ export class AgentManager {
|
|
|
795
795
|
'${WECHAT_MP_PROFILE_DIR}': path.join(profileRoot, `wechat_mp-${userId}`),
|
|
796
796
|
};
|
|
797
797
|
const mcpServers = this._resolveDirectiveMcpServers(directive, baseReplacements);
|
|
798
|
+
// Inject LIGHTCONE_AGENT_RUNTIME into every MCP server's env so that
|
|
799
|
+
// server-side handlers (reached via thin-proxy) can route to a backend
|
|
800
|
+
// matching the calling agent's own LLM stack. Example: analyze_page
|
|
801
|
+
// uses this to pick codex vision for codex agents and claude vision
|
|
802
|
+
// for claude agents — avoiding cross-vendor spawn chains.
|
|
803
|
+
for (const server of Object.values(mcpServers)) {
|
|
804
|
+
if (server && typeof server === 'object') {
|
|
805
|
+
server.env = { ...(server.env ?? {}), LIGHTCONE_AGENT_RUNTIME: runtime };
|
|
806
|
+
}
|
|
807
|
+
}
|
|
798
808
|
|
|
799
809
|
if (runtime === 'codex') {
|
|
800
810
|
const mcpKeys = Object.keys(mcpServers);
|