@codesoul-co/hypha-memory / index-outbox
- 包索引:
@codesoul-co/hypha-memory - 源码:
packages/memory/src/index-outbox.ts - 导出数: 11
模块用法
用于使用该功能边界的公共契约与操作。Index outbox 模块公开 3 类、8 接口。
从包入口导入
ts
import {
IndexOutboxWorker,
InMemoryLocalVectorStoreAdapter,
LegacyVectorIndexStoreAdapter,
} from '@codesoul-co/hypha-memory';
import type {
IndexOutboxWorkerEvent,
IndexOutboxWorkerOptions,
IndexOutboxWorkerRunResult,
ManagedVectorPoint,
ManagedVectorSearchRequest,
ManagedVectorSearchResult,
ManagedVectorStoreAdapter,
ManagedVectorWriteOptions,
} from '@codesoul-co/hypha-memory';使用要点
- 8 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用
import type,运行时不应依赖它们。 - 3 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。
公共导出
| Symbol | 种类 | 签名 | 说明 |
|---|---|---|---|
IndexOutboxWorker | 类 | new IndexOutboxWorker(options: IndexOutboxWorkerOptions): IndexOutboxWorker | Index Outbox Worker 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。 |
InMemoryLocalVectorStoreAdapter | 类 | new InMemoryLocalVectorStoreAdapter(id?: string): InMemoryLocalVectorStoreAdapter | In Memory Local Vector Store Adapter 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。 |
LegacyVectorIndexStoreAdapter | 类 | new LegacyVectorIndexStoreAdapter(id: string, provider: VectorIndexProvider): LegacyVectorIndexStoreAdapter | Legacy Vector Index Store Adapter 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。 |
IndexOutboxWorkerEvent | 接口 | interface IndexOutboxWorkerEvent | Index Outbox Worker Event 接口,共包含 7 个公开字段或方法。 |
IndexOutboxWorkerOptions | 接口 | interface IndexOutboxWorkerOptions | Index Outbox Worker Options 接口,共包含 14 个公开字段或方法。 |
IndexOutboxWorkerRunResult | 接口 | interface IndexOutboxWorkerRunResult | Index Outbox Worker Run Result 接口,共包含 4 个公开字段或方法。 |
ManagedVectorPoint | 接口 | interface ManagedVectorPoint | Managed Vector Point 接口,共包含 3 个公开字段或方法。 |
ManagedVectorSearchRequest | 接口 | interface ManagedVectorSearchRequest | Managed Vector Search Request 接口,共包含 4 个公开字段或方法。 |
ManagedVectorSearchResult | 接口 | interface ManagedVectorSearchResult | Managed Vector Search Result 接口,共包含 3 个公开字段或方法。 |
ManagedVectorStoreAdapter | 接口 | interface ManagedVectorStoreAdapter | Managed Vector Store Adapter 接口,共包含 5 个公开字段或方法。 |
ManagedVectorWriteOptions | 接口 | interface ManagedVectorWriteOptions | Managed Vector Write Options 接口,共包含 2 个公开字段或方法。 |
IndexOutboxWorker
Index Outbox Worker 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。
- 种类: 类
- 导入:
import { IndexOutboxWorker } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export declare class IndexOutboxWorker {
constructor(options: IndexOutboxWorkerOptions);
runOnce(): Promise<IndexOutboxWorkerRunResult>;
start(): void;
stop(): void;
drain(): Promise<void>;
stopAndDrain(): Promise<void>;
}公开成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
constructor | 构造函数 | (options: IndexOutboxWorkerOptions): IndexOutboxWorker | 创建该类的实例。 |
drain | 方法 | drain(): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
runOnce | 方法 | runOnce(): Promise<IndexOutboxWorkerRunResult> | 公开方法;参数与返回类型以签名列为准。 |
start | 方法 | start(): void | 公开方法;参数与返回类型以签名列为准。 |
stop | 方法 | stop(): void | 公开方法;参数与返回类型以签名列为准。 |
stopAndDrain | 方法 | stopAndDrain(): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
InMemoryLocalVectorStoreAdapter
In Memory Local Vector Store Adapter 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。
- 种类: 类
- 导入:
import { InMemoryLocalVectorStoreAdapter } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export declare class InMemoryLocalVectorStoreAdapter implements ManagedVectorStoreAdapter {
readonly id: string;
constructor(id?: string);
upsert(points: ManagedVectorPoint[], options?: ManagedVectorWriteOptions): Promise<void>;
delete(ids: string[], options?: ManagedVectorWriteOptions): Promise<void>;
search(request: ManagedVectorSearchRequest): Promise<ManagedVectorSearchResult[]>;
health(): Promise<ProviderHealth>;
}公开成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
constructor | 构造函数 | (id?: string): InMemoryLocalVectorStoreAdapter | 创建该类的实例。 |
delete | 方法 | delete(ids: string[], options?: ManagedVectorWriteOptions): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
health | 方法 | health(): Promise<ProviderHealth> | 公开方法;参数与返回类型以签名列为准。 |
id | 属性 | readonly id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
search | 方法 | search(request: ManagedVectorSearchRequest): Promise<ManagedVectorSearchResult[]> | 公开方法;参数与返回类型以签名列为准。 |
upsert | 方法 | upsert(points: ManagedVectorPoint[], options?: ManagedVectorWriteOptions): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
LegacyVectorIndexStoreAdapter
Legacy Vector Index Store Adapter 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。
- 种类: 类
- 导入:
import { LegacyVectorIndexStoreAdapter } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export declare class LegacyVectorIndexStoreAdapter implements ManagedVectorStoreAdapter {
readonly id: string;
constructor(id: string, provider: VectorIndexProvider);
upsert(points: ManagedVectorPoint[], options?: ManagedVectorWriteOptions): Promise<void>;
delete(ids: string[], options?: ManagedVectorWriteOptions): Promise<void>;
search(request: ManagedVectorSearchRequest): Promise<ManagedVectorSearchResult[]>;
health(): Promise<ProviderHealth>;
}公开成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
constructor | 构造函数 | (id: string, provider: VectorIndexProvider): LegacyVectorIndexStoreAdapter | 创建该类的实例。 |
delete | 方法 | delete(ids: string[], options?: ManagedVectorWriteOptions): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
health | 方法 | health(): Promise<ProviderHealth> | 公开方法;参数与返回类型以签名列为准。 |
id | 属性 | readonly id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
search | 方法 | search(request: ManagedVectorSearchRequest): Promise<ManagedVectorSearchResult[]> | 公开方法;参数与返回类型以签名列为准。 |
upsert | 方法 | upsert(points: ManagedVectorPoint[], options?: ManagedVectorWriteOptions): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
IndexOutboxWorkerEvent
Index Outbox Worker Event 接口,共包含 7 个公开字段或方法。
- 种类: 接口
- 导入:
import type { IndexOutboxWorkerEvent } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface IndexOutboxWorkerEvent {
type: 'memory.index.started' | 'memory.index.completed' | 'memory.index.partial' | 'memory.index.failed';
operationId: string;
outboxId: string;
memoryId: string;
memoryVersionId: string;
scopeHash: string;
error?: NormalizedMemoryError;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
error | 属性 | error?: NormalizedMemoryError | 公开属性;类型、只读和可选状态以签名列为准。 |
memoryId | 属性 | memoryId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
memoryVersionId | 属性 | memoryVersionId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
operationId | 属性 | operationId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
outboxId | 属性 | outboxId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
scopeHash | 属性 | scopeHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
type | 属性 | type: "memory.index.started" | "memory.index.completed" | "memory.index.partial" | "memory.index.failed" | 公开属性;类型、只读和可选状态以签名列为准。 |
IndexOutboxWorkerOptions
Index Outbox Worker Options 接口,共包含 14 个公开字段或方法。
- 种类: 接口
- 导入:
import type { IndexOutboxWorkerOptions } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface IndexOutboxWorkerOptions {
ownerId: string;
outboxStore: MemoryIndexOutboxStore;
recordStore: ManagedMemoryRecordStore;
embeddingProvider: EmbeddingProvider;
vectorStores: ManagedVectorStoreAdapter[];
batchSize?: number;
leaseMs?: number;
renewalMs?: number;
maxAttempts?: number;
retryDelayMs?: number;
pollIntervalMs?: number;
now?: () => Date;
onEvent?: (event: IndexOutboxWorkerEvent) => void | Promise<void>;
onError?: (error: NormalizedMemoryError) => void | Promise<void>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
batchSize | 属性 | batchSize?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
embeddingProvider | 属性 | embeddingProvider: EmbeddingProvider | 公开属性;类型、只读和可选状态以签名列为准。 |
leaseMs | 属性 | leaseMs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
maxAttempts | 属性 | maxAttempts?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
now | 方法 | now?(): Date | 公开方法;参数与返回类型以签名列为准。 |
onError | 方法 | onError?(error: NormalizedMemoryError): void | Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
onEvent | 方法 | onEvent?(event: IndexOutboxWorkerEvent): void | Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
outboxStore | 属性 | outboxStore: MemoryIndexOutboxStore | 公开属性;类型、只读和可选状态以签名列为准。 |
ownerId | 属性 | ownerId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
pollIntervalMs | 属性 | pollIntervalMs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
recordStore | 属性 | recordStore: ManagedMemoryRecordStore | 公开属性;类型、只读和可选状态以签名列为准。 |
renewalMs | 属性 | renewalMs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
retryDelayMs | 属性 | retryDelayMs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
vectorStores | 属性 | vectorStores: ManagedVectorStoreAdapter[] | 公开属性;类型、只读和可选状态以签名列为准。 |
IndexOutboxWorkerRunResult
Index Outbox Worker Run Result 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { IndexOutboxWorkerRunResult } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface IndexOutboxWorkerRunResult {
leased: number;
completed: number;
failed: number;
deadLettered: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
completed | 属性 | completed: number | 公开属性;类型、只读和可选状态以签名列为准。 |
deadLettered | 属性 | deadLettered: number | 公开属性;类型、只读和可选状态以签名列为准。 |
failed | 属性 | failed: number | 公开属性;类型、只读和可选状态以签名列为准。 |
leased | 属性 | leased: number | 公开属性;类型、只读和可选状态以签名列为准。 |
ManagedVectorPoint
Managed Vector Point 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { ManagedVectorPoint } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface ManagedVectorPoint {
id: string;
vector: number[];
metadata: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
vector | 属性 | vector: number[] | 公开属性;类型、只读和可选状态以签名列为准。 |
ManagedVectorSearchRequest
Managed Vector Search Request 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { ManagedVectorSearchRequest } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface ManagedVectorSearchRequest {
vector: number[];
topK: number;
filter?: Record<string, unknown>;
scoreThreshold?: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
filter | 属性 | filter?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
scoreThreshold | 属性 | scoreThreshold?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
topK | 属性 | topK: number | 公开属性;类型、只读和可选状态以签名列为准。 |
vector | 属性 | vector: number[] | 公开属性;类型、只读和可选状态以签名列为准。 |
ManagedVectorSearchResult
Managed Vector Search Result 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { ManagedVectorSearchResult } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface ManagedVectorSearchResult {
id: string;
score: number;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
score | 属性 | score: number | 公开属性;类型、只读和可选状态以签名列为准。 |
ManagedVectorStoreAdapter
Managed Vector Store Adapter 接口,共包含 5 个公开字段或方法。
- 种类: 接口
- 导入:
import type { ManagedVectorStoreAdapter } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface ManagedVectorStoreAdapter {
readonly id: string;
upsert(points: ManagedVectorPoint[], options?: ManagedVectorWriteOptions): Promise<void>;
delete(ids: string[], options?: ManagedVectorWriteOptions): Promise<void>;
search(request: ManagedVectorSearchRequest): Promise<ManagedVectorSearchResult[]>;
health(): Promise<ProviderHealth>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
delete | 方法 | delete(ids: string[], options?: ManagedVectorWriteOptions): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
health | 方法 | health(): Promise<ProviderHealth> | 公开方法;参数与返回类型以签名列为准。 |
id | 属性 | readonly id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
search | 方法 | search(request: ManagedVectorSearchRequest): Promise<ManagedVectorSearchResult[]> | 公开方法;参数与返回类型以签名列为准。 |
upsert | 方法 | upsert(points: ManagedVectorPoint[], options?: ManagedVectorWriteOptions): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
ManagedVectorWriteOptions
Managed Vector Write Options 接口,共包含 2 个公开字段或方法。
- 种类: 接口
- 导入:
import type { ManagedVectorWriteOptions } from '@codesoul-co/hypha-memory'; - 源码模块:
index-outbox
声明
text
export interface ManagedVectorWriteOptions {
fencingToken?: number;
memoryRevision?: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
fencingToken | 属性 | fencingToken?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
memoryRevision | 属性 | memoryRevision?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
