skill-family-harness-node 0.8.1 → 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 +21 -0
- package/CHANGELOG.zh-CN.md +21 -0
- package/README.md +12 -12
- package/README.zh-CN.md +12 -12
- package/candidate/quickstart-profile.mjs +33 -0
- package/package.json +2 -2
- package/release-notes/0.8.2.yaml +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
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
|
+
|
|
3
24
|
<!-- release-skill:changelog:start version=0.8.1 locale=en baseline=sha256:4cd9f23da3561184cef4ebadb7e758a22d377d069742bbe7c77166d6c1b3bd14 -->
|
|
4
25
|
## [0.8.1] - 2026-08-22
|
|
5
26
|
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
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
|
+
|
|
3
24
|
<!-- release-skill:changelog:start version=0.8.1 locale=zh-CN baseline=sha256:904de77446dbc69ef7e70cdda0020fd98632a6e704754f6ed57e136764e3112e -->
|
|
4
25
|
## [0.8.1] - 2026-08-22
|
|
5
26
|
|
package/README.md
CHANGED
|
@@ -4,28 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
# skill-family-harness-node
|
|
6
6
|
|
|
7
|
-
<!-- release-skill:release-version: 0.8.
|
|
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.
|
|
12
|
+
**0.8.2** (2026-08-23)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
The fixed candidate mechanism bridge now exposes the existing strict reader through read-file-strict.
|
|
15
15
|
|
|
16
|
-
**
|
|
16
|
+
**Added**
|
|
17
17
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
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.
|
|
20
20
|
|
|
21
|
-
**
|
|
21
|
+
**Changed**
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
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.
|
|
25
25
|
|
|
26
26
|
**Upgrade Notes**
|
|
27
27
|
|
|
28
|
-
|
|
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.
|
|
29
29
|
<!-- release-skill:managed:end id=latest-release -->
|
|
30
30
|
|
|
31
31
|
## Problem It Solves
|
|
@@ -39,14 +39,14 @@ The Harness consumes `skill-family-contracts` (a workspace dependency), reusing
|
|
|
39
39
|
## Installation and Minimal Example
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
npm install skill-family-harness-node@0.8.
|
|
42
|
+
npm install skill-family-harness-node@0.8.2
|
|
43
43
|
npm info skill-family-harness-node --help
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
The minimal example shows validating a contract document inside Node:
|
|
47
47
|
|
|
48
48
|
```js
|
|
49
|
-
// Run from an empty directory: npm install skill-family-harness-node@0.8.
|
|
49
|
+
// Run from an empty directory: npm install skill-family-harness-node@0.8.2
|
|
50
50
|
import { validateContractDocument } from "skill-family-harness-node";
|
|
51
51
|
|
|
52
52
|
const document = {
|
package/README.zh-CN.md
CHANGED
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
|
|
6
6
|
# skill-family-harness-node
|
|
7
7
|
|
|
8
|
-
<!-- release-skill:release-version: 0.8.
|
|
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.
|
|
13
|
+
**0.8.2** (2026-08-23)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
固定的候选机制桥接新增 read-file-strict,直接公开既有严格读取机制。
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
**新增**
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
19
|
+
- invokeFoundationMechanism 新增 read-file-strict;参数闭合为 root、path、encoding 和 expectedSha256。
|
|
20
|
+
- UTF-8 内容返回字符串,二进制内容返回标准的 JSON 安全 Buffer 形态。
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**变更**
|
|
23
23
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
24
|
+
- 路径收容、文件读取、摘要复验和失败分类全部转发给 readFileStrict,不新增第二套读取算法。
|
|
25
|
+
- 包版本与 Contracts、Engineering Kit 一同升至 0.8.2。
|
|
26
26
|
|
|
27
27
|
**升级说明**
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
候选消费者必须把三个 Foundation 包精确锁定到 0.8.2,再重建受管 Bundle。直接调用继续返回 SFC2004 与 details.kind;JSON CLI 只承诺成功退出码 0 和拒绝退出码 2。
|
|
30
30
|
<!-- release-skill:managed:end id=latest-release -->
|
|
31
31
|
|
|
32
32
|
## 解决的问题
|
|
@@ -40,14 +40,14 @@ Harness 消费 `skill-family-contracts`(工作区依赖),复用其方言
|
|
|
40
40
|
## 安装和最小示例
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
|
-
npm install skill-family-harness-node@0.8.
|
|
43
|
+
npm install skill-family-harness-node@0.8.2
|
|
44
44
|
npm info skill-family-harness-node --help
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
最小示例演示在 Node 内校验一份契约文档:
|
|
48
48
|
|
|
49
49
|
```js
|
|
50
|
-
// 从空目录运行:npm install skill-family-harness-node@0.8.
|
|
50
|
+
// 从空目录运行:npm install skill-family-harness-node@0.8.2
|
|
51
51
|
import { validateContractDocument } from "skill-family-harness-node";
|
|
52
52
|
|
|
53
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.
|
|
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.
|
|
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.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。
|