@yolk_vat-y/dsh-project-memory 0.6.8 → 0.6.10

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/cordis.patch.yml CHANGED
@@ -11,6 +11,10 @@
11
11
  autoIndexOnFirstUse: false
12
12
  watch: true
13
13
  watchInterval: 30
14
+ # 其中三个也能在 web 的「插件 → 项目记忆」详情页里可视化修改(默认收起的「常用设置」):
15
+ # watchInterval / autoIndexOnFirstUse / llmQueryExpansion
16
+ # 保存即生效(autoIndexOnFirstUse 下次启动生效);页面上的改动落在 profile 的用户层,不改这个文件。
17
+ # watch / lazyIndexing / enableTypeScript 刻意不放进界面:关掉只会让记忆变旧。
14
18
  # 危险根护栏(家目录 / 文件系统根 / 系统与包管理器前缀整体扫描会吃满内存)。
15
19
  # 兼容开关:只放开内置名单;roots.deny / roots.exclude 仍然优先。
16
20
  allowUnsafeRoots: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolk_vat-y/dsh-project-memory",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
4
4
  "description": "Persistent project memory for dsh agents: index docs (PDF/Markdown/text) and code symbols into a searchable per-workspace store, recall them with cited sources, and keep experience entries (problems -> solutions) searchable on demand.",
5
5
  "author": "00080000 <3388065969@qq.com>",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "url": "https://github.com/00080000/dsh-project-memory.git"
21
21
  },
