skill-family-harness-node 0.8.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ <!-- release-skill:changelog:start version=0.8.2 locale=en baseline=sha256:af051a6925c7d1f46bef6fbe367aceea8685b4a916629af4e69334e73014e3a7 -->
4
+ ## [0.8.2] - 2026-08-23
5
+
6
+ The fixed candidate mechanism bridge now exposes the existing strict reader through read-file-strict.
7
+
8
+ ### Added
9
+
10
+ - Adds read-file-strict to invokeFoundationMechanism with closed root, path, encoding, and expectedSha256 parameters.
11
+ - Returns UTF-8 content as a string and binary content in the standard JSON-safe Buffer shape.
12
+
13
+ ### Changed
14
+
15
+ - Delegates containment, file reading, digest verification, and failure classification directly to readFileStrict; no second read algorithm is introduced.
16
+ - Moves the package version to 0.8.2 together with Contracts and Engineering Kit.
17
+
18
+ ### Upgrade Notes
19
+
20
+ Candidate consumers must pin all three Foundation packages to exactly 0.8.2 and rebuild their managed Bundle. Direct calls retain SFC2004 details.kind failures; the JSON CLI continues to promise only exit code 0 for success and 2 for rejection.
21
+ <!-- release-skill:changelog:end version=0.8.2 locale=en -->
22
+
23
+
24
+ <!-- release-skill:changelog:start version=0.8.1 locale=en baseline=sha256:4cd9f23da3561184cef4ebadb7e758a22d377d069742bbe7c77166d6c1b3bd14 -->
25
+ ## [0.8.1] - 2026-08-22
26
+
27
+ Harness now preserves its own report renderer version when a host bundles it into a single-file adapter.
28
+
29
+ ### Changed
30
+
31
+ - Moves the package version to 0.8.1 together with Contracts and Engineering Kit.
32
+ - Keeps all 21 Harness capabilities, report contracts, and public exports unchanged.
33
+
34
+ ### Fixed
35
+
36
+ - Replaces the report renderer's runtime import.meta.url package-manifest lookup with a static JSON import, so esbuild inlines the Harness version instead of resolving the host adapter's package metadata.
37
+ - Adds source and third-party single-file bundle regression tests for REPORT_RENDERER_VERSION.
38
+
39
+ ### Upgrade Notes
40
+
41
+ Host adapters that bundle the report renderer must pin Harness 0.8.1. The report API and renderer identity remain unchanged, so no API migration is required from 0.8.0.
42
+ <!-- release-skill:changelog:end version=0.8.1 locale=en -->
43
+
44
+
3
45
  <!-- release-skill:changelog:start version=0.8.0 locale=en baseline=sha256:85322b5fb8d4e3a2177fbe9e37427235256d530bf604d0b5cdb95cf2ad11cc50 -->
4
46
  ## [0.8.0] - 2026-08-21
5
47
 
@@ -1,5 +1,47 @@
1
1
  # 变更日志
2
2
 
