@deepseek-ai/dsh-plugin-package-inventory-deepseek 0.1.5-rc.2 → 0.1.6-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/llm/plugin-package-inventory-deepseek/README.md
5
- README.md: 8da1b526608348c8c6ec0ff75d7d472921e12aed
6
- README.zh.md: 72fa53e0fbea03ae9e0b218b52d162905834f4f7
5
+ README.md: 4da84873844722aa4fb2ec2ed28984cfe8ec4c88
6
+ README.zh.md: 69d2717c0e44c65754e3c05bb6f89f9c7d9a3060
package/README.md CHANGED
@@ -35,7 +35,9 @@ Shipped profiles use the default, so every official DeepSeek request carries the
35
35
 
36
36
  Every request re-reads active non-group entries from the host Loader tree. When optional `ctx.agentPresets` is present and `sessionId` resolves to a live Agent joined to a standing preset, that preset's separate Loader tree joins the same collection; deployments without the service report the host tree only. Entries are included only while their root fiber is `ACTIVE` and their effective Loader state is enabled.
37
37
 
38
- Bare package and package-subpath specifiers resolve through Node's package search paths without requiring a `./package.json` export. Each ordinary entry uses its owning Loader tree base. A standing preset's root entries use the harness base, matching the preset Loader's deliberate bare-package override; nested includes retain their own bases. Relative and absolute modules walk to their nearest manifest; a manifest without `name` marks a loose module and contributes no package identity. A named package manifest must also declare a non-empty `version`, and malformed package metadata fails request preparation. Exact name/version pairs are deduplicated and sorted with a locale-independent comparison, while simultaneously active different versions remain separate.
38
+ At activation, the plugin samples the optional `ctx.pluginPackages` service. Shipped app boot mounts that service before profile Loader entries, so bare package and package-subpath identities use the same authoritative generation as their imports, including generation misses, without requiring a `./package.json` export. If the service is absent, the plugin retains native Node package-search lookup for its lifetime and does not switch an existing inventory when a resolver mounts later. A low-level embedder that wants runtime-generation identities must therefore mount `PluginPackages` before both the Loader entries and this plugin.
39
+
40
+ Each ordinary entry uses its owning Loader tree base. A standing preset's root entries use the harness base, matching the preset Loader's deliberate bare-package override; nested includes retain their own bases. Relative and absolute modules walk to their nearest manifest; a manifest without `name` marks a loose module and contributes no package identity. A named package manifest must also declare a non-empty `version`, and malformed package metadata fails request preparation. Exact name/version pairs are deduplicated and sorted with a locale-independent comparison, while simultaneously active different versions remain separate.
39
41
 
40
42
  The version-1 `dsh_plugin_packages` field contains only `{ name, version }` pairs. Disabled, pending, failed, disposed, unloading, structural `cordis:` rows, ordinary dependencies, loose files without an owning package identity, programmatically mounted child fibers, and in-memory dynamic plugins are excluded.
41
43
 
@@ -60,7 +62,7 @@ None; package lifecycle changes do not alter the model-visible prefix.
60
62
 
61
63
  <a id="known-limitations-and-deferred-work"></a>
62
64
 
63
- - **Loader package provenance only** — programmatic child fibers and in-memory dynamic plugins do not have authoritative npm name/version provenance and remain outside this inventory.
65
+ - **Loader package identity only** — programmatic child fibers and in-memory dynamic plugins do not have authoritative npm names and versions and remain outside this inventory.
64
66
  - **Loose modules are omitted** — a relative file without a named and versioned owning manifest is a plugin module, not a plugin package.
65
67
  - **In-place package replacement requires restart** — manifest identities are cached for the process lifetime. Loader enable, disable, mount, unmount, and ordinary source HMR still refresh the active entry set, but replacing a mounted package's manifest with another version in the same process is not a supported upgrade path.
66
68
 
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- 用于 DeepSeek 官方 LLM API 请求的完整存活 Loader 插件包清单。该函数插件注入 Loader、存活 Agent 注册表与 `ctx.deepseekLlmApiExtensions`,并拥有 `dsh_plugin_packages` 字段。当官方 API 需要活动包清单进行请求诊断时,请启用它。
12
+ 用于 DeepSeek 官方 LLM API 请求的完整活跃 Loader 插件包清单。该函数插件注入 Loader、存活 Agent 注册表与 `ctx.deepseekLlmApiExtensions`,并拥有 `dsh_plugin_packages` 字段。当官方 API 需要活动包清单进行请求诊断时,请启用它。
13
13
 
14
14
  ## 目录
15
15
 
@@ -33,9 +33,11 @@ kind: "package-reference"
33
33
  <a id="collection"></a>
34
34
  ## 收集
35
35
 
