blun-king-cli 9.1.624 → 9.1.625

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.
Files changed (142) hide show
  1. package/CHANGELOG.md +62 -213
  2. package/LIESMICH.txt +57 -74
  3. package/README.md +76 -119
  4. package/agent-spine-plugin/scripts/check-install.js +4 -4
  5. package/agent-spine-plugin/src/hook.js +0 -4
  6. package/agent-spine-plugin/src/lib/documents.js +1 -1
  7. package/agent-spine-plugin/src/lib/hook-context.js +0 -1
  8. package/agent-spine-plugin/src/lib/host-instruction-budget.js +2 -1
  9. package/agent-spine-plugin/src/lib/preflight.js +9 -38
  10. package/agent-spine-plugin/src/lib/source-roots.js +1 -1
  11. package/bin/agentspine-king-goal-inbox.mjs +127 -127
  12. package/bin/agentspine-king-goal-intake.mjs +106 -106
  13. package/bin/agentspine-king-host-runner.mjs +109 -109
  14. package/bin/agentspine-king-snapshot-policy.cjs +80 -80
  15. package/bin/agentspine-king-status-policy.mjs +226 -226
  16. package/bin/agentspine-king-worker-host.mjs +160 -160
  17. package/bin/core-bootstrap.js +71 -100
  18. package/bin/launcher-mode.js +93 -93
  19. package/bin/launcher-restart-policy.cjs +131 -131
  20. package/bin/launcher-runtime.js +89 -254
  21. package/bin/managed-node.js +186 -186
  22. package/bin/managed-plugin-selection.cjs +109 -116
  23. package/bin/native-module-repair.js +201 -201
  24. package/bin/node-runtime.js +34 -34
  25. package/bin/node-version.js +49 -49
  26. package/bin/plugin-bootstrap.js +149 -172
  27. package/bin/private-paths.js +1578 -1624
  28. package/bin/runtime-exit-ledger.cjs +144 -144
  29. package/bin/runtime-exit-ledger.d.cts +23 -23
  30. package/bin/standard-tools-bootstrap.js +277 -272
  31. package/bin/turn-thinking-policy.cjs +82 -82
  32. package/bin/update-copy.js +200 -200
  33. package/bin/update-lease.js +597 -599
  34. package/bin/update-notice.js +1568 -1568
  35. package/bin/verify-agent-behavior.cjs +122 -122
  36. package/bin/verify-agent-components.cjs +104 -104
  37. package/bin/verify-bundled-agent-sources.cjs +91 -96
  38. package/bin/windows-node-crash-dump.cjs +289 -289
  39. package/blun.mjs +187640 -180475
  40. package/bundled-agent-sources.json +26 -30
  41. package/codebase-index/codebase_index.py +462 -470
  42. package/dist-web/assets/{CodeBlockNode-TKKkJX8L.js → CodeBlockNode-BMbuG85x.js} +1 -1
  43. package/dist-web/assets/{CodeBlockShell.vue_vue_type_style_index_0_lang-CUj2Ds5x.js → CodeBlockShell.vue_vue_type_style_index_0_lang-C1fv7l_Z.js} +1 -1
  44. package/dist-web/assets/DesignSystemView-6HgAUEmC.css +1 -0
  45. package/dist-web/assets/DesignSystemView-CEEBqXSX.js +12 -0
  46. package/dist-web/assets/{Tooltip-CTWv7WCU.js → Tooltip--YoauJ24.js} +1 -1
  47. package/dist-web/assets/{abnfDiagram-N423BO3Z-DA8V8Zjh.js → abnfDiagram-N423BO3Z-DZvBWkRg.js} +1 -1
  48. package/dist-web/assets/{arc-YtddKbdY.js → arc-B04JATeX.js} +1 -1
  49. package/dist-web/assets/{architectureDiagram-T3A2C74G-CGEiObmo.js → architectureDiagram-T3A2C74G-DmYnMep2.js} +1 -1
  50. package/dist-web/assets/{blockDiagram-VBNYF7ZC-Bd5Vt50e.js → blockDiagram-VBNYF7ZC-DJ1gPS1C.js} +1 -1
  51. package/dist-web/assets/{c4Diagram-5PPSVZJV-D2ApPM54.js → c4Diagram-5PPSVZJV-DmjxvUbd.js} +1 -1
  52. package/dist-web/assets/channel-472fcEvw.js +1 -0
  53. package/dist-web/assets/{chunk-2GRJ4B5K-BDcIEZSl.js → chunk-2GRJ4B5K-AB0raj3I.js} +1 -1
  54. package/dist-web/assets/{chunk-2Q5K7J3B-6aSabCX7.js → chunk-2Q5K7J3B-Drf039vM.js} +1 -1
  55. package/dist-web/assets/{chunk-5RXB4S5H-BFRQvIJS.js → chunk-5RXB4S5H-D5ILttmz.js} +1 -1
  56. package/dist-web/assets/{chunk-5VM5RSS4-ChAa-DNY.js → chunk-5VM5RSS4-DrLSdi8y.js} +1 -1
  57. package/dist-web/assets/{chunk-6Q2QTUOP-BIfrb2Jc.js → chunk-6Q2QTUOP-LiaqdEOQ.js} +1 -1
  58. package/dist-web/assets/{chunk-GF5L2VYU-BR0gvtWI.js → chunk-GF5L2VYU-AIYkb--o.js} +1 -1
  59. package/dist-web/assets/{chunk-JWPE2WC7-BgXKsx5E.js → chunk-JWPE2WC7-CogdNl0i.js} +1 -1
  60. package/dist-web/assets/{chunk-KBJHAD2P-I8mrZhpz.js → chunk-KBJHAD2P-DHjpNtZv.js} +1 -1
  61. package/dist-web/assets/{chunk-RYQCIY6F-BMPaem92.js → chunk-RYQCIY6F-BUSOqH2X.js} +1 -1
  62. package/dist-web/assets/{chunk-XXDRQBXY-COy0J-0j.js → chunk-XXDRQBXY-BpoMV0bh.js} +1 -1
  63. package/dist-web/assets/classDiagram-JCYQIIEL-BTZeLngj.js +1 -0
  64. package/dist-web/assets/classDiagram-v2-OCEON4UE-BTZeLngj.js +1 -0
  65. package/dist-web/assets/{cose-bilkent-JH36ORCC-MosTTRdo.js → cose-bilkent-JH36ORCC-BJr2I61o.js} +1 -1
  66. package/dist-web/assets/{cynefin-VYW2F7L2-5tjPgrkP.js → cynefin-VYW2F7L2-HtysQZ4A.js} +1 -1
  67. package/dist-web/assets/{cynefinDiagram-MW4NZA55-CbDcdInR.js → cynefinDiagram-MW4NZA55-CcpC_2uv.js} +1 -1
  68. package/dist-web/assets/{dagre-VZM6K2ZE-YaBom1ZH.js → dagre-VZM6K2ZE-D8Ao0LUg.js} +1 -1
  69. package/dist-web/assets/{diagram-7IWD3JNH-Da4m-Hgz.js → diagram-7IWD3JNH-BITiLhjX.js} +1 -1
  70. package/dist-web/assets/{diagram-B4RE2ZJO-CAUUegxg.js → diagram-B4RE2ZJO-CJtwfy9f.js} +1 -1
  71. package/dist-web/assets/{diagram-LBJQPF4R-o21mWKG4.js → diagram-LBJQPF4R-BsVTh6w8.js} +1 -1
  72. package/dist-web/assets/{diagram-Q27KOJAE-BA3z3sXf.js → diagram-Q27KOJAE-pA_MUCUf.js} +1 -1
  73. package/dist-web/assets/{diagram-UB23O5K3-CGRdSSDK.js → diagram-UB23O5K3-CIY8z7vu.js} +1 -1
  74. package/dist-web/assets/{ebnfDiagram-BXEA7PRR-Bw-iU9FP.js → ebnfDiagram-BXEA7PRR-C3FMioqp.js} +1 -1
  75. package/dist-web/assets/{erDiagram-JOGREHBK-BwM1yiR0.js → erDiagram-JOGREHBK-CzoyKmKc.js} +1 -1
  76. package/dist-web/assets/{flowDiagram-UKHOOZJN-z05eOR1Q.js → flowDiagram-UKHOOZJN-DOqfushy.js} +1 -1
  77. package/dist-web/assets/{ganttDiagram-PKOTCBZU-BMUubNTl.js → ganttDiagram-PKOTCBZU-Cf9XQSWl.js} +1 -1
  78. package/dist-web/assets/{gitGraphDiagram-DS77QQ5N-Dccbi1wU.js → gitGraphDiagram-DS77QQ5N-DHUDofE5.js} +1 -1
  79. package/dist-web/assets/{index-h0KEOmkU.js → index-B6qEMQMx.js} +14 -14
  80. package/dist-web/assets/{index-C9eDH3u-.css → index-BmKj7CB1.css} +1 -1
  81. package/dist-web/assets/{index-BBbC5LRF.js → index-DokxDX1w.js} +1 -1
  82. package/dist-web/assets/{index-D48p0M2S.js → index-auojtiAA.js} +2 -2
  83. package/dist-web/assets/{index10-Qbuw1N6u.js → index10-Drb2n5e5.js} +1 -1
  84. package/dist-web/assets/{index11-g8v025wN.js → index11-Cx-aV4G2.js} +1 -1
  85. package/dist-web/assets/{index5-BYNcV8BY.js → index5-Dg3qGTyH.js} +1 -1
  86. package/dist-web/assets/{index6-BetANtnV.js → index6-BgvtIICP.js} +1 -1
  87. package/dist-web/assets/{index7-BcPbgCKN.js → index7-uEnniPQG.js} +1 -1
  88. package/dist-web/assets/{index8-B1lp-RvF.js → index8-h4IKc0ek.js} +2 -2
  89. package/dist-web/assets/{infoDiagram-6WML65LV-BF_pbUnN.js → infoDiagram-6WML65LV-D-3tvEiJ.js} +1 -1
  90. package/dist-web/assets/{ishikawaDiagram-WSZJBQD7-Dedv4urS.js → ishikawaDiagram-WSZJBQD7-DIIBNv7a.js} +1 -1
  91. package/dist-web/assets/{journeyDiagram-NVQOT4AX-B1Ex3b6o.js → journeyDiagram-NVQOT4AX-DP4r1Vlx.js} +1 -1
  92. package/dist-web/assets/{kanban-definition-27J2QSJJ-BtCGliBH.js → kanban-definition-27J2QSJJ-C3_Ztgxv.js} +1 -1
  93. package/dist-web/assets/{linear-ByItc8Qr.js → linear-DnqhIw-y.js} +1 -1
  94. package/dist-web/assets/{mermaid.core-B1M2O7nN.js → mermaid.core-xYUgBa3T.js} +4 -4
  95. package/dist-web/assets/{mindmap-definition-FAOFIHXS-D0UHKUyj.js → mindmap-definition-FAOFIHXS-l-dq-zfr.js} +1 -1
  96. package/dist-web/assets/{pegDiagram-VL7TDLO6-D7zYCVmG.js → pegDiagram-VL7TDLO6-C8vXQiaJ.js} +1 -1
  97. package/dist-web/assets/{pieDiagram-7S7Q4E2Y-Bd0i9CHa.js → pieDiagram-7S7Q4E2Y-CyNRSsI6.js} +1 -1
  98. package/dist-web/assets/{quadrantDiagram-CIZ2JOQS-MG-Ug47d.js → quadrantDiagram-CIZ2JOQS-D-w8AD_g.js} +1 -1
  99. package/dist-web/assets/{railroadDiagram-AXF67PYL-AZdl90Gj.js → railroadDiagram-AXF67PYL-BLkyQCWy.js} +1 -1
  100. package/dist-web/assets/{requirementDiagram-LRYGKXZP-DjplF9kt.js → requirementDiagram-LRYGKXZP-CEWO7XfT.js} +1 -1
  101. package/dist-web/assets/{sankeyDiagram-W5VNT64P-Bi9Zgfjs.js → sankeyDiagram-W5VNT64P-ByGoAaGj.js} +1 -1
  102. package/dist-web/assets/{sequenceDiagram-SI44F4Z6-ChEpdCvb.js → sequenceDiagram-SI44F4Z6-Bhn9GQtd.js} +1 -1
  103. package/dist-web/assets/{sizeCapture-X5ZJPWSS-B5RFUdaa.js → sizeCapture-X5ZJPWSS-jVKR9CTu.js} +1 -1
  104. package/dist-web/assets/{stateDiagram-OKZ733FA-BkRblSKp.js → stateDiagram-OKZ733FA-wW3XbegA.js} +1 -1
  105. package/dist-web/assets/stateDiagram-v2-UEYNNEHI-B8aids-Z.js +1 -0
  106. package/dist-web/assets/{swimlanes-SLNWSIFB-DLXH6Zhc.js → swimlanes-SLNWSIFB-B8QyFS7G.js} +2 -2
  107. package/dist-web/assets/swimlanesDiagram-ULZ7WXOC-B8XAkdSm.js +8 -0
  108. package/dist-web/assets/{timeline-definition-Z64GVDOM-C_N88siO.js → timeline-definition-Z64GVDOM-DpvxS-1A.js} +1 -1
  109. package/dist-web/assets/{vennDiagram-T6HMQDX7-DMsnvDt0.js → vennDiagram-T6HMQDX7-BzGM0ihY.js} +1 -1
  110. package/dist-web/assets/{vue.runtime.esm-bundler-B-3uIy85.js → vue.runtime.esm-bundler-BOcpwIX1.js} +1 -1
  111. package/dist-web/assets/{wardleyDiagram-T6FBY63Y-C9SJIPzq.js → wardleyDiagram-T6FBY63Y-2DKAOs5e.js} +1 -1
  112. package/dist-web/assets/{xychartDiagram-ELKLHX3M-DZLWA6Go.js → xychartDiagram-ELKLHX3M-B0SP0TXd.js} +1 -1
  113. package/dist-web/index.html +32 -32
  114. package/dist-web/vis/index.html.gz +0 -0
  115. package/package.json +1 -1
  116. package/scripts/fix-node-pty-perms.js +53 -53
  117. package/standard-skills/blun-app-design-system/SKILL.md +30 -30
  118. package/standard-skills/blun-app-design-system/provenance.json +17 -17
  119. package/standard-skills/blun-app-design-system/references/tokens.md +48 -48
  120. package/standard-skills/blun-app-design-system/scripts/check-blun-design.mjs +49 -49
  121. package/standard-skills/translate-native/README.md +1 -1
  122. package/standard-skills/translate-native/scripts/blun_language_guard.py +2 -0
  123. package/standard-skills/translate-native/scripts/language_gateway.py +2 -0
  124. package/standard-skills/translate-native/scripts/pre_output_guard.py +2 -0
  125. package/standard-tools/language-guard/blun_language_guard.py +2 -0
  126. package/standard-tools/language-guard/language_gateway.py +2 -0
  127. package/standard-tools/language-guard/pre_output_guard.py +2 -0
  128. package/telegram-plugin/blun.plugin.json +20 -20
  129. package/telegram-plugin/commands/access.md +37 -37
  130. package/telegram-plugin/dist/bridge.mjs +310 -187
  131. package/telegram-plugin/dist/mcp-server.mjs +174 -261
  132. package/telegram-plugin/dist/noise.mjs +1 -19
  133. package/worker-host.mjs +13747 -16824
  134. package/bin/profile-handoff.cjs +0 -152
  135. package/bin/profile-launch.cjs +0 -120
  136. package/dist-web/assets/DesignSystemView-DwK1aQMo.js +0 -12
  137. package/dist-web/assets/DesignSystemView-szjTj7ns.css +0 -1
  138. package/dist-web/assets/channel-BnluexuN.js +0 -1
  139. package/dist-web/assets/classDiagram-JCYQIIEL-BliFdSD9.js +0 -1
  140. package/dist-web/assets/classDiagram-v2-OCEON4UE-BliFdSD9.js +0 -1
  141. package/dist-web/assets/stateDiagram-v2-UEYNNEHI-fVkQcACW.js +0 -1
  142. package/dist-web/assets/swimlanesDiagram-ULZ7WXOC-Bg-BiZJQ.js +0 -8
