dsh-mnemon 0.3.3 → 0.3.5
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 +5 -3
- package/README.zh-CN.md +5 -3
- package/lib/client.js +126 -16
- package/lib/index.js +352 -110
- package/lib/types/src/client/MnemonTurnTail.d.ts +3 -2
- package/lib/types/src/client/MnemonView.d.ts +1 -1
- package/lib/types/src/client/api.d.ts +1 -0
- package/lib/types/src/client/dsh-compat.d.ts +34 -3
- package/lib/types/src/client/locales.d.ts +24 -0
- package/lib/types/src/client/subagent-token-usage.d.ts +3 -4
- package/lib/types/src/config-values.d.ts +5 -0
- package/lib/types/src/config.d.ts +1 -1
- package/lib/types/src/contracts.d.ts +18 -4
- package/lib/types/src/git-branch.d.ts +6 -0
- package/lib/types/src/memory-view.d.ts +8 -2
- package/lib/types/src/pack.d.ts +2 -1
- package/lib/types/src/rpc.d.ts +7 -7
- package/lib/types/src/runtime-memory.d.ts +22 -6
- package/lib/types/src/shared/contracts.d.ts +26 -1
- package/lib/types/src/subagent.d.ts +2 -1
- package/package.json +7 -5
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ClientConnectionHandle } from '../shared/contracts.ts';
|
|
2
|
-
import type { TurnTailOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
3
2
|
import { type MnemonAnchorPage } from './anchor.ts';
|
|
4
3
|
import type { MnemonKey } from './locales.ts';
|
|
5
4
|
export interface MnemonTurnTailProps {
|
|
@@ -15,6 +14,8 @@ export interface MnemonTurnTailProps {
|
|
|
15
14
|
/** Route a settled tool name to the workbench page that explains its effect. */
|
|
16
15
|
export declare function memoryPageForTool(name: string): MnemonAnchorPage;
|
|
17
16
|
/** Whether this entry renders for the owner; chain selectors decline quietly. */
|
|
18
|
-
export declare function selectMnemonTurnTail(owner:
|
|
17
|
+
export declare function selectMnemonTurnTail(owner: {
|
|
18
|
+
turn: unknown;
|
|
19
|
+
}): Record<string, never> | null;
|
|
19
20
|
/** One-line memory-activity bar under a completed turn; hides when the turn touched no memory. */
|
|
20
21
|
export declare const MnemonTurnTail: import("react").NamedExoticComponent<MnemonTurnTailProps>;
|
|
@@ -36,6 +36,7 @@ export declare class MnemonClient {
|
|
|
36
36
|
content?: string;
|
|
37
37
|
old_text?: string;
|
|
38
38
|
importance?: RuntimeMemoryImportance;
|
|
39
|
+
branches?: string[];
|
|
39
40
|
}): Promise<RuntimeMemoryMutationResult>;
|
|
40
41
|
documents(): Promise<DocumentSnapshot>;
|
|
41
42
|
document(id: string): Promise<DocumentView>;
|
|
@@ -6,15 +6,46 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client';
|
|
8
8
|
import type { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client';
|
|
9
|
-
import type {
|
|
9
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
10
10
|
import type { MnemonKey } from './locales.ts';
|
|
11
11
|
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
12
12
|
interface LocaleNamespaceMap {
|
|
13
13
|
mnemon: MnemonKey;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export interface MnemonSessionSummary {
|
|
17
|
+
cwd?: string;
|
|
18
|
+
origin?: string;
|
|
19
|
+
projectionValues?: Readonly<Record<string, unknown>>;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface MnemonSessionListState {
|
|
23
|
+
current?: string;
|
|
24
|
+
byId: Record<string, MnemonSessionSummary>;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface MnemonWorkspaceSummary {
|
|
28
|
+
workspaceId: unknown;
|
|
29
|
+
title: string;
|
|
30
|
+
path: string;
|
|
31
|
+
}
|
|
32
|
+
export interface MnemonWorkspaceListState {
|
|
33
|
+
items: MnemonWorkspaceSummary[];
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface SnapshotStore<State> {
|
|
37
|
+
getSnapshot(): State;
|
|
38
|
+
subscribe(listener: () => void): () => void;
|
|
39
|
+
}
|
|
40
|
+
/** Context shared by the released client runtime and the 0.1.2 controller split. */
|
|
41
|
+
export type MnemonClientContext = Context & {
|
|
18
42
|
connection: ConnectionHandle;
|
|
19
43
|
locale: LocaleRuntime;
|
|
44
|
+
sessions: {
|
|
45
|
+
list: SnapshotStore<MnemonSessionListState>;
|
|
46
|
+
};
|
|
47
|
+
workspaces: {
|
|
48
|
+
list: SnapshotStore<MnemonWorkspaceListState>;
|
|
49
|
+
};
|
|
20
50
|
};
|
|
51
|
+
export {};
|
|
@@ -333,6 +333,10 @@ export declare const zh: {
|
|
|
333
333
|
'runtime.importance.critical': string;
|
|
334
334
|
'runtime.importance.normal': string;
|
|
335
335
|
'runtime.importance.low': string;
|
|
336
|
+
'runtime.branches': string;
|
|
337
|
+
'runtime.branchesPlaceholder': string;
|
|
338
|
+
'runtime.branchesHint': string;
|
|
339
|
+
'runtime.branchBadge': string;
|
|
336
340
|
'runtime.empty': string;
|
|
337
341
|
'runtime.editContent': string;
|
|
338
342
|
'runtime.editAction': string;
|
|
@@ -706,6 +710,13 @@ export declare const zh: {
|
|
|
706
710
|
'config.customHintShort': string;
|
|
707
711
|
'config.customSelected': string;
|
|
708
712
|
'config.globalScopeHint': string;
|
|
713
|
+
'config.runtimeUserScopeTitle': string;
|
|
714
|
+
'config.runtimeUserScopeDescription': string;
|
|
715
|
+
'config.runtimeUserScopeAria': string;
|
|
716
|
+
'config.runtimeUserScopeStorage': string;
|
|
717
|
+
'config.runtimeUserScopeStorageHint': string;
|
|
718
|
+
'config.runtimeUserScopeGlobal': string;
|
|
719
|
+
'config.runtimeUserScopeGlobalHint': string;
|
|
709
720
|
'config.topologyTitle': string;
|
|
710
721
|
'config.topologyDescription': string;
|
|
711
722
|
'config.topologyLoading': string;
|
|
@@ -826,6 +837,7 @@ export declare const zh: {
|
|
|
826
837
|
'config.customDirectoryHint': string;
|
|
827
838
|
'config.customPlaceholder': string;
|
|
828
839
|
'config.invalidScope': string;
|
|
840
|
+
'config.invalidRuntimeUserScope': string;
|
|
829
841
|
'config.customRequired': string;
|
|
830
842
|
'config.customAbsolute': string;
|
|
831
843
|
'config.saveFailed': string;
|
|
@@ -1228,6 +1240,10 @@ export declare const en: {
|
|
|
1228
1240
|
'runtime.importance.critical': string;
|
|
1229
1241
|
'runtime.importance.normal': string;
|
|
1230
1242
|
'runtime.importance.low': string;
|
|
1243
|
+
'runtime.branches': string;
|
|
1244
|
+
'runtime.branchesPlaceholder': string;
|
|
1245
|
+
'runtime.branchesHint': string;
|
|
1246
|
+
'runtime.branchBadge': string;
|
|
1231
1247
|
'runtime.empty': string;
|
|
1232
1248
|
'runtime.editContent': string;
|
|
1233
1249
|
'runtime.editAction': string;
|
|
@@ -1601,6 +1617,13 @@ export declare const en: {
|
|
|
1601
1617
|
'config.customHintShort': string;
|
|
1602
1618
|
'config.customSelected': string;
|
|
1603
1619
|
'config.globalScopeHint': string;
|
|
1620
|
+
'config.runtimeUserScopeTitle': string;
|
|
1621
|
+
'config.runtimeUserScopeDescription': string;
|
|
1622
|
+
'config.runtimeUserScopeAria': string;
|
|
1623
|
+
'config.runtimeUserScopeStorage': string;
|
|
1624
|
+
'config.runtimeUserScopeStorageHint': string;
|
|
1625
|
+
'config.runtimeUserScopeGlobal': string;
|
|
1626
|
+
'config.runtimeUserScopeGlobalHint': string;
|
|
1604
1627
|
'config.topologyTitle': string;
|
|
1605
1628
|
'config.topologyDescription': string;
|
|
1606
1629
|
'config.topologyLoading': string;
|
|
@@ -1721,6 +1744,7 @@ export declare const en: {
|
|
|
1721
1744
|
'config.customDirectoryHint': string;
|
|
1722
1745
|
'config.customPlaceholder': string;
|
|
1723
1746
|
'config.invalidScope': string;
|
|
1747
|
+
'config.invalidRuntimeUserScope': string;
|
|
1724
1748
|
'config.customRequired': string;
|
|
1725
1749
|
'config.customAbsolute': string;
|
|
1726
1750
|
'config.saveFailed': string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { SessionListState } from '@deepseek-ai/dsh-client-runtime/client';
|
|
2
1
|
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
-
import type { MnemonClientContext } from './dsh-compat.ts';
|
|
2
|
+
import type { MnemonClientContext, MnemonSessionListState } from './dsh-compat.ts';
|
|
4
3
|
export declare const MNEMON_SUBAGENT_TOKEN_USAGE_KEY = "mnemonSubagentTokenUsage";
|
|
5
4
|
export interface MnemonTokenUsageProjection {
|
|
6
5
|
uncachedInputTokens: number;
|
|
@@ -13,9 +12,9 @@ export interface MnemonTokenUsageProjection {
|
|
|
13
12
|
* released official catalog component. All other consumers continue seeing
|
|
14
13
|
* DSH's complete-log `tokenUsage` value.
|
|
15
14
|
*/
|
|
16
|
-
export declare function scopeSubagentTokenUsage(state:
|
|
15
|
+
export declare function scopeSubagentTokenUsage(state: MnemonSessionListState): MnemonSessionListState;
|
|
17
16
|
/** Wrap the framework hook while preserving its selector/equality contract. */
|
|
18
|
-
export declare function createScopedUseSessions(useSessions: SnapshotSelectorHook<
|
|
17
|
+
export declare function createScopedUseSessions(useSessions: SnapshotSelectorHook<MnemonSessionListState>): SnapshotSelectorHook<MnemonSessionListState>;
|
|
19
18
|
/**
|
|
20
19
|
* Shadow the released official single-slot entry at a lower priority. The
|
|
21
20
|
* component and action factory are captured from the public slot ledger, so
|
|
@@ -7,4 +7,9 @@ export declare const DEFAULT_RECALL_HIGH_SCORE_THRESHOLD = 0.6;
|
|
|
7
7
|
export declare const DEFAULT_RECALL_CANDIDATE_MULTIPLIER = 3;
|
|
8
8
|
export declare const DEFAULT_RECALL_MAX_MEDIUM_RESULTS = 4;
|
|
9
9
|
export declare const DEFAULT_RECALL_MAX_UNKNOWN_RESULTS = 2;
|
|
10
|
+
export declare const DEFAULT_RUNTIME_MEMORY_LIMIT_BYTES: number;
|
|
11
|
+
export declare const DEFAULT_RUNTIME_USER_LIMIT_BYTES: number;
|
|
12
|
+
export declare const DEFAULT_RUNTIME_MAINTENANCE_MAX_TOKENS = 8192;
|
|
13
|
+
export declare const MAX_RUNTIME_MEMORY_LIMIT_BYTES: number;
|
|
14
|
+
export declare const MAX_RUNTIME_MAINTENANCE_MAX_TOKENS = 1000000;
|
|
10
15
|
export { DEFAULT_EMBEDDING_ENDPOINT, DEFAULT_EMBEDDING_MODEL } from './shared/contracts.ts';
|
|
@@ -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_EMBEDDING_ENDPOINT, DEFAULT_EMBEDDING_MODEL, 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';
|
|
3
|
+
export { DEFAULT_IDLE_REVIEW_MS, DEFAULT_EMBEDDING_ENDPOINT, DEFAULT_EMBEDDING_MODEL, 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_RUNTIME_MAINTENANCE_MAX_TOKENS, DEFAULT_RUNTIME_MEMORY_LIMIT_BYTES, DEFAULT_RUNTIME_USER_LIMIT_BYTES, DEFAULT_TIMEOUT_MS, MAX_RUNTIME_MAINTENANCE_MAX_TOKENS, MAX_RUNTIME_MEMORY_LIMIT_BYTES, } from './config-values.ts';
|
|
4
4
|
export type Config = SharedConfig;
|
|
5
5
|
export type CustomPackConfig = SharedCustomPackConfig;
|
|
6
6
|
export type InteractionConfig = SharedInteractionConfig;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { RpcResult, SettingsOperation } from './shared/contracts.ts';
|
|
2
2
|
export type { ClientConnectionHandle, ClientSettingsScope, ClientSettingsSnapshot, JsonPrimitive, JsonValue, RpcError, RpcResult, SettingsOperation, } from './shared/contracts.ts';
|
|
3
|
-
export type HostRpcHandler = (endpoint: string, payload: unknown) => Promise<RpcResult<unknown>>;
|
|
3
|
+
export type HostRpcHandler = (endpoint: string, payload: unknown, signal?: AbortSignal) => Promise<RpcResult<unknown>>;
|
|
4
4
|
export type HostRpcAuthority = 'trusted-host' | 'loopback';
|
|
5
|
+
/**
|
|
6
|
+
* DSH rc.2 requires this registration policy. DSH 0.1.2-alpha.1 accepts only
|
|
7
|
+
* the first two JavaScript arguments and safely ignores this trailing value.
|
|
8
|
+
* Keeping one unconditional call shape avoids runtime version detection.
|
|
9
|
+
*/
|
|
10
|
+
export interface HostRpcRegistrationOptions {
|
|
11
|
+
readonly authority: HostRpcAuthority;
|
|
12
|
+
}
|
|
5
13
|
export interface HostConnectionHandle {
|
|
6
14
|
rpc: {
|
|
7
|
-
handle(channel: string, handler: HostRpcHandler, options:
|
|
8
|
-
authority: HostRpcAuthority;
|
|
9
|
-
}): unknown;
|
|
15
|
+
handle(channel: string, handler: HostRpcHandler, options: HostRpcRegistrationOptions): unknown;
|
|
10
16
|
};
|
|
11
17
|
}
|
|
12
18
|
export interface HostSettingsScope<T> {
|
|
@@ -151,6 +157,14 @@ export interface HostAgent {
|
|
|
151
157
|
agentPreset?: string;
|
|
152
158
|
};
|
|
153
159
|
events: readonly HostSessionEvent[];
|
|
160
|
+
/**
|
|
161
|
+
* Model-visible event sequences, in order. Optional because not every host
|
|
162
|
+
* publishes a surface projection; when absent, callers fall back to
|
|
163
|
+
* session-scoped state.
|
|
164
|
+
*/
|
|
165
|
+
surface?: {
|
|
166
|
+
readonly nodes: readonly number[];
|
|
167
|
+
};
|
|
154
168
|
};
|
|
155
169
|
ctx: HostAgentContext;
|
|
156
170
|
followup(message: HostUserMessage): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the current git branch of a workspace root. Returns undefined when
|
|
3
|
+
* the directory is not a git working tree, HEAD is detached, or the probe
|
|
4
|
+
* fails or times out, so callers fall back to the unfiltered view.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveGitBranch(cwd?: string): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MemoryTurnViewManager } from '../packages/kernel/src/index.ts';
|
|
1
|
+
import { MemoryTurnViewManager, type MemorySource } from '../packages/kernel/src/index.ts';
|
|
2
2
|
import type { DocumentManager } from './documents.ts';
|
|
3
3
|
import type { MemoryKernel } from './memory-system/kernel.ts';
|
|
4
4
|
import type { RuntimeMemoryController } from './runtime-memory.ts';
|
|
@@ -10,6 +10,12 @@ export interface DefaultMemorySources {
|
|
|
10
10
|
}
|
|
11
11
|
/** Compatibility name for the v0.3 pre-release API. */
|
|
12
12
|
export type DefaultMemoryViewSources = DefaultMemorySources;
|
|
13
|
-
export
|
|
13
|
+
export type BranchResolver = (cwd?: string) => string | undefined;
|
|
14
|
+
export interface DefaultMemoryTurnViewManagerOptions {
|
|
15
|
+
/** Override the git branch probe used for runtime branch scoping. Defaults to resolveGitBranch. */
|
|
16
|
+
resolveBranch?: BranchResolver;
|
|
17
|
+
}
|
|
18
|
+
export declare function createRuntimeMemorySource(runtimeMemory: RuntimeMemoryController, resolveBranch?: BranchResolver): MemorySource;
|
|
19
|
+
export declare function createDefaultMemoryTurnViewManager(kernel: MemoryKernel, sources: DefaultMemorySources, options?: DefaultMemoryTurnViewManagerOptions): MemoryTurnViewManager;
|
|
14
20
|
/** Compatibility name for the v0.3 pre-release API. */
|
|
15
21
|
export declare const createDefaultMemoryViewManager: typeof createDefaultMemoryTurnViewManager;
|
package/lib/types/src/pack.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export declare class MnemonPackManager {
|
|
|
14
14
|
private readonly afterImport;
|
|
15
15
|
private readonly now;
|
|
16
16
|
private readonly root;
|
|
17
|
-
|
|
17
|
+
private readonly runtimeLimits;
|
|
18
|
+
constructor(runner: MnemonRunner, config: Pick<ResolvedConfig, 'storageScope' | 'runtimeMemory'>, afterImport?: (components: MnemonPackComponent[]) => void, now?: () => Date);
|
|
18
19
|
target(): {
|
|
19
20
|
root: string;
|
|
20
21
|
scope: ResolvedConfig['storageScope'];
|
package/lib/types/src/rpc.d.ts
CHANGED
|
@@ -9,14 +9,14 @@ import { VersionUpdateManager } from './version-updates.ts';
|
|
|
9
9
|
export { MNEMON_ACTIVATION_CHANNEL, MNEMON_PACK_CHANNEL, MNEMON_READ_CHANNEL, MNEMON_WRITE_CHANNEL } from './channels.ts';
|
|
10
10
|
type RuntimeInput = MnemonService | LiveMnemonRuntime;
|
|
11
11
|
export declare function createReadHandler(input: RuntimeInput, lifecycle?: MnemonLifecycle, runtimeMemory?: RuntimeMemoryController, storage?: StorageScopeInspector, versions?: VersionUpdateManager): HostRpcHandler;
|
|
12
|
-
/**
|
|
13
|
-
* Expose only DSH read-routing activation to trusted Web hosts. Metadata,
|
|
14
|
-
* provider connections, credentials, and durable memory writes stay on the
|
|
15
|
-
* loopback-only write channel.
|
|
16
|
-
*/
|
|
12
|
+
/** Keep activation on a narrow, independently validated control endpoint. */
|
|
17
13
|
export declare function createActivationHandler(input: RuntimeInput): HostRpcHandler;
|
|
18
14
|
export declare function createWriteHandler(input: RuntimeInput, lifecycle?: MnemonLifecycle, runtimeMemory?: RuntimeMemoryController, versions?: VersionUpdateManager): HostRpcHandler;
|
|
19
|
-
/** Backup payloads contain private memory and
|
|
15
|
+
/** Backup payloads contain private memory and stay behind DSH browser authentication. */
|
|
20
16
|
export declare function createPackHandler(input: MnemonPackManager | LiveMnemonRuntime, writeEnabled?: boolean | (() => boolean)): HostRpcHandler;
|
|
21
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Register one call shape across DSH rc.2 and 0.1.2-alpha.1. The former
|
|
19
|
+
* enforces channel authority; the latter ignores the trailing options object
|
|
20
|
+
* after applying its uniform browser-session authentication boundary.
|
|
21
|
+
*/
|
|
22
22
|
export declare function registerRpc(connection: HostConnectionHandle, input: RuntimeInput, lifecycle?: MnemonLifecycle, runtimeMemory?: RuntimeMemoryController, storage?: StorageScopeInspector, packs?: MnemonPackManager, versions?: VersionUpdateManager, managementAuthority?: HostRpcAuthority): void;
|
|
@@ -5,10 +5,11 @@ import type { RuntimeMemoryAction, RuntimeMemoryCompactedEntry, RuntimeMemoryEnt
|
|
|
5
5
|
export type { RuntimeMemoryAction, RuntimeMemoryCompactedEntry, RuntimeMemoryEntry, RuntimeMemoryImportance, RuntimeMemoryMutation, RuntimeMemoryMutationResult, RuntimeMemorySnapshot, RuntimeMemoryTarget, RuntimeMemoryTargetView, RuntimeMemoryUsage, } from './shared/contracts.ts';
|
|
6
6
|
export declare const RUNTIME_MEMORY_VERSION = 1;
|
|
7
7
|
export declare const RUNTIME_ENTRY_DELIMITER = "\n\u00A7\n";
|
|
8
|
-
export
|
|
8
|
+
export interface RuntimeMemoryLimits {
|
|
9
9
|
readonly memory: number;
|
|
10
10
|
readonly user: number;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
export declare const RUNTIME_MEMORY_LIMITS: RuntimeMemoryLimits;
|
|
12
13
|
export declare const RUNTIME_MEMORY_PROTOCOL: string;
|
|
13
14
|
export interface RuntimeMemoryContextProjection {
|
|
14
15
|
revision: string;
|
|
@@ -37,6 +38,10 @@ export declare class RuntimeMemoryCapacityError extends Error {
|
|
|
37
38
|
export declare class RuntimeMemoryConflictError extends Error {
|
|
38
39
|
constructor();
|
|
39
40
|
}
|
|
41
|
+
export declare const RUNTIME_BRANCH_NAME_MAX = 128;
|
|
42
|
+
export declare const RUNTIME_BRANCHES_PER_ENTRY_MAX = 16;
|
|
43
|
+
/** Validate a model-supplied branch scope. Returns the normalized list; an empty list means "no scope". */
|
|
44
|
+
export declare function normalizeRuntimeBranches(value: unknown, field?: string): string[];
|
|
40
45
|
/**
|
|
41
46
|
* Single authority for hot memory. JSON is the durable source of truth;
|
|
42
47
|
* Markdown files are deterministic projections consumed by prompt assembly.
|
|
@@ -46,15 +51,26 @@ export declare class RuntimeMemoryController {
|
|
|
46
51
|
private readonly recordCommit?;
|
|
47
52
|
readonly directory: string;
|
|
48
53
|
readonly sourcePath: string;
|
|
54
|
+
readonly userSourcePath: string;
|
|
49
55
|
readonly memoryPath: string;
|
|
50
56
|
readonly userPath: string;
|
|
51
57
|
readonly lockPath: string;
|
|
58
|
+
readonly limits: RuntimeMemoryLimits;
|
|
52
59
|
private queue;
|
|
53
|
-
|
|
60
|
+
private readonly localUserPath;
|
|
61
|
+
private readonly userController;
|
|
62
|
+
constructor(runner: Pick<MnemonRunner, 'effectiveDataDir'>, now?: () => Date, recordCommit?: AuthorityCommitRecorder | undefined, limits?: RuntimeMemoryLimits, userRunner?: Pick<MnemonRunner, 'effectiveDataDir'>);
|
|
54
63
|
snapshot(): RuntimeMemorySnapshot;
|
|
55
|
-
contextText(): string;
|
|
56
|
-
/**
|
|
57
|
-
|
|
64
|
+
contextText(branch?: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Read the exact Runtime revision and its prompt projection from each
|
|
67
|
+
* configured authority root.
|
|
68
|
+
* When a git branch is supplied, target=memory entries scoped to other
|
|
69
|
+
* branches are hidden from the projection; the on-disk Markdown files and
|
|
70
|
+
* the source JSON always remain complete.
|
|
71
|
+
*/
|
|
72
|
+
contextProjection(branch?: string): RuntimeMemoryContextProjection;
|
|
73
|
+
private localContextProjection;
|
|
58
74
|
mutate(request: RuntimeMemoryMutation): Promise<RuntimeMemoryMutationResult>;
|
|
59
75
|
/** Resolve exactly which committed entries survive a blocked mutation and are safe to compact. */
|
|
60
76
|
planMaintenance(request: RuntimeMemoryMutation): Promise<RuntimeMemoryMaintenancePlan>;
|
|
@@ -104,6 +104,19 @@ export interface RecallQualityConfig {
|
|
|
104
104
|
/** Maximum unknown-scale or unscored rows admitted by the strict policy. */
|
|
105
105
|
maxUnknownResults?: number;
|
|
106
106
|
}
|
|
107
|
+
export interface RuntimeMemoryConfig {
|
|
108
|
+
/** Maximum UTF-8 bytes projected into MEMORY.md. */
|
|
109
|
+
memoryLimitBytes?: number;
|
|
110
|
+
/** Maximum UTF-8 bytes projected into USER.md. */
|
|
111
|
+
userLimitBytes?: number;
|
|
112
|
+
/** Completion-token budget for Runtime migration and compaction workers. */
|
|
113
|
+
maintenanceMaxTokens?: number;
|
|
114
|
+
}
|
|
115
|
+
export interface ResolvedRuntimeMemoryConfig {
|
|
116
|
+
memoryLimitBytes: number;
|
|
117
|
+
userLimitBytes: number;
|
|
118
|
+
maintenanceMaxTokens: number;
|
|
119
|
+
}
|
|
107
120
|
export interface ResolvedRecallQualityConfig {
|
|
108
121
|
policy: string;
|
|
109
122
|
lowScoreThreshold: number;
|
|
@@ -114,6 +127,8 @@ export interface ResolvedRecallQualityConfig {
|
|
|
114
127
|
}
|
|
115
128
|
export interface Config {
|
|
116
129
|
storageScope?: StorageScopeKind;
|
|
130
|
+
/** Whether USER.md follows the selected storage root or stays in the global root. */
|
|
131
|
+
runtimeUserScope?: 'storage' | 'global';
|
|
117
132
|
cliPath?: string;
|
|
118
133
|
dataDir?: string;
|
|
119
134
|
customPackId?: string;
|
|
@@ -121,6 +136,7 @@ export interface Config {
|
|
|
121
136
|
store?: string;
|
|
122
137
|
timeoutMs?: number;
|
|
123
138
|
defaultRecallLimit?: number;
|
|
139
|
+
runtimeMemory?: RuntimeMemoryConfig;
|
|
124
140
|
/** Optional DSH-owned overrides injected into every Mnemon CLI process. */
|
|
125
141
|
embedding?: MnemonEmbeddingConfig;
|
|
126
142
|
memoryTopology?: MemoryTopologyConfig;
|
|
@@ -129,7 +145,7 @@ export interface Config {
|
|
|
129
145
|
displayMode?: 'sidebar' | 'buildin';
|
|
130
146
|
tabEnabled?: boolean;
|
|
131
147
|
writeEnabled?: boolean;
|
|
132
|
-
/**
|
|
148
|
+
/** DSH rc.2 management-channel authority; ignored by DSH 0.1.2-alpha.1. */
|
|
133
149
|
remoteAccess?: 'read-only' | 'trusted-host';
|
|
134
150
|
lifecycleEnabled?: boolean;
|
|
135
151
|
recallMode?: 'guided' | 'off';
|
|
@@ -202,11 +218,13 @@ export interface InteractionConfig {
|
|
|
202
218
|
}
|
|
203
219
|
export interface ResolvedConfig {
|
|
204
220
|
storageScope: StorageScopeKind;
|
|
221
|
+
runtimeUserScope: 'storage' | 'global';
|
|
205
222
|
cliPath?: string;
|
|
206
223
|
dataDir?: string;
|
|
207
224
|
store?: string;
|
|
208
225
|
timeoutMs: number;
|
|
209
226
|
defaultRecallLimit: number;
|
|
227
|
+
runtimeMemory: ResolvedRuntimeMemoryConfig;
|
|
210
228
|
embedding: ResolvedMnemonEmbeddingConfig;
|
|
211
229
|
memoryTopology: ResolvedMemoryTopologyConfig;
|
|
212
230
|
recallQuality: ResolvedRecallQualityConfig;
|
|
@@ -214,6 +232,7 @@ export interface ResolvedConfig {
|
|
|
214
232
|
displayMode: 'sidebar' | 'buildin';
|
|
215
233
|
tabEnabled: boolean;
|
|
216
234
|
writeEnabled: boolean;
|
|
235
|
+
/** DSH rc.2 management-channel authority; ignored by DSH 0.1.2-alpha.1. */
|
|
217
236
|
remoteAccess: 'read-only' | 'trusted-host';
|
|
218
237
|
lifecycleEnabled: boolean;
|
|
219
238
|
recallMode: 'guided' | 'off';
|
|
@@ -683,6 +702,8 @@ export interface RuntimeMemoryEntry {
|
|
|
683
702
|
updated_at: string;
|
|
684
703
|
target: RuntimeMemoryTarget;
|
|
685
704
|
importance: RuntimeMemoryImportance;
|
|
705
|
+
/** Optional git branch names that limit where this entry is projected. Absent means every branch. */
|
|
706
|
+
branches?: string[];
|
|
686
707
|
}
|
|
687
708
|
export interface RuntimeMemoryUsage {
|
|
688
709
|
used: number;
|
|
@@ -704,6 +725,8 @@ export interface RuntimeMemorySnapshot {
|
|
|
704
725
|
export interface RuntimeMemoryCompactedEntry {
|
|
705
726
|
content: string;
|
|
706
727
|
importance: RuntimeMemoryImportance;
|
|
728
|
+
/** Branch scope carried through compaction; absent means the entry is visible on every branch. */
|
|
729
|
+
branches?: string[];
|
|
707
730
|
}
|
|
708
731
|
export interface RuntimeMemoryMutation {
|
|
709
732
|
action: RuntimeMemoryAction;
|
|
@@ -711,6 +734,8 @@ export interface RuntimeMemoryMutation {
|
|
|
711
734
|
content?: string;
|
|
712
735
|
oldText?: string;
|
|
713
736
|
importance?: RuntimeMemoryImportance;
|
|
737
|
+
/** Git branch names limiting where a target=memory entry is projected. Absent keeps the current scope on replace; an empty list clears it. */
|
|
738
|
+
branches?: string[];
|
|
714
739
|
}
|
|
715
740
|
export type RuntimeMemoryMutationResult = {
|
|
716
741
|
success: true;
|
|
@@ -66,6 +66,7 @@ export declare class MnemonSubagentCoordinator {
|
|
|
66
66
|
private readonly documents?;
|
|
67
67
|
private readonly resultRuntime?;
|
|
68
68
|
private readonly taskAgentModelResolver?;
|
|
69
|
+
private readonly runtimeMaintenanceMaxTokensResolver?;
|
|
69
70
|
private readonly counters;
|
|
70
71
|
private runtimeQueue;
|
|
71
72
|
private documentQueue;
|
|
@@ -73,7 +74,7 @@ export declare class MnemonSubagentCoordinator {
|
|
|
73
74
|
constructor(subagents: HostSubagentsService, runtimeMemoryOrSource?: (RuntimeMemoryController | AgentRuntimeSource) | undefined, documents?: DocumentManager | undefined, resultRuntime?: HostResultToolRuntime | undefined, taskAgentModelResolver?: (() => {
|
|
74
75
|
provider: string;
|
|
75
76
|
model: string;
|
|
76
|
-
} | undefined) | undefined);
|
|
77
|
+
} | undefined) | undefined, runtimeMaintenanceMaxTokensResolver?: (() => number) | undefined);
|
|
77
78
|
snapshot(): SubagentCounters;
|
|
78
79
|
documentsSnapshot(parent: HostAgent): import("./documents.ts").DocumentSnapshot;
|
|
79
80
|
documentGet(parent: HostAgent, id: string): DocumentView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
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",
|
|
@@ -114,9 +114,9 @@
|
|
|
114
114
|
},
|
|
115
115
|
"client": {
|
|
116
116
|
"inject": [
|
|
117
|
-
"@deepseek-ai/dsh-client-runtime",
|
|
118
117
|
"@deepseek-ai/dsh-client-connection",
|
|
119
118
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
119
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
120
120
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
121
121
|
"@deepseek-ai/dsh-client-locale"
|
|
122
122
|
],
|
|
@@ -133,7 +133,9 @@
|
|
|
133
133
|
"verify:build": "node scripts/verify-deterministic-build.mjs",
|
|
134
134
|
"verify:headless": "node scripts/verify-headless-profile.mjs",
|
|
135
135
|
"verify:package": "node scripts/verify-package-contents.mjs && node scripts/verify-public-entries.mjs && pnpm run lint:package",
|
|
136
|
-
"verify": "pnpm run typecheck && pnpm run test && pnpm run verify:build && pnpm run verify:headless && pnpm run verify:package"
|
|
136
|
+
"verify": "pnpm run typecheck && pnpm run test && pnpm run verify:build && pnpm run verify:headless && pnpm run verify:package",
|
|
137
|
+
"dsh:link-source": "node scripts/link-dsh-source.mjs",
|
|
138
|
+
"dsh:restore-registry": "node scripts/link-dsh-source.mjs --restore"
|
|
137
139
|
},
|
|
138
140
|
"dependencies": {
|
|
139
141
|
"fflate": "^0.8.3",
|
|
@@ -142,7 +144,7 @@
|
|
|
142
144
|
"zod": "^4.4.3"
|
|
143
145
|
},
|
|
144
146
|
"peerDependencies": {
|
|
145
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-rc.1",
|
|
147
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
|
|
146
148
|
"react": "^18.2.0",
|
|
147
149
|
"react-dom": "^18.2.0"
|
|
148
150
|
},
|
|
@@ -152,9 +154,9 @@
|
|
|
152
154
|
"@deepseek-ai/dsh": "0.1.1-rc.2",
|
|
153
155
|
"@deepseek-ai/dsh-client-connection": "0.1.1-rc.2",
|
|
154
156
|
"@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
|
|
155
|
-
"@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
|
|
156
157
|
"@deepseek-ai/dsh-client-ui-conversation": "0.1.1-rc.2",
|
|
157
158
|
"@deepseek-ai/dsh-client-ui-primitives": "0.1.1-rc.2",
|
|
159
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.1-rc.2",
|
|
158
160
|
"@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
|
|
159
161
|
"@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
|
|
160
162
|
"@deepseek-ai/dsh-client-ui-tool": "0.1.1-rc.2",
|