@chenhw7/dsh-memory 0.10.0 → 0.11.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.
Files changed (95) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +9 -8
  3. package/README.zh.md +9 -8
  4. package/assets/icon.svg +6 -0
  5. package/lib/client/index.js +1046 -291
  6. package/lib/context/index.d.ts +17 -4
  7. package/lib/context/index.d.ts.map +1 -1
  8. package/lib/context/index.js +11 -7
  9. package/lib/context/index.js.map +1 -1
  10. package/lib/context/package.json +4 -0
  11. package/lib/context/policy.d.ts +1 -1
  12. package/lib/context/policy.d.ts.map +1 -1
  13. package/lib/context/policy.js +5 -0
  14. package/lib/context/policy.js.map +1 -1
  15. package/lib/context/settings.d.ts +7 -6
  16. package/lib/context/settings.d.ts.map +1 -1
  17. package/lib/context/settings.js +11 -10
  18. package/lib/context/settings.js.map +1 -1
  19. package/lib/identity/index.d.ts +11 -1
  20. package/lib/identity/index.d.ts.map +1 -1
  21. package/lib/identity/index.js +3 -2
  22. package/lib/identity/index.js.map +1 -1
  23. package/lib/identity/package.json +4 -0
  24. package/lib/identity/settings.d.ts +5 -4
  25. package/lib/identity/settings.d.ts.map +1 -1
  26. package/lib/identity/settings.js +10 -7
  27. package/lib/identity/settings.js.map +1 -1
  28. package/lib/index.d.ts +13 -2
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +10 -0
  31. package/lib/index.js.map +1 -1
  32. package/lib/live-config.d.ts +33 -0
  33. package/lib/live-config.d.ts.map +1 -0
  34. package/lib/live-config.js +26 -0
  35. package/lib/live-config.js.map +1 -0
  36. package/lib/notes/index.d.ts +8 -8
  37. package/lib/notes/index.d.ts.map +1 -1
  38. package/lib/notes/index.js +3 -2
  39. package/lib/notes/index.js.map +1 -1
  40. package/lib/notes/package.json +4 -0
  41. package/lib/notes/settings.d.ts +6 -5
  42. package/lib/notes/settings.d.ts.map +1 -1
  43. package/lib/notes/settings.js +13 -9
  44. package/lib/notes/settings.js.map +1 -1
  45. package/lib/remote/index.d.ts +9 -0
  46. package/lib/remote/index.d.ts.map +1 -1
  47. package/lib/remote/index.js +18 -2
  48. package/lib/remote/index.js.map +1 -1
  49. package/lib/remote/package.json +4 -0
  50. package/lib/remote/typert.remote-client.d.ts +7 -4
  51. package/lib/review/accumulator.d.ts +39 -3
  52. package/lib/review/accumulator.d.ts.map +1 -1
  53. package/lib/review/accumulator.js +72 -9
  54. package/lib/review/accumulator.js.map +1 -1
  55. package/lib/review/consolidate.d.ts +3 -0
  56. package/lib/review/consolidate.d.ts.map +1 -1
  57. package/lib/review/consolidate.js +2 -0
  58. package/lib/review/consolidate.js.map +1 -1
  59. package/lib/review/extract.d.ts +23 -6
  60. package/lib/review/extract.d.ts.map +1 -1
  61. package/lib/review/extract.js +33 -17
  62. package/lib/review/extract.js.map +1 -1
  63. package/lib/review/index.d.ts +42 -3
  64. package/lib/review/index.d.ts.map +1 -1
  65. package/lib/review/index.js +121 -75
  66. package/lib/review/index.js.map +1 -1
  67. package/lib/review/package.json +4 -0
  68. package/lib/store/decay.d.ts +32 -0
  69. package/lib/store/decay.d.ts.map +1 -0
  70. package/lib/store/decay.js +23 -0
  71. package/lib/store/decay.js.map +1 -0
  72. package/lib/store/index.d.ts +28 -19
  73. package/lib/store/index.d.ts.map +1 -1
  74. package/lib/store/index.js +61 -22
  75. package/lib/store/index.js.map +1 -1
  76. package/lib/store/limits.d.ts +16 -0
  77. package/lib/store/limits.d.ts.map +1 -0
  78. package/lib/store/limits.js +16 -0
  79. package/lib/store/limits.js.map +1 -0
  80. package/lib/store/package.json +4 -0
  81. package/lib/store/settings.d.ts +9 -8
  82. package/lib/store/settings.d.ts.map +1 -1
  83. package/lib/store/settings.js +16 -14
  84. package/lib/store/settings.js.map +1 -1
  85. package/lib/store/sqlite.d.ts +8 -5
  86. package/lib/store/sqlite.d.ts.map +1 -1
  87. package/lib/store/sqlite.js +41 -16
  88. package/lib/store/sqlite.js.map +1 -1
  89. package/lib/tool/index.d.ts.map +1 -1
  90. package/lib/tool/index.js +86 -13
  91. package/lib/tool/index.js.map +1 -1
  92. package/lib/tool/package.json +4 -0
  93. package/lib/types.d.ts +21 -0
  94. package/lib/types.d.ts.map +1 -1
  95. package/package.json +7 -4
