dsh-daoing-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/lib/client.js CHANGED
@@ -6,7 +6,6 @@ window.__ModuleLoader__.load({
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let react = require("react");
9
- let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
10
9
  //#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
11
10
  var _a$1;
12
11
  function $constructor(name, initializer, params) {
@@ -7751,7 +7750,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7751
7750
  "data-memory-nav": true,
7752
7751
  "aria-label": "记忆监控",
7753
7752
  onClick: () => {
7754
- props.actions.select("experience");
7753
+ props.selectPage("experience");
7755
7754
  },
7756
7755
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "记忆" })
7757
7756
  });
@@ -7814,12 +7813,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7814
7813
  //#endregion
7815
7814
  //#region src/client/navStore.ts
7816
7815
  /**
7817
- * Memory monitoring nav store: shared viewing state between the session header
7818
- * entry (conversation.session.header.utilities) and the right-pane takeover (shell.overlay).
7819
- * One factory handle is created in apply and passed to both registrations so
7820
- * selecting a menu in the sidebar and rendering the matching page read the
7821
- * same state. Module level exports the factory only — a module-level handle
7822
- * would pin the store's identity across plugin reloads.
7816
+ * Memory monitoring nav state: shared viewing state between the session header
7817
+ * entry (conversation.session.header.utilities, scope "session") and the
7818
+ * right-pane takeover (shell.overlay, scope "root").
7819
+ *
7820
+ * IMPORTANT: DSH's slot system enforces "one handle, one scope" — a single
7821
+ * store handle cannot be mounted under two different scopes. Since the header
7822
+ * slot is scope "session" and the overlay slot is scope "root", we CANNOT
7823
+ * share a DSH EngineStoreHandle between them.
7824
+ *
7825
+ * Instead, page selection lives in a module-level observable that both
7826
+ * components subscribe to via the useCurrentPage() React hook. Neither slot
7827
+ * registration passes a `store` option, so no scope pinning occurs.
7823
7828
  */
7824
7829
  /** The four fixed monitoring pages. */
7825
7830
  const MEMORY_NAV_ITEMS = [
@@ -7840,31 +7845,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7840
7845
  label: "人工管理"
7841
7846
  }
7842
7847
  ];
7848
+ let _currentPage = null;
7849
+ const _listeners = /* @__PURE__ */ new Set();
7850
+ function notify() {
7851
+ for (const fn of _listeners) fn();
7852
+ }
7853
+ /** Select a monitoring page (opens the overlay on that page). */
7854
+ function selectPage(page) {
7855
+ _currentPage = page;
7856
+ notify();
7857
+ }
7858
+ /** Clear the selection (hides the overlay, returns to conversation view). */
7859
+ function clearPage() {
7860
+ _currentPage = null;
7861
+ notify();
7862
+ }
7843
7863
  /**
7844
- * Create the memory nav store handle. `select` both chooses the page and
7845
- * expands the group; `clear` hides the takeover overlay (used when the user
7846
- * opens a session row, returning to the native conversation view).
7847
- * @returns the store handle (spec + type + identity + factory in one).
7864
+ * React hook: subscribe to page changes and re-render on update.
7865
+ * Returns the current page key, or null when the overlay is hidden.
7848
7866
  */
7849
- function createMemoryNavStore() {
7850
- return (0, _deepseek_ai_dsh_client_runtime_client.defineStore)({
7851
- init: () => ({
7852
- page: null,
7853
- collapsed: false
7854
- }),
7855
- actions: {
7856
- select: (d, page) => {
7857
- d.page = page;
7858
- d.collapsed = false;
7859
- },
7860
- clear: (d) => {
7861
- d.page = null;
7862
- },
7863
- toggleCollapsed: (d) => {
7864
- d.collapsed = !d.collapsed;
7865
- }
7866
- }
7867
- });
7867
+ function useCurrentPage() {
7868
+ const [, force] = (0, react.useState)(0);
7869
+ (0, react.useEffect)(() => {
7870
+ const fn = () => {
7871
+ force((n) => n + 1);
7872
+ };
7873
+ _listeners.add(fn);
7874
+ return () => {
7875
+ _listeners.delete(fn);
7876
+ };
7877
+ }, []);
7878
+ return _currentPage;
7868
7879
  }
7869
7880
  //#endregion
7870
7881
  //#region \0dsh-css:D:\DSH 插件项目\项目源码\deepseek-harness-master\packages\memory\dsh-daoing-memory\src\client\Workbench.module.css.mjs
@@ -7878,61 +7889,61 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7878
7889
  document.head.appendChild(tag);
7879
7890
  }
