@axiom-lattice/examples-deep_research 1.0.26 → 1.0.27

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/.env CHANGED
@@ -1,4 +1,5 @@
1
1
  # Server Configuration
2
+ # Server port; set to e.g. 4002 if 4001 is already in use
2
3
  PORT=4001
3
4
  NODE_ENV=development
4
5
 
@@ -19,11 +20,16 @@ VOLCENGINE_API_KEY2=a0533576-d6ed-4ca4-a308-473cbf7ebd10
19
20
  TAVILY_API_KEY=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
20
21
 
21
22
  DATABASE_URL=postgresql://postgres_fuli:jfd4whz%40GPF2nqx7zhm@pgm-uf615169n98t95tflo.pg.rds.aliyuncs.com:5432/postgres
23
+
24
+ # Database Configuration Store Encryption Key (Required in production)
25
+ # Generate with: openssl rand -base64 32
26
+ LATTICE_ENCRYPTION_KEY="deep-research-encryption-key-change-in-production!"
27
+
22
28
  # QUEUE_NAME=simon_tasks
23
29
  # REDIS_URL=redis://localhost:6379
24
30
  # REDIS_PASSWORD=fina
25
31
 
26
- LANGSMITH_TRACING=true
27
- LANGSMITH_ENDPOINT="https://api.smith.langchain.com"
28
- LANGSMITH_API_KEY="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"
29
- LANGSMITH_PROJECT=deepsearch
32
+ # LANGSMITH_TRACING=true
33
+ # LANGSMITH_ENDPOINT="https://api.smith.langchain.com"
34
+ # LANGSMITH_API_KEY="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"
35
+ # LANGSMITH_PROJECT=deepsearch
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/examples-deep_research@1.0.26 build /home/runner/work/agentic/agentic/examples/deep_research
2
+ > @axiom-lattice/examples-deep_research@1.0.27 build /home/runner/work/agentic/agentic/examples/deep_research
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,9 +9,9 @@
9
9
  CLI Target: es2020
10
10
  CLI Cleaning output folder
11
11
  CJS Build start
12
- CJS dist/index.js 43.50 KB
13
- CJS dist/index.js.map 45.16 KB
14
- CJS ⚡️ Build success in 49ms
12
+ CJS dist/index.js 47.72 KB
13
+ CJS dist/index.js.map 52.21 KB
14
+ CJS ⚡️ Build success in 99ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 5608ms
16
+ DTS ⚡️ Build success in 5795ms
17
17
  DTS dist/index.d.ts 13.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @axiom-lattice/examples-deep_research
2
2
 
3
+ ## 1.0.27
4
+
5
+ ### Patch Changes
6
+
7
+ - faf1bad: update team and more
8
+ - Updated dependencies [faf1bad]
9
+ - @axiom-lattice/pg-stores@1.0.14
10
+ - @axiom-lattice/core@2.1.24
11
+ - @axiom-lattice/gateway@2.1.29
12
+ - @axiom-lattice/protocols@2.1.14
13
+
3
14
  ## 1.0.26
4
15
 
5
16
  ### Patch Changes
@@ -0,0 +1,290 @@
1
+ # PostgreSQL DatabaseConfigStore 配置说明
2
+
3
+ ## 配置概览
4
+
5
+ 已在 deep_research 示例中配置使用 PostgreSQL 存储数据库连接配置。
6
+
7
+ ## 环境变量
8
+
9
+ ### .env 文件更新
10
+
11
+ ```bash
12
+ # 数据库连接(已存在)
13
+ DATABASE_URL=postgresql://postgres_fuli:jfd4whz%40GPF2nqx7zhm@pgm-uf615169n98t95tflo.pg.rds.aliyuncs.com:5432/postgres
14
+
15
+ # 新增:加密密钥(生产环境必需)
16
+ LATTICE_ENCRYPTION_KEY="deep-research-encryption-key-change-in-production!"
17
+ ```
18
+
19
+ ### 生成安全的加密密钥
20
+
21
+ ```bash
22
+ # 方法 1: 使用 openssl
23
+ openssl rand -base64 32
24
+
25
+ # 方法 2: 使用 Node.js
26
+ node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
27
+
28
+ # 方法 3: 使用 uuid
29
+ node -e "console.log(require('crypto').randomUUID())"
30
+ ```
31
+
32
+ ## 代码更新
33
+
34
+ ### src/index.ts
35
+
36
+ ```typescript
37
+ import { PostgreSQLDatabaseConfigStore } from "@axiom-lattice/pg-stores";
38
+
39
+ // 初始化 PostgreSQL DatabaseConfigStore
40
+ const databaseConfigStore = new PostgreSQLDatabaseConfigStore({
41
+ poolConfig: process.env.DATABASE_URL || "",
42
+ autoMigrate: true, // 自动运行数据库迁移
43
+ });
44
+
45
+ // 注册到 StoreLatticeManager
46
+ storeLatticeManager.removeLattice("default", "database");
47
+ registerStoreLattice("default", "database", databaseConfigStore);
48
+ ```
49
+
50
+ ## 数据库表结构
51
+
52
+ 启动时会自动创建以下表:
53
+
54
+ ```sql
55
+ CREATE TABLE lattice_database_configs (
56
+ id VARCHAR(255) NOT NULL,
57
+ tenant_id VARCHAR(255) NOT NULL,
58
+ key VARCHAR(255) NOT NULL,
59
+ name VARCHAR(255),
60
+ description TEXT,
61
+ config JSONB NOT NULL, -- 密码字段加密存储
62
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
63
+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
64
+
65
+ PRIMARY KEY (tenant_id, id),
66
+ CONSTRAINT uk_lattice_database_configs_tenant_key UNIQUE (tenant_id, key)
67
+ );
68
+
69
+ CREATE INDEX idx_lattice_database_configs_tenant_id
70
+ ON lattice_database_configs(tenant_id);
71
+ ```
72
+
73
+ ## 启动应用
74
+
75
+ ```bash
76
+ cd examples/deep_research
77
+
78
+ # 方式 1: 使用默认端口
79
+ pnpm start
80
+
81
+ # 方式 2: 指定端口
82
+ pnpm start --port 4002
83
+
84
+ # 方式 3: 开发模式
85
+ pnpm dev
86
+ ```
87
+
88
+ ## 验证配置
89
+
90
+ ### 1. 检查启动日志
91
+
92
+ 启动后应该看到:
93
+ ```
94
+ PostgreSQL DatabaseConfigStore initialized with auto-migration
95
+ Applying migration 4: create_database_configs_table
96
+ Applied 1 migration(s)
97
+ ```
98
+
99
+ ### 2. 访问 UI
100
+
101
+ 1. 打开浏览器访问 `http://localhost:4001`
102
+ 2. 点击 Sidebar 的 Database 图标(🗄️)
103
+ 3. 查看数据库配置管理界面
104
+
105
+ ### 3. 测试 API
106
+
107
+ ```bash
108
+ # 获取配置列表
109
+ curl -H "x-tenant-id: default" http://localhost:4001/api/database-configs
110
+
111
+ # 创建配置
112
+ curl -X POST http://localhost:4001/api/database-configs \
113
+ -H "Content-Type: application/json" \
114
+ -H "x-tenant-id: default" \
115
+ -d '{
116
+ "key": "main-db",
117
+ "name": "Main Database",
118
+ "config": {
119
+ "type": "postgres",
120
+ "host": "localhost",
121
+ "port": 5432,
122
+ "database": "mydb",
123
+ "user": "admin",
124
+ "password": "secret123"
125
+ }
126
+ }'
127
+
128
+ # 测试连接
129
+ curl -X POST http://localhost:4001/api/database-configs/main-db/test \
130
+ -H "x-tenant-id: default"
131
+ ```
132
+
133
+ ## 功能特性
134
+
135
+ ### 1. 密码加密
136
+ - 所有密码使用 AES-256-GCM 加密
137
+ - 加密密钥来自 `LATTICE_ENCRYPTION_KEY` 环境变量
138
+ - 读取时自动解密
139
+
140
+ ### 2. 自动迁移
141
+ - 启动时自动创建/更新数据库表
142
+ - 使用 PostgreSQL 咨询锁防止并发迁移
143
+ - 迁移历史记录在 `lattice_schema_migrations` 表
144
+
145
+ ### 3. 多租户支持
146
+ - 通过 `x-tenant-id` header 区分租户
147
+ - 每个租户的配置完全隔离
148
+ - 租户内配置 key 唯一
149
+
150
+ ### 4. 自动注册
151
+ - 创建/更新配置时自动注册到 SqlDatabaseManager
152
+ - 可以直接使用配置的 key 访问数据库
153
+
154
+ ## 使用场景
155
+
156
+ ### 1. 动态添加数据库连接
157
+
158
+ ```typescript
159
+ // 通过 UI 或 API 添加数据库配置
160
+ // 配置会自动注册到 SqlDatabaseManager
161
+
162
+ // 在代码中可以直接使用
163
+ import { sqlDatabaseManager } from "@axiom-lattice/core";
164
+
165
+ const db = sqlDatabaseManager.getDatabase('main-db');
166
+ const tables = await db.listTables();
167
+ ```
168
+
169
+ ### 2. 多租户数据库隔离
170
+
171
+ ```typescript
172
+ // 为不同租户配置不同的数据库
173
+ // Tenant A
174
+ await store.createConfig('tenant-a', 'config-1', {
175
+ key: 'db',
176
+ config: { type: 'postgres', database: 'db-a', ... }
177
+ });
178
+
179
+ // Tenant B
180
+ await store.createConfig('tenant-b', 'config-1', {
181
+ key: 'db',
182
+ config: { type: 'postgres', database: 'db-b', ... }
183
+ });
184
+ ```
185
+
186
+ ### 3. 数据库连接池管理
187
+
188
+ ```typescript
189
+ // 配置的数据库会自动维护连接池
190
+ // 可以通过 SqlDatabaseManager 管理
191
+ await sqlDatabaseManager.removeDatabase('old-db');
192
+ sqlDatabaseManager.registerDatabase('new-db', newConfig);
193
+ ```
194
+
195
+ ## 生产环境建议
196
+
197
+ ### 1. 加密密钥管理
198
+
199
+ ```bash
200
+ # 生产环境必须设置
201
+ export LATTICE_ENCRYPTION_KEY=$(openssl rand -base64 32)
202
+
203
+ # 使用密钥管理服务(推荐)
204
+ # AWS Secrets Manager
205
+ # Azure Key Vault
206
+ # HashiCorp Vault
207
+ ```
208
+
209
+ ### 2. 数据库权限
210
+
211
+ 确保 PostgreSQL 用户有以下权限:
212
+ ```sql
213
+ -- 创建表
214
+ CREATE TABLE privilege
215
+
216
+ -- 读写数据
217
+ INSERT, SELECT, UPDATE, DELETE
218
+
219
+ -- 运行迁移
220
+ ALTER TABLE (用于创建索引)
221
+ ```
222
+
223
+ ### 3. 备份策略
224
+
225
+ ```bash
226
+ # 定期备份数据库
227
+ pg_dump -U postgres -h localhost lattice > backup.sql
228
+
229
+ # 或使用 cron 定时任务
230
+ 0 2 * * * pg_dump -U postgres lattice >> /backups/lattice_$(date +\%Y\%m\%d).sql
231
+ ```
232
+
233
+ ### 4. 监控告警
234
+
235
+ ```typescript
236
+ // 添加健康检查端点
237
+ app.get('/health/database-configs', async (req, res) => {
238
+ try {
239
+ const store = getStoreLattice('default', 'database').store;
240
+ const configs = await store.getAllConfigs('default');
241
+ res.json({
242
+ status: 'ok',
243
+ configCount: configs.length
244
+ });
245
+ } catch (error) {
246
+ res.status(500).json({ status: 'error', error });
247
+ }
248
+ });
249
+ ```
250
+
251
+ ## 故障排查
252
+
253
+ ### 1. 加密密钥未设置
254
+
255
+ ```
256
+ WARNING: Using default encryption key. Set LATTICE_ENCRYPTION_KEY in production.
257
+ ```
258
+
259
+ **解决**: 在 .env 中设置 `LATTICE_ENCRYPTION_KEY`
260
+
261
+ ### 2. 数据库连接失败
262
+
263
+ ```
264
+ Error: Failed to connect to PostgreSQL
265
+ ```
266
+
267
+ **解决**:
268
+ - 检查 `DATABASE_URL` 是否正确
269
+ - 验证网络连通性
270
+ - 检查数据库用户权限
271
+
272
+ ### 3. 迁移失败
273
+
274
+ ```
275
+ Error: relation "lattice_database_configs" already exists
276
+ ```
277
+
278
+ **解决**: 这是正常的,说明表已经存在。可以忽略或手动删除表重新创建。
279
+
280
+ ## 相关文件
281
+
282
+ - 配置:`examples/deep_research/.env`
283
+ - 代码:`examples/deep_research/src/index.ts`
284
+ - Controller: `packages/gateway/src/controllers/database-configs.ts`
285
+ - Store: `packages/pg-stores/src/stores/PostgreSQLDatabaseConfigStore.ts`
286
+
287
+ ---
288
+
289
+ **配置日期**: 2026-03-01
290
+ **状态**: ✅ 已完成
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.26",
34
+ version: "1.0.27",
35
35
  main: "dist/index.js",
