@klarkxy/dsh-dev-index 0.1.7 → 0.2.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,5 +1,8 @@
1
1
  # DSH Docs
2
2
 
3
+ <!-- release-state-note -->
4
+ The [repository registry](../../README.md#plugin-lifecycle) tracks Draft → Testing → Published, moving forward only. Fixes, testing and version updates keep published packages Published; each update still passes release checks. First publication explicitly selects Testing packages and records Published only after npm archive verification. See the [release guide](../../RELEASING.md).
5
+
3
6
  [简体中文](README.zh-CN.md) | [English](README.md)
4
7
 
5
8
  Runtime: Node `^22.19.0 || >=24.0.0` and DSH `>=0.1.7-rc.2`. The documentation reader is a DSH Web client; the four read-only tools and the Creator-mode guidance run in the host.
@@ -23,7 +26,7 @@ The host half adds one system-prompt section when the session uses the `cordis`
23
26
  - `dsh_docs_search({ query: "plugin", language: "en" })` searches the live official `llms.txt` directory: titles, categories and paths. This is a directory search, not full-text search; an empty result does not establish that a topic is absent from the document bodies, so try broader Chinese or English keywords.
24
27
  - `dsh_docs_fetch({ id: "en/develop/basic/tool.md" })` reads a document ID returned by search. Results include the source URL, fetch time, content revision and `nextOffset`. Continue with that offset and the same `revision`; if the document changes, restart from offset zero. The default page size is 12,000 characters, at most 16,000.
25
28
  - `dsh_plugins_search({ query: "memory" })` finds candidate plugins. The default `catalog` source searches the curated klarkxy Chinese/English plugin catalog; `source: "npm"` searches npm's `dsh-plugin` keyword more broadly. Neither source is exhaustive, and a hit is a candidate rather than verified compatibility.
26
- - `dsh_plugins_fetch({ package: "@klarkxy/dsh-memory", version: "latest" })` reads npm registry metadata for an exact package name: dist-tags, published versions in publication-time order, and the selected version's bundle declaration, DSH/Node engine ranges, dependencies and deprecation. `version` accepts an exact release or a dist-tag; ranges are rejected.
29
+ - `dsh_plugins_fetch({ package: "@klarkxy/dsh-current-title", version: "latest" })` reads npm registry metadata for an exact package name: dist-tags, published versions in publication-time order, and the selected version's bundle declaration, DSH/Node engine ranges, dependencies and deprecation. `version` accepts an exact release or a dist-tag; ranges are rejected.
27
30
 
28
31
  The plugin-registry tools are read-only metadata lookups: nothing is downloaded, installed or executed, and a declared engines range is not runtime compatibility proof. GitHub-installed plugins have no registry metadata; install those directly with the official plugin manager as `github:owner/repo#commit`, and review their `package.json` yourself.
29
32
 
package/README.zh-CN.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # DSH 文档
2
2
 
3
+ <!-- release-state-note -->
4
+ 插件生命周期见[仓库状态清单](../../README.zh-CN.md#插件生命周期):草稿 → 测试中 → 已发布,只向前推进。已发布插件的修复、测试和升版保持已发布;每次更新仍须通过发布检查。首次发布须明确选择测试中的包,并在 npm 归档验证成功后登记。详见[发布规则](../../RELEASING.zh-CN.md)。
5
+
3
6
  [简体中文](README.zh-CN.md) | [English](README.md)
4
7
 
5
8
  **运行环境**:Node `^22.19.0 || >=24.0.0`、DSH `>=0.1.7-rc.2`。文档阅读器是 DSH Web 客户端;四个只读工具和创造模式指引运行在宿主里。
@@ -23,7 +26,7 @@
23
26
  - `dsh_docs_search({ query: "插件", language: "zh" })` 在线读取官方 `llms.txt`,搜索标题、分类和路径。这是目录搜索,不是全文搜索;没有命中不代表正文不含相关内容,可以改用更宽泛的中文或英文关键词。
24
27
  - `dsh_docs_fetch({ id: "develop/basic/tool.md" })` 读取搜索结果中的文档 ID。结果包含来源、获取时间、内容修订值和 `nextOffset`。长文用该偏移量和相同的 `revision` 继续读取;正文更新时需要从头重读。默认每次返回 12,000 字符,上限 16,000。
25
28
  - `dsh_plugins_search({ query: "记忆" })` 查找候选插件。默认 `catalog` 数据源搜索 klarkxy 维护的中英文插件目录;`source: "npm"` 用 npm 的 `dsh-plugin` 关键词做更宽的发现。两个源都不是全量目录,命中结果只是候选,不代表兼容性已验证。
26
- - `dsh_plugins_fetch({ package: "@klarkxy/dsh-memory", version: "latest" })` 按确切包名读取 npm 注册表元数据:dist-tags、按发布时间排序的版本列表,以及选定版本的组合包声明、DSH/Node 版本要求、依赖和弃用说明。`version` 可填精确版本或标签,不接受范围。
29
+ - `dsh_plugins_fetch({ package: "@klarkxy/dsh-current-title", version: "latest" })` 按确切包名读取 npm 注册表元数据:dist-tags、按发布时间排序的版本列表,以及选定版本的组合包声明、DSH/Node 版本要求、依赖和弃用说明。`version` 可填精确版本或标签,不接受范围。
27
30
 
28
31
  插件注册表工具是只读元数据查询:不下载、不安装、不执行任何代码,声明的 engines 范围也不是运行时兼容性证明。从 GitHub 安装的插件没有注册表元数据,直接用官方插件管理器以 `github:owner/repo#commit` 安装,并自行审阅其 `package.json`。
29
32
 
package/client.js CHANGED
@@ -85,18 +85,17 @@ const css = `
85
85
  const hostLanguage = locale => locale.getSnapshot().active.startsWith('zh') ? 'zh' : 'en';
86
86
 
87
87
  function DocumentationBrowser({ hostLocale }) {
88
- const [language, setLanguage] = React.useState(() => hostLanguage(hostLocale));
88
+ const subscribe = React.useCallback(listener => hostLocale.subscribe(listener), [hostLocale]);
89
+ const snapshot = React.useCallback(() => hostLanguage(hostLocale), [hostLocale]);
90
+ const uiLanguage = React.useSyncExternalStore(subscribe, snapshot, snapshot);
91
+ const [selectedLanguage, setLanguage] = React.useState(uiLanguage);
89
92
  /* Once the reader picks a language, the host locale stops driving it. */
90
93
  const [pinned, setPinned] = React.useState(false);
91
94
  const [revision, setRevision] = React.useState(0);
92
95
  const [status, setStatus] = React.useState('loading');
96
+ const language = pinned ? selectedLanguage : uiLanguage;
93
97
  const url = language === 'zh' ? pages : `${pages}en/`;
94
- const chinese = language === 'zh';
95
-
96
- React.useEffect(() => {
97
- if (pinned) return undefined;
98
- return hostLocale.subscribe(() => setLanguage(hostLanguage(hostLocale)));
99
- }, [hostLocale, pinned]);
98
+ const chinese = uiLanguage === 'zh';
100
99
 
101
100
  React.useEffect(() => {
102
101
  setStatus('loading');
@@ -107,7 +106,7 @@ const css = `
107
106
  function reload() { setRevision(value => value + 1); }
108
107
  function choose(nextLanguage) {
109
108
  setPinned(true);
110
- if (nextLanguage !== language) setLanguage(nextLanguage);
109
+ setLanguage(nextLanguage);
111
110
  }
112
111
 
113
112
  const open = h('a', {
package/dsh.plugin.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "id": "@klarkxy/dsh-dev-index",
3
- "version": "0.1.7",
3
+ "version": "0.2.1",
4
4
  "main": "lib/index.js",
5
5
  "description": "DSH Docs: read the official DSH documentation in the Plugins page; Creator mode searches and fetches it with native tools.",
6
6
  "engines": {
7
- "dsh": ">=0.1.7-rc.2"
7
+ "dsh": ">=0.2.0-rc.2"
8
8
  },
9
9
  "contributes": {
10
- "tools": ["dsh_docs_search", "dsh_docs_fetch"],
10
+ "tools": [
11
+ "dsh_docs_search",
12
+ "dsh_docs_fetch"
13
+ ],
11
14
  "skills": []
12
15
  }
13
16
  }
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
+ import { CREATOR_PRESET_ID } from "@klarkxy/dsh-plugin-kit/contracts";
2
3
  import { CREATOR_GUIDANCE } from "./creator-guidance.js";
3
4
  import { DocsClient } from "./docs.js";
4
5
  import { docsTools } from "./docs-tools.js";
@@ -30,7 +31,7 @@ export function apply(ctx, config) {
30
31
  ctx.effect(() => ctx.systemPrompt.section({
31
32
  name: "dsh-dev-index.creator-docs",
32
33
  order: 100,
33
- text: ({ agent }) => agent !== undefined && ctx.agentPresets.composedPreset(agent.ctx) === "cordis"
34
+ text: ({ agent }) => agent !== undefined && ctx.agentPresets.composedPreset(agent.ctx) === CREATOR_PRESET_ID
34
35
  ? CREATOR_GUIDANCE
35
36
  : "",
36
37
  }), "dsh-dev-index.creator-docs");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klarkxy/dsh-dev-index",
3
- "version": "0.1.7",
3
+ "version": "0.2.1",
4
4
  "description": "DSH Docs: read the official DSH documentation in the Plugins page; Creator mode searches docs and checks plugin npm metadata with native tools.",
5
5
  "icon": "./icon.svg",
6
6
  "keywords": [
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "files": [
40
40
  "icon.svg",
41
+ "scripts/prepare.mjs",
41
42
  "client.js",
42
43
  "lib/**/*.js",
43
44
  "lib/**/*.d.ts",
@@ -49,14 +50,14 @@
49
50
  ],
50
51
  "scripts": {
51
52
  "build": "tsc -p tsconfig.build.json",
52
- "prepare": "pnpm build",
53
+ "prepare": "node scripts/prepare.mjs",
53
54
  "prepack": "pnpm build",
54
55
  "typecheck": "tsc -p tsconfig.json",
55
56
  "test": "vitest run"
56
57
  },
57
58
  "engines": {
58
59
  "node": "^22.19.0 || >=24.0.0",
59
- "dsh": ">=0.1.7-rc.2"
60
+ "dsh": ">=0.2.0-rc.2"
60
61
  },
61
62
  "license": "SEE LICENSE IN LICENSE",
62
63
  "dsh": {
@@ -72,11 +73,14 @@
72
73
  }
73
74
  },
74
75
  "peerDependencies": {
75
- "@deepseek-ai/cordis": "^4.0.2",
76
- "@deepseek-ai/dsh-agent-preset-registry": ">=0.1.7-rc.2",
77
- "@deepseek-ai/dsh-system-prompt": ">=0.1.7-rc.2",
78
- "@deepseek-ai/schemastery": "^3.18.2",
79
- "@deepseek-ai/dsh-tools": ">=0.1.7-rc.2"
76
+ "@deepseek-ai/cordis": ">=4.0.4",
77
+ "@deepseek-ai/dsh-agent-preset-registry": ">=0.2.0-rc.2",
78
+ "@deepseek-ai/dsh-system-prompt": ">=0.2.0-rc.2",
79
+ "@deepseek-ai/schemastery": ">=3.18.4",
80
+ "@deepseek-ai/dsh-tools": ">=0.2.0-rc.2"
81
+ },
82
+ "dependencies": {
83
+ "@klarkxy/dsh-plugin-kit": "0.3.0"
80
84
  },
81
85
  "peerDependenciesMeta": {
82
86
  "@deepseek-ai/dsh-agent-preset-registry": {
@@ -92,18 +96,17 @@
92
96
  "devDependencies": {
93
97
  "@deepseek-ai/cordis": "4.0.4",
94
98
  "@deepseek-ai/schemastery": "3.18.4",
95
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
96
- "@deepseek-ai/dsh-agent-preset-registry": "0.1.7-rc.2",
97
- "@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2",
98
- "@deepseek-ai/dsh-tools": "0.1.7-rc.2",
99
- "@deepseek-ai/dsh-scope": "0.1.7-rc.2",
100
- "@deepseek-ai/dsh-invariants": "0.1.7-rc.2"
99
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
100
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.0-rc.2",
101
+ "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
102
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
103
+ "@deepseek-ai/dsh-scope": "0.2.0-rc.2"
101
104
  },
102
105
  "publishConfig": {
103
106
  "access": "public",
104
107
  "registry": "https://registry.npmjs.org/"
105
108
  },
106
109
  "dshRelease": {
107
- "contentHash": "0778ecf2ce276ea3ebc49c845fb1a980ad8c1d041faee741cff1f63045d2a9f8"
110
+ "contentHash": "3a0b6e7fd1e2c97ad944581ca989658034c02bd300be660e5445e976d54f6e0d"
108
111
  }
109
112
  }
@@ -0,0 +1,39 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { existsSync, realpathSync } from 'node:fs';
3
+ import { createRequire } from 'node:module';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const require = createRequire(import.meta.url);
7
+ const packageRoot = new URL('../', import.meta.url);
8
+
9
+ try {
10
+ require.resolve('@klarkxy/dsh-plugin-kit/contracts');
11
+ } catch (error) {
12
+ // Only defer a clean monorepo install. Missing/broken published dependencies
13
+ // must fail Git installs, not silently produce a package without lib/.
14
+ const workspaceKit = new URL('../../dsh-plugin-kit/package.json', import.meta.url);
15
+ const workspaceFile = new URL('../../../pnpm-workspace.yaml', import.meta.url);
16
+ if (
17
+ error.code !== 'MODULE_NOT_FOUND' ||
18
+ !existsSync(workspaceFile) ||
19
+ !existsSync(workspaceKit) ||
20
+ realpathSync(require.resolve('@klarkxy/dsh-plugin-kit/package.json')) !== realpathSync(workspaceKit)
21
+ ) {
22
+ throw error;
23
+ }
24
+ console.log('prepare: deferred until workspace plugin-kit is built; prepack still requires a build');
25
+ process.exit(0);
26
+ }
27
+
28
+ // npm and pnpm supply their JS entry point to lifecycle scripts. Launch it
29
+ // through Node so paths with spaces and Windows .cmd wrappers need no shell.
30
+ if (!process.env.npm_execpath) {
31
+ throw new Error('prepare must run through a package manager (npm_execpath is missing)');
32
+ }
33
+ const result = spawnSync(process.execPath, [process.env.npm_execpath, 'run', 'build'], {
34
+ cwd: fileURLToPath(packageRoot),
35
+ stdio: 'inherit',
36
+ });
37
+ if (result.error) throw result.error;
38
+ if (result.signal) throw new Error(`prepare build terminated by ${result.signal}`);
39
+ process.exitCode = result.status ?? 1;