7880
7891
  var Workbench_module_css_default = {
7881
- "statline": "KAfEAG_statline",
7882
- "error": "KAfEAG_error",
7883
- "btnDanger": "KAfEAG_btnDanger",
7884
- "cardMeta": "KAfEAG_cardMeta",
7885
- "payloadFull": "KAfEAG_payloadFull",
7886
- "form": "KAfEAG_form",
7887
7892
  "toolbar": "KAfEAG_toolbar",
7888
- "statusCandidate": "KAfEAG_statusCandidate",
7889
- "sectionTitle": "KAfEAG_sectionTitle",
7890
- "concernBg": "KAfEAG_concernBg",
7891
- "tab": "KAfEAG_tab",
7892
- "list": "KAfEAG_list",
7893
- "actions": "KAfEAG_actions",
7893
+ "trust": "KAfEAG_trust",
7894
7894
  "columns": "KAfEAG_columns",
7895
- "badgeConflict": "KAfEAG_badgeConflict",
7896
- "workbenchTabActive": "KAfEAG_workbenchTabActive",
7897
- "workbenchTabs": "KAfEAG_workbenchTabs",
7898
- "field": "KAfEAG_field",
7899
- "card": "KAfEAG_card",
7895
+ "cardMeta": "KAfEAG_cardMeta",
7896
+ "statusOther": "KAfEAG_statusOther",
7900
7897
  "cardTitle": "KAfEAG_cardTitle",
7901
- "cardDetail": "KAfEAG_cardDetail",
7902
- "cellActions": "KAfEAG_cellActions",
7903
- "header": "KAfEAG_header",
7904
- "warnLine": "KAfEAG_warnLine",
7905
- "statusLive": "KAfEAG_statusLive",
7898
+ "badgePositive": "KAfEAG_badgePositive",
7899
+ "badgeNegative": "KAfEAG_badgeNegative",
7900
+ "cardSub": "KAfEAG_cardSub",
7906
7901
  "payloadToggle": "KAfEAG_payloadToggle",
7907
7902
  "okLine": "KAfEAG_okLine",
7908
- "badgePinned": "KAfEAG_badgePinned",
7909
- "trust": "KAfEAG_trust",
7910
- "rules": "KAfEAG_rules",
7911
- "column": "KAfEAG_column",
7912
7903
  "panel": "KAfEAG_panel",
7913
- "cardSub": "KAfEAG_cardSub",
7914
- "workbenchTab": "KAfEAG_workbenchTab",
7904
+ "title": "KAfEAG_title",
7905
+ "concernBg": "KAfEAG_concernBg",
7906
+ "error": "KAfEAG_error",
7907
+ "valueCell": "KAfEAG_valueCell",
7908
+ "statusChallenged": "KAfEAG_statusChallenged",
7909
+ "list": "KAfEAG_list",
7910
+ "statusLive": "KAfEAG_statusLive",
7911
+ "cellActions": "KAfEAG_cellActions",
7912
+ "badge": "KAfEAG_badge",
7915
7913
  "tabActive": "KAfEAG_tabActive",
7914
+ "detailLabel": "KAfEAG_detailLabel",
7915
+ "btnDanger": "KAfEAG_btnDanger",
7916
+ "workbenchTab": "KAfEAG_workbenchTab",
7917
+ "btn": "KAfEAG_btn",
7918
+ "cardHead": "KAfEAG_cardHead",
7916
7919
  "detailRow": "KAfEAG_detailRow",
7917
- "check": "KAfEAG_check",
7920
+ "page": "KAfEAG_page",
7921
+ "subtitle": "KAfEAG_subtitle",
7918
7922
  "historyTitle": "KAfEAG_historyTitle",
7923
+ "sectionTitle": "KAfEAG_sectionTitle",
7919
7924
  "table": "KAfEAG_table",
7920
- "page": "KAfEAG_page",
7921
- "cardHead": "KAfEAG_cardHead",
7922
- "valueCell": "KAfEAG_valueCell",
7925
+ "tab": "KAfEAG_tab",
7923
7926
  "body": "KAfEAG_body",
7927
+ "workbenchTabs": "KAfEAG_workbenchTabs",
7924
7928
  "titleBlock": "KAfEAG_titleBlock",
7925
- "tabs": "KAfEAG_tabs",
7926
- "badgePositive": "KAfEAG_badgePositive",
7927
- "subtitle": "KAfEAG_subtitle",
7928
- "detailLabel": "KAfEAG_detailLabel",
7929
- "badgeNegative": "KAfEAG_badgeNegative",
7930
- "btn": "KAfEAG_btn",
7931
- "statusChallenged": "KAfEAG_statusChallenged",
7932
- "title": "KAfEAG_title",
7933
- "badge": "KAfEAG_badge",
7929
+ "header": "KAfEAG_header",
7930
+ "card": "KAfEAG_card",
7931
+ "badgePinned": "KAfEAG_badgePinned",
7932
+ "statusCandidate": "KAfEAG_statusCandidate",
7933
+ "form": "KAfEAG_form",
7934
+ "check": "KAfEAG_check",
7935
+ "cardDetail": "KAfEAG_cardDetail",
7936
+ "payloadFull": "KAfEAG_payloadFull",
7937
+ "rules": "KAfEAG_rules",
7934
7938
  "empty": "KAfEAG_empty",
7935
- "statusOther": "KAfEAG_statusOther"
7939
+ "workbenchTabActive": "KAfEAG_workbenchTabActive",
7940
+ "badgeConflict": "KAfEAG_badgeConflict",
7941
+ "column": "KAfEAG_column",
7942
+ "warnLine": "KAfEAG_warnLine",
7943
+ "statline": "KAfEAG_statline",
7944
+ "actions": "KAfEAG_actions",
7945
+ "field": "KAfEAG_field",
7946
+ "tabs": "KAfEAG_tabs"
7936
7947
  };
