Skip to content

@codesoul-co/hypha-adapters-local / index

模块用法

聚合 @codesoul-co/hypha-adapters-local 的公共入口导出;应用应从包入口导入这些 Symbol,不应依赖内部文件路径。

从包入口导入

ts
import {
  ArtifactStoreToolPort,
  FileArtifactStore,
  FileMCPCapabilityCatalogStore,
  FileToolContractSnapshotStore,
  FileToolObservationStore,
  FileToolRuntimeStore,
  InMemoryArtifactStore,
  InMemoryStructuredStore,
} from '@codesoul-co/hypha-adapters-local';

import type {
  FileArtifactStoreOptions,
  FileToolRuntimeStoreOptions,
  LocalAdapterProfile,
  LocalHashEmbeddingProviderOptions,
  LocalStorageBackbone,
  LocalStorageBackboneOptions,
  LocalVectorIndexProviderOptions,
  SQLiteEventStoreOptions,
} from '@codesoul-co/hypha-adapters-local';

// 完整导出列表见下方。

使用要点

  • 9 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 14 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。
  • 2 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。
  • 1 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。

公共导出

Symbol种类签名说明
ArtifactStoreToolPortnew ArtifactStoreToolPort(artifacts: ArtifactStoreProvider): ArtifactStoreToolPortArtifact Store Tool Port 类,共公开 2 个构造函数或成员;精确签名见本条目的声明与成员表。
FileArtifactStorenew FileArtifactStore(options: FileArtifactStoreOptions): FileArtifactStoreFile Artifact Store 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。
FileMCPCapabilityCatalogStorenew FileMCPCapabilityCatalogStore(filename: string): FileMCPCapabilityCatalogStoreFile MCP Capability Catalog Store 类,共公开 3 个构造函数或成员;精确签名见本条目的声明与成员表。
FileToolContractSnapshotStorenew FileToolContractSnapshotStore(rootPath: string): FileToolContractSnapshotStoreFile Tool Contract Snapshot Store 类,共公开 3 个构造函数或成员;精确签名见本条目的声明与成员表。
FileToolObservationStorenew FileToolObservationStore(rootPath: string): FileToolObservationStoreFile Tool Observation Store 类,共公开 2 个构造函数或成员;精确签名见本条目的声明与成员表。
FileToolRuntimeStorenew FileToolRuntimeStore(options: FileToolRuntimeStoreOptions): FileToolRuntimeStoreFile Tool Runtime Store 类,共公开 13 个构造函数或成员;精确签名见本条目的声明与成员表。
InMemoryArtifactStorenew InMemoryArtifactStore(): InMemoryArtifactStoreIn Memory Artifact Store 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。
InMemoryStructuredStorenew InMemoryStructuredStore(): InMemoryStructuredStoreIn Memory Structured Store 类,共公开 7 个构造函数或成员;精确签名见本条目的声明与成员表。
InMemoryVectorIndexProvidernew InMemoryVectorIndexProvider(): InMemoryVectorIndexProviderIn Memory Vector Index Provider 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。
LocalHashEmbeddingProvidernew LocalHashEmbeddingProvider(options?: LocalHashEmbeddingProviderOptions): LocalHashEmbeddingProviderZero-dependency lexical embedding for the local backbone. This is deliberately named by its algorithm rather than presented as a neural semantic model. Token and character n-gram feature hashing gives related local text stable overlap while keeping dimensions and persistence deterministic. Deployments that require semantic recall should inject a concrete embedding Provider through createLocalStorageBackbone.
LocalVectorIndexProvidernew LocalVectorIndexProvider(options: LocalVectorIndexProviderOptions): LocalVectorIndexProviderLocal Vector Index Provider 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。
MockEmbeddingProvidernew MockEmbeddingProvider(): MockEmbeddingProviderMock Embedding Provider 类,共公开 2 个构造函数或成员;精确签名见本条目的声明与成员表。
SQLiteEventStorenew SQLiteEventStore(options: SQLiteEventStoreOptions): SQLiteEventStoreSQLite Event Store 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。
SQLiteStructuredStorenew SQLiteStructuredStore(options: SQLiteStructuredStoreOptions): SQLiteStructuredStoreSQLite Structured Store 类,共公开 7 个构造函数或成员;精确签名见本条目的声明与成员表。
LOCAL_ADAPTER_TYPES常量const LOCAL_ADAPTER_TYPES: readonly ["sqlite", "local-vector", "file-artifact"]index 模块导出的 LOCAL ADAPTER TYPES 常量。
createLocalStorageBackbone函数createLocalStorageBackbone(options: LocalStorageBackboneOptions): LocalStorageBackboneCreate Local Storage Backbone 函数,提供 1 个公开调用签名;参数与返回类型见下表。
createLocalStorageProfiles函数createLocalStorageProfiles(input: { eventDbFilename: string; structuredDbFilename: string; vectorFilename: string; artifactRootPath: string; }): StorageProviderProfile[]Create Local Storage Profiles 函数,提供 1 个公开调用签名;参数与返回类型见下表。
FileArtifactStoreOptions接口interface FileArtifactStoreOptionsFile Artifact Store Options 接口,共包含 1 个公开字段或方法。
FileToolRuntimeStoreOptions接口interface FileToolRuntimeStoreOptionsFile Tool Runtime Store Options 接口,共包含 1 个公开字段或方法。
LocalAdapterProfile接口interface LocalAdapterProfileLocal Adapter Profile 接口,共包含 4 个公开字段或方法。
LocalHashEmbeddingProviderOptions接口interface LocalHashEmbeddingProviderOptionsLocal Hash Embedding Provider Options 接口,共包含 1 个公开字段或方法。
LocalStorageBackbone接口interface LocalStorageBackboneLocal Storage Backbone 接口,共包含 7 个公开字段或方法。
LocalStorageBackboneOptions接口interface LocalStorageBackboneOptionsLocal Storage Backbone Options 接口,共包含 8 个公开字段或方法。
LocalVectorIndexProviderOptions接口interface LocalVectorIndexProviderOptionsLocal Vector Index Provider Options 接口,共包含 1 个公开字段或方法。
SQLiteEventStoreOptions接口interface SQLiteEventStoreOptionsSQLite Event Store Options 接口,共包含 3 个公开字段或方法。
SQLiteStructuredStoreOptions接口interface SQLiteStructuredStoreOptionsSQLite Structured Store Options 接口,共包含 3 个公开字段或方法。

ArtifactStoreToolPort

Artifact Store Tool Port 类,共公开 2 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { ArtifactStoreToolPort } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class ArtifactStoreToolPort implements ToolArtifactPort {
    constructor(artifacts: ArtifactStoreProvider);
    store(request: {
            invocationId: string;
            toolId: string;
            value: unknown;
            mimeType?: string;
            metadata?: Record<string, unknown>;
        }): Promise<string>;
}

公开成员

成员种类签名说明
constructor构造函数(artifacts: ArtifactStoreProvider): ArtifactStoreToolPort创建该类的实例。
store方法store(request: { invocationId: string; toolId: string; value: unknown; mimeType?: string; metadata?: Record<string, unknown>; }): Promise<string>公开方法;参数与返回类型以签名列为准。

FileArtifactStore

File Artifact Store 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { FileArtifactStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class FileArtifactStore implements ArtifactStoreProvider {
    constructor(options: FileArtifactStoreOptions);
    put(filePath: string, content: Buffer | string, meta?: ArtifactMeta): Promise<ArtifactRef>;
    get(ref: ArtifactRef): Promise<Buffer>;
    delete(ref: ArtifactRef): Promise<void>;
}

公开成员

成员种类签名说明
constructor构造函数(options: FileArtifactStoreOptions): FileArtifactStore创建该类的实例。
delete方法delete(ref: ArtifactRef): Promise<void>公开方法;参数与返回类型以签名列为准。
get方法get(ref: ArtifactRef): Promise<Buffer>公开方法;参数与返回类型以签名列为准。
put方法put(filePath: string, content: Buffer | string, meta?: ArtifactMeta): Promise<ArtifactRef>公开方法;参数与返回类型以签名列为准。

FileMCPCapabilityCatalogStore

File MCP Capability Catalog Store 类,共公开 3 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { FileMCPCapabilityCatalogStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class FileMCPCapabilityCatalogStore implements MCPCapabilityCatalogStore {
    constructor(filename: string);
    list(serverId?: string): Promise<MCPCapabilityRecord[]>;
    save(record: MCPCapabilityRecord, options?: {
            expected?: MCPCapabilityRecord | null;
        }): Promise<boolean>;
}

公开成员

成员种类签名说明
constructor构造函数(filename: string): FileMCPCapabilityCatalogStore创建该类的实例。
list方法list(serverId?: string): Promise<MCPCapabilityRecord[]>公开方法;参数与返回类型以签名列为准。
save方法save(record: MCPCapabilityRecord, options?: { expected?: MCPCapabilityRecord | null; }): Promise<boolean>公开方法;参数与返回类型以签名列为准。

FileToolContractSnapshotStore

File Tool Contract Snapshot Store 类,共公开 3 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { FileToolContractSnapshotStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class FileToolContractSnapshotStore implements ToolContractSnapshotStore {
    constructor(rootPath: string);
    get(snapshotId: string): Promise<ToolContractSnapshot | null>;
    save(snapshot: ToolContractSnapshot): Promise<void>;
}

公开成员

成员种类签名说明
constructor构造函数(rootPath: string): FileToolContractSnapshotStore创建该类的实例。
get方法get(snapshotId: string): Promise<ToolContractSnapshot | null>公开方法;参数与返回类型以签名列为准。
save方法save(snapshot: ToolContractSnapshot): Promise<void>公开方法;参数与返回类型以签名列为准。

FileToolObservationStore

File Tool Observation Store 类,共公开 2 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { FileToolObservationStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class FileToolObservationStore implements ToolObservationPort {
    constructor(rootPath: string);
    record(request: {
            invocationId: string;
            toolId: string;
            toolRevision: string;
            runId: string;
            stepId: string;
            inputHash: string;
            outputHash: string;
            value: unknown;
            artifactRefs?: string[];
            provenance: Record<string, unknown>;
        }): Promise<string>;
}

公开成员

成员种类签名说明
constructor构造函数(rootPath: string): FileToolObservationStore创建该类的实例。
record方法record(request: { invocationId: string; toolId: string; toolRevision: string; runId: string; stepId: string; inputHash: string; outputHash: string; value: unknown; artifactRefs?: string[]; provenance: Record<string, unknown>; }): Promise<string>公开方法;参数与返回类型以签名列为准。

FileToolRuntimeStore

File Tool Runtime Store 类,共公开 13 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { FileToolRuntimeStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class FileToolRuntimeStore implements ToolInvocationStore, ToolApprovalStore {
    constructor(options: FileToolRuntimeStoreOptions);
    get(invocationId: string): Promise<ToolInvocationRecord | null>;
    findByIdempotency(request: ToolIdempotencyLookup): Promise<ToolInvocationRecord | null>;
    list(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>;
    create(record: ToolInvocationRecord): Promise<ToolInvocationRecord>;
    update(invocationId: string, patch: ToolInvocationPatch, options?: {
            expectedStatuses?: readonly ToolInvocationStatus[];
            expectedRevision?: number;
        }): Promise<ToolInvocationRecord>;
    getCompleted(invocationId: string): Promise<ToolCallResult | null>;
    saveCompleted(invocationId: string, result: ToolCallResult): Promise<void>;
    getRequest(invocationId: string): Promise<ToolApprovalRequest | null>;
    requestApproval(request: ToolApprovalRequest): Promise<ToolApprovalRequest>;
    getGrant(invocationId: string): Promise<ToolApprovalGrant | null>;
    approve(invocationId: string, approvedBy: string, options?: {
            approvedAt?: string;
            expiresAt?: string;
        }): Promise<ToolApprovalGrant>;
    reject(invocationId: string): Promise<ToolApprovalRequest>;
}

公开成员

成员种类签名说明
approve方法approve(invocationId: string, approvedBy: string, options?: { approvedAt?: string; expiresAt?: string; }): Promise<ToolApprovalGrant>公开方法;参数与返回类型以签名列为准。
constructor构造函数(options: FileToolRuntimeStoreOptions): FileToolRuntimeStore创建该类的实例。
create方法create(record: ToolInvocationRecord): Promise<ToolInvocationRecord>公开方法;参数与返回类型以签名列为准。
findByIdempotency方法findByIdempotency(request: ToolIdempotencyLookup): Promise<ToolInvocationRecord | null>公开方法;参数与返回类型以签名列为准。
get方法get(invocationId: string): Promise<ToolInvocationRecord | null>公开方法;参数与返回类型以签名列为准。
getCompleted方法getCompleted(invocationId: string): Promise<ToolCallResult | null>公开方法;参数与返回类型以签名列为准。
getGrant方法getGrant(invocationId: string): Promise<ToolApprovalGrant | null>公开方法;参数与返回类型以签名列为准。
getRequest方法getRequest(invocationId: string): Promise<ToolApprovalRequest | null>公开方法;参数与返回类型以签名列为准。
list方法list(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>公开方法;参数与返回类型以签名列为准。
reject方法reject(invocationId: string): Promise<ToolApprovalRequest>公开方法;参数与返回类型以签名列为准。
requestApproval方法requestApproval(request: ToolApprovalRequest): Promise<ToolApprovalRequest>公开方法;参数与返回类型以签名列为准。
saveCompleted方法saveCompleted(invocationId: string, result: ToolCallResult): Promise<void>公开方法;参数与返回类型以签名列为准。
update方法update(invocationId: string, patch: ToolInvocationPatch, options?: { expectedStatuses?: readonly ToolInvocationStatus[]; expectedRevision?: number; }): Promise<ToolInvocationRecord>公开方法;参数与返回类型以签名列为准。

InMemoryArtifactStore

In Memory Artifact Store 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { InMemoryArtifactStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class InMemoryArtifactStore implements ArtifactStoreProvider {
    put(path: string, content: Buffer | string, meta?: ArtifactMeta): Promise<ArtifactRef>;
    get(ref: ArtifactRef): Promise<Buffer>;
    delete(ref: ArtifactRef): Promise<void>;
}

公开成员

成员种类签名说明
constructor构造函数(): InMemoryArtifactStore创建该类的实例。
delete方法delete(ref: ArtifactRef): Promise<void>公开方法;参数与返回类型以签名列为准。
get方法get(ref: ArtifactRef): Promise<Buffer>公开方法;参数与返回类型以签名列为准。
put方法put(path: string, content: Buffer | string, meta?: ArtifactMeta): Promise<ArtifactRef>公开方法;参数与返回类型以签名列为准。

InMemoryStructuredStore

In Memory Structured Store 类,共公开 7 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { InMemoryStructuredStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class InMemoryStructuredStore implements StructuredStoreProvider {
    get<T>(table: string, id: string): Promise<T | null>;
    insert<T extends {
            id: string;
        }>(table: string, record: T): Promise<void>;
    update<T>(table: string, id: string, patch: Partial<T>): Promise<void>;
    delete(table: string, id: string): Promise<void>;
    query<T>(table: string, query: StructuredQuery): Promise<T[]>;
    transaction<T>(fn: (tx: StructuredStoreProvider) => Promise<T>): Promise<T>;
}

公开成员

成员种类签名说明
constructor构造函数(): InMemoryStructuredStore创建该类的实例。
delete方法delete(table: string, id: string): Promise<void>公开方法;参数与返回类型以签名列为准。
get方法get<T>(table: string, id: string): Promise<T | null>公开方法;参数与返回类型以签名列为准。
insert方法insert<T extends { id: string; }>(table: string, record: T): Promise<void>公开方法;参数与返回类型以签名列为准。
query方法query<T>(table: string, query: StructuredQuery): Promise<T[]>公开方法;参数与返回类型以签名列为准。
transaction方法transaction<T>(fn: (tx: StructuredStoreProvider) => Promise<T>): Promise<T>公开方法;参数与返回类型以签名列为准。
update方法update<T>(table: string, id: string, patch: Partial<T>): Promise<void>公开方法;参数与返回类型以签名列为准。

InMemoryVectorIndexProvider

In Memory Vector Index Provider 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { InMemoryVectorIndexProvider } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class InMemoryVectorIndexProvider implements VectorIndexProvider {
    upsert(records: VectorRecord[]): Promise<void>;
    search(query: VectorQuery): Promise<VectorSearchResult[]>;
    delete(ids: string[]): Promise<void>;
}

公开成员

成员种类签名说明
constructor构造函数(): InMemoryVectorIndexProvider创建该类的实例。
delete方法delete(ids: string[]): Promise<void>公开方法;参数与返回类型以签名列为准。
search方法search(query: VectorQuery): Promise<VectorSearchResult[]>公开方法;参数与返回类型以签名列为准。
upsert方法upsert(records: VectorRecord[]): Promise<void>公开方法;参数与返回类型以签名列为准。

LocalHashEmbeddingProvider

Zero-dependency lexical embedding for the local backbone. This is deliberately named by its algorithm rather than presented as a neural semantic model. Token and character n-gram feature hashing gives related local text stable overlap while keeping dimensions and persistence deterministic. Deployments that require semantic recall should inject a concrete embedding Provider through createLocalStorageBackbone.

  • 种类: 类
  • 导入: import { LocalHashEmbeddingProvider } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class LocalHashEmbeddingProvider implements EmbeddingProvider {
    constructor(options?: LocalHashEmbeddingProviderOptions);
    embed(input: string[]): Promise<number[][]>;
}

公开成员

成员种类签名说明
constructor构造函数(options?: LocalHashEmbeddingProviderOptions): LocalHashEmbeddingProvider创建该类的实例。
embed方法embed(input: string[]): Promise<number[][]>公开方法;参数与返回类型以签名列为准。

LocalVectorIndexProvider

Local Vector Index Provider 类,共公开 4 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { LocalVectorIndexProvider } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class LocalVectorIndexProvider implements VectorIndexProvider {
    constructor(options: LocalVectorIndexProviderOptions);
    upsert(records: VectorRecord[]): Promise<void>;
    search(query: VectorQuery): Promise<VectorSearchResult[]>;
    delete(ids: string[]): Promise<void>;
}

公开成员

成员种类签名说明
constructor构造函数(options: LocalVectorIndexProviderOptions): LocalVectorIndexProvider创建该类的实例。
delete方法delete(ids: string[]): Promise<void>公开方法;参数与返回类型以签名列为准。
search方法search(query: VectorQuery): Promise<VectorSearchResult[]>公开方法;参数与返回类型以签名列为准。
upsert方法upsert(records: VectorRecord[]): Promise<void>公开方法;参数与返回类型以签名列为准。

MockEmbeddingProvider

Mock Embedding Provider 类,共公开 2 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { MockEmbeddingProvider } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class MockEmbeddingProvider implements EmbeddingProvider {
    embed(input: string[]): Promise<number[][]>;
}

公开成员

成员种类签名说明
constructor构造函数(): MockEmbeddingProvider创建该类的实例。
embed方法embed(input: string[]): Promise<number[][]>公开方法;参数与返回类型以签名列为准。

SQLiteEventStore

SQLite Event Store 类,共公开 6 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { SQLiteEventStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class SQLiteEventStore implements EventStore, TraceRecorder {
    constructor(options: SQLiteEventStoreOptions);
    append(event: FrameworkEvent): Promise<void>;
    record(event: FrameworkEvent): Promise<void>;
    list(filter?: EventFilter): Promise<FrameworkEvent[]>;
    exportJsonl(filename: string, filter?: EventFilter): Promise<number>;
    importJsonl(filename: string): Promise<number>;
}

公开成员

成员种类签名说明
append方法append(event: FrameworkEvent): Promise<void>公开方法;参数与返回类型以签名列为准。
constructor构造函数(options: SQLiteEventStoreOptions): SQLiteEventStore创建该类的实例。
exportJsonl方法exportJsonl(filename: string, filter?: EventFilter): Promise<number>公开方法;参数与返回类型以签名列为准。
importJsonl方法importJsonl(filename: string): Promise<number>公开方法;参数与返回类型以签名列为准。
list方法list(filter?: EventFilter): Promise<FrameworkEvent[]>公开方法;参数与返回类型以签名列为准。
record方法record(event: FrameworkEvent): Promise<void>公开方法;参数与返回类型以签名列为准。

SQLiteStructuredStore

SQLite Structured Store 类,共公开 7 个构造函数或成员;精确签名见本条目的声明与成员表。

  • 种类: 类
  • 导入: import { SQLiteStructuredStore } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare class SQLiteStructuredStore implements StructuredStoreProvider {
    constructor(options: SQLiteStructuredStoreOptions);
    get<T>(table: string, id: string): Promise<T | null>;
    insert<T extends {
            id: string;
        }>(table: string, record: T): Promise<void>;
    update<T>(table: string, id: string, patch: Partial<T>): Promise<void>;
    delete(table: string, id: string): Promise<void>;
    query<T>(table: string, query: StructuredQuery): Promise<T[]>;
    transaction<T>(fn: (tx: StructuredStoreProvider) => Promise<T>): Promise<T>;
}

公开成员

成员种类签名说明
constructor构造函数(options: SQLiteStructuredStoreOptions): SQLiteStructuredStore创建该类的实例。
delete方法delete(table: string, id: string): Promise<void>公开方法;参数与返回类型以签名列为准。
get方法get<T>(table: string, id: string): Promise<T | null>公开方法;参数与返回类型以签名列为准。
insert方法insert<T extends { id: string; }>(table: string, record: T): Promise<void>公开方法;参数与返回类型以签名列为准。
query方法query<T>(table: string, query: StructuredQuery): Promise<T[]>公开方法;参数与返回类型以签名列为准。
transaction方法transaction<T>(fn: (tx: StructuredStoreProvider) => Promise<T>): Promise<T>公开方法;参数与返回类型以签名列为准。
update方法update<T>(table: string, id: string, patch: Partial<T>): Promise<void>公开方法;参数与返回类型以签名列为准。

LOCAL_ADAPTER_TYPES

index 模块导出的 LOCAL ADAPTER TYPES 常量。

  • 种类: 常量
  • 导入: import { LOCAL_ADAPTER_TYPES } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare const LOCAL_ADAPTER_TYPES: readonly ["sqlite", "local-vector", "file-artifact"];

createLocalStorageBackbone

Create Local Storage Backbone 函数,提供 1 个公开调用签名;参数与返回类型见下表。

  • 种类: 函数
  • 导入: import { createLocalStorageBackbone } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare function createLocalStorageBackbone(options: LocalStorageBackboneOptions): LocalStorageBackbone;

调用签名

text
createLocalStorageBackbone(options: LocalStorageBackboneOptions): LocalStorageBackbone

参数

参数类型必需说明
optionsLocalStorageBackboneOptions必需参数;接受的值由类型列定义。

返回值

  • 类型: LocalStorageBackbone
  • 说明: 返回值契约由上述类型定义。

createLocalStorageProfiles

Create Local Storage Profiles 函数,提供 1 个公开调用签名;参数与返回类型见下表。

  • 种类: 函数
  • 导入: import { createLocalStorageProfiles } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export declare function createLocalStorageProfiles(input: {
    eventDbFilename: string;
    structuredDbFilename: string;
    vectorFilename: string;
    artifactRootPath: string;
}): StorageProviderProfile[];

调用签名

text
createLocalStorageProfiles(input: { eventDbFilename: string; structuredDbFilename: string; vectorFilename: string; artifactRootPath: string; }): StorageProviderProfile[]

参数

参数类型必需说明
input{ eventDbFilename: string; structuredDbFilename: string; vectorFilename: string; artifactRootPath: string; }必需参数;接受的值由类型列定义。

返回值

  • 类型: StorageProviderProfile[]
  • 说明: 返回值契约由上述类型定义。

FileArtifactStoreOptions

File Artifact Store Options 接口,共包含 1 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { FileArtifactStoreOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface FileArtifactStoreOptions {
    rootPath: string;
}

契约成员

成员种类签名说明
rootPath属性rootPath: string公开属性;类型、只读和可选状态以签名列为准。

FileToolRuntimeStoreOptions

File Tool Runtime Store Options 接口,共包含 1 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { FileToolRuntimeStoreOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface FileToolRuntimeStoreOptions {
    filename: string;
}

契约成员

成员种类签名说明
filename属性filename: string公开属性;类型、只读和可选状态以签名列为准。

LocalAdapterProfile

Local Adapter Profile 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { LocalAdapterProfile } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface LocalAdapterProfile {
    id: string;
    type: 'sqlite' | 'local-vector' | 'file-artifact';
    rootPath?: string;
    options?: Record<string, unknown>;
}

契约成员

成员种类签名说明
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
options属性options?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
rootPath属性rootPath?: string公开属性;类型、只读和可选状态以签名列为准。
type属性type: "sqlite" | "local-vector" | "file-artifact"公开属性;类型、只读和可选状态以签名列为准。

LocalHashEmbeddingProviderOptions

Local Hash Embedding Provider Options 接口,共包含 1 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { LocalHashEmbeddingProviderOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface LocalHashEmbeddingProviderOptions {
    dimensions?: number;
}

契约成员

成员种类签名说明
dimensions属性dimensions?: number公开属性;类型、只读和可选状态以签名列为准。

LocalStorageBackbone

Local Storage Backbone 接口,共包含 7 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { LocalStorageBackbone } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface LocalStorageBackbone {
    profiles: StorageProviderProfile[];
    eventStore: SQLiteEventStore;
    structured: SQLiteStructuredStore;
    vector: LocalVectorIndexProvider;
    artifacts: FileArtifactStore;
    embeddings: EmbeddingProvider;
    memory: HybridMemoryProvider;
}

契约成员

成员种类签名说明
artifacts属性artifacts: FileArtifactStore公开属性;类型、只读和可选状态以签名列为准。
embeddings属性embeddings: EmbeddingProvider公开属性;类型、只读和可选状态以签名列为准。
eventStore属性eventStore: SQLiteEventStore公开属性;类型、只读和可选状态以签名列为准。
memory属性memory: HybridMemoryProvider公开属性;类型、只读和可选状态以签名列为准。
profiles属性profiles: StorageProviderProfile[]公开属性;类型、只读和可选状态以签名列为准。
structured属性structured: SQLiteStructuredStore公开属性;类型、只读和可选状态以签名列为准。
vector属性vector: LocalVectorIndexProvider公开属性;类型、只读和可选状态以签名列为准。

LocalStorageBackboneOptions

Local Storage Backbone Options 接口,共包含 8 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { LocalStorageBackboneOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface LocalStorageBackboneOptions {
    rootPath: string;
    sqliteMode?: SQLiteEventStoreOptions['mode'];
    eventDbFilename?: string;
    structuredDbFilename?: string;
    vectorFilename?: string;
    artifactRootPath?: string;
    memoryTableName?: string;
    embeddings?: EmbeddingProvider;
}

契约成员

成员种类签名说明
artifactRootPath属性artifactRootPath?: string公开属性;类型、只读和可选状态以签名列为准。
embeddings属性embeddings?: EmbeddingProvider公开属性;类型、只读和可选状态以签名列为准。
eventDbFilename属性eventDbFilename?: string公开属性;类型、只读和可选状态以签名列为准。
memoryTableName属性memoryTableName?: string公开属性;类型、只读和可选状态以签名列为准。
rootPath属性rootPath: string公开属性;类型、只读和可选状态以签名列为准。
sqliteMode属性sqliteMode?: "sqlite" | "json" | "auto" | "node-sqlite"公开属性;类型、只读和可选状态以签名列为准。
structuredDbFilename属性structuredDbFilename?: string公开属性;类型、只读和可选状态以签名列为准。
vectorFilename属性vectorFilename?: string公开属性;类型、只读和可选状态以签名列为准。

LocalVectorIndexProviderOptions

Local Vector Index Provider Options 接口,共包含 1 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { LocalVectorIndexProviderOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface LocalVectorIndexProviderOptions {
    filename: string;
}

契约成员

成员种类签名说明
filename属性filename: string公开属性;类型、只读和可选状态以签名列为准。

SQLiteEventStoreOptions

SQLite Event Store Options 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SQLiteEventStoreOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface SQLiteEventStoreOptions {
    filename: string;
    mode?: 'auto' | 'sqlite' | 'node-sqlite' | 'json';
    jsonFallbackFilename?: string;
}

契约成员

成员种类签名说明
filename属性filename: string公开属性;类型、只读和可选状态以签名列为准。
jsonFallbackFilename属性jsonFallbackFilename?: string公开属性;类型、只读和可选状态以签名列为准。
mode属性mode?: "sqlite" | "json" | "auto" | "node-sqlite"公开属性;类型、只读和可选状态以签名列为准。

SQLiteStructuredStoreOptions

SQLite Structured Store Options 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SQLiteStructuredStoreOptions } from '@codesoul-co/hypha-adapters-local';
  • 源码模块: index

声明

text
export interface SQLiteStructuredStoreOptions {
    filename: string;
    mode?: 'auto' | 'sqlite' | 'node-sqlite' | 'json';
    jsonFallbackFilename?: string;
}

契约成员

成员种类签名说明
filename属性filename: string公开属性;类型、只读和可选状态以签名列为准。
jsonFallbackFilename属性jsonFallbackFilename?: string公开属性;类型、只读和可选状态以签名列为准。
mode属性mode?: "sqlite" | "json" | "auto" | "node-sqlite"公开属性;类型、只读和可选状态以签名列为准。