dsh-mnemon 0.2.16 → 0.3.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.
Files changed (108) hide show
  1. package/README.md +16 -8
  2. package/README.zh-CN.md +16 -8
  3. package/SECURITY.md +12 -5
  4. package/lib/client.js +294 -33
  5. package/lib/contracts.js +36 -0
  6. package/lib/extension-sdk.js +238 -0
  7. package/lib/index.js +1944 -2865
  8. package/lib/kernel.js +1126 -0
  9. package/lib/layers/documents.js +31 -0
  10. package/lib/layers/memory-spaces.js +34 -0
  11. package/lib/layers/runtime.js +27 -0
  12. package/lib/provider-sdk.js +2 -0
  13. package/lib/registry-B9SdBRLo.js +2423 -0
  14. package/lib/strategy-default-three-tier.js +99 -0
  15. package/lib/strategy-sdk.js +56 -0
  16. package/lib/types/packages/contracts/src/index.d.ts +221 -0
  17. package/lib/types/packages/extension-sdk/src/index.d.ts +54 -0
  18. package/lib/types/packages/kernel/src/access.d.ts +14 -0
  19. package/lib/types/packages/kernel/src/catalog.d.ts +42 -0
  20. package/lib/types/packages/kernel/src/index.d.ts +5 -0
  21. package/lib/types/packages/kernel/src/kernel.d.ts +46 -0
  22. package/lib/types/packages/kernel/src/topology.d.ts +25 -0
  23. package/lib/types/packages/kernel/src/view.d.ts +78 -0
  24. package/lib/types/packages/layer-documents/src/index.d.ts +4 -0
  25. package/lib/types/packages/layer-memory-spaces/src/index.d.ts +4 -0
  26. package/lib/types/packages/layer-runtime/src/index.d.ts +4 -0
  27. package/lib/types/packages/provider-sdk/src/index.d.ts +19 -0
  28. package/lib/types/packages/strategy-default-three-tier/src/index.d.ts +7 -0
  29. package/lib/types/packages/strategy-sdk/src/index.d.ts +35 -0
  30. package/lib/types/{client → src/client}/api.d.ts +2 -1
  31. package/lib/types/{client → src/client}/locales.d.ts +38 -0
  32. package/lib/types/{contracts.d.ts → src/contracts.d.ts} +3 -0
  33. package/lib/types/{documents.d.ts → src/documents.d.ts} +7 -2
  34. package/lib/types/src/guidance.d.ts +23 -0
  35. package/lib/types/{index.d.ts → src/index.d.ts} +3 -1
  36. package/lib/types/{lifecycle.d.ts → src/lifecycle.d.ts} +5 -9
  37. package/lib/types/{live-runtime.d.ts → src/live-runtime.d.ts} +30 -3
  38. package/lib/types/{memory-bodies.d.ts → src/memory-bodies.d.ts} +3 -0
  39. package/lib/types/src/memory-receipts.d.ts +21 -0
  40. package/lib/types/src/memory-system/access.d.ts +2 -0
  41. package/lib/types/src/memory-system/catalog.d.ts +2 -0
  42. package/lib/types/src/memory-system/contracts.d.ts +2 -0
  43. package/lib/types/src/memory-system/defaults.d.ts +6 -0
  44. package/lib/types/src/memory-system/index.d.ts +7 -0
  45. package/lib/types/src/memory-system/kernel.d.ts +2 -0
  46. package/lib/types/src/memory-system/topology.d.ts +2 -0
  47. package/lib/types/src/memory-system/view.d.ts +2 -0
  48. package/lib/types/src/memory-view.d.ts +15 -0
  49. package/lib/types/src/provider-sdk.d.ts +4 -0
  50. package/lib/types/src/providers/memory-system.d.ts +6 -0
  51. package/lib/types/src/providers/registry.d.ts +23 -0
  52. package/lib/types/{runtime-memory.d.ts → src/runtime-memory.d.ts} +14 -5
  53. package/lib/types/src/search-tokens.d.ts +5 -0
  54. package/lib/types/{service.d.ts → src/service.d.ts} +9 -1
  55. package/lib/types/{shared → src/shared}/contracts.d.ts +25 -0
  56. package/lib/types/{subagent.d.ts → src/subagent.d.ts} +29 -21
  57. package/lib/types/{tools.d.ts → src/tools.d.ts} +2 -9
  58. package/package.json +42 -6
  59. package/lib/types/guidance.d.ts +0 -11
  60. /package/lib/types/{activity.d.ts → src/activity.d.ts} +0 -0
  61. /package/lib/types/{channels.d.ts → src/channels.d.ts} +0 -0
  62. /package/lib/types/{client → src/client}/GlobalLocationSetting.d.ts +0 -0
  63. /package/lib/types/{client → src/client}/MnemonDialog.d.ts +0 -0
  64. /package/lib/types/{client → src/client}/MnemonLogo.d.ts +0 -0
  65. /package/lib/types/{client → src/client}/MnemonPackSection.d.ts +0 -0
  66. /package/lib/types/{client → src/client}/MnemonSaveAction.d.ts +0 -0
  67. /package/lib/types/{client → src/client}/MnemonSettingsCard.d.ts +0 -0
  68. /package/lib/types/{client → src/client}/MnemonTurnTail.d.ts +0 -0
  69. /package/lib/types/{client → src/client}/MnemonView.d.ts +0 -0
  70. /package/lib/types/{client → src/client}/MnemonViewAppearance.d.ts +0 -0
  71. /package/lib/types/{client → src/client}/ProviderIcon.d.ts +0 -0
  72. /package/lib/types/{client → src/client}/ProviderSettingsSection.d.ts +0 -0
  73. /package/lib/types/{client → src/client}/anchor.d.ts +0 -0
  74. /package/lib/types/{client → src/client}/dsh-compat.d.ts +0 -0
  75. /package/lib/types/{client → src/client}/index.d.ts +0 -0
  76. /package/lib/types/{client → src/client}/settings.d.ts +0 -0
  77. /package/lib/types/{client → src/client}/sidebar-entry.d.ts +0 -0
  78. /package/lib/types/{client → src/client}/use-request-version.d.ts +0 -0
  79. /package/lib/types/{client → src/client}/workspace-controller.d.ts +0 -0
  80. /package/lib/types/{client → src/client}/workspace-mount.d.ts +0 -0
  81. /package/lib/types/{commands.d.ts → src/commands.d.ts} +0 -0
  82. /package/lib/types/{config-values.d.ts → src/config-values.d.ts} +0 -0
  83. /package/lib/types/{config.d.ts → src/config.d.ts} +0 -0
  84. /package/lib/types/{pack.d.ts → src/pack.d.ts} +0 -0
  85. /package/lib/types/{process.d.ts → src/process.d.ts} +0 -0
  86. /package/lib/types/{provider-placement.d.ts → src/provider-placement.d.ts} +0 -0
  87. /package/lib/types/{providers → src/providers}/byterover.d.ts +0 -0
  88. /package/lib/types/{providers → src/providers}/catalog.d.ts +0 -0
  89. /package/lib/types/{providers → src/providers}/hindsight.d.ts +0 -0
  90. /package/lib/types/{providers → src/providers}/holographic.d.ts +0 -0
  91. /package/lib/types/{providers → src/providers}/honcho.d.ts +0 -0
  92. /package/lib/types/{providers → src/providers}/http.d.ts +0 -0
  93. /package/lib/types/{providers → src/providers}/mem0.d.ts +0 -0
  94. /package/lib/types/{providers → src/providers}/openviking.d.ts +0 -0
  95. /package/lib/types/{providers → src/providers}/provider.d.ts +0 -0
  96. /package/lib/types/{providers → src/providers}/retaindb.d.ts +0 -0
  97. /package/lib/types/{providers → src/providers}/supermemory.d.ts +0 -0
  98. /package/lib/types/{recall-quality → src/recall-quality}/contracts.d.ts +0 -0
  99. /package/lib/types/{recall-quality → src/recall-quality}/engine.d.ts +0 -0
  100. /package/lib/types/{recall-quality → src/recall-quality}/index.d.ts +0 -0
  101. /package/lib/types/{recall-quality → src/recall-quality}/policies.d.ts +0 -0
  102. /package/lib/types/{recall-quality → src/recall-quality}/registry.d.ts +0 -0
  103. /package/lib/types/{review-activity.d.ts → src/review-activity.d.ts} +0 -0
  104. /package/lib/types/{rpc.d.ts → src/rpc.d.ts} +0 -0
  105. /package/lib/types/{runner.d.ts → src/runner.d.ts} +0 -0
  106. /package/lib/types/{settings.d.ts → src/settings.d.ts} +0 -0
  107. /package/lib/types/{storage-scope.d.ts → src/storage-scope.d.ts} +0 -0
  108. /package/lib/types/{version-updates.d.ts → src/version-updates.d.ts} +0 -0