@@ -34,11 +34,12 @@ __export(index_exports, {
34
34
  module.exports = __toCommonJS(index_exports);
35
35
 
36
36
  // src/client/MemorySection.tsx
37
- var import_react = require("react");
37
+ var import_react2 = require("react");
38
38
 
39
39
  // src/client/memory-section-store.ts
40
40
  var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
41
41
  var MEMORY_BATCH_SIZE = 50;
42
+ var AUDIT_PAGE_SIZE = 200;
42
43
  var MEMORY_CATEGORIES = [
43
44
  "failure",
44
45
  "correction",
@@ -70,7 +71,12 @@ var INITIAL = {
70
71
  query: "",
71
72
  categories: [],
72
73
  pending: [],
73
- actionError: null
74
+ actionError: null,
75
+ audit: [],
76
+ auditStatus: "idle",
77
+ auditError: null,
78
+ auditOps: [],
79
+ auditSources: []
74
80
  };
75
81
  function projectSelectable(scope) {
76
82
  return scope === "all" || scope === "project";
@@ -89,6 +95,10 @@ var MemorySectionController = class {
89
95
  store = (0, import_dsh_client_store.createSnapshotStore)(INITIAL);
90
96
  /** Guards against overlapping loads painting partial results. */
91
97
  seq = 0;
98
+ /** Guards against overlapping audit loads (rapid filter clicks) painting stale results. */
99
+ auditSeq = 0;
100
+ /** Rows requested per audit load. */
101
+ auditLimit = AUDIT_PAGE_SIZE;
92
102
  /**
93
103
  * Full match set behind the active query/chips, cached between local
94
104
  * reveals; null whenever plain browsing applies. See {@link fetchFirstBatch}.
@@ -294,6 +304,67 @@ var MemorySectionController = class {
294
304
  return false;
295
305
  }
296
306
  }
307
+ /**
308
+ * Create one entry from the management page.
309
+ *
310
+ * The host write path stays the single fact source: the content goes through
311
+ * the same `add` the tools use (scanner gates included), and a successful
312
+ * create reloads the page so the new row appears under the active filters.
313
+ * @param input - scope, content, and the optional category/summary/workspace.
314
+ * @returns whether the host accepted the entry.
315
+ */
316
+ async createEntry(input) {
317
+ const created = await this.act(async (api) => {
318
+ const response = await api.add(input);
319
+ if (!response.result.ok) return { ok: false, message: response.result.error.message };
320
+ const { entry, error } = response.result.value;
321
+ if (entry === void 0) return { ok: false, message: error ?? "add failed" };
322
+ return { ok: true };
323
+ });
324
+ if (created) {
325
+ await this.load();
326
+ if (this.store.getSnapshot().auditStatus !== "idle") void this.loadAudit();
327
+ }
328
+ return created;
329
+ }
330
+ /**
331
+ * Load the audit trail for the active filters.
332
+ *
333
+ * Idle until the tab is first opened (the trail is a diagnostic surface, not
334
+ * part of the landing page), then refreshed on demand and after every row
335
+ * action so a mutation shows up in the same visit.
336
+ * @returns once the snapshot reflects the host.
337
+ */
338
+ async loadAudit() {
339
+ const ticket = ++this.auditSeq;
340
+ const snapshot = this.store.getSnapshot();
341
+ this.set({ auditStatus: snapshot.audit.length === 0 ? "loading" : snapshot.auditStatus });
342
+ try {
343
+ const api = this.requireApi();
344
+ const response = await api.auditLog({
345
+ limit: this.auditLimit,
346
+ ...snapshot.auditOps.length > 0 ? { ops: snapshot.auditOps } : {},
347
+ ...snapshot.auditSources.length > 0 ? { sources: snapshot.auditSources } : {}
348
+ });
349
+ if (!response.result.ok) throw new Error(response.result.error.message);
350
+ if (ticket !== this.auditSeq) return;
351
+ this.set({ auditStatus: "ready", auditError: null, audit: response.result.value.entries });
352
+ } catch (error) {
353
+ if (ticket !== this.auditSeq) return;
354
+ this.set({ auditStatus: "error", auditError: messageOf(error) });
355
+ }
356
+ }
357
+ /**
358
+ * Toggle one audit filter value and reload the trail.
359
+ * @param dimension - which filter list to change.
360
+ * @param value - the filter value to add or remove.
361
+ */
362
+ async toggleAuditFilter(dimension, value) {
363
+ const current = dimension === "ops" ? this.store.getSnapshot().auditOps : this.store.getSnapshot().auditSources;
364
+ const next = current.includes(value) ? current.filter((item) => item !== value) : [...current, value];
365
+ this.set(dimension === "ops" ? { auditOps: next } : { auditSources: next });
366
+ await this.loadAudit();
367
+ }
297
368
  /** Save human edits to one entry ("edit lands in KV", store single truth). */
298
369
  async saveEntryEdits(id, edits) {
299
370
  return this.act(async (api) => {
@@ -379,6 +450,7 @@ var MemorySectionController = class {
379
450
  });
380
451
  if (done) {
381
452
  this.set({ pending: this.store.getSnapshot().pending.filter((s) => s.id !== id), actionError: null });
453
+ if (this.store.getSnapshot().auditStatus !== "idle") void this.loadAudit();
382
454
  await this.reload();
383
455
  }
384
456
  return done;
@@ -393,9 +465,10 @@ var MemorySectionController = class {
393
465
  if (done) this.set({ pending: this.store.getSnapshot().pending.filter((s) => s.id !== id), actionError: null });
394
466
  return done;
395
467
  }
396
- /** Post-mutation repaint: health numbers + the visible list + the queue. */
468
+ /** Post-mutation repaint: health numbers + the visible list + the queue (+ audit when open). */
397
469
  async refreshAfterMutation() {
398
470
  void this.refreshPending();
471
+ if (this.store.getSnapshot().auditStatus !== "idle") void this.loadAudit();
399
472
  try {
400
473
  const [health] = await Promise.all([this.requireApi().health()]);
401
474
  if (health.result.ok) this.set({ health: health.result.value });
@@ -429,6 +502,26 @@ var RULES = `
429
502
  color: var(--dsw-alias-label-tertiary);
430
503
  }
431
504
 
505
+ /* The main-panel page frame: the panel owns its scroll container and column,
506
+ and pads its top by the frame's constant step below the window chrome. */
507
+ .dsm-s-panel {
508
+ height: 100%;
509
+ min-height: 0;
510
+ overflow-y: auto;
511
+ overflow-x: hidden;
512
+ box-sizing: border-box;
513
+ padding: calc(var(--dsh-frame-top-clearance, 0px) + 16px) 24px 48px;
514
+ padding-left: max(24px, var(--dsh-frame-leading-clearance, 24px));
515
+ }
516
+ .dsm-s-panel-inner {
517
+ display: flex;
518
+ flex-direction: column;
519
+ gap: 16px;
520
+ width: 100%;
521
+ max-width: 960px;
522
+ margin: 0 auto;
523
+ }
524
+
432
525
  /* \u2500\u2500 Health dashboard bar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
433
526
  .dsm-s-dash {
434
527
  display: flex;
@@ -801,8 +894,164 @@ var RULES = `
801
894
  line-height: 1.5;
802
895
  color: var(--dsw-alias-label-secondary);
803
896
  }
897
+
898
+ /* Operation counters and swallowed-failure diagnostics (Overview tab). */
899
+ .dsm-s-metric-group {
900
+ margin-top: 20px;
901
+ padding-top: 16px;
902
+ border-top: 1px solid var(--dsw-alias-separator);
903
+ }
904
+
905
+ .dsm-s-metric-group-title {
906
+ margin: 0 0 4px;
907
+ font-size: 13px;
908
+ font-weight: 600;
909
+ color: var(--dsw-alias-label-primary);
910
+ }
911
+
912
+ .dsm-s-metric-hint {
913
+ margin: 0 0 12px;
914
+ font-size: 12px;
915
+ line-height: 1.5;
916
+ color: var(--dsw-alias-label-tertiary);
917
+ }
918
+
919
+ .dsm-s-metric-grid {
920
+ display: grid;
921
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
922
+ gap: 8px 16px;
923
+ }
924
+
925
+ .dsm-s-metric {
926
+ display: flex;
927
+ align-items: baseline;
928
+ gap: 6px;
929
+ min-width: 0;
930
+ }
931
+
932
+ .dsm-s-metric-value {
933
+ font-size: 15px;
934
+ font-variant-numeric: tabular-nums;
935
+ font-weight: 600;
936
+ color: var(--dsw-alias-label-primary);
937
+ }
938
+
939
+ .dsm-s-metric-label {
940
+ font-size: 12px;
941
+ color: var(--dsw-alias-label-tertiary);
942
+ overflow: hidden;
943
+ text-overflow: ellipsis;
944
+ white-space: nowrap;
945
+ }
946
+
947
+ .dsm-s-failure-list {
948
+ display: flex;
949
+ flex-direction: column;
950
+ gap: 4px;
951
+ margin: 0;
952
+ padding: 0;
953
+ list-style: none;
954
+ }
955
+
956
+ .dsm-s-failure-row {
957
+ display: flex;
958
+ justify-content: space-between;
959
+ gap: 12px;
960
+ font-size: 12px;
961
+ color: var(--dsw-alias-label-secondary);
962
+ }
963
+
964
+ .dsm-s-failure-site {
965
+ font-family: var(--dsw-font-mono, ui-monospace, monospace);
966
+ }
967
+
968
+ .dsm-s-failure-count {
969
+ font-variant-numeric: tabular-nums;
970
+ color: var(--dsw-alias-label-error, #c0392b);
971
+ }
972
+
973
+ /* Audit trail tab. */
974
+ .dsm-s-audit-bar {
975
+ display: flex;
976
+ flex-wrap: wrap;
977
+ align-items: center;
978
+ gap: 8px;
979
+ margin-bottom: 12px;
980
+ }
981
+
982
+ .dsm-s-audit-table {
983
+ display: flex;
984
+ flex-direction: column;
985
+ margin: 0;
986
+ padding: 0;
987
+ list-style: none;
988
+ }
989
+
990
+ .dsm-s-audit-head,
991
+ .dsm-s-audit-row {
992
+ display: grid;
993
+ grid-template-columns: 150px 90px 90px 80px minmax(0, 1fr);
994
+ gap: 12px;
995
+ padding: 6px 4px;
996
+ font-size: 12px;
997
+ align-items: start;
998
+ }
999
+
1000
+ .dsm-s-audit-head {
1001
+ border-bottom: 1px solid var(--dsw-alias-separator);
1002
+ color: var(--dsw-alias-label-tertiary);
1003
+ font-weight: 500;
1004
+ }
1005
+
1006
+ .dsm-s-audit-row {
1007
+ border-bottom: 1px solid var(--dsw-alias-separator-weak, var(--dsw-alias-separator));
1008
+ color: var(--dsw-alias-label-secondary);
1009
+ }
1010
+
1011
+ .dsm-s-audit-cell {
1012
+ overflow: hidden;
1013
+ text-overflow: ellipsis;
1014
+ white-space: nowrap;
1015
+ }
1016
+
1017
+ .dsm-s-audit-preview {
1018
+ overflow: hidden;
1019
+ text-overflow: ellipsis;
1020
+ white-space: nowrap;
1021
+ color: var(--dsw-alias-label-primary);
1022
+ }
1023
+
1024
+ .dsm-s-audit-ts {
1025
+ font-variant-numeric: tabular-nums;
1026
+ color: var(--dsw-alias-label-tertiary);
1027
+ }
1028
+
1029
+ /* Create form (Manage tab). */
1030
+ .dsm-s-create-box {
1031
+ margin: 0 0 12px;
1032
+ padding: 12px;
1033
+ border: 1px solid var(--dsw-alias-separator);
1034
+ border-radius: 8px;
1035
+ background: var(--dsw-alias-fill-subtle, transparent);
1036
+ }
1037
+
1038
+ .dsm-s-create-row {
1039
+ display: flex;
1040
+ flex-wrap: wrap;
1041
+ align-items: center;
1042
+ gap: 8px;
1043
+ margin-top: 8px;
1044
+ }
1045
+
1046
+ .dsm-s-create-label {
1047
+ min-width: 96px;
1048
+ font-size: 12px;
1049
+ color: var(--dsw-alias-label-tertiary);
1050
+ }
804
1051
  `;
805
1052
  var cls = {
1053
+ panel: "dsm-s-panel",
1054
+ panelInner: "dsm-s-panel-inner",
806
1055
  section: "dsm-s-section",
807
1056
  title: "dsm-s-title",
808
1057
  intro: "dsm-s-intro",
@@ -845,6 +1094,30 @@ var cls = {
845
1094
  badgeHits: "dsm-s-badge-hits",
846
1095
  editForm: "dsm-s-edit-form",
847
1096
  textarea: "dsm-s-textarea",
1097
+ // Operation counters + swallowed-failure diagnostics (Overview).
1098
+ metricGroup: "dsm-s-metric-group",
1099
+ metricGroupTitle: "dsm-s-metric-group-title",
1100
+ metricHint: "dsm-s-metric-hint",
1101
+ metricGrid: "dsm-s-metric-grid",
1102
+ metric: "dsm-s-metric",
1103
+ metricValue: "dsm-s-metric-value",
1104
+ metricLabel: "dsm-s-metric-label",
1105
+ failureList: "dsm-s-failure-list",
1106
+ failureRow: "dsm-s-failure-row",
1107
+ failureSite: "dsm-s-failure-site",
1108
+ failureCount: "dsm-s-failure-count",
1109
+ // Audit trail tab.
1110
+ auditBar: "dsm-s-audit-bar",
1111
+ auditTable: "dsm-s-audit-table",
1112
+ auditHead: "dsm-s-audit-head",
1113
+ auditRow: "dsm-s-audit-row",
1114
+ auditCell: "dsm-s-audit-cell",
1115
+ auditPreview: "dsm-s-audit-preview",
1116
+ auditTs: "dsm-s-audit-ts",
1117
+ // Create form (Manage tab).
1118
+ createBox: "dsm-s-create-box",
1119
+ createRow: "dsm-s-create-row",
1120
+ createLabel: "dsm-s-create-label",
848
1121
  field: "dsm-s-field",
849
1122
  formRow: "dsm-s-form-row",
850
1123
  reviewHead: "dsm-s-review-head"
@@ -860,8 +1133,252 @@ function inject() {
860
1133
  }
861
1134
  var css = (inject(), cls);
862
1135
 
863
- // src/client/MemorySection.tsx
1136
+ // src/client/MemoryAuditTab.tsx
864
1137
  var import_jsx_runtime = require("react/jsx-runtime");
1138
+ var AUDIT_OPS = ["add", "update", "remove", "readRaw"];
1139
+ var AUDIT_SOURCES = ["tool", "review", "flush", "janitor", "ui"];
1140
+ function MemoryAuditTab(props) {
1141
+ const { state, translate, onLoad, onToggleFilter } = props;
1142
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1143
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.reviewHead, children: translate("auditIntro") }),
1144
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.auditBar, children: [
1145
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.toolbarLabel, children: translate("auditFilterOp") }),
1146
+ AUDIT_OPS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1147
+ "button",
1148
+ {
1149
+ type: "button",
1150
+ className: css.chip,
1151
+ "aria-pressed": state.auditOps.includes(op),
1152
+ onClick: () => {
1153
+ onToggleFilter("ops", op);
1154
+ },
1155
+ children: op
1156
+ },
1157
+ op
1158
+ )),
1159
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.toolbarLabel, children: translate("auditFilterSource") }),
1160
+ AUDIT_SOURCES.map((source) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1161
+ "button",
1162
+ {
1163
+ type: "button",
1164
+ className: css.chip,
1165
+ "aria-pressed": state.auditSources.includes(source),
1166
+ onClick: () => {
1167
+ onToggleFilter("sources", source);
1168
+ },
1169
+ children: source
1170
+ },
1171
+ source
1172
+ )),
1173
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.actionBtn, onClick: onLoad, children: translate("auditRefresh") })
1174
+ ] }),
1175
+ state.auditStatus === "error" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.error, role: "alert", children: state.auditError ?? translate("auditFailed") }) : null,
1176
+ state.auditStatus === "loading" && state.audit.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: css.empty, children: [
1177
+ translate("searchLabel"),
1178
+ "\u2026"
1179
+ ] }) : null,
1180
+ state.audit.length === 0 ? state.auditStatus === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.empty, children: translate(state.auditOps.length === 0 && state.auditSources.length === 0 ? "auditEmptyAll" : "auditEmpty") }) : null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1181
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.metricHint, children: translate("auditShowing").replace("{count}", String(state.audit.length)).replace("{limit}", String(AUDIT_PAGE_SIZE)) }),
1182
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.auditHead, children: [
1183
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: translate("auditColTime") }),
1184
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: translate("auditColOp") }),
1185
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: translate("auditColSource") }),
1186
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: translate("auditColScope") }),
1187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: translate("auditColPreview") })
1188
+ ] }),
1189
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: css.auditTable, children: [...state.audit].reverse().map((record) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuditRow, { record }, record.id)) })
1190
+ ] })
1191
+ ] });
1192
+ }
1193
+ function AuditRow(props) {
1194
+ const { record } = props;
1195
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: css.auditRow, children: [
1196
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${css.auditCell} ${css.auditTs}`, children: new Date(record.ts).toLocaleString() }),
1197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.auditCell, children: record.op }),
1198
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.auditCell, children: record.source }),
1199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.auditCell, children: record.scope }),
1200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.auditPreview, title: `${record.entryId}: ${record.contentPreview}`, children: record.contentPreview })
1201
+ ] });
1202
+ }
1203
+
1204
+ // src/client/MemoryCreateForm.tsx
1205
+ var import_react = require("react");
1206
+ var import_jsx_runtime2 = require("react/jsx-runtime");
1207
+ var CREATE_SCOPES = [
1208
+ { value: "global", labelKey: "scopeGlobal" },
1209
+ { value: "project", labelKey: "scopeProject" },
1210
+ { value: "user", labelKey: "scopeUser" }
1211
+ ];
1212
+ function MemoryCreateForm(props) {
1213
+ const { open, projects, actionError, translate, onToggle, onSubmit } = props;
1214
+ const [scope, setScope] = (0, import_react.useState)("user");
1215
+ const [content, setContent] = (0, import_react.useState)("");
1216
+ const [category, setCategory] = (0, import_react.useState)("");
1217
+ const [summary, setSummary] = (0, import_react.useState)("");
1218
+ const [projectName, setProjectName] = (0, import_react.useState)("");
1219
+ const [error, setError] = (0, import_react.useState)(null);
1220
+ const [saving, setSaving] = (0, import_react.useState)(false);
1221
+ if (!open) {
1222
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: css.createRow, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css.actionBtn, onClick: onToggle, children: translate("createTitle") }) });
1223
+ }
1224
+ const trimmed = content.trim();
1225
+ const valid = trimmed.length > 0 && (scope !== "project" || projectName.trim().length > 0);
1226
+ const submit = async () => {
1227
+ if (!valid || saving) return;
1228
+ setSaving(true);
1229
+ setError(null);
1230
+ const ok = await onSubmit({
1231
+ scope,
1232
+ content: trimmed,
1233
+ ...category.length > 0 ? { category } : {},
1234
+ ...summary.trim().length > 0 ? { summary: summary.trim() } : {},
1235
+ ...scope === "project" ? { projectName: projectName.trim() } : {}
1236
+ });
1237
+ setSaving(false);
1238
+ if (!ok) {
1239
+ setError(translate("createFailed"));
1240
+ return;
1241
+ }
1242
+ setContent("");
1243
+ setSummary("");
1244
+ setCategory("");
1245
+ onToggle();
1246
+ };
1247
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.createBox, children: [
1248
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { className: css.metricGroupTitle, children: translate("createTitle") }),
1249
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.metricHint, children: translate("createHint") }),
1250
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.createRow, children: [
1251
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.createLabel, children: translate("createScope") }),
1252
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: css.seg, role: "group", "aria-label": translate("createScope"), children: CREATE_SCOPES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1253
+ "button",
1254
+ {
1255
+ type: "button",
1256
+ className: css.segBtn,
1257
+ "aria-pressed": scope === option.value,
1258
+ onClick: () => {
1259
+ setScope(option.value);
1260
+ },
1261
+ children: translate(option.labelKey)
1262
+ },
1263
+ option.value
1264
+ )) }),
1265
+ scope === "project" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1266
+ "input",
1267
+ {
1268
+ className: css.input,
1269
+ "aria-label": translate("createProject"),
1270
+ placeholder: translate("createProject"),
1271
+ list: "dsm-create-projects",
1272
+ value: projectName,
1273
+ onChange: (event) => {
1274
+ setProjectName(event.target.value);
1275
+ }
1276
+ }
1277
+ ) : null,
1278
+ scope === "project" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("datalist", { id: "dsm-create-projects", children: projects.map((name) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: name }, name)) }) : null
1279
+ ] }),
1280
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.createRow, children: [
1281
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.createLabel, children: translate("createContent") }),
1282
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1283
+ "textarea",
1284
+ {
1285
+ className: css.textarea,
1286
+ "aria-label": translate("createContent"),
1287
+ placeholder: translate("createContentPlaceholder"),
1288
+ rows: 3,
1289
+ value: content,
1290
+ onChange: (event) => {
1291
+ setContent(event.target.value);
1292
+ }
1293
+ }
1294
+ )
1295
+ ] }),
1296
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.createRow, children: [
1297
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.createLabel, children: translate("createCategory") }),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1299
+ "select",
1300
+ {
1301
+ className: css.select,
1302
+ "aria-label": translate("createCategory"),
1303
+ value: category,
1304
+ onChange: (event) => {
1305
+ setCategory(event.target.value);
1306
+ },
1307
+ children: [
1308
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: translate("noCategory") }),
1309
+ MEMORY_CATEGORIES.map((value) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value, children: translate(CATEGORY_LABEL_KEYS[value]) }, value))
1310
+ ]
1311
+ }
1312
+ ),
1313
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.createLabel, children: translate("createSummary") }),
1314
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1315
+ "input",
1316
+ {
1317
+ className: css.input,
1318
+ "aria-label": translate("createSummary"),
1319
+ placeholder: translate("editSummaryPlaceholder"),
1320
+ value: summary,
1321
+ onChange: (event) => {
1322
+ setSummary(event.target.value);
1323
+ }
1324
+ }
1325
+ )
1326
+ ] }),
1327
+ error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.error, role: "alert", children: actionError ?? error }),
1328
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.createRow, children: [
1329
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css.actionBtn, disabled: !valid || saving, onClick: () => {
1330
+ void submit();
1331
+ }, children: translate("createSubmit") }),
1332
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css.actionBtn, onClick: onToggle, children: translate("createCancel") })
1333
+ ] })
1334
+ ] });
1335
+ }
1336
+
1337
+ // src/client/MemorySection.tsx
1338
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1339
+ var METRIC_ROWS = [
1340
+ { key: "tool.search", labelKey: "metricLabelToolSearch" },
1341
+ { key: "tool.searchFallback", labelKey: "metricLabelSearchFallback" },
1342
+ { key: "autoRecall.steps", labelKey: "metricLabelAutoRecallSteps" },
1343
+ { key: "autoRecall.hits", labelKey: "metricLabelAutoRecallHits" },
1344
+ { key: "digest.emitted", labelKey: "metricLabelDigest" },
1345
+ { key: "extract.calls", labelKey: "metricLabelExtractCalls" },
1346
+ { key: "curator.passes", labelKey: "metricLabelCurator" },
1347
+ { key: "flush.compaction", labelKey: "metricLabelFlush" },
1348
+ { key: "flush.dispose", labelKey: "metricLabelFlushDispose" },
1349
+ { key: "usage.hits", labelKey: "metricLabelHits" }
1350
+ ];
1351
+ function MetricsPanel(props) {
1352
+ const { metrics, translate } = props;
1353
+ const rows = METRIC_ROWS.filter((row) => metrics?.[row.key] !== void 0);
1354
+ const extra = Object.entries(metrics ?? {}).filter(([key]) => !METRIC_ROWS.some((row) => row.key === key));
1355
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.metricGroup, children: [
1356
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: css.metricGroupTitle, children: translate("metricsTitle") }),
1357
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.metricHint, children: translate("metricsHint") }),
1358
+ rows.length === 0 && extra.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.empty, children: translate("metricsNone") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.metricGrid, children: [
1359
+ rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.metric, children: [
1360
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.metricValue, children: metrics?.[row.key] ?? 0 }),
1361
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.metricLabel, title: row.key, children: translate(row.labelKey) })
1362
+ ] }, row.key)),
1363
+ extra.map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.metric, children: [
1364
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.metricValue, children: value }),
1365
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.metricLabel, title: key, children: key })
1366
+ ] }, key))
1367
+ ] })
1368
+ ] });
1369
+ }
1370
+ function FailuresPanel(props) {
1371
+ const { failures, translate } = props;
1372
+ const rows = Object.entries(failures ?? {});
1373
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.metricGroup, children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: css.metricGroupTitle, children: translate("failuresTitle") }),
1375
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.metricHint, children: translate("failuresHint") }),
1376
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.empty, children: translate("failuresNone") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: css.failureList, children: rows.map(([site, count]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: css.failureRow, children: [
1377
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.failureSite, children: site }),
1378
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.failureCount, children: count })
1379
+ ] }, site)) })
1380
+ ] });
1381
+ }
865
1382
  var SCOPES = [
866
1383
  { value: "all", labelKey: "scopeAll" },
867
1384
  { value: "global", labelKey: "scopeGlobal" },
@@ -879,10 +1396,18 @@ function emptyKeyOf(state) {
879
1396
  if (state.scope === "project") return "emptyProject";
880
1397
  return "emptyAll";
881
1398
  }
1399
+ function proposalActionKey(suggestion) {
1400
+ const action = suggestion.action ?? (suggestion.targetEntryId !== void 0 ? "update" : "add");
1401
+ if (action === "remove") return "actionRemoveBadge";
1402
+ if (action === "pin") return "actionPinBadge";
1403
+ if (action === "unpin") return "actionUnpinBadge";
1404
+ if (action === "update") return "updateProposalBadge";
1405
+ return void 0;
1406
+ }
882
1407
  function EntryEditor(props) {
883
1408
  const { entry, translate, loadRaw, onSave, onCancel } = props;
884
- const [draftContent, setDraftContent] = (0, import_react.useState)(entry.content);
885
- (0, import_react.useEffect)(() => {
1409
+ const [draftContent, setDraftContent] = (0, import_react2.useState)(entry.content);
1410
+ (0, import_react2.useEffect)(() => {
886
1411
  let alive = true;
887
1412
  loadRaw(entry.id).then((raw) => {
888
1413
  if (alive && raw !== void 0) setDraftContent(raw);
@@ -892,10 +1417,10 @@ function EntryEditor(props) {
892
1417
  alive = false;
893
1418
  };
894
1419
  }, [entry.id, loadRaw]);
895
- const [draftCategory, setDraftCategory] = (0, import_react.useState)(entry.category ?? NO_CATEGORY);
896
- const [draftSummary, setDraftSummary] = (0, import_react.useState)(entry.summary ?? "");
897
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.editForm, children: [
898
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1420
+ const [draftCategory, setDraftCategory] = (0, import_react2.useState)(entry.category ?? NO_CATEGORY);
1421
+ const [draftSummary, setDraftSummary] = (0, import_react2.useState)(entry.summary ?? "");
1422
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.editForm, children: [
1423
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
899
1424
  "textarea",
900
1425
  {
901
1426
  className: css.textarea,
@@ -906,8 +1431,8 @@ function EntryEditor(props) {
906
1431
  }
907
1432
  }
908
1433
  ),
909
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.formRow, children: [
910
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1434
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.formRow, children: [
1435
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
911
1436
  "select",
912
1437
  {
913
1438
  className: css.select,
@@ -917,12 +1442,12 @@ function EntryEditor(props) {
917
1442
  setDraftCategory(event.target.value);
918
1443
  },
919
1444
  children: [
920
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: NO_CATEGORY, children: translate("noCategory") }),
921
- MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: category, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }, category))
1445
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: NO_CATEGORY, children: translate("noCategory") }),
1446
+ MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: category, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }, category))
922
1447
  ]