@@ -1,105 +1,100 @@
1
- 'use strict';
2
- const fs = require('node:fs');
3
- const path = require('node:path');
4
- const { createHash } = require('node:crypto');
5
- const RECEIPT = 'bundled-agent-sources.json';
6
- const SCHEMA = 'blun.bundled-agent-sources/v1';
7
- const PREFIXES = ['agent-spine-plugin/', 'standard-skills/translate-native/', 'standard-tools/language-guard/'];
8
- const GUARD_RESPONSE_PROFILE = Object.freeze({
9
- schema: 'blun.language-guard-response-profile/v1',
10
- file: 'translate-native/scripts/blun_language_guard.py',
11
- beforeSha256: '837361690535ded4251ca23fbab313f5c3a7005472c259aa8fc51ebf7ecb9cb9',
12
- afterSha256: '1e21b570259de0145ace2abf55fb82bf8896c90aaae93839c97fff36a01731f2',
13
- });
14
- const GUARD_RESPONSE_PAYLOADS = Object.freeze([
15
- 'standard-skills/translate-native/scripts/blun_language_guard.py',
16
- 'standard-tools/language-guard/blun_language_guard.py',
17
- ]);
1
+ 'use strict';
2
+ const fs = require('node:fs');
3
+ const path = require('node:path');
4
+ const { createHash } = require('node:crypto');
5
+ const RECEIPT = 'bundled-agent-sources.json';
6
+ const SCHEMA = 'blun.bundled-agent-sources/v1';
7
+ const PREFIXES = ['agent-spine-plugin/', 'standard-skills/translate-native/', 'standard-tools/language-guard/'];
8
+ const GUARD_RESPONSE_PROFILE = Object.freeze({
9
+ schema: 'blun.language-guard-response-profile/v2',
10
+ file: 'translate-native/scripts/blun_language_guard.py',
11
+ beforeSha256: '837361690535ded4251ca23fbab313f5c3a7005472c259aa8fc51ebf7ecb9cb9',
12
+ afterSha256: '8883fc38aa2fcef7f0828299244d5bb05d3059c18bfeefd466374271c291473e',
13
+ bytecodeEntries: Object.freeze([
14
+ Object.freeze({ file: 'translate-native/scripts/pre_output_guard.py',
15
+ beforeSha256: 'aa87c3b5b27f68dcee375541e8dbfe5b6164aa69a693185f279877c2b22174be',
16
+ afterSha256: 'f56abf628cb712624debccff27ca0be53b3f70220eabe13c8d5ee53ba37080ae' }),
17
+ Object.freeze({ file: 'translate-native/scripts/language_gateway.py',
18
+ beforeSha256: 'd7d4ace4a99ced9dfc5e3cfee645acd14523f7481a973b38f3a8c90ef351fbce',
19
+ afterSha256: '8e46de71597c94477d9f1bc2062bae456a0256a63bc7f1f3721430e16e859cf8' }),
20
+ ]),
21
+ });
22
+ const GUARD_RESPONSE_PAYLOADS = Object.freeze([
23
+ 'standard-skills/translate-native/scripts/blun_language_guard.py',
24
+ 'standard-tools/language-guard/blun_language_guard.py',
25
+ ]);
18
26
  const REQUIRED = [
19
- 'agent-spine-plugin/package.json',
20
- 'standard-skills/translate-native/VERSION', 'standard-skills/translate-native/provenance.json',
21
- 'standard-tools/language-guard/VERSION', 'standard-tools/language-guard/provenance.json',
22
- 'agent-spine-plugin/blun.plugin.json', 'agent-spine-plugin/src/hook.js',
23
- 'agent-spine-plugin/src/mcp.js', 'agent-spine-plugin/skills/agent-spine/SKILL.md',
24
- 'standard-skills/translate-native/SKILL.md', ...GUARD_RESPONSE_PAYLOADS,
25
- 'standard-tools/language-guard/check_diacritics.py', 'standard-tools/language-guard/language_quality.py',
26
- 'standard-tools/language-guard/guard_service_client.py', 'standard-tools/language-guard/translation_guard.py',
27
- ];
28
- const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
29
-
30
- function payloadInventory(root, prefix = '') {
31
- const files = {};
32
- for (const name of fs.readdirSync(root).sort()) {
33
- const target = path.join(root, name), relative = prefix + name;
34
- const stat = fs.lstatSync(target);
35
- if (stat.isSymbolicLink()) throw new Error('Linked bundled component: ' + relative);
36
- if (stat.isDirectory()) Object.assign(files, payloadInventory(target, relative + '/'));
37
- else if (stat.isFile()) files[relative] = sha256(fs.readFileSync(target));
38
- else throw new Error('Unsupported bundled component: ' + relative);
39
- }
40
- return files;
41
- }
42
-
43
- function verifyBundledAgentSources(root, pins) {
44
- const receipt = JSON.parse(fs.readFileSync(path.join(root, RECEIPT), 'utf8'));
45
- if (receipt.schema !== SCHEMA || !receipt.files || Array.isArray(receipt.files)) throw new Error('Invalid bundled source receipt');
46
- for (const name of ['agentSpine', 'translateNative']) {
47
- if (!/^[a-f0-9]{40}$/.test(receipt.sources?.[name]?.commit || '')) throw new Error('Missing bundled source commit: ' + name);
48
- if (pins && JSON.stringify(receipt.sources[name]) !== JSON.stringify(pins[name])) throw new Error('Stale bundled source: ' + name);
49
- }
50
- for (const file of REQUIRED) if (!Object.hasOwn(receipt.files, file)) throw new Error('Missing required bundled source: ' + file);
51
- const actual = {};
52
- for (const prefix of PREFIXES) {
53
- const target = path.join(root, prefix);
54
- if (fs.lstatSync(target).isSymbolicLink()) throw new Error('Linked component directory');
55
- Object.assign(actual, payloadInventory(target, prefix));
56
- }
57
- const expectedNames = Object.keys(receipt.files).sort();
58
- if (JSON.stringify(Object.keys(actual).sort()) !== JSON.stringify(expectedNames)) throw new Error('Bundled source inventory mismatch');
27
+ 'agent-spine-plugin/blun.plugin.json', 'agent-spine-plugin/src/hook.js',
28
+ 'agent-spine-plugin/src/mcp.js', 'agent-spine-plugin/skills/agent-spine/SKILL.md',
29
+ 'standard-skills/translate-native/SKILL.md', ...GUARD_RESPONSE_PAYLOADS,
30
+ 'standard-tools/language-guard/check_diacritics.py', 'standard-tools/language-guard/language_quality.py',
31
+ 'standard-tools/language-guard/guard_service_client.py', 'standard-tools/language-guard/translation_guard.py',
32
+ ];
33
+ const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
34
+
35
+ function payloadInventory(root, prefix = '') {
36
+ const files = {};
37
+ for (const name of fs.readdirSync(root).sort()) {
38
+ const target = path.join(root, name), relative = prefix + name;
39
+ const stat = fs.lstatSync(target);
40
+ if (stat.isSymbolicLink()) throw new Error('Linked bundled component: ' + relative);
41
+ if (stat.isDirectory()) Object.assign(files, payloadInventory(target, relative + '/'));
42
+ else if (stat.isFile()) files[relative] = sha256(fs.readFileSync(target));
43
+ else throw new Error('Unsupported bundled component: ' + relative);
44
+ }
45
+ return files;
46
+ }
47
+
48
+ function verifyBundledAgentSources(root, pins) {
49
+ const receipt = JSON.parse(fs.readFileSync(path.join(root, RECEIPT), 'utf8'));
50
+ if (receipt.schema !== SCHEMA || !receipt.files || Array.isArray(receipt.files)) throw new Error('Invalid bundled source receipt');
51
+ for (const name of ['agentSpine', 'translateNative']) {
52
+ if (!/^[a-f0-9]{40}$/.test(receipt.sources?.[name]?.commit || '')) throw new Error('Missing bundled source commit: ' + name);
53
+ if (pins && JSON.stringify(receipt.sources[name]) !== JSON.stringify(pins[name])) throw new Error('Stale bundled source: ' + name);
54
+ }
55
+ for (const file of REQUIRED) if (!Object.hasOwn(receipt.files, file)) throw new Error('Missing required bundled source: ' + file);
56
+ const actual = {};
57
+ for (const prefix of PREFIXES) {
58
+ const target = path.join(root, prefix);
59
+ if (fs.lstatSync(target).isSymbolicLink()) throw new Error('Linked component directory');
60
+ Object.assign(actual, payloadInventory(target, prefix));
61
+ }
62
+ const expectedNames = Object.keys(receipt.files).sort();
63
+ if (JSON.stringify(Object.keys(actual).sort()) !== JSON.stringify(expectedNames)) throw new Error('Bundled source inventory mismatch');
59
64
  for (const file of expectedNames) {
60
65
  if (!/^[a-f0-9]{64}$/.test(receipt.files[file]) || actual[file] !== receipt.files[file]) throw new Error('Bundled source digest mismatch: ' + file);
61
66
  }
62
- for (const name of ['agentSpine', 'translateNative']) {
63
- const version = receipt.versions?.[name];
64
- if (typeof version !== 'string' || !version || version.trim() !== version) {
65
- throw new Error('Invalid bundled component version: ' + name);
67
+ // Bind the semantic repair independently of the self-reported file inventory.
68
+ const patch = receipt.localPatches?.guardResponseProfile;
69
+ if (!patch || typeof patch !== 'object' || Array.isArray(patch)
70
+ || Object.keys(patch).length !== Object.keys(GUARD_RESPONSE_PROFILE).length
71
+ || Object.entries(GUARD_RESPONSE_PROFILE).some(([key, value]) => JSON.stringify(patch[key]) !== JSON.stringify(value))) {
72
+ throw new Error('Invalid language guard response profile repair receipt');
73
+ }
74
+ if (receipt.sourceDigests?.translateNative?.[GUARD_RESPONSE_PROFILE.file] !== GUARD_RESPONSE_PROFILE.beforeSha256) {
75
+ throw new Error('Invalid language guard response profile source digest');
76
+ }
77
+ for (const file of GUARD_RESPONSE_PAYLOADS) {
78
+ if (actual[file] !== GUARD_RESPONSE_PROFILE.afterSha256) {
79
+ throw new Error('Invalid language guard response profile payload: ' + file);
66
80
  }
67
81
  }
68
- const spine = JSON.parse(fs.readFileSync(path.join(root, 'agent-spine-plugin/package.json'), 'utf8'));
69
- if (spine.version !== receipt.versions.agentSpine) throw new Error('Bundled component version mismatch: agentSpine');
70
- for (const prefix of ['standard-skills/translate-native/', 'standard-tools/language-guard/']) {
71
- if (fs.readFileSync(path.join(root, prefix, 'VERSION'), 'utf8').trim() !== receipt.versions.translateNative) {
72
- throw new Error('Bundled component version mismatch: ' + prefix);
82
+ for (const entry of GUARD_RESPONSE_PROFILE.bytecodeEntries) {
83
+ if (receipt.sourceDigests?.translateNative?.[entry.file] !== entry.beforeSha256) {
84
+ throw new Error('Invalid language guard bytecode source digest');
73
85
  }
74
- const provenance = JSON.parse(fs.readFileSync(path.join(root, prefix, 'provenance.json'), 'utf8'));
75
- if (provenance?.name !== 'translate-native' || provenance.version !== receipt.versions.translateNative
76
- || provenance.sourceCommit !== receipt.sources.translateNative.commit
77
- || provenance.sourceRepository !== receipt.sources.translateNative.repository) {
78
- throw new Error('Bundled component provenance mismatch: ' + prefix);
86
+ for (const prefix of ['standard-skills/translate-native/scripts/', 'standard-tools/language-guard/']) {
87
+ const file = prefix + path.basename(entry.file);
88
+ if (actual[file] !== entry.afterSha256) throw new Error('Invalid language guard bytecode payload: ' + file);
79
89
  }
80
90
  }
81
- // Bind the semantic repair independently of the self-reported file inventory.
82
- const patch = receipt.localPatches?.guardResponseProfile;
83
- if (!patch || typeof patch !== 'object' || Array.isArray(patch)
84
- || Object.keys(patch).length !== Object.keys(GUARD_RESPONSE_PROFILE).length
85
- || Object.entries(GUARD_RESPONSE_PROFILE).some(([key, value]) => patch[key] !== value)) {
86
- throw new Error('Invalid language guard response profile repair receipt');
87
- }
88
- if (receipt.sourceDigests?.translateNative?.[GUARD_RESPONSE_PROFILE.file] !== GUARD_RESPONSE_PROFILE.beforeSha256) {
89
- throw new Error('Invalid language guard response profile source digest');
90
- }
91
- for (const file of GUARD_RESPONSE_PAYLOADS) {
92
- if (actual[file] !== GUARD_RESPONSE_PROFILE.afterSha256) {
93
- throw new Error('Invalid language guard response profile payload: ' + file);
94
- }
95
- }
96
- return receipt;
97
- }
98
-
99
- if (require.main === module) {
100
- try { const receipt = verifyBundledAgentSources(path.resolve(__dirname, '..'));
101
- console.log(JSON.stringify({ verified: true, sources: receipt.sources, files: Object.keys(receipt.files).length }));
102
- } catch (error) { console.error(error.message); process.exitCode = 1; }
103
- }
104
- module.exports = { verifyBundledAgentSources, payloadInventory, sha256, RECEIPT, SCHEMA, PREFIXES, REQUIRED,
105
- GUARD_RESPONSE_PROFILE, GUARD_RESPONSE_PAYLOADS };
91
+ return receipt;
92
+ }
93
+
94
+ if (require.main === module) {
95
+ try { const receipt = verifyBundledAgentSources(path.resolve(__dirname, '..'));
96
+ console.log(JSON.stringify({ verified: true, sources: receipt.sources, files: Object.keys(receipt.files).length }));
97
+ } catch (error) { console.error(error.message); process.exitCode = 1; }
98
+ }
99
+ module.exports = { verifyBundledAgentSources, payloadInventory, sha256, RECEIPT, SCHEMA, PREFIXES, REQUIRED,
100
+ GUARD_RESPONSE_PROFILE, GUARD_RESPONSE_PAYLOADS };