@@ -1,4 +1,6 @@
1
1
  import type { ConnectionHandle as DshClientConnectionHandle } from '@deepseek-ai/dsh-client-connection/client';
2
+ import type { MemoryLayerParticipation, MemorySystemDescriptor } from '../memory-system/contracts.ts';
3
+ export type { MemoryLayerParticipation, MemoryParticipationChannel, MemoryParticipationMode, MemorySystemDescriptor, MemoryTopologyDefinition, } from '../memory-system/contracts.ts';
2
4
  export declare const MNEMON_READ_CHANNEL = "/dsh-mnemon-read";
3
5
  export declare const MNEMON_ACTIVATION_CHANNEL = "/dsh-mnemon-activation";
4
6
  export declare const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write";
@@ -63,6 +65,26 @@ export type SettingsOperation = {
63
65
  path: string[];
64
66
  };
65
67
  export type StorageScopeKind = 'global' | 'workspace' | 'custom';
68
+ export interface MemoryLayerConfig {
69
+ enabled?: boolean;
70
+ participation?: Partial<MemoryLayerParticipation>;
71
+ adapterIds?: string[];
72
+ }
73
+ export interface MemoryTopologyConfig {
74
+ id?: string;
75
+ strategyId?: string;
76
+ layers?: Record<string, MemoryLayerConfig>;
77
+ }
78
+ export interface ResolvedMemoryLayerConfig {
79
+ enabled: boolean;
80
+ participation: MemoryLayerParticipation;
81
+ adapterIds: string[];
82
+ }
83
+ export interface ResolvedMemoryTopologyConfig {
84
+ id: string;
85
+ strategyId: string;
86
+ layers: Record<string, ResolvedMemoryLayerConfig>;
87
+ }
66
88
  export interface CustomPackConfig {
67
89
  id: string;
68
90
  name: string;
@@ -97,6 +119,7 @@ export interface Config {
97
119
  store?: string;
98
120
  timeoutMs?: number;
99
121
  defaultRecallLimit?: number;
122
+ memoryTopology?: MemoryTopologyConfig;
100
123
  recallQuality?: RecallQualityConfig;
101
124
  routingGuidance?: boolean;
102
125
  displayMode?: 'sidebar' | 'buildin';
@@ -169,6 +192,7 @@ export interface ResolvedConfig {
169
192
  store?: string;
170
193
  timeoutMs: number;
171
194
  defaultRecallLimit: number;
195
+ memoryTopology: ResolvedMemoryTopologyConfig;
172
196
  recallQuality: ResolvedRecallQualityConfig;
173
197
  routingGuidance: boolean;
174
198
  displayMode: 'sidebar' | 'buildin';
@@ -818,6 +842,7 @@ export interface StatusView {
818
842
  memoryBodyDirectory: string;
819
843
  memoryBodies: MemoryBodyView[];
820
844
  providerServices?: MemoryProviderRuntimeStatus[];
845
+ memorySystem?: MemorySystemDescriptor;
821
846
  lifecycle?: LifecycleSnapshot;
822
847
  documents?: DocumentSnapshot;
823
848
  storage?: StorageScopeCatalog;
@@ -1,17 +1,12 @@
1
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
- import type { Insight, MnemonService, RememberRequest, SearchRequest } from './service.ts';
4
+ import { type EdgeType, type Insight, type RememberRequest, type SearchRequest } from './service.ts';
5
5
  import { type PreparedMemoryPlacement } from './provider-placement.ts';
6
6
  import type { MemoryBodyMetadataMaintenanceResult, MemoryPlacementDecision, SubagentCounters } from './shared/contracts.ts';
7
+ import type { MnemonAgentRuntimeSource } from './live-runtime.ts';
7
8
  export type { SubagentCounters } from './shared/contracts.ts';
8
- interface AgentRuntimeSource {
9
- forAgent(agent: HostAgent): {
10
- service: MnemonService;
11
- runtimeMemory: RuntimeMemoryController;
12
- documents: DocumentManager;
13
- };
14
- }
9
+ type AgentRuntimeSource = Pick<MnemonAgentRuntimeSource, 'forAgent'>;
15
10
  interface HostToolRegistry {
16
11
  register(definition: ToolDefinition): unknown;
17
12
  }
@@ -21,18 +16,14 @@ interface HostResultToolRuntime {
21
16
  }
22
17
  /** Rejects schema keywords that DSH structured-output tools cannot compile. */
23
18
  export declare function assertDshOutputSchema(schema: unknown, path?: string): void;
24
- export interface DelegatedRecallResult {
19
+ export interface RecallResult {
25
20
  query: string;
26
21
  mode: string;
27
22
  results: Insight[];
28
23
  hint?: string;
29
- delegation: {
30
- runId: string;
31
- provider: string;
32
- summary: string;
33
- selectedMemoryBodyIds: string[];
34
- };
35
24
  }
25
+ /** Compatibility name for the v0.3 pre-release API. Recall no longer delegates. */
26
+ export type DelegatedRecallResult = RecallResult;
36
27
  export interface DelegatedWriteResult {
37
28
  delegated: true;
38
29
  runId: string;
@@ -61,7 +52,6 @@ export interface DelegatedAnswerResult {
61
52
  }
62
53
  export type CoordinatedRuntimeMemoryResult = RuntimeMemoryMutationResult & {
63
54
  maintenance?: {
64
- kind: 'mnemon-archive' | 'local-compaction';
65
55
  runId: string;
66
56
  provider: string;
67
57
  summary: string;
@@ -76,20 +66,33 @@ export declare class MnemonSubagentCoordinator {
76
66
  private readonly documents?;
77
67
  private readonly resultRuntime?;
78
68
  private readonly taskAgentModelResolver?;
79
- private readonly serviceOrSource?;
80
69
  private readonly counters;
81
70
  private runtimeQueue;
82
71
  private documentQueue;
72
+ private readonly retrievalTurns;
83
73
  constructor(subagents: HostSubagentsService, runtimeMemoryOrSource?: (RuntimeMemoryController | AgentRuntimeSource) | undefined, documents?: DocumentManager | undefined, resultRuntime?: HostResultToolRuntime | undefined, taskAgentModelResolver?: (() => {
84
74
  provider: string;
85
75
  model: string;
86
- } | undefined) | undefined, serviceOrSource?: (MnemonService | AgentRuntimeSource) | undefined);
76
+ } | undefined) | undefined);
87
77
  snapshot(): SubagentCounters;
88
78
  documentsSnapshot(parent: HostAgent): import("./documents.ts").DocumentSnapshot;
89
79
  documentGet(parent: HostAgent, id: string): DocumentView;
90
80
  documentSearch(parent: HostAgent, query: string, includeArchived?: boolean, limit?: number): Promise<import("./documents.ts").DocumentSearchResult>;
91
- recall(parent: HostAgent, request: SearchRequest, signal: AbortSignal): Promise<DelegatedRecallResult>;
92
- related(parent: HostAgent, id: string, memoryBodyId: string | undefined, signal: AbortSignal): Promise<DelegatedRecallResult>;
81
+ /** Admit at most one model-facing Documents query for one root turn. */
82
+ claimDocumentSearch(parent: HostAgent): boolean;
83
+ recall(parent: HostAgent, request: SearchRequest, signal: AbortSignal, options?: {
84
+ requirePinnedView?: boolean;
85
+ }): Promise<RecallResult>;
86
+ /** Bind a model read to the Source state pinned by its root turn. */
87
+ scopeRecallRequest(agent: HostAgent, request: SearchRequest, requirePinnedView?: boolean): SearchRequest;
88
+ private scopeRecallWithAuthority;
89
+ scopeRelatedMemoryBody(agent: HostAgent, memoryBodyId?: string, requirePinnedView?: boolean): string | undefined;
90
+ private scopeRelatedWithAuthority;
91
+ related(parent: HostAgent, id: string, memoryBodyId: string | undefined, signal: AbortSignal, options?: {
92
+ depth?: number;
93
+ edge?: EdgeType;
94
+ requirePinnedView?: boolean;
95
+ }): Promise<RecallResult>;
93
96
  placeProvider(parent: HostAgent, body: {
94
97
  name: string;
95
98
  description: string;
@@ -102,14 +105,19 @@ export declare class MnemonSubagentCoordinator {
102
105
  answer(parent: HostAgent, query: string, evidence: Insight[], signal: AbortSignal): Promise<DelegatedAnswerResult>;
103
106
  write(parent: HostAgent, operation: string, request: unknown, signal: AbortSignal): Promise<DelegatedWriteResult>;
104
107
  review(parent: HostAgent, signal: AbortSignal): Promise<DelegatedWriteResult>;
105
- private recallResult;
106
108
  private documentLocked;
107
109
  private archiveDocumentLocked;
108
110
  private runtimeLocked;
109
111
  private compactUserAndCommit;
112
+ private archiveRuntimeEntry;
110
113
  private delegate;
111
114
  private provider;
115
+ private recallAuthority;
116
+ private turnAuthority;
117
+ private turnRetrievalState;
118
+ private recordRecall;
112
119
  private runtimeMemoryFor;
113
120
  private serviceFor;
121
+ private assertAutomaticMemoryWrite;
114
122
  private documentsFor;
115
123
  }
@@ -1,17 +1,10 @@
1
1
  import type { HostContextShape } from './contracts.ts';
2
- import type { HostAgent } from './contracts.ts';
3
2
  import type { DocumentManager } from './documents.ts';
4
3
  import type { RuntimeMemoryController } from './runtime-memory.ts';
4
+ import type { MnemonAgentRuntimeSource } from './live-runtime.ts';
5
5
  import { MnemonSubagentCoordinator } from './subagent.ts';
6
6
  import { type MnemonService } from './service.ts';
7
- interface AgentRuntimeSource {
8
- readonly config: MnemonService['config'];
9
- forAgent(agent: HostAgent): {
10
- service: MnemonService;
11
- runtimeMemory: RuntimeMemoryController;
12
- documents: DocumentManager;
13
- };
14
- }
7
+ type AgentRuntimeSource = MnemonAgentRuntimeSource;
15
8
  /** Root calls delegate to a bounded child; memory-worker calls reach the deterministic service. */
16
9
  export declare function registerTools(ctx: HostContextShape, serviceOrSource: MnemonService | AgentRuntimeSource, coordinator: MnemonSubagentCoordinator, runtimeMemory?: RuntimeMemoryController, documents?: DocumentManager): void;
17
10
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-mnemon",
3
- "version": "0.2.16",
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.",
3
+ "version": "0.3.1",
4
+ "description": "Composable three-tier memory control plane for DeepSeek Harness: persistent runtime context, searchable project documents, pluggable long-term memory, guarded strategies, WebUI, and headless tools.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
7
7
  "deepseek-harness-plugin",
@@ -51,16 +51,52 @@
51
51
  },
52
52
  "type": "module",
53
53
  "main": "lib/index.js",
54
- "types": "lib/types/index.d.ts",
54
+ "types": "lib/types/src/index.d.ts",
55
55
  "exports": {
56
56
  ".": {
57
- "types": "./lib/types/index.d.ts",
57
+ "types": "./lib/types/src/index.d.ts",
58
58
  "default": "./lib/index.js"
59
59
  },
60
60
  "./client": {
61
- "types": "./lib/types/client/index.d.ts",
61
+ "types": "./lib/types/src/client/index.d.ts",
62
62
  "default": "./lib/client.js"
63
63
  },
64
+ "./contracts": {
65
+ "types": "./lib/types/packages/contracts/src/index.d.ts",
66
+ "default": "./lib/contracts.js"
67
+ },
68
+ "./kernel": {
69
+ "types": "./lib/types/packages/kernel/src/index.d.ts",
70
+ "default": "./lib/kernel.js"
71
+ },
72
+ "./extension-sdk": {
73
+ "types": "./lib/types/packages/extension-sdk/src/index.d.ts",
74
+ "default": "./lib/extension-sdk.js"
75
+ },
76
+ "./provider-sdk": {
77
+ "types": "./lib/types/src/provider-sdk.d.ts",
78
+ "default": "./lib/provider-sdk.js"
79
+ },
80
+ "./strategy-sdk": {
81
+ "types": "./lib/types/packages/strategy-sdk/src/index.d.ts",
82
+ "default": "./lib/strategy-sdk.js"
83
+ },
84
+ "./strategy-default-three-tier": {
85
+ "types": "./lib/types/packages/strategy-default-three-tier/src/index.d.ts",
86
+ "default": "./lib/strategy-default-three-tier.js"
87
+ },
88
+ "./layers/runtime": {
89
+ "types": "./lib/types/packages/layer-runtime/src/index.d.ts",
90
+ "default": "./lib/layers/runtime.js"
91
+ },
92
+ "./layers/documents": {
93
+ "types": "./lib/types/packages/layer-documents/src/index.d.ts",
94
+ "default": "./lib/layers/documents.js"
95
+ },
96
+ "./layers/memory-spaces": {
97
+ "types": "./lib/types/packages/layer-memory-spaces/src/index.d.ts",
98
+ "default": "./lib/layers/memory-spaces.js"
99
+ },
64
100
  "./package.json": "./package.json"
65
101
  },
66
102
  "files": [
@@ -96,7 +132,7 @@
96
132
  "test": "vitest run",
97
133
  "verify:build": "node scripts/verify-deterministic-build.mjs",
98
134
  "verify:headless": "node scripts/verify-headless-profile.mjs",
99
- "verify:package": "node scripts/verify-package-contents.mjs && pnpm run lint:package",
135
+ "verify:package": "node scripts/verify-package-contents.mjs && node scripts/verify-public-entries.mjs && pnpm run lint:package",
100
136
  "verify": "pnpm run typecheck && pnpm run test && pnpm run verify:build && pnpm run verify:headless && pnpm run verify:package"
101
137
  },
102
138
  "dependencies": {
@@ -1,11 +0,0 @@
1
- import type { HostAgent, HostContextShape } from './contracts.ts';
2
- import type { ResolvedConfig } from './config.ts';
3
- import type { RuntimeMemoryController } from './runtime-memory.ts';
4
- export declare const GUIDANCE_SECTION_NAME = "mnemon:routing";
5
- export declare const RUNTIME_MEMORY_CONTEXT_NAME = "mnemon:runtime-memory";
6
- export declare const ROUTING_GUIDANCE = "Use memory only by need. For substantial project records, search active Mnemon Documents before deep recall. Call mnemon_recall when durable history may matter or an exact prior detail is missing; never infer a missing historical rule. New explicit reusable facts normally go to mnemon_runtime_memory. A write completes only with a tool receipt.";
7
- export declare function registerGuidance(ctx: HostContextShape, config?: Pick<ResolvedConfig, 'routingGuidance'>): void;
8
- /** Project the latest committed USER.md/MEMORY.md as DSH's durable runtime-context snapshot. */
9
- export declare function registerRuntimeMemoryContext(ctx: HostContextShape, runtimeMemory: RuntimeMemoryController): void;
10
- /** Shadow the global fallback with the current Agent workspace's hot memory. */
11
- export declare function registerAgentRuntimeMemoryContext(agent: HostAgent, runtimeMemory: () => RuntimeMemoryController): () => void;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes