@chenhw7/dsh-memory 0.3.0 → 0.5.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.
- package/README.md +7 -4
- package/README.zh-CN.md +7 -4
- package/lib/benchmark/index.d.ts +125 -0
- package/lib/benchmark/index.d.ts.map +1 -0
- package/lib/benchmark/index.js +150 -0
- package/lib/benchmark/index.js.map +1 -0
- package/lib/brand.d.ts +11 -0
- package/lib/brand.d.ts.map +1 -1
- package/lib/brand.js +7 -0
- package/lib/brand.js.map +1 -1
- package/lib/client/index.js +1666 -42
- package/lib/context/index.d.ts +22 -3
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +59 -13
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +6 -0
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +26 -9
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +44 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +48 -2
- package/lib/index.js.map +1 -1
- package/lib/notes/index.d.ts +1 -1
- package/lib/notes/index.d.ts.map +1 -1
- package/lib/notes/index.js +37 -7
- package/lib/notes/index.js.map +1 -1
- package/lib/notes/writer.d.ts +33 -0
- package/lib/notes/writer.d.ts.map +1 -1
- package/lib/notes/writer.js +61 -1
- package/lib/notes/writer.js.map +1 -1
- package/lib/remote/index.d.ts +102 -5
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +138 -8
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +38 -5
- package/lib/remote/typert.remote-client.js +8 -2
- package/lib/review/extract.d.ts +48 -4
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +164 -11
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts +6 -0
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +12 -10
- package/lib/review/index.js.map +1 -1
- package/lib/store/index.d.ts +56 -3
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +238 -9
- package/lib/store/index.js.map +1 -1
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +156 -25
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +83 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +14 -1
package/lib/client/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var index_exports = {};
|
|
30
30
|
__export(index_exports, {
|
|
31
31
|
apply: () => apply,
|
|
32
|
-
inject: () =>
|
|
32
|
+
inject: () => inject3
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(index_exports);
|
|
35
35
|
|
|
@@ -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
|
{
|
|
@@ -722,13 +743,1365 @@ function MemoryPluginCard(props) {
|
|
|
722
743
|
] });
|
|
723
744
|
}
|
|
724
745
|
|
|
725
|
-
// src/client/
|
|
746
|
+
// src/client/MemorySection.tsx
|
|
726
747
|
var import_react2 = require("react");
|
|
727
|
-
|
|
748
|
+
|
|
749
|
+
// src/client/memory-section-store.ts
|
|
750
|
+
var import_client = require("@deepseek-ai/dsh-client-runtime/client");
|
|
751
|
+
var MEMORY_BATCH_SIZE = 50;
|
|
752
|
+
var MEMORY_CATEGORIES = [
|
|
753
|
+
"failure",
|
|
754
|
+
"correction",
|
|
755
|
+
"insight",
|
|
756
|
+
"preference",
|
|
757
|
+
"convention",
|
|
758
|
+
"tool-quirk",
|
|
759
|
+
"procedure"
|
|
760
|
+
];
|
|
761
|
+
var CATEGORY_LABEL_KEYS = {
|
|
762
|
+
failure: "catFailure",
|
|
763
|
+
correction: "catCorrection",
|
|
764
|
+
insight: "catInsight",
|
|
765
|
+
preference: "catPreference",
|
|
766
|
+
convention: "catConvention",
|
|
767
|
+
"tool-quirk": "catToolQuirk",
|
|
768
|
+
procedure: "catProcedure"
|
|
769
|
+
};
|
|
770
|
+
var INITIAL = {
|
|
771
|
+
status: "idle",
|
|
772
|
+
error: null,
|
|
773
|
+
health: null,
|
|
774
|
+
projects: [],
|
|
775
|
+
entries: [],
|
|
776
|
+
total: 0,
|
|
777
|
+
loadingMore: false,
|
|
778
|
+
scope: "all",
|
|
779
|
+
projectName: null,
|
|
780
|
+
query: "",
|
|
781
|
+
categories: [],
|
|
782
|
+
pending: [],
|
|
783
|
+
actionError: null
|
|
784
|
+
};
|
|
785
|
+
function projectSelectable(scope) {
|
|
786
|
+
return scope === "all" || scope === "project";
|
|
787
|
+
}
|
|
788
|
+
var MemorySectionController = class {
|
|
789
|
+
/**
|
|
790
|
+
* @param api - the mounted `memoryRemote` namespace face; undefined on a
|
|
791
|
+
* deployment too old to serve it — loads then fail into the page's error
|
|
792
|
+
* state instead of breaking the settings panel.
|
|
793
|
+
*/
|
|
794
|
+
constructor(api) {
|
|
795
|
+
this.api = api;
|
|
796
|
+
}
|
|
797
|
+
api;
|
|
798
|
+
/** Page snapshot the renderer subscribes to. */
|
|
799
|
+
store = (0, import_client.createSnapshotStore)(INITIAL);
|
|
800
|
+
/** Guards against overlapping loads painting partial results. */
|
|
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;
|
|
807
|
+
set(patch) {
|
|
808
|
+
this.store.set({ ...this.store.getSnapshot(), ...patch });
|
|
809
|
+
}
|
|
810
|
+
/** Wire scope for the current filter, or undefined for "all". */
|
|
811
|
+
wireScope() {
|
|
812
|
+
const { scope } = this.store.getSnapshot();
|
|
813
|
+
return scope === "all" ? void 0 : scope;
|
|
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
|
+
}
|
|
826
|
+
requireApi() {
|
|
827
|
+
if (this.api === void 0) throw new Error("the memory remote namespace is not mounted on this connection");
|
|
828
|
+
return this.api;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
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).
|
|
835
|
+
*/
|
|
836
|
+
async fetchFirstBatch() {
|
|
837
|
+
const snapshot = this.store.getSnapshot();
|
|
838
|
+
const trimmed = snapshot.query.trim();
|
|
839
|
+
if (trimmed !== "" || snapshot.categories.length > 0) {
|
|
840
|
+
const response2 = await this.requireApi().search({
|
|
841
|
+
...this.wireFilters(),
|
|
842
|
+
...trimmed !== "" ? { query: trimmed } : {},
|
|
843
|
+
limit: 0
|
|
844
|
+
});
|
|
845
|
+
if (!response2.result.ok) throw new Error(response2.result.error.message);
|
|
846
|
+
const selected = snapshot.categories;
|
|
847
|
+
const matches = selected.length === 0 ? [...response2.result.value.entries] : response2.result.value.entries.filter(
|
|
848
|
+
(entry) => entry.category !== void 0 && selected.includes(entry.category)
|
|
849
|
+
);
|
|
850
|
+
this.matches = matches;
|
|
851
|
+
return { entries: matches.slice(0, MEMORY_BATCH_SIZE), total: matches.length };
|
|
852
|
+
}
|
|
853
|
+
this.matches = null;
|
|
854
|
+
const response = await this.requireApi().list({
|
|
855
|
+
...this.wireFilters(),
|
|
856
|
+
limit: MEMORY_BATCH_SIZE,
|
|
857
|
+
offset: 0
|
|
858
|
+
});
|
|
859
|
+
if (!response.result.ok) throw new Error(response.result.error.message);
|
|
860
|
+
return { entries: response.result.value.entries, total: response.result.value.total };
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
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.
|
|
866
|
+
* @returns once the snapshot reflects the host.
|
|
867
|
+
*/
|
|
868
|
+
async load() {
|
|
869
|
+
const ticket = ++this.seq;
|
|
870
|
+
if (this.store.getSnapshot().status === "idle") this.set({ status: "loading" });
|
|
871
|
+
try {
|
|
872
|
+
const api = this.requireApi();
|
|
873
|
+
const [health, projects, batch] = await Promise.all([
|
|
874
|
+
api.health(),
|
|
875
|
+
api.projects(),
|
|
876
|
+
this.fetchFirstBatch()
|
|
877
|
+
]);
|
|
878
|
+
if (!health.result.ok) throw new Error(health.result.error.message);
|
|
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
|
+
);
|
|
884
|
+
if (ticket !== this.seq) return;
|
|
885
|
+
this.set({
|
|
886
|
+
status: "ready",
|
|
887
|
+
error: null,
|
|
888
|
+
health: health.result.value,
|
|
889
|
+
projects: projects.result.value.projects,
|
|
890
|
+
entries: batch.entries,
|
|
891
|
+
total: batch.total,
|
|
892
|
+
pending: pendingRows
|
|
893
|
+
});
|
|
894
|
+
} catch (error) {
|
|
895
|
+
if (ticket !== this.seq) return;
|
|
896
|
+
this.set({ status: "error", error: messageOf(error) });
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
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.
|
|
903
|
+
*/
|
|
904
|
+
async reload() {
|
|
905
|
+
const ticket = ++this.seq;
|
|
906
|
+
try {
|
|
907
|
+
const batch = await this.fetchFirstBatch();
|
|
908
|
+
if (ticket !== this.seq) return;
|
|
909
|
+
this.set({ status: "ready", error: null, entries: batch.entries, total: batch.total, loadingMore: false });
|
|
910
|
+
} catch (error) {
|
|
911
|
+
if (ticket !== this.seq) return;
|
|
912
|
+
this.set({ error: messageOf(error), loadingMore: false });
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
/** Switch the scope filter; the workspace pick cannot outlive its scope. */
|
|
916
|
+
setScope(scope) {
|
|
917
|
+
if (this.store.getSnapshot().scope === scope) return;
|
|
918
|
+
this.set({ scope, projectName: null });
|
|
919
|
+
void this.reload();
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Pick one workspace (or null/'' for all). Only honored where it means
|
|
923
|
+
* something — see {@link projectSelectable}.
|
|
924
|
+
*/
|
|
925
|
+
setProject(projectName) {
|
|
926
|
+
if (!projectSelectable(this.store.getSnapshot().scope)) return;
|
|
927
|
+
const next = projectName === "" ? null : projectName;
|
|
928
|
+
if (this.store.getSnapshot().projectName === next) return;
|
|
929
|
+
this.set({ projectName: next });
|
|
930
|
+
void this.reload();
|
|
931
|
+
}
|
|
932
|
+
/** Commit a search text (already debounced upstream); empty clears it. */
|
|
933
|
+
commitQuery(query) {
|
|
934
|
+
if (this.store.getSnapshot().query === query) return;
|
|
935
|
+
this.set({ query });
|
|
936
|
+
void this.reload();
|
|
937
|
+
}
|
|
938
|
+
/** Flip one category chip. */
|
|
939
|
+
toggleCategory(category) {
|
|
940
|
+
const selected = this.store.getSnapshot().categories;
|
|
941
|
+
const next = selected.includes(category) ? selected.filter((c) => c !== category) : [...selected, category];
|
|
942
|
+
this.set({ categories: next });
|
|
943
|
+
void this.reload();
|
|
944
|
+
}
|
|
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();
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
function messageOf(error) {
|
|
1104
|
+
return error instanceof Error ? error.message : String(error);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// src/client/section-styles.ts
|
|
1108
|
+
var RULES2 = `
|
|
1109
|
+
.dsm-s-section {
|
|
1110
|
+
display: flex;
|
|
1111
|
+
flex-direction: column;
|
|
1112
|
+
gap: 16px;
|
|
1113
|
+
}
|
|
1114
|
+
.dsm-s-title {
|
|
1115
|
+
margin: 0;
|
|
1116
|
+
font-size: 15px;
|
|
1117
|
+
font-weight: 600;
|
|
1118
|
+
line-height: 1.4;
|
|
1119
|
+
color: var(--dsw-alias-label-primary);
|
|
1120
|
+
}
|
|
1121
|
+
.dsm-s-intro {
|
|
1122
|
+
margin: 0;
|
|
1123
|
+
font-size: 13px;
|
|
1124
|
+
line-height: 1.5;
|
|
1125
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/* \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 */
|
|
1129
|
+
.dsm-s-dash {
|
|
1130
|
+
display: flex;
|
|
1131
|
+
flex-wrap: wrap;
|
|
1132
|
+
align-items: stretch;
|
|
1133
|
+
gap: 8px;
|
|
1134
|
+
}
|
|
1135
|
+
.dsm-s-stat {
|
|
1136
|
+
display: flex;
|
|
1137
|
+
flex-direction: column;
|
|
1138
|
+
justify-content: center;
|
|
1139
|
+
gap: 2px;
|
|
1140
|
+
min-width: 88px;
|
|
1141
|
+
padding: 10px 14px;
|
|
1142
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1143
|
+
border-radius: 12px;
|
|
1144
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1145
|
+
}
|
|
1146
|
+
.dsm-s-stat-value {
|
|
1147
|
+
font-size: 18px;
|
|
1148
|
+
font-weight: 600;
|
|
1149
|
+
line-height: 1.3;
|
|
1150
|
+
color: var(--dsw-alias-label-primary);
|
|
1151
|
+
}
|
|
1152
|
+
.dsm-s-stat-value-muted {
|
|
1153
|
+
color: var(--dsw-alias-label-secondary);
|
|
1154
|
+
}
|
|
1155
|
+
.dsm-s-stat-label {
|
|
1156
|
+
font-size: 12px;
|
|
1157
|
+
line-height: 1.5;
|
|
1158
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1159
|
+
}
|
|
1160
|
+
.dsm-s-stat-stale {
|
|
1161
|
+
cursor: help;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/* \u2500\u2500 Toolbar \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1165
|
+
.dsm-s-toolbar {
|
|
1166
|
+
display: flex;
|
|
1167
|
+
flex-direction: column;
|
|
1168
|
+
gap: 10px;
|
|
1169
|
+
}
|
|
1170
|
+
.dsm-s-toolbar-row {
|
|
1171
|
+
display: flex;
|
|
1172
|
+
flex-wrap: wrap;
|
|
1173
|
+
align-items: center;
|
|
1174
|
+
gap: 8px;
|
|
1175
|
+
}
|
|
1176
|
+
.dsm-s-toolbar-label {
|
|
1177
|
+
font-size: 12px;
|
|
1178
|
+
font-weight: 500;
|
|
1179
|
+
line-height: 1.5;
|
|
1180
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1181
|
+
}
|
|
1182
|
+
/* Segmented scope switch and section tabs share one visual language. */
|
|
1183
|
+
.dsm-s-seg,
|
|
1184
|
+
.dsm-s-tabs {
|
|
1185
|
+
display: inline-flex;
|
|
1186
|
+
padding: 2px;
|
|
1187
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1188
|
+
border-radius: 8px;
|
|
1189
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1190
|
+
}
|
|
1191
|
+
.dsm-s-seg-btn,
|
|
1192
|
+
.dsm-s-tab-btn {
|
|
1193
|
+
appearance: none;
|
|
1194
|
+
border: 0;
|
|
1195
|
+
background: none;
|
|
1196
|
+
padding: 4px 12px;
|
|
1197
|
+
border-radius: 6px;
|
|
1198
|
+
font: inherit;
|
|
1199
|
+
font-size: 13px;
|
|
1200
|
+
line-height: 1.5;
|
|
1201
|
+
color: var(--dsw-alias-label-secondary);
|
|
1202
|
+
cursor: pointer;
|
|
1203
|
+
}
|
|
1204
|
+
.dsm-s-seg-btn:hover:not([aria-pressed="true"]),
|
|
1205
|
+
.dsm-s-tab-btn:hover:not([aria-selected="true"]) {
|
|
1206
|
+
color: var(--dsw-alias-label-primary);
|
|
1207
|
+
}
|
|
1208
|
+
.dsm-s-seg-btn[aria-pressed="true"],
|
|
1209
|
+
.dsm-s-tab-btn[aria-selected="true"] {
|
|
1210
|
+
background: var(--dsw-alias-brand-primary);
|
|
1211
|
+
color: var(--dsw-alias-bg-layer-3);
|
|
1212
|
+
}
|
|
1213
|
+
.dsm-s-tab-btn[aria-selected="true"] {
|
|
1214
|
+
cursor: default;
|
|
1215
|
+
}
|
|
1216
|
+
.dsm-s-seg-btn:focus-visible,
|
|
1217
|
+
.dsm-s-tab-btn:focus-visible {
|
|
1218
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
1219
|
+
outline-offset: -2px;
|
|
1220
|
+
}
|
|
1221
|
+
/* Search box mirrors the shared .input control look. */
|
|
1222
|
+
.dsm-s-input {
|
|
1223
|
+
flex: 1;
|
|
1224
|
+
min-width: 200px;
|
|
1225
|
+
max-width: 360px;
|
|
1226
|
+
height: 34px;
|
|
1227
|
+
padding: 0 12px;
|
|
1228
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1229
|
+
border-radius: 8px;
|
|
1230
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1231
|
+
font: inherit;
|
|
1232
|
+
font-size: 13px;
|
|
1233
|
+
line-height: 1.5;
|
|
1234
|
+
color: var(--dsw-alias-label-primary);
|
|
1235
|
+
}
|
|
1236
|
+
.dsm-s-input:focus-visible {
|
|
1237
|
+
outline: none;
|
|
1238
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
1239
|
+
}
|
|
1240
|
+
/* Workspace selector mirrors the shared .select control look. */
|
|
1241
|
+
.dsm-s-select {
|
|
1242
|
+
max-width: 260px;
|
|
1243
|
+
height: 34px;
|
|
1244
|
+
padding: 0 28px 0 12px;
|
|
1245
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1246
|
+
border-radius: 8px;
|
|
1247
|
+
background-color: var(--dsw-alias-bg-layer-3);
|
|
1248
|
+
font: inherit;
|
|
1249
|
+
font-size: 13px;
|
|
1250
|
+
line-height: 1.5;
|
|
1251
|
+
color: var(--dsw-alias-label-primary);
|
|
1252
|
+
cursor: pointer;
|
|
1253
|
+
appearance: none;
|
|
1254
|
+
-webkit-appearance: none;
|
|
1255
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3 5l4 4 4-4' stroke='%237a7a7a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
1256
|
+
background-repeat: no-repeat;
|
|
1257
|
+
background-position: right 10px center;
|
|
1258
|
+
}
|
|
1259
|
+
.dsm-s-select:focus-visible {
|
|
1260
|
+
outline: none;
|
|
1261
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
1262
|
+
}
|
|
1263
|
+
.dsm-s-select:disabled {
|
|
1264
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1265
|
+
cursor: default;
|
|
1266
|
+
}
|
|
1267
|
+
/* Category chips. */
|
|
1268
|
+
.dsm-s-chip {
|
|
1269
|
+
appearance: none;
|
|
1270
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1271
|
+
border-radius: 999px;
|
|
1272
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1273
|
+
padding: 3px 12px;
|
|
1274
|
+
font: inherit;
|
|
1275
|
+
font-size: 12px;
|
|
1276
|
+
line-height: 1.5;
|
|
1277
|
+
color: var(--dsw-alias-label-secondary);
|
|
1278
|
+
cursor: pointer;
|
|
1279
|
+
}
|
|
1280
|
+
.dsm-s-chip:hover {
|
|
1281
|
+
color: var(--dsw-alias-label-primary);
|
|
1282
|
+
border-color: var(--dsw-alias-label-dimmed);
|
|
1283
|
+
}
|
|
1284
|
+
.dsm-s-chip[aria-pressed="true"] {
|
|
1285
|
+
background: var(--dsw-alias-bg-module-platform);
|
|
1286
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
1287
|
+
color: var(--dsw-alias-label-primary);
|
|
1288
|
+
}
|
|
1289
|
+
.dsm-s-chip:focus-visible {
|
|
1290
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
1291
|
+
outline-offset: 1px;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
/* \u2500\u2500 Entry list \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1295
|
+
.dsm-s-list {
|
|
1296
|
+
list-style: none;
|
|
1297
|
+
margin: 0;
|
|
1298
|
+
padding: 0;
|
|
1299
|
+
display: flex;
|
|
1300
|
+
flex-direction: column;
|
|
1301
|
+
gap: 8px;
|
|
1302
|
+
}
|
|
1303
|
+
.dsm-s-row {
|
|
1304
|
+
display: flex;
|
|
1305
|
+
flex-direction: column;
|
|
1306
|
+
gap: 6px;
|
|
1307
|
+
padding: 12px 14px;
|
|
1308
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1309
|
+
border-radius: 12px;
|
|
1310
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1311
|
+
}
|
|
1312
|
+
.dsm-s-row-stale {
|
|
1313
|
+
opacity: 0.62;
|
|
1314
|
+
}
|
|
1315
|
+
.dsm-s-badges {
|
|
1316
|
+
display: inline-flex;
|
|
1317
|
+
align-items: center;
|
|
1318
|
+
flex-wrap: wrap;
|
|
1319
|
+
gap: 6px;
|
|
1320
|
+
}
|
|
1321
|
+
.dsm-s-badge {
|
|
1322
|
+
border-radius: 999px;
|
|
1323
|
+
padding: 1px 8px;
|
|
1324
|
+
font-size: 11px;
|
|
1325
|
+
line-height: 17px;
|
|
1326
|
+
white-space: nowrap;
|
|
1327
|
+
font-weight: 500;
|
|
1328
|
+
background: var(--dsw-alias-bg-module-platform);
|
|
1329
|
+
color: var(--dsw-alias-label-secondary);
|
|
1330
|
+
}
|
|
1331
|
+
.dsm-s-badge-pinned,
|
|
1332
|
+
.dsm-s-badge-stale {
|
|
1333
|
+
background: none;
|
|
1334
|
+
padding-left: 0;
|
|
1335
|
+
}
|
|
1336
|
+
.dsm-s-project {
|
|
1337
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
1338
|
+
font-size: 11px;
|
|
1339
|
+
line-height: 17px;
|
|
1340
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1341
|
+
}
|
|
1342
|
+
.dsm-s-content {
|
|
1343
|
+
margin: 0;
|
|
1344
|
+
font-size: 13px;
|
|
1345
|
+
line-height: 1.55;
|
|
1346
|
+
color: var(--dsw-alias-label-primary);
|
|
1347
|
+
white-space: pre-wrap;
|
|
1348
|
+
word-break: break-word;
|
|
1349
|
+
cursor: pointer;
|
|
1350
|
+
display: -webkit-box;
|
|
1351
|
+
-webkit-box-orient: vertical;
|
|
1352
|
+
-webkit-line-clamp: 2;
|
|
1353
|
+
overflow: hidden;
|
|
1354
|
+
}
|
|
1355
|
+
.dsm-s-content-open {
|
|
1356
|
+
display: block;
|
|
1357
|
+
-webkit-line-clamp: none;
|
|
1358
|
+
overflow: visible;
|
|
1359
|
+
cursor: text;
|
|
1360
|
+
}
|
|
1361
|
+
.dsm-s-meta {
|
|
1362
|
+
display: flex;
|
|
1363
|
+
flex-wrap: wrap;
|
|
1364
|
+
gap: 4px 14px;
|
|
1365
|
+
margin: 0;
|
|
1366
|
+
font-size: 11px;
|
|
1367
|
+
line-height: 1.5;
|
|
1368
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
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 {
|
|
1373
|
+
display: flex;
|
|
1374
|
+
flex-direction: column;
|
|
1375
|
+
align-items: center;
|
|
1376
|
+
gap: 8px;
|
|
1377
|
+
}
|
|
1378
|
+
.dsm-s-count {
|
|
1379
|
+
margin: 0;
|
|
1380
|
+
font-size: 12px;
|
|
1381
|
+
line-height: 1.5;
|
|
1382
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1383
|
+
}
|
|
1384
|
+
.dsm-s-sentinel {
|
|
1385
|
+
width: 100%;
|
|
1386
|
+
height: 1px;
|
|
1387
|
+
}
|
|
1388
|
+
.dsm-s-more-btn {
|
|
1389
|
+
appearance: none;
|
|
1390
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1391
|
+
border-radius: 8px;
|
|
1392
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1393
|
+
padding: 4px 12px;
|
|
1394
|
+
font: inherit;
|
|
1395
|
+
font-size: 13px;
|
|
1396
|
+
line-height: 1.5;
|
|
1397
|
+
color: var(--dsw-alias-label-secondary);
|
|
1398
|
+
cursor: pointer;
|
|
1399
|
+
}
|
|
1400
|
+
.dsm-s-more-btn:hover:not(:disabled) {
|
|
1401
|
+
color: var(--dsw-alias-label-primary);
|
|
1402
|
+
border-color: var(--dsw-alias-label-dimmed);
|
|
1403
|
+
}
|
|
1404
|
+
.dsm-s-more-btn:disabled {
|
|
1405
|
+
opacity: 0.4;
|
|
1406
|
+
cursor: default;
|
|
1407
|
+
}
|
|
1408
|
+
.dsm-s-empty {
|
|
1409
|
+
margin: 24px 0;
|
|
1410
|
+
text-align: center;
|
|
1411
|
+
font-size: 13px;
|
|
1412
|
+
line-height: 1.6;
|
|
1413
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1414
|
+
}
|
|
1415
|
+
.dsm-s-error {
|
|
1416
|
+
margin: 0;
|
|
1417
|
+
font-size: 12px;
|
|
1418
|
+
line-height: 1.5;
|
|
1419
|
+
color: var(--dsw-alias-label-error);
|
|
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
|
+
}
|
|
1500
|
+
`;
|
|
1501
|
+
var cls2 = {
|
|
1502
|
+
section: "dsm-s-section",
|
|
1503
|
+
title: "dsm-s-title",
|
|
1504
|
+
intro: "dsm-s-intro",
|
|
1505
|
+
dash: "dsm-s-dash",
|
|
1506
|
+
stat: "dsm-s-stat",
|
|
1507
|
+
statValue: "dsm-s-stat-value",
|
|
1508
|
+
statValueMuted: "dsm-s-stat-value-muted",
|
|
1509
|
+
statLabel: "dsm-s-stat-label",
|
|
1510
|
+
statStale: "dsm-s-stat-stale",
|
|
1511
|
+
toolbar: "dsm-s-toolbar",
|
|
1512
|
+
toolbarRow: "dsm-s-toolbar-row",
|
|
1513
|
+
toolbarLabel: "dsm-s-toolbar-label",
|
|
1514
|
+
seg: "dsm-s-seg",
|
|
1515
|
+
segBtn: "dsm-s-seg-btn",
|
|
1516
|
+
tabs: "dsm-s-tabs",
|
|
1517
|
+
tabBtn: "dsm-s-tab-btn",
|
|
1518
|
+
input: "dsm-s-input",
|
|
1519
|
+
select: "dsm-s-select",
|
|
1520
|
+
chip: "dsm-s-chip",
|
|
1521
|
+
list: "dsm-s-list",
|
|
1522
|
+
row: "dsm-s-row",
|
|
1523
|
+
rowStale: "dsm-s-row-stale",
|
|
1524
|
+
badges: "dsm-s-badges",
|
|
1525
|
+
badge: "dsm-s-badge",
|
|
1526
|
+
badgePinned: "dsm-s-badge-pinned",
|
|
1527
|
+
badgeStale: "dsm-s-badge-stale",
|
|
1528
|
+
project: "dsm-s-project",
|
|
1529
|
+
content: "dsm-s-content",
|
|
1530
|
+
contentOpen: "dsm-s-content-open",
|
|
1531
|
+
meta: "dsm-s-meta",
|
|
1532
|
+
more: "dsm-s-more",
|
|
1533
|
+
count: "dsm-s-count",
|
|
1534
|
+
sentinel: "dsm-s-sentinel",
|
|
1535
|
+
moreBtn: "dsm-s-more-btn",
|
|
1536
|
+
empty: "dsm-s-empty",
|
|
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"
|
|
1547
|
+
};
|
|
1548
|
+
var injected2 = false;
|
|
1549
|
+
function inject2() {
|
|
1550
|
+
if (injected2 || typeof document === "undefined") return;
|
|
1551
|
+
const style = document.createElement("style");
|
|
1552
|
+
style.setAttribute("data-dsh-memory", "section");
|
|
1553
|
+
style.textContent = RULES2;
|
|
1554
|
+
document.head.appendChild(style);
|
|
1555
|
+
injected2 = true;
|
|
1556
|
+
}
|
|
1557
|
+
var css2 = (inject2(), cls2);
|
|
1558
|
+
|
|
1559
|
+
// src/client/MemorySection.tsx
|
|
728
1560
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1561
|
+
var SCOPES = [
|
|
1562
|
+
{ value: "all", labelKey: "scopeAll" },
|
|
1563
|
+
{ value: "global", labelKey: "scopeGlobal" },
|
|
1564
|
+
{ value: "project", labelKey: "scopeProject" },
|
|
1565
|
+
{ value: "user", labelKey: "scopeUser" }
|
|
1566
|
+
];
|
|
1567
|
+
function formatTs(ts, fallback) {
|
|
1568
|
+
return ts === void 0 || ts === null ? fallback : new Date(ts).toLocaleString();
|
|
1569
|
+
}
|
|
1570
|
+
var NO_CATEGORY = "";
|
|
1571
|
+
function emptyKeyOf(state) {
|
|
1572
|
+
if (state.query.trim() !== "" || state.categories.length > 0) return "emptyFiltered";
|
|
1573
|
+
if (state.scope === "global") return "emptyGlobal";
|
|
1574
|
+
if (state.scope === "user") return "emptyUser";
|
|
1575
|
+
if (state.scope === "project") return "emptyProject";
|
|
1576
|
+
return "emptyAll";
|
|
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
|
+
}
|
|
1648
|
+
function EntryRow(props) {
|
|
1649
|
+
const { entry, expanded, staleLabel, staleHint, pinnedLabel, neverRecalledLabel, scopeLabels, translate, onToggle, onSaveEdits, onDelete, onTogglePin, onToggleArchive } = props;
|
|
1650
|
+
const category = entry.category;
|
|
1651
|
+
const projectName = entry.projectName;
|
|
1652
|
+
const isStale = entry.staleSince !== void 0;
|
|
1653
|
+
const isPinned = entry.pinned === true;
|
|
1654
|
+
const [editing, setEditing] = (0, import_react2.useState)(false);
|
|
1655
|
+
const [confirmingDelete, setConfirmingDelete] = (0, import_react2.useState)(false);
|
|
1656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: isStale ? `${css2.row} ${css2.rowStale}` : css2.row, children: [
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.badges, children: [
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: scopeLabels[entry.scope] }),
|
|
1659
|
+
category === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }),
|
|
1660
|
+
projectName === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.project, children: projectName }),
|
|
1661
|
+
isPinned ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.badge} ${css2.badgePinned}`, children: `\u{1F4CC} ${pinnedLabel}` }) : null,
|
|
1662
|
+
isStale ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.badge} ${css2.badgeStale}`, title: staleHint, "aria-label": staleHint, children: `\u{1F634} ${staleLabel}` }) : null
|
|
1663
|
+
] }),
|
|
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)(
|
|
1678
|
+
"button",
|
|
1679
|
+
{
|
|
1680
|
+
type: "button",
|
|
1681
|
+
className: expanded ? `${css2.content} ${css2.contentOpen}` : css2.content,
|
|
1682
|
+
"aria-expanded": expanded,
|
|
1683
|
+
onClick: onToggle,
|
|
1684
|
+
children: entry.content
|
|
1685
|
+
}
|
|
1686
|
+
),
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: css2.meta, children: [
|
|
1688
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaCreated")} ${formatTs(entry.createdAt, "\u2014")}` }),
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaUpdated")} ${formatTs(entry.updatedAt, "\u2014")}` }),
|
|
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
|
+
)
|
|
1742
|
+
] })
|
|
1743
|
+
] });
|
|
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
|
+
}
|
|
1806
|
+
function MemorySection(props) {
|
|
1807
|
+
const { useMemorySection, t, load } = props;
|
|
1808
|
+
const state = useMemorySection((snapshot) => snapshot);
|
|
1809
|
+
(0, import_react2.useEffect)(() => {
|
|
1810
|
+
void load();
|
|
1811
|
+
}, [load]);
|
|
1812
|
+
const [tab, setTab] = (0, import_react2.useState)("overview");
|
|
1813
|
+
const [searchText, setSearchText] = (0, import_react2.useState)(state.query);
|
|
1814
|
+
(0, import_react2.useEffect)(() => {
|
|
1815
|
+
const timer = setTimeout(() => {
|
|
1816
|
+
props.commitQuery(searchText);
|
|
1817
|
+
}, 300);
|
|
1818
|
+
return () => {
|
|
1819
|
+
clearTimeout(timer);
|
|
1820
|
+
};
|
|
1821
|
+
}, [searchText]);
|
|
1822
|
+
const [expandedIds, setExpandedIds] = (0, import_react2.useState)(/* @__PURE__ */ new Set());
|
|
1823
|
+
const toggleExpanded = (id) => {
|
|
1824
|
+
setExpandedIds((previous) => {
|
|
1825
|
+
const next = new Set(previous);
|
|
1826
|
+
if (next.has(id)) next.delete(id);
|
|
1827
|
+
else next.add(id);
|
|
1828
|
+
return next;
|
|
1829
|
+
});
|
|
1830
|
+
};
|
|
1831
|
+
const scopeLabels = {
|
|
1832
|
+
global: t("dashGlobal"),
|
|
1833
|
+
project: t("dashProject"),
|
|
1834
|
+
user: t("dashUser")
|
|
1835
|
+
};
|
|
1836
|
+
const workspaceEnabled = state.scope === "all" || state.scope === "project";
|
|
1837
|
+
const total = state.total;
|
|
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]);
|
|
1858
|
+
if (state.status === "error") {
|
|
1859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
|
|
1862
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.moreBtn, onClick: () => {
|
|
1863
|
+
void load();
|
|
1864
|
+
}, children: t("retry") })
|
|
1865
|
+
] });
|
|
1866
|
+
}
|
|
1867
|
+
if (state.status === "loading" || state.status === "idle") {
|
|
1868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
|
|
1870
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.intro, children: t("loading") })
|
|
1871
|
+
] });
|
|
1872
|
+
}
|
|
1873
|
+
const health = state.health;
|
|
1874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
|
|
1875
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
|
|
1876
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.intro, children: t("sectionIntro") }),
|
|
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: [
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.totalEntries }),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashTotal") })
|
|
1922
|
+
] }),
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.byScope.global }),
|
|
1925
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("scopeGlobal") })
|
|
1926
|
+
] }),
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.byScope.user }),
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("scopeUser") })
|
|
1930
|
+
] }),
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.byScope.project }),
|
|
1933
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("scopeProject") })
|
|
1934
|
+
] }),
|
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.pinned }),
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashPinned") })
|
|
1938
|
+
] }),
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: `${css2.stat} ${css2.statStale}`, title: t("dashStaleHint"), children: [
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.statValue}${(health.stale ?? 0) > 0 ? "" : ` ${css2.statValueMuted}`}`, children: health.stale ?? 0 }),
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashStale") })
|
|
1942
|
+
] }),
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.auditRecords }),
|
|
1945
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashAudit") })
|
|
1946
|
+
] }),
|
|
1947
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.statValue} ${css2.statValueMuted}`, children: formatTs(health.lastActivityTs, t("dashLastActivityNever")) }),
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashLastActivity") })
|
|
1950
|
+
] }),
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1952
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.statValue} ${css2.statValueMuted}`, children: formatTs(health.lastExtractionTs, t("dashLastActivityNever")) }),
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashLastExtraction") })
|
|
1954
|
+
] })
|
|
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,
|
|
1961
|
+
{
|
|
1962
|
+
suggestion,
|
|
1963
|
+
scopeLabels,
|
|
1964
|
+
translate: t,
|
|
1965
|
+
onAdopt: (edits) => {
|
|
1966
|
+
void props.adoptSuggestion(suggestion.id, edits);
|
|
1967
|
+
},
|
|
1968
|
+
onReject: () => {
|
|
1969
|
+
void props.rejectSuggestion(suggestion.id);
|
|
1970
|
+
}
|
|
1971
|
+
},
|
|
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)
|
|
1989
|
+
},
|
|
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,
|
|
2044
|
+
{
|
|
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);
|
|
2055
|
+
},
|
|
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
|
+
] })
|
|
2089
|
+
] })
|
|
2090
|
+
] }) : null
|
|
2091
|
+
] });
|
|
2092
|
+
}
|
|
2093
|
+
function translateCategory(category, t) {
|
|
2094
|
+
const key = CATEGORY_LABEL_KEYS[category];
|
|
2095
|
+
return key === void 0 ? category : t(key);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
// src/client/NamespaceCard.tsx
|
|
2099
|
+
var import_react3 = require("react");
|
|
2100
|
+
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
2101
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
729
2102
|
function namespaceCard(spec) {
|
|
730
2103
|
return function SpecBoundNamespaceCard(props) {
|
|
731
|
-
return /* @__PURE__ */ (0,
|
|
2104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NamespaceCard, { ...props, spec });
|
|
732
2105
|
};
|
|
733
2106
|
}
|
|
734
2107
|
function isOverridden2(snap, field) {
|
|
@@ -741,12 +2114,12 @@ function NamespaceCard(props) {
|
|
|
741
2114
|
const snap = props.useNs((s) => s);
|
|
742
2115
|
const t = props.t;
|
|
743
2116
|
const spec = props.spec;
|
|
744
|
-
const [open, setOpen] = (0,
|
|
2117
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
745
2118
|
const canLoadCatalog = typeof props.loadCatalog === "function";
|
|
746
|
-
const catalogStartedRef = (0,
|
|
747
|
-
const [catalog, setCatalog] = (0,
|
|
748
|
-
const [catalogStatus, setCatalogStatus] = (0,
|
|
749
|
-
(0,
|
|
2119
|
+
const catalogStartedRef = (0, import_react3.useRef)(false);
|
|
2120
|
+
const [catalog, setCatalog] = (0, import_react3.useState)(void 0);
|
|
2121
|
+
const [catalogStatus, setCatalogStatus] = (0, import_react3.useState)("idle");
|
|
2122
|
+
(0, import_react3.useEffect)(() => {
|
|
750
2123
|
if (!open || !canLoadCatalog || catalogStartedRef.current) return;
|
|
751
2124
|
catalogStartedRef.current = true;
|
|
752
2125
|
setCatalogStatus("loading");
|
|
@@ -767,10 +2140,10 @@ function NamespaceCard(props) {
|
|
|
767
2140
|
})();
|
|
768
2141
|
}, [open, canLoadCatalog]);
|
|
769
2142
|
const committed = snap.value ?? {};
|
|
770
|
-
const [draft, setDraft] = (0,
|
|
771
|
-
const [saving, setSaving] = (0,
|
|
772
|
-
const [failed, setFailed] = (0,
|
|
773
|
-
(0,
|
|
2143
|
+
const [draft, setDraft] = (0, import_react3.useState)({ ...committed });
|
|
2144
|
+
const [saving, setSaving] = (0, import_react3.useState)(false);
|
|
2145
|
+
const [failed, setFailed] = (0, import_react3.useState)(false);
|
|
2146
|
+
(0, import_react3.useEffect)(() => {
|
|
774
2147
|
setDraft({ ...committed });
|
|
775
2148
|
setFailed(false);
|
|
776
2149
|
}, [committed]);
|
|
@@ -814,7 +2187,7 @@ function NamespaceCard(props) {
|
|
|
814
2187
|
const renderSelectField = (field, base) => {
|
|
815
2188
|
const rawValue = typeof draft[field.key] === "string" ? draft[field.key] : "";
|
|
816
2189
|
if (!canLoadCatalog || catalogStatus === "failed") {
|
|
817
|
-
return /* @__PURE__ */ (0,
|
|
2190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
818
2191
|
TextField,
|
|
819
2192
|
{
|
|
820
2193
|
...base,
|
|
@@ -825,7 +2198,7 @@ function NamespaceCard(props) {
|
|
|
825
2198
|
);
|
|
826
2199
|
}
|
|
827
2200
|
if (catalogStatus !== "ready") {
|
|
828
|
-
return /* @__PURE__ */ (0,
|
|
2201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
829
2202
|
SelectField,
|
|
830
2203
|
{
|
|
831
2204
|
...base,
|
|
@@ -839,7 +2212,7 @@ function NamespaceCard(props) {
|
|
|
839
2212
|
}
|
|
840
2213
|
const resolved = field.options?.({ catalog, draft }) ?? [];
|
|
841
2214
|
if (resolved.length === 0) {
|
|
842
|
-
return /* @__PURE__ */ (0,
|
|
2215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
843
2216
|
TextField,
|
|
844
2217
|
{
|
|
845
2218
|
...base,
|
|
@@ -853,7 +2226,7 @@ function NamespaceCard(props) {
|
|
|
853
2226
|
if (rawValue !== "" && !opts.some((o) => o.value === rawValue)) {
|
|
854
2227
|
opts.push({ value: rawValue, label: rawValue });
|
|
855
2228
|
}
|
|
856
|
-
return /* @__PURE__ */ (0,
|
|
2229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
857
2230
|
SelectField,
|
|
858
2231
|
{
|
|
859
2232
|
...base,
|
|
@@ -863,8 +2236,8 @@ function NamespaceCard(props) {
|
|
|
863
2236
|
}
|
|
864
2237
|
);
|
|
865
2238
|
};
|
|
866
|
-
return /* @__PURE__ */ (0,
|
|
867
|
-
/* @__PURE__ */ (0,
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { className: `${css.card}${open ? ` ${css.cardOpen}` : ""}`, children: [
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
868
2241
|
"button",
|
|
869
2242
|
{
|
|
870
2243
|
type: "button",
|
|
@@ -875,17 +2248,17 @@ function NamespaceCard(props) {
|
|
|
875
2248
|
setOpen(!open);
|
|
876
2249
|
},
|
|
877
2250
|
children: [
|
|
878
|
-
/* @__PURE__ */ (0,
|
|
879
|
-
/* @__PURE__ */ (0,
|
|
880
|
-
/* @__PURE__ */ (0,
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css.headText, children: [
|
|
2252
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.name, children: t(spec.titleKey) }),
|
|
2253
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.description, children: t(spec.descriptionKey) })
|
|
881
2254
|
] }),
|
|
882
|
-
dirty ? /* @__PURE__ */ (0,
|
|
883
|
-
/* @__PURE__ */ (0,
|
|
2255
|
+
dirty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.pending, children: t("unsaved") }) : null,
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives2.IconChevronDownOutline14, { className: `${css.chevron}${open ? ` ${css.chevronOpen}` : ""}` })
|
|
884
2257
|
]
|
|
885
2258
|
}
|
|
886
2259
|
),
|
|
887
|
-
open ? /* @__PURE__ */ (0,
|
|
888
|
-
!snap.writable ? /* @__PURE__ */ (0,
|
|
2260
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.body, children: [
|
|
2261
|
+
!snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.readOnly, role: "status", children: t("readOnly") }) : null,
|
|
889
2262
|
spec.fields.map((field) => {
|
|
890
2263
|
const label = t(field.labelKey ?? field.key);
|
|
891
2264
|
const hint = t(field.hintKey ?? `${field.key}Hint`);
|
|
@@ -904,7 +2277,7 @@ function NamespaceCard(props) {
|
|
|
904
2277
|
}
|
|
905
2278
|
};
|
|
906
2279
|
if (field.kind === "checkbox") {
|
|
907
|
-
return /* @__PURE__ */ (0,
|
|
2280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
908
2281
|
CheckboxField,
|
|
909
2282
|
{
|
|
910
2283
|
...base,
|
|
@@ -915,7 +2288,7 @@ function NamespaceCard(props) {
|
|
|
915
2288
|
}
|
|
916
2289
|
if (field.kind === "number") {
|
|
917
2290
|
const raw = draft[field.key];
|
|
918
|
-
return /* @__PURE__ */ (0,
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
919
2292
|
NumberField,
|
|
920
2293
|
{
|
|
921
2294
|
...base,
|
|
@@ -929,7 +2302,7 @@ function NamespaceCard(props) {
|
|
|
929
2302
|
if (field.kind === "select") {
|
|
930
2303
|
return renderSelectField(field, base);
|
|
931
2304
|
}
|
|
932
|
-
return /* @__PURE__ */ (0,
|
|
2305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
933
2306
|
TextField,
|
|
934
2307
|
{
|
|
935
2308
|
...base,
|
|
@@ -938,10 +2311,10 @@ function NamespaceCard(props) {
|
|
|
938
2311
|
}
|
|
939
2312
|
);
|
|
940
2313
|
}),
|
|
941
|
-
/* @__PURE__ */ (0,
|
|
942
|
-
failed ? /* @__PURE__ */ (0,
|
|
943
|
-
/* @__PURE__ */ (0,
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
2314
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.footer, children: [
|
|
2315
|
+
failed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.failed, role: "status", children: t("saveFailed") }) : null,
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
|
|
945
2318
|
] })
|
|
946
2319
|
] }) : null
|
|
947
2320
|
] });
|
|
@@ -1002,6 +2375,8 @@ var en = {
|
|
|
1002
2375
|
customPolicyHint: 'Used only when memory mode is "custom".',
|
|
1003
2376
|
charLimit: "Memory character limit",
|
|
1004
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.",
|
|
1005
2380
|
maxSearchResults: "Max search results",
|
|
1006
2381
|
maxSearchResultsHint: "Default cap for memory_search / memory_list results; 0 means no limit.",
|
|
1007
2382
|
decayDays: "Decay days",
|
|
@@ -1031,6 +2406,8 @@ var en = {
|
|
|
1031
2406
|
// Review extraction card (memory-review namespace).
|
|
1032
2407
|
reviewCardTitle: "Automatic Extraction",
|
|
1033
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.",
|
|
1034
2411
|
reviewEnabled: "Automatic review extraction",
|
|
1035
2412
|
reviewEnabledHint: "Extract durable facts from the conversation automatically.",
|
|
1036
2413
|
reviewThreshold: "Review candidate threshold",
|
|
@@ -1056,7 +2433,86 @@ var en = {
|
|
|
1056
2433
|
curatorMaxEntries: "Curator max entries",
|
|
1057
2434
|
curatorMaxEntriesHint: "Maximum entries selected per pass, longest first; minimum 1.",
|
|
1058
2435
|
curatorMinChars: "Curator minimum length",
|
|
1059
|
-
curatorMinCharsHint: "Only entries at least this long are selected for re-summarization."
|
|
2436
|
+
curatorMinCharsHint: "Only entries at least this long are selected for re-summarization.",
|
|
2437
|
+
// ── Memory content-management section (Settings → Memory, phase 1) ──
|
|
2438
|
+
nav: "Memory",
|
|
2439
|
+
sectionTitle: "Memory",
|
|
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",
|
|
2443
|
+
dashTotal: "Total memories",
|
|
2444
|
+
dashGlobal: "Global",
|
|
2445
|
+
dashUser: "User",
|
|
2446
|
+
dashProject: "Project",
|
|
2447
|
+
dashPinned: "Pinned",
|
|
2448
|
+
dashStale: "Dormant",
|
|
2449
|
+
dashStaleHint: "Soft-decayed entries: hidden from injection until recalled again. They stay searchable and editable here.",
|
|
2450
|
+
dashAudit: "Audit records",
|
|
2451
|
+
dashLastActivity: "Last activity",
|
|
2452
|
+
dashLastActivityNever: "never",
|
|
2453
|
+
dashLastExtraction: "Last extraction",
|
|
2454
|
+
scopeAll: "All",
|
|
2455
|
+
scopeGlobal: "Global",
|
|
2456
|
+
scopeUser: "User",
|
|
2457
|
+
scopeProject: "Project",
|
|
2458
|
+
workspaceLabel: "Workspace",
|
|
2459
|
+
workspaceAll: "All workspaces",
|
|
2460
|
+
searchLabel: "Search",
|
|
2461
|
+
searchPlaceholder: "Search memories\u2026",
|
|
2462
|
+
categoryLabel: "Category",
|
|
2463
|
+
catFailure: "Failure",
|
|
2464
|
+
catCorrection: "Correction",
|
|
2465
|
+
catInsight: "Insight",
|
|
2466
|
+
catPreference: "Preference",
|
|
2467
|
+
catConvention: "Convention",
|
|
2468
|
+
catToolQuirk: "Tool quirk",
|
|
2469
|
+
catProcedure: "Procedure",
|
|
2470
|
+
emptyGlobal: "No global memories yet. They are written by the memory tools and automatic extraction during sessions.",
|
|
2471
|
+
emptyUser: "No user memories yet. Teach me something about yourself in a session and it appears here.",
|
|
2472
|
+
emptyProject: "No memories for this workspace yet. Teach me in a session working in this repository and lessons land here.",
|
|
2473
|
+
emptyFiltered: "No memories match the current filters. Loosen the search or clear a chip.",
|
|
2474
|
+
emptyAll: "The memory store is empty. Memories are written by the memory tools and automatic extraction during sessions.",
|
|
2475
|
+
pinnedBadge: "Pinned",
|
|
2476
|
+
staleMark: "Dormant",
|
|
2477
|
+
staleHint: "Dormant \u2014 hidden from injection until recalled again; being recalled revives it.",
|
|
2478
|
+
metaCreated: "created",
|
|
2479
|
+
metaUpdated: "updated",
|
|
2480
|
+
metaRecalled: "recalled",
|
|
2481
|
+
shownCount: "Showing {shown} of {total}",
|
|
2482
|
+
loadMore: "Load more",
|
|
2483
|
+
loadFailed: "The memory store could not be reached.",
|
|
2484
|
+
retry: "Retry",
|
|
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)"
|
|
1060
2516
|
};
|
|
1061
2517
|
var zh = {
|
|
1062
2518
|
// Card chrome
|
|
@@ -1086,6 +2542,8 @@ var zh = {
|
|
|
1086
2542
|
customPolicyHint: '\u4EC5\u5728\u8BB0\u5FC6\u6A21\u5F0F\u4E3A "custom" \u65F6\u4F7F\u7528\u3002',
|
|
1087
2543
|
charLimit: "\u8BB0\u5FC6\u5B57\u7B26\u4E0A\u9650",
|
|
1088
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",
|
|
1089
2547
|
maxSearchResults: "\u6700\u5927\u641C\u7D22\u7ED3\u679C\u6570",
|
|
1090
2548
|
maxSearchResultsHint: "memory_search / memory_list \u7684\u9ED8\u8BA4\u6761\u6570\u4E0A\u9650\uFF1B0 \u8868\u793A\u4E0D\u9650\u3002",
|
|
1091
2549
|
decayDays: "\u8870\u51CF\u5929\u6570",
|
|
@@ -1115,6 +2573,8 @@ var zh = {
|
|
|
1115
2573
|
// 自动提取卡片(memory-review 命名空间)
|
|
1116
2574
|
reviewCardTitle: "\u81EA\u52A8\u63D0\u53D6",
|
|
1117
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",
|
|
1118
2578
|
reviewEnabled: "\u81EA\u52A8\u8BC4\u5BA1\u63D0\u53D6",
|
|
1119
2579
|
reviewEnabledHint: "\u81EA\u52A8\u4ECE\u5BF9\u8BDD\u4E2D\u63D0\u53D6\u53EF\u6301\u4E45\u7684\u4E8B\u5B9E\u3002",
|
|
1120
2580
|
reviewThreshold: "\u8BC4\u5BA1\u5019\u9009\u9608\u503C",
|
|
@@ -1140,7 +2600,86 @@ var zh = {
|
|
|
1140
2600
|
curatorMaxEntries: "\u5355\u6B21\u6574\u7406\u6761\u6570\u4E0A\u9650",
|
|
1141
2601
|
curatorMaxEntriesHint: "\u6BCF\u6B21\u6574\u7406\u6700\u591A\u9009\u4E2D\u7684\u6761\u76EE\u6570\uFF08\u6700\u957F\u4F18\u5148\uFF09\uFF0C\u6700\u5C0F\u4E3A 1\u3002",
|
|
1142
2602
|
curatorMinChars: "\u53C2\u4E0E\u6574\u7406\u6700\u5C0F\u957F\u5EA6",
|
|
1143
|
-
curatorMinCharsHint: "\u4EC5\u957F\u5EA6\u4E0D\u4F4E\u4E8E\u8BE5\u5B57\u7B26\u6570\u7684\u6761\u76EE\u4F1A\u88AB\u9009\u4E2D\u6539\u5199\u3002"
|
|
2603
|
+
curatorMinCharsHint: "\u4EC5\u957F\u5EA6\u4E0D\u4F4E\u4E8E\u8BE5\u5B57\u7B26\u6570\u7684\u6761\u76EE\u4F1A\u88AB\u9009\u4E2D\u6539\u5199\u3002",
|
|
2604
|
+
// ── 记忆内容管理 section(Settings → Memory,一期)──
|
|
2605
|
+
nav: "\u8BB0\u5FC6",
|
|
2606
|
+
sectionTitle: "\u8BB0\u5FC6",
|
|
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",
|
|
2610
|
+
dashTotal: "\u8BB0\u5FC6\u603B\u6570",
|
|
2611
|
+
dashGlobal: "\u5168\u5C40",
|
|
2612
|
+
dashUser: "\u7528\u6237",
|
|
2613
|
+
dashProject: "\u9879\u76EE",
|
|
2614
|
+
dashPinned: "\u7F6E\u9876",
|
|
2615
|
+
dashStale: "\u4F11\u7720",
|
|
2616
|
+
dashStaleHint: "\u8F6F\u8870\u51CF\u6761\u76EE\uFF1A\u5DF2\u4ECE\u6CE8\u5165\u9762\u9690\u85CF\uFF0C\u88AB\u53EC\u56DE\u540E\u81EA\u52A8\u590D\u6D3B\uFF1B\u6B64\u5904\u4ECD\u53EF\u641C\u7D22\u3002",
|
|
2617
|
+
dashAudit: "\u5BA1\u8BA1\u8BB0\u5F55",
|
|
2618
|
+
dashLastActivity: "\u6700\u8FD1\u6D3B\u52A8",
|
|
2619
|
+
dashLastActivityNever: "\u6682\u65E0",
|
|
2620
|
+
dashLastExtraction: "\u6700\u8FD1\u63D0\u53D6",
|
|
2621
|
+
scopeAll: "\u5168\u90E8",
|
|
2622
|
+
scopeGlobal: "\u5168\u5C40",
|
|
2623
|
+
scopeUser: "\u7528\u6237",
|
|
2624
|
+
scopeProject: "\u9879\u76EE",
|
|
2625
|
+
workspaceLabel: "\u5DE5\u4F5C\u533A",
|
|
2626
|
+
workspaceAll: "\u5168\u90E8\u5DE5\u4F5C\u533A",
|
|
2627
|
+
searchLabel: "\u641C\u7D22",
|
|
2628
|
+
searchPlaceholder: "\u641C\u7D22\u8BB0\u5FC6\u2026",
|
|
2629
|
+
categoryLabel: "\u7C7B\u522B",
|
|
2630
|
+
catFailure: "\u5931\u8D25",
|
|
2631
|
+
catCorrection: "\u7EA0\u6B63",
|
|
2632
|
+
catInsight: "\u6D1E\u5BDF",
|
|
2633
|
+
catPreference: "\u504F\u597D",
|
|
2634
|
+
catConvention: "\u7EA6\u5B9A",
|
|
2635
|
+
catToolQuirk: "\u5DE5\u5177\u602A\u7656",
|
|
2636
|
+
catProcedure: "\u6D41\u7A0B",
|
|
2637
|
+
emptyGlobal: "\u5C1A\u65E0 global \u8BB0\u5FC6\u3002\u5B83\u4EEC\u7531\u4F1A\u8BDD\u4E2D\u7684\u8BB0\u5FC6\u5DE5\u5177\u4E0E\u81EA\u52A8\u63D0\u53D6\u5199\u5165\u3002",
|
|
2638
|
+
emptyUser: "\u5C1A\u65E0 user \u8BB0\u5FC6\u3002\u5728\u4F1A\u8BDD\u91CC\u544A\u8BC9\u6211\u5173\u4E8E\u4F60\u7684\u504F\u597D\uFF0C\u5B83\u5C31\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",
|
|
2639
|
+
emptyProject: "\u8BE5\u5DE5\u4F5C\u533A\u5C1A\u65E0\u8BB0\u5FC6\u3002\u5728\u672C\u4ED3\u5E93\u7684\u4F1A\u8BDD\u91CC\u6559\u4F1A\u6211\uFF0C\u7ECF\u9A8C\u6559\u8BAD\u5C31\u4F1A\u6C89\u6DC0\u5230\u8FD9\u91CC\u3002",
|
|
2640
|
+
emptyFiltered: "\u6CA1\u6709\u7B26\u5408\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u7684\u8BB0\u5FC6\u3002\u653E\u5BBD\u641C\u7D22\u6216\u53D6\u6D88\u4E00\u4E2A\u7C7B\u522B\u7B5B\u9009\u8BD5\u8BD5\u3002",
|
|
2641
|
+
emptyAll: "\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u4F1A\u8BDD\u4E2D\u7684\u8BB0\u5FC6\u5DE5\u5177\u4E0E\u81EA\u52A8\u63D0\u53D6\u4F1A\u5199\u5165\u5185\u5BB9\u3002",
|
|
2642
|
+
pinnedBadge: "\u7F6E\u9876",
|
|
2643
|
+
staleMark: "\u4F11\u7720",
|
|
2644
|
+
staleHint: "\u4F11\u7720\u4E2D\u2014\u2014\u5DF2\u4ECE\u6CE8\u5165\u9762\u9690\u85CF\uFF1B\u518D\u6B21\u88AB\u53EC\u56DE\u5373\u81EA\u52A8\u590D\u6D3B\u3002",
|
|
2645
|
+
metaCreated: "\u521B\u5EFA\u4E8E",
|
|
2646
|
+
metaUpdated: "\u66F4\u65B0\u4E8E",
|
|
2647
|
+
metaRecalled: "\u53EC\u56DE\u4E8E",
|
|
2648
|
+
shownCount: "\u5DF2\u663E\u793A {shown} / \u5171 {total} \u6761",
|
|
2649
|
+
loadMore: "\u52A0\u8F7D\u66F4\u591A",
|
|
2650
|
+
loadFailed: "\u65E0\u6CD5\u8FDE\u63A5\u8BB0\u5FC6\u5B58\u50A8\u3002",
|
|
2651
|
+
retry: "\u91CD\u8BD5",
|
|
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"
|
|
1144
2683
|
};
|
|
1145
2684
|
|
|
1146
2685
|
// src/client/index.ts
|
|
@@ -1188,20 +2727,65 @@ var REVIEW_SPEC = {
|
|
|
1188
2727
|
{ key: "extractionBudget", kind: "number" },
|
|
1189
2728
|
{ key: "judgeEnabled", kind: "checkbox" },
|
|
1190
2729
|
{ key: "pitfallStreakThreshold", kind: "number", minValue: 1 },
|
|
2730
|
+
{
|
|
2731
|
+
key: "confirmBeforeWrite",
|
|
2732
|
+
kind: "checkbox",
|
|
2733
|
+
labelKey: "confirmBeforeWrite",
|
|
2734
|
+
hintKey: "confirmBeforeWriteHint"
|
|
2735
|
+
},
|
|
1191
2736
|
{ key: "curatorEnabled", kind: "checkbox" },
|
|
1192
2737
|
{ key: "curatorEveryNSessions", kind: "number", minValue: 1 },
|
|
1193
2738
|
{ key: "curatorMaxEntries", kind: "number", minValue: 1 },
|
|
1194
2739
|
{ key: "curatorMinChars", kind: "number", minValue: 1 }
|
|
1195
2740
|
]
|
|
1196
2741
|
};
|
|
1197
|
-
var
|
|
2742
|
+
var inject3 = ["slots", "locale", "connection", "settingsScope"];
|
|
1198
2743
|
var NS = "settings.memory";
|
|
2744
|
+
var SECTION_ORDER = 25;
|
|
1199
2745
|
var CARDS = [
|
|
1200
2746
|
{ key: "memory" },
|
|
1201
2747
|
{ key: "memory-notes", namespace: "memory", spec: NOTES_SPEC },
|
|
1202
2748
|
{ key: "memory-autorecall", namespace: "memory", spec: AUTORECALL_SPEC },
|
|
1203
2749
|
{ key: "memory-review", spec: REVIEW_SPEC }
|
|
1204
2750
|
];
|
|
2751
|
+
function createMemoryRemoteApi(connection) {
|
|
2752
|
+
const call = connection?.rpc?.call;
|
|
2753
|
+
if (typeof call !== "function") return void 0;
|
|
2754
|
+
const invoke = async (method, request) => {
|
|
2755
|
+
try {
|
|
2756
|
+
const response = await call("/api", `memoryRemote/${method}`, {
|
|
2757
|
+
args: request === void 0 ? {} : { request }
|
|
2758
|
+
});
|
|
2759
|
+
if (response.ok) return { result: { ok: true, value: response.value } };
|
|
2760
|
+
return {
|
|
2761
|
+
result: {
|
|
2762
|
+
ok: false,
|
|
2763
|
+
error: { message: response.error?.message ?? `memoryRemote/${method} failed` }
|
|
2764
|
+
}
|
|
2765
|
+
};
|
|
2766
|
+
} catch (error) {
|
|
2767
|
+
return {
|
|
2768
|
+
result: {
|
|
2769
|
+
ok: false,
|
|
2770
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2775
|
+
return {
|
|
2776
|
+
list: (request) => invoke("list", request),
|
|
2777
|
+
search: (request) => invoke("search", request),
|
|
2778
|
+
projects: () => invoke("projects"),
|
|
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)
|
|
2787
|
+
};
|
|
2788
|
+
}
|
|
1205
2789
|
function createCatalogLoader(connection) {
|
|
1206
2790
|
const llm = connection?.api?.llm;
|
|
1207
2791
|
if (llm === void 0 || typeof llm.models !== "function") return void 0;
|
|
@@ -1212,14 +2796,21 @@ function createCatalogLoader(connection) {
|
|
|
1212
2796
|
}
|
|
1213
2797
|
function apply(ctx) {
|
|
1214
2798
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-memory: locale dictionaries");
|
|
1215
|
-
const
|
|
2799
|
+
const connection = ctx.get("connection");
|
|
2800
|
+
const loadCatalog = createCatalogLoader(connection);
|
|
2801
|
+
const controller = new MemorySectionController(createMemoryRemoteApi(connection));
|
|
2802
|
+
ctx.effect(() => {
|
|
2803
|
+
return ctx.on("connection/reset", () => {
|
|
2804
|
+
void controller.load();
|
|
2805
|
+
});
|
|
2806
|
+
}, "dsh-memory: memory section reload on reconnect");
|
|
1216
2807
|
ctx.slots.inject("settings.plugin.item", function* () {
|
|
1217
2808
|
for (const card of CARDS) {
|
|
1218
2809
|
const ns = card.namespace ?? card.key;
|
|
1219
2810
|
const scope = ctx.settingsScope.bind({ namespace: ns });
|
|
1220
2811
|
if (card.spec === void 0) {
|
|
1221
2812
|
const typed = scope;
|
|
1222
|
-
const
|
|
2813
|
+
const injected3 = () => ({
|
|
1223
2814
|
hooks: { memory: typed },
|
|
1224
2815
|
set: (field, value) => typed.set(field, value),
|
|
1225
2816
|
unset: (field) => typed.unset(field)
|
|
@@ -1228,13 +2819,13 @@ function apply(ctx) {
|
|
|
1228
2819
|
name: "settings.plugin.item",
|
|
1229
2820
|
key: card.key,
|
|
1230
2821
|
locale: NS,
|
|
1231
|
-
inject:
|
|
2822
|
+
inject: injected3
|
|
1232
2823
|
}, MemoryPluginCard);
|
|
1233
2824
|
} else {
|
|
1234
2825
|
const spec = card.spec;
|
|
1235
2826
|
const typed = scope;
|
|
1236
2827
|
const withCatalog = loadCatalog !== void 0 && spec.fields.some((f) => f.kind === "select");
|
|
1237
|
-
const
|
|
2828
|
+
const injected3 = () => ({
|
|
1238
2829
|
hooks: { ns: typed },
|
|
1239
2830
|
set: (field, value) => typed.set(field, value),
|
|
1240
2831
|
unset: (field) => typed.unset(field),
|
|
@@ -1244,11 +2835,44 @@ function apply(ctx) {
|
|
|
1244
2835
|
name: "settings.plugin.item",
|
|
1245
2836
|
key: card.key,
|
|
1246
2837
|
locale: NS,
|
|
1247
|
-
inject:
|
|
2838
|
+
inject: injected3
|
|
1248
2839
|
}, namespaceCard(spec));
|
|
1249
2840
|
}
|
|
1250
2841
|
}
|
|
1251
2842
|
});
|
|
2843
|
+
const sectionInjected = () => ({
|
|
2844
|
+
hooks: { memorySection: controller.store },
|
|
2845
|
+
load: () => controller.load(),
|
|
2846
|
+
setScope: (scope) => {
|
|
2847
|
+
controller.setScope(scope);
|
|
2848
|
+
},
|
|
2849
|
+
setProject: (name) => {
|
|
2850
|
+
controller.setProject(name);
|
|
2851
|
+
},
|
|
2852
|
+
commitQuery: (query) => {
|
|
2853
|
+
controller.commitQuery(query);
|
|
2854
|
+
},
|
|
2855
|
+
toggleCategory: (category) => {
|
|
2856
|
+
controller.toggleCategory(category);
|
|
2857
|
+
},
|
|
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)
|
|
2867
|
+
});
|
|
2868
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
2869
|
+
name: "settings.section",
|
|
2870
|
+
id: "memory",
|
|
2871
|
+
order: SECTION_ORDER,
|
|
2872
|
+
label: () => ctx.locale.bind(NS)("nav"),
|
|
2873
|
+
locale: NS,
|
|
2874
|
+
inject: sectionInjected
|
|
2875
|
+
}, MemorySection));
|
|
1252
2876
|
}
|
|
1253
2877
|
|
|
1254
2878
|
|