923
1448
  }
924
1449
  ),
925
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1450
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
926
1451
  "input",
927
1452
  {
928
1453
  className: css.field,
@@ -936,8 +1461,8 @@ function EntryEditor(props) {
936
1461
  }
937
1462
  )
938
1463
  ] }),
939
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.actions, children: [
940
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1464
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.actions, children: [
1465
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
941
1466
  "button",
942
1467
  {
943
1468
  type: "button",
@@ -955,7 +1480,7 @@ function EntryEditor(props) {
955
1480
  children: translate("saveEdits")
956
1481
  }
957
1482
  ),
958
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.actionBtn, onClick: onCancel, children: translate("cancelEdits") })
1483
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css.actionBtn, onClick: onCancel, children: translate("cancelEdits") })
959
1484
  ] })
960
1485
  ] });
961
1486
  }
@@ -965,17 +1490,17 @@ function EntryRow(props) {
965
1490
  const projectName = entry.projectName;
966
1491
  const isStale = entry.staleSince !== void 0;
967
1492
  const isPinned = entry.pinned === true;
968
- const [editing, setEditing] = (0, import_react.useState)(false);
969
- const [confirmingDelete, setConfirmingDelete] = (0, import_react.useState)(false);
970
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: isStale ? `${css.row} ${css.rowStale}` : css.row, children: [
971
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.badges, children: [
972
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: scopeLabels[entry.scope] }),
973
- category === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }),
974
- projectName === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.project, children: projectName }),
975
- isPinned ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${css.badge} ${css.badgePinned}`, children: `\u{1F4CC} ${pinnedLabel}` }) : null,
976
- isStale ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${css.badge} ${css.badgeStale}`, title: staleHint, "aria-label": staleHint, children: `\u{1F634} ${staleLabel}` }) : null
1493
+ const [editing, setEditing] = (0, import_react2.useState)(false);
1494
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react2.useState)(false);
1495
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: isStale ? `${css.row} ${css.rowStale}` : css.row, children: [
1496
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.badges, children: [
1497
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.badge, children: scopeLabels[entry.scope] }),
1498
+ category === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.badge, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }),
1499
+ projectName === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.project, children: projectName }),
1500
+ isPinned ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css.badge} ${css.badgePinned}`, children: `\u{1F4CC} ${pinnedLabel}` }) : null,
1501
+ isStale ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css.badge} ${css.badgeStale}`, title: staleHint, "aria-label": staleHint, children: `\u{1F634} ${staleLabel}` }) : null
977
1502
  ] }),
978
- editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1503
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
979
1504
  EntryEditor,
980
1505
  {
981
1506
  entry,
@@ -989,7 +1514,7 @@ function EntryRow(props) {
989
1514
  setEditing(false);
990
1515
  }
991
1516
  }
992
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1517
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
993
1518
  "button",
994
1519
  {
995
1520
  type: "button",
@@ -999,13 +1524,13 @@ function EntryRow(props) {
999
1524
  children: entry.content
1000
1525
  }
1001
1526
  ),
1002
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: css.meta, children: [
1003
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: `${translate("metaCreated")} ${formatTs(entry.createdAt, "\u2014")}` }),
1004
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: `${translate("metaUpdated")} ${formatTs(entry.updatedAt, "\u2014")}` }),
1005
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: entry.lastRecalledAt === void 0 ? `${translate("metaRecalled")} ${neverRecalledLabel}` : `${translate("metaRecalled")} ${formatTs(entry.lastRecalledAt, neverRecalledLabel)}` })
1527
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: css.meta, children: [
1528
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaCreated")} ${formatTs(entry.createdAt, "\u2014")}` }),
1529
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaUpdated")} ${formatTs(entry.updatedAt, "\u2014")}` }),
1530
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: entry.lastRecalledAt === void 0 ? `${translate("metaRecalled")} ${neverRecalledLabel}` : `${translate("metaRecalled")} ${formatTs(entry.lastRecalledAt, neverRecalledLabel)}` })
1006
1531
  ] }),
1007
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.actions, children: [
1008
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1532
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.actions, children: [
1533
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1009
1534
  "button",
1010
1535
  {
1011
1536
  type: "button",
@@ -1017,10 +1542,10 @@ function EntryRow(props) {
1017
1542
  children: editing ? translate("cancelEdits") : translate("editAction")
1018
1543
  }
1019
1544
  ),
1020
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.actionBtn, onClick: onTogglePin, children: isPinned ? translate("unpinAction") : translate("pinAction") }),
1021
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.actionBtn, onClick: onToggleArchive, children: isStale ? translate("unarchiveAction") : translate("archiveAction") }),
1022
- confirmingDelete ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1023
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1545
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css.actionBtn, onClick: onTogglePin, children: isPinned ? translate("unpinAction") : translate("pinAction") }),
1546
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css.actionBtn, onClick: onToggleArchive, children: isStale ? translate("unarchiveAction") : translate("archiveAction") }),
1547
+ confirmingDelete ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1548
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1024
1549
  "button",
1025
1550
  {
1026
1551
  type: "button",
@@ -1032,7 +1557,7 @@ function EntryRow(props) {
1032
1557
  children: translate("confirmDelete")
1033
1558
  }
1034
1559
  ),
1035
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1560
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1036
1561
  "button",
1037
1562
  {
1038
1563
  type: "button",
@@ -1043,7 +1568,7 @@ function EntryRow(props) {
1043
1568
  children: translate("cancelDelete")
1044
1569
  }
1045
1570
  )
