@chenhw7/dsh-memory 0.4.0 → 0.5.1

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 (62) hide show
  1. package/README.md +29 -13
  2. package/README.zh-CN.md +29 -13
  3. package/lib/benchmark/index.d.ts +125 -0
  4. package/lib/benchmark/index.d.ts.map +1 -0
  5. package/lib/benchmark/index.js +150 -0
  6. package/lib/benchmark/index.js.map +1 -0
  7. package/lib/brand.d.ts +11 -0
  8. package/lib/brand.d.ts.map +1 -1
  9. package/lib/brand.js +7 -0
  10. package/lib/brand.js.map +1 -1
  11. package/lib/client/index.js +844 -185
  12. package/lib/context/index.d.ts +22 -3
  13. package/lib/context/index.d.ts.map +1 -1
  14. package/lib/context/index.js +59 -13
  15. package/lib/context/index.js.map +1 -1
  16. package/lib/context/policy.d.ts +6 -0
  17. package/lib/context/policy.d.ts.map +1 -1
  18. package/lib/context/policy.js +26 -9
  19. package/lib/context/policy.js.map +1 -1
  20. package/lib/index.d.ts +44 -5
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js +48 -2
  23. package/lib/index.js.map +1 -1
  24. package/lib/notes/index.d.ts +2 -2
  25. package/lib/notes/index.d.ts.map +1 -1
  26. package/lib/notes/index.js +52 -10
  27. package/lib/notes/index.js.map +1 -1
  28. package/lib/notes/scope.d.ts +2 -2
  29. package/lib/notes/scope.js +2 -2
  30. package/lib/notes/settings.d.ts +10 -0
  31. package/lib/notes/settings.d.ts.map +1 -1
  32. package/lib/notes/settings.js +17 -0
  33. package/lib/notes/settings.js.map +1 -1
  34. package/lib/notes/writer.d.ts +33 -0
  35. package/lib/notes/writer.d.ts.map +1 -1
  36. package/lib/notes/writer.js +61 -1
  37. package/lib/notes/writer.js.map +1 -1
  38. package/lib/remote/index.d.ts +71 -1
  39. package/lib/remote/index.d.ts.map +1 -1
  40. package/lib/remote/index.js +94 -1
  41. package/lib/remote/index.js.map +1 -1
  42. package/lib/remote/typert.remote-client.d.ts +31 -3
  43. package/lib/review/accumulator.d.ts +1 -1
  44. package/lib/review/accumulator.js +1 -1
  45. package/lib/review/extract.d.ts +48 -4
  46. package/lib/review/extract.d.ts.map +1 -1
  47. package/lib/review/extract.js +164 -11
  48. package/lib/review/extract.js.map +1 -1
  49. package/lib/review/index.d.ts +6 -0
  50. package/lib/review/index.d.ts.map +1 -1
  51. package/lib/review/index.js +12 -10
  52. package/lib/review/index.js.map +1 -1
  53. package/lib/store/index.d.ts +56 -3
  54. package/lib/store/index.d.ts.map +1 -1
  55. package/lib/store/index.js +238 -9
  56. package/lib/store/index.js.map +1 -1
  57. package/lib/tool/index.d.ts.map +1 -1
  58. package/lib/tool/index.js +156 -25
  59. package/lib/tool/index.js.map +1 -1
  60. package/lib/types.d.ts +83 -2
  61. package/lib/types.d.ts.map +1 -1
  62. package/package.json +25 -2
@@ -531,6 +531,7 @@ var DEFAULTS = {
531
531
  memoryMode: "policy-only",
532
532
  memoryPolicyCustomText: "",
533
533
  memoryCharLimit: 5e3,
534
+ memoryMaxEntries: 20,
534
535
  maxSearchResults: 50,
535
536
  decayDays: 30,
536
537
  notesEnabled: true,
@@ -539,7 +540,7 @@ var DEFAULTS = {
539
540
  notesAgentsPointer: true,
540
541
  notesMaxEntriesPerFile: 100
541
542
  };
542
- var NUMERIC_FIELDS = ["memoryCharLimit", "maxSearchResults", "decayDays", "notesCharLimit", "notesMaxEntriesPerFile"];
543
+ var NUMERIC_FIELDS = ["memoryCharLimit", "memoryMaxEntries", "maxSearchResults", "decayDays", "notesCharLimit", "notesMaxEntriesPerFile"];
543
544
  function isOverridden(snap, field) {
544
545
  const user = snap.user;
545
546
  if (user === void 0 || user === null || typeof user !== "object") return false;
@@ -673,6 +674,26 @@ function MemoryPluginCard(props) {
673
674
  }
674
675
  }
675
676
  ),
677
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
678
+ NumberField,
679
+ {
680
+ id: "dsh-memory-max-entries",
681
+ label: t("memoryMaxEntries"),
682
+ hint: t("memoryMaxEntriesHint"),
683
+ overridden: isOverridden(snap, "memoryMaxEntries"),
684
+ overriddenLabel: t("overridden"),
685
+ resetLabel: t("reset"),
686
+ invalidLabel: t("invalidNumber"),
687
+ invalid: numericInvalid("memoryMaxEntries"),
688
+ disabled,
689
+ value: draft.memoryMaxEntries ?? "",
690
+ onChange: (v) => edit("memoryMaxEntries", v === "" ? void 0 : Number(v)),
691
+ onReset: () => {
692
+ void props.unset("memoryMaxEntries");
693
+ edit("memoryMaxEntries", void 0);
694
+ }
695
+ }
696
+ ),
676
697
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
677
698
  NumberField,