22
22
  "scripts": {
23
- "test": "node test/run-test.mjs && node test/taskbridge.test.mjs && node test/insight-store.test.mjs && node test/reflection-pipeline.test.mjs && node test/auto-inject.test.mjs && node test/insight-actions.test.mjs && node test/insight-paging.test.mjs && node test/config-schema.test.mjs && node test/host-contract.test.mjs && node test/session-dir.test.mjs && node test/llm-route.test.mjs && node test/doc-index.test.mjs && node test/chunker.test.mjs && node test/client-hints.test.mjs && node test/client-paging.test.mjs && node test/client-task-sync.test.mjs && node test/recall.test.mjs && node test/recall-vector-fusion.test.mjs && node test/vector-index.test.mjs && node test/readiness.test.mjs && node test/insight-derive.test.mjs && node test/readiness-eval.test.mjs && node test/ops.test.mjs && node test/injection-audit.test.mjs && node test/signal-source.test.mjs && node test/skill.test.mjs && node test/injection-budget.test.mjs && node test/injection-scenarios.test.mjs && node test/bugfix-0.5.7.test.mjs && node test/client-icons.test.mjs && node test/client-slash.test.mjs && node test/client-toolview.test.mjs && node test/workflow-command.test.mjs && node test/client-session-id.test.mjs && node test/client-degraded.test.mjs && node test/watch-idle.test.mjs && node test/citation-paths.test.mjs && node test/task-view.test.mjs && node test/root-guards.test.mjs && node test/root-policy.test.mjs && node test/gitignore-index.test.mjs && node test/store-gitignore.test.mjs && node test/atomic-write.test.mjs && node test/store-cache.test.mjs && node test/store-concurrent.test.mjs && node test/store-lock.test.mjs && node test/windows-compat.test.mjs && node test/tool-schema-size.test.mjs && node test/enhancer.test.mjs && node test/multilingual-ru.test.mjs && node test/lazy-batch.test.mjs",
23
+ "test": "node test/run-test.mjs && node test/taskbridge.test.mjs && node test/insight-store.test.mjs && node test/reflection-pipeline.test.mjs && node test/auto-inject.test.mjs && node test/insight-actions.test.mjs && node test/insight-paging.test.mjs && node test/config-schema.test.mjs && node test/host-contract.test.mjs && node test/session-dir.test.mjs && node test/llm-route.test.mjs && node test/doc-index.test.mjs && node test/chunker.test.mjs && node test/client-hints.test.mjs && node test/client-paging.test.mjs && node test/client-task-sync.test.mjs && node test/recall.test.mjs && node test/recall-vector-fusion.test.mjs && node test/vector-index.test.mjs && node test/readiness.test.mjs && node test/insight-derive.test.mjs && node test/readiness-eval.test.mjs && node test/ops.test.mjs && node test/injection-audit.test.mjs && node test/signal-source.test.mjs && node test/skill.test.mjs && node test/injection-budget.test.mjs && node test/injection-scenarios.test.mjs && node test/bugfix-0.5.7.test.mjs && node test/client-icons.test.mjs && node test/client-slash.test.mjs && node test/client-toolview.test.mjs && node test/workflow-command.test.mjs && node test/client-session-id.test.mjs && node test/client-degraded.test.mjs && node test/settings-card.test.mjs && node test/watch-idle.test.mjs && node test/citation-paths.test.mjs && node test/task-view.test.mjs && node test/root-guards.test.mjs && node test/root-policy.test.mjs && node test/gitignore-index.test.mjs && node test/store-gitignore.test.mjs && node test/atomic-write.test.mjs && node test/store-cache.test.mjs && node test/store-concurrent.test.mjs && node test/store-lock.test.mjs && node test/windows-compat.test.mjs && node test/tool-schema-size.test.mjs && node test/enhancer.test.mjs && node test/multilingual-ru.test.mjs && node test/tokenizer-equivalence.test.mjs && node test/lazy-batch.test.mjs && node test/pdfjs-host.test.mjs && node test/index-failures.test.mjs && node test/audit-2026-11-02.test.mjs && node test/memorydir-guard.test.mjs",
24
24
  "eval:injection": "node test/injection-scenarios.test.mjs",
25
25
  "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
26
26
  "selfcheck:triggers": "node test/injection-scenarios.test.mjs --selfcheck",
@@ -61,7 +61,7 @@
61
61
  "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
62
62
  "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
63
63
  "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
64
- "@deepseek-ai/schemastery": "^3.18.2",
64
+ "@deepseek-ai/schemastery": "^3.18.3",
65
65
  "@tsdown/css": "0.22.14",
66
66
  "@types/react": "^18.3.31",
67
67
  "@types/react-dom": "^18.3.7",
@@ -73,7 +73,7 @@
73
73
  "@deepseek-ai/cordis": "^4.0.1",
74
74
  "@deepseek-ai/dsh-llm": ">=0.0.1-rc.1 <0.1.0 || >=0.1.0-rc.1 <0.2.0-0 || >=0.1.1-rc.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
75
75
  "@deepseek-ai/dsh-tools": ">=0.0.1-rc.1 <0.1.0 || >=0.1.0-rc.1 <0.2.0-0 || >=0.1.1-rc.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
76
- "@deepseek-ai/schemastery": "^3.18.1",
76
+ "@deepseek-ai/schemastery": "^3.18.3",
77
77
  "typescript": "^5.0.0 || ^6.0.0"
78
78
  },
