@metago-ai/engine 2.1.3 → 2.1.4

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 (65) hide show
  1. package/BOUNDARIES.md +109 -0
  2. package/CHANGES.md +4 -4
  3. package/CONSTITUTION/AXIOMS.md +75 -113
  4. package/CORE/ATOMS.md +611 -0
  5. package/CORE/ATTRIBUTES.md +74 -105
  6. package/CORE/PROTOCOLS.md +134 -116
  7. package/ENGINE.md +115 -115
  8. package/ENGINES/engine-runtime.cjs +318 -0
  9. package/ENGINES/final-engines-runtime.cjs +683 -0
  10. package/ENGINES/governance-runtime.cjs +582 -0
  11. package/ENGINES/math-capability-runtime.cjs +451 -0
  12. package/ENGINES/philosophy-runtime.cjs +427 -0
  13. package/ENGINES/yili/data/yaoci-1.js +24 -0
  14. package/ENGINES/yili/data/yaoci-2.js +21 -0
  15. package/ENGINES/yili/data/yaoci-3.js +21 -0
  16. package/ENGINES/yili/data/yaoci-4.js +21 -0
  17. package/ENGINES/yili/data/yaoci.js +17 -0
  18. package/ENGINES/yili/lib/almanac.js +416 -0
  19. package/ENGINES/yili/lib/bazi.js +127 -0
  20. package/ENGINES/yili/lib/diagnose.js +71 -0
  21. package/ENGINES/yili/lib/hetu-luoshu.js +123 -0
  22. package/ENGINES/yili/lib/index.js +23 -0
  23. package/ENGINES/yili/lib/liuyao.js +226 -0
  24. package/ENGINES/yili/lib/qimen.js +167 -0
  25. package/ENGINES/yili/lib/shushu-calculus.js +85 -0
  26. package/ENGINES/yili/lib/taiyi.js +83 -0
  27. package/ENGINES/yili/lib/vendor/shouxing-core.js +627 -0
  28. package/ENGINES/yili/lib/wuxing.js +106 -0
  29. package/ENGINES/yili/lib/yijing.js +226 -0
  30. package/ENGINES/yili/lib/zeri.js +80 -0
  31. package/ENGINES/yili/lib/ziwei.js +145 -0
  32. package/ENGINES/yili/package.json +1 -0
  33. package/EXECUTORS.md +85 -0
  34. package/GENOME.json +11 -10
  35. package/INDEX/ENGINES.md +168 -0
  36. package/INDEX/engines.json +2 -2
  37. package/INDEX/knowledge.json +87 -87
  38. package/INDEX/skills.json +227 -203
  39. package/PATENTS.md +1 -1
  40. package/PROTOCOLS/closure-runtime.cjs +288 -0
  41. package/PROTOCOLS/covenant-runtime.cjs +409 -0
  42. package/PROTOCOLS/final-runtime.cjs +680 -0
  43. package/PROTOCOLS/formula-runtime.cjs +399 -0
  44. package/PROTOCOLS/proactive-runtime.cjs +368 -0
  45. package/PROTOCOLS/rule-runtime.cjs +448 -0
  46. package/PROTOCOLS/runtime.cjs +441 -0
  47. package/README.md +5 -5
  48. package/RUNTIME/dist/kmwi-memory.d.ts.map +1 -1
  49. package/RUNTIME/dist/kmwi-memory.js +14 -2
  50. package/RUNTIME/dist/kmwi-memory.js.map +1 -1
  51. package/RUNTIME/dist/validators.js +11 -2
  52. package/atoms/approx.cjs +293 -0
  53. package/atoms/atom-factory.cjs +550 -0
  54. package/atoms/atoms-cosmic-bio.cjs +340 -0
  55. package/atoms/atoms-crypto-emotion.cjs +215 -0
  56. package/atoms/atoms_engines.json +5821 -0
  57. package/atoms/blueprint-atoms-2.cjs +583 -0
  58. package/atoms/blueprint-atoms.cjs +975 -0
  59. package/atoms/constraints.cjs +257 -0
  60. package/atoms/contract-validator.cjs +213 -0
  61. package/atoms/engine.cjs +849 -0
  62. package/atoms/specialized.cjs +530 -0
  63. package/atoms/verify.cjs +94 -0
  64. package/package.json +12 -6
  65. package/scripts/verify-dist.cjs +80 -0
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MetaGO Engine 发布前完整性门禁
4
+ *
5
+ * 在 npm publish 之前强制校验包内容完整,防止再次出现:
6
+ * - EVOLUTION.md 未随包发布(loader.js requiredFiles 校验失败,CLI 全灭)
7
+ * - RUNTIME/dist/algorithms/ 缺失(927 算法硬驱动失效,@metago-ai/algorithms 无引擎可载)
8
+ * - dist/cli.js 无 shebang(POSIX 下 bin 无法直接执行)
9
+ *
10
+ * 用法:node scripts/verify-dist.cjs (npm publish 时通过 prepublishOnly 自动触发)
11
+ *
12
+ * @author 易霄 / MetaGO Lightyear
13
+ * @version 1.0.0
14
+ */
15
+
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+
19
+ const pkgRoot = path.resolve(__dirname, '..');
20
+ const errors = [];
21
+
22
+ function check(cond, msg) {
23
+ if (!cond) errors.push(msg);
24
+ }
25
+
26
+ // 1. loader.js requiredFiles 对应的实体文件必须存在
27
+ const requiredFiles = [
28
+ 'ENGINE.md',
29
+ 'CONSTITUTION/AXIOMS.md',
30
+ 'CORE/ATTRIBUTES.md',
31
+ 'CORE/PROTOCOLS.md',
32
+ 'INDEX/engines.json',
33
+ 'INDEX/skills.json',
34
+ 'INDEX/tools.json',
35
+ 'INDEX/knowledge.json',
36
+ 'EVOLUTION.md',
37
+ ];
38
+ for (const rel of requiredFiles) {
39
+ check(fs.existsSync(path.join(pkgRoot, rel)), `缺少 loader 必需文件: ${rel}`);
40
+ }
41
+
42
+ // 2. 构建产物必须存在;算法注册表为"增强项"(硬校验+软告警分级)
43
+ // - 硬:dist 存在、cli.js 有 shebang(CLI 可用性)
44
+ // - 软:dist/algorithms 注册表(927 算法内嵌;engine 核心运行不依赖它,
45
+ // 消费方 @metago-ai/algorithms 已自带 vendored 注册表。缺失时告警:
46
+ // 完整内嵌版应从含全量源码的 monorepo 构建发布)
47
+ const distDir = path.join(pkgRoot, 'RUNTIME', 'dist');
48
+ check(fs.existsSync(distDir), 'RUNTIME/dist/ 不存在,请先运行 npm run build');
49
+ const warnings = [];
50
+ const registryPath = path.join(distDir, 'algorithms', 'registry.js');
51
+ if (fs.existsSync(distDir) && !fs.existsSync(registryPath)) {
52
+ warnings.push('RUNTIME/dist/algorithms/ 未内嵌(927 算法注册表不在本包内;@metago-ai/algorithms 已 vendored 自带,不影响功能。如需内嵌请从全量 monorepo 构建发布)');
53
+ }
54
+
55
+ // 3. CLI 入口必须有 shebang
56
+ const cliPath = path.join(distDir, 'cli.js');
57
+ if (fs.existsSync(cliPath)) {
58
+ const head = fs.readFileSync(cliPath, 'utf8').slice(0, 64);
59
+ check(head.startsWith('#!/usr/bin/env node'), 'RUNTIME/dist/cli.js 缺少 #!/usr/bin/env node shebang(检查 src/cli.ts 首行)');
60
+ } else {
61
+ errors.push('RUNTIME/dist/cli.js 不存在,请先运行 npm run build');
62
+ }
63
+
64
+ // 4. package.json files 列表必须覆盖关键路径
65
+ const pkg = require(path.join(pkgRoot, 'package.json'));
66
+ const files = pkg.files || [];
67
+ for (const need of ['RUNTIME/dist/', 'EVOLUTION.md']) {
68
+ check(files.includes(need), `package.json files 缺少 "${need}"`);
69
+ }
70
+
71
+ if (warnings.length > 0) {
72
+ console.warn('[verify-dist] 告警(不阻断发布):');
73
+ for (const w of warnings) console.warn(` ⚠ ${w}`);
74
+ }
75
+ if (errors.length > 0) {
76
+ console.error('[verify-dist] 发布门禁未通过:');
77
+ for (const e of errors) console.error(` ✗ ${e}`);
78
+ process.exit(1);
79
+ }
80
+ console.log(`[verify-dist] 发布门禁通过(${requiredFiles.length} 必需文件 + CLI shebang 均就绪)`);