3
+ <!-- release-skill:changelog:start version=0.8.2 locale=zh-CN baseline=sha256:748d79d51dcabe6193332e60ec69a6eb26fd914ad3555f6e924b78db71016192 -->
4
+ ## [0.8.2] - 2026-08-23
5
+
6
+ 固定的候选机制桥接新增 read-file-strict,直接公开既有严格读取机制。
7
+
8
+ ### 新增
9
+
10
+ - invokeFoundationMechanism 新增 read-file-strict;参数闭合为 root、path、encoding 和 expectedSha256。
11
+ - UTF-8 内容返回字符串,二进制内容返回标准的 JSON 安全 Buffer 形态。
12
+
13
+ ### 变更
14
+
15
+ - 路径收容、文件读取、摘要复验和失败分类全部转发给 readFileStrict,不新增第二套读取算法。
16
+ - 包版本与 Contracts、Engineering Kit 一同升至 0.8.2。
17
+
18
+ ### 升级说明
19
+
20
+ 候选消费者必须把三个 Foundation 包精确锁定到 0.8.2,再重建受管 Bundle。直接调用继续返回 SFC2004 与 details.kind;JSON CLI 只承诺成功退出码 0 和拒绝退出码 2。
21
+ <!-- release-skill:changelog:end version=0.8.2 locale=zh-CN -->
22
+
23
+
24
+ <!-- release-skill:changelog:start version=0.8.1 locale=zh-CN baseline=sha256:904de77446dbc69ef7e70cdda0020fd98632a6e704754f6ed57e136764e3112e -->
25
+ ## [0.8.1] - 2026-08-22
26
+
27
+ 宿主把 Harness 打包进单文件适配器后,报告渲染器仍能保留 Harness 自身的包版本。
28
+
29
+ ### 变更
30
+
31
+ - 包版本与 Contracts、Engineering Kit 一同升至 0.8.1。
32
+ - Harness 的 21 项能力、报告合同和公共导出均保持不变。
33
+
34
+ ### 修复
35
+
36
+ - 用静态 JSON import 替换报告渲染器运行时基于 import.meta.url 的包清单查找,使 esbuild 内联 Harness 版本,不再读取宿主适配器的包元数据。
37
+ - 为 REPORT_RENDERER_VERSION 新增源码运行与第三方单文件 bundle 回归测试。
38
+
39
+ ### 升级说明
40
+
41
+ 把报告渲染器打包进宿主适配器的消费者必须精确锁定 Harness 0.8.1;报告 API 与渲染器身份保持不变,从 0.8.0 升级不需要迁移 API。
42
+ <!-- release-skill:changelog:end version=0.8.1 locale=zh-CN -->
43
+
44
+
3
45
  <!-- release-skill:changelog:start version=0.8.0 locale=zh-CN baseline=sha256:83f13f0b9f624ee26865c5d1bb0295ecd8cbaa64c581f066b53012eadf1dc040 -->
4
46
  ## [0.8.0] - 2026-08-21
5
47
 
package/README.md CHANGED
@@ -4,22 +4,28 @@
4
4
 
5
5
  # skill-family-harness-node
6
6
 
7
- <!-- release-skill:release-version: 0.8.0 -->
7
+ <!-- release-skill:release-version: 0.8.2 -->
8
8
 
9
9
  The **single default Node implementation** of the Contracts mechanism protocol. This is a thin runtime: it only implements the mechanism protocol, introduces no business semantics, and does not provide a second-language implementation.
10
10
 
11
11
  <!-- release-skill:managed:start id=latest-release -->
12
- **0.8.0** (2026-08-21)
12
+ **0.8.2** (2026-08-23)
13
13
 
14
- Lockstep version bump with Foundation 0.8.0; the Harness mechanism surface is unchanged.
14
+ The fixed candidate mechanism bridge now exposes the existing strict reader through read-file-strict.
15
+
16
+ **Added**
17
+
18
+ - Adds read-file-strict to invokeFoundationMechanism with closed root, path, encoding, and expectedSha256 parameters.
19
+ - Returns UTF-8 content as a string and binary content in the standard JSON-safe Buffer shape.
15
20
 
16
21
  **Changed**
17
22
 
18
- - Contracts 1.7.0 adds the Project Profile contract, but no Harness capability or exported mechanism changes.
23
+ - Delegates containment, file reading, digest verification, and failure classification directly to readFileStrict; no second read algorithm is introduced.
24
+ - Moves the package version to 0.8.2 together with Contracts and Engineering Kit.
19
25
 
20
26
  **Upgrade Notes**
21
27
 
22
- Consumers keep their Harness mechanism pins. Project Profile verification belongs to Engineering Kit/Profile SPI, not to a new Harness mechanism.
28
+ Candidate consumers must pin all three Foundation packages to exactly 0.8.2 and rebuild their managed Bundle. Direct calls retain SFC2004 details.kind failures; the JSON CLI continues to promise only exit code 0 for success and 2 for rejection.
23
29
  <!-- release-skill:managed:end id=latest-release -->
24
30
 
25
31
  ## Problem It Solves
@@ -33,14 +39,14 @@ The Harness consumes `skill-family-contracts` (a workspace dependency), reusing
33
39
  ## Installation and Minimal Example
34
40
 
35
41
  ```sh
36
- npm install skill-family-harness-node@0.8.0
42
+ npm install skill-family-harness-node@0.8.2
37
43
  npm info skill-family-harness-node --help
38
44
  ```
39
45
 
40
46
  The minimal example shows validating a contract document inside Node:
41
47
 
42
48
  ```js
43
- // Run from an empty directory: npm install skill-family-harness-node@0.8.0
49
+ // Run from an empty directory: npm install skill-family-harness-node@0.8.2
44
50
  import { validateContractDocument } from "skill-family-harness-node";
45
51
 
46
52
  const document = {
package/README.zh-CN.md CHANGED
@@ -5,22 +5,28 @@
5
5
 
6
6
  # skill-family-harness-node
7
7
 
8
- <!-- release-skill:release-version: 0.8.0 -->
8
+ <!-- release-skill:release-version: 0.8.2 -->
9
9
 
10
10
  Contracts 机制协议的**唯一默认 Node 实现**。这是一个薄运行时(thin runtime):只实现机制协议,不引入业务语义,不做第二语言实现。
11
11
 
12
12
  <!-- release-skill:managed:start id=latest-release -->
13
- **0.8.0** (2026-08-21)
13
+ **0.8.2** (2026-08-23)
14
14
 
15
- Foundation 0.8.0 线锁步升版;Harness 机制表面不变。
15
+ 固定的候选机制桥接新增 read-file-strict,直接公开既有严格读取机制。
16
+
17
+ **新增**
18
+
19
+ - invokeFoundationMechanism 新增 read-file-strict;参数闭合为 root、path、encoding 和 expectedSha256。
20
+ - UTF-8 内容返回字符串,二进制内容返回标准的 JSON 安全 Buffer 形态。
16
21
 
17
22
  **变更**
18
23
 
19
- - Contracts 1.7.0 新增 Project Profile 合同,但 Harness 能力和导出机制均不变。
24
+ - 路径收容、文件读取、摘要复验和失败分类全部转发给 readFileStrict,不新增第二套读取算法。
25
+ - 包版本与 Contracts、Engineering Kit 一同升至 0.8.2。
20
26
 
21
27
  **升级说明**
22
28
 
23
- 消费者保持 Harness 机制锁定;Project Profile 校验归 Engineering Kit/Profile SPI 负责,不新增 Harness 机制。
29
+ 候选消费者必须把三个 Foundation 包精确锁定到 0.8.2,再重建受管 Bundle。直接调用继续返回 SFC2004 details.kind;JSON CLI 只承诺成功退出码 0 和拒绝退出码 2。
24
30
  <!-- release-skill:managed:end id=latest-release -->
25
31
 
26
32
  ## 解决的问题
@@ -34,14 +40,14 @@ Harness 消费 `skill-family-contracts`(工作区依赖),复用其方言
34
40
  ## 安装和最小示例
35
41
 
36
42
  ```sh
37
- npm install skill-family-harness-node@0.8.0
43
+ npm install skill-family-harness-node@0.8.2
38
44
  npm info skill-family-harness-node --help
39
45
  ```
40
46
 
41
47
  最小示例演示在 Node 内校验一份契约文档:
42
48
 
43
49
  ```js
44
- // 从空目录运行:npm install skill-family-harness-node@0.8.0
50
+ // 从空目录运行:npm install skill-family-harness-node@0.8.2
45
51
  import { validateContractDocument } from "skill-family-harness-node";
46
52
 