79
79
  "peerDependenciesMeta": {
@@ -66,7 +66,11 @@ Run from a shell (no dsh required):
66
66
  ```bash
67
67
  node <this-skill-dir>/scripts/pm-digest.mjs <project-root>
68
68
  node <this-skill-dir>/scripts/pm-digest.mjs <project-root> --json
69
+ node <this-skill-dir>/scripts/pm-digest.mjs <project-root> --memory-dir <name>
69
70
  ```
70
71
 
71
72
  It prints store size, insight/task counts, trigger coverage, and staleness. Use it when memory looks
72
- empty, suspiciously large, or when you need to explain what is stored.
73
+ empty, suspiciously large, or when you need to explain what is stored. The store directory is usually
74
+ `.dsh-project-memory`; if the project configures another `memoryDir`, pass it with `--memory-dir`
75
+ (or `DSH_PROJECT_MEMORY_DIR`) — without either, a single store-shaped directory directly under the
76
+ root is picked up and reported as `auto-detected`, and the "no memory store" message says how to pass it.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // 项目记忆的体检脚本(零依赖、不调模型、不写盘)。
3
3
  //
4
- // node pm-digest.mjs [项目根] [--json]
4
+ // node pm-digest.mjs [项目根] [--json] [--memory-dir <name>]
5
5
  //
6
6
  // 面向模型与人类各一半:模型拿它替代"先读三个 JSON 再数数"的多次工具往返;
7
7
  // 人拿它看 store 是否异常增长、trigger 覆盖多少、任务是不是全归档了。
@@ -10,10 +10,61 @@ import { readFileSync, readdirSync, statSync } from 'node:fs'
10
10
  import { homedir } from 'node:os'
11
11
  import path from 'node:path'
12
12
 
13
+ const DEFAULT_MEMORY_DIR = '.dsh-project-memory'
14
+ const STORE_MARKER = 'format.json'
15
+
13
16
  const args = process.argv.slice(2)
14
17
  const json = args.includes('--json')
15
- const root = path.resolve(args.find((a) => !a.startsWith('--')) || process.cwd())
16
- const memoryDir = path.join(root, '.dsh-project-memory')
18
+ // store 目录名 = config 的 memoryDir;显式 --memory-dir / 环境变量优先。
19
+ let memoryDirName = process.env.DSH_PROJECT_MEMORY_DIR || ''
20
+ const positional = []
21
+ for (let i = 0; i < args.length; i++) {
22
+ const arg = args[i]
23
+ if (arg === '--json') continue
24
+ if (arg === '--memory-dir') {
25
+ memoryDirName = args[++i] || ''
26
+ continue
27
+ }
28
+ if (arg.startsWith('--memory-dir=')) {
29
+ memoryDirName = arg.slice('--memory-dir='.length)
30
+ continue
31
+ }
32
+ if (arg.startsWith('--')) continue
33
+ positional.push(arg)
34
+ }
35
+ const root = path.resolve(positional[0] || process.cwd())
36
+
37
+ const isFile = (file) => {
38
+ try {
39
+ return statSync(file).isFile()
40
+ } catch {
41
+ return false
42
+ }
43
+ }
44
+
45
+ /**
46
+ * store 目录。写死默认名在自定义 `memoryDir` 的项目上会报"没有 store",
47
+ * 而脚本读不到宿主 profile,所以:显式名 → 默认名 → 根下一层按 `format.json` 标记找**唯一**候选。
48
+ * 0 个或多个候选都不猜,沿用默认名并在报错里点名怎么传。
49
+ */
50
+ function resolveMemoryDir(root, name) {
51
+ if (name) return { dir: path.join(root, name), name }
52
+ const fallback = path.join(root, DEFAULT_MEMORY_DIR)
53
+ if (isFile(path.join(fallback, STORE_MARKER))) return { dir: fallback, name: DEFAULT_MEMORY_DIR }
54
+ let candidates = []
55
+ try {
56
+ candidates = readdirSync(root, { withFileTypes: true })
57
+ .filter((entry) => entry.isDirectory() && isFile(path.join(root, entry.name, STORE_MARKER)))
58
+ .map((entry) => entry.name)
59
+ } catch {
60
+ candidates = []
61
+ }
62
+ if (candidates.length === 1) return { dir: path.join(root, candidates[0]), name: candidates[0], detected: true }
63
+ return { dir: fallback, name: DEFAULT_MEMORY_DIR }
64
+ }
65
+
66
+ const resolved = resolveMemoryDir(root, memoryDirName)
67
+ const memoryDir = resolved.dir
17
68
 
18
69
  const readJson = (file, fallback) => {
19
70
  try {
@@ -94,8 +145,15 @@ const binding = readJson(path.join(memoryDir, 'binding.json'), null)
94
145
  const globalFile = path.join(homedir(), '.config', 'dsh-project-memory', 'global.json')
95
146
  const globalDoc = readJson(globalFile, null)
96
147
 
97
- if (!insDoc && !taskDoc) {
98
- const msg = `no memory store at ${memoryDir} (run index_repo or index_doc first)`
148
+ // 有没有 store:`format.json` 标记(走过一次 save)或已有的 insights/tasks 都算。
149
+ // 只看后两者会把"只索引了文档、还没写洞察/任务"的项目误报成没有 store。
150
+ const hasStore = isFile(path.join(memoryDir, STORE_MARKER)) || Boolean(insDoc || taskDoc)
151
+
152
+ if (!hasStore) {
153
+ const hint = resolved.detected || memoryDirName
154
+ ? ''
155
+ : '; if `memoryDir` is customized, pass --memory-dir <name>'
156
+ const msg = `no memory store at ${memoryDir} (run index_repo or index_doc first)${hint}`
99
157
  if (json) process.stdout.write(JSON.stringify({ root, memoryDir, store: false }, null, 2) + '\n')
100
158
  else process.stdout.write(msg + '\n')
101
159
  process.exit(0)
@@ -107,6 +165,7 @@ const tasks = taskStats((Array.isArray(taskDoc) ? taskDoc : []) || [])
107
165
  const summary = {
108
166
  root,
109
167
  memoryDir,
168
+ ...(resolved.detected ? { detected: true } : {}),
110
169
  store: true,
111
170
  shards,
112
171
  insights,
@@ -123,6 +182,9 @@ if (json) {
123
182
  const kb = (n) => (n >= 1024 * 1024 ? `${(n / 1024 / 1024).toFixed(1)} MB` : `${Math.round(n / 102.4) / 10} KB`)
124
183
  const line = (label, value) => process.stdout.write(`${label.padEnd(12)} ${value}\n`)
125
184
  line('project', root)
185
+ if (resolved.name !== DEFAULT_MEMORY_DIR || resolved.detected) {
186
+ line('location', `${resolved.name}${resolved.detected ? ' (auto-detected)' : ''}`)
187
+ }
126
188
  line('store', `${shards.files} shards · ${kb(shards.bytes)} · ${insights.total} insights · ${tasks.total} tasks`)
127
189
  if (insights.total) {
128
190
  const kinds = Object.entries(insights.kinds).map(([k, n]) => `${k} ${n}`).join(' · ')
@@ -426,7 +426,9 @@ function scoreHints({ cands, query, humanText, hintQuery, cfg, dropped, rerank =
426
426
  * @returns {{ text: string, labels: string[], reasons: object[], dropped: object[] }}
427
427
  */
428
428
  export function buildInjection(opts) {
429
- const { query, task, globalStore, cfg } = opts
429
+ const { query, globalStore, cfg } = opts
430
+ // 归档任务不是“当前任务”:即使调用方还拿着旧绑定,也不能回声任务卡或任务级 insights。
431
+ const task = opts.task && !opts.task.archived ? opts.task : null
430
432
  const store = opts.store || null
431
433
  const tags = opts.projectTagsList || []
432
434
  // 就绪上下文可能**已经构建过**(injectForStep 先构建、再传给这里)。二次构建会把第一遍的
@@ -445,7 +447,9 @@ export function buildInjection(opts) {
445
447
  const quotaChars = typeof opts.maxChars === 'number' ? opts.maxChars : Infinity
446
448
  const maxItems = typeof opts.maxItems === 'number' ? opts.maxItems : Infinity
447
449
  const skipItems = opts.skipItems === true
448
- const stepBudget = Math.max(0, (cfg.maxTokens || 400) * 3)
450
+ // 0 是合法值(= 不给注入预算):不能用 `|| 400` 把显式的 0 顶回默认值。
451
+ const maxTokens = typeof cfg.maxTokens === 'number' && Number.isFinite(cfg.maxTokens) ? cfg.maxTokens : 400
452
+ const stepBudget = Math.max(0, maxTokens * 3)
449
453
  const itemBudget = Math.max(0, Math.min(stepBudget, quotaChars))
450
454
 
451
455
  const skipItem = typeof opts.skipItem === 'function' ? opts.skipItem : null
@@ -474,7 +478,7 @@ export function buildInjection(opts) {
474
478
 
475
479
  // 常驻块文本。去重指纹包含“编辑中”行:否则这条常驻状态只会在别的条目变化时顺带更新,
476
480
  // 模型会一直看到旧文件列表;只有热点文件集合/顺序变化时才重发整块。
477
- const echo = cfg.entryOn !== false && shouldEchoTaskCard(task, cfg)
481
+ const echo = stepBudget > 0 && cfg.entryOn !== false && shouldEchoTaskCard(task, cfg)
478
482
  const entry = echo ? buildEntryContent(task, cfg) : ''
479
483
  const entryStable = entry
480
484
  let used = entry.length
@@ -765,8 +769,9 @@ async function injectForStep({ payload, decision, config, cfg, audit, shadow, se
765
769
  }), shadow, root)
766
770
 
767
771
  // 记忆根通告:根是**推定**的(会话工作目录且无任何项目标记)时,第一次注入前告诉模型"记忆存在哪、
768
- // 怎么改"。它是状态声明(与常驻任务卡同类),只发一次、不占条目额度。
769
- const notice = rootNotice({ root, sessionId, sessions, config })
772
+ // 怎么改"。它是状态声明(与常驻任务卡同类),只发一次、不占条目额度;但 maxTokens: 0
773
+ // 的契约是"完全不注入",状态声明也不能绕过。
774
+ const notice = cfg.maxTokens > 0 ? rootNotice({ root, sessionId, sessions, config }) : null
770
775
 
771
776
  const fp = built.text ? fingerprint(built.dedupeText ?? built.text) : fingerprint(notice || '')
772
777
  const injectedText = notice ? (built.text ? `${notice}\n${built.text}` : notice) : built.text
@@ -0,0 +1,185 @@
1
+ /* 插件详情页的「常用设置」:外形照宿主自己的插件卡片(边框 + 16px 圆角 + 折叠头)。 */
2
+ .card {
3
+ box-sizing: border-box;
4
+ border: 0.5px solid var(--dsw-alias-settings-card-stroke, var(--dsw-alias-border-l4, #00000029));
5
+ border-radius: var(--dsw-radius-lg, 16px);
6
+ background: var(--dsw-alias-bg-layer-3, #fff);
7
+ transition: border-color 0.16s, background 0.16s;
8
+ }
9
+
10
+ .card:hover {
11
+ border-color: var(--dsw-alias-label-dimmed, #c8ccd4);
12
+ }
13
+
14
+ .cardOpen {
15
+ background: var(--dsw-alias-bg-layer-2, #f7f8fa);
16
+ border-color: var(--dsw-alias-label-dimmed, #c8ccd4);
17
+ }
18
+
19
+ .header {
20
+ appearance: none;
21
+ display: flex;
22
+ align-items: center;
23
+ gap: 12px;
24
+ width: 100%;
25
+ padding: 14px 16px;
26
+ border: 0;
27
+ border-radius: inherit;
28
+ background: none;
29
+ font: inherit;
30
+ color: inherit;
31
+ text-align: left;
32
+ cursor: pointer;
33
+ }
34
+
35
+ .header:focus-visible {
36
+ outline: 2px solid var(--dsw-alias-brand-primary, #4f6ef7);
37
+ outline-offset: -2px;
38
+ }
39
+
40
+ .headText {
41
+ display: flex;
42
+ flex: 1;
43
+ flex-direction: column;
44
+ gap: 4px;
45
+ min-width: 0;
46
+ }
47
+
48
+ .name {
49
+ font-size: 15px;
50
+ font-weight: 600;
51
+ line-height: 1.4;
52
+ color: var(--dsw-alias-label-primary, #1f2328);
53
+ }
54
+
55
+ .desc {
56
+ font-size: 13px;
57
+ line-height: 1.5;
58
+ color: var(--dsw-alias-label-tertiary, #8b93a1);
59
+ }
60
+
61
+ .unsaved {
62
+ flex: none;
63
+ padding: 0 6px;
64
+ border-radius: 9px;
65
+ font-size: 11px;
66
+ font-weight: 600;
67
+ line-height: 17px;
68
+ color: var(--dsw-alias-label-secondary, #6b7280);
69
+ background: var(--dsw-alias-bg-module-platform, #eef0f4);
70
+ }
71
+
72
+ .chevron {
73
+ flex: none;
74
+ display: inline-flex;
75
+ color: var(--dsw-alias-label-tertiary, #8b93a1);
76
+ transition: transform 0.16s;
77
+ }
78
+
79
+ .chevronOpen {
80
+ transform: rotate(180deg);
81
+ }
82
+
83
+ .body {
84
+ margin: 0 16px;
85
+ padding-bottom: 8px;
86
+ border-top: 1px solid var(--dsw-alias-border-l2, #e5e7eb);
87
+ }
88
+
89
+ .row {
90
+ display: flex;
91
+ align-items: center;
92
+ gap: 12px;
93
+ padding: 12px 0;
94
+ }
95
+
96
+ .row + .row {
97
+ border-top: 1px solid var(--dsw-alias-border-l2, #e5e7eb);
98
+ }
99
+
100
+ .labelBox {
101
+ display: flex;
102
+ flex: 1;
103
+ flex-direction: column;
104
+ gap: 3px;
105
+ min-width: 0;
106
+ }
107
+
108
+ .label {
109
+ font-size: 13px;
110
+ line-height: 20px;
111
+ color: var(--dsw-alias-label-primary, #1f2328);
112
+ }
113
+
114
+ .hint {
115
+ font-size: 12px;
116
+ line-height: 18px;
117
+ color: var(--dsw-alias-label-tertiary, #8b93a1);
118
+ }
119
+
120
+ .control {
121
+ flex: none;
122
+ display: flex;
123
+ align-items: center;
124
+ gap: 6px;
125
+ }
126
+
127
+ .number {
128
+ box-sizing: border-box;
129
+ width: 84px;
130
+ padding: 6px 8px;
131
+ border: 1px solid var(--dsw-alias-border-l2, #d1d5db);
132
+ border-radius: 7px;
133
+ background: var(--dsw-alias-bg-layer-3, #fff);
134
+ font: inherit;
135
+ font-size: 12px;
136
+ line-height: 18px;
137
+ color: var(--dsw-alias-label-primary, #1f2328);
138
+ text-align: right;
139
+ }
140
+
141
+ .number:disabled {
142
+ opacity: 0.5;
143
+ cursor: default;
144
+ }
145
+
146
+ .number:focus {
147
+ border-color: var(--dsw-alias-brand-primary, #4f6ef7);
148
+ outline: 2px solid color-mix(in srgb, var(--dsw-alias-brand-primary, #4f6ef7) 18%, transparent);
149
+ }
150
+
151
+ .number[aria-invalid='true'] {
152
+ border-color: var(--dsw-alias-state-error-primary, #dc2626);
153
+ }
154
+
155
+ .unit {
156
+ font-size: 12px;
157
+ line-height: 18px;
158
+ color: var(--dsw-alias-label-tertiary, #8b93a1);
159
+ }
160
+
161
+ .actions {
162
+ display: flex;
163
+ align-items: center;
164
+ justify-content: flex-end;
165
+ gap: 8px;
166
+ padding: 12px 0 4px;
167
+ border-top: 1px solid var(--dsw-alias-border-l2, #e5e7eb);
168
+ }
169
+
170
+ .failed {
171
+ flex: 1;
172
+ min-width: 0;
173
+ margin: 0;
174
+ font-size: 12px;
175
+ line-height: 18px;
176
+ color: var(--dsw-alias-label-error, #dc2626);
177
+ }
178
+
179
+ .notice {
180
+ margin: 0;
181
+ padding: 12px 0;
182
+ font-size: 12px;
183
+ line-height: 18px;
184
+ color: var(--dsw-alias-label-tertiary, #8b93a1);
185
+ }
@@ -26,6 +26,7 @@ import { registerShowTaskPanelView } from './ShowTaskPanelNode.tsx'
26
26
  import { taskUIStore } from './task-ui-store.ts'
27
27
  import { createSlashSource } from './slash.ts'
28
28
  import { DEGRADED_GRACE_MS, later, missingServices, service } from './services.ts'
29
+ import { registerSettingsCard } from './settings-card.tsx'
29
30
 
30
31
  const NS = 'dsh-project-memory'
31
32
 
@@ -174,8 +175,10 @@ function reportDegradedLater(ctx: any): void {
174
175
  }
175
176
 
176
177
  export function apply(ctx: any): void {
177
- // 顶层不再有任何硬依赖:这里的三步都在缺服务时降级,绝不早退(早退就是静默消失)。
178
+ // 顶层不再有任何硬依赖:这里的几步都在缺服务时降级,绝不早退(早退就是静默消失)。
178
179
  registerTaskPanel(ctx)
179
180
  registerSlashSource(ctx)
181
+ // 插件详情页上的可视化设置:宿主没有 settings / configForms 时整段不跑(见 settings-card.tsx)。
182
+ registerSettingsCard(ctx)
180
183
  reportDegradedLater(ctx)
181
184
  }
@@ -88,6 +88,22 @@ export const zh = {
88
88
  'slash.tasks-desc': '任务清单:步骤进度、涉及文件、当前会话绑定',
89
89
  'slash.project-desc': '项目记忆:本项目的教训 / 决策 / 流程',
90
90
  'slash.global-desc': '全局记忆:跨项目的经验条目',
91
+ // 插件页上的可视化设置卡片(src/client/settings-card.tsx)。
92
+ 'settings.title': '常用设置',
93
+ 'settings.subtitle': '保存后立即生效(启动时全量索引除外);其余配置在 profile 的 cordis.patch.yml 里。',
94
+ 'settings.unsaved': '未保存',
95
+ 'settings.autoIndexOnFirstUse.title': '启动时全量索引',
96
+ 'settings.autoIndexOnFirstUse.hint': '插件加载后扫描当前工作目录;打开后从下次启动开始生效。',
97
+ 'settings.watchInterval.title': '刷新间隔',
98
+ 'settings.watchInterval.hint': '后台自动刷新索引的频率(秒)。回合进行中降频,空闲时最多退避到 2 分钟。',
99
+ 'settings.llmQueryExpansion.title': '检索时扩展查询',
100
+ 'settings.llmQueryExpansion.hint': '让模型先改写几条变体查询再检索,命中更准,但会消耗 token。',
101
+ 'settings.unit.seconds': '秒',
102
+ 'settings.form.unavailable': '设置不可用:宿主没有提供本插件的配置命名空间。',
103
+ 'settings.form.readOnly': '当前部署只读,改动无法保存。',
104
+ 'settings.form.saveFailed': '宿主没有接受这次保存,请检查取值。',
105
+ 'settings.form.save': '保存',
106
+ 'settings.form.saving': '保存中…',
91
107
  }
92
108
 
93
109
  export const en = {
@@ -174,6 +190,21 @@ export const en = {
174
190
  'slash.tasks-desc': 'Task list: progress, involved files, current session binding',
175
191
  'slash.project-desc': 'Project memory: this project’s lessons / decisions / procedures',
176
192
  'slash.global-desc': 'Global memory: experience entries shared across projects',
193
+ 'settings.title': 'Common settings',
194
+ 'settings.subtitle': 'Saved changes apply immediately, except the startup full index; the rest stays in the profile’s cordis.patch.yml.',
195
+ 'settings.unsaved': 'Unsaved',
196
+ 'settings.autoIndexOnFirstUse.title': 'Full index on startup',
197
+ 'settings.autoIndexOnFirstUse.hint': 'Scan the current working directory after the plugin loads; takes effect from the next start.',
198
+ 'settings.watchInterval.title': 'Refresh interval',
199
+ 'settings.watchInterval.hint': 'How often the index refreshes in the background, in seconds. Slower during a turn, up to two minutes when idle.',
200
+ 'settings.llmQueryExpansion.title': 'Expand queries',
201
+ 'settings.llmQueryExpansion.hint': 'Ask the model for a few query variants before search: better recall, spends tokens.',
202
+ 'settings.unit.seconds': 's',
203
+ 'settings.form.unavailable': 'Settings unavailable: the host serves no configuration namespace for this plugin.',
204
+ 'settings.form.readOnly': 'This deployment is read-only; changes cannot be saved.',
205
+ 'settings.form.saveFailed': 'The host rejected this save; check the values.',
206
+ 'settings.form.save': 'Save',
207
+ 'settings.form.saving': 'Saving…',
177
208
  }
178
209
 
179
210
  export type LocaleDict = typeof zh