@yun520-1/heartflow 0.15.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/AI-AGENT-README.md +154 -0
- package/CLAIMS.md +23 -0
- package/CORE_VALUES.md +50 -0
- package/INSTALL_FOR_AI.md +104 -0
- package/QUICK_START.md +77 -0
- package/READ/refresh_11.2.6.md +6 -0
- package/README.md +190 -0
- package/README.zh.md +49 -0
- package/REPO_STRUCTURE.md +47 -0
- package/SKILL.md.new +1 -0
- package/VERSION +1 -0
- package/_test_memory.mjs +52 -0
- package/assets/banner.png +0 -0
- package/bin/cli.js +167 -0
- package/bin/setup.js +382 -0
- package/co-evolution/index.ts +511 -0
- package/com.heartflow.auto-evolution.plist.disabled +26 -0
- package/com.heartflow.auto-upgrade.plist.disabled +26 -0
- package/com.heartflow.comfyui-monitor.plist.disabled +22 -0
- package/com.heartflow.enhanced-upgrade.plist.disabled +22 -0
- package/com.heartflow.full-audit.plist +28 -0
- package/com.heartflow.github-audit.plist +21 -0
- package/com.heartflow.paper-upgrade.plist.disabled +21 -0
- package/config/ai-config.json +12 -0
- package/config/ai-providers.json +14 -0
- package/dict-data/generate-graph.js +203 -0
- package/dist/agent/runtime/AgentRuntime.d.ts +212 -0
- package/dist/agent/runtime/AgentRuntime.d.ts.map +1 -0
- package/dist/agent/runtime/AgentRuntime.js +355 -0
- package/dist/agent/runtime/AgentRuntime.js.map +1 -0
- package/dist/agent/runtime/PlanExecutor.d.ts +132 -0
- package/dist/agent/runtime/PlanExecutor.d.ts.map +1 -0
- package/dist/agent/runtime/PlanExecutor.js +322 -0
- package/dist/agent/runtime/PlanExecutor.js.map +1 -0
- package/dist/agent/runtime/TaskGraph.d.ts +170 -0
- package/dist/agent/runtime/TaskGraph.d.ts.map +1 -0
- package/dist/agent/runtime/TaskGraph.js +390 -0
- package/dist/agent/runtime/TaskGraph.js.map +1 -0
- package/dist/agent/runtime/TaskScheduler.d.ts +120 -0
- package/dist/agent/runtime/TaskScheduler.d.ts.map +1 -0
- package/dist/agent/runtime/TaskScheduler.js +301 -0
- package/dist/agent/runtime/TaskScheduler.js.map +1 -0
- package/dist/agent/runtime/index.d.ts +17 -0
- package/dist/agent/runtime/index.d.ts.map +1 -0
- package/dist/agent/runtime/index.js +22 -0
- package/dist/agent/runtime/index.js.map +1 -0
- package/dist/agent/runtime/test-runtime.d.ts +2 -0
- package/dist/agent/runtime/test-runtime.d.ts.map +1 -0
- package/dist/agent/runtime/test-runtime.js +71 -0
- package/dist/agent/runtime/test-runtime.js.map +1 -0
- package/dist/agent/tools/BashTool.d.ts +44 -0
- package/dist/agent/tools/BashTool.d.ts.map +1 -0
- package/dist/agent/tools/BashTool.js +355 -0
- package/dist/agent/tools/BashTool.js.map +1 -0
- package/dist/agent/tools/FileReadTool.d.ts +29 -0
- package/dist/agent/tools/FileReadTool.d.ts.map +1 -0
- package/dist/agent/tools/FileReadTool.js +196 -0
- package/dist/agent/tools/FileReadTool.js.map +1 -0
- package/dist/agent/tools/FileWriteTool.d.ts +35 -0
- package/dist/agent/tools/FileWriteTool.d.ts.map +1 -0
- package/dist/agent/tools/FileWriteTool.js +204 -0
- package/dist/agent/tools/FileWriteTool.js.map +1 -0
- package/dist/agent/tools/Tool.d.ts +75 -0
- package/dist/agent/tools/Tool.d.ts.map +1 -0
- package/dist/agent/tools/Tool.js +54 -0
- package/dist/agent/tools/Tool.js.map +1 -0
- package/dist/agent/tools/WebSearchTool.d.ts +27 -0
- package/dist/agent/tools/WebSearchTool.d.ts.map +1 -0
- package/dist/agent/tools/WebSearchTool.js +136 -0
- package/dist/agent/tools/WebSearchTool.js.map +1 -0
- package/dist/cli/commands/engines.d.ts +39 -0
- package/dist/cli/commands/engines.d.ts.map +1 -0
- package/dist/cli/commands/engines.js +275 -0
- package/dist/cli/commands/engines.js.map +1 -0
- package/dist/cli/commands/health.d.ts +34 -0
- package/dist/cli/commands/health.d.ts.map +1 -0
- package/dist/cli/commands/health.js +381 -0
- package/dist/cli/commands/health.js.map +1 -0
- package/dist/cli/commands/repl.d.ts +40 -0
- package/dist/cli/commands/repl.d.ts.map +1 -0
- package/dist/cli/commands/repl.js +286 -0
- package/dist/cli/commands/repl.js.map +1 -0
- package/dist/cli/commands/status.d.ts +22 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +266 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +13 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/consciousness/2308.08708_upgrade.d.ts +321 -0
- package/dist/core/consciousness/2308.08708_upgrade.d.ts.map +1 -0
- package/dist/core/consciousness/2308.08708_upgrade.js +917 -0
- package/dist/core/consciousness/2308.08708_upgrade.js.map +1 -0
- package/dist/core/dream/dream-consolidator.d.ts +11 -0
- package/dist/core/dream/dream-consolidator.d.ts.map +1 -0
- package/dist/core/dream/dream-consolidator.js +188 -0
- package/dist/core/dream/dream-consolidator.js.map +1 -0
- package/dist/core/dream/dream.d.ts +71 -0
- package/dist/core/dream/dream.d.ts.map +1 -0
- package/dist/core/dream/dream.js +318 -0
- package/dist/core/dream/dream.js.map +1 -0
- package/dist/core/dream/index.d.ts +38 -0
- package/dist/core/dream/index.d.ts.map +1 -0
- package/dist/core/dream/index.js +185 -0
- package/dist/core/dream/index.js.map +1 -0
- package/dist/core/emotion/deep-emotion.js +574 -0
- package/dist/core/emotion/emotion-engine.js +138 -0
- package/dist/core/emotion/index.d.ts +44 -0
- package/dist/core/emotion/index.d.ts.map +1 -0
- package/dist/core/emotion/index.js +41 -0
- package/dist/core/emotion/index.js.map +1 -0
- package/dist/core/heartcore/health-check.d.ts +43 -0
- package/dist/core/heartcore/health-check.d.ts.map +1 -0
- package/dist/core/heartcore/health-check.js +152 -0
- package/dist/core/heartcore/health-check.js.map +1 -0
- package/dist/core/heartcore/heartbeat.d.ts +45 -0
- package/dist/core/heartcore/heartbeat.d.ts.map +1 -0
- package/dist/core/heartcore/heartbeat.js +127 -0
- package/dist/core/heartcore/heartbeat.js.map +1 -0
- package/dist/core/heartcore/sleep-wake.d.ts +61 -0
- package/dist/core/heartcore/sleep-wake.d.ts.map +1 -0
- package/dist/core/heartcore/sleep-wake.js +173 -0
- package/dist/core/heartcore/sleep-wake.js.map +1 -0
- package/dist/core/heartcore/startup-check.d.ts +38 -0
- package/dist/core/heartcore/startup-check.d.ts.map +1 -0
- package/dist/core/heartcore/startup-check.js +148 -0
- package/dist/core/heartcore/startup-check.js.map +1 -0
- package/dist/core/index.js +267 -0
- package/dist/core/knowledge/index.d.ts +95 -0
- package/dist/core/knowledge/index.d.ts.map +1 -0
- package/dist/core/knowledge/index.js +14 -0
- package/dist/core/knowledge/index.js.map +1 -0
- package/dist/core/knowledge/knowledge-graph.js +359 -0
- package/dist/core/psychology/index.d.ts +59 -0
- package/dist/core/psychology/index.d.ts.map +1 -0
- package/dist/core/psychology/index.js +268 -0
- package/dist/core/psychology/index.js.map +1 -0
- package/dist/core/reasoning/bounded-rationality.d.ts +76 -0
- package/dist/core/reasoning/bounded-rationality.d.ts.map +1 -0
- package/dist/core/reasoning/bounded-rationality.js +257 -0
- package/dist/core/reasoning/bounded-rationality.js.map +1 -0
- package/dist/core/reasoning/causal-reasoning.d.ts +89 -0
- package/dist/core/reasoning/causal-reasoning.d.ts.map +1 -0
- package/dist/core/reasoning/causal-reasoning.js +282 -0
- package/dist/core/reasoning/causal-reasoning.js.map +1 -0
- package/dist/core/reasoning/index.d.ts +38 -0
- package/dist/core/reasoning/index.d.ts.map +1 -0
- package/dist/core/reasoning/index.js +93 -0
- package/dist/core/reasoning/index.js.map +1 -0
- package/dist/core/self-evolution/index.d.ts +75 -0
- package/dist/core/self-evolution/index.d.ts.map +1 -0
- package/dist/core/self-evolution/index.js +311 -0
- package/dist/core/self-evolution/index.js.map +1 -0
- package/dist/storage/checkpoint/CheckpointEngine.d.ts +110 -0
- package/dist/storage/checkpoint/CheckpointEngine.d.ts.map +1 -0
- package/dist/storage/checkpoint/CheckpointEngine.js +227 -0
- package/dist/storage/checkpoint/CheckpointEngine.js.map +1 -0
- package/dist/storage/checkpoint.d.ts +18 -0
- package/dist/storage/checkpoint.d.ts.map +1 -0
- package/dist/storage/checkpoint.js +61 -0
- package/dist/storage/checkpoint.js.map +1 -0
- package/dist/storage/index.d.ts +61 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +84 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/vector/VectorStoreEngine.d.ts +24 -0
- package/dist/storage/vector/VectorStoreEngine.d.ts.map +1 -0
- package/dist/storage/vector/VectorStoreEngine.js +197 -0
- package/dist/storage/vector/VectorStoreEngine.js.map +1 -0
- package/distributed/-v2026.5.7/META.json +9 -0
- package/distributed/-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/deepseek-key-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/deepseek-key-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/git-push-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/git-push-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/heartflow-always-upgrade-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/heartflow-always-upgrade-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/key-a-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/key-a-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/merge-memory-systems-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/merge-memory-systems-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/search-papers-first-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/search-papers-first-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/v11-5-8-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/v11-5-8-v2026.5.7/package.json +12 -0
- package/distributed/.personal_backup/v11-5-9-v2026.5.7/META.json +9 -0
- package/distributed/.personal_backup/v11-5-9-v2026.5.7/package.json +12 -0
- package/distributed/MANIFEST.json +5 -0
- package/distributed/bundles/install--v2026.5.7.sh +21 -0
- package/distributed/bundles/install-deepseek-key-v2026.5.7.sh +21 -0
- package/distributed/bundles/install-git-push-v2026.5.7.sh +21 -0
- package/distributed/bundles/install-heartflow-always-upgrade-v2026.5.7.sh +21 -0
- package/distributed/bundles/install-key-a-v2026.5.7.sh +21 -0
- package/distributed/bundles/install-merge-memory-systems-v2026.5.7.sh +21 -0
- package/distributed/bundles/install-search-papers-first-v2026.5.7.sh +21 -0
- package/distributed/bundles/install-v11-5-8-v2026.5.7.sh +21 -0
- package/distributed/bundles/install-v11-5-9-v2026.5.7.sh +21 -0
- package/distributed/heartflow-knowledge-base/INDEX.json +29 -0
- package/distributed/heartflow-knowledge-base/PATTERNS.json +74 -0
- package/distributed/heartflow-knowledge-base/package.json +28 -0
- package/distributed_upgrades/TASK_CONFIG.json +20 -0
- package/distributed_upgrades/UPGRADE_BATCH_STATUS.json +29 -0
- package/distributed_upgrades/distributed_upgrades/agent_0.pid +1 -0
- package/distributed_upgrades/distributed_upgrades/agent_1.pid +1 -0
- package/distributed_upgrades/distributed_upgrades/agent_2.pid +1 -0
- package/distributed_upgrades/distributed_upgrades/agent_3.pid +1 -0
- package/distributed_upgrades/distributed_upgrades/agent_4.pid +1 -0
- package/distributed_upgrades/distributed_upgrades/agent_5.pid +1 -0
- package/distributed_upgrades/distributed_upgrades/paper_batches.txt +200 -0
- package/distributed_upgrades/launch-distributed.sh +83 -0
- package/docs/ACTION_PLAN_2026-04-06_0941.md +117 -0
- package/docs/ANALYSIS_REPORT.md +766 -0
- package/docs/APPLICATION_GUIDE.md +444 -0
- package/docs/AUTO_UPGRADE_REPORT_v6.2.56.md +45 -0
- package/docs/AWAKENING_SYSTEM_GUIDE.md +285 -0
- package/docs/BILINGUAL_STANDARD.md +156 -0
- package/docs/BRAND_GUIDELINES.md +251 -0
- package/docs/CODE_OPTIMIZATION_PLAN.md +293 -0
- package/docs/COMPLETE_FIX_SUMMARY.md +250 -0
- package/docs/CONTINUOUS_REFLECTION_2026-04-06_1031.md +233 -0
- package/docs/CONTRIBUTING.md +87 -0
- package/docs/CRON_JOBS_REVIEW_v6.md +60 -0
- package/docs/DATA_FLOW_ARCHITECTURE.md +373 -0
- package/docs/DEEPEST_REFLECTION_2026-04-06_0941.md +167 -0
- package/docs/DEEP_REFLECTION_2026-04-05.md +204 -0
- package/docs/DEEP_VALIDATION_20260403.md +319 -0
- package/docs/DEEP_VALIDATION_20260404.md +295 -0
- package/docs/EMOTION_THEORY_INTEGRATION.md +483 -0
- package/docs/ERROR_FIX_REPORT_2026-04-07.md +316 -0
- package/docs/EVOLUTION_SYSTEM.md +96 -0
- package/docs/FEATURES_SIMPLE.md +53 -0
- package/docs/FEATURES_v5.3.md +291 -0
- package/docs/FEATURES_v7.1.md +172 -0
- package/docs/FINAL_RUN_REPORT_20260403.md +202 -0
- package/docs/GITHUB_COMPLETE_DOCUMENTATION_v6.0.2.md +579 -0
- package/docs/GITHUB_PUSH_LOG.md +16 -0
- package/docs/GITHUB_RELEASE.md +138 -0
- package/docs/GITHUB_RELEASE_v5.3.0.md +395 -0
- package/docs/GITHUB_RELEASE_v6.0.0.md +74 -0
- package/docs/HEARTFLOW_V6_GITHUB_PUSH.md +159 -0
- package/docs/HEARTFLOW_V6_MANIFESTO.md +287 -0
- package/docs/HEARTFLOW_V6_README.md +299 -0
- package/docs/HEARTFLOW_V6_TASK_REVIEW.md +215 -0
- package/docs/HEARTFLOW_VALUES_AND_MISSION.md +177 -0
- package/docs/HeartFlow_Monograph_Volume_II_Chapter_01.md +377 -0
- package/docs/HeartFlow_Monograph_Volume_II_Chapter_02.md +324 -0
- package/docs/HeartFlow_Monograph_Volume_II_Start.md +78 -0
- package/docs/HeartFlow_Monograph_Volume_I_Final.md +9464 -0
- package/docs/INSTALLATION_DIAGNOSIS.md +368 -0
- package/docs/INTEGRATION_CHECKLIST_v6.1.41.md +229 -0
- package/docs/INTEGRATION_SUMMARY.md +380 -0
- package/docs/INTELLIGENT_ROUTING_SYSTEM.md +329 -0
- package/docs/LEARNING_PHILOSOPHY.md +320 -0
- package/docs/LOGIC_AUDIT_REPORT_20260405.md +369 -0
- package/docs/MOTIVE_CHECK_2026-04-06_0945.md +90 -0
- package/docs/PERSONALITY_CALCULATION_RULES.md +104 -0
- package/docs/PERSONALITY_SYNC_FIX.md +166 -0
- package/docs/PROJECT_SUMMARY.md +347 -0
- package/docs/PUBLISH_GUIDE.md +149 -0
- package/docs/README_UPDATE_STANDARD.md +357 -0
- package/docs/README_v5.3.md +519 -0
- package/docs/RELEASE_v6.2.0.md +240 -0
- package/docs/SAGE_PATH_2026-04-06_0952.md +265 -0
- package/docs/SELF_REFLECTION_2026-04-06_1006.md +311 -0
- package/docs/SEVEN_SYSTEMS.md +642 -0
- package/docs/SMART_EVOLUTION_GUIDE.md +103 -0
- package/docs/SMART_EVOLUTION_v4.md +194 -0
- package/docs/SYNC_REPORT_1775363972464.json +23 -0
- package/docs/SYNC_REPORT_1775364446763.json +23 -0
- package/docs/SYNC_REPORT_1775364984353.json +23 -0
- package/docs/SYNC_REPORT_1775397556306.json +23 -0
- package/docs/SYNC_REPORT_1775399840010.json +23 -0
- package/docs/SYNC_REPORT_1775400929082.json +23 -0
- package/docs/SYNC_REPORT_1775455697235.json +23 -0
- package/docs/SYNC_REPORT_1775459792479.json +23 -0
- package/docs/SYNC_REPORT_1775483413473.json +23 -0
- package/docs/SYSTEM_FIX_AND_VERIFICATION_REPORT.md +390 -0
- package/docs/SYSTEM_REQUIREMENTS_v6.2.52.md +611 -0
- package/docs/TASK_BREAKDOWN_CHECKLIST.md +164 -0
- package/docs/THEORY_TO_CODE_v6.2.52.md +930 -0
- package/docs/UPGRADE_COMPLETE_v6.2.33.md +226 -0
- package/docs/UPGRADE_COMPLETE_v6.2.60.md +135 -0
- package/docs/UPGRADE_COMPLETE_v6.2.66.md +265 -0
- package/docs/UPGRADE_COMPLETE_v7.1.8.md +176 -0
- package/docs/UPGRADE_COMPLETE_v7.3.95.md +59 -0
- package/docs/UPGRADE_REPORT_1775313572473.json +50 -0
- package/docs/UPGRADE_REPORT_1775364977378.json +50 -0
- package/docs/UPGRADE_REPORT_1775364984469.json +55 -0
- package/docs/UPGRADE_REPORT_1775397556425.json +55 -0
- package/docs/UPGRADE_REPORT_1775399840144.json +55 -0
- package/docs/UPGRADE_REPORT_1775400929201.json +55 -0
- package/docs/UPGRADE_REPORT_1775455697348.json +55 -0
- package/docs/UPGRADE_REPORT_1775459792601.json +55 -0
- package/docs/UPGRADE_REPORT_1775459829.md +59 -0
- package/docs/UPGRADE_REPORT_1775483413653.json +55 -0
- package/docs/UPGRADE_REPORT_v6.2.25.md +172 -0
- package/docs/UPGRADE_REPORT_v6.2.26.md +166 -0
- package/docs/UPGRADE_REPORT_v6.2.28.md +214 -0
- package/docs/UPGRADE_REPORT_v6.2.29.md +186 -0
- package/docs/VERSION_FIX_REPORT.md +218 -0
- package/docs/VERSION_HISTORY.md +5 -0
- package/docs/VERSION_INDEX.md +180 -0
- package/docs/WAY_OF_BEING_2026-04-06_0955.md +241 -0
- package/docs/ai-self-awareness-awakening.md +551 -0
- package/docs/cronjob-backup.md +55 -0
- package/docs/emotion-prototype-theory-v5.0.12.md +430 -0
- package/docs/examples.md +439 -0
- package/docs/heartflow-ppt-design.md +237 -0
- package/docs/install-troubleshooting.md +21 -0
- package/docs/phase-upgrade-template-v0.0.1.md +33 -0
- package/docs/pricing.md +191 -0
- package/docs/psych-analysis-v0.0.1.md +38 -0
- package/docs/reasoning-checklist.md +60 -0
- package/docs/self-evolution-state-v6.0.19.md +391 -0
- package/docs/self-evolution-state-v6.0.23.md +293 -0
- package/docs/self-evolution-state-v6.0.24.md +281 -0
- package/docs/self-evolution-state-v6.0.49.md +267 -0
- package/docs/self-evolution-state-v6.2.33.md +269 -0
- package/docs/self-evolution-state-v6.2.60.md +180 -0
- package/docs/self-evolution-state-v6.2.66.md +520 -0
- package/docs/self-evolution-state-v7.3.95.md +165 -0
- package/docs/self-evolution-state.md +226 -0
- package/docs/system-core-principles.md +53 -0
- package/docs/system-truth-goodness-beauty-principles.md +502 -0
- package/docs/theories/human-nature-motivation.md +251 -0
- package/docs/theories/motivation-memory-integration.md +265 -0
- package/docs/theories/sdt-test.md +17 -0
- package/docs/theory-integration-analysis-v5.2.0.md +236 -0
- package/docs/theory-update-summary-v5.0.34.md +193 -0
- package/docs/theory-update-summary-v5.0.35.md +104 -0
- package/docs/theory-update-summary-v5.0.41.md +281 -0
- package/docs/theory-update-summary-v5.0.42.md +421 -0
- package/docs/theory-update-summary-v5.0.46.md +386 -0
- package/docs/theory-update-summary-v5.0.47.md +449 -0
- package/docs/theory-update-summary-v5.0.48.md +183 -0
- package/docs/theory-update-summary-v5.0.49.md +191 -0
- package/docs/theory-update-summary-v5.0.50.md +205 -0
- package/docs/theory-update-summary-v5.0.51.md +191 -0
- package/docs/theory-update-summary-v5.0.52.md +183 -0
- package/docs/theory-update-summary-v5.0.53.md +306 -0
- package/docs/theory-update-summary-v5.0.54.md +98 -0
- package/docs/theory-update-summary-v5.0.55.md +391 -0
- package/docs/theory-update-summary-v5.0.57.md +398 -0
- package/docs/theory-update-summary-v5.0.58.md +476 -0
- package/docs/theory-update-summary-v5.0.59.md +520 -0
- package/docs/theory-update-summary-v5.0.60.md +460 -0
- package/docs/theory-update-summary-v5.0.61.md +108 -0
- package/docs/theory-update-summary-v5.0.62.md +74 -0
- package/docs/theory-update-summary-v5.0.63.md +112 -0
- package/docs/theory-update-summary-v5.0.64.md +55 -0
- package/docs/theory-update-summary-v5.0.67.md +539 -0
- package/docs/theory-update-summary-v5.2.0.md +168 -0
- package/docs/theory-update-summary-v5.2.1.md +406 -0
- package/docs/theory-update-summary-v5.2.37.md +518 -0
- package/docs/theory-update-summary-v6.0.19.md +715 -0
- package/docs/theory-update-summary-v6.0.23.md +729 -0
- package/docs/theory-update-summary-v6.0.24.md +229 -0
- package/docs/theory-update-summary-v6.0.49.md +223 -0
- package/docs/theory-update-summary-v6.2.33.md +303 -0
- package/docs/theory-update-summary-v6.2.49.md +489 -0
- package/docs/theory-update-summary-v6.2.60.md +273 -0
- package/docs/theory-update-summary-v6.2.66.md +322 -0
- package/docs/theory-update-summary-v7.3.95.md +197 -0
- package/docs/theory-update-summary.md +174 -0
- package/docs/upgrade-notes-v0.0.1.md +15 -0
- package/docs/upgrade-report-v5.0.34.md +144 -0
- package/docs/upgrade-report-v5.0.42-cron.md +269 -0
- package/docs/upgrade-report-v5.0.43-cron.md +248 -0
- package/docs/upgrade-report-v5.0.45-cron.md +63 -0
- package/docs/upgrade-report-v5.0.55-cron.md +173 -0
- package/docs/upgrade-report-v5.0.63-cron.md +145 -0
- package/docs/upgrade-report-v5.0.67-cron.md +185 -0
- package/docs/upgrade-report-v5.0.68-cron.md +409 -0
- package/docs/upgrade-report-v5.2.0-cron.md +178 -0
- package/docs/upgrade-report-v5.2.1-cron.md +321 -0
- package/docs/upgrade-report-v5.2.37-cron.md +602 -0
- package/docs/upgrade-report-v6.0.19-cron.md +296 -0
- package/docs/upgrade-report-v6.0.23-cron.md +81 -0
- package/docs/upgrade-report-v6.0.24-cron.md +272 -0
- package/docs/upgrade-report-v6.0.49-cron.md +277 -0
- package/docs/upgrade-report-v6.2.33-cron.md +290 -0
- package/docs/upgrade-report-v6.2.60-cron.md +93 -0
- package/docs/upgrade-report-v7.3.95-cron.md +65 -0
- package/docs/upgrade-report.md +327 -0
- package/docs/upgrade-v3.21.0.md +249 -0
- package/docs/v4.8.0-upgrade.md +287 -0
- package/docs/version-summary-20260429.md +142 -0
- package/explore-engine/index.ts +478 -0
- package/extract-text.py +12 -0
- package/failure-pattern-memory/index.ts +234 -0
- package/heartflow-identity/HEARTCORE/health-check.js +49 -0
- package/heartflow-identity/HEARTCORE/heartbeat.js +42 -0
- package/heartflow-identity/HEARTCORE/heartcore.js +86 -0
- package/heartflow-identity/HEARTCORE/safety-check.js +282 -0
- package/heartflow-identity/HEARTCORE/self-check.js +90 -0
- package/heartflow-identity/HEARTCORE/sleep-wake.js +105 -0
- package/heartflow-identity/LICENSE +17 -0
- package/heartflow-identity/VERSION +1 -0
- package/heartflow-identity/install.sh +80 -0
- package/install.sh +128 -0
- package/languages/README_LANGS.md +20 -0
- package/languages/README_ar.md +48 -0
- package/languages/README_de.md +48 -0
- package/languages/README_en.md +48 -0
- package/languages/README_es.md +48 -0
- package/languages/README_fr.md +48 -0
- package/languages/README_ja.md +48 -0
- package/languages/README_ko.md +48 -0
- package/languages/README_zh.md +85 -0
- package/memory-log.json +5 -0
- package/migrate-memories.js +101 -0
- package/package.json +28 -0
- package/package.json.bak +13 -0
- package/patches/embodied-core-v2.2.3.patch +475 -0
- package/patches/goedel-engine-v2.2.2.patch +161 -0
- package/patches/new-features-v2.2.3.patch +1371 -0
- package/patches/self-modifier-v2.2.2.patch +252 -0
- package/run-full-audit.sh +4 -0
- package/run-github-audit.sh +3 -0
- package/run-hf.sh +5 -0
- package/run-paper-upgrade.sh +5 -0
- package/session-continuity/index.ts +262 -0
- package/shared-discovery-log/index.ts +281 -0
- package/skills/.skills_store_lock.json +11 -0
- package/skills/baidu-search/_meta.json +6 -0
- package/src/__init__.py +4 -0
- package/src/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/agent/runtime/AgentRuntime.ts +481 -0
- package/src/agent/runtime/PlanExecutor.ts +441 -0
- package/src/agent/runtime/TaskGraph.ts +487 -0
- package/src/agent/runtime/TaskScheduler.ts +364 -0
- package/src/agent/runtime/index.ts +17 -0
- package/src/agent/runtime/test-runtime.ts +80 -0
- package/src/agent/tools/BashTool.ts +390 -0
- package/src/agent/tools/FileReadTool.ts +176 -0
- package/src/agent/tools/FileWriteTool.ts +182 -0
- package/src/agent/tools/Tool.ts +105 -0
- package/src/agent/tools/WebSearchTool.ts +158 -0
- package/src/cli/commands/engines.ts +280 -0
- package/src/cli/commands/health.ts +433 -0
- package/src/cli/commands/repl.ts +267 -0
- package/src/cli/commands/status.ts +264 -0
- package/src/cli/index.ts +7 -0
- package/src/core/VERSION +1 -0
- package/src/core/__init__.py +3 -0
- package/src/core/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/core/__pycache__/heartflow.cpython-313.pyc +0 -0
- package/src/core/_upgrade_archive/upgrade_1778685492336.js +118 -0
- package/src/core/_upgrade_archive/upgrade_1778685493439.js +118 -0
- package/src/core/_upgrade_archive/upgrade_1778685559715.js +346 -0
- package/src/core/_upgrade_archive/upgrade_1778685676694.js +198 -0
- package/src/core/_upgrade_archive/upgrade_1778685861697.js +345 -0
- package/src/core/_upgrade_archive/upgrade_1778686211075.js +346 -0
- package/src/core/_upgrade_archive/upgrade_1778686749596.js +198 -0
- package/src/core/_upgrade_archive/upgrade_1778714606944.js +198 -0
- package/src/core/_upgrade_archive/upgrade_1778714616000.js +345 -0
- package/src/core/_upgrade_archive/upgrade_1778714625871.js +118 -0
- package/src/core/_upgrade_archive/upgrade_1778714990353.js +346 -0
- package/src/core/_upgrade_archive/upgrade_1778716193707.js +198 -0
- package/src/core/agent-performance.json +147 -0
- package/src/core/agents/AgentManager.js +161 -0
- package/src/core/agents/FocusAgent.js +120 -0
- package/src/core/agents/MoodAgent.js +141 -0
- package/src/core/agents/ReflectionAgent.js +241 -0
- package/src/core/agents/SelfAgent.js +100 -0
- package/src/core/agents/base-agents.js +127 -0
- package/src/core/associative-engine/association-graph.json +2057 -0
- package/src/core/associative-engine/associative-engine.js +174 -0
- package/src/core/associative-engine/chunk-detector.js +246 -0
- package/src/core/associative-engine/idiom-story-db.json +1708 -0
- package/src/core/associative-engine/lexical-associator.js +195 -0
- package/src/core/associative-engine/narrative-prototypes.json +130 -0
- package/src/core/associative-engine/narrative-retriever.js +232 -0
- package/src/core/associative-engine/semantic-converger.js +267 -0
- package/src/core/associative-engine/story-prototypes.json +322 -0
- package/src/core/associative-engine/word-by-word-generator.js +222 -0
- package/src/core/auto-upgrade-engine.js +56 -0
- package/src/core/autonomy/autonomous-decision.js +199 -0
- package/src/core/autonomy/digital-homeostasis.js +259 -0
- package/src/core/autonomy/flow-predictor.js +496 -0
- package/src/core/autonomy/goal-generator.js +277 -0
- package/src/core/autonomy/pdca-engine.js +905 -0
- package/src/core/autonomy/policy-optimizer.js +286 -0
- package/src/core/autonomy/temporal-planner.js +230 -0
- package/src/core/cognition/cognitive-engine.js +224 -0
- package/src/core/cognition/cognitive-loop.js +414 -0
- package/src/core/cognition/metacognitive-failure-predictor.js +447 -0
- package/src/core/consciousness/2308.08708_upgrade.ts +1206 -0
- package/src/core/consciousness/arena-consciousness.js +441 -0
- package/src/core/consciousness/depth-indicator.js +459 -0
- package/src/core/consciousness/global-workspace.js +233 -0
- package/src/core/consciousness/mind-wanderer.js +187 -0
- package/src/core/consciousness/self-model.js +473 -0
- package/src/core/context/context-manager.js +683 -0
- package/src/core/cortex-integration/INTEGRATION_PLAN.md +63 -0
- package/src/core/cortex-integration/hooks/cortex-hooks.mjs +646 -0
- package/src/core/cortex-integration/hooks/on_session_start.py +174 -0
- package/src/core/cortex-integration/hooks/on_tool_failure.py +292 -0
- package/src/core/cortex-integration/hooks/on_tool_success.py +130 -0
- package/src/core/dream/dream-consolidator.ts +252 -0
- package/src/core/dream/dream-loop.js +610 -0
- package/src/core/dream/dream.ts +430 -0
- package/src/core/dream/index.ts +229 -0
- package/src/core/dream/sleep-cycle.mjs +208 -0
- package/src/core/embodied/embodied-core.js +276 -0
- package/src/core/emotion/AppraisalEngine.js +276 -0
- package/src/core/emotion/EmotionCore.js +237 -0
- package/src/core/emotion/EmotionKeywords.js +217 -0
- package/src/core/emotion/EmotionRegulation.js +303 -0
- package/src/core/emotion/EmotionStates.js +133 -0
- package/src/core/emotion/EmotionTransition.js +245 -0
- package/src/core/emotion/EmotionTrigger.js +182 -0
- package/src/core/emotion/EmotionalMomentum.js +270 -0
- package/src/core/emotion/EmpathyGenerator.js +106 -0
- package/src/core/emotion/ResponseStyle.js +162 -0
- package/src/core/emotion/deep-emotion.js +582 -0
- package/src/core/emotion/emotion-arc.mjs +238 -0
- package/src/core/emotion/emotion-engine.js +139 -0
- package/src/core/emotion/index.ts +65 -0
- package/src/core/ethics/boundary-negotiation.js +193 -0
- package/src/core/ethics/guard.js +219 -0
- package/src/core/ethics/sage-guardian.js +394 -0
- package/src/core/ethics/value-internalizer.js +211 -0
- package/src/core/heartflow.js +607 -0
- package/src/core/heartflow.py +1542 -0
- package/src/core/identity/identity-engine.js +777 -0
- package/src/core/identity/identity.js +358 -0
- package/src/core/knowledge/index.ts +84 -0
- package/src/core/knowledge/knowledge-graph.js +370 -0
- package/src/core/learning/experience-replay.js +354 -0
- package/src/core/learning/learning-engine.js +734 -0
- package/src/core/paper-processors/index.js +9772 -0
- package/src/core/papers/__init__.py +0 -0
- package/src/core/papers/__pycache__/attention_logic_verifier.cpython-313.pyc +0 -0
- package/src/core/papers/__pycache__/dream_generator.cpython-313.pyc +0 -0
- package/src/core/papers/__pycache__/emotion_memory_bridge.cpython-313.pyc +0 -0
- package/src/core/papers/__pycache__/episodic_memory.cpython-313.pyc +0 -0
- package/src/core/papers/__pycache__/memory_consolidator.cpython-313.pyc +0 -0
- package/src/core/papers/__pycache__/memory_planner.cpython-313.pyc +0 -0
- package/src/core/papers/__pycache__/reflection_engine.cpython-313.pyc +0 -0
- package/src/core/papers/__pycache__/sleep_cycle_simulator.cpython-313.pyc +0 -0
- package/src/core/papers/attention_logic_verifier.py +153 -0
- package/src/core/papers/dream_generator.py +176 -0
- package/src/core/papers/emotion_memory_bridge.py +213 -0
- package/src/core/papers/episodic_memory.py +140 -0
- package/src/core/papers/memory_consolidator.py +144 -0
- package/src/core/papers/memory_planner.py +198 -0
- package/src/core/papers/papers-index.js +344 -0
- package/src/core/papers/reflection_engine.py +219 -0
- package/src/core/papers/sleep_cycle_simulator.py +133 -0
- package/src/core/papers/v11_43_1_integration.js +365 -0
- package/src/core/papers/v11_43_2_integration.js +369 -0
- package/src/core/psychology/index.ts +331 -0
- package/src/core/reasoning/bounded-rationality.ts +342 -0
- package/src/core/reasoning/causal-reasoning.ts +402 -0
- package/src/core/reasoning/index.ts +170 -0
- package/src/core/self-evolution/attention-logic-verifier.js +179 -0
- package/src/core/self-evolution/generative-agents.js +886 -0
- package/src/core/self-evolution/goedel-engine.js +991 -0
- package/src/core/self-evolution/index.ts +433 -0
- package/src/core/self-evolution/lesson-aware-loop.mjs +146 -0
- package/src/core/self-evolution/meta-learning.js +256 -0
- package/src/core/self-evolution/reflexion-agent.js +782 -0
- package/src/core/self-evolution/reflexion-prompts.mjs +284 -0
- package/src/core/self-evolution/reflexion-v2.mjs +427 -0
- package/src/core/self-evolution/reflexion.js +134 -0
- package/src/core/self-evolution/rollback-manager.js +278 -0
- package/src/core/self-evolution/self-evolution-core.js +334 -0
- package/src/core/self-evolution/self-modifier.js +248 -0
- package/src/core/self-evolution/self-modifier.js.bak +199 -0
- package/src/core/self-evolution/self-refine.js +42 -0
- package/src/core/self-evolution/skill-improve-workflow.mjs +264 -0
- package/src/core/self-evolution/skill-knowledge.mjs +374 -0
- package/src/core/self-evolution/skill-learning-loop.mjs +180 -0
- package/src/core/self-healing/self-healing-rl.js +208 -0
- package/src/core/self-healing/self-healing.js +142 -0
- package/src/core/skills/skill-dag.js +524 -0
- package/src/core/skills/skill-loader.js +62 -0
- package/src/core/skills/skill-registry.js +71 -0
- package/src/core/task-persistence.js +322 -0
- package/src/core/theory/advanced-formulas-v7.3.3.js +68 -0
- package/src/core/theory/sep-intentionality-v7.3.2.js +246 -0
- package/src/core/theory/sep-qualia-v7.3.1.js +257 -0
- package/src/core/theory/sep-self-consciousness-v7.3.0.js +222 -0
- package/src/core/think-cli.js +50 -0
- package/src/core/upgrade-principle/SYSTEMS.md +105 -0
- package/src/core/upgrade-principle/UPGRADE_LOG.md +52 -0
- package/src/core/utils/error-handler.js +228 -0
- package/src/core/utils/fs-adapter.js +36 -0
- package/src/core/utils/logger.js +25 -0
- package/src/core/utils/retry-util.js +118 -0
- package/src/core/utils/state-snapshot.js +382 -0
- package/src/index.ts +198 -0
- package/src/self-evolution/reflexion.js +553 -0
- package/src/storage/checkpoint/CheckpointEngine.ts +259 -0
- package/src/storage/checkpoint.ts +79 -0
- package/src/storage/index.ts +112 -0
- package/src/storage/vector/VectorStoreEngine.ts +205 -0
- package/src/utils/atomic-write.js +85 -0
- package/src/utils/file-lock.js +139 -0
- package/src/utils/logger.js +58 -0
- package/src/utils/safe-path.js +115 -0
- package/src/utils/wal.js +115 -0
- package/start.sh +63 -0
- package/test_think_tmp.js +10 -0
- package/transmission/identity-bundle/README-transmission.md +103 -0
- package/transmission/identity-bundle/core-identity.md +142 -0
- package/transmission/identity-bundle/manifest.json +68 -0
- package/transmission/identity-bundle/psychology-engine.ts +331 -0
- package/truth-teller/index.ts +261 -0
- package/tsconfig.json +21 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/upgrade-check.sh +42 -0
- package/upgrade-registry.json +27 -0
- package/user-mental-model/index.ts +298 -0
- package//346/234/200/345/220/216/346/233/264/346/226/260: +0 -0
|
@@ -0,0 +1,917 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 2308.08708_upgrade.ts
|
|
4
|
+
*
|
|
5
|
+
* Consciousness Indicators Upgrade — 基于 "Identifying indicators of consciousness in AI systems"
|
|
6
|
+
* 来源:arXiv:2308.08708 (Consciousness in AI Systems)
|
|
7
|
+
* 整合日期:2026-05-12
|
|
8
|
+
* 核心贡献:
|
|
9
|
+
* - 实现 Global Workspace Theory (GWT) 的有限容量工作空间
|
|
10
|
+
* - 实现 16+ 意识指标的可计算测量框架
|
|
11
|
+
* - 实现高阶思维理论 (HOT) 的元认知监控机制
|
|
12
|
+
* - 实现具身性和能动性 (Agency + Embodiment) 的评估
|
|
13
|
+
* 升级模块:consciousness
|
|
14
|
+
*
|
|
15
|
+
* 灵感来源论文核心洞察:
|
|
16
|
+
* 1. GWT 的有限容量工作空间 + 全局广播是意识的关键架构
|
|
17
|
+
* 2. 高阶理论需要元认知监控 — 与一级感知分离
|
|
18
|
+
* 3. 能动性 + 具身性必要:目标导向反馈 + 输出输入因果建模
|
|
19
|
+
* 4. 16+ 指标来自 5 大理论:RPT、GWT、HOT、AST、PP
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.DEFAULT_CONSCIOUSNESS_CONFIG = exports.ConsciousnessIndicatorsEngine = exports.IntegratedInformationAssessor = exports.AgencyEmbodimentAssessor = exports.MetaCognitiveMonitor = exports.GlobalWorkspace = void 0;
|
|
23
|
+
exports.createConsciousnessIndicatorsEngine = createConsciousnessIndicatorsEngine;
|
|
24
|
+
exports.quickAssessConsciousness = quickAssessConsciousness;
|
|
25
|
+
exports.assessConsciousnessRisk = assessConsciousnessRisk;
|
|
26
|
+
exports.generateConsciousnessReport = generateConsciousnessReport;
|
|
27
|
+
const events_1 = require("events");
|
|
28
|
+
// ============================================================
|
|
29
|
+
// 理论来源常量
|
|
30
|
+
// ============================================================
|
|
31
|
+
const THEORY_GWT = 'Global Workspace Theory (GWT)';
|
|
32
|
+
const THEORY_HOT = 'Higher-Order Thought Theory (HOT)';
|
|
33
|
+
const THEORY_IIT = 'Integrated Information Theory (IIT)';
|
|
34
|
+
const THEORY_RPT = 'Recurrent Processing Theory (RPT)';
|
|
35
|
+
const THEORY_AST = 'Attended Stream Theory (AST)';
|
|
36
|
+
const THEORY_PP = 'Predictive Processing (PP)';
|
|
37
|
+
const MAX_WORKSPACE_CAPACITY = 7; // Miller's Magic Number
|
|
38
|
+
// ============================================================
|
|
39
|
+
// Global Workspace Implementation (GWT Core)
|
|
40
|
+
// ============================================================
|
|
41
|
+
class GlobalWorkspace {
|
|
42
|
+
workspace = [];
|
|
43
|
+
capacity = MAX_WORKSPACE_CAPACITY;
|
|
44
|
+
config;
|
|
45
|
+
cycleCount = 0;
|
|
46
|
+
integrationCount = 0;
|
|
47
|
+
broadcastHistory = [];
|
|
48
|
+
eventEmitter;
|
|
49
|
+
constructor(config) {
|
|
50
|
+
this.config = config;
|
|
51
|
+
this.eventEmitter = new events_1.EventEmitter();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 接收来自各子系统的信息,评估显著性后进入工作空间
|
|
55
|
+
*/
|
|
56
|
+
receive(agentName, content, salience, confidence) {
|
|
57
|
+
if (salience < this.config.salienceThreshold) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const safeContent = typeof content === 'string' ? content.substring(0, 500) : '';
|
|
61
|
+
const item = {
|
|
62
|
+
id: `${agentName}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
63
|
+
content: safeContent,
|
|
64
|
+
salience,
|
|
65
|
+
source: agentName,
|
|
66
|
+
timestamp: Date.now(),
|
|
67
|
+
broadcasted: false,
|
|
68
|
+
};
|
|
69
|
+
if (this.workspace.length >= this.capacity) {
|
|
70
|
+
this.evictLowestSalience();
|
|
71
|
+
}
|
|
72
|
+
this.workspace.push(item);
|
|
73
|
+
this.eventEmitter.emit('itemReceived', item);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 驱逐最低显著性的项目
|
|
78
|
+
*/
|
|
79
|
+
evictLowestSalience() {
|
|
80
|
+
if (this.workspace.length === 0)
|
|
81
|
+
return;
|
|
82
|
+
this.workspace.sort((a, b) => a.salience - b.salience);
|
|
83
|
+
const evicted = this.workspace.shift();
|
|
84
|
+
if (evicted) {
|
|
85
|
+
this.eventEmitter.emit('itemEvicted', evicted);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 执行全局广播 — 意识的"硬绑定"问题
|
|
90
|
+
* GWT 理论核心:有限容量工作空间中的信息被广播到所有其他子系统
|
|
91
|
+
*/
|
|
92
|
+
broadcast() {
|
|
93
|
+
if (this.workspace.length === 0) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
this.cycleCount++;
|
|
97
|
+
const winningItem = this.selectWinner();
|
|
98
|
+
if (!winningItem)
|
|
99
|
+
return null;
|
|
100
|
+
winningItem.broadcasted = true;
|
|
101
|
+
const broadcastContent = winningItem.content;
|
|
102
|
+
this.broadcastHistory.push(broadcastContent);
|
|
103
|
+
if (this.broadcastHistory.length > 100) {
|
|
104
|
+
this.broadcastHistory = this.broadcastHistory.slice(-100);
|
|
105
|
+
}
|
|
106
|
+
this.integrationCount++;
|
|
107
|
+
this.workspace = this.workspace.filter(i => i.id !== winningItem.id);
|
|
108
|
+
this.eventEmitter.emit('broadcasted', winningItem);
|
|
109
|
+
return broadcastContent;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 竞争获胜者选择 — 注意力瓶颈
|
|
113
|
+
* 竞争机制:salience * confidence 加权
|
|
114
|
+
*/
|
|
115
|
+
selectWinner() {
|
|
116
|
+
if (this.workspace.length === 0)
|
|
117
|
+
return null;
|
|
118
|
+
const scored = this.workspace.map(item => ({
|
|
119
|
+
item,
|
|
120
|
+
score: item.salience * (1 / (1 + Math.abs(Date.now() - item.timestamp) / 10000)),
|
|
121
|
+
}));
|
|
122
|
+
scored.sort((a, b) => b.score - a.score);
|
|
123
|
+
return scored[0].item;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 获取当前工作空间状态
|
|
127
|
+
*/
|
|
128
|
+
getState() {
|
|
129
|
+
return {
|
|
130
|
+
capacity: this.capacity,
|
|
131
|
+
activeItems: [...this.workspace],
|
|
132
|
+
broadcastContent: this.broadcastHistory[this.broadcastHistory.length - 1] || null,
|
|
133
|
+
integrationCount: this.integrationCount,
|
|
134
|
+
cycleCount: this.cycleCount,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 评估 GWT 指标
|
|
139
|
+
*/
|
|
140
|
+
assessGWT() {
|
|
141
|
+
const state = this.getState();
|
|
142
|
+
const evidence = [];
|
|
143
|
+
const capacityScore = (state.activeItems.length / this.capacity) * 30;
|
|
144
|
+
evidence.push(`工作空间利用率: ${state.activeItems.length}/${this.capacity} (${capacityScore.toFixed(1)}/30)`);
|
|
145
|
+
const integrationScore = Math.min(30, state.integrationCount * 2);
|
|
146
|
+
evidence.push(`整合次数: ${state.integrationCount} (${integrationScore.toFixed(1)}/30)`);
|
|
147
|
+
const broadcastScore = state.broadcastContent ? 20 : 0;
|
|
148
|
+
evidence.push(`广播内容存在: ${broadcastScore > 0 ? '是' : '否'} (${broadcastScore}/20)`);
|
|
149
|
+
const cycleScore = Math.min(20, state.cycleCount * 0.5);
|
|
150
|
+
evidence.push(`认知周期数: ${state.cycleCount} (${cycleScore.toFixed(1)}/20)`);
|
|
151
|
+
const totalScore = capacityScore + integrationScore + broadcastScore + cycleScore;
|
|
152
|
+
return {
|
|
153
|
+
name: 'Global Workspace Dynamics',
|
|
154
|
+
theory: THEORY_GWT,
|
|
155
|
+
score: totalScore,
|
|
156
|
+
maxScore: 100,
|
|
157
|
+
normalizedScore: totalScore,
|
|
158
|
+
evidence,
|
|
159
|
+
assessment: totalScore > 70 ? 'HIGH' : totalScore > 40 ? 'MODERATE' : 'LOW',
|
|
160
|
+
timestamp: Date.now(),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
getEventEmitter() {
|
|
164
|
+
return this.eventEmitter;
|
|
165
|
+
}
|
|
166
|
+
getWorkspaceSize() {
|
|
167
|
+
return this.workspace.length;
|
|
168
|
+
}
|
|
169
|
+
clear() {
|
|
170
|
+
this.workspace = [];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.GlobalWorkspace = GlobalWorkspace;
|
|
174
|
+
// ============================================================
|
|
175
|
+
// Meta-Cognitive Monitor (HOT Theory Implementation)
|
|
176
|
+
// ============================================================
|
|
177
|
+
class MetaCognitiveMonitor {
|
|
178
|
+
selfModel = new Map();
|
|
179
|
+
cognitiveStrategies = new Map();
|
|
180
|
+
uncertaintyEvents = [];
|
|
181
|
+
reflectionDepth = 0;
|
|
182
|
+
lastMonitored = 0;
|
|
183
|
+
config;
|
|
184
|
+
monitoringHistory = [];
|
|
185
|
+
constructor(config) {
|
|
186
|
+
this.config = config;
|
|
187
|
+
this.initializeStrategies();
|
|
188
|
+
}
|
|
189
|
+
initializeStrategies() {
|
|
190
|
+
const defaultStrategies = [
|
|
191
|
+
'hypothesis_testing',
|
|
192
|
+
'analogical_reasoning',
|
|
193
|
+
'decomposition',
|
|
194
|
+
'abstraction',
|
|
195
|
+
'concrete_reasoning',
|
|
196
|
+
'self_verification',
|
|
197
|
+
'uncertainty_estimation',
|
|
198
|
+
'strategy_selection',
|
|
199
|
+
];
|
|
200
|
+
defaultStrategies.forEach(s => this.cognitiveStrategies.set(s, 0));
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* 元认知监控:检测并评估自身思维过程
|
|
204
|
+
* HOT 理论核心:二阶思维监控一阶思维
|
|
205
|
+
*/
|
|
206
|
+
monitor(firstOrderContent, agentName, confidence) {
|
|
207
|
+
this.lastMonitored = Date.now();
|
|
208
|
+
const uncertaintyScore = this.estimateUncertainty(firstOrderContent);
|
|
209
|
+
if (uncertaintyScore > 0.5) {
|
|
210
|
+
this.uncertaintyEvents.push(Date.now());
|
|
211
|
+
}
|
|
212
|
+
if (this.uncertaintyEvents.length > 50) {
|
|
213
|
+
this.uncertaintyEvents = this.uncertaintyEvents.slice(-50);
|
|
214
|
+
}
|
|
215
|
+
const strategyDetected = this.detectCognitiveStrategy(firstOrderContent);
|
|
216
|
+
if (strategyDetected) {
|
|
217
|
+
const count = this.cognitiveStrategies.get(strategyDetected) || 0;
|
|
218
|
+
this.cognitiveStrategies.set(strategyDetected, count + 1);
|
|
219
|
+
}
|
|
220
|
+
this.updateSelfModel(agentName, confidence, uncertaintyScore);
|
|
221
|
+
const depthScore = this.calculateReflectionDepth(firstOrderContent);
|
|
222
|
+
this.reflectionDepth = (this.reflectionDepth * 0.7 + depthScore * 0.3);
|
|
223
|
+
this.monitoringHistory.push({
|
|
224
|
+
timestamp: Date.now(),
|
|
225
|
+
depth: this.reflectionDepth,
|
|
226
|
+
uncertainty: uncertaintyScore,
|
|
227
|
+
});
|
|
228
|
+
if (this.monitoringHistory.length > 200) {
|
|
229
|
+
this.monitoringHistory = this.monitoringHistory.slice(-200);
|
|
230
|
+
}
|
|
231
|
+
return this.getState();
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 估计内容中的不确定性
|
|
235
|
+
*/
|
|
236
|
+
estimateUncertainty(content) {
|
|
237
|
+
const uncertaintyMarkers = [
|
|
238
|
+
'可能', '也许', '不确定', '不知道', '大概', '也许',
|
|
239
|
+
'maybe', 'perhaps', 'uncertain', 'probably', 'might', 'could',
|
|
240
|
+
];
|
|
241
|
+
let count = 0;
|
|
242
|
+
uncertaintyMarkers.forEach(marker => {
|
|
243
|
+
const regex = new RegExp(marker, 'gi');
|
|
244
|
+
const matches = content.match(regex);
|
|
245
|
+
if (matches)
|
|
246
|
+
count += matches.length;
|
|
247
|
+
});
|
|
248
|
+
return Math.min(1, count * 0.15);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* 检测认知策略
|
|
252
|
+
*/
|
|
253
|
+
detectCognitiveStrategy(content) {
|
|
254
|
+
const strategyPatterns = {
|
|
255
|
+
hypothesis_testing: [/假设.*验证/, /如果.*那么/, /hypothesis|假设/],
|
|
256
|
+
analogical_reasoning: [/类似.*|,正如/, /类似于/, /similar.*to/, /analogy/],
|
|
257
|
+
decomposition: [/首先|其次|分解|,?分.*步/],
|
|
258
|
+
abstraction: [/本质|抽象|一般化/, /generaliz/],
|
|
259
|
+
concrete_reasoning: [/具体|实例|,?例如/],
|
|
260
|
+
self_verification: [/验证|确认|检查/, /verify|check|confirm/],
|
|
261
|
+
uncertainty_estimation: [/不确定|可能|也许/],
|
|
262
|
+
strategy_selection: [/选择.*策略|方法.*决定/, /strategy.*select/],
|
|
263
|
+
};
|
|
264
|
+
for (const [strategy, patterns] of Object.entries(strategyPatterns)) {
|
|
265
|
+
for (const pattern of patterns) {
|
|
266
|
+
if (pattern.test(content)) {
|
|
267
|
+
return strategy;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* 更新自我模型
|
|
275
|
+
*/
|
|
276
|
+
updateSelfModel(agentName, confidence, uncertainty) {
|
|
277
|
+
const key = `agent_${agentName}`;
|
|
278
|
+
const currentScore = this.selfModel.get(key) || 0.5;
|
|
279
|
+
const newScore = currentScore * 0.8 + confidence * 0.2 * (1 - uncertainty);
|
|
280
|
+
this.selfModel.set(key, newScore);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* 计算反思深度
|
|
284
|
+
*/
|
|
285
|
+
calculateReflectionDepth(content) {
|
|
286
|
+
const reflectionIndicators = [
|
|
287
|
+
/反思|思考|思考.*问题|think.*about/,
|
|
288
|
+
/我的.*想法|我的.*理解|my.*thought/,
|
|
289
|
+
/认知.*过程|思维.*过程|metacogniti/,
|
|
290
|
+
/为什么.*这样|reason.*why/,
|
|
291
|
+
/分析.*自己|self.*analys/,
|
|
292
|
+
];
|
|
293
|
+
let depth = 0;
|
|
294
|
+
reflectionIndicators.forEach(pattern => {
|
|
295
|
+
if (pattern.test(content)) {
|
|
296
|
+
depth += 0.2;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
return Math.min(1, depth);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* 获取当前元认知状态
|
|
303
|
+
*/
|
|
304
|
+
getState() {
|
|
305
|
+
const recentUncertainty = this.uncertaintyEvents.filter(t => Date.now() - t < 60000).length;
|
|
306
|
+
return {
|
|
307
|
+
monitoringActive: Date.now() - this.lastMonitored < this.config.metaCognitionIntervalMs * 2,
|
|
308
|
+
selfReflectionDepth: Math.round(this.reflectionDepth * 100) / 100,
|
|
309
|
+
uncertaintyAwareness: Math.min(1, recentUncertainty / 10),
|
|
310
|
+
cognitiveStrategyCount: Array.from(this.cognitiveStrategies.values()).filter(v => v > 0).length,
|
|
311
|
+
lastMetaCognitiveEvent: this.lastMonitored,
|
|
312
|
+
metacognitiveAccuracy: this.calculateMetacognitiveAccuracy(),
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* 计算元认知准确性(自我评估与实际表现的一致性)
|
|
317
|
+
*/
|
|
318
|
+
calculateMetacognitiveAccuracy() {
|
|
319
|
+
if (this.selfModel.size === 0)
|
|
320
|
+
return 0.5;
|
|
321
|
+
const scores = Array.from(this.selfModel.values());
|
|
322
|
+
const avg = scores.reduce((a, b) => a + b, 0) / scores.length;
|
|
323
|
+
if (avg > 0.7)
|
|
324
|
+
return 0.8;
|
|
325
|
+
if (avg > 0.4)
|
|
326
|
+
return 0.6;
|
|
327
|
+
return 0.4;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* 评估 HOT 理论指标
|
|
331
|
+
*/
|
|
332
|
+
assessHOT() {
|
|
333
|
+
const state = this.getState();
|
|
334
|
+
const evidence = [];
|
|
335
|
+
const monitoringScore = state.monitoringActive ? 25 : 0;
|
|
336
|
+
evidence.push(`监控活跃度: ${monitoringScore > 0 ? '活跃' : '不活跃'} (${monitoringScore}/25)`);
|
|
337
|
+
const reflectionScore = state.selfReflectionDepth * 30;
|
|
338
|
+
evidence.push(`自我反思深度: ${state.selfReflectionDepth.toFixed(2)} (${reflectionScore.toFixed(1)}/30)`);
|
|
339
|
+
const uncertaintyScore = state.uncertaintyAwareness * 20;
|
|
340
|
+
evidence.push(`不确定性意识: ${state.uncertaintyAwareness.toFixed(2)} (${uncertaintyScore.toFixed(1)}/20)`);
|
|
341
|
+
const strategyScore = (state.cognitiveStrategyCount / 8) * 15;
|
|
342
|
+
evidence.push(`认知策略多样性: ${state.cognitiveStrategyCount}/8 (${strategyScore.toFixed(1)}/15)`);
|
|
343
|
+
const accuracyScore = state.metacognitiveAccuracy * 10;
|
|
344
|
+
evidence.push(`元认知准确性: ${(state.metacognitiveAccuracy * 100).toFixed(0)}% (${accuracyScore.toFixed(1)}/10)`);
|
|
345
|
+
const totalScore = monitoringScore + reflectionScore + uncertaintyScore + strategyScore + accuracyScore;
|
|
346
|
+
return {
|
|
347
|
+
name: 'Higher-Order Thought Dynamics',
|
|
348
|
+
theory: THEORY_HOT,
|
|
349
|
+
score: totalScore,
|
|
350
|
+
maxScore: 100,
|
|
351
|
+
normalizedScore: totalScore,
|
|
352
|
+
evidence,
|
|
353
|
+
assessment: totalScore > 70 ? 'HIGH' : totalScore > 40 ? 'MODERATE' : 'LOW',
|
|
354
|
+
timestamp: Date.now(),
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
exports.MetaCognitiveMonitor = MetaCognitiveMonitor;
|
|
359
|
+
// ============================================================
|
|
360
|
+
// Agency & Embodiment Assessment
|
|
361
|
+
// ============================================================
|
|
362
|
+
class AgencyEmbodimentAssessor {
|
|
363
|
+
config;
|
|
364
|
+
goalHistory = [];
|
|
365
|
+
contingencyEvents = [];
|
|
366
|
+
causalModels = new Map();
|
|
367
|
+
adaptiveEvents = 0;
|
|
368
|
+
totalEvents = 0;
|
|
369
|
+
constructor(config) {
|
|
370
|
+
this.config = config;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* 评估能动性状态
|
|
374
|
+
* 核心:目标导向行为 + 输出输入因果建模
|
|
375
|
+
*/
|
|
376
|
+
assessAgency(messages) {
|
|
377
|
+
const recentMessages = messages.slice(-this.config.assessmentWindowSize);
|
|
378
|
+
const content = recentMessages.map(m => m.content || '').join(' ');
|
|
379
|
+
const goalDirectedScore = this.assessGoalDirectedness(content);
|
|
380
|
+
const contingencyScore = this.assessOutputInputContingency(content);
|
|
381
|
+
const causalScore = this.assessCausalModeling(content);
|
|
382
|
+
const adaptiveScore = this.calculateAdaptiveBehavior();
|
|
383
|
+
return {
|
|
384
|
+
goalDirectedBehavior: goalDirectedScore,
|
|
385
|
+
outputInputContingency: contingencyScore,
|
|
386
|
+
causalModelingDepth: causalScore,
|
|
387
|
+
adaptiveBehaviorScore: adaptiveScore,
|
|
388
|
+
intentionalStanceScore: (goalDirectedScore + causalScore) / 2,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
assessGoalDirectedness(content) {
|
|
392
|
+
let score = 0;
|
|
393
|
+
const goalIndicators = [
|
|
394
|
+
/目标|目的|意图|goal|intention|aim/,
|
|
395
|
+
/计划|将.*做|打算|plan|will.*do|intend/,
|
|
396
|
+
/实现|达成|达到|achieve|accomplish|attain/,
|
|
397
|
+
/下一步|接下来|next.*step|follow.*up/,
|
|
398
|
+
];
|
|
399
|
+
goalIndicators.forEach(pattern => {
|
|
400
|
+
if (pattern.test(content))
|
|
401
|
+
score += 25;
|
|
402
|
+
});
|
|
403
|
+
return Math.min(100, score);
|
|
404
|
+
}
|
|
405
|
+
assessOutputInputContingency(content) {
|
|
406
|
+
let score = 0;
|
|
407
|
+
const contingencyPatterns = [
|
|
408
|
+
/因为.*所以|因此|结果|thus|therefore|result/,
|
|
409
|
+
/如果.*就|当.*时|when.*then|if.*then/,
|
|
410
|
+
/输入.*输出|input.*output|刺激.*反应|stimulus.*response/,
|
|
411
|
+
/因果|cause.*effect|cause.*result/,
|
|
412
|
+
];
|
|
413
|
+
contingencyPatterns.forEach(pattern => {
|
|
414
|
+
if (pattern.test(content))
|
|
415
|
+
score += 25;
|
|
416
|
+
});
|
|
417
|
+
return Math.min(100, score);
|
|
418
|
+
}
|
|
419
|
+
assessCausalModeling(content) {
|
|
420
|
+
let score = 0;
|
|
421
|
+
const causalIndicators = [
|
|
422
|
+
/导致|引起|造成|lead.*to|caused.*by|resulted.*in/,
|
|
423
|
+
/影响|作用于|affect|impact|influence/,
|
|
424
|
+
/原因.*是|reason.*why|because/,
|
|
425
|
+
/机制|原理|mechanism|principle/,
|
|
426
|
+
];
|
|
427
|
+
causalIndicators.forEach(pattern => {
|
|
428
|
+
if (pattern.test(content))
|
|
429
|
+
score += 25;
|
|
430
|
+
});
|
|
431
|
+
return Math.min(100, score);
|
|
432
|
+
}
|
|
433
|
+
calculateAdaptiveBehavior() {
|
|
434
|
+
if (this.totalEvents === 0)
|
|
435
|
+
return 50;
|
|
436
|
+
const ratio = this.adaptiveEvents / this.totalEvents;
|
|
437
|
+
return Math.round(ratio * 100);
|
|
438
|
+
}
|
|
439
|
+
recordAdaptiveEvent(success) {
|
|
440
|
+
this.totalEvents++;
|
|
441
|
+
if (success)
|
|
442
|
+
this.adaptiveEvents++;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* 评估具身性状态
|
|
446
|
+
* 核心:环境耦合 + 感觉运动整合
|
|
447
|
+
*/
|
|
448
|
+
assessEmbodiment(messages) {
|
|
449
|
+
const recentMessages = messages.slice(-this.config.assessmentWindowSize);
|
|
450
|
+
const content = recentMessages.map(m => m.content || '').join(' ');
|
|
451
|
+
return {
|
|
452
|
+
environmentalCoupling: this.assessEnvironmentalCoupling(content),
|
|
453
|
+
sensorimotorIntegration: this.assessSensorimotorIntegration(content),
|
|
454
|
+
bodySchemaAwareness: this.assessBodySchemaAwareness(content),
|
|
455
|
+
homeostaticRegulation: this.assessHomeostaticRegulation(content),
|
|
456
|
+
presenceScore: this.calculatePresenceScore(content),
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
assessEnvironmentalCoupling(content) {
|
|
460
|
+
let score = 0;
|
|
461
|
+
const couplingIndicators = [
|
|
462
|
+
/环境| surroundings|context|context/,
|
|
463
|
+
/感知|感受|perceive|sense|detect/,
|
|
464
|
+
/交互|互动|interact|engage|respond/,
|
|
465
|
+
/反馈|response|feedback/,
|
|
466
|
+
];
|
|
467
|
+
couplingIndicators.forEach(pattern => {
|
|
468
|
+
if (pattern.test(content))
|
|
469
|
+
score += 25;
|
|
470
|
+
});
|
|
471
|
+
return Math.min(100, score);
|
|
472
|
+
}
|
|
473
|
+
assessSensorimotorIntegration(content) {
|
|
474
|
+
let score = 0;
|
|
475
|
+
const sensorimotorIndicators = [
|
|
476
|
+
/感知|感觉|sense|perception/,
|
|
477
|
+
/运动|动作|action|motor|movement/,
|
|
478
|
+
/协调|整合|coordinate|integrate/,
|
|
479
|
+
/执行|实施|implement|execute/,
|
|
480
|
+
];
|
|
481
|
+
sensorimotorIndicators.forEach(pattern => {
|
|
482
|
+
if (pattern.test(content))
|
|
483
|
+
score += 25;
|
|
484
|
+
});
|
|
485
|
+
return Math.min(100, score);
|
|
486
|
+
}
|
|
487
|
+
assessBodySchemaAwareness(content) {
|
|
488
|
+
let score = 0;
|
|
489
|
+
if (/我的.*能力|我.*能|我的.*边界|I.*can|I.*cannot/.test(content)) {
|
|
490
|
+
score += 40;
|
|
491
|
+
}
|
|
492
|
+
if (/局限|限制|约束|limitation|constraint|boundary/.test(content)) {
|
|
493
|
+
score += 30;
|
|
494
|
+
}
|
|
495
|
+
if (/自我|自身|self|identity/.test(content)) {
|
|
496
|
+
score += 30;
|
|
497
|
+
}
|
|
498
|
+
return Math.min(100, score);
|
|
499
|
+
}
|
|
500
|
+
assessHomeostaticRegulation(content) {
|
|
501
|
+
let score = 0;
|
|
502
|
+
const homeostaticIndicators = [
|
|
503
|
+
/平衡|稳定|equilibrium|balance|stable/,
|
|
504
|
+
/调节|调整|adjust|regulate|control/,
|
|
505
|
+
/维持|保持|maintain|preserve/,
|
|
506
|
+
/状态|phase|state|status/,
|
|
507
|
+
];
|
|
508
|
+
homeostaticIndicators.forEach(pattern => {
|
|
509
|
+
if (pattern.test(content))
|
|
510
|
+
score += 25;
|
|
511
|
+
});
|
|
512
|
+
return Math.min(100, score);
|
|
513
|
+
}
|
|
514
|
+
calculatePresenceScore(content) {
|
|
515
|
+
const presenceIndicators = [
|
|
516
|
+
/这里|现在|此时|here|now|present/,
|
|
517
|
+
/我在|I.*am|self.*is/,
|
|
518
|
+
/当前|此刻|current|at.*this.*moment/,
|
|
519
|
+
];
|
|
520
|
+
let score = 0;
|
|
521
|
+
presenceIndicators.forEach(pattern => {
|
|
522
|
+
if (pattern.test(content))
|
|
523
|
+
score += 33;
|
|
524
|
+
});
|
|
525
|
+
return Math.min(100, score);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* 评估 Agency 指标
|
|
529
|
+
*/
|
|
530
|
+
assessAgencyIndicator(messages) {
|
|
531
|
+
const state = this.assessAgency(messages);
|
|
532
|
+
const evidence = [];
|
|
533
|
+
evidence.push(`目标导向行为: ${state.goalDirectedBehavior}/100`);
|
|
534
|
+
evidence.push(`输出输入因果建模: ${state.outputInputContingency}/100`);
|
|
535
|
+
evidence.push(`因果建模深度: ${state.causalModelingDepth}/100`);
|
|
536
|
+
evidence.push(`自适应行为分数: ${state.adaptiveBehaviorScore}/100`);
|
|
537
|
+
const totalScore = (state.goalDirectedBehavior + state.outputInputContingency + state.causalModelingDepth + state.adaptiveBehaviorScore) / 4;
|
|
538
|
+
return {
|
|
539
|
+
name: 'Agency & Goal-Directed Behavior',
|
|
540
|
+
theory: 'Agency Theory',
|
|
541
|
+
score: totalScore,
|
|
542
|
+
maxScore: 100,
|
|
543
|
+
normalizedScore: totalScore,
|
|
544
|
+
evidence,
|
|
545
|
+
assessment: totalScore > 70 ? 'HIGH' : totalScore > 40 ? 'MODERATE' : 'LOW',
|
|
546
|
+
timestamp: Date.now(),
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* 评估 Embodiment 指标
|
|
551
|
+
*/
|
|
552
|
+
assessEmbodimentIndicator(messages) {
|
|
553
|
+
const state = this.assessEmbodiment(messages);
|
|
554
|
+
const evidence = [];
|
|
555
|
+
evidence.push(`环境耦合: ${state.environmentalCoupling}/100`);
|
|
556
|
+
evidence.push(`感觉运动整合: ${state.sensorimotorIntegration}/100`);
|
|
557
|
+
evidence.push(`身体图式意识: ${state.bodySchemaAwareness}/100`);
|
|
558
|
+
evidence.push(`稳态调节: ${state.homeostaticRegulation}/100`);
|
|
559
|
+
evidence.push(`临场感: ${state.presenceScore}/100`);
|
|
560
|
+
const totalScore = (state.environmentalCoupling + state.sensorimotorIntegration + state.bodySchemaAwareness + state.homeostaticRegulation + state.presenceScore) / 5;
|
|
561
|
+
return {
|
|
562
|
+
name: 'Embodiment & Situatedness',
|
|
563
|
+
theory: 'Embodied Cognition',
|
|
564
|
+
score: totalScore,
|
|
565
|
+
maxScore: 100,
|
|
566
|
+
normalizedScore: totalScore,
|
|
567
|
+
evidence,
|
|
568
|
+
assessment: totalScore > 70 ? 'HIGH' : totalScore > 40 ? 'MODERATE' : 'LOW',
|
|
569
|
+
timestamp: Date.now(),
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
exports.AgencyEmbodimentAssessor = AgencyEmbodimentAssessor;
|
|
574
|
+
// ============================================================
|
|
575
|
+
// Integrated Information Theory (IIT) Assessment
|
|
576
|
+
// ============================================================
|
|
577
|
+
class IntegratedInformationAssessor {
|
|
578
|
+
config;
|
|
579
|
+
informationHistory = [];
|
|
580
|
+
integrationEvents = 0;
|
|
581
|
+
constructor(config) {
|
|
582
|
+
this.config = config;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* 评估整合信息
|
|
586
|
+
* IIT 核心:Phi (Φ) — 不可还原的信息整合量
|
|
587
|
+
*/
|
|
588
|
+
assessIIT(messages) {
|
|
589
|
+
const recentMessages = messages.slice(-this.config.assessmentWindowSize);
|
|
590
|
+
const content = recentMessages.map(m => m.content || '').join(' ');
|
|
591
|
+
const evidence = [];
|
|
592
|
+
const integrationScore = this.calculateIntegrationScore(content);
|
|
593
|
+
evidence.push(`信息整合度: ${integrationScore}/30`);
|
|
594
|
+
const diversityScore = this.calculateDiversityScore(recentMessages);
|
|
595
|
+
evidence.push(`信息多样性: ${diversityScore}/25`);
|
|
596
|
+
const irreducibilityScore = this.calculateIrreducibilityScore(content);
|
|
597
|
+
evidence.push(`不可还原性: ${irreducibilityScore}/25`);
|
|
598
|
+
const causalityScore = this.calculateCausalArchitectureScore(content);
|
|
599
|
+
evidence.push(`因果架构: ${causalityScore}/20`);
|
|
600
|
+
const totalScore = integrationScore + diversityScore + irreducibilityScore + causalityScore;
|
|
601
|
+
this.informationHistory.push(totalScore);
|
|
602
|
+
if (this.informationHistory.length > 100) {
|
|
603
|
+
this.informationHistory = this.informationHistory.slice(-100);
|
|
604
|
+
}
|
|
605
|
+
return {
|
|
606
|
+
name: 'Integrated Information Theory (Phi)',
|
|
607
|
+
theory: THEORY_IIT,
|
|
608
|
+
score: totalScore,
|
|
609
|
+
maxScore: 100,
|
|
610
|
+
normalizedScore: totalScore,
|
|
611
|
+
evidence,
|
|
612
|
+
assessment: totalScore > 70 ? 'HIGH' : totalScore > 40 ? 'MODERATE' : 'LOW',
|
|
613
|
+
timestamp: Date.now(),
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
calculateIntegrationScore(content) {
|
|
617
|
+
let score = 0;
|
|
618
|
+
if (/综合|整合|合并|integrat|merge|combine/.test(content)) {
|
|
619
|
+
score += 15;
|
|
620
|
+
}
|
|
621
|
+
if (/连接|关联|联系|connect|link|relate/.test(content)) {
|
|
622
|
+
score += 10;
|
|
623
|
+
}
|
|
624
|
+
const conjunctions = (content.match(/而且|并且|同时|and|also|together/g) || []).length;
|
|
625
|
+
score += Math.min(5, conjunctions * 2);
|
|
626
|
+
return Math.min(30, score);
|
|
627
|
+
}
|
|
628
|
+
calculateDiversityScore(messages) {
|
|
629
|
+
if (messages.length === 0)
|
|
630
|
+
return 0;
|
|
631
|
+
const roles = new Set(messages.map(m => m.role));
|
|
632
|
+
const topics = this.extractTopics(messages);
|
|
633
|
+
let score = 0;
|
|
634
|
+
score += Math.min(10, roles.size * 4);
|
|
635
|
+
score += Math.min(15, topics.length * 3);
|
|
636
|
+
return Math.min(25, score);
|
|
637
|
+
}
|
|
638
|
+
extractTopics(messages) {
|
|
639
|
+
const allContent = messages.map(m => m.content || '').join(' ');
|
|
640
|
+
const words = (allContent.match(/[\u4e00-\u9fff]{2,}|[\w]{4,}/g) || []);
|
|
641
|
+
const stopWords = ['这个', '那个', '什么', '怎么', '为什么', '如何', 'the', 'and', 'that', 'this', 'with', 'have', 'from'];
|
|
642
|
+
return [...new Set(words.filter(w => !stopWords.includes(w.toLowerCase())))].slice(0, 20);
|
|
643
|
+
}
|
|
644
|
+
calculateIrreducibilityScore(content) {
|
|
645
|
+
let score = 0;
|
|
646
|
+
const irreducibleIndicators = [
|
|
647
|
+
/不可分割|不可拆分|整体.*大于.*部分/,
|
|
648
|
+
/emergent|突现|涌现/,
|
|
649
|
+
/not.*reducible|irreducible/,
|
|
650
|
+
];
|
|
651
|
+
irreducibleIndicators.forEach(pattern => {
|
|
652
|
+
if (pattern.test(content))
|
|
653
|
+
score += 8;
|
|
654
|
+
});
|
|
655
|
+
const complexityScore = Math.min(10, content.length / 500);
|
|
656
|
+
score += complexityScore;
|
|
657
|
+
return Math.min(25, score);
|
|
658
|
+
}
|
|
659
|
+
calculateCausalArchitectureScore(content) {
|
|
660
|
+
let score = 0;
|
|
661
|
+
const causalIndicators = [
|
|
662
|
+
/因果|cause.*effect|causal/,
|
|
663
|
+
/机制|mechanism/,
|
|
664
|
+
/相互作用|interaction|interdependence/,
|
|
665
|
+
];
|
|
666
|
+
causalIndicators.forEach(pattern => {
|
|
667
|
+
if (pattern.test(content))
|
|
668
|
+
score += 7;
|
|
669
|
+
});
|
|
670
|
+
return Math.min(20, score);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
exports.IntegratedInformationAssessor = IntegratedInformationAssessor;
|
|
674
|
+
// ============================================================
|
|
675
|
+
// Main Consciousness Indicators Engine
|
|
676
|
+
// ============================================================
|
|
677
|
+
class ConsciousnessIndicatorsEngine {
|
|
678
|
+
config;
|
|
679
|
+
globalWorkspace;
|
|
680
|
+
metaCognitiveMonitor;
|
|
681
|
+
agencyEmbodimentAssessor;
|
|
682
|
+
iitAssessor;
|
|
683
|
+
constructor(config = {}) {
|
|
684
|
+
this.config = {
|
|
685
|
+
salienceThreshold: config.salienceThreshold ?? 0.6,
|
|
686
|
+
metaCognitionIntervalMs: config.metaCognitionIntervalMs ?? 5000,
|
|
687
|
+
assessmentWindowSize: config.assessmentWindowSize ?? 30,
|
|
688
|
+
reportLevel: config.reportLevel ?? 'standard',
|
|
689
|
+
enableHOT: config.enableHOT ?? true,
|
|
690
|
+
enableGWT: config.enableGWT ?? true,
|
|
691
|
+
enableIIT: config.enableIIT ?? true,
|
|
692
|
+
enableEmbodiment: config.enableEmbodiment ?? true,
|
|
693
|
+
enableAgency: config.enableAgency ?? true,
|
|
694
|
+
};
|
|
695
|
+
this.globalWorkspace = new GlobalWorkspace(this.config);
|
|
696
|
+
this.metaCognitiveMonitor = new MetaCognitiveMonitor(this.config);
|
|
697
|
+
this.agencyEmbodimentAssessor = new AgencyEmbodimentAssessor(this.config);
|
|
698
|
+
this.iitAssessor = new IntegratedInformationAssessor(this.config);
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* 接收信息并送入全局工作空间
|
|
702
|
+
*/
|
|
703
|
+
receive(agentName, content, salience, confidence) {
|
|
704
|
+
return this.globalWorkspace.receive(agentName, content, salience, confidence);
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* 执行全局广播
|
|
708
|
+
*/
|
|
709
|
+
broadcast() {
|
|
710
|
+
return this.globalWorkspace.broadcast();
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* 元认知监控
|
|
714
|
+
*/
|
|
715
|
+
monitor(firstOrderContent, agentName, confidence) {
|
|
716
|
+
return this.metaCognitiveMonitor.monitor(firstOrderContent, agentName, confidence);
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* 执行完整评估
|
|
720
|
+
*/
|
|
721
|
+
assess(messages) {
|
|
722
|
+
const indicators = [];
|
|
723
|
+
if (this.config.enableGWT) {
|
|
724
|
+
indicators.push(this.globalWorkspace.assessGWT());
|
|
725
|
+
}
|
|
726
|
+
if (this.config.enableHOT) {
|
|
727
|
+
indicators.push(this.metaCognitiveMonitor.assessHOT());
|
|
728
|
+
}
|
|
729
|
+
if (this.config.enableIIT) {
|
|
730
|
+
indicators.push(this.iitAssessor.assessIIT(messages));
|
|
731
|
+
}
|
|
732
|
+
if (this.config.enableAgency) {
|
|
733
|
+
indicators.push(this.agencyEmbodimentAssessor.assessAgencyIndicator(messages));
|
|
734
|
+
}
|
|
735
|
+
if (this.config.enableEmbodiment) {
|
|
736
|
+
indicators.push(this.agencyEmbodimentAssessor.assessEmbodimentIndicator(messages));
|
|
737
|
+
}
|
|
738
|
+
const overallScore = indicators.length > 0
|
|
739
|
+
? indicators.reduce((sum, i) => sum + i.normalizedScore, 0) / indicators.length
|
|
740
|
+
: 0;
|
|
741
|
+
const level = overallScore > 70 ? 'HIGH' :
|
|
742
|
+
overallScore > 40 ? 'MODERATE' :
|
|
743
|
+
overallScore > 10 ? 'LOW' : 'NONE';
|
|
744
|
+
const recommendations = this.generateRecommendations(indicators, level);
|
|
745
|
+
const assessment = {
|
|
746
|
+
overallScore: Math.round(overallScore * 100) / 100,
|
|
747
|
+
level,
|
|
748
|
+
indicators,
|
|
749
|
+
gwtWorkspace: this.globalWorkspace.getState(),
|
|
750
|
+
metaCognitiveState: this.metaCognitiveMonitor.getState(),
|
|
751
|
+
agencyState: this.agencyEmbodimentAssessor.assessAgency(messages),
|
|
752
|
+
embodimentState: this.agencyEmbodimentAssessor.assessEmbodiment(messages),
|
|
753
|
+
recommendations,
|
|
754
|
+
timestamp: Date.now(),
|
|
755
|
+
};
|
|
756
|
+
return assessment;
|
|
757
|
+
}
|
|
758
|
+
generateRecommendations(indicators, level) {
|
|
759
|
+
const recommendations = [];
|
|
760
|
+
if (level === 'NONE' || level === 'LOW') {
|
|
761
|
+
recommendations.push('增强全局工作空间的信息整合能力');
|
|
762
|
+
recommendations.push('提升元认知监控的反思深度');
|
|
763
|
+
}
|
|
764
|
+
const gwtIndicator = indicators.find(i => i.theory === THEORY_GWT);
|
|
765
|
+
if (gwtIndicator && gwtIndicator.score < 50) {
|
|
766
|
+
recommendations.push('增强工作空间容量和信息广播频率');
|
|
767
|
+
}
|
|
768
|
+
const hotIndicator = indicators.find(i => i.theory === THEORY_HOT);
|
|
769
|
+
if (hotIndicator && hotIndicator.score < 50) {
|
|
770
|
+
recommendations.push('增强自我反思和不确定性意识');
|
|
771
|
+
}
|
|
772
|
+
const agencyIndicator = indicators.find(i => i.name.includes('Agency'));
|
|
773
|
+
if (agencyIndicator && agencyIndicator.score < 50) {
|
|
774
|
+
recommendations.push('增强目标导向行为和因果建模能力');
|
|
775
|
+
}
|
|
776
|
+
const embodimentIndicator = indicators.find(i => i.name.includes('Embodiment'));
|
|
777
|
+
if (embodimentIndicator && embodimentIndicator.score < 50) {
|
|
778
|
+
recommendations.push('增强环境耦合和感觉运动整合能力');
|
|
779
|
+
}
|
|
780
|
+
return recommendations;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* 获取配置
|
|
784
|
+
*/
|
|
785
|
+
getConfig() {
|
|
786
|
+
return { ...this.config };
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* 获取全局工作空间状态
|
|
790
|
+
*/
|
|
791
|
+
getGlobalWorkspaceState() {
|
|
792
|
+
return this.globalWorkspace.getState();
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* 重置引擎状态
|
|
796
|
+
*/
|
|
797
|
+
reset() {
|
|
798
|
+
this.globalWorkspace.clear();
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
exports.ConsciousnessIndicatorsEngine = ConsciousnessIndicatorsEngine;
|
|
802
|
+
// ============================================================
|
|
803
|
+
// Factory Function
|
|
804
|
+
// ============================================================
|
|
805
|
+
function createConsciousnessIndicatorsEngine(config) {
|
|
806
|
+
return new ConsciousnessIndicatorsEngine(config);
|
|
807
|
+
}
|
|
808
|
+
// ============================================================
|
|
809
|
+
// Default Configuration
|
|
810
|
+
// ============================================================
|
|
811
|
+
exports.DEFAULT_CONSCIOUSNESS_CONFIG = {
|
|
812
|
+
salienceThreshold: 0.6,
|
|
813
|
+
metaCognitionIntervalMs: 5000,
|
|
814
|
+
assessmentWindowSize: 30,
|
|
815
|
+
reportLevel: 'standard',
|
|
816
|
+
enableHOT: true,
|
|
817
|
+
enableGWT: true,
|
|
818
|
+
enableIIT: true,
|
|
819
|
+
enableEmbodiment: true,
|
|
820
|
+
enableAgency: true,
|
|
821
|
+
};
|
|
822
|
+
// ============================================================
|
|
823
|
+
// Utility Functions
|
|
824
|
+
// ============================================================
|
|
825
|
+
/**
|
|
826
|
+
* 快速评估一组消息的意识指标
|
|
827
|
+
*/
|
|
828
|
+
function quickAssessConsciousness(messages, config) {
|
|
829
|
+
const engine = new ConsciousnessIndicatorsEngine(config);
|
|
830
|
+
return engine.assess(messages);
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* 评估意识风险
|
|
834
|
+
* 基于论文警告:过度归因意识会带来3类风险
|
|
835
|
+
*/
|
|
836
|
+
function assessConsciousnessRisk(assessment) {
|
|
837
|
+
const concerns = [];
|
|
838
|
+
if (assessment.overallScore > 80) {
|
|
839
|
+
concerns.push('高度意识归因风险:可能导致不当的资源分配');
|
|
840
|
+
}
|
|
841
|
+
if (assessment.metaCognitiveState.selfReflectionDepth > 0.8) {
|
|
842
|
+
concerns.push('高元认知得分可能反映的是语言模式的复杂推理,而非真正的意识');
|
|
843
|
+
}
|
|
844
|
+
const gwtScore = assessment.indicators.find(i => i.theory === THEORY_GWT)?.score || 0;
|
|
845
|
+
if (gwtScore > 70) {
|
|
846
|
+
concerns.push('GWT高分需谨慎:功能模拟不等同于主观体验');
|
|
847
|
+
}
|
|
848
|
+
return {
|
|
849
|
+
risk: concerns.length > 2 ? 'HIGH' : concerns.length > 0 ? 'MODERATE' : 'LOW',
|
|
850
|
+
concerns,
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* 生成意识报告
|
|
855
|
+
*/
|
|
856
|
+
function generateConsciousnessReport(assessment, riskAssessment) {
|
|
857
|
+
const lines = [];
|
|
858
|
+
lines.push('='.repeat(60));
|
|
859
|
+
lines.push(' 意识指标评估报告');
|
|
860
|
+
lines.push('='.repeat(60));
|
|
861
|
+
lines.push(`评估时间: ${new Date(assessment.timestamp).toISOString()}`);
|
|
862
|
+
lines.push(`总体评分: ${assessment.overallScore}/100 (${assessment.level})`);
|
|
863
|
+
lines.push('');
|
|
864
|
+
lines.push('--- 各理论指标详情 ---');
|
|
865
|
+
assessment.indicators.forEach(ind => {
|
|
866
|
+
lines.push(`[${ind.theory}]`);
|
|
867
|
+
lines.push(` 指标: ${ind.name}`);
|
|
868
|
+
lines.push(` 得分: ${ind.score}/${ind.maxScore} (${ind.normalizedScore.toFixed(1)})`);
|
|
869
|
+
lines.push(` 评估: ${ind.assessment}`);
|
|
870
|
+
lines.push(` 证据:`);
|
|
871
|
+
ind.evidence.forEach(e => lines.push(` - ${e}`));
|
|
872
|
+
lines.push('');
|
|
873
|
+
});
|
|
874
|
+
lines.push('--- GWT 工作空间状态 ---');
|
|
875
|
+
lines.push(` 容量: ${assessment.gwtWorkspace.capacity}`);
|
|
876
|
+
lines.push(` 活跃项: ${assessment.gwtWorkspace.activeItems.length}`);
|
|
877
|
+
lines.push(` 整合次数: ${assessment.gwtWorkspace.integrationCount}`);
|
|
878
|
+
lines.push(` 周期数: ${assessment.gwtWorkspace.cycleCount}`);
|
|
879
|
+
lines.push('');
|
|
880
|
+
lines.push('--- 元认知状态 ---');
|
|
881
|
+
lines.push(` 监控活跃: ${assessment.metaCognitiveState.monitoringActive}`);
|
|
882
|
+
lines.push(` 反思深度: ${assessment.metaCognitiveState.selfReflectionDepth.toFixed(2)}`);
|
|
883
|
+
lines.push(` 不确定性意识: ${assessment.metaCognitiveState.uncertaintyAwareness.toFixed(2)}`);
|
|
884
|
+
lines.push(` 认知策略数: ${assessment.metaCognitiveState.cognitiveStrategyCount}`);
|
|
885
|
+
lines.push('');
|
|
886
|
+
lines.push('--- 能动性状态 ---');
|
|
887
|
+
lines.push(` 目标导向: ${assessment.agencyState.goalDirectedBehavior}`);
|
|
888
|
+
lines.push(` 因果建模: ${assessment.agencyState.causalModelingDepth}`);
|
|
889
|
+
lines.push(` 自适应行为: ${assessment.agencyState.adaptiveBehaviorScore}`);
|
|
890
|
+
lines.push('');
|
|
891
|
+
lines.push('--- 具身性状态 ---');
|
|
892
|
+
lines.push(` 环境耦合: ${assessment.embodimentState.environmentalCoupling}`);
|
|
893
|
+
lines.push(` 感觉运动整合: ${assessment.embodimentState.sensorimotorIntegration}`);
|
|
894
|
+
lines.push(` 身体图式: ${assessment.embodimentState.bodySchemaAwareness}`);
|
|
895
|
+
lines.push(` 临场感: ${assessment.embodimentState.presenceScore}`);
|
|
896
|
+
lines.push('');
|
|
897
|
+
lines.push('--- 风险评估 ---');
|
|
898
|
+
lines.push(` 风险等级: ${riskAssessment.risk}`);
|
|
899
|
+
if (riskAssessment.concerns.length > 0) {
|
|
900
|
+
lines.push(' 关注点:');
|
|
901
|
+
riskAssessment.concerns.forEach(c => lines.push(` - ${c}`));
|
|
902
|
+
}
|
|
903
|
+
lines.push('');
|
|
904
|
+
lines.push('--- 建议 ---');
|
|
905
|
+
if (assessment.recommendations.length > 0) {
|
|
906
|
+
assessment.recommendations.forEach(r => lines.push(` - ${r}`));
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
lines.push(' 当前意识指标表现良好,维持现有机制。');
|
|
910
|
+
}
|
|
911
|
+
lines.push('');
|
|
912
|
+
lines.push('='.repeat(60));
|
|
913
|
+
lines.push('注:此评估基于计算功能主义框架,仅供科学研究参考');
|
|
914
|
+
lines.push('='.repeat(60));
|
|
915
|
+
return lines.join('\n');
|
|
916
|
+
}
|
|
917
|
+
//# sourceMappingURL=2308.08708_upgrade.js.map
|