feat: add isolated memory spaces

This commit is contained in:
2026-05-11 14:45:28 +09:00
parent b908bc0bd9
commit d83fc31c59
14 changed files with 667 additions and 132 deletions

View File

@@ -1,6 +1,26 @@
import type { JsonValue, TopicCategory, TopicGranularity } from './domain';
export interface UpsertTopicInput {
export interface SpaceScopedInput {
spaceName?: string | undefined;
}
export interface UpsertSpaceInput {
name: string;
description?: string | null;
metadata?: JsonValue | null;
}
export interface Space {
id: string;
name: string;
normalizedName: string;
description: string | null;
metadata: JsonValue | null;
createdAt: string;
updatedAt: string;
}
export interface UpsertTopicInput extends SpaceScopedInput {
name: string;
category?: TopicCategory;
granularity?: TopicGranularity;
@@ -12,7 +32,7 @@ export interface TopicLinkInput extends UpsertTopicInput {
role?: string | null;
}
export interface AddFactInput {
export interface AddFactInput extends SpaceScopedInput {
statement: string;
summary?: string | null;
source?: string | null;
@@ -21,13 +41,14 @@ export interface AddFactInput {
topics: TopicLinkInput[];
}
export interface LinkTopicsInput {
export interface LinkTopicsInput extends SpaceScopedInput {
parentName: string;
childName: string;
}
export interface Topic {
id: string;
spaceId: string;
name: string;
normalizedName: string;
category: TopicCategory;
@@ -45,6 +66,7 @@ export interface FactTopic extends Topic {
export interface Fact {
id: string;
spaceId: string;
statement: string;
summary: string | null;
source: string | null;
@@ -63,11 +85,11 @@ export interface ConnectedTopic extends Topic {
sharedFactCount: number;
}
export interface TopicLookupOptions {
export interface TopicLookupOptions extends SpaceScopedInput {
includeFacts?: boolean;
}
export interface ListTopicsOptions {
export interface ListTopicsOptions extends SpaceScopedInput {
includeFacts?: boolean;
limit?: number;
}
@@ -79,11 +101,11 @@ export interface EmbeddingProvider {
embedMany?(inputs: string[]): Promise<number[][]>;
}
export interface IndexFactEmbeddingsInput {
export interface IndexFactEmbeddingsInput extends SpaceScopedInput {
provider: EmbeddingProvider;
}
export interface SearchFactsInput {
export interface SearchFactsInput extends SpaceScopedInput {
query: string;
provider: EmbeddingProvider;
topicNames?: string[];
@@ -91,7 +113,7 @@ export interface SearchFactsInput {
minimumScore?: number;
}
export interface FindSimilarFactsInput {
export interface FindSimilarFactsInput extends SpaceScopedInput {
statement: string;
provider: EmbeddingProvider;
topicNames?: string[];