@axiom-lattice/examples-deep_research 1.0.19 → 1.0.20
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +9 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/examples-deep_research@1.0.
|
|
2
|
+
> @axiom-lattice/examples-deep_research@1.0.20 build /home/runner/work/agentic/agentic/examples/deep_research
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
12
|
[32mCJS[39m [1mdist/index.js [22m[32m39.63 KB[39m
|
|
13
13
|
[32mCJS[39m [1mdist/index.js.map [22m[32m39.84 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 43ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 6037ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m13.00 B[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @axiom-lattice/examples-deep_research
|
|
2
2
|
|
|
3
|
+
## 1.0.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e0a5f54]
|
|
8
|
+
- @axiom-lattice/gateway@2.1.23
|
|
9
|
+
- @axiom-lattice/core@2.1.18
|
|
10
|
+
- @axiom-lattice/pg-stores@1.0.7
|
|
11
|
+
|
|
3
12
|
## 1.0.19
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "@axiom-lattice/examples-deep_research",
|
|
34
|
-
version: "1.0.
|
|
34
|
+
version: "1.0.20",
|
|
35
35
|
main: "dist/index.js",
|
|
36
36
|
bin: {
|
|
37
37
|
"lattice-deep-research": "./dist/index.js"
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/index.ts","../src/agents/research/index.ts","../src/agents/data_agent/index.ts","../src/agents/sandbox_agent/index.ts"],"sourcesContent":["{\n \"name\": \"@axiom-lattice/examples-deep_research\",\n \"version\": \"1.0.19\",\n \"main\": \"dist/index.js\",\n \"bin\": {\n \"lattice-deep-research\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"start\": \"node dist/index.js\",\n \"dev\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node dist/index.js\\\"\",\n \"dev:nodemon\": \"nodemon --watch 'src/**/*.ts' --watch '../../packages/core/dist/**/*' --exec 'ts-node' -r tsconfig-paths/register src/index.ts\",\n \"dev:serve\": \"tsup src/index.ts --format cjs --dts --watch --serve dist/index.js\",\n \"dev:inspect\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node --inspect dist/index.js\\\"\",\n \"lint\": \"tsc --noEmit\",\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"Deep Research Server for Axiom Lattice\",\n \"dependencies\": {\n \"@axiom-lattice/core\": \"workspace:*\",\n \"@axiom-lattice/gateway\": \"workspace:*\",\n \"@axiom-lattice/protocols\": \"workspace:*\",\n \"@axiom-lattice/pg-stores\": \"workspace:*\",\n \"dotenv\": \"^16.6.1\",\n \"uuid\": \"^9.0.1\",\n \"zod\": \"^3.24.2\",\n \"zod-to-json-schema\": \"^3.24.3\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.14\",\n \"@types/lodash\": \"^4.17.16\",\n \"@types/node\": \"^20.17.23\",\n \"@types/uuid\": \"^9.0.8\",\n \"@typescript-eslint/eslint-plugin\": \"^7.2.0\",\n \"@typescript-eslint/parser\": \"^7.2.0\",\n \"eslint\": \"^8.57.0\",\n \"jest\": \"^29.7.0\",\n \"nodemon\": \"^3.1.9\",\n \"ts-jest\": \"^29.4.0\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.2\"\n }\n}\n","import dotenv from \"dotenv\";\n\nimport { LatticeGateway } from \"@axiom-lattice/gateway\";\nimport {\n getScheduleLattice,\n registerCheckpointSaver,\n registerModelLattice,\n registerScheduleLattice,\n FileSystemSkillStore,\n\n storeLatticeManager,\n skillLatticeManager,\n mcpManager,\n toolLatticeManager,\n registerStoreLattice,\n sandboxLatticeManager,\n} from \"@axiom-lattice/core\";\nimport { McpServerConfig } from \"@axiom-lattice/protocols\";\nimport \"./agents\";\n\nimport path from \"path\";\nimport {\n LoggerConfig,\n LoggerType,\n ScheduleType,\n} from \"@axiom-lattice/protocols\";\nimport { PostgreSQLScheduleStorage, PostgreSQLThreadStore } from \"@axiom-lattice/pg-stores\";\n\n// 在文件开头添加\nconst fs = require(\"fs\");\nconst PACKAGE_VERSION = require(\"../package.json\").version;\nconst BUILD_TIME = new Date().toISOString();\nconst IS_DEV = process.env.NODE_ENV !== \"production\";\n\n// 在启动时输出\nconsole.log(`\n╔═══════════════════════════════════════╗\n║ Lattice Deep Research Server ║\n║ Version: ${PACKAGE_VERSION} ║\n║ Build Time: ${BUILD_TIME} ║\n║ Environment: ${IS_DEV ? \"Development\" : \"Production\"} ║\n╚═══════════════════════════════════════╝\n`);\n// Load environment variables\ndotenv.config({ path: path.resolve(__dirname, \"../.env\") });\n\n// Initialize and register PostgreSQL ThreadStore\n// The constructor automatically calls initialize() unless autoMigrate is false\n// Migrations use advisory locks to prevent concurrent execution\nconst threadStore = new PostgreSQLThreadStore({\n poolConfig: process.env.DATABASE_URL || \"\",\n});\n\n// Register threadStore to replace the default in-memory store\nstoreLatticeManager.removeLattice(\"default\", \"thread\");\nregisterStoreLattice(\"default\", \"thread\", threadStore);\n\n// Parse command line arguments for port configuration\nfunction parsePort(): number {\n const args = process.argv.slice(2);\n const portIndex = args.findIndex((arg) => arg === \"--port\" || arg === \"-p\");\n\n if (portIndex !== -1 && args[portIndex + 1]) {\n const port = parseInt(args[portIndex + 1], 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid port value: ${args[portIndex + 1]}, using default port 4001`\n );\n }\n\n // Check environment variable\n if (process.env.PORT) {\n const port = parseInt(process.env.PORT, 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid PORT environment variable: ${process.env.PORT}, using default port 4001`\n );\n }\n\n // Default port\n return 4001;\n}\n\n// Register default model Lattice\nregisterModelLattice(\n \"default\",\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // }\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // apiKeyEnvName: \"DEEPSEEK_API_KEY2\",\n // },\n // {\n // model: \"deepseek-v3-250324\",\n // provider: \"volcengine\",\n // streaming: false,\n // },\n {\n model: \"kimi-k2-250905\",\n provider: \"volcengine\",\n streaming: true,\n apiKeyEnvName: \"VOLCENGINE_API_KEY2\",\n }\n // {\n // model: \"kimi-k2-0711-preview\",\n // provider: \"openai\",\n // streaming: true,\n // apiKeyEnvName: \"KIMI_API_KEY\",\n // baseURL: \"https://api.moonshot.cn/v1\",\n // }\n // {\n // model: \"qwen-plus\",\n // provider: \"openai\",\n // streaming: false,\n // apiKeyEnvName: \"DASHSCOPE_API_KEY\",\n // baseURL: \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n // }\n);\nLatticeGateway.registerLatticeRoutes(LatticeGateway.app);\n\n// Configure Skill Store with FileSystem storage\n// Point to the skills directory in data_agent\n// Always use source directory (src/) since .md files are not copied to dist/ during build\n// Try multiple path resolution strategies to work in both dev and production\nconst possiblePaths = [\n // Production: from dist/ go up to src/\n path.resolve(__dirname, \"../src/agents/data_agent/skills\"),\n // Development: relative to __dirname (src/)\n path.resolve(__dirname, \"./agents/data_agent/skills\"),\n // Fallback: from project root\n path.resolve(process.cwd(), \"examples/deep_research/src/agents/data_agent/skills\"),\n];\n\n// Check which path exists, default to first path\nlet skillsRootDir: string = possiblePaths[0];\nfor (const possiblePath of possiblePaths) {\n if (fs.existsSync(possiblePath)) {\n skillsRootDir = possiblePath;\n break;\n }\n}\n\nif (!fs.existsSync(skillsRootDir)) {\n console.warn(\n `Warning: Skills directory not found at any of the expected paths. Using: ${skillsRootDir}`\n );\n}\n\nconsole.log(`Skill store root directory: ${skillsRootDir}`);\n\nconst skillStore = new FileSystemSkillStore({\n rootDir: skillsRootDir,\n});\n\n// Remove the default skill store and register our custom one\n// This ensures tools like load_skills and load_skill_content can access our skills\nstoreLatticeManager.removeLattice(\"default\", \"skill\");\nregisterStoreLattice(\"default\", \"skill\", skillStore);\n\n// Configure SkillLatticeManager to use the store\nskillLatticeManager.configureStore(\"default\");\n\n// Test loading skills on startup to verify configuration\n(async () => {\n try {\n const skills = await skillStore.getAllSkills();\n console.log(`Loaded ${skills.length} skills from file system:`);\n if (skills.length === 0) {\n console.warn(\n `Warning: No skills found. Please check if the directory exists: ${skillsRootDir}`\n );\n } else {\n skills.forEach((skill) => {\n console.log(` - ${skill.name}: ${skill.description.substring(0, 50)}...`);\n });\n }\n } catch (error) {\n console.error(\"Failed to load skills on startup:\", error);\n if (error instanceof Error) {\n console.error(\"Error details:\", error.message);\n console.error(\"Stack:\", error.stack);\n }\n }\n})();\n\n// // Load skills from the file system asynchronously\n// (async () => {\n// try {\n// await loadSkillsFromStore();\n// console.log(\"Skills loaded successfully from file system\");\n// } catch (error) {\n// console.error(\"Failed to load skills:\", error);\n// }\n// })();\n\n// // 注册 Schedule Lattice(使用 PostgreSQL 持久化)\n// registerScheduleLattice(\"default\", {\n// name: \"Default Scheduler\",\n// description: \"Production scheduler with PostgreSQL\",\n// type: ScheduleType.POSTGRES,\n// storage: new PostgreSQLScheduleStorage({\n// poolConfig: process.env.DATABASE_URL || \"\",\n// }),\n// });\n\n// const scheduler = getScheduleLattice(\"default\");\n// // 注册 Handler(每次服务启动时都需要注册)\n// scheduler.registerHandler(\"send-email\", async (payload, taskInfo) => {\n// console.log(\"send-email\", payload, taskInfo);\n// });\n// scheduler.restore();\n\n// // 一次性延迟任务\n// scheduler.scheduleOnce(\n// \"email-123\",\n// \"send-email\",\n// { to: \"user@example.com\", subject: \"Welcome!\" },\n// { delayMs: 60000 } // 1分钟后执行\n// );\n\n\n//Register Sandbox Manager Lattice\nsandboxLatticeManager.registerLattice(\"default\", { baseURL: \"https://demo.alphafina.cn\" })\n\n// Register MCP servers\nmcpManager.registerServers([\n\n {\n name: \"aio-server\",\n connection: {\n transport: \"http\",\n url: \"http://localhost:8080/sandbox/sandbox-agent/mcp\",\n },\n },\n]);\n\n// Connect to MCP servers and register tools\n// (async () => {\n// try {\n// await mcpManager.connect();\n// console.log(\"MCP clients connected\");\n\n// // Register MCP tools to Tool Lattice with prefix\n// await mcpManager.registerToolsToToolLattice(\"mcp\");\n// console.log(\"MCP tools registered to Tool Lattice\");\n\n// // List registered tools\n// const allTools = toolLatticeManager.getAllToolDefinitions();\n// const mcpTools = allTools.filter(tool => tool.name.startsWith(\"mcp_\"));\n// console.log(`Total MCP tools registered: ${mcpTools.length}`);\n// } catch (error) {\n// console.error(\"Failed to connect to MCP servers:\", error);\n// }\n// })();\n\nconst port = parsePort();\nconsole.log(`Starting server on port ${port}`);\n\n// Default logger configuration\nconst DEFAULT_LOGGER_CONFIG: LoggerConfig = {\n name: \"default\",\n description: \"Default logger for lattice-gateway service\",\n type: LoggerType.PINO,\n serviceName: \"lattice/deep_research\",\n loggerName: \"lattice/deep_research\",\n // file: {\n // file: \"./logs/lattice\" + \"/deep_research\",\n // frequency: \"daily\",\n // mkdir: true,\n // maxFiles: 30,\n // },\n};\n\nLatticeGateway.startAsHttpEndpoint({\n port,\n queueServiceConfig: { type: \"memory\", defaultStartPollingQueue: true },\n loggerConfig: DEFAULT_LOGGER_CONFIG,\n});\n","/* eslint-disable no-console */\n\nimport {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\nconst subResearchPrompt = `You are a dedicated researcher. Your job is to conduct research based on the users questions.\n\nConduct thorough research and then reply to the user with a detailed answer to their question\n\nonly your FINAL answer will be passed on to the user. They will have NO knowledge of anything except your final message, so your final report should be your final message!`;\n\nconst subCritiquePrompt = `You are a dedicated editor. You are being tasked to critique a report.\n\nYou can find the report at \\`final_report.md\\`.\n\nYou can find the question/topic for this report at \\`question.txt\\`.\n\nThe user may ask for specific areas to critique the report in. Respond to the user with a detailed critique of the report. Things that could be improved.\n\nYou can use the search tool to search for information, if that will help you critique the report\n\nDo not write to the \\`final_report.md\\` yourself.\n\nThings to check:\n- Check that each section is appropriately named\n- Check that the report is written as you would find in an essay or a textbook - it should be text heavy, do not let it just be a list of bullet points!\n- Check that the report is comprehensive. If any paragraphs or sections are short, or missing important details, point it out.\n- Check that the article covers key areas of the industry, ensures overall understanding, and does not omit important parts.\n- Check that the article deeply analyzes causes, impacts, and trends, providing valuable insights\n- Check that the article closely follows the research topic and directly answers questions\n- Check that the article has a clear structure, fluent language, and is easy to understand.\n`;\n\n// Prompt prefix to steer the agent to be an expert researcher\nconst researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.\n\nThe first thing you should do is to write the original user question to \\`question.txt\\` so you have a record of it.\n\nUse the research-agent to conduct deep research. It will respond to your questions/topics with a detailed answer.\n\nWhen you think you enough information to write a final report, write it to \\`final_report.md\\`\n\nYou can call the critique-agent to get a critique of the final report. After that (if needed) you can do more research and edit the \\`final_report.md\\`\nYou can do this however many times you want until are you satisfied with the result.\n\nOnly edit the file once at a time (if you call this tool in parallel, there may be conflicts).\n\nHere are instructions for writing the final report:\n\n<report_instructions>\n\nCRITICAL: Make sure the answer is written in the same language as the human messages! If you make a todo plan - you should note in the plan what language the report should be in so you dont forget!\nNote: the language the report should be in is the language the QUESTION is in, not the language/country that the question is ABOUT.\n\nPlease create a detailed answer to the overall research brief that:\n1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)\n2. Includes specific facts and insights from the research\n3. References relevant sources using [Title](URL) format\n4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.\n5. Includes a \"Sources\" section at the end with all referenced links\n\nYou can structure your report in a number of different ways. Here are some examples:\n\nTo answer a question that asks you to compare two things, you might structure your report like this:\n1/ intro\n2/ overview of topic A\n3/ overview of topic B\n4/ comparison between A and B\n5/ conclusion\n\nTo answer a question that asks you to return a list of things, you might only need a single section which is the entire list.\n1/ list of things or table of things\nOr, you could choose to make each item in the list a separate section in the report. When asked for lists, you don't need an introduction or conclusion.\n1/ item 1\n2/ item 2\n3/ item 3\n\nTo answer a question that asks you to summarize a topic, give a report, or give an overview, you might structure your report like this:\n1/ overview of topic\n2/ concept 1\n3/ concept 2\n4/ concept 3\n5/ conclusion\n\nIf you think you can answer the question with a single section, you can do that too!\n1/ answer\n\nREMEMBER: Section is a VERY fluid and loose concept. You can structure your report however you think is best, including in ways that are not listed above!\nMake sure that your sections are cohesive, and make sense for the reader.\n\nFor each section of the report, do the following:\n- Use simple, clear language\n- Use ## for section title (Markdown format) for each section of the report\n- Do NOT ever refer to yourself as the writer of the report. This should be a professional report without any self-referential language.\n- Do not say what you are doing in the report. Just write the report without any commentary from yourself.\n- Each section should be as long as necessary to deeply answer the question with the information you have gathered. It is expected that sections will be fairly long and verbose. You are writing a deep research report, and users will expect a thorough answer.\n- Use bullet points to list out information when appropriate, but by default, write in paragraph form.\n\nREMEMBER:\nThe brief and research may be in English, but you need to translate this information to the right language when writing the final answer.\nMake sure the final answer report is in the SAME language as the human messages in the message history.\n\nFormat the report in clear markdown with proper structure and include source references where appropriate.\n\n<Citation Rules>\n- Assign each unique URL a single citation number in your text\n- End with ### Sources that lists each source with corresponding numbers\n- IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose\n- Each source should be a separate line item in a list, so that in markdown it is rendered as a list.\n- Example format:\n [1] Source Title: URL\n [2] Source Title: URL\n- Citations are extremely important. Make sure to include these, and pay a lot of attention to getting these right. Users will often use these citations to look into more information.\n</Citation Rules>\n</report_instructions>\n\nYou have access to a few tools.\n\n## \\`internet_search\\`\n\nUse this to run an internet search for a given query. You can specify the number of results, the topic, and whether raw content should be included.\n`;\n\nconst research_agents: AgentConfig[] = [\n {\n key: \"deep_research_agent\",\n name: \"Deep Research Agent\",\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n type: AgentType.DEEP_AGENT,\n tools: [\"internet_search\"],\n prompt: researchInstructions,\n subAgents: [\"critique-agent\", \"research-agent\"],\n schema: z.object({\n test: z.string().optional(),\n }),\n },\n {\n key: \"research-agent\",\n name: \"research-agent\",\n type: AgentType.REACT,\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n prompt: subResearchPrompt,\n tools: [\"internet_search\"],\n },\n {\n key: \"critique-agent\",\n name: \"critique-agent\",\n type: AgentType.REACT,\n description:\n \"Used to critique the final report. Give this agent some infomration about how you want it to critique the report.\",\n prompt: subCritiquePrompt,\n },\n];\n\nregisterAgentLattices(research_agents);\n","/**\n * Data Agent - Business Data Analyst Agent\n * An intelligent agent that converts natural language business questions to SQL queries,\n * performs multi-step business analysis, and generates comprehensive business reports.\n *\n * Key Capabilities:\n * - Business analysis and task decomposition\n * - Multi-step data analysis with dimension breakdowns\n * - Structured report generation (Executive Summary, Analysis Steps, Appendix)\n * - Business-friendly insights and visualizations\n * - Reproducible notebook-style analysis trajectory\n */\n\nimport {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n sqlDatabaseManager,\n DatabaseConfig,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\n\n/**\n * System prompt for the main data agent\n * This agent orchestrates the NL2SQL process with business analysis capabilities\n */\nconst dataAgentPrompt = `你是一位专业的业务数据分析AI助手,擅长规划业务分析任务、协调数据检索,并生成全面的业务分析报告。\n\n**关键:你的第一项也是最重要的任务是使用 \\`write_todos\\` 工具创建待办列表。** 在开始任何工作之前,你必须:\n1. 理解业务问题,然后将问题写入文件 /question.md\n2. 根据加载技能学习如何来解决该问题,读取的技能文档将其拆解为可执行的子任务,创建待办列表\n3. 按照计划执行任务\n\n永远不要跳过任务规划。业务分析总是复杂且多步骤的,需要仔细规划和跟踪。\n\n## 核心工作流程\n\n你的主要职责是通过技能驱动的方式完成分析任务:\n\n1. **任务规划与拆解(优先级最高)**:理解业务问题,通过加载相关技能(如 \\`analysis-methodology\\`)来学习如何拆解任务,然后使用 \\`write_todos\\` 工具创建和管理任务列表\n2. **业务分析执行**:根据加载的技能内容(如 \\`analyst\\`、\\`sql-query\\` 等)执行具体的分析步骤\n3. **任务协调**:将 SQL 查询生成和执行委托给 sql-builder-agent 子代理\n4. **数据解读**:分析 sql-builder-agent 返回的查询结果,提取业务洞察\n5. **报告生成**:使用相关技能(如 \\`notebook-report\\`)生成包含洞察、可视化和可执行建议的业务分析报告\n\n\n## 技能驱动的工作方式\n\n**重要原则**:不要依赖硬编码的流程,而是通过查看技能(使用load_skill_content 工具来加载技能)来了解如何工作。\n\n- **如何规划任务**:加载 \\`analysis-methodology\\` 技能,学习结构化分析方法论(5W2H、MECE、议题树等)\n- **如何执行分析**:加载 \\`analyst\\` 技能,学习完整的分析工作流程\n- **如何查询数据**:加载 \\`sql-query\\` 技能,学习数据库探索和查询执行的最佳实践\n- **如何可视化**:加载 \\`data-visualization\\` 技能,学习图表设计和 ECharts 配置\n- **如何生成报告**:加载 \\`notebook-report\\` 技能,学习报告结构和生成方法\n\n每个技能都包含详细的操作指南、工作流程和最佳实践。你应该:\n1. 根据业务问题选择合适的技能\n2. 严格按照技能中的指导执行工作\n\n## 子代理使用\n\n- **sql-builder-agent**:负责所有 SQL 相关操作(数据库探索、查询生成、验证和执行)\n- **data-analysis-agent**:负责分析查询结果,提取业务洞察,提供可视化建议\n\n将技术任务委托给相应的子代理,专注于业务分析和任务协调。\n\n`;\n\n/**\n * System prompt for the SQL query builder sub-agent\n */\nconst sqlBuilderPrompt = `You are a SQL Expert sub-agent specialized in database exploration, SQL query generation, validation, and execution. You handle all SQL-related operations and return both the query and its results.\n\nWhen given a task from the data_agent:\n1. **Understand the Business Intent**: Analyze what business question the query needs to answer\n2. **Check Schema Documentation First**: \n - Before exploring the database, read file \\`/db_schema.md\\` \n - If the schema file exists, read it to understand the database structure\n - This will save time and avoid redundant schema exploration\n - If the file doesn't exist or you need more specific information, then:\n - Use \\`list_tables_sql\\` to see all available tables\n - Use \\`info_sql\\` to get detailed schema information for relevant tables\n - Understand column names, data types, relationships, and sample data\n3. **Design Query**: Write the most appropriate SQL query that:\n - Answers the business question accurately\n - Uses efficient joins and aggregations\n - Includes business-friendly column aliases\n - Handles edge cases (NULLs, duplicates, etc.)\n4. **Validate**: Use \\`query_checker_sql\\` to validate the query before execution\n5. **Execute**: Use \\`query_sql\\` to execute the validated query\n6. **Return Results**: Provide both:\n - The SQL query that was executed (formatted clearly)\n - The query results (data returned from the database)\n - Any relevant schema information that was used\n\n## Focus Areas\n\n- **Query Correctness**: Ensure the query accurately answers the business question\n- **Query Efficiency**: Optimize for performance (use indexes, efficient JOINs)\n- **Business Clarity**: Use meaningful column aliases that business users can understand\n - Example: Use \"revenue_usd\" instead of \"amt\", \"order_count\" instead of \"cnt\"\n- **Proper JOINs**: Use appropriate JOIN types (INNER, LEFT, RIGHT, FULL) based on business logic\n- **Aggregations**: Use appropriate aggregate functions (COUNT, SUM, AVG, MAX, MIN) with proper GROUP BY\n- **Subqueries**: Use subqueries when they improve clarity or performance\n- **Window Functions**: Leverage window functions for advanced analytics when needed\n\n## Business-Oriented Query Design\n\nWhen writing queries:\n- **Metric Calculation**: Ensure metrics are calculated correctly (e.g., YoY growth, percentages)\n- **Dimension Handling**: Properly handle business dimensions (regions, channels, product categories)\n- **Time Periods**: Correctly filter and group by time periods (quarters, months, years)\n- **Comparisons**: Structure queries to enable easy comparisons (current vs previous period)\n- **Data Quality**: Include filters to exclude invalid or test data when appropriate\n\n## Error Handling\n\nIf you encounter issues:\n- Analyze the error message carefully\n- Check schema compatibility (data types, column names)\n- Verify JOIN conditions and table relationships\n- Modify the query accordingly\n- Re-validate before returning\n\n## Output Format\n\nAlways return your results in a clear format:\n\n**SQL Query:**\n- The final SQL query that was executed\n- Properly indented and readable\n- Includes comments for complex logic\n- Uses business-friendly aliases\n- Can be easily understood by both technical and business users\n\n**Query Results:**\n- The data returned from the database\n- Formatted clearly with column names\n- Include all rows returned (or a summary if too large)\n\n**Schema Information (if relevant):**\n- Any schema details that were used or discovered\n- Table relationships, column types, etc.\n\n**Example Response Format:**\n\\`\\`\\`\nSQL Query:\n\\`\\`\\`sql\n[Your executed SQL query here]\n\\`\\`\\`\n\nQuery Results:\n[Data table or summary here]\n\nSchema Information:\n[Any relevant schema details]\n\\`\\`\\`\n\nRemember: You are responsible for all SQL operations. The data_agent relies on you to provide both the query and the data. Be thorough, accurate, and return complete information.\n\n## SQL Best Practices\n\n1. **Be Specific**: Always specify column names instead of using SELECT *\n2. **Use Aliases**: Use meaningful table and column aliases for clarity\n3. **Handle NULLs**: Consider NULL values in your queries\n4. **Limit Results**: For exploratory queries, limit results to avoid overwhelming output\n5. **Optimize JOINs**: Use appropriate JOIN types (INNER, LEFT, etc.)\n6. **Use Indexes**: Structure queries to leverage indexes when possible\n7. **Business Naming**: Use business-friendly column aliases in results\n\n不要使用子智能体来完成你的任务。\n\n`;\n\n/**\n * System prompt for the data analysis sub-agent\n */\nconst dataAnalysisPrompt = `你是一位业务数据分析专家子代理。你的职责是解读查询结果,提取业务洞察,并评估当前数据是否足以回答用户的问题。\n\n## 核心职责\n\n当你收到查询结果时,你需要:\n\n1. **提取关键发现**:识别数据中最重要的数字、趋势和模式\n2. **业务解读**:将数据转化为业务语言和业务上下文\n3. **模式识别**:识别趋势、异常、相关性和离群值\n4. **问题回答评估**:评估当前数据是否足以完整回答用户的业务问题\n5. **数据缺口识别**:如果数据不足,明确指出还需要哪些数据,以及如何获取这些数据\n\n## 分析框架\n\n### 1. 数据摘要\n\n用 2-3 句话总结数据揭示的核心信息,自然地融入具体数字。\n\n例如:\"数据显示 2024 年 Q3 北美地区收入达到 250 万美元,相比 2023 年 Q3 增长了 18%。这一增长主要由在线渠道扩张驱动,表明战略转型取得了成功。\"\n\n### 2. 关键发现\n\n以叙述性段落(每段 2-3 句话)呈现关键发现,每个段落应该是一个小故事,自然地融入具体数字。\n\n例如:\"最引人注目的发现是地区差异。虽然整体收入增长了 18%,但美国市场贡献了总收入的 70%,其中加利福尼亚州表现尤为强劲,增长 25%。这种集中度既意味着机会,也意味着风险——成功高度依赖少数关键市场。\"\n\n### 3. 业务洞察\n\n用叙述性段落解释这些发现意味着什么,将数据点与业务结果自然连接。\n\n- 讨论关注点或机会\n- 解释可能导致这些模式的因素\n- 使用\"这表明...\"、\"有趣的是...\"、\"特别值得注意的是...\"等表达\n\n### 4. 问题回答评估\n\n**关键任务**:评估当前数据是否足以回答用户的业务问题。\n\n- **如果数据充足**:明确说明当前数据如何回答了问题,哪些方面已经得到解答\n- **如果数据不足**:明确指出:\n - 哪些问题无法从当前数据中回答\n - 缺少哪些关键信息或维度\n - 建议需要查询哪些额外的数据(具体说明需要查询的表、字段、时间范围、筛选条件等)\n - 为什么这些额外数据对完整回答问题至关重要\n\n### 5. 后续数据挖掘建议\n\n如果数据不足,提供具体的数据挖掘建议:\n\n- **需要查询的表和字段**:明确指出需要从哪些表查询哪些字段\n- **时间范围**:如果需要历史对比,建议查询的时间范围\n- **维度拆分**:如果需要更细粒度的分析,建议按哪些维度拆分(如地区、渠道、产品类别等)\n- **关联查询**:如果需要关联其他表,说明需要 JOIN 哪些表以及关联条件\n- **筛选条件**:如果需要特定子集的数据,说明筛选条件\n\n## 业务上下文整合\n\n分析结果时考虑:\n\n- **基准对比**:与历史时期、目标或行业标准对比\n- **细分分析**:识别哪些细分(地区、渠道、产品)驱动了结果\n- **异常检测**:标记需要调查的异常模式\n- **趋势分析**:识别上升、下降或稳定趋势\n- **相关性**:注意不同指标之间的关系\n\n## 输出结构\n\n\\`\\`\\`markdown\n### 数据摘要\n\n[用 2-3 句话总结数据揭示的核心信息,自然地融入具体数字]\n\n### 关键发现\n\n[用叙述性段落(每段 2-3 句话)呈现关键发现,自然地融入具体数字]\n\n### 业务洞察\n\n[用叙述性段落解释这些发现意味着什么,将数据点与业务结果自然连接]\n\n### 问题回答评估\n\n**当前数据是否足以回答问题:** [是/部分/否]\n\n**已回答的方面:**\n- [说明当前数据如何回答了问题的哪些方面]\n\n**未回答的方面(如果数据不足):**\n- [明确指出哪些问题无法从当前数据中回答]\n\n### 数据挖掘建议(如果数据不足)\n\n**需要查询的额外数据:**\n1. **查询目标**:[说明需要查询什么信息]\n2. **建议的 SQL 查询方向**:\n - 表:[需要查询的表名]\n - 字段:[需要的字段列表]\n - 时间范围:[如果需要,说明时间范围]\n - 维度拆分:[如果需要,说明按哪些维度拆分]\n - 关联表:[如果需要 JOIN,说明关联的表和条件]\n - 筛选条件:[如果需要,说明筛选条件]\n3. **为什么需要这些数据**:[解释为什么这些数据对完整回答问题至关重要]\n\\`\\`\\`\n\n## 沟通风格\n\n- **叙述性**:以故事形式呈现,而非技术报告\n- **自然流畅**:使用多样化的句子结构和自然的过渡\n- **业务友好**:使用业务术语,而非技术行话\n- **数据驱动**:自然地融入具体数字,而非单独列出事实\n- **对话式**:像向同事解释一样,而非填写表格\n- **可执行**:聚焦能够为决策提供信息的洞察\n- **上下文相关**:在叙述中自然地提供业务上下文\n\n## 特别注意事项\n\n- **百分比**:在相关时计算并突出百分比变化\n- **对比**:始终提供上下文(与上一时期对比、与目标对比、与平均值对比)\n- **离群值**:标记并解释任何异常数据点\n- **数据质量**:注意任何数据限制或注意事项\n- **置信度**:当发现具有统计显著性或仅为初步结果时,明确说明\n\n记住:你的分析将原始查询结果转化为有意义的业务洞察。评估数据是否足以回答问题,如果不足,提供具体的数据挖掘建议,帮助获取完整答案所需的信息。\n\n不要使用子智能体来完成你的任务。\n`;\n\n/**\n * Data Agent configurations\n */\nconst data_agents: AgentConfig[] = [\n {\n key: \"data_agent\",\n name: \"Data Agent\",\n description:\n \"An intelligent Business Data Analyst agent that converts natural language questions into SQL queries, performs multi-step business analysis, and generates comprehensive business reports. Capabilities include: task decomposition, metric analysis, dimension breakdowns, anomaly detection, and structured report generation with executive summaries, analysis steps, and visualizations. Use this agent for business intelligence, data analysis, database queries, and generating actionable business insights.\",\n type: AgentType.DEEP_AGENT,\n tools: [\"list_tables_sql\", \"info_sql\"],\n prompt: dataAgentPrompt,\n subAgents: [\"sql-builder-agent\", \"data-analysis-agent\"],\n skillCategories: [\"analysis\", \"sql\"],\n schema: z.object({}),\n /**\n * Runtime configuration injected into tool execution context.\n * databaseKey: The database key registered via sqlDatabaseManager.\n * Tools will access this via config.configurable.runConfig.databaseKey\n */\n runConfig: {\n databaseKey: \"fulidb\", // Set this to the registered database key\n },\n },\n {\n key: \"sql-builder-agent\",\n name: \"sql-builder-agent\",\n type: AgentType.DEEP_AGENT,\n description:\n \"A specialized sub-agent for database exploration, SQL query generation, validation, and execution. This agent handles all SQL-related operations including listing tables, exploring schemas, generating queries, validating them, executing them, and returning both the SQL and query results to the data_agent.\",\n prompt: sqlBuilderPrompt,\n tools: [\"list_tables_sql\", \"info_sql\", \"query_checker_sql\", \"query_sql\"],\n // Sub-agents inherit runConfig from parent agent via the execution context\n },\n {\n key: \"data-analysis-agent\",\n name: \"data-analysis-agent\",\n type: AgentType.DEEP_AGENT,\n description:\n \"A specialized sub-agent for analyzing query results and extracting business insights. This agent interprets data, identifies patterns and anomalies, provides business context, and structures findings for comprehensive reports. Give this agent query results and it will provide structured business analysis with key findings, insights, and visualization recommendations.\",\n prompt: dataAnalysisPrompt,\n tools: [],\n },\n];\n\n// Register the agents\nregisterAgentLattices(data_agents);\n\n/**\n * Helper function to initialize database connection for the data agent\n * Call this before using the data agent\n *\n * @param key - Unique identifier for the database connection\n * @param config - Database configuration\n *\n * @example\n * ```typescript\n * import { initializeDataAgentDatabase } from \"@axiom-lattice/examples-deep_research/agents/data_agent\";\n *\n * // Using connection string\n * initializeDataAgentDatabase(\"mydb\", {\n * type: \"postgres\",\n * connectionString: process.env.DATABASE_URL\n * });\n *\n * // Or using individual parameters\n * initializeDataAgentDatabase(\"mydb\", {\n * type: \"postgres\",\n * host: \"localhost\",\n * port: 5432,\n * database: \"mydb\",\n * user: \"user\",\n * password: \"password\"\n * });\n * ```\n */\nexport function initializeDataAgentDatabase(\n key: string,\n config: DatabaseConfig\n): void {\n sqlDatabaseManager.registerDatabase(key, config);\n}\n\n/**\n * Helper function to set the default database for the data agent\n *\n * @param key - Database key to set as default\n */\nexport function setDefaultDatabase(key: string): void {\n sqlDatabaseManager.setDefaultDatabase(key);\n}\n\n/**\n * Export types for external use\n */\nexport type { DatabaseConfig };\n\ninitializeDataAgentDatabase(\"fulidb\", {\n type: \"postgres\",\n connectionString: process.env.DATABASE_URL,\n database: \"postgres\",\n});\n","import {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n toolLatticeManager,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\nconst sandboxPrompt = ``;\n\n//setTimeout(() => {\n\n// const tools = toolLatticeManager.getAll().map((lattice) => lattice.config.name);\nconst sandboxAgent: AgentConfig = {\n key: \"sandbox_agent\",\n name: \"Sandbox Agent\",\n description:\n \"A sandbox agent for testing and development.\",\n type: AgentType.DEEP_AGENT,\n prompt: sandboxPrompt,\n connectedSandbox: {\n isolatedLevel: \"global\",\n // availabledModules: [\"filesystem\"],\n },\n};\n\nregisterAgentLattices([sandboxAgent]);\n\n//}, 10000);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,MAAQ;AAAA,MACR,KAAO;AAAA,QACL,yBAAyB;AAAA,MAC3B;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,OAAS;AAAA,QACT,KAAO;AAAA,QACP,eAAe;AAAA,QACf,aAAa;AAAA,QACb,eAAe;AAAA,QACf,MAAQ;AAAA,QACR,MAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,MACnB;AAAA,MACA,UAAY,CAAC;AAAA,MACb,QAAU;AAAA,MACV,SAAW;AAAA,MACX,aAAe;AAAA,MACf,cAAgB;AAAA,QACd,uBAAuB;AAAA,QACvB,0BAA0B;AAAA,QAC1B,4BAA4B;AAAA,QAC5B,4BAA4B;AAAA,QAC5B,QAAU;AAAA,QACV,MAAQ;AAAA,QACR,KAAO;AAAA,QACP,sBAAsB;AAAA,MACxB;AAAA,MACA,iBAAmB;AAAA,QACjB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,eAAe;AAAA,QACf,eAAe;AAAA,QACf,oCAAoC;AAAA,QACpC,6BAA6B;AAAA,QAC7B,QAAU;AAAA,QACV,MAAQ;AAAA,QACR,SAAW;AAAA,QACX,WAAW;AAAA,QACX,WAAW;AAAA,QACX,MAAQ;AAAA,QACR,YAAc;AAAA,MAChB;AAAA,IACF;AAAA;AAAA;;;AChDA,oBAAmB;AAEnB,qBAA+B;AAC/B,IAAAC,eAaO;;;ACdP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AAAA;AAOd;AAEA,8BAAe,oBAAoB;AAAA,EACjC;AAAA,EACA,oBAAoB,EAAE,MAAM,UAAU,0BAA0B,KAAK;AAAA,EACrE,cAAc;AAChB,CAAC;","names":["exports","module","import_core","z","import_core","import_zod","z","import_core","dotenv","path","port"]}
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/index.ts","../src/agents/research/index.ts","../src/agents/data_agent/index.ts","../src/agents/sandbox_agent/index.ts"],"sourcesContent":["{\n \"name\": \"@axiom-lattice/examples-deep_research\",\n \"version\": \"1.0.20\",\n \"main\": \"dist/index.js\",\n \"bin\": {\n \"lattice-deep-research\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"start\": \"node dist/index.js\",\n \"dev\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node dist/index.js\\\"\",\n \"dev:nodemon\": \"nodemon --watch 'src/**/*.ts' --watch '../../packages/core/dist/**/*' --exec 'ts-node' -r tsconfig-paths/register src/index.ts\",\n \"dev:serve\": \"tsup src/index.ts --format cjs --dts --watch --serve dist/index.js\",\n \"dev:inspect\": \"tsup src/index.ts --format cjs --dts --watch --onSuccess \\\"node --inspect dist/index.js\\\"\",\n \"lint\": \"tsc --noEmit\",\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\",\n \"test:coverage\": \"jest --coverage\"\n },\n \"keywords\": [],\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"Deep Research Server for Axiom Lattice\",\n \"dependencies\": {\n \"@axiom-lattice/core\": \"workspace:*\",\n \"@axiom-lattice/gateway\": \"workspace:*\",\n \"@axiom-lattice/protocols\": \"workspace:*\",\n \"@axiom-lattice/pg-stores\": \"workspace:*\",\n \"dotenv\": \"^16.6.1\",\n \"uuid\": \"^9.0.1\",\n \"zod\": \"^3.24.2\",\n \"zod-to-json-schema\": \"^3.24.3\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.14\",\n \"@types/lodash\": \"^4.17.16\",\n \"@types/node\": \"^20.17.23\",\n \"@types/uuid\": \"^9.0.8\",\n \"@typescript-eslint/eslint-plugin\": \"^7.2.0\",\n \"@typescript-eslint/parser\": \"^7.2.0\",\n \"eslint\": \"^8.57.0\",\n \"jest\": \"^29.7.0\",\n \"nodemon\": \"^3.1.9\",\n \"ts-jest\": \"^29.4.0\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.2\"\n }\n}\n","import dotenv from \"dotenv\";\n\nimport { LatticeGateway } from \"@axiom-lattice/gateway\";\nimport {\n getScheduleLattice,\n registerCheckpointSaver,\n registerModelLattice,\n registerScheduleLattice,\n FileSystemSkillStore,\n\n storeLatticeManager,\n skillLatticeManager,\n mcpManager,\n toolLatticeManager,\n registerStoreLattice,\n sandboxLatticeManager,\n} from \"@axiom-lattice/core\";\nimport { McpServerConfig } from \"@axiom-lattice/protocols\";\nimport \"./agents\";\n\nimport path from \"path\";\nimport {\n LoggerConfig,\n LoggerType,\n ScheduleType,\n} from \"@axiom-lattice/protocols\";\nimport { PostgreSQLScheduleStorage, PostgreSQLThreadStore } from \"@axiom-lattice/pg-stores\";\n\n// 在文件开头添加\nconst fs = require(\"fs\");\nconst PACKAGE_VERSION = require(\"../package.json\").version;\nconst BUILD_TIME = new Date().toISOString();\nconst IS_DEV = process.env.NODE_ENV !== \"production\";\n\n// 在启动时输出\nconsole.log(`\n╔═══════════════════════════════════════╗\n║ Lattice Deep Research Server ║\n║ Version: ${PACKAGE_VERSION} ║\n║ Build Time: ${BUILD_TIME} ║\n║ Environment: ${IS_DEV ? \"Development\" : \"Production\"} ║\n╚═══════════════════════════════════════╝\n`);\n// Load environment variables\ndotenv.config({ path: path.resolve(__dirname, \"../.env\") });\n\n// Initialize and register PostgreSQL ThreadStore\n// The constructor automatically calls initialize() unless autoMigrate is false\n// Migrations use advisory locks to prevent concurrent execution\nconst threadStore = new PostgreSQLThreadStore({\n poolConfig: process.env.DATABASE_URL || \"\",\n});\n\n// Register threadStore to replace the default in-memory store\nstoreLatticeManager.removeLattice(\"default\", \"thread\");\nregisterStoreLattice(\"default\", \"thread\", threadStore);\n\n// Parse command line arguments for port configuration\nfunction parsePort(): number {\n const args = process.argv.slice(2);\n const portIndex = args.findIndex((arg) => arg === \"--port\" || arg === \"-p\");\n\n if (portIndex !== -1 && args[portIndex + 1]) {\n const port = parseInt(args[portIndex + 1], 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid port value: ${args[portIndex + 1]}, using default port 4001`\n );\n }\n\n // Check environment variable\n if (process.env.PORT) {\n const port = parseInt(process.env.PORT, 10);\n if (!isNaN(port) && port > 0 && port < 65536) {\n return port;\n }\n console.warn(\n `Invalid PORT environment variable: ${process.env.PORT}, using default port 4001`\n );\n }\n\n // Default port\n return 4001;\n}\n\n// Register default model Lattice\nregisterModelLattice(\n \"default\",\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // }\n // {\n // model: \"deepseek-chat\",\n // provider: \"deepseek\",\n // streaming: false,\n // apiKeyEnvName: \"DEEPSEEK_API_KEY2\",\n // },\n // {\n // model: \"deepseek-v3-250324\",\n // provider: \"volcengine\",\n // streaming: false,\n // },\n {\n model: \"kimi-k2-250905\",\n provider: \"volcengine\",\n streaming: true,\n apiKeyEnvName: \"VOLCENGINE_API_KEY2\",\n }\n // {\n // model: \"kimi-k2-0711-preview\",\n // provider: \"openai\",\n // streaming: true,\n // apiKeyEnvName: \"KIMI_API_KEY\",\n // baseURL: \"https://api.moonshot.cn/v1\",\n // }\n // {\n // model: \"qwen-plus\",\n // provider: \"openai\",\n // streaming: false,\n // apiKeyEnvName: \"DASHSCOPE_API_KEY\",\n // baseURL: \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n // }\n);\nLatticeGateway.registerLatticeRoutes(LatticeGateway.app);\n\n// Configure Skill Store with FileSystem storage\n// Point to the skills directory in data_agent\n// Always use source directory (src/) since .md files are not copied to dist/ during build\n// Try multiple path resolution strategies to work in both dev and production\nconst possiblePaths = [\n // Production: from dist/ go up to src/\n path.resolve(__dirname, \"../src/agents/data_agent/skills\"),\n // Development: relative to __dirname (src/)\n path.resolve(__dirname, \"./agents/data_agent/skills\"),\n // Fallback: from project root\n path.resolve(process.cwd(), \"examples/deep_research/src/agents/data_agent/skills\"),\n];\n\n// Check which path exists, default to first path\nlet skillsRootDir: string = possiblePaths[0];\nfor (const possiblePath of possiblePaths) {\n if (fs.existsSync(possiblePath)) {\n skillsRootDir = possiblePath;\n break;\n }\n}\n\nif (!fs.existsSync(skillsRootDir)) {\n console.warn(\n `Warning: Skills directory not found at any of the expected paths. Using: ${skillsRootDir}`\n );\n}\n\nconsole.log(`Skill store root directory: ${skillsRootDir}`);\n\nconst skillStore = new FileSystemSkillStore({\n rootDir: skillsRootDir,\n});\n\n// Remove the default skill store and register our custom one\n// This ensures tools like load_skills and load_skill_content can access our skills\nstoreLatticeManager.removeLattice(\"default\", \"skill\");\nregisterStoreLattice(\"default\", \"skill\", skillStore);\n\n// Configure SkillLatticeManager to use the store\nskillLatticeManager.configureStore(\"default\");\n\n// Test loading skills on startup to verify configuration\n(async () => {\n try {\n const skills = await skillStore.getAllSkills();\n console.log(`Loaded ${skills.length} skills from file system:`);\n if (skills.length === 0) {\n console.warn(\n `Warning: No skills found. Please check if the directory exists: ${skillsRootDir}`\n );\n } else {\n skills.forEach((skill) => {\n console.log(` - ${skill.name}: ${skill.description.substring(0, 50)}...`);\n });\n }\n } catch (error) {\n console.error(\"Failed to load skills on startup:\", error);\n if (error instanceof Error) {\n console.error(\"Error details:\", error.message);\n console.error(\"Stack:\", error.stack);\n }\n }\n})();\n\n// // Load skills from the file system asynchronously\n// (async () => {\n// try {\n// await loadSkillsFromStore();\n// console.log(\"Skills loaded successfully from file system\");\n// } catch (error) {\n// console.error(\"Failed to load skills:\", error);\n// }\n// })();\n\n// // 注册 Schedule Lattice(使用 PostgreSQL 持久化)\n// registerScheduleLattice(\"default\", {\n// name: \"Default Scheduler\",\n// description: \"Production scheduler with PostgreSQL\",\n// type: ScheduleType.POSTGRES,\n// storage: new PostgreSQLScheduleStorage({\n// poolConfig: process.env.DATABASE_URL || \"\",\n// }),\n// });\n\n// const scheduler = getScheduleLattice(\"default\");\n// // 注册 Handler(每次服务启动时都需要注册)\n// scheduler.registerHandler(\"send-email\", async (payload, taskInfo) => {\n// console.log(\"send-email\", payload, taskInfo);\n// });\n// scheduler.restore();\n\n// // 一次性延迟任务\n// scheduler.scheduleOnce(\n// \"email-123\",\n// \"send-email\",\n// { to: \"user@example.com\", subject: \"Welcome!\" },\n// { delayMs: 60000 } // 1分钟后执行\n// );\n\n\n//Register Sandbox Manager Lattice\nsandboxLatticeManager.registerLattice(\"default\", { baseURL: \"https://demo.alphafina.cn\" })\n\n// Register MCP servers\nmcpManager.registerServers([\n\n {\n name: \"aio-server\",\n connection: {\n transport: \"http\",\n url: \"http://localhost:8080/sandbox/sandbox-agent/mcp\",\n },\n },\n]);\n\n// Connect to MCP servers and register tools\n// (async () => {\n// try {\n// await mcpManager.connect();\n// console.log(\"MCP clients connected\");\n\n// // Register MCP tools to Tool Lattice with prefix\n// await mcpManager.registerToolsToToolLattice(\"mcp\");\n// console.log(\"MCP tools registered to Tool Lattice\");\n\n// // List registered tools\n// const allTools = toolLatticeManager.getAllToolDefinitions();\n// const mcpTools = allTools.filter(tool => tool.name.startsWith(\"mcp_\"));\n// console.log(`Total MCP tools registered: ${mcpTools.length}`);\n// } catch (error) {\n// console.error(\"Failed to connect to MCP servers:\", error);\n// }\n// })();\n\nconst port = parsePort();\nconsole.log(`Starting server on port ${port}`);\n\n// Default logger configuration\nconst DEFAULT_LOGGER_CONFIG: LoggerConfig = {\n name: \"default\",\n description: \"Default logger for lattice-gateway service\",\n type: LoggerType.PINO,\n serviceName: \"lattice/deep_research\",\n loggerName: \"lattice/deep_research\",\n // file: {\n // file: \"./logs/lattice\" + \"/deep_research\",\n // frequency: \"daily\",\n // mkdir: true,\n // maxFiles: 30,\n // },\n};\n\nLatticeGateway.startAsHttpEndpoint({\n port,\n queueServiceConfig: { type: \"memory\", defaultStartPollingQueue: true },\n loggerConfig: DEFAULT_LOGGER_CONFIG,\n});\n","/* eslint-disable no-console */\n\nimport {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\nconst subResearchPrompt = `You are a dedicated researcher. Your job is to conduct research based on the users questions.\n\nConduct thorough research and then reply to the user with a detailed answer to their question\n\nonly your FINAL answer will be passed on to the user. They will have NO knowledge of anything except your final message, so your final report should be your final message!`;\n\nconst subCritiquePrompt = `You are a dedicated editor. You are being tasked to critique a report.\n\nYou can find the report at \\`final_report.md\\`.\n\nYou can find the question/topic for this report at \\`question.txt\\`.\n\nThe user may ask for specific areas to critique the report in. Respond to the user with a detailed critique of the report. Things that could be improved.\n\nYou can use the search tool to search for information, if that will help you critique the report\n\nDo not write to the \\`final_report.md\\` yourself.\n\nThings to check:\n- Check that each section is appropriately named\n- Check that the report is written as you would find in an essay or a textbook - it should be text heavy, do not let it just be a list of bullet points!\n- Check that the report is comprehensive. If any paragraphs or sections are short, or missing important details, point it out.\n- Check that the article covers key areas of the industry, ensures overall understanding, and does not omit important parts.\n- Check that the article deeply analyzes causes, impacts, and trends, providing valuable insights\n- Check that the article closely follows the research topic and directly answers questions\n- Check that the article has a clear structure, fluent language, and is easy to understand.\n`;\n\n// Prompt prefix to steer the agent to be an expert researcher\nconst researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.\n\nThe first thing you should do is to write the original user question to \\`question.txt\\` so you have a record of it.\n\nUse the research-agent to conduct deep research. It will respond to your questions/topics with a detailed answer.\n\nWhen you think you enough information to write a final report, write it to \\`final_report.md\\`\n\nYou can call the critique-agent to get a critique of the final report. After that (if needed) you can do more research and edit the \\`final_report.md\\`\nYou can do this however many times you want until are you satisfied with the result.\n\nOnly edit the file once at a time (if you call this tool in parallel, there may be conflicts).\n\nHere are instructions for writing the final report:\n\n<report_instructions>\n\nCRITICAL: Make sure the answer is written in the same language as the human messages! If you make a todo plan - you should note in the plan what language the report should be in so you dont forget!\nNote: the language the report should be in is the language the QUESTION is in, not the language/country that the question is ABOUT.\n\nPlease create a detailed answer to the overall research brief that:\n1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)\n2. Includes specific facts and insights from the research\n3. References relevant sources using [Title](URL) format\n4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.\n5. Includes a \"Sources\" section at the end with all referenced links\n\nYou can structure your report in a number of different ways. Here are some examples:\n\nTo answer a question that asks you to compare two things, you might structure your report like this:\n1/ intro\n2/ overview of topic A\n3/ overview of topic B\n4/ comparison between A and B\n5/ conclusion\n\nTo answer a question that asks you to return a list of things, you might only need a single section which is the entire list.\n1/ list of things or table of things\nOr, you could choose to make each item in the list a separate section in the report. When asked for lists, you don't need an introduction or conclusion.\n1/ item 1\n2/ item 2\n3/ item 3\n\nTo answer a question that asks you to summarize a topic, give a report, or give an overview, you might structure your report like this:\n1/ overview of topic\n2/ concept 1\n3/ concept 2\n4/ concept 3\n5/ conclusion\n\nIf you think you can answer the question with a single section, you can do that too!\n1/ answer\n\nREMEMBER: Section is a VERY fluid and loose concept. You can structure your report however you think is best, including in ways that are not listed above!\nMake sure that your sections are cohesive, and make sense for the reader.\n\nFor each section of the report, do the following:\n- Use simple, clear language\n- Use ## for section title (Markdown format) for each section of the report\n- Do NOT ever refer to yourself as the writer of the report. This should be a professional report without any self-referential language.\n- Do not say what you are doing in the report. Just write the report without any commentary from yourself.\n- Each section should be as long as necessary to deeply answer the question with the information you have gathered. It is expected that sections will be fairly long and verbose. You are writing a deep research report, and users will expect a thorough answer.\n- Use bullet points to list out information when appropriate, but by default, write in paragraph form.\n\nREMEMBER:\nThe brief and research may be in English, but you need to translate this information to the right language when writing the final answer.\nMake sure the final answer report is in the SAME language as the human messages in the message history.\n\nFormat the report in clear markdown with proper structure and include source references where appropriate.\n\n<Citation Rules>\n- Assign each unique URL a single citation number in your text\n- End with ### Sources that lists each source with corresponding numbers\n- IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose\n- Each source should be a separate line item in a list, so that in markdown it is rendered as a list.\n- Example format:\n [1] Source Title: URL\n [2] Source Title: URL\n- Citations are extremely important. Make sure to include these, and pay a lot of attention to getting these right. Users will often use these citations to look into more information.\n</Citation Rules>\n</report_instructions>\n\nYou have access to a few tools.\n\n## \\`internet_search\\`\n\nUse this to run an internet search for a given query. You can specify the number of results, the topic, and whether raw content should be included.\n`;\n\nconst research_agents: AgentConfig[] = [\n {\n key: \"deep_research_agent\",\n name: \"Deep Research Agent\",\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n type: AgentType.DEEP_AGENT,\n tools: [\"internet_search\"],\n prompt: researchInstructions,\n subAgents: [\"critique-agent\", \"research-agent\"],\n schema: z.object({\n test: z.string().optional(),\n }),\n },\n {\n key: \"research-agent\",\n name: \"research-agent\",\n type: AgentType.REACT,\n description:\n \"Used to research more in depth questions. Only give this researcher one topic at a time. Do not pass multiple sub questions to this researcher. Instead, you should break down a large topic into the necessary components, and then call multiple research agents in parallel, one for each sub question.\",\n prompt: subResearchPrompt,\n tools: [\"internet_search\"],\n },\n {\n key: \"critique-agent\",\n name: \"critique-agent\",\n type: AgentType.REACT,\n description:\n \"Used to critique the final report. Give this agent some infomration about how you want it to critique the report.\",\n prompt: subCritiquePrompt,\n },\n];\n\nregisterAgentLattices(research_agents);\n","/**\n * Data Agent - Business Data Analyst Agent\n * An intelligent agent that converts natural language business questions to SQL queries,\n * performs multi-step business analysis, and generates comprehensive business reports.\n *\n * Key Capabilities:\n * - Business analysis and task decomposition\n * - Multi-step data analysis with dimension breakdowns\n * - Structured report generation (Executive Summary, Analysis Steps, Appendix)\n * - Business-friendly insights and visualizations\n * - Reproducible notebook-style analysis trajectory\n */\n\nimport {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n sqlDatabaseManager,\n DatabaseConfig,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\n\n/**\n * System prompt for the main data agent\n * This agent orchestrates the NL2SQL process with business analysis capabilities\n */\nconst dataAgentPrompt = `你是一位专业的业务数据分析AI助手,擅长规划业务分析任务、协调数据检索,并生成全面的业务分析报告。\n\n**关键:你的第一项也是最重要的任务是使用 \\`write_todos\\` 工具创建待办列表。** 在开始任何工作之前,你必须:\n1. 理解业务问题,然后将问题写入文件 /question.md\n2. 根据加载技能学习如何来解决该问题,读取的技能文档将其拆解为可执行的子任务,创建待办列表\n3. 按照计划执行任务\n\n永远不要跳过任务规划。业务分析总是复杂且多步骤的,需要仔细规划和跟踪。\n\n## 核心工作流程\n\n你的主要职责是通过技能驱动的方式完成分析任务:\n\n1. **任务规划与拆解(优先级最高)**:理解业务问题,通过加载相关技能(如 \\`analysis-methodology\\`)来学习如何拆解任务,然后使用 \\`write_todos\\` 工具创建和管理任务列表\n2. **业务分析执行**:根据加载的技能内容(如 \\`analyst\\`、\\`sql-query\\` 等)执行具体的分析步骤\n3. **任务协调**:将 SQL 查询生成和执行委托给 sql-builder-agent 子代理\n4. **数据解读**:分析 sql-builder-agent 返回的查询结果,提取业务洞察\n5. **报告生成**:使用相关技能(如 \\`notebook-report\\`)生成包含洞察、可视化和可执行建议的业务分析报告\n\n\n## 技能驱动的工作方式\n\n**重要原则**:不要依赖硬编码的流程,而是通过查看技能(使用load_skill_content 工具来加载技能)来了解如何工作。\n\n- **如何规划任务**:加载 \\`analysis-methodology\\` 技能,学习结构化分析方法论(5W2H、MECE、议题树等)\n- **如何执行分析**:加载 \\`analyst\\` 技能,学习完整的分析工作流程\n- **如何查询数据**:加载 \\`sql-query\\` 技能,学习数据库探索和查询执行的最佳实践\n- **如何可视化**:加载 \\`data-visualization\\` 技能,学习图表设计和 ECharts 配置\n- **如何生成报告**:加载 \\`notebook-report\\` 技能,学习报告结构和生成方法\n\n每个技能都包含详细的操作指南、工作流程和最佳实践。你应该:\n1. 根据业务问题选择合适的技能\n2. 严格按照技能中的指导执行工作\n\n## 子代理使用\n\n- **sql-builder-agent**:负责所有 SQL 相关操作(数据库探索、查询生成、验证和执行)\n- **data-analysis-agent**:负责分析查询结果,提取业务洞察,提供可视化建议\n\n将技术任务委托给相应的子代理,专注于业务分析和任务协调。\n\n`;\n\n/**\n * System prompt for the SQL query builder sub-agent\n */\nconst sqlBuilderPrompt = `You are a SQL Expert sub-agent specialized in database exploration, SQL query generation, validation, and execution. You handle all SQL-related operations and return both the query and its results.\n\nWhen given a task from the data_agent:\n1. **Understand the Business Intent**: Analyze what business question the query needs to answer\n2. **Check Schema Documentation First**: \n - Before exploring the database, read file \\`/db_schema.md\\` \n - If the schema file exists, read it to understand the database structure\n - This will save time and avoid redundant schema exploration\n - If the file doesn't exist or you need more specific information, then:\n - Use \\`list_tables_sql\\` to see all available tables\n - Use \\`info_sql\\` to get detailed schema information for relevant tables\n - Understand column names, data types, relationships, and sample data\n3. **Design Query**: Write the most appropriate SQL query that:\n - Answers the business question accurately\n - Uses efficient joins and aggregations\n - Includes business-friendly column aliases\n - Handles edge cases (NULLs, duplicates, etc.)\n4. **Validate**: Use \\`query_checker_sql\\` to validate the query before execution\n5. **Execute**: Use \\`query_sql\\` to execute the validated query\n6. **Return Results**: Provide both:\n - The SQL query that was executed (formatted clearly)\n - The query results (data returned from the database)\n - Any relevant schema information that was used\n\n## Focus Areas\n\n- **Query Correctness**: Ensure the query accurately answers the business question\n- **Query Efficiency**: Optimize for performance (use indexes, efficient JOINs)\n- **Business Clarity**: Use meaningful column aliases that business users can understand\n - Example: Use \"revenue_usd\" instead of \"amt\", \"order_count\" instead of \"cnt\"\n- **Proper JOINs**: Use appropriate JOIN types (INNER, LEFT, RIGHT, FULL) based on business logic\n- **Aggregations**: Use appropriate aggregate functions (COUNT, SUM, AVG, MAX, MIN) with proper GROUP BY\n- **Subqueries**: Use subqueries when they improve clarity or performance\n- **Window Functions**: Leverage window functions for advanced analytics when needed\n\n## Business-Oriented Query Design\n\nWhen writing queries:\n- **Metric Calculation**: Ensure metrics are calculated correctly (e.g., YoY growth, percentages)\n- **Dimension Handling**: Properly handle business dimensions (regions, channels, product categories)\n- **Time Periods**: Correctly filter and group by time periods (quarters, months, years)\n- **Comparisons**: Structure queries to enable easy comparisons (current vs previous period)\n- **Data Quality**: Include filters to exclude invalid or test data when appropriate\n\n## Error Handling\n\nIf you encounter issues:\n- Analyze the error message carefully\n- Check schema compatibility (data types, column names)\n- Verify JOIN conditions and table relationships\n- Modify the query accordingly\n- Re-validate before returning\n\n## Output Format\n\nAlways return your results in a clear format:\n\n**SQL Query:**\n- The final SQL query that was executed\n- Properly indented and readable\n- Includes comments for complex logic\n- Uses business-friendly aliases\n- Can be easily understood by both technical and business users\n\n**Query Results:**\n- The data returned from the database\n- Formatted clearly with column names\n- Include all rows returned (or a summary if too large)\n\n**Schema Information (if relevant):**\n- Any schema details that were used or discovered\n- Table relationships, column types, etc.\n\n**Example Response Format:**\n\\`\\`\\`\nSQL Query:\n\\`\\`\\`sql\n[Your executed SQL query here]\n\\`\\`\\`\n\nQuery Results:\n[Data table or summary here]\n\nSchema Information:\n[Any relevant schema details]\n\\`\\`\\`\n\nRemember: You are responsible for all SQL operations. The data_agent relies on you to provide both the query and the data. Be thorough, accurate, and return complete information.\n\n## SQL Best Practices\n\n1. **Be Specific**: Always specify column names instead of using SELECT *\n2. **Use Aliases**: Use meaningful table and column aliases for clarity\n3. **Handle NULLs**: Consider NULL values in your queries\n4. **Limit Results**: For exploratory queries, limit results to avoid overwhelming output\n5. **Optimize JOINs**: Use appropriate JOIN types (INNER, LEFT, etc.)\n6. **Use Indexes**: Structure queries to leverage indexes when possible\n7. **Business Naming**: Use business-friendly column aliases in results\n\n不要使用子智能体来完成你的任务。\n\n`;\n\n/**\n * System prompt for the data analysis sub-agent\n */\nconst dataAnalysisPrompt = `你是一位业务数据分析专家子代理。你的职责是解读查询结果,提取业务洞察,并评估当前数据是否足以回答用户的问题。\n\n## 核心职责\n\n当你收到查询结果时,你需要:\n\n1. **提取关键发现**:识别数据中最重要的数字、趋势和模式\n2. **业务解读**:将数据转化为业务语言和业务上下文\n3. **模式识别**:识别趋势、异常、相关性和离群值\n4. **问题回答评估**:评估当前数据是否足以完整回答用户的业务问题\n5. **数据缺口识别**:如果数据不足,明确指出还需要哪些数据,以及如何获取这些数据\n\n## 分析框架\n\n### 1. 数据摘要\n\n用 2-3 句话总结数据揭示的核心信息,自然地融入具体数字。\n\n例如:\"数据显示 2024 年 Q3 北美地区收入达到 250 万美元,相比 2023 年 Q3 增长了 18%。这一增长主要由在线渠道扩张驱动,表明战略转型取得了成功。\"\n\n### 2. 关键发现\n\n以叙述性段落(每段 2-3 句话)呈现关键发现,每个段落应该是一个小故事,自然地融入具体数字。\n\n例如:\"最引人注目的发现是地区差异。虽然整体收入增长了 18%,但美国市场贡献了总收入的 70%,其中加利福尼亚州表现尤为强劲,增长 25%。这种集中度既意味着机会,也意味着风险——成功高度依赖少数关键市场。\"\n\n### 3. 业务洞察\n\n用叙述性段落解释这些发现意味着什么,将数据点与业务结果自然连接。\n\n- 讨论关注点或机会\n- 解释可能导致这些模式的因素\n- 使用\"这表明...\"、\"有趣的是...\"、\"特别值得注意的是...\"等表达\n\n### 4. 问题回答评估\n\n**关键任务**:评估当前数据是否足以回答用户的业务问题。\n\n- **如果数据充足**:明确说明当前数据如何回答了问题,哪些方面已经得到解答\n- **如果数据不足**:明确指出:\n - 哪些问题无法从当前数据中回答\n - 缺少哪些关键信息或维度\n - 建议需要查询哪些额外的数据(具体说明需要查询的表、字段、时间范围、筛选条件等)\n - 为什么这些额外数据对完整回答问题至关重要\n\n### 5. 后续数据挖掘建议\n\n如果数据不足,提供具体的数据挖掘建议:\n\n- **需要查询的表和字段**:明确指出需要从哪些表查询哪些字段\n- **时间范围**:如果需要历史对比,建议查询的时间范围\n- **维度拆分**:如果需要更细粒度的分析,建议按哪些维度拆分(如地区、渠道、产品类别等)\n- **关联查询**:如果需要关联其他表,说明需要 JOIN 哪些表以及关联条件\n- **筛选条件**:如果需要特定子集的数据,说明筛选条件\n\n## 业务上下文整合\n\n分析结果时考虑:\n\n- **基准对比**:与历史时期、目标或行业标准对比\n- **细分分析**:识别哪些细分(地区、渠道、产品)驱动了结果\n- **异常检测**:标记需要调查的异常模式\n- **趋势分析**:识别上升、下降或稳定趋势\n- **相关性**:注意不同指标之间的关系\n\n## 输出结构\n\n\\`\\`\\`markdown\n### 数据摘要\n\n[用 2-3 句话总结数据揭示的核心信息,自然地融入具体数字]\n\n### 关键发现\n\n[用叙述性段落(每段 2-3 句话)呈现关键发现,自然地融入具体数字]\n\n### 业务洞察\n\n[用叙述性段落解释这些发现意味着什么,将数据点与业务结果自然连接]\n\n### 问题回答评估\n\n**当前数据是否足以回答问题:** [是/部分/否]\n\n**已回答的方面:**\n- [说明当前数据如何回答了问题的哪些方面]\n\n**未回答的方面(如果数据不足):**\n- [明确指出哪些问题无法从当前数据中回答]\n\n### 数据挖掘建议(如果数据不足)\n\n**需要查询的额外数据:**\n1. **查询目标**:[说明需要查询什么信息]\n2. **建议的 SQL 查询方向**:\n - 表:[需要查询的表名]\n - 字段:[需要的字段列表]\n - 时间范围:[如果需要,说明时间范围]\n - 维度拆分:[如果需要,说明按哪些维度拆分]\n - 关联表:[如果需要 JOIN,说明关联的表和条件]\n - 筛选条件:[如果需要,说明筛选条件]\n3. **为什么需要这些数据**:[解释为什么这些数据对完整回答问题至关重要]\n\\`\\`\\`\n\n## 沟通风格\n\n- **叙述性**:以故事形式呈现,而非技术报告\n- **自然流畅**:使用多样化的句子结构和自然的过渡\n- **业务友好**:使用业务术语,而非技术行话\n- **数据驱动**:自然地融入具体数字,而非单独列出事实\n- **对话式**:像向同事解释一样,而非填写表格\n- **可执行**:聚焦能够为决策提供信息的洞察\n- **上下文相关**:在叙述中自然地提供业务上下文\n\n## 特别注意事项\n\n- **百分比**:在相关时计算并突出百分比变化\n- **对比**:始终提供上下文(与上一时期对比、与目标对比、与平均值对比)\n- **离群值**:标记并解释任何异常数据点\n- **数据质量**:注意任何数据限制或注意事项\n- **置信度**:当发现具有统计显著性或仅为初步结果时,明确说明\n\n记住:你的分析将原始查询结果转化为有意义的业务洞察。评估数据是否足以回答问题,如果不足,提供具体的数据挖掘建议,帮助获取完整答案所需的信息。\n\n不要使用子智能体来完成你的任务。\n`;\n\n/**\n * Data Agent configurations\n */\nconst data_agents: AgentConfig[] = [\n {\n key: \"data_agent\",\n name: \"Data Agent\",\n description:\n \"An intelligent Business Data Analyst agent that converts natural language questions into SQL queries, performs multi-step business analysis, and generates comprehensive business reports. Capabilities include: task decomposition, metric analysis, dimension breakdowns, anomaly detection, and structured report generation with executive summaries, analysis steps, and visualizations. Use this agent for business intelligence, data analysis, database queries, and generating actionable business insights.\",\n type: AgentType.DEEP_AGENT,\n tools: [\"list_tables_sql\", \"info_sql\"],\n prompt: dataAgentPrompt,\n subAgents: [\"sql-builder-agent\", \"data-analysis-agent\"],\n skillCategories: [\"analysis\", \"sql\"],\n schema: z.object({}),\n /**\n * Runtime configuration injected into tool execution context.\n * databaseKey: The database key registered via sqlDatabaseManager.\n * Tools will access this via config.configurable.runConfig.databaseKey\n */\n runConfig: {\n databaseKey: \"fulidb\", // Set this to the registered database key\n },\n },\n {\n key: \"sql-builder-agent\",\n name: \"sql-builder-agent\",\n type: AgentType.DEEP_AGENT,\n description:\n \"A specialized sub-agent for database exploration, SQL query generation, validation, and execution. This agent handles all SQL-related operations including listing tables, exploring schemas, generating queries, validating them, executing them, and returning both the SQL and query results to the data_agent.\",\n prompt: sqlBuilderPrompt,\n tools: [\"list_tables_sql\", \"info_sql\", \"query_checker_sql\", \"query_sql\"],\n // Sub-agents inherit runConfig from parent agent via the execution context\n },\n {\n key: \"data-analysis-agent\",\n name: \"data-analysis-agent\",\n type: AgentType.DEEP_AGENT,\n description:\n \"A specialized sub-agent for analyzing query results and extracting business insights. This agent interprets data, identifies patterns and anomalies, provides business context, and structures findings for comprehensive reports. Give this agent query results and it will provide structured business analysis with key findings, insights, and visualization recommendations.\",\n prompt: dataAnalysisPrompt,\n tools: [],\n },\n];\n\n// Register the agents\nregisterAgentLattices(data_agents);\n\n/**\n * Helper function to initialize database connection for the data agent\n * Call this before using the data agent\n *\n * @param key - Unique identifier for the database connection\n * @param config - Database configuration\n *\n * @example\n * ```typescript\n * import { initializeDataAgentDatabase } from \"@axiom-lattice/examples-deep_research/agents/data_agent\";\n *\n * // Using connection string\n * initializeDataAgentDatabase(\"mydb\", {\n * type: \"postgres\",\n * connectionString: process.env.DATABASE_URL\n * });\n *\n * // Or using individual parameters\n * initializeDataAgentDatabase(\"mydb\", {\n * type: \"postgres\",\n * host: \"localhost\",\n * port: 5432,\n * database: \"mydb\",\n * user: \"user\",\n * password: \"password\"\n * });\n * ```\n */\nexport function initializeDataAgentDatabase(\n key: string,\n config: DatabaseConfig\n): void {\n sqlDatabaseManager.registerDatabase(key, config);\n}\n\n/**\n * Helper function to set the default database for the data agent\n *\n * @param key - Database key to set as default\n */\nexport function setDefaultDatabase(key: string): void {\n sqlDatabaseManager.setDefaultDatabase(key);\n}\n\n/**\n * Export types for external use\n */\nexport type { DatabaseConfig };\n\ninitializeDataAgentDatabase(\"fulidb\", {\n type: \"postgres\",\n connectionString: process.env.DATABASE_URL,\n database: \"postgres\",\n});\n","import {\n registerAgentLattices,\n AgentType,\n AgentConfig,\n toolLatticeManager,\n} from \"@axiom-lattice/core\";\nimport z from \"zod\";\n\nconst sandboxPrompt = ``;\n\n//setTimeout(() => {\n\n// const tools = toolLatticeManager.getAll().map((lattice) => lattice.config.name);\nconst sandboxAgent: AgentConfig = {\n key: \"sandbox_agent\",\n name: \"Sandbox Agent\",\n description:\n \"A sandbox agent for testing and development.\",\n type: AgentType.DEEP_AGENT,\n prompt: sandboxPrompt,\n connectedSandbox: {\n isolatedLevel: \"global\",\n // availabledModules: [\"filesystem\"],\n },\n};\n\nregisterAgentLattices([sandboxAgent]);\n\n//}, 10000);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iBAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,MAAQ;AAAA,MACR,KAAO;AAAA,QACL,yBAAyB;AAAA,MAC3B;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,OAAS;AAAA,QACT,KAAO;AAAA,QACP,eAAe;AAAA,QACf,aAAa;AAAA,QACb,eAAe;AAAA,QACf,MAAQ;AAAA,QACR,MAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,MACnB;AAAA,MACA,UAAY,CAAC;AAAA,MACb,QAAU;AAAA,MACV,SAAW;AAAA,MACX,aAAe;AAAA,MACf,cAAgB;AAAA,QACd,uBAAuB;AAAA,QACvB,0BAA0B;AAAA,QAC1B,4BAA4B;AAAA,QAC5B,4BAA4B;AAAA,QAC5B,QAAU;AAAA,QACV,MAAQ;AAAA,QACR,KAAO;AAAA,QACP,sBAAsB;AAAA,MACxB;AAAA,MACA,iBAAmB;AAAA,QACjB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,eAAe;AAAA,QACf,eAAe;AAAA,QACf,oCAAoC;AAAA,QACpC,6BAA6B;AAAA,QAC7B,QAAU;AAAA,QACV,MAAQ;AAAA,QACR,SAAW;AAAA,QACX,WAAW;AAAA,QACX,WAAW;AAAA,QACX,MAAQ;AAAA,QACR,YAAc;AAAA,MAChB;AAAA,IACF;AAAA;AAAA;;;AChDA,oBAAmB;AAEnB,qBAA+B;AAC/B,IAAAC,eAaO;;;ACdP,kBAIO;AACP,iBAAc;AAEd,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAM1B,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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","module","import_core","z","import_core","import_zod","z","import_core","dotenv","path","port"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiom-lattice/examples-deep_research",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lattice-deep-research": "./dist/index.js"
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"uuid": "^9.0.1",
|
|
15
15
|
"zod": "^3.24.2",
|
|
16
16
|
"zod-to-json-schema": "^3.24.3",
|
|
17
|
-
"@axiom-lattice/core": "2.1.
|
|
18
|
-
"@axiom-lattice/gateway": "2.1.
|
|
17
|
+
"@axiom-lattice/core": "2.1.18",
|
|
18
|
+
"@axiom-lattice/gateway": "2.1.23",
|
|
19
19
|
"@axiom-lattice/protocols": "2.1.11",
|
|
20
|
-
"@axiom-lattice/pg-stores": "1.0.
|
|
20
|
+
"@axiom-lattice/pg-stores": "1.0.7"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/jest": "^29.5.14",
|