@chenhw7/dsh-memory 0.9.1 → 0.9.2
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.i18n.yaml +2 -2
- package/README.md +70 -20
- package/README.zh.md +70 -20
- package/cordis.patch.yml +11 -4
- package/lib/benchmark/index.d.ts +1 -1
- package/lib/benchmark/index.d.ts.map +1 -1
- package/lib/client/index.js +388 -58
- package/lib/context/index.d.ts +93 -18
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +331 -71
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +72 -11
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +250 -16
- package/lib/context/policy.js.map +1 -1
- package/lib/identity/index.d.ts +74 -0
- package/lib/identity/index.d.ts.map +1 -0
- package/lib/identity/index.js +150 -0
- package/lib/identity/index.js.map +1 -0
- package/lib/identity/seeds.d.ts +52 -0
- package/lib/identity/seeds.d.ts.map +1 -0
- package/lib/identity/seeds.js +130 -0
- package/lib/identity/seeds.js.map +1 -0
- package/lib/identity/settings.d.ts +32 -0
- package/lib/identity/settings.d.ts.map +1 -0
- package/lib/identity/settings.js +33 -0
- package/lib/identity/settings.js.map +1 -0
- package/lib/index.d.ts +53 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +62 -1
- package/lib/index.js.map +1 -1
- package/lib/notes/index.d.ts +5 -2
- package/lib/notes/index.d.ts.map +1 -1
- package/lib/notes/index.js +26 -14
- package/lib/notes/index.js.map +1 -1
- package/lib/notes/render.d.ts +15 -3
- package/lib/notes/render.d.ts.map +1 -1
- package/lib/notes/render.js +110 -27
- package/lib/notes/render.js.map +1 -1
- package/lib/notes/settings.d.ts +27 -14
- package/lib/notes/settings.d.ts.map +1 -1
- package/lib/notes/settings.js +42 -13
- package/lib/notes/settings.js.map +1 -1
- package/lib/remote/index.d.ts +83 -1
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +93 -2
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +29 -1
- package/lib/remote/typert.remote-client.js +19 -0
- package/lib/remote/types.d.ts +1 -1
- package/lib/remote/types.d.ts.map +1 -1
- package/lib/review/extract.d.ts +12 -1
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +72 -2
- package/lib/review/extract.js.map +1 -1
- package/lib/store/identity-util.d.ts +12 -0
- package/lib/store/identity-util.d.ts.map +1 -0
- package/lib/store/identity-util.js +19 -0
- package/lib/store/identity-util.js.map +1 -0
- package/lib/store/index.d.ts +64 -13
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +246 -26
- package/lib/store/index.js.map +1 -1
- package/lib/store/sqlite.d.ts +24 -7
- package/lib/store/sqlite.d.ts.map +1 -1
- package/lib/store/sqlite.js +181 -13
- package/lib/store/sqlite.js.map +1 -1
- package/lib/tool/index.d.ts +4 -11
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +117 -3
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +90 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +5 -1
package/lib/client/index.js
CHANGED
|
@@ -526,19 +526,17 @@ function TextareaField(props) {
|
|
|
526
526
|
|
|
527
527
|
// src/client/MemoryPluginCard.tsx
|
|
528
528
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
529
|
-
var MODES = ["policy-only", "full", "index", "custom", "off"];
|
|
529
|
+
var MODES = ["digest", "policy-only", "full", "index", "custom", "off"];
|
|
530
530
|
var DEFAULTS = {
|
|
531
|
-
memoryMode: "
|
|
531
|
+
memoryMode: "digest",
|
|
532
532
|
memoryPolicyCustomText: "",
|
|
533
533
|
memoryCharLimit: 5e3,
|
|
534
|
+
memoryDigestCharLimit: 800,
|
|
534
535
|
memoryMaxEntries: 20,
|
|
535
536
|
maxSearchResults: 50,
|
|
536
|
-
decayDays: 30
|
|
537
|
-
notesEnabled: true,
|
|
538
|
-
notesCharLimit: 4e3,
|
|
539
|
-
notesMaxEntriesPerFile: 100
|
|
537
|
+
decayDays: 30
|
|
540
538
|
};
|
|
541
|
-
var NUMERIC_FIELDS = ["memoryCharLimit", "
|
|
539
|
+
var NUMERIC_FIELDS = ["memoryCharLimit", "memoryDigestCharLimit", "memoryMaxEntries", "maxSearchResults", "decayDays"];
|
|
542
540
|
function isOverridden(snap, field) {
|
|
543
541
|
const user = snap.user;
|
|
544
542
|
if (user === void 0 || user === null || typeof user !== "object") return false;
|
|
@@ -625,7 +623,7 @@ function MemoryPluginCard(props) {
|
|
|
625
623
|
overriddenLabel: t("overridden"),
|
|
626
624
|
resetLabel: t("reset"),
|
|
627
625
|
disabled,
|
|
628
|
-
value: draft.memoryMode ?? "
|
|
626
|
+
value: draft.memoryMode ?? "digest",
|
|
629
627
|
options: MODES.map((m) => ({ value: m, label: m })),
|
|
630
628
|
onChange: (v) => edit("memoryMode", v),
|
|
631
629
|
onReset: () => {
|
|
@@ -672,6 +670,26 @@ function MemoryPluginCard(props) {
|
|
|
672
670
|
}
|
|
673
671
|
}
|
|
674
672
|
),
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
674
|
+
NumberField,
|
|
675
|
+
{
|
|
676
|
+
id: "dsh-memory-digest-char-limit",
|
|
677
|
+
label: t("digestCharLimit"),
|
|
678
|
+
hint: t("digestCharLimitHint"),
|
|
679
|
+
overridden: isOverridden(snap, "memoryDigestCharLimit"),
|
|
680
|
+
overriddenLabel: t("overridden"),
|
|
681
|
+
resetLabel: t("reset"),
|
|
682
|
+
invalidLabel: t("invalidNumber"),
|
|
683
|
+
invalid: numericInvalid("memoryDigestCharLimit"),
|
|
684
|
+
disabled,
|
|
685
|
+
value: draft.memoryDigestCharLimit ?? "",
|
|
686
|
+
onChange: (v) => edit("memoryDigestCharLimit", v === "" ? void 0 : Number(v)),
|
|
687
|
+
onReset: () => {
|
|
688
|
+
void props.unset("memoryDigestCharLimit");
|
|
689
|
+
edit("memoryDigestCharLimit", void 0);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
),
|
|
675
693
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
676
694
|
NumberField,
|
|
677
695
|
{
|
|
@@ -2119,13 +2137,134 @@ function translateCategory(category, t) {
|
|
|
2119
2137
|
return key === void 0 ? category : t(key);
|
|
2120
2138
|
}
|
|
2121
2139
|
|
|
2122
|
-
// src/client/
|
|
2140
|
+
// src/client/IdentitySection.tsx
|
|
2123
2141
|
var import_react3 = require("react");
|
|
2124
|
-
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
2125
2142
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2143
|
+
var KINDS = [
|
|
2144
|
+
{ kind: "soul", titleKey: "identitySoulTitle", emptyKey: "identitySoulEmpty", file: "SOUL.md" },
|
|
2145
|
+
{ kind: "user", titleKey: "identityUserTitle", emptyKey: "identityUserEmpty", file: "USER.md" }
|
|
2146
|
+
];
|
|
2147
|
+
function formatTs2(ts) {
|
|
2148
|
+
return new Date(ts).toLocaleString();
|
|
2149
|
+
}
|
|
2150
|
+
function sourceLabel(source, translate) {
|
|
2151
|
+
if (source === "seed") return translate("identitySourceSeed");
|
|
2152
|
+
if (source === "ui") return translate("identitySourceUi");
|
|
2153
|
+
return translate("identitySourceTool");
|
|
2154
|
+
}
|
|
2155
|
+
function exportDocument(file, content) {
|
|
2156
|
+
if (typeof Blob === "undefined" || typeof URL.createObjectURL !== "function") return;
|
|
2157
|
+
const blob = new Blob([content], { type: "text/markdown" });
|
|
2158
|
+
const url = URL.createObjectURL(blob);
|
|
2159
|
+
const anchor = document.createElement("a");
|
|
2160
|
+
anchor.href = url;
|
|
2161
|
+
anchor.download = file;
|
|
2162
|
+
anchor.click();
|
|
2163
|
+
URL.revokeObjectURL(url);
|
|
2164
|
+
}
|
|
2165
|
+
function DocumentPanel(props) {
|
|
2166
|
+
const { kind, file, title, emptyHint, record, history, translate, onRevert } = props;
|
|
2167
|
+
const [confirmingVersion, setConfirmingVersion] = (0, import_react3.useState)(null);
|
|
2168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.row, "data-testid": `identity-panel-${kind}`, children: [
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.reviewHead, children: [
|
|
2170
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.title, children: title }),
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.badges, children: record !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.badge, children: translate("identityCurrentVersion").replace("{version}", String(record.version)) }),
|
|
2173
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2174
|
+
"button",
|
|
2175
|
+
{
|
|
2176
|
+
type: "button",
|
|
2177
|
+
className: css2.moreBtn,
|
|
2178
|
+
onClick: () => {
|
|
2179
|
+
exportDocument(file, record.content);
|
|
2180
|
+
},
|
|
2181
|
+
children: translate("identityExport")
|
|
2182
|
+
}
|
|
2183
|
+
)
|
|
2184
|
+
] }) : null })
|
|
2185
|
+
] }),
|
|
2186
|
+
record === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.empty, children: emptyHint }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { className: `${css2.content} ${css2.contentOpen}`, children: record.content }),
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.list, children: [
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: css2.meta, children: translate("identityHistoryTitle") }),
|
|
2190
|
+
history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.empty, children: translate("identityEmptyHistory") }) : history.map((snapshot) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.row, children: [
|
|
2191
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.content, children: `v${snapshot.version} \xB7 ${formatTs2(snapshot.ts)} \xB7 ${sourceLabel(snapshot.source, translate)}` }),
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: css2.actions, children: confirmingVersion === snapshot.version ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2193
|
+
"button",
|
|
2194
|
+
{
|
|
2195
|
+
type: "button",
|
|
2196
|
+
className: css2.actionBtnDanger,
|
|
2197
|
+
onClick: () => {
|
|
2198
|
+
setConfirmingVersion(null);
|
|
2199
|
+
void onRevert(kind, snapshot.version);
|
|
2200
|
+
},
|
|
2201
|
+
children: translate("identityRevertConfirm")
|
|
2202
|
+
}
|
|
2203
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2204
|
+
"button",
|
|
2205
|
+
{
|
|
2206
|
+
type: "button",
|
|
2207
|
+
className: css2.actionBtn,
|
|
2208
|
+
onClick: () => {
|
|
2209
|
+
setConfirmingVersion(snapshot.version);
|
|
2210
|
+
},
|
|
2211
|
+
children: translate("identityRevertBtn")
|
|
2212
|
+
}
|
|
2213
|
+
) })
|
|
2214
|
+
] }, `${kind}-${snapshot.version}`))
|
|
2215
|
+
] })
|
|
2216
|
+
] })
|
|
2217
|
+
] });
|
|
2218
|
+
}
|
|
2219
|
+
function IdentitySection(props) {
|
|
2220
|
+
const { useIdentitySection, t, load } = props;
|
|
2221
|
+
const state = useIdentitySection((snapshot) => snapshot);
|
|
2222
|
+
(0, import_react3.useEffect)(() => {
|
|
2223
|
+
void load();
|
|
2224
|
+
}, [load]);
|
|
2225
|
+
if (state.status === "error") {
|
|
2226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.section, children: [
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: css2.title, children: t("identityNav") }),
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.error, role: "alert", children: `${t("loadFailed")} ${state.error ?? ""}` }),
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: css2.moreBtn, onClick: () => {
|
|
2230
|
+
void load();
|
|
2231
|
+
}, children: t("retry") })
|
|
2232
|
+
] });
|
|
2233
|
+
}
|
|
2234
|
+
if (state.status === "loading" || state.status === "idle") {
|
|
2235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.section, children: [
|
|
2236
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: css2.title, children: t("identityNav") }),
|
|
2237
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.intro, children: t("loading") })
|
|
2238
|
+
] });
|
|
2239
|
+
}
|
|
2240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: css2.section, children: [
|
|
2241
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: css2.title, children: t("identityNav") }),
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.intro, children: t("identitySectionIntro") }),
|
|
2243
|
+
state.actionError !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: css2.error, role: "alert", children: state.actionError }) : null,
|
|
2244
|
+
KINDS.map(({ kind, titleKey, emptyKey, file }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2245
|
+
DocumentPanel,
|
|
2246
|
+
{
|
|
2247
|
+
kind,
|
|
2248
|
+
file,
|
|
2249
|
+
title: t(titleKey),
|
|
2250
|
+
emptyHint: t(emptyKey),
|
|
2251
|
+
record: kind === "soul" ? state.soul : state.user,
|
|
2252
|
+
history: state.history[kind],
|
|
2253
|
+
translate: t,
|
|
2254
|
+
onRevert: (revertKind, version) => props.revert(revertKind, version)
|
|
2255
|
+
},
|
|
2256
|
+
kind
|
|
2257
|
+
))
|
|
2258
|
+
] });
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
// src/client/NamespaceCard.tsx
|
|
2262
|
+
var import_react4 = require("react");
|
|
2263
|
+
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
2264
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2126
2265
|
function namespaceCard(spec) {
|
|
2127
2266
|
return function SpecBoundNamespaceCard(props) {
|
|
2128
|
-
return /* @__PURE__ */ (0,
|
|
2267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NamespaceCard, { ...props, spec });
|
|
2129
2268
|
};
|
|
2130
2269
|
}
|
|
2131
2270
|
function isOverridden2(snap, field) {
|
|
@@ -2138,12 +2277,12 @@ function NamespaceCard(props) {
|
|
|
2138
2277
|
const snap = props.useNs((s) => s);
|
|
2139
2278
|
const t = props.t;
|
|
2140
2279
|
const spec = props.spec;
|
|
2141
|
-
const [open, setOpen] = (0,
|
|
2280
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
2142
2281
|
const canLoadCatalog = typeof props.loadCatalog === "function";
|
|
2143
|
-
const catalogStartedRef = (0,
|
|
2144
|
-
const [catalog, setCatalog] = (0,
|
|
2145
|
-
const [catalogStatus, setCatalogStatus] = (0,
|
|
2146
|
-
(0,
|
|
2282
|
+
const catalogStartedRef = (0, import_react4.useRef)(false);
|
|
2283
|
+
const [catalog, setCatalog] = (0, import_react4.useState)(void 0);
|
|
2284
|
+
const [catalogStatus, setCatalogStatus] = (0, import_react4.useState)("idle");
|
|
2285
|
+
(0, import_react4.useEffect)(() => {
|
|
2147
2286
|
if (!open || !canLoadCatalog || catalogStartedRef.current) return;
|
|
2148
2287
|
catalogStartedRef.current = true;
|
|
2149
2288
|
setCatalogStatus("loading");
|
|
@@ -2164,10 +2303,10 @@ function NamespaceCard(props) {
|
|
|
2164
2303
|
})();
|
|
2165
2304
|
}, [open, canLoadCatalog]);
|
|
2166
2305
|
const committed = snap.value ?? {};
|
|
2167
|
-
const [draft, setDraft] = (0,
|
|
2168
|
-
const [saving, setSaving] = (0,
|
|
2169
|
-
const [failed, setFailed] = (0,
|
|
2170
|
-
(0,
|
|
2306
|
+
const [draft, setDraft] = (0, import_react4.useState)({ ...committed });
|
|
2307
|
+
const [saving, setSaving] = (0, import_react4.useState)(false);
|
|
2308
|
+
const [failed, setFailed] = (0, import_react4.useState)(false);
|
|
2309
|
+
(0, import_react4.useEffect)(() => {
|
|
2171
2310
|
setDraft({ ...committed });
|
|
2172
2311
|
setFailed(false);
|
|
2173
2312
|
}, [committed]);
|
|
@@ -2211,7 +2350,7 @@ function NamespaceCard(props) {
|
|
|
2211
2350
|
const renderSelectField = (field, base) => {
|
|
2212
2351
|
const rawValue = typeof draft[field.key] === "string" ? draft[field.key] : "";
|
|
2213
2352
|
if (!canLoadCatalog || catalogStatus === "failed") {
|
|
2214
|
-
return /* @__PURE__ */ (0,
|
|
2353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2215
2354
|
TextField,
|
|
2216
2355
|
{
|
|
2217
2356
|
...base,
|
|
@@ -2222,7 +2361,7 @@ function NamespaceCard(props) {
|
|
|
2222
2361
|
);
|
|
2223
2362
|
}
|
|
2224
2363
|
if (catalogStatus !== "ready") {
|
|
2225
|
-
return /* @__PURE__ */ (0,
|
|
2364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2226
2365
|
SelectField,
|
|
2227
2366
|
{
|
|
2228
2367
|
...base,
|
|
@@ -2236,7 +2375,7 @@ function NamespaceCard(props) {
|
|
|
2236
2375
|
}
|
|
2237
2376
|
const resolved = field.options?.({ catalog, draft }) ?? [];
|
|
2238
2377
|
if (resolved.length === 0) {
|
|
2239
|
-
return /* @__PURE__ */ (0,
|
|
2378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2240
2379
|
TextField,
|
|
2241
2380
|
{
|
|
2242
2381
|
...base,
|
|
@@ -2250,7 +2389,7 @@ function NamespaceCard(props) {
|
|
|
2250
2389
|
if (rawValue !== "" && !opts.some((o) => o.value === rawValue)) {
|
|
2251
2390
|
opts.push({ value: rawValue, label: rawValue });
|
|
2252
2391
|
}
|
|
2253
|
-
return /* @__PURE__ */ (0,
|
|
2392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2254
2393
|
SelectField,
|
|
2255
2394
|
{
|
|
2256
2395
|
...base,
|
|
@@ -2260,8 +2399,8 @@ function NamespaceCard(props) {
|
|
|
2260
2399
|
}
|
|
2261
2400
|
);
|
|
2262
2401
|
};
|
|
2263
|
-
return /* @__PURE__ */ (0,
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: `${css.card}${open ? ` ${css.cardOpen}` : ""}`, children: [
|
|
2403
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2265
2404
|
"button",
|
|
2266
2405
|
{
|
|
2267
2406
|
type: "button",
|
|
@@ -2272,17 +2411,17 @@ function NamespaceCard(props) {
|
|
|
2272
2411
|
setOpen(!open);
|
|
2273
2412
|
},
|
|
2274
2413
|
children: [
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2276
|
-
/* @__PURE__ */ (0,
|
|
2277
|
-
/* @__PURE__ */ (0,
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: css.headText, children: [
|
|
2415
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css.name, children: t(spec.titleKey) }),
|
|
2416
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css.description, children: t(spec.descriptionKey) })
|
|
2278
2417
|
] }),
|
|
2279
|
-
dirty ? /* @__PURE__ */ (0,
|
|
2280
|
-
/* @__PURE__ */ (0,
|
|
2418
|
+
dirty ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: css.pending, children: t("unsaved") }) : null,
|
|
2419
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives2.IconChevronDownOutline14, { className: `${css.chevron}${open ? ` ${css.chevronOpen}` : ""}` })
|
|
2281
2420
|
]
|
|
2282
2421
|
}
|
|
2283
2422
|
),
|
|
2284
|
-
open ? /* @__PURE__ */ (0,
|
|
2285
|
-
!snap.writable ? /* @__PURE__ */ (0,
|
|
2423
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css.body, children: [
|
|
2424
|
+
!snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css.readOnly, role: "status", children: t("readOnly") }) : null,
|
|
2286
2425
|
spec.fields.map((field) => {
|
|
2287
2426
|
const label = t(field.labelKey ?? field.key);
|
|
2288
2427
|
const hint = t(field.hintKey ?? `${field.key}Hint`);
|
|
@@ -2301,7 +2440,7 @@ function NamespaceCard(props) {
|
|
|
2301
2440
|
}
|
|
2302
2441
|
};
|
|
2303
2442
|
if (field.kind === "checkbox") {
|
|
2304
|
-
return /* @__PURE__ */ (0,
|
|
2443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2305
2444
|
CheckboxField,
|
|
2306
2445
|
{
|
|
2307
2446
|
...base,
|
|
@@ -2312,7 +2451,7 @@ function NamespaceCard(props) {
|
|
|
2312
2451
|
}
|
|
2313
2452
|
if (field.kind === "number") {
|
|
2314
2453
|
const raw = draft[field.key];
|
|
2315
|
-
return /* @__PURE__ */ (0,
|
|
2454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2316
2455
|
NumberField,
|
|
2317
2456
|
{
|
|
2318
2457
|
...base,
|
|
@@ -2326,7 +2465,7 @@ function NamespaceCard(props) {
|
|
|
2326
2465
|
if (field.kind === "select") {
|
|
2327
2466
|
return renderSelectField(field, base);
|
|
2328
2467
|
}
|
|
2329
|
-
return /* @__PURE__ */ (0,
|
|
2468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2330
2469
|
TextField,
|
|
2331
2470
|
{
|
|
2332
2471
|
...base,
|
|
@@ -2335,15 +2474,113 @@ function NamespaceCard(props) {
|
|
|
2335
2474
|
}
|
|
2336
2475
|
);
|
|
2337
2476
|
}),
|
|
2338
|
-
/* @__PURE__ */ (0,
|
|
2339
|
-
failed ? /* @__PURE__ */ (0,
|
|
2340
|
-
/* @__PURE__ */ (0,
|
|
2341
|
-
/* @__PURE__ */ (0,
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: css.footer, children: [
|
|
2478
|
+
failed ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: css.failed, role: "status", children: t("saveFailed") }) : null,
|
|
2479
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: css.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
|
|
2342
2481
|
] })
|
|
2343
2482
|
] }) : null
|
|
2344
2483
|
] });
|
|
2345
2484
|
}
|
|
2346
2485
|
|
|
2486
|
+
// src/client/identity-section-store.ts
|
|
2487
|
+
var import_dsh_client_store2 = require("@deepseek-ai/dsh-client-store");
|
|
2488
|
+
var INITIAL2 = {
|
|
2489
|
+
status: "idle",
|
|
2490
|
+
error: null,
|
|
2491
|
+
soul: null,
|
|
2492
|
+
user: null,
|
|
2493
|
+
history: { soul: [], user: [] },
|
|
2494
|
+
actionError: null
|
|
2495
|
+
};
|
|
2496
|
+
var IdentitySectionController = class {
|
|
2497
|
+
constructor(api) {
|
|
2498
|
+
this.api = api;
|
|
2499
|
+
}
|
|
2500
|
+
api;
|
|
2501
|
+
/** Page snapshot the renderer subscribes to. */
|
|
2502
|
+
store = (0, import_dsh_client_store2.createSnapshotStore)(INITIAL2);
|
|
2503
|
+
/** Guards against overlapping loads painting partial results. */
|
|
2504
|
+
seq = 0;
|
|
2505
|
+
set(patch) {
|
|
2506
|
+
this.store.set({ ...this.store.getSnapshot(), ...patch });
|
|
2507
|
+
}
|
|
2508
|
+
requireApi() {
|
|
2509
|
+
if (this.api === void 0) throw new Error("the memory remote namespace is not mounted on this connection");
|
|
2510
|
+
return this.api;
|
|
2511
|
+
}
|
|
2512
|
+
/**
|
|
2513
|
+
* Full load: both current records plus both histories. Used on section
|
|
2514
|
+
* open, manual retry, connection recovery, and after every revert.
|
|
2515
|
+
* @returns once the snapshot reflects the host.
|
|
2516
|
+
*/
|
|
2517
|
+
async load() {
|
|
2518
|
+
const ticket = ++this.seq;
|
|
2519
|
+
if (this.store.getSnapshot().status === "idle") this.set({ status: "loading" });
|
|
2520
|
+
try {
|
|
2521
|
+
const api = this.requireApi();
|
|
2522
|
+
if (typeof api.identityList !== "function" || typeof api.identityHistory !== "function") {
|
|
2523
|
+
if (ticket !== this.seq) return;
|
|
2524
|
+
this.set({ status: "ready", error: null });
|
|
2525
|
+
return;
|
|
2526
|
+
}
|
|
2527
|
+
const [records, soulHistory, userHistory] = await Promise.all([
|
|
2528
|
+
api.identityList(),
|
|
2529
|
+
api.identityHistory({ kind: "soul" }),
|
|
2530
|
+
api.identityHistory({ kind: "user" })
|
|
2531
|
+
]);
|
|
2532
|
+
if (!records.result.ok) throw new Error(records.result.error.message);
|
|
2533
|
+
if (!soulHistory.result.ok) throw new Error(soulHistory.result.error.message);
|
|
2534
|
+
if (!userHistory.result.ok) throw new Error(userHistory.result.error.message);
|
|
2535
|
+
if (ticket !== this.seq) return;
|
|
2536
|
+
this.set({
|
|
2537
|
+
status: "ready",
|
|
2538
|
+
error: null,
|
|
2539
|
+
soul: records.result.value.soul ?? null,
|
|
2540
|
+
user: records.result.value.user ?? null,
|
|
2541
|
+
history: { soul: soulHistory.result.value.history, user: userHistory.result.value.history }
|
|
2542
|
+
});
|
|
2543
|
+
} catch (error) {
|
|
2544
|
+
if (ticket !== this.seq) return;
|
|
2545
|
+
this.set({ status: "error", error: messageOf2(error) });
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
/**
|
|
2549
|
+
* The governance valve: restore one retained version as the newest (the
|
|
2550
|
+
* history is never destroyed — the restore lands as a fresh version). A
|
|
2551
|
+
* refusal (revert disabled on the deployment) or failure surfaces in
|
|
2552
|
+
* `actionError`; success repaints from a full reload.
|
|
2553
|
+
*/
|
|
2554
|
+
async revert(kind, version) {
|
|
2555
|
+
try {
|
|
2556
|
+
const api = this.requireApi();
|
|
2557
|
+
if (typeof api.identityRevert !== "function") {
|
|
2558
|
+
this.set({ actionError: "identity revert is not available on this deployment" });
|
|
2559
|
+
return false;
|
|
2560
|
+
}
|
|
2561
|
+
const response = await api.identityRevert({ kind, version });
|
|
2562
|
+
if (!response.result.ok) {
|
|
2563
|
+
this.set({ actionError: response.result.error.message });
|
|
2564
|
+
return false;
|
|
2565
|
+
}
|
|
2566
|
+
const record = response.result.value.reverted;
|
|
2567
|
+
if (record === void 0) {
|
|
2568
|
+
this.set({ actionError: response.result.value.error ?? "revert failed" });
|
|
2569
|
+
return false;
|
|
2570
|
+
}
|
|
2571
|
+
this.set({ actionError: null });
|
|
2572
|
+
await this.load();
|
|
2573
|
+
return true;
|
|
2574
|
+
} catch (error) {
|
|
2575
|
+
this.set({ actionError: messageOf2(error) });
|
|
2576
|
+
return false;
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
};
|
|
2580
|
+
function messageOf2(error) {
|
|
2581
|
+
return error instanceof Error ? error.message : String(error);
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2347
2584
|
// src/client/model-catalog.ts
|
|
2348
2585
|
var PROVIDER_FIELD = "extractionModelProvider";
|
|
2349
2586
|
function catalogLabel(name, id) {
|
|
@@ -2405,6 +2642,8 @@ var en = {
|
|
|
2405
2642
|
customPolicyHint: 'Used only when memory mode is "custom".',
|
|
2406
2643
|
charLimit: "Memory character limit",
|
|
2407
2644
|
charLimitHint: "Character budget for the frozen memory content snapshot.",
|
|
2645
|
+
digestCharLimit: "Digest character limit",
|
|
2646
|
+
digestCharLimitHint: "Character budget for the one-time store inventory message in digest mode (0 = off).",
|
|
2408
2647
|
memoryMaxEntries: "Max injected entries",
|
|
2409
2648
|
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.",
|
|
2410
2649
|
maxSearchResults: "Max search results",
|
|
@@ -2416,19 +2655,32 @@ var en = {
|
|
|
2416
2655
|
notesCardDescription: "Inject conventions and a pitfall log into the prompt; entries are managed in the Memory section.",
|
|
2417
2656
|
notesEnabled: "Project notes",
|
|
2418
2657
|
notesEnabledHint: "Inject conventions and the pitfall log into the system prompt (no repo files; manage entries in the Memory section).",
|
|
2419
|
-
|
|
2420
|
-
|
|
2658
|
+
notesConventionsCharLimit: "Conventions character limit",
|
|
2659
|
+
notesConventionsCharLimitHint: "Character budget for the conventions half of the notes section (blank = default 1600); budgeted at freeze time.",
|
|
2660
|
+
notesPitfallsCharLimit: "Pitfalls character limit",
|
|
2661
|
+
notesPitfallsCharLimitHint: "Character budget for the pitfall log half of the notes section (blank = default 800); budgeted at freeze time.",
|
|
2421
2662
|
notesMaxEntriesPerFile: "Max rendered entries",
|
|
2422
|
-
notesMaxEntriesPerFileHint: "Entry cap for the injected notes;
|
|
2663
|
+
notesMaxEntriesPerFileHint: "Entry cap for the injected notes; squeezed entries fold into a count line pointing at memory_search.",
|
|
2423
2664
|
// Auto recall card (memory namespace).
|
|
2424
2665
|
autoRecallCardTitle: "Auto Recall",
|
|
2425
2666
|
autoRecallCardDescription: "Append a per-step recalled-memory block from a store search; the system prompt stays untouched.",
|
|
2426
2667
|
autoRecallEnabled: "Auto recall",
|
|
2427
|
-
autoRecallEnabledHint: "On each agent step, search the store for the step's user text and append a fenced recalled-memory message.",
|
|
2668
|
+
autoRecallEnabledHint: "On each agent step, search the store for the step's user text and append a fenced recalled-memory message (stamps recency only, never access counts). On by default.",
|
|
2428
2669
|
autoRecallLimit: "Recall entry limit",
|
|
2429
2670
|
autoRecallLimitHint: "Maximum entries in one auto-recall fence; minimum 1.",
|
|
2430
2671
|
autoRecallMinChars: "Recall trigger length",
|
|
2431
2672
|
autoRecallMinCharsHint: "Skip recall when the step's user text is shorter than this many characters.",
|
|
2673
|
+
// Identity card (memory namespace).
|
|
2674
|
+
identityCardTitle: "Identity",
|
|
2675
|
+
identityCardDescription: "The assistant's self-documents: enable the layer, set the injection budgets, point at custom seed files.",
|
|
2676
|
+
identityEnabled: "Identity layer",
|
|
2677
|
+
identityEnabledHint: "Inject the soul and user-profile prompt sections and expose the identity_update tool; the documents themselves stay read-only, governed in the Identity settings section. Off by default.",
|
|
2678
|
+
soulCharLimit: "Soul character limit",
|
|
2679
|
+
soulCharLimitHint: "Character budget for the injected soul section (0 = disabled).",
|
|
2680
|
+
userCharLimit: "User-profile character limit",
|
|
2681
|
+
userCharLimitHint: "Character budget for the injected user-profile section (0 = disabled).",
|
|
2682
|
+
identitySeedDir: "Seed directory",
|
|
2683
|
+
identitySeedDirHint: "Optional directory holding custom SOUL.md / USER.md seeds; empty uses the builtin seeds. Checked at load when the layer is enabled.",
|
|
2432
2684
|
// Review extraction card (memory-review namespace).
|
|
2433
2685
|
reviewCardTitle: "Automatic Extraction",
|
|
2434
2686
|
reviewCardDescription: "When conversations are distilled into durable memory, which model runs it, and how oversized entries get re-summarized.",
|
|
@@ -2550,7 +2802,23 @@ var en = {
|
|
|
2550
2802
|
editCategory: "Category",
|
|
2551
2803
|
noCategory: "(no category)",
|
|
2552
2804
|
editSummary: "Summary",
|
|
2553
|
-
editSummaryPlaceholder: "Short summary for index views (optional)"
|
|
2805
|
+
editSummaryPlaceholder: "Short summary for index views (optional)",
|
|
2806
|
+
// ── Identity governance section (Settings → Identity) ──
|
|
2807
|
+
identityNav: "Identity",
|
|
2808
|
+
identitySectionIntro: "These two documents are maintained by the assistant itself, through conversation: SOUL.md is its character, USER.md is its understanding of you. This page is read-only \u2014 you can review the version history, revert to any retained version, or export the text. The content itself is written by the assistant through the identity_update tool.",
|
|
2809
|
+
identitySoulTitle: "SOUL.md \u2014 the assistant's character",
|
|
2810
|
+
identitySoulEmpty: "Not written yet. Once the identity layer is enabled (the Identity card in plugin configuration), the assistant seeds and grows this document through conversation.",
|
|
2811
|
+
identityUserTitle: "USER.md \u2014 the assistant's understanding of you",
|
|
2812
|
+
identityUserEmpty: "Not written yet. Once the identity layer is enabled (the Identity card in plugin configuration), the assistant accumulates its understanding of you here, naturally, without interrogating.",
|
|
2813
|
+
identityCurrentVersion: "Current: v{version}",
|
|
2814
|
+
identityHistoryTitle: "Version history (newest first; revert restores a version as a NEW one)",
|
|
2815
|
+
identityEmptyHistory: "No retained history yet.",
|
|
2816
|
+
identityRevertBtn: "Revert to this version",
|
|
2817
|
+
identityRevertConfirm: "Confirm revert?",
|
|
2818
|
+
identityExport: "Export",
|
|
2819
|
+
identitySourceSeed: "seeded",
|
|
2820
|
+
identitySourceTool: "assistant write",
|
|
2821
|
+
identitySourceUi: "revert"
|
|
2554
2822
|
};
|
|
2555
2823
|
var zh = {
|
|
2556
2824
|
// Card chrome
|
|
@@ -2580,6 +2848,8 @@ var zh = {
|
|
|
2580
2848
|
customPolicyHint: '\u4EC5\u5728\u8BB0\u5FC6\u6A21\u5F0F\u4E3A "custom" \u65F6\u4F7F\u7528\u3002',
|
|
2581
2849
|
charLimit: "\u8BB0\u5FC6\u5B57\u7B26\u4E0A\u9650",
|
|
2582
2850
|
charLimitHint: "\u51BB\u7ED3\u8BB0\u5FC6\u5185\u5BB9\u5FEB\u7167\u7684\u5B57\u7B26\u9884\u7B97\u3002",
|
|
2851
|
+
digestCharLimit: "\u6E05\u5355\u5B57\u7B26\u4E0A\u9650",
|
|
2852
|
+
digestCharLimitHint: "digest \u6A21\u5F0F\u4E0B\u4E00\u6B21\u6027\u5E93\u5B58\u6E05\u5355\u6D88\u606F\u7684\u5B57\u7B26\u9884\u7B97\uFF080 = \u5173\u95ED\uFF09\u3002",
|
|
2583
2853
|
memoryMaxEntries: "\u6700\u5927\u6CE8\u5165\u6761\u6570",
|
|
2584
2854
|
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",
|
|
2585
2855
|
maxSearchResults: "\u6700\u5927\u641C\u7D22\u7ED3\u679C\u6570",
|
|
@@ -2591,19 +2861,32 @@ var zh = {
|
|
|
2591
2861
|
notesCardDescription: "\u628A\u7F16\u7801\u7EA6\u5B9A\u4E0E\u8E29\u5751\u65E5\u5FD7\u6CE8\u5165\u7CFB\u7EDF\u63D0\u793A\u8BCD\uFF1B\u6761\u76EE\u5728 Memory \u5206\u533A\u4E2D\u7BA1\u7406\u3002",
|
|
2592
2862
|
notesEnabled: "\u9879\u76EE\u7B14\u8BB0",
|
|
2593
2863
|
notesEnabledHint: "\u628A\u7F16\u7801\u7EA6\u5B9A\u4E0E\u8E29\u5751\u65E5\u5FD7\u6CE8\u5165\u7CFB\u7EDF\u63D0\u793A\u8BCD\uFF08\u4E0D\u5199\u4ED3\u5E93\u6587\u4EF6\uFF1B\u6761\u76EE\u5728 Memory \u5206\u533A\u4E2D\u7BA1\u7406\uFF09\u3002",
|
|
2594
|
-
|
|
2595
|
-
|
|
2864
|
+
notesConventionsCharLimit: "\u7EA6\u5B9A\u5B57\u7B26\u4E0A\u9650",
|
|
2865
|
+
notesConventionsCharLimitHint: "\u9879\u76EE\u7B14\u8BB0\u300C\u7EA6\u5B9A\u300D\u534A\u533A\u7684\u5B57\u7B26\u9884\u7B97\uFF08\u7559\u7A7A = \u9ED8\u8BA4 1600\uFF09\uFF1B\u51BB\u7ED3\u65F6\u5E94\u7528\u3002",
|
|
2866
|
+
notesPitfallsCharLimit: "\u8E29\u5751\u5B57\u7B26\u4E0A\u9650",
|
|
2867
|
+
notesPitfallsCharLimitHint: "\u9879\u76EE\u7B14\u8BB0\u300C\u8E29\u5751\u300D\u534A\u533A\u7684\u5B57\u7B26\u9884\u7B97\uFF08\u7559\u7A7A = \u9ED8\u8BA4 800\uFF09\uFF1B\u51BB\u7ED3\u65F6\u5E94\u7528\u3002",
|
|
2596
2868
|
notesMaxEntriesPerFile: "\u6700\u5927\u6E32\u67D3\u6761\u76EE\u6570",
|
|
2597
|
-
notesMaxEntriesPerFileHint: "\u6CE8\u5165\u7B14\u8BB0\u7684\u6761\u76EE\u4E0A\u9650\
|
|
2869
|
+
notesMaxEntriesPerFileHint: "\u6CE8\u5165\u7B14\u8BB0\u7684\u6761\u76EE\u4E0A\u9650\uFF1B\u88AB\u6324\u51FA\u7684\u6761\u76EE\u6298\u53E0\u4E3A\u6307\u5411 memory_search \u7684\u8BA1\u6570\u884C\u3002",
|
|
2598
2870
|
// 自动召回卡片(memory 命名空间)
|
|
2599
2871
|
autoRecallCardTitle: "\u81EA\u52A8\u53EC\u56DE",
|
|
2600
2872
|
autoRecallCardDescription: "\u6BCF\u4E2A\u6B65\u9AA4\u68C0\u7D22\u8BB0\u5FC6\u5E93\u5E76\u8FFD\u52A0\u53EC\u56DE\u5757\uFF0C\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4FDD\u6301\u4E0D\u53D8\u3002",
|
|
2601
2873
|
autoRecallEnabled: "\u6B65\u7EA7\u81EA\u52A8\u53EC\u56DE",
|
|
2602
|
-
autoRecallEnabledHint: "\u5728\u6BCF\u4E2A\u6B65\u9AA4\u6309\u7528\u6237\u6587\u672C\u68C0\u7D22\u8BB0\u5FC6\u5E93\uFF0C\u8FFD\u52A0\u4E00\u6BB5\u56F4\u680F\u53EC\u56DE\u6D88\u606F\uFF1B\u4E0D\
|
|
2874
|
+
autoRecallEnabledHint: "\u5728\u6BCF\u4E2A\u6B65\u9AA4\u6309\u7528\u6237\u6587\u672C\u68C0\u7D22\u8BB0\u5FC6\u5E93\uFF0C\u8FFD\u52A0\u4E00\u6BB5\u56F4\u680F\u53EC\u56DE\u6D88\u606F\uFF1B\u53EA\u5237\u65B0\u6700\u8FD1\u53EC\u56DE\u65F6\u95F4\uFF0C\u4E0D\u8BA1\u5165\u8BBF\u95EE\u8BA1\u6570\u3002\u9ED8\u8BA4\u5F00\u542F\u3002",
|
|
2603
2875
|
autoRecallLimit: "\u5355\u6B21\u53EC\u56DE\u6761\u6570\u4E0A\u9650",
|
|
2604
2876
|
autoRecallLimitHint: "\u4E00\u6B21\u81EA\u52A8\u53EC\u56DE\u6700\u591A\u9644\u5E26\u7684\u6761\u76EE\u6570\uFF0C\u6700\u5C0F\u4E3A 1\u3002",
|
|
2605
2877
|
autoRecallMinChars: "\u89E6\u53D1\u6700\u5C0F\u6587\u672C\u957F\u5EA6",
|
|
2606
2878
|
autoRecallMinCharsHint: "\u6B65\u9AA4\u7528\u6237\u6587\u672C\u77ED\u4E8E\u8BE5\u5B57\u7B26\u6570\u65F6\u8DF3\u8FC7\u53EC\u56DE\u3002",
|
|
2879
|
+
// 身份卡片(memory 命名空间)
|
|
2880
|
+
identityCardTitle: "\u8EAB\u4EFD",
|
|
2881
|
+
identityCardDescription: "AI \u7684\u81EA\u6211\u6587\u6863\uFF1A\u5F00\u542F\u8EAB\u4EFD\u5C42\u3001\u8BBE\u5B9A\u6CE8\u5165\u9884\u7B97\u3001\u6307\u5B9A\u81EA\u5B9A\u4E49\u79CD\u5B50\u6587\u4EF6\u3002",
|
|
2882
|
+
identityEnabled: "\u8EAB\u4EFD\u5C42",
|
|
2883
|
+
identityEnabledHint: "\u6CE8\u5165 soul \u4E0E user-profile \u63D0\u793A\u6BB5\u5E76\u5F00\u653E identity_update \u5DE5\u5177\uFF1B\u6587\u6863\u672C\u8EAB\u4FDD\u6301\u53EA\u8BFB\uFF0C\u5728\u300C\u8EAB\u4EFD\u300D\u8BBE\u7F6E\u533A\u6CBB\u7406\u3002\u9ED8\u8BA4\u5173\u95ED\u3002",
|
|
2884
|
+
soulCharLimit: "\u4EBA\u683C\u5B57\u7B26\u4E0A\u9650",
|
|
2885
|
+
soulCharLimitHint: "\u6CE8\u5165\u7684 soul \u6BB5\u7684\u5B57\u7B26\u9884\u7B97\uFF080 = \u7981\u7528\uFF09\u3002",
|
|
2886
|
+
userCharLimit: "\u7528\u6237\u753B\u50CF\u5B57\u7B26\u4E0A\u9650",
|
|
2887
|
+
userCharLimitHint: "\u6CE8\u5165\u7684 user-profile \u6BB5\u7684\u5B57\u7B26\u9884\u7B97\uFF080 = \u7981\u7528\uFF09\u3002",
|
|
2888
|
+
identitySeedDir: "\u79CD\u5B50\u76EE\u5F55",
|
|
2889
|
+
identitySeedDirHint: "\u53EF\u9009\u7684\u81EA\u5B9A\u4E49 SOUL.md / USER.md \u79CD\u5B50\u76EE\u5F55\uFF1B\u7559\u7A7A\u4F7F\u7528\u5185\u7F6E\u79CD\u5B50\u3002\u5F00\u542F\u8EAB\u4EFD\u5C42\u65F6\u88C5\u8F7D\u671F\u6821\u9A8C\u3002",
|
|
2607
2890
|
// 自动提取卡片(memory-review 命名空间)
|
|
2608
2891
|
reviewCardTitle: "\u81EA\u52A8\u63D0\u53D6",
|
|
2609
2892
|
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",
|
|
@@ -2725,7 +3008,23 @@ var zh = {
|
|
|
2725
3008
|
editCategory: "\u7C7B\u522B",
|
|
2726
3009
|
noCategory: "\uFF08\u65E0\u7C7B\u522B\uFF09",
|
|
2727
3010
|
editSummary: "\u6458\u8981",
|
|
2728
|
-
editSummaryPlaceholder: "\u7D22\u5F15\u89C6\u56FE\u7528\u7684\u77ED\u6458\u8981\uFF08\u53EF\u9009\uFF09"
|
|
3011
|
+
editSummaryPlaceholder: "\u7D22\u5F15\u89C6\u56FE\u7528\u7684\u77ED\u6458\u8981\uFF08\u53EF\u9009\uFF09",
|
|
3012
|
+
// ── 身份治理 section(Settings → Identity)──
|
|
3013
|
+
identityNav: "\u8EAB\u4EFD",
|
|
3014
|
+
identitySectionIntro: "\u8FD9\u4E24\u4EFD\u6587\u6863\u7531 AI \u5728\u5BF9\u8BDD\u4E2D\u81EA\u5DF1\u7EF4\u62A4\uFF1ASOUL.md \u662F\u5B83\u7684\u4EBA\u683C\uFF0CUSER.md \u662F\u5B83\u5BF9\u4F60\u7684\u4E86\u89E3\u3002\u672C\u9875\u53EA\u8BFB\u2014\u2014\u4F60\u53EF\u4EE5\u67E5\u770B\u7248\u672C\u5386\u53F2\u3001\u56DE\u6EDA\u5230\u4EFB\u610F\u4FDD\u7559\u7248\u672C\u3001\u6216\u5BFC\u51FA\u6587\u672C\uFF1B\u5185\u5BB9\u672C\u8EAB\u7531 AI \u901A\u8FC7 identity_update \u5DE5\u5177\u4E66\u5199\u3002",
|
|
3015
|
+
identitySoulTitle: "SOUL.md \u2014 AI \u7684\u4EBA\u683C",
|
|
3016
|
+
identitySoulEmpty: "\u5C1A\u672A\u751F\u6210\u3002\u5728\u63D2\u4EF6\u914D\u7F6E\u7684\u300C\u8EAB\u4EFD\u300D\u5361\u7247\u4E2D\u5F00\u542F\u8EAB\u4EFD\u5C42\u540E\uFF0CAI \u4F1A\u5728\u5BF9\u8BDD\u4E2D\u64AD\u79CD\u5E76\u751F\u957F\u8FD9\u4EFD\u6587\u6863\u3002",
|
|
3017
|
+
identityUserTitle: "USER.md \u2014 AI \u5BF9\u4F60\u7684\u4E86\u89E3",
|
|
3018
|
+
identityUserEmpty: "\u5C1A\u672A\u751F\u6210\u3002\u5728\u63D2\u4EF6\u914D\u7F6E\u7684\u300C\u8EAB\u4EFD\u300D\u5361\u7247\u4E2D\u5F00\u542F\u8EAB\u4EFD\u5C42\u540E\uFF0CAI \u4F1A\u5728\u8FD9\u91CC\u81EA\u7136\u5730\u79EF\u7D2F\u5BF9\u4F60\u7684\u4E86\u89E3\uFF0C\u4E0D\u523B\u610F\u8FFD\u95EE\u3002",
|
|
3019
|
+
identityCurrentVersion: "\u5F53\u524D\u7248\u672C\uFF1Av{version}",
|
|
3020
|
+
identityHistoryTitle: "\u7248\u672C\u5386\u53F2\uFF08\u65B0\u7248\u672C\u5728\u524D\uFF1B\u56DE\u6EDA\u4F1A\u628A\u6240\u9009\u7248\u672C\u6062\u590D\u4E3A\u4E00\u4E2A\u65B0\u7248\u672C\uFF09",
|
|
3021
|
+
identityEmptyHistory: "\u6682\u65E0\u4FDD\u7559\u7684\u5386\u53F2\u7248\u672C\u3002",
|
|
3022
|
+
identityRevertBtn: "\u56DE\u6EDA\u5230\u6B64\u7248\u672C",
|
|
3023
|
+
identityRevertConfirm: "\u786E\u8BA4\u56DE\u6EDA\uFF1F",
|
|
3024
|
+
identityExport: "\u5BFC\u51FA",
|
|
3025
|
+
identitySourceSeed: "\u521D\u59CB\u79CD\u5B50",
|
|
3026
|
+
identitySourceTool: "AI \u5199\u5165",
|
|
3027
|
+
identitySourceUi: "\u56DE\u6EDA"
|
|
2729
3028
|
};
|
|
2730
3029
|
|
|
2731
3030
|
// src/client/index.ts
|
|
@@ -2734,8 +3033,9 @@ var NOTES_SPEC = {
|
|
|
2734
3033
|
descriptionKey: "notesCardDescription",
|
|
2735
3034
|
fields: [
|
|
2736
3035
|
{ key: "notesEnabled", kind: "checkbox" },
|
|
2737
|
-
{ key: "
|
|
2738
|
-
{ key: "
|
|
3036
|
+
{ key: "notesConventionsCharLimit", kind: "number", minValue: 0 },
|
|
3037
|
+
{ key: "notesPitfallsCharLimit", kind: "number", minValue: 0 },
|
|
3038
|
+
{ key: "notesMaxEntriesPerFile", kind: "number", minValue: 0 }
|
|
2739
3039
|
]
|
|
2740
3040
|
};
|
|
2741
3041
|
var AUTORECALL_SPEC = {
|
|
@@ -2749,6 +3049,16 @@ var AUTORECALL_SPEC = {
|
|
|
2749
3049
|
{ key: "hitSignalThreshold", kind: "number", minValue: 0, labelKey: "hitSignalThreshold", hintKey: "hitSignalThresholdHint" }
|
|
2750
3050
|
]
|
|
2751
3051
|
};
|
|
3052
|
+
var IDENTITY_SPEC = {
|
|
3053
|
+
titleKey: "identityCardTitle",
|
|
3054
|
+
descriptionKey: "identityCardDescription",
|
|
3055
|
+
fields: [
|
|
3056
|
+
{ key: "identityEnabled", kind: "checkbox" },
|
|
3057
|
+
{ key: "soulCharLimit", kind: "number", minValue: 0 },
|
|
3058
|
+
{ key: "userCharLimit", kind: "number", minValue: 0 },
|
|
3059
|
+
{ key: "identitySeedDir", kind: "text" }
|
|
3060
|
+
]
|
|
3061
|
+
};
|
|
2752
3062
|
var PROVIDER_FIELD2 = "extractionModelProvider";
|
|
2753
3063
|
var REVIEW_SPEC = {
|
|
2754
3064
|
titleKey: "reviewCardTitle",
|
|
@@ -2792,10 +3102,12 @@ var REVIEW_SPEC = {
|
|
|
2792
3102
|
var inject3 = ["slots", "locale", "connection", "settingsScope"];
|
|
2793
3103
|
var NS = "settings.memory";
|
|
2794
3104
|
var SECTION_ORDER = 25;
|
|
3105
|
+
var IDENTITY_SECTION_ORDER = 26;
|
|
2795
3106
|
var CARDS = [
|
|
2796
3107
|
{ key: "memory" },
|
|
2797
|
-
{ key: "memory-notes",
|
|
2798
|
-
{ key: "memory-autorecall",
|
|
3108
|
+
{ key: "memory-notes", spec: NOTES_SPEC },
|
|
3109
|
+
{ key: "memory-autorecall", spec: AUTORECALL_SPEC },
|
|
3110
|
+
{ key: "memory-identity", spec: IDENTITY_SPEC },
|
|
2799
3111
|
{ key: "memory-review", spec: REVIEW_SPEC }
|
|
2800
3112
|
];
|
|
2801
3113
|
function createMemoryRemoteApi(connection) {
|
|
@@ -2834,7 +3146,10 @@ function createMemoryRemoteApi(connection) {
|
|
|
2834
3146
|
archive: (request) => invoke("archive", request),
|
|
2835
3147
|
suggestList: () => invoke("suggestList"),
|
|
2836
3148
|
suggestAdopt: (request) => invoke("suggestAdopt", request),
|
|
2837
|
-
suggestReject: (request) => invoke("suggestReject", request)
|
|
3149
|
+
suggestReject: (request) => invoke("suggestReject", request),
|
|
3150
|
+
identityList: () => invoke("identityList"),
|
|
3151
|
+
identityHistory: (request) => invoke("identityHistory", request),
|
|
3152
|
+
identityRevert: (request) => invoke("identityRevert", request)
|
|
2838
3153
|
};
|
|
2839
3154
|
}
|
|
2840
3155
|
function createCatalogLoader(connection) {
|
|
@@ -2849,16 +3164,18 @@ function apply(ctx) {
|
|
|
2849
3164
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-memory: locale dictionaries");
|
|
2850
3165
|
const connection = ctx.get("connection");
|
|
2851
3166
|
const loadCatalog = createCatalogLoader(connection);
|
|
2852
|
-
const
|
|
3167
|
+
const remoteApi = createMemoryRemoteApi(connection);
|
|
3168
|
+
const controller = new MemorySectionController(remoteApi);
|
|
3169
|
+
const identityController = new IdentitySectionController(remoteApi);
|
|
2853
3170
|
ctx.effect(() => {
|
|
2854
3171
|
return ctx.on("connection/reset", () => {
|
|
2855
3172
|
void controller.load();
|
|
3173
|
+
void identityController.load();
|
|
2856
3174
|
});
|
|
2857
3175
|
}, "dsh-memory: memory section reload on reconnect");
|
|
2858
3176
|
ctx.slots.inject("settings.plugin.item", function* () {
|
|
2859
3177
|
for (const card of CARDS) {
|
|
2860
|
-
const
|
|
2861
|
-
const scope = ctx.settingsScope.bind({ namespace: ns });
|
|
3178
|
+
const scope = ctx.settingsScope.bind({ namespace: card.key });
|
|
2862
3179
|
if (card.spec === void 0) {
|
|
2863
3180
|
const typed = scope;
|
|
2864
3181
|
const injected3 = () => ({
|
|
@@ -2925,6 +3242,19 @@ function apply(ctx) {
|
|
|
2925
3242
|
locale: NS,
|
|
2926
3243
|
inject: sectionInjected
|
|
2927
3244
|
}, MemorySection));
|
|
3245
|
+
const identityInjected = () => ({
|
|
3246
|
+
hooks: { identitySection: identityController.store },
|
|
3247
|
+
load: () => identityController.load(),
|
|
3248
|
+
revert: (kind, version) => identityController.revert(kind, version)
|
|
3249
|
+
});
|
|
3250
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
3251
|
+
name: "settings.section",
|
|
3252
|
+
id: "identity",
|
|
3253
|
+
order: IDENTITY_SECTION_ORDER,
|
|
3254
|
+
label: () => ctx.locale.bind(NS)("identityNav"),
|
|
3255
|
+
locale: NS,
|
|
3256
|
+
inject: identityInjected
|
|
3257
|
+
}, IdentitySection));
|
|
2928
3258
|
}
|
|
2929
3259
|
|
|
2930
3260
|
|