678
699
  {
@@ -727,7 +748,7 @@ var import_react2 = require("react");
727
748
 
728
749
  // src/client/memory-section-store.ts
729
750
  var import_client = require("@deepseek-ai/dsh-client-runtime/client");
730
- var MEMORY_PAGE_SIZE = 100;
751
+ var MEMORY_BATCH_SIZE = 50;
731
752
  var MEMORY_CATEGORIES = [
732
753
  "failure",
733
754
  "correction",
@@ -753,11 +774,13 @@ var INITIAL = {
753
774
  projects: [],
754
775
  entries: [],
755
776
  total: 0,
777
+ loadingMore: false,
756
778
  scope: "all",
757
779
  projectName: null,
758
780
  query: "",
759
781
  categories: [],
760
- page: 0
782
+ pending: [],
783
+ actionError: null
761
784
  };
762
785
  function projectSelectable(scope) {
763
786
  return scope === "all" || scope === "project";
@@ -776,6 +799,11 @@ var MemorySectionController = class {
776
799
  store = (0, import_client.createSnapshotStore)(INITIAL);
777
800
  /** Guards against overlapping loads painting partial results. */
778
801
  seq = 0;
802
+ /**
803
+ * Full match set behind the active query/chips, cached between local
804
+ * reveals; null whenever plain browsing applies. See {@link fetchFirstBatch}.
805
+ */
806
+ matches = null;
779
807
  set(patch) {
780
808
  this.store.set({ ...this.store.getSnapshot(), ...patch });
781
809
  }
@@ -784,23 +812,33 @@ var MemorySectionController = class {
784
812
  const { scope } = this.store.getSnapshot();
785
813
  return scope === "all" ? void 0 : scope;
786
814
  }
815
+ /**
816
+ * Shared wire filter fields (scope + workspace) from the current snapshot.
817
+ */
818
+ wireFilters() {
819
+ const snapshot = this.store.getSnapshot();
820
+ const scope = this.wireScope();
821
+ return {
822
+ ...scope !== void 0 ? { scope } : {},
823
+ ...snapshot.projectName !== null && snapshot.projectName !== "" ? { projectName: snapshot.projectName } : {}
824
+ };
825
+ }
787
826
  requireApi() {
788
827
  if (this.api === void 0) throw new Error("the memory remote namespace is not mounted on this connection");
789
828
  return this.api;
790
829
  }
791
830
  /**
792
- * Fetch one page of entries under the committed filters. Plain browsing
793
- * pages remotely; an active query or chip set pulls the whole match set
794
- * once (search has no offset on the wire) and pages locally.
831
+ * Fetch the first batch under the committed filters. Plain browsing pages
832
+ * remotely; an active query or chip set pulls the whole match set once
833
+ * (search has no offset on the wire), caches it for local reveals, and
834
+ * unions multi-chip selections client-side (the wire takes one category).
795
835
  */
796
- async fetchPage() {
836
+ async fetchFirstBatch() {
797
837
  const snapshot = this.store.getSnapshot();
798
- const offset = snapshot.page * MEMORY_PAGE_SIZE;
799
838
  const trimmed = snapshot.query.trim();
800
839
  if (trimmed !== "" || snapshot.categories.length > 0) {
801
840
  const response2 = await this.requireApi().search({
802
- ...this.wireScope() !== void 0 ? { scope: this.wireScope() } : {},
803
- ...snapshot.projectName !== null && snapshot.projectName !== "" ? { projectName: snapshot.projectName } : {},
841
+ ...this.wireFilters(),
804
842
  ...trimmed !== "" ? { query: trimmed } : {},
805
843
  limit: 0
806
844
  });
@@ -809,23 +847,22 @@ var MemorySectionController = class {
809
847
  const matches = selected.length === 0 ? [...response2.result.value.entries] : response2.result.value.entries.filter(
810
848
  (entry) => entry.category !== void 0 && selected.includes(entry.category)
811
849
  );
812
- return {
813
- entries: matches.slice(offset, offset + MEMORY_PAGE_SIZE),
814
- total: matches.length
815
- };
850
+ this.matches = matches;
851
+ return { entries: matches.slice(0, MEMORY_BATCH_SIZE), total: matches.length };
816
852
  }
853
+ this.matches = null;
817
854
  const response = await this.requireApi().list({
818
- ...this.wireScope() !== void 0 ? { scope: this.wireScope() } : {},
819
- ...snapshot.projectName !== null && snapshot.projectName !== "" ? { projectName: snapshot.projectName } : {},
820
- limit: MEMORY_PAGE_SIZE,
821
- offset
855
+ ...this.wireFilters(),
856
+ limit: MEMORY_BATCH_SIZE,
857
+ offset: 0
822
858
  });
823
859
  if (!response.result.ok) throw new Error(response.result.error.message);
824
860
  return { entries: response.result.value.entries, total: response.result.value.total };
825
861
  }
826
862
  /**
827
- * Full load: health dashboard, workspace roster, and current page. Used on
828
- * section open, manual retry, and connection recovery.
863
+ * Full load: health dashboard, workspace roster, current page, and the
864
+ * pending-review queue. Used on section open, manual retry, and connection
865
+ * recovery.
829
866
  * @returns once the snapshot reflects the host.
830
867
  */
831
868
  async load() {
@@ -833,21 +870,26 @@ var MemorySectionController = class {
833
870
  if (this.store.getSnapshot().status === "idle") this.set({ status: "loading" });
834
871
  try {
835
872
  const api = this.requireApi();
836
- const [health, projects, page] = await Promise.all([
873
+ const [health, projects, batch] = await Promise.all([
837
874
  api.health(),
838
875
  api.projects(),
839
- this.fetchPage()
876
+ this.fetchFirstBatch()
840
877
  ]);
841
878
  if (!health.result.ok) throw new Error(health.result.error.message);
842
879
  if (!projects.result.ok) throw new Error(projects.result.error.message);
880
+ const pendingRows = typeof api.suggestList !== "function" ? [] : await api.suggestList().then(
881
+ (response) => response.result.ok ? response.result.value.suggestions : [],
882
+ () => []
883
+ );
843
884
  if (ticket !== this.seq) return;
844
885
  this.set({
845
886
  status: "ready",
846
887
  error: null,
847
888
  health: health.result.value,
848
889
  projects: projects.result.value.projects,
849
- entries: page.entries,
850
- total: page.total
890
+ entries: batch.entries,
891
+ total: batch.total,
892
+ pending: pendingRows
851
893
  });
852
894
  } catch (error) {
853
895
  if (ticket !== this.seq) return;
@@ -855,25 +897,25 @@ var MemorySectionController = class {
855
897
  }
856
898
  }
857
899
  /**
858
- * Re-fetch just the entry page (filters changed). Keeps the dashboard and
859
- * status untouched; a failure surfaces as page-level error text while the
860
- * previous rows stay visible.
900
+ * Re-fetch the first batch (filters changed). Resets the accumulated list;
901
+ * keeps the dashboard and status untouched, and a failure surfaces as
902
+ * page-level error text while the previous rows stay visible.
861
903
  */
862
904
  async reload() {
863
905
  const ticket = ++this.seq;
864
906
  try {
865
- const page = await this.fetchPage();
907
+ const batch = await this.fetchFirstBatch();
866
908
  if (ticket !== this.seq) return;
867
- this.set({ status: "ready", error: null, entries: page.entries, total: page.total });
909
+ this.set({ status: "ready", error: null, entries: batch.entries, total: batch.total, loadingMore: false });
868
910
  } catch (error) {
869
911
  if (ticket !== this.seq) return;
870
- this.set({ error: messageOf(error) });
912
+ this.set({ error: messageOf(error), loadingMore: false });
871
913
  }
872
914
  }
873
915
  /** Switch the scope filter; the workspace pick cannot outlive its scope. */
874
916
  setScope(scope) {
875
917
  if (this.store.getSnapshot().scope === scope) return;
876
- this.set({ scope, projectName: null, page: 0 });
918
+ this.set({ scope, projectName: null });
877
919
  void this.reload();
878
920
  }
879
921
  /**
@@ -884,30 +926,178 @@ var MemorySectionController = class {
884
926
  if (!projectSelectable(this.store.getSnapshot().scope)) return;
885
927
  const next = projectName === "" ? null : projectName;
886
928
  if (this.store.getSnapshot().projectName === next) return;
887
- this.set({ projectName: next, page: 0 });
929
+ this.set({ projectName: next });
888
930
  void this.reload();
889
931
  }
890
932
  /** Commit a search text (already debounced upstream); empty clears it. */
891
933
  commitQuery(query) {
892
934
  if (this.store.getSnapshot().query === query) return;
893
- this.set({ query, page: 0 });
935
+ this.set({ query });
894
936
  void this.reload();
895
937
  }
896
938
  /** Flip one category chip. */
897
939
  toggleCategory(category) {
898
940
  const selected = this.store.getSnapshot().categories;
899
941
  const next = selected.includes(category) ? selected.filter((c) => c !== category) : [...selected, category];
900
- this.set({ categories: next, page: 0 });
942
+ this.set({ categories: next });
901
943
  void this.reload();
902
944
  }
903
- /** Jump to a zero-based page within range. */
904
- setPage(page) {
905
- const total = this.store.getSnapshot().total;
906
- const maxPage = Math.max(0, Math.ceil(total / MEMORY_PAGE_SIZE) - 1);
907
- const clamped = Math.min(Math.max(0, Math.floor(page)), maxPage);
908
- if (this.store.getSnapshot().page === clamped) return;
909
- this.set({ page: clamped });
910
- void this.reload();
945
+ /**
946
+ * Append the next chunk to the visible list. Plain browsing issues one
947
+ * remote batch; an active search reveals more of the cached full match
948
+ * set without touching the network. No-op while everything is already
949
+ * shown or another append is in flight.
950
+ */
951
+ async loadMore() {
952
+ const snapshot = this.store.getSnapshot();
953
+ if (snapshot.status !== "ready" || snapshot.loadingMore) return;
954
+ if (snapshot.entries.length >= snapshot.total) return;
955
+ if (snapshot.query.trim() === "" && snapshot.categories.length === 0) {
956
+ const ticket = ++this.seq;
957
+ this.set({ loadingMore: true });
958
+ try {
959
+ const response = await this.requireApi().list({
960
+ ...this.wireFilters(),
961
+ limit: MEMORY_BATCH_SIZE,
962
+ offset: snapshot.entries.length
963
+ });
964
+ if (!response.result.ok) throw new Error(response.result.error.message);
965
+ if (ticket !== this.seq) return;
966
+ const current = this.store.getSnapshot();
967
+ const seen = new Set(current.entries.map((entry) => entry.id));
968
+ const appended = response.result.value.entries.filter((entry) => !seen.has(entry.id));
969
+ this.set({
970
+ entries: [...current.entries, ...appended],
971
+ total: response.result.value.total,
972
+ loadingMore: false
973
+ });
974
+ } catch (error) {
975
+ if (ticket !== this.seq) return;
976
+ this.set({ error: messageOf(error), loadingMore: false });
977
+ }
978
+ return;
979
+ }
980
+ const matches = this.matches;
981
+ if (matches === null) {
982
+ await this.reload();
983
+ return;
984
+ }
985
+ this.set({ entries: matches.slice(0, snapshot.entries.length + MEMORY_BATCH_SIZE) });
986
+ }
987
+ // ─── Write path (phase 2): edit / delete / pin / archive / review queue ───
988
+ /**
989
+ * Run one row action against the host, then refresh the affected surfaces.
990
+ * Failures land in `actionError` (inline, previous rows stay visible); a
991
+ * success clears any stale error and repaints from the host's answer.
992
+ */
993
+ async act(run) {
994
+ try {
995
+ const outcome = await run(this.requireApi());
996
+ if (!outcome.ok) {
997
+ this.set({ actionError: outcome.message ?? "action failed" });
998
+ return false;
999
+ }
1000
+ this.set({ actionError: null });
1001
+ return true;
1002
+ } catch (error) {
1003
+ this.set({ actionError: messageOf(error) });
1004
+ return false;
1005
+ }
1006
+ }
1007
+ /** Save human edits to one entry ("edit lands in KV", store single truth). */
1008
+ async saveEntryEdits(id, edits) {
1009
+ return this.act(async (api) => {
1010
+ const response = await api.update({
1011
+ id,
1012
+ ...edits.content !== void 0 ? { content: edits.content } : {},
1013
+ ...edits.category !== void 0 ? { category: edits.category ?? "" } : {},
1014
+ ...edits.summary !== void 0 ? { summary: edits.summary ?? "" } : {}
1015
+ });
1016
+ if (!response.result.ok) return { ok: false, message: response.result.error.message };
1017
+ if (!response.result.value.found) return { ok: false, message: "entry vanished before it could be saved" };
1018
+ await this.refreshAfterMutation();
1019
+ return { ok: true };
1020
+ });
1021
+ }
1022
+ /** Delete one entry after the component-level confirmation. */
1023
+ async deleteEntry(id) {
1024
+ return this.act(async (api) => {
1025
+ const response = await api.removeEntry({ id });
1026
+ if (!response.result.ok) return { ok: false, message: response.result.error.message };
1027
+ if (!response.result.value.removed) return { ok: false, message: "entry was already gone" };
1028
+ await this.refreshAfterMutation();
1029
+ return { ok: true };
1030
+ });
1031
+ }
1032
+ /** Toggle one entry's pin. */
1033
+ async togglePin(entry) {
1034
+ return this.act(async (api) => {
1035
+ const response = await api.pin({ id: entry.id, pinned: entry.pinned !== true });
1036
+ if (!response.result.ok) return { ok: false, message: response.result.error.message };
1037
+ if (!response.result.value.found) return { ok: false, message: "entry was already gone" };
1038
+ await this.refreshAfterMutation();
1039
+ return { ok: true };
1040
+ });
1041
+ }
1042
+ /** Toggle one entry's dormancy stamp (P1-7 archive semantics). */
1043
+ async toggleArchive(entry) {
1044
+ return this.act(async (api) => {
1045
+ const response = await api.archive({ id: entry.id, archived: entry.staleSince === void 0 });
1046
+ if (!response.result.ok) return { ok: false, message: response.result.error.message };
1047
+ if (!response.result.value.found) return { ok: false, message: "entry was already gone" };
1048
+ await this.refreshAfterMutation();
1049
+ return { ok: true };
1050
+ });
1051
+ }
1052
+ /** Re-fetch the pending queue plus whatever list surfaces are live. */
1053
+ async refreshPending() {
1054
+ try {
1055
+ const response = await this.requireApi().suggestList();
1056
+ if (response.result.ok) this.set({ pending: response.result.value.suggestions });
1057
+ } catch {
1058
+ }
1059
+ }
1060
+ /**
1061
+ * Adopt one pending proposal — optionally with "edit before adopt" tweaks.
1062
+ * Refreshes the queue AND the entry list (adoption may create or rewrite an
1063
+ * entry under the active filters).
1064
+ */
1065
+ async adoptSuggestion(id, edits) {
1066
+ const done = await this.act(async (api) => {
1067
+ const response = await api.suggestAdopt({
1068
+ id,
1069
+ ...edits?.content !== void 0 && edits.content.trim() !== "" ? { content: edits.content } : {},
1070
+ ...edits?.category !== void 0 && edits.category !== "" ? { category: edits.category } : {}
1071
+ });
1072
+ if (!response.result.ok) return { ok: false, message: response.result.error.message };
1073
+ if (!response.result.value.found) return { ok: false, message: "proposal was already decided" };
1074
+ return { ok: true };
1075
+ });
1076
+ if (done) {
1077
+ this.set({ pending: this.store.getSnapshot().pending.filter((s) => s.id !== id), actionError: null });
1078
+ await this.reload();
1079
+ }
1080
+ return done;
1081
+ }
1082
+ /** Reject one pending proposal. */
1083
+ async rejectSuggestion(id) {
1084
+ const done = await this.act(async (api) => {
1085
+ const response = await api.suggestReject({ id });
1086
+ if (!response.result.ok) return { ok: false, message: response.result.error.message };
1087
+ return { ok: response.result.value.rejected, message: response.result.value.rejected ? void 0 : "proposal was already decided" };
1088
+ });
1089
+ if (done) this.set({ pending: this.store.getSnapshot().pending.filter((s) => s.id !== id), actionError: null });
1090
+ return done;
1091
+ }
1092
+ /** Post-mutation repaint: health numbers + the visible list + the queue. */
1093
+ async refreshAfterMutation() {
1094
+ void this.refreshPending();
1095
+ try {
1096
+ const [health] = await Promise.all([this.requireApi().health()]);
1097
+ if (health.result.ok) this.set({ health: health.result.value });
1098
+ } catch {
1099
+ }
1100
+ await this.reload();
911
1101
  }
912
1102
  };
913
1103
  function messageOf(error) {
@@ -989,15 +1179,17 @@ var RULES2 = `
989
1179
  line-height: 1.5;
990
1180
  color: var(--dsw-alias-label-tertiary);
991
1181
  }
992
- /* Segmented scope switch. */
993
- .dsm-s-seg {
1182
+ /* Segmented scope switch and section tabs share one visual language. */
1183
+ .dsm-s-seg,
1184
+ .dsm-s-tabs {
994
1185
  display: inline-flex;
995
1186
  padding: 2px;
996
1187
  border: 1px solid var(--dsw-alias-border-l2);
997
1188
  border-radius: 8px;
998
1189
  background: var(--dsw-alias-bg-layer-3);
999
1190
  }
1000
- .dsm-s-seg-btn {
1191
+ .dsm-s-seg-btn,
1192
+ .dsm-s-tab-btn {
1001
1193
  appearance: none;
1002
1194
  border: 0;
1003
1195
  background: none;
@@ -1009,15 +1201,20 @@ var RULES2 = `
1009
1201
  color: var(--dsw-alias-label-secondary);
1010
1202
  cursor: pointer;
1011
1203
  }
1012
- .dsm-s-seg-btn:hover:not([aria-pressed="true"]) {
1204
+ .dsm-s-seg-btn:hover:not([aria-pressed="true"]),
1205
+ .dsm-s-tab-btn:hover:not([aria-selected="true"]) {
1013
1206
  color: var(--dsw-alias-label-primary);
1014
1207
  }
1015
- .dsm-s-seg-btn[aria-pressed="true"] {
1208
+ .dsm-s-seg-btn[aria-pressed="true"],
1209
+ .dsm-s-tab-btn[aria-selected="true"] {
1016
1210
  background: var(--dsw-alias-brand-primary);
1017
1211
  color: var(--dsw-alias-bg-layer-3);
1212
+ }
1213
+ .dsm-s-tab-btn[aria-selected="true"] {
1018
1214
  cursor: default;
1019
1215
  }
1020
- .dsm-s-seg-btn:focus-visible {
1216
+ .dsm-s-seg-btn:focus-visible,
1217
+ .dsm-s-tab-btn:focus-visible {
1021
1218
  outline: 2px solid var(--dsw-alias-brand-primary);
1022
1219
  outline-offset: -2px;
1023
1220
  }
@@ -1171,20 +1368,24 @@ var RULES2 = `
1171
1368
  color: var(--dsw-alias-label-tertiary);
1172
1369
  }
1173
1370
 
1174
- /* \u2500\u2500 Pager / empty / error \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 */
1175
- .dsm-s-pager {
1371
+ /* \u2500\u2500 Lazy-load footer / empty / error \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 */
1372
+ .dsm-s-more {
1176
1373
  display: flex;
1374
+ flex-direction: column;
1177
1375
  align-items: center;
1178
- justify-content: flex-end;
1179
- gap: 10px;
1376
+ gap: 8px;
1180
1377
  }
1181
- .dsm-s-pager-info {
1378
+ .dsm-s-count {
1182
1379
  margin: 0;
1183
1380
  font-size: 12px;
1184
1381
  line-height: 1.5;
1185
1382
  color: var(--dsw-alias-label-tertiary);
1186
1383
  }
1187
- .dsm-s-page-btn {
1384
+ .dsm-s-sentinel {
1385
+ width: 100%;
1386
+ height: 1px;
1387
+ }
1388
+ .dsm-s-more-btn {
1188
1389
  appearance: none;
1189
1390
  border: 1px solid var(--dsw-alias-border-l2);
1190
1391
  border-radius: 8px;
@@ -1196,11 +1397,11 @@ var RULES2 = `
1196
1397
  color: var(--dsw-alias-label-secondary);
1197
1398
  cursor: pointer;
1198
1399
  }
1199
- .dsm-s-page-btn:hover:not(:disabled) {
1400
+ .dsm-s-more-btn:hover:not(:disabled) {
1200
1401
  color: var(--dsw-alias-label-primary);
1201
1402
  border-color: var(--dsw-alias-label-dimmed);
1202
1403
  }
1203
- .dsm-s-page-btn:disabled {
1404
+ .dsm-s-more-btn:disabled {
1204
1405
  opacity: 0.4;
1205
1406
  cursor: default;
1206
1407
  }
@@ -1217,6 +1418,85 @@ var RULES2 = `
1217
1418
  line-height: 1.5;
1218
1419
  color: var(--dsw-alias-label-error);
1219
1420
  }
1421
+
1422
+ /* \u2500\u2500 Phase-2 write path: row actions / editor / review queue \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
1423
+ .dsm-s-actions {
1424
+ display: flex;
1425
+ flex-wrap: wrap;
1426
+ align-items: center;
1427
+ gap: 6px;
1428
+ }
1429
+ .dsm-s-action-btn {
1430
+ appearance: none;
1431
+ border: 1px solid var(--dsw-alias-border-l2);
1432
+ border-radius: 8px;
1433
+ background: var(--dsw-alias-bg-layer-3);
1434
+ padding: 2px 10px;
1435
+ font: inherit;
1436
+ font-size: 12px;
1437
+ line-height: 20px;
1438
+ color: var(--dsw-alias-label-secondary);
1439
+ cursor: pointer;
1440
+ }
1441
+ .dsm-s-action-btn:hover:not(:disabled) {
1442
+ color: var(--dsw-alias-label-primary);
1443
+ border-color: var(--dsw-alias-label-dimmed);
1444
+ }
1445
+ .dsm-s-action-btn:disabled {
1446
+ opacity: 0.45;
1447
+ cursor: default;
1448
+ }
1449
+ .dsm-s-action-btn:focus-visible {
1450
+ outline: 2px solid var(--dsw-alias-brand-primary);
1451
+ outline-offset: -2px;
1452
+ }
1453
+ .dsm-s-action-btn-danger {
1454
+ color: var(--dsw-alias-label-error);
1455
+ }
1456
+ .dsm-s-badge-hits {
1457
+ background: var(--dsw-alias-brand-primary);
1458
+ color: var(--dsw-alias-bg-layer-3);
1459
+ }
1460
+ .dsm-s-edit-form {
1461
+ display: flex;
1462
+ flex-direction: column;
1463
+ gap: 8px;
1464
+ }
1465
+ .dsm-s-textarea,
1466
+ .dsm-s-field {
1467
+ width: 100%;
1468
+ box-sizing: border-box;
1469
+ padding: 6px 12px;
1470
+ border: 1px solid var(--dsw-alias-border-l2);
1471
+ border-radius: 8px;
1472
+ background: var(--dsw-alias-bg-layer-3);
1473
+ font: inherit;
1474
+ font-size: 13px;
1475
+ line-height: 1.5;
1476
+ color: var(--dsw-alias-label-primary);
1477
+ }
1478
+ .dsm-s-textarea {
1479
+ min-height: 64px;
1480
+ resize: vertical;
1481
+ }
1482
+ .dsm-s-textarea:focus-visible,
1483
+ .dsm-s-field:focus-visible {
1484
+ outline: none;
1485
+ border-color: var(--dsw-alias-brand-primary);
1486
+ }
1487
+ .dsm-s-form-row {
1488
+ display: flex;
1489
+ flex-wrap: wrap;
1490
+ align-items: center;
1491
+ gap: 8px;
1492
+ }
1493
+ .dsm-s-review-head {
1494
+ margin: 0;
1495
+ font-size: 13px;
1496
+ font-weight: 500;
1497
+ line-height: 1.5;
1498
+ color: var(--dsw-alias-label-secondary);
1499
+ }
1220
1500
  `;
1221
1501
  var cls2 = {
1222
1502
  section: "dsm-s-section",
@@ -1233,6 +1513,8 @@ var cls2 = {
1233
1513
  toolbarLabel: "dsm-s-toolbar-label",
1234
1514
  seg: "dsm-s-seg",
1235
1515
  segBtn: "dsm-s-seg-btn",
1516
+ tabs: "dsm-s-tabs",
1517
+ tabBtn: "dsm-s-tab-btn",
1236
1518
  input: "dsm-s-input",
1237
1519
  select: "dsm-s-select",
1238
1520
  chip: "dsm-s-chip",
@@ -1247,11 +1529,21 @@ var cls2 = {
1247
1529
  content: "dsm-s-content",
1248
1530
  contentOpen: "dsm-s-content-open",
1249
1531
  meta: "dsm-s-meta",
1250
- pager: "dsm-s-pager",
1251
- pagerInfo: "dsm-s-pager-info",
1252
- pageBtn: "dsm-s-page-btn",
1532
+ more: "dsm-s-more",
1533
+ count: "dsm-s-count",
1534
+ sentinel: "dsm-s-sentinel",
1535
+ moreBtn: "dsm-s-more-btn",
1253
1536
  empty: "dsm-s-empty",
1254
- error: "dsm-s-error"
1537
+ error: "dsm-s-error",
1538
+ actions: "dsm-s-actions",
1539
+ actionBtn: "dsm-s-action-btn",
1540
+ actionBtnDanger: "dsm-s-action-btn-danger",
1541
+ badgeHits: "dsm-s-badge-hits",
1542
+ editForm: "dsm-s-edit-form",
1543
+ textarea: "dsm-s-textarea",
1544
+ field: "dsm-s-field",
1545
+ formRow: "dsm-s-form-row",
1546
+ reviewHead: "dsm-s-review-head"
1255
1547
  };
1256
1548
  var injected2 = false;
1257
1549
  function inject2() {
@@ -1275,6 +1567,7 @@ var SCOPES = [
1275
1567
  function formatTs(ts, fallback) {
1276
1568
  return ts === void 0 || ts === null ? fallback : new Date(ts).toLocaleString();
1277
1569
  }
1570
+ var NO_CATEGORY = "";
1278
1571
  function emptyKeyOf(state) {
1279
1572
  if (state.query.trim() !== "" || state.categories.length > 0) return "emptyFiltered";
1280
1573
  if (state.scope === "global") return "emptyGlobal";
@@ -1282,12 +1575,84 @@ function emptyKeyOf(state) {
1282
1575
  if (state.scope === "project") return "emptyProject";
1283
1576
  return "emptyAll";
1284
1577
  }
1578
+ function EntryEditor(props) {
1579
+ const { entry, translate, onSave, onCancel } = props;
1580
+ const [draftContent, setDraftContent] = (0, import_react2.useState)(entry.content);
1581
+ const [draftCategory, setDraftCategory] = (0, import_react2.useState)(entry.category ?? NO_CATEGORY);
1582
+ const [draftSummary, setDraftSummary] = (0, import_react2.useState)(entry.summary ?? "");
1583
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.editForm, children: [
1584
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1585
+ "textarea",
1586
+ {
1587
+ className: css2.textarea,
1588
+ "aria-label": translate("editContent"),
1589
+ value: draftContent,
1590
+ onChange: (event) => {
1591
+ setDraftContent(event.target.value);
1592
+ }
1593
+ }
1594
+ ),
1595
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.formRow, children: [
1596
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1597
+ "select",
1598
+ {
1599
+ className: css2.select,
1600
+ "aria-label": translate("editCategory"),
1601
+ value: draftCategory,
1602
+ onChange: (event) => {
1603
+ setDraftCategory(event.target.value);
1604
+ },
1605
+ children: [
1606
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: NO_CATEGORY, children: translate("noCategory") }),
1607
+ MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: category, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }, category))
1608
+ ]
1609
+ }
1610
+ ),
1611
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1612
+ "input",
1613
+ {
1614
+ className: css2.field,
1615
+ type: "text",
1616
+ "aria-label": translate("editSummary"),
1617
+ placeholder: translate("editSummaryPlaceholder"),
1618
+ value: draftSummary,
1619
+ onChange: (event) => {
1620
+ setDraftSummary(event.target.value);
1621
+ }
1622
+ }
1623
+ )
1624
+ ] }),
1625
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.actions, children: [
1626
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1627
+ "button",
1628
+ {
1629
+ type: "button",
1630
+ className: css2.actionBtn,
1631
+ disabled: draftContent.trim() === "",
1632
+ onClick: () => {
1633
+ onSave({
1634
+ content: draftContent,
1635
+ // '' selects "none": pass null so the controller clears the field;
1636
+ // an untouched pick passes the current value through.
1637
+ category: draftCategory === NO_CATEGORY ? null : draftCategory,
1638
+ summary: draftSummary
1639
+ });
1640
+ },
1641
+ children: translate("saveEdits")
1642
+ }
1643
+ ),
1644
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.actionBtn, onClick: onCancel, children: translate("cancelEdits") })
1645
+ ] })
1646
+ ] });
1647
+ }
1285
1648
  function EntryRow(props) {
1286
- const { entry, expanded, staleLabel, staleHint, pinnedLabel, neverRecalledLabel, scopeLabels, translate, onToggle } = props;
1649
+ const { entry, expanded, staleLabel, staleHint, pinnedLabel, neverRecalledLabel, scopeLabels, translate, onToggle, onSaveEdits, onDelete, onTogglePin, onToggleArchive } = props;
1287
1650
  const category = entry.category;
1288
1651
  const projectName = entry.projectName;
1289
1652
  const isStale = entry.staleSince !== void 0;
1290
1653
  const isPinned = entry.pinned === true;
1654
+ const [editing, setEditing] = (0, import_react2.useState)(false);
1655
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react2.useState)(false);
1291
1656
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: isStale ? `${css2.row} ${css2.rowStale}` : css2.row, children: [
1292
1657
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.badges, children: [
1293
1658
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: scopeLabels[entry.scope] }),
@@ -1296,7 +1661,20 @@ function EntryRow(props) {
1296
1661
  isPinned ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.badge} ${css2.badgePinned}`, children: `\u{1F4CC} ${pinnedLabel}` }) : null,
1297
1662
  isStale ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.badge} ${css2.badgeStale}`, title: staleHint, "aria-label": staleHint, children: `\u{1F634} ${staleLabel}` }) : null
