@axiom-lattice/pg-stores

中文文档
5.0.3发布于 2026/11/03MITTypeScriptESM + CJS近 30 天下载 4428

Axiom Lattice 框架的 PG 存储执行

中文使用文档
文档目录6 节
  1. 快速启动
  2. createPgStoreConfig
  3. 个人存储使用
  4. 可用存储
  5. 构造选项
  6. 移徙系统

@axiom-lattice/ pg- stores (英语)

PostgreSQL 为Axiom Lattice框架存储执行.

快速启动

import { configureStores } from "@axiom-lattice/core";
import { createPgStoreConfig } from "@axiom-lattice/pg-stores";
import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres";

// One connection string creates all PG stores
const stores = createPgStoreConfig(process.env.DATABASE_URL);

// Register all stores in one call
await configureStores({
  ...stores,
  checkpoint: PostgresSaver.fromConnString(process.env.DATABASE_URL),
});

createPgStoreConfig

从单一连接字符串创建所有 PG 存储实例的工厂函数 。 返回一个可扩展到 configureStores()。 。 。 .

function createPgStoreConfig(connectionString: string): {
  workspace: PostgreSQLWorkspaceStore;
  project: PostgreSQLProjectStore;
  eval: PostgreSQLEvalStore;
  user: PostgreSQLUserStore;
  tenant: PostgreSQLTenantStore;
  userTenantLink: PostgreSQLUserTenantLinkStore;
  channelBinding: ChannelBindingStore;
  channelInstallation: PostgreSQLChannelInstallationStore;
  thread: PostgreSQLThreadStore;
  database: PostgreSQLDatabaseConfigStore;
  metrics: PostgreSQLMetricsServerConfigStore;
  mcp: PostgreSQLMcpServerConfigStore;
  assistant: PostgreSQLAssistantStore;
  workflowTracking: PostgreSQLWorkflowTrackingStore;
  threadMessageQueue: ThreadMessageQueueStore;
  schedule: PostgreSQLScheduleStorage;
}

存储于 autoMigrate: true: eval, 频道Binding, 频道安装, 工作流程跟踪, 线程MessageQuue. 其他人都会用 autoMigrate: false (手语: initialize() 通过 configureStores) (中文(简体) ).

个人存储使用

如果您只需要特定的商店, 请直接构建它们 :

import { configureStores } from "@axiom-lattice/core";
import { PostgreSQLThreadStore, PostgreSQLAssistantStore } from "@axiom-lattice/pg-stores";

await configureStores({
  thread: new PostgreSQLThreadStore({ poolConfig: process.env.DATABASE_URL }),
  assistant: new PostgreSQLAssistantStore({ poolConfig: process.env.DATABASE_URL }),
});

可用存储

存储类说明
线程PostgreSQLThreadStore线索 CRUD
助理人员PostgreSQLAssistantStore助理CRUD
技能PostgreSQLSkillStore技能存储
工作空间PostgreSQLWorkspaceStore工作空间管理
项目PostgreSQLProjectStore项目管理
数据库PostgreSQLDatabaseConfigStoreDB 连接配置
计量PostgreSQLMetricsServerConfigStore计量服务器配置
微调PostgreSQLMcpServerConfigStoreMCP 服务器配置
用户PostgreSQLUserStore用户存储
租户PostgreSQLTenantStore租户存储
用户 TenantLinkPostgreSQLUserTenantLinkStore用户租户链接
线程信息队列ThreadMessageQueueStore信件队列持续性
工作流程跟踪PostgreSQLWorkflowTrackingStore工作流程运行跟踪
eval (中文)PostgreSQLEvalStore评价存储
频道安装PostgreSQLChannelInstallationStore频道装置
频道编辑ChannelBindingStore发件人对代理绑定
时间表PostgreSQLScheduleStorage排定的任务持久性

构造选项

所有商店都接受相同的选项模式 :

interface StoreOptions {
  poolConfig: string | PoolConfig;  // Connection string or PoolConfig object
  autoMigrate?: boolean;            // Run migrations automatically (default: true)
}

移徙系统

每个商店管理自己的计划迁移 MigrationManager. 期间的移徙 initialize()。 。 。 .

// Manual control
const store = new PostgreSQLThreadStore({
  poolConfig: process.env.DATABASE_URL,
  autoMigrate: false,
});
await store.initialize(); // Migrations applied here

版本与发布记录

@axiom-lattice/pg-stores 共发布 159 个版本,首次发布于 2026/01/08;过去 12 个月发布了 159 个版本。

版本发布日期距今
5.0.3latest2026/11/034 天前
5.0.22026/11/034 天前
5.0.12026/11/025 天前
5.0.02026/10/317 天前
4.1.12026/10/299 天前
4.1.02026/10/2810 天前

其他发布通道:hotfix → 1.0.4-hotfix.0。

关于 @axiom-lattice/pg-stores 的常见问题

@axiom-lattice/pg-stores 是什么?

Axiom Lattice 框架的 PG 存储执行

如何安装 @axiom-lattice/pg-stores?

在项目目录运行 npm install @axiom-lattice/pg-stores,或使用 pnpm add / yarn add / bun add。

@axiom-lattice/pg-stores 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@axiom-lattice/pg-stores 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@axiom-lattice/pg-stores 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.10.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@axiom-lattice/pg-stores 可以商用吗?

@axiom-lattice/pg-stores 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@axiom-lattice/pg-stores 的下载量有多少?

根据 npm 官方下载统计,@axiom-lattice/pg-stores 在 2026/10/08 – 2026/11/06 这 30 天内被下载 4,428 次,日均约 148 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@axiom-lattice/pg-stores 还在维护吗?

最新版本 5.0.3 发布于 2026/11/03(4 天前);至今共发布 159 个版本,其中过去 12 个月发布了 159 个;首次发布于 2026/01/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。