7937
7948
  //#endregion
7938
7949
  //#region src/client/ExperiencePage.tsx
@@ -8395,17 +8406,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8395
8406
  document.head.appendChild(tag);
8396
8407
  }
8397
8408
  var ReasonDialog_module_css_default = {
8409
+ "buttons": "L4KK8a_buttons",
8398
8410
  "btnConfirm": "L4KK8a_btnConfirm",
8399
- "header": "L4KK8a_header",
8400
- "btnCancel": "L4KK8a_btnCancel",
8411
+ "footer": "L4KK8a_footer",
8401
8412
  "textarea": "L4KK8a_textarea",
8413
+ "hint": "L4KK8a_hint",
8414
+ "btnCancel": "L4KK8a_btnCancel",
8415
+ "title": "L4KK8a_title",
8416
+ "overlay": "L4KK8a_overlay",
8402
8417
  "subtitle": "L4KK8a_subtitle",
8403
8418
  "dialog": "L4KK8a_dialog",
8404
- "overlay": "L4KK8a_overlay",
8405
- "title": "L4KK8a_title",
8406
- "hint": "L4KK8a_hint",
8407
- "footer": "L4KK8a_footer",
8408
- "buttons": "L4KK8a_buttons"
8419
+ "header": "L4KK8a_header"
8409
8420
  };
8410
8421
  //#endregion
8411
8422
  //#region src/client/ReasonDialog.tsx
@@ -10221,6 +10232,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10221
10232
  * four pages remain reachable. Opening a session row clears the selection
10222
10233
  * and returns to the native conversation view. All human mutations go through
10223
10234
  * the audited Remote callbacks.
10235
+ *
10236
+ * IMPORTANT: No DSH store handle is used here. The overlay slot has scope
10237
+ * "root" while the header slot has scope "session" — sharing a handle would
10238
+ * violate DSH's "one handle, one scope" rule. Page state comes from the
10239
+ * module-level observable in navStore.ts via useCurrentPage().
10224
10240
  */
10225
10241
  /** Format an epoch-ms timestamp as a compact local string. */
10226
10242
  function formatTs(ts) {
@@ -10235,11 +10251,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10235
10251
  }
10236
10252
  /**
10237
10253
  * The workbench entry component. Renders nothing unless a monitoring page is
10238
- * selected in the nav store and a current session exists (the Remote face is
10239
- * session-bound).
10254
+ * selected in the module-level nav state and a current session exists (the
10255
+ * Remote face is session-bound).
10240
10256
  */
10241
10257
  function MemoryWorkbench(props) {
10242
- const nav = props.useStore((s) => s);
10258
+ const page = useCurrentPage();
10243
10259
  const sessionId = props.useSessions((s) => s).current;
10244
10260
  const [info, setInfo] = (0, react.useState)(null);
10245
10261
  const [stats, setStats] = (0, react.useState)(null);
@@ -10271,9 +10287,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10271
10287
  }, [
10272
10288
  info,
10273
10289
  refreshStats,
10274
- nav.page
10290
+ page
10275
10291
  ]);
10276
- const active = nav.page !== null && info !== null && sessionId !== void 0;
10292
+ const active = page !== null && info !== null && sessionId !== void 0;
10277
10293
  (0, react.useEffect)(() => {
10278
10294
  if (!active) return;
10279
10295
  const onPointerDown = (event) => {
@@ -10281,19 +10297,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10281
10297
  if (!(target instanceof Element)) return;
10282
10298
  if (target.closest("[data-memory-workbench]") !== null) return;
10283
10299
  if (target.closest("[data-memory-nav]") !== null) return;
10284
- props.actions.clear();
10300
+ clearPage();
10285
10301
  };
10286
10302
  window.addEventListener("pointerdown", onPointerDown, true);
10287
10303
  return () => {
10288
10304
  window.removeEventListener("pointerdown", onPointerDown, true);
10289
10305
  };
10290
- }, [active, props.actions]);
10306
+ }, [active]);
10291
10307
  const prevSession = (0, react.useRef)(sessionId);