1298
1663
  ] }),
1299
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1664
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1665
+ EntryEditor,
1666
+ {
1667
+ entry,
1668
+ translate,
1669
+ onSave: (edits) => {
1670
+ setEditing(false);
1671
+ onSaveEdits(edits);
1672
+ },
1673
+ onCancel: () => {
1674
+ setEditing(false);
1675
+ }
1676
+ }
1677
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1300
1678
  "button",
1301
1679
  {
1302
1680
  type: "button",
@@ -1310,15 +1688,128 @@ function EntryRow(props) {
1310
1688
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaCreated")} ${formatTs(entry.createdAt, "\u2014")}` }),
1311
1689
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaUpdated")} ${formatTs(entry.updatedAt, "\u2014")}` }),
1312
1690
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: entry.lastRecalledAt === void 0 ? `${translate("metaRecalled")} ${neverRecalledLabel}` : `${translate("metaRecalled")} ${formatTs(entry.lastRecalledAt, neverRecalledLabel)}` })
1691
+ ] }),
1692
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.actions, children: [
1693
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1694
+ "button",
1695
+ {
1696
+ type: "button",
1697
+ className: css2.actionBtn,
1698
+ onClick: () => {
1699
+ setEditing((current) => !current);
1700
+ setConfirmingDelete(false);
1701
+ },
1702
+ children: editing ? translate("cancelEdits") : translate("editAction")
1703
+ }
1704
+ ),
1705
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.actionBtn, onClick: onTogglePin, children: isPinned ? translate("unpinAction") : translate("pinAction") }),
1706
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.actionBtn, onClick: onToggleArchive, children: isStale ? translate("unarchiveAction") : translate("archiveAction") }),
1707
+ confirmingDelete ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1708
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1709
+ "button",
1710
+ {
1711
+ type: "button",
1712
+ className: `${css2.actionBtn} ${css2.actionBtnDanger}`,
1713
+ onClick: () => {
1714
+ setConfirmingDelete(false);
1715
+ onDelete();
1716
+ },
1717
+ children: translate("confirmDelete")
1718
+ }
1719
+ ),
1720
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1721
+ "button",
1722
+ {
1723
+ type: "button",
1724
+ className: css2.actionBtn,
1725
+ onClick: () => {
1726
+ setConfirmingDelete(false);
1727
+ },
1728
+ children: translate("cancelDelete")
1729
+ }
1730
+ )
1731
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1732
+ "button",
1733
+ {
1734
+ type: "button",
1735
+ className: `${css2.actionBtn} ${css2.actionBtnDanger}`,
1736
+ onClick: () => {
1737
+ setConfirmingDelete(true);
1738
+ },
1739
+ children: translate("deleteAction")
1740
+ }
1741
+ )
1313
1742
  ] })
