@try-works/dsh-memory 0.1.5 → 0.1.6
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/package.json +1 -1
- package/src/client/index.js +36 -26
package/package.json
CHANGED
package/src/client/index.js
CHANGED
|
@@ -618,38 +618,48 @@ window.__ModuleLoader__.load({
|
|
|
618
618
|
name: 'tool.call.toolview',
|
|
619
619
|
key: 'memory_map',
|
|
620
620
|
}, MemoryMapCard)))
|
|
621
|
-
// The
|
|
622
|
-
//
|
|
623
|
-
//
|
|
624
|
-
//
|
|
625
|
-
ctx.effect(() => ctx.uiSession.provide({
|
|
626
|
-
hooks: ['memoryMap'],
|
|
627
|
-
resolve: (binding) => {
|
|
628
|
-
const target = ctx.uiConversation.binding(binding).target('trajectory')
|
|
629
|
-
return {
|
|
630
|
-
hooks: {
|
|
631
|
-
memoryMap: {
|
|
632
|
-
getSnapshot: () => findMemorySnapshot(target.getSnapshot()),
|
|
633
|
-
subscribe: (listener) => target.subscribe(listener),
|
|
634
|
-
},
|
|
635
|
-
},
|
|
636
|
-
}
|
|
637
|
-
},
|
|
638
|
-
}), 'dsh-memory: memory map hook')
|
|
639
|
-
disposers.push(ctx.slots.inject('conversation.view', () => ctx.slots.register({
|
|
640
|
-
name: 'conversation.view',
|
|
641
|
-
id: 'memory',
|
|
642
|
-
// ui-chat holds 0 and ui-trajectory 10, so Memory sits after both without
|
|
643
|
-
// reordering anyone else's tab.
|
|
644
|
-
order: 20,
|
|
645
|
-
label: 'Memory',
|
|
646
|
-
}, MemoryTabView)))
|
|
621
|
+
// The settings page registers FIRST, and deliberately. It is the established surface;
|
|
622
|
+
// the tab below is newer and depends on two services the page does not need. Ordering
|
|
623
|
+
// the proven surface before the unproven one means a failure in the tab cannot take the
|
|
624
|
+
// settings page down with it - both halves share one file and one apply().
|
|
647
625
|
disposers.push(ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
648
626
|
name: 'settings.section',
|
|
649
627
|
id: 'memory',
|
|
650
628
|
order: 80,
|
|
651
629
|
label: 'Memory',
|
|
652
630
|
}, () => react.createElement(MemorySettings))))
|
|
631
|
+
// The Memory tab. Data arrives through a registered standard hook, because a
|
|
632
|
+
// conversation view is a slot and slots are fed by hooks, not by direct reads.
|
|
633
|
+
// The Trajectory target is the shipped assembly of this session's nodes, so the
|
|
634
|
+
// source re-derives the memory snapshot from it on every projection.
|
|
635
|
+
try {
|
|
636
|
+
ctx.effect(() => ctx.uiSession.provide({
|
|
637
|
+
hooks: ['memoryMap'],
|
|
638
|
+
resolve: (binding) => {
|
|
639
|
+
const target = ctx.uiConversation.binding(binding).target('trajectory')
|
|
640
|
+
return {
|
|
641
|
+
hooks: {
|
|
642
|
+
memoryMap: {
|
|
643
|
+
getSnapshot: () => findMemorySnapshot(target.getSnapshot()),
|
|
644
|
+
subscribe: (listener) => target.subscribe(listener),
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
}), 'dsh-memory: memory map hook')
|
|
650
|
+
disposers.push(ctx.slots.inject('conversation.view', () => ctx.slots.register({
|
|
651
|
+
name: 'conversation.view',
|
|
652
|
+
id: 'memory',
|
|
653
|
+
// ui-chat holds 0 and ui-trajectory 10, so Memory sits after both without
|
|
654
|
+
// reordering anyone else's tab.
|
|
655
|
+
order: 20,
|
|
656
|
+
label: 'Memory',
|
|
657
|
+
}, MemoryTabView)))
|
|
658
|
+
} catch (error) {
|
|
659
|
+
// Loud, not silent. A tab that fails to register is invisible by definition, so this
|
|
660
|
+
// warning is the only trace the failure can leave.
|
|
661
|
+
ctx.logger.warn('dsh-memory: Memory tab unavailable: ' + (error && error.message ? error.message : String(error)))
|
|
662
|
+
}
|
|
653
663
|
return () => { for (const dispose of disposers) dispose() }
|
|
654
664
|
}, 'dsh-memory: settings section')
|
|
655
665
|
}
|