@x1a0f3n9/dsh-typert-loader 0.1.5-rc.5 → 0.1.7-rc.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
@@ -1,6 +1,58 @@
1
- # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
- # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
- # after editing either side, bring the other along and re-record with:
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/typert/loader/README.md
5
- README.md: 378be98dea5f47e4d6b0a0c70600e2a4c221c80b
6
- README.zh.md: e598127bba12e4057405231fe09199db18f9604d
5
+ /:
6
+ en: 3fa30a143acc79d7
7
+ zh: 0c6fe79fba20f26f
8
+ /x1a0f3n9-dsh-typert-loader:
9
+ en: 92345679476b3a2a
10
+ zh: 3546b7580f3117e0
11
+ /x1a0f3n9-dsh-typert-loader/summary:
12
+ en: be19cf069f29d225
13
+ zh: d2e50148ebe20bcc
14
+ /x1a0f3n9-dsh-typert-loader/table-of-contents:
15
+ en: d152484eb41ac6b4
16
+ zh: 09388d293f9be9cb
17
+ /x1a0f3n9-dsh-typert-loader/use-this-package:
18
+ en: a755161460d28bd2
19
+ zh: 15db6beb30e87926
20
+ /x1a0f3n9-dsh-typert-loader/use-this-package/minimal-configuration:
21
+ en: 881670b2d7dfb04d
22
+ zh: fbf612e945aaf066
23
+ /x1a0f3n9-dsh-typert-loader/use-this-package/what-gets-registered:
24
+ en: 01318fcba39e9b0f
25
+ zh: c5f6528a91b335ac
26
+ /x1a0f3n9-dsh-typert-loader/use-this-package/observable-behavior-and-failures:
27
+ en: 01494e9fbd469ec8
28
+ zh: 3025d870c0f36e2b
29
+ /x1a0f3n9-dsh-typert-loader/understand-the-implementation:
30
+ en: 519c0242ef4d9e21
31
+ zh: a72967feb0ea1b41
32
+ /x1a0f3n9-dsh-typert-loader/understand-the-implementation/design-concept:
33
+ en: 03fc077e58271e18
34
+ zh: 20f8fc02008cee5e
35
+ /x1a0f3n9-dsh-typert-loader/understand-the-implementation/manifest-validation:
36
+ en: eb246aef15ea0532
37
+ zh: 7a4a7bcc788b3ba3
38
+ /x1a0f3n9-dsh-typert-loader/understand-the-implementation/caching-and-ownership:
39
+ en: 38e781e052fdf44e
40
+ zh: d8f6b4d119bf9856
41
+ /x1a0f3n9-dsh-typert-loader/understand-the-implementation/source-map:
42
+ en: 40a8a6723d33b335
43
+ zh: 5b806e49b6279818
44
+ /x1a0f3n9-dsh-typert-loader/further-exploration:
45
+ en: 9665bb4850bb92de
46
+ zh: 508eaf81dee2a10b
47
+ /x1a0f3n9-dsh-typert-loader/model-experience:
48
+ en: d3555a846d0b19a6
49
+ zh: eb4815fbd81a3561
50
+ /x1a0f3n9-dsh-typert-loader/model-experience/kv-cache-effect:
51
+ en: f8a0ad3d0fc0eb32
52
+ zh: 7649a694b279f5f3
53
+ /x1a0f3n9-dsh-typert-loader/known-limitations-and-deferred-work:
54
+ en: a7e281826b58b218
55
+ zh: b4347c965151a1a9
56
+ /x1a0f3n9-dsh-typert-loader/known-limitations-and-deferred-work/dev-note:
57
+ en: e67f633dc6fe7773
58
+ zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- With `dsh-typert-loader` mounted, every package that mounts in a Loader composition automatically contributes its generated Typert reflection and schemas to the runtime registry — and withdraws them when the package or the plugin unmounts. Packages without the generated export are skipped, so adding the plugin to any composition is safe. An explicit `packages` list covers plugins nested behind another Loader entry, whose fibers carry no resolvable package specifier. It is a Node-only plugin and needs the config-tree resolution anchor to resolve packages.
12
+ With `dsh-typert-loader` mounted, every package that mounts in a Loader composition automatically contributes its generated Typert reflection and schema factories to the runtime registry — and withdraws them when the package or the plugin unmounts. Packages without the generated export are skipped, so adding the plugin to any composition is safe. An explicit `packages` list covers plugins nested behind another Loader entry, whose fibers carry no resolvable package specifier. It is a Node-only plugin and needs the config-tree resolution anchor to resolve packages.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -44,7 +44,7 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
44
44
 
