dsh-layers-hippocampus 1.9.9 → 1.9.21

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/src/webRoutes.js CHANGED
@@ -47,6 +47,9 @@ export const MEMORY_API = Object.freeze({
47
47
  layers: '/api/hippocampus/layers',
48
48
  // Escape hatch (v1.5.4): clear a wedged rollover/handoff state from the UI.
49
49
  sessionReset: '/api/hippocampus/session/reset',
50
+ // v1.9.15: the 「续接」 button's read model. Tiny on purpose — the sidebar polls
51
+ // it, and /stats (the whole panel payload) is far too heavy for that.
52
+ handoff: '/api/hippocampus/handoff',
50
53
  // Settings-page button: install the GitHub Orchestrator through the Host manager.
51
54
  orchestratorInstall: '/api/hippocampus/orchestrator/install',
52
55
  });
@@ -128,6 +131,17 @@ export const EDITABLE_CONFIG_KEYS = Object.freeze([
128
131
  'context.smartPrune.keepRecentTurns',
129
132
  'context.smartPrune.minChars',
130
133
  'context.smartPrune.maxNodes',
134
+ // v1.9.13 — the 1.9.8–1.9.11 knobs become the operator's. All of them are bounded,
135
+ // reversible, and have a visible effect in the status card; keeping them file-only
136
+ // meant the four most confusing behaviours of this plugin had no switch in the UI.
137
+ 'context.ownership',
138
+ 'context.smartPrune.onceFoldAt',
139
+ 'context.liveCompact.enabled',
140
+ 'handoff.minIntervalMs',
141
+ 'handoff.requestBudgetMs',
142
+ 'handoff.failFastBudgetMs',
143
+ 'handoff.commandBudgetMs',
144
+ 'handoff.maxRunMs',
131
145
  'context.statePointer.maxChars',
132
146
  'context.coldStartInjectSummary',
133
147
  'context.coldStartInjectRecentTurns',
@@ -670,6 +684,37 @@ export function createMemoryRoutes({ runtime, persist = null, logger = null }) {
670
684
  }
671
685
  };
672
686
 
687
+ /**
688
+ * v1.9.15: handoff → "continue in a new conversation".
689
+ *
690
+ * READ-ONLY and GET-only. It answers the exact questions the client half cannot
691
+ * answer for itself: is there a handoff summary worth continuing, which preset
692
+ * did it inherit, and will the Host inject the cold-start block on its own (in
693
+ * which case the client must NOT seed the draft with the same text).
694
+ *
695
+ * Not-ready is 409 with a body like every other route: a poller learns "the
696
+ * engine is migrating" instead of mistaking it for an empty handoff.
697
+ */
698
+ const handoffHandler = async (req, res) => {
699
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
700
+ sendState(res, 405, runtime, {
701
+ ok: false,
702
+ error: { code: 'MEM_E_INVALID_INPUT', message: 'handoff is read-only: use GET' },
703
+ });
704
+ return;
705
+ }
706
+ try {
707
+ if (stateOf(runtime) !== 'ready') {
708
+ sendState(res, 409, runtime, { ok: false, error: asMemoryError(runtime.notReady('handoff')).toJSON() });
709
+ return;
710
+ }
711
+ sendState(res, 200, runtime, { ok: true, handoff: runtime.handoffResume() });
712
+ } catch (error) {
713
+ log(`handoff view failed: ${error?.message ?? error}`);
714
+ fail(res, 500, error, runtime);
715
+ }
716
+ };
717
+
673
718
  const orchestratorInstallHandler = async (req, res) => {
674
719
  if (req.method !== 'POST') {
675
720
  sendState(res, 405, runtime, { ok: false, error: { code: 'MEM_E_INVALID_INPUT', message: 'use POST' } });
@@ -719,6 +764,7 @@ export function createMemoryRoutes({ runtime, persist = null, logger = null }) {
719
764
  { kind: 'exact', path: MEMORY_API.spaces, handler: storesHandler },
720
765
  { kind: 'exact', path: MEMORY_API.layers, handler: layersHandler },
721
766
  { kind: 'exact', path: MEMORY_API.sessionReset, handler: sessionResetHandler },
767
+ { kind: 'exact', path: MEMORY_API.handoff, handler: handoffHandler },
722
768
  { kind: 'exact', path: MEMORY_API.orchestratorInstall, handler: orchestratorInstallHandler },
723
769
  ];
724
770
  }