dsh-zdiary-kit 3.17.0 → 3.17.1

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 CHANGED
@@ -1,4 +1,4 @@
1
- # dsh-zdiary-kit 3.17.0
1
+ # dsh-zdiary-kit 3.17.1
2
2
 
3
3
  > 给 [DSH](https://github.com/deepseek-ai/deepseek-harness) 装一个**内置 [zk](https://github.com/zk-org/zk) 的知识库 / 日记本**:
4
4
  > 插件提供一键安装 zk(官方 release;设置页按钮或 `zk-kit install`)、自动建笔记本(zk init + 日记模板 + 日记 group),
@@ -21,6 +21,7 @@ import { buildMemoryPayload, formatFileShares } from '../../lib/memory.js';
21
21
  import { RETIRED_ENTRY_RE } from '../../lib/memory-format.js';
22
22
  import { TEMPLATE_VERSION } from '../../lib/agents-template.js';
23
23
  import { parseFrontmatter } from '../../lib/frontmatter.js';
24
+ import { NOTE_TYPE_VALUES } from '../../lib/notebook.js';
24
25
  import { stripPersonaMarker } from '../../lib/persona-template.js';
25
26
  import { esc, layout, renderMarkdown } from './html.js';
26
27
  import { timelineIssues, timelineSummary } from '../../lib/timeline.js';
@@ -442,8 +443,7 @@ async function handleMemory(res, cfg) {
442
443
  ].join('\n');
443
444
  sendHtml(res, 200, shell(cfg, '记忆', body));
444
445
  }
445
- /** 结构过滤的取值:type 跟 zk_new 的目录约定走,status 只有两态 */
446
- const TYPE_VALUES = ['concept', 'source', 'daily', 'meeting', 'person', 'topic'];
446
+ /** 结构过滤的 status 只有两态;type 取值跟 NOTE_TYPE_VALUES 一份真相 */
447
447
  const STATUS_VALUES = ['active', 'superseded'];
448
448
  /** 「type=source · status=superseded」这样的可读串;两个都空就是「不过滤」 */