45
45
  ### What gets registered
46
46
 
47
- Each qualifying Loader entry contributes its generated host-face reflection and schemas to the runtime registry. Registration follows the entry lifecycle: it is withdrawn when the entry or the plugin unmounts, and an import that settles after either owner is gone is discarded.
47
+ Each qualifying Loader entry contributes its generated host-face reflection and schema factories to the runtime registry. Registration follows the entry lifecycle: it is withdrawn when the entry or the plugin unmounts, and an import that settles after either owner is gone is discarded.
48
48
 
49
49
  ### Observable behavior and failures
50
50
 
@@ -66,7 +66,7 @@ The plugin is an incremental scanner mirroring the client-modules node half: eve
66
66
 
67
67
  ### Manifest validation
68
68
 
69
- `validateTypertManifest()` is the module/file boundary: the manifest crosses from a build artifact into the typed registry, so every field is checked. The manifest must name the package that exports it, carry face `host`, hold zod v4 schema instances, and keep well-formed service, event, object, member, type, and documentation records; invocation descriptors must use strict codecs. Every failure names the package and the defect.
69
+ `validateTypertManifest()` is the module/file boundary: the manifest crosses from a build artifact into the typed registry, so every field is checked. The manifest must name the package that exports it, carry face `host`, hold schema factories, and keep well-formed service, event, object, member, type, and documentation records; invocation descriptors must use strict codecs with factories. Every failure names the package and the defect.
70
70
 
71
71
  ### Caching and ownership
72
72
 
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- 挂载 `dsh-typert-loader` 后,Loader 组合中每个挂载的包都会自动把其生成的 Typert 反射与 schema 贡献给运行时注册表——并在包或本插件卸载时自动撤销。没有该导出的包会被跳过,因此在任何 Loader 组合中挂载它都是安全的。显式 `packages` 用于覆盖嵌套在另一 Loader 配置项之下的插件,这些插件的 fiber 不携带可解析的包说明符。它是仅支持 Node 的插件,需要配置树解析锚点才能解析包。
12
+ 挂载 `dsh-typert-loader` 后,Loader 组合中每个挂载的包都会自动把其生成的 Typert 反射与 schema factory 贡献给运行时注册表——并在包或本插件卸载时自动撤销。没有该导出的包会被跳过,因此在任何 Loader 组合中挂载它都是安全的。显式 `packages` 用于覆盖嵌套在另一 Loader 配置项之下的插件,这些插件的 fiber 不携带可解析的包说明符。它是仅支持 Node 的插件,需要配置树解析锚点才能解析包。
13
13
 
14
14
  ## 目录
15
15
 
@@ -44,7 +44,7 @@ kind: "package-reference"
44
44
 
45
45
  ### 注册什么
46
46
 
47
- 每个符合条件的 Loader 配置项都会把其生成的宿主侧反射与 schema 贡献给运行时注册表。注册跟随配置项生命周期:配置项或本插件卸载时撤销;在配置项或本插件任一方卸载后才结束的导入操作会被丢弃。
47
+ 每个符合条件的 Loader 配置项都会把其生成的宿主侧反射与 schema factory 贡献给运行时注册表。注册跟随配置项生命周期:配置项或本插件卸载时撤销;在配置项或本插件任一方卸载后才结束的导入操作会被丢弃。
48
48
 
49
49
  ### 可观察行为与失败
50
50
 
@@ -66,7 +66,7 @@ kind: "package-reference"
66
66
 
67
67
  ### Manifest 校验