36
- 每次请求都会重读宿主 Loader 树中的存活非 group 配置项。存在可选 `ctx.agentPresets` 且 `sessionId` 解析到已加入 standing preset 的存活 Agent 时,该 preset 的独立 Loader 树也会加入同一次收集;未挂载该服务的部署只报告宿主树。只有根 fiber 处于 `ACTIVE` 且 Loader 有效状态为启用的配置项才会纳入。
36
+ 每次请求都会重读宿主 Loader 树中的活跃非 group 配置项。存在可选 `ctx.agentPresets` 且 `sessionId` 解析到已加入 standing preset 的存活 Agent 时,该 preset 的独立 Loader 树也会加入同一次收集;未挂载该服务的部署只报告宿主树。只有根 fiber 处于 `ACTIVE` 且 Loader 有效状态为启用的配置项才会纳入。
37
37
 
38
- 裸包与包子路径 specifier 通过 Node 包搜索路径解析,无需包导出 `./package.json`。每个普通配置项使用其所属 Loader 树的基址。standing preset 的根配置项使用宿主基址,与 preset Loader 对裸包的显式覆写保持一致;嵌套 include 仍使用自身基址。相对与绝对模块会向上查找最近的 manifest(元数据清单);没有 `name` 的 manifest 只标记松散模块,不贡献包身份。具名包 manifest 还必须声明非空 `version`,格式错误的包元数据会使请求准备失败。系统使用与 locale 无关的比较按确切名称/版本对去重并排序,同时存活的不同版本仍会分开保留。
38
+ 插件在激活时读取一次可选的 `ctx.pluginPackages` 服务。随附 app boot 会在 profile Loader 配置项之前挂载该服务,因此裸包和包子路径的身份使用与其 import 相同的权威 generation,包括 generation 未命中,并且无需包导出 `./package.json`。若该服务不存在,插件会在整个生命周期中保留 Node 原生包搜索,之后再挂载 resolver 也不会切换既有清单。因此,希望使用 runtime generation 身份的底层嵌入方必须先挂载 `PluginPackages`,再挂载 Loader 配置项和本插件。
39
+
40
+ 每个普通配置项使用其所属 Loader 树的基址。standing preset 的根配置项使用宿主基址,与 preset Loader 对裸包的显式覆写保持一致;嵌套 include 仍使用自身基址。相对与绝对模块会向上查找最近的 manifest(元数据清单);没有 `name` 的 manifest 只标记松散模块,不贡献包身份。具名包 manifest 还必须声明非空 `version`,格式错误的包元数据会使请求准备失败。系统使用与 locale 无关的比较按确切名称/版本对去重并排序,同时存活的不同版本仍会分开保留。
39
41
 
40
42
  版本 1 的 `dsh_plugin_packages` 字段只包含 `{ name, version }` 对。系统会排除禁用、pending、failed、disposed、unloading 状态,结构性 `cordis:` 配置项,普通依赖,没有所属包身份的松散文件,以编程方式挂载的子 fiber,以及内存动态插件。
41
43
 
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ import { brandString } from "@deepseek-ai/dsh-brand";
8
8
  /**
9
9
  * Active Loader-backed plugin package inventory for official DeepSeek requests.
10
10
  * Host entries and the requesting agent's standing preset are resolved at request time;
11
- * installed dependencies and plugin fibers without Loader package provenance are excluded.
11
+ * installed dependencies and plugin fibers without Loader-backed package identity are excluded.
12
12
  * @module @deepseek-ai/dsh-plugin-package-inventory-deepseek
13
13
  */
14
14
  /** Cordis plugin name. */
@@ -38,12 +38,12 @@ function identityFromManifest(path, allowAnonymous) {
38
38
  };
39
39
  }
40
40
  /** Resolve a bare package without requiring it to export `./package.json`. */
