dsh-mnemon 0.3.5 → 0.4.0

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/lib/kernel.js CHANGED
@@ -837,6 +837,7 @@ var MemoryTurnViewManager = class {
837
837
  sourceGeneration = 0;
838
838
  views = /* @__PURE__ */ new Map();
839
839
  turns = /* @__PURE__ */ new Map();
840
+ retainedViews = /* @__PURE__ */ new Map();
840
841
  pendingReceipts = /* @__PURE__ */ new Map();
841
842
  current;
842
843
  currentByScope = /* @__PURE__ */ new Map();
@@ -922,6 +923,17 @@ var MemoryTurnViewManager = class {
922
923
  return existing;
923
924
  }
924
925
  const view = await this.reconcile(scope);
926
+ return this.pinTurn(id, scope, view.id);
927
+ }
928
+ /** Pin an already-authorized View without re-snapshotting a newer Source. */
929
+ pinTurn(turnId, scope, viewId) {
930
+ const id = text(turnId, "memory turn id", 300);
931
+ const view = this.requireStoredView(viewId).view;
932
+ const existing = this.turns.get(id);
933
+ if (existing !== void 0) {
934
+ if (!sameScope(existing.scope, scope) || existing.viewId !== view.id) throw new Error(`memory turn authority changed while pinned: ${id}`);
935
+ return existing;
936
+ }
925
937
  const context = deepFreeze({
926
938
  turnId: id,
927
939
  viewId: view.id,
@@ -932,6 +944,20 @@ var MemoryTurnViewManager = class {
932
944
  this.turns.set(id, context);
933
945
  return context;
934
946
  }
947
+ /** Keep a delegated View available independently of the originating turn. */
948
+ retainView(viewId) {
949
+ const id = this.requireStoredView(viewId).view.id;
950
+ this.retainedViews.set(id, (this.retainedViews.get(id) ?? 0) + 1);
951
+ let retained = true;
952
+ return () => {
953
+ if (!retained) return;
954
+ retained = false;
955
+ const count = this.retainedViews.get(id) ?? 0;
956
+ if (count > 1) this.retainedViews.set(id, count - 1);
957
+ else this.retainedViews.delete(id);
958
+ this.collect();
959
+ };
960
+ }
935
961
  turn(turnId) {
936
962
  return this.turns.get(turnId);
937
963
  }
@@ -939,6 +965,26 @@ var MemoryTurnViewManager = class {
939
965
  const id = text(agentId, "memory agent id", 300);
940
966
  return [...this.turns.values()].findLast((turn) => turn.scope.agentId === id);
941
967
  }
968
+ /**
969
+ * Latest reconciled View for inspection, not execution authority. A child
970
+ * must retain its delegated View and pin its own turn instead of inheriting
971
+ * whatever its parent's later turns happen to publish.
972
+ */
973
+ lastViewForAgent(agentId) {
974
+ const id = text(agentId, "memory agent id", 300);
975
+ let match;
976
+ for (const [key, view] of this.currentByScope) {
977
+ let owner;
978
+ try {
979
+ owner = JSON.parse(key).agentId;
980
+ } catch {
981
+ continue;
982
+ }
983
+ if (owner !== id) continue;
984
+ if (match === void 0 || view.createdAt > match.createdAt) match = view;
985
+ }
986
+ return match;
987
+ }
942
988
  endTurn(turnId) {
943
989
  const deleted = this.turns.delete(turnId);
944
990
  if (deleted) this.collect();
@@ -1113,6 +1159,7 @@ var MemoryTurnViewManager = class {
1113
1159
  collect() {
1114
1160
  if (this.views.size <= this.maxViews) return;
1115
1161
  const pinned = new Set([...this.turns.values()].map((turn) => turn.viewId));
1162
+ for (const id of this.retainedViews.keys()) pinned.add(id);
1116
1163
  if (this.current !== void 0) pinned.add(this.current.id);
1117
1164
  for (const id of this.views.keys()) {
1118
1165
  if (this.views.size <= this.maxViews) break;
@@ -38,6 +38,7 @@ export declare class MemoryTurnViewManager {
38
38
  private sourceGeneration;
39
39
  private readonly views;
40
40
  private readonly turns;
41
+ private readonly retainedViews;
41
42
  private readonly pendingReceipts;
42
43
  private current;
43
44
  private readonly currentByScope;
@@ -59,8 +60,18 @@ export declare class MemoryTurnViewManager {
59
60
  pendingReceiptCount(): number;
60
61
  apply(receipt: MemoryReceipt): boolean;
61
62
  beginTurn(turnId: string, scope: MemoryOperationScope): Promise<MemoryTurnContext>;
63
+ /** Pin an already-authorized View without re-snapshotting a newer Source. */
64
+ pinTurn(turnId: string, scope: MemoryOperationScope, viewId: string): MemoryTurnContext;
65
+ /** Keep a delegated View available independently of the originating turn. */
66
+ retainView(viewId: string): () => void;
62
67
  turn(turnId: string): MemoryTurnContext | undefined;
63
68
  activeTurn(agentId: string): MemoryTurnContext | undefined;
69
+ /**
70
+ * Latest reconciled View for inspection, not execution authority. A child
71
+ * must retain its delegated View and pin its own turn instead of inheriting
72
+ * whatever its parent's later turns happen to publish.
73
+ */
74
+ lastViewForAgent(agentId: string): MemoryTurnView | undefined;
64
75
  endTurn(turnId: string): boolean;
65
76
  wake(viewId: string): MemoryWake;
66
77
  /** Compile and publish a candidate. On failure, preserve the last valid scoped View. */
@@ -0,0 +1,42 @@
1
+ import type { MemoryOperationScope, MemoryTurnContext } from '../packages/contracts/src/index.ts';
2
+ import type { MemoryTurnViewManager } from '../packages/kernel/src/index.ts';
3
+ import type { HostAgent } from './contracts.ts';
4
+ import type { MnemonAgentRuntimeSource, MnemonRuntimeGraph } from './live-runtime.ts';
5
+ /** Host-owned authority captured before a child activation starts executing. */
6
+ export interface DelegatedMemoryView {
7
+ readonly graph: MnemonRuntimeGraph;
8
+ readonly scope: MemoryOperationScope;
9
+ readonly viewId?: string;
10
+ }
11
+ export interface PinnedAgentMemoryTurn {
12
+ readonly turn: number;
13
+ readonly graph: MnemonRuntimeGraph;
14
+ readonly manager: MemoryTurnViewManager;
15
+ readonly context: MemoryTurnContext;
16
+ readonly releaseRuntime?: () => void;
17
+ }
18
+ export declare function agentMemoryScope(agent: HostAgent, graph: MnemonRuntimeGraph): MemoryOperationScope;
19
+ /** The durable log, not a parent session id, identifies the executing turn. */
20
+ export declare function openAgentTurn(agent: HostAgent): number | undefined;
21
+ /**
22
+ * One Agent owns each turn pin. A child additionally retains its delegation
23
+ * across parent completion, collection, and runtime swaps until it is disposed.
24
+ */
25
+ export declare class AgentMemoryTurn {
26
+ private readonly agent;
27
+ private readonly runtime;
28
+ private readonly delegation?;
29
+ private pinned;
30
+ private pending;
31
+ private generation;
32
+ private closed;
33
+ private readonly releaseDelegation;
34
+ constructor(agent: HostAgent, runtime: Pick<MnemonAgentRuntimeSource, 'forAgent' | 'bindAgentRuntime'>, delegation?: DelegatedMemoryView | undefined);
35
+ get current(): PinnedAgentMemoryTurn | undefined;
36
+ /** Capture now; descendants must not resolve a later parent turn on demand. */
37
+ delegate(): DelegatedMemoryView;
38
+ begin(turn: number, signal?: AbortSignal): Promise<void>;
39
+ end(turn?: number): void;
40
+ dispose(): void;
41
+ private pin;
42
+ }
@@ -1,13 +1,11 @@
1
1
  import { type ClientConnectionHandle, type ClientSettingsScope, type Config } from '../shared/contracts.ts';
2
2
  import { type MnemonTranslate } from './locales.ts';
3
- import { type MnemonViewSurface } from './MnemonViewAppearance.tsx';
4
3
  export interface MnemonViewProps {
5
4
  connection: ClientConnectionHandle;
6
5
  settingsScope: ClientSettingsScope<Config>;
7
6
  sessionId?: string;
8
7
  workspaceId?: string;
9
8
  workspaceSelection?: MnemonWorkspaceSelection;
10
- surface?: MnemonViewSurface;
11
9
  t?: MnemonTranslate;
12
10
  locale?: string;
13
11
  onClose?: () => void;
@@ -5,8 +5,8 @@
5
5
  * A dispatch asks the Mnemon view to open a page (optionally with a seed) in
6
6
  * the session the dispatch came from. The view may not be mounted when the
7
7
  * user clicks — the dispatch is then held per session and consumed the next
8
- * time that session's Mnemon view mounts, so switching to the Memory System
9
- * tab afterwards still lands on the requested page.
8
+ * time that session's Mnemon workspace mounts, so opening Memory System from
9
+ * the sidebar afterwards still lands on the requested page or write dialog.
10
10
  */
11
11
  /** Pages of the Mnemon workspace, mirroring MnemonView's internal Page union. */
12
12
  export type MnemonAnchorPage = 'overview' | 'runtime' | 'documents' | 'explore' | 'entities' | 'remember' | 'list' | 'status';
@@ -10,28 +10,16 @@ export declare const zh: {
10
10
  'category.context': string;
11
11
  'category.general': string;
12
12
  'nav.aria': string;
13
- 'nav.group.system': string;
14
- 'nav.group.storage': string;
15
- 'nav.group.tools': string;
16
13
  'nav.memory.aria': string;
17
14
  'nav.overview': string;
18
15
  'nav.bodies': string;
19
- 'nav.bodies.detail': string;
20
16
  'nav.runtime': string;
21
- 'nav.runtime.detail': string;
22
17
  'nav.documents': string;
23
- 'nav.documents.detail': string;
24
18
  'nav.search': string;
25
- 'nav.search.detail': string;
26
19
  'nav.entities': string;
27
- 'nav.entities.detail': string;
28
- 'nav.remember': string;
29
20
  'nav.rememberAction': string;
30
- 'nav.remember.detail': string;
31
21
  'nav.content': string;
32
- 'nav.content.detail': string;
33
22
  'nav.status': string;
34
- 'nav.status.detail': string;
35
23
  'common.refresh': string;
36
24
  'common.loading': string;
37
25
  'common.cancel': string;
@@ -54,8 +42,6 @@ export declare const zh: {
54
42
  'header.backToConversation': string;
55
43
  'header.checking': string;
56
44
  'header.connected': string;
57
- 'header.connectedWithCount': string;
58
- 'header.directoryPending': string;
59
45
  'header.unavailable': string;
60
46
  'header.notReady': string;
61
47
  'workspace.viewing': string;
@@ -64,17 +50,9 @@ export declare const zh: {
64
50
  'workspace.storageModeAria': string;
65
51
  'workspace.mismatchTitle': string;
66
52
  'workspace.mismatchShort': string;
67
- 'workspace.mismatchDescription': string;
68
53
  'workspace.selectedRoot': string;
69
54
  'workspace.effectiveRoot': string;
70
55
  'workspace.align': string;
71
- 'telemetry.aria': string;
72
- 'telemetry.title': string;
73
- 'telemetry.memories': string;
74
- 'telemetry.graph': string;
75
- 'telemetry.entities': string;
76
- 'telemetry.spaces': string;
77
- 'sidebar.activeSpaces': string;
78
56
  'overview.title': string;
79
57
  'overview.description': string;
80
58
  'overview.pageDescription': string;
@@ -133,7 +111,6 @@ export declare const zh: {
133
111
  'overview.noActiveText': string;
134
112
  'overview.noContentTitle': string;
135
113
  'overview.noContentText': string;
136
- 'overview.create': string;
137
114
  'overview.createTitle': string;
138
115
  'overview.createDialogHint': string;
139
116
  'overview.createIdentityTitle': string;
@@ -337,12 +314,10 @@ export declare const zh: {
337
314
  'runtime.branchesPlaceholder': string;
338
315
  'runtime.branchesHint': string;
339
316
  'runtime.branchBadge': string;
340
- 'runtime.empty': string;
341
317
  'runtime.editContent': string;
342
318
  'runtime.editAction': string;
343
319
  'runtime.saveEdit': string;
344
320
  'runtime.removeAction': string;
345
- 'runtime.removeConfirm': string;
346
321
  'runtime.removeTitle': string;
347
322
  'runtime.removeWarning': string;
348
323
  'runtime.result.add': string;
@@ -422,7 +397,6 @@ export declare const zh: {
422
397
  'graph.aria': string;
423
398
  'graph.kindSpace': string;
424
399
  'graph.kindEntity': string;
425
- 'card.confirmAria': string;
426
400
  'card.confirmText': string;
427
401
  'card.processing': string;
428
402
  'card.confirmForget': string;
@@ -499,17 +473,8 @@ export declare const zh: {
499
473
  'entities.emptyText': string;
500
474
  'remember.title': string;
501
475
  'remember.description': string;
502
- 'remember.worker': string;
503
476
  'remember.readOnlyTitle': string;
504
477
  'remember.readOnlyText': string;
505
- 'remember.flowTitle': string;
506
- 'remember.routeTitle': string;
507
- 'remember.routeText': string;
508
- 'remember.dedupeTitle': string;
509
- 'remember.dedupeText': string;
510
- 'remember.writeTitle': string;
511
- 'remember.writeText': string;
512
- 'remember.flowText': string;
513
478
  'remember.delegateTitle': string;
514
479
  'remember.noSession': string;
515
480
  'remember.ready': string;
@@ -692,13 +657,6 @@ export declare const zh: {
692
657
  'config.ready': string;
693
658
  'config.noticeBefore': string;
694
659
  'config.noticeAfter': string;
695
- 'config.displayTitle': string;
696
- 'config.displayDescription': string;
697
- 'config.displayAria': string;
698
- 'config.displaySidebar': string;
699
- 'config.displaySidebarHint': string;
700
- 'config.displayBuildin': string;
701
- 'config.displayBuildinHint': string;
702
660
  'config.storageTitle': string;
703
661
  'config.storageDescription': string;
704
662
  'config.scope': string;
@@ -748,6 +706,13 @@ export declare const zh: {
748
706
  'config.embeddingManagedHint': string;
749
707
  'config.embeddingEndpoint': string;
750
708
  'config.embeddingModel': string;
709
+ 'config.embeddingApiKey': string;
710
+ 'config.embeddingApiKeyInvalid': string;
711
+ 'config.embeddingProtocol': string;
712
+ 'config.embeddingProtocolAuto': string;
713
+ 'config.embeddingProtocolOllama': string;
714
+ 'config.embeddingProtocolOpenai': string;
715
+ 'config.embeddingProtocolInvalid': string;
751
716
  'config.embeddingEndpointInvalid': string;
752
717
  'config.embeddingModelInvalid': string;
753
718
  'config.embeddingSecurity': string;
@@ -757,7 +722,9 @@ export declare const zh: {
757
722
  'config.embeddingSaveBeforeTest': string;
758
723
  'config.embeddingTestUnavailable': string;
759
724
  'config.embeddingStatusAvailable': string;
725
+ 'config.embeddingStatusAvailableWithProtocol': string;
760
726
  'config.embeddingStatusUnavailable': string;
727
+ 'config.embeddingStatusUnavailableWithProtocol': string;
761
728
  'config.embeddingStatusFailed': string;
762
729
  'config.providerGlobalLocation': string;
763
730
  'config.providerGlobalLocationHint': string;
@@ -917,28 +884,16 @@ export declare const en: {
917
884
  'category.context': string;
918
885
  'category.general': string;
919
886
  'nav.aria': string;
920
- 'nav.group.system': string;
921
- 'nav.group.storage': string;
922
- 'nav.group.tools': string;
923
887
  'nav.memory.aria': string;
924
888
  'nav.overview': string;
925
889
  'nav.bodies': string;
926
- 'nav.bodies.detail': string;
927
890
  'nav.runtime': string;
928
- 'nav.runtime.detail': string;
929
891
  'nav.documents': string;
930
- 'nav.documents.detail': string;
931
892
  'nav.search': string;
932
- 'nav.search.detail': string;
933
893
  'nav.entities': string;
934
- 'nav.entities.detail': string;
935
- 'nav.remember': string;
936
894
  'nav.rememberAction': string;
937
- 'nav.remember.detail': string;
938
895
  'nav.content': string;
939
- 'nav.content.detail': string;
940
896
  'nav.status': string;
941
- 'nav.status.detail': string;
942
897
  'common.refresh': string;
943
898
  'common.loading': string;
944
899
  'common.cancel': string;
@@ -961,8 +916,6 @@ export declare const en: {
961
916
  'header.backToConversation': string;
962
917
  'header.checking': string;
963
918
  'header.connected': string;
964
- 'header.connectedWithCount': string;
965
- 'header.directoryPending': string;
966
919
  'header.unavailable': string;
967
920
  'header.notReady': string;
968
921
  'workspace.viewing': string;
@@ -971,17 +924,9 @@ export declare const en: {
971
924
  'workspace.storageModeAria': string;
972
925
  'workspace.mismatchTitle': string;
973
926
  'workspace.mismatchShort': string;
974
- 'workspace.mismatchDescription': string;
975
927
  'workspace.selectedRoot': string;
976
928
  'workspace.effectiveRoot': string;
977
929
  'workspace.align': string;
978
- 'telemetry.aria': string;
979
- 'telemetry.title': string;
980
- 'telemetry.memories': string;
981
- 'telemetry.graph': string;
982
- 'telemetry.entities': string;
983
- 'telemetry.spaces': string;
984
- 'sidebar.activeSpaces': string;
985
930
  'overview.title': string;
986
931
  'overview.description': string;
987
932
  'overview.pageDescription': string;
@@ -1040,7 +985,6 @@ export declare const en: {
1040
985
  'overview.noActiveText': string;
1041
986
  'overview.noContentTitle': string;
1042
987
  'overview.noContentText': string;
1043
- 'overview.create': string;
1044
988
  'overview.createTitle': string;
1045
989
  'overview.createDialogHint': string;
1046
990
  'overview.createIdentityTitle': string;
@@ -1244,12 +1188,10 @@ export declare const en: {
1244
1188
  'runtime.branchesPlaceholder': string;
1245
1189
  'runtime.branchesHint': string;
1246
1190
  'runtime.branchBadge': string;
1247
- 'runtime.empty': string;
1248
1191
  'runtime.editContent': string;
1249
1192
  'runtime.editAction': string;
1250
1193
  'runtime.saveEdit': string;
1251
1194
  'runtime.removeAction': string;
1252
- 'runtime.removeConfirm': string;
1253
1195
  'runtime.removeTitle': string;
1254
1196
  'runtime.removeWarning': string;
1255
1197
  'runtime.result.add': string;
@@ -1329,7 +1271,6 @@ export declare const en: {
1329
1271
  'graph.aria': string;
1330
1272
  'graph.kindSpace': string;
1331
1273
  'graph.kindEntity': string;
1332
- 'card.confirmAria': string;
1333
1274
  'card.confirmText': string;
1334
1275
  'card.processing': string;
1335
1276
  'card.confirmForget': string;
@@ -1406,17 +1347,8 @@ export declare const en: {
1406
1347
  'entities.emptyText': string;
1407
1348
  'remember.title': string;
1408
1349
  'remember.description': string;
1409
- 'remember.worker': string;
1410
1350
  'remember.readOnlyTitle': string;
1411
1351
  'remember.readOnlyText': string;
1412
- 'remember.flowTitle': string;
1413
- 'remember.routeTitle': string;
1414
- 'remember.routeText': string;
1415
- 'remember.dedupeTitle': string;
1416
- 'remember.dedupeText': string;
1417
- 'remember.writeTitle': string;
1418
- 'remember.writeText': string;
1419
- 'remember.flowText': string;
1420
1352
  'remember.delegateTitle': string;
1421
1353
  'remember.noSession': string;
1422
1354
  'remember.ready': string;
@@ -1599,13 +1531,6 @@ export declare const en: {
1599
1531
  'config.ready': string;
1600
1532
  'config.noticeBefore': string;
1601
1533
  'config.noticeAfter': string;
1602
- 'config.displayTitle': string;
1603
- 'config.displayDescription': string;
1604
- 'config.displayAria': string;
1605
- 'config.displaySidebar': string;
1606
- 'config.displaySidebarHint': string;
1607
- 'config.displayBuildin': string;
1608
- 'config.displayBuildinHint': string;
1609
1534
  'config.storageTitle': string;
1610
1535
  'config.storageDescription': string;
1611
1536
  'config.scope': string;
@@ -1655,6 +1580,13 @@ export declare const en: {
1655
1580
  'config.embeddingManagedHint': string;
1656
1581
  'config.embeddingEndpoint': string;
1657
1582
  'config.embeddingModel': string;
1583
+ 'config.embeddingApiKey': string;
1584
+ 'config.embeddingApiKeyInvalid': string;
1585
+ 'config.embeddingProtocol': string;
1586
+ 'config.embeddingProtocolAuto': string;
1587
+ 'config.embeddingProtocolOllama': string;
1588
+ 'config.embeddingProtocolOpenai': string;
1589
+ 'config.embeddingProtocolInvalid': string;
1658
1590
  'config.embeddingEndpointInvalid': string;
1659
1591
  'config.embeddingModelInvalid': string;
1660
1592
  'config.embeddingSecurity': string;
@@ -1664,7 +1596,9 @@ export declare const en: {
1664
1596
  'config.embeddingSaveBeforeTest': string;
1665
1597
  'config.embeddingTestUnavailable': string;
1666
1598
  'config.embeddingStatusAvailable': string;
1599
+ 'config.embeddingStatusAvailableWithProtocol': string;
1667
1600
  'config.embeddingStatusUnavailable': string;
1601
+ 'config.embeddingStatusUnavailableWithProtocol': string;
1668
1602
  'config.embeddingStatusFailed': string;
1669
1603
  'config.providerGlobalLocation': string;
1670
1604
  'config.providerGlobalLocationHint': string;
@@ -0,0 +1,2 @@
1
+ /** Compose shared view styles with the fixed sidebar skin. */
2
+ export declare function appearanceClass(base: string | undefined, sidebar: string | undefined): string;
@@ -12,4 +12,4 @@ export declare const DEFAULT_RUNTIME_USER_LIMIT_BYTES: number;
12
12
  export declare const DEFAULT_RUNTIME_MAINTENANCE_MAX_TOKENS = 8192;
13
13
  export declare const MAX_RUNTIME_MEMORY_LIMIT_BYTES: number;
14
14
  export declare const MAX_RUNTIME_MAINTENANCE_MAX_TOKENS = 1000000;
15
- export { DEFAULT_EMBEDDING_ENDPOINT, DEFAULT_EMBEDDING_MODEL } from './shared/contracts.ts';
15
+ export { DEFAULT_EMBEDDING_ENDPOINT, DEFAULT_EMBEDDING_MODEL, DEFAULT_EMBEDDING_PROTOCOL, MNEMON_EMBEDDING_PROTOCOLS } 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_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';
3
+ export { DEFAULT_IDLE_REVIEW_MS, DEFAULT_EMBEDDING_ENDPOINT, DEFAULT_EMBEDDING_MODEL, DEFAULT_EMBEDDING_PROTOCOL, 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;
@@ -136,7 +136,15 @@ export type HostPreStepDecision = {
136
136
  messages: HostUserMessage[];
137
137
  };
138
138
  export interface HostAgentContext {
139
- on(name: string, listener: (...args: never[]) => unknown): () => unknown;
139
+ /**
140
+ * `options` is optional and forwarded verbatim to the host. `prepend`
141
+ * places the listener at the head of the chain, which for a waterfall
142
+ * means it observes the fully assembled result. Omitting it keeps the
143
+ * previous two-argument behaviour exactly.
144
+ */
145
+ on(name: string, listener: (...args: never[]) => unknown, options?: {
146
+ prepend?: boolean;
147
+ }): () => unknown;
140
148
  effect(callback: () => (() => unknown) | void, label?: string): () => unknown;
141
149
  get?(name: string): unknown;
142
150
  }
@@ -284,6 +292,14 @@ export interface HostContextShape {
284
292
  /** Cordis service publication; optional only for narrow test/headless shims. */
285
293
  provide?(name: string, value?: unknown, check?: () => boolean): unknown;
286
294
  inject(services: string[], callback: (ctx: HostContextShape) => void): unknown;
287
- on(name: string, listener: (...args: never[]) => unknown): () => unknown;
295
+ /**
296
+ * `options` is optional and forwarded verbatim to the host. `prepend`
297
+ * places the listener at the head of the chain, which for a waterfall
298
+ * means it observes the fully assembled result. Omitting it keeps the
299
+ * previous two-argument behaviour exactly.
300
+ */
301
+ on(name: string, listener: (...args: never[]) => unknown, options?: {
302
+ prepend?: boolean;
303
+ }): () => unknown;
288
304
  effect(callback: () => (() => unknown) | void, label?: string): () => unknown;
289
305
  }
@@ -6,6 +6,7 @@ export declare const GUIDANCE_SECTION_NAME = "mnemon:routing";
6
6
  export declare const RUNTIME_MEMORY_PROTOCOL_SECTION_NAME = "mnemon:runtime-memory-protocol";
7
7
  export declare const RUNTIME_MEMORY_CONTEXT_NAME = "mnemon:runtime-memory";
8
8
  export declare const ROUTING_GUIDANCE = "Use memory only when needed. Search Mnemon Documents for substantial project records. Call mnemon_recall for durable history or exact prior details; never infer a missing historical rule. Put only new user facts or explicit save/correction requests in mnemon_runtime_memory; never cache retrieved evidence. A write exists only after its receipt.";
9
+ export declare function memoryPromptText(value: string): string;
9
10
  /** Replace the already-materialized Agent protocol and context with the Wake pinned during assembly. */
10
11
  export declare function applyAgentMemoryViewWake<T extends {
11
12
  sections: Array<{
@@ -22,6 +22,8 @@ export declare class MnemonLifecycle {
22
22
  private readonly config;
23
23
  private readonly runtimeSource?;
24
24
  private readonly owners;
25
+ private readonly children;
26
+ private readonly memoryTurns;
25
27
  private readonly counters;
26
28
  /** Creation ids reserved before DSH publishes clean task-root Agents. */
27
29
  private readonly taskAgentIds;
@@ -73,4 +75,6 @@ export declare class MnemonLifecycle {
73
75
  private taskAgentModelRoute;
74
76
  private taskAgentModelOptions;
75
77
  private install;
78
+ /** Child memory ownership is independent of root-only reminders and idle review. */
79
+ private installChild;
76
80
  }
@@ -29,7 +29,7 @@ export interface MnemonRuntimeGraph {
29
29
  export interface MnemonAgentRuntimeSource {
30
30
  readonly config: ResolvedConfig;
31
31
  forAgent(agent: HostAgent): MnemonRuntimeGraph;
32
- /** Pin every tool in one Agent turn to the same immutable runtime generation. */
32
+ /** Retain one runtime generation for an Agent turn or delegated child lifetime. */
33
33
  bindAgentRuntime(agentId: string, graph: MnemonRuntimeGraph): () => void;
34
34
  }
35
35
  /**
@@ -10,6 +10,13 @@ export declare const MNEMON_SETTINGS_NAMESPACE = "mnemon";
10
10
  export declare const MNEMON_UI_SETTINGS_NAMESPACE = "mnemon-ui";
11
11
  export declare const DEFAULT_EMBEDDING_ENDPOINT = "http://localhost:11434";
12
12
  export declare const DEFAULT_EMBEDDING_MODEL = "nomic-embed-text";
13
+ export declare const EMBEDDING_PROTOCOL_AUTO = "auto";
14
+ export declare const EMBEDDING_PROTOCOL_OLLAMA = "ollama";
15
+ export declare const EMBEDDING_PROTOCOL_OPENAI = "openai";
16
+ /** Default protocol defers to Mnemon's /v1 auto-detection. */
17
+ export declare const DEFAULT_EMBEDDING_PROTOCOL = "auto";
18
+ /** Wire protocols accepted by the embedding protocol override; single source for schema, resolver, and UI validation. */
19
+ export declare const MNEMON_EMBEDDING_PROTOCOLS: readonly ["auto", "ollama", "openai"];
13
20
  export type JsonPrimitive = string | number | boolean | null;
14
21
  export type JsonValue = JsonPrimitive | JsonValue[] | {
15
22
  [key: string]: JsonValue;
@@ -142,7 +149,6 @@ export interface Config {
142
149
  memoryTopology?: MemoryTopologyConfig;
143
150
  recallQuality?: RecallQualityConfig;
144
151
  routingGuidance?: boolean;
145
- displayMode?: 'sidebar' | 'buildin';
146
152
  tabEnabled?: boolean;
147
153
  writeEnabled?: boolean;
148
154
  /** DSH rc.2 management-channel authority; ignored by DSH 0.1.2-alpha.1. */
@@ -161,16 +167,23 @@ export interface Config {
161
167
  /** Model route used by clean, session-independent maintenance Agents. */
162
168
  taskAgentModel?: TaskAgentModelConfig;
163
169
  }
170
+ export type MnemonEmbeddingProtocol = (typeof MNEMON_EMBEDDING_PROTOCOLS)[number];
164
171
  export interface MnemonEmbeddingConfig {
165
172
  /** When false or omitted, Mnemon keeps its inherited environment and built-in defaults. */
166
173
  enabled?: boolean;
167
174
  endpoint?: string;
168
175
  model?: string;
176
+ /** Optional Bearer token forwarded as MNEMON_EMBED_API_KEY for OpenAI-compatible endpoints. */
177
+ apiKey?: string;
178
+ /** Explicit wire-protocol override; 'auto' keeps Mnemon's /v1 auto-detection. */
179
+ protocol?: MnemonEmbeddingProtocol;
169
180
  }
170
181
  export interface ResolvedMnemonEmbeddingConfig {
171
182
  enabled: boolean;
172
183
  endpoint: string;
173
184
  model: string;
185
+ apiKey: string;
186
+ protocol: MnemonEmbeddingProtocol;
174
187
  }
175
188
  export interface TaskAgentModelConfig {
176
189
  mode?: 'inherit' | 'fixed';
@@ -229,7 +242,6 @@ export interface ResolvedConfig {
229
242
  memoryTopology: ResolvedMemoryTopologyConfig;
230
243
  recallQuality: ResolvedRecallQualityConfig;
231
244
  routingGuidance: boolean;
232
- displayMode: 'sidebar' | 'buildin';
233
245
  tabEnabled: boolean;
234
246
  writeEnabled: boolean;
235
247
  /** DSH rc.2 management-channel authority; ignored by DSH 0.1.2-alpha.1. */
@@ -249,6 +261,8 @@ export interface ResolvedConfig {
249
261
  export interface MnemonEmbeddingStatus {
250
262
  available: boolean;
251
263
  model: string;
264
+ /** Protocol Mnemon resolved for the embedding endpoint; omitted when the CLI does not report one. */
265
+ protocol?: string;
252
266
  totalInsights: number;
253
267
  embedded: number;
254
268
  coverage: string;
@@ -79,12 +79,12 @@ export declare class MnemonSubagentCoordinator {
79
79
  documentsSnapshot(parent: HostAgent): import("./documents.ts").DocumentSnapshot;
80
80
  documentGet(parent: HostAgent, id: string): DocumentView;
81
81
  documentSearch(parent: HostAgent, query: string, includeArchived?: boolean, limit?: number): Promise<import("./documents.ts").DocumentSearchResult>;
82
- /** Admit at most one model-facing Documents query for one root turn. */
82
+ /** Admit at most one model-facing Documents query for one executing turn. */
83
83
  claimDocumentSearch(parent: HostAgent): boolean;
84
84
  recall(parent: HostAgent, request: SearchRequest, signal: AbortSignal, options?: {
85
85
  requirePinnedView?: boolean;
86
86
  }): Promise<RecallResult>;
87
- /** Bind a model read to the Source state pinned by its root turn. */
87
+ /** Bind a model read to the Source state pinned by its own executing turn. */
88
88
  scopeRecallRequest(agent: HostAgent, request: SearchRequest, requirePinnedView?: boolean): SearchRequest;
89
89
  private scopeRecallWithAuthority;
90
90
  scopeRelatedMemoryBody(agent: HostAgent, memoryBodyId?: string, requirePinnedView?: boolean): string | undefined;
@@ -5,6 +5,6 @@ import type { MnemonAgentRuntimeSource } from './live-runtime.ts';
5
5
  import { MnemonSubagentCoordinator } from './subagent.ts';
6
6
  import { type MnemonService } from './service.ts';
7
7
  type AgentRuntimeSource = MnemonAgentRuntimeSource;
8
- /** Root calls delegate to a bounded child; memory-worker calls reach the deterministic service. */
8
+ /** Model tools use the executing Agent's pinned runtime and deterministic service. */
9
9
  export declare function registerTools(ctx: HostContextShape, serviceOrSource: MnemonService | AgentRuntimeSource, coordinator: MnemonSubagentCoordinator, runtimeMemory?: RuntimeMemoryController, documents?: DocumentManager): void;
10
10
  export {};