@chude/memory 4.0.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 +294 -0
- package/dist/application/index.d.ts +6 -0
- package/dist/application/services/ambient-context-service.d.ts +90 -0
- package/dist/application/services/backfill-service.d.ts +71 -0
- package/dist/application/services/budget-allocator.d.ts +57 -0
- package/dist/application/services/embedding-service.d.ts +131 -0
- package/dist/application/services/export-service.d.ts +225 -0
- package/dist/application/services/extraction-pipeline.d.ts +50 -0
- package/dist/application/services/friction-service.d.ts +148 -0
- package/dist/application/services/fts-sanitizer.d.ts +25 -0
- package/dist/application/services/index.d.ts +34 -0
- package/dist/application/services/llm-extractor.d.ts +96 -0
- package/dist/application/services/memory-file-sync-service.d.ts +58 -0
- package/dist/application/services/pattern-extractor.d.ts +95 -0
- package/dist/application/services/recovery-service.d.ts +81 -0
- package/dist/application/services/rrf-fusion.d.ts +53 -0
- package/dist/application/services/smart-context-service.d.ts +126 -0
- package/dist/application/services/sync-service.d.ts +157 -0
- package/dist/application/services/temporal-decay.d.ts +62 -0
- package/dist/domain/entities/backfill-state.d.ts +56 -0
- package/dist/domain/entities/entity.d.ts +131 -0
- package/dist/domain/entities/extraction-state.d.ts +128 -0
- package/dist/domain/entities/fact.d.ts +59 -0
- package/dist/domain/entities/friction-entry.d.ts +84 -0
- package/dist/domain/entities/index.d.ts +15 -0
- package/dist/domain/entities/link.d.ts +74 -0
- package/dist/domain/entities/memory-file.d.ts +78 -0
- package/dist/domain/entities/message.d.ts +70 -0
- package/dist/domain/entities/session.d.ts +93 -0
- package/dist/domain/entities/tool-use.d.ts +85 -0
- package/dist/domain/errors/error-codes.d.ts +37 -0
- package/dist/domain/errors/index.d.ts +8 -0
- package/dist/domain/errors/memory-error.d.ts +52 -0
- package/dist/domain/errors/unknown-error.d.ts +9 -0
- package/dist/domain/index.d.ts +11 -0
- package/dist/domain/ports/embedding.d.ts +96 -0
- package/dist/domain/ports/extraction.d.ts +13 -0
- package/dist/domain/ports/index.d.ts +14 -0
- package/dist/domain/ports/redactor.d.ts +17 -0
- package/dist/domain/ports/repositories.d.ts +658 -0
- package/dist/domain/ports/services.d.ts +180 -0
- package/dist/domain/ports/signals.d.ts +82 -0
- package/dist/domain/ports/sources.d.ts +122 -0
- package/dist/domain/ports/types.d.ts +150 -0
- package/dist/domain/services/content-extractor.d.ts +61 -0
- package/dist/domain/services/index.d.ts +8 -0
- package/dist/domain/services/path-decoder.d.ts +56 -0
- package/dist/domain/services/query-parser.d.ts +47 -0
- package/dist/domain/value-objects/embedding-config.d.ts +56 -0
- package/dist/domain/value-objects/embedding-result.d.ts +46 -0
- package/dist/domain/value-objects/index.d.ts +10 -0
- package/dist/domain/value-objects/project-path.d.ts +92 -0
- package/dist/domain/value-objects/search-query.d.ts +30 -0
- package/dist/domain/value-objects/search-result.d.ts +92 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +1548 -0
- package/dist/infrastructure/database/connection.d.ts +161 -0
- package/dist/infrastructure/database/event-log.d.ts +22 -0
- package/dist/infrastructure/database/health-checker.d.ts +248 -0
- package/dist/infrastructure/database/index.d.ts +11 -0
- package/dist/infrastructure/database/repositories/backfill-state-repository.d.ts +19 -0
- package/dist/infrastructure/database/repositories/embedding-repository.d.ts +121 -0
- package/dist/infrastructure/database/repositories/entity-repository.d.ts +73 -0
- package/dist/infrastructure/database/repositories/extraction-log-repository.d.ts +17 -0
- package/dist/infrastructure/database/repositories/extraction-state-repository.d.ts +52 -0
- package/dist/infrastructure/database/repositories/fact-repository.d.ts +25 -0
- package/dist/infrastructure/database/repositories/friction-repository.d.ts +41 -0
- package/dist/infrastructure/database/repositories/index.d.ts +17 -0
- package/dist/infrastructure/database/repositories/link-repository.d.ts +64 -0
- package/dist/infrastructure/database/repositories/memory-file-repository.d.ts +28 -0
- package/dist/infrastructure/database/repositories/message-repository.d.ts +87 -0
- package/dist/infrastructure/database/repositories/session-repository.d.ts +125 -0
- package/dist/infrastructure/database/repositories/tool-use-repository.d.ts +72 -0
- package/dist/infrastructure/database/schema.d.ts +203 -0
- package/dist/infrastructure/database/services/context-service.d.ts +93 -0
- package/dist/infrastructure/database/services/hybrid-search-service.d.ts +156 -0
- package/dist/infrastructure/database/services/index.d.ts +10 -0
- package/dist/infrastructure/database/services/search-service.d.ts +57 -0
- package/dist/infrastructure/database/services/stats-service.d.ts +36 -0
- package/dist/infrastructure/embedding/background-embedder.d.ts +125 -0
- package/dist/infrastructure/embedding/embedding-provider-factory.d.ts +44 -0
- package/dist/infrastructure/embedding/index.d.ts +5 -0
- package/dist/infrastructure/embedding/ollama-provider.d.ts +41 -0
- package/dist/infrastructure/embedding/openai-provider.d.ts +38 -0
- package/dist/infrastructure/embedding/transformers-js-provider.d.ts +34 -0
- package/dist/infrastructure/external/index.d.ts +7 -0
- package/dist/infrastructure/external/qmd-runner.d.ts +36 -0
- package/dist/infrastructure/hooks/auto-memory-writer.d.ts +52 -0
- package/dist/infrastructure/hooks/config-manager.d.ts +237 -0
- package/dist/infrastructure/hooks/git-syncer.d.ts +44 -0
- package/dist/infrastructure/hooks/hook-runner.d.ts +126 -0
- package/dist/infrastructure/hooks/index.d.ts +12 -0
- package/dist/infrastructure/hooks/log-writer.d.ts +106 -0
- package/dist/infrastructure/hooks/settings-manager.d.ts +163 -0
- package/dist/infrastructure/hooks/sync-hook-script.d.ts +83 -0
- package/dist/infrastructure/hooks/sync-logger-adapter.d.ts +17 -0
- package/dist/infrastructure/index.d.ts +11 -0
- package/dist/infrastructure/llm/anthropic-extractor.d.ts +20 -0
- package/dist/infrastructure/llm/claude-cli-extractor.d.ts +14 -0
- package/dist/infrastructure/llm/claude-summary-generator.d.ts +14 -0
- package/dist/infrastructure/llm/extraction-helper.d.ts +16 -0
- package/dist/infrastructure/llm/ollama-extractor.d.ts +20 -0
- package/dist/infrastructure/llm/openai-extractor.d.ts +23 -0
- package/dist/infrastructure/migration.d.ts +103 -0
- package/dist/infrastructure/parsers/event-classifier.d.ts +111 -0
- package/dist/infrastructure/parsers/index.d.ts +8 -0
- package/dist/infrastructure/parsers/jsonl-parser.d.ts +25 -0
- package/dist/infrastructure/parsers/timestamp.d.ts +18 -0
- package/dist/infrastructure/paths.d.ts +129 -0
- package/dist/infrastructure/providers/provider-defaults.d.ts +11 -0
- package/dist/infrastructure/providers/provider-registry.d.ts +28 -0
- package/dist/infrastructure/security/pattern-redactor.d.ts +6 -0
- package/dist/infrastructure/signals/adapters.d.ts +27 -0
- package/dist/infrastructure/signals/checkpoint-manager.d.ts +83 -0
- package/dist/infrastructure/signals/index.d.ts +8 -0
- package/dist/infrastructure/signals/signal-handler.d.ts +113 -0
- package/dist/infrastructure/sources/index.d.ts +8 -0
- package/dist/infrastructure/sources/memory-file-scanner.d.ts +23 -0
- package/dist/infrastructure/sources/project-name-resolver.d.ts +67 -0
- package/dist/infrastructure/sources/session-source.d.ts +70 -0
- package/dist/presentation/cli/command-result.d.ts +10 -0
- package/dist/presentation/cli/commands/_helpers/capture-json.d.ts +36 -0
- package/dist/presentation/cli/commands/_helpers/deprecation-warning.d.ts +41 -0
- package/dist/presentation/cli/commands/backfill.d.ts +56 -0
- package/dist/presentation/cli/commands/browse.d.ts +55 -0
- package/dist/presentation/cli/commands/completion.d.ts +61 -0
- package/dist/presentation/cli/commands/context.d.ts +53 -0
- package/dist/presentation/cli/commands/doctor.d.ts +55 -0
- package/dist/presentation/cli/commands/export.d.ts +36 -0
- package/dist/presentation/cli/commands/extract.d.ts +40 -0
- package/dist/presentation/cli/commands/facts.d.ts +17 -0
- package/dist/presentation/cli/commands/friction/dashboard.d.ts +18 -0
- package/dist/presentation/cli/commands/friction/index.d.ts +12 -0
- package/dist/presentation/cli/commands/friction/list.d.ts +12 -0
- package/dist/presentation/cli/commands/friction/log.d.ts +12 -0
- package/dist/presentation/cli/commands/friction/purge.d.ts +12 -0
- package/dist/presentation/cli/commands/friction/resolve.d.ts +12 -0
- package/dist/presentation/cli/commands/friction/types.d.ts +86 -0
- package/dist/presentation/cli/commands/friction/wontfix.d.ts +12 -0
- package/dist/presentation/cli/commands/import.d.ts +38 -0
- package/dist/presentation/cli/commands/index.d.ts +51 -0
- package/dist/presentation/cli/commands/install.d.ts +67 -0
- package/dist/presentation/cli/commands/list.d.ts +61 -0
- package/dist/presentation/cli/commands/migrate.d.ts +36 -0
- package/dist/presentation/cli/commands/purge.d.ts +100 -0
- package/dist/presentation/cli/commands/query.d.ts +51 -0
- package/dist/presentation/cli/commands/related.d.ts +47 -0
- package/dist/presentation/cli/commands/remote.d.ts +36 -0
- package/dist/presentation/cli/commands/search.d.ts +100 -0
- package/dist/presentation/cli/commands/show.d.ts +51 -0
- package/dist/presentation/cli/commands/stats.d.ts +38 -0
- package/dist/presentation/cli/commands/status.d.ts +152 -0
- package/dist/presentation/cli/commands/sync/ambient.d.ts +22 -0
- package/dist/presentation/cli/commands/sync/background.d.ts +23 -0
- package/dist/presentation/cli/commands/sync/embedding-pass.d.ts +32 -0
- package/dist/presentation/cli/commands/sync/helpers.d.ts +25 -0
- package/dist/presentation/cli/commands/sync/index.d.ts +17 -0
- package/dist/presentation/cli/commands/sync/memory-files.d.ts +26 -0
- package/dist/presentation/cli/commands/sync/types.d.ts +163 -0
- package/dist/presentation/cli/commands/uninstall.d.ts +44 -0
- package/dist/presentation/cli/db-startup.d.ts +61 -0
- package/dist/presentation/cli/formatters/ai-formatter.d.ts +38 -0
- package/dist/presentation/cli/formatters/color.d.ts +82 -0
- package/dist/presentation/cli/formatters/context-formatter.d.ts +55 -0
- package/dist/presentation/cli/formatters/dto-helpers.d.ts +176 -0
- package/dist/presentation/cli/formatters/envelope.d.ts +136 -0
- package/dist/presentation/cli/formatters/error-formatter.d.ts +41 -0
- package/dist/presentation/cli/formatters/friction-dashboard.d.ts +46 -0
- package/dist/presentation/cli/formatters/index.d.ts +17 -0
- package/dist/presentation/cli/formatters/list-formatter.d.ts +48 -0
- package/dist/presentation/cli/formatters/output-formatter.d.ts +98 -0
- package/dist/presentation/cli/formatters/related-formatter.d.ts +57 -0
- package/dist/presentation/cli/formatters/show-formatter.d.ts +63 -0
- package/dist/presentation/cli/formatters/stats-formatter.d.ts +54 -0
- package/dist/presentation/cli/formatters/text-width.d.ts +37 -0
- package/dist/presentation/cli/formatters/timestamp-formatter.d.ts +38 -0
- package/dist/presentation/cli/index.d.ts +10 -0
- package/dist/presentation/cli/index.js +1664 -0
- package/dist/presentation/cli/parsers/date-parser.d.ts +28 -0
- package/dist/presentation/cli/parsers/index.d.ts +6 -0
- package/dist/presentation/cli/pickers/index.d.ts +6 -0
- package/dist/presentation/cli/pickers/session-picker.d.ts +59 -0
- package/dist/presentation/cli/progress-reporter.d.ts +199 -0
- package/package.json +94 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QueryParser Domain Service
|
|
3
|
+
*
|
|
4
|
+
* Parses search query strings into structured query objects.
|
|
5
|
+
* Supports terms, quoted phrases, and filter syntax.
|
|
6
|
+
*
|
|
7
|
+
* Service properties:
|
|
8
|
+
* - Stateless operations
|
|
9
|
+
* - Pure functions (no side effects)
|
|
10
|
+
* - Domain logic only (no infrastructure concerns)
|
|
11
|
+
*/
|
|
12
|
+
export interface ParsedQuery {
|
|
13
|
+
terms: string[];
|
|
14
|
+
filters: QueryFilters;
|
|
15
|
+
originalQuery: string;
|
|
16
|
+
}
|
|
17
|
+
export interface QueryFilters {
|
|
18
|
+
project?: string;
|
|
19
|
+
role?: string;
|
|
20
|
+
tool?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class QueryParser {
|
|
23
|
+
/**
|
|
24
|
+
* Parse a search query string into structured components.
|
|
25
|
+
* @param query The raw search query
|
|
26
|
+
* @returns Parsed query with terms and filters
|
|
27
|
+
*/
|
|
28
|
+
static parse(query: string): ParsedQuery;
|
|
29
|
+
/**
|
|
30
|
+
* Convert a parsed query to FTS5 query syntax.
|
|
31
|
+
* @param parsed The parsed query
|
|
32
|
+
* @returns FTS5-compatible query string
|
|
33
|
+
*/
|
|
34
|
+
static toFts5Query(parsed: ParsedQuery): string;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a parsed query is effectively empty.
|
|
37
|
+
* @param parsed The parsed query
|
|
38
|
+
* @returns true if no terms and no filters
|
|
39
|
+
*/
|
|
40
|
+
static isEmpty(parsed: ParsedQuery): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a parsed query has any filters.
|
|
43
|
+
* @param parsed The parsed query
|
|
44
|
+
* @returns true if any filters are present
|
|
45
|
+
*/
|
|
46
|
+
static hasFilters(parsed: ParsedQuery): boolean;
|
|
47
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmbeddingConfig Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents the configuration for an embedding provider, including
|
|
5
|
+
* whether embeddings are enabled, the provider name, model, and dimensions.
|
|
6
|
+
*
|
|
7
|
+
* Value object properties:
|
|
8
|
+
* - Immutable after construction
|
|
9
|
+
* - Equality based on all field values
|
|
10
|
+
* - Validates on construction (dimensions positive integer, strings non-empty)
|
|
11
|
+
*/
|
|
12
|
+
interface EmbeddingConfigParams {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
provider: string;
|
|
15
|
+
model: string;
|
|
16
|
+
dimensions: number;
|
|
17
|
+
}
|
|
18
|
+
export declare class EmbeddingConfig {
|
|
19
|
+
private readonly _enabled;
|
|
20
|
+
private readonly _provider;
|
|
21
|
+
private readonly _model;
|
|
22
|
+
private readonly _dimensions;
|
|
23
|
+
private constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Create EmbeddingConfig from parameters.
|
|
26
|
+
* @throws Error if dimensions not positive integer, provider/model empty
|
|
27
|
+
*/
|
|
28
|
+
static create(params: EmbeddingConfigParams): EmbeddingConfig;
|
|
29
|
+
/**
|
|
30
|
+
* Create EmbeddingConfig with default values.
|
|
31
|
+
* Default: local provider, all-MiniLM-L6-v2, 384 dimensions, enabled.
|
|
32
|
+
*/
|
|
33
|
+
static defaults(): EmbeddingConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Whether embedding generation is enabled.
|
|
36
|
+
*/
|
|
37
|
+
get enabled(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The embedding provider identifier (e.g., "local", "openai", "ollama").
|
|
40
|
+
*/
|
|
41
|
+
get provider(): string;
|
|
42
|
+
/**
|
|
43
|
+
* The embedding model identifier.
|
|
44
|
+
*/
|
|
45
|
+
get model(): string;
|
|
46
|
+
/**
|
|
47
|
+
* The number of dimensions in the embedding vectors.
|
|
48
|
+
*/
|
|
49
|
+
get dimensions(): number;
|
|
50
|
+
/**
|
|
51
|
+
* Check equality with another EmbeddingConfig.
|
|
52
|
+
* Two configs are equal if all fields match.
|
|
53
|
+
*/
|
|
54
|
+
equals(other: EmbeddingConfig): boolean;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmbeddingResult Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents a vector embedding produced by an embedding provider.
|
|
5
|
+
* Contains the embedding vector, model identifier, and dimension count.
|
|
6
|
+
*
|
|
7
|
+
* Value object properties:
|
|
8
|
+
* - Immutable after construction (Float32Array is copied)
|
|
9
|
+
* - Equality based on model and embedding values
|
|
10
|
+
* - Validates on construction (dimensions match, model non-empty)
|
|
11
|
+
*/
|
|
12
|
+
interface EmbeddingResultParams {
|
|
13
|
+
embedding: Float32Array;
|
|
14
|
+
model: string;
|
|
15
|
+
dimensions: number;
|
|
16
|
+
}
|
|
17
|
+
export declare class EmbeddingResult {
|
|
18
|
+
private readonly _embedding;
|
|
19
|
+
private readonly _model;
|
|
20
|
+
private readonly _dimensions;
|
|
21
|
+
private constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Create EmbeddingResult from parameters.
|
|
24
|
+
* @throws Error if dimensions mismatch, model empty, or embedding empty
|
|
25
|
+
*/
|
|
26
|
+
static create(params: EmbeddingResultParams): EmbeddingResult;
|
|
27
|
+
/**
|
|
28
|
+
* The embedding vector as Float32Array.
|
|
29
|
+
* Returns a copy to preserve immutability.
|
|
30
|
+
*/
|
|
31
|
+
get embedding(): Float32Array;
|
|
32
|
+
/**
|
|
33
|
+
* The model identifier that produced this embedding.
|
|
34
|
+
*/
|
|
35
|
+
get model(): string;
|
|
36
|
+
/**
|
|
37
|
+
* The number of dimensions in the embedding vector.
|
|
38
|
+
*/
|
|
39
|
+
get dimensions(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Check equality with another EmbeddingResult.
|
|
42
|
+
* Two results are equal if they have the same model and identical embeddings.
|
|
43
|
+
*/
|
|
44
|
+
equals(other: EmbeddingResult): boolean;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Value Objects
|
|
3
|
+
*
|
|
4
|
+
* Immutable objects defined by their attributes, not identity.
|
|
5
|
+
*/
|
|
6
|
+
export { EmbeddingConfig } from "./embedding-config.js";
|
|
7
|
+
export { EmbeddingResult } from "./embedding-result.js";
|
|
8
|
+
export { ProjectPath } from "./project-path.js";
|
|
9
|
+
export { SearchQuery } from "./search-query.js";
|
|
10
|
+
export { SearchResult } from "./search-result.js";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProjectPath Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents a project directory path that can be encoded for filesystem-safe
|
|
5
|
+
* storage (e.g., as directory names) and decoded back to the original path.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: Claude Code's encoding is LOSSY. Three different characters all
|
|
8
|
+
* become single dashes in the encoded form:
|
|
9
|
+
* - Backslash (path separator): \ -> -
|
|
10
|
+
* - Forward slash (path separator): / -> -
|
|
11
|
+
* - Space (in folder names): " " -> -
|
|
12
|
+
* - Hyphen (in folder names): - -> - (unchanged, but indistinguishable)
|
|
13
|
+
*
|
|
14
|
+
* Since information is lost during encoding, the decoded path is "best effort"
|
|
15
|
+
* and may not match the original path exactly. Use the encoded form as the
|
|
16
|
+
* canonical identifier for matching and comparison.
|
|
17
|
+
*
|
|
18
|
+
* Encoding rules (matching Claude Code behavior):
|
|
19
|
+
* - Windows drive letter + colon + backslash -> double-dash (C:\ -> C--)
|
|
20
|
+
* - All other backslashes -> single-dash
|
|
21
|
+
* - Forward slashes -> single-dash
|
|
22
|
+
* - Spaces -> single-dash
|
|
23
|
+
* - Hyphens -> single-dash (preserved but indistinguishable)
|
|
24
|
+
*
|
|
25
|
+
* Value object properties:
|
|
26
|
+
* - Immutable after construction
|
|
27
|
+
* - Equality based on encoded path value (canonical identifier)
|
|
28
|
+
* - Validates on construction (rejects empty paths)
|
|
29
|
+
*/
|
|
30
|
+
export declare class ProjectPath {
|
|
31
|
+
private readonly _decoded;
|
|
32
|
+
private readonly _encoded;
|
|
33
|
+
private readonly _projectName;
|
|
34
|
+
private constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Create ProjectPath from a decoded (original) path.
|
|
37
|
+
* @param path The original filesystem path (e.g., "C:\Users\Destiny\Projects\foo")
|
|
38
|
+
* @throws Error if path is empty or whitespace-only
|
|
39
|
+
*/
|
|
40
|
+
static fromDecoded(path: string): ProjectPath;
|
|
41
|
+
/**
|
|
42
|
+
* Create ProjectPath from an encoded path.
|
|
43
|
+
* @param encoded The encoded path (e.g., "C--Users-Destiny-Projects-foo")
|
|
44
|
+
* @throws Error if path is empty or whitespace-only
|
|
45
|
+
*/
|
|
46
|
+
static fromEncoded(encoded: string): ProjectPath;
|
|
47
|
+
/**
|
|
48
|
+
* The original filesystem path.
|
|
49
|
+
*/
|
|
50
|
+
get decoded(): string;
|
|
51
|
+
/**
|
|
52
|
+
* The filesystem-safe encoded path.
|
|
53
|
+
*/
|
|
54
|
+
get encoded(): string;
|
|
55
|
+
/**
|
|
56
|
+
* The project name (last segment of the path).
|
|
57
|
+
*/
|
|
58
|
+
get projectName(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Return a new ProjectPath with an overridden project name.
|
|
61
|
+
* Preserves encoded and decoded paths. Useful when the correct
|
|
62
|
+
* project name is resolved via filesystem lookup.
|
|
63
|
+
*/
|
|
64
|
+
withProjectName(name: string): ProjectPath;
|
|
65
|
+
/**
|
|
66
|
+
* Check equality with another ProjectPath.
|
|
67
|
+
* Two paths are equal if their decoded values match.
|
|
68
|
+
*/
|
|
69
|
+
equals(other: ProjectPath): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Encode a path for filesystem-safe storage.
|
|
72
|
+
* Matches Claude Code's encoding behavior:
|
|
73
|
+
* - Windows drive (C:\) becomes C--
|
|
74
|
+
* - All backslashes become single-dash
|
|
75
|
+
* - All forward slashes become single-dash
|
|
76
|
+
* - All spaces become single-dash
|
|
77
|
+
* - Hyphens remain as single-dash (lossy - indistinguishable from separators)
|
|
78
|
+
*/
|
|
79
|
+
private static encode;
|
|
80
|
+
/**
|
|
81
|
+
* Decode an encoded path back to the original format.
|
|
82
|
+
* Detects Windows vs Unix based on pattern:
|
|
83
|
+
* - Windows paths have drive letter followed by double-dash (e.g., "C--")
|
|
84
|
+
* - Unix paths start with a dash (from leading /)
|
|
85
|
+
*/
|
|
86
|
+
private static decode;
|
|
87
|
+
/**
|
|
88
|
+
* Extract the project name from the decoded path.
|
|
89
|
+
* Handles both Windows and Unix paths, and trailing separators.
|
|
90
|
+
*/
|
|
91
|
+
private extractProjectName;
|
|
92
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchQuery Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents a validated search query for full-text search operations.
|
|
5
|
+
*
|
|
6
|
+
* Value object properties:
|
|
7
|
+
* - Immutable after construction
|
|
8
|
+
* - Equality based on query value
|
|
9
|
+
* - Validates on construction (rejects empty queries)
|
|
10
|
+
* - Trims whitespace but preserves case and special characters
|
|
11
|
+
*/
|
|
12
|
+
export declare class SearchQuery {
|
|
13
|
+
private readonly _value;
|
|
14
|
+
private constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Create SearchQuery from a query string.
|
|
17
|
+
* @param query The search query string
|
|
18
|
+
* @throws Error if query is empty or whitespace-only
|
|
19
|
+
*/
|
|
20
|
+
static from(query: string): SearchQuery;
|
|
21
|
+
/**
|
|
22
|
+
* The search query value.
|
|
23
|
+
*/
|
|
24
|
+
get value(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Check equality with another SearchQuery.
|
|
27
|
+
* Comparison is case-sensitive.
|
|
28
|
+
*/
|
|
29
|
+
equals(other: SearchQuery): boolean;
|
|
30
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchResult Value Object
|
|
3
|
+
*
|
|
4
|
+
* Represents a single search result from a full-text search query.
|
|
5
|
+
* Contains the matched message reference, relevance score, and snippet.
|
|
6
|
+
*
|
|
7
|
+
* Value object properties:
|
|
8
|
+
* - Immutable after construction
|
|
9
|
+
* - Equality based on sessionId and messageId (identity of the match)
|
|
10
|
+
* - Validates on construction (rejects invalid scores, empty IDs)
|
|
11
|
+
*/
|
|
12
|
+
interface SearchResultParams {
|
|
13
|
+
sessionId: string;
|
|
14
|
+
messageId: string;
|
|
15
|
+
snippet: string;
|
|
16
|
+
score: number;
|
|
17
|
+
timestamp: Date;
|
|
18
|
+
role: string;
|
|
19
|
+
/** Source ranker(s) that produced this result */
|
|
20
|
+
source?: "fts" | "vector" | "both" | undefined;
|
|
21
|
+
/** Raw scores from individual rankers before normalization */
|
|
22
|
+
rawScores?: {
|
|
23
|
+
bm25?: number | undefined;
|
|
24
|
+
cosine?: number | undefined;
|
|
25
|
+
rrf?: number | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare class SearchResult {
|
|
29
|
+
private readonly _sessionId;
|
|
30
|
+
private readonly _messageId;
|
|
31
|
+
private readonly _snippet;
|
|
32
|
+
private readonly _score;
|
|
33
|
+
private readonly _timestamp;
|
|
34
|
+
private readonly _role;
|
|
35
|
+
private readonly _source?;
|
|
36
|
+
private readonly _rawScores?;
|
|
37
|
+
private constructor();
|
|
38
|
+
/**
|
|
39
|
+
* Create SearchResult from parameters.
|
|
40
|
+
* @throws Error if any required field is empty or score is out of range
|
|
41
|
+
*/
|
|
42
|
+
static create(params: SearchResultParams): SearchResult;
|
|
43
|
+
/**
|
|
44
|
+
* The session ID containing this result.
|
|
45
|
+
*/
|
|
46
|
+
get sessionId(): string;
|
|
47
|
+
/**
|
|
48
|
+
* The message ID within the session.
|
|
49
|
+
*/
|
|
50
|
+
get messageId(): string;
|
|
51
|
+
/**
|
|
52
|
+
* The text snippet containing the match.
|
|
53
|
+
*/
|
|
54
|
+
get snippet(): string;
|
|
55
|
+
/**
|
|
56
|
+
* The relevance score (0-1, higher is more relevant).
|
|
57
|
+
*/
|
|
58
|
+
get score(): number;
|
|
59
|
+
/**
|
|
60
|
+
* The timestamp of the matched message.
|
|
61
|
+
*/
|
|
62
|
+
get timestamp(): Date;
|
|
63
|
+
/**
|
|
64
|
+
* The role of the message author (user, assistant, system).
|
|
65
|
+
*/
|
|
66
|
+
get role(): string;
|
|
67
|
+
/**
|
|
68
|
+
* The source ranker(s) that produced this result.
|
|
69
|
+
* Undefined for legacy FTS-only results.
|
|
70
|
+
*/
|
|
71
|
+
get source(): "fts" | "vector" | "both" | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Raw scores from individual rankers before normalization.
|
|
74
|
+
* Undefined for legacy FTS-only results.
|
|
75
|
+
*/
|
|
76
|
+
get rawScores(): {
|
|
77
|
+
bm25?: number | undefined;
|
|
78
|
+
cosine?: number | undefined;
|
|
79
|
+
rrf?: number | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Check equality with another SearchResult.
|
|
83
|
+
* Two results are equal if they reference the same message.
|
|
84
|
+
*/
|
|
85
|
+
equals(other: SearchResult): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Compare by score for sorting (descending order - higher scores first).
|
|
88
|
+
* Returns negative if this result should come before other.
|
|
89
|
+
*/
|
|
90
|
+
compareByScore(other: SearchResult): number;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @chude/memory
|
|
3
|
+
*
|
|
4
|
+
* Cross-project context persistence for Claude Code sessions.
|
|
5
|
+
*
|
|
6
|
+
* This module exports:
|
|
7
|
+
* - Domain layer: entities, value objects, services, errors
|
|
8
|
+
* - Application layer: use cases and application services
|
|
9
|
+
* - Presentation API: execute*Command functions for programmatic use
|
|
10
|
+
*/
|
|
11
|
+
export * from "./domain/index.js";
|
|
12
|
+
export * from "./application/index.js";
|
|
13
|
+
export { executeSyncCommand, executeSearchCommand, executeListCommand, executeStatsCommand, executeContextCommand, executeRelatedCommand, executeShowCommand, executeBrowseCommand, executeQueryCommand, executeInstallCommand, executeUninstallCommand, executeStatusCommand, executeDoctorCommand, executePurgeCommand, executeExportCommand, executeImportCommand, executeCompletionCommand, executeFrictionCommand, } from "./presentation/cli/commands/index.js";
|
|
14
|
+
export type { CommandResult } from "./presentation/cli/commands/index.js";
|
|
15
|
+
export type { SyncCommandOptions, EmbeddingPassDeps, BackgroundModeDeps, SearchCommandOptions, ListCommandOptions, StatsCommandOptions, ContextCommandOptions, RelatedCommandOptions, ShowCommandOptions, QueryCommandOptions, BrowseCommandOptions, InstallOptions, UninstallOptions, DoctorOptions, PurgeCommandOptions, PurgeResult, ExportOptions, ImportOptions, ShellType, StatusInfo, EmbeddingStatus, StatusOptions, GatherStatusOptions, FrictionCommandOptions, FrictionLogOptions, FrictionListOptions, FrictionResolveOptions, FrictionExecuteOptions, } from "./presentation/cli/commands/index.js";
|