1046
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1571
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1047
1572
  "button",
1048
1573
  {
1049
1574
  type: "button",
@@ -1059,20 +1584,22 @@ function EntryRow(props) {
1059
1584
  }
1060
1585
  function SuggestionRow(props) {
1061
1586
  const { suggestion, scopeLabels, translate, onAdopt, onReject } = props;
1062
- const [editing, setEditing] = (0, import_react.useState)(false);
1063
- const [draftContent, setDraftContent] = (0, import_react.useState)(suggestion.content);
1587
+ const action = suggestion.action ?? (suggestion.targetEntryId !== void 0 ? "update" : "add");
1588
+ const editable = action === "add" || action === "update";
1589
+ const [editing, setEditing] = (0, import_react2.useState)(false);
1590
+ const [draftContent, setDraftContent] = (0, import_react2.useState)(suggestion.content);
1064
1591
  const category = suggestion.category;
1065
1592
  const projectName = suggestion.projectName;
1066
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: css.row, children: [
1067
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.badges, children: [
1068
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: scopeLabels[suggestion.scope] }),
1069
- category === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }),
1070
- projectName === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.project, children: projectName }),
1071
- suggestion.hits > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${css.badge} ${css.badgeHits}`, children: translate("hitsBadge").replace("{hits}", String(suggestion.hits)) }) : null,
1072
- suggestion.targetEntryId !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: translate("updateProposalBadge") }) : null
1593
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: css.row, children: [
1594
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.badges, children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.badge, children: scopeLabels[suggestion.scope] }),
1596
+ category === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.badge, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }),
1597
+ projectName === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.project, children: projectName }),
1598
+ suggestion.hits > 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css.badge} ${css.badgeHits}`, children: translate("hitsBadge").replace("{hits}", String(suggestion.hits)) }) : null,
1599
+ proposalActionKey(suggestion) === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.badge, children: translate(proposalActionKey(suggestion)) })
1073
1600
  ] }),
1074
- editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.editForm, children: [
1075
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1601
+ editable && editing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.editForm, children: [
1602
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1076
1603
  "textarea",
1077
1604
  {
1078
1605
  className: css.textarea,
@@ -1083,8 +1610,8 @@ function SuggestionRow(props) {
1083
1610
  }
1084
1611
  }
1085
1612
  ),
1086
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.actions, children: [
1087
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1613
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.actions, children: [
1614
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1088
1615
  "button",
1089
1616
  {
1090
1617
  type: "button",
@@ -1096,37 +1623,46 @@ function SuggestionRow(props) {
1096
1623
  children: translate("saveAdopt")
1097
1624
  }
1098
1625
  ),
1099
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.actionBtn, onClick: () => {
1626
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css.actionBtn, onClick: () => {
1100
1627
  onAdopt(void 0);
1101
1628
  }, children: translate("adoptAsIs") })
1102
1629
  ] })
1103
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: `${css.content} ${css.contentOpen}`, onClick: () => {
1630
+ ] }) : editable ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${css.content} ${css.contentOpen}`, onClick: () => {
1104
1631
  setEditing(true);
1105
- }, children: suggestion.content }),
1106
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: css.meta, children: [
1107
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: `${translate("metaSeen")} ${formatTs(suggestion.lastSeenAt, "\u2014")}` }),
1108
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: `${translate("metaFirstSeen")} ${formatTs(suggestion.firstSeenAt, "\u2014")}` })
1632
+ }, children: suggestion.content }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: `${css.content} ${css.contentOpen}`, children: suggestion.content }),
1633
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: css.meta, children: [
1634
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaSeen")} ${formatTs(suggestion.lastSeenAt, "\u2014")}` }),
1635
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaFirstSeen")} ${formatTs(suggestion.firstSeenAt, "\u2014")}` })
1109
1636
  ] }),
1110
- !editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.actions, children: [
1111
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.actionBtn, onClick: () => {
1637
+ !(editable && editing) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.actions, children: [
1638
+ editable ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css.actionBtn, onClick: () => {
1112
1639
  setEditing(true);
1113
- }, children: translate("editAndAdopt") }),
1114
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.actionBtn, onClick: () => {
1640
+ }, children: translate("editAndAdopt") }) : null,
1641
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css.actionBtn, onClick: () => {
1115
1642
  onAdopt(void 0);
1116
1643
  }, children: translate("adoptAction") }),