449
449
  function structureSummary(type, status) {
@@ -457,7 +457,7 @@ function structureForm(current, tag) {
457
457
  const options = (values, picked, empty) => `<option value=""${picked ? '' : ' selected'}>${esc(empty)}</option>` +
458
458
  values.map((v) => `<option value="${v}"${v === picked ? ' selected' : ''}>${esc(v)}</option>`).join('');
459
459
  return `<form class="search" method="get" action="${VIEW}">${hidden}` +
460
- `<select name="type" aria-label="按 type 过滤">${options(TYPE_VALUES, current.type, '全部 type')}</select> ` +
460
+ `<select name="type" aria-label="按 type 过滤">${options(NOTE_TYPE_VALUES, current.type, '全部 type')}</select> ` +
461
461
  `<select name="status" aria-label="按 status 过滤">${options(STATUS_VALUES, current.status, '全部 status')}</select> ` +
462
462
  '<button type="submit">过滤</button></form>';
463
463
  }
@@ -14,8 +14,8 @@ import { config, notebookInfos, selectNotebook } from '../../config/store.js';
14
14
  import { configFor, pinSession, sessionNotebook, sessionState } from '../../config/session.js';
15
15
  import { defaultNotebook, expandHome, processWorkspace, resolveInWorkspace } from '../../config/paths.js';
16
16
  import { S, validateArgs } from '../../lib/tool.js';
17
- import { ensureNotebook, newNoteDir } from '../../lib/notebook.js';
18
- import { searchNotes, searchNotesDetailed, createNote, appendToNote, ensureDailyNote, appendDaily, linkNotes, taglessCjkWarning, notebookStats, supersedeNote, renameNote, hasNotebook, isUnderDir, localDate as dateOnly, runAlias, hasCjk, walkFrom, scanNotes, ZkError, } from '../../lib/zk.js';
17
+ import { NOTE_KINDS, NOTE_TYPE_VALUES, ensureNotebook, newNoteDir } from '../../lib/notebook.js';
18
+ import { searchNotesDetailed, createNote, appendToNote, ensureDailyNote, appendDaily, linkNotes, taglessCjkWarning, notebookStats, supersedeNote, renameNote, hasNotebook, isUnderDir, localDate as dateOnly, runAlias, hasCjk, walkFrom, scanNotes, ZkError, } from '../../lib/zk.js';
19
19
  import { configuredAliases, readAliases } from '../../lib/alias.js';
20
20
  import { buildMemoryPayload, memoryCapacity, META_FILES } from '../../lib/memory.js';
21
21
  import { assembleRecall } from '../../lib/recall.js';
@@ -624,7 +624,7 @@ export function buildTools(workspaceOf = () => processWorkspace()) {
624
624
  query: S.str('全文检索词(中文会自动并用子串,多词按覆盖度合并)'),
625
625
  tags: S.arr('按标签过滤(AND)', S.str('标签名,不带 #')),
626
626
  dirs: S.arr('只看这些目录(相对笔记本,如 notes/concepts)', S.str('相对目录')),
627
- type: S.enum('只要这个类型的笔记', ['daily', 'source', 'concept', 'entity', 'pattern']),
627
+ type: S.enum('只要这个类型的笔记', NOTE_TYPE_VALUES),
628
628
  status: S.enum('只要这个状态(默认 active)', ['active', 'superseded']),
629
629
  since: S.str('只看这个日期之后创建的'),
630
630
  until: S.str('只看这个日期之前创建的'),
@@ -769,7 +769,7 @@ export function buildTools(workspaceOf = () => processWorkspace()) {
769
769
  orphan: S.bool('只看没有反链的孤立笔记'),
770
770
  brokenLinks: S.bool('只看含断链的笔记'),
771
771
  include_archived: S.bool('连 archive/ 里的废弃笔记一起查(默认 false)'),
772
- type: S.enum('只要这个类型的笔记', ['daily', 'source', 'concept', 'entity', 'pattern']),
772
+ type: S.enum('只要这个类型的笔记', NOTE_TYPE_VALUES),
773
773
  status: S.enum('只要这个状态(默认 active)', ['active', 'superseded']),
774
774
  limit: S.num('候选检索条数(1-200,默认 30;装配只在这些候选里挑)'),
775
775
  sort: S.enum('排序方式;有 query 默认 relevance(按 FTS 相关性),无 query 回退 created-desc', ['relevance', 'created-desc', 'created-asc', 'modified-desc', 'title-asc']),
@@ -970,7 +970,7 @@ export function buildTools(workspaceOf = () => processWorkspace()) {
970
970
  summary: S.str('一句话摘要(填进模板的 ## Summary;正文里已经写了这一节就不动)'),
971
971
  tags: S.arr('标签(不写 #)。与设置里的默认标签合并;模板有 frontmatter tags 格就写那一格(layered),没有才追加正文 hashtag 行;与库里已有标签近义时在 tagHints 里提示', S.str('标签名')),
972
972
  dir: S.str('放到哪个子目录(相对笔记本)。flat 默认 notesDir;layered 必须落在某个 group(notes/sources 等,子目录也行),不给就按 type 落位;两者都没有、或不在 group 里都会报错'),
973
- type: S.enum('笔记类型(写进 frontmatter;layered 结构下决定模板的分节,不给 dir 时也决定目录)', ['source', 'concept', 'entity', 'pattern']),
973
+ type: S.enum('笔记类型(写进 frontmatter;layered 结构下决定模板的分节,不给 dir 时也决定目录)', NOTE_KINDS),
974
974
  authority: S.enum('可信度(写进 frontmatter,给未来的自己判断该不该引用)', ['official', 'expert', 'informal']),
975
975
  group: S.str('zk 的 group 名(一般不用给:目录会自动匹配 group)'),
976
976
  links: S.arr('要链接到的笔记(相对路径或标题)', S.str('目标笔记')),
@@ -56,7 +56,7 @@ function matchesQuery(text, terms) {
56
56
  return terms.some((term) => hay.includes(term));
57
57
  }
58
58
  /** raw / 根目录 meta 都不是可导航的笔记:入口指过去也没用 */
59
- function isNonNotePath(cfg, rel) {
59
+ function isNonNotePath(rel) {
60
60
  if (isMetaPath(rel))
61
61
  return true;
62
62
  return rel === 'raw' || rel.startsWith('raw/');
@@ -164,7 +164,7 @@ export function entryPointsOf(cfg, notes, opts = {}) {
164
164
  if (hit.status === 'archived')
165
165
  continue; // 废弃结论归死胡同探针,不当活入口
166
166
  if (hit.status === 'live') {
167
- if (isNonNotePath(cfg, hit.path))
167
+ if (isNonNotePath(hit.path))
168
168
  continue;
169
169
  const known = byPath.get(hit.path);
170
170
  if (known) {
@@ -180,7 +180,7 @@ export function entryPointsOf(cfg, notes, opts = {}) {
180
180
  }
181
181
  // 标题 / id 写法且不在本批结果里:只给入口名,不为了补一次路径再起一个 zk 进程。
182
182
  // 落地交给 `zk_walk <标题>` —— 卢曼的索引给的本来也是卡号,不是卡片。
183
- if (isNonNotePath(cfg, target))
183
+ if (isNonNotePath(target))
184
184
  continue;
185
185
  add({ entry: entry.entry, title: target, path: '', absPath: '', via: 'query', resolved: false });
186
186
  break;
@@ -98,6 +98,12 @@ function dailyGroup(cfg) {
98
98
  }
99
99
  /** layered 的四种笔记类型(顺序与目录 / group 一致) */
100
100
  export const NOTE_KINDS = ['source', 'concept', 'entity', 'pattern'];
101
+ /**
102
+ * type 过滤 / 工具枚举的取值:笔记类型 + daily。
103
+ * daily 不在 NOTE_KINDS 里 —— 日记模板没有 frontmatter `type`,查询时按 dailyDir 路径兜底
104
+ * (见 zk.ts 的 keep),但下拉 / 工具参数都得能筛到它。只读视图与 zk_query / zk_recall 共用这一份。
105
+ */
106
+ export const NOTE_TYPE_VALUES = ['daily', ...NOTE_KINDS];
101
107
  /** type → 目录名的复数(entity 不规则,不能直接加 s) */
102
108
  const PLURAL_DIR = {
103
109
  source: 'sources',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-zdiary-kit",
3
- "version": "3.17.0",
3
+ "version": "3.17.1",
4
4
  "description": "内置 zk 的 DSH 知识库 / 日记插件:装好即用 —— 自动装 zk、建笔记本,给 agent 一组 zk_* 工具(搜索、读写、日记、双链),设置页里管路径、索引与自检。",
5
5
  "icon": "./icon.svg",
6
6
  "repository": {