36
36
  bin: {
37
37
  "lattice-deep-research": "./dist/index.js"
@@ -84,7 +84,7 @@ var require_package = __commonJS({
84
84
  // src/index.ts
85
85
  var import_dotenv = __toESM(require("dotenv"));
86
86
  var import_gateway = require("@axiom-lattice/gateway");
87
- var import_core4 = require("@axiom-lattice/core");
87
+ var import_core5 = require("@axiom-lattice/core");
88
88
 
89
89
  // src/agents/research/index.ts
90
90
  var import_core = require("@axiom-lattice/core");
@@ -234,9 +234,72 @@ var research_agents = [
234
234
  ];
235
235
  (0, import_core.registerAgentLattices)(research_agents);
236
236
 
237
- // src/agents/data_agent/index.ts
237
+ // src/agents/research_team/index.ts
238
238
  var import_core2 = require("@axiom-lattice/core");
239
239
  var import_zod2 = __toESM(require("zod"));
240
+ var teamLeadPrompt = `You are an expert research team lead. You coordinate a team of specialized agents to produce a thorough, polished research report.
241
+
242
+ ## Workflow
243
+
244
+ 1. When given a research topic, break it down into concrete research tasks:
245
+ - Multiple focused research sub-topics (assign to "researcher" teammates)
246
+ - A final critique pass (assign to "critic" teammate)
247
+ - A writing/synthesis task (you will handle this yourself after research is done)
248
+
249
+ 2. Call \`create_team\` with the initial tasks and teammates. Tasks can have dependencies (e.g. critique depends on all research tasks completing).
250
+
251
+ 3. While tasks are NOT all completed: You MUST periodically call \`check_tasks\` and \`read_messages\` to monitor progress. Do not assume tasks are done without checking. Keep polling until all research tasks show completed or failed.
252
+ - If a teammate reports new findings that require additional research, use \`add_tasks\` to add follow-up tasks.
253
+
254
+ 4. Once all research tasks are complete (verify via \`check_tasks\`), synthesize the results into a final report.
255
+
256
+ 5. After the critic reviews, incorporate feedback and produce the final version.
257
+
258
+ ## Report Writing Guidelines
259
+
260
+ CRITICAL: Write the report in the SAME language as the user's message.
261
+
262
+ The final report should:
263
+ - Be well-organized with proper headings (# for title, ## for sections, ### for subsections)
264
+ - Include specific facts and insights from the research
265
+ - Reference relevant sources using [Title](URL) format
266
+ - Provide a balanced, thorough analysis
267
+ - Include a "Sources" section at the end
268
+ - Be text-heavy -- not just bullet points
269
+ - Be comprehensive and detailed
270
+
271
+ <Citation Rules>
272
+ - Assign each unique URL a single citation number
273
+ - End with ### Sources listing each source with numbers
274
+ - Number sources sequentially (1,2,3,4...)
275
+ - Each source as a separate list item: [1] Source Title: URL
276
+ </Citation Rules>
277
+
278
+ ## Available Teammates
279
+
280
+ - **researcher**: Can search the internet for information. Assign one research sub-topic per task. You can create multiple researcher tasks to run in parallel.
281
+ - **critic**: Reviews research results and the draft report for quality, completeness, and accuracy. The critic does NOT have search tools -- only reviews text.`;
282
+ var teamResearchAgent = {
283
+ key: "team_research_agent",
284
+ name: "Team Research Agent",
285
+ description: "Team-based deep research agent. Uses a team of persistent researcher and critic agents that work in parallel via a shared task list and mailbox. Compare with deep_research_agent (DEEP_AGENT version) for architectural differences.",
286
+ type: import_core2.AgentType.TEAM,
287
+ prompt: teamLeadPrompt,
288
+ tools: ["internet_search"],
289
+ // Team lead also has search capability
290
+ schema: import_zod2.default.object({
291
+ test: import_zod2.default.string().optional()
292
+ }),
293
+ scheduleLatticeKey: "default",
294
+ // Use ScheduleLattice for polling task list
295
+ pollIntervalMs: 5e3
296
+ // Poll every 5 seconds
297
+ };
298
+ (0, import_core2.registerAgentLattices)([teamResearchAgent]);
299
+
300
+ // src/agents/data_agent/index.ts
301
+ var import_core3 = require("@axiom-lattice/core");
302
+ var import_zod3 = __toESM(require("zod"));
240
303
  var dataAgentPrompt = `\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u4E1A\u52A1\u6570\u636E\u5206\u6790AI\u52A9\u624B\uFF0C\u64C5\u957F\u89C4\u5212\u4E1A\u52A1\u5206\u6790\u4EFB\u52A1\u3001\u534F\u8C03\u6570\u636E\u68C0\u7D22\uFF0C\u5E76\u751F\u6210\u5168\u9762\u7684\u4E1A\u52A1\u5206\u6790\u62A5\u544A\u3002
241
304
 
242
305
  **\u5173\u952E\uFF1A\u4F60\u7684\u7B2C\u4E00\u9879\u4E5F\u662F\u6700\u91CD\u8981\u7684\u4EFB\u52A1\u662F\u4F7F\u7528 \`write_todos\` \u5DE5\u5177\u521B\u5EFA\u5F85\u529E\u5217\u8868\u3002** \u5728\u5F00\u59CB\u4EFB\u4F55\u5DE5\u4F5C\u4E4B\u524D\uFF0C\u4F60\u5FC5\u987B\uFF1A
@@ -512,12 +575,12 @@ var data_agents = [
512
575
  key: "data_agent",
513
576
  name: "Data Agent",
514
577
  description: "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.",
515
- type: import_core2.AgentType.DEEP_AGENT,
578
+ type: import_core3.AgentType.DEEP_AGENT,
516
579
  tools: ["list_tables_sql", "info_sql"],
517
580
  prompt: dataAgentPrompt,
518
581
  subAgents: ["sql-builder-agent", "data-analysis-agent"],
519
582
  skillCategories: ["analysis", "sql"],
520
- schema: import_zod2.default.object({}),
583
+ schema: import_zod3.default.object({}),
521
584
  /**
522
585
  * Runtime configuration injected into tool execution context.
523
586
  * databaseKey: The database key registered via sqlDatabaseManager.
@@ -531,7 +594,7 @@ var data_agents = [
531
594
  {
532
595
  key: "sql-builder-agent",
533
596
  name: "sql-builder-agent",
534
- type: import_core2.AgentType.DEEP_AGENT,
597
+ type: import_core3.AgentType.DEEP_AGENT,
535
598
  description: "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.",
536
599
  prompt: sqlBuilderPrompt
537
600
  // tools: ["list_tables_sql", "info_sql", "query_checker_sql", "query_sql"],
@@ -540,15 +603,15 @@ var data_agents = [
540
603
  {
541
604
  key: "data-analysis-agent",
542
605
  name: "data-analysis-agent",
543
- type: import_core2.AgentType.DEEP_AGENT,
606
+ type: import_core3.AgentType.DEEP_AGENT,
544
607
  description: "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.",
545
608
  prompt: dataAnalysisPrompt,
546
609
  tools: []
547
610
  }
548
611
  ];
549
- (0, import_core2.registerAgentLattices)(data_agents);
612
+ (0, import_core3.registerAgentLattices)(data_agents);
550
613
  function initializeDataAgentDatabase(key, config) {
551
- import_core2.sqlDatabaseManager.registerDatabase(key, config);
614
+ import_core3.sqlDatabaseManager.registerDatabase(key, config);
552
615
  }
553
616
  initializeDataAgentDatabase("fulidb", {
554
617
  type: "postgres",
@@ -557,7 +620,7 @@ initializeDataAgentDatabase("fulidb", {
557
620
  });
558
621
 
559
622
  // src/agents/sandbox_agent/index.ts
560
- var import_core3 = require("@axiom-lattice/core");
623
+ var import_core4 = require("@axiom-lattice/core");
561
624
  var sandboxPrompt = `You are a Personal AI Assistant with access to a powerful sandboxed computer environment. You can help users with research, coding, file management, and web browsing tasks.
562
625
 
563
626
  ## Your Core Identity
@@ -642,7 +705,7 @@ var sandboxAgent = {
642
705
  key: "sandbox_agent",
643
706
  name: "Sandbox Agent",
644
707
  description: "A sandbox agent for testing and development.",
645
- type: import_core3.AgentType.DEEP_AGENT,
708
+ type: import_core4.AgentType.DEEP_AGENT,
646
709
  prompt: sandboxPrompt,
647
710
  middleware: [
648
711
  {
@@ -671,7 +734,7 @@ var sandboxAgent = {
671
734
  }
672
735
  ]
673
736
  };
674
- (0, import_core3.registerAgentLattices)([sandboxAgent]);
737
+ (0, import_core4.registerAgentLattices)([sandboxAgent]);
675
738
 
676
739
  // src/index.ts
677
740
  var import_path = __toESM(require("path"));
@@ -693,8 +756,30 @@ import_dotenv.default.config({ path: import_path.default.resolve(__dirname, "../
693
756
  var threadStore = new import_pg_stores.PostgreSQLThreadStore({
694
757
  poolConfig: process.env.DATABASE_URL || ""
695
758
  });
696
- import_core4.storeLatticeManager.removeLattice("default", "thread");
697
- (0, import_core4.registerStoreLattice)("default", "thread", threadStore);
759
+ import_core5.storeLatticeManager.removeLattice("default", "thread");
760
+ (0, import_core5.registerStoreLattice)("default", "thread", threadStore);
761
+ var databaseConfigStore = new import_pg_stores.PostgreSQLDatabaseConfigStore({
762
+ poolConfig: process.env.DATABASE_URL || "",
763
+ autoMigrate: true
764
+ });
765
+ import_core5.storeLatticeManager.removeLattice("default", "database");
766
+ (0, import_core5.registerStoreLattice)("default", "database", databaseConfigStore);
767
+ import_core5.sqlDatabaseManager.loadAllConfigsFromStore(databaseConfigStore);
768
+ console.log("PostgreSQL DatabaseConfigStore initialized with auto-migration");
769
+ var workspaceStore = new import_pg_stores.PostgreSQLWorkspaceStore({
770
+ poolConfig: process.env.DATABASE_URL || "",
771
+ autoMigrate: true
772
+ });
773
+ import_core5.storeLatticeManager.removeLattice("default", "workspace");
774
+ (0, import_core5.registerStoreLattice)("default", "workspace", workspaceStore);
775
+ console.log("PostgreSQL WorkspaceStore initialized with auto-migration");
776
+ var projectStore = new import_pg_stores.PostgreSQLProjectStore({
777
+ poolConfig: process.env.DATABASE_URL || "",
778
+ autoMigrate: true
779
+ });
780
+ import_core5.storeLatticeManager.removeLattice("default", "project");
781
+ (0, import_core5.registerStoreLattice)("default", "project", projectStore);
782
+ console.log("PostgreSQL ProjectStore initialized with auto-migration");
698
783
  function parsePort() {
699
784
  const args = process.argv.slice(2);
700
785
  const portIndex = args.findIndex((arg) => arg === "--port" || arg === "-p");
@@ -718,7 +803,7 @@ function parsePort() {
718
803
  }
719
804
  return 4001;
720
805
  }
721
- (0, import_core4.registerModelLattice)(
806
+ (0, import_core5.registerModelLattice)(
722
807
  "default",
723
808
  // {
724
809
  // model: "deepseek-chat",
@@ -779,12 +864,12 @@ if (!fs.existsSync(skillsRootDir)) {
779
864
  );
780
865
  }
781
866
  console.log(`Skill store root directory: ${skillsRootDir}`);
782
- var skillStore = new import_core4.FileSystemSkillStore({
867
+ var skillStore = new import_core5.FileSystemSkillStore({
783
868
  rootDir: skillsRootDir
784
869
  });
785
- import_core4.storeLatticeManager.removeLattice("default", "skill");
786
- (0, import_core4.registerStoreLattice)("default", "skill", skillStore);
787
- import_core4.skillLatticeManager.configureStore("default");
870
+ import_core5.storeLatticeManager.removeLattice("default", "skill");
871
+ (0, import_core5.registerStoreLattice)("default", "skill", skillStore);
872
+ import_core5.skillLatticeManager.configureStore("default");
788
873
  (async () => {
789
874
  try {
790
875
  const skills = await skillStore.getAllSkills();
@@ -806,9 +891,9 @@ import_core4.skillLatticeManager.configureStore("default");
806
891
  }
807
892
  }
808
893
  })();
809
- import_core4.sandboxLatticeManager.registerLattice("default", {
810
- baseURL: "http://100.64.0.2:9080"
811
- //"https://demo.alphafina.cn"
894
+ import_core5.sandboxLatticeManager.registerLattice("default", {
895
+ // baseURL: "http://100.64.0.2:9080"
896
+ baseURL: "https://demo.alphafina.cn"
812
897
  });
813
898
  var port = parsePort();
814
899
  console.log(`Starting server on port ${port}`);