dsh-daoing-memory 0.1.13 → 0.1.14
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 +91 -91
- package/README.zh-CN.md +91 -91
- package/lib/client.js +11348 -11348
- package/lib/index.js +4779 -4779
- package/lib/types/index.d.ts +74 -74
- package/lib/types/index.js +106 -106
- package/package.json +1 -1
package/lib/types/index.d.ts
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory library host plugin: the self-evolving memory layer (生·用·修·记 +
|
|
3
|
-
* diary/fact semantic memory). One process-global library shared by every
|
|
4
|
-
* session, backed by a local SQLite file. Registers `ctx.memory`
|
|
5
|
-
* (MemoryService). The monitoring UI is an independent left-sidebar nav group
|
|
6
|
-
* (browser half), not a workspace; this host half performs no workspace
|
|
7
|
-
* adoption.
|
|
8
|
-
* @module dsh-daoing-memory
|
|
9
|
-
*/
|
|
10
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
-
import { MemoryService } from './service.ts';
|
|
12
|
-
export type * from './types.ts';
|
|
13
|
-
export { MemoryCore, DEFAULT_CORE_CONFIG } from './core.ts';
|
|
14
|
-
export type { MemoryCoreConfig } from './core.ts';
|
|
15
|
-
export { MemoryService } from './service.ts';
|
|
16
|
-
export { MemoryStore, MEMORY_SCHEMA_VERSION } from './store.ts';
|
|
17
|
-
declare module '@deepseek-ai/cordis' {
|
|
18
|
-
interface Context {
|
|
19
|
-
/** The memory library service (self-evolving memory). */
|
|
20
|
-
memory: MemoryService;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/** Plugin config: every deployment-varying tunable lives here (cordis.yml). */
|
|
24
|
-
export interface Config {
|
|
25
|
-
/** SQLite database file path (default: $DSH_HOME/storages/memory.db). */
|
|
26
|
-
databasePath?: string;
|
|
27
|
-
/** Monitoring workspace folder (default: $DSH_HOME/memory-workbench). */
|
|
28
|
-
/** Library display folder shown in the workbench info payload (no workspace is adopted). */
|
|
29
|
-
workspacePath?: string;
|
|
30
|
-
/** Library display title shown in the workbench info payload. */
|
|
31
|
-
workspaceTitle?: string;
|
|
32
|
-
/** Diary entries that trigger one extraction run. */
|
|
33
|
-
diaryExtractEvery?: number;
|
|
34
|
-
/** Minimum hours between extraction runs. */
|
|
35
|
-
diaryExtractIntervalHours?: number;
|
|
36
|
-
/** Default recall candidate count. */
|
|
37
|
-
recallTopK?: number;
|
|
38
|
-
/** Injection budget in estimated tokens. */
|
|
39
|
-
injectionBudgetTokens?: number;
|
|
40
|
-
/** Consecutive experience-attributed failures that quarantine a live experience. */
|
|
41
|
-
challengeConsecutiveFails?: number;
|
|
42
|
-
/** Window size for the failure-rate challenge rule. */
|
|
43
|
-
challengeWindow?: number;
|
|
44
|
-
/** Failure rate within the window that challenges a live experience. */
|
|
45
|
-
challengeWindowFailRate?: number;
|
|
46
|
-
/** Live-revision cap per family tag (capacity budget). */
|
|
47
|
-
familyLiveCap?: number;
|
|
48
|
-
/** Complexity gate: token threshold. */
|
|
49
|
-
complexityTokenGate?: number;
|
|
50
|
-
/** Complexity gate: step threshold. */
|
|
51
|
-
complexityStepGate?: number;
|
|
52
|
-
/** Information-gain gate: overlap at/above this rejects a near-duplicate. */
|
|
53
|
-
duplicateOverlapGate?: number;
|
|
54
|
-
/** Minimum relevance score for injection. */
|
|
55
|
-
recallFloorScore?: number;
|
|
56
|
-
/** Shadow replay agreement required to adopt a draft. */
|
|
57
|
-
shadowPassRate?: number;
|
|
58
|
-
/** Minimum hours between deletion-feedback LLM summarization runs. */
|
|
59
|
-
deletionFeedbackIntervalHours?: number;
|
|
60
|
-
/** Minimum new deletions since last run to trigger summarization. */
|
|
61
|
-
deletionFeedbackMinDeletions?: number;
|
|
62
|
-
}
|
|
63
|
-
/** Resolve the plugin config with explicit defaults; unknown keys fail loud. */
|
|
64
|
-
export declare function resolveConfig(config: Config): Required<Omit<Config, 'databasePath' | 'workspacePath'>> & {
|
|
65
|
-
databasePath: string;
|
|
66
|
-
workspacePath: string;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Host plugin body: open the SQLite store, provide `ctx.memory`, and adopt
|
|
70
|
-
* the monitoring workspace directory once a workspace registry is available.
|
|
71
|
-
* @param ctx - host context.
|
|
72
|
-
* @param config - plugin config (see {@link Config}).
|
|
73
|
-
*/
|
|
74
|
-
export declare function apply(ctx: Context, config?: Config): void;
|
|
1
|
+
/**
|
|
2
|
+
* Memory library host plugin: the self-evolving memory layer (生·用·修·记 +
|
|
3
|
+
* diary/fact semantic memory). One process-global library shared by every
|
|
4
|
+
* session, backed by a local SQLite file. Registers `ctx.memory`
|
|
5
|
+
* (MemoryService). The monitoring UI is an independent left-sidebar nav group
|
|
6
|
+
* (browser half), not a workspace; this host half performs no workspace
|
|
7
|
+
* adoption.
|
|
8
|
+
* @module dsh-daoing-memory
|
|
9
|
+
*/
|
|
10
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
+
import { MemoryService } from './service.ts';
|
|
12
|
+
export type * from './types.ts';
|
|
13
|
+
export { MemoryCore, DEFAULT_CORE_CONFIG } from './core.ts';
|
|
14
|
+
export type { MemoryCoreConfig } from './core.ts';
|
|
15
|
+
export { MemoryService } from './service.ts';
|
|
16
|
+
export { MemoryStore, MEMORY_SCHEMA_VERSION } from './store.ts';
|
|
17
|
+
declare module '@deepseek-ai/cordis' {
|
|
18
|
+
interface Context {
|
|
19
|
+
/** The memory library service (self-evolving memory). */
|
|
20
|
+
memory: MemoryService;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Plugin config: every deployment-varying tunable lives here (cordis.yml). */
|
|
24
|
+
export interface Config {
|
|
25
|
+
/** SQLite database file path (default: $DSH_HOME/storages/memory.db). */
|
|
26
|
+
databasePath?: string;
|
|
27
|
+
/** Monitoring workspace folder (default: $DSH_HOME/memory-workbench). */
|
|
28
|
+
/** Library display folder shown in the workbench info payload (no workspace is adopted). */
|
|
29
|
+
workspacePath?: string;
|
|
30
|
+
/** Library display title shown in the workbench info payload. */
|
|
31
|
+
workspaceTitle?: string;
|
|
32
|
+
/** Diary entries that trigger one extraction run. */
|
|
33
|
+
diaryExtractEvery?: number;
|
|
34
|
+
/** Minimum hours between extraction runs. */
|
|
35
|
+
diaryExtractIntervalHours?: number;
|
|
36
|
+
/** Default recall candidate count. */
|
|
37
|
+
recallTopK?: number;
|
|
38
|
+
/** Injection budget in estimated tokens. */
|
|
39
|
+
injectionBudgetTokens?: number;
|
|
40
|
+
/** Consecutive experience-attributed failures that quarantine a live experience. */
|
|
41
|
+
challengeConsecutiveFails?: number;
|
|
42
|
+
/** Window size for the failure-rate challenge rule. */
|
|
43
|
+
challengeWindow?: number;
|
|
44
|
+
/** Failure rate within the window that challenges a live experience. */
|
|
45
|
+
challengeWindowFailRate?: number;
|
|
46
|
+
/** Live-revision cap per family tag (capacity budget). */
|
|
47
|
+
familyLiveCap?: number;
|
|
48
|
+
/** Complexity gate: token threshold. */
|
|
49
|
+
complexityTokenGate?: number;
|
|
50
|
+
/** Complexity gate: step threshold. */
|
|
51
|
+
complexityStepGate?: number;
|
|
52
|
+
/** Information-gain gate: overlap at/above this rejects a near-duplicate. */
|
|
53
|
+
duplicateOverlapGate?: number;
|
|
54
|
+
/** Minimum relevance score for injection. */
|
|
55
|
+
recallFloorScore?: number;
|
|
56
|
+
/** Shadow replay agreement required to adopt a draft. */
|
|
57
|
+
shadowPassRate?: number;
|
|
58
|
+
/** Minimum hours between deletion-feedback LLM summarization runs. */
|
|
59
|
+
deletionFeedbackIntervalHours?: number;
|
|
60
|
+
/** Minimum new deletions since last run to trigger summarization. */
|
|
61
|
+
deletionFeedbackMinDeletions?: number;
|
|
62
|
+
}
|
|
63
|
+
/** Resolve the plugin config with explicit defaults; unknown keys fail loud. */
|
|
64
|
+
export declare function resolveConfig(config: Config): Required<Omit<Config, 'databasePath' | 'workspacePath'>> & {
|
|
65
|
+
databasePath: string;
|
|
66
|
+
workspacePath: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Host plugin body: open the SQLite store, provide `ctx.memory`, and adopt
|
|
70
|
+
* the monitoring workspace directory once a workspace registry is available.
|
|
71
|
+
* @param ctx - host context.
|
|
72
|
+
* @param config - plugin config (see {@link Config}).
|
|
73
|
+
*/
|
|
74
|
+
export declare function apply(ctx: Context, config?: Config): void;
|
|
75
75
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/index.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory library host plugin: the self-evolving memory layer (生·用·修·记 +
|
|
3
|
-
* diary/fact semantic memory). One process-global library shared by every
|
|
4
|
-
* session, backed by a local SQLite file. Registers `ctx.memory`
|
|
5
|
-
* (MemoryService). The monitoring UI is an independent left-sidebar nav group
|
|
6
|
-
* (browser half), not a workspace; this host half performs no workspace
|
|
7
|
-
* adoption.
|
|
8
|
-
* @module dsh-daoing-memory
|
|
9
|
-
*/
|
|
10
|
-
import { mkdirSync } from 'node:fs';
|
|
11
|
-
import { join, resolve } from 'node:path';
|
|
12
|
-
import { DatabaseSync } from 'node:sqlite';
|
|
13
|
-
import { DEFAULT_CORE_CONFIG, MemoryCore } from "./core.js";
|
|
14
|
-
import { MemoryService } from "./service.js";
|
|
15
|
-
import { MemoryStore } from "./store.js";
|
|
16
|
-
export { MemoryCore, DEFAULT_CORE_CONFIG } from "./core.js";
|
|
17
|
-
export { MemoryService } from "./service.js";
|
|
18
|
-
export { MemoryStore, MEMORY_SCHEMA_VERSION } from "./store.js";
|
|
19
|
-
/** Resolve the plugin config with explicit defaults; unknown keys fail loud. */
|
|
20
|
-
export function resolveConfig(config) {
|
|
21
|
-
const home = process.env.DSH_HOME ?? join(process.cwd(), '.dsh');
|
|
22
|
-
const known = [
|
|
23
|
-
'databasePath', 'workspacePath', 'workspaceTitle', 'diaryExtractEvery',
|
|
24
|
-
'diaryExtractIntervalHours', 'recallTopK', 'injectionBudgetTokens',
|
|
25
|
-
'challengeConsecutiveFails', 'challengeWindow', 'challengeWindowFailRate',
|
|
26
|
-
'familyLiveCap', 'complexityTokenGate', 'complexityStepGate',
|
|
27
|
-
'duplicateOverlapGate', 'recallFloorScore', 'shadowPassRate',
|
|
28
|
-
'deletionFeedbackIntervalHours', 'deletionFeedbackMinDeletions',
|
|
29
|
-
];
|
|
30
|
-
const unknown = Object.keys(config).filter(key => !known.includes(key));
|
|
31
|
-
if (unknown.length > 0) {
|
|
32
|
-
throw new Error(`memory: unknown config key(s) ${unknown.join(', ')}`);
|
|
33
|
-
}
|
|
34
|
-
const databasePath = resolve(config.databasePath ?? join(home, 'storages', 'memory.db'));
|
|
35
|
-
const workspacePath = resolve(config.workspacePath ?? join(home, 'memory-workbench'));
|
|
36
|
-
return {
|
|
37
|
-
databasePath,
|
|
38
|
-
workspacePath,
|
|
39
|
-
workspaceTitle: config.workspaceTitle ?? '记忆监控',
|
|
40
|
-
diaryExtractEvery: config.diaryExtractEvery ?? DEFAULT_CORE_CONFIG.diaryExtractEvery,
|
|
41
|
-
diaryExtractIntervalHours: config.diaryExtractIntervalHours ?? DEFAULT_CORE_CONFIG.diaryExtractIntervalHours,
|
|
42
|
-
recallTopK: config.recallTopK ?? DEFAULT_CORE_CONFIG.recallTopK,
|
|
43
|
-
injectionBudgetTokens: config.injectionBudgetTokens ?? DEFAULT_CORE_CONFIG.injectionBudgetTokens,
|
|
44
|
-
challengeConsecutiveFails: config.challengeConsecutiveFails ?? DEFAULT_CORE_CONFIG.challengeConsecutiveFails,
|
|
45
|
-
challengeWindow: config.challengeWindow ?? DEFAULT_CORE_CONFIG.challengeWindow,
|
|
46
|
-
challengeWindowFailRate: config.challengeWindowFailRate ?? DEFAULT_CORE_CONFIG.challengeWindowFailRate,
|
|
47
|
-
familyLiveCap: config.familyLiveCap ?? DEFAULT_CORE_CONFIG.familyLiveCap,
|
|
48
|
-
complexityTokenGate: config.complexityTokenGate ?? DEFAULT_CORE_CONFIG.complexityTokenGate,
|
|
49
|
-
complexityStepGate: config.complexityStepGate ?? DEFAULT_CORE_CONFIG.complexityStepGate,
|
|
50
|
-
duplicateOverlapGate: config.duplicateOverlapGate ?? DEFAULT_CORE_CONFIG.duplicateOverlapGate,
|
|
51
|
-
recallFloorScore: config.recallFloorScore ?? DEFAULT_CORE_CONFIG.recallFloorScore,
|
|
52
|
-
shadowPassRate: config.shadowPassRate ?? DEFAULT_CORE_CONFIG.shadowPassRate,
|
|
53
|
-
deletionFeedbackIntervalHours: config.deletionFeedbackIntervalHours ?? DEFAULT_CORE_CONFIG.deletionFeedbackIntervalHours,
|
|
54
|
-
deletionFeedbackMinDeletions: config.deletionFeedbackMinDeletions ?? DEFAULT_CORE_CONFIG.deletionFeedbackMinDeletions,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Host plugin body: open the SQLite store, provide `ctx.memory`, and adopt
|
|
59
|
-
* the monitoring workspace directory once a workspace registry is available.
|
|
60
|
-
* @param ctx - host context.
|
|
61
|
-
* @param config - plugin config (see {@link Config}).
|
|
62
|
-
*/
|
|
63
|
-
export function apply(ctx, config = {}) {
|
|
64
|
-
const resolved = resolveConfig(config);
|
|
65
|
-
const coreConfig = {
|
|
66
|
-
...DEFAULT_CORE_CONFIG,
|
|
67
|
-
diaryExtractEvery: resolved.diaryExtractEvery,
|
|
68
|
-
diaryExtractIntervalHours: resolved.diaryExtractIntervalHours,
|
|
69
|
-
recallTopK: resolved.recallTopK,
|
|
70
|
-
injectionBudgetTokens: resolved.injectionBudgetTokens,
|
|
71
|
-
challengeConsecutiveFails: resolved.challengeConsecutiveFails,
|
|
72
|
-
challengeWindow: resolved.challengeWindow,
|
|
73
|
-
challengeWindowFailRate: resolved.challengeWindowFailRate,
|
|
74
|
-
familyLiveCap: resolved.familyLiveCap,
|
|
75
|
-
complexityTokenGate: resolved.complexityTokenGate,
|
|
76
|
-
complexityStepGate: resolved.complexityStepGate,
|
|
77
|
-
duplicateOverlapGate: resolved.duplicateOverlapGate,
|
|
78
|
-
recallFloorScore: resolved.recallFloorScore,
|
|
79
|
-
shadowPassRate: resolved.shadowPassRate,
|
|
80
|
-
deletionFeedbackIntervalHours: resolved.deletionFeedbackIntervalHours,
|
|
81
|
-
deletionFeedbackMinDeletions: resolved.deletionFeedbackMinDeletions,
|
|
82
|
-
};
|
|
83
|
-
mkdirSync(join(resolved.databasePath, '..'), { recursive: true });
|
|
84
|
-
const db = new DatabaseSync(resolved.databasePath);
|
|
85
|
-
const store = new MemoryStore(db);
|
|
86
|
-
const core = new MemoryCore(store, coreConfig);
|
|
87
|
-
const workbenchInfo = () => ({
|
|
88
|
-
workspacePath: resolved.workspacePath,
|
|
89
|
-
workspaceTitle: resolved.workspaceTitle,
|
|
90
|
-
databasePath: resolved.databasePath,
|
|
91
|
-
diaryExtractEvery: resolved.diaryExtractEvery,
|
|
92
|
-
injectionBudgetTokens: resolved.injectionBudgetTokens,
|
|
93
|
-
});
|
|
94
|
-
// Fetch the LLM service handle now, while this fiber is ACTIVE. Accessing
|
|
95
|
-
// ctx.llm in a Remote call context fails ("cannot get property llm without
|
|
96
|
-
// inject"), so we capture a stable reference here instead.
|
|
97
|
-
const llm = ctx.get('llm');
|
|
98
|
-
const defaultModel = ctx.get('agentDefaultModel');
|
|
99
|
-
new MemoryService(ctx, core, workbenchInfo, llm, defaultModel);
|
|
100
|
-
ctx.effect(() => () => {
|
|
101
|
-
try {
|
|
102
|
-
db.close();
|
|
103
|
-
}
|
|
104
|
-
catch { /* already closed */ }
|
|
105
|
-
}, 'memory: SQLite store lifetime');
|
|
106
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Memory library host plugin: the self-evolving memory layer (生·用·修·记 +
|
|
3
|
+
* diary/fact semantic memory). One process-global library shared by every
|
|
4
|
+
* session, backed by a local SQLite file. Registers `ctx.memory`
|
|
5
|
+
* (MemoryService). The monitoring UI is an independent left-sidebar nav group
|
|
6
|
+
* (browser half), not a workspace; this host half performs no workspace
|
|
7
|
+
* adoption.
|
|
8
|
+
* @module dsh-daoing-memory
|
|
9
|
+
*/
|
|
10
|
+
import { mkdirSync } from 'node:fs';
|
|
11
|
+
import { join, resolve } from 'node:path';
|
|
12
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
13
|
+
import { DEFAULT_CORE_CONFIG, MemoryCore } from "./core.js";
|
|
14
|
+
import { MemoryService } from "./service.js";
|
|
15
|
+
import { MemoryStore } from "./store.js";
|
|
16
|
+
export { MemoryCore, DEFAULT_CORE_CONFIG } from "./core.js";
|
|
17
|
+
export { MemoryService } from "./service.js";
|
|
18
|
+
export { MemoryStore, MEMORY_SCHEMA_VERSION } from "./store.js";
|
|
19
|
+
/** Resolve the plugin config with explicit defaults; unknown keys fail loud. */
|
|
20
|
+
export function resolveConfig(config) {
|
|
21
|
+
const home = process.env.DSH_HOME ?? join(process.cwd(), '.dsh');
|
|
22
|
+
const known = [
|
|
23
|
+
'databasePath', 'workspacePath', 'workspaceTitle', 'diaryExtractEvery',
|
|
24
|
+
'diaryExtractIntervalHours', 'recallTopK', 'injectionBudgetTokens',
|
|
25
|
+
'challengeConsecutiveFails', 'challengeWindow', 'challengeWindowFailRate',
|
|
26
|
+
'familyLiveCap', 'complexityTokenGate', 'complexityStepGate',
|
|
27
|
+
'duplicateOverlapGate', 'recallFloorScore', 'shadowPassRate',
|
|
28
|
+
'deletionFeedbackIntervalHours', 'deletionFeedbackMinDeletions',
|
|
29
|
+
];
|
|
30
|
+
const unknown = Object.keys(config).filter(key => !known.includes(key));
|
|
31
|
+
if (unknown.length > 0) {
|
|
32
|
+
throw new Error(`memory: unknown config key(s) ${unknown.join(', ')}`);
|
|
33
|
+
}
|
|
34
|
+
const databasePath = resolve(config.databasePath ?? join(home, 'storages', 'memory.db'));
|
|
35
|
+
const workspacePath = resolve(config.workspacePath ?? join(home, 'memory-workbench'));
|
|
36
|
+
return {
|
|
37
|
+
databasePath,
|
|
38
|
+
workspacePath,
|
|
39
|
+
workspaceTitle: config.workspaceTitle ?? '记忆监控',
|
|
40
|
+
diaryExtractEvery: config.diaryExtractEvery ?? DEFAULT_CORE_CONFIG.diaryExtractEvery,
|
|
41
|
+
diaryExtractIntervalHours: config.diaryExtractIntervalHours ?? DEFAULT_CORE_CONFIG.diaryExtractIntervalHours,
|
|
42
|
+
recallTopK: config.recallTopK ?? DEFAULT_CORE_CONFIG.recallTopK,
|
|
43
|
+
injectionBudgetTokens: config.injectionBudgetTokens ?? DEFAULT_CORE_CONFIG.injectionBudgetTokens,
|
|
44
|
+
challengeConsecutiveFails: config.challengeConsecutiveFails ?? DEFAULT_CORE_CONFIG.challengeConsecutiveFails,
|
|
45
|
+
challengeWindow: config.challengeWindow ?? DEFAULT_CORE_CONFIG.challengeWindow,
|
|
46
|
+
challengeWindowFailRate: config.challengeWindowFailRate ?? DEFAULT_CORE_CONFIG.challengeWindowFailRate,
|
|
47
|
+
familyLiveCap: config.familyLiveCap ?? DEFAULT_CORE_CONFIG.familyLiveCap,
|
|
48
|
+
complexityTokenGate: config.complexityTokenGate ?? DEFAULT_CORE_CONFIG.complexityTokenGate,
|
|
49
|
+
complexityStepGate: config.complexityStepGate ?? DEFAULT_CORE_CONFIG.complexityStepGate,
|
|
50
|
+
duplicateOverlapGate: config.duplicateOverlapGate ?? DEFAULT_CORE_CONFIG.duplicateOverlapGate,
|
|
51
|
+
recallFloorScore: config.recallFloorScore ?? DEFAULT_CORE_CONFIG.recallFloorScore,
|
|
52
|
+
shadowPassRate: config.shadowPassRate ?? DEFAULT_CORE_CONFIG.shadowPassRate,
|
|
53
|
+
deletionFeedbackIntervalHours: config.deletionFeedbackIntervalHours ?? DEFAULT_CORE_CONFIG.deletionFeedbackIntervalHours,
|
|
54
|
+
deletionFeedbackMinDeletions: config.deletionFeedbackMinDeletions ?? DEFAULT_CORE_CONFIG.deletionFeedbackMinDeletions,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Host plugin body: open the SQLite store, provide `ctx.memory`, and adopt
|
|
59
|
+
* the monitoring workspace directory once a workspace registry is available.
|
|
60
|
+
* @param ctx - host context.
|
|
61
|
+
* @param config - plugin config (see {@link Config}).
|
|
62
|
+
*/
|
|
63
|
+
export function apply(ctx, config = {}) {
|
|
64
|
+
const resolved = resolveConfig(config);
|
|
65
|
+
const coreConfig = {
|
|
66
|
+
...DEFAULT_CORE_CONFIG,
|
|
67
|
+
diaryExtractEvery: resolved.diaryExtractEvery,
|
|
68
|
+
diaryExtractIntervalHours: resolved.diaryExtractIntervalHours,
|
|
69
|
+
recallTopK: resolved.recallTopK,
|
|
70
|
+
injectionBudgetTokens: resolved.injectionBudgetTokens,
|
|
71
|
+
challengeConsecutiveFails: resolved.challengeConsecutiveFails,
|
|
72
|
+
challengeWindow: resolved.challengeWindow,
|
|
73
|
+
challengeWindowFailRate: resolved.challengeWindowFailRate,
|
|
74
|
+
familyLiveCap: resolved.familyLiveCap,
|
|
75
|
+
complexityTokenGate: resolved.complexityTokenGate,
|
|
76
|
+
complexityStepGate: resolved.complexityStepGate,
|
|
77
|
+
duplicateOverlapGate: resolved.duplicateOverlapGate,
|
|
78
|
+
recallFloorScore: resolved.recallFloorScore,
|
|
79
|
+
shadowPassRate: resolved.shadowPassRate,
|
|
80
|
+
deletionFeedbackIntervalHours: resolved.deletionFeedbackIntervalHours,
|
|
81
|
+
deletionFeedbackMinDeletions: resolved.deletionFeedbackMinDeletions,
|
|
82
|
+
};
|
|
83
|
+
mkdirSync(join(resolved.databasePath, '..'), { recursive: true });
|
|
84
|
+
const db = new DatabaseSync(resolved.databasePath);
|
|
85
|
+
const store = new MemoryStore(db);
|
|
86
|
+
const core = new MemoryCore(store, coreConfig);
|
|
87
|
+
const workbenchInfo = () => ({
|
|
88
|
+
workspacePath: resolved.workspacePath,
|
|
89
|
+
workspaceTitle: resolved.workspaceTitle,
|
|
90
|
+
databasePath: resolved.databasePath,
|
|
91
|
+
diaryExtractEvery: resolved.diaryExtractEvery,
|
|
92
|
+
injectionBudgetTokens: resolved.injectionBudgetTokens,
|
|
93
|
+
});
|
|
94
|
+
// Fetch the LLM service handle now, while this fiber is ACTIVE. Accessing
|
|
95
|
+
// ctx.llm in a Remote call context fails ("cannot get property llm without
|
|
96
|
+
// inject"), so we capture a stable reference here instead.
|
|
97
|
+
const llm = ctx.get('llm');
|
|
98
|
+
const defaultModel = ctx.get('agentDefaultModel');
|
|
99
|
+
new MemoryService(ctx, core, workbenchInfo, llm, defaultModel);
|
|
100
|
+
ctx.effect(() => () => {
|
|
101
|
+
try {
|
|
102
|
+
db.close();
|
|
103
|
+
}
|
|
104
|
+
catch { /* already closed */ }
|
|
105
|
+
}, 'memory: SQLite store lifetime');
|
|
106
|
+
}
|
|
107
107
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-daoing-memory",
|
|
3
3
|
"description": "Self-evolving memory for DeepSeek Harness (DSH): earned experiences, diary/fact semantic memory, concern tracking, and an append-only audit ledger.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "daoing",
|