@chude/memory 4.0.0 → 4.0.1
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 +58 -11
- package/dist/application/services/embedding-service.d.ts +8 -1
- package/dist/application/services/friction-service.d.ts +18 -2
- package/dist/application/services/index.d.ts +11 -1
- package/dist/application/services/memory-governance-service.d.ts +65 -0
- package/dist/application/services/memory-ranking-service.d.ts +65 -0
- package/dist/application/services/persona-profile-service.d.ts +29 -0
- package/dist/application/services/projection-registry.d.ts +18 -0
- package/dist/application/services/remote-event-sync-service.d.ts +76 -0
- package/dist/application/services/smart-context-service.d.ts +34 -1
- package/dist/application/services/temporal-graph-service.d.ts +30 -0
- package/dist/domain/entities/graph-edge.d.ts +87 -0
- package/dist/domain/entities/index.d.ts +5 -0
- package/dist/domain/entities/memory-event.d.ts +101 -0
- package/dist/domain/entities/memory-governance.d.ts +100 -0
- package/dist/domain/entities/memory-utility-metric.d.ts +65 -0
- package/dist/domain/entities/persona-entry.d.ts +67 -0
- package/dist/domain/ports/capability.d.ts +35 -0
- package/dist/domain/ports/embedding.d.ts +21 -0
- package/dist/domain/ports/index.d.ts +1 -0
- package/dist/domain/ports/redactor.d.ts +3 -0
- package/dist/domain/ports/repositories.d.ts +155 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +774 -328
- package/dist/infrastructure/capabilities/capability-status.d.ts +10 -0
- package/dist/infrastructure/capabilities/index.d.ts +1 -0
- package/dist/infrastructure/database/event-log.d.ts +40 -8
- package/dist/infrastructure/database/health-checker.d.ts +22 -1
- package/dist/infrastructure/database/index.d.ts +3 -3
- package/dist/infrastructure/database/repositories/embedding-repository.d.ts +18 -4
- package/dist/infrastructure/database/repositories/friction-repository.d.ts +2 -1
- package/dist/infrastructure/database/repositories/graph-repository.d.ts +17 -0
- package/dist/infrastructure/database/repositories/index.d.ts +4 -0
- package/dist/infrastructure/database/repositories/memory-governance-repository.d.ts +21 -0
- package/dist/infrastructure/database/repositories/memory-utility-repository.d.ts +15 -0
- package/dist/infrastructure/database/repositories/persona-repository.d.ts +16 -0
- package/dist/infrastructure/database/schema.d.ts +40 -0
- package/dist/infrastructure/embedding/embedding-provider-factory.d.ts +3 -2
- package/dist/infrastructure/embedding/ollama-provider.d.ts +1 -0
- package/dist/infrastructure/hooks/config-manager.d.ts +17 -0
- package/dist/infrastructure/providers/provider-egress-policy.d.ts +21 -0
- package/dist/infrastructure/providers/provider-registry.d.ts +8 -4
- package/dist/infrastructure/remote/git-remote-event-transport.d.ts +40 -0
- package/dist/infrastructure/security/pattern-redactor.d.ts +3 -0
- package/dist/infrastructure/security/secret-audit-service.d.ts +57 -0
- package/dist/presentation/cli/commands/audit-secrets.d.ts +54 -0
- package/dist/presentation/cli/commands/friction/types.d.ts +13 -0
- package/dist/presentation/cli/commands/governance.d.ts +27 -0
- package/dist/presentation/cli/commands/index.d.ts +6 -0
- package/dist/presentation/cli/commands/profile.d.ts +23 -0
- package/dist/presentation/cli/commands/remote.d.ts +21 -3
- package/dist/presentation/cli/commands/sync/ambient.d.ts +7 -0
- package/dist/presentation/cli/commands/sync/types.d.ts +8 -12
- package/dist/presentation/cli/formatters/envelope.d.ts +2 -2
- package/dist/presentation/cli/index.js +918 -351
- package/package.json +9 -6
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret Audit Command
|
|
3
|
+
*
|
|
4
|
+
* Scans durable memory surfaces for likely secrets. Read-only by default;
|
|
5
|
+
* database redaction and event-log quarantine require explicit flags.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import type { Database } from "bun:sqlite";
|
|
9
|
+
import type { CommandResult } from "../command-result.js";
|
|
10
|
+
import { SecretAuditService } from "../../../infrastructure/security/secret-audit-service.js";
|
|
11
|
+
import type { IRedactor } from "../../../domain/ports/redactor.js";
|
|
12
|
+
export interface AuditSecretsOptions {
|
|
13
|
+
/** Output as JSON */
|
|
14
|
+
json?: boolean | undefined;
|
|
15
|
+
/** Database path override */
|
|
16
|
+
db?: string | undefined;
|
|
17
|
+
/** Skip database scanning */
|
|
18
|
+
skipDb?: boolean | undefined;
|
|
19
|
+
/** Explicit event log path(s) to scan */
|
|
20
|
+
eventLog?: string[] | undefined;
|
|
21
|
+
/** Events directory override */
|
|
22
|
+
eventsDir?: string | undefined;
|
|
23
|
+
/** Skip event-log scanning */
|
|
24
|
+
skipEvents?: boolean | undefined;
|
|
25
|
+
/** Redact mutable database fields in-place */
|
|
26
|
+
redactDb?: boolean | undefined;
|
|
27
|
+
/** Quarantine raw event logs and write sanitized active copies */
|
|
28
|
+
quarantineEvents?: boolean | undefined;
|
|
29
|
+
/** Event-log quarantine directory override */
|
|
30
|
+
quarantineDir?: string | undefined;
|
|
31
|
+
/** Write a redacted evidence report */
|
|
32
|
+
report?: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
export interface AuditSecretsCommandDeps {
|
|
35
|
+
getDefaultDbPath?: (() => string) | undefined;
|
|
36
|
+
databaseExists?: ((path: string) => boolean) | undefined;
|
|
37
|
+
initializeDatabase?: ((config: {
|
|
38
|
+
path: string;
|
|
39
|
+
create: boolean;
|
|
40
|
+
applySchema: boolean;
|
|
41
|
+
walMode: boolean;
|
|
42
|
+
quickCheck: boolean;
|
|
43
|
+
}) => {
|
|
44
|
+
db: Database;
|
|
45
|
+
}) | undefined;
|
|
46
|
+
closeDatabase?: ((db: Database) => void) | undefined;
|
|
47
|
+
getAllLogFiles?: ((eventsDir?: string) => string[]) | undefined;
|
|
48
|
+
createService?: ((redactor: IRedactor) => Pick<SecretAuditService, "audit">) | undefined;
|
|
49
|
+
redactor?: IRedactor | undefined;
|
|
50
|
+
writeFile?: ((path: string, content: string) => void) | undefined;
|
|
51
|
+
mkdir?: ((path: string) => void) | undefined;
|
|
52
|
+
}
|
|
53
|
+
export declare function createAuditSecretsCommand(): Command;
|
|
54
|
+
export declare function executeAuditSecretsCommand(options?: AuditSecretsOptions, deps?: AuditSecretsCommandDeps): Promise<CommandResult>;
|
|
@@ -43,8 +43,15 @@ export interface FrictionLogOptions extends FrictionCommandOptions {
|
|
|
43
43
|
export interface FrictionListOptions extends FrictionCommandOptions {
|
|
44
44
|
all?: boolean;
|
|
45
45
|
status?: string;
|
|
46
|
+
severity?: string;
|
|
46
47
|
category?: string;
|
|
47
48
|
tool?: string;
|
|
49
|
+
project?: string;
|
|
50
|
+
since?: string;
|
|
51
|
+
descriptionContains?: string;
|
|
52
|
+
contextContains?: string;
|
|
53
|
+
count?: boolean;
|
|
54
|
+
min?: string;
|
|
48
55
|
limit?: string;
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
@@ -80,6 +87,12 @@ export interface FrictionExecuteOptions {
|
|
|
80
87
|
limit?: string;
|
|
81
88
|
resolution?: string;
|
|
82
89
|
tool?: string;
|
|
90
|
+
project?: string;
|
|
91
|
+
since?: string;
|
|
92
|
+
descriptionContains?: string;
|
|
93
|
+
contextContains?: string;
|
|
94
|
+
count?: boolean;
|
|
95
|
+
min?: string;
|
|
83
96
|
html?: boolean;
|
|
84
97
|
dryRun?: boolean;
|
|
85
98
|
force?: boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance CLI command.
|
|
3
|
+
*
|
|
4
|
+
* Inspect and control derived memory provenance/consent state.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import type { CommandResult } from "../command-result.js";
|
|
8
|
+
import { type MemoryGovernanceSurface } from "../../../domain/entities/memory-governance.js";
|
|
9
|
+
export type GovernanceAction = "list" | "show" | "suppress" | "unsuppress" | "invalidate" | "expire" | "review" | "consent-grant" | "consent-revoke";
|
|
10
|
+
export interface GovernanceCommandOptions {
|
|
11
|
+
action: GovernanceAction;
|
|
12
|
+
surface?: MemoryGovernanceSurface | undefined;
|
|
13
|
+
targetId?: string | undefined;
|
|
14
|
+
project?: string | undefined;
|
|
15
|
+
status?: string | undefined;
|
|
16
|
+
reason?: string | undefined;
|
|
17
|
+
at?: string | undefined;
|
|
18
|
+
scope?: string[] | undefined;
|
|
19
|
+
json?: boolean | undefined;
|
|
20
|
+
limit?: number | undefined;
|
|
21
|
+
}
|
|
22
|
+
export interface GovernanceCommandDeps {
|
|
23
|
+
dbPath?: string | undefined;
|
|
24
|
+
writeEvents?: boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare function createGovernanceCommand(): Command;
|
|
27
|
+
export declare function executeGovernanceCommand(options: GovernanceCommandOptions, deps?: GovernanceCommandDeps): Promise<CommandResult>;
|
|
@@ -18,12 +18,15 @@ export { createInstallCommand, executeInstallCommand } from "./install.js";
|
|
|
18
18
|
export { createUninstallCommand, executeUninstallCommand } from "./uninstall.js";
|
|
19
19
|
export { createStatusCommand, executeStatusCommand } from "./status.js";
|
|
20
20
|
export { createDoctorCommand, executeDoctorCommand } from "./doctor.js";
|
|
21
|
+
export { createAuditSecretsCommand, executeAuditSecretsCommand } from "./audit-secrets.js";
|
|
21
22
|
export { createPurgeCommand, executePurgeCommand } from "./purge.js";
|
|
22
23
|
export { createMigrateCommand, executeMigrateCommand } from "./migrate.js";
|
|
23
24
|
export { createExportCommand, executeExportCommand } from "./export.js";
|
|
24
25
|
export { createImportCommand, executeImportCommand } from "./import.js";
|
|
25
26
|
export { createCompletionCommand, executeCompletionCommand } from "./completion.js";
|
|
26
27
|
export { createFrictionCommand, executeFrictionCommand } from "./friction/index.js";
|
|
28
|
+
export { createGovernanceCommand, executeGovernanceCommand } from "./governance.js";
|
|
29
|
+
export { createProfileCommand, executeProfileCommand } from "./profile.js";
|
|
27
30
|
export { createBackfillCommand, executeBackfillCommand } from "./backfill.js";
|
|
28
31
|
export { createExtractCommand, executeExtractCommand } from "./extract.js";
|
|
29
32
|
export { createFactsCommand, executeFactsCommand } from "./facts.js";
|
|
@@ -41,11 +44,14 @@ export type { BrowseCommandOptions } from "./browse.js";
|
|
|
41
44
|
export type { InstallOptions } from "./install.js";
|
|
42
45
|
export type { UninstallOptions } from "./uninstall.js";
|
|
43
46
|
export type { DoctorOptions } from "./doctor.js";
|
|
47
|
+
export type { AuditSecretsOptions } from "./audit-secrets.js";
|
|
44
48
|
export type { PurgeCommandOptions, PurgeResult } from "./purge.js";
|
|
45
49
|
export type { ExportOptions } from "./export.js";
|
|
46
50
|
export type { ImportOptions } from "./import.js";
|
|
47
51
|
export type { ShellType } from "./completion.js";
|
|
48
52
|
export type { StatusOptions, StatusInfo, EmbeddingStatus, GatherStatusOptions } from "./status.js";
|
|
49
53
|
export type { FrictionCommandOptions, FrictionLogOptions, FrictionListOptions, FrictionResolveOptions, FrictionExecuteOptions, } from "./friction/index.js";
|
|
54
|
+
export type { GovernanceAction, GovernanceCommandDeps, GovernanceCommandOptions, } from "./governance.js";
|
|
55
|
+
export type { ProfileAction, ProfileCommandDeps, ProfileCommandOptions, } from "./profile.js";
|
|
50
56
|
export type { BackfillCommandOptions, BackfillServiceDeps, } from "./backfill.js";
|
|
51
57
|
export type { MigrateCommandOptions } from "./migrate.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile CLI command.
|
|
3
|
+
*
|
|
4
|
+
* Exposes persona/procedural memory as a governed, explainable user surface.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import type { CommandResult } from "../command-result.js";
|
|
8
|
+
import { type PersonaEntryKind } from "../../../domain/entities/persona-entry.js";
|
|
9
|
+
export type ProfileAction = "show" | "export" | "rebuild";
|
|
10
|
+
export interface ProfileCommandOptions {
|
|
11
|
+
action: ProfileAction;
|
|
12
|
+
project?: string | undefined;
|
|
13
|
+
kind?: PersonaEntryKind | undefined;
|
|
14
|
+
limit?: number | undefined;
|
|
15
|
+
all?: boolean | undefined;
|
|
16
|
+
json?: boolean | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface ProfileCommandDeps {
|
|
19
|
+
dbPath?: string | undefined;
|
|
20
|
+
now?: (() => Date) | undefined;
|
|
21
|
+
}
|
|
22
|
+
export declare function createProfileCommand(): Command;
|
|
23
|
+
export declare function executeProfileCommand(options: ProfileCommandOptions, deps?: ProfileCommandDeps): Promise<CommandResult>;
|
|
@@ -14,9 +14,22 @@ import { GitSyncer } from "../../../infrastructure/hooks/git-syncer.js";
|
|
|
14
14
|
export interface RemoteCommandOptions {
|
|
15
15
|
configPathOverride?: string;
|
|
16
16
|
eventsDirOverride?: string;
|
|
17
|
+
backupDirOverride?: string;
|
|
17
18
|
loadConfig?: typeof loadConfig;
|
|
18
19
|
saveConfig?: typeof saveConfig;
|
|
19
20
|
createGitSyncer?: (eventsDir?: string) => Pick<GitSyncer, "isGitRepo" | "initRepo" | "configureRemote" | "removeRemote" | "getRemoteUrl">;
|
|
21
|
+
auditRemoteEventLogs?: () => Promise<{
|
|
22
|
+
eventLogFindings: number;
|
|
23
|
+
}>;
|
|
24
|
+
allowLocalPathRemote?: boolean;
|
|
25
|
+
now?: () => Date;
|
|
26
|
+
}
|
|
27
|
+
export interface RemoteCliOptions {
|
|
28
|
+
json?: boolean;
|
|
29
|
+
allowLocalPath?: boolean;
|
|
30
|
+
autoPull?: boolean;
|
|
31
|
+
autoPush?: boolean;
|
|
32
|
+
confirm?: boolean;
|
|
20
33
|
}
|
|
21
34
|
/**
|
|
22
35
|
* Create the remote command group for Commander.js.
|
|
@@ -25,12 +38,17 @@ export declare function createRemoteCommand(opts?: RemoteCommandOptions): Comman
|
|
|
25
38
|
/**
|
|
26
39
|
* Configure the remote sync repository.
|
|
27
40
|
*/
|
|
28
|
-
export declare function executeRemoteSetCommand(repositoryUrl: string, opts?: RemoteCommandOptions): Promise<CommandResult>;
|
|
41
|
+
export declare function executeRemoteSetCommand(repositoryUrl: string, opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
29
42
|
/**
|
|
30
43
|
* Remove remote sync configuration.
|
|
31
44
|
*/
|
|
32
|
-
export declare function executeRemoteRemoveCommand(opts?: RemoteCommandOptions): Promise<CommandResult>;
|
|
45
|
+
export declare function executeRemoteRemoveCommand(opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
33
46
|
/**
|
|
34
47
|
* Display current remote sync configurations and status.
|
|
35
48
|
*/
|
|
36
|
-
export declare function executeRemoteStatusCommand(opts?: RemoteCommandOptions): Promise<CommandResult>;
|
|
49
|
+
export declare function executeRemoteStatusCommand(opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
50
|
+
export declare function executeRemotePreflightCommand(repositoryUrl: string | undefined, opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
51
|
+
export declare function executeRemoteDoctorCommand(opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
52
|
+
export declare function executeRemoteBackupCommand(outputDir: string | undefined, opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
53
|
+
export declare function executeRemoteRestoreCommand(backupDir: string, opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
54
|
+
export declare function executeRemoteRollbackCommand(backupDir: string, opts?: RemoteCommandOptions, commandOptions?: RemoteCliOptions): Promise<CommandResult>;
|
|
@@ -20,3 +20,10 @@ import type { SyncCommandOptions, AmbientContextDeps } from "./types.js";
|
|
|
20
20
|
* @param deps Optional dependency overrides for testing
|
|
21
21
|
*/
|
|
22
22
|
export declare function runAmbientContextGeneration(db: ReturnType<typeof initializeDatabase>["db"], options: SyncCommandOptions, deps?: AmbientContextDeps): Promise<void>;
|
|
23
|
+
export declare function createDefaultAmbientService(db: ReturnType<typeof initializeDatabase>["db"]): Promise<{
|
|
24
|
+
generateAmbientContext: (opts: any) => Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
contextTokens?: number;
|
|
27
|
+
reason?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
@@ -29,13 +29,11 @@ export interface SyncCommandOptions {
|
|
|
29
29
|
background?: boolean;
|
|
30
30
|
/** Explicitly index legacy ~/.memory / MEMORY_HOME markdown files */
|
|
31
31
|
includeMemoryFiles?: boolean;
|
|
32
|
+
/** Explicitly synchronize canonical event logs with configured remote */
|
|
33
|
+
remote?: boolean;
|
|
32
34
|
}
|
|
33
|
-
export interface
|
|
34
|
-
sync(
|
|
35
|
-
success: boolean;
|
|
36
|
-
rebuildNeeded: boolean;
|
|
37
|
-
error?: string;
|
|
38
|
-
}>;
|
|
35
|
+
export interface RemoteEventSyncCommandService {
|
|
36
|
+
sync(request: import("../../../../application/services/index.js").RemoteEventSyncRequest): Promise<import("../../../../application/services/index.js").RemoteEventSyncResult>;
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* Dependency overrides for executeSyncCommand.
|
|
@@ -92,12 +90,10 @@ export interface SyncCommandDeps {
|
|
|
92
90
|
};
|
|
93
91
|
/** Override config loading */
|
|
94
92
|
loadConfig?: () => import("../../../../infrastructure/hooks/config-manager.js").MemoryConfig;
|
|
95
|
-
/** Override remote
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/** Explicitly enable the unfinished Phase 38 remote-sync prototype */
|
|
100
|
-
experimentalRemoteSync?: boolean;
|
|
93
|
+
/** Override remote event sync service construction */
|
|
94
|
+
createRemoteEventSyncService?: (deps: {
|
|
95
|
+
db: import("bun:sqlite").Database;
|
|
96
|
+
}) => RemoteEventSyncCommandService | Promise<RemoteEventSyncCommandService>;
|
|
101
97
|
/** Override memory file sync */
|
|
102
98
|
runMemoryFileSync?: typeof import("./memory-files.js").runMemoryFileSync;
|
|
103
99
|
/** Override memory file sync reporting */
|
|
@@ -27,7 +27,7 @@ export declare const ENVELOPE_SCHEMA_VERSION: "1";
|
|
|
27
27
|
* can use both the values (e.g. `QUERY_COMMAND_NAMES.includes(x)`) and the
|
|
28
28
|
* literal union type (`QueryCommandName`). Per Codex HIGH-1.
|
|
29
29
|
*/
|
|
30
|
-
export declare const QUERY_COMMAND_NAMES: readonly ["search", "context", "show", "list", "related", "stats", "query"];
|
|
30
|
+
export declare const QUERY_COMMAND_NAMES: readonly ["search", "context", "show", "list", "related", "stats", "query", "friction"];
|
|
31
31
|
/**
|
|
32
32
|
* Union of valid query command names, derived from QUERY_COMMAND_NAMES.
|
|
33
33
|
*/
|
|
@@ -37,7 +37,7 @@ export type QueryCommandName = (typeof QUERY_COMMAND_NAMES)[number];
|
|
|
37
37
|
* (HIGH-4) has a stable kind in the envelope. Phase 32.5 will route the
|
|
38
38
|
* unified query primitive's `--kind` flag through this same set.
|
|
39
39
|
*/
|
|
40
|
-
export declare const QUERY_RESULT_KINDS: readonly ["message", "session", "context", "related", "stats", "file"];
|
|
40
|
+
export declare const QUERY_RESULT_KINDS: readonly ["message", "session", "context", "related", "stats", "file", "friction"];
|
|
41
41
|
/**
|
|
42
42
|
* Union of valid query result kinds, derived from QUERY_RESULT_KINDS.
|
|
43
43
|
*/
|