68
68
 
69
- `validateTypertManifest()` 是模块/文件边界:manifest 从构建产物进入类型化注册表,因此每个字段都会被检查。manifest 必须指名导出它的包、携带 `host` face、持有 zod v4 schema 实例,并保持服务、事件、对象、成员、类型与文档记录格式正确;调用描述符必须使用严格编解码器。每次失败都会指名包与缺陷。
69
+ `validateTypertManifest()` 是模块/文件边界:manifest 从构建产物进入类型化注册表,因此每个字段都会被检查。manifest 必须指名导出它的包、携带 `host` face、持有 schema factory,并保持服务、事件、对象、成员、类型与文档记录格式正确;调用描述符必须使用带 factory 的严格编解码器。每次失败都会指名包与缺陷。
70
70
 
71
71
  ### 缓存与归属
72
72
 
package/lib/index.js CHANGED
@@ -84,7 +84,7 @@ function validateTypertManifest(pkgName, exported) {
84
84
  if (typeof value !== "object" || value === null) throw new Error(`typert-loader: ${pkgName} TYPERT.schemas contains a non-object schema`);
85
85
  const schema = value;
86
86
  requireString(pkgName, schema, "name", "schema");
87
- if (typeof schema.schema !== "object" || schema.schema === null || !("_zod" in schema.schema)) throw new Error(`typert-loader: ${pkgName} TYPERT schema "${schema.name}" is not a zod v4 schema instance`);
87
+ if (typeof schema.create !== "function") throw new Error(`typert-loader: ${pkgName} TYPERT schema "${schema.name}" has no create() factory`);
88
88
  }
89
89
  const model = requireObject(pkgName, manifest.model, "TYPERT.model");
90
90
  const services = requireArray(pkgName, model.services, "TYPERT.model.services");
@@ -207,7 +207,8 @@ function requireStrictCodec(pkgName, value, subject) {
207
207
  const codec = requireObject(pkgName, value, subject);
208
208
  if (codec.mode !== "strict") throw new Error(`typert-loader: ${pkgName} ${subject} must use a strict codec`);
209
209
  requireString(pkgName, codec, "typeSymbol", subject);
210
- if (typeof codec.schema !== "object" || codec.schema === null || !("_zod" in codec.schema) || typeof codec.schema.parse !== "function") throw new Error(`typert-loader: ${pkgName} ${subject} is not backed by a zod v4 schema`);
210
+ for (const method of ["decode", "encode"]) if (codec[method] !== void 0 && typeof codec[method] !== "function") throw new Error(`typert-loader: ${pkgName} ${subject} ${method} must be a function`);
211
+ if (typeof codec.create !== "function") throw new Error(`typert-loader: ${pkgName} ${subject} has no create() factory`);
211
212
  }
212
213
  /**
213
214
  * Scan current Loader entries during activation, then follow entry mounts and
@@ -217,7 +218,8 @@ function requireStrictCodec(pkgName, value, subject) {
217
218
  */
