@aalis/plugin-vectorstore-api 0.1.0

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/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @aalis/plugin-vectorstore-api
2
+
3
+ 类型/接口/能力声明包(只导出 `type` 与 `*Capabilities`,不含运行时逻辑)
4
+
5
+ ## 角色
6
+
7
+ 类型/接口/能力声明包(只导出 `type` 与 `*Capabilities`,不含运行时逻辑)
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ pnpm add @aalis/plugin-vectorstore-api
13
+ ```
14
+
15
+ ## 使用
16
+
17
+ ```ts
18
+ import type { /* ... */ } from '@aalis/plugin-vectorstore-api';
19
+ ```
20
+
21
+ 本包为 *-api 类型包;实现见对应的运行时插件。
22
+
23
+ ## 许可
24
+
25
+ 见仓库根目录 LICENSE。
@@ -0,0 +1,28 @@
1
+ /** 向量搜索结果条目 */
2
+ export interface VectorSearchResult {
3
+ /** 余弦相似度分数 */
4
+ score: number;
5
+ /** 存储时附带的元数据 */
6
+ metadata: Record<string, unknown>;
7
+ }
8
+ /** 向量数据库服务——由 vectorstore 插件提供 */
9
+ export interface VectorStoreService {
10
+ /** 添加一条向量及其元数据 */
11
+ add(vector: number[], metadata: Record<string, unknown>): Promise<void>;
12
+ /** 搜索最近邻,返回 [分数, 元数据][] */
13
+ search(queryVector: number[], topK: number): Promise<VectorSearchResult[]>;
14
+ /** 当前存储的向量总数 */
15
+ size(): Promise<number>;
16
+ /** 清空所有向量数据 */
17
+ clear(): Promise<void>;
18
+ /** 按 metadata 字段过滤删除(如 { sessionId: 'xxx' }) */
19
+ deleteByFilter?(filter: Record<string, unknown>): Promise<number>;
20
+ /** 持久化(由调用方或 dispose 触发) */
21
+ save(): Promise<void>;
22
+ }
23
+ declare module '@aalis/core' {
24
+ interface ServiceTypeMap {
25
+ vectorstore: VectorStoreService;
26
+ }
27
+ }
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,eAAe;AACf,MAAM,WAAW,kBAAkB;IACjC,cAAc;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC,kBAAkB;IAClB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,2BAA2B;IAC3B,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC3E,gBAAgB;IAChB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe;IACf,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,gDAAgD;IAChD,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClE,4BAA4B;IAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAGD,OAAO,QAAQ,aAAa,CAAC;IAC3B,UAAU,cAAc;QACtB,WAAW,EAAE,kBAAkB,CAAC;KACjC;CACF"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // ----- 向量数据库服务接口 -----
2
+ export {};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB"}
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@aalis/plugin-vectorstore-api",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "devDependencies": {
11
+ "@types/node": "^22.0.0",
12
+ "typescript": "^5.7.0",
13
+ "@aalis/core": "0.1.0"
14
+ },
15
+ "aalis": {
16
+ "types": true
17
+ },
18
+ "peerDependencies": {
19
+ "@aalis/core": "^0.1.0"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "dev": "tsc --watch"
24
+ }
25
+ }