@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,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search Command Handler
|
|
3
|
+
*
|
|
4
|
+
* CLI command for full-text and hybrid search across synced sessions.
|
|
5
|
+
* Wires to HybridSearchService supporting auto, FTS, vector, and hybrid modes.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import type { CommandResult } from "../command-result.js";
|
|
9
|
+
import type { SearchResult } from "../../../domain/value-objects/search-result.js";
|
|
10
|
+
import type { SearchMode } from "../../../domain/ports/services.js";
|
|
11
|
+
/**
|
|
12
|
+
* Options for the search command.
|
|
13
|
+
*/
|
|
14
|
+
export interface SearchCommandOptions {
|
|
15
|
+
/** Maximum results to return (as string, parsed to integer) */
|
|
16
|
+
limit?: string;
|
|
17
|
+
/** Filter by project name */
|
|
18
|
+
project?: string;
|
|
19
|
+
/** Filter by session ID */
|
|
20
|
+
session?: string;
|
|
21
|
+
/** Filter by role: user, assistant, or both (comma-separated) */
|
|
22
|
+
role?: string;
|
|
23
|
+
/** Results after date (e.g., 'yesterday', '2 weeks ago') */
|
|
24
|
+
since?: string;
|
|
25
|
+
/** Results before date */
|
|
26
|
+
before?: string;
|
|
27
|
+
/** Results from last N days (includes today) */
|
|
28
|
+
days?: number;
|
|
29
|
+
/** Output results as JSON */
|
|
30
|
+
json?: boolean;
|
|
31
|
+
/** Case-insensitive search (default) */
|
|
32
|
+
ignoreCase?: boolean;
|
|
33
|
+
/** Case-sensitive search */
|
|
34
|
+
caseSensitive?: boolean;
|
|
35
|
+
/** Show detailed output with execution info */
|
|
36
|
+
verbose?: boolean;
|
|
37
|
+
/** Suppress headers and decorations */
|
|
38
|
+
quiet?: boolean;
|
|
39
|
+
/** Search mode: auto, fts, vector, or hybrid */
|
|
40
|
+
mode?: string;
|
|
41
|
+
/** Set to false via --no-vector to disable vector search */
|
|
42
|
+
vector?: boolean;
|
|
43
|
+
/** Set to false via --no-decay to disable temporal decay scoring */
|
|
44
|
+
decay?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Output format. Phase 32 (CLI-03) normalized choices: `brief`,
|
|
47
|
+
* `ai`. `default` retained as deprecated alias (one-minor cadence;
|
|
48
|
+
* CHANGELOG documents removal). Undefined = no-flag default text
|
|
49
|
+
* output (backward compatible).
|
|
50
|
+
*/
|
|
51
|
+
format?: "brief" | "ai" | "default";
|
|
52
|
+
/** Search markdown files via qmd (requires qmd installed) */
|
|
53
|
+
files?: boolean;
|
|
54
|
+
/** Override database path (for testing) */
|
|
55
|
+
dbPath?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolve the effective search mode from CLI flags.
|
|
59
|
+
*
|
|
60
|
+
* --no-vector always forces FTS mode (DEGRADE-04), overriding --mode.
|
|
61
|
+
* --mode auto returns undefined to let HybridSearchService decide.
|
|
62
|
+
* Explicit modes (fts, vector, hybrid) are returned directly.
|
|
63
|
+
*
|
|
64
|
+
* @param options Partial options with mode and noVector flags
|
|
65
|
+
* @returns Resolved SearchMode or undefined for auto
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveSearchMode(options: {
|
|
68
|
+
mode?: string;
|
|
69
|
+
vector?: boolean;
|
|
70
|
+
}): SearchMode | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Create the search command for Commander.js.
|
|
73
|
+
*
|
|
74
|
+
* @returns Configured Command instance
|
|
75
|
+
*/
|
|
76
|
+
export declare function createSearchCommand(): Command;
|
|
77
|
+
/**
|
|
78
|
+
* Execute the search command programmatically.
|
|
79
|
+
*
|
|
80
|
+
* Searches sessions using FTS5 or hybrid semantic search. Handles its own
|
|
81
|
+
* database initialization and teardown.
|
|
82
|
+
*
|
|
83
|
+
* @param query - The search string (must be non-empty)
|
|
84
|
+
* @param options - Search command options
|
|
85
|
+
* @returns CommandResult with exitCode 0 (success) or 1 (error)
|
|
86
|
+
*/
|
|
87
|
+
export declare function executeSearchCommand(query: string, options: SearchCommandOptions): Promise<CommandResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Internal implementation of the search query execution.
|
|
90
|
+
*/
|
|
91
|
+
export declare function runSearchInternal(query: string, options: SearchCommandOptions): Promise<CommandResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Filter results to only include those with case-sensitive match in snippet.
|
|
94
|
+
*
|
|
95
|
+
* @param results Search results from FTS5
|
|
96
|
+
* @param query Original query string
|
|
97
|
+
* @param limit Maximum results to return after filtering
|
|
98
|
+
* @returns Filtered results matching exact case
|
|
99
|
+
*/
|
|
100
|
+
export declare function filterCaseSensitive(results: SearchResult[], query: string, limit: number): SearchResult[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show Command Handler
|
|
3
|
+
*
|
|
4
|
+
* CLI command for displaying session details with conversation thread format.
|
|
5
|
+
* Supports partial session ID matching and multiple output modes.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import type { CommandResult } from "../command-result.js";
|
|
9
|
+
/**
|
|
10
|
+
* Options for the show command.
|
|
11
|
+
*/
|
|
12
|
+
export interface ShowCommandOptions {
|
|
13
|
+
/** Output as JSON */
|
|
14
|
+
json?: boolean;
|
|
15
|
+
/** Show detailed output */
|
|
16
|
+
verbose?: boolean;
|
|
17
|
+
/** Minimal output (message content only) */
|
|
18
|
+
quiet?: boolean;
|
|
19
|
+
/** Show detailed tool inputs and outputs */
|
|
20
|
+
tools?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Output format. Phase 32 (CLI-03) normalized choices: `brief`,
|
|
23
|
+
* `ai`. `default` retained as deprecated alias (one-minor cadence;
|
|
24
|
+
* CHANGELOG documents removal). Undefined = no-flag default
|
|
25
|
+
* (backward compatible).
|
|
26
|
+
*/
|
|
27
|
+
format?: "brief" | "ai" | "default";
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Runtime dependencies for executeShowCommand.
|
|
31
|
+
*
|
|
32
|
+
* Separated from ShowCommandOptions because these are not user-facing
|
|
33
|
+
* CLI flags — they are operational dependencies that tests substitute
|
|
34
|
+
* to achieve isolation. Defaults to production resolution
|
|
35
|
+
* (getDefaultDbPath()) when omitted.
|
|
36
|
+
*/
|
|
37
|
+
export interface ShowCommandDeps {
|
|
38
|
+
/** Database path. Defaults to getDefaultDbPath(). */
|
|
39
|
+
dbPath?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create the show command for Commander.js.
|
|
43
|
+
*
|
|
44
|
+
* @returns Configured Command instance
|
|
45
|
+
*/
|
|
46
|
+
export declare function createShowCommand(): Command;
|
|
47
|
+
export declare function executeShowCommand(sessionId: string, options: ShowCommandOptions, deps?: ShowCommandDeps): Promise<CommandResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Internal implementation of the show query execution.
|
|
50
|
+
*/
|
|
51
|
+
export declare function runShowInternal(sessionId: string, options: ShowCommandOptions, deps?: ShowCommandDeps): Promise<CommandResult>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats Command Handler (Wrapper)
|
|
3
|
+
*
|
|
4
|
+
* Thin view that delegates database stats overview to executeStatusCommand.
|
|
5
|
+
* Maintained for backwards compatibility.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import type { CommandResult } from "../command-result.js";
|
|
9
|
+
/**
|
|
10
|
+
* Options for the stats command.
|
|
11
|
+
*/
|
|
12
|
+
export interface StatsCommandOptions {
|
|
13
|
+
/** Output as JSON */
|
|
14
|
+
json?: boolean;
|
|
15
|
+
/** Show detailed output with timing */
|
|
16
|
+
verbose?: boolean;
|
|
17
|
+
/** Minimal output */
|
|
18
|
+
quiet?: boolean;
|
|
19
|
+
/** Number of projects to show in breakdown */
|
|
20
|
+
projects?: string;
|
|
21
|
+
/** Output format */
|
|
22
|
+
format?: "brief" | "ai" | "default";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Runtime dependencies for executeStatsCommand.
|
|
26
|
+
*/
|
|
27
|
+
export interface StatsCommandDeps {
|
|
28
|
+
/** Database path. Defaults to getDefaultDbPath(). */
|
|
29
|
+
dbPath?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create the stats command for Commander.js.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createStatsCommand(): Command;
|
|
35
|
+
/**
|
|
36
|
+
* Execute the stats command programmatically by wrapping executeStatusCommand.
|
|
37
|
+
*/
|
|
38
|
+
export declare function executeStatsCommand(options: StatsCommandOptions, deps?: StatsCommandDeps): Promise<CommandResult>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status Command Handler
|
|
3
|
+
*
|
|
4
|
+
* CLI command for displaying hook installation status, configuration, health diagnostics,
|
|
5
|
+
* and database statistics. Unifies status, doctor, and stats commands per Phase 32.5.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import type { CommandResult } from "../command-result.js";
|
|
9
|
+
import { type HookStatus, type MemoryConfig } from "../../../infrastructure/hooks/index.js";
|
|
10
|
+
import { type HealthCheckResult } from "../../../infrastructure/database/index.js";
|
|
11
|
+
import { type MigrationStatusResult } from "../../../infrastructure/migration.js";
|
|
12
|
+
import type { QmdHealthInfo } from "../../../domain/ports/index.js";
|
|
13
|
+
import { type ExtendedStatsResult } from "../formatters/stats-formatter.js";
|
|
14
|
+
/**
|
|
15
|
+
* Options for the status command.
|
|
16
|
+
*/
|
|
17
|
+
export interface StatusOptions {
|
|
18
|
+
/** Output as JSON */
|
|
19
|
+
json?: boolean | undefined;
|
|
20
|
+
/** Output Database Health Section */
|
|
21
|
+
db?: boolean | undefined;
|
|
22
|
+
/** Output Hooks Section */
|
|
23
|
+
hooks?: boolean | undefined;
|
|
24
|
+
/** Output Embedding Section */
|
|
25
|
+
embedding?: boolean | undefined;
|
|
26
|
+
/** Output Configuration Section */
|
|
27
|
+
config?: boolean | undefined;
|
|
28
|
+
/** Output Statistics Section */
|
|
29
|
+
stats?: boolean | undefined;
|
|
30
|
+
/** Output all sections */
|
|
31
|
+
all?: boolean | undefined;
|
|
32
|
+
/** Attempt to fix common issues automatically */
|
|
33
|
+
fix?: boolean | undefined;
|
|
34
|
+
/** Number of projects to show in breakdown */
|
|
35
|
+
projects?: string | undefined;
|
|
36
|
+
/** Output format for stats */
|
|
37
|
+
format?: "brief" | "ai" | "default" | undefined;
|
|
38
|
+
/** Verbose option for stats */
|
|
39
|
+
verbose?: boolean | undefined;
|
|
40
|
+
/** Quiet option for stats */
|
|
41
|
+
quiet?: boolean | undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Runtime dependencies for executeStatusCommand.
|
|
45
|
+
*/
|
|
46
|
+
export interface StatusCommandDeps {
|
|
47
|
+
/** Database path. Defaults to getDefaultDbPath(). */
|
|
48
|
+
dbPath?: string | undefined;
|
|
49
|
+
/** Sync log file path. Defaults to XDG-resolved sync.log. */
|
|
50
|
+
logPath?: string | undefined;
|
|
51
|
+
/** Config file path. Defaults to XDG-resolved config.json. */
|
|
52
|
+
configPath?: string | undefined;
|
|
53
|
+
/** Hook-related path overrides */
|
|
54
|
+
hookOverrides?: import("../../../infrastructure/hooks/settings-manager.js").PathOverrides | undefined;
|
|
55
|
+
/** Status gatherer seam for tests and alternate hosts. Defaults to gatherStatus(). */
|
|
56
|
+
gatherStatus?: ((options: GatherStatusOptions) => Promise<StatusInfo>) | undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Embedding background process status.
|
|
60
|
+
*/
|
|
61
|
+
export interface EmbeddingStatus {
|
|
62
|
+
/** Whether a background embedding process is currently running */
|
|
63
|
+
active: boolean;
|
|
64
|
+
/** PID of the background embedding process */
|
|
65
|
+
pid?: number;
|
|
66
|
+
/** ISO timestamp when the background process started */
|
|
67
|
+
startedAt?: string;
|
|
68
|
+
/** Number of messages that have been embedded so far */
|
|
69
|
+
embeddedCount?: number;
|
|
70
|
+
/** Total number of messages in the database */
|
|
71
|
+
totalMessages?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Aggregated status information.
|
|
75
|
+
*/
|
|
76
|
+
export interface StatusInfo {
|
|
77
|
+
/** Hook installation status */
|
|
78
|
+
hooks: HookStatus;
|
|
79
|
+
/** Current configuration */
|
|
80
|
+
config: MemoryConfig;
|
|
81
|
+
/** ISO timestamp of the last sync, or null if never synced */
|
|
82
|
+
lastSync: string | null;
|
|
83
|
+
/** Number of sessions pending sync */
|
|
84
|
+
pendingSessions: number;
|
|
85
|
+
/** Number of recent log entries */
|
|
86
|
+
recentLogs: number;
|
|
87
|
+
/** Background embedding process status */
|
|
88
|
+
embedding: EmbeddingStatus;
|
|
89
|
+
/** Comprehensive health check results */
|
|
90
|
+
health: HealthCheckResult;
|
|
91
|
+
/** Database statistics (if DB exists) */
|
|
92
|
+
stats?: ExtendedStatsResult | undefined;
|
|
93
|
+
/** Legacy migration status */
|
|
94
|
+
migration: MigrationStatusResult;
|
|
95
|
+
/** External qmd tool availability status */
|
|
96
|
+
qmd: QmdHealthInfo;
|
|
97
|
+
/** List of automatic fixes applied */
|
|
98
|
+
fixes: string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Options for gathering status.
|
|
102
|
+
*/
|
|
103
|
+
export interface GatherStatusOptions {
|
|
104
|
+
/** Override database path for testing */
|
|
105
|
+
dbPath?: string | undefined;
|
|
106
|
+
/** Override log file path for testing */
|
|
107
|
+
logPath?: string | undefined;
|
|
108
|
+
/** Override config file path for testing */
|
|
109
|
+
configPath?: string | undefined;
|
|
110
|
+
/** Hook-related path overrides */
|
|
111
|
+
hookOverrides?: import("../../../infrastructure/hooks/settings-manager.js").PathOverrides | undefined;
|
|
112
|
+
/** Attempt to fix common issues automatically */
|
|
113
|
+
fix?: boolean | undefined;
|
|
114
|
+
/** Number of projects in breakdown */
|
|
115
|
+
projects?: number | undefined;
|
|
116
|
+
/** Whether stats are requested */
|
|
117
|
+
stats?: boolean | undefined;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Create the status command for Commander.js.
|
|
121
|
+
*
|
|
122
|
+
* @returns Configured Command instance
|
|
123
|
+
*/
|
|
124
|
+
export declare function createStatusCommand(): Command;
|
|
125
|
+
/**
|
|
126
|
+
* Gather all status information exactly once.
|
|
127
|
+
*
|
|
128
|
+
* @param options Optional configuration including database and log paths
|
|
129
|
+
* @returns Aggregated status information
|
|
130
|
+
*/
|
|
131
|
+
export declare function gatherStatus(options?: GatherStatusOptions): Promise<StatusInfo>;
|
|
132
|
+
/**
|
|
133
|
+
* Execute the status command programmatically.
|
|
134
|
+
*/
|
|
135
|
+
export declare function executeStatusCommand(options: StatusOptions, deps?: StatusCommandDeps): Promise<CommandResult>;
|
|
136
|
+
/**
|
|
137
|
+
* Attempt automatic fixes for common issues.
|
|
138
|
+
*/
|
|
139
|
+
export declare function attemptFixes(result: HealthCheckResult, useColor: boolean): string[];
|
|
140
|
+
/**
|
|
141
|
+
* Format and display status output to console.
|
|
142
|
+
*
|
|
143
|
+
* @param status Status information to display
|
|
144
|
+
*/
|
|
145
|
+
export declare function formatStatusOutput(status: StatusInfo): void;
|
|
146
|
+
/**
|
|
147
|
+
* Format an ISO timestamp as a human-readable relative time.
|
|
148
|
+
*
|
|
149
|
+
* @param isoTimestamp ISO 8601 timestamp string
|
|
150
|
+
* @returns Relative time string (e.g., "5 min ago", "2h ago")
|
|
151
|
+
*/
|
|
152
|
+
export declare function formatTimeAgo(isoTimestamp: string): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Ambient Context
|
|
3
|
+
*
|
|
4
|
+
* Generates ambient context files for the current project after
|
|
5
|
+
* memory file sync. Writes context.md and updates MEMORY.md in the
|
|
6
|
+
* current project's Claude Code auto memory directory.
|
|
7
|
+
*/
|
|
8
|
+
import type { initializeDatabase } from "../../../../infrastructure/database/index.js";
|
|
9
|
+
import type { SyncCommandOptions, AmbientContextDeps } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Generate ambient context files for the current project.
|
|
12
|
+
*
|
|
13
|
+
* Runs after memory file sync. Writes context.md and updates MEMORY.md
|
|
14
|
+
* in the current project's Claude Code auto memory directory.
|
|
15
|
+
*
|
|
16
|
+
* Failure is non-fatal: logs error and continues sync.
|
|
17
|
+
*
|
|
18
|
+
* @param db Database connection
|
|
19
|
+
* @param options Sync command options
|
|
20
|
+
* @param deps Optional dependency overrides for testing
|
|
21
|
+
*/
|
|
22
|
+
export declare function runAmbientContextGeneration(db: ReturnType<typeof initializeDatabase>["db"], options: SyncCommandOptions, deps?: AmbientContextDeps): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Background Mode
|
|
3
|
+
*
|
|
4
|
+
* Handles --background flag for embedding generation.
|
|
5
|
+
* Spawns a detached background process to run embedding asynchronously.
|
|
6
|
+
*/
|
|
7
|
+
import type { CommandResult } from "../../command-result.js";
|
|
8
|
+
import type { SyncCommandOptions, BackgroundModeDeps } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Handle --background mode for embedding.
|
|
11
|
+
*
|
|
12
|
+
* Checks that --embed is also set, then spawns a detached background
|
|
13
|
+
* process to run embedding asynchronously. Returns immediately with
|
|
14
|
+
* a status message including the PID.
|
|
15
|
+
*
|
|
16
|
+
* Accepts optional dependency overrides for testing (avoid spawning
|
|
17
|
+
* real child processes in tests).
|
|
18
|
+
*
|
|
19
|
+
* @param options Sync command options
|
|
20
|
+
* @param deps Optional dependency overrides (testing support)
|
|
21
|
+
* @returns Command result with exit code
|
|
22
|
+
*/
|
|
23
|
+
export declare function handleBackgroundMode(options: SyncCommandOptions, deps?: BackgroundModeDeps): Promise<CommandResult>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Embedding Pass
|
|
3
|
+
*
|
|
4
|
+
* Handles embedding generation after sync completes.
|
|
5
|
+
* Lazy-loads embedding infrastructure to avoid ONNX runtime overhead
|
|
6
|
+
* when --embed is not used.
|
|
7
|
+
*/
|
|
8
|
+
import type { initializeDatabase } from "../../../../infrastructure/database/index.js";
|
|
9
|
+
import type { ModelState } from "../../../../application/services/index.js";
|
|
10
|
+
import type { SyncCommandOptions, EmbeddingPassDeps } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Run the embedding pass after sync completes.
|
|
13
|
+
*
|
|
14
|
+
* Lazy-loads embedding infrastructure to avoid ONNX runtime overhead
|
|
15
|
+
* when --embed is not used. All embedding modules are dynamically imported.
|
|
16
|
+
*
|
|
17
|
+
* @param db Database connection
|
|
18
|
+
* @param options Sync command options
|
|
19
|
+
* @param deps Optional dependency overrides for testing
|
|
20
|
+
*/
|
|
21
|
+
export declare function runEmbeddingPass(db: ReturnType<typeof initializeDatabase>["db"], options: SyncCommandOptions, deps?: EmbeddingPassDeps): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Handle model change detection with user confirmation.
|
|
24
|
+
*
|
|
25
|
+
* Uses human-readable model names from ModelState for prompts.
|
|
26
|
+
* Auto-confirms with --force, skips in non-interactive mode.
|
|
27
|
+
*
|
|
28
|
+
* @param modelState Model state comparison result
|
|
29
|
+
* @param options Sync command options
|
|
30
|
+
* @returns true if embedding should proceed, false to skip
|
|
31
|
+
*/
|
|
32
|
+
export declare function handleModelChange(modelState: ModelState, options: SyncCommandOptions): Promise<boolean>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Command Helpers
|
|
3
|
+
*
|
|
4
|
+
* Shared utility functions for dry-run, error handling, result reporting,
|
|
5
|
+
* and lazy-loading infrastructure dependencies.
|
|
6
|
+
*/
|
|
7
|
+
import type { SyncCommandOptions } from "./types.js";
|
|
8
|
+
import type { CommandResult } from "../../command-result.js";
|
|
9
|
+
import type { SyncResult } from "../../../../application/services/index.js";
|
|
10
|
+
import { initializeDatabase } from "../../../../infrastructure/database/index.js";
|
|
11
|
+
import { ProjectNameResolver } from "../../../../infrastructure/sources/index.js";
|
|
12
|
+
/** Load embedding provider factory via dynamic import. */
|
|
13
|
+
export declare function loadFactory(): Promise<import("../../../../infrastructure/embedding/embedding-provider-factory.js").EmbeddingProviderFactory>;
|
|
14
|
+
/** Load memory config via dynamic import. */
|
|
15
|
+
export declare function loadConfig(): Promise<import("../../../../infrastructure/index.js").MemoryConfig>;
|
|
16
|
+
/** Load embedding repository via dynamic import. */
|
|
17
|
+
export declare function loadRepository(db: ReturnType<typeof initializeDatabase>["db"]): Promise<import("../../../../infrastructure/index.js").EmbeddingRepository>;
|
|
18
|
+
/** Execute dry-run mode: show what would be synced without syncing. */
|
|
19
|
+
export declare function executeDryRun(options: SyncCommandOptions): Promise<CommandResult>;
|
|
20
|
+
/** Handle error with appropriate formatting. */
|
|
21
|
+
export declare function handleError(error: unknown, options: SyncCommandOptions): void;
|
|
22
|
+
/** Report sync results to console. */
|
|
23
|
+
export declare function reportResults(result: SyncResult, startTime: number, options: SyncCommandOptions): void;
|
|
24
|
+
/** Create a ProjectNameResolver rooted at the system drive. */
|
|
25
|
+
export declare function createDriveResolver(): ProjectNameResolver;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Command
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates session extraction, memory file sync, ambient context,
|
|
5
|
+
* and optional embedding generation.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import type { CommandResult } from "../../command-result.js";
|
|
9
|
+
import type { SyncCommandDeps, SyncCommandOptions } from "./types.js";
|
|
10
|
+
/** Create the sync command for Commander.js. */
|
|
11
|
+
export declare function createSyncCommand(): Command;
|
|
12
|
+
/** Execute the sync command programmatically. */
|
|
13
|
+
export declare function executeSyncCommand(options: SyncCommandOptions, deps?: SyncCommandDeps): Promise<CommandResult>;
|
|
14
|
+
export type { SyncCommandOptions, EmbeddingPassDeps, BackgroundModeDeps, AmbientContextDeps } from "./types.js";
|
|
15
|
+
export { runEmbeddingPass, handleModelChange } from "./embedding-pass.js";
|
|
16
|
+
export { handleBackgroundMode } from "./background.js";
|
|
17
|
+
export { runAmbientContextGeneration } from "./ambient.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Memory Files
|
|
3
|
+
*
|
|
4
|
+
* Discovers and indexes legacy markdown memory files after session extraction.
|
|
5
|
+
*/
|
|
6
|
+
import type { initializeDatabase } from "../../../../infrastructure/database/index.js";
|
|
7
|
+
import type { MemoryFileSyncResult } from "../../../../application/services/index.js";
|
|
8
|
+
import type { SyncCommandOptions } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Run memory file sync: discover and index legacy markdown memory files.
|
|
11
|
+
*
|
|
12
|
+
* Runs after session extraction. Returns null if no memory files
|
|
13
|
+
* were processed (for example, the legacy memory-file root does not exist).
|
|
14
|
+
*
|
|
15
|
+
* @param db Database connection
|
|
16
|
+
* @param options Sync command options
|
|
17
|
+
* @returns Sync result, or null if nothing to report
|
|
18
|
+
*/
|
|
19
|
+
export declare function runMemoryFileSync(db: ReturnType<typeof initializeDatabase>["db"], options: SyncCommandOptions): Promise<MemoryFileSyncResult | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Report memory file sync results to console.
|
|
22
|
+
*
|
|
23
|
+
* @param result Memory file sync result
|
|
24
|
+
* @param options Command options
|
|
25
|
+
*/
|
|
26
|
+
export declare function reportMemoryFileResults(result: MemoryFileSyncResult, options: SyncCommandOptions): void;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Command Types
|
|
3
|
+
*
|
|
4
|
+
* Shared interfaces for the sync command modules.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Options for the sync command.
|
|
8
|
+
*/
|
|
9
|
+
export interface SyncCommandOptions {
|
|
10
|
+
/** Force re-sync of all sessions, ignoring extraction state */
|
|
11
|
+
force?: boolean;
|
|
12
|
+
/** Filter to sessions from a specific project */
|
|
13
|
+
project?: string;
|
|
14
|
+
/** Filter to a specific session by ID */
|
|
15
|
+
session?: string;
|
|
16
|
+
/** Suppress non-essential output */
|
|
17
|
+
quiet?: boolean;
|
|
18
|
+
/** Show detailed output with timing information */
|
|
19
|
+
verbose?: boolean;
|
|
20
|
+
/** Output results as JSON */
|
|
21
|
+
json?: boolean;
|
|
22
|
+
/** Preview sync without modifying the database */
|
|
23
|
+
dryRun?: boolean;
|
|
24
|
+
/** Fix project names using the resolver */
|
|
25
|
+
fixNames?: boolean;
|
|
26
|
+
/** Generate embeddings for synced messages */
|
|
27
|
+
embed?: boolean;
|
|
28
|
+
/** Run embedding generation in a background process */
|
|
29
|
+
background?: boolean;
|
|
30
|
+
/** Explicitly index legacy ~/.memory / MEMORY_HOME markdown files */
|
|
31
|
+
includeMemoryFiles?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface RemoteSyncer {
|
|
34
|
+
sync(machineId: string, remoteUrl: string, autoPull?: boolean, autoPush?: boolean): Promise<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
rebuildNeeded: boolean;
|
|
37
|
+
error?: string;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Dependency overrides for executeSyncCommand.
|
|
42
|
+
*
|
|
43
|
+
* Keep user options separate from operational dependencies. This is the
|
|
44
|
+
* canonical test-isolation seam for command orchestration.
|
|
45
|
+
*/
|
|
46
|
+
export interface SyncCommandDeps {
|
|
47
|
+
/** Override background-mode handling */
|
|
48
|
+
handleBackgroundMode?: (options: SyncCommandOptions) => Promise<import("../../command-result.js").CommandResult>;
|
|
49
|
+
/** Override process signal setup */
|
|
50
|
+
setupSignalHandlers?: () => void;
|
|
51
|
+
/** Override checkpoint presence check */
|
|
52
|
+
hasCheckpoint?: () => boolean;
|
|
53
|
+
/** Override checkpoint loading */
|
|
54
|
+
loadCheckpoint?: () => {
|
|
55
|
+
completedSessions: number;
|
|
56
|
+
totalSessions: number;
|
|
57
|
+
} | null;
|
|
58
|
+
/** Override progress reporter construction */
|
|
59
|
+
createProgressReporter?: (options: SyncCommandOptions) => {
|
|
60
|
+
log(message: string): void;
|
|
61
|
+
start(total: number): void;
|
|
62
|
+
update(current: number, sessionId?: string): void;
|
|
63
|
+
stop(): void;
|
|
64
|
+
};
|
|
65
|
+
/** Override database path resolution */
|
|
66
|
+
getDefaultDbPath?: () => string;
|
|
67
|
+
/** Override dry-run execution */
|
|
68
|
+
executeDryRun?: typeof import("./helpers.js").executeDryRun;
|
|
69
|
+
/** Override error handling */
|
|
70
|
+
handleError?: typeof import("./helpers.js").handleError;
|
|
71
|
+
/** Override text/JSON result reporting */
|
|
72
|
+
reportResults?: typeof import("./helpers.js").reportResults;
|
|
73
|
+
/** Override drive resolver creation */
|
|
74
|
+
createDriveResolver?: typeof import("./helpers.js").createDriveResolver;
|
|
75
|
+
/** Override database initialization */
|
|
76
|
+
initializeDatabase?: typeof import("../../../../infrastructure/database/index.js").initializeDatabase;
|
|
77
|
+
/** Override database close */
|
|
78
|
+
closeDatabase?: typeof import("../../../../infrastructure/database/index.js").closeDatabase;
|
|
79
|
+
/** Override bulk checkpoint flush */
|
|
80
|
+
bulkOperationCheckpoint?: typeof import("../../../../infrastructure/database/index.js").bulkOperationCheckpoint;
|
|
81
|
+
/** Override cleanup registration */
|
|
82
|
+
registerCleanup?: typeof import("../../../../infrastructure/signals/index.js").registerCleanup;
|
|
83
|
+
/** Override cleanup unregistration */
|
|
84
|
+
unregisterCleanup?: typeof import("../../../../infrastructure/signals/index.js").unregisterCleanup;
|
|
85
|
+
/** Override sync service construction */
|
|
86
|
+
createSyncService?: (deps: {
|
|
87
|
+
db: import("bun:sqlite").Database;
|
|
88
|
+
resolver: unknown;
|
|
89
|
+
}) => {
|
|
90
|
+
fixProjectNames: (resolver: unknown) => Promise<number>;
|
|
91
|
+
sync: (options: import("../../../../application/services/index.js").SyncOptions) => Promise<import("../../../../application/services/index.js").SyncResult>;
|
|
92
|
+
};
|
|
93
|
+
/** Override config loading */
|
|
94
|
+
loadConfig?: () => import("../../../../infrastructure/hooks/config-manager.js").MemoryConfig;
|
|
95
|
+
/** Override remote syncer construction */
|
|
96
|
+
createGitSyncer?: () => RemoteSyncer | Promise<RemoteSyncer>;
|
|
97
|
+
/** Override projection rebuild after remote pulls */
|
|
98
|
+
rebuildProjections?: (db: import("bun:sqlite").Database) => Promise<void>;
|
|
99
|
+
/** Explicitly enable the unfinished Phase 38 remote-sync prototype */
|
|
100
|
+
experimentalRemoteSync?: boolean;
|
|
101
|
+
/** Override memory file sync */
|
|
102
|
+
runMemoryFileSync?: typeof import("./memory-files.js").runMemoryFileSync;
|
|
103
|
+
/** Override memory file sync reporting */
|
|
104
|
+
reportMemoryFileResults?: typeof import("./memory-files.js").reportMemoryFileResults;
|
|
105
|
+
/** Override ambient context generation */
|
|
106
|
+
runAmbientContextGeneration?: typeof import("./ambient.js").runAmbientContextGeneration;
|
|
107
|
+
/** Override embedding pass */
|
|
108
|
+
runEmbeddingPass?: typeof import("./embedding-pass.js").runEmbeddingPass;
|
|
109
|
+
/** Override background embedding lock removal */
|
|
110
|
+
removeBackgroundLock?: () => void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Dependency overrides for runEmbeddingPass (testing support).
|
|
114
|
+
*
|
|
115
|
+
* When not provided, real dependencies are loaded via dynamic import.
|
|
116
|
+
*/
|
|
117
|
+
export interface EmbeddingPassDeps {
|
|
118
|
+
/** Override embedding provider factory (avoids loading real ONNX runtime) */
|
|
119
|
+
factory?: import("../../../../infrastructure/embedding/embedding-provider-factory.js").EmbeddingProviderFactory;
|
|
120
|
+
/** Override configuration (avoids reading config file) */
|
|
121
|
+
config?: import("../../../../infrastructure/hooks/config-manager.js").MemoryConfig;
|
|
122
|
+
/** Override embedding repository (avoids real database operations) */
|
|
123
|
+
repositoryOverride?: import("../../../../infrastructure/database/repositories/embedding-repository.js").EmbeddingRepository;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Dependency overrides for handleBackgroundMode (testing support).
|
|
127
|
+
*
|
|
128
|
+
* Allows injection of background-embedder functions for unit testing
|
|
129
|
+
* without spawning real child processes.
|
|
130
|
+
*/
|
|
131
|
+
export interface BackgroundModeDeps {
|
|
132
|
+
/** Override background process spawning */
|
|
133
|
+
spawnBackgroundEmbedding: (options?: any) => import("../../../../infrastructure/embedding/background-embedder.js").SpawnResult;
|
|
134
|
+
/** Override lock file reading */
|
|
135
|
+
readLock: (dataDir?: string) => import("../../../../infrastructure/embedding/background-embedder.js").LockData | null;
|
|
136
|
+
/** Override process liveness check */
|
|
137
|
+
isProcessAlive: (pid: number) => boolean;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Dependency overrides for runAmbientContextGeneration (testing support).
|
|
141
|
+
*
|
|
142
|
+
* When not provided, real dependencies are loaded via dynamic import.
|
|
143
|
+
*/
|
|
144
|
+
export interface AmbientContextDeps {
|
|
145
|
+
/** Override config loading */
|
|
146
|
+
loadConfig: () => {
|
|
147
|
+
ambientContext: {
|
|
148
|
+
enabled: boolean;
|
|
149
|
+
budget: number;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
/** Override auto memory directory resolution */
|
|
153
|
+
resolveAutoMemoryDir: () => string;
|
|
154
|
+
/** Override project name resolution */
|
|
155
|
+
resolveProjectName: () => string;
|
|
156
|
+
/** Override ambient service creation */
|
|
157
|
+
createAmbientService: () => {
|
|
158
|
+
generateAmbientContext: (opts: any) => Promise<{
|
|
159
|
+
success: boolean;
|
|
160
|
+
contextTokens?: number;
|
|
161
|
+
}>;
|
|
162
|
+
};
|
|
163
|
+
}
|