@vibe-lark/larkpal 0.1.32 → 0.1.34

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 (2) hide show
  1. package/dist/main.mjs +18 -9
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -1700,16 +1700,16 @@ async function createLarkpalAgentAdapter() {
1700
1700
  maxTurns: defaultMaxTurns
1701
1701
  });
1702
1702
  const { LarkpalAgentAdapter, ToolRegistry } = await import("@vibe-lark/larkpal-agent");
1703
+ const registry = new ToolRegistry();
1703
1704
  const adapter = new LarkpalAgentAdapter({
1704
1705
  llm,
1705
1706
  systemPrompt,
1706
1707
  tools: [],
1707
- defaultMaxTurns
1708
+ defaultMaxTurns,
1709
+ registry
1708
1710
  });
1709
1711
  const mcpServerUrl = process.env.LARKPAL_AGENT_MCP_SERVER_URL;
1710
- let registry = null;
1711
1712
  if (mcpServerUrl) try {
1712
- registry = new ToolRegistry();
1713
1713
  const toolCount = await registry.connectMcpServer(mcpServerUrl, { timeoutMs: 1e4 });
1714
1714
  const tools = registry.getAll();
1715
1715
  adapter.registerTools(tools);
@@ -1727,10 +1727,10 @@ async function createLarkpalAgentAdapter() {
1727
1727
  else log$27.warn("未配置 LARKPAL_AGENT_MCP_SERVER_URL,Agent 无远程工具可用");
1728
1728
  try {
1729
1729
  const { loadSkillsFromDir, registerSkills } = await import("@vibe-lark/larkpal-agent");
1730
- const { createRequire } = await import("node:module");
1731
- const skillsDir = join(createRequire(import.meta.url).resolve("@vibe-lark/larkpal-agent").replace(/\/dist\/index\.js$/, ""), "src", "skills", "definitions");
1730
+ const { fileURLToPath } = await import("node:url");
1731
+ const skillsDir = join(fileURLToPath(import.meta.resolve("@vibe-lark/larkpal-agent")).replace(/\/dist\/index\.js$/, ""), "src", "skills", "definitions");
1732
1732
  const skills = await loadSkillsFromDir(skillsDir);
1733
- if (skills.length > 0 && registry) {
1733
+ if (skills.length > 0) {
1734
1734
  registerSkills(registry, skills, llm);
1735
1735
  const skillTools = registry.getAll().filter((t) => t.name.startsWith("skill:"));
1736
1736
  adapter.registerTools(skillTools);
@@ -1738,8 +1738,7 @@ async function createLarkpalAgentAdapter() {
1738
1738
  skillCount: skills.length,
1739
1739
  skillNames: skills.map((s) => s.name)
1740
1740
  });
1741
- } else if (skills.length > 0 && !registry) log$27.warn("Skills 已加载但无 ToolRegistry(MCP 未连接),跳过 Meta-Tool 注册");
1742
- else log$27.info("未找到 Skill 定义文件", { skillsDir });
1741
+ } else log$27.info("未找到 Skill 定义文件", { skillsDir });
1743
1742
  } catch (err) {
1744
1743
  log$27.warn("Skill 加载失败(非阻塞)", { error: err?.message });
1745
1744
  }
@@ -1983,6 +1982,15 @@ async function handleExecute(req, res, processManager) {
1983
1982
  sessionId: body.session_id,
1984
1983
  mode
1985
1984
  });
1985
+ if (!body.auth_headers) {
1986
+ const tenantKey = req.headers["x-tenant-key"];
1987
+ const userId = req.headers["x-user-id"];
1988
+ if (tenantKey || userId) {
1989
+ body.auth_headers = {};
1990
+ if (tenantKey) body.auth_headers["x-tenant-key"] = tenantKey;
1991
+ if (userId) body.auth_headers["x-user-id"] = userId;
1992
+ }
1993
+ }
1986
1994
  const config = {
1987
1995
  sessionId: body.session_id,
1988
1996
  cwd: body.cwd,
@@ -1993,7 +2001,8 @@ async function handleExecute(req, res, processManager) {
1993
2001
  baseURL: body.llm_config.base_url,
1994
2002
  apiKey: body.llm_config.api_key,
1995
2003
  model: body.llm_config.model
1996
- } } : {}
2004
+ } } : {},
2005
+ ...body.auth_headers ? { authHeaders: body.auth_headers } : {}
1997
2006
  };
1998
2007
  if (mode === "async") {
1999
2008
  const callbacks = createTaskCallbacks(taskId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-lark/larkpal",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "LarkPal - Lark/Feishu bot service",
5
5
  "type": "module",
6
6
  "main": "./dist/main.mjs",