dsh-mnemon 0.2.6 → 0.2.8
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 +3 -3
- package/README.zh-CN.md +3 -3
- package/cordis.patch.yml +7 -0
- package/lib/index.js +488 -33
- package/lib/types/config-values.d.ts +6 -0
- package/lib/types/config.d.ts +1 -1
- package/lib/types/contracts.d.ts +5 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/providers/byterover.d.ts +2 -1
- package/lib/types/providers/hindsight.d.ts +2 -1
- package/lib/types/providers/holographic.d.ts +2 -1
- package/lib/types/providers/mem0.d.ts +2 -1
- package/lib/types/providers/openviking.d.ts +2 -1
- package/lib/types/providers/provider.d.ts +6 -0
- package/lib/types/providers/retaindb.d.ts +2 -1
- package/lib/types/providers/supermemory.d.ts +2 -1
- package/lib/types/recall-quality/contracts.d.ts +32 -0
- package/lib/types/recall-quality/engine.d.ts +13 -0
- package/lib/types/recall-quality/index.d.ts +4 -0
- package/lib/types/recall-quality/policies.d.ts +5 -0
- package/lib/types/recall-quality/registry.d.ts +10 -0
- package/lib/types/service.d.ts +4 -2
- package/lib/types/shared/contracts.d.ts +41 -0
- package/lib/types/subagent.d.ts +10 -2
- package/package.json +1 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export declare const DEFAULT_TIMEOUT_MS = 10000;
|
|
2
2
|
export declare const DEFAULT_RECALL_LIMIT = 10;
|
|
3
3
|
export declare const DEFAULT_IDLE_REVIEW_MS = 30000;
|
|
4
|
+
export declare const DEFAULT_RECALL_QUALITY_POLICY = "strict-v1";
|
|
5
|
+
export declare const DEFAULT_RECALL_LOW_SCORE_THRESHOLD = 0.25;
|
|
6
|
+
export declare const DEFAULT_RECALL_HIGH_SCORE_THRESHOLD = 0.6;
|
|
7
|
+
export declare const DEFAULT_RECALL_CANDIDATE_MULTIPLIER = 3;
|
|
8
|
+
export declare const DEFAULT_RECALL_MAX_MEDIUM_RESULTS = 4;
|
|
9
|
+
export declare const DEFAULT_RECALL_MAX_UNKNOWN_RESULTS = 2;
|
package/lib/types/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from 'schemastery';
|
|
2
2
|
import type { Config as SharedConfig, CustomPackConfig as SharedCustomPackConfig, InteractionConfig as SharedInteractionConfig, ResolvedConfig as SharedResolvedConfig, ResolvedInteractionConfig as SharedResolvedInteractionConfig } from './shared/contracts.ts';
|
|
3
|
-
export { DEFAULT_IDLE_REVIEW_MS, DEFAULT_RECALL_LIMIT, DEFAULT_TIMEOUT_MS } from './config-values.ts';
|
|
3
|
+
export { DEFAULT_IDLE_REVIEW_MS, DEFAULT_RECALL_CANDIDATE_MULTIPLIER, DEFAULT_RECALL_HIGH_SCORE_THRESHOLD, DEFAULT_RECALL_LIMIT, DEFAULT_RECALL_LOW_SCORE_THRESHOLD, DEFAULT_RECALL_MAX_MEDIUM_RESULTS, DEFAULT_RECALL_MAX_UNKNOWN_RESULTS, DEFAULT_RECALL_QUALITY_POLICY, DEFAULT_TIMEOUT_MS, } from './config-values.ts';
|
|
4
4
|
export type Config = SharedConfig;
|
|
5
5
|
export type CustomPackConfig = SharedCustomPackConfig;
|
|
6
6
|
export type InteractionConfig = SharedInteractionConfig;
|
package/lib/types/contracts.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ export interface HostSettingsService {
|
|
|
34
34
|
export interface ToolExecution {
|
|
35
35
|
signal: AbortSignal;
|
|
36
36
|
agent?: HostAgent;
|
|
37
|
+
name?: string;
|
|
38
|
+
parent?: symbol;
|
|
39
|
+
token?: symbol;
|
|
40
|
+
/** End the current model turn after an authoritative terminal tool call. */
|
|
41
|
+
concludeTurn?: () => void;
|
|
37
42
|
}
|
|
38
43
|
export type CommandResult = {
|
|
39
44
|
kind: 'success';
|
package/lib/types/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { MnemonSubagentCoordinator } from './subagent.ts';
|
|
|
9
9
|
import { StorageScopeInspector } from './storage-scope.ts';
|
|
10
10
|
import { MnemonPackManager } from './pack.ts';
|
|
11
11
|
import { VersionUpdateManager } from './version-updates.ts';
|
|
12
|
+
export { BALANCED_RECALL_QUALITY_POLICY, EXHAUSTIVE_RECALL_QUALITY_POLICY, RecallQualityPolicyRegistry, STRICT_RECALL_QUALITY_POLICY, recallQualityPolicies, registerRecallQualityPolicy, } from './recall-quality/index.ts';
|
|
13
|
+
export type { RecallQualityCandidate, RecallQualityDecision, RecallQualityPolicy, RecallQualityPolicyContext, } from './recall-quality/index.ts';
|
|
12
14
|
export declare const name = "dsh-mnemon";
|
|
13
15
|
export declare const inject: string[];
|
|
14
16
|
export { Config, InteractionConfig, resolveConfig, resolveInteractionConfig, DocumentManager, LiveMnemonRuntime, MnemonLifecycle, MnemonService, MnemonSubagentCoordinator, RuntimeMemoryController, StorageScopeInspector, MnemonPackManager, VersionUpdateManager, createRunner, createRuntimeGraph };
|
|
@@ -2,7 +2,7 @@ import type { JsonValue } from '../contracts.ts';
|
|
|
2
2
|
import type { MemoryBodyRegistry } from '../memory-bodies.ts';
|
|
3
3
|
import { type ProcessRunner } from '../process.ts';
|
|
4
4
|
import type { Insight, MemoryBody, MemoryGraphSnapshot, MemoryListRequest, MemoryProviderConnection, RememberRequest, SearchRequest } from '../shared/contracts.ts';
|
|
5
|
-
import type
|
|
5
|
+
import { type MemoryProviderAdapter, type ProviderBodyStatus, type ProviderMemorySpace, type ProviderSearchResult } from './provider.ts';
|
|
6
6
|
interface ByteRoverProviderOptions {
|
|
7
7
|
process?: ProcessRunner;
|
|
8
8
|
queryTimeoutMs?: number;
|
|
@@ -11,6 +11,7 @@ interface ByteRoverProviderOptions {
|
|
|
11
11
|
export declare class ByteRoverProvider implements MemoryProviderAdapter {
|
|
12
12
|
private readonly memoryBodies;
|
|
13
13
|
readonly id: "byterover";
|
|
14
|
+
readonly scoreSemantics: import("./provider.ts").ProviderScoreSemantics;
|
|
14
15
|
private readonly process;
|
|
15
16
|
private readonly queryTimeoutMs;
|
|
16
17
|
private readonly curateTimeoutMs;
|
|
@@ -2,9 +2,10 @@ import type { JsonValue } from '../contracts.ts';
|
|
|
2
2
|
import type { MemoryBodyRegistry } from '../memory-bodies.ts';
|
|
3
3
|
import type { EdgeType, Insight, MemoryBody, MemoryGraphSnapshot, MemoryListRequest, RememberRequest, SearchRequest } from '../shared/contracts.ts';
|
|
4
4
|
import { HttpMemoryProvider, type HttpProviderOptions } from './http.ts';
|
|
5
|
-
import type
|
|
5
|
+
import { type MemoryProviderAdapter, type ProviderBodyStatus, type ProviderMemorySpace, type ProviderSearchResult } from './provider.ts';
|
|
6
6
|
export declare class HindsightProvider extends HttpMemoryProvider implements MemoryProviderAdapter {
|
|
7
7
|
readonly id: "hindsight";
|
|
8
|
+
readonly scoreSemantics: import("./provider.ts").ProviderScoreSemantics;
|
|
8
9
|
constructor(memoryBodies: MemoryBodyRegistry, options?: HttpProviderOptions);
|
|
9
10
|
discover(connection: Record<string, string | number | boolean>, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
|
|
10
11
|
status(body: MemoryBody, signal?: AbortSignal): Promise<ProviderBodyStatus>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { JsonValue } from '../contracts.ts';
|
|
2
2
|
import type { MemoryBodyRegistry } from '../memory-bodies.ts';
|
|
3
3
|
import type { Insight, MemoryBody, MemoryGraphSnapshot, MemoryListRequest, MemoryProviderConnection, RememberRequest, SearchRequest } from '../shared/contracts.ts';
|
|
4
|
-
import type
|
|
4
|
+
import { type MemoryProviderAdapter, type ProviderBodyStatus, type ProviderMemorySpace, type ProviderSearchResult } from './provider.ts';
|
|
5
5
|
export declare class HolographicProvider implements MemoryProviderAdapter {
|
|
6
6
|
private readonly memoryBodies;
|
|
7
7
|
readonly id: "holographic";
|
|
8
|
+
readonly scoreSemantics: import("./provider.ts").ProviderScoreSemantics;
|
|
8
9
|
constructor(memoryBodies: MemoryBodyRegistry);
|
|
9
10
|
discover(connection: MemoryProviderConnection): Promise<ProviderMemorySpace[]>;
|
|
10
11
|
status(body: MemoryBody): Promise<ProviderBodyStatus>;
|
|
@@ -2,9 +2,10 @@ import type { JsonValue } from '../contracts.ts';
|
|
|
2
2
|
import type { MemoryBodyRegistry } from '../memory-bodies.ts';
|
|
3
3
|
import type { Insight, MemoryBody, MemoryListRequest, RememberRequest, SearchRequest } from '../shared/contracts.ts';
|
|
4
4
|
import { HttpMemoryProvider, type HttpProviderOptions } from './http.ts';
|
|
5
|
-
import type
|
|
5
|
+
import { type MemoryProviderAdapter, type ProviderBodyStatus, type ProviderMemorySpace, type ProviderSearchResult } from './provider.ts';
|
|
6
6
|
export declare class Mem0Provider extends HttpMemoryProvider implements MemoryProviderAdapter {
|
|
7
7
|
readonly id: "mem0";
|
|
8
|
+
readonly scoreSemantics: import("./provider.ts").ProviderScoreSemantics;
|
|
8
9
|
constructor(memoryBodies: MemoryBodyRegistry, options?: HttpProviderOptions);
|
|
9
10
|
discover(connection: Record<string, string | number | boolean>, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
|
|
10
11
|
status(body: MemoryBody, signal?: AbortSignal): Promise<ProviderBodyStatus>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JsonValue } from '../contracts.ts';
|
|
2
2
|
import type { MemoryBodyRegistry } from '../memory-bodies.ts';
|
|
3
3
|
import type { Insight, MemoryBody, MemoryGraphSnapshot, MemoryListRequest, MemoryProviderConnection, RememberRequest, SearchRequest } from '../shared/contracts.ts';
|
|
4
|
-
import type
|
|
4
|
+
import { type MemoryProviderAdapter, type ProviderBodyStatus, type ProviderMemorySpace, type ProviderSearchResult } from './provider.ts';
|
|
5
5
|
interface OpenVikingProviderOptions {
|
|
6
6
|
fetch?: typeof fetch;
|
|
7
7
|
requestTimeoutMs?: number;
|
|
@@ -11,6 +11,7 @@ interface OpenVikingProviderOptions {
|
|
|
11
11
|
export declare class OpenVikingProvider implements MemoryProviderAdapter {
|
|
12
12
|
private readonly memoryBodies;
|
|
13
13
|
readonly id: "openviking";
|
|
14
|
+
readonly scoreSemantics: import("./provider.ts").ProviderScoreSemantics;
|
|
14
15
|
private readonly requestFetch;
|
|
15
16
|
private readonly requestTimeoutMs;
|
|
16
17
|
private readonly settlementTimeoutMs;
|
|
@@ -9,6 +9,11 @@ export interface ProviderSearchResult {
|
|
|
9
9
|
results: Insight[];
|
|
10
10
|
hint?: string;
|
|
11
11
|
}
|
|
12
|
+
export interface ProviderScoreSemantics {
|
|
13
|
+
/** Provider promises a finite relevance score in 0..1 where larger is better. */
|
|
14
|
+
kind: 'normalized-relevance';
|
|
15
|
+
}
|
|
16
|
+
export declare const NORMALIZED_RELEVANCE_SCORE: ProviderScoreSemantics;
|
|
12
17
|
/** One provider-owned namespace projected into DSH as a Memory Space. */
|
|
13
18
|
export interface ProviderMemorySpace {
|
|
14
19
|
/** Stable identifier owned by the provider, never a DSH-generated title. */
|
|
@@ -23,6 +28,7 @@ export interface ProviderMemorySpace {
|
|
|
23
28
|
*/
|
|
24
29
|
export interface MemoryProviderAdapter {
|
|
25
30
|
readonly id: MemoryBody['provider']['id'];
|
|
31
|
+
readonly scoreSemantics?: ProviderScoreSemantics;
|
|
26
32
|
/** Enumerate the complete set of namespaces visible to this service connection. */
|
|
27
33
|
discover?(connection: MemoryProviderConnection, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
|
|
28
34
|
/** Drop a short-lived health result before an explicit user reconnect. */
|
|
@@ -2,9 +2,10 @@ import type { JsonValue } from '../contracts.ts';
|
|
|
2
2
|
import type { MemoryBodyRegistry } from '../memory-bodies.ts';
|
|
3
3
|
import type { Insight, MemoryBody, MemoryListRequest, RememberRequest, SearchRequest } from '../shared/contracts.ts';
|
|
4
4
|
import { HttpMemoryProvider, type HttpProviderOptions } from './http.ts';
|
|
5
|
-
import type
|
|
5
|
+
import { type MemoryProviderAdapter, type ProviderBodyStatus, type ProviderMemorySpace, type ProviderSearchResult } from './provider.ts';
|
|
6
6
|
export declare class RetainDbProvider extends HttpMemoryProvider implements MemoryProviderAdapter {
|
|
7
7
|
readonly id: "retaindb";
|
|
8
|
+
readonly scoreSemantics: import("./provider.ts").ProviderScoreSemantics;
|
|
8
9
|
constructor(memoryBodies: MemoryBodyRegistry, options?: HttpProviderOptions);
|
|
9
10
|
discover(connection: Record<string, string | number | boolean>, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
|
|
10
11
|
status(body: MemoryBody, signal?: AbortSignal): Promise<ProviderBodyStatus>;
|
|
@@ -2,9 +2,10 @@ import type { JsonValue } from '../contracts.ts';
|
|
|
2
2
|
import type { MemoryBodyRegistry } from '../memory-bodies.ts';
|
|
3
3
|
import type { Insight, MemoryBody, MemoryListRequest, RememberRequest, SearchRequest } from '../shared/contracts.ts';
|
|
4
4
|
import { HttpMemoryProvider, type HttpProviderOptions } from './http.ts';
|
|
5
|
-
import type
|
|
5
|
+
import { type MemoryProviderAdapter, type ProviderBodyStatus, type ProviderMemorySpace, type ProviderSearchResult } from './provider.ts';
|
|
6
6
|
export declare class SupermemoryProvider extends HttpMemoryProvider implements MemoryProviderAdapter {
|
|
7
7
|
readonly id: "supermemory";
|
|
8
|
+
readonly scoreSemantics: import("./provider.ts").ProviderScoreSemantics;
|
|
8
9
|
constructor(memoryBodies: MemoryBodyRegistry, options?: HttpProviderOptions);
|
|
9
10
|
discover(connection: Record<string, string | number | boolean>, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
|
|
10
11
|
status(body: MemoryBody, signal?: AbortSignal): Promise<ProviderBodyStatus>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Insight, MemoryProviderId, ResolvedRecallQualityConfig } from '../shared/contracts.ts';
|
|
2
|
+
import type { ProviderScoreSemantics } from '../providers/provider.ts';
|
|
3
|
+
export type RecallQualityDecisionReason = 'high-score' | 'medium-score' | 'low-score' | 'non-positive-score' | 'invalid-score' | 'unscaled-score' | 'unscored';
|
|
4
|
+
export interface RecallQualityCandidate {
|
|
5
|
+
insight: Insight;
|
|
6
|
+
memoryBodyId: string;
|
|
7
|
+
providerId: MemoryProviderId;
|
|
8
|
+
providerRank: number;
|
|
9
|
+
bodyOrder: number;
|
|
10
|
+
scoreSemantics?: ProviderScoreSemantics;
|
|
11
|
+
}
|
|
12
|
+
export interface RecallQualityDecision {
|
|
13
|
+
action: 'keep' | 'drop';
|
|
14
|
+
tier: 'high' | 'medium' | 'low' | 'unknown';
|
|
15
|
+
reason: RecallQualityDecisionReason;
|
|
16
|
+
normalizedScore?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface EvaluatedRecallQualityCandidate {
|
|
19
|
+
candidate: RecallQualityCandidate;
|
|
20
|
+
decision: RecallQualityDecision;
|
|
21
|
+
}
|
|
22
|
+
export interface RecallQualityPolicyContext {
|
|
23
|
+
requestedLimit: number;
|
|
24
|
+
config: ResolvedRecallQualityConfig;
|
|
25
|
+
}
|
|
26
|
+
/** Pure, bounded policy applied before recall rows are serialized to an Agent. */
|
|
27
|
+
export interface RecallQualityPolicy {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
candidateLimit(context: RecallQualityPolicyContext): number;
|
|
30
|
+
evaluate(candidate: RecallQualityCandidate, context: RecallQualityPolicyContext): RecallQualityDecision;
|
|
31
|
+
select(candidates: readonly EvaluatedRecallQualityCandidate[], context: RecallQualityPolicyContext): EvaluatedRecallQualityCandidate[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EvaluatedRecallQualityCandidate, RecallQualityCandidate, RecallQualityPolicy, RecallQualityPolicyContext } from './contracts.ts';
|
|
2
|
+
export interface PreparedRecallQualityPolicy {
|
|
3
|
+
policy: RecallQualityPolicy;
|
|
4
|
+
candidateLimit: number;
|
|
5
|
+
fallbackFrom?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function prepareRecallQualityPolicy(policy: RecallQualityPolicy, context: RecallQualityPolicyContext, fallback?: RecallQualityPolicy): PreparedRecallQualityPolicy;
|
|
8
|
+
export declare function applyRecallQualityPolicy(prepared: PreparedRecallQualityPolicy, candidates: readonly RecallQualityCandidate[], context: RecallQualityPolicyContext, fallback?: RecallQualityPolicy): {
|
|
9
|
+
policyId: string;
|
|
10
|
+
fallbackFrom?: string;
|
|
11
|
+
evaluated: EvaluatedRecallQualityCandidate[];
|
|
12
|
+
selected: EvaluatedRecallQualityCandidate[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { EvaluatedRecallQualityCandidate, RecallQualityCandidate, RecallQualityDecision, RecallQualityDecisionReason, RecallQualityPolicy, RecallQualityPolicyContext, } from './contracts.ts';
|
|
2
|
+
export { BALANCED_RECALL_QUALITY_POLICY, BUILTIN_RECALL_QUALITY_POLICIES, EXHAUSTIVE_RECALL_QUALITY_POLICY, STRICT_RECALL_QUALITY_POLICY, } from './policies.ts';
|
|
3
|
+
export { applyRecallQualityPolicy, prepareRecallQualityPolicy, type PreparedRecallQualityPolicy } from './engine.ts';
|
|
4
|
+
export { RecallQualityPolicyRegistry, recallQualityPolicies, registerRecallQualityPolicy } from './registry.ts';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RecallQualityPolicy } from './contracts.ts';
|
|
2
|
+
export declare const STRICT_RECALL_QUALITY_POLICY: RecallQualityPolicy;
|
|
3
|
+
export declare const BALANCED_RECALL_QUALITY_POLICY: RecallQualityPolicy;
|
|
4
|
+
export declare const EXHAUSTIVE_RECALL_QUALITY_POLICY: RecallQualityPolicy;
|
|
5
|
+
export declare const BUILTIN_RECALL_QUALITY_POLICIES: readonly [RecallQualityPolicy, RecallQualityPolicy, RecallQualityPolicy];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RecallQualityPolicy } from './contracts.ts';
|
|
2
|
+
export declare class RecallQualityPolicyRegistry {
|
|
3
|
+
private readonly policies;
|
|
4
|
+
constructor(policies?: readonly RecallQualityPolicy[]);
|
|
5
|
+
register(policy: RecallQualityPolicy): () => void;
|
|
6
|
+
resolve(id: string): RecallQualityPolicy;
|
|
7
|
+
ids(): string[];
|
|
8
|
+
}
|
|
9
|
+
export declare const recallQualityPolicies: RecallQualityPolicyRegistry;
|
|
10
|
+
export declare function registerRecallQualityPolicy(policy: RecallQualityPolicy): () => void;
|
package/lib/types/service.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import type { ResolvedConfig } from './config.ts';
|
|
|
3
3
|
import { MemoryBodyRegistry, type CreateMemoryBodyRequest, type MemoryBody, type UpdateMemoryBodyRequest } from './memory-bodies.ts';
|
|
4
4
|
import type { MnemonRunner } from './runner.ts';
|
|
5
5
|
import { type LlmMemoryPlacementSelection, type PreparedMemoryPlacement } from './provider-placement.ts';
|
|
6
|
+
import { type RecallQualityPolicyRegistry } from './recall-quality/index.ts';
|
|
6
7
|
import { type EdgeType, type EntityView, type Insight, type MemoryBodyCatalog, type MemoryBodyMetadataUpdate, type MemoryBodyView, type MemoryGraphSnapshot, type MemoryListRequest, type MemoryListView, type MemoryPlacementDecision, type MemoryReadSource, type RememberRequest, type SearchRequest, type StatusView } from './shared/contracts.ts';
|
|
7
8
|
export { CATEGORIES, EDGE_TYPES, INTENTS, SOURCES } from './shared/contracts.ts';
|
|
8
|
-
export type { Category, EdgeType, EntityView, Insight, Intent, MemoryBodyCatalog, MemoryBodyStats, MemoryBodyView, MemoryGraphEdge, MemoryGraphNode, MemoryGraphSnapshot, MemoryListRequest, MemoryListView, MemoryReadSource, RememberRequest, SearchRequest, Source, StatusView, } from './shared/contracts.ts';
|
|
9
|
+
export type { Category, EdgeType, EntityView, Insight, Intent, MemoryBodyCatalog, MemoryBodyStats, MemoryBodyView, MemoryGraphEdge, MemoryGraphNode, MemoryGraphSnapshot, MemoryListRequest, MemoryListView, MemoryReadSource, RecallQualityStats, RememberRequest, SearchRequest, Source, StatusView, } from './shared/contracts.ts';
|
|
9
10
|
export interface MemoryBodyMetadataSample {
|
|
10
11
|
memoryBodyId: string;
|
|
11
12
|
name: string;
|
|
@@ -22,8 +23,9 @@ export declare class MnemonService {
|
|
|
22
23
|
readonly config: ResolvedConfig;
|
|
23
24
|
readonly memoryBodies: MemoryBodyRegistry;
|
|
24
25
|
private readonly providers;
|
|
26
|
+
private readonly recallQualityPolicy;
|
|
25
27
|
private bodiesInFlight;
|
|
26
|
-
constructor(runner: MnemonRunner, config: ResolvedConfig, memoryBodies?: MemoryBodyRegistry);
|
|
28
|
+
constructor(runner: MnemonRunner, config: ResolvedConfig, memoryBodies?: MemoryBodyRegistry, recallQualityPolicyRegistry?: RecallQualityPolicyRegistry);
|
|
27
29
|
bodies(signal?: AbortSignal): Promise<MemoryBodyCatalog>;
|
|
28
30
|
/** Coalesce simultaneous Status/Memory-page probes without caching mutations. */
|
|
29
31
|
private collectBodies;
|
|
@@ -68,6 +68,26 @@ export interface CustomPackConfig {
|
|
|
68
68
|
name: string;
|
|
69
69
|
dataDir: string;
|
|
70
70
|
}
|
|
71
|
+
export interface RecallQualityConfig {
|
|
72
|
+
/** Registered deterministic policy id. */
|
|
73
|
+
policy?: string;
|
|
74
|
+
lowScoreThreshold?: number;
|
|
75
|
+
highScoreThreshold?: number;
|
|
76
|
+
/** Provider candidate expansion before quality filtering, from 1 through 5. */
|
|
77
|
+
candidateMultiplier?: number;
|
|
78
|
+
/** Maximum medium-relevance rows admitted by the strict policy. */
|
|
79
|
+
maxMediumResults?: number;
|
|
80
|
+
/** Maximum unknown-scale or unscored rows admitted by the strict policy. */
|
|
81
|
+
maxUnknownResults?: number;
|
|
82
|
+
}
|
|
83
|
+
export interface ResolvedRecallQualityConfig {
|
|
84
|
+
policy: string;
|
|
85
|
+
lowScoreThreshold: number;
|
|
86
|
+
highScoreThreshold: number;
|
|
87
|
+
candidateMultiplier: number;
|
|
88
|
+
maxMediumResults: number;
|
|
89
|
+
maxUnknownResults: number;
|
|
90
|
+
}
|
|
71
91
|
export interface Config {
|
|
72
92
|
storageScope?: StorageScopeKind;
|
|
73
93
|
cliPath?: string;
|
|
@@ -77,6 +97,7 @@ export interface Config {
|
|
|
77
97
|
store?: string;
|
|
78
98
|
timeoutMs?: number;
|
|
79
99
|
defaultRecallLimit?: number;
|
|
100
|
+
recallQuality?: RecallQualityConfig;
|
|
80
101
|
routingGuidance?: boolean;
|
|
81
102
|
displayMode?: 'sidebar' | 'buildin';
|
|
82
103
|
tabEnabled?: boolean;
|
|
@@ -146,6 +167,7 @@ export interface ResolvedConfig {
|
|
|
146
167
|
store?: string;
|
|
147
168
|
timeoutMs: number;
|
|
148
169
|
defaultRecallLimit: number;
|
|
170
|
+
recallQuality: ResolvedRecallQualityConfig;
|
|
149
171
|
routingGuidance: boolean;
|
|
150
172
|
displayMode: 'sidebar' | 'buildin';
|
|
151
173
|
tabEnabled: boolean;
|
|
@@ -365,6 +387,7 @@ export type EdgeType = 'temporal' | 'semantic' | 'causal' | 'entity';
|
|
|
365
387
|
export declare const EDGE_TYPES: readonly ["temporal", "semantic", "causal", "entity"];
|
|
366
388
|
export type Intent = 'WHY' | 'WHEN' | 'ENTITY' | 'GENERAL';
|
|
367
389
|
export declare const INTENTS: readonly ["WHY", "WHEN", "ENTITY", "GENERAL"];
|
|
390
|
+
export type RecallRelevanceTier = 'high' | 'medium' | 'low' | 'unknown';
|
|
368
391
|
export interface Insight {
|
|
369
392
|
id: string;
|
|
370
393
|
content: string;
|
|
@@ -374,6 +397,10 @@ export interface Insight {
|
|
|
374
397
|
entities?: string[];
|
|
375
398
|
source?: string;
|
|
376
399
|
score?: number;
|
|
400
|
+
/** Policy-normalized query relevance; absent for unknown Provider score scales. */
|
|
401
|
+
normalizedScore?: number;
|
|
402
|
+
/** Query relevance assigned by the active deterministic recall quality policy. */
|
|
403
|
+
relevanceTier?: RecallRelevanceTier;
|
|
377
404
|
/** Comparable rank score only when results were fused across providers. */
|
|
378
405
|
federatedScore?: number;
|
|
379
406
|
confidence?: string;
|
|
@@ -483,6 +510,19 @@ export interface MemoryReadSource {
|
|
|
483
510
|
itemCount: number;
|
|
484
511
|
edgeCount?: number;
|
|
485
512
|
hint?: string;
|
|
513
|
+
quality?: RecallQualityStats;
|
|
514
|
+
}
|
|
515
|
+
export interface RecallQualityStats {
|
|
516
|
+
policyId: string;
|
|
517
|
+
fallbackFrom?: string;
|
|
518
|
+
fetched: number;
|
|
519
|
+
retained: number;
|
|
520
|
+
selected: number;
|
|
521
|
+
droppedLowScore: number;
|
|
522
|
+
droppedNonPositiveScore: number;
|
|
523
|
+
droppedInvalidScore: number;
|
|
524
|
+
unscored: number;
|
|
525
|
+
unscaled: number;
|
|
486
526
|
}
|
|
487
527
|
export interface MemoryListRequest {
|
|
488
528
|
query?: string;
|
|
@@ -772,6 +812,7 @@ export interface StatusView {
|
|
|
772
812
|
writeEnabled: boolean;
|
|
773
813
|
timeoutMs: number;
|
|
774
814
|
defaultRecallLimit: number;
|
|
815
|
+
recallQuality: ResolvedRecallQualityConfig;
|
|
775
816
|
memoryBodyDirectory: string;
|
|
776
817
|
memoryBodies: MemoryBodyView[];
|
|
777
818
|
providerServices?: MemoryProviderRuntimeStatus[];
|
package/lib/types/subagent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HostAgent, HostSubagentsService } from './contracts.ts';
|
|
1
|
+
import type { HostAgent, HostSubagentsService, ToolDefinition } from './contracts.ts';
|
|
2
2
|
import { type DocumentManager, type DocumentMutation, type DocumentMutationResult, type DocumentView } from './documents.ts';
|
|
3
3
|
import { type RuntimeMemoryController, type RuntimeMemoryMutation, type RuntimeMemoryMutationResult } from './runtime-memory.ts';
|
|
4
4
|
import type { Insight, MnemonService, RememberRequest, SearchRequest } from './service.ts';
|
|
@@ -12,6 +12,13 @@ interface AgentRuntimeSource {
|
|
|
12
12
|
documents: DocumentManager;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
+
interface HostToolRegistry {
|
|
16
|
+
register(definition: ToolDefinition): unknown;
|
|
17
|
+
}
|
|
18
|
+
interface HostResultToolRuntime {
|
|
19
|
+
tools: HostToolRegistry;
|
|
20
|
+
on(name: string, listener: (...args: never[]) => unknown): unknown;
|
|
21
|
+
}
|
|
15
22
|
/** Rejects schema keywords that DSH structured-output tools cannot compile. */
|
|
16
23
|
export declare function assertDshOutputSchema(schema: unknown, path?: string): void;
|
|
17
24
|
export interface DelegatedRecallResult {
|
|
@@ -66,10 +73,11 @@ export declare class MnemonSubagentCoordinator {
|
|
|
66
73
|
private readonly subagents;
|
|
67
74
|
private readonly runtimeMemoryOrSource?;
|
|
68
75
|
private readonly documents?;
|
|
76
|
+
private readonly resultRuntime?;
|
|
69
77
|
private readonly counters;
|
|
70
78
|
private runtimeQueue;
|
|
71
79
|
private documentQueue;
|
|
72
|
-
constructor(subagents: HostSubagentsService, runtimeMemoryOrSource?: (RuntimeMemoryController | AgentRuntimeSource) | undefined, documents?: DocumentManager | undefined);
|
|
80
|
+
constructor(subagents: HostSubagentsService, runtimeMemoryOrSource?: (RuntimeMemoryController | AgentRuntimeSource) | undefined, documents?: DocumentManager | undefined, resultRuntime?: HostResultToolRuntime | undefined);
|
|
73
81
|
snapshot(): SubagentCounters;
|
|
74
82
|
documentsSnapshot(parent: HostAgent): import("./documents.ts").DocumentSnapshot;
|
|
75
83
|
documentGet(parent: HostAgent, id: string): DocumentView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Three-tier memory control plane for DeepSeek Harness: persistent runtime context, searchable project documents, pluggable long-term memory, smart routing, supervised agent workflows, WebUI, and headless tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|