@chenhw7/dsh-memory 0.1.3 → 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 +102 -120
- package/README.zh-CN.md +104 -119
- package/cordis.patch.yml +13 -8
- package/lib/client/index.js +1591 -195
- package/lib/context/conflict.d.ts +19 -2
- package/lib/context/conflict.d.ts.map +1 -1
- package/lib/context/conflict.js +33 -0
- package/lib/context/conflict.js.map +1 -1
- package/lib/context/index.d.ts +34 -10
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +195 -24
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +28 -1
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +60 -3
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +27 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -0
- package/lib/index.js.map +1 -1
- package/lib/notes/index.d.ts +66 -0
- package/lib/notes/index.d.ts.map +1 -0
- package/lib/notes/index.js +180 -0
- package/lib/notes/index.js.map +1 -0
- package/lib/notes/render.d.ts +32 -0
- package/lib/notes/render.d.ts.map +1 -0
- package/lib/notes/render.js +68 -0
- package/lib/notes/render.js.map +1 -0
- package/lib/notes/scope.d.ts +35 -0
- package/lib/notes/scope.d.ts.map +1 -0
- package/lib/notes/scope.js +44 -0
- package/lib/notes/scope.js.map +1 -0
- package/lib/notes/settings.d.ts +35 -0
- package/lib/notes/settings.d.ts.map +1 -0
- package/lib/notes/settings.js +36 -0
- package/lib/notes/settings.js.map +1 -0
- package/lib/notes/writer.d.ts +32 -0
- package/lib/notes/writer.d.ts.map +1 -0
- package/lib/notes/writer.js +71 -0
- package/lib/notes/writer.js.map +1 -0
- 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/lib/review/accumulator.d.ts +53 -18
- package/lib/review/accumulator.d.ts.map +1 -1
- package/lib/review/accumulator.js +176 -36
- package/lib/review/accumulator.js.map +1 -1
- package/lib/review/dedup.d.ts +16 -3
- package/lib/review/dedup.d.ts.map +1 -1
- package/lib/review/dedup.js +21 -4
- package/lib/review/dedup.js.map +1 -1
- package/lib/review/extract.d.ts +81 -5
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +224 -31
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts +15 -2
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +137 -55
- package/lib/review/index.js.map +1 -1
- package/lib/scanner.d.ts +15 -0
- package/lib/scanner.d.ts.map +1 -1
- package/lib/scanner.js +20 -0
- package/lib/scanner.js.map +1 -1
- package/lib/store/bm25.d.ts +48 -0
- package/lib/store/bm25.d.ts.map +1 -0
- package/lib/store/bm25.js +115 -0
- package/lib/store/bm25.js.map +1 -0
- package/lib/store/index.d.ts +26 -3
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +111 -68
- package/lib/store/index.js.map +1 -1
- package/lib/tool/index.d.ts +3 -1
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +52 -9
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +17 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +44 -30
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
|
|
|
@@ -417,18 +417,129 @@ var cls = {
|
|
|
417
417
|
};
|
|
418
418
|
var css = (inject(), cls);
|
|
419
419
|
|
|
420
|
-
// src/client/
|
|
420
|
+
// src/client/fields.tsx
|
|
421
421
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
422
|
+
function FieldHead(props) {
|
|
423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.head, children: [
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: css.label, htmlFor: props.id, children: props.label }),
|
|
425
|
+
props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.badges, children: [
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: props.overriddenLabel }),
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.reset, disabled: props.disabled, onClick: props.onReset, children: props.resetLabel })
|
|
428
|
+
] }) : null
|
|
429
|
+
] });
|
|
430
|
+
}
|
|
431
|
+
function SelectField(props) {
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.field, children: [
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldHead, { ...props }),
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
435
|
+
"select",
|
|
436
|
+
{
|
|
437
|
+
id: props.id,
|
|
438
|
+
className: css.select,
|
|
439
|
+
value: props.value,
|
|
440
|
+
disabled: props.disabled,
|
|
441
|
+
onChange: (e) => props.onChange(e.target.value),
|
|
442
|
+
children: props.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.hint, children: props.hint })
|
|
446
|
+
] });
|
|
447
|
+
}
|
|
448
|
+
function TextField(props) {
|
|
449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.field, children: [
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldHead, { ...props }),
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
452
|
+
"input",
|
|
453
|
+
{
|
|
454
|
+
id: props.id,
|
|
455
|
+
className: css.input,
|
|
456
|
+
type: "text",
|
|
457
|
+
value: props.value,
|
|
458
|
+
disabled: props.disabled,
|
|
459
|
+
onChange: (e) => props.onChange(e.target.value)
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.hint, children: props.hint })
|
|
463
|
+
] });
|
|
464
|
+
}
|
|
465
|
+
function NumberField(props) {
|
|
466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.field, children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldHead, { ...props }),
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
469
|
+
"input",
|
|
470
|
+
{
|
|
471
|
+
id: props.id,
|
|
472
|
+
className: props.invalid ? css.inputInvalid : css.input,
|
|
473
|
+
type: "text",
|
|
474
|
+
inputMode: "numeric",
|
|
475
|
+
...props.invalid ? { "aria-invalid": true } : {},
|
|
476
|
+
value: String(props.value),
|
|
477
|
+
disabled: props.disabled,
|
|
478
|
+
onChange: (e) => props.onChange(e.target.value)
|
|
479
|
+
}
|
|
480
|
+
),
|
|
481
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: props.invalid ? css.invalid : css.hint, children: props.invalid ? props.invalidLabel : props.hint })
|
|
482
|
+
] });
|
|
483
|
+
}
|
|
484
|
+
function CheckboxField(props) {
|
|
485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.field, children: [
|
|
486
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.head, children: [
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.checkRow, children: [
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
489
|
+
"input",
|
|
490
|
+
{
|
|
491
|
+
id: props.id,
|
|
492
|
+
type: "checkbox",
|
|
493
|
+
className: css.checkbox,
|
|
494
|
+
checked: props.checked,
|
|
495
|
+
disabled: props.disabled,
|
|
496
|
+
onChange: (e) => props.onChange(e.target.checked)
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: css.checkLabel, htmlFor: props.id, children: props.label })
|
|
500
|
+
] }),
|
|
501
|
+
props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.badges, children: [
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: props.overriddenLabel }),
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.reset, disabled: props.disabled, onClick: props.onReset, children: props.resetLabel })
|
|
504
|
+
] }) : null
|
|
505
|
+
] }),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.hint, children: props.hint })
|
|
507
|
+
] });
|
|
508
|
+
}
|
|
509
|
+
function TextareaField(props) {
|
|
510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: css.field, children: [
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldHead, { ...props }),
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
513
|
+
"textarea",
|
|
514
|
+
{
|
|
515
|
+
id: props.id,
|
|
516
|
+
className: css.textarea,
|
|
517
|
+
value: props.value,
|
|
518
|
+
disabled: props.disabled,
|
|
519
|
+
rows: 4,
|
|
520
|
+
onChange: (e) => props.onChange(e.target.value)
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.hint, children: props.hint })
|
|
524
|
+
] });
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// src/client/MemoryPluginCard.tsx
|
|
528
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
422
529
|
var MODES = ["policy-only", "full", "index", "custom", "off"];
|
|
423
530
|
var DEFAULTS = {
|
|
424
531
|
memoryMode: "policy-only",
|
|
425
|
-
|
|
426
|
-
reviewCandidateThreshold: 10,
|
|
427
|
-
flushOnCompaction: true,
|
|
428
|
-
flushOnDispose: true,
|
|
532
|
+
memoryPolicyCustomText: "",
|
|
429
533
|
memoryCharLimit: 5e3,
|
|
430
|
-
|
|
534
|
+
maxSearchResults: 50,
|
|
535
|
+
decayDays: 30,
|
|
536
|
+
notesEnabled: true,
|
|
537
|
+
notesDir: "docs/agent-memory",
|
|
538
|
+
notesCharLimit: 4e3,
|
|
539
|
+
notesAgentsPointer: true,
|
|
540
|
+
notesMaxEntriesPerFile: 100
|
|
431
541
|
};
|
|
542
|
+
var NUMERIC_FIELDS = ["memoryCharLimit", "maxSearchResults", "decayDays", "notesCharLimit", "notesMaxEntriesPerFile"];
|
|
432
543
|
function isOverridden(snap, field) {
|
|
433
544
|
const user = snap.user;
|
|
434
545
|
if (user === void 0 || user === null || typeof user !== "object") return false;
|
|
@@ -452,12 +563,12 @@ function MemoryPluginCard(props) {
|
|
|
452
563
|
};
|
|
453
564
|
const numericInvalid = (field) => {
|
|
454
565
|
const v = draft[field];
|
|
455
|
-
if (v === void 0 || v === null
|
|
566
|
+
if (v === void 0 || v === null) return false;
|
|
456
567
|
const n = Number(v);
|
|
457
568
|
return !Number.isFinite(n) || n < 0;
|
|
458
569
|
};
|
|
459
570
|
const dirty = JSON.stringify(draft) !== JSON.stringify({ ...DEFAULTS, ...committed });
|
|
460
|
-
const invalid =
|
|
571
|
+
const invalid = NUMERIC_FIELDS.some(numericInvalid);
|
|
461
572
|
const disabled = !snap.writable;
|
|
462
573
|
const blocked = !dirty || invalid || saving;
|
|
463
574
|
if (snap.status !== "ready") return null;
|
|
@@ -482,8 +593,8 @@ function MemoryPluginCard(props) {
|
|
|
482
593
|
setDraft({ ...DEFAULTS, ...committed });
|
|
483
594
|
setFailed(false);
|
|
484
595
|
};
|
|
485
|
-
return /* @__PURE__ */ (0,
|
|
486
|
-
/* @__PURE__ */ (0,
|
|
596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { className: `${css.card}${open ? ` ${css.cardOpen}` : ""}`, children: [
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
487
598
|
"button",
|
|
488
599
|
{
|
|
489
600
|
type: "button",
|
|
@@ -494,18 +605,18 @@ function MemoryPluginCard(props) {
|
|
|
494
605
|
setOpen(!open);
|
|
495
606
|
},
|
|
496
607
|
children: [
|
|
497
|
-
/* @__PURE__ */ (0,
|
|
498
|
-
/* @__PURE__ */ (0,
|
|
499
|
-
/* @__PURE__ */ (0,
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: css.headText, children: [
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.name, children: t("cardTitle") }),
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.description, children: t("cardDescription") })
|
|
500
611
|
] }),
|
|
501
|
-
dirty ? /* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
612
|
+
dirty ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: css.pending, children: t("unsaved") }) : null,
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutline14, { className: `${css.chevron}${open ? ` ${css.chevronOpen}` : ""}` })
|
|
503
614
|
]
|
|
504
615
|
}
|
|
505
616
|
),
|
|
506
|
-
open ? /* @__PURE__ */ (0,
|
|
507
|
-
!snap.writable ? /* @__PURE__ */ (0,
|
|
508
|
-
/* @__PURE__ */ (0,
|
|
617
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.body, children: [
|
|
618
|
+
!snap.writable ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.readOnly, role: "status", children: t("readOnly") }) : null,
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
509
620
|
SelectField,
|
|
510
621
|
{
|
|
511
622
|
id: "dsh-memory-mode",
|
|
@@ -524,7 +635,7 @@ function MemoryPluginCard(props) {
|
|
|
524
635
|
}
|
|
525
636
|
}
|
|
526
637
|
),
|
|
527
|
-
draft.memoryMode === "custom" ? /* @__PURE__ */ (0,
|
|
638
|
+
draft.memoryMode === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
528
639
|
TextareaField,
|
|
529
640
|
{
|
|
530
641
|
id: "dsh-memory-custom-policy",
|
|
@@ -542,201 +653,1132 @@ function MemoryPluginCard(props) {
|
|
|
542
653
|
}
|
|
543
654
|
}
|
|
544
655
|
) : null,
|
|
545
|
-
/* @__PURE__ */ (0,
|
|
546
|
-
CheckboxField,
|
|
547
|
-
{
|
|
548
|
-
id: "dsh-memory-review-enabled",
|
|
549
|
-
label: t("reviewEnabled"),
|
|
550
|
-
hint: t("reviewEnabledHint"),
|
|
551
|
-
overridden: isOverridden(snap, "reviewEnabled"),
|
|
552
|
-
overriddenLabel: t("overridden"),
|
|
553
|
-
resetLabel: t("reset"),
|
|
554
|
-
disabled,
|
|
555
|
-
checked: Boolean(draft.reviewEnabled ?? true),
|
|
556
|
-
onChange: (v) => edit("reviewEnabled", v),
|
|
557
|
-
onReset: () => {
|
|
558
|
-
void props.unset("reviewEnabled");
|
|
559
|
-
edit("reviewEnabled", void 0);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
),
|
|
563
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
656
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
564
657
|
NumberField,
|
|
565
658
|
{
|
|
566
|
-
id: "dsh-memory-
|
|
567
|
-
label: t("
|
|
568
|
-
hint: t("
|
|
569
|
-
overridden: isOverridden(snap, "
|
|
659
|
+
id: "dsh-memory-char-limit",
|
|
660
|
+
label: t("charLimit"),
|
|
661
|
+
hint: t("charLimitHint"),
|
|
662
|
+
overridden: isOverridden(snap, "memoryCharLimit"),
|
|
570
663
|
overriddenLabel: t("overridden"),
|
|
571
664
|
resetLabel: t("reset"),
|
|
572
665
|
invalidLabel: t("invalidNumber"),
|
|
573
|
-
invalid: numericInvalid("
|
|
574
|
-
disabled,
|
|
575
|
-
value: draft.reviewCandidateThreshold ?? "",
|
|
576
|
-
onChange: (v) => edit("reviewCandidateThreshold", v === "" ? void 0 : Number(v)),
|
|
577
|
-
onReset: () => {
|
|
578
|
-
void props.unset("reviewCandidateThreshold");
|
|
579
|
-
edit("reviewCandidateThreshold", void 0);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
),
|
|
583
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
584
|
-
CheckboxField,
|
|
585
|
-
{
|
|
586
|
-
id: "dsh-memory-flush-compaction",
|
|
587
|
-
label: t("flushOnCompaction"),
|
|
588
|
-
hint: t("flushOnCompactionHint"),
|
|
589
|
-
overridden: isOverridden(snap, "flushOnCompaction"),
|
|
590
|
-
overriddenLabel: t("overridden"),
|
|
591
|
-
resetLabel: t("reset"),
|
|
666
|
+
invalid: numericInvalid("memoryCharLimit"),
|
|
592
667
|
disabled,
|
|
593
|
-
|
|
594
|
-
onChange: (v) => edit("
|
|
668
|
+
value: draft.memoryCharLimit ?? "",
|
|
669
|
+
onChange: (v) => edit("memoryCharLimit", v === "" ? void 0 : Number(v)),
|
|
595
670
|
onReset: () => {
|
|
596
|
-
void props.unset("
|
|
597
|
-
edit("
|
|
671
|
+
void props.unset("memoryCharLimit");
|
|
672
|
+
edit("memoryCharLimit", void 0);
|
|
598
673
|
}
|
|
599
674
|
}
|
|
600
675
|
),
|
|
601
|
-
/* @__PURE__ */ (0,
|
|
602
|
-
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
677
|
+
NumberField,
|
|
603
678
|
{
|
|
604
|
-
id: "dsh-memory-
|
|
605
|
-
label: t("
|
|
606
|
-
hint: t("
|
|
607
|
-
overridden: isOverridden(snap, "
|
|
679
|
+
id: "dsh-memory-max-search",
|
|
680
|
+
label: t("maxSearchResults"),
|
|
681
|
+
hint: t("maxSearchResultsHint"),
|
|
682
|
+
overridden: isOverridden(snap, "maxSearchResults"),
|
|
608
683
|
overriddenLabel: t("overridden"),
|
|
609
684
|
resetLabel: t("reset"),
|
|
685
|
+
invalidLabel: t("invalidNumber"),
|
|
686
|
+
invalid: numericInvalid("maxSearchResults"),
|
|
610
687
|
disabled,
|
|
611
|
-
|
|
612
|
-
onChange: (v) => edit("
|
|
688
|
+
value: draft.maxSearchResults ?? "",
|
|
689
|
+
onChange: (v) => edit("maxSearchResults", v === "" ? void 0 : Number(v)),
|
|
613
690
|
onReset: () => {
|
|
614
|
-
void props.unset("
|
|
615
|
-
edit("
|
|
691
|
+
void props.unset("maxSearchResults");
|
|
692
|
+
edit("maxSearchResults", void 0);
|
|
616
693
|
}
|
|
617
694
|
}
|
|
618
695
|
),
|
|
619
|
-
/* @__PURE__ */ (0,
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
620
697
|
NumberField,
|
|
621
698
|
{
|
|
622
|
-
id: "dsh-memory-
|
|
623
|
-
label: t("
|
|
624
|
-
hint: t("
|
|
625
|
-
overridden: isOverridden(snap, "
|
|
699
|
+
id: "dsh-memory-decay-days",
|
|
700
|
+
label: t("decayDays"),
|
|
701
|
+
hint: t("decayDaysHint"),
|
|
702
|
+
overridden: isOverridden(snap, "decayDays"),
|
|
626
703
|
overriddenLabel: t("overridden"),
|
|
627
704
|
resetLabel: t("reset"),
|
|
628
705
|
invalidLabel: t("invalidNumber"),
|
|
629
|
-
invalid: numericInvalid("
|
|
706
|
+
invalid: numericInvalid("decayDays"),
|
|
630
707
|
disabled,
|
|
631
|
-
value: draft.
|
|
632
|
-
onChange: (v) => edit("
|
|
708
|
+
value: draft.decayDays ?? "",
|
|
709
|
+
onChange: (v) => edit("decayDays", v === "" ? void 0 : Number(v)),
|
|
633
710
|
onReset: () => {
|
|
634
|
-
void props.unset("
|
|
635
|
-
edit("
|
|
711
|
+
void props.unset("decayDays");
|
|
712
|
+
edit("decayDays", void 0);
|
|
636
713
|
}
|
|
637
714
|
}
|
|
638
715
|
),
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
640
|
-
failed ? /* @__PURE__ */ (0,
|
|
641
|
-
/* @__PURE__ */ (0,
|
|
642
|
-
/* @__PURE__ */ (0,
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: css.footer, children: [
|
|
717
|
+
failed ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: css.failed, role: "status", children: t("saveFailed") }) : null,
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css.discard, disabled: !dirty || saving, onClick: discard, children: t("discard") }),
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: css.save, disabled: blocked, onClick: () => void save(), children: t(saving ? "saving" : "save") })
|
|
643
720
|
] })
|
|
644
721
|
] }) : null
|
|
645
722
|
] });
|
|
646
723
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
724
|
+
|
|
725
|
+
// src/client/MemorySection.tsx
|
|
726
|
+
var import_react2 = require("react");
|
|
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";
|
|
672
764
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
),
|
|
689
|
-
|
|
690
|
-
|
|
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);
|
|
691
915
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
id: props.id,
|
|
700
|
-
type: "checkbox",
|
|
701
|
-
className: css.checkbox,
|
|
702
|
-
checked: props.checked,
|
|
703
|
-
disabled: props.disabled,
|
|
704
|
-
onChange: (e) => props.onChange(e.target.checked)
|
|
705
|
-
}
|
|
706
|
-
),
|
|
707
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: css.checkLabel, htmlFor: props.id, children: props.label })
|
|
708
|
-
] }),
|
|
709
|
-
props.overridden ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: css.badges, children: [
|
|
710
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: css.badge, children: props.overriddenLabel }),
|
|
711
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: css.reset, disabled: props.disabled, onClick: props.onReset, children: props.resetLabel })
|
|
712
|
-
] }) : null
|
|
713
|
-
] }),
|
|
714
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.hint, children: props.hint })
|
|
715
|
-
] });
|
|
916
|
+
|
|
917
|
+
// src/client/section-styles.ts
|
|
918
|
+
var RULES2 = `
|
|
919
|
+
.dsm-s-section {
|
|
920
|
+
display: flex;
|
|
921
|
+
flex-direction: column;
|
|
922
|
+
gap: 16px;
|
|
716
923
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
id: props.id,
|
|
724
|
-
className: css.textarea,
|
|
725
|
-
value: props.value,
|
|
726
|
-
disabled: props.disabled,
|
|
727
|
-
rows: 4,
|
|
728
|
-
onChange: (e) => props.onChange(e.target.value)
|
|
729
|
-
}
|
|
730
|
-
),
|
|
731
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: css.hint, children: props.hint })
|
|
732
|
-
] });
|
|
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);
|
|
733
930
|
}
|
|
734
|
-
|
|
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
|
|
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");
|
|
1530
|
+
function namespaceCard(spec) {
|
|
1531
|
+
return function SpecBoundNamespaceCard(props) {
|
|
1532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NamespaceCard, { ...props, spec });
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function isOverridden2(snap, field) {
|
|
1536
|
+
const user = snap.user;
|
|
1537
|
+
if (user === void 0 || user === null || typeof user !== "object") return false;
|
|
1538
|
+
return Object.prototype.hasOwnProperty.call(user, field);
|
|
1539
|
+
}
|
|
1540
|
+
var MODEL_CATALOG_TIMEOUT_MS = 15e3;
|
|
1541
|
+
function NamespaceCard(props) {
|
|
1542
|
+
const snap = props.useNs((s) => s);
|
|
1543
|
+
const t = props.t;
|
|
1544
|
+
const spec = props.spec;
|
|
1545
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
1546
|
+
const canLoadCatalog = typeof props.loadCatalog === "function";
|
|
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)(() => {
|
|
1551
|
+
if (!open || !canLoadCatalog || catalogStartedRef.current) return;
|
|
1552
|
+
catalogStartedRef.current = true;
|
|
1553
|
+
setCatalogStatus("loading");
|
|
1554
|
+
const load = props.loadCatalog;
|
|
1555
|
+
void (async () => {
|
|
1556
|
+
try {
|
|
1557
|
+
const view = await Promise.race([
|
|
1558
|
+
load(),
|
|
1559
|
+
new Promise((_resolve, reject) => {
|
|
1560
|
+
setTimeout(() => reject(new Error("model catalog timed out")), MODEL_CATALOG_TIMEOUT_MS);
|
|
1561
|
+
})
|
|
1562
|
+
]);
|
|
1563
|
+
setCatalog(view);
|
|
1564
|
+
setCatalogStatus("ready");
|
|
1565
|
+
} catch {
|
|
1566
|
+
setCatalogStatus("failed");
|
|
1567
|
+
}
|
|
1568
|
+
})();
|
|
1569
|
+
}, [open, canLoadCatalog]);
|
|
1570
|
+
const committed = snap.value ?? {};
|
|
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)(() => {
|
|
1575
|
+
setDraft({ ...committed });
|
|
1576
|
+
setFailed(false);
|
|
1577
|
+
}, [committed]);
|
|
1578
|
+
const edit = (field, value) => {
|
|
1579
|
+
setFailed(false);
|
|
1580
|
+
setDraft((prev) => ({ ...prev, [field]: value }));
|
|
1581
|
+
};
|
|
1582
|
+
const numericInvalid = (field) => {
|
|
1583
|
+
if (field.kind !== "number") return false;
|
|
1584
|
+
const v = draft[field.key];
|
|
1585
|
+
if (v === void 0 || v === null || v === "") return false;
|
|
1586
|
+
const n = Number(v);
|
|
1587
|
+
return !Number.isFinite(n) || n < (field.minValue ?? 0);
|
|
1588
|
+
};
|
|
1589
|
+
const dirty = JSON.stringify(draft) !== JSON.stringify(committed);
|
|
1590
|
+
const invalid = spec.fields.some(numericInvalid);
|
|
1591
|
+
const disabled = !snap.writable;
|
|
1592
|
+
const blocked = !dirty || invalid || saving;
|
|
1593
|
+
if (snap.status !== "ready") return null;
|
|
1594
|
+
const save = async () => {
|
|
1595
|
+
setSaving(true);
|
|
1596
|
+
setFailed(false);
|
|
1597
|
+
try {
|
|
1598
|
+
const ops = [];
|
|
1599
|
+
for (const field of spec.fields) {
|
|
1600
|
+
if (draft[field.key] === committed[field.key]) continue;
|
|
1601
|
+
const value = draft[field.key];
|
|
1602
|
+
ops.push(value === void 0 ? props.unset(field.key) : props.set(field.key, value));
|
|
1603
|
+
}
|
|
1604
|
+
await Promise.all(ops);
|
|
1605
|
+
} catch {
|
|
1606
|
+
setFailed(true);
|
|
1607
|
+
} finally {
|
|
1608
|
+
setSaving(false);
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1611
|
+
const discard = () => {
|
|
1612
|
+
setDraft({ ...committed });
|
|
1613
|
+
setFailed(false);
|
|
1614
|
+
};
|
|
1615
|
+
const renderSelectField = (field, base) => {
|
|
1616
|
+
const rawValue = typeof draft[field.key] === "string" ? draft[field.key] : "";
|
|
1617
|
+
if (!canLoadCatalog || catalogStatus === "failed") {
|
|
1618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1619
|
+
TextField,
|
|
1620
|
+
{
|
|
1621
|
+
...base,
|
|
1622
|
+
hint: `${base.hint} ${t("modelCatalogUnavailable")}`,
|
|
1623
|
+
value: rawValue,
|
|
1624
|
+
onChange: (v) => edit(field.key, v === "" ? void 0 : v)
|
|
1625
|
+
}
|
|
1626
|
+
);
|
|
1627
|
+
}
|
|
1628
|
+
if (catalogStatus !== "ready") {
|
|
1629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1630
|
+
SelectField,
|
|
1631
|
+
{
|
|
1632
|
+
...base,
|
|
1633
|
+
disabled: true,
|
|
1634
|
+
value: "",
|
|
1635
|
+
options: [{ value: "", label: t("modelCatalogLoading") }],
|
|
1636
|
+
onChange: () => {
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
);
|
|
1640
|
+
}
|
|
1641
|
+
const resolved = field.options?.({ catalog, draft }) ?? [];
|
|
1642
|
+
if (resolved.length === 0) {
|
|
1643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1644
|
+
TextField,
|
|
1645
|
+
{
|
|
1646
|
+
...base,
|
|
1647
|
+
hint: `${base.hint} ${t("modelCatalogUnavailable")}`,
|
|
1648
|
+
value: rawValue,
|
|
1649
|
+
onChange: (v) => edit(field.key, v === "" ? void 0 : v)
|
|
1650
|
+
}
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
const opts = field.emptyOptionKey === void 0 ? [...resolved] : [{ value: "", label: t(field.emptyOptionKey) }, ...resolved];
|
|
1654
|
+
if (rawValue !== "" && !opts.some((o) => o.value === rawValue)) {
|
|
1655
|
+
opts.push({ value: rawValue, label: rawValue });
|
|
1656
|
+
}
|
|
1657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1658
|
+
SelectField,
|
|
1659
|
+
{
|
|
1660
|
+
...base,
|
|
1661
|
+
value: rawValue,
|
|
1662
|
+
options: opts,
|
|
1663
|
+
onChange: (v) => edit(field.key, v === "" ? void 0 : v)
|
|
1664
|
+
}
|
|
1665
|
+
);
|
|
1666
|
+
};
|
|
1667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { className: `${css.card}${open ? ` ${css.cardOpen}` : ""}`, children: [
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1669
|
+
"button",
|
|
1670
|
+
{
|
|
1671
|
+
type: "button",
|
|
1672
|
+
className: css.header,
|
|
1673
|
+
"aria-expanded": open,
|
|
1674
|
+
"aria-label": `${t(open ? "collapse" : "expand")}: ${t(spec.titleKey)}`,
|
|
1675
|
+
onClick: () => {
|
|
1676
|
+
setOpen(!open);
|
|
1677
|
+
},
|
|
1678
|
+
children: [
|
|
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) })
|
|
1682
|
+
] }),
|
|
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}` : ""}` })
|
|
1685
|
+
]
|
|
1686
|
+
}
|
|
1687
|
+
),
|
|
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,
|
|
1690
|
+
spec.fields.map((field) => {
|
|
1691
|
+
const label = t(field.labelKey ?? field.key);
|
|
1692
|
+
const hint = t(field.hintKey ?? `${field.key}Hint`);
|
|
1693
|
+
const base = {
|
|
1694
|
+
key: field.key,
|
|
1695
|
+
id: `dsh-settings-${field.key}`,
|
|
1696
|
+
label,
|
|
1697
|
+
hint,
|
|
1698
|
+
overridden: isOverridden2(snap, field.key),
|
|
1699
|
+
overriddenLabel: t("overridden"),
|
|
1700
|
+
resetLabel: t("reset"),
|
|
1701
|
+
disabled,
|
|
1702
|
+
onReset: () => {
|
|
1703
|
+
void props.unset(field.key);
|
|
1704
|
+
edit(field.key, void 0);
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
if (field.kind === "checkbox") {
|
|
1708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1709
|
+
CheckboxField,
|
|
1710
|
+
{
|
|
1711
|
+
...base,
|
|
1712
|
+
checked: Boolean(draft[field.key] ?? false),
|
|
1713
|
+
onChange: (v) => edit(field.key, v)
|
|
1714
|
+
}
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1717
|
+
if (field.kind === "number") {
|
|
1718
|
+
const raw = draft[field.key];
|
|
1719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1720
|
+
NumberField,
|
|
1721
|
+
{
|
|
1722
|
+
...base,
|
|
1723
|
+
invalidLabel: t("invalidNumber"),
|
|
1724
|
+
invalid: numericInvalid(field),
|
|
1725
|
+
value: typeof raw === "number" ? raw : typeof raw === "string" ? raw : "",
|
|
1726
|
+
onChange: (v) => edit(field.key, v === "" ? void 0 : Number(v))
|
|
1727
|
+
}
|
|
1728
|
+
);
|
|
1729
|
+
}
|
|
1730
|
+
if (field.kind === "select") {
|
|
1731
|
+
return renderSelectField(field, base);
|
|
1732
|
+
}
|
|
1733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1734
|
+
TextField,
|
|
1735
|
+
{
|
|
1736
|
+
...base,
|
|
1737
|
+
value: typeof draft[field.key] === "string" ? draft[field.key] : "",
|
|
1738
|
+
onChange: (v) => edit(field.key, v === "" ? void 0 : v)
|
|
1739
|
+
}
|
|
1740
|
+
);
|
|
1741
|
+
}),
|
|
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") })
|
|
1746
|
+
] })
|
|
1747
|
+
] }) : null
|
|
1748
|
+
] });
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
// src/client/model-catalog.ts
|
|
1752
|
+
var PROVIDER_FIELD = "extractionModelProvider";
|
|
1753
|
+
function catalogLabel(name, id) {
|
|
1754
|
+
return typeof name === "string" && name.length > 0 && name !== id ? `${name} (${id})` : id;
|
|
1755
|
+
}
|
|
1756
|
+
function providerOptions({ catalog }) {
|
|
1757
|
+
return (catalog?.groups ?? []).filter((g) => typeof g?.id === "string" && g.id.length > 0).map((g) => ({ value: g.id, label: catalogLabel(g.name, g.id) }));
|
|
1758
|
+
}
|
|
1759
|
+
function modelOptions({ catalog, draft }) {
|
|
1760
|
+
const groups = catalog?.groups ?? [];
|
|
1761
|
+
const providerId = draft[PROVIDER_FIELD];
|
|
1762
|
+
const hasProvider = typeof providerId === "string" && providerId.length > 0;
|
|
1763
|
+
const scoped = hasProvider ? groups.filter((g) => g.id === providerId) : groups;
|
|
1764
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1765
|
+
const options = [];
|
|
1766
|
+
for (const g of scoped) {
|
|
1767
|
+
for (const m of g.models ?? []) {
|
|
1768
|
+
if (typeof m?.id !== "string" || m.id.length === 0 || seen.has(m.id)) continue;
|
|
1769
|
+
seen.add(m.id);
|
|
1770
|
+
const label = hasProvider ? catalogLabel(m.name, m.id) : `${g.id} \xB7 ${catalogLabel(m.name, m.id)}`;
|
|
1771
|
+
options.push({ value: m.id, label });
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
return options;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
735
1777
|
// src/client/locales.ts
|
|
736
1778
|
var en = {
|
|
737
1779
|
// Card chrome (mirrors the PluginCard shell's keys).
|
|
738
1780
|
cardTitle: "Memory",
|
|
739
|
-
cardDescription: "
|
|
1781
|
+
cardDescription: "How recalled memory reaches the prompt, how much the tools return, and how long entries live.",
|
|
740
1782
|
expand: "Show settings",
|
|
741
1783
|
collapse: "Hide settings",
|
|
742
1784
|
unsaved: "Unsaved",
|
|
@@ -750,11 +1792,46 @@ var en = {
|
|
|
750
1792
|
invalidNumber: "Enter a number, or leave blank to use the default.",
|
|
751
1793
|
loading: "Loading\u2026",
|
|
752
1794
|
unavailable: "Memory settings are not available on this connection.",
|
|
753
|
-
//
|
|
1795
|
+
// Extraction model dropdown states.
|
|
1796
|
+
followSessionRoute: "Follow the session model",
|
|
1797
|
+
modelCatalogLoading: "Loading model catalog\u2026",
|
|
1798
|
+
modelCatalogUnavailable: "Model catalog unavailable \u2014 type the id manually.",
|
|
1799
|
+
// Memory card fields (memory namespace).
|
|
754
1800
|
memoryMode: "Memory mode",
|
|
755
1801
|
memoryModeHint: "How recalled memory is rendered into the system prompt.",
|
|
756
1802
|
customPolicy: "Custom policy text",
|
|
757
1803
|
customPolicyHint: 'Used only when memory mode is "custom".',
|
|
1804
|
+
charLimit: "Memory character limit",
|
|
1805
|
+
charLimitHint: "Character budget for the frozen memory content snapshot.",
|
|
1806
|
+
maxSearchResults: "Max search results",
|
|
1807
|
+
maxSearchResultsHint: "Default cap for memory_search / memory_list results; 0 means no limit.",
|
|
1808
|
+
decayDays: "Decay days",
|
|
1809
|
+
decayDaysHint: "Auto-decay project entries not recalled within N days; 0 disables.",
|
|
1810
|
+
// Project notes card (memory namespace).
|
|
1811
|
+
notesCardTitle: "Project Notes",
|
|
1812
|
+
notesCardDescription: "Export conventions and a pitfall log into repo files and inject them into the prompt.",
|
|
1813
|
+
notesEnabled: "Project notes",
|
|
1814
|
+
notesEnabledHint: "Export conventions and the pitfall log into repo files and inject them into the prompt.",
|
|
1815
|
+
notesDir: "Notes directory",
|
|
1816
|
+
notesDirHint: "Repo-relative directory for the generated CONVENTIONS.md / PITFALLS.md.",
|
|
1817
|
+
notesCharLimit: "Notes character limit",
|
|
1818
|
+
notesCharLimitHint: "Character budget for the injected project-notes section.",
|
|
1819
|
+
notesAgentsPointer: "AGENTS.md pointer",
|
|
1820
|
+
notesAgentsPointerHint: "Maintain the managed pointer block in the repo AGENTS.md so other tools discover the notes.",
|
|
1821
|
+
notesMaxEntriesPerFile: "Max entries per notes file",
|
|
1822
|
+
notesMaxEntriesPerFileHint: "Per-file entry cap; the oldest entries are truncated.",
|
|
1823
|
+
// Auto recall card (memory namespace).
|
|
1824
|
+
autoRecallCardTitle: "Auto Recall",
|
|
1825
|
+
autoRecallCardDescription: "Append a per-step recalled-memory block from a store search; the system prompt stays untouched.",
|
|
1826
|
+
autoRecallEnabled: "Auto recall",
|
|
1827
|
+
autoRecallEnabledHint: "On each agent step, search the store for the step's user text and append a fenced recalled-memory message.",
|
|
1828
|
+
autoRecallLimit: "Recall entry limit",
|
|
1829
|
+
autoRecallLimitHint: "Maximum entries in one auto-recall fence; minimum 1.",
|
|
1830
|
+
autoRecallMinChars: "Recall trigger length",
|
|
1831
|
+
autoRecallMinCharsHint: "Skip recall when the step's user text is shorter than this many characters.",
|
|
1832
|
+
// Review extraction card (memory-review namespace).
|
|
1833
|
+
reviewCardTitle: "Automatic Extraction",
|
|
1834
|
+
reviewCardDescription: "When conversations are distilled into durable memory, which model runs it, and how oversized entries get re-summarized.",
|
|
758
1835
|
reviewEnabled: "Automatic review extraction",
|
|
759
1836
|
reviewEnabledHint: "Extract durable facts from the conversation automatically.",
|
|
760
1837
|
reviewThreshold: "Review candidate threshold",
|
|
@@ -763,12 +1840,78 @@ var en = {
|
|
|
763
1840
|
flushOnCompactionHint: "Write pending memory when the context is compacted.",
|
|
764
1841
|
flushOnDispose: "Flush on dispose",
|
|
765
1842
|
flushOnDisposeHint: "Write pending memory when the session ends.",
|
|
766
|
-
|
|
767
|
-
|
|
1843
|
+
extractionModelProvider: "Extraction provider",
|
|
1844
|
+
extractionModelProviderHint: "LLM provider for extraction/dedup calls, picked from the configured providers; the default follows the session model.",
|
|
1845
|
+
extractionModelModel: "Extraction model",
|
|
1846
|
+
extractionModelModelHint: "Model for extraction/dedup calls, picked from the chosen provider's catalog; the default follows the session model.",
|
|
1847
|
+
extractionBudget: "Extraction budget",
|
|
1848
|
+
extractionBudgetHint: "Max extraction + judge calls per session; 0 means unlimited.",
|
|
1849
|
+
judgeEnabled: "Dedup judge",
|
|
1850
|
+
judgeEnabledHint: "Run the LLM judge on near-duplicate hits before merging them.",
|
|
1851
|
+
pitfallStreakThreshold: "Pitfall streak threshold",
|
|
1852
|
+
pitfallStreakThresholdHint: "Consecutive same-signature failures \u2014 once resolved \u2014 that log a pitfall entry.",
|
|
1853
|
+
curatorEnabled: "Curator pass",
|
|
1854
|
+
curatorEnabledHint: "Periodically rewrite the longest oversized entries into concise one-liners with the extraction model.",
|
|
1855
|
+
curatorEveryNSessions: "Curator interval (sessions)",
|
|
1856
|
+
curatorEveryNSessionsHint: "Run the curator pass every N session creations; minimum 1.",
|
|
1857
|
+
curatorMaxEntries: "Curator max entries",
|
|
1858
|
+
curatorMaxEntriesHint: "Maximum entries selected per pass, longest first; minimum 1.",
|
|
1859
|
+
curatorMinChars: "Curator minimum length",
|
|
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"
|
|
768
1910
|
};
|
|
769
1911
|
var zh = {
|
|
1912
|
+
// Card chrome
|
|
770
1913
|
cardTitle: "\u8BB0\u5FC6",
|
|
771
|
-
cardDescription: "\
|
|
1914
|
+
cardDescription: "\u53EC\u56DE\u7684\u8BB0\u5FC6\u5982\u4F55\u8FDB\u5165\u63D0\u793A\u8BCD\u3001\u5DE5\u5177\u8FD4\u56DE\u591A\u5C11\u3001\u8BB0\u5FC6\u4FDD\u7559\u591A\u4E45\u3002",
|
|
772
1915
|
expand: "\u5C55\u5F00\u8BBE\u7F6E",
|
|
773
1916
|
collapse: "\u6536\u8D77\u8BBE\u7F6E",
|
|
774
1917
|
unsaved: "\u672A\u4FDD\u5B58",
|
|
@@ -782,10 +1925,46 @@ var zh = {
|
|
|
782
1925
|
invalidNumber: "\u8BF7\u586B\u6570\u5B57\uFF1B\u7559\u7A7A\u8868\u793A\u4F7F\u7528\u9ED8\u8BA4\u503C\u3002",
|
|
783
1926
|
loading: "\u6B63\u5728\u52A0\u8F7D\u2026",
|
|
784
1927
|
unavailable: "\u5F53\u524D\u8FDE\u63A5\u4E0D\u53EF\u7528\u8BB0\u5FC6\u8BBE\u7F6E\u3002",
|
|
1928
|
+
// 提取模型下拉状态
|
|
1929
|
+
followSessionRoute: "\u8DDF\u968F\u4F1A\u8BDD\u6A21\u578B",
|
|
1930
|
+
modelCatalogLoading: "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u76EE\u5F55\u2026",
|
|
1931
|
+
modelCatalogUnavailable: "\u6A21\u578B\u76EE\u5F55\u4E0D\u53EF\u7528\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165 id\u3002",
|
|
1932
|
+
// 记忆卡片字段(memory 命名空间)
|
|
785
1933
|
memoryMode: "\u8BB0\u5FC6\u6A21\u5F0F",
|
|
786
1934
|
memoryModeHint: "\u53EC\u56DE\u7684\u8BB0\u5FC6\u5982\u4F55\u6E32\u67D3\u8FDB\u7CFB\u7EDF\u63D0\u793A\u8BCD\u3002",
|
|
787
1935
|
customPolicy: "\u81EA\u5B9A\u4E49\u7B56\u7565\u6587\u672C",
|
|
788
1936
|
customPolicyHint: '\u4EC5\u5728\u8BB0\u5FC6\u6A21\u5F0F\u4E3A "custom" \u65F6\u4F7F\u7528\u3002',
|
|
1937
|
+
charLimit: "\u8BB0\u5FC6\u5B57\u7B26\u4E0A\u9650",
|
|
1938
|
+
charLimitHint: "\u51BB\u7ED3\u8BB0\u5FC6\u5185\u5BB9\u5FEB\u7167\u7684\u5B57\u7B26\u9884\u7B97\u3002",
|
|
1939
|
+
maxSearchResults: "\u6700\u5927\u641C\u7D22\u7ED3\u679C\u6570",
|
|
1940
|
+
maxSearchResultsHint: "memory_search / memory_list \u7684\u9ED8\u8BA4\u6761\u6570\u4E0A\u9650\uFF1B0 \u8868\u793A\u4E0D\u9650\u3002",
|
|
1941
|
+
decayDays: "\u8870\u51CF\u5929\u6570",
|
|
1942
|
+
decayDaysHint: "N \u5929\u672A\u53EC\u56DE\u7684 project \u6761\u76EE\u81EA\u52A8\u8870\u51CF\uFF1B0 \u8868\u793A\u7981\u7528\u3002",
|
|
1943
|
+
// 项目笔记卡片(memory 命名空间)
|
|
1944
|
+
notesCardTitle: "\u9879\u76EE\u7B14\u8BB0",
|
|
1945
|
+
notesCardDescription: "\u628A\u7F16\u7801\u7EA6\u5B9A\u4E0E\u8E29\u5751\u65E5\u5FD7\u5BFC\u51FA\u5230\u4ED3\u5E93\u6587\u4EF6\u5E76\u6CE8\u5165\u63D0\u793A\u8BCD\u3002",
|
|
1946
|
+
notesEnabled: "\u9879\u76EE\u7B14\u8BB0",
|
|
1947
|
+
notesEnabledHint: "\u628A\u7F16\u7801\u7EA6\u5B9A\u4E0E\u8E29\u5751\u65E5\u5FD7\u5BFC\u51FA\u5230\u4ED3\u5E93\u6587\u4EF6\uFF0C\u5E76\u6CE8\u5165\u7CFB\u7EDF\u63D0\u793A\u8BCD\u3002",
|
|
1948
|
+
notesDir: "\u7B14\u8BB0\u76EE\u5F55",
|
|
1949
|
+
notesDirHint: "\u4ED3\u5E93\u5185\u751F\u6210 CONVENTIONS.md / PITFALLS.md \u7684\u76F8\u5BF9\u76EE\u5F55\u3002",
|
|
1950
|
+
notesCharLimit: "\u7B14\u8BB0\u5B57\u7B26\u4E0A\u9650",
|
|
1951
|
+
notesCharLimitHint: "\u6CE8\u5165\u7684\u9879\u76EE\u7B14\u8BB0\u6BB5\u843D\u7684\u5B57\u7B26\u9884\u7B97\u3002",
|
|
1952
|
+
notesAgentsPointer: "AGENTS.md \u6307\u9488",
|
|
1953
|
+
notesAgentsPointerHint: "\u5728\u4ED3\u5E93 AGENTS.md \u4E2D\u7EF4\u62A4\u6258\u7BA1\u6307\u9488\u5757\uFF0C\u4F9B\u5176\u4ED6\u5DE5\u5177\u53D1\u73B0\u7B14\u8BB0\u3002",
|
|
1954
|
+
notesMaxEntriesPerFile: "\u5355\u6587\u4EF6\u6700\u5927\u6761\u76EE\u6570",
|
|
1955
|
+
notesMaxEntriesPerFileHint: "\u6BCF\u4E2A\u7B14\u8BB0\u6587\u4EF6\u7684\u6761\u76EE\u4E0A\u9650\uFF0C\u8D85\u51FA\u622A\u65AD\u6700\u65E7\u7684\u6761\u76EE\u3002",
|
|
1956
|
+
// 自动召回卡片(memory 命名空间)
|
|
1957
|
+
autoRecallCardTitle: "\u81EA\u52A8\u53EC\u56DE",
|
|
1958
|
+
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",
|
|
1959
|
+
autoRecallEnabled: "\u6B65\u7EA7\u81EA\u52A8\u53EC\u56DE",
|
|
1960
|
+
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\u6539\u7CFB\u7EDF\u63D0\u793A\u8BCD\uFF0CKV-cache \u524D\u7F00\u7A33\u5B9A\u3002",
|
|
1961
|
+
autoRecallLimit: "\u5355\u6B21\u53EC\u56DE\u6761\u6570\u4E0A\u9650",
|
|
1962
|
+
autoRecallLimitHint: "\u4E00\u6B21\u81EA\u52A8\u53EC\u56DE\u6700\u591A\u9644\u5E26\u7684\u6761\u76EE\u6570\uFF0C\u6700\u5C0F\u4E3A 1\u3002",
|
|
1963
|
+
autoRecallMinChars: "\u89E6\u53D1\u6700\u5C0F\u6587\u672C\u957F\u5EA6",
|
|
1964
|
+
autoRecallMinCharsHint: "\u6B65\u9AA4\u7528\u6237\u6587\u672C\u77ED\u4E8E\u8BE5\u5B57\u7B26\u6570\u65F6\u8DF3\u8FC7\u53EC\u56DE\u3002",
|
|
1965
|
+
// 自动提取卡片(memory-review 命名空间)
|
|
1966
|
+
reviewCardTitle: "\u81EA\u52A8\u63D0\u53D6",
|
|
1967
|
+
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",
|
|
789
1968
|
reviewEnabled: "\u81EA\u52A8\u8BC4\u5BA1\u63D0\u53D6",
|
|
790
1969
|
reviewEnabledHint: "\u81EA\u52A8\u4ECE\u5BF9\u8BDD\u4E2D\u63D0\u53D6\u53EF\u6301\u4E45\u7684\u4E8B\u5B9E\u3002",
|
|
791
1970
|
reviewThreshold: "\u8BC4\u5BA1\u5019\u9009\u9608\u503C",
|
|
@@ -794,30 +1973,247 @@ var zh = {
|
|
|
794
1973
|
flushOnCompactionHint: "\u4E0A\u4E0B\u6587\u88AB\u538B\u7F29\u65F6\u5199\u5165\u5F85\u5199\u8BB0\u5FC6\u3002",
|
|
795
1974
|
flushOnDispose: "\u4F1A\u8BDD\u7ED3\u675F\u65F6\u51B2\u5237",
|
|
796
1975
|
flushOnDisposeHint: "\u4F1A\u8BDD\u7ED3\u675F\u65F6\u5199\u5165\u5F85\u5199\u8BB0\u5FC6\u3002",
|
|
797
|
-
|
|
798
|
-
|
|
1976
|
+
extractionModelProvider: "\u63D0\u53D6\u6A21\u578B provider",
|
|
1977
|
+
extractionModelProviderHint: "\u63D0\u53D6/\u53BB\u91CD\u8C03\u7528\u4F7F\u7528\u7684 LLM provider\uFF0C\u4ECE\u5DF2\u914D\u7F6E\u7684 provider \u4E2D\u9009\u62E9\uFF1B\u9ED8\u8BA4\u8DDF\u968F\u4F1A\u8BDD\u6A21\u578B\u3002",
|
|
1978
|
+
extractionModelModel: "\u63D0\u53D6\u6A21\u578B",
|
|
1979
|
+
extractionModelModelHint: "\u63D0\u53D6/\u53BB\u91CD\u8C03\u7528\u4F7F\u7528\u7684\u6A21\u578B\uFF0C\u4ECE\u6240\u9009 provider \u7684\u76EE\u5F55\u4E2D\u9009\u62E9\uFF1B\u9ED8\u8BA4\u8DDF\u968F\u4F1A\u8BDD\u6A21\u578B\u3002",
|
|
1980
|
+
extractionBudget: "\u63D0\u53D6\u9884\u7B97",
|
|
1981
|
+
extractionBudgetHint: "\u6BCF\u4F1A\u8BDD\u6700\u5927\u63D0\u53D6 + \u53BB\u91CD\u88C1\u51B3\u8C03\u7528\u6B21\u6570\uFF1B0 \u8868\u793A\u4E0D\u9650\u3002",
|
|
1982
|
+
judgeEnabled: "\u53BB\u91CD\u88C1\u51B3",
|
|
1983
|
+
judgeEnabledHint: "\u5BF9\u8FD1\u4F3C\u91CD\u590D\u547D\u4E2D\u5728\u5408\u5E76\u524D\u8FD0\u884C LLM \u88C1\u51B3\u3002",
|
|
1984
|
+
pitfallStreakThreshold: "\u8E29\u5751\u8FDE\u7EED\u9608\u503C",
|
|
1985
|
+
pitfallStreakThresholdHint: "\u540C\u7B7E\u540D\u8FDE\u7EED\u5931\u8D25\u8FBE\u5230\u8BE5\u6B21\u6570\u4E14\u6700\u7EC8\u89E3\u51B3\uFF0C\u624D\u8BB0\u5F55\u4E00\u6761\u8E29\u5751\u3002",
|
|
1986
|
+
curatorEnabled: "\u7B56\u5C55\u6574\u7406",
|
|
1987
|
+
curatorEnabledHint: "\u4F4E\u9891\u5730\u628A\u6700\u957F\u7684\u8D85\u5C3A\u5BF8\u6761\u76EE\u7528\u63D0\u53D6\u6A21\u578B\u6539\u5199\u6210\u7B80\u6D01\u5355\u884C\u3002",
|
|
1988
|
+
curatorEveryNSessions: "\u7B56\u5C55\u95F4\u9694\uFF08\u4F1A\u8BDD\u6570\uFF09",
|
|
1989
|
+
curatorEveryNSessionsHint: "\u6BCF\u521B\u5EFA N \u4E2A\u4F1A\u8BDD\u8FD0\u884C\u4E00\u6B21\u7B56\u5C55\u6574\u7406\uFF0C\u6700\u5C0F\u4E3A 1\u3002",
|
|
1990
|
+
curatorMaxEntries: "\u5355\u6B21\u6574\u7406\u6761\u6570\u4E0A\u9650",
|
|
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",
|
|
1992
|
+
curatorMinChars: "\u53C2\u4E0E\u6574\u7406\u6700\u5C0F\u957F\u5EA6",
|
|
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"
|
|
799
2043
|
};
|
|
800
2044
|
|
|
801
2045
|
// src/client/index.ts
|
|
802
|
-
var
|
|
2046
|
+
var NOTES_SPEC = {
|
|
2047
|
+
titleKey: "notesCardTitle",
|
|
2048
|
+
descriptionKey: "notesCardDescription",
|
|
2049
|
+
fields: [
|
|
2050
|
+
{ key: "notesEnabled", kind: "checkbox" },
|
|
2051
|
+
{ key: "notesDir", kind: "text" },
|
|
2052
|
+
{ key: "notesCharLimit", kind: "number" },
|
|
2053
|
+
{ key: "notesAgentsPointer", kind: "checkbox" },
|
|
2054
|
+
{ key: "notesMaxEntriesPerFile", kind: "number" }
|
|
2055
|
+
]
|
|
2056
|
+
};
|
|
2057
|
+
var AUTORECALL_SPEC = {
|
|
2058
|
+
titleKey: "autoRecallCardTitle",
|
|
2059
|
+
descriptionKey: "autoRecallCardDescription",
|
|
2060
|
+
fields: [
|
|
2061
|
+
{ key: "autoRecallEnabled", kind: "checkbox" },
|
|
2062
|
+
{ key: "autoRecallLimit", kind: "number", minValue: 1 },
|
|
2063
|
+
{ key: "autoRecallMinChars", kind: "number", minValue: 1 }
|
|
2064
|
+
]
|
|
2065
|
+
};
|
|
2066
|
+
var PROVIDER_FIELD2 = "extractionModelProvider";
|
|
2067
|
+
var REVIEW_SPEC = {
|
|
2068
|
+
titleKey: "reviewCardTitle",
|
|
2069
|
+
descriptionKey: "reviewCardDescription",
|
|
2070
|
+
fields: [
|
|
2071
|
+
{ key: "reviewEnabled", kind: "checkbox" },
|
|
2072
|
+
{ key: "reviewCandidateThreshold", kind: "number", labelKey: "reviewThreshold", hintKey: "reviewThresholdHint", minValue: 1 },
|
|
2073
|
+
{ key: "flushOnCompaction", kind: "checkbox" },
|
|
2074
|
+
{ key: "flushOnDispose", kind: "checkbox" },
|
|
2075
|
+
{
|
|
2076
|
+
key: PROVIDER_FIELD2,
|
|
2077
|
+
kind: "select",
|
|
2078
|
+
options: providerOptions,
|
|
2079
|
+
emptyOptionKey: "followSessionRoute"
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
key: "extractionModelModel",
|
|
2083
|
+
kind: "select",
|
|
2084
|
+
options: modelOptions,
|
|
2085
|
+
emptyOptionKey: "followSessionRoute"
|
|
2086
|
+
},
|
|
2087
|
+
{ key: "extractionBudget", kind: "number" },
|
|
2088
|
+
{ key: "judgeEnabled", kind: "checkbox" },
|
|
2089
|
+
{ key: "pitfallStreakThreshold", kind: "number", minValue: 1 },
|
|
2090
|
+
{ key: "curatorEnabled", kind: "checkbox" },
|
|
2091
|
+
{ key: "curatorEveryNSessions", kind: "number", minValue: 1 },
|
|
2092
|
+
{ key: "curatorMaxEntries", kind: "number", minValue: 1 },
|
|
2093
|
+
{ key: "curatorMinChars", kind: "number", minValue: 1 }
|
|
2094
|
+
]
|
|
2095
|
+
};
|
|
2096
|
+
var inject3 = ["slots", "locale", "connection", "settingsScope"];
|
|
803
2097
|
var NS = "settings.memory";
|
|
804
|
-
var
|
|
2098
|
+
var SECTION_ORDER = 25;
|
|
2099
|
+
var CARDS = [
|
|
2100
|
+
{ key: "memory" },
|
|
2101
|
+
{ key: "memory-notes", namespace: "memory", spec: NOTES_SPEC },
|
|
2102
|
+
{ key: "memory-autorecall", namespace: "memory", spec: AUTORECALL_SPEC },
|
|
2103
|
+
{ key: "memory-review", spec: REVIEW_SPEC }
|
|
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
|
+
}
|
|
2136
|
+
function createCatalogLoader(connection) {
|
|
2137
|
+
const llm = connection?.api?.llm;
|
|
2138
|
+
if (llm === void 0 || typeof llm.models !== "function") return void 0;
|
|
2139
|
+
return async () => {
|
|
2140
|
+
const response = await llm.models({});
|
|
2141
|
+
return response.result.ok ? response.result.value : void 0;
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
805
2144
|
function apply(ctx) {
|
|
806
2145
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-memory: locale dictionaries");
|
|
807
|
-
const
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
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");
|
|
813
2154
|
ctx.slots.inject("settings.plugin.item", function* () {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
2155
|
+
for (const card of CARDS) {
|
|
2156
|
+
const ns = card.namespace ?? card.key;
|
|
2157
|
+
const scope = ctx.settingsScope.bind({ namespace: ns });
|
|
2158
|
+
if (card.spec === void 0) {
|
|
2159
|
+
const typed = scope;
|
|
2160
|
+
const injected3 = () => ({
|
|
2161
|
+
hooks: { memory: typed },
|
|
2162
|
+
set: (field, value) => typed.set(field, value),
|
|
2163
|
+
unset: (field) => typed.unset(field)
|
|
2164
|
+
});
|
|
2165
|
+
yield ctx.slots.register({
|
|
2166
|
+
name: "settings.plugin.item",
|
|
2167
|
+
key: card.key,
|
|
2168
|
+
locale: NS,
|
|
2169
|
+
inject: injected3
|
|
2170
|
+
}, MemoryPluginCard);
|
|
2171
|
+
} else {
|
|
2172
|
+
const spec = card.spec;
|
|
2173
|
+
const typed = scope;
|
|
2174
|
+
const withCatalog = loadCatalog !== void 0 && spec.fields.some((f) => f.kind === "select");
|
|
2175
|
+
const injected3 = () => ({
|
|
2176
|
+
hooks: { ns: typed },
|
|
2177
|
+
set: (field, value) => typed.set(field, value),
|
|
2178
|
+
unset: (field) => typed.unset(field),
|
|
2179
|
+
...withCatalog ? { loadCatalog } : {}
|
|
2180
|
+
});
|
|
2181
|
+
yield ctx.slots.register({
|
|
2182
|
+
name: "settings.plugin.item",
|
|
2183
|
+
key: card.key,
|
|
2184
|
+
locale: NS,
|
|
2185
|
+
inject: injected3
|
|
2186
|
+
}, namespaceCard(spec));
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
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
|
+
}
|
|
820
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));
|
|
821
2217
|
}
|
|
822
2218
|
|
|
823
2219
|
|