1117
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: `${css.actionBtn} ${css.actionBtnDanger}`, onClick: onReject, children: translate("rejectAction") })
1644
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${css.actionBtn} ${css.actionBtnDanger}`, onClick: onReject, children: translate("rejectAction") })
1118
1645
  ] }) : null
1119
1646
  ] });
1120
1647
  }
1121
1648
  function MemorySection(props) {
1649
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css.panel, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css.panelInner, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MemorySectionContent, { ...props }) }) });
1650
+ }
1651
+ function MemorySectionContent(props) {
1122
1652
  const { useMemorySection, t, load } = props;
1123
1653
  const state = useMemorySection((snapshot) => snapshot);
1124
- (0, import_react.useEffect)(() => {
1654
+ (0, import_react2.useEffect)(() => {
1125
1655
  void load();
1126
1656
  }, [load]);
1127
- const [tab, setTab] = (0, import_react.useState)("overview");
1128
- const [searchText, setSearchText] = (0, import_react.useState)(state.query);
1129
- (0, import_react.useEffect)(() => {
1657
+ const [tab, setTab] = (0, import_react2.useState)("overview");
1658
+ const [creating, setCreating] = (0, import_react2.useState)(false);
1659
+ const { loadAudit } = props;
1660
+ (0, import_react2.useEffect)(() => {
1661
+ if (tab !== "audit" || state.auditStatus !== "idle") return;
1662
+ void loadAudit();
1663
+ }, [tab, state.auditStatus, loadAudit]);
1664
+ const [searchText, setSearchText] = (0, import_react2.useState)(state.query);
1665
+ (0, import_react2.useEffect)(() => {
1130
1666
  const timer = setTimeout(() => {
1131
1667
  props.commitQuery(searchText);
1132
1668
  }, 300);
@@ -1134,7 +1670,7 @@ function MemorySection(props) {
1134
1670
  clearTimeout(timer);
1135
1671
  };
1136
1672
  }, [searchText]);
1137
- const [expandedIds, setExpandedIds] = (0, import_react.useState)(/* @__PURE__ */ new Set());
1673
+ const [expandedIds, setExpandedIds] = (0, import_react2.useState)(/* @__PURE__ */ new Set());
1138
1674
  const toggleExpanded = (id) => {
1139
1675
  setExpandedIds((previous) => {
1140
1676
  const next = new Set(previous);
@@ -1152,10 +1688,10 @@ function MemorySection(props) {
1152
1688
  const total = state.total;
1153
1689
  const shown = state.entries.length;
1154
1690
  const hasMore = shown < total;
1155
- const loadMoreRef = (0, import_react.useRef)(props.loadMore);
1691
+ const loadMoreRef = (0, import_react2.useRef)(props.loadMore);
1156
1692
  loadMoreRef.current = props.loadMore;
1157
- const sentinelRef = (0, import_react.useRef)(null);
1158
- (0, import_react.useEffect)(() => {
1693
+ const sentinelRef = (0, import_react2.useRef)(null);
1694
+ (0, import_react2.useEffect)(() => {
1159
1695
  const element = sentinelRef.current;
1160
1696
  if (element === null || tab !== "manage") return;
1161
1697
  if (typeof IntersectionObserver === "undefined") return;
@@ -1171,26 +1707,26 @@ function MemorySection(props) {
1171
1707
  };
1172
1708
  }, [tab, state.status, shown, total]);
1173
1709
  if (state.status === "error") {
1174
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.section, children: [
1175
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: css.title, children: t("nav") }),
1176
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
1177
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.moreBtn, onClick: () => {
1710
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.section, children: [
1711
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css.title, children: t("nav") }),
1712
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
1713
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css.moreBtn, onClick: () => {
1178
1714
  void load();
1179
1715
  }, children: t("retry") })
1180
1716
  ] });
1181
1717
  }
1182
1718
  if (state.status === "loading" || state.status === "idle") {
1183
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.section, children: [
1184
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: css.title, children: t("nav") }),
1185
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.intro, children: t("loading") })
1719
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.section, children: [
1720
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css.title, children: t("nav") }),
1721
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.intro, children: t("loading") })
1186
1722
  ] });
1187
1723
  }
1188
1724
  const health = state.health;
1189
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.section, children: [
1190
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: css.title, children: t("nav") }),
1191
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.intro, children: t("sectionIntro") }),
1192
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.tabs, role: "tablist", "aria-label": t("nav"), children: [
1193
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1725
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.section, children: [
1726
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css.title, children: t("nav") }),
1727
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.intro, children: t("sectionIntro") }),
1728
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.tabs, role: "tablist", "aria-label": t("nav"), children: [
1729
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1194
1730
  "button",
1195
1731
  {
1196
1732
  type: "button",
@@ -1203,7 +1739,7 @@ function MemorySection(props) {
1203
1739
  children: t("tabOverview")
1204
1740
  }
1205
1741
  ),
1206
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1742
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1207
1743
  "button",
1208
1744
  {
1209
1745
  type: "button",
@@ -1216,7 +1752,7 @@ function MemorySection(props) {
1216
1752
  children: state.pending.length > 0 ? t("tabReviewWithCount").replace("{count}", String(state.pending.length)) : t("tabReview")
1217
1753
  }
1218
1754
  ),
1219
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1755
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1220
1756
  "button",
1221
1757
  {
1222
1758
  type: "button",
@@ -1228,50 +1764,65 @@ function MemorySection(props) {
1228
1764
  },
1229
1765
  children: t("tabManage")
1230
1766
  }
1767
+ ),
1768
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1769
+ "button",
1770
+ {
1771
+ type: "button",
1772
+ role: "tab",
1773
+ className: css.tabBtn,
1774
+ "aria-selected": tab === "audit",
1775
+ onClick: () => {
1776
+ setTab("audit");
1777
+ },
1778
+ children: t("tabAudit")
1779
+ }
1231
1780
  )
1232
1781
  ] }),
1233
- tab === "overview" ? health === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.dash, children: [
1234
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1235
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statValue, children: health.totalEntries }),
1236
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("dashTotal") })
1782
+ tab === "overview" ? health === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.dash, children: [
1783
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1784
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statValue, children: health.totalEntries }),
1785
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("dashTotal") })
1237
1786
  ] }),
1238
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1239
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statValue, children: health.byScope.global }),
1240
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("scopeGlobal") })
1787
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1788
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statValue, children: health.byScope.global }),
1789
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("scopeGlobal") })
1241
1790
  ] }),
1242
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1243
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statValue, children: health.byScope.user }),
1244
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("scopeUser") })
1791
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1792
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statValue, children: health.byScope.user }),
1793
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("scopeUser") })
1245
1794
  ] }),
1246
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1247
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statValue, children: health.byScope.project }),
1248
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("scopeProject") })
1795
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1796
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statValue, children: health.byScope.project }),
1797
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("scopeProject") })
1249
1798
  ] }),
1250
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1251
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statValue, children: health.pinned }),
1252
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("dashPinned") })
1799
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1800
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statValue, children: health.pinned }),
1801
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("dashPinned") })
1253
1802
  ] }),
1254
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: `${css.stat} ${css.statStale}`, title: t("dashStaleHint"), children: [
1255
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${css.statValue}${(health.stale ?? 0) > 0 ? "" : ` ${css.statValueMuted}`}`, children: health.stale ?? 0 }),
1256
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("dashStale") })
1803
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: `${css.stat} ${css.statStale}`, title: t("dashStaleHint"), children: [
1804
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css.statValue}${(health.stale ?? 0) > 0 ? "" : ` ${css.statValueMuted}`}`, children: health.stale ?? 0 }),
1805
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("dashStale") })
1257
1806
  ] }),
1258
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1259
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statValue, children: health.auditRecords }),
1260
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("dashAudit") })
1807
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1808
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statValue, children: health.auditRecords }),
1809
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("dashAudit") })
1261
1810
  ] }),
1262
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1263
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${css.statValue} ${css.statValueMuted}`, children: formatTs(health.lastActivityTs, t("dashLastActivityNever")) }),
1264
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("dashLastActivity") })
1811
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1812
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css.statValue} ${css.statValueMuted}`, children: formatTs(health.lastActivityTs, t("dashLastActivityNever")) }),
1813
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("dashLastActivity") })
1265
1814
  ] }),
1266
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.stat, children: [
1267
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${css.statValue} ${css.statValueMuted}`, children: formatTs(health.lastExtractionTs, t("dashLastActivityNever")) }),
1268
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.statLabel, children: t("dashLastExtraction") })
1269
- ] })
1815
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css.stat, children: [
1816
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css.statValue} ${css.statValueMuted}`, children: formatTs(health.lastExtractionTs, t("dashLastActivityNever")) }),
1817
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.statLabel, children: t("dashLastExtraction") })
1818
+ ] }),
1819
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MetricsPanel, { metrics: health.metrics, translate: t }),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FailuresPanel, { failures: health.backgroundFailures, translate: t })
1270
1821
  ] }) : null,
1271
- tab === "review" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1272
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.reviewHead, children: t("reviewIntro") }),
1273
- state.actionError === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.error, role: "alert", children: state.actionError }),
1274
- state.pending.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.empty, children: t("reviewEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: css.list, children: state.pending.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1822
+ tab === "review" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1823
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.reviewHead, children: t("reviewIntro") }),
1824
+ state.actionError === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.error, role: "alert", children: state.actionError }),
1825
+ state.pending.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.empty, children: t("reviewEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: css.list, children: state.pending.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1275
1826
  SuggestionRow,
1276
1827
  {
1277
1828
  suggestion,
@@ -1287,11 +1838,37 @@ function MemorySection(props) {
1287
1838
  suggestion.id
1288
1839
  )) })
1289
1840
  ] }) : null,
1290
- tab === "manage" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1291
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.toolbar, children: [
1292
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.toolbarRow, children: [
1293
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.toolbarLabel, children: t("searchLabel") }),
1294
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: css.seg, role: "group", "aria-label": t("nav"), children: SCOPES.map(({ value, labelKey }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1841
+ tab === "audit" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1842
+ MemoryAuditTab,
1843
+ {
1844
+ state,
1845
+ translate: t,
1846
+ onLoad: () => {
1847
+ void props.loadAudit();
1848
+ },
1849
+ onToggleFilter: (dimension, value) => {
1850
+ void props.toggleAuditFilter(dimension, value);
1851
+ }
1852
+ }
1853
+ ) : null,
1854
+ tab === "manage" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1855
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1856
+ MemoryCreateForm,
1857
+ {
1858
+ open: creating,
1859
+ projects: state.projects,
1860
+ actionError: state.actionError,
1861
+ translate: t,
1862
+ onToggle: () => {
1863
+ setCreating((open) => !open);
1864
+ },
1865
+ onSubmit: (input) => props.createEntry(input)
1866
+ }
1867
+ ),
1868
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.toolbar, children: [
1869
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.toolbarRow, children: [
1870
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.toolbarLabel, children: t("searchLabel") }),
1871
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css.seg, role: "group", "aria-label": t("nav"), children: SCOPES.map(({ value, labelKey }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1295
1872
  "button",
1296
1873
  {
1297
1874
  type: "button",
@@ -1304,7 +1881,7 @@ function MemorySection(props) {
1304
1881
  },
1305
1882
  value
1306
1883
  )) }),
1307
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1884
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1308
1885
  "select",
1309
1886
  {
1310
1887
  className: css.select,
@@ -1315,12 +1892,12 @@ function MemorySection(props) {
1315
1892
  props.setProject(event.target.value);
1316
1893
  },
1317
1894
  children: [
1318
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: t("workspaceAll") }),
1319
- state.projects.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: name, children: name }, name))
1895
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", children: t("workspaceAll") }),
1896
+ state.projects.map((name) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: name, children: name }, name))
1320
1897
  ]
1321
1898
  }
1322
1899
  ),
1323
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1900
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1324
1901
  "input",
1325
1902
  {
1326
1903
  type: "search",
@@ -1334,9 +1911,9 @@ function MemorySection(props) {
1334
1911
  }
1335
1912
  )
1336
1913
  ] }),
1337
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.toolbarRow, children: [
1338
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.toolbarLabel, children: t("categoryLabel") }),
1339
- MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1914
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.toolbarRow, children: [
1915
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css.toolbarLabel, children: t("categoryLabel") }),
1916
+ MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1340
1917
  "button",
1341
1918
  {
1342
1919
  type: "button",
@@ -1351,10 +1928,10 @@ function MemorySection(props) {
1351
1928
  ))
1352
1929
  ] })
1353
1930
  ] }),
1354
- state.error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.error, role: "alert", children: state.error }),
1355
- state.actionError === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.error, role: "alert", children: state.actionError }),
1356
- total === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.empty, children: t(emptyKeyOf(state)) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1357
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: css.list, children: state.entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1931
+ state.error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.error, role: "alert", children: state.error }),
1932
+ state.actionError === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.error, role: "alert", children: state.actionError }),
1933
+ total === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.empty, children: t(emptyKeyOf(state)) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1934
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: css.list, children: state.entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1358
1935
  EntryRow,
1359
1936
  {
1360
1937
  entry,
@@ -1384,11 +1961,11 @@ function MemorySection(props) {
1384
1961
  },
1385
1962
  entry.id
1386
1963
  )) }),
1387
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.more, children: [
1388
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.count, children: t("shownCount").replace("{shown}", String(shown)).replace("{total}", String(total)) }),
1389
- hasMore ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1390
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: sentinelRef, className: css.sentinel, "aria-hidden": "true" }),
1391
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1964
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css.more, children: [
1965
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css.count, children: t("shownCount").replace("{shown}", String(shown)).replace("{total}", String(total)) }),
1966
+ hasMore ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1967
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: sentinelRef, className: css.sentinel, "aria-hidden": "true" }),
1968
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1392
1969
  "button",
1393
1970
  {
1394
1971
  type: "button",
@@ -1412,8 +1989,8 @@ function translateCategory(category, t) {
1412
1989
  }
1413
1990
 
1414
1991
  // src/client/IdentitySection.tsx
1415
- var import_react2 = require("react");
1416
- var import_jsx_runtime2 = require("react/jsx-runtime");
1992
+ var import_react3 = require("react");
1993
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1417
1994
  var KINDS = [
1418
1995
  { kind: "soul", titleKey: "identitySoulTitle", emptyKey: "identitySoulEmpty", file: "SOUL.md" },
1419
1996
  { kind: "user", titleKey: "identityUserTitle", emptyKey: "identityUserEmpty", file: "USER.md" }
@@ -1438,13 +2015,13 @@ function exportDocument(file, content) {
1438
2015
  }
1439
2016
  function DocumentPanel(props) {
1440
2017
  const { kind, file, title, emptyHint, record, history, translate, onRevert } = props;
1441
- const [confirmingVersion, setConfirmingVersion] = (0, import_react2.useState)(null);
1442
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.row, "data-testid": `identity-panel-${kind}`, children: [
1443
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.reviewHead, children: [
1444
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.title, children: title }),
1445
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.badges, children: record !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1446
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.badge, children: translate("identityCurrentVersion").replace("{version}", String(record.version)) }),
1447
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2018
+ const [confirmingVersion, setConfirmingVersion] = (0, import_react3.useState)(null);
2019
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.row, "data-testid": `identity-panel-${kind}`, children: [
2020
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.reviewHead, children: [
2021
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.title, children: title }),
2022
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.badges, children: record !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2023
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.badge, children: translate("identityCurrentVersion").replace("{version}", String(record.version)) }),
2024
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1448
2025
  "button",
1449
2026
  {
1450
2027
  type: "button",
@@ -1457,13 +2034,13 @@ function DocumentPanel(props) {
1457
2034
  )
1458
2035
  ] }) : null })
1459
2036
  ] }),
1460
- record === null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.empty, children: emptyHint }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1461
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: `${css.content} ${css.contentOpen}`, children: record.content }),
1462
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.list, children: [
1463
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: css.meta, children: translate("identityHistoryTitle") }),
1464
- history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.empty, children: translate("identityEmptyHistory") }) : history.map((snapshot) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.row, children: [
1465
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.content, children: `v${snapshot.version} \xB7 ${formatTs2(snapshot.ts)} \xB7 ${sourceLabel(snapshot.source, translate)}` }),
1466
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.actions, children: confirmingVersion === snapshot.version ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2037
+ record === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.empty, children: emptyHint }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2038
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { className: `${css.content} ${css.contentOpen}`, children: record.content }),
2039
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.list, children: [
2040
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css.meta, children: translate("identityHistoryTitle") }),
2041
+ history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.empty, children: translate("identityEmptyHistory") }) : history.map((snapshot) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.row, children: [
2042
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.content, children: `v${snapshot.version} \xB7 ${formatTs2(snapshot.ts)} \xB7 ${sourceLabel(snapshot.source, translate)}` }),
2043
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.actions, children: confirmingVersion === snapshot.version ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1467
2044
  "button",
1468
2045
  {
1469
2046
  type: "button",
@@ -1474,7 +2051,7 @@ function DocumentPanel(props) {
1474
2051
  },
1475
2052
  children: translate("identityRevertConfirm")
1476
2053
  }
1477
- ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2054
+ ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1478
2055
  "button",
1479
2056
  {
1480
2057
  type: "button",
@@ -1491,31 +2068,34 @@ function DocumentPanel(props) {
1491
2068
  ] });
1492
2069
  }
1493
2070
  function IdentitySection(props) {
2071
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css.panel, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css.panelInner, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IdentitySectionContent, { ...props }) }) });
2072
+ }
2073
+ function IdentitySectionContent(props) {
1494
2074
  const { useIdentitySection, t, load } = props;
1495
2075
  const state = useIdentitySection((snapshot) => snapshot);
1496
- (0, import_react2.useEffect)(() => {
2076
+ (0, import_react3.useEffect)(() => {
1497
2077
  void load();
1498
2078
  }, [load]);
1499
2079
  if (state.status === "error") {
1500
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.section, children: [
1501
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: css.title, children: t("identityNav") }),
1502
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
1503
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css.moreBtn, onClick: () => {
2080
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.section, children: [
2081
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: css.title, children: t("identityNav") }),
2082
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
2083
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css.moreBtn, onClick: () => {
1504
2084
  void load();
1505
2085
  }, children: t("retry") })
1506
2086
  ] });
1507
2087
  }
1508
2088
  if (state.status === "loading" || state.status === "idle") {
1509
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.section, children: [
1510
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: css.title, children: t("identityNav") }),
1511
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.intro, children: t("loading") })
2089
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.section, children: [
2090
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: css.title, children: t("identityNav") }),
2091
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.intro, children: t("loading") })
1512
2092
  ] });
1513
2093
  }
1514
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.section, children: [
1515
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: css.title, children: t("identityNav") }),
1516
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.intro, children: t("identitySectionIntro") }),
1517
- state.actionError !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.error, role: "alert", children: state.actionError }) : null,
1518
- KINDS.map(({ kind, titleKey, emptyKey, file }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2094
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.section, children: [
2095
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: css.title, children: t("identityNav") }),
2096
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.intro, children: t("identitySectionIntro") }),
2097
+ state.actionError !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.error, role: "alert", children: state.actionError }) : null,
2098
+ KINDS.map(({ kind, titleKey, emptyKey, file }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1519
2099
  DocumentPanel,
1520
2100
  {
1521
2101
  kind,
@@ -1924,24 +2504,24 @@ var cls2 = {
1924
2504
  var css2 = (inject2(), cls2);
1925
2505
 
1926
2506
  // src/client/MemoryPluginCard.tsx
1927
- var import_react4 = require("react");
2507
+ var import_react5 = require("react");
1928
2508
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
1929
2509
 
1930
2510
  // src/client/fields.tsx
1931
- var import_jsx_runtime3 = require("react/jsx-runtime");
2511
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1932
2512
  function FieldHead(props) {
1933
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.head, children: [
1934
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: css2.label, htmlFor: props.id, children: props.label }),
1935
- props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.badges, children: [
1936
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: props.overriddenLabel }),
1937
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.reset, disabled: props.disabled, onClick: props.onReset, children: props.resetLabel })
2513
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.head, children: [
2514
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: css2.label, htmlFor: props.id, children: props.label }),
2515
+ props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css2.badges, children: [
2516
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css2.badge, children: props.overriddenLabel }),
2517
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css2.reset, disabled: props.disabled, onClick: props.onReset, children: props.resetLabel })
1938
2518
  ] }) : null
1939
2519
  ] });
1940
2520
  }
1941
2521
  function SelectField(props) {
1942
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.field, children: [
1943
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FieldHead, { ...props }),
1944
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2522
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.field, children: [
2523
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldHead, { ...props }),
2524
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1945
2525
  "select",
1946
2526
  {
1947
2527
  id: props.id,
@@ -1949,16 +2529,16 @@ function SelectField(props) {
1949
2529
  value: props.value,
1950
2530
  disabled: props.disabled,
1951
2531
  onChange: (e) => props.onChange(e.target.value),
1952
- children: props.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: o.value, children: o.label }, o.value))
2532
+ children: props.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: o.value, children: o.label }, o.value))
1953
2533
  }
1954
2534
  ),
1955
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.hint, children: props.hint })
2535
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css2.hint, children: props.hint })
1956
2536
  ] });
1957
2537
  }
1958
2538
  function TextField(props) {
1959
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.field, children: [
1960
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FieldHead, { ...props }),
1961
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2539
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.field, children: [
2540
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldHead, { ...props }),
2541
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1962
2542
  "input",
1963
2543
  {
1964
2544
  id: props.id,
@@ -1969,13 +2549,13 @@ function TextField(props) {
1969
2549
  onChange: (e) => props.onChange(e.target.value)
1970
2550
  }
1971
2551
  ),
1972
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.hint, children: props.hint })
2552
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css2.hint, children: props.hint })
1973
2553
  ] });
1974
2554
  }
1975
2555
  function NumberField(props) {
1976
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.field, children: [
1977
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FieldHead, { ...props }),
1978
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2556
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.field, children: [
2557
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldHead, { ...props }),
2558
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1979
2559
  "input",
1980
2560
  {
1981
2561
  id: props.id,
@@ -1988,14 +2568,14 @@ function NumberField(props) {
1988
2568
  onChange: (e) => props.onChange(e.target.value)
1989
2569
  }
1990
2570
  ),
1991
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: props.invalid ? css2.invalid : css2.hint, children: props.invalid ? props.invalidLabel : props.hint })
2571
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: props.invalid ? css2.invalid : css2.hint, children: props.invalid ? props.invalidLabel : props.hint })
1992
2572
  ] });
1993
2573
  }
1994
2574
  function CheckboxField(props) {
1995
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.field, children: [
1996
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.head, children: [
1997
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.checkRow, children: [
1998
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2575
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.field, children: [
2576
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.head, children: [
2577
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css2.checkRow, children: [
2578
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1999
2579
  "input",
2000
2580
  {
2001
2581
  id: props.id,
@@ -2006,20 +2586,20 @@ function CheckboxField(props) {
2006
2586
  onChange: (e) => props.onChange(e.target.checked)
2007
2587
  }
2008
2588
  ),
2009
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: css2.checkLabel, htmlFor: props.id, children: props.label })
2589
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: css2.checkLabel, htmlFor: props.id, children: props.label })
2010
2590
  ] }),
2011
- props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.badges, children: [
2012
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: props.overriddenLabel }),
2013
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.reset, disabled: props.disabled, onClick: props.onReset, children: props.resetLabel })
2591
+ props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css2.badges, children: [
2592
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css2.badge, children: props.overriddenLabel }),
2593
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css2.reset, disabled: props.disabled, onClick: props.onReset, children: props.resetLabel })
2014
2594
  ] }) : null
2015
2595
  ] }),
2016
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.hint, children: props.hint })
2596
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css2.hint, children: props.hint })
2017
2597
  ] });
2018
2598
  }
2019
2599
  function TextareaField(props) {
2020
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.field, children: [
2021
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FieldHead, { ...props }),
2022
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2600
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.field, children: [
2601
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldHead, { ...props }),
2602
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2023
2603
  "textarea",
2024
2604
  {
2025
2605
  id: props.id,
@@ -2030,14 +2610,14 @@ function TextareaField(props) {
2030
2610
  onChange: (e) => props.onChange(e.target.value)
2031
2611
  }
2032
2612
  ),
2033
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.hint, children: props.hint })
2613
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css2.hint, children: props.hint })
2034
2614
  ] });
2035
2615
  }
2036
2616
 
2037
2617
  // src/client/form.ts
2038
- var import_react3 = require("react");
2618
+ var import_react4 = require("react");
2039
2619
  function useFormSnapshot(form) {
2040
- return (0, import_react3.useSyncExternalStore)(
2620
+ return (0, import_react4.useSyncExternalStore)(
2041
2621
  (listener) => form.subscribe(listener),
2042
2622
  () => form.getSnapshot()
2043
2623
  );
@@ -2059,7 +2639,7 @@ async function submitSection(form, draft, committed) {
2059
2639
  }
2060
2640
 
2061
2641
  // src/client/MemoryPluginCard.tsx
2062
- var import_jsx_runtime4 = require("react/jsx-runtime");
2642
+ var import_jsx_runtime6 = require("react/jsx-runtime");
2063
2643
  var MODES = ["digest", "policy-only", "full", "index", "custom", "off"];
2064
2644
  var DEFAULTS = {
2065
2645
  memoryMode: "digest",
@@ -2074,12 +2654,12 @@ var NUMERIC_FIELDS = ["memoryCharLimit", "memoryDigestCharLimit", "memoryMaxEntr
2074
2654
  function MemorySection2(props) {
2075
2655
  const snap = useFormSnapshot(props.form);
2076
2656
  const t = props.t;
2077
- const [open, setOpen] = (0, import_react4.useState)(false);
2657
+ const [open, setOpen] = (0, import_react5.useState)(false);
2078
2658
  const committed = snap.value ?? {};
2079
- const [draft, setDraft] = (0, import_react4.useState)({ ...DEFAULTS, ...committed });
2080
- const [saving, setSaving] = (0, import_react4.useState)(false);
2081
- const [failed, setFailed] = (0, import_react4.useState)(false);
2082
- (0, import_react4.useEffect)(() => {
2659
+ const [draft, setDraft] = (0, import_react5.useState)({ ...DEFAULTS, ...committed });
2660
+ const [saving, setSaving] = (0, import_react5.useState)(false);
2661
+ const [failed, setFailed] = (0, import_react5.useState)(false);
2662
+ (0, import_react5.useEffect)(() => {
2083
2663
  setDraft({ ...DEFAULTS, ...committed });
2084
2664
  setFailed(false);
2085
2665
  }, [committed]);
@@ -2114,8 +2694,8 @@ function MemorySection2(props) {
2114
2694
  setDraft({ ...DEFAULTS, ...committed });
2115
2695
  setFailed(false);
2116
2696
  };
2117
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { className: `${css2.card}${open ? ` ${css2.cardOpen}` : ""}`, children: [
2118
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2697
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: `${css2.card}${open ? ` ${css2.cardOpen}` : ""}`, children: [
2698
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
2119
2699
  "button",
2120
2700
  {
2121
2701
  type: "button",
@@ -2126,18 +2706,18 @@ function MemorySection2(props) {
2126
2706
  setOpen(!open);
2127
2707
  },
2128
2708
  children: [
2129
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css2.headText, children: [
2130
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.name, children: t("cardTitle") }),
2131
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.description, children: t("cardDescription") })
2709
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: css2.headText, children: [
2710
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css2.name, children: t("cardTitle") }),
2711
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css2.description, children: t("cardDescription") })
2132
2712
  ] }),
2133
- dirty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.pending, children: t("unsaved") }) : null,
2134
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: `${css2.chevron}${open ? ` ${css2.chevronOpen}` : ""}` })
2713
+ dirty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: css2.pending, children: t("unsaved") }) : null,
2714
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: `${css2.chevron}${open ? ` ${css2.chevronOpen}` : ""}` })
2135
2715
  ]
2136
2716
  }
2137
2717
  ),
2138
- open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.body, children: [
2139
- !snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.readOnly, role: "status", children: t("readOnly") }) : null,
2140
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2718
+ open ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css2.body, children: [
2719
+ !snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css2.readOnly, role: "status", children: t("readOnly") }) : null,
2720
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2141
2721
  SelectField,
2142
2722
  {
2143
2723
  id: "dsh-memory-mode",
@@ -2156,7 +2736,7 @@ function MemorySection2(props) {
2156
2736
  }
2157
2737
  }
2158
2738
  ),
2159
- draft.memoryMode === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2739
+ draft.memoryMode === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2160
2740
  TextareaField,
2161
2741
  {
2162
2742
  id: "dsh-memory-custom-policy",
@@ -2174,7 +2754,7 @@ function MemorySection2(props) {
2174
2754
  }
2175
2755
  }
2176
2756
  ) : null,
2177
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2757
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2178
2758
  NumberField,
2179
2759
  {
2180
2760
  id: "dsh-memory-char-limit",
@@ -2194,7 +2774,7 @@ function MemorySection2(props) {
2194
2774
  }
2195
2775
  }
2196
2776
  ),
2197
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2777
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2198
2778
  NumberField,
2199
2779
  {
2200
2780
  id: "dsh-memory-digest-char-limit",
@@ -2214,7 +2794,7 @@ function MemorySection2(props) {
2214
2794
  }
2215
2795
  }
2216
2796
  ),
2217
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2797
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2218
2798
  NumberField,
2219
2799
  {
2220
2800
  id: "dsh-memory-max-entries",
@@ -2234,7 +2814,7 @@ function MemorySection2(props) {
2234
2814
  }
2235
2815
  }
2236
2816
  ),
2237
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2817
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2238
2818
  NumberField,
2239
2819
  {
2240
2820
  id: "dsh-memory-max-search",
@@ -2254,7 +2834,7 @@ function MemorySection2(props) {
2254
2834
  }
2255
2835
  }
2256
2836
  ),
2257
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2837
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2258
2838
  NumberField,
2259
2839
  {
2260
2840
  id: "dsh-memory-decay-days",
@@ -2274,30 +2854,30 @@ function MemorySection2(props) {
2274
2854
  }
2275
2855
  }
2276
2856
  ),
2277
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.footer, children: [
2278
- failed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.failed, role: "status", children: t("saveFailed") }) : null,
2279
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css2.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
2280
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css2.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
2857
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: css2.footer, children: [
2858
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: css2.failed, role: "status", children: t("saveFailed") }) : null,
2859
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: css2.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
2860
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: css2.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
2281
2861
  ] })
2282
2862
  ] }) : null
2283
2863
  ] });
2284
2864
  }
2285
2865
 
2286
2866
  // src/client/NamespaceCard.tsx
2287
- var import_react5 = require("react");
2867
+ var import_react6 = require("react");
2288
2868
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
2289
- var import_jsx_runtime5 = require("react/jsx-runtime");
2869
+ var import_jsx_runtime7 = require("react/jsx-runtime");
2290
2870
  var MODEL_CATALOG_TIMEOUT_MS = 15e3;
2291
2871
  function NamespaceSection(props) {
2292
2872
  const snap = useFormSnapshot(props.form);
2293
2873
  const t = props.t;
2294
2874
  const spec = props.spec;
2295
- const [open, setOpen] = (0, import_react5.useState)(false);
2875
+ const [open, setOpen] = (0, import_react6.useState)(false);
2296
2876
  const canLoadCatalog = typeof props.loadCatalog === "function";
2297
- const catalogStartedRef = (0, import_react5.useRef)(false);
2298
- const [catalog, setCatalog] = (0, import_react5.useState)(void 0);
2299
- const [catalogStatus, setCatalogStatus] = (0, import_react5.useState)("idle");
2300
- (0, import_react5.useEffect)(() => {
2877
+ const catalogStartedRef = (0, import_react6.useRef)(false);
2878
+ const [catalog, setCatalog] = (0, import_react6.useState)(void 0);
2879
+ const [catalogStatus, setCatalogStatus] = (0, import_react6.useState)("idle");
2880
+ (0, import_react6.useEffect)(() => {
2301
2881
  if (!open || !canLoadCatalog || catalogStartedRef.current) return;
2302
2882
  catalogStartedRef.current = true;
2303
2883
  setCatalogStatus("loading");
@@ -2318,10 +2898,10 @@ function NamespaceSection(props) {
2318
2898
  })();
2319
2899
  }, [open, canLoadCatalog]);
2320
2900
  const committed = snap.value ?? {};
2321
- const [draft, setDraft] = (0, import_react5.useState)({ ...committed });
2322
- const [saving, setSaving] = (0, import_react5.useState)(false);
2323
- const [failed, setFailed] = (0, import_react5.useState)(false);
2324
- (0, import_react5.useEffect)(() => {
2901
+ const [draft, setDraft] = (0, import_react6.useState)({ ...committed });
2902
+ const [saving, setSaving] = (0, import_react6.useState)(false);
2903
+ const [failed, setFailed] = (0, import_react6.useState)(false);
2904
+ (0, import_react6.useEffect)(() => {
2325
2905
  setDraft({ ...committed });
2326
2906
  setFailed(false);
2327
2907
  }, [committed]);
@@ -2360,7 +2940,7 @@ function NamespaceSection(props) {
2360
2940
  const renderSelectField = (field, base) => {
2361
2941
  const rawValue = typeof draft[field.key] === "string" ? draft[field.key] : "";
2362
2942
  if (!canLoadCatalog || catalogStatus === "failed") {
2363
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2943
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2364
2944
  TextField,
2365
2945
  {
2366
2946
  ...base,
@@ -2371,7 +2951,7 @@ function NamespaceSection(props) {
2371
2951
  );
2372
2952
  }
2373
2953
  if (catalogStatus !== "ready") {
2374
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2954
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2375
2955
  SelectField,
2376
2956
  {
2377
2957
  ...base,
@@ -2385,7 +2965,7 @@ function NamespaceSection(props) {
2385
2965
  }
2386
2966
  const resolved = field.options?.({ catalog, draft }) ?? [];
2387
2967
  if (resolved.length === 0) {
2388
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2968
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2389
2969
  TextField,
2390
2970
  {
2391
2971
  ...base,
@@ -2399,7 +2979,7 @@ function NamespaceSection(props) {
2399
2979
  if (rawValue !== "" && !opts.some((o) => o.value === rawValue)) {
2400
2980
  opts.push({ value: rawValue, label: rawValue });
2401
2981
  }
2402
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2982
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2403
2983
  SelectField,
2404
2984
  {
2405
2985
  ...base,
@@ -2409,8 +2989,8 @@ function NamespaceSection(props) {
2409
2989
  }
2410
2990
  );
2411
2991
  };
2412
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: `${css2.card}${open ? ` ${css2.cardOpen}` : ""}`, children: [
2413
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2992
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { className: `${css2.card}${open ? ` ${css2.cardOpen}` : ""}`, children: [
2993
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2414
2994
  "button",
2415
2995
  {
2416
2996
  type: "button",
@@ -2421,17 +3001,17 @@ function NamespaceSection(props) {
2421
3001
  setOpen(!open);
2422
3002
  },
2423
3003
  children: [
2424
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css2.headText, children: [
2425
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css2.name, children: t(spec.titleKey) }),
2426
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css2.description, children: t(spec.descriptionKey) })
3004
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: css2.headText, children: [
3005
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: css2.name, children: t(spec.titleKey) }),
3006
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: css2.description, children: t(spec.descriptionKey) })
2427
3007
  ] }),
2428
- dirty ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css2.pending, children: t("unsaved") }) : null,
2429
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives2.IconChevronDownOutlineMedium, { className: `${css2.chevron}${open ? ` ${css2.chevronOpen}` : ""}` })
3008
+ dirty ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: css2.pending, children: t("unsaved") }) : null,
3009
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dsh_client_ui_primitives2.IconChevronDownOutlineMedium, { className: `${css2.chevron}${open ? ` ${css2.chevronOpen}` : ""}` })
2430
3010
  ]
2431
3011
  }
2432
3012
  ),
2433
- open ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.body, children: [
2434
- !snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css2.readOnly, role: "status", children: t("readOnly") }) : null,
3013
+ open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: css2.body, children: [
3014
+ !snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: css2.readOnly, role: "status", children: t("readOnly") }) : null,
2435
3015
  spec.fields.map((field) => {
2436
3016
  const label = t(field.labelKey ?? field.key);
2437
3017
  const hint = t(field.hintKey ?? `${field.key}Hint`);
@@ -2450,7 +3030,7 @@ function NamespaceSection(props) {
2450
3030
  }
2451
3031
  };
2452
3032
  if (field.kind === "checkbox") {
2453
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3033
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2454
3034
  CheckboxField,
2455
3035
  {
2456
3036
  ...base,
@@ -2461,7 +3041,7 @@ function NamespaceSection(props) {
2461
3041
  }
2462
3042
  if (field.kind === "number") {
2463
3043
  const raw = draft[field.key];
2464
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3044
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2465
3045
  NumberField,
2466
3046
  {
2467
3047
  ...base,
@@ -2475,7 +3055,7 @@ function NamespaceSection(props) {
2475
3055
  if (field.kind === "select") {
2476
3056
  return renderSelectField(field, base);
2477
3057
  }
2478
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3058
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2479
3059
  TextField,
2480
3060
  {
2481
3061
  ...base,
@@ -2484,10 +3064,10 @@ function NamespaceSection(props) {
2484
3064
  }
2485
3065
  );
2486
3066
  }),
2487
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css2.footer, children: [
2488
- failed ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css2.failed, role: "status", children: t("saveFailed") }) : null,
2489
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css2.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
2490
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css2.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
3067
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: css2.footer, children: [
3068
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: css2.failed, role: "status", children: t("saveFailed") }) : null,
3069
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: css2.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
3070
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: css2.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
2491
3071
  ] })
2492
3072
  ] }) : null
2493
3073
  ] });
@@ -2526,7 +3106,7 @@ function consolidationOptions() {
2526
3106
  }
2527
3107
 
2528
3108
  // src/client/SettingsPage.tsx
2529
- var import_jsx_runtime6 = require("react/jsx-runtime");
3109
+ var import_jsx_runtime8 = require("react/jsx-runtime");
2530
3110
  var MEMORY_ENTRY_IDS = ["memory", "memory-review", "memory-identity", "memory-notes", "memory-autorecall"];
2531
3111
  var NOTES_SPEC = {
2532
3112
  titleKey: "notesCardTitle",
@@ -2555,8 +3135,7 @@ var IDENTITY_SPEC = {
2555
3135
  fields: [
2556
3136
  { key: "identityEnabled", kind: "checkbox" },
2557
3137
  { key: "soulCharLimit", kind: "number", minValue: 0 },
2558
- { key: "userCharLimit", kind: "number", minValue: 0 },
2559
- { key: "identitySeedDir", kind: "text" }
3138
+ { key: "userCharLimit", kind: "number", minValue: 0 }
2560
3139
  ]
2561
3140
  };
2562
3141
  var REVIEW_SPEC = {
@@ -2602,12 +3181,12 @@ function SettingsPage(props) {
2602
3181
  if (props.view !== "page") return null;
2603
3182
  const t = props.t;
2604
3183
  const { forms, loadCatalog } = props;
2605
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ul", { className: css2.pageList, children: [
2606
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MemorySection2, { form: forms.memory, t }),
2607
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NamespaceSection, { spec: NOTES_SPEC, form: forms["memory-notes"], t }),
2608
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NamespaceSection, { spec: AUTORECALL_SPEC, form: forms["memory-autorecall"], t }),
2609
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NamespaceSection, { spec: IDENTITY_SPEC, form: forms["memory-identity"], t }),
2610
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NamespaceSection, { spec: REVIEW_SPEC, form: forms["memory-review"], t, ...loadCatalog === void 0 ? {} : { loadCatalog } })
3184
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("ul", { className: css2.pageList, children: [
3185
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MemorySection2, { form: forms.memory, t }),
3186
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NamespaceSection, { spec: NOTES_SPEC, form: forms["memory-notes"], t }),
3187
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NamespaceSection, { spec: AUTORECALL_SPEC, form: forms["memory-autorecall"], t }),
3188
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NamespaceSection, { spec: IDENTITY_SPEC, form: forms["memory-identity"], t }),
3189
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NamespaceSection, { spec: REVIEW_SPEC, form: forms["memory-review"], t, ...loadCatalog === void 0 ? {} : { loadCatalog } })
2611
3190
  ] });
2612
3191
  }
2613
3192
 
@@ -2709,6 +3288,59 @@ function messageOf2(error) {
2709
3288
  return error instanceof Error ? error.message : String(error);
2710
3289
  }
2711
3290
 
3291
+ // src/client/panel-icons.tsx
3292
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3293
+ function MemoryPanelIcon(props) {
3294
+ const { size, active } = props;
3295
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3296
+ "svg",
3297
+ {
3298
+ width: size,
3299
+ height: size,
3300
+ viewBox: "0 0 16 16",
3301
+ fill: "none",
3302
+ "aria-hidden": "true",
3303
+ focusable: "false",
3304
+ "data-memory-panel-icon": "",
3305
+ children: [
3306
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3307
+ "path",
3308
+ {
3309
+ d: "M8 1.9 14 5 8 8.1 2 5l6-3.1Z",
3310
+ stroke: "currentColor",
3311
+ strokeWidth: active ? 1.4 : 1.2,
3312
+ strokeLinejoin: "round",
3313
+ opacity: active ? 1 : 0.85
3314
+ }
3315
+ ),
3316
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M2 8.1 8 11.2l6-3.1", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", opacity: active ? 1 : 0.85 }),
3317
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M2 11.2 8 14.3l6-3.1", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", opacity: active ? 1 : 0.6 })
3318
+ ]
3319
+ }
3320
+ );
3321
+ }
3322
+ function IdentityPanelIcon(props) {
3323
+ const { size, active } = props;
3324
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3325
+ "svg",
3326
+ {
3327
+ width: size,
3328
+ height: size,
3329
+ viewBox: "0 0 16 16",
3330
+ fill: "none",
3331
+ "aria-hidden": "true",
3332
+ focusable: "false",
3333
+ "data-identity-panel-icon": "",
3334
+ children: [
3335
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "6", cy: "5.2", r: "2.3", stroke: "currentColor", strokeWidth: "1.2", opacity: active ? 1 : 0.85 }),
3336
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M1.9 13.4c.4-2.5 2-3.9 4.1-3.9s3.7 1.4 4.1 3.9", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", opacity: active ? 1 : 0.85 }),
3337
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M10.3 3.2a2.2 2.2 0 0 1 0 4", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", opacity: active ? 1 : 0.6 }),
3338
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M11.5 9.6c1.3.4 2.2 1.4 2.5 3.2", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", opacity: active ? 1 : 0.6 })
3339
+ ]
3340
+ }
3341
+ );
3342
+ }
3343
+
2712
3344
  // src/client/locales.ts
2713
3345
  var en = {
2714
3346
  // Card chrome (mirrors the PluginCard shell's keys).
@@ -2837,6 +3469,51 @@ var en = {
2837
3469
  dashLastActivity: "Last activity",
2838
3470
  dashLastActivityNever: "never",
2839
3471
  dashLastExtraction: "Last extraction",
3472
+ // ── Operation counters (reads that write no audit row) ──
3473
+ metricsTitle: "Operation counters (this process)",
3474
+ metricsHint: "Counts since the host started: searches, injections, extraction calls, and usage hits. They reset on restart and are never persisted.",
3475
+ metricLabelToolSearch: "tool searches",
3476
+ metricLabelSearchFallback: "recency fallbacks",
3477
+ metricLabelAutoRecallSteps: "auto-recall steps",
3478
+ metricLabelAutoRecallHits: "auto-recall hits",
3479
+ metricLabelDigest: "digests emitted",
3480
+ metricLabelExtractCalls: "extraction calls",
3481
+ metricLabelHits: "usage hits",
3482
+ metricLabelFlush: "compaction flushes",
3483
+ metricLabelFlushDispose: "dispose flushes",
3484
+ metricLabelCurator: "curator passes",
3485
+ metricsNone: "Nothing counted yet in this process.",
3486
+ failuresTitle: "Swallowed background failures",
3487
+ failuresHint: "Best-effort paths (flush, janitor, curator, judge, audit append) report here instead of throwing. A non-zero count means something degraded silently \u2014 the host log has the detail.",
3488
+ failuresNone: "No background failure was swallowed.",
3489
+ // ── Audit trail tab ──
3490
+ tabAudit: "Audit",
3491
+ auditIntro: "Every mutation the store applies, newest first: additions, edits, removals, and the reads that asked for unredacted content. Usage hits are counters, not mutations, so they never appear here.",
3492
+ auditEmpty: "No audit records match the filters.",
3493
+ auditEmptyAll: "The audit trail is empty: no mutation has been applied in this store yet.",
3494
+ auditFilterOp: "Operation",
3495
+ auditFilterSource: "Source",
3496
+ auditColTime: "Time",
3497
+ auditColOp: "Op",
3498
+ auditColSource: "Source",
3499
+ auditColScope: "Scope",
3500
+ auditColPreview: "Entry",
3501
+ auditRefresh: "Refresh",
3502
+ auditFailed: "The audit trail could not be loaded.",
3503
+ auditShowing: "Newest {count} records (cap {limit}).",
3504
+ // ── Create form (manage tab) ──
3505
+ createTitle: "New memory",
3506
+ createHint: "Written through the same store path the tools use, with the same scanner gates. Use it for facts you want remembered without waiting for extraction.",
3507
+ createScope: "Scope",
3508
+ createContent: "Content",
3509
+ createContentPlaceholder: "One self-contained fact, written so it reads on its own.",
3510
+ createCategory: "Category",
3511
+ createSummary: "Summary (optional)",
3512
+ createProject: "Workspace (project scope only)",
3513
+ createSubmit: "Save memory",
3514
+ createCancel: "Cancel",
3515
+ createSaved: "Saved.",
3516
+ createFailed: "The entry was rejected.",
2840
3517
  scopeAll: "All",
2841
3518
  scopeGlobal: "Global",
2842
3519
  scopeUser: "User",
@@ -2876,6 +3553,9 @@ var en = {
2876
3553
  reviewEmpty: "No pending proposals. With human review enabled, extraction and tool writes land here for your decision.",
2877
3554
  hitsBadge: "seen \xD7{hits}",
2878
3555
  updateProposalBadge: "update proposal",
3556
+ actionRemoveBadge: "removal proposal",
3557
+ actionPinBadge: "pin proposal",
3558
+ actionUnpinBadge: "unpin proposal",
2879
3559
  metaSeen: "last seen",
2880
3560
  metaFirstSeen: "first seen",
2881
3561
  adoptAction: "Adopt",
@@ -3042,6 +3722,51 @@ var zh = {
3042
3722
  dashAudit: "\u5BA1\u8BA1\u8BB0\u5F55",
3043
3723
  dashLastActivity: "\u6700\u8FD1\u6D3B\u52A8",
3044
3724
  dashLastActivityNever: "\u6682\u65E0",
3725
+ // ── 操作计数器(不写审计记录的读路径) ──
3726
+ metricsTitle: "\u64CD\u4F5C\u8BA1\u6570\uFF08\u672C\u8FDB\u7A0B\uFF09",
3727
+ metricsHint: "\u81EA\u5BBF\u4E3B\u542F\u52A8\u4EE5\u6765\u7684\u8BA1\u6570\uFF1A\u68C0\u7D22\u3001\u6CE8\u5165\u3001\u63D0\u53D6\u8C03\u7528\u4E0E\u4F7F\u7528\u547D\u4E2D\u3002\u91CD\u542F\u5373\u6E05\u96F6\uFF0C\u4ECE\u4E0D\u6301\u4E45\u5316\u3002",
3728
+ metricLabelToolSearch: "\u5DE5\u5177\u68C0\u7D22",
3729
+ metricLabelSearchFallback: "\u96F6\u547D\u4E2D\u515C\u5E95",
3730
+ metricLabelAutoRecallSteps: "\u81EA\u52A8\u53EC\u56DE\u6B65\u6570",
3731
+ metricLabelAutoRecallHits: "\u81EA\u52A8\u53EC\u56DE\u547D\u4E2D",
3732
+ metricLabelDigest: "\u6E05\u5355\u6CE8\u5165",
3733
+ metricLabelExtractCalls: "\u63D0\u53D6\u8C03\u7528",
3734
+ metricLabelHits: "\u4F7F\u7528\u547D\u4E2D",
3735
+ metricLabelFlush: "\u538B\u7F29\u51B2\u5237",
3736
+ metricLabelFlushDispose: "\u9500\u6BC1\u51B2\u5237",
3737
+ metricLabelCurator: "\u7B56\u5C55\u6B21\u6570",
3738
+ metricsNone: "\u672C\u8FDB\u7A0B\u5C1A\u672A\u8BB0\u5F55\u4EFB\u4F55\u8BA1\u6570\u3002",
3739
+ failuresTitle: "\u88AB\u541E\u6389\u7684\u540E\u53F0\u5931\u8D25",
3740
+ failuresHint: "\u5C3D\u529B\u800C\u4E3A\u7684\u8DEF\u5F84\uFF08\u51B2\u5237\u3001\u6E05\u7406\u3001\u7B56\u5C55\u3001\u88C1\u51B3\u3001\u5BA1\u8BA1\u8FFD\u52A0\uFF09\u5728\u8FD9\u91CC\u6C47\u62A5\u800C\u4E0D\u629B\u51FA\u3002\u8BA1\u6570\u975E\u96F6\u8868\u793A\u67D0\u5904\u5DF2\u9759\u9ED8\u964D\u7EA7\u2014\u2014\u7EC6\u8282\u5728\u5BBF\u4E3B\u65E5\u5FD7\u3002",
3741
+ failuresNone: "\u6CA1\u6709\u540E\u53F0\u5931\u8D25\u88AB\u541E\u6389\u3002",
3742
+ // ── 审计轨迹 tab ──
3743
+ tabAudit: "\u5BA1\u8BA1",
3744
+ auditIntro: "\u5B58\u50A8\u5C42\u5B9E\u9645\u6267\u884C\u7684\u6BCF\u6B21\u53D8\u66F4\uFF0C\u6700\u65B0\u5728\u524D\uFF1A\u65B0\u589E\u3001\u7F16\u8F91\u3001\u5220\u9664\uFF0C\u4EE5\u53CA\u8BF7\u6C42\u672A\u8131\u654F\u6B63\u6587\u7684\u8BFB\u53D6\u3002\u4F7F\u7528\u547D\u4E2D\u662F\u8BA1\u6570\u5668\u800C\u975E\u53D8\u66F4\uFF0C\u56E0\u6B64\u4E0D\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",
3745
+ auditEmpty: "\u6CA1\u6709\u5339\u914D\u7B5B\u9009\u6761\u4EF6\u7684\u5BA1\u8BA1\u8BB0\u5F55\u3002",
3746
+ auditEmptyAll: "\u5BA1\u8BA1\u8F68\u8FF9\u4E3A\u7A7A\uFF1A\u8FD9\u4E2A\u5B58\u50A8\u8FD8\u6CA1\u6709\u6267\u884C\u8FC7\u4EFB\u4F55\u53D8\u66F4\u3002",
3747
+ auditFilterOp: "\u64CD\u4F5C",
3748
+ auditFilterSource: "\u6765\u6E90",
3749
+ auditColTime: "\u65F6\u95F4",
3750
+ auditColOp: "\u64CD\u4F5C",
3751
+ auditColSource: "\u6765\u6E90",
3752
+ auditColScope: "\u4F5C\u7528\u57DF",
3753
+ auditColPreview: "\u6761\u76EE",
3754
+ auditRefresh: "\u5237\u65B0",
3755
+ auditFailed: "\u5BA1\u8BA1\u8F68\u8FF9\u52A0\u8F7D\u5931\u8D25\u3002",
3756
+ auditShowing: "\u6700\u65B0 {count} \u6761\u8BB0\u5F55\uFF08\u4E0A\u9650 {limit}\uFF09\u3002",
3757
+ // ── 新建记忆表单(管理 tab) ──
3758
+ createTitle: "\u65B0\u5EFA\u8BB0\u5FC6",
3759
+ createHint: "\u8D70\u5DE5\u5177\u6240\u7528\u7684\u540C\u4E00\u6761\u5199\u5165\u8DEF\u5F84\uFF0C\u542B\u540C\u6837\u7684\u626B\u63CF\u95E8\u7981\u3002\u7528\u4E8E\u90A3\u4E9B\u4F60\u4E0D\u60F3\u7B49\u81EA\u52A8\u63D0\u53D6\u3001\u5E0C\u671B\u7ACB\u523B\u8BB0\u4E0B\u7684\u4E8B\u5B9E\u3002",
3760
+ createScope: "\u4F5C\u7528\u57DF",
3761
+ createContent: "\u6B63\u6587",
3762
+ createContentPlaceholder: "\u4E00\u6761\u81EA\u6D3D\u7684\u4E8B\u5B9E\uFF0C\u5199\u6E05\u5230\u8131\u79BB\u4E0A\u4E0B\u6587\u4E5F\u80FD\u8BFB\u61C2\u3002",
3763
+ createCategory: "\u7C7B\u522B",
3764
+ createSummary: "\u6458\u8981\uFF08\u53EF\u9009\uFF09",
3765
+ createProject: "\u5DE5\u4F5C\u533A\uFF08\u4EC5\u9879\u76EE\u4F5C\u7528\u57DF\uFF09",
3766
+ createSubmit: "\u4FDD\u5B58\u8BB0\u5FC6",
3767
+ createCancel: "\u53D6\u6D88",
3768
+ createSaved: "\u5DF2\u4FDD\u5B58\u3002",
3769
+ createFailed: "\u6761\u76EE\u88AB\u62D2\u7EDD\u3002",
3045
3770
  dashLastExtraction: "\u6700\u8FD1\u63D0\u53D6",
3046
3771
  scopeAll: "\u5168\u90E8",
3047
3772
  scopeGlobal: "\u5168\u5C40",
@@ -3082,6 +3807,9 @@ var zh = {
3082
3807
  reviewEmpty: "\u6682\u65E0\u5F85\u786E\u8BA4\u63D0\u8BAE\u3002\u5F00\u542F\u4EBA\u5DE5\u786E\u8BA4\u540E\uFF0C\u63D0\u53D6\u4E0E\u5DE5\u5177\u5199\u5165\u4F1A\u6C47\u96C6\u5230\u8FD9\u91CC\u7B49\u4F60\u88C1\u51B3\u3002",
3083
3808
  hitsBadge: "\u51FA\u73B0 \xD7{hits}",
3084
3809
  updateProposalBadge: "\u66F4\u65B0\u63D0\u8BAE",
3810
+ actionRemoveBadge: "\u5220\u9664\u63D0\u8BAE",
3811
+ actionPinBadge: "\u56FA\u5B9A\u63D0\u8BAE",
3812
+ actionUnpinBadge: "\u53D6\u6D88\u56FA\u5B9A\u63D0\u8BAE",
3085
3813
  metaSeen: "\u6700\u8FD1\u51FA\u73B0",
3086
3814
  metaFirstSeen: "\u9996\u6B21\u51FA\u73B0",
3087
3815
  adoptAction: "\u91C7\u7EB3",
@@ -3127,8 +3855,10 @@ var zh = {
3127
3855
  var inject3 = ["slots", "locale", "connection", "configForms"];
3128
3856
  var NS = "settings.memory";
3129
3857
  var BUNDLE_NAME = "@chenhw7/dsh-memory";
3130
- var SECTION_ORDER = 25;
3131
- var IDENTITY_SECTION_ORDER = 26;
3858
+ var MEMORY_PANEL_ORDER = 30;
3859
+ var IDENTITY_PANEL_ORDER = 31;
3860
+ var MEMORY_PANEL_KEY = "memory";
3861
+ var IDENTITY_PANEL_KEY = "identity";
3132
3862
  function createMemoryRemoteApi(connection) {
3133
3863
  const call = connection?.rpc?.call;
3134
3864
  if (typeof call !== "function") return void 0;
@@ -3166,6 +3896,8 @@ function createMemoryRemoteApi(connection) {
3166
3896
  suggestList: () => invoke("suggestList"),
3167
3897
  suggestAdopt: (request) => invoke("suggestAdopt", request),
3168
3898
  suggestReject: (request) => invoke("suggestReject", request),
3899
+ add: (request) => invoke("add", request),
3900
+ auditLog: (request) => invoke("auditLog", request),
3169
3901
  identityList: () => invoke("identityList"),
3170
3902
  identityHistory: (request) => invoke("identityHistory", request),
3171
3903
  identityRevert: (request) => invoke("identityRevert", request)
@@ -3233,29 +3965,52 @@ function apply(ctx) {
3233
3965
  togglePin: (entry) => controller.togglePin(entry),
3234
3966
  toggleArchive: (entry) => controller.toggleArchive(entry),
3235
3967
  adoptSuggestion: (id, edits) => controller.adoptSuggestion(id, edits),
3236
- rejectSuggestion: (id) => controller.rejectSuggestion(id)
3968
+ rejectSuggestion: (id) => controller.rejectSuggestion(id),
3969
+ loadAudit: () => controller.loadAudit(),
3970
+ toggleAuditFilter: (dimension, value) => controller.toggleAuditFilter(dimension, value),
3971
+ createEntry: (input) => controller.createEntry(input)
3237
3972
  });
3238
- ctx.slots.inject("settings.section", () => ctx.slots.register({
3239
- name: "settings.section",
3240
- id: "memory",
3241
- order: SECTION_ORDER,
3242
- label: () => ctx.locale.bind(NS)("nav"),
3243
- locale: NS,
3244
- inject: sectionInjected
3245
- }, MemorySection));
3973
+ ctx.effect(() => {
3974
+ const disposePage = ctx.slots.inject("main", () => ctx.slots.register({
3975
+ name: "main",
3976
+ key: MEMORY_PANEL_KEY,
3977
+ locale: NS,
3978
+ inject: sectionInjected
3979
+ }, MemorySection));
3980
+ const disposeIcon = ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
3981
+ name: "sidebar.panellist",
3982
+ id: MEMORY_PANEL_KEY,
3983
+ order: MEMORY_PANEL_ORDER,
3984
+ label: () => ctx.locale.bind(NS)("nav")
3985
+ }, MemoryPanelIcon));
3986
+ return () => {
3987
+ disposeIcon();
3988
+ disposePage();
3989
+ };
3990
+ }, "dsh-memory: memory panel");
3246
3991
  const identityInjected = () => ({
3247
3992
  hooks: { identitySection: identityController.store },
3248
3993
  load: () => identityController.load(),
3249
3994
  revert: (kind, version) => identityController.revert(kind, version)
3250
3995
  });
3251
- ctx.slots.inject("settings.section", () => ctx.slots.register({
3252
- name: "settings.section",
3253
- id: "identity",
3254
- order: IDENTITY_SECTION_ORDER,
3255
- label: () => ctx.locale.bind(NS)("identityNav"),
3256
- locale: NS,
3257
- inject: identityInjected
3258
- }, IdentitySection));
3996
+ ctx.effect(() => {
3997
+ const disposePage = ctx.slots.inject("main", () => ctx.slots.register({
3998
+ name: "main",
3999
+ key: IDENTITY_PANEL_KEY,
4000
+ locale: NS,
4001
+ inject: identityInjected
4002
+ }, IdentitySection));
4003
+ const disposeIcon = ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
4004
+ name: "sidebar.panellist",
4005
+ id: IDENTITY_PANEL_KEY,
4006
+ order: IDENTITY_PANEL_ORDER,
4007
+ label: () => ctx.locale.bind(NS)("identityNav")
4008
+ }, IdentityPanelIcon));
4009
+ return () => {
4010
+ disposeIcon();
4011
+ disposePage();
4012
+ };
4013
+ }, "dsh-memory: identity panel");
3259
4014
  }
3260
4015
 
3261
4016