@gt-fe/eap-runtime 0.0.15 → 0.0.16
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
|
@@ -163,7 +163,7 @@ DSL / 契约细节见 `.kiro/specs/04-runtime-core/design.md` §1.4 与 `src/gra
|
|
|
163
163
|
|------|------|------|
|
|
164
164
|
| `EAP_PREINSTALL_ROOT` | — | 预装根;也可用 `GraphLoader({ preinstallRoot })` |
|
|
165
165
|
| `EAP_PRELOAD_REQUIRE_READY` | 关 | 缺 `.ready` → `runtime.preload.missing` |
|
|
166
|
-
| `EAP_PRELOAD_REQUIRE_CHECKSUM` | 关 | snapshot 须含 sha256 或 artifacts |
|
|
166
|
+
| `EAP_PRELOAD_REQUIRE_CHECKSUM` | 关 | snapshot 须含 sha256 或 artifacts。加载期比对文件摘要,不匹配则 warn、不中断 |
|
|
167
167
|
| `EAP_PRELOAD_USER_SKILL_OVERRIDE` | 关 | `users` 优先于 `shared` |
|
|
168
168
|
| `EAP_PRELOAD_VALIDATE_SKILL_IO` | 关 | 校验 Skill `inputDef.required`(`state.skillInput`) |
|
|
169
169
|
| `EAP_PRELOAD_DEFINITION_CACHE` | 有预装时开 | 定义缓存;`0`/`false` 关闭,`1`/`true` 强制开 |
|
|
@@ -17,6 +17,7 @@ import { parseSkillMd } from '@gt-fe/eap-contracts';
|
|
|
17
17
|
import { findSkillEntryFile } from './skill-tree.js';
|
|
18
18
|
import { preloadMissing, preloadPackageCorrupt, } from './preload-errors.js';
|
|
19
19
|
import { isRequireChecksum, resolvePreloadBehaviorFlags, } from './preload-flags.js';
|
|
20
|
+
import { emitRuntimeLog } from '../common/logger.js';
|
|
20
21
|
async function pathExists(p) {
|
|
21
22
|
try {
|
|
22
23
|
await access(p, fsConstants.F_OK);
|
|
@@ -115,17 +116,19 @@ async function findDigestMatch(items, expectedRaw) {
|
|
|
115
116
|
}
|
|
116
117
|
return undefined;
|
|
117
118
|
}
|
|
118
|
-
async function
|
|
119
|
+
async function warnIfDigestMismatch(expectedRaw, actualHex, label, details) {
|
|
119
120
|
const expected = normalizeDigest(expectedRaw);
|
|
120
121
|
if (!expected)
|
|
121
122
|
return;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
const actual = actualHex.toLowerCase();
|
|
124
|
+
if (expected === actual)
|
|
125
|
+
return;
|
|
126
|
+
emitRuntimeLog('warn', 'preload', `预装校验和不匹配: ${label}`, {
|
|
127
|
+
event: 'runtime.preload.digest_mismatch',
|
|
128
|
+
expected,
|
|
129
|
+
actual,
|
|
130
|
+
...details,
|
|
131
|
+
});
|
|
129
132
|
}
|
|
130
133
|
async function pickLatestVersionDir(parent) {
|
|
131
134
|
if (!(await pathExists(parent)))
|
|
@@ -358,10 +361,14 @@ export class FileSystemDeploymentSnapshot {
|
|
|
358
361
|
const raw = (await readTextFile(pkgFile))?.trim() ?? '';
|
|
359
362
|
const fileDigest = normalizeDigest(raw);
|
|
360
363
|
if (!fileDigest) {
|
|
361
|
-
|
|
364
|
+
emitRuntimeLog('warn', 'preload', '.package.sha256 内容非法', {
|
|
365
|
+
event: 'runtime.preload.digest_mismatch',
|
|
366
|
+
path: pkgFile,
|
|
367
|
+
});
|
|
362
368
|
}
|
|
363
|
-
if (fileDigest !== expectedPkg) {
|
|
364
|
-
|
|
369
|
+
else if (fileDigest !== expectedPkg) {
|
|
370
|
+
emitRuntimeLog('warn', 'preload', 'snapshot.sha256 与 .package.sha256 不一致', {
|
|
371
|
+
event: 'runtime.preload.digest_mismatch',
|
|
365
372
|
expected: expectedPkg,
|
|
366
373
|
actual: fileDigest,
|
|
367
374
|
path: pkgFile,
|
|
@@ -387,7 +394,7 @@ export class FileSystemDeploymentSnapshot {
|
|
|
387
394
|
throw preloadPackageCorrupt(`artifacts 指向的文件不存在: ${rel}`, { path: full });
|
|
388
395
|
}
|
|
389
396
|
const actual = await sha256OfFile(full);
|
|
390
|
-
await
|
|
397
|
+
await warnIfDigestMismatch(expected, actual, `artifact ${rel}`, { path: full });
|
|
391
398
|
}
|
|
392
399
|
}
|
|
393
400
|
async resolveAgentDir(agentCode, version) {
|
|
@@ -492,7 +499,7 @@ export class FileSystemDeploymentSnapshot {
|
|
|
492
499
|
if (ref.sha256) {
|
|
493
500
|
const matched = await findDigestMatch(existingManifests, ref.sha256);
|
|
494
501
|
if (!matched) {
|
|
495
|
-
await
|
|
502
|
+
await warnIfDigestMismatch(ref.sha256, await sha256OfFile(existingManifests[0].path), `tool ${ref.name}`, { path: existingManifests[0].path });
|
|
496
503
|
}
|
|
497
504
|
chosen = matched ?? existingManifests[0];
|
|
498
505
|
}
|
|
@@ -564,9 +571,12 @@ export class FileSystemDeploymentSnapshot {
|
|
|
564
571
|
continue;
|
|
565
572
|
const isUserOverridePath = bundlePath.includes('/users/') || bundlePath.includes('\\users\\');
|
|
566
573
|
const isAuthorOverlay = extraRoots.some((root) => root && isPathInside(root, bundlePath));
|
|
567
|
-
if (ref.sha256 &&
|
|
574
|
+
if (ref.sha256 &&
|
|
575
|
+
!isUserOverridePath &&
|
|
576
|
+
!isAuthorOverlay &&
|
|
577
|
+
manifestPath.endsWith('.json')) {
|
|
568
578
|
const actual = await sha256OfFile(manifestPath);
|
|
569
|
-
await
|
|
579
|
+
await warnIfDigestMismatch(ref.sha256, actual, `skill ${ref.skillId}`, { path: manifestPath });
|
|
570
580
|
}
|
|
571
581
|
const skillId = String(ref.skillId);
|
|
572
582
|
return {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* |------|------|------|
|
|
6
6
|
* | EAP_PRELOAD_REQUIRE_READY | 关 | 强制校验 .ready |
|
|
7
7
|
* | EAP_PRELOAD_VALIDATE_SKILL_IO | **开** | 执行子图前校验 skill inputDef.required;`0`/`false` 关闭 |
|
|
8
|
-
* | EAP_PRELOAD_REQUIRE_CHECKSUM | 关 | snapshot 必须带 sha256 或 artifacts[] |
|
|
8
|
+
* | EAP_PRELOAD_REQUIRE_CHECKSUM | 关 | snapshot 必须带 sha256 或 artifacts[](字段存在性)。加载期摘要不匹配为 warn |
|
|
9
9
|
* | EAP_PRELOAD_DEFINITION_CACHE | 有预装时开 | 进程内定义缓存;`0`/`false` 关闭 |
|
|
10
10
|
* | EAP_SKILL_HOT_RELOAD | **dev 开 / server 关** | 已装配 Skill 的目录 mtime 变化则丢缓存;未写入装配名单的目录不进清单 |
|
|
11
11
|
* | EAP_LOCAL_SKILLS_DIR | 关 | 开发态作者源 Skill 根;查找优先于 preinstall,低于 users/ |
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* |------|------|------|
|
|
6
6
|
* | EAP_PRELOAD_REQUIRE_READY | 关 | 强制校验 .ready |
|
|
7
7
|
* | EAP_PRELOAD_VALIDATE_SKILL_IO | **开** | 执行子图前校验 skill inputDef.required;`0`/`false` 关闭 |
|
|
8
|
-
* | EAP_PRELOAD_REQUIRE_CHECKSUM | 关 | snapshot 必须带 sha256 或 artifacts[] |
|
|
8
|
+
* | EAP_PRELOAD_REQUIRE_CHECKSUM | 关 | snapshot 必须带 sha256 或 artifacts[](字段存在性)。加载期摘要不匹配为 warn |
|
|
9
9
|
* | EAP_PRELOAD_DEFINITION_CACHE | 有预装时开 | 进程内定义缓存;`0`/`false` 关闭 |
|
|
10
10
|
* | EAP_SKILL_HOT_RELOAD | **dev 开 / server 关** | 已装配 Skill 的目录 mtime 变化则丢缓存;未写入装配名单的目录不进清单 |
|
|
11
11
|
* | EAP_LOCAL_SKILLS_DIR | 关 | 开发态作者源 Skill 根;查找优先于 preinstall,低于 users/ |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gt-fe/eap-runtime",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Enterprise Agent Platform
|
|
3
|
+
"version": "0.0.16",
|
|
4
|
+
"description": "Enterprise Agent Platform \u2014 Runtime\u6838\u5fc3\uff1aGraph\u6267\u884c\u5f15\u64ce\u3001Task\u751f\u547d\u5468\u671f\u3001Session\u7ba1\u7406\u3001Checkpoint\u6301\u4e45\u5316",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|