1314
1743
  ] });
1315
1744
  }
1745
+ function SuggestionRow(props) {
1746
+ const { suggestion, scopeLabels, translate, onAdopt, onReject } = props;
1747
+ const [editing, setEditing] = (0, import_react2.useState)(false);
1748
+ const [draftContent, setDraftContent] = (0, import_react2.useState)(suggestion.content);
1749
+ const category = suggestion.category;
1750
+ const projectName = suggestion.projectName;
1751
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: css2.row, children: [
1752
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.badges, children: [
1753
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: scopeLabels[suggestion.scope] }),
1754
+ category === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }),
1755
+ projectName === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.project, children: projectName }),
1756
+ suggestion.hits > 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.badge} ${css2.badgeHits}`, children: translate("hitsBadge").replace("{hits}", String(suggestion.hits)) }) : null,
1757
+ suggestion.targetEntryId !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: translate("updateProposalBadge") }) : null
1758
+ ] }),
1759
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.editForm, children: [
1760
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1761
+ "textarea",
1762
+ {
1763
+ className: css2.textarea,
1764
+ "aria-label": translate("editProposalContent"),
1765
+ value: draftContent,
1766
+ onChange: (event) => {
1767
+ setDraftContent(event.target.value);
1768
+ }
1769
+ }
1770
+ ),
1771
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.actions, children: [
1772
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1773
+ "button",
1774
+ {
1775
+ type: "button",
1776
+ className: css2.actionBtn,
1777
+ disabled: draftContent.trim() === "",
1778
+ onClick: () => {
1779
+ onAdopt({ content: draftContent });
1780
+ },
1781
+ children: translate("saveAdopt")
1782
+ }
1783
+ ),
1784
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.actionBtn, onClick: () => {
1785
+ onAdopt(void 0);
1786
+ }, children: translate("adoptAsIs") })
1787
+ ] })
1788
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${css2.content} ${css2.contentOpen}`, onClick: () => {
1789
+ setEditing(true);
1790
+ }, children: suggestion.content }),
1791
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: css2.meta, children: [
1792
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaSeen")} ${formatTs(suggestion.lastSeenAt, "\u2014")}` }),
1793
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaFirstSeen")} ${formatTs(suggestion.firstSeenAt, "\u2014")}` })
1794
+ ] }),
1795
+ !editing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.actions, children: [
1796
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.actionBtn, onClick: () => {
1797
+ setEditing(true);
1798
+ }, children: translate("editAndAdopt") }),
1799
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.actionBtn, onClick: () => {
1800
+ onAdopt(void 0);
1801
+ }, children: translate("adoptAction") }),
1802
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: `${css2.actionBtn} ${css2.actionBtnDanger}`, onClick: onReject, children: translate("rejectAction") })
1803
+ ] }) : null
1804
+ ] });
1805
+ }
1316
1806
  function MemorySection(props) {
1317
1807
  const { useMemorySection, t, load } = props;
1318
1808
  const state = useMemorySection((snapshot) => snapshot);
1319
1809
  (0, import_react2.useEffect)(() => {
1320
1810
  void load();
1321
1811
  }, [load]);
1812
+ const [tab, setTab] = (0, import_react2.useState)("overview");
1322
1813
  const [searchText, setSearchText] = (0, import_react2.useState)(state.query);
1323
1814
  (0, import_react2.useEffect)(() => {
1324
1815
  const timer = setTimeout(() => {
@@ -1344,14 +1835,31 @@ function MemorySection(props) {
1344
1835
  };
1345
1836
  const workspaceEnabled = state.scope === "all" || state.scope === "project";
1346
1837
  const total = state.total;
1347
- const pageCount = Math.max(1, Math.ceil(total / MEMORY_PAGE_SIZE));
1348
- const from = total === 0 ? 0 : state.page * MEMORY_PAGE_SIZE + 1;
1349
- const to = Math.min(total, (state.page + 1) * MEMORY_PAGE_SIZE);
1838
+ const shown = state.entries.length;
1839
+ const hasMore = shown < total;
1840
+ const loadMoreRef = (0, import_react2.useRef)(props.loadMore);
1841
+ loadMoreRef.current = props.loadMore;
1842
+ const sentinelRef = (0, import_react2.useRef)(null);
1843
+ (0, import_react2.useEffect)(() => {
1844
+ const element = sentinelRef.current;
1845
+ if (element === null || tab !== "manage") return;
1846
+ if (typeof IntersectionObserver === "undefined") return;
1847
+ const observer = new IntersectionObserver(
1848
+ (entries) => {
1849
+ if (entries.some((entry) => entry.isIntersecting)) loadMoreRef.current();
1850
+ },
1851
+ { rootMargin: "240px" }
1852
+ );
1853
+ observer.observe(element);
1854
+ return () => {
1855
+ observer.disconnect();
1856
+ };
1857
+ }, [tab, state.status, shown, total]);
1350
1858
  if (state.status === "error") {
1351
1859
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
1352
1860
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
1353
1861
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
1354
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.pageBtn, onClick: () => {
1862
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.moreBtn, onClick: () => {
1355
1863
  void load();
1356
1864
  }, children: t("retry") })
1357
1865
  ] });
@@ -1366,7 +1874,48 @@ function MemorySection(props) {
1366
1874
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
1367
1875
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
1368
1876
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.intro, children: t("sectionIntro") }),
1369
- health === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.dash, children: [
1877
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.tabs, role: "tablist", "aria-label": t("nav"), children: [
1878
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1879
+ "button",
1880
+ {
1881
+ type: "button",
1882
+ role: "tab",
1883
+ className: css2.tabBtn,
1884
+ "aria-selected": tab === "overview",
1885
+ onClick: () => {
1886
+ setTab("overview");
1887
+ },
1888
+ children: t("tabOverview")
1889
+ }
1890
+ ),
1891
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1892
+ "button",
1893
+ {
1894
+ type: "button",
1895
+ role: "tab",
1896
+ className: css2.tabBtn,
1897
+ "aria-selected": tab === "review",
1898
+ onClick: () => {
1899
+ setTab("review");
1900
+ },
1901
+ children: state.pending.length > 0 ? t("tabReviewWithCount").replace("{count}", String(state.pending.length)) : t("tabReview")
1902
+ }
1903
+ ),
1904
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1905
+ "button",
1906
+ {
1907
+ type: "button",
1908
+ role: "tab",
1909
+ className: css2.tabBtn,
1910
+ "aria-selected": tab === "manage",
1911
+ onClick: () => {
1912
+ setTab("manage");
1913
+ },
1914
+ children: t("tabManage")
1915
+ }
1916
+ )
1917
+ ] }),
1918
+ tab === "overview" ? health === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.dash, children: [
1370
1919
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
1371
1920
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.totalEntries }),
1372
1921
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashTotal") })
@@ -1403,119 +1952,142 @@ function MemorySection(props) {
1403
1952
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.statValue} ${css2.statValueMuted}`, children: formatTs(health.lastExtractionTs, t("dashLastActivityNever")) }),
1404
1953
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashLastExtraction") })
1405
1954
  ] })
1406
- ] }),
1407
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbar, children: [
1408
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbarRow, children: [
1409
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.toolbarLabel, children: t("searchLabel") }),
1410
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css2.seg, role: "group", "aria-label": t("nav"), children: SCOPES.map(({ value, labelKey }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1411
- "button",
1412
- {
1413
- type: "button",
1414
- className: css2.segBtn,
1415
- "aria-pressed": state.scope === value,
1416
- onClick: () => {
1417
- props.setScope(value);
1418
- },
1419
- children: t(labelKey)
1420
- },
1421
- value
1422
- )) }),
1423
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1424
- "select",
1425
- {
1426
- className: css2.select,
1427
- "aria-label": t("workspaceLabel"),
1428
- disabled: !workspaceEnabled,
1429
- value: state.projectName ?? "",
1430
- onChange: (event) => {
1431
- props.setProject(event.target.value);
1432
- },
1433
- children: [
1434
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", children: t("workspaceAll") }),
1435
- state.projects.map((name) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: name, children: name }, name))
1436
- ]
1437
- }
1438
- ),
1439
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1440
- "input",
1441
- {
1442
- type: "search",
1443
- className: css2.input,
1444
- "aria-label": t("searchLabel"),
1445
- placeholder: t("searchPlaceholder"),
1446
- value: searchText,
1447
- onChange: (event) => {
1448
- setSearchText(event.target.value);
1449
- }
1450
- }
1451
- )
1452
- ] }),
1453
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbarRow, children: [
1454
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.toolbarLabel, children: t("categoryLabel") }),
1455
- MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1456
- "button",
1457
- {
1458
- type: "button",
1459
- className: css2.chip,
1460
- "aria-pressed": state.categories.includes(category),
1461
- onClick: () => {
1462
- props.toggleCategory(category);
1463
- },
1464
- children: translateCategory(category, t)
1465
- },
1466
- category
1467
- ))
1468
- ] })
1469
- ] }),
1470
- state.error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: state.error }),
1471
- total === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.empty, children: t(emptyKeyOf(state)) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1472
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: css2.list, children: state.entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1473
- EntryRow,
1955
+ ] }) : null,
1956
+ tab === "review" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1957
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.reviewHead, children: t("reviewIntro") }),
1958
+ state.actionError === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: state.actionError }),
1959
+ state.pending.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.empty, children: t("reviewEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: css2.list, children: state.pending.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1960
+ SuggestionRow,
1474
1961
  {
1475
- entry,
1476
- expanded: expandedIds.has(entry.id),
1477
- staleLabel: t("staleMark"),
1478
- staleHint: t("staleHint"),
1479
- pinnedLabel: t("pinnedBadge"),
1480
- neverRecalledLabel: t("neverRecalled"),
1962
+ suggestion,
1481
1963
  scopeLabels,
1482
1964
  translate: t,
1483
- onToggle: () => {
1484
- toggleExpanded(entry.id);
1965
+ onAdopt: (edits) => {
1966
+ void props.adoptSuggestion(suggestion.id, edits);
1967
+ },
1968
+ onReject: () => {
1969
+ void props.rejectSuggestion(suggestion.id);
1485
1970
  }
1486
1971
  },
1487
- entry.id
1488
- )) }),
1489
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.pager, children: [
1490
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.pagerInfo, children: pageCount <= 1 ? t("pageSingle").replace("{total}", String(total)) : t("pageInfo").replace("{from}", String(from)).replace("{to}", String(to)).replace("{total}", String(total)) }),
1491
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1492
- "button",
1493
- {
1494
- type: "button",
1495
- className: css2.pageBtn,
1496
- disabled: state.page <= 0,
1497
- "aria-label": t("pagePrev"),
1498
- onClick: () => {
1499
- props.setPage(state.page - 1);
1972
+ suggestion.id
1973
+ )) })
1974
+ ] }) : null,
1975
+ tab === "manage" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1976
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbar, children: [
1977
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbarRow, children: [
1978
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.toolbarLabel, children: t("searchLabel") }),
1979
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css2.seg, role: "group", "aria-label": t("nav"), children: SCOPES.map(({ value, labelKey }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1980
+ "button",
1981
+ {
1982
+ type: "button",
1983
+ className: css2.segBtn,
1984
+ "aria-pressed": state.scope === value,
1985
+ onClick: () => {
1986
+ props.setScope(value);
1987
+ },
1988
+ children: t(labelKey)
1500
1989
  },
1501
- children: "\u2039"
1502
- }
1503
- ),
1504
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1505
- "button",
1990
+ value
1991
+ )) }),
1992
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1993
+ "select",
1994
+ {
1995
+ className: css2.select,
1996
+ "aria-label": t("workspaceLabel"),
1997
+ disabled: !workspaceEnabled,
1998
+ value: state.projectName ?? "",
1999
+ onChange: (event) => {
2000
+ props.setProject(event.target.value);
2001
+ },
2002
+ children: [
2003
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", children: t("workspaceAll") }),
2004
+ state.projects.map((name) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: name, children: name }, name))
2005
+ ]
2006
+ }
2007
+ ),
2008
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2009
+ "input",
2010
+ {
2011
+ type: "search",
2012
+ className: css2.input,
2013
+ "aria-label": t("searchLabel"),
2014
+ placeholder: t("searchPlaceholder"),
2015
+ value: searchText,
2016
+ onChange: (event) => {
2017
+ setSearchText(event.target.value);
2018
+ }
2019
+ }
2020
+ )
2021
+ ] }),
2022
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbarRow, children: [
2023
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.toolbarLabel, children: t("categoryLabel") }),
2024
+ MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2025
+ "button",
2026
+ {
2027
+ type: "button",
2028
+ className: css2.chip,
2029
+ "aria-pressed": state.categories.includes(category),
2030
+ onClick: () => {
2031
+ props.toggleCategory(category);
2032
+ },
2033
+ children: translateCategory(category, t)
2034
+ },
2035
+ category
2036
+ ))
2037
+ ] })
2038
+ ] }),
2039
+ state.error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: state.error }),
2040
+ state.actionError === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: state.actionError }),
2041
+ total === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.empty, children: t(emptyKeyOf(state)) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
2042
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: css2.list, children: state.entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2043
+ EntryRow,
1506
2044
  {
1507
- type: "button",
1508
- className: css2.pageBtn,
1509
- disabled: state.page >= pageCount - 1,
1510
- "aria-label": t("pageNext"),
1511
- onClick: () => {
1512
- props.setPage(state.page + 1);
2045
+ entry,
2046
+ expanded: expandedIds.has(entry.id),
2047
+ staleLabel: t("staleMark"),
2048
+ staleHint: t("staleHint"),
2049
+ pinnedLabel: t("pinnedBadge"),
2050
+ neverRecalledLabel: t("neverRecalled"),
2051
+ scopeLabels,
2052
+ translate: t,
2053
+ onToggle: () => {
2054
+ toggleExpanded(entry.id);
1513
2055
  },
1514
- children: "\u203A"
1515
- }
1516
- )
2056
+ onSaveEdits: (edits) => {
2057
+ void props.saveEntryEdits(entry.id, edits);
2058
+ },
2059
+ onDelete: () => {
2060
+ void props.deleteEntry(entry.id);
2061
+ },
2062
+ onTogglePin: () => {
2063
+ void props.togglePin(entry);
2064
+ },
2065
+ onToggleArchive: () => {
2066
+ void props.toggleArchive(entry);
2067
+ }
2068
+ },
2069
+ entry.id
2070
+ )) }),
2071
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.more, children: [
2072
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.count, children: t("shownCount").replace("{shown}", String(shown)).replace("{total}", String(total)) }),
2073
+ hasMore ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
2074
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: sentinelRef, className: css2.sentinel, "aria-hidden": "true" }),
2075
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2076
+ "button",
2077
+ {
2078
+ type: "button",
2079
+ className: css2.moreBtn,
2080
+ disabled: state.loadingMore,
2081
+ onClick: () => {
2082
+ props.loadMore();
2083
+ },
2084
+ children: state.loadingMore ? t("loading") : t("loadMore")
2085
+ }
2086
+ )
2087
+ ] }) : null
2088
+ ] })
1517
2089
  ] })
1518
- ] })
2090
+ ] }) : null
1519
2091
  ] });
1520
2092
  }
1521
2093
  function translateCategory(category, t) {
@@ -1803,6 +2375,8 @@ var en = {
1803
2375
  customPolicyHint: 'Used only when memory mode is "custom".',
1804
2376
  charLimit: "Memory character limit",
1805
2377
  charLimitHint: "Character budget for the frozen memory content snapshot.",
2378
+ memoryMaxEntries: "Max injected entries",
2379
+ memoryMaxEntriesHint: "Max memory entries injected into the system-prompt snapshot (full mode); 0 means no limit. Entries beyond the cap are folded into a count summary.",
1806
2380
  maxSearchResults: "Max search results",
1807
2381
  maxSearchResultsHint: "Default cap for memory_search / memory_list results; 0 means no limit.",
1808
2382
  decayDays: "Decay days",
@@ -1832,6 +2406,8 @@ var en = {
1832
2406
  // Review extraction card (memory-review namespace).
1833
2407
  reviewCardTitle: "Automatic Extraction",
1834
2408
  reviewCardDescription: "When conversations are distilled into durable memory, which model runs it, and how oversized entries get re-summarized.",
2409
+ confirmBeforeWrite: "Human review before write",
2410
+ confirmBeforeWriteHint: "Queue extraction and tool proposals for your confirmation in the Memory section instead of storing them automatically.",
1835
2411
  reviewEnabled: "Automatic review extraction",
1836
2412
  reviewEnabledHint: "Extract durable facts from the conversation automatically.",
1837
2413
  reviewThreshold: "Review candidate threshold",
@@ -1862,6 +2438,8 @@ var en = {
1862
2438
  nav: "Memory",
1863
2439
  sectionTitle: "Memory",
1864
2440
  sectionIntro: "Everything this deployment remembers, across all scopes and workspaces \u2014 browse, filter, and search the store itself. Configuration (injection mode, budgets, extraction) lives separately under Settings \u2192 Plugins \u2192 Plugin configuration.",
2441
+ tabOverview: "Overview",
2442
+ tabManage: "Manage",
1865
2443
  dashTotal: "Total memories",
1866
2444
  dashGlobal: "Global",
1867
2445
  dashUser: "User",
@@ -1900,13 +2478,41 @@ var en = {
1900
2478
  metaCreated: "created",
1901
2479
  metaUpdated: "updated",
1902
2480
  metaRecalled: "recalled",
1903
- pagePrev: "Previous page",
1904
- pageNext: "Next page",
1905
- pageInfo: "{from}\u2013{to} of {total}",
1906
- pageSingle: "{total} entries",
2481
+ shownCount: "Showing {shown} of {total}",
2482
+ loadMore: "Load more",
1907
2483
  loadFailed: "The memory store could not be reached.",
1908
2484
  retry: "Retry",
1909
- neverRecalled: "never recalled"
2485
+ neverRecalled: "never recalled",
2486
+ // ── Phase 2: review queue + write path ──
2487
+ tabReview: "Review",
2488
+ tabReviewWithCount: "Review ({count})",
2489
+ reviewIntro: "Proposals from automatic extraction and the memory tools wait here. Adopting stores one (with your edits); rejecting discards it. Nothing is remembered until you decide.",
2490
+ reviewEmpty: "No pending proposals. With human review enabled, extraction and tool writes land here for your decision.",
2491
+ hitsBadge: "seen \xD7{hits}",
2492
+ updateProposalBadge: "update proposal",
2493
+ metaSeen: "last seen",
2494
+ metaFirstSeen: "first seen",
2495
+ adoptAction: "Adopt",
2496
+ editAndAdopt: "Edit & adopt",
2497
+ adoptAsIs: "Adopt original",
2498
+ saveAdopt: "Adopt with edits",
2499
+ rejectAction: "Reject",
2500
+ editProposalContent: "Proposal content",
2501
+ editAction: "Edit",
2502
+ pinAction: "Pin",
2503
+ unpinAction: "Unpin",
2504
+ archiveAction: "Archive",
2505
+ unarchiveAction: "Unarchive",
2506
+ deleteAction: "Delete",
2507
+ confirmDelete: "Confirm delete?",
2508
+ cancelDelete: "Keep",
2509
+ saveEdits: "Save",
2510
+ cancelEdits: "Cancel",
2511
+ editContent: "Entry content",
2512
+ editCategory: "Category",
2513
+ noCategory: "(no category)",
2514
+ editSummary: "Summary",
2515
+ editSummaryPlaceholder: "Short summary for index views (optional)"
1910
2516
  };
1911
2517
  var zh = {
1912
2518
  // Card chrome
@@ -1936,6 +2542,8 @@ var zh = {
1936
2542
  customPolicyHint: '\u4EC5\u5728\u8BB0\u5FC6\u6A21\u5F0F\u4E3A "custom" \u65F6\u4F7F\u7528\u3002',
1937
2543
  charLimit: "\u8BB0\u5FC6\u5B57\u7B26\u4E0A\u9650",
1938
2544
  charLimitHint: "\u51BB\u7ED3\u8BB0\u5FC6\u5185\u5BB9\u5FEB\u7167\u7684\u5B57\u7B26\u9884\u7B97\u3002",
2545
+ memoryMaxEntries: "\u6700\u5927\u6CE8\u5165\u6761\u6570",
2546
+ memoryMaxEntriesHint: "\u6CE8\u5165\u7CFB\u7EDF\u63D0\u793A\u8BCD\u5FEB\u7167\u7684\u6700\u5927\u6761\u76EE\u6570\uFF08full \u6A21\u5F0F\uFF09\uFF1B0 \u8868\u793A\u4E0D\u9650\u3002\u8D85\u51FA\u90E8\u5206\u6298\u53E0\u4E3A\u8BA1\u6570\u884C\u3002",
1939
2547
  maxSearchResults: "\u6700\u5927\u641C\u7D22\u7ED3\u679C\u6570",
1940
2548
  maxSearchResultsHint: "memory_search / memory_list \u7684\u9ED8\u8BA4\u6761\u6570\u4E0A\u9650\uFF1B0 \u8868\u793A\u4E0D\u9650\u3002",
1941
2549
  decayDays: "\u8870\u51CF\u5929\u6570",
@@ -1965,6 +2573,8 @@ var zh = {
1965
2573
  // 自动提取卡片(memory-review 命名空间)
1966
2574
  reviewCardTitle: "\u81EA\u52A8\u63D0\u53D6",
1967
2575
  reviewCardDescription: "\u4F55\u65F6\u628A\u5BF9\u8BDD\u6C89\u6DC0\u4E3A\u957F\u671F\u8BB0\u5FC6\u3001\u4F7F\u7528\u54EA\u4E2A\u6A21\u578B\uFF0C\u4EE5\u53CA\u8D85\u957F\u6761\u76EE\u7684\u5B9A\u671F\u7CBE\u7B80\u3002",
2576
+ confirmBeforeWrite: "\u5199\u5165\u524D\u4EBA\u5DE5\u786E\u8BA4",
2577
+ confirmBeforeWriteHint: "\u63D0\u53D6\u4E0E\u5DE5\u5177\u4EA7\u751F\u7684\u5199\u5165\u5148\u8FDB\u5165 Memory \u5206\u533A\u7684\u5F85\u786E\u8BA4\u961F\u5217\uFF0C\u7531\u4F60\u91C7\u7EB3\u540E\u624D\u771F\u6B63\u843D\u5E93\u3002",
1968
2578
  reviewEnabled: "\u81EA\u52A8\u8BC4\u5BA1\u63D0\u53D6",
1969
2579
  reviewEnabledHint: "\u81EA\u52A8\u4ECE\u5BF9\u8BDD\u4E2D\u63D0\u53D6\u53EF\u6301\u4E45\u7684\u4E8B\u5B9E\u3002",
1970
2580
  reviewThreshold: "\u8BC4\u5BA1\u5019\u9009\u9608\u503C",
@@ -1995,6 +2605,8 @@ var zh = {
1995
2605
  nav: "\u8BB0\u5FC6",
1996
2606
  sectionTitle: "\u8BB0\u5FC6",
1997
2607
  sectionIntro: "\u8FD9\u91CC\u7BA1\u7406\u672C\u90E8\u7F72\u8BB0\u4F4F\u7684\u5168\u90E8\u5185\u5BB9\u2014\u2014\u8DE8\u6240\u6709\u4F5C\u7528\u57DF\u4E0E\u5DE5\u4F5C\u533A\u6D4F\u89C8\u3001\u7B5B\u9009\u3001\u68C0\u7D22\u8BB0\u5FC6\u5E93\u672C\u8EAB\u3002\u914D\u7F6E\u9879\uFF08\u6CE8\u5165\u6A21\u5F0F\u3001\u9884\u7B97\u3001\u81EA\u52A8\u63D0\u53D6\uFF09\u5728 Settings \u2192 Plugins \u2192 Plugin configuration \u4E2D\uFF0C\u4E0E\u6B64\u9875\u4E92\u4E0D\u5F71\u54CD\u3002",
2608
+ tabOverview: "\u6982\u89C8",
2609
+ tabManage: "\u7BA1\u7406",
1998
2610
  dashTotal: "\u8BB0\u5FC6\u603B\u6570",
1999
2611
  dashGlobal: "\u5168\u5C40",
2000
2612
  dashUser: "\u7528\u6237",
@@ -2033,13 +2645,41 @@ var zh = {
2033
2645
  metaCreated: "\u521B\u5EFA\u4E8E",
2034
2646
  metaUpdated: "\u66F4\u65B0\u4E8E",
2035
2647
  metaRecalled: "\u53EC\u56DE\u4E8E",
2036
- pagePrev: "\u4E0A\u4E00\u9875",
2037
- pageNext: "\u4E0B\u4E00\u9875",
2038
- pageInfo: "\u7B2C {from}\u2013{to} \u6761 \xB7 \u5171 {total} \u6761",
2039
- pageSingle: "\u5171 {total} \u6761",
2648
+ shownCount: "\u5DF2\u663E\u793A {shown} / \u5171 {total} \u6761",
2649
+ loadMore: "\u52A0\u8F7D\u66F4\u591A",
2040
2650
  loadFailed: "\u65E0\u6CD5\u8FDE\u63A5\u8BB0\u5FC6\u5B58\u50A8\u3002",
2041
2651
  retry: "\u91CD\u8BD5",
2042
- neverRecalled: "\u4ECE\u672A\u53EC\u56DE"
2652
+ neverRecalled: "\u4ECE\u672A\u53EC\u56DE",
2653
+ // ── 二期:待确认队列 + 写路径 ──
2654
+ tabReview: "\u5F85\u786E\u8BA4",
2655
+ tabReviewWithCount: "\u5F85\u786E\u8BA4\uFF08{count}\uFF09",
2656
+ reviewIntro: "\u81EA\u52A8\u63D0\u53D6\u4E0E\u8BB0\u5FC6\u5DE5\u5177\u7684\u5199\u5165\u63D0\u8BAE\u5728\u8FD9\u91CC\u7B49\u5F85\u4F60\u7684\u88C1\u51B3\uFF1A\u91C7\u7EB3\u540E\u624D\u4F1A\u6210\u4E3A\u8BB0\u5FC6\uFF08\u53EF\u5148\u7F16\u8F91\uFF09\uFF0C\u62D2\u7EDD\u5219\u4E22\u5F03\u3002\u4F60\u51B3\u5B9A\u4E4B\u524D\uFF0C\u4EFB\u4F55\u5185\u5BB9\u90FD\u4E0D\u4F1A\u88AB\u8BB0\u4F4F\u3002",
2657
+ 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",
2658
+ hitsBadge: "\u51FA\u73B0 \xD7{hits}",
2659
+ updateProposalBadge: "\u66F4\u65B0\u63D0\u8BAE",
2660
+ metaSeen: "\u6700\u8FD1\u51FA\u73B0",
2661
+ metaFirstSeen: "\u9996\u6B21\u51FA\u73B0",
2662
+ adoptAction: "\u91C7\u7EB3",
2663
+ editAndAdopt: "\u7F16\u8F91\u540E\u91C7\u7EB3",
2664
+ adoptAsIs: "\u6309\u539F\u6587\u91C7\u7EB3",
2665
+ saveAdopt: "\u4EE5\u4FEE\u6539\u91C7\u7EB3",
2666
+ rejectAction: "\u62D2\u7EDD",
2667
+ editProposalContent: "\u63D0\u8BAE\u5185\u5BB9",
2668
+ editAction: "\u7F16\u8F91",
2669
+ pinAction: "\u7F6E\u9876",
2670
+ unpinAction: "\u53D6\u6D88\u7F6E\u9876",
2671
+ archiveAction: "\u5F52\u6863",
2672
+ unarchiveAction: "\u53D6\u6D88\u5F52\u6863",
2673
+ deleteAction: "\u5220\u9664",
2674
+ confirmDelete: "\u786E\u8BA4\u5220\u9664\uFF1F",
2675
+ cancelDelete: "\u4FDD\u7559",
2676
+ saveEdits: "\u4FDD\u5B58",
2677
+ cancelEdits: "\u53D6\u6D88",
2678
+ editContent: "\u6761\u76EE\u5185\u5BB9",
2679
+ editCategory: "\u7C7B\u522B",
2680
+ noCategory: "\uFF08\u65E0\u7C7B\u522B\uFF09",
2681
+ editSummary: "\u6458\u8981",
2682
+ editSummaryPlaceholder: "\u7D22\u5F15\u89C6\u56FE\u7528\u7684\u77ED\u6458\u8981\uFF08\u53EF\u9009\uFF09"
2043
2683
  };
2044
2684
 
2045
2685
  // src/client/index.ts
@@ -2087,6 +2727,12 @@ var REVIEW_SPEC = {
2087
2727
  { key: "extractionBudget", kind: "number" },
2088
2728
  { key: "judgeEnabled", kind: "checkbox" },
2089
2729
  { key: "pitfallStreakThreshold", kind: "number", minValue: 1 },
2730
+ {
2731
+ key: "confirmBeforeWrite",
2732
+ kind: "checkbox",
2733
+ labelKey: "confirmBeforeWrite",
2734
+ hintKey: "confirmBeforeWriteHint"
2735
+ },
2090
2736
  { key: "curatorEnabled", kind: "checkbox" },
2091
2737
  { key: "curatorEveryNSessions", kind: "number", minValue: 1 },
2092
2738
  { key: "curatorMaxEntries", kind: "number", minValue: 1 },
@@ -2130,7 +2776,14 @@ function createMemoryRemoteApi(connection) {
2130
2776
  list: (request) => invoke("list", request),
2131
2777
  search: (request) => invoke("search", request),
2132
2778
  projects: () => invoke("projects"),
2133
- health: () => invoke("health")
2779
+ health: () => invoke("health"),
2780
+ update: (request) => invoke("update", request),
2781
+ removeEntry: (request) => invoke("removeEntry", request),
2782
+ pin: (request) => invoke("pin", request),
2783
+ archive: (request) => invoke("archive", request),
2784
+ suggestList: () => invoke("suggestList"),
2785
+ suggestAdopt: (request) => invoke("suggestAdopt", request),
2786
+ suggestReject: (request) => invoke("suggestReject", request)
2134
2787
  };
2135
2788
  }
2136
2789
  function createCatalogLoader(connection) {
@@ -2202,9 +2855,15 @@ function apply(ctx) {
2202
2855
  toggleCategory: (category) => {
2203
2856
  controller.toggleCategory(category);
2204
2857
  },
2205
- setPage: (page) => {
2206
- controller.setPage(page);
2207
- }
2858
+ loadMore: () => {
2859
+ void controller.loadMore();
2860
+ },
2861
+ saveEntryEdits: (id, edits) => controller.saveEntryEdits(id, edits),
2862
+ deleteEntry: (id) => controller.deleteEntry(id),
2863
+ togglePin: (entry) => controller.togglePin(entry),
2864
+ toggleArchive: (entry) => controller.toggleArchive(entry),
2865
+ adoptSuggestion: (id, edits) => controller.adoptSuggestion(id, edits),
2866
+ rejectSuggestion: (id) => controller.rejectSuggestion(id)
2208
2867
  });
2209
2868
  ctx.slots.inject("settings.section", () => ctx.slots.register({
2210
2869
  name: "settings.section",