41
- function barePackageManifest(packageName, anchors) {
41
+ function barePackageManifest(packageName, anchors, packages) {
42
42
  for (const anchor of anchors) {
43
- const searchPaths = createRequire(anchor).resolve.paths(packageName);
44
- /* v8 ignore next -- active non-builtin package entries always have Node package search paths */
45
- if (searchPaths === null) continue;
46
- for (const searchPath of searchPaths) {
43
+ const pkg = packages?.packageOf(packageName, anchor);
44
+ if (pkg !== void 0) return pkg.manifestPath;
45
+ if (packages !== void 0) continue;
46
+ for (const searchPath of createRequire(anchor).resolve.paths(packageName)) {
47
47
  const manifest = join(searchPath, packageName, "package.json");
48
48
  if (existsSync(manifest)) return manifest;
49
49
  }
@@ -63,9 +63,11 @@ function nearestManifest(modulePath) {
63
63
  /** Exact package identity resolver with immutable per-process manifest caching. */
64
64
  var PackageIdentityResolver = class {
65
65
  hostBaseUrl;
66
+ packages;
66
67
  cache = /* @__PURE__ */ new Map();
67
- constructor(hostBaseUrl) {
68
+ constructor(hostBaseUrl, packages) {
68
69
  this.hostBaseUrl = hostBaseUrl;
70
+ this.packages = packages;
69
71
  }
70
72
  /** Resolve one Loader entry's owning package, or absence for a non-package loose module. */
71
73
  resolve({ entry, bareBaseUrl }) {
@@ -82,7 +84,7 @@ var PackageIdentityResolver = class {
82
84
  const packageName = barePackageName(entry.options.name);
83
85
  let manifest;
84
86
  if (packageName !== void 0) {
85
- manifest = barePackageManifest(packageName, anchors);
87
+ manifest = barePackageManifest(packageName, anchors, this.packages);
86
88
  if (manifest === void 0) throw new Error(`plugin-package-inventory-deepseek: cannot resolve active package ${JSON.stringify(packageName)}`);
87
89
  } else if (!entry.options.name.startsWith("cordis:")) {
88
90
  const moduleUrl = isAbsolute(entry.options.name) ? pathToFileURL(entry.options.name) : new URL(entry.options.name, treeBase);
@@ -125,13 +127,13 @@ async function collectActivePluginPackages(ctx, resolver, hostBaseUrl, sessionId
125
127
  }
126
128
  /**
127
129
  * Register the complete `dsh_plugin_packages` request contribution when enabled.
128
- * @param ctx - plugin context carrying Loader provenance and the DeepSeek request-extension registry.
130
+ * @param ctx - plugin context carrying Loader entry metadata and the DeepSeek request-extension registry.
129
131
  * @param config - validated default-on configuration.
130
132
  */
131
133
  function apply(ctx, config) {
132
134
  if (config.enabled === false) return;
133
135
  const hostBaseUrl = ctx.baseUrl ?? import.meta.url;
134
- const resolver = new PackageIdentityResolver(hostBaseUrl);
136
+ const resolver = new PackageIdentityResolver(hostBaseUrl, ctx.get("pluginPackages"));
135
137
  ctx.deepseekLlmApiExtensions.register("dsh_plugin_packages", { prepare: async (request) => {
136
138
  return { value: {
137
139
  version: 1,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Active Loader-backed plugin package inventory for official DeepSeek requests.
3
3
  * Host entries and the requesting agent's standing preset are resolved at request time;
4
- * installed dependencies and plugin fibers without Loader package provenance are excluded.
4
+ * installed dependencies and plugin fibers without Loader-backed package identity are excluded.
5
5
  * @module @deepseek-ai/dsh-plugin-package-inventory-deepseek
6
6
  */
7
7
  import { type Context } from '@deepseek-ai/cordis';
@@ -20,7 +20,7 @@ export interface Config {
20
20
  export declare const Config: z<Config>;
21
21
  /**
22
22
  * Register the complete `dsh_plugin_packages` request contribution when enabled.
23
- * @param ctx - plugin context carrying Loader provenance and the DeepSeek request-extension registry.
23
+ * @param ctx - plugin context carrying Loader entry metadata and the DeepSeek request-extension registry.
24
24
  * @param config - validated default-on configuration.
25
25
  */
26
26
  export declare function apply(ctx: Context, config: Config): void;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Active Loader-backed plugin package inventory for official DeepSeek requests.
3
3
  * Host entries and the requesting agent's standing preset are resolved at request time;
4
- * installed dependencies and plugin fibers without Loader package provenance are excluded.
4
+ * installed dependencies and plugin fibers without Loader-backed package identity are excluded.
5
5
  * @module @deepseek-ai/dsh-plugin-package-inventory-deepseek
6
6
  */
7
7
  import { existsSync, readFileSync } from 'node:fs';
@@ -38,13 +38,14 @@ function identityFromManifest(path, allowAnonymous) {
38
38
  return { name: manifest.name, version: manifest.version };
39
39
  }
40
40
  /** Resolve a bare package without requiring it to export `./package.json`. */
41
- function barePackageManifest(packageName, anchors) {
41
+ function barePackageManifest(packageName, anchors, packages) {
42
42
  for (const anchor of anchors) {
43
- const searchPaths = createRequire(anchor).resolve.paths(packageName);
44
- /* v8 ignore next -- active non-builtin package entries always have Node package search paths */
45
- if (searchPaths === null)
43
+ const pkg = packages?.packageOf(packageName, anchor);
44
+ if (pkg !== undefined)
45
+ return pkg.manifestPath;
46
+ if (packages !== undefined)
46
47
  continue;
47
- for (const searchPath of searchPaths) {
48
+ for (const searchPath of createRequire(anchor).resolve.paths(packageName)) {
48
49
  const manifest = join(searchPath, packageName, 'package.json');
49
50
  if (existsSync(manifest))
50
51
  return manifest;
@@ -68,10 +69,12 @@ function nearestManifest(modulePath) {
68
69
  /** Exact package identity resolver with immutable per-process manifest caching. */
69
70
  class PackageIdentityResolver {
70
71
  hostBaseUrl;
72
+ packages;
71
73
  // TODO: Invalidate manifest identities if in-process package-version replacement becomes a supported upgrade path.
72
74
  cache = new Map();
73
- constructor(hostBaseUrl) {
75
+ constructor(hostBaseUrl, packages) {
74
76
  this.hostBaseUrl = hostBaseUrl;
77
+ this.packages = packages;
75
78
  }
76
79
  /** Resolve one Loader entry's owning package, or absence for a non-package loose module. */
77
80
  resolve({ entry, bareBaseUrl }) {
@@ -84,7 +87,7 @@ class PackageIdentityResolver {
84
87
  const packageName = barePackageName(entry.options.name);
85
88
  let manifest;
86
89
  if (packageName !== undefined) {
87
- manifest = barePackageManifest(packageName, anchors);
90
+ manifest = barePackageManifest(packageName, anchors, this.packages);
88
91
  if (manifest === undefined) {
89
92
  throw new Error(`plugin-package-inventory-deepseek: cannot resolve active package ${JSON.stringify(packageName)}`);
90
93
  }
@@ -145,14 +148,14 @@ async function collectActivePluginPackages(ctx, resolver, hostBaseUrl, sessionId
145
148
  }
146
149
  /**
147
150
  * Register the complete `dsh_plugin_packages` request contribution when enabled.
148
- * @param ctx - plugin context carrying Loader provenance and the DeepSeek request-extension registry.
151
+ * @param ctx - plugin context carrying Loader entry metadata and the DeepSeek request-extension registry.
149
152
  * @param config - validated default-on configuration.
150
153
  */
151
154
  export function apply(ctx, config) {
152
155
  if (config.enabled === false)
153
156
  return;
154
157
  const hostBaseUrl = ctx.baseUrl ?? import.meta.url;
155
- const resolver = new PackageIdentityResolver(hostBaseUrl);
158
+ const resolver = new PackageIdentityResolver(hostBaseUrl, ctx.get('pluginPackages'));
156
159
  ctx.deepseekLlmApiExtensions.register('dsh_plugin_packages', {
157
160
  prepare: async (request) => {
158
161
  const value = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-plugin-package-inventory-deepseek",
3
3
  "description": "Active Loader-backed plugin package inventory for official DeepSeek LLM API requests",
4
- "version": "0.1.5-rc.2",
4
+ "version": "0.1.6-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -32,16 +32,16 @@
32
32
  ],
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "@deepseek-ai/dsh-brand": "^0.1.5-rc.2",
36
- "@deepseek-ai/schemastery": "^3.18.2"
35
+ "@deepseek-ai/schemastery": "^3.18.2",
36
+ "@deepseek-ai/dsh-brand": "^0.1.6-alpha.2"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.2",
40
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
41
40
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
42
- "@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.5-rc.2",
43
- "@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
44
- "@deepseek-ai/dsh-session": "^0.1.5-rc.2"
41
+ "@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
42
+ "@deepseek-ai/dsh-agent-presets": "^0.1.6-alpha.2",
43
+ "@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.6-alpha.2",
44
+ "@deepseek-ai/dsh-session": "^0.1.6-alpha.2"
45
45
  },
46
46
  "peerDependenciesMeta": {
47
47
  "@deepseek-ai/dsh-agent-presets": {
@@ -49,14 +49,15 @@
49
49
  }
50
50
  },
51
51
  "devDependencies": {
52
+ "@deepseek-ai/dsh-app-boot": "^0.1.6-alpha.2",
52
53
  "@deepseek-ai/cordis": "^4.0.2",
53
- "@deepseek-ai/cordis-plugin-include": "^1.0.7",
54
54
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
55
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
56
- "@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
57
- "@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.5-rc.2",
58
- "@deepseek-ai/dsh-scope": "^0.1.5-rc.2",
59
- "@deepseek-ai/dsh-session": "^0.1.5-rc.2",
60
- "@deepseek-ai/dsh-session-projection": "^0.1.5-rc.2"
55
+ "@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
56
+ "@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.6-alpha.2",
57
+ "@deepseek-ai/dsh-agent-presets": "^0.1.6-alpha.2",
58
+ "@deepseek-ai/dsh-scope": "^0.1.6-alpha.2",
59
+ "@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
60
+ "@deepseek-ai/cordis-plugin-include": "^1.0.7",
61
+ "@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.2"
61
62
  }
62
63
  }