@chenhw7/dsh-memory 0.3.0 → 0.4.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 +5 -4
- package/README.zh-CN.md +5 -4
- package/lib/client/index.js +1006 -41
- package/lib/remote/index.d.ts +31 -4
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +44 -7
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +7 -2
- package/lib/remote/typert.remote-client.js +8 -2
- package/package.json +10 -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
|
|
|
@@ -722,13 +722,814 @@ function MemoryPluginCard(props) {
|
|
|
722
722
|
] });
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
-
// src/client/
|
|
725
|
+
// src/client/MemorySection.tsx
|
|
726
726
|
var import_react2 = require("react");
|
|
727
|
-
|
|
727
|
+
|
|
728
|
+
// src/client/memory-section-store.ts
|
|
729
|
+
var import_client = require("@deepseek-ai/dsh-client-runtime/client");
|
|
730
|
+
var MEMORY_PAGE_SIZE = 100;
|
|
731
|
+
var MEMORY_CATEGORIES = [
|
|
732
|
+
"failure",
|
|
733
|
+
"correction",
|
|
734
|
+
"insight",
|
|
735
|
+
"preference",
|
|
736
|
+
"convention",
|
|
737
|
+
"tool-quirk",
|
|
738
|
+
"procedure"
|
|
739
|
+
];
|
|
740
|
+
var CATEGORY_LABEL_KEYS = {
|
|
741
|
+
failure: "catFailure",
|
|
742
|
+
correction: "catCorrection",
|
|
743
|
+
insight: "catInsight",
|
|
744
|
+
preference: "catPreference",
|
|
745
|
+
convention: "catConvention",
|
|
746
|
+
"tool-quirk": "catToolQuirk",
|
|
747
|
+
procedure: "catProcedure"
|
|
748
|
+
};
|
|
749
|
+
var INITIAL = {
|
|
750
|
+
status: "idle",
|
|
751
|
+
error: null,
|
|
752
|
+
health: null,
|
|
753
|
+
projects: [],
|
|
754
|
+
entries: [],
|
|
755
|
+
total: 0,
|
|
756
|
+
scope: "all",
|
|
757
|
+
projectName: null,
|
|
758
|
+
query: "",
|
|
759
|
+
categories: [],
|
|
760
|
+
page: 0
|
|
761
|
+
};
|
|
762
|
+
function projectSelectable(scope) {
|
|
763
|
+
return scope === "all" || scope === "project";
|
|
764
|
+
}
|
|
765
|
+
var MemorySectionController = class {
|
|
766
|
+
/**
|
|
767
|
+
* @param api - the mounted `memoryRemote` namespace face; undefined on a
|
|
768
|
+
* deployment too old to serve it — loads then fail into the page's error
|
|
769
|
+
* state instead of breaking the settings panel.
|
|
770
|
+
*/
|
|
771
|
+
constructor(api) {
|
|
772
|
+
this.api = api;
|
|
773
|
+
}
|
|
774
|
+
api;
|
|
775
|
+
/** Page snapshot the renderer subscribes to. */
|
|
776
|
+
store = (0, import_client.createSnapshotStore)(INITIAL);
|
|
777
|
+
/** Guards against overlapping loads painting partial results. */
|
|
778
|
+
seq = 0;
|
|
779
|
+
set(patch) {
|
|
780
|
+
this.store.set({ ...this.store.getSnapshot(), ...patch });
|
|
781
|
+
}
|
|
782
|
+
/** Wire scope for the current filter, or undefined for "all". */
|
|
783
|
+
wireScope() {
|
|
784
|
+
const { scope } = this.store.getSnapshot();
|
|
785
|
+
return scope === "all" ? void 0 : scope;
|
|
786
|
+
}
|
|
787
|
+
requireApi() {
|
|
788
|
+
if (this.api === void 0) throw new Error("the memory remote namespace is not mounted on this connection");
|
|
789
|
+
return this.api;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Fetch one page of entries under the committed filters. Plain browsing
|
|
793
|
+
* pages remotely; an active query or chip set pulls the whole match set
|
|
794
|
+
* once (search has no offset on the wire) and pages locally.
|
|
795
|
+
*/
|
|
796
|
+
async fetchPage() {
|
|
797
|
+
const snapshot = this.store.getSnapshot();
|
|
798
|
+
const offset = snapshot.page * MEMORY_PAGE_SIZE;
|
|
799
|
+
const trimmed = snapshot.query.trim();
|
|
800
|
+
if (trimmed !== "" || snapshot.categories.length > 0) {
|
|
801
|
+
const response2 = await this.requireApi().search({
|
|
802
|
+
...this.wireScope() !== void 0 ? { scope: this.wireScope() } : {},
|
|
803
|
+
...snapshot.projectName !== null && snapshot.projectName !== "" ? { projectName: snapshot.projectName } : {},
|
|
804
|
+
...trimmed !== "" ? { query: trimmed } : {},
|
|
805
|
+
limit: 0
|
|
806
|
+
});
|
|
807
|
+
if (!response2.result.ok) throw new Error(response2.result.error.message);
|
|
808
|
+
const selected = snapshot.categories;
|
|
809
|
+
const matches = selected.length === 0 ? [...response2.result.value.entries] : response2.result.value.entries.filter(
|
|
810
|
+
(entry) => entry.category !== void 0 && selected.includes(entry.category)
|
|
811
|
+
);
|
|
812
|
+
return {
|
|
813
|
+
entries: matches.slice(offset, offset + MEMORY_PAGE_SIZE),
|
|
814
|
+
total: matches.length
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
const response = await this.requireApi().list({
|
|
818
|
+
...this.wireScope() !== void 0 ? { scope: this.wireScope() } : {},
|
|
819
|
+
...snapshot.projectName !== null && snapshot.projectName !== "" ? { projectName: snapshot.projectName } : {},
|
|
820
|
+
limit: MEMORY_PAGE_SIZE,
|
|
821
|
+
offset
|
|
822
|
+
});
|
|
823
|
+
if (!response.result.ok) throw new Error(response.result.error.message);
|
|
824
|
+
return { entries: response.result.value.entries, total: response.result.value.total };
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Full load: health dashboard, workspace roster, and current page. Used on
|
|
828
|
+
* section open, manual retry, and connection recovery.
|
|
829
|
+
* @returns once the snapshot reflects the host.
|
|
830
|
+
*/
|
|
831
|
+
async load() {
|
|
832
|
+
const ticket = ++this.seq;
|
|
833
|
+
if (this.store.getSnapshot().status === "idle") this.set({ status: "loading" });
|
|
834
|
+
try {
|
|
835
|
+
const api = this.requireApi();
|
|
836
|
+
const [health, projects, page] = await Promise.all([
|
|
837
|
+
api.health(),
|
|
838
|
+
api.projects(),
|
|
839
|
+
this.fetchPage()
|
|
840
|
+
]);
|
|
841
|
+
if (!health.result.ok) throw new Error(health.result.error.message);
|
|
842
|
+
if (!projects.result.ok) throw new Error(projects.result.error.message);
|
|
843
|
+
if (ticket !== this.seq) return;
|
|
844
|
+
this.set({
|
|
845
|
+
status: "ready",
|
|
846
|
+
error: null,
|
|
847
|
+
health: health.result.value,
|
|
848
|
+
projects: projects.result.value.projects,
|
|
849
|
+
entries: page.entries,
|
|
850
|
+
total: page.total
|
|
851
|
+
});
|
|
852
|
+
} catch (error) {
|
|
853
|
+
if (ticket !== this.seq) return;
|
|
854
|
+
this.set({ status: "error", error: messageOf(error) });
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Re-fetch just the entry page (filters changed). Keeps the dashboard and
|
|
859
|
+
* status untouched; a failure surfaces as page-level error text while the
|
|
860
|
+
* previous rows stay visible.
|
|
861
|
+
*/
|
|
862
|
+
async reload() {
|
|
863
|
+
const ticket = ++this.seq;
|
|
864
|
+
try {
|
|
865
|
+
const page = await this.fetchPage();
|
|
866
|
+
if (ticket !== this.seq) return;
|
|
867
|
+
this.set({ status: "ready", error: null, entries: page.entries, total: page.total });
|
|
868
|
+
} catch (error) {
|
|
869
|
+
if (ticket !== this.seq) return;
|
|
870
|
+
this.set({ error: messageOf(error) });
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
/** Switch the scope filter; the workspace pick cannot outlive its scope. */
|
|
874
|
+
setScope(scope) {
|
|
875
|
+
if (this.store.getSnapshot().scope === scope) return;
|
|
876
|
+
this.set({ scope, projectName: null, page: 0 });
|
|
877
|
+
void this.reload();
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Pick one workspace (or null/'' for all). Only honored where it means
|
|
881
|
+
* something — see {@link projectSelectable}.
|
|
882
|
+
*/
|
|
883
|
+
setProject(projectName) {
|
|
884
|
+
if (!projectSelectable(this.store.getSnapshot().scope)) return;
|
|
885
|
+
const next = projectName === "" ? null : projectName;
|
|
886
|
+
if (this.store.getSnapshot().projectName === next) return;
|
|
887
|
+
this.set({ projectName: next, page: 0 });
|
|
888
|
+
void this.reload();
|
|
889
|
+
}
|
|
890
|
+
/** Commit a search text (already debounced upstream); empty clears it. */
|
|
891
|
+
commitQuery(query) {
|
|
892
|
+
if (this.store.getSnapshot().query === query) return;
|
|
893
|
+
this.set({ query, page: 0 });
|
|
894
|
+
void this.reload();
|
|
895
|
+
}
|
|
896
|
+
/** Flip one category chip. */
|
|
897
|
+
toggleCategory(category) {
|
|
898
|
+
const selected = this.store.getSnapshot().categories;
|
|
899
|
+
const next = selected.includes(category) ? selected.filter((c) => c !== category) : [...selected, category];
|
|
900
|
+
this.set({ categories: next, page: 0 });
|
|
901
|
+
void this.reload();
|
|
902
|
+
}
|
|
903
|
+
/** Jump to a zero-based page within range. */
|
|
904
|
+
setPage(page) {
|
|
905
|
+
const total = this.store.getSnapshot().total;
|
|
906
|
+
const maxPage = Math.max(0, Math.ceil(total / MEMORY_PAGE_SIZE) - 1);
|
|
907
|
+
const clamped = Math.min(Math.max(0, Math.floor(page)), maxPage);
|
|
908
|
+
if (this.store.getSnapshot().page === clamped) return;
|
|
909
|
+
this.set({ page: clamped });
|
|
910
|
+
void this.reload();
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
function messageOf(error) {
|
|
914
|
+
return error instanceof Error ? error.message : String(error);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// src/client/section-styles.ts
|
|
918
|
+
var RULES2 = `
|
|
919
|
+
.dsm-s-section {
|
|
920
|
+
display: flex;
|
|
921
|
+
flex-direction: column;
|
|
922
|
+
gap: 16px;
|
|
923
|
+
}
|
|
924
|
+
.dsm-s-title {
|
|
925
|
+
margin: 0;
|
|
926
|
+
font-size: 15px;
|
|
927
|
+
font-weight: 600;
|
|
928
|
+
line-height: 1.4;
|
|
929
|
+
color: var(--dsw-alias-label-primary);
|
|
930
|
+
}
|
|
931
|
+
.dsm-s-intro {
|
|
932
|
+
margin: 0;
|
|
933
|
+
font-size: 13px;
|
|
934
|
+
line-height: 1.5;
|
|
935
|
+
color: var(--dsw-alias-label-tertiary);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/* \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 */
|
|
939
|
+
.dsm-s-dash {
|
|
940
|
+
display: flex;
|
|
941
|
+
flex-wrap: wrap;
|
|
942
|
+
align-items: stretch;
|
|
943
|
+
gap: 8px;
|
|
944
|
+
}
|
|
945
|
+
.dsm-s-stat {
|
|
946
|
+
display: flex;
|
|
947
|
+
flex-direction: column;
|
|
948
|
+
justify-content: center;
|
|
949
|
+
gap: 2px;
|
|
950
|
+
min-width: 88px;
|
|
951
|
+
padding: 10px 14px;
|
|
952
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
953
|
+
border-radius: 12px;
|
|
954
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
955
|
+
}
|
|
956
|
+
.dsm-s-stat-value {
|
|
957
|
+
font-size: 18px;
|
|
958
|
+
font-weight: 600;
|
|
959
|
+
line-height: 1.3;
|
|
960
|
+
color: var(--dsw-alias-label-primary);
|
|
961
|
+
}
|
|
962
|
+
.dsm-s-stat-value-muted {
|
|
963
|
+
color: var(--dsw-alias-label-secondary);
|
|
964
|
+
}
|
|
965
|
+
.dsm-s-stat-label {
|
|
966
|
+
font-size: 12px;
|
|
967
|
+
line-height: 1.5;
|
|
968
|
+
color: var(--dsw-alias-label-tertiary);
|
|
969
|
+
}
|
|
970
|
+
.dsm-s-stat-stale {
|
|
971
|
+
cursor: help;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/* \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 */
|
|
975
|
+
.dsm-s-toolbar {
|
|
976
|
+
display: flex;
|
|
977
|
+
flex-direction: column;
|
|
978
|
+
gap: 10px;
|
|
979
|
+
}
|
|
980
|
+
.dsm-s-toolbar-row {
|
|
981
|
+
display: flex;
|
|
982
|
+
flex-wrap: wrap;
|
|
983
|
+
align-items: center;
|
|
984
|
+
gap: 8px;
|
|
985
|
+
}
|
|
986
|
+
.dsm-s-toolbar-label {
|
|
987
|
+
font-size: 12px;
|
|
988
|
+
font-weight: 500;
|
|
989
|
+
line-height: 1.5;
|
|
990
|
+
color: var(--dsw-alias-label-tertiary);
|
|
991
|
+
}
|
|
992
|
+
/* Segmented scope switch. */
|
|
993
|
+
.dsm-s-seg {
|
|
994
|
+
display: inline-flex;
|
|
995
|
+
padding: 2px;
|
|
996
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
997
|
+
border-radius: 8px;
|
|
998
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
999
|
+
}
|
|
1000
|
+
.dsm-s-seg-btn {
|
|
1001
|
+
appearance: none;
|
|
1002
|
+
border: 0;
|
|
1003
|
+
background: none;
|
|
1004
|
+
padding: 4px 12px;
|
|
1005
|
+
border-radius: 6px;
|
|
1006
|
+
font: inherit;
|
|
1007
|
+
font-size: 13px;
|
|
1008
|
+
line-height: 1.5;
|
|
1009
|
+
color: var(--dsw-alias-label-secondary);
|
|
1010
|
+
cursor: pointer;
|
|
1011
|
+
}
|
|
1012
|
+
.dsm-s-seg-btn:hover:not([aria-pressed="true"]) {
|
|
1013
|
+
color: var(--dsw-alias-label-primary);
|
|
1014
|
+
}
|
|
1015
|
+
.dsm-s-seg-btn[aria-pressed="true"] {
|
|
1016
|
+
background: var(--dsw-alias-brand-primary);
|
|
1017
|
+
color: var(--dsw-alias-bg-layer-3);
|
|
1018
|
+
cursor: default;
|
|
1019
|
+
}
|
|
1020
|
+
.dsm-s-seg-btn:focus-visible {
|
|
1021
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
1022
|
+
outline-offset: -2px;
|
|
1023
|
+
}
|
|
1024
|
+
/* Search box mirrors the shared .input control look. */
|
|
1025
|
+
.dsm-s-input {
|
|
1026
|
+
flex: 1;
|
|
1027
|
+
min-width: 200px;
|
|
1028
|
+
max-width: 360px;
|
|
1029
|
+
height: 34px;
|
|
1030
|
+
padding: 0 12px;
|
|
1031
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1032
|
+
border-radius: 8px;
|
|
1033
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1034
|
+
font: inherit;
|
|
1035
|
+
font-size: 13px;
|
|
1036
|
+
line-height: 1.5;
|
|
1037
|
+
color: var(--dsw-alias-label-primary);
|
|
1038
|
+
}
|
|
1039
|
+
.dsm-s-input:focus-visible {
|
|
1040
|
+
outline: none;
|
|
1041
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
1042
|
+
}
|
|
1043
|
+
/* Workspace selector mirrors the shared .select control look. */
|
|
1044
|
+
.dsm-s-select {
|
|
1045
|
+
max-width: 260px;
|
|
1046
|
+
height: 34px;
|
|
1047
|
+
padding: 0 28px 0 12px;
|
|
1048
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1049
|
+
border-radius: 8px;
|
|
1050
|
+
background-color: var(--dsw-alias-bg-layer-3);
|
|
1051
|
+
font: inherit;
|
|
1052
|
+
font-size: 13px;
|
|
1053
|
+
line-height: 1.5;
|
|
1054
|
+
color: var(--dsw-alias-label-primary);
|
|
1055
|
+
cursor: pointer;
|
|
1056
|
+
appearance: none;
|
|
1057
|
+
-webkit-appearance: none;
|
|
1058
|
+
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");
|
|
1059
|
+
background-repeat: no-repeat;
|
|
1060
|
+
background-position: right 10px center;
|
|
1061
|
+
}
|
|
1062
|
+
.dsm-s-select:focus-visible {
|
|
1063
|
+
outline: none;
|
|
1064
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
1065
|
+
}
|
|
1066
|
+
.dsm-s-select:disabled {
|
|
1067
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1068
|
+
cursor: default;
|
|
1069
|
+
}
|
|
1070
|
+
/* Category chips. */
|
|
1071
|
+
.dsm-s-chip {
|
|
1072
|
+
appearance: none;
|
|
1073
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1074
|
+
border-radius: 999px;
|
|
1075
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1076
|
+
padding: 3px 12px;
|
|
1077
|
+
font: inherit;
|
|
1078
|
+
font-size: 12px;
|
|
1079
|
+
line-height: 1.5;
|
|
1080
|
+
color: var(--dsw-alias-label-secondary);
|
|
1081
|
+
cursor: pointer;
|
|
1082
|
+
}
|
|
1083
|
+
.dsm-s-chip:hover {
|
|
1084
|
+
color: var(--dsw-alias-label-primary);
|
|
1085
|
+
border-color: var(--dsw-alias-label-dimmed);
|
|
1086
|
+
}
|
|
1087
|
+
.dsm-s-chip[aria-pressed="true"] {
|
|
1088
|
+
background: var(--dsw-alias-bg-module-platform);
|
|
1089
|
+
border-color: var(--dsw-alias-brand-primary);
|
|
1090
|
+
color: var(--dsw-alias-label-primary);
|
|
1091
|
+
}
|
|
1092
|
+
.dsm-s-chip:focus-visible {
|
|
1093
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
1094
|
+
outline-offset: 1px;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/* \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 */
|
|
1098
|
+
.dsm-s-list {
|
|
1099
|
+
list-style: none;
|
|
1100
|
+
margin: 0;
|
|
1101
|
+
padding: 0;
|
|
1102
|
+
display: flex;
|
|
1103
|
+
flex-direction: column;
|
|
1104
|
+
gap: 8px;
|
|
1105
|
+
}
|
|
1106
|
+
.dsm-s-row {
|
|
1107
|
+
display: flex;
|
|
1108
|
+
flex-direction: column;
|
|
1109
|
+
gap: 6px;
|
|
1110
|
+
padding: 12px 14px;
|
|
1111
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1112
|
+
border-radius: 12px;
|
|
1113
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1114
|
+
}
|
|
1115
|
+
.dsm-s-row-stale {
|
|
1116
|
+
opacity: 0.62;
|
|
1117
|
+
}
|
|
1118
|
+
.dsm-s-badges {
|
|
1119
|
+
display: inline-flex;
|
|
1120
|
+
align-items: center;
|
|
1121
|
+
flex-wrap: wrap;
|
|
1122
|
+
gap: 6px;
|
|
1123
|
+
}
|
|
1124
|
+
.dsm-s-badge {
|
|
1125
|
+
border-radius: 999px;
|
|
1126
|
+
padding: 1px 8px;
|
|
1127
|
+
font-size: 11px;
|
|
1128
|
+
line-height: 17px;
|
|
1129
|
+
white-space: nowrap;
|
|
1130
|
+
font-weight: 500;
|
|
1131
|
+
background: var(--dsw-alias-bg-module-platform);
|
|
1132
|
+
color: var(--dsw-alias-label-secondary);
|
|
1133
|
+
}
|
|
1134
|
+
.dsm-s-badge-pinned,
|
|
1135
|
+
.dsm-s-badge-stale {
|
|
1136
|
+
background: none;
|
|
1137
|
+
padding-left: 0;
|
|
1138
|
+
}
|
|
1139
|
+
.dsm-s-project {
|
|
1140
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
1141
|
+
font-size: 11px;
|
|
1142
|
+
line-height: 17px;
|
|
1143
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1144
|
+
}
|
|
1145
|
+
.dsm-s-content {
|
|
1146
|
+
margin: 0;
|
|
1147
|
+
font-size: 13px;
|
|
1148
|
+
line-height: 1.55;
|
|
1149
|
+
color: var(--dsw-alias-label-primary);
|
|
1150
|
+
white-space: pre-wrap;
|
|
1151
|
+
word-break: break-word;
|
|
1152
|
+
cursor: pointer;
|
|
1153
|
+
display: -webkit-box;
|
|
1154
|
+
-webkit-box-orient: vertical;
|
|
1155
|
+
-webkit-line-clamp: 2;
|
|
1156
|
+
overflow: hidden;
|
|
1157
|
+
}
|
|
1158
|
+
.dsm-s-content-open {
|
|
1159
|
+
display: block;
|
|
1160
|
+
-webkit-line-clamp: none;
|
|
1161
|
+
overflow: visible;
|
|
1162
|
+
cursor: text;
|
|
1163
|
+
}
|
|
1164
|
+
.dsm-s-meta {
|
|
1165
|
+
display: flex;
|
|
1166
|
+
flex-wrap: wrap;
|
|
1167
|
+
gap: 4px 14px;
|
|
1168
|
+
margin: 0;
|
|
1169
|
+
font-size: 11px;
|
|
1170
|
+
line-height: 1.5;
|
|
1171
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/* \u2500\u2500 Pager / empty / error \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1175
|
+
.dsm-s-pager {
|
|
1176
|
+
display: flex;
|
|
1177
|
+
align-items: center;
|
|
1178
|
+
justify-content: flex-end;
|
|
1179
|
+
gap: 10px;
|
|
1180
|
+
}
|
|
1181
|
+
.dsm-s-pager-info {
|
|
1182
|
+
margin: 0;
|
|
1183
|
+
font-size: 12px;
|
|
1184
|
+
line-height: 1.5;
|
|
1185
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1186
|
+
}
|
|
1187
|
+
.dsm-s-page-btn {
|
|
1188
|
+
appearance: none;
|
|
1189
|
+
border: 1px solid var(--dsw-alias-border-l2);
|
|
1190
|
+
border-radius: 8px;
|
|
1191
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
1192
|
+
padding: 4px 12px;
|
|
1193
|
+
font: inherit;
|
|
1194
|
+
font-size: 13px;
|
|
1195
|
+
line-height: 1.5;
|
|
1196
|
+
color: var(--dsw-alias-label-secondary);
|
|
1197
|
+
cursor: pointer;
|
|
1198
|
+
}
|
|
1199
|
+
.dsm-s-page-btn:hover:not(:disabled) {
|
|
1200
|
+
color: var(--dsw-alias-label-primary);
|
|
1201
|
+
border-color: var(--dsw-alias-label-dimmed);
|
|
1202
|
+
}
|
|
1203
|
+
.dsm-s-page-btn:disabled {
|
|
1204
|
+
opacity: 0.4;
|
|
1205
|
+
cursor: default;
|
|
1206
|
+
}
|
|
1207
|
+
.dsm-s-empty {
|
|
1208
|
+
margin: 24px 0;
|
|
1209
|
+
text-align: center;
|
|
1210
|
+
font-size: 13px;
|
|
1211
|
+
line-height: 1.6;
|
|
1212
|
+
color: var(--dsw-alias-label-tertiary);
|
|
1213
|
+
}
|
|
1214
|
+
.dsm-s-error {
|
|
1215
|
+
margin: 0;
|
|
1216
|
+
font-size: 12px;
|
|
1217
|
+
line-height: 1.5;
|
|
1218
|
+
color: var(--dsw-alias-label-error);
|
|
1219
|
+
}
|
|
1220
|
+
`;
|
|
1221
|
+
var cls2 = {
|
|
1222
|
+
section: "dsm-s-section",
|
|
1223
|
+
title: "dsm-s-title",
|
|
1224
|
+
intro: "dsm-s-intro",
|
|
1225
|
+
dash: "dsm-s-dash",
|
|
1226
|
+
stat: "dsm-s-stat",
|
|
1227
|
+
statValue: "dsm-s-stat-value",
|
|
1228
|
+
statValueMuted: "dsm-s-stat-value-muted",
|
|
1229
|
+
statLabel: "dsm-s-stat-label",
|
|
1230
|
+
statStale: "dsm-s-stat-stale",
|
|
1231
|
+
toolbar: "dsm-s-toolbar",
|
|
1232
|
+
toolbarRow: "dsm-s-toolbar-row",
|
|
1233
|
+
toolbarLabel: "dsm-s-toolbar-label",
|
|
1234
|
+
seg: "dsm-s-seg",
|
|
1235
|
+
segBtn: "dsm-s-seg-btn",
|
|
1236
|
+
input: "dsm-s-input",
|
|
1237
|
+
select: "dsm-s-select",
|
|
1238
|
+
chip: "dsm-s-chip",
|
|
1239
|
+
list: "dsm-s-list",
|
|
1240
|
+
row: "dsm-s-row",
|
|
1241
|
+
rowStale: "dsm-s-row-stale",
|
|
1242
|
+
badges: "dsm-s-badges",
|
|
1243
|
+
badge: "dsm-s-badge",
|
|
1244
|
+
badgePinned: "dsm-s-badge-pinned",
|
|
1245
|
+
badgeStale: "dsm-s-badge-stale",
|
|
1246
|
+
project: "dsm-s-project",
|
|
1247
|
+
content: "dsm-s-content",
|
|
1248
|
+
contentOpen: "dsm-s-content-open",
|
|
1249
|
+
meta: "dsm-s-meta",
|
|
1250
|
+
pager: "dsm-s-pager",
|
|
1251
|
+
pagerInfo: "dsm-s-pager-info",
|
|
1252
|
+
pageBtn: "dsm-s-page-btn",
|
|
1253
|
+
empty: "dsm-s-empty",
|
|
1254
|
+
error: "dsm-s-error"
|
|
1255
|
+
};
|
|
1256
|
+
var injected2 = false;
|
|
1257
|
+
function inject2() {
|
|
1258
|
+
if (injected2 || typeof document === "undefined") return;
|
|
1259
|
+
const style = document.createElement("style");
|
|
1260
|
+
style.setAttribute("data-dsh-memory", "section");
|
|
1261
|
+
style.textContent = RULES2;
|
|
1262
|
+
document.head.appendChild(style);
|
|
1263
|
+
injected2 = true;
|
|
1264
|
+
}
|
|
1265
|
+
var css2 = (inject2(), cls2);
|
|
1266
|
+
|
|
1267
|
+
// src/client/MemorySection.tsx
|
|
728
1268
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1269
|
+
var SCOPES = [
|
|
1270
|
+
{ value: "all", labelKey: "scopeAll" },
|
|
1271
|
+
{ value: "global", labelKey: "scopeGlobal" },
|
|
1272
|
+
{ value: "project", labelKey: "scopeProject" },
|
|
1273
|
+
{ value: "user", labelKey: "scopeUser" }
|
|
1274
|
+
];
|
|
1275
|
+
function formatTs(ts, fallback) {
|
|
1276
|
+
return ts === void 0 || ts === null ? fallback : new Date(ts).toLocaleString();
|
|
1277
|
+
}
|
|
1278
|
+
function emptyKeyOf(state) {
|
|
1279
|
+
if (state.query.trim() !== "" || state.categories.length > 0) return "emptyFiltered";
|
|
1280
|
+
if (state.scope === "global") return "emptyGlobal";
|
|
1281
|
+
if (state.scope === "user") return "emptyUser";
|
|
1282
|
+
if (state.scope === "project") return "emptyProject";
|
|
1283
|
+
return "emptyAll";
|
|
1284
|
+
}
|
|
1285
|
+
function EntryRow(props) {
|
|
1286
|
+
const { entry, expanded, staleLabel, staleHint, pinnedLabel, neverRecalledLabel, scopeLabels, translate, onToggle } = props;
|
|
1287
|
+
const category = entry.category;
|
|
1288
|
+
const projectName = entry.projectName;
|
|
1289
|
+
const isStale = entry.staleSince !== void 0;
|
|
1290
|
+
const isPinned = entry.pinned === true;
|
|
1291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: isStale ? `${css2.row} ${css2.rowStale}` : css2.row, children: [
|
|
1292
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.badges, children: [
|
|
1293
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: scopeLabels[entry.scope] }),
|
|
1294
|
+
category === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.badge, children: translate(CATEGORY_LABEL_KEYS[category] ?? category) }),
|
|
1295
|
+
projectName === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.project, children: projectName }),
|
|
1296
|
+
isPinned ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.badge} ${css2.badgePinned}`, children: `\u{1F4CC} ${pinnedLabel}` }) : null,
|
|
1297
|
+
isStale ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.badge} ${css2.badgeStale}`, title: staleHint, "aria-label": staleHint, children: `\u{1F634} ${staleLabel}` }) : null
|
|
1298
|
+
] }),
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1300
|
+
"button",
|
|
1301
|
+
{
|
|
1302
|
+
type: "button",
|
|
1303
|
+
className: expanded ? `${css2.content} ${css2.contentOpen}` : css2.content,
|
|
1304
|
+
"aria-expanded": expanded,
|
|
1305
|
+
onClick: onToggle,
|
|
1306
|
+
children: entry.content
|
|
1307
|
+
}
|
|
1308
|
+
),
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: css2.meta, children: [
|
|
1310
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaCreated")} ${formatTs(entry.createdAt, "\u2014")}` }),
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: `${translate("metaUpdated")} ${formatTs(entry.updatedAt, "\u2014")}` }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: entry.lastRecalledAt === void 0 ? `${translate("metaRecalled")} ${neverRecalledLabel}` : `${translate("metaRecalled")} ${formatTs(entry.lastRecalledAt, neverRecalledLabel)}` })
|
|
1313
|
+
] })
|
|
1314
|
+
] });
|
|
1315
|
+
}
|
|
1316
|
+
function MemorySection(props) {
|
|
1317
|
+
const { useMemorySection, t, load } = props;
|
|
1318
|
+
const state = useMemorySection((snapshot) => snapshot);
|
|
1319
|
+
(0, import_react2.useEffect)(() => {
|
|
1320
|
+
void load();
|
|
1321
|
+
}, [load]);
|
|
1322
|
+
const [searchText, setSearchText] = (0, import_react2.useState)(state.query);
|
|
1323
|
+
(0, import_react2.useEffect)(() => {
|
|
1324
|
+
const timer = setTimeout(() => {
|
|
1325
|
+
props.commitQuery(searchText);
|
|
1326
|
+
}, 300);
|
|
1327
|
+
return () => {
|
|
1328
|
+
clearTimeout(timer);
|
|
1329
|
+
};
|
|
1330
|
+
}, [searchText]);
|
|
1331
|
+
const [expandedIds, setExpandedIds] = (0, import_react2.useState)(/* @__PURE__ */ new Set());
|
|
1332
|
+
const toggleExpanded = (id) => {
|
|
1333
|
+
setExpandedIds((previous) => {
|
|
1334
|
+
const next = new Set(previous);
|
|
1335
|
+
if (next.has(id)) next.delete(id);
|
|
1336
|
+
else next.add(id);
|
|
1337
|
+
return next;
|
|
1338
|
+
});
|
|
1339
|
+
};
|
|
1340
|
+
const scopeLabels = {
|
|
1341
|
+
global: t("dashGlobal"),
|
|
1342
|
+
project: t("dashProject"),
|
|
1343
|
+
user: t("dashUser")
|
|
1344
|
+
};
|
|
1345
|
+
const workspaceEnabled = state.scope === "all" || state.scope === "project";
|
|
1346
|
+
const total = state.total;
|
|
1347
|
+
const pageCount = Math.max(1, Math.ceil(total / MEMORY_PAGE_SIZE));
|
|
1348
|
+
const from = total === 0 ? 0 : state.page * MEMORY_PAGE_SIZE + 1;
|
|
1349
|
+
const to = Math.min(total, (state.page + 1) * MEMORY_PAGE_SIZE);
|
|
1350
|
+
if (state.status === "error") {
|
|
1351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
|
|
1352
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
|
|
1354
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: css2.pageBtn, onClick: () => {
|
|
1355
|
+
void load();
|
|
1356
|
+
}, children: t("retry") })
|
|
1357
|
+
] });
|
|
1358
|
+
}
|
|
1359
|
+
if (state.status === "loading" || state.status === "idle") {
|
|
1360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
|
|
1362
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.intro, children: t("loading") })
|
|
1363
|
+
] });
|
|
1364
|
+
}
|
|
1365
|
+
const health = state.health;
|
|
1366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.section, children: [
|
|
1367
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: css2.title, children: t("nav") }),
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.intro, children: t("sectionIntro") }),
|
|
1369
|
+
health === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.dash, children: [
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.totalEntries }),
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashTotal") })
|
|
1373
|
+
] }),
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.byScope.global }),
|
|
1376
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("scopeGlobal") })
|
|
1377
|
+
] }),
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.byScope.user }),
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("scopeUser") })
|
|
1381
|
+
] }),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.byScope.project }),
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("scopeProject") })
|
|
1385
|
+
] }),
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.pinned }),
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashPinned") })
|
|
1389
|
+
] }),
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: `${css2.stat} ${css2.statStale}`, title: t("dashStaleHint"), children: [
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.statValue}${(health.stale ?? 0) > 0 ? "" : ` ${css2.statValueMuted}`}`, children: health.stale ?? 0 }),
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashStale") })
|
|
1393
|
+
] }),
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statValue, children: health.auditRecords }),
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashAudit") })
|
|
1397
|
+
] }),
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.statValue} ${css2.statValueMuted}`, children: formatTs(health.lastActivityTs, t("dashLastActivityNever")) }),
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashLastActivity") })
|
|
1401
|
+
] }),
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: css2.stat, children: [
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: `${css2.statValue} ${css2.statValueMuted}`, children: formatTs(health.lastExtractionTs, t("dashLastActivityNever")) }),
|
|
1404
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.statLabel, children: t("dashLastExtraction") })
|
|
1405
|
+
] })
|
|
1406
|
+
] }),
|
|
1407
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbar, children: [
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbarRow, children: [
|
|
1409
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.toolbarLabel, children: t("searchLabel") }),
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: css2.seg, role: "group", "aria-label": t("nav"), children: SCOPES.map(({ value, labelKey }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1411
|
+
"button",
|
|
1412
|
+
{
|
|
1413
|
+
type: "button",
|
|
1414
|
+
className: css2.segBtn,
|
|
1415
|
+
"aria-pressed": state.scope === value,
|
|
1416
|
+
onClick: () => {
|
|
1417
|
+
props.setScope(value);
|
|
1418
|
+
},
|
|
1419
|
+
children: t(labelKey)
|
|
1420
|
+
},
|
|
1421
|
+
value
|
|
1422
|
+
)) }),
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1424
|
+
"select",
|
|
1425
|
+
{
|
|
1426
|
+
className: css2.select,
|
|
1427
|
+
"aria-label": t("workspaceLabel"),
|
|
1428
|
+
disabled: !workspaceEnabled,
|
|
1429
|
+
value: state.projectName ?? "",
|
|
1430
|
+
onChange: (event) => {
|
|
1431
|
+
props.setProject(event.target.value);
|
|
1432
|
+
},
|
|
1433
|
+
children: [
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "", children: t("workspaceAll") }),
|
|
1435
|
+
state.projects.map((name) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: name, children: name }, name))
|
|
1436
|
+
]
|
|
1437
|
+
}
|
|
1438
|
+
),
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1440
|
+
"input",
|
|
1441
|
+
{
|
|
1442
|
+
type: "search",
|
|
1443
|
+
className: css2.input,
|
|
1444
|
+
"aria-label": t("searchLabel"),
|
|
1445
|
+
placeholder: t("searchPlaceholder"),
|
|
1446
|
+
value: searchText,
|
|
1447
|
+
onChange: (event) => {
|
|
1448
|
+
setSearchText(event.target.value);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
)
|
|
1452
|
+
] }),
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.toolbarRow, children: [
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: css2.toolbarLabel, children: t("categoryLabel") }),
|
|
1455
|
+
MEMORY_CATEGORIES.map((category) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1456
|
+
"button",
|
|
1457
|
+
{
|
|
1458
|
+
type: "button",
|
|
1459
|
+
className: css2.chip,
|
|
1460
|
+
"aria-pressed": state.categories.includes(category),
|
|
1461
|
+
onClick: () => {
|
|
1462
|
+
props.toggleCategory(category);
|
|
1463
|
+
},
|
|
1464
|
+
children: translateCategory(category, t)
|
|
1465
|
+
},
|
|
1466
|
+
category
|
|
1467
|
+
))
|
|
1468
|
+
] })
|
|
1469
|
+
] }),
|
|
1470
|
+
state.error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.error, role: "alert", children: state.error }),
|
|
1471
|
+
total === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.empty, children: t(emptyKeyOf(state)) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: css2.list, children: state.entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1473
|
+
EntryRow,
|
|
1474
|
+
{
|
|
1475
|
+
entry,
|
|
1476
|
+
expanded: expandedIds.has(entry.id),
|
|
1477
|
+
staleLabel: t("staleMark"),
|
|
1478
|
+
staleHint: t("staleHint"),
|
|
1479
|
+
pinnedLabel: t("pinnedBadge"),
|
|
1480
|
+
neverRecalledLabel: t("neverRecalled"),
|
|
1481
|
+
scopeLabels,
|
|
1482
|
+
translate: t,
|
|
1483
|
+
onToggle: () => {
|
|
1484
|
+
toggleExpanded(entry.id);
|
|
1485
|
+
}
|
|
1486
|
+
},
|
|
1487
|
+
entry.id
|
|
1488
|
+
)) }),
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: css2.pager, children: [
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: css2.pagerInfo, children: pageCount <= 1 ? t("pageSingle").replace("{total}", String(total)) : t("pageInfo").replace("{from}", String(from)).replace("{to}", String(to)).replace("{total}", String(total)) }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1492
|
+
"button",
|
|
1493
|
+
{
|
|
1494
|
+
type: "button",
|
|
1495
|
+
className: css2.pageBtn,
|
|
1496
|
+
disabled: state.page <= 0,
|
|
1497
|
+
"aria-label": t("pagePrev"),
|
|
1498
|
+
onClick: () => {
|
|
1499
|
+
props.setPage(state.page - 1);
|
|
1500
|
+
},
|
|
1501
|
+
children: "\u2039"
|
|
1502
|
+
}
|
|
1503
|
+
),
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1505
|
+
"button",
|
|
1506
|
+
{
|
|
1507
|
+
type: "button",
|
|
1508
|
+
className: css2.pageBtn,
|
|
1509
|
+
disabled: state.page >= pageCount - 1,
|
|
1510
|
+
"aria-label": t("pageNext"),
|
|
1511
|
+
onClick: () => {
|
|
1512
|
+
props.setPage(state.page + 1);
|
|
1513
|
+
},
|
|
1514
|
+
children: "\u203A"
|
|
1515
|
+
}
|
|
1516
|
+
)
|
|
1517
|
+
] })
|
|
1518
|
+
] })
|
|
1519
|
+
] });
|
|
1520
|
+
}
|
|
1521
|
+
function translateCategory(category, t) {
|
|
1522
|
+
const key = CATEGORY_LABEL_KEYS[category];
|
|
1523
|
+
return key === void 0 ? category : t(key);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
// src/client/NamespaceCard.tsx
|
|
1527
|
+
var import_react3 = require("react");
|
|
1528
|
+
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1529
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
729
1530
|
function namespaceCard(spec) {
|
|
730
1531
|
return function SpecBoundNamespaceCard(props) {
|
|
731
|
-
return /* @__PURE__ */ (0,
|
|
1532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NamespaceCard, { ...props, spec });
|
|
732
1533
|
};
|
|
733
1534
|
}
|
|
734
1535
|
function isOverridden2(snap, field) {
|
|
@@ -741,12 +1542,12 @@ function NamespaceCard(props) {
|
|
|
741
1542
|
const snap = props.useNs((s) => s);
|
|
742
1543
|
const t = props.t;
|
|
743
1544
|
const spec = props.spec;
|
|
744
|
-
const [open, setOpen] = (0,
|
|
1545
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
745
1546
|
const canLoadCatalog = typeof props.loadCatalog === "function";
|
|
746
|
-
const catalogStartedRef = (0,
|
|
747
|
-
const [catalog, setCatalog] = (0,
|
|
748
|
-
const [catalogStatus, setCatalogStatus] = (0,
|
|
749
|
-
(0,
|
|
1547
|
+
const catalogStartedRef = (0, import_react3.useRef)(false);
|
|
1548
|
+
const [catalog, setCatalog] = (0, import_react3.useState)(void 0);
|
|
1549
|
+
const [catalogStatus, setCatalogStatus] = (0, import_react3.useState)("idle");
|
|
1550
|
+
(0, import_react3.useEffect)(() => {
|
|
750
1551
|
if (!open || !canLoadCatalog || catalogStartedRef.current) return;
|
|
751
1552
|
catalogStartedRef.current = true;
|
|
752
1553
|
setCatalogStatus("loading");
|
|
@@ -767,10 +1568,10 @@ function NamespaceCard(props) {
|
|
|
767
1568
|
})();
|
|
768
1569
|
}, [open, canLoadCatalog]);
|
|
769
1570
|
const committed = snap.value ?? {};
|
|
770
|
-
const [draft, setDraft] = (0,
|
|
771
|
-
const [saving, setSaving] = (0,
|
|
772
|
-
const [failed, setFailed] = (0,
|
|
773
|
-
(0,
|
|
1571
|
+
const [draft, setDraft] = (0, import_react3.useState)({ ...committed });
|
|
1572
|
+
const [saving, setSaving] = (0, import_react3.useState)(false);
|
|
1573
|
+
const [failed, setFailed] = (0, import_react3.useState)(false);
|
|
1574
|
+
(0, import_react3.useEffect)(() => {
|
|
774
1575
|
setDraft({ ...committed });
|
|
775
1576
|
setFailed(false);
|
|
776
1577
|
}, [committed]);
|
|
@@ -814,7 +1615,7 @@ function NamespaceCard(props) {
|
|
|
814
1615
|
const renderSelectField = (field, base) => {
|
|
815
1616
|
const rawValue = typeof draft[field.key] === "string" ? draft[field.key] : "";
|
|
816
1617
|
if (!canLoadCatalog || catalogStatus === "failed") {
|
|
817
|
-
return /* @__PURE__ */ (0,
|
|
1618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
818
1619
|
TextField,
|
|
819
1620
|
{
|
|
820
1621
|
...base,
|
|
@@ -825,7 +1626,7 @@ function NamespaceCard(props) {
|
|
|
825
1626
|
);
|
|
826
1627
|
}
|
|
827
1628
|
if (catalogStatus !== "ready") {
|
|
828
|
-
return /* @__PURE__ */ (0,
|
|
1629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
829
1630
|
SelectField,
|
|
830
1631
|
{
|
|
831
1632
|
...base,
|
|
@@ -839,7 +1640,7 @@ function NamespaceCard(props) {
|
|
|
839
1640
|
}
|
|
840
1641
|
const resolved = field.options?.({ catalog, draft }) ?? [];
|
|
841
1642
|
if (resolved.length === 0) {
|
|
842
|
-
return /* @__PURE__ */ (0,
|
|
1643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
843
1644
|
TextField,
|
|
844
1645
|
{
|
|
845
1646
|
...base,
|
|
@@ -853,7 +1654,7 @@ function NamespaceCard(props) {
|
|
|
853
1654
|
if (rawValue !== "" && !opts.some((o) => o.value === rawValue)) {
|
|
854
1655
|
opts.push({ value: rawValue, label: rawValue });
|
|
855
1656
|
}
|
|
856
|
-
return /* @__PURE__ */ (0,
|
|
1657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
857
1658
|
SelectField,
|
|
858
1659
|
{
|
|
859
1660
|
...base,
|
|
@@ -863,8 +1664,8 @@ function NamespaceCard(props) {
|
|
|
863
1664
|
}
|
|
864
1665
|
);
|
|
865
1666
|
};
|
|
866
|
-
return /* @__PURE__ */ (0,
|
|
867
|
-
/* @__PURE__ */ (0,
|
|
1667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { className: `${css.card}${open ? ` ${css.cardOpen}` : ""}`, children: [
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
868
1669
|
"button",
|
|
869
1670
|
{
|
|
870
1671
|
type: "button",
|
|
@@ -875,17 +1676,17 @@ function NamespaceCard(props) {
|
|
|
875
1676
|
setOpen(!open);
|
|
876
1677
|
},
|
|
877
1678
|
children: [
|
|
878
|
-
/* @__PURE__ */ (0,
|
|
879
|
-
/* @__PURE__ */ (0,
|
|
880
|
-
/* @__PURE__ */ (0,
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: css.headText, children: [
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.name, children: t(spec.titleKey) }),
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.description, children: t(spec.descriptionKey) })
|
|
881
1682
|
] }),
|
|
882
|
-
dirty ? /* @__PURE__ */ (0,
|
|
883
|
-
/* @__PURE__ */ (0,
|
|
1683
|
+
dirty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css.pending, children: t("unsaved") }) : null,
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives2.IconChevronDownOutline14, { className: `${css.chevron}${open ? ` ${css.chevronOpen}` : ""}` })
|
|
884
1685
|
]
|
|
885
1686
|
}
|
|
886
1687
|
),
|
|
887
|
-
open ? /* @__PURE__ */ (0,
|
|
888
|
-
!snap.writable ? /* @__PURE__ */ (0,
|
|
1688
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.body, children: [
|
|
1689
|
+
!snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.readOnly, role: "status", children: t("readOnly") }) : null,
|
|
889
1690
|
spec.fields.map((field) => {
|
|
890
1691
|
const label = t(field.labelKey ?? field.key);
|
|
891
1692
|
const hint = t(field.hintKey ?? `${field.key}Hint`);
|
|
@@ -904,7 +1705,7 @@ function NamespaceCard(props) {
|
|
|
904
1705
|
}
|
|
905
1706
|
};
|
|
906
1707
|
if (field.kind === "checkbox") {
|
|
907
|
-
return /* @__PURE__ */ (0,
|
|
1708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
908
1709
|
CheckboxField,
|
|
909
1710
|
{
|
|
910
1711
|
...base,
|
|
@@ -915,7 +1716,7 @@ function NamespaceCard(props) {
|
|
|
915
1716
|
}
|
|
916
1717
|
if (field.kind === "number") {
|
|
917
1718
|
const raw = draft[field.key];
|
|
918
|
-
return /* @__PURE__ */ (0,
|
|
1719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
919
1720
|
NumberField,
|
|
920
1721
|
{
|
|
921
1722
|
...base,
|
|
@@ -929,7 +1730,7 @@ function NamespaceCard(props) {
|
|
|
929
1730
|
if (field.kind === "select") {
|
|
930
1731
|
return renderSelectField(field, base);
|
|
931
1732
|
}
|
|
932
|
-
return /* @__PURE__ */ (0,
|
|
1733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
933
1734
|
TextField,
|
|
934
1735
|
{
|
|
935
1736
|
...base,
|
|
@@ -938,10 +1739,10 @@ function NamespaceCard(props) {
|
|
|
938
1739
|
}
|
|
939
1740
|
);
|
|
940
1741
|
}),
|
|
941
|
-
/* @__PURE__ */ (0,
|
|
942
|
-
failed ? /* @__PURE__ */ (0,
|
|
943
|
-
/* @__PURE__ */ (0,
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
1742
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css.footer, children: [
|
|
1743
|
+
failed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css.failed, role: "status", children: t("saveFailed") }) : null,
|
|
1744
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
|
|
1745
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
|
|
945
1746
|
] })
|
|
946
1747
|
] }) : null
|
|
947
1748
|
] });
|
|
@@ -1056,7 +1857,56 @@ var en = {
|
|
|
1056
1857
|
curatorMaxEntries: "Curator max entries",
|
|
1057
1858
|
curatorMaxEntriesHint: "Maximum entries selected per pass, longest first; minimum 1.",
|
|
1058
1859
|
curatorMinChars: "Curator minimum length",
|
|
1059
|
-
curatorMinCharsHint: "Only entries at least this long are selected for re-summarization."
|
|
1860
|
+
curatorMinCharsHint: "Only entries at least this long are selected for re-summarization.",
|
|
1861
|
+
// ── Memory content-management section (Settings → Memory, phase 1) ──
|
|
1862
|
+
nav: "Memory",
|
|
1863
|
+
sectionTitle: "Memory",
|
|
1864
|
+
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.",
|
|
1865
|
+
dashTotal: "Total memories",
|
|
1866
|
+
dashGlobal: "Global",
|
|
1867
|
+
dashUser: "User",
|
|
1868
|
+
dashProject: "Project",
|
|
1869
|
+
dashPinned: "Pinned",
|
|
1870
|
+
dashStale: "Dormant",
|
|
1871
|
+
dashStaleHint: "Soft-decayed entries: hidden from injection until recalled again. They stay searchable and editable here.",
|
|
1872
|
+
dashAudit: "Audit records",
|
|
1873
|
+
dashLastActivity: "Last activity",
|
|
1874
|
+
dashLastActivityNever: "never",
|
|
1875
|
+
dashLastExtraction: "Last extraction",
|
|
1876
|
+
scopeAll: "All",
|
|
1877
|
+
scopeGlobal: "Global",
|
|
1878
|
+
scopeUser: "User",
|
|
1879
|
+
scopeProject: "Project",
|
|
1880
|
+
workspaceLabel: "Workspace",
|
|
1881
|
+
workspaceAll: "All workspaces",
|
|
1882
|
+
searchLabel: "Search",
|
|
1883
|
+
searchPlaceholder: "Search memories\u2026",
|
|
1884
|
+
categoryLabel: "Category",
|
|
1885
|
+
catFailure: "Failure",
|
|
1886
|
+
catCorrection: "Correction",
|
|
1887
|
+
catInsight: "Insight",
|
|
1888
|
+
catPreference: "Preference",
|
|
1889
|
+
catConvention: "Convention",
|
|
1890
|
+
catToolQuirk: "Tool quirk",
|
|
1891
|
+
catProcedure: "Procedure",
|
|
1892
|
+
emptyGlobal: "No global memories yet. They are written by the memory tools and automatic extraction during sessions.",
|
|
1893
|
+
emptyUser: "No user memories yet. Teach me something about yourself in a session and it appears here.",
|
|
1894
|
+
emptyProject: "No memories for this workspace yet. Teach me in a session working in this repository and lessons land here.",
|
|
1895
|
+
emptyFiltered: "No memories match the current filters. Loosen the search or clear a chip.",
|
|
1896
|
+
emptyAll: "The memory store is empty. Memories are written by the memory tools and automatic extraction during sessions.",
|
|
1897
|
+
pinnedBadge: "Pinned",
|
|
1898
|
+
staleMark: "Dormant",
|
|
1899
|
+
staleHint: "Dormant \u2014 hidden from injection until recalled again; being recalled revives it.",
|
|
1900
|
+
metaCreated: "created",
|
|
1901
|
+
metaUpdated: "updated",
|
|
1902
|
+
metaRecalled: "recalled",
|
|
1903
|
+
pagePrev: "Previous page",
|
|
1904
|
+
pageNext: "Next page",
|
|
1905
|
+
pageInfo: "{from}\u2013{to} of {total}",
|
|
1906
|
+
pageSingle: "{total} entries",
|
|
1907
|
+
loadFailed: "The memory store could not be reached.",
|
|
1908
|
+
retry: "Retry",
|
|
1909
|
+
neverRecalled: "never recalled"
|
|
1060
1910
|
};
|
|
1061
1911
|
var zh = {
|
|
1062
1912
|
// Card chrome
|
|
@@ -1140,7 +1990,56 @@ var zh = {
|
|
|
1140
1990
|
curatorMaxEntries: "\u5355\u6B21\u6574\u7406\u6761\u6570\u4E0A\u9650",
|
|
1141
1991
|
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
1992
|
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"
|
|
1993
|
+
curatorMinCharsHint: "\u4EC5\u957F\u5EA6\u4E0D\u4F4E\u4E8E\u8BE5\u5B57\u7B26\u6570\u7684\u6761\u76EE\u4F1A\u88AB\u9009\u4E2D\u6539\u5199\u3002",
|
|
1994
|
+
// ── 记忆内容管理 section(Settings → Memory,一期)──
|
|
1995
|
+
nav: "\u8BB0\u5FC6",
|
|
1996
|
+
sectionTitle: "\u8BB0\u5FC6",
|
|
1997
|
+
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",
|
|
1998
|
+
dashTotal: "\u8BB0\u5FC6\u603B\u6570",
|
|
1999
|
+
dashGlobal: "\u5168\u5C40",
|
|
2000
|
+
dashUser: "\u7528\u6237",
|
|
2001
|
+
dashProject: "\u9879\u76EE",
|
|
2002
|
+
dashPinned: "\u7F6E\u9876",
|
|
2003
|
+
dashStale: "\u4F11\u7720",
|
|
2004
|
+
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",
|
|
2005
|
+
dashAudit: "\u5BA1\u8BA1\u8BB0\u5F55",
|
|
2006
|
+
dashLastActivity: "\u6700\u8FD1\u6D3B\u52A8",
|
|
2007
|
+
dashLastActivityNever: "\u6682\u65E0",
|
|
2008
|
+
dashLastExtraction: "\u6700\u8FD1\u63D0\u53D6",
|
|
2009
|
+
scopeAll: "\u5168\u90E8",
|
|
2010
|
+
scopeGlobal: "\u5168\u5C40",
|
|
2011
|
+
scopeUser: "\u7528\u6237",
|
|
2012
|
+
scopeProject: "\u9879\u76EE",
|
|
2013
|
+
workspaceLabel: "\u5DE5\u4F5C\u533A",
|
|
2014
|
+
workspaceAll: "\u5168\u90E8\u5DE5\u4F5C\u533A",
|
|
2015
|
+
searchLabel: "\u641C\u7D22",
|
|
2016
|
+
searchPlaceholder: "\u641C\u7D22\u8BB0\u5FC6\u2026",
|
|
2017
|
+
categoryLabel: "\u7C7B\u522B",
|
|
2018
|
+
catFailure: "\u5931\u8D25",
|
|
2019
|
+
catCorrection: "\u7EA0\u6B63",
|
|
2020
|
+
catInsight: "\u6D1E\u5BDF",
|
|
2021
|
+
catPreference: "\u504F\u597D",
|
|
2022
|
+
catConvention: "\u7EA6\u5B9A",
|
|
2023
|
+
catToolQuirk: "\u5DE5\u5177\u602A\u7656",
|
|
2024
|
+
catProcedure: "\u6D41\u7A0B",
|
|
2025
|
+
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",
|
|
2026
|
+
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",
|
|
2027
|
+
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",
|
|
2028
|
+
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",
|
|
2029
|
+
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",
|
|
2030
|
+
pinnedBadge: "\u7F6E\u9876",
|
|
2031
|
+
staleMark: "\u4F11\u7720",
|
|
2032
|
+
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",
|
|
2033
|
+
metaCreated: "\u521B\u5EFA\u4E8E",
|
|
2034
|
+
metaUpdated: "\u66F4\u65B0\u4E8E",
|
|
2035
|
+
metaRecalled: "\u53EC\u56DE\u4E8E",
|
|
2036
|
+
pagePrev: "\u4E0A\u4E00\u9875",
|
|
2037
|
+
pageNext: "\u4E0B\u4E00\u9875",
|
|
2038
|
+
pageInfo: "\u7B2C {from}\u2013{to} \u6761 \xB7 \u5171 {total} \u6761",
|
|
2039
|
+
pageSingle: "\u5171 {total} \u6761",
|
|
2040
|
+
loadFailed: "\u65E0\u6CD5\u8FDE\u63A5\u8BB0\u5FC6\u5B58\u50A8\u3002",
|
|
2041
|
+
retry: "\u91CD\u8BD5",
|
|
2042
|
+
neverRecalled: "\u4ECE\u672A\u53EC\u56DE"
|
|
1144
2043
|
};
|
|
1145
2044
|
|
|
1146
2045
|
// src/client/index.ts
|
|
@@ -1194,14 +2093,46 @@ var REVIEW_SPEC = {
|
|
|
1194
2093
|
{ key: "curatorMinChars", kind: "number", minValue: 1 }
|
|
1195
2094
|
]
|
|
1196
2095
|
};
|
|
1197
|
-
var
|
|
2096
|
+
var inject3 = ["slots", "locale", "connection", "settingsScope"];
|
|
1198
2097
|
var NS = "settings.memory";
|
|
2098
|
+
var SECTION_ORDER = 25;
|
|
1199
2099
|
var CARDS = [
|
|
1200
2100
|
{ key: "memory" },
|
|
1201
2101
|
{ key: "memory-notes", namespace: "memory", spec: NOTES_SPEC },
|
|
1202
2102
|
{ key: "memory-autorecall", namespace: "memory", spec: AUTORECALL_SPEC },
|
|
1203
2103
|
{ key: "memory-review", spec: REVIEW_SPEC }
|
|
1204
2104
|
];
|
|
2105
|
+
function createMemoryRemoteApi(connection) {
|
|
2106
|
+
const call = connection?.rpc?.call;
|
|
2107
|
+
if (typeof call !== "function") return void 0;
|
|
2108
|
+
const invoke = async (method, request) => {
|
|
2109
|
+
try {
|
|
2110
|
+
const response = await call("/api", `memoryRemote/${method}`, {
|
|
2111
|
+
args: request === void 0 ? {} : { request }
|
|
2112
|
+
});
|
|
2113
|
+
if (response.ok) return { result: { ok: true, value: response.value } };
|
|
2114
|
+
return {
|
|
2115
|
+
result: {
|
|
2116
|
+
ok: false,
|
|
2117
|
+
error: { message: response.error?.message ?? `memoryRemote/${method} failed` }
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
} catch (error) {
|
|
2121
|
+
return {
|
|
2122
|
+
result: {
|
|
2123
|
+
ok: false,
|
|
2124
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
2125
|
+
}
|
|
2126
|
+
};
|
|
2127
|
+
}
|
|
2128
|
+
};
|
|
2129
|
+
return {
|
|
2130
|
+
list: (request) => invoke("list", request),
|
|
2131
|
+
search: (request) => invoke("search", request),
|
|
2132
|
+
projects: () => invoke("projects"),
|
|
2133
|
+
health: () => invoke("health")
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
1205
2136
|
function createCatalogLoader(connection) {
|
|
1206
2137
|
const llm = connection?.api?.llm;
|
|
1207
2138
|
if (llm === void 0 || typeof llm.models !== "function") return void 0;
|
|
@@ -1212,14 +2143,21 @@ function createCatalogLoader(connection) {
|
|
|
1212
2143
|
}
|
|
1213
2144
|
function apply(ctx) {
|
|
1214
2145
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-memory: locale dictionaries");
|
|
1215
|
-
const
|
|
2146
|
+
const connection = ctx.get("connection");
|
|
2147
|
+
const loadCatalog = createCatalogLoader(connection);
|
|
2148
|
+
const controller = new MemorySectionController(createMemoryRemoteApi(connection));
|
|
2149
|
+
ctx.effect(() => {
|
|
2150
|
+
return ctx.on("connection/reset", () => {
|
|
2151
|
+
void controller.load();
|
|
2152
|
+
});
|
|
2153
|
+
}, "dsh-memory: memory section reload on reconnect");
|
|
1216
2154
|
ctx.slots.inject("settings.plugin.item", function* () {
|
|
1217
2155
|
for (const card of CARDS) {
|
|
1218
2156
|
const ns = card.namespace ?? card.key;
|
|
1219
2157
|
const scope = ctx.settingsScope.bind({ namespace: ns });
|
|
1220
2158
|
if (card.spec === void 0) {
|
|
1221
2159
|
const typed = scope;
|
|
1222
|
-
const
|
|
2160
|
+
const injected3 = () => ({
|
|
1223
2161
|
hooks: { memory: typed },
|
|
1224
2162
|
set: (field, value) => typed.set(field, value),
|
|
1225
2163
|
unset: (field) => typed.unset(field)
|
|
@@ -1228,13 +2166,13 @@ function apply(ctx) {
|
|
|
1228
2166
|
name: "settings.plugin.item",
|
|
1229
2167
|
key: card.key,
|
|
1230
2168
|
locale: NS,
|
|
1231
|
-
inject:
|
|
2169
|
+
inject: injected3
|
|
1232
2170
|
}, MemoryPluginCard);
|
|
1233
2171
|
} else {
|
|
1234
2172
|
const spec = card.spec;
|
|
1235
2173
|
const typed = scope;
|
|
1236
2174
|
const withCatalog = loadCatalog !== void 0 && spec.fields.some((f) => f.kind === "select");
|
|
1237
|
-
const
|
|
2175
|
+
const injected3 = () => ({
|
|
1238
2176
|
hooks: { ns: typed },
|
|
1239
2177
|
set: (field, value) => typed.set(field, value),
|
|
1240
2178
|
unset: (field) => typed.unset(field),
|
|
@@ -1244,11 +2182,38 @@ function apply(ctx) {
|
|
|
1244
2182
|
name: "settings.plugin.item",
|
|
1245
2183
|
key: card.key,
|
|
1246
2184
|
locale: NS,
|
|
1247
|
-
inject:
|
|
2185
|
+
inject: injected3
|
|
1248
2186
|
}, namespaceCard(spec));
|
|
1249
2187
|
}
|
|
1250
2188
|
}
|
|
1251
2189
|
});
|
|
2190
|
+
const sectionInjected = () => ({
|
|
2191
|
+
hooks: { memorySection: controller.store },
|
|
2192
|
+
load: () => controller.load(),
|
|
2193
|
+
setScope: (scope) => {
|
|
2194
|
+
controller.setScope(scope);
|
|
2195
|
+
},
|
|
2196
|
+
setProject: (name) => {
|
|
2197
|
+
controller.setProject(name);
|
|
2198
|
+
},
|
|
2199
|
+
commitQuery: (query) => {
|
|
2200
|
+
controller.commitQuery(query);
|
|
2201
|
+
},
|
|
2202
|
+
toggleCategory: (category) => {
|
|
2203
|
+
controller.toggleCategory(category);
|
|
2204
|
+
},
|
|
2205
|
+
setPage: (page) => {
|
|
2206
|
+
controller.setPage(page);
|
|
2207
|
+
}
|
|
2208
|
+
});
|
|
2209
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
2210
|
+
name: "settings.section",
|
|
2211
|
+
id: "memory",
|
|
2212
|
+
order: SECTION_ORDER,
|
|
2213
|
+
label: () => ctx.locale.bind(NS)("nav"),
|
|
2214
|
+
locale: NS,
|
|
2215
|
+
inject: sectionInjected
|
|
2216
|
+
}, MemorySection));
|
|
1252
2217
|
}
|
|
1253
2218
|
|
|
1254
2219
|
|