10292
10308
  (0, react.useEffect)(() => {
10293
10309
  if (prevSession.current === sessionId) return;
10294
10310
  prevSession.current = sessionId;
10295
- props.actions.clear();
10296
- }, [sessionId, props.actions]);
10311
+ clearPage();
10312
+ }, [sessionId]);
10297
10313
  (0, react.useEffect)(() => {
10298
10314
  if (!active) return;
10299
10315
  const root = rootRef.current;
@@ -10312,7 +10328,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10312
10328
  }, [active]);
10313
10329
  const bound = (0, react.useMemo)(() => sessionId === void 0 ? null : bindMemoryActions(props, sessionId), [sessionId]);
10314
10330
  if (!active || info === null || bound === null) return null;
10315
- const title = MEMORY_NAV_ITEMS.find((item) => item.key === nav.page)?.label ?? info.workspaceTitle;
10331
+ const title = MEMORY_NAV_ITEMS.find((item) => item.key === page)?.label ?? info.workspaceTitle;
10316
10332
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10317
10333
  ref: rootRef,
10318
10334
  className: Workbench_module_css_default.panel,
@@ -10340,10 +10356,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10340
10356
  "aria-label": "记忆监控页面",
10341
10357
  children: MEMORY_NAV_ITEMS.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
10342
10358
  type: "button",
10343
- className: clsx(Workbench_module_css_default.workbenchTab, nav.page === item.key && Workbench_module_css_default.workbenchTabActive),
10344
- "aria-current": nav.page === item.key ? "page" : void 0,
10359
+ className: clsx(Workbench_module_css_default.workbenchTab, page === item.key && Workbench_module_css_default.workbenchTabActive),
10360
+ "aria-current": page === item.key ? "page" : void 0,
10345
10361
  onClick: () => {
10346
- props.actions.select(item.key);
10362
+ selectPage(item.key);
10347
10363
  },
10348
10364
  children: item.label
10349
10365
  }, item.key))
@@ -10351,16 +10367,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10351
10367
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("main", {
10352
10368
  className: Workbench_module_css_default.body,
10353
10369
  children: [
10354
- nav.page === "experience" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExperiencePage, {
10370
+ page === "experience" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExperiencePage, {
10355
10371
  actions: bound,
10356
10372
  onChanged: refreshStats
10357
10373
  }),
10358
- nav.page === "fact" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FactDiaryPage, {
10374
+ page === "fact" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FactDiaryPage, {
10359
10375
  actions: bound,
10360
10376
  onChanged: refreshStats
10361
10377
  }),
10362
- nav.page === "ledger" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LedgerPage, { actions: bound }),
10363
- nav.page === "human" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HumanOpsPage, {
10378
+ page === "ledger" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LedgerPage, { actions: bound }),
10379
+ page === "human" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HumanOpsPage, {
10364
10380
  actions: bound,
10365
10381
  onChanged: refreshStats
10366
10382
  })
@@ -10390,7 +10406,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10390
10406
  }
10391
10407
  /**
10392
10408
  * Client plugin body: mount the memory Remote contribution, then register the
10393
- * header entry and the overlay takeover sharing one nav store handle.
10409
+ * header entry and the overlay takeover. Page selection is shared through the
10410
+ * module-level observable in navStore.ts (not a DSH store handle) to avoid
10411
+ * the "one handle, one scope" conflict between the session-scoped header slot
10412
+ * and the root-scoped overlay slot.
10394
10413
  * @param ctx - client root context.
10395
10414
  * @returns disposer after both entries and the Remote namespace unregister.
10396
10415
  */
@@ -10441,18 +10460,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10441
10460
  humanReleaseCold: async (session, request) => unwrap(await memory.humanReleaseCold(session, request)),
10442
10461
  ingest: async (session, request) => unwrap(await memory.ingest(session, request))
10443
10462
  };
10444
- const navStore = createMemoryNavStore();
10445
10463
  const disposeNav = ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
10446
10464
  name: "conversation.session.header.utilities",
10447
10465
  id: "memory-nav",
10448
10466
  order: -10,
10449
- store: navStore
10467
+ inject: () => ({ selectPage })
10450
10468
  }, MemoryHeaderAction));
10451
10469
  const disposeOverlay = ctx.slots.inject("shell.overlay", () => ctx.slots.register({
10452
10470
  name: "shell.overlay",
10453
10471
  id: "memory-workbench",
10454
10472
  order: 100,
10455
- store: navStore,
10456
10473
  inject: () => actions
10457
10474
  }, MemoryWorkbench));
10458
10475
  return async () => {