47
53
  const document = {
@@ -13,6 +13,7 @@ import { fileURLToPath } from "node:url";
13
13
  import { computeResourceClosure, digestBytes } from "../src/closure.mjs";
14
14
  import { HARNESS_ERROR_KINDS, HarnessError, mechanismError } from "../src/errors.mjs";
15
15
  import { resolveContained } from "../src/paths.mjs";
16
+ import { readFileStrict } from "../src/strict-read.mjs";
16
17
 
17
18
  /**
18
19
  * Candidate quickstart profile v2 mechanisms (unstable).
@@ -455,6 +456,7 @@ const FOUNDATION_MECHANISM_OPERATIONS = Object.freeze([
455
456
  "digest-document",
456
457
  "resource-closure",
457
458
  "resolve-contained",
459
+ "read-file-strict",
458
460
  "create-task",
459
461
  "wrap-result",
460
462
  "verify-exchange",
@@ -483,6 +485,34 @@ function findUnsafeInteger(value, instancePath = "") {
483
485
  return null;
484
486
  }
485
487
 
488
+ function assertReadFileStrictParams(params) {
489
+ const allowedKeys = new Set(["root", "path", "encoding", "expectedSha256"]);
490
+ const unknownKey = Object.keys(params).find((key) => !allowedKeys.has(key));
491
+ if (unknownKey !== undefined) {
492
+ throw new TypeError(`invokeFoundationMechanism: read-file-strict unknown param: ${unknownKey}`);
493
+ }
494
+ for (const key of ["root", "path"]) {
495
+ if (!Object.hasOwn(params, key) || typeof params[key] !== "string" || params[key].length === 0) {
496
+ throw new TypeError(`invokeFoundationMechanism: read-file-strict ${key} must be a non-empty string`);
497
+ }
498
+ }
499
+ if (Object.hasOwn(params, "encoding") && params.encoding !== "utf8") {
500
+ throw new TypeError('invokeFoundationMechanism: read-file-strict encoding must be "utf8" or omitted');
501
+ }
502
+ }
503
+
504
+ async function invokeReadFileStrict(params) {
505
+ assertReadFileStrictParams(params);
506
+ const receipt = await readFileStrict(params.root, params.path, {
507
+ ...(Object.hasOwn(params, "encoding") ? { encoding: params.encoding } : {}),
508
+ ...(Object.hasOwn(params, "expectedSha256") ? { expectedSha256: params.expectedSha256 } : {}),
509
+ });
510
+ return {
511
+ ...receipt,
512
+ content: Buffer.isBuffer(receipt.content) ? receipt.content.toJSON() : receipt.content,
513
+ };
514
+ }
515
+
486
516
  /**
487
517
  * Fixed, business-neutral mechanism bridge for consumers that cannot import
488
518
  * several Foundation modules directly. validateBySchemaId is injected only
@@ -525,6 +555,9 @@ export async function invokeFoundationMechanism(request, { validateBySchemaId }
525
555
  if (operation === "resource-closure") {
526
556
  return computeResourceClosure({ root: params.root, resources: params.resources });
527
557
  }
558
+ if (operation === "read-file-strict") {
559
+ return invokeReadFileStrict(params);
560
+ }
528
561
  if (operation === "create-task") {
529
562
  return createQuickstartTask(params);
530
563
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "@pnpm/lockfile.fs": "1001.1.35",
12
12
  "ipaddr.js": "2.5.0",
13
- "skill-family-contracts": "0.8.0",
13
+ "skill-family-contracts": "0.8.2",
14
14
  "yaml": "2.9.0"
15
15
  },
16
16
  "description": "Thin Node.js mechanism runtime for Skill Family engineering contracts.",
@@ -45,7 +45,7 @@
45
45
  "url": "https://github.com/ifoohoo/skill-family-harness-node.git"
46
46
  },
47
47
  "type": "module",
48
- "version": "0.8.0",
48
+ "version": "0.8.2",
49
49
  "scripts": {
50
50
  "check": "node --test",
51
51
  "test": "node --test"
@@ -0,0 +1,23 @@
1
+ version: 0.8.1
2
+ date: 2026-08-22
3
+ locales:
4
+ en:
5
+ summary: Harness now preserves its own report renderer version when a host bundles it into a single-file adapter.
6
+ changes:
7
+ fixed:
8
+ - Replaces the report renderer's runtime import.meta.url package-manifest lookup with a static JSON import, so esbuild inlines the Harness version instead of resolving the host adapter's package metadata.
9
+ - Adds source and third-party single-file bundle regression tests for REPORT_RENDERER_VERSION.
10
+ changed:
11
+ - Moves the package version to 0.8.1 together with Contracts and Engineering Kit.
12
+ - Keeps all 21 Harness capabilities, report contracts, and public exports unchanged.
13
+ upgradeNotes: Host adapters that bundle the report renderer must pin Harness 0.8.1. The report API and renderer identity remain unchanged, so no API migration is required from 0.8.0.
14
+ zh-CN:
15
+ summary: 宿主把 Harness 打包进单文件适配器后,报告渲染器仍能保留 Harness 自身的包版本。
16
+ changes:
17
+ fixed:
18
+ - 用静态 JSON import 替换报告渲染器运行时基于 import.meta.url 的包清单查找,使 esbuild 内联 Harness 版本,不再读取宿主适配器的包元数据。
19
+ - 为 REPORT_RENDERER_VERSION 新增源码运行与第三方单文件 bundle 回归测试。
20
+ changed:
21
+ - 包版本与 Contracts、Engineering Kit 一同升至 0.8.1。
22
+ - Harness 的 21 项能力、报告合同和公共导出均保持不变。
23
+ upgradeNotes: 把报告渲染器打包进宿主适配器的消费者必须精确锁定 Harness 0.8.1;报告 API 与渲染器身份保持不变,从 0.8.0 升级不需要迁移 API。
@@ -0,0 +1,23 @@
1
+ version: 0.8.2
2
+ date: 2026-08-23
3
+ locales:
4
+ en:
5
+ summary: The fixed candidate mechanism bridge now exposes the existing strict reader through read-file-strict.
6
+ changes:
7
+ added:
8
+ - Adds read-file-strict to invokeFoundationMechanism with closed root, path, encoding, and expectedSha256 parameters.
9
+ - Returns UTF-8 content as a string and binary content in the standard JSON-safe Buffer shape.
10
+ changed:
11
+ - Delegates containment, file reading, digest verification, and failure classification directly to readFileStrict; no second read algorithm is introduced.
12
+ - Moves the package version to 0.8.2 together with Contracts and Engineering Kit.
13
+ upgradeNotes: Candidate consumers must pin all three Foundation packages to exactly 0.8.2 and rebuild their managed Bundle. Direct calls retain SFC2004 details.kind failures; the JSON CLI continues to promise only exit code 0 for success and 2 for rejection.
14
+ zh-CN:
15
+ summary: 固定的候选机制桥接新增 read-file-strict,直接公开既有严格读取机制。
16
+ changes:
17
+ added:
18
+ - invokeFoundationMechanism 新增 read-file-strict;参数闭合为 root、path、encoding 和 expectedSha256。
19
+ - UTF-8 内容返回字符串,二进制内容返回标准的 JSON 安全 Buffer 形态。
20
+ changed:
21
+ - 路径收容、文件读取、摘要复验和失败分类全部转发给 readFileStrict,不新增第二套读取算法。
22
+ - 包版本与 Contracts、Engineering Kit 一同升至 0.8.2。
23
+ upgradeNotes: 候选消费者必须把三个 Foundation 包精确锁定到 0.8.2,再重建受管 Bundle。直接调用继续返回 SFC2004 与 details.kind;JSON CLI 只承诺成功退出码 0 和拒绝退出码 2。
@@ -0,0 +1,6 @@
1
+ import harnessPackage from "../package.json" with { type: "json" };
2
+
3
+ // The Harness package manifest is the report renderer version authority.
4
+ // Bundlers inline this static JSON import, so a single-file host adapter keeps
5
+ // the Harness version instead of resolving package.json beside the host file.
6
+ export const REPORT_RENDERER_VERSION = harnessPackage.version;
package/src/report.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { readFileSync } from "node:fs";
2
1
  import {
3
2
  canonicalJson,
4
3
  digestDocument,
@@ -7,6 +6,7 @@ import {
7
6
  } from "skill-family-contracts";
8
7
  import { digestBytes } from "./closure.mjs";
9
8
  import { HARNESS_ERROR_KINDS, mechanismError } from "./errors.mjs";
9
+ import { REPORT_RENDERER_VERSION } from "./report-version.mjs";
10
10
  import { validateContractDocument } from "./validation.mjs";
11
11
 
12
12
  /**
@@ -18,10 +18,8 @@ import { validateContractDocument } from "./validation.mjs";
18
18
  * operation's outputs, derives an execution status, or fills missing facts.
19
19
  */
20
20
 
21
- const PACKAGE_META = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
22
-
23
21
  export const REPORT_RENDERER_NAME = "skill-family-harness-node/report";
24
- export const REPORT_RENDERER_VERSION = PACKAGE_META.version;
22
+ export { REPORT_RENDERER_VERSION };
25
23
  export const SUPPORTED_REPORT_LOCALES = Object.freeze(["zh-CN", "en-US"]);
26
24
  export const EXECUTION_STATUSES = Object.freeze([
27
25
  "SUCCEEDED",