218
219
  async function apply(ctx, config) {
219
220
  if (ctx.baseUrl === void 0) throw new Error("typert-loader: ctx.baseUrl is unset — the loader needs the config-tree anchor to resolve plugin packages");
220
- const require = createRequire(ctx.baseUrl);
221
+ const baseUrl = ctx.baseUrl;
222
+ const require = createRequire(baseUrl);
221
223
  const configured = new Set(config.packages);
222
224
  const registered = /* @__PURE__ */ new Map();
223
225
  const pending = /* @__PURE__ */ new Map();
@@ -235,17 +237,33 @@ async function apply(ctx, config) {
235
237
  const resolveArtifact = (pkgName) => {
236
238
  const cached = artifactPath.get(pkgName);
237
239
  if (cached !== void 0) return cached;
240
+ const firstSlash = pkgName.indexOf("/");
241
+ if (firstSlash >= 0 && (pkgName[0] !== "@" || pkgName.indexOf("/", firstSlash + 1) >= 0)) {
242
+ if (configured.has(pkgName)) throw new Error(`typert-loader: configured package "${pkgName}" cannot be resolved from the config tree — add it to the composition package dependencies or remove it from packages`);
243
+ artifactPath.set(pkgName, null);
244
+ return null;
245
+ }
238
246
  let pkgPath;
247
+ let pkg;
239
248
  try {
240
- pkgPath = require.resolve(`${pkgName}/package.json`);
249
+ const packages = ctx.get("pluginPackages");
250
+ const resolvedPackage = packages?.packageOf(pkgName, baseUrl);
251
+ if (packages !== void 0 && resolvedPackage === void 0) throw new Error("package is absent from the active resolver");
252
+ pkgPath = resolvedPackage === void 0 ? require.resolve(`${pkgName}/package.json`) : resolvedPackage.manifestPath;
253
+ pkg = resolvedPackage?.manifest;
241
254
  } catch (cause) {
242
255
  if (configured.has(pkgName)) throw new Error(`typert-loader: configured package "${pkgName}" cannot be resolved from the config tree — add it to the composition package dependencies or remove it from packages`, { cause });
243
256
  artifactPath.set(pkgName, null);
244
257
  return null;
245
258
  }
246
- const rel = typertExportOf(pkgName, JSON.parse(readFileSync(pkgPath, "utf8")).exports);
259
+ pkg ??= JSON.parse(readFileSync(pkgPath, "utf8"));
260
+ const manifestName = typeof pkg.name === "string" ? pkg.name : pkgName;
261
+ const rel = typertExportOf(manifestName, pkg.exports);
247
262
  if (rel === void 0 && configured.has(pkgName)) throw new Error(`typert-loader: configured package "${pkgName}" does not export "${TYPERT_HOST_EXPORT}"`);
248
- const resolved = rel === void 0 ? null : join(dirname(pkgPath), rel);
263
+ const resolved = rel === void 0 ? null : {
264
+ packageName: manifestName,
265
+ path: join(dirname(pkgPath), rel)
266
+ };
249
267
  artifactPath.set(pkgName, resolved);
250
268
  return resolved;
251
269
  };
@@ -275,9 +293,9 @@ async function apply(ctx, config) {
275
293
  return;
276
294
  }
277
295
  if (registered.has(entryName) || pending.has(entryName)) return void 0;
278
- const path = resolveArtifact(entryName);
279
- if (path === null) return void 0;
280
- const task = loadManifest(entryName, path).then((manifest) => {
296
+ const artifact = resolveArtifact(entryName);
297
+ if (artifact === null) return void 0;
298
+ const task = loadManifest(artifact.packageName, artifact.path).then((manifest) => {
281
299
  if (!active || !qualifies(entryName) || registered.has(entryName)) return;
282
300
  registered.set(entryName, ctx.typert.register(manifest));
283
301
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@x1a0f3n9/dsh-typert-loader",
3
3
  "description": "Loader integration for generated Typert package contributions",
4
- "version": "0.1.5-rc.5",
4
+ "version": "0.1.7-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,17 +27,18 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
- "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
31
- "@x1a0f3n9/dsh-typert-registry": "^0.1.5-rc.5",
32
- "@deepseek-ai/cordis": "^4.0.2"
30
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.5",
31
+ "@x1a0f3n9/dsh-typert-registry": "0.1.7-rc.2",
32
+ "@deepseek-ai/cordis": "~4.0.4"
33
33
  },
34
34
  "dependencies": {
35
- "@deepseek-ai/schemastery": "^3.18.2"
35
+ "@deepseek-ai/schemastery": "~3.18.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "zod": "^4.4.3",
39
- "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
40
- "@x1a0f3n9/dsh-typert-registry": "^0.1.5-rc.5",
41
- "@deepseek-ai/cordis": "^4.0.2"
39
+ "@x1a0f3n9/dsh-app-boot": "0.1.7-rc.2",
40
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.5",
41
+ "@x1a0f3n9/dsh-typert-registry": "0.1.7-rc.2",
42
+ "@deepseek-ai/cordis": "~4.0.4"
42
43
  }
43
44
  }