femo-plugin 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +632 -635
- package/docs/ActiveRoadmaps/ARCHITECTURE.md +466 -0
- package/docs/ActiveRoadmaps/dshAdapter-/351/207/215/346/236/204/346/226/275/345/267/245/346/270/205/345/215/225.md +154 -0
- package/docs/ActiveRoadmaps/hub/345/224/257/344/270/200/345/214/226/350/256/276/350/256/241.md +107 -0
- package/docs/ActiveRoadmaps/webAdapter-/351/235/231/351/273/230/351/230/266/346/242/257/346/226/275/345/267/245/344/272/244/346/216/245.md +158 -0
- package/docs/ActiveRoadmaps/zcode-/346/227/240/345/255/220/344/273/243/347/220/206/345/214/226/346/226/275/345/267/245/346/270/205/345/215/225.md +166 -0
- package/docs/ActiveRoadmaps//345/274/225/346/223/216/345/270/270/351/251/273/345/214/226/347/254/2542/346/255/245/344/272/244/346/216/245.md +108 -0
- package/docs/ActiveRoadmaps//345/274/225/346/223/216/345/270/270/351/251/273/350/277/233/347/250/213/346/226/275/345/267/245/346/270/205/345/215/225.md +178 -0
- package/docs/ActiveRoadmaps//346/212/225/345/275/261/345/256/277/344/270/273/346/240/207/346/263/250/344/277/256/346/255/243/350/256/276/350/256/241.md +61 -0
- package/docs/ActiveRoadmaps//346/212/225/345/275/261/351/241/265/346/213/206/345/210/206/346/226/275/345/267/245/346/270/205/345/215/225.md +116 -0
- package/docs/README.md +38 -0
- package/docs/Specs//345/205/254/345/205/261/345/261/202/350/256/276/350/256/241/347/272/246/346/235/237.md +63 -0
- package/docs/Specs//345/256/277/344/270/273/346/216/245/345/205/245/346/270/205/345/215/225.md +137 -0
- package/docs/Specs//346/212/225/345/275/261/344/270/255/345/277/203/350/241/214/345/215/217/350/256/256.md +548 -0
- package/docs/Specs//350/267/250/345/256/277/344/270/273/345/257/271/350/257/235/346/223/215/344/275/234/346/214/207/345/215/227.md +124 -0
- package/femo2host/AGENTS.md +165 -0
- package/femo2host/femoGenConnector/SKILL.common.md +232 -0
- package/femo2host/femoGenConnector/femogen-canvas-state.mjs +56 -0
- package/femo2host/femoGenConnector/femogen-files.d.mts +22 -0
- package/femo2host/femoGenConnector/femogen-files.mjs +208 -0
- package/femo2host/femoGenConnector/file-dialogs.d.mts +15 -0
- package/femo2host/femoGenConnector/file-dialogs.mjs +131 -0
- package/femo2host/femoGenConnector/sse-core.d.mts +40 -0
- package/femo2host/femoGenConnector/sse-core.mjs +95 -0
- package/femo2host/femoRoot.d.mts +7 -0
- package/femo2host/femoRoot.mjs +44 -0
- package/femo2host/femoToolcall/chronica.py +159 -156
- package/femo2host/femoToolcall/femo_debugger.py +1518 -1515
- package/femo2host/femo_api.py +472 -437
- package/femo2host/femo_gen_api.jsx +86 -77
- package/femo2host/host/api-retry.d.mts +44 -0
- package/femo2host/host/api-retry.mjs +155 -0
- package/femo2host/host/cast-core.d.mts +20 -0
- package/femo2host/host/cast-core.mjs +113 -0
- package/femo2host/host/daemon-client.d.mts +63 -0
- package/femo2host/host/daemon-client.mjs +606 -0
- package/femo2host/host/debug-run-core.d.mts +121 -0
- package/femo2host/host/debug-run-core.mjs +531 -0
- package/femo2host/host/delivery-queue.d.mts +18 -0
- package/femo2host/host/delivery-queue.mjs +101 -0
- package/femo2host/host/event-core.d.mts +84 -0
- package/femo2host/host/event-core.mjs +335 -0
- package/femo2host/host/femo-relation.d.mts +22 -0
- package/femo2host/host/femo-relation.mjs +39 -0
- package/femo2host/host/hub-client.d.mts +11 -0
- package/femo2host/host/hub-client.mjs +74 -0
- package/femo2host/host/hub-feed-core.d.mts +68 -0
- package/femo2host/host/hub-feed-core.mjs +274 -0
- package/femo2host/host/hub-render-core.d.mts +43 -0
- package/femo2host/host/hub-render-core.mjs +140 -0
- package/femo2host/host/mailbox-push-core.d.mts +40 -0
- package/femo2host/host/mailbox-push-core.mjs +113 -0
- package/femo2host/host/mount-registry.mjs +110 -0
- package/femo2host/host/node-retry.d.mts +37 -0
- package/femo2host/host/node-retry.mjs +200 -0
- package/femo2host/host/notice-core.d.mts +33 -0
- package/femo2host/host/notice-core.mjs +83 -0
- package/femo2host/host/projection-core.d.mts +78 -0
- package/femo2host/host/projection-core.mjs +279 -0
- package/femo2host/host/run-control-core.d.mts +23 -0
- package/femo2host/host/run-control-core.mjs +72 -0
- package/femo2host/host/run-state-core.d.mts +59 -0
- package/femo2host/host/run-state-core.mjs +173 -0
- package/femo2host/host/session-registry.mjs +56 -0
- package/femo2host/host/skill-expand.d.mts +11 -0
- package/femo2host/host/skill-expand.mjs +51 -0
- package/femo2host/host/speech-core.d.mts +43 -0
- package/femo2host/host/speech-core.mjs +75 -0
- package/femo2host/host/state-files.d.mts +35 -0
- package/femo2host/host/state-files.mjs +267 -0
- package/femo2host/host/subagent-core.d.mts +81 -0
- package/femo2host/host/subagent-core.mjs +303 -0
- package/femo2host/host/tools-core.d.mts +72 -0
- package/femo2host/host/tools-core.mjs +684 -0
- package/femo2host/host/variable-api.d.mts +23 -0
- package/femo2host/host/variable-api.mjs +90 -0
- package/femo2host/host//345/267/262/351/200/200/345/275/271-bridge-client.d.mts +48 -0
- package/femo2host/host//345/267/262/351/200/200/345/275/271-bridge-client.mjs +239 -0
- package/femo2host/host//345/267/262/351/200/200/345/275/271-bridge-launch.d.mts +28 -0
- package/femo2host/host//345/267/262/351/200/200/345/275/271-bridge-launch.mjs +96 -0
- package/femo2host/mail_courier.py +104 -0
- package/femo2host/mailbox.py +491 -0
- package/femo2host/projectionCenter/app.css +808 -0
- package/femo2host/projectionCenter/composer.mjs +183 -0
- package/femo2host/projectionCenter/debug-panel.mjs +114 -0
- package/femo2host/projectionCenter/index.html +99 -0
- package/femo2host/projectionCenter/main.mjs +375 -0
- package/femo2host/projectionCenter/panels.mjs +281 -0
- package/femo2host/projectionCenter/render.mjs +623 -0
- package/femo2host/projectionCenter/sessions.mjs +138 -0
- package/femo2host/projectionCenter/state.mjs +93 -0
- package/femo2host/projectionCenter/theme.css +246 -0
- package/femo2host/projectionCenter/util.mjs +51 -0
- package/femo2host/projection_hub.py +7835 -0
- package/femo2host/python/femo_bridge.py +2075 -0
- package/femo2host/python/femo_daemon.py +1187 -0
- package/femo2host/python/setting.py +153 -0
- package/femoBridges/ContextExample.py +167 -42
- package/femoBridges/MemoryExample.py +33 -30
- package/femoBridges/getDir/get_dir.py +32 -18
- package/femoBridges/getDir//344/275/240/345/217/257/344/273/245/350/256/276/345/256/232/344/273/273/346/204/217/346/226/207/344/273/266/345/244/271/344/270/272/347/224/250/346/210/267/346/225/260/346/215/256/346/226/207/344/273/266/345/244/271.txt +1 -1
- package/femoBridges/llmBridge.py +1 -1
- package/femoBridges/llmProviders.py +39 -35
- package/femoCompiler/AGENTS.md +185 -0
- package/femoCompiler/FEMO_CLIrenderer.py +50 -30
- package/femoCompiler/FEMO_config.py +2 -1
- package/femoCompiler/FEMO_errors.py +286 -278
- package/femoCompiler/FEMO_normalizer.py +12 -7
- package/femoCompiler/FEMO_parser.py +217 -118
- package/femoCompiler/FEMO_runtime.py +491 -251
- package/femoCompiler/FEMO_scope_resolver.py +6 -3
- package/femoCompiler/actor_resolver.py +3 -3
- package/femoCompiler/block_collector.py +31 -28
- package/femoCompiler/db_utils.py +18 -0
- package/femoCompiler/femoAsync.py +436 -401
- package/femoCompiler/host_manifest.py +22 -2
- package/femoCompiler/job_manager.py +183 -55
- package/femoCompiler/protocol.py +13 -12
- package/femoCompiler/save_dialog.py +103 -59
- package/femoCompiler/task_world.py +579 -544
- package/femoCompiler/vars/checkpoint.py +3 -3
- package/femoCompiler/vars/env.py +77 -12
- package/femoCompiler/vars/evaluator.py +11 -6
- package/femoCompiler/vars/join.py +1 -1
- package/femoCompiler/vars/model.py +7 -7
- package/femoExamples/AI/345/211/252/350/247/206/351/242/221/AI/345/211/252/350/247/206/351/242/221.femo +5 -5
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/AI/350/201/212/345/244/251/345/256/244-/345/217/257/351/200/200/345/234/272/347/211/210.femo +115 -0
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/AI/350/201/212/345/244/251/345/256/244.femo +74 -0
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/random_wait_time.py +73 -3
- package/femoExamples/LuxFiat/luxfiat-loop.femo +67 -0
- package/femoExamples/LuxFiat/{luxfiat.femo → luxfiat-simple.femo} +1 -15
- package/femoExamples/LuxFiat/wait.py +2 -2
- package/femoExamples/_join_wiring_tlib.py +28 -0
- package/femoExamples/discussion.femo +7 -5
- package/femoExamples/mt_test/file_a.py +5 -0
- package/femoExamples/plan-mode.femo +55 -0
- package/femoExamples//345/237/272/347/241/200/350/277/236/351/200/232/346/265/213/350/257/225.femo +38 -0
- package/femoExamples//347/213/274/344/272/272/346/235/200/werewolf_utils2.py +248 -20
- package/femoExamples//347/213/274/344/272/272/346/235/200/werewolf_utils9.py +609 -0
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200-/350/255/246/351/225/277/347/211/210-9/344/272/272/351/242/204/345/245/263/347/214/216.femo +799 -0
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200-/350/255/246/351/225/277/347/211/210.femo +223 -48
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200.femo +4 -4
- package/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225/quiz_used.json +122 -0
- package/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225/undercover_utils.py +286 -2
- package/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225//350/260/201/346/230/257/345/215/247/345/272/225-/350/217/234/345/270/202/345/234/272/345/261/200.femo +95 -3
- package/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225//350/260/201/346/230/257/345/215/247/345/272/225.femo +128 -43
- package/femoGen/AGENTS.md +137 -0
- package/femoGen/document_ch.html +11 -11
- package/femoGen/index.html +1 -1
- package/femoGen/intro_ch.html +22 -22
- package/femoGen/src/FemoWorAuto.jsx +597 -152
- package/femoGen/src/actionModal.jsx +2 -2
- package/femoGen/src/bubbleOverlay.jsx +7 -5
- package/femoGen/src/canvasNodes.jsx +261 -61
- package/femoGen/src/common.jsx +88 -19
- package/femoGen/src/debugPanel.jsx +170 -43
- package/femoGen/src/faIcons.jsx +11 -4
- package/femoGen/src/femoDiagnostics.js +1 -1
- package/femoGen/src/femoDirBrowse.jsx +430 -0
- package/femoGen/src/femoFileList.jsx +36 -6
- package/femoGen/src/femoGenerator.jsx +9 -9
- package/femoGen/src/femoParser.jsx +2276 -2255
- package/femoGen/src/femoPreview.jsx +3 -0
- package/femoGen/src/femoSaveReminder.jsx +75 -0
- package/femoGen/src/graphBuilder.jsx +2 -2
- package/femoGen/src/libPanel.jsx +1 -1
- package/femoGen/src/mobileView.jsx +2814 -2796
- package/femoGen/src/projectPanel.jsx +2 -2
- package/femoGen/src/snap.js +101 -0
- package/femoGen/src/soulModal.jsx +4 -2
- package/femoGen/src/themes.js +272 -4
- package/femoGen/src/{useCanvasInteraction.jsx → /345/267/262/351/200/200/345/275/271-useCanvasInteraction.disabled.jsx} +8 -2
- package/hostAdapter/dshAdapter/README.md +109 -68
- package/hostAdapter/dshAdapter/build.mjs +49 -6
- package/hostAdapter/dshAdapter/check-imports.mjs +85 -0
- package/hostAdapter/dshAdapter/client/client-ui/cast-button.tsx +232 -0
- package/hostAdapter/dshAdapter/client/{lineage-fork-native.jsx → client-ui/catalog-dropdown.jsx} +689 -624
- package/hostAdapter/dshAdapter/client/client-ui/chat-node.tsx +12 -9
- package/hostAdapter/dshAdapter/client/client-ui/composer-common.tsx +74 -0
- package/hostAdapter/dshAdapter/client/client-ui/composer-permission.tsx +183 -0
- package/hostAdapter/dshAdapter/client/client-ui/composer-ring.tsx +196 -0
- package/hostAdapter/dshAdapter/client/client-ui/composer-run-state.tsx +134 -0
- package/hostAdapter/dshAdapter/client/client-ui/composer-stats.tsx +163 -0
- package/hostAdapter/dshAdapter/client/client-ui/composer.tsx +417 -997
- package/hostAdapter/dshAdapter/client/client-ui/editor-page.tsx +747 -726
- package/hostAdapter/dshAdapter/client/client-ui/editor-view.tsx +89 -88
- package/hostAdapter/dshAdapter/client/client-ui/hub-constants.ts +10 -0
- package/hostAdapter/dshAdapter/client/client-ui/hub-window.tsx +545 -0
- package/hostAdapter/dshAdapter/client/client-ui/primitives-compat.ts +39 -0
- package/hostAdapter/dshAdapter/client/client-ui/proj2/frame-router.ts +17 -52
- package/hostAdapter/dshAdapter/client/client-ui/proj2/index.ts +1 -1
- package/hostAdapter/dshAdapter/client/client-ui/proj2/ledger.ts +12 -12
- package/hostAdapter/dshAdapter/client/client-ui/proj2/turn-view.tsx +8 -16
- package/hostAdapter/dshAdapter/client/client-ui/proj2/window-id.ts +8 -9
- package/hostAdapter/dshAdapter/client/client-ui/stream-store.ts +187 -550
- package/hostAdapter/dshAdapter/client/client-ui/styles.ts +21 -10
- package/hostAdapter/dshAdapter/client/client-ui/view-button.tsx +550 -572
- package/hostAdapter/dshAdapter/client/client-ui/view-state.ts +1 -1
- package/hostAdapter/dshAdapter/client/client.tsx +611 -518
- package/hostAdapter/dshAdapter/client/fa-icons.tsx +3 -0
- package/hostAdapter/dshAdapter/client/femo-reasoning-row.tsx +104 -103
- package/hostAdapter/dshAdapter/client/femo-tool-row.tsx +264 -0
- package/hostAdapter/dshAdapter/client/lineage-fork.jsx +55 -570
- package/hostAdapter/dshAdapter/data/actor-usage/femo-mth3yajcr8s0.json +12 -0
- package/hostAdapter/dshAdapter/data/actor-usage/femo-mttj2cy56n12.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/femo-mtxc74ueurft.json +19 -0
- package/hostAdapter/dshAdapter/data/actor-usage/femo-mtxmxyn8kngv.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/femo-mug4r692c8ka.json +12 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-037b2575-75b9-4d2b-827d-47fc805b431c.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-040de1e9-ef4a-4d8a-9196-5f9110179851.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-141fce35-4246-4282-974b-75d68bdd56cf.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-1c27370c-4353-4f46-b796-b6a34d3828c7.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-20ced29b-bd52-4132-81f7-3b41b87e0252.json +19 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-270edff4-c750-445c-b8b4-c4213714ceb2.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-283fa98f-287b-4b41-9365-5e86d8fc5573.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-29a259df-5360-4592-a62f-318726585cdb.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-2a765670-8786-42c8-93bf-015a5559f262.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-2ae40e62-d506-4304-bfe5-75370cd3ea7c.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-2b4996d3-be1e-422c-a6fc-09f4b2579ca0.json +47 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-2c0860c7-6ece-4d88-9b93-3f742ca45be8.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-2dd1876b-abdc-4823-a73f-3c1da01cd532.json +47 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-30252fa7-ad1c-4e2f-84b9-e452265c556d.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-30b14bb0-a360-4c49-80af-466d24fb43a8.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-36bf7992-ab1c-4ca4-8cdf-303b88313463.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-463976b2-f499-4bbb-aef5-47ccafdf2f71.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-4ca53237-528f-4d57-a3b0-aef603372987.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-55230dc9-8958-4baa-aa17-e30c2a6ab936.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-58fe766b-a748-451a-9f1c-8e99f73e6f78.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-5b64624d-12b4-4135-a056-7c5deeee7d26.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-5bbd3eaf-f0a5-4832-ab3a-235764e53489.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-610c6e5f-cb10-4602-8296-39d043a080a2.json +19 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-71b726f7-672c-428a-ae67-a938b3813885.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-75496374-b5b5-47bf-97a8-727a5ff60269.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-75e232d5-8623-4d18-9fb0-0483afaf2267.json +19 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-770dfb20-c9fd-40ba-ac9c-566c330c0f52.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-77c5456d-e3b8-49a3-bb30-28e2868648d2.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-799be0db-7417-4d73-82fc-70f0f0614f83.json +33 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-7f36a505-8482-4de9-a250-3eec58ff55aa.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-7fc18e95-6e4a-4a99-9921-1e103a018f9d.json +12 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75.json +33 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-827bcfa4-87f7-45b8-a911-a676cde5d181.json +12 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-879ca267-b9a6-40fd-982f-450e08887a82.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-89aba104-72f4-468e-9851-b31c5bd2982f.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-8a1a4626-8571-43cf-86b1-65fca24347e0.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-8a2ac43a-1b4c-464e-9e46-7bfd1093aeeb.json +54 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-8b80220d-4882-4f09-95f7-fc2a25c154bc.json +33 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-8bc0e63f-8f4c-418d-a7e8-c52df202cd71.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-8bc8b7ad-037b-4d2e-9f3a-f2daff5ec7ba.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-8e248853-d0ac-44a9-bdd3-ef23eecd14ea.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-9b90725f-53ee-4331-b759-8a19ce23c65e.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-a13ed007-52ea-4ece-ac25-0e7e2437d850.json +33 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-a5405bf4-b995-4031-ab71-19575f817075.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-a5656c1b-2927-4723-b5b9-70cb52689a3c.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-a847b4af-495d-4511-bd39-fe4cf5d59c85.json +19 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-a91ea1d5-1f66-42cf-9c05-483474ee97b1.json +26 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-ada86a6c-31f1-482e-8294-43363f399324.json +33 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-bb9c48e5-bc43-41e6-b271-508fe0ca4096.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-be0023a0-d6ae-474a-9e3a-f180ad51cde7.json +54 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-c003925d-e214-46dd-ac10-4807ffe7ba16.json +12 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-c3036a0e-0e27-4fb0-89f5-1b349063ab05.json +47 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-c38b2590-e2f8-4267-a066-53f1d8217aa7.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-c406c289-db0a-42dc-9a25-679750ff84a5.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-c8d5057d-e6e0-49b8-8eec-a5fd6d86af08.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-c8f2aa54-98bc-40c7-81c8-9ab5b36c3978.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-caeb300b-9a4d-4fc2-a8f8-d76261746896.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8.json +54 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-ce183804-b492-4b3e-b47f-30c80f61f69e.json +19 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-dfccc764-ec17-44d3-afb2-4bd47e20eb47.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-e0e17c43-b8f1-46a9-b7fb-c302f65a7f8a.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-e5cbe7fa-e2a5-4fc0-9268-55307d8e42f0.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-f06390c1-de3c-4caf-9ec3-314cc992d402.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-f845e7b6-ed8d-420d-b031-4387b8b40aac.json +40 -0
- package/hostAdapter/dshAdapter/data/actor-usage/session-fd9c0828-03f5-4ed8-ab4f-2f477eed17a4.json +40 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug4r692c8ka-_40_4eba_7c7b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug4r692c8ka-_40_5bfc_6f14.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug4r692c8ka-_40_963f_660e.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug4r692c8ka-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug4r692c8ka-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug6f691kirq-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug6f691kirq-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug6f691kirq-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-mug6f691kirq-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muiwyk7icw54-_40AI1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muiwyk7icw54-_40AI2.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muiwyk7icw54-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muiwyk7icw54-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muix9vua4j1u-_40AI1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muix9vua4j1u-_40AI2.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muix9vua4j1u-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-femo-muix9vua4j1u-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-040de1e9-ef4a-4d8a-9196-5f9110179851-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-270edff4-c750-445c-b8b4-c4213714ceb2-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2a765670-8786-42c8-93bf-015a5559f262-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-2c0860c7-6ece-4d88-9b93-3f742ca45be8-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-34b94e86-92eb-44e9-a348-e4bda7d10e83-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-3c3a846e-7258-4119-8d43-0d98599e916e-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-51895361-2c62-492e-b28d-d7a5ed3a0638-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-587f60de-2e57-4917-940a-99766708e910-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-6028094b-26ab-4d70-829a-a605b73d041e-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-610c6e5f-cb10-4602-8296-39d043a080a2-_40_732b_732b.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75496374-b5b5-47bf-97a8-727a5ff60269-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75e232d5-8623-4d18-9fb0-0483afaf2267-_40AI-1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75e232d5-8623-4d18-9fb0-0483afaf2267-_40AI-2.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75e232d5-8623-4d18-9fb0-0483afaf2267-_40AI1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75e232d5-8623-4d18-9fb0-0483afaf2267-_40AI2.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75e232d5-8623-4d18-9fb0-0483afaf2267-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-75e232d5-8623-4d18-9fb0-0483afaf2267-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40AI_52a9_624b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40Portia.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_4eba.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_5c0f_6ee1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_5c0f_7075.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_7528_6237.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_8587_62c9.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_9646_8001_8d26.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-_40_96f7_7a3d_67e5.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-770dfb20-c9fd-40ba-ac9c-566c330c0f52-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40AI_52a9_624b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40Portia.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_4eba.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_5c0f_6ee1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_5c0f_7075.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_7528_6237.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_8587_62c9.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_9646_8001_8d26.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-_40_96f7_7a3d_67e5.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-799be0db-7417-4d73-82fc-70f0f0614f83-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-7c0e68a4-7904-434e-8339-ce78f3087133-_40AI1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-7c0e68a4-7904-434e-8339-ce78f3087133-_40AI2.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-7c0e68a4-7904-434e-8339-ce78f3087133-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-7c0e68a4-7904-434e-8339-ce78f3087133-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-main.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-81dd6f61-4c71-4d31-9ac7-534fab6a9f75-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-827bcfa4-87f7-45b8-a911-a676cde5d181-_40_8ba1_6570_5458.jsonl +11 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8425bd6f-b397-462b-8a5a-06dd27f0bf48-_40DSH.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8425bd6f-b397-462b-8a5a-06dd27f0bf48-_40ZCode.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8425bd6f-b397-462b-8a5a-06dd27f0bf48-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8425bd6f-b397-462b-8a5a-06dd27f0bf48-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40AI_52a9_624b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40Portia.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_4eba.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_5c0f_7075.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-89aba104-72f4-468e-9851-b31c5bd2982f-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_738b_70b8.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_8001_674e.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8a827bb7-b42f-40ed-b3ba-2a5750fbd84b-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8c62feb0-4444-424b-a3fc-aa04efc2f6b8-_40ZCode.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8c62feb0-4444-424b-a3fc-aa04efc2f6b8-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-8c62feb0-4444-424b-a3fc-aa04efc2f6b8-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-_40Eve.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-_40_51fa_9898_5b98.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-_40_5c0f_673a.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-_40_5c0f_732b_54aa.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-_40_732b_732b.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-_40_770b_56fe_6897.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-_40_94f2_5c4e_5b98.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-94bebdcf-0a72-4227-9bbf-130ca53f8894-stage.jsonl +7 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-a5656c1b-2927-4723-b5b9-70cb52689a3c-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-_40_5c0f_6ee1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-_40_7528_6237.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-_40_8587_62c9.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-_40_9646_8001_8d26.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-_40_96f7_7a3d_67e5.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-_40player.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-player.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ada86a6c-31f1-482e-8294-43363f399324-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-b1a7c943-1f3d-4557-85b4-ccd412926746-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-b978b30f-d131-4618-8833-33b12a40fede-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bbd289ab-b541-48e8-88cf-d2ffd650b37f-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bc31b811-ab74-4de2-b07e-cb507a99dd60-_40ZCode.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bc31b811-ab74-4de2-b07e-cb507a99dd60-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bc31b811-ab74-4de2-b07e-cb507a99dd60-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bc31b811-ab74-4de2-b07e-cb507a99dd60-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bc75ec67-da39-49fc-bcb9-678bf2c0d7ee-_40DSH.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bc75ec67-da39-49fc-bcb9-678bf2c0d7ee-_40ZCode.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-bc75ec67-da39-49fc-bcb9-678bf2c0d7ee-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-c406c289-db0a-42dc-9a25-679750ff84a5-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_51fa_9898_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_5c0f_673a.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_732b_732b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_738b_70b8.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_770b_56fe_6897.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_8001_674e.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40_94f2_5c4e_5b98.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-_40player.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-player.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-ccf2d14c-54ca-4f98-ac96-4300d5158ce8-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d052de57-9451-4f79-8254-0afd4ae0e7cb-stage.jsonl +4 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-_40AI_52a9_624b.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-_40Eve.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-_40Portia.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-_40_4eba.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-_40_5c0f_673a.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-_40_5c0f_7075.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-d11a76cb-6e38-48ff-9d10-cacf1f7f5f61-stage.jsonl +6 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-_40AI-1.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-_40AI-2.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-_40ZCode.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-_40_5c0f_732b_54aa.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-littlecat.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-main.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-f3b0f8c2-b14a-468d-962d-77036849afc7-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-fed2b44a-bf73-448d-ae8c-42b7a24edd6f-_40ZCode.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-fed2b44a-bf73-448d-ae8c-42b7a24edd6f-_40_6d4b_8bd5_4e8c_53f7.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-fed2b44a-bf73-448d-ae8c-42b7a24edd6f-god.jsonl +5 -0
- package/hostAdapter/dshAdapter/data/proj-mirror/femo-proj-session-fed2b44a-bf73-448d-ae8c-42b7a24edd6f-stage.jsonl +5 -0
- package/hostAdapter/dshAdapter/dshPatch/DSH-0.1.2-fork/344/277/256/346/224/271/351/234/200/346/261/202.md +4 -4
- package/hostAdapter/dshAdapter/dshPatch/patch-dsh-0.1.2-alpha.1.py +1 -1
- package/{femo2host/femoToolcall → hostAdapter/dshAdapter}/femo-chat.mjs +4 -2
- package/hostAdapter/dshAdapter/host/actor-name.ts +30 -0
- package/hostAdapter/dshAdapter/host/actor-usage.ts +54 -0
- package/hostAdapter/dshAdapter/host/actors/dispatch.ts +152 -0
- package/hostAdapter/dshAdapter/host/actors/main/capture.ts +219 -0
- package/hostAdapter/dshAdapter/host/actors/main/delivery.ts +233 -0
- package/hostAdapter/dshAdapter/host/actors/main/index.ts +420 -0
- package/hostAdapter/dshAdapter/host/actors/main/notice.ts +180 -0
- package/hostAdapter/dshAdapter/host/actors/native/child-setup.ts +103 -0
- package/hostAdapter/dshAdapter/host/actors/native/index.ts +672 -0
- package/hostAdapter/dshAdapter/host/actors/native/registry.ts +55 -0
- package/hostAdapter/dshAdapter/host/actors/native/turn-watch.ts +159 -0
- package/hostAdapter/dshAdapter/host/api-retry.ts +30 -123
- package/hostAdapter/dshAdapter/host/bridge-supervisor.ts +96 -0
- package/hostAdapter/dshAdapter/host/bridge.ts +147 -224
- package/hostAdapter/dshAdapter/host/compat/dsh-session-host.ts +46 -0
- package/hostAdapter/dshAdapter/host/{list-cache.ts → compat/list-cache.ts} +1 -1
- package/hostAdapter/dshAdapter/host/compat/plugin-source.ts +41 -0
- package/hostAdapter/dshAdapter/host/config.ts +149 -124
- package/hostAdapter/dshAdapter/host/debug-run.ts +274 -793
- package/hostAdapter/dshAdapter/host/diag/debug-log.ts +44 -0
- package/hostAdapter/dshAdapter/host/{diag-feed.ts → diag/diag-feed.ts} +11 -18
- package/hostAdapter/dshAdapter/host/{host-log.ts → diag/host-log.ts} +1 -1
- package/hostAdapter/dshAdapter/host/engine-transcript.ts +2 -2
- package/hostAdapter/dshAdapter/host/events/engine-events.ts +747 -0
- package/hostAdapter/dshAdapter/host/events/mailbox-push.ts +332 -0
- package/hostAdapter/dshAdapter/host/{pre-step-gate.ts → events/pre-step-gate.ts} +26 -32
- package/hostAdapter/dshAdapter/host/femo-files.ts +6 -207
- package/hostAdapter/dshAdapter/host/http.ts +10 -12
- package/hostAdapter/dshAdapter/host/hub/god-mirror.ts +307 -0
- package/hostAdapter/dshAdapter/host/hub/hub-feed.ts +129 -0
- package/hostAdapter/dshAdapter/host/hub/hub-proxy.ts +203 -0
- package/hostAdapter/dshAdapter/host/{stream-frames.ts → hub/stream-frames.ts} +36 -77
- package/hostAdapter/dshAdapter/host/index.ts +355 -633
- package/hostAdapter/dshAdapter/host/job-index.ts +36 -0
- package/hostAdapter/dshAdapter/host/main-actor.ts +24 -853
- package/hostAdapter/dshAdapter/host/main-delivery-queue.ts +5 -112
- package/hostAdapter/dshAdapter/host/node-retry.ts +22 -246
- package/hostAdapter/dshAdapter/host/persona.ts +1 -1
- package/hostAdapter/dshAdapter/host/preset-install.ts +218 -0
- package/hostAdapter/dshAdapter/host/projection/hub-anchor.ts +21 -0
- package/hostAdapter/dshAdapter/host/{projection.ts → projection/projection.ts} +112 -188
- package/hostAdapter/dshAdapter/host/{windowing-native.ts → projection/windowing-native.ts} +35 -37
- package/hostAdapter/dshAdapter/host/routes/dialogs.ts +63 -0
- package/hostAdapter/dshAdapter/host/routes/index.ts +599 -0
- package/hostAdapter/dshAdapter/host/{projection-input.ts → routes/projection-input.ts} +254 -238
- package/hostAdapter/dshAdapter/host/routes/projection.ts +174 -0
- package/hostAdapter/dshAdapter/host/routes/run.ts +127 -0
- package/hostAdapter/dshAdapter/host/routes/script-files.ts +68 -0
- package/hostAdapter/dshAdapter/host/routes/state.ts +273 -0
- package/hostAdapter/dshAdapter/host/run-control.ts +709 -641
- package/hostAdapter/dshAdapter/host/session-roster.ts +420 -0
- package/hostAdapter/dshAdapter/host/sse.ts +27 -0
- package/hostAdapter/dshAdapter/host/state-files.ts +13 -301
- package/hostAdapter/dshAdapter/host/tool-deps.ts +297 -0
- package/hostAdapter/dshAdapter/host/tools.ts +394 -486
- package/hostAdapter/dshAdapter/host/verbs.ts +81 -0
- package/hostAdapter/dshAdapter/host.manifest.json +2 -1
- package/hostAdapter/dshAdapter/lib/client.js +4923 -3289
- package/hostAdapter/dshAdapter/lib/client.js.map +4 -4
- package/hostAdapter/dshAdapter/lib/index.js +13 -8173
- package/hostAdapter/dshAdapter/lib/index.js.map +4 -4
- package/hostAdapter/dshAdapter/lib/main.js +17484 -0
- package/hostAdapter/dshAdapter/lib/main.js.map +7 -0
- package/hostAdapter/dshAdapter/package.json +52 -55
- package/hostAdapter/dshAdapter/pnpm-lock.yaml +606 -596
- package/hostAdapter/dshAdapter/preset/agent.cordis.yml +82 -0
- package/hostAdapter/dshAdapter/preset/preset.yml +3 -0
- package/hostAdapter/dshAdapter/shared/window-id.d.mts +5 -0
- package/hostAdapter/dshAdapter/shared/window-id.mjs +22 -0
- package/hostAdapter/dshAdapter/tsconfig.host-verify.json +6 -0
- package/hostAdapter/dshAdapter/tsconfig.json +1 -3
- package/package.json +40 -40
- package//350/257/255/346/263/225/346/226/207/346/241/243.md +1202 -1136
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/group-chat.femo +0 -42
- package/hostAdapter/dshAdapter/client/client-ui/femo-stream-live.tsx +0 -264
- package/hostAdapter/dshAdapter/dshPatch/MEOW_MODIFICATIONS.md +0 -3105
- package/hostAdapter/dshAdapter/host/debug-log.ts +0 -29
- package/hostAdapter/dshAdapter/host/engine-events.ts +0 -891
- package/hostAdapter/dshAdapter/host/god-mirror.ts +0 -234
- package/hostAdapter/dshAdapter/host/proj-trace.ts +0 -49
- package/hostAdapter/dshAdapter/host/routes.ts +0 -1196
- package/hostAdapter/dshAdapter/host/section-gate.ts +0 -108
- package/hostAdapter/dshAdapter/host/subagent-native.ts +0 -997
- package/hostAdapter/dshAdapter/host/subagent.ts +0 -1205
- package/hostAdapter/dshAdapter/package-lock.json +0 -500
- package/hostAdapter/dshAdapter/python/dev-bridge-test.py +0 -43
- package/hostAdapter/dshAdapter/python/femo_bridge.py +0 -533
- /package/hostAdapter/dshAdapter/host/{native-state.ts → compat/native-state.ts} +0 -0
- /package/hostAdapter/dshAdapter/host/{session-events.ts → compat/session-events.ts} +0 -0
|
@@ -1,2255 +1,2276 @@
|
|
|
1
|
-
// ═══════════════════════════════════════════════════════════════
|
|
2
|
-
// ═══ femoParser.jsx ═══
|
|
3
|
-
// ═══════════════════════════════════════════════════════════════
|
|
4
|
-
|
|
5
|
-
import { TYPES, SPECIAL_COLORS, actionId } from './common'
|
|
6
|
-
// ═══ 统一报错链路(2026-09-07 解耦)═══
|
|
7
|
-
// parser 内所有语法检查点不再各自 throw new Error(手拼字符串),统一调
|
|
8
|
-
// reporter(femoDiagnostics.js):error 阻断(抛 FEMOSyntaxError)、warning
|
|
9
|
-
// 仅提醒(挂 result.warnings)。每条诊断固定携带 行号/出错行/信息/区域。
|
|
10
|
-
import { createReporter } from './femoDiagnostics';
|
|
11
|
-
|
|
12
|
-
// actor thinking 档位词汇全集(与 Python 编译器 FEMO_parser.THINKING_LEVELS 对齐,
|
|
13
|
-
// = pi-ai 的 ModelThinkingLevel;无 default 词——「默认」由不带 thinking 声明表达,
|
|
14
|
-
// 与 dsh 模型选择器 Default 项同语义:不发 reasoning_effort 字段,服务器自选)。
|
|
15
|
-
export const THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
16
|
-
|
|
17
|
-
function normalizeSymbols(str, context = 'global') {
|
|
18
|
-
let s = str;
|
|
19
|
-
// ═══ 全角符号标准化(注释剥离已由全局 stripComments 完成,此处不再处理注释)═══
|
|
20
|
-
if (context !== 'prompt') {
|
|
21
|
-
s = s
|
|
22
|
-
.replace(/:/g, ':')
|
|
23
|
-
.replace(/,/g, ',')
|
|
24
|
-
.replace(/“/g, '"')
|
|
25
|
-
.replace(/”/g, '"')
|
|
26
|
-
.replace(/(/g, '(')
|
|
27
|
-
.replace(/)/g, ')')
|
|
28
|
-
.replace(/【/g, '[')
|
|
29
|
-
.replace(/】/g, ']')
|
|
30
|
-
.replace(/|/g, '|');
|
|
31
|
-
}
|
|
32
|
-
// flow 区域额外:-- 替换为 ->
|
|
33
|
-
if (context === 'flow') {
|
|
34
|
-
s = s.replace(/--/g, '->');
|
|
35
|
-
}
|
|
36
|
-
return s;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// ═══════════════════════════════════════════════════════════════
|
|
40
|
-
// ═══ 全局注释剥离(编译第一步)═══
|
|
41
|
-
// ═══════════════════════════════════════════════════════════════
|
|
42
|
-
// 除 prompt 文本块内部与字符串引号内部外,所有 `#` 与 `//` 连同其后内容
|
|
43
|
-
// 清空到行尾。行首缩进保留(块结构依赖缩进)。
|
|
44
|
-
|
|
45
|
-
// 引号感知的行级注释剥离
|
|
46
|
-
function stripLineComments(line) {
|
|
47
|
-
let out = '';
|
|
48
|
-
let quote = null;
|
|
49
|
-
for (let i = 0; i < line.length; i++) {
|
|
50
|
-
const c = line[i];
|
|
51
|
-
if (quote) {
|
|
52
|
-
out += c;
|
|
53
|
-
if (c === '\\' && i + 1 < line.length) {
|
|
54
|
-
out += line[i + 1];
|
|
55
|
-
i++;
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (c === quote) quote = null;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (c === '"' || c === "'") {
|
|
62
|
-
quote = c;
|
|
63
|
-
out += c;
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
if (c === '#') {
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
if (c === '/' && line[i + 1] === '/') break;
|
|
70
|
-
out += c;
|
|
71
|
-
}
|
|
72
|
-
return out;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// 找出所有多行文本块 [start, end) 行区间:
|
|
76
|
-
// prompt: | / showprompt: |(action)以及 key = |(meta:system_safety 等)
|
|
77
|
-
function findPromptRanges(lines) {
|
|
78
|
-
const ranges = [];
|
|
79
|
-
let i = 0;
|
|
80
|
-
while (i < lines.length) {
|
|
81
|
-
const trimmed = lines[i].trim();
|
|
82
|
-
// 允许行尾带注释(全局剥离后该行会先被清成 prompt: |,此处宽松匹配)
|
|
83
|
-
const isMultiStart =
|
|
84
|
-
/^(?:prompt|showprompt):\s*[||]\s*(?:#.*)?$/.test(trimmed) ||
|
|
85
|
-
/^(?:@|\$@|\$)?[\w\u4e00-\u9fff]+\s*=\s*[||]\s*(?:#.*)?$/.test(trimmed);
|
|
86
|
-
if (isMultiStart) {
|
|
87
|
-
const fieldIndent = lines[i].length - lines[i].trimStart().length;
|
|
88
|
-
let j = i + 1;
|
|
89
|
-
while (j < lines.length) {
|
|
90
|
-
const t2 = lines[j].trim();
|
|
91
|
-
if (!t2) { j++; continue; } // 空行算 prompt 内容
|
|
92
|
-
const ind2 = lines[j].length - lines[j].trimStart().length;
|
|
93
|
-
if (ind2 <= fieldIndent) break; // 缩进回到字段层 → 块结束
|
|
94
|
-
j++;
|
|
95
|
-
}
|
|
96
|
-
ranges.push([i + 1, j]);
|
|
97
|
-
i = j;
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
i++;
|
|
101
|
-
}
|
|
102
|
-
return ranges;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// ═══════════════════════════════════════════════════════════════
|
|
106
|
-
// ═══ #sketch 注释块还原(编译第零步,必须先于 stripComments)═══
|
|
107
|
-
// ═══════════════════════════════════════════════════════════════
|
|
108
|
-
// 生成端把 sketch 块写成注释(每行行首加 #);这里检测 #sketch 标志,
|
|
109
|
-
// 把整个块取出、每行剥掉行首一个 #(# 后的空格即原缩进),还原为
|
|
110
|
-
// 普通 sketch: 块,再走正常链路解析。块内残余 #(手写注释)交由
|
|
111
|
-
// stripComments 正常去掉。
|
|
112
|
-
function extractHashSketch(lines) {
|
|
113
|
-
const out = [];
|
|
114
|
-
let i = 0;
|
|
115
|
-
while (i < lines.length) {
|
|
116
|
-
const raw = lines[i];
|
|
117
|
-
if (/^#\s*sketch\s*:/.test(raw)) {
|
|
118
|
-
out.push(raw.replace(/^#/, '')); // 标志行剥一个 # → sketch:
|
|
119
|
-
i++;
|
|
120
|
-
while (i < lines.length && /^#/.test(lines[i])) {
|
|
121
|
-
out.push(lines[i].replace(/^#/, '')); // 块内容行同样剥一个 #
|
|
122
|
-
i++;
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
out.push(raw);
|
|
126
|
-
i++;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return out;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// 全局注释剥离:parseFEMO 的第一步
|
|
133
|
-
function stripComments(lines) {
|
|
134
|
-
const ranges = findPromptRanges(lines);
|
|
135
|
-
return lines.map((raw, i) => {
|
|
136
|
-
for (const [s, e] of ranges) {
|
|
137
|
-
if (i >= s && i < e) return raw; // prompt 文本块:原样保留
|
|
138
|
-
}
|
|
139
|
-
return stripLineComments(raw);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// rep:统一报错链路入口(femoDiagnostics.createReporter 产物)。可外部传入
|
|
144
|
-
// 以收集诊断;缺省时内部自建。error → 抛 FEMOSyntaxError(阻断);warning →
|
|
145
|
-
// 汇入 result.warnings(不阻断)。
|
|
146
|
-
function parseFEMO(text, rep = null) {
|
|
147
|
-
rep = rep || createReporter();
|
|
148
|
-
// 编译第负一步:捕获 meta: 之前的文件头原文(作者的架构说明 / ⚠️ 备忘等注释)。
|
|
149
|
-
// 下一步 stripComments 会全局剥注释,preamble 必须抢在它之前从原文截取;
|
|
150
|
-
// buildFEMO 生成时原样回写到文件头(2026-09-12:编辑器保存曾把文件头注释剥掉)。
|
|
151
|
-
// 只认顶格的 meta: 行(模块内的 meta: 有缩进,不会误命中)。
|
|
152
|
-
const rawLines = text.split('\n');
|
|
153
|
-
const metaLineIdx = rawLines.findIndex((l) => /^meta:\s*$/.test(l));
|
|
154
|
-
const preamble = metaLineIdx > 0
|
|
155
|
-
? rawLines.slice(0, metaLineIdx).join('\n').replace(/\s+$/, '')
|
|
156
|
-
: '';
|
|
157
|
-
// 编译第零步:#sketch 注释块还原(必须先于全局去注释)
|
|
158
|
-
// 编译第一步:内存版全局去注释(# 和 // 到行尾;prompt 块与引号内豁免)
|
|
159
|
-
// 只处理内存副本,用户原文/窗口文本不受影响
|
|
160
|
-
const lines = stripComments(extractHashSketch(rawLines));
|
|
161
|
-
const blocks = splitTopBlocks(lines);
|
|
162
|
-
|
|
163
|
-
const result = {
|
|
164
|
-
meta: {
|
|
165
|
-
name: '',
|
|
166
|
-
version: '1.0',
|
|
167
|
-
owner: '',
|
|
168
|
-
database: '',
|
|
169
|
-
session: '',
|
|
170
|
-
system_safety: '',
|
|
171
|
-
output_style: '',
|
|
172
|
-
},
|
|
173
|
-
code: [],
|
|
174
|
-
context: [],
|
|
175
|
-
memory: [],
|
|
176
|
-
preamble, // meta: 之前的文件头原文(注释等),buildFEMO 原样回写
|
|
177
|
-
vars: [],
|
|
178
|
-
actors: [],
|
|
179
|
-
warnings: [], // 非阻断提示(rep.warnings 诊断:行号/出错行/信息/区域)——与引擎 script.warnings 对齐
|
|
180
|
-
actions: [],
|
|
181
|
-
modules: [],
|
|
182
|
-
mainflow: { nodeDecls: [], edges: [] },
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
let mainflowSketch = null; // 容错:顶层 sketch: 块(与 mainflow 同级)
|
|
186
|
-
|
|
187
|
-
for (const block of blocks) {
|
|
188
|
-
const h = block.header;
|
|
189
|
-
if (h === 'meta:') {
|
|
190
|
-
result.meta = parseMetaBlock(block.contentLines, rep);
|
|
191
|
-
} else if (h === 'code:') {
|
|
192
|
-
result.code = parseCodeBlock(block.contentLines, rep);
|
|
193
|
-
} else if (h === 'vars:') {
|
|
194
|
-
result.vars = parseVarsBlock(block.contentLines, rep);
|
|
195
|
-
} else if (h === 'actors:') {
|
|
196
|
-
result.actors = parseActorsBlock(block.contentLines, rep);
|
|
197
|
-
} else if (h.startsWith('memory ')) {
|
|
198
|
-
result.memory.push(
|
|
199
|
-
parseMemoryOrContextBlock(h, block.contentLines, 'memory', rep, block.headerLineNum)
|
|
200
|
-
);
|
|
201
|
-
} else if (h.startsWith('context ')) {
|
|
202
|
-
result.context.push(
|
|
203
|
-
parseMemoryOrContextBlock(h, block.contentLines, 'context', rep, block.headerLineNum)
|
|
204
|
-
);
|
|
205
|
-
} else if (h.startsWith('action ')) {
|
|
206
|
-
result.actions.push(parseActionBlock(h, block.contentLines, rep, block.headerLineNum));
|
|
207
|
-
} else if (h.startsWith('module ')) {
|
|
208
|
-
result.modules.push(parseModuleBlock(h, block.contentLines, rep, block.headerLineNum));
|
|
209
|
-
} else if (h === 'sketch:') {
|
|
210
|
-
// 暂存顶层草图,待 mainflow 解析后合并
|
|
211
|
-
mainflowSketch = parseLayoutBlock(block.contentLines);
|
|
212
|
-
} else if (h === 'mainflow:' || h === 'flow:') {
|
|
213
|
-
// flow: 与 mainflow: 等价(编译器 build_blocks 均归为 flow 块)
|
|
214
|
-
result.mainflow = parseMainflowBlock(block.contentLines, rep);
|
|
215
|
-
// 如果有与 mainflow 同级的 sketch 块,合并布局(外部覆盖内部)
|
|
216
|
-
if (mainflowSketch) {
|
|
217
|
-
result.mainflow.layout = { ...result.mainflow.layout, ...mainflowSketch };
|
|
218
|
-
mainflowSketch = null;
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
rep.fail(
|
|
222
|
-
`未识别的顶层块: "${h}"。期望: meta:, code:, vars:, actors:, context:, memory:, action ..., module ..., mainflow:`,
|
|
223
|
-
{ line: (block.headerLineNum ?? -1) + 1, lineText: h, where: '顶层' }
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// 如果 sketch 在 mainflow 之前就已经读到,但 mainflow 始终未出现,则丢弃(不报错)
|
|
229
|
-
// 如果 mainflow 已解析但之后还有 sketch 块,同样合并
|
|
230
|
-
if (mainflowSketch && result.mainflow) {
|
|
231
|
-
result.mainflow.layout = { ...result.mainflow.layout, ...mainflowSketch };
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// 展平嵌套模块,为每个模块生成层级 path(从 mainflow 起)
|
|
235
|
-
const topModules = result.modules;
|
|
236
|
-
result.modules = [];
|
|
237
|
-
function flattenModules(mods, parentPath) {
|
|
238
|
-
for (const m of mods) {
|
|
239
|
-
const path = [...parentPath, m.name];
|
|
240
|
-
m.path = path;
|
|
241
|
-
result.modules.push(m);
|
|
242
|
-
if (m.subModules) {
|
|
243
|
-
flattenModules(m.subModules, path);
|
|
244
|
-
delete m.subModules; // 清理临时字段
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
flattenModules(topModules, ['mainflow']);
|
|
249
|
-
|
|
250
|
-
// ═══ 变量声明校验:编译器原则,未声明必须报错,不静默兜底 ═══
|
|
251
|
-
validateDeclarations(result, rep);
|
|
252
|
-
|
|
253
|
-
// ═══ 动作/作用域硬校验(2026-09-07 五类,与引擎 validate_action_syntax 对齐)═══
|
|
254
|
-
validateActionSyntax(result, rep);
|
|
255
|
-
|
|
256
|
-
// ═══ join 在环上警告(与引擎 validate_join_on_cycle 对齐,非阻断)═══
|
|
257
|
-
validateJoinOnCycle(result, text, rep);
|
|
258
|
-
|
|
259
|
-
// 报错链路收口:warning 全量挂 result.warnings({severity,line,lineText,
|
|
260
|
-
// message,where},其中 where/message 与引擎 script.warnings 两键对齐);
|
|
261
|
-
// error 若有(校验期聚合未抛的)在此统一抛出。
|
|
262
|
-
result.warnings = rep.warnings;
|
|
263
|
-
rep.throwIfErrors();
|
|
264
|
-
|
|
265
|
-
return result;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// join(all)/join(N) 的引擎现状是"等全部(N 个)上游到齐再放行"。若 join 的
|
|
269
|
-
// 目标节点位于流程环路上(能从目标出发绕回目标自己),环上的 fork 会先于
|
|
270
|
-
// join 发生、又只有 join
|
|
271
|
-
// 卡死(实锤:警长版被"图到文本"自动加 join(all) 后 DayPhase 永远进不去)。
|
|
272
|
-
// ⚠️ 前端图模型不建 join 节点(join(...) 按文档等价于普通多线,解析期摊平
|
|
273
|
-
// 成普通边),所以这里从**原文**扫描 join(...) 块拿目标节点,再到解析后的
|
|
274
|
-
// 图里查环。非阻断 warning:与引擎 add_warning 同语义,走统一报错链路
|
|
275
|
-
// (rep.warning),随 result.warnings 供 UI 展示;等引擎 join 语义修正
|
|
276
|
-
// (下一轮)后本警告可随之退役。
|
|
277
|
-
function validateJoinOnCycle(result, text, rep = null) {
|
|
278
|
-
rep = rep || createReporter();
|
|
279
|
-
const flows = [];
|
|
280
|
-
if (result.mainflow) flows.push({ edges: result.mainflow.edges, where: 'mainflow' });
|
|
281
|
-
for (const m of result.modules || []) {
|
|
282
|
-
flows.push({ edges: m.edges, where: `module ${m.name}` });
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function onCycle(targetLabel, edges) {
|
|
286
|
-
// 正向 BFS:从目标的后继出发,看能否绕回目标自己
|
|
287
|
-
const frontier = (edges || [])
|
|
288
|
-
.filter((e) => e.srcLabel === targetLabel)
|
|
289
|
-
.map((e) => e.tgtLabel);
|
|
290
|
-
const visited = new Set(frontier);
|
|
291
|
-
while (frontier.length) {
|
|
292
|
-
const nid = frontier.pop();
|
|
293
|
-
if (nid === targetLabel) return true;
|
|
294
|
-
for (const e of edges || []) {
|
|
295
|
-
if (e.srcLabel === nid && !visited.has(e.tgtLabel)) {
|
|
296
|
-
visited.add(e.tgtLabel);
|
|
297
|
-
frontier.push(e.tgtLabel);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const joinBlock = /join\s*\(([^)]*)\)\s*:\s*([\s\S]*?)to\s*\[([^\]]+)\]/g;
|
|
305
|
-
let m;
|
|
306
|
-
while ((m = joinBlock.exec(String(text || '')) ) !== null) {
|
|
307
|
-
const target = m[3].trim();
|
|
308
|
-
for (const f of flows) {
|
|
309
|
-
const known = new Set((f.edges || []).flatMap((e) => [e.srcLabel, e.tgtLabel]));
|
|
310
|
-
if (known.has(target) && onCycle(target, f.edges)) {
|
|
311
|
-
// 从命中位置反推 1-based 行号与出错行(原文正则扫描,无行对象可用)
|
|
312
|
-
const before = String(text || '').slice(0, m.index);
|
|
313
|
-
const line = before.split('\n').length;
|
|
314
|
-
const lineText = (text.slice(m.index).split('\n')[0] || '').trim();
|
|
315
|
-
rep.warning(
|
|
316
|
-
`join(...) 的目标 [${target}] 位于流程环路上(从它出发能绕回它自己)。` +
|
|
317
|
-
'当前引擎的 join 会等待上游到齐,而环路里的一部分上游只有 join 放行之后才会发生,' +
|
|
318
|
-
'
|
|
319
|
-
'(逐条 [A] -> [next],到即走),不要用 join(...):。',
|
|
320
|
-
{ line, lineText, where: f.where }
|
|
321
|
-
);
|
|
322
|
-
break; // 每个 join 块只报一条
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// ── 变量声明校验 ────────────────────────────────────────────
|
|
329
|
-
// 规则(与引擎一致):
|
|
330
|
-
// 1. for 循环变量必须已在 vars: 声明(如 @hero = "")
|
|
331
|
-
// 2. 条件表达式里的裸标识符必须是已声明变量 / actor / 循环变量,
|
|
332
|
-
// 字符串字面量必须带引号(== "ai" 而非 == ai)
|
|
333
|
-
const _RESERVED_WORDS = new Set([
|
|
334
|
-
'and', 'or', 'not', 'in', 'is',
|
|
335
|
-
'True', 'False', 'None', 'true', 'false', 'TRUE', 'FALSE',
|
|
336
|
-
]);
|
|
337
|
-
|
|
338
|
-
function _extractCondIdentifiers(cond) {
|
|
339
|
-
// 剥离字符串字面量(带引号的文本不算标识符)
|
|
340
|
-
const noStr = cond.replace(/"[^"]*"|'[^']*'/g, '""');
|
|
341
|
-
return noStr.match(/@?[\w\u4e00-\u9fff]+(?:\.[\w\u4e00-\u9fff]+)*/g) || [];
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function _mainIdent(ident) {
|
|
345
|
-
const dot = ident.indexOf('.');
|
|
346
|
-
return dot >= 0 ? ident.slice(0, dot) : ident;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
function _declName(raw) {
|
|
350
|
-
// 规范名:剥 $ 前缀、@ 保留(与后端编译器 split_spec_name 完全一致:
|
|
351
|
-
// '$x'→'x','$@a'→'@a','@a'→'@a','x'→'x')。
|
|
352
|
-
// 条件/for 提取(_extractCondIdentifiers 等)产出的是不带 $ 的裸标识符,
|
|
353
|
-
// 声明表若保留 $ 前缀会两头对不上——造成 "$game_over 已声明却被报
|
|
354
|
-
// 引用了未声明的变量 game_over" 的误报。声明名必须过此函数归一。
|
|
355
|
-
return raw.startsWith('$') ? raw.slice(1) : raw;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
function validateDeclarations(result, rep = null) {
|
|
359
|
-
rep = rep || createReporter();
|
|
360
|
-
const topVars = new Set((result.vars || []).map((v) => _declName(v.name)));
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
if (!
|
|
386
|
-
rep.fail(
|
|
387
|
-
`for
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
for (const
|
|
464
|
-
if (
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
//
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
//
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
} else if (
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
{
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
if (String(action.
|
|
612
|
-
rep.error(
|
|
613
|
-
`action "${action.name}"(${ctx})→ @notice
|
|
614
|
-
|
|
615
|
-
{ where: 'action 校验' }
|
|
616
|
-
);
|
|
617
|
-
}
|
|
618
|
-
if (String(action.
|
|
619
|
-
rep.error(
|
|
620
|
-
`action "${action.name}"(${ctx})→ @notice 不支持
|
|
621
|
-
|
|
622
|
-
{ where: 'action 校验' }
|
|
623
|
-
);
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
if (
|
|
639
|
-
rep.warning(
|
|
640
|
-
`action "${action.name}"(${ctx})→ @notice 的
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
{
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
if (
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
case '
|
|
854
|
-
meta.
|
|
855
|
-
break;
|
|
856
|
-
case '
|
|
857
|
-
meta.
|
|
858
|
-
break;
|
|
859
|
-
case '
|
|
860
|
-
meta.
|
|
861
|
-
break;
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
if (!
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
i
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
action.
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
i++;
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
if (
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
const
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
// 规则
|
|
1492
|
-
if (newIsConditional && hasAnyConditional) {
|
|
1493
|
-
const
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
label
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
label
|
|
1584
|
-
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
const parts =
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
if (
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
let
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
})
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
i
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
}
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
//
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
const
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
//
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
//
|
|
2057
|
-
if (
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
//
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
continue;
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
}
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════
|
|
2
|
+
// ═══ femoParser.jsx ═══
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
// 已注释死导入(观察期 2026-09-26):import { TYPES, SPECIAL_COLORS, actionId } from './common';(整行未使用)
|
|
6
|
+
// ═══ 统一报错链路(2026-09-07 解耦)═══
|
|
7
|
+
// parser 内所有语法检查点不再各自 throw new Error(手拼字符串),统一调
|
|
8
|
+
// reporter(femoDiagnostics.js):error 阻断(抛 FEMOSyntaxError)、warning
|
|
9
|
+
// 仅提醒(挂 result.warnings)。每条诊断固定携带 行号/出错行/信息/区域。
|
|
10
|
+
import { createReporter } from './femoDiagnostics';
|
|
11
|
+
|
|
12
|
+
// actor thinking 档位词汇全集(与 Python 编译器 FEMO_parser.THINKING_LEVELS 对齐,
|
|
13
|
+
// = pi-ai 的 ModelThinkingLevel;无 default 词——「默认」由不带 thinking 声明表达,
|
|
14
|
+
// 与 dsh 模型选择器 Default 项同语义:不发 reasoning_effort 字段,服务器自选)。
|
|
15
|
+
export const THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
16
|
+
|
|
17
|
+
function normalizeSymbols(str, context = 'global') {
|
|
18
|
+
let s = str;
|
|
19
|
+
// ═══ 全角符号标准化(注释剥离已由全局 stripComments 完成,此处不再处理注释)═══
|
|
20
|
+
if (context !== 'prompt') {
|
|
21
|
+
s = s
|
|
22
|
+
.replace(/:/g, ':')
|
|
23
|
+
.replace(/,/g, ',')
|
|
24
|
+
.replace(/“/g, '"')
|
|
25
|
+
.replace(/”/g, '"')
|
|
26
|
+
.replace(/(/g, '(')
|
|
27
|
+
.replace(/)/g, ')')
|
|
28
|
+
.replace(/【/g, '[')
|
|
29
|
+
.replace(/】/g, ']')
|
|
30
|
+
.replace(/|/g, '|');
|
|
31
|
+
}
|
|
32
|
+
// flow 区域额外:-- 替换为 ->
|
|
33
|
+
if (context === 'flow') {
|
|
34
|
+
s = s.replace(/--/g, '->');
|
|
35
|
+
}
|
|
36
|
+
return s;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ═══════════════════════════════════════════════════════════════
|
|
40
|
+
// ═══ 全局注释剥离(编译第一步)═══
|
|
41
|
+
// ═══════════════════════════════════════════════════════════════
|
|
42
|
+
// 除 prompt 文本块内部与字符串引号内部外,所有 `#` 与 `//` 连同其后内容
|
|
43
|
+
// 清空到行尾。行首缩进保留(块结构依赖缩进)。
|
|
44
|
+
|
|
45
|
+
// 引号感知的行级注释剥离
|
|
46
|
+
function stripLineComments(line) {
|
|
47
|
+
let out = '';
|
|
48
|
+
let quote = null;
|
|
49
|
+
for (let i = 0; i < line.length; i++) {
|
|
50
|
+
const c = line[i];
|
|
51
|
+
if (quote) {
|
|
52
|
+
out += c;
|
|
53
|
+
if (c === '\\' && i + 1 < line.length) {
|
|
54
|
+
out += line[i + 1];
|
|
55
|
+
i++;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (c === quote) quote = null;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (c === '"' || c === "'") {
|
|
62
|
+
quote = c;
|
|
63
|
+
out += c;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (c === '#') {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
if (c === '/' && line[i + 1] === '/') break;
|
|
70
|
+
out += c;
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 找出所有多行文本块 [start, end) 行区间:
|
|
76
|
+
// prompt: | / showprompt: |(action)以及 key = |(meta:system_safety 等)
|
|
77
|
+
function findPromptRanges(lines) {
|
|
78
|
+
const ranges = [];
|
|
79
|
+
let i = 0;
|
|
80
|
+
while (i < lines.length) {
|
|
81
|
+
const trimmed = lines[i].trim();
|
|
82
|
+
// 允许行尾带注释(全局剥离后该行会先被清成 prompt: |,此处宽松匹配)
|
|
83
|
+
const isMultiStart =
|
|
84
|
+
/^(?:prompt|showprompt):\s*[||]\s*(?:#.*)?$/.test(trimmed) ||
|
|
85
|
+
/^(?:@|\$@|\$)?[\w\u4e00-\u9fff]+\s*=\s*[||]\s*(?:#.*)?$/.test(trimmed);
|
|
86
|
+
if (isMultiStart) {
|
|
87
|
+
const fieldIndent = lines[i].length - lines[i].trimStart().length;
|
|
88
|
+
let j = i + 1;
|
|
89
|
+
while (j < lines.length) {
|
|
90
|
+
const t2 = lines[j].trim();
|
|
91
|
+
if (!t2) { j++; continue; } // 空行算 prompt 内容
|
|
92
|
+
const ind2 = lines[j].length - lines[j].trimStart().length;
|
|
93
|
+
if (ind2 <= fieldIndent) break; // 缩进回到字段层 → 块结束
|
|
94
|
+
j++;
|
|
95
|
+
}
|
|
96
|
+
ranges.push([i + 1, j]);
|
|
97
|
+
i = j;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
i++;
|
|
101
|
+
}
|
|
102
|
+
return ranges;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ═══════════════════════════════════════════════════════════════
|
|
106
|
+
// ═══ #sketch 注释块还原(编译第零步,必须先于 stripComments)═══
|
|
107
|
+
// ═══════════════════════════════════════════════════════════════
|
|
108
|
+
// 生成端把 sketch 块写成注释(每行行首加 #);这里检测 #sketch 标志,
|
|
109
|
+
// 把整个块取出、每行剥掉行首一个 #(# 后的空格即原缩进),还原为
|
|
110
|
+
// 普通 sketch: 块,再走正常链路解析。块内残余 #(手写注释)交由
|
|
111
|
+
// stripComments 正常去掉。
|
|
112
|
+
function extractHashSketch(lines) {
|
|
113
|
+
const out = [];
|
|
114
|
+
let i = 0;
|
|
115
|
+
while (i < lines.length) {
|
|
116
|
+
const raw = lines[i];
|
|
117
|
+
if (/^#\s*sketch\s*:/.test(raw)) {
|
|
118
|
+
out.push(raw.replace(/^#/, '')); // 标志行剥一个 # → sketch:
|
|
119
|
+
i++;
|
|
120
|
+
while (i < lines.length && /^#/.test(lines[i])) {
|
|
121
|
+
out.push(lines[i].replace(/^#/, '')); // 块内容行同样剥一个 #
|
|
122
|
+
i++;
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
out.push(raw);
|
|
126
|
+
i++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 全局注释剥离:parseFEMO 的第一步
|
|
133
|
+
function stripComments(lines) {
|
|
134
|
+
const ranges = findPromptRanges(lines);
|
|
135
|
+
return lines.map((raw, i) => {
|
|
136
|
+
for (const [s, e] of ranges) {
|
|
137
|
+
if (i >= s && i < e) return raw; // prompt 文本块:原样保留
|
|
138
|
+
}
|
|
139
|
+
return stripLineComments(raw);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// rep:统一报错链路入口(femoDiagnostics.createReporter 产物)。可外部传入
|
|
144
|
+
// 以收集诊断;缺省时内部自建。error → 抛 FEMOSyntaxError(阻断);warning →
|
|
145
|
+
// 汇入 result.warnings(不阻断)。
|
|
146
|
+
function parseFEMO(text, rep = null) {
|
|
147
|
+
rep = rep || createReporter();
|
|
148
|
+
// 编译第负一步:捕获 meta: 之前的文件头原文(作者的架构说明 / ⚠️ 备忘等注释)。
|
|
149
|
+
// 下一步 stripComments 会全局剥注释,preamble 必须抢在它之前从原文截取;
|
|
150
|
+
// buildFEMO 生成时原样回写到文件头(2026-09-12:编辑器保存曾把文件头注释剥掉)。
|
|
151
|
+
// 只认顶格的 meta: 行(模块内的 meta: 有缩进,不会误命中)。
|
|
152
|
+
const rawLines = text.split('\n');
|
|
153
|
+
const metaLineIdx = rawLines.findIndex((l) => /^meta:\s*$/.test(l));
|
|
154
|
+
const preamble = metaLineIdx > 0
|
|
155
|
+
? rawLines.slice(0, metaLineIdx).join('\n').replace(/\s+$/, '')
|
|
156
|
+
: '';
|
|
157
|
+
// 编译第零步:#sketch 注释块还原(必须先于全局去注释)
|
|
158
|
+
// 编译第一步:内存版全局去注释(# 和 // 到行尾;prompt 块与引号内豁免)
|
|
159
|
+
// 只处理内存副本,用户原文/窗口文本不受影响
|
|
160
|
+
const lines = stripComments(extractHashSketch(rawLines));
|
|
161
|
+
const blocks = splitTopBlocks(lines);
|
|
162
|
+
|
|
163
|
+
const result = {
|
|
164
|
+
meta: {
|
|
165
|
+
name: '',
|
|
166
|
+
version: '1.0',
|
|
167
|
+
owner: '',
|
|
168
|
+
database: '',
|
|
169
|
+
session: '',
|
|
170
|
+
system_safety: '',
|
|
171
|
+
output_style: '',
|
|
172
|
+
},
|
|
173
|
+
code: [],
|
|
174
|
+
context: [],
|
|
175
|
+
memory: [],
|
|
176
|
+
preamble, // meta: 之前的文件头原文(注释等),buildFEMO 原样回写
|
|
177
|
+
vars: [],
|
|
178
|
+
actors: [],
|
|
179
|
+
warnings: [], // 非阻断提示(rep.warnings 诊断:行号/出错行/信息/区域)——与引擎 script.warnings 对齐
|
|
180
|
+
actions: [],
|
|
181
|
+
modules: [],
|
|
182
|
+
mainflow: { nodeDecls: [], edges: [] },
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
let mainflowSketch = null; // 容错:顶层 sketch: 块(与 mainflow 同级)
|
|
186
|
+
|
|
187
|
+
for (const block of blocks) {
|
|
188
|
+
const h = block.header;
|
|
189
|
+
if (h === 'meta:') {
|
|
190
|
+
result.meta = parseMetaBlock(block.contentLines, rep);
|
|
191
|
+
} else if (h === 'code:') {
|
|
192
|
+
result.code = parseCodeBlock(block.contentLines, rep);
|
|
193
|
+
} else if (h === 'vars:') {
|
|
194
|
+
result.vars = parseVarsBlock(block.contentLines, rep);
|
|
195
|
+
} else if (h === 'actors:') {
|
|
196
|
+
result.actors = parseActorsBlock(block.contentLines, rep);
|
|
197
|
+
} else if (h.startsWith('memory ')) {
|
|
198
|
+
result.memory.push(
|
|
199
|
+
parseMemoryOrContextBlock(h, block.contentLines, 'memory', rep, block.headerLineNum)
|
|
200
|
+
);
|
|
201
|
+
} else if (h.startsWith('context ')) {
|
|
202
|
+
result.context.push(
|
|
203
|
+
parseMemoryOrContextBlock(h, block.contentLines, 'context', rep, block.headerLineNum)
|
|
204
|
+
);
|
|
205
|
+
} else if (h.startsWith('action ')) {
|
|
206
|
+
result.actions.push(parseActionBlock(h, block.contentLines, rep, block.headerLineNum));
|
|
207
|
+
} else if (h.startsWith('module ')) {
|
|
208
|
+
result.modules.push(parseModuleBlock(h, block.contentLines, rep, block.headerLineNum));
|
|
209
|
+
} else if (h === 'sketch:') {
|
|
210
|
+
// 暂存顶层草图,待 mainflow 解析后合并
|
|
211
|
+
mainflowSketch = parseLayoutBlock(block.contentLines);
|
|
212
|
+
} else if (h === 'mainflow:' || h === 'flow:') {
|
|
213
|
+
// flow: 与 mainflow: 等价(编译器 build_blocks 均归为 flow 块)
|
|
214
|
+
result.mainflow = parseMainflowBlock(block.contentLines, rep);
|
|
215
|
+
// 如果有与 mainflow 同级的 sketch 块,合并布局(外部覆盖内部)
|
|
216
|
+
if (mainflowSketch) {
|
|
217
|
+
result.mainflow.layout = { ...result.mainflow.layout, ...mainflowSketch };
|
|
218
|
+
mainflowSketch = null;
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
rep.fail(
|
|
222
|
+
`未识别的顶层块: "${h}"。期望: meta:, code:, vars:, actors:, context:, memory:, action ..., module ..., mainflow:`,
|
|
223
|
+
{ line: (block.headerLineNum ?? -1) + 1, lineText: h, where: '顶层' }
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// 如果 sketch 在 mainflow 之前就已经读到,但 mainflow 始终未出现,则丢弃(不报错)
|
|
229
|
+
// 如果 mainflow 已解析但之后还有 sketch 块,同样合并
|
|
230
|
+
if (mainflowSketch && result.mainflow) {
|
|
231
|
+
result.mainflow.layout = { ...result.mainflow.layout, ...mainflowSketch };
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 展平嵌套模块,为每个模块生成层级 path(从 mainflow 起)
|
|
235
|
+
const topModules = result.modules;
|
|
236
|
+
result.modules = [];
|
|
237
|
+
function flattenModules(mods, parentPath) {
|
|
238
|
+
for (const m of mods) {
|
|
239
|
+
const path = [...parentPath, m.name];
|
|
240
|
+
m.path = path;
|
|
241
|
+
result.modules.push(m);
|
|
242
|
+
if (m.subModules) {
|
|
243
|
+
flattenModules(m.subModules, path);
|
|
244
|
+
delete m.subModules; // 清理临时字段
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
flattenModules(topModules, ['mainflow']);
|
|
249
|
+
|
|
250
|
+
// ═══ 变量声明校验:编译器原则,未声明必须报错,不静默兜底 ═══
|
|
251
|
+
validateDeclarations(result, rep);
|
|
252
|
+
|
|
253
|
+
// ═══ 动作/作用域硬校验(2026-09-07 五类,与引擎 validate_action_syntax 对齐)═══
|
|
254
|
+
validateActionSyntax(result, rep);
|
|
255
|
+
|
|
256
|
+
// ═══ join 在环上警告(与引擎 validate_join_on_cycle 对齐,非阻断)═══
|
|
257
|
+
validateJoinOnCycle(result, text, rep);
|
|
258
|
+
|
|
259
|
+
// 报错链路收口:warning 全量挂 result.warnings({severity,line,lineText,
|
|
260
|
+
// message,where},其中 where/message 与引擎 script.warnings 两键对齐);
|
|
261
|
+
// error 若有(校验期聚合未抛的)在此统一抛出。
|
|
262
|
+
result.warnings = rep.warnings;
|
|
263
|
+
rep.throwIfErrors();
|
|
264
|
+
|
|
265
|
+
return result;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// join(all)/join(N) 的引擎现状是"等全部(N 个)上游到齐再放行"。若 join 的
|
|
269
|
+
// 目标节点位于流程环路上(能从目标出发绕回目标自己),环上的 fork 会先于
|
|
270
|
+
// join 发生、又只有 join 放行后才会再发生——等待集永远凑不齐,FEMO脚本必然无声
|
|
271
|
+
// 卡死(实锤:警长版被"图到文本"自动加 join(all) 后 DayPhase 永远进不去)。
|
|
272
|
+
// ⚠️ 前端图模型不建 join 节点(join(...) 按文档等价于普通多线,解析期摊平
|
|
273
|
+
// 成普通边),所以这里从**原文**扫描 join(...) 块拿目标节点,再到解析后的
|
|
274
|
+
// 图里查环。非阻断 warning:与引擎 add_warning 同语义,走统一报错链路
|
|
275
|
+
// (rep.warning),随 result.warnings 供 UI 展示;等引擎 join 语义修正
|
|
276
|
+
// (下一轮)后本警告可随之退役。
|
|
277
|
+
function validateJoinOnCycle(result, text, rep = null) {
|
|
278
|
+
rep = rep || createReporter();
|
|
279
|
+
const flows = [];
|
|
280
|
+
if (result.mainflow) flows.push({ edges: result.mainflow.edges, where: 'mainflow' });
|
|
281
|
+
for (const m of result.modules || []) {
|
|
282
|
+
flows.push({ edges: m.edges, where: `module ${m.name}` });
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function onCycle(targetLabel, edges) {
|
|
286
|
+
// 正向 BFS:从目标的后继出发,看能否绕回目标自己
|
|
287
|
+
const frontier = (edges || [])
|
|
288
|
+
.filter((e) => e.srcLabel === targetLabel)
|
|
289
|
+
.map((e) => e.tgtLabel);
|
|
290
|
+
const visited = new Set(frontier);
|
|
291
|
+
while (frontier.length) {
|
|
292
|
+
const nid = frontier.pop();
|
|
293
|
+
if (nid === targetLabel) return true;
|
|
294
|
+
for (const e of edges || []) {
|
|
295
|
+
if (e.srcLabel === nid && !visited.has(e.tgtLabel)) {
|
|
296
|
+
visited.add(e.tgtLabel);
|
|
297
|
+
frontier.push(e.tgtLabel);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const joinBlock = /join\s*\(([^)]*)\)\s*:\s*([\s\S]*?)to\s*\[([^\]]+)\]/g;
|
|
305
|
+
let m;
|
|
306
|
+
while ((m = joinBlock.exec(String(text || '')) ) !== null) {
|
|
307
|
+
const target = m[3].trim();
|
|
308
|
+
for (const f of flows) {
|
|
309
|
+
const known = new Set((f.edges || []).flatMap((e) => [e.srcLabel, e.tgtLabel]));
|
|
310
|
+
if (known.has(target) && onCycle(target, f.edges)) {
|
|
311
|
+
// 从命中位置反推 1-based 行号与出错行(原文正则扫描,无行对象可用)
|
|
312
|
+
const before = String(text || '').slice(0, m.index);
|
|
313
|
+
const line = before.split('\n').length;
|
|
314
|
+
const lineText = (text.slice(m.index).split('\n')[0] || '').trim();
|
|
315
|
+
rep.warning(
|
|
316
|
+
`join(...) 的目标 [${target}] 位于流程环路上(从它出发能绕回它自己)。` +
|
|
317
|
+
'当前引擎的 join 会等待上游到齐,而环路里的一部分上游只有 join 放行之后才会发生,' +
|
|
318
|
+
'这会让FEMO脚本永远等待下去。请把循环里的合流改成普通多线汇入' +
|
|
319
|
+
'(逐条 [A] -> [next],到即走),不要用 join(...):。',
|
|
320
|
+
{ line, lineText, where: f.where }
|
|
321
|
+
);
|
|
322
|
+
break; // 每个 join 块只报一条
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ── 变量声明校验 ────────────────────────────────────────────
|
|
329
|
+
// 规则(与引擎一致):
|
|
330
|
+
// 1. for 循环变量必须已在 vars: 声明(如 @hero = "")
|
|
331
|
+
// 2. 条件表达式里的裸标识符必须是已声明变量 / actor / 循环变量,
|
|
332
|
+
// 字符串字面量必须带引号(== "ai" 而非 == ai)
|
|
333
|
+
const _RESERVED_WORDS = new Set([
|
|
334
|
+
'and', 'or', 'not', 'in', 'is',
|
|
335
|
+
'True', 'False', 'None', 'true', 'false', 'TRUE', 'FALSE',
|
|
336
|
+
]);
|
|
337
|
+
|
|
338
|
+
function _extractCondIdentifiers(cond) {
|
|
339
|
+
// 剥离字符串字面量(带引号的文本不算标识符)
|
|
340
|
+
const noStr = cond.replace(/"[^"]*"|'[^']*'/g, '""');
|
|
341
|
+
return noStr.match(/@?[\w\u4e00-\u9fff]+(?:\.[\w\u4e00-\u9fff]+)*/g) || [];
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function _mainIdent(ident) {
|
|
345
|
+
const dot = ident.indexOf('.');
|
|
346
|
+
return dot >= 0 ? ident.slice(0, dot) : ident;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function _declName(raw) {
|
|
350
|
+
// 规范名:剥 $ 前缀、@ 保留(与后端编译器 split_spec_name 完全一致:
|
|
351
|
+
// '$x'→'x','$@a'→'@a','@a'→'@a','x'→'x')。
|
|
352
|
+
// 条件/for 提取(_extractCondIdentifiers 等)产出的是不带 $ 的裸标识符,
|
|
353
|
+
// 声明表若保留 $ 前缀会两头对不上——造成 "$game_over 已声明却被报
|
|
354
|
+
// 引用了未声明的变量 game_over" 的误报。声明名必须过此函数归一。
|
|
355
|
+
return raw.startsWith('$') ? raw.slice(1) : raw;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function validateDeclarations(result, rep = null) {
|
|
359
|
+
rep = rep || createReporter();
|
|
360
|
+
const topVars = new Set((result.vars || []).map((v) => _declName(v.name)));
|
|
361
|
+
// 预定义变量 all / allAI / allHUMAN(与引擎 parse_script 自动补声明对齐,
|
|
362
|
+
// 2026-10-04):all=全部角色名、allAI=全部 AI 角色、allHUMAN=全部人类角色,
|
|
363
|
+
// 条件裸名 / for 迭代器按已声明放行。作者在 vars: 显式声明(含 $ 前缀)
|
|
364
|
+
// 时以作者为准(引擎同款守卫——但校验语义上「已声明」两头一致,此处无需分支)。
|
|
365
|
+
topVars.add('all');
|
|
366
|
+
topVars.add('allAI');
|
|
367
|
+
topVars.add('allHUMAN');
|
|
368
|
+
const actors = new Set((result.actors || []).map((a) => a.name));
|
|
369
|
+
const moduleVars = new Map();
|
|
370
|
+
for (const m of result.modules || []) {
|
|
371
|
+
moduleVars.set(m.name, new Set((m.vars || []).map((v) => _declName(v.name))));
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function validateFlow(nodeDecls, edges, ctxName, moduleName) {
|
|
375
|
+
const scopeVars = new Set(topVars);
|
|
376
|
+
if (moduleName && moduleVars.has(moduleName)) {
|
|
377
|
+
for (const n of moduleVars.get(moduleName)) scopeVars.add(n);
|
|
378
|
+
}
|
|
379
|
+
const loopVars = new Set();
|
|
380
|
+
|
|
381
|
+
// 1) for 循环变量与迭代器声明检查
|
|
382
|
+
for (const d of nodeDecls || []) {
|
|
383
|
+
if (d.specialType === 'FOR' && d.forCondition) {
|
|
384
|
+
const m = d.forCondition.match(/^(@?[\w\u4e00-\u9fff]+)\s+in\s+(.+)$/);
|
|
385
|
+
if (!m) {
|
|
386
|
+
rep.fail(
|
|
387
|
+
`for 条件格式错误: "${d.forCondition}"。期望: for @var in list`,
|
|
388
|
+
{ where: ctxName }
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
const loopVar = m[1];
|
|
392
|
+
if (!scopeVars.has(loopVar)) {
|
|
393
|
+
rep.fail(
|
|
394
|
+
`for 循环变量 "${loopVar}" 未在 vars: 中声明(for 条件: "${d.forCondition}")。` +
|
|
395
|
+
`所有循环变量必须在 vars: 中预先声明,例如: ${loopVar} = ""`,
|
|
396
|
+
{ where: ctxName }
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
loopVars.add(loopVar);
|
|
400
|
+
const iterable = m[2].trim();
|
|
401
|
+
if (/^@?[\w\u4e00-\u9fff]+$/.test(iterable) && !scopeVars.has(iterable)) {
|
|
402
|
+
rep.fail(
|
|
403
|
+
`for 迭代器 "${iterable}" 未在 vars: 中声明(for 条件: "${d.forCondition}")`,
|
|
404
|
+
{ where: ctxName }
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// 2) 条件表达式里的裸标识符检查
|
|
411
|
+
const known = new Set([...scopeVars, ...actors, ...loopVars]);
|
|
412
|
+
for (const e of edges || []) {
|
|
413
|
+
if (!e.cond) continue;
|
|
414
|
+
for (const ident of _extractCondIdentifiers(e.cond)) {
|
|
415
|
+
if (_RESERVED_WORDS.has(ident)) continue;
|
|
416
|
+
const main = _mainIdent(ident);
|
|
417
|
+
if (/^\d+(\.\d+)?$/.test(main)) continue; // 数字字面量
|
|
418
|
+
if (main.startsWith('@')) {
|
|
419
|
+
if (!actors.has(main) && !scopeVars.has(main) && !loopVars.has(main)) {
|
|
420
|
+
rep.fail(
|
|
421
|
+
`条件 "${e.cond}" 引用了未声明的 actor/变量 "${main}"(边 ${e.srcLabel} -> ${e.tgtLabel})`,
|
|
422
|
+
{ where: ctxName }
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
} else if (!known.has(main)) {
|
|
426
|
+
rep.fail(
|
|
427
|
+
`条件 "${e.cond}" 引用了未声明的变量 "${main}"(边 ${e.srcLabel} -> ${e.tgtLabel})。` +
|
|
428
|
+
`字符串字面量请加引号,如 == "ai";所有变量须在 vars: 中声明`,
|
|
429
|
+
{ where: ctxName }
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// 3) 回流检测:回到「多条无条件出边」的节点会导致分支数爆炸——
|
|
436
|
+
// 每次回到这里往下运行都会从一变成多分支。条件出边(if 分流)
|
|
437
|
+
// 回流是安全的(只走为真的分支),不检测;for/par/fork/join 网关
|
|
438
|
+
// 的多出边是迭代/并发语义,跳过;重复边去重(par 出口链可能重复)。
|
|
439
|
+
const seenEdges = new Set();
|
|
440
|
+
const uniqEdges = (edges || []).filter((e) => {
|
|
441
|
+
const key = `${e.srcLabel}\u0000${e.tgtLabel}\u0000${e.cond || ''}`;
|
|
442
|
+
if (seenEdges.has(key)) return false;
|
|
443
|
+
seenEdges.add(key);
|
|
444
|
+
return true;
|
|
445
|
+
});
|
|
446
|
+
// 「回到」= 入边来自流程内部;入口启动边([START]/[IN] 出发)不算。
|
|
447
|
+
// 【2026-09-06 修复】边 label 存的是剥括号形态('IN'/'START',见
|
|
448
|
+
// chainMatch/resolveTarget),原先按 '[IN]'/'[START]' 带括号比较恒不
|
|
449
|
+
// 相等 → 入口排除成死代码,「入口直连多出边」这一最常见形态全部误报
|
|
450
|
+
// (module chat 的 [hub] 即此误报)。比较前统一剥括号,两种形态都兜住。
|
|
451
|
+
const entrySrc = (s) => String(s ?? '').replace(/^\[|\]$/g, '');
|
|
452
|
+
const hasIn = new Set(
|
|
453
|
+
uniqEdges
|
|
454
|
+
.filter((e) => entrySrc(e.srcLabel) !== 'START' && entrySrc(e.srcLabel) !== 'IN')
|
|
455
|
+
.map((e) => e.tgtLabel)
|
|
456
|
+
);
|
|
457
|
+
const gatewayNames = new Set(
|
|
458
|
+
(nodeDecls || [])
|
|
459
|
+
.filter((d) => d.specialType === 'FOR' || d.specialType === 'PAR' || d.specialType === 'FORK' || d.specialType === 'JOIN')
|
|
460
|
+
.map((d) => d.label)
|
|
461
|
+
);
|
|
462
|
+
const unconditionalOuts = new Map();
|
|
463
|
+
for (const e of uniqEdges) {
|
|
464
|
+
if (!e.cond) {
|
|
465
|
+
const list = unconditionalOuts.get(e.srcLabel) || [];
|
|
466
|
+
list.push(e.tgtLabel);
|
|
467
|
+
unconditionalOuts.set(e.srcLabel, list);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
for (const [src, tgts] of unconditionalOuts) {
|
|
471
|
+
if (gatewayNames.has(src)) continue;
|
|
472
|
+
if (tgts.length >= 2 && hasIn.has(src)) {
|
|
473
|
+
// 【2026-09-07 用户拍板】编译期不再阻断回流(分支数爆炸)场景:
|
|
474
|
+
// 原为 throw 拦截前端解析/画布恢复/运行,现改为不阻断——用户坚持运行则应能跑。
|
|
475
|
+
// 以后改成 warning(提示但不阻断);保留原报错信息留档,勿删。
|
|
476
|
+
// throw new Error(
|
|
477
|
+
// `${ctxName}: 节点 [${src}] 有多个出边,不能回到这种节点。` +
|
|
478
|
+
// `原因是,每次回到这里往下运行都会从一变成多分支,分支数会爆炸。` +
|
|
479
|
+
// `建议在本节点之后的分支中加空节点,让他们回到空节点。`
|
|
480
|
+
// );
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
validateFlow(result.mainflow.nodeDecls, result.mainflow.edges, 'mainflow', null);
|
|
486
|
+
for (const m of result.modules || []) {
|
|
487
|
+
validateFlow(m.nodeDecls, m.edges, `module ${m.name}`, m.name);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// ── 动作/作用域硬校验(2026-09-07,与引擎 FEMO_parser.validate_action_syntax 逐条对齐)──
|
|
492
|
+
// 五类此前被静默吞掉的语法错误,前端直接判 error 提示(前端与引擎是两份独立的
|
|
493
|
+
// 语法检查:前端不带引擎可出图,引擎不带前端可跑,两边都要报、不遗漏):
|
|
494
|
+
// ① @func 缺少"模块别名.函数名"(@func: / @func() / @func(别名))
|
|
495
|
+
// ② in: 项缺 "= 变量表达式" 映射(裸项,多行/单行都查)
|
|
496
|
+
// ③ scope 引用不存在的角色(@名 不在 actors 也不是已声明变量)
|
|
497
|
+
// ④ scope 格式错误(self 与其他目标混用;多目标未加方括号)
|
|
498
|
+
// ⑤ 变量名与 Python 保留字冲突(vars:/out: 目标/in: 左侧/for·par 循环变量)
|
|
499
|
+
|
|
500
|
+
const _PY_KEYWORDS = new Set([
|
|
501
|
+
'False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await',
|
|
502
|
+
'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except',
|
|
503
|
+
'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is',
|
|
504
|
+
'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return',
|
|
505
|
+
'try', 'while', 'with', 'yield',
|
|
506
|
+
]);
|
|
507
|
+
|
|
508
|
+
function _stripSpecName(name) {
|
|
509
|
+
// 剥 $/@ 前缀('$alive'→'alive','@狼人'→'狼人'),与引擎 _strip_spec_name 一致
|
|
510
|
+
return String(name || '').replace(/^[$@]+/, '').trim();
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function _outTargetRoot(raw) {
|
|
514
|
+
// out: 项原文 → 赋值目标根名('day += 1'→'day';'hp.@x(string,"xx")'→'hp')
|
|
515
|
+
let t = String(raw || '').trim().replace(/,+$/, '').trim();
|
|
516
|
+
t = t.replace(/\([^)]*\)\s*$/, '').trim(); // 剥尾部类型标签
|
|
517
|
+
t = t.split(/\+=|-=|=(?!=)/)[0].trim(); // 剥赋值运算符及右侧
|
|
518
|
+
return _stripSpecName(t);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function _splitInItems(inMappings) {
|
|
522
|
+
// inMappings 是字符串(多行用 \n 连接,单行可能逗号分隔)→ 项数组
|
|
523
|
+
const items = [];
|
|
524
|
+
for (const line of String(inMappings || '').split('\n')) {
|
|
525
|
+
for (const piece of line.split(',')) {
|
|
526
|
+
const t = piece.trim().replace(/,+$/, '').trim();
|
|
527
|
+
if (t) items.push(t);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return items;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function validateActionSyntax(result, rep = null) {
|
|
534
|
+
rep = rep || createReporter();
|
|
535
|
+
const actors = new Set((result.actors || []).map((a) => a.name));
|
|
536
|
+
const topScopeVars = new Set((result.vars || []).map((v) => _stripSpecName(v.name)));
|
|
537
|
+
|
|
538
|
+
function checkScope(rawScope, scopeVars, ctx) {
|
|
539
|
+
const s = String(rawScope || '').trim();
|
|
540
|
+
if (!s || s.toLowerCase() === 'all' || s.toLowerCase() === 'self') return;
|
|
541
|
+
// ② self 与其他目标混用
|
|
542
|
+
if (/\bself\b/i.test(s)) {
|
|
543
|
+
rep.error(
|
|
544
|
+
`${ctx}: scope: ${s} → "self" 只能单独使用(scope: self = 仅发言者可见);` +
|
|
545
|
+
`多目标请写成方括号列表,如 scope: [@上帝, @player]`,
|
|
546
|
+
{ where: 'action 校验' }
|
|
547
|
+
);
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
for (const part of s.split('+')) {
|
|
551
|
+
const p = part.trim();
|
|
552
|
+
if (!p) continue;
|
|
553
|
+
if (p.startsWith('[')) {
|
|
554
|
+
if (!p.endsWith(']')) {
|
|
555
|
+
rep.error(`${ctx}: scope: ${s} → 方括号不闭合,请检查列表格式`, { where: 'action 校验' });
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
for (const item of p.slice(1, -1).split(/[,,]/)) {
|
|
559
|
+
const it = item.trim();
|
|
560
|
+
if (!it) continue;
|
|
561
|
+
if (it.startsWith('{') && it.endsWith('}')) continue; // 花括号动态项交运行期
|
|
562
|
+
if (it.startsWith('@')) {
|
|
563
|
+
// ③ 引用不存在的角色/变量
|
|
564
|
+
if (!actors.has(it) && !scopeVars.has(_stripSpecName(it))) {
|
|
565
|
+
rep.error(
|
|
566
|
+
`${ctx}: scope: ${s} → "${it}" 不是已声明的角色,也不是已声明的变量。` +
|
|
567
|
+
`可用角色:${[...actors].sort().join(' / ') || '(无)'}`,
|
|
568
|
+
{ where: 'action 校验' }
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
} else if (!scopeVars.has(it)) {
|
|
572
|
+
rep.error(
|
|
573
|
+
`${ctx}: scope: ${s} → "${it}" 未在 vars: 中声明` +
|
|
574
|
+
`(scope 列表里的名字必须是角色 @名 或已声明变量)`,
|
|
575
|
+
{ where: 'action 校验' }
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
} else if (/[,,]/.test(p)) {
|
|
580
|
+
// ② 多目标未加方括号
|
|
581
|
+
const suggestion = '[' + p.split(/[,,]/).map((x) => x.trim()).join(', ') + ']';
|
|
582
|
+
rep.error(
|
|
583
|
+
`${ctx}: scope: ${s} → 多个目标必须用方括号列表包裹,请写成 scope: ${suggestion}`,
|
|
584
|
+
{ where: 'action 校验' }
|
|
585
|
+
);
|
|
586
|
+
} else if (!scopeVars.has(p) && !scopeVars.has(_stripSpecName(p))) {
|
|
587
|
+
rep.error(
|
|
588
|
+
`${ctx}: scope: ${s} → "${p}" 未在 vars: 中声明` +
|
|
589
|
+
`(裸名按变量解析,必须先在 vars: 声明;角色请带 @)`,
|
|
590
|
+
{ where: 'action 校验' }
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function checkAction(action, scopeVars, ctx) {
|
|
597
|
+
// ① @func 必须带 模块别名.函数名
|
|
598
|
+
if (action.executorType === 'func') {
|
|
599
|
+
const param = String(action.executorActor || '').trim();
|
|
600
|
+
if (!/^[\w\u4e00-\u9fff]+\.[\w\u4e00-\u9fff]+$/.test(param)) {
|
|
601
|
+
rep.error(
|
|
602
|
+
`action "${action.name}"(${ctx})→ @func 缺少"模块别名.函数名"。` +
|
|
603
|
+
`必须写成 @func(模块别名.函数名),别名在 code: 区声明。示例:@func(werewolf_utils.get_order)`,
|
|
604
|
+
{ where: 'action 校验' }
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
// ⑥ @notice 分级校验(与引擎 validate_action_syntax 镜像):
|
|
609
|
+
// error = 静默错误行为;warning = 惰性死配置
|
|
610
|
+
if (action.executorType === 'notice') {
|
|
611
|
+
if (!String(action.prompt || '').trim()) {
|
|
612
|
+
rep.error(
|
|
613
|
+
`action "${action.name}"(${ctx})→ @notice 的 prompt 为空。` +
|
|
614
|
+
`公告节点必须要有 prompt(它就是注入上下文的公告本体)`,
|
|
615
|
+
{ where: 'action 校验' }
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
if (String(action.outVars || '').trim()) {
|
|
619
|
+
rep.error(
|
|
620
|
+
`action "${action.name}"(${ctx})→ @notice 不支持 out:。` +
|
|
621
|
+
`公告节点没有回答者,out 声明的变量永远不会被赋值,赋值请用 @assign 或让 AI/human 输出`,
|
|
622
|
+
{ where: 'action 校验' }
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
if (String(action.resolve || '').trim()) {
|
|
626
|
+
rep.error(
|
|
627
|
+
`action "${action.name}"(${ctx})→ @notice 不支持 resolve:。` +
|
|
628
|
+
`公告节点没有回答者,校验函数永远不会被调用`,
|
|
629
|
+
{ where: 'action 校验' }
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
const inert = [];
|
|
633
|
+
if (String(action.memory || '').trim()) inert.push('memory:');
|
|
634
|
+
if (String(action.context || '').trim()) inert.push('context:');
|
|
635
|
+
if (String(action.showprompt || '').trim()) inert.push('showprompt:');
|
|
636
|
+
if (action.max_retries) inert.push('max_retries:');
|
|
637
|
+
if (String(action.fallback || '').trim()) inert.push('fallback:');
|
|
638
|
+
if (inert.length) {
|
|
639
|
+
rep.warning(
|
|
640
|
+
`action "${action.name}"(${ctx})→ @notice 的 ${inert.join(' / ')} 不生效:` +
|
|
641
|
+
`公告节点无回答者(惰性死配置,知情即可)`,
|
|
642
|
+
{ where: 'action 校验' }
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
if (String(action.scope || '').trim().toLowerCase() === 'self') {
|
|
646
|
+
rep.warning(
|
|
647
|
+
`action "${action.name}"(${ctx})→ @notice 的 scope: self = 仅 meta.owner 可见(公告无发言者)`,
|
|
648
|
+
{ where: 'action 校验' }
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
if (String(action.executorActor || '').trim()) {
|
|
652
|
+
rep.warning(
|
|
653
|
+
`action "${action.name}"(${ctx})→ @notice 的执行者参数被整体忽略(公告没有发言者),保存时会剥掉`,
|
|
654
|
+
{ where: 'action 校验' }
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
// ② in: 裸项 + ⑤ in: 左侧保留字
|
|
659
|
+
const items = _splitInItems(action.inMappings);
|
|
660
|
+
const bare = items.filter((it) => !it.includes('='));
|
|
661
|
+
if (bare.length > 0) {
|
|
662
|
+
rep.error(
|
|
663
|
+
`action "${action.name}"(${ctx})→ in: 项缺少 "= 变量表达式" 映射:` +
|
|
664
|
+
`${bare.join(', ')}。in: 的每一项必须是 "参数名 = 变量表达式",例如 in: from_ = speak_from`,
|
|
665
|
+
{ where: 'action 校验' }
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
for (const it of items) {
|
|
669
|
+
const left = it.split('=')[0].trim();
|
|
670
|
+
if (_PY_KEYWORDS.has(_stripSpecName(left))) {
|
|
671
|
+
rep.error(
|
|
672
|
+
`action "${action.name}"(${ctx})→ in: 参数名 "${_stripSpecName(left)}" ` +
|
|
673
|
+
`是 Python 保留字,不能用作参数名,请改名`,
|
|
674
|
+
{ where: 'action 校验' }
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
// ⑤ out: 目标保留字 + 括号标注检查(2026-09-29 二刀拍板,与引擎
|
|
679
|
+
// _parse_out_multi 同一规则:括号里只认 required/optional,旧
|
|
680
|
+
// (类型, "标签") 写法废除)
|
|
681
|
+
for (const line of String(action.outVars || '').split('\n')) {
|
|
682
|
+
for (const item of line.split(',')) {
|
|
683
|
+
const target = _outTargetRoot(item);
|
|
684
|
+
if (_PY_KEYWORDS.has(target)) {
|
|
685
|
+
rep.error(
|
|
686
|
+
`action "${action.name}"(${ctx})→ out: 目标 "${target}" ` +
|
|
687
|
+
`是 Python 保留字,不能用作变量名,请改名`,
|
|
688
|
+
{ where: 'action 校验' }
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
const pm = String(item || '').trim().match(/^([$\w.{}@]+)\(([^)]*)\)(.*)$/);
|
|
692
|
+
if (pm) {
|
|
693
|
+
const key = pm[2].trim().replace(/^["']+|["']+$/g, '').toLowerCase();
|
|
694
|
+
if (pm[3].trim() || (key !== 'required' && key !== 'optional')) {
|
|
695
|
+
rep.error(
|
|
696
|
+
`action "${action.name}"(${ctx})→ out: 项 "${item.trim()}" ` +
|
|
697
|
+
`不支持括号标注:括号里只认 required/optional(如 name(required)),` +
|
|
698
|
+
`直接写变量名即可`,
|
|
699
|
+
{ where: 'action 校验' }
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
// ③④ scope
|
|
706
|
+
checkScope(action.scope, scopeVars, `action "${action.name}"(${ctx})`);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
for (const action of result.actions || []) {
|
|
710
|
+
checkAction(action, topScopeVars, '顶层');
|
|
711
|
+
}
|
|
712
|
+
for (const m of result.modules || []) {
|
|
713
|
+
const scopeVars = new Set([...topScopeVars, ...((m.vars || []).map((v) => _stripSpecName(v.name)))]);
|
|
714
|
+
const ctx = `module ${m.name}`;
|
|
715
|
+
for (const action of m.actions || []) {
|
|
716
|
+
checkAction(action, scopeVars, ctx);
|
|
717
|
+
}
|
|
718
|
+
// ⑤ for/par 循环变量保留字
|
|
719
|
+
for (const d of m.nodeDecls || []) {
|
|
720
|
+
if ((d.specialType === 'FOR' || d.specialType === 'PAR') && d.forCondition) {
|
|
721
|
+
const match = d.forCondition.match(/^(@?[\w\u4e00-\u9fff]+)\s+in\s+/);
|
|
722
|
+
if (match && _PY_KEYWORDS.has(_stripSpecName(match[1]))) {
|
|
723
|
+
rep.error(
|
|
724
|
+
`${ctx} 循环变量 "${_stripSpecName(match[1])}" 是 Python 保留字,不能用作循环变量名,请改名`,
|
|
725
|
+
{ where: 'action 校验' }
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
// ⑤ 顶层 for/par 循环变量保留字
|
|
732
|
+
for (const d of (result.mainflow && result.mainflow.nodeDecls) || []) {
|
|
733
|
+
if ((d.specialType === 'FOR' || d.specialType === 'PAR') && d.forCondition) {
|
|
734
|
+
const match = d.forCondition.match(/^(@?[\w\u4e00-\u9fff]+)\s+in\s+/);
|
|
735
|
+
if (match && _PY_KEYWORDS.has(_stripSpecName(match[1]))) {
|
|
736
|
+
rep.error(
|
|
737
|
+
`mainflow 循环变量 "${_stripSpecName(match[1])}" 是 Python 保留字,不能用作循环变量名,请改名`,
|
|
738
|
+
{ where: 'action 校验' }
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
// ⑤ vars: 声明保留字
|
|
744
|
+
const varDecls = [...(result.vars || [])];
|
|
745
|
+
for (const m of result.modules || []) {
|
|
746
|
+
for (const v of m.vars || []) varDecls.push(v);
|
|
747
|
+
}
|
|
748
|
+
for (const v of varDecls) {
|
|
749
|
+
if (_PY_KEYWORDS.has(_stripSpecName(v.name))) {
|
|
750
|
+
rep.error(
|
|
751
|
+
`vars: 变量名 "${_stripSpecName(v.name)}" 是 Python 保留字,不能用作变量名,请换一个不冲突的名字`,
|
|
752
|
+
{ where: 'action 校验' }
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// 收集到的 error 聚合抛出(一条则单条直抛,多条带计数头)
|
|
758
|
+
rep.throwIfErrors('编译错误:脚本语法检查未通过');
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function splitTopBlocks(lines) {
|
|
762
|
+
const blocks = [];
|
|
763
|
+
let current = null;
|
|
764
|
+
for (let i = 0; i < lines.length; i++) {
|
|
765
|
+
const line = lines[i];
|
|
766
|
+
const trimmed = line.trim();
|
|
767
|
+
const indent = line.length - line.trimStart().length;
|
|
768
|
+
|
|
769
|
+
// 空白行:如果当前正在某个块内,保留它
|
|
770
|
+
if (!trimmed) {
|
|
771
|
+
if (current) {
|
|
772
|
+
current.contentLines.push({
|
|
773
|
+
indent,
|
|
774
|
+
text: '',
|
|
775
|
+
lineNum: i,
|
|
776
|
+
raw: line,
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
if (indent === 0) {
|
|
783
|
+
// 顶层注释行(# 或 //)不构成块,直接跳过
|
|
784
|
+
if (trimmed.startsWith('#') || trimmed.startsWith('//')) {
|
|
785
|
+
continue;
|
|
786
|
+
}
|
|
787
|
+
if (current) blocks.push(current);
|
|
788
|
+
current = {
|
|
789
|
+
header: normalizeSymbols(trimmed),
|
|
790
|
+
headerLineNum: i,
|
|
791
|
+
contentLines: [],
|
|
792
|
+
};
|
|
793
|
+
} else if (current) {
|
|
794
|
+
current.contentLines.push({
|
|
795
|
+
indent,
|
|
796
|
+
text: trimmed,
|
|
797
|
+
lineNum: i,
|
|
798
|
+
raw: line,
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if (current) blocks.push(current);
|
|
803
|
+
return blocks;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
function parseMetaBlock(cls, rep = null) {
|
|
807
|
+
rep = rep || createReporter();
|
|
808
|
+
const meta = {}; // 不再预设空字段,全部由用户定义
|
|
809
|
+
let i = 0;
|
|
810
|
+
while (i < cls.length) {
|
|
811
|
+
const cl = cls[i];
|
|
812
|
+
// 跳过空行与整行注释
|
|
813
|
+
const _t = cl.text.trim();
|
|
814
|
+
if (!_t || _t.startsWith('#')) {
|
|
815
|
+
i++;
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
818
|
+
const line = normalizeSymbols(cl.text);
|
|
819
|
+
|
|
820
|
+
// 检查是否为多行字符串定义: key = |
|
|
821
|
+
const multiMatch = line.match(/^([\w\u4e00-\u9fff]+)\s*=\s*\|$/);
|
|
822
|
+
if (multiMatch) {
|
|
823
|
+
const key = multiMatch[1];
|
|
824
|
+
i++;
|
|
825
|
+
const valueLines = [];
|
|
826
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
827
|
+
valueLines.push(cls[i].text);
|
|
828
|
+
i++;
|
|
829
|
+
}
|
|
830
|
+
const value = valueLines.join('\n');
|
|
831
|
+
// 与编译器一致:任意 key 都收(不限于 system_safety/output_style)
|
|
832
|
+
meta[key] = value;
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// 普通单行键值对
|
|
837
|
+
const m = line.match(/^([\w\u4e00-\u9fff]+)\s*=\s*(.+)$/);
|
|
838
|
+
if (!m)
|
|
839
|
+
rep.fail(
|
|
840
|
+
`meta 字段格式错误: "${cl.text}"。期望: key = value 或 key = |`,
|
|
841
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'meta:' }
|
|
842
|
+
);
|
|
843
|
+
const [, key, val] = m;
|
|
844
|
+
let v = val.trim();
|
|
845
|
+
|
|
846
|
+
// ═══ 新增:去除首尾配对引号 & 尝试转为数字 ═══
|
|
847
|
+
if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) {
|
|
848
|
+
v = v.slice(1, -1);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// 规范化常用字段,其他字段直接以原始键名存储
|
|
852
|
+
switch (key) {
|
|
853
|
+
case 'id':
|
|
854
|
+
meta.id = v;
|
|
855
|
+
break;
|
|
856
|
+
case 'name':
|
|
857
|
+
meta.name = v;
|
|
858
|
+
break;
|
|
859
|
+
case 'version':
|
|
860
|
+
meta.version = v;
|
|
861
|
+
break;
|
|
862
|
+
case 'owner':
|
|
863
|
+
meta.owner = String(v).replace(/^\[|\]$/g, '');
|
|
864
|
+
break;
|
|
865
|
+
case 'database':
|
|
866
|
+
meta.database = v;
|
|
867
|
+
break;
|
|
868
|
+
case 'session':
|
|
869
|
+
meta.session = v;
|
|
870
|
+
break;
|
|
871
|
+
case 'system_safety':
|
|
872
|
+
meta.system_safety = typeof v === 'string' ? v.replace(/^"|"$/g, '') : v;
|
|
873
|
+
break;
|
|
874
|
+
case 'output_style':
|
|
875
|
+
meta.output_style = typeof v === 'string' ? v.replace(/^"|"$/g, '') : v;
|
|
876
|
+
break;
|
|
877
|
+
case 'max_steps':
|
|
878
|
+
meta.max_steps = Number(v);
|
|
879
|
+
break;
|
|
880
|
+
case 'delay':
|
|
881
|
+
meta.delay = Number(v);
|
|
882
|
+
break;
|
|
883
|
+
default:
|
|
884
|
+
// 与编译器一致:未知字段保留原始键名,不报错
|
|
885
|
+
meta[key] = v;
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
i++;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// ⚡ 删除所有默认值设置,直接返回解析到的字段
|
|
892
|
+
return meta;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
function parseLayoutBlock(cls) {
|
|
896
|
+
const layout = {};
|
|
897
|
+
for (const cl of cls) {
|
|
898
|
+
const line = normalizeSymbols(cl.text);
|
|
899
|
+
const m = line.match(/^(\[.+?\])\s*=\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
|
|
900
|
+
if (m) {
|
|
901
|
+
layout[m[1]] = { dx: Math.round(parseFloat(m[2])), dy: Math.round(parseFloat(m[3])) };
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
return layout;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function parseVarsBlock(cls, rep = null) {
|
|
908
|
+
rep = rep || createReporter();
|
|
909
|
+
const vars = [];
|
|
910
|
+
let i = 0;
|
|
911
|
+
while (i < cls.length) {
|
|
912
|
+
const cl = cls[i];
|
|
913
|
+
const _t = cl.text.trim();
|
|
914
|
+
if (!_t || _t.startsWith('#')) { i++; continue; } // 跳过空行与注释
|
|
915
|
+
const line = normalizeSymbols(cl.text);
|
|
916
|
+
|
|
917
|
+
// 多行值:key = |(与编译器 _eval_kv_block 一致)
|
|
918
|
+
const multiMatch = line.match(/^((?:@|\$@|\$)?[\w\u4e00-\u9fff]+)\s*=\s*\|$/);
|
|
919
|
+
if (multiMatch) {
|
|
920
|
+
const key = multiMatch[1];
|
|
921
|
+
i++;
|
|
922
|
+
const valueLines = [];
|
|
923
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
924
|
+
valueLines.push(cls[i].text);
|
|
925
|
+
i++;
|
|
926
|
+
}
|
|
927
|
+
vars.push({ name: key, defaultValue: valueLines.join('\n') });
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
const m = line.match(/^((?:@|\$@|\$)?[\w\u4e00-\u9fff]+)\s*=\s*(.*)$/);
|
|
932
|
+
if (!m)
|
|
933
|
+
rep.fail(
|
|
934
|
+
`vars 字段格式错误: "${cl.text}"。期望: varname = "value"`,
|
|
935
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'vars:' }
|
|
936
|
+
);
|
|
937
|
+
vars.push({ name: m[1], defaultValue: m[2].trim() });
|
|
938
|
+
i++;
|
|
939
|
+
}
|
|
940
|
+
return vars;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
function parseCodeBlock(cls, rep = null) {
|
|
944
|
+
rep = rep || createReporter();
|
|
945
|
+
const code = [];
|
|
946
|
+
for (const cl of cls) {
|
|
947
|
+
const _t = cl.text.trim();
|
|
948
|
+
if (!_t || _t.startsWith('#')) continue; // 跳过空行与注释
|
|
949
|
+
const line = normalizeSymbols(cl.text);
|
|
950
|
+
const m = line.match(/^(@?[\w\u4e00-\u9fff]+)\s*=\s*(.*)$/);
|
|
951
|
+
if (!m)
|
|
952
|
+
rep.fail(
|
|
953
|
+
`code 字段格式错误: "${cl.text}"。期望: name = value`,
|
|
954
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'code:' }
|
|
955
|
+
);
|
|
956
|
+
let val = m[2].trim();
|
|
957
|
+
// 如果格式为 file:"xxx",只取内部路径
|
|
958
|
+
const fm = val.match(/^file:"(.*)"$/);
|
|
959
|
+
if (fm) val = fm[1];
|
|
960
|
+
code.push({ name: m[1], value: val });
|
|
961
|
+
}
|
|
962
|
+
return code;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
function parseActorsBlock(cls, rep = null) {
|
|
966
|
+
rep = rep || createReporter();
|
|
967
|
+
const actors = [];
|
|
968
|
+
let i = 0;
|
|
969
|
+
while (i < cls.length) {
|
|
970
|
+
const cl = cls[i];
|
|
971
|
+
const _t = cl.text.trim();
|
|
972
|
+
if (!_t || _t.startsWith('#')) { i++; continue; } // 跳过空行与注释
|
|
973
|
+
const line = normalizeSymbols(cl.text);
|
|
974
|
+
|
|
975
|
+
// blueprint 块(与编译器一致):blueprint name: + 缩进属性 source/tools
|
|
976
|
+
const bpMatch = line.match(/^blueprint\s+(@?[\w\u4e00-\u9fff]+)\s*:\s*$/);
|
|
977
|
+
if (bpMatch) {
|
|
978
|
+
const bpName = bpMatch[1];
|
|
979
|
+
let source = null;
|
|
980
|
+
let tools = null;
|
|
981
|
+
let thinking = null;
|
|
982
|
+
i++;
|
|
983
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
984
|
+
const al = normalizeSymbols(cls[i].text).trim();
|
|
985
|
+
if (al.startsWith('source:')) {
|
|
986
|
+
source = al.slice(7).trim();
|
|
987
|
+
} else if (al.startsWith('thinking')) {
|
|
988
|
+
const thStr = al.replace(/^thinking\s*[:=]\s*/, '').trim().toLowerCase();
|
|
989
|
+
// `default` 显式值 ≡ 未声明(归一化为空串,与不传字段完全等效)
|
|
990
|
+
if (thStr !== 'default' && !THINKING_LEVELS.includes(thStr)) {
|
|
991
|
+
rep.fail(
|
|
992
|
+
`thinking 档位不合法: "${thStr}"(允许: default/${THINKING_LEVELS.join('/')})`,
|
|
993
|
+
{ line: cls[i].lineNum + 1, lineText: cls[i].raw || cls[i].text, where: `blueprint ${bpName}` }
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
thinking = thStr === 'default' ? '' : thStr;
|
|
997
|
+
} else if (al.startsWith('tools')) {
|
|
998
|
+
const toolsStr = al.replace(/^tools\s*[:=]\s*/, '').trim();
|
|
999
|
+
if (toolsStr.startsWith('[') && toolsStr.endsWith(']')) {
|
|
1000
|
+
tools = toolsStr.slice(1, -1).split(',').map(s => s.trim()).filter(Boolean);
|
|
1001
|
+
// 显式空列表 [] ≡ 明确禁用(与 Python 编译器语义对齐)
|
|
1002
|
+
if (!tools.length) tools = false;
|
|
1003
|
+
} else if (toolsStr === 'true' || toolsStr === 'false') {
|
|
1004
|
+
tools = toolsStr === 'true';
|
|
1005
|
+
} else {
|
|
1006
|
+
rep.fail(
|
|
1007
|
+
`tools 格式错误,应为 tools = [tool1, tool2] 或 tools: true/false`,
|
|
1008
|
+
{ line: cls[i].lineNum + 1, lineText: cls[i].raw || cls[i].text, where: `blueprint ${bpName}` }
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
i++;
|
|
1013
|
+
}
|
|
1014
|
+
actors.push({ type: 'blueprint', name: bpName, soul: '', source: source ?? '', tools: tools, thinking: thinking ?? '' });
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
const prefixMatch = line.match(
|
|
1019
|
+
/^(ai|human)\s+(@?[\w\u4e00-\u9fff]+)\s*=\s*(.*)$/
|
|
1020
|
+
);
|
|
1021
|
+
// 裸 actor:`ai|human @名`(无 `=`、无属性)→ soul/source 缺省。
|
|
1022
|
+
// 与 Python 编译器 FEMO_parser.py eval_actors 的裸 actor 分支对齐(soul 非必须,
|
|
1023
|
+
// 无 soul 角色 = 无角色设定的裸执行者)。
|
|
1024
|
+
const bareMatch = !prefixMatch ? line.match(/^(ai|human)\s+(@?[\w\u4e00-\u9fff]+)\s*$/) : null;
|
|
1025
|
+
if (bareMatch) {
|
|
1026
|
+
actors.push({ type: bareMatch[1], name: bareMatch[2], soul: '', source: '', tools: [] });
|
|
1027
|
+
i++;
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
if (!prefixMatch)
|
|
1031
|
+
rep.fail(
|
|
1032
|
+
`actors 格式错误: "${cl.text}"。期望: ai|human @name = soul:X, source:Y, tools:[...],或裸写法 ai|human @name`,
|
|
1033
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'actors:' }
|
|
1034
|
+
);
|
|
1035
|
+
const type = prefixMatch[1];
|
|
1036
|
+
const name = prefixMatch[2];
|
|
1037
|
+
const rest = prefixMatch[3];
|
|
1038
|
+
|
|
1039
|
+
// 初始化字段(全部 null 表示未设置,最终再给默认值)
|
|
1040
|
+
let soul = null;
|
|
1041
|
+
let source = null;
|
|
1042
|
+
let tools = null;
|
|
1043
|
+
let thinking = null;
|
|
1044
|
+
|
|
1045
|
+
// 分割属性部分:逗号或空格分隔均可,但 tools 中有逗号,所以用逗号分割再处理
|
|
1046
|
+
const parts = rest.split(',').map(p => p.trim()).filter(Boolean);
|
|
1047
|
+
for (let pi = 0; pi < parts.length; pi++) {
|
|
1048
|
+
const part = parts[pi];
|
|
1049
|
+
if (part.startsWith('soul:')) {
|
|
1050
|
+
const val = part.slice(5).trim();
|
|
1051
|
+
if (!val) rep.fail(`soul 字段缺少值,例如 soul:1`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'actors:' });
|
|
1052
|
+
soul = val;
|
|
1053
|
+
} else if (part.startsWith('source:')) {
|
|
1054
|
+
const val = part.slice(7).trim();
|
|
1055
|
+
if (!val) rep.fail(`source 字段缺少值,例如 source:01A`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'actors:' });
|
|
1056
|
+
source = val;
|
|
1057
|
+
} else if (part.startsWith('thinking')) {
|
|
1058
|
+
// thinking: <档位>(off/minimal/low/medium/high/xhigh/max,编译期词汇校验);
|
|
1059
|
+
// `default` 显式值 ≡ 未声明(归一化为空串,与不传字段完全等效)
|
|
1060
|
+
const thStr = part.replace(/^thinking\s*[:=]\s*/, '').trim().toLowerCase();
|
|
1061
|
+
if (thStr !== 'default' && !THINKING_LEVELS.includes(thStr)) {
|
|
1062
|
+
rep.fail(
|
|
1063
|
+
`thinking 档位不合法: "${thStr}"(允许: default/${THINKING_LEVELS.join('/')})`,
|
|
1064
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: `actor ${name}` }
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1067
|
+
thinking = thStr === 'default' ? '' : thStr;
|
|
1068
|
+
} else if (part.startsWith('tools')) {
|
|
1069
|
+
// 允许 tools = [...] / tools:[...] / tools: true|false(布尔=全部/禁用)
|
|
1070
|
+
let toolsStr = part.replace(/^tools\s*[:=]\s*/, '').trim();
|
|
1071
|
+
// 列表内部含逗号会被上面的 split 切碎成多段:仅列表([ 开头)才拼接
|
|
1072
|
+
// 到方括号闭合——布尔值绝不拼接,否则 tools: false 后面的属性(如
|
|
1073
|
+
// thinking: default)会被吞进 tools 造成「tools 格式错误」假警报
|
|
1074
|
+
// (2026-08-30 实证:与 thinking 标签共存时必炸)。
|
|
1075
|
+
if (toolsStr.startsWith('[')) {
|
|
1076
|
+
while (!toolsStr.endsWith(']') && pi + 1 < parts.length) {
|
|
1077
|
+
pi += 1;
|
|
1078
|
+
toolsStr += ',' + parts[pi];
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (toolsStr.startsWith('[') && toolsStr.endsWith(']')) {
|
|
1082
|
+
toolsStr = toolsStr.slice(1, -1);
|
|
1083
|
+
tools = toolsStr.split(',').map(s => s.trim()).filter(Boolean);
|
|
1084
|
+
// 显式空白名单 [] ≡ 明确禁用(与 Python 编译器 2026-09-12 语义对齐;
|
|
1085
|
+
// 「不写 tools」= null = 宿主默认全开,两者严格区分)
|
|
1086
|
+
if (!tools.length) tools = false;
|
|
1087
|
+
} else if (toolsStr === 'true' || toolsStr === 'false') {
|
|
1088
|
+
tools = toolsStr === 'true';
|
|
1089
|
+
} else {
|
|
1090
|
+
rep.fail(
|
|
1091
|
+
`tools 格式错误,应为 tools = [tool1, tool2] 或 tools: true/false`,
|
|
1092
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: `actor ${name}` }
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
} else {
|
|
1096
|
+
// 其他字段直接报错
|
|
1097
|
+
rep.fail(
|
|
1098
|
+
`不支持的字段 "${part}"。合法字段: soul, source, thinking, tools`,
|
|
1099
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'actors:' }
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// 最后赋予默认值(不兜底修改原值)。soul 缺省 = 空串(裸 actor 语义:
|
|
1105
|
+
// soul 非必须,序列化时对空 soul 保持沉默,绝不伪造数字 soul)。
|
|
1106
|
+
if (soul === null) soul = '';
|
|
1107
|
+
if (source === null) source = '';
|
|
1108
|
+
// tools 缺省保持 null(未声明 = 宿主默认全开)——禁止归一成 []:
|
|
1109
|
+
// [] 是「显式空白名单 ≡ 明确禁用」,与「未声明」是两种语义,混了会把
|
|
1110
|
+
// 没写 tools 的 actor 在保存时写上 tools: false(禁用)(2026-09-12 修正)。
|
|
1111
|
+
if (thinking === null) thinking = '';
|
|
1112
|
+
|
|
1113
|
+
actors.push({ type, name, soul, source, tools, thinking });
|
|
1114
|
+
i++;
|
|
1115
|
+
}
|
|
1116
|
+
return actors;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
function parseMemoryOrContextBlock(header, cls, blockType, rep = null, headerLineNum = null) {
|
|
1120
|
+
rep = rep || createReporter();
|
|
1121
|
+
// 解析 memory name(fileRef): 或 context name(fileRef):
|
|
1122
|
+
const hm = header.match(
|
|
1123
|
+
new RegExp(`^${blockType}\\s+([\\w\\u4e00-\\u9fff]+)\\((.+?)\\):$`)
|
|
1124
|
+
);
|
|
1125
|
+
if (!hm)
|
|
1126
|
+
rep.fail(
|
|
1127
|
+
`${blockType} 声明格式错误: "${header}"。期望: ${blockType} name(fileRef):`,
|
|
1128
|
+
{ line: (headerLineNum ?? -1) + 1, lineText: header, where: `${blockType} 区` }
|
|
1129
|
+
);
|
|
1130
|
+
const block = {
|
|
1131
|
+
name: hm[1],
|
|
1132
|
+
fileRef: hm[2],
|
|
1133
|
+
in: '',
|
|
1134
|
+
out: '',
|
|
1135
|
+
};
|
|
1136
|
+
for (const cl of cls) {
|
|
1137
|
+
const _t = cl.text.trim();
|
|
1138
|
+
if (!_t || _t.startsWith('#')) continue; // 跳过空行与注释
|
|
1139
|
+
const line = normalizeSymbols(cl.text);
|
|
1140
|
+
if (line.startsWith('in:')) {
|
|
1141
|
+
const after = line.slice(3).trim();
|
|
1142
|
+
block.in =
|
|
1143
|
+
after ||
|
|
1144
|
+
cls
|
|
1145
|
+
.filter((l) => l.indent > cl.indent)
|
|
1146
|
+
.map((l) => normalizeSymbols(l.text))
|
|
1147
|
+
.join('\n');
|
|
1148
|
+
} else if (line.startsWith('out:')) {
|
|
1149
|
+
const after = line.slice(4).trim();
|
|
1150
|
+
block.out =
|
|
1151
|
+
after ||
|
|
1152
|
+
cls
|
|
1153
|
+
.filter((l) => l.indent > cl.indent)
|
|
1154
|
+
.map((l) => normalizeSymbols(l.text))
|
|
1155
|
+
.join(', ');
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return block;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
function parseActionBlock(header, cls, rep = null, headerLineNum = null) {
|
|
1162
|
+
rep = rep || createReporter();
|
|
1163
|
+
// 先标准化 header
|
|
1164
|
+
const normalizedHeader = normalizeSymbols(header);
|
|
1165
|
+
const hm = normalizedHeader.match(
|
|
1166
|
+
/^action\s+([\w\u4e00-\u9fff]+)\s+(@[\w\u4e00-\u9fff]+)(?:\((@?[\w\u4e00-\u9fff.]+)\))?(?:\s+as\s*\((@?[\w\u4e00-\u9fff.]+)\))?\s*:\s*$/
|
|
1167
|
+
);
|
|
1168
|
+
if (!hm)
|
|
1169
|
+
rep.fail(
|
|
1170
|
+
`Action 声明格式错误: "${header}"。期望: action name @type(@actor):`,
|
|
1171
|
+
{ line: (headerLineNum ?? -1) + 1, lineText: header, where: 'action 区' }
|
|
1172
|
+
);
|
|
1173
|
+
const action = {
|
|
1174
|
+
name: hm[1],
|
|
1175
|
+
executorType: hm[2].replace('@', ''),
|
|
1176
|
+
executorActor: hm[3] || '',
|
|
1177
|
+
asActor: hm[4] || '',
|
|
1178
|
+
prompt: '',
|
|
1179
|
+
resolve: '',
|
|
1180
|
+
scope: '',
|
|
1181
|
+
outVars: '',
|
|
1182
|
+
inMappings: '',
|
|
1183
|
+
memory: '',
|
|
1184
|
+
context: '',
|
|
1185
|
+
max_retries: 0,
|
|
1186
|
+
fallback: '',
|
|
1187
|
+
interrupt: '',
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
let i = 0;
|
|
1191
|
+
while (i < cls.length) {
|
|
1192
|
+
const cl = cls[i];
|
|
1193
|
+
|
|
1194
|
+
// ★ 非 prompt 上下文:跳过空白行
|
|
1195
|
+
const isPromptContext =
|
|
1196
|
+
cl.text.startsWith('prompt:') ||
|
|
1197
|
+
cl.text.startsWith('showprompt:') ||
|
|
1198
|
+
(i > 0 &&
|
|
1199
|
+
(cls[i - 1].text === 'prompt: |' || cls[i - 1].text === 'showprompt: |') &&
|
|
1200
|
+
cl.indent > cls[i - 1].indent);
|
|
1201
|
+
|
|
1202
|
+
if (!isPromptContext && (!cl.text.trim() || cl.text.trim().startsWith('#'))) {
|
|
1203
|
+
i++;
|
|
1204
|
+
continue;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
const line = isPromptContext ? cl.text : normalizeSymbols(cl.text);
|
|
1208
|
+
if (line === 'prompt: |') {
|
|
1209
|
+
i++;
|
|
1210
|
+
const pl = [];
|
|
1211
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
1212
|
+
pl.push(cls[i].text);
|
|
1213
|
+
i++;
|
|
1214
|
+
}
|
|
1215
|
+
action.prompt = pl.join('\n');
|
|
1216
|
+
continue;
|
|
1217
|
+
}
|
|
1218
|
+
if (line.startsWith('prompt:') && !line.endsWith('|')) {
|
|
1219
|
+
const after = line.slice(7).trim();
|
|
1220
|
+
action.prompt = after;
|
|
1221
|
+
i++;
|
|
1222
|
+
continue;
|
|
1223
|
+
}
|
|
1224
|
+
if (line === 'showprompt: |') {
|
|
1225
|
+
i++;
|
|
1226
|
+
const spl = [];
|
|
1227
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
1228
|
+
spl.push(cls[i].text);
|
|
1229
|
+
i++;
|
|
1230
|
+
}
|
|
1231
|
+
action.showprompt = spl.join('\n');
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
if (line.startsWith('showprompt:')) {
|
|
1235
|
+
const after = line.slice(11).trim();
|
|
1236
|
+
action.showprompt = after;
|
|
1237
|
+
i++;
|
|
1238
|
+
continue;
|
|
1239
|
+
}
|
|
1240
|
+
if (line.startsWith('in:')) {
|
|
1241
|
+
const after = line.slice(3).trim();
|
|
1242
|
+
if (after) {
|
|
1243
|
+
action.inMappings = after;
|
|
1244
|
+
i++; // 单行模式必须推进索引,否则死循环
|
|
1245
|
+
} else {
|
|
1246
|
+
i++;
|
|
1247
|
+
const il = [];
|
|
1248
|
+
let guard = 0;
|
|
1249
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
1250
|
+
if (++guard > 500)
|
|
1251
|
+
rep.fail(`in 字段解析陷入死循环`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: `action ${action.name}` });
|
|
1252
|
+
il.push(normalizeSymbols(cls[i].text));
|
|
1253
|
+
i++;
|
|
1254
|
+
}
|
|
1255
|
+
action.inMappings = il.join('\n');
|
|
1256
|
+
}
|
|
1257
|
+
continue;
|
|
1258
|
+
}
|
|
1259
|
+
if (line.startsWith('out:')) {
|
|
1260
|
+
const after = line.slice(4).trim();
|
|
1261
|
+
if (after) {
|
|
1262
|
+
action.outVars = after;
|
|
1263
|
+
i++; // 单行模式必须推进索引
|
|
1264
|
+
// 单行 out 后的缩进续行也并入(out: x += 1 后接缩进的 y = {})
|
|
1265
|
+
const ol = [];
|
|
1266
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
1267
|
+
const t2 = normalizeSymbols(cls[i].text).trim();
|
|
1268
|
+
if (t2 && !t2.startsWith('#')) ol.push(t2);
|
|
1269
|
+
i++;
|
|
1270
|
+
}
|
|
1271
|
+
if (ol.length > 0) action.outVars = after + '\n' + ol.join('\n');
|
|
1272
|
+
} else {
|
|
1273
|
+
i++;
|
|
1274
|
+
const ol = [];
|
|
1275
|
+
while (i < cls.length && cls[i].indent > cl.indent) {
|
|
1276
|
+
ol.push(normalizeSymbols(cls[i].text));
|
|
1277
|
+
i++;
|
|
1278
|
+
}
|
|
1279
|
+
action.outVars = ol.join('\n');
|
|
1280
|
+
}
|
|
1281
|
+
continue;
|
|
1282
|
+
}
|
|
1283
|
+
if (line.startsWith('scope:')) {
|
|
1284
|
+
action.scope = line.slice(6).trim();
|
|
1285
|
+
i++;
|
|
1286
|
+
continue;
|
|
1287
|
+
}
|
|
1288
|
+
if (line.startsWith('memory:')) {
|
|
1289
|
+
action.memory = line.slice(7).trim();
|
|
1290
|
+
i++;
|
|
1291
|
+
continue;
|
|
1292
|
+
}
|
|
1293
|
+
if (line.startsWith('context:')) {
|
|
1294
|
+
action.context = line.slice(8).trim();
|
|
1295
|
+
i++;
|
|
1296
|
+
continue;
|
|
1297
|
+
}
|
|
1298
|
+
if (line.startsWith('resolve:')) {
|
|
1299
|
+
action.resolve = line.slice(8).trim();
|
|
1300
|
+
i++;
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1303
|
+
if (line.startsWith('max_retries:')) {
|
|
1304
|
+
action.max_retries = Number(line.slice(12).trim());
|
|
1305
|
+
i++;
|
|
1306
|
+
continue;
|
|
1307
|
+
}
|
|
1308
|
+
if (line.startsWith('fallback:')) {
|
|
1309
|
+
action.fallback = line.slice(9).trim();
|
|
1310
|
+
i++;
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1313
|
+
if (line.startsWith('interrupt:')) {
|
|
1314
|
+
action.interrupt = line.slice(10).trim();
|
|
1315
|
+
i++;
|
|
1316
|
+
continue;
|
|
1317
|
+
}
|
|
1318
|
+
rep.fail(
|
|
1319
|
+
`未识别的 action 子字段: "${cl.text}"。合法: prompt:, in:, out:, scope:, memory:, context:, resolve:, max_retries:, fallback:, interrupt:`,
|
|
1320
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: `action ${action.name}` }
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
return action;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
function parseModuleBlock(header, cls, rep = null, headerLineNum = null) {
|
|
1327
|
+
rep = rep || createReporter();
|
|
1328
|
+
const hm = header.match(/^module\s+([\w\u4e00-\u9fff]+)(?:\s*\(([^)]*)\))?\s*:?\s*$/);
|
|
1329
|
+
if (!hm)
|
|
1330
|
+
rep.fail(
|
|
1331
|
+
`Module 声明格式错误: "${header}"。期望: module Name:`,
|
|
1332
|
+
{ line: (headerLineNum ?? -1) + 1, lineText: header, where: 'module 区' }
|
|
1333
|
+
);
|
|
1334
|
+
const mod = {
|
|
1335
|
+
name: hm[1],
|
|
1336
|
+
params: hm[2] ? hm[2].split(',').map((s) => s.trim()).filter(Boolean) : [],
|
|
1337
|
+
meta: {},
|
|
1338
|
+
code: [],
|
|
1339
|
+
vars: [],
|
|
1340
|
+
actions: [],
|
|
1341
|
+
nodeDecls: [],
|
|
1342
|
+
edges: [],
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
// 子块按最小缩进切分(兼容 2 空格 / 4 空格等任意统一缩进)
|
|
1346
|
+
const subBlocks = [];
|
|
1347
|
+
let cur = null;
|
|
1348
|
+
const nonEmpty = cls.filter((cl) => cl.text.trim());
|
|
1349
|
+
const baseIndent = nonEmpty.length > 0
|
|
1350
|
+
? Math.min(...nonEmpty.map((cl) => cl.indent))
|
|
1351
|
+
: 0;
|
|
1352
|
+
for (const cl of cls) {
|
|
1353
|
+
// 跳过空行,防止生成空 header 的子块
|
|
1354
|
+
if (!cl.text.trim()) continue;
|
|
1355
|
+
|
|
1356
|
+
if (cl.indent === baseIndent) {
|
|
1357
|
+
if (cur) subBlocks.push(cur);
|
|
1358
|
+
const headerText = cl.text.trim();
|
|
1359
|
+
if (headerText.startsWith('//') || headerText.startsWith('#')) {
|
|
1360
|
+
cur = null;
|
|
1361
|
+
} else {
|
|
1362
|
+
cur = { header: cl.text, headerLineNum: cl.lineNum, contentLines: [] };
|
|
1363
|
+
}
|
|
1364
|
+
} else if (cur && cl.indent > baseIndent) {
|
|
1365
|
+
cur.contentLines.push({ ...cl, indent: cl.indent - baseIndent });
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
if (cur) subBlocks.push(cur);
|
|
1369
|
+
|
|
1370
|
+
for (const sb of subBlocks) {
|
|
1371
|
+
const hdr = normalizeSymbols(sb.header);
|
|
1372
|
+
if (hdr === 'vars:') {
|
|
1373
|
+
mod.vars = parseVarsBlock(sb.contentLines, rep);
|
|
1374
|
+
} else if (hdr === 'meta:') {
|
|
1375
|
+
mod.meta = parseMetaBlock(sb.contentLines, rep);
|
|
1376
|
+
} else if (hdr === 'code:') {
|
|
1377
|
+
mod.code = parseCodeBlock(sb.contentLines, rep);
|
|
1378
|
+
} else if (hdr.startsWith('action ')) {
|
|
1379
|
+
mod.actions.push(
|
|
1380
|
+
parseActionBlock(normalizeSymbols(sb.header), sb.contentLines, rep, sb.headerLineNum)
|
|
1381
|
+
);
|
|
1382
|
+
} else if (hdr === 'flow:') {
|
|
1383
|
+
const { nodeDecls, edges } = parseFlowSection(sb.contentLines, [], rep);
|
|
1384
|
+
mod.nodeDecls = nodeDecls;
|
|
1385
|
+
mod.edges = edges;
|
|
1386
|
+
} else if (hdr === 'sketch:') {
|
|
1387
|
+
mod.layout = parseLayoutBlock(sb.contentLines);
|
|
1388
|
+
} else if (hdr.startsWith('module ')) {
|
|
1389
|
+
// 递归解析嵌套子模块
|
|
1390
|
+
const subMod = parseModuleBlock(hdr, sb.contentLines, rep, sb.headerLineNum);
|
|
1391
|
+
if (!mod.subModules) mod.subModules = [];
|
|
1392
|
+
mod.subModules.push(subMod);
|
|
1393
|
+
} else {
|
|
1394
|
+
rep.fail(
|
|
1395
|
+
`Module 内未识别的子块: "${sb.header}"。合法: vars:, meta:, code:, action ..., module ..., flow:`,
|
|
1396
|
+
{ line: (sb.headerLineNum ?? -1) + 1, lineText: sb.header, where: `module ${mod.name}` }
|
|
1397
|
+
);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return mod;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
function parseMainflowBlock(cls, rep = null) {
|
|
1404
|
+
rep = rep || createReporter();
|
|
1405
|
+
// 计算最小缩进(跳过空行和注释)
|
|
1406
|
+
const nonCommentLines = cls.filter(l => {
|
|
1407
|
+
const t = normalizeSymbols(l.text).trim();
|
|
1408
|
+
return t && !t.startsWith('//') && !t.startsWith('#');
|
|
1409
|
+
});
|
|
1410
|
+
if (nonCommentLines.length === 0) {
|
|
1411
|
+
return { nodeDecls: [], edges: [], layout: {} };
|
|
1412
|
+
}
|
|
1413
|
+
const baseIndent = Math.min(...nonCommentLines.map(l => l.indent));
|
|
1414
|
+
|
|
1415
|
+
// 按 baseIndent 分组(mainflow 内部子块)
|
|
1416
|
+
const groups = [];
|
|
1417
|
+
let currentGroup = null;
|
|
1418
|
+
for (const cl of cls) {
|
|
1419
|
+
if (cl.indent === baseIndent) {
|
|
1420
|
+
if (currentGroup) groups.push(currentGroup);
|
|
1421
|
+
currentGroup = { header: cl, lines: [] };
|
|
1422
|
+
} else if (currentGroup && cl.indent > baseIndent) {
|
|
1423
|
+
currentGroup.lines.push(cl);
|
|
1424
|
+
}
|
|
1425
|
+
// 缩进小于 baseIndent 的异常行忽略
|
|
1426
|
+
}
|
|
1427
|
+
if (currentGroup) groups.push(currentGroup);
|
|
1428
|
+
|
|
1429
|
+
let flowLines = [];
|
|
1430
|
+
let layout = {};
|
|
1431
|
+
|
|
1432
|
+
for (const group of groups) {
|
|
1433
|
+
const headerText = normalizeSymbols(group.header.text);
|
|
1434
|
+
if (headerText === 'sketch:') {
|
|
1435
|
+
// 收集 sketch 块内的坐标行
|
|
1436
|
+
layout = parseLayoutBlock(group.lines);
|
|
1437
|
+
} else {
|
|
1438
|
+
// 其他行(节点声明、连线)原样放入 flowLines
|
|
1439
|
+
flowLines.push(group.header);
|
|
1440
|
+
flowLines.push(...group.lines);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
// 如果没有分组(所有行缩进相同),则直接作为 flow 行
|
|
1445
|
+
if (groups.length === 0) {
|
|
1446
|
+
flowLines = cls;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
const result = parseFlowSection(flowLines, [], rep);
|
|
1450
|
+
result.layout = layout;
|
|
1451
|
+
return result;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
function parseFlowSection(flowLines, existingLabels, rep = null) {
|
|
1455
|
+
rep = rep || createReporter();
|
|
1456
|
+
console.log('parseFlowSection 被调用,flowLines:');
|
|
1457
|
+
|
|
1458
|
+
const nodeDecls = [];
|
|
1459
|
+
const edges = [];
|
|
1460
|
+
let currentNode = null;
|
|
1461
|
+
const usedLabels = new Set(existingLabels || []);
|
|
1462
|
+
|
|
1463
|
+
const addEdge = (edge) => {
|
|
1464
|
+
const newCond = (edge.cond || '').trim();
|
|
1465
|
+
console.log(`[DEBUG] addEdge: src="${edge.srcLabel}" -> tgt="${edge.tgtLabel}", cond="${newCond}", isBack=${edge.isBack}`);
|
|
1466
|
+
|
|
1467
|
+
const existing = edges.filter(
|
|
1468
|
+
(e) => e.srcLabel === edge.srcLabel && e.tgtLabel === edge.tgtLabel
|
|
1469
|
+
);
|
|
1470
|
+
console.log(`[DEBUG] 已有同src→tgt边数: ${existing.length}, 现有cond列表: [${existing.map(e => JSON.stringify((e.cond||'').trim())).join(', ')}]`);
|
|
1471
|
+
|
|
1472
|
+
// Case 0: 该 src→tgt 无任何已有边 → 直接加入
|
|
1473
|
+
if (existing.length === 0) {
|
|
1474
|
+
console.log(`[addEdge] 无冲突, 直接加入`);
|
|
1475
|
+
edges.push(edge);
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
// 查找完全相同的 cond
|
|
1480
|
+
const exactMatch = existing.find((e) => (e.cond || '').trim() === newCond);
|
|
1481
|
+
if (exactMatch) {
|
|
1482
|
+
console.log(`[addEdge] 完全相同 cond "${newCond}" 已存在, 跳过新边`);
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
const newIsConditional = newCond !== '';
|
|
1487
|
+
const hasAnyConditional = existing.some((e) => (e.cond || '').trim() !== '');
|
|
1488
|
+
const allUnconditional = existing.every((e) => (e.cond || '').trim() === '');
|
|
1489
|
+
console.log(`[DEBUG] newIsConditional=${newIsConditional}, hasAnyConditional=${hasAnyConditional}, allUnconditional=${allUnconditional}`);
|
|
1490
|
+
|
|
1491
|
+
// 规则2a: 新边无条件,已有中存在有条件边 → 丢弃新边(保留已有的条件边)
|
|
1492
|
+
if (!newIsConditional && hasAnyConditional) {
|
|
1493
|
+
const keptCond = existing.find(e => (e.cond || '').trim() !== '').cond;
|
|
1494
|
+
console.log(`[addEdge] 规则2: 新边无条件,已有条件边 "${(keptCond||'').trim()}" → 丢弃新边`);
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// 规则2b: 新边有条件,已有全无条件 → 删除已有无条件边,加入新条件边
|
|
1499
|
+
if (newIsConditional && allUnconditional) {
|
|
1500
|
+
console.log(`[addEdge] 规则2: 新边有条件 "${newCond}",已有全无条件 → 删除已有无条件边,加入新条件边`);
|
|
1501
|
+
const indicesToRemove = existing
|
|
1502
|
+
.map(e => edges.indexOf(e))
|
|
1503
|
+
.filter(i => i !== -1)
|
|
1504
|
+
.sort((a, b) => b - a);
|
|
1505
|
+
for (const idx of indicesToRemove) {
|
|
1506
|
+
edges.splice(idx, 1);
|
|
1507
|
+
}
|
|
1508
|
+
edges.push(edge);
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// 规则4: 新边有条件,已有也有条件,且条件不同 → 报错
|
|
1513
|
+
if (newIsConditional && hasAnyConditional) {
|
|
1514
|
+
const existingConds = existing.map(e => (e.cond || '').trim());
|
|
1515
|
+
rep.fail(
|
|
1516
|
+
`边冲突: "${edge.srcLabel}" → "${edge.tgtLabel}" 已存在条件边 (条件: "${existingConds.join('", "')}"),` +
|
|
1517
|
+
` 新边条件为 "${newCond}"。同一 src→tgt 不允许同时存在两条不同条件的边,请检查流程结构`,
|
|
1518
|
+
{ where: 'flow' }
|
|
1519
|
+
);
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
// 兜底: 新边无条件,已有也全无条件 → 实际上被 exactMatch 拦住了,不会走到这里
|
|
1523
|
+
console.log(`[addEdge] 兜底: 都无条件 (${existing.length}条已有), 加入`);
|
|
1524
|
+
edges.push(edge);
|
|
1525
|
+
};
|
|
1526
|
+
// 根据裸引用获取或创建节点标签,不产生边
|
|
1527
|
+
function ensureNodeForRef(ref) {
|
|
1528
|
+
console.log('ensureNodeForRef 被调用:', ref);
|
|
1529
|
+
if (ref.includes('->')) {
|
|
1530
|
+
console.trace('异常节点引用(含 ->):', ref);
|
|
1531
|
+
rep.fail(`ensureNodeForRef 收到非法引用: "${ref}"`, { where: 'flow' });
|
|
1532
|
+
}
|
|
1533
|
+
const trimmed = ref.trim();
|
|
1534
|
+
const bracketMatch = trimmed.match(/^\[(.+)\]$/);
|
|
1535
|
+
if (bracketMatch) {
|
|
1536
|
+
const label = bracketMatch[1];
|
|
1537
|
+
if (!usedLabels.has(label) && !nodeDecls.some(d => d.label === label)) {
|
|
1538
|
+
nodeDecls.push({ label, ref: '' });
|
|
1539
|
+
usedLabels.add(label);
|
|
1540
|
+
}
|
|
1541
|
+
return label;
|
|
1542
|
+
}
|
|
1543
|
+
const inlineMatch = trimmed.match(/^\[(.+?)\]:\s*(.*)$/);
|
|
1544
|
+
if (inlineMatch) {
|
|
1545
|
+
const label = inlineMatch[1];
|
|
1546
|
+
const refVal = inlineMatch[2].trim();
|
|
1547
|
+
if (!usedLabels.has(label) && !nodeDecls.some(d => d.label === label)) {
|
|
1548
|
+
nodeDecls.push({ label, ref: refVal });
|
|
1549
|
+
usedLabels.add(label);
|
|
1550
|
+
}
|
|
1551
|
+
return label;
|
|
1552
|
+
}
|
|
1553
|
+
let baseName = trimmed.startsWith('&') ? trimmed.substring(1) : trimmed;
|
|
1554
|
+
baseName = baseName.replace(/\(.*$/, '').trim();
|
|
1555
|
+
let label = baseName;
|
|
1556
|
+
let counter = 2;
|
|
1557
|
+
while (usedLabels.has(label) || nodeDecls.some(d => d.label === label)) {
|
|
1558
|
+
label = `${baseName}_${counter}`;
|
|
1559
|
+
counter++;
|
|
1560
|
+
}
|
|
1561
|
+
nodeDecls.push({ label, ref: trimmed });
|
|
1562
|
+
usedLabels.add(label);
|
|
1563
|
+
return label;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
// 统一解析目标(支持 [label]、[label]:ref、actionName、&module 等)
|
|
1567
|
+
function resolveTarget(srcLabel, targetRaw, cond) {
|
|
1568
|
+
console.log('resolveTarget:', srcLabel, '->', targetRaw, 'cond:', cond);
|
|
1569
|
+
console.log(`[DEBUG] resolveTarget: src="${srcLabel}", target="${targetRaw}", cond="${cond}"`);
|
|
1570
|
+
if (targetRaw == null) {
|
|
1571
|
+
console.trace('resolveTarget 收到空 targetRaw,srcLabel:', srcLabel);
|
|
1572
|
+
rep.fail(`resolveTarget 收到空 targetRaw,srcLabel: ${srcLabel}`, { where: 'flow' });
|
|
1573
|
+
}
|
|
1574
|
+
const trimmed = targetRaw.trim().replace(/:/g, ':');
|
|
1575
|
+
const inlineMatch = trimmed.match(/^\[(.+?)\]:\s*(.*)$/);
|
|
1576
|
+
if (inlineMatch) {
|
|
1577
|
+
const label = inlineMatch[1];
|
|
1578
|
+
const ref = inlineMatch[2].trim();
|
|
1579
|
+
if (!usedLabels.has(label) && !nodeDecls.some(d => d.label === label)) {
|
|
1580
|
+
nodeDecls.push({ label, ref });
|
|
1581
|
+
usedLabels.add(label);
|
|
1582
|
+
}
|
|
1583
|
+
addEdge({ srcLabel, tgtLabel: label, cond, isBack: false });
|
|
1584
|
+
return label;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
const bracketMatch = trimmed.match(/^\[(.+)\]$/);
|
|
1588
|
+
if (bracketMatch) {
|
|
1589
|
+
const label = bracketMatch[1];
|
|
1590
|
+
if (!usedLabels.has(label) && !nodeDecls.some(d => d.label === label)) {
|
|
1591
|
+
nodeDecls.push({ label, ref: '' });
|
|
1592
|
+
usedLabels.add(label);
|
|
1593
|
+
}
|
|
1594
|
+
addEdge({ srcLabel, tgtLabel: label, cond, isBack: false });
|
|
1595
|
+
return label;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
// 普通引用
|
|
1599
|
+
let nodeLabel = trimmed.startsWith('&') ? trimmed.substring(1) : trimmed;
|
|
1600
|
+
const baseName = nodeLabel.replace(/\(.*$/, '').trim();
|
|
1601
|
+
let label = baseName;
|
|
1602
|
+
let counter = 2;
|
|
1603
|
+
while (usedLabels.has(label) || nodeDecls.some(d => d.label === label)) {
|
|
1604
|
+
label = `${baseName}_${counter}`;
|
|
1605
|
+
counter++;
|
|
1606
|
+
}
|
|
1607
|
+
nodeDecls.push({ label, ref: trimmed.trim() });
|
|
1608
|
+
usedLabels.add(label);
|
|
1609
|
+
addEdge({ srcLabel, tgtLabel: label, cond, isBack: false });
|
|
1610
|
+
return label;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
// 链式入口解析:[A] -> [B] -> fork:/for:/par: 的入口串。
|
|
1614
|
+
// 先把入口链建成普通边,返回链尾节点作为控制块的入口。
|
|
1615
|
+
function resolveChainEntry(raw) {
|
|
1616
|
+
const parts = raw.split('->').map(p => p.trim()).filter(Boolean);
|
|
1617
|
+
if (parts.length <= 1) return ensureNodeForRef(parts[0] || raw.trim());
|
|
1618
|
+
let prev = ensureNodeForRef(parts[0]);
|
|
1619
|
+
for (let k = 1; k < parts.length; k++) {
|
|
1620
|
+
prev = resolveTarget(prev, parts[k], '');
|
|
1621
|
+
}
|
|
1622
|
+
return prev;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
// 链式出口解析:-> [FAREWELL]:farewell -> [END](for/par 出口行允许内联定义 + 链)
|
|
1626
|
+
function resolveExitChain(raw, srcLabel) {
|
|
1627
|
+
const parts = raw.split('->').map(p => p.trim()).filter(Boolean);
|
|
1628
|
+
if (parts.length === 0) return srcLabel;
|
|
1629
|
+
let cur = srcLabel;
|
|
1630
|
+
for (const part of parts) {
|
|
1631
|
+
const ifMatch = part.match(/^if\s*\((.+)\)$/);
|
|
1632
|
+
if (ifMatch) {
|
|
1633
|
+
const rest = part.slice(part.indexOf(')') + 1).trim();
|
|
1634
|
+
cur = resolveTarget(cur, rest, ifMatch[1].trim());
|
|
1635
|
+
} else {
|
|
1636
|
+
cur = resolveTarget(cur, part, '');
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
return cur;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
// ── 第一步:全局裸引用规范化(按->切块,智能保留控制结构) ──
|
|
1643
|
+
for (const line of flowLines) {
|
|
1644
|
+
|
|
1645
|
+
let t = normalizeSymbols(line.text, 'flow');
|
|
1646
|
+
console.log('规范化前:', line.text);
|
|
1647
|
+
// 按 -> 切割成块
|
|
1648
|
+
const parts = t.split('->').map(p => {
|
|
1649
|
+
let s = p.trim();
|
|
1650
|
+
if (!s) return '';
|
|
1651
|
+
|
|
1652
|
+
// 已经是 [label] 或 [label]:ref → 原样
|
|
1653
|
+
if (s.startsWith('[')) return s;
|
|
1654
|
+
|
|
1655
|
+
// 包含冒号的定义式(如 god:god_announce) → 原样
|
|
1656
|
+
if (/^[^:]+\s*:\s*.+/.test(s)) return s;
|
|
1657
|
+
|
|
1658
|
+
// 如果块内包含控制流关键字或括号 → 整块原样保留
|
|
1659
|
+
if (
|
|
1660
|
+
/\b(if|for|while|fork|par|join|in|to|all)\b/.test(s) ||
|
|
1661
|
+
/[()]/.test(s)
|
|
1662
|
+
) {
|
|
1663
|
+
return s;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
// &module → 转成 [module]
|
|
1667
|
+
if (s.startsWith('&')) {
|
|
1668
|
+
const label = ensureNodeForRef(s);
|
|
1669
|
+
return `[${label}]`;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
// 纯标识符(如 tally, nextDay;含中文节点名如 随机等一会儿)→ 转成 [label]
|
|
1673
|
+
if (/^[\p{L}_][\p{L}\p{N}_]*$/u.test(s)) {
|
|
1674
|
+
const label = ensureNodeForRef(s);
|
|
1675
|
+
return `[${label}]`;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
// 其他未知结构,原样保留(安全)
|
|
1679
|
+
return s;
|
|
1680
|
+
});
|
|
1681
|
+
|
|
1682
|
+
// 用 ' -> ' 重新拼接(保证后续正则 100% 命中)
|
|
1683
|
+
line.text = parts.join(' -> ');
|
|
1684
|
+
console.log('规范化后:', line.text);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
let i = 0;
|
|
1688
|
+
let loopGuard = 0;
|
|
1689
|
+
while (i < flowLines.length) {
|
|
1690
|
+
|
|
1691
|
+
if (++loopGuard > flowLines.length * 20) {
|
|
1692
|
+
rep.fail(`流程解析陷入死循环`, { line: (flowLines[i]?.lineNum ?? i) + 1, lineText: flowLines[i]?.raw || '', where: 'flow' });
|
|
1693
|
+
}
|
|
1694
|
+
const cl = flowLines[i];
|
|
1695
|
+
if (!cl) break;
|
|
1696
|
+
let text = normalizeSymbols(cl.text, 'flow').trim();
|
|
1697
|
+
console.log('>>> LINE', cl.lineNum+1, JSON.stringify(text));
|
|
1698
|
+
|
|
1699
|
+
// 跳过空行和注释
|
|
1700
|
+
if (!text || text.startsWith('//')) {
|
|
1701
|
+
i++;
|
|
1702
|
+
continue;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
// 跳过 // 注释行
|
|
1706
|
+
if (text.startsWith('//')) { i++; continue; }
|
|
1707
|
+
|
|
1708
|
+
// 注释行(# for loop 魔法注释已废弃,一律跳过)
|
|
1709
|
+
if (text.startsWith('#')) {
|
|
1710
|
+
i++;
|
|
1711
|
+
continue;
|
|
1712
|
+
}
|
|
1713
|
+
// fork: 显式入口 [A] -> fork:(支持链式入口 [A] -> [B] -> fork:)
|
|
1714
|
+
const forkMatch = text.match(/^(.+)\s*->\s*fork:$/);
|
|
1715
|
+
if (forkMatch) {
|
|
1716
|
+
const srcLabel = resolveChainEntry(forkMatch[1].trim());
|
|
1717
|
+
i++;
|
|
1718
|
+
let forkGuard = 0;
|
|
1719
|
+
while (i < flowLines.length && flowLines[i].indent > cl.indent) {
|
|
1720
|
+
if (++forkGuard > 500) rep.fail(`fork 分支解析死循环`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'flow' });
|
|
1721
|
+
const rawLine = flowLines[i].text;
|
|
1722
|
+
const bl = normalizeSymbols(rawLine, 'flow').trim();
|
|
1723
|
+
// 分支行:-> if (cond) -> 目标 或 -> 目标 -> 目标2 ...
|
|
1724
|
+
const bm = bl.match(/^->\s*(?:if\s*\((.+?)\)\s*->\s*)?(.+)$/);
|
|
1725
|
+
if (bm) {
|
|
1726
|
+
const cond = bm[1] || '';
|
|
1727
|
+
const rest = bm[2].trim();
|
|
1728
|
+
// 把剩余部分当链式解析,从 srcLabel 出发
|
|
1729
|
+
const parts = rest.split('->').map(p => p.trim()).filter(p => p !== '');
|
|
1730
|
+
if (parts.length === 0) rep.fail(`fork 分支缺少目标`, { line: flowLines[i].lineNum + 1, lineText: flowLines[i].raw || rawLine, where: 'flow' });
|
|
1731
|
+
let curSrc = srcLabel;
|
|
1732
|
+
let first = true;
|
|
1733
|
+
for (const part of parts) {
|
|
1734
|
+
curSrc = resolveTarget(curSrc, part, first ? cond : '');
|
|
1735
|
+
first = false;
|
|
1736
|
+
}
|
|
1737
|
+
} else {
|
|
1738
|
+
rep.fail(`fork 分支格式错误: "${rawLine}"`, { line: flowLines[i].lineNum + 1, lineText: flowLines[i].raw || rawLine, where: 'flow' });
|
|
1739
|
+
}
|
|
1740
|
+
i++;
|
|
1741
|
+
}
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
// par 循环(与 for 完全相同的解析,但特殊类型为 PAR)
|
|
1748
|
+
const parMatch = text.match(/^(.+)\s*->\s*par\s+(.+):$/);
|
|
1749
|
+
if (parMatch) {
|
|
1750
|
+
const entryRaw = parMatch[1].trim();
|
|
1751
|
+
const condition = parMatch[2].trim();
|
|
1752
|
+
|
|
1753
|
+
const entryLabel = resolveChainEntry(entryRaw);
|
|
1754
|
+
|
|
1755
|
+
let parLabel = 'PAR';
|
|
1756
|
+
let counter = 2;
|
|
1757
|
+
while (nodeDecls.some(d => d.label === parLabel)) {
|
|
1758
|
+
parLabel = `PAR_${counter}`;
|
|
1759
|
+
counter++;
|
|
1760
|
+
}
|
|
1761
|
+
const parNodeLabel = parLabel;
|
|
1762
|
+
const parOutLabel = parLabel + '_out';
|
|
1763
|
+
|
|
1764
|
+
nodeDecls.push({
|
|
1765
|
+
label: parNodeLabel,
|
|
1766
|
+
ref: '',
|
|
1767
|
+
specialType: 'PAR',
|
|
1768
|
+
forCondition: condition,
|
|
1769
|
+
});
|
|
1770
|
+
|
|
1771
|
+
// 立即创建 par_out 节点(确保无论是否有出口行都存在)
|
|
1772
|
+
if (!nodeDecls.some(d => d.label === parOutLabel)) {
|
|
1773
|
+
nodeDecls.push({
|
|
1774
|
+
label: parOutLabel,
|
|
1775
|
+
ref: '',
|
|
1776
|
+
specialType: 'PAR_OUT',
|
|
1777
|
+
forNodeId: parNodeLabel,
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
addEdge({ srcLabel: entryLabel, tgtLabel: parNodeLabel, cond: '', isBack: false });
|
|
1782
|
+
|
|
1783
|
+
i++; // 跳过 par 行
|
|
1784
|
+
|
|
1785
|
+
const rawBodyLines = [];
|
|
1786
|
+
while (i < flowLines.length && flowLines[i].indent > cl.indent) {
|
|
1787
|
+
rawBodyLines.push(flowLines[i]);
|
|
1788
|
+
i++;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
if (rawBodyLines.length === 0) {
|
|
1792
|
+
rep.fail(`par 块不能为空`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'flow' });
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
const pendingBackNodes = [];
|
|
1796
|
+
const cleanBodyLines = [];
|
|
1797
|
+
|
|
1798
|
+
for (const bl of rawBodyLines) {
|
|
1799
|
+
let textBody = normalizeSymbols(bl.text, 'flow').trim();
|
|
1800
|
+
let lastNodeInLine = null;
|
|
1801
|
+
|
|
1802
|
+
if (textBody.startsWith('->')) {
|
|
1803
|
+
const restAfterStart = textBody.substring(2).trim();
|
|
1804
|
+
const ifMatch = restAfterStart.match(/^if\s*\((.+?)\)\s*->\s*(.*)$/);
|
|
1805
|
+
let startCond = '';
|
|
1806
|
+
if (ifMatch) {
|
|
1807
|
+
startCond = ifMatch[1].trim();
|
|
1808
|
+
textBody = ifMatch[2].trim();
|
|
1809
|
+
} else {
|
|
1810
|
+
textBody = restAfterStart;
|
|
1811
|
+
}
|
|
1812
|
+
const parts = textBody.split('->').map(x => x.trim()).filter(Boolean);
|
|
1813
|
+
if (!parts.length) {
|
|
1814
|
+
rep.fail(`par 内部行首 -> 后面缺少目标`, { line: bl.lineNum + 1, lineText: bl.raw || bl.text, where: 'flow' });
|
|
1815
|
+
}
|
|
1816
|
+
const firstPart = parts[0];
|
|
1817
|
+
const tgtLabel = resolveTarget(parNodeLabel, firstPart, startCond);
|
|
1818
|
+
lastNodeInLine = tgtLabel;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
let endsWithArrow = false;
|
|
1822
|
+
if (textBody.endsWith('->')) {
|
|
1823
|
+
textBody = textBody.slice(0, -2).trim();
|
|
1824
|
+
endsWithArrow = true;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
if (textBody) {
|
|
1828
|
+
const parts = textBody.split('->').map(p => p.trim()).filter(p => p !== '');
|
|
1829
|
+
if (parts.length > 0) {
|
|
1830
|
+
const lastPart = parts[parts.length - 1];
|
|
1831
|
+
const labelMatch = lastPart.match(/^\[(.+?)\]/);
|
|
1832
|
+
if (labelMatch) {
|
|
1833
|
+
lastNodeInLine = labelMatch[1];
|
|
1834
|
+
} else {
|
|
1835
|
+
lastNodeInLine = ensureNodeForRef(lastPart);
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
} else if (!lastNodeInLine) {
|
|
1839
|
+
rep.fail(`par 内部行缺少节点`, { line: bl.lineNum + 1, lineText: bl.raw || bl.text, where: 'flow' });
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
if (endsWithArrow && lastNodeInLine) {
|
|
1843
|
+
pendingBackNodes.push(lastNodeInLine);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
if (textBody) {
|
|
1847
|
+
cleanBodyLines.push({
|
|
1848
|
+
...bl,
|
|
1849
|
+
text: textBody,
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
if (cleanBodyLines.length > 0) {
|
|
1855
|
+
const minIndent = Math.min(...cleanBodyLines.map(l => l.indent));
|
|
1856
|
+
const normalizedLines = cleanBodyLines.map(l => ({
|
|
1857
|
+
...l,
|
|
1858
|
+
indent: l.indent - minIndent + 2,
|
|
1859
|
+
}));
|
|
1860
|
+
const { nodeDecls: bodyDecls, edges: bodyEdges } = parseFlowSection(
|
|
1861
|
+
normalizedLines,
|
|
1862
|
+
[...usedLabels],
|
|
1863
|
+
rep
|
|
1864
|
+
);
|
|
1865
|
+
bodyDecls.forEach(d => {
|
|
1866
|
+
if (!nodeDecls.some(existing => existing.label === d.label)) {
|
|
1867
|
+
nodeDecls.push(d);
|
|
1868
|
+
}
|
|
1869
|
+
});
|
|
1870
|
+
bodyEdges.forEach(be => addEdge(be));
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
// 内部路径末端连向 par_out(不再是 PAR 自身)
|
|
1874
|
+
pendingBackNodes.forEach(pbLabel => {
|
|
1875
|
+
addEdge({ srcLabel: pbLabel, tgtLabel: parOutLabel, cond: '', isBack: false });
|
|
1876
|
+
});
|
|
1877
|
+
|
|
1878
|
+
// 处理出口:同缩进的 -> [ExitNode](出口行可同时是控制块入口:
|
|
1879
|
+
// -> [A] -> [B] -> fork: 时,链部分作为出口,控制块行留给主循环)
|
|
1880
|
+
if (i < flowLines.length && flowLines[i].indent === cl.indent) {
|
|
1881
|
+
const afterLine = normalizeSymbols(flowLines[i].text, 'flow').trim();
|
|
1882
|
+
const am = afterLine.match(/^->\s*(.+)$/);
|
|
1883
|
+
if (am) {
|
|
1884
|
+
const exitTargetRaw = am[1].trim();
|
|
1885
|
+
const ctrlMatch = exitTargetRaw.match(/\s*->\s*(for|par|fork|join)\b/);
|
|
1886
|
+
if (ctrlMatch) {
|
|
1887
|
+
// 出口链 + 控制块入口:链部分建出口边,不消费该行
|
|
1888
|
+
const chainPart = exitTargetRaw.slice(0, ctrlMatch.index).trim();
|
|
1889
|
+
if (chainPart) {
|
|
1890
|
+
resolveExitChain(chainPart, parOutLabel);
|
|
1891
|
+
}
|
|
1892
|
+
} else {
|
|
1893
|
+
// 纯出口链(支持内联定义:-> [FAREWELL]:farewell -> [END])
|
|
1894
|
+
resolveExitChain(exitTargetRaw, parOutLabel);
|
|
1895
|
+
i++;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
currentNode = parOutLabel;
|
|
1901
|
+
continue;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
// join(all):
|
|
1905
|
+
const jm = text.match(/^join\((\w+)\):$/);
|
|
1906
|
+
if (jm) {
|
|
1907
|
+
const joinParam = jm[1]; // 保留用户写的参数,如 "all", "1", "any"
|
|
1908
|
+
i++;
|
|
1909
|
+
const sources = [];
|
|
1910
|
+
while (i < flowLines.length && !flowLines[i].text.trim().startsWith('to ')) {
|
|
1911
|
+
const rawLine = flowLines[i].text;
|
|
1912
|
+
const srcLine = rawLine.trim();
|
|
1913
|
+
if (!srcLine.endsWith('->')) {
|
|
1914
|
+
rep.fail(`join 内部每行必须以 -> 结尾。当前行: "${rawLine}"`, { line: flowLines[i].lineNum + 1, lineText: flowLines[i].raw || rawLine, where: 'flow' });
|
|
1915
|
+
}
|
|
1916
|
+
// label 禁止跨括号(防回溯把多段链式吞进单个节点名)
|
|
1917
|
+
const sm = srcLine.match(/^\[([^\[\]]+?)\]\s*->$/);
|
|
1918
|
+
if (sm) {
|
|
1919
|
+
sources.push(sm[1]);
|
|
1920
|
+
} else {
|
|
1921
|
+
rep.fail(`join 源节点格式错误,期望 [节点名] ->,实际: "${rawLine}"`, { line: flowLines[i].lineNum + 1, lineText: flowLines[i].raw || rawLine, where: 'flow' });
|
|
1922
|
+
}
|
|
1923
|
+
i++;
|
|
1924
|
+
}
|
|
1925
|
+
if (i < flowLines.length && flowLines[i].text.trim().startsWith('to ')) {
|
|
1926
|
+
let targetRaw = flowLines[i].text.trim().slice(3).trim();
|
|
1927
|
+
if (!targetRaw) rep.fail(`join 目标为空`, { line: flowLines[i].lineNum + 1, lineText: flowLines[i].raw || '', where: 'flow' });
|
|
1928
|
+
if (targetRaw.endsWith('->')) {
|
|
1929
|
+
targetRaw = targetRaw.slice(0, -2).trim();
|
|
1930
|
+
}
|
|
1931
|
+
// 支持链式目标 to [A]:ref -> [B]:sources 连链首,currentNode 走链尾
|
|
1932
|
+
const parts = targetRaw.split('->').map(p => p.trim()).filter(Boolean);
|
|
1933
|
+
if (parts.length === 0) rep.fail(`join 目标为空`, { line: flowLines[i].lineNum + 1, lineText: flowLines[i].raw || '', where: 'flow' });
|
|
1934
|
+
const tgtLabel = ensureNodeForRef(parts[0]);
|
|
1935
|
+
let tail = tgtLabel;
|
|
1936
|
+
for (let k = 1; k < parts.length; k++) {
|
|
1937
|
+
tail = resolveTarget(tail, parts[k], '');
|
|
1938
|
+
}
|
|
1939
|
+
sources.forEach(s => addEdge({ srcLabel: s, tgtLabel: tgtLabel, cond: '', isBack: false }));
|
|
1940
|
+
|
|
1941
|
+
// ═══ 将 join 信息存入目标节点的声明 ═══
|
|
1942
|
+
const tgtDecl = nodeDecls.find(d => d.label === tgtLabel);
|
|
1943
|
+
if (tgtDecl) {
|
|
1944
|
+
if (!tgtDecl.joinEntries) tgtDecl.joinEntries = [];
|
|
1945
|
+
tgtDecl.joinEntries.push({ sources: sources.slice(), param: joinParam });
|
|
1946
|
+
} else {
|
|
1947
|
+
// ensureNodeForRef 应该已创建,但以防万一手动补
|
|
1948
|
+
const newDecl = { label: tgtLabel, ref: '', joinEntries: [{ sources: sources.slice(), param: joinParam }] };
|
|
1949
|
+
nodeDecls.push(newDecl);
|
|
1950
|
+
usedLabels.add(tgtLabel);
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
currentNode = tail;
|
|
1954
|
+
i++;
|
|
1955
|
+
} else {
|
|
1956
|
+
rep.fail(`join 缺少 to 目标`, { line: (flowLines[i]?.lineNum ?? flowLines.length) + 1, lineText: flowLines[i]?.raw || '', where: 'flow' });
|
|
1957
|
+
}
|
|
1958
|
+
continue;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
|
|
1962
|
+
|
|
1963
|
+
// for 循环新语法: [A] -> for 条件:
|
|
1964
|
+
const forEntryMatch = text.match(/^(.+)\s*->\s*for\s+(.+):$/);
|
|
1965
|
+
if (forEntryMatch) {
|
|
1966
|
+
const entryRaw = forEntryMatch[1].trim();
|
|
1967
|
+
const condition = forEntryMatch[2].trim();
|
|
1968
|
+
|
|
1969
|
+
// 解析入口节点(支持链式入口 [A] -> [B] -> for ...)
|
|
1970
|
+
const entryLabel = resolveChainEntry(entryRaw);
|
|
1971
|
+
|
|
1972
|
+
// 生成唯一的 FOR 节点标签
|
|
1973
|
+
let forLabel = 'FOR';
|
|
1974
|
+
let counter = 2;
|
|
1975
|
+
while (nodeDecls.some(d => d.label === forLabel)) {
|
|
1976
|
+
forLabel = `FOR_${counter}`;
|
|
1977
|
+
counter++;
|
|
1978
|
+
}
|
|
1979
|
+
const forNodeLabel = forLabel;
|
|
1980
|
+
const forOutLabel = forLabel + '_out';
|
|
1981
|
+
|
|
1982
|
+
// 声明 FOR 节点
|
|
1983
|
+
nodeDecls.push({
|
|
1984
|
+
label: forNodeLabel,
|
|
1985
|
+
ref: '',
|
|
1986
|
+
specialType: 'FOR',
|
|
1987
|
+
forCondition: condition,
|
|
1988
|
+
});
|
|
1989
|
+
|
|
1990
|
+
// 入口边: entryLabel -> FOR
|
|
1991
|
+
addEdge({ srcLabel: entryLabel, tgtLabel: forNodeLabel, cond: '', isBack: false });
|
|
1992
|
+
|
|
1993
|
+
i++; // 跳过 for 行
|
|
1994
|
+
|
|
1995
|
+
// 收集缩进大于 for 行的内部行
|
|
1996
|
+
const rawBodyLines = [];
|
|
1997
|
+
while (i < flowLines.length && flowLines[i].indent > cl.indent) {
|
|
1998
|
+
rawBodyLines.push(flowLines[i]);
|
|
1999
|
+
i++;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
if (rawBodyLines.length === 0) {
|
|
2003
|
+
rep.fail(`for 块不能为空`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'flow' });
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
// ---------- 剥箭头预处理 ----------
|
|
2007
|
+
const pendingBackNodes = []; // 需要回连/连出口的节点 label
|
|
2008
|
+
const cleanBodyLines = []; // 剥除箭头后的行(用于递归解析)
|
|
2009
|
+
|
|
2010
|
+
for (const bl of rawBodyLines) {
|
|
2011
|
+
let textBody = normalizeSymbols(bl.text, 'flow').trim();
|
|
2012
|
+
let lastNodeInLine = null; // 记录该行最右节点
|
|
2013
|
+
|
|
2014
|
+
// 1. 处理行首箭头:-> if (cond) -> target 或 -> target ...
|
|
2015
|
+
if (textBody.startsWith('->')) {
|
|
2016
|
+
const restAfterStart = textBody.substring(2).trim();
|
|
2017
|
+
const ifMatch = restAfterStart.match(/^if\s*\((.+?)\)\s*->\s*(.*)$/);
|
|
2018
|
+
let startCond = '';
|
|
2019
|
+
if (ifMatch) {
|
|
2020
|
+
startCond = ifMatch[1].trim();
|
|
2021
|
+
textBody = ifMatch[2].trim();
|
|
2022
|
+
} else {
|
|
2023
|
+
textBody = restAfterStart;
|
|
2024
|
+
}
|
|
2025
|
+
// 提取第一个目标节点(仅用于生成 FOR->node 边,不截断 textBody)
|
|
2026
|
+
const parts =
|
|
2027
|
+
textBody
|
|
2028
|
+
.split('->')
|
|
2029
|
+
.map(x => x.trim())
|
|
2030
|
+
.filter(Boolean);
|
|
2031
|
+
|
|
2032
|
+
if (!parts.length) {
|
|
2033
|
+
rep.fail(`for 内部行首 -> 后面缺少目标`, { line: bl.lineNum + 1, lineText: bl.raw || bl.text, where: 'flow' });
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
const firstPart = parts[0];
|
|
2037
|
+
|
|
2038
|
+
const tgtLabel =
|
|
2039
|
+
resolveTarget(
|
|
2040
|
+
forNodeLabel,
|
|
2041
|
+
firstPart,
|
|
2042
|
+
startCond
|
|
2043
|
+
);
|
|
2044
|
+
|
|
2045
|
+
lastNodeInLine = tgtLabel;
|
|
2046
|
+
// 注意:textBody 保持不变,继续包含完整链式,以便后续行尾箭头处理和 cleanBodyLines 解析
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
// 2. 处理行尾箭头
|
|
2050
|
+
let endsWithArrow = false;
|
|
2051
|
+
if (textBody.endsWith('->')) {
|
|
2052
|
+
textBody = textBody.slice(0, -2).trim();
|
|
2053
|
+
endsWithArrow = true;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
// 3. 找出该行的最右节点(用于 pendingBackNodes)
|
|
2057
|
+
if (textBody) {
|
|
2058
|
+
// 从 textBody 中提取最后一个节点 label
|
|
2059
|
+
const parts = textBody.split('->').map(p => p.trim()).filter(p => p !== '');
|
|
2060
|
+
if (parts.length > 0) {
|
|
2061
|
+
const lastPart = parts[parts.length - 1];
|
|
2062
|
+
// 尝试解析最后一个节点的 label
|
|
2063
|
+
const labelMatch = lastPart.match(/^\[(.+?)\]/);
|
|
2064
|
+
if (labelMatch) {
|
|
2065
|
+
lastNodeInLine = labelMatch[1];
|
|
2066
|
+
} else {
|
|
2067
|
+
// 裸引用,用 ensureNodeForRef 获取 label
|
|
2068
|
+
const lbl = ensureNodeForRef(lastPart);
|
|
2069
|
+
lastNodeInLine = lbl;
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
} else if (!lastNodeInLine) {
|
|
2073
|
+
// textBody 为空且没有行首箭头,说明该行只有行尾箭头(不太可能,但防御)
|
|
2074
|
+
rep.fail(`for 内部行缺少节点`, { line: bl.lineNum + 1, lineText: bl.raw || bl.text, where: 'flow' });
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
// 如果有行尾箭头,记录最右节点
|
|
2078
|
+
if (endsWithArrow && lastNodeInLine) {
|
|
2079
|
+
pendingBackNodes.push(lastNodeInLine);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
// 若剥完后 textBody 非空,作为普通行加入 cleanBodyLines
|
|
2083
|
+
if (textBody) {
|
|
2084
|
+
cleanBodyLines.push({
|
|
2085
|
+
...bl,
|
|
2086
|
+
text: textBody,
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
// 递归解析清理后的循环体内部
|
|
2092
|
+
if (cleanBodyLines.length > 0) {
|
|
2093
|
+
const minIndent = Math.min(...cleanBodyLines.map(l => l.indent));
|
|
2094
|
+
const normalizedLines = cleanBodyLines.map(l => ({
|
|
2095
|
+
...l,
|
|
2096
|
+
indent: l.indent - minIndent + 2,
|
|
2097
|
+
}));
|
|
2098
|
+
const { nodeDecls: bodyDecls, edges: bodyEdges } = parseFlowSection(
|
|
2099
|
+
normalizedLines,
|
|
2100
|
+
[...usedLabels],
|
|
2101
|
+
rep
|
|
2102
|
+
);
|
|
2103
|
+
bodyDecls.forEach(d => {
|
|
2104
|
+
if (!nodeDecls.some(existing => existing.label === d.label)) {
|
|
2105
|
+
nodeDecls.push(d);
|
|
2106
|
+
}
|
|
2107
|
+
});
|
|
2108
|
+
bodyEdges.forEach(be => addEdge(be));
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
// 处理出口:同缩进的 -> [ExitNode]
|
|
2112
|
+
// 无论有无出口,pendingBackNodes 都应回连 FOR 形成环
|
|
2113
|
+
pendingBackNodes.forEach(pbLabel => {
|
|
2114
|
+
addEdge({ srcLabel: pbLabel, tgtLabel: forNodeLabel, cond: '', isBack: true });
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
console.log('FOR出口诊断:', {
|
|
2118
|
+
i,
|
|
2119
|
+
lineText: flowLines[i]?.text,
|
|
2120
|
+
lineIndent: flowLines[i]?.indent,
|
|
2121
|
+
forIndent: cl.indent,
|
|
2122
|
+
isMatch: flowLines[i]?.indent === cl.indent
|
|
2123
|
+
});
|
|
2124
|
+
if (i < flowLines.length && flowLines[i].indent === cl.indent) {
|
|
2125
|
+
const afterLine = normalizeSymbols(flowLines[i].text, 'flow').trim();
|
|
2126
|
+
const am = afterLine.match(/^->\s*(.+)$/);
|
|
2127
|
+
if (am) {
|
|
2128
|
+
// 声明 for_out 节点
|
|
2129
|
+
if (!nodeDecls.some(d => d.label === forOutLabel)) {
|
|
2130
|
+
nodeDecls.push({
|
|
2131
|
+
label: forOutLabel,
|
|
2132
|
+
ref: '',
|
|
2133
|
+
specialType: 'FOR_OUT',
|
|
2134
|
+
forNodeId: forNodeLabel,
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
const exitTargetRaw = am[1].trim();
|
|
2138
|
+
const ctrlMatch = exitTargetRaw.match(/\s*->\s*(for|par|fork|join)\b/);
|
|
2139
|
+
if (ctrlMatch) {
|
|
2140
|
+
// 出口链 + 控制块入口:链部分建出口边,不消费该行
|
|
2141
|
+
const chainPart = exitTargetRaw.slice(0, ctrlMatch.index).trim();
|
|
2142
|
+
if (chainPart) {
|
|
2143
|
+
resolveExitChain(chainPart, forOutLabel);
|
|
2144
|
+
}
|
|
2145
|
+
} else {
|
|
2146
|
+
// for_out -> 出口节点(支持链:-> [X]:ref -> [Y])
|
|
2147
|
+
resolveExitChain(exitTargetRaw, forOutLabel);
|
|
2148
|
+
i++;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
// 更新 currentNode 为 for_out 标签,方便后续链
|
|
2154
|
+
currentNode = forOutLabel;
|
|
2155
|
+
continue;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
// ⚠️ 重要:先匹配链式连接([label] -> ...),再匹配节点声明([label]: ...)
|
|
2160
|
+
// [label]:ref -> ... 链式(如 [AI_ATK]:ai_attack -> [AI_DONE])
|
|
2161
|
+
// label 用 [^\[\]] 防回溯跨箭头:否则 `[START] -> [x]:a -> [END]` 会被
|
|
2162
|
+
// 误判成声明行,把 "START] -> [x" 当成节点名(2026-08-22 flow 链式 bug 根因)。
|
|
2163
|
+
const dmChain = text.match(/^\[([^\[\]]+?)\]:\s*(\S+)\s*->\s*(.+)$/);
|
|
2164
|
+
if (dmChain) {
|
|
2165
|
+
const label = dmChain[1];
|
|
2166
|
+
const ref = dmChain[2].trim();
|
|
2167
|
+
const existing = nodeDecls.find((d) => d.label === label);
|
|
2168
|
+
if (existing) existing.ref = ref || existing.ref;
|
|
2169
|
+
else nodeDecls.push({ label, ref });
|
|
2170
|
+
i++;
|
|
2171
|
+
// 剩余链从 label 出发(复用 chainMatch 的解析逻辑)
|
|
2172
|
+
const rest = dmChain[3].trim();
|
|
2173
|
+
const rawParts = rest.split('->').map((p) => p.trim()).filter((p) => p !== '');
|
|
2174
|
+
const parts = [];
|
|
2175
|
+
let pendingCond = null;
|
|
2176
|
+
for (const part of rawParts) {
|
|
2177
|
+
const ifMatch = part.match(/^if\s*\((.+)\)$/);
|
|
2178
|
+
if (ifMatch) {
|
|
2179
|
+
pendingCond = ifMatch[1].trim();
|
|
2180
|
+
} else {
|
|
2181
|
+
parts.push({ target: part, cond: pendingCond || '' });
|
|
2182
|
+
pendingCond = null;
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
if (pendingCond) {
|
|
2186
|
+
rep.fail(
|
|
2187
|
+
`条件 "if (${pendingCond})" 后面缺少目标节点`,
|
|
2188
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'flow' }
|
|
2189
|
+
);
|
|
2190
|
+
}
|
|
2191
|
+
let currentSrc = label;
|
|
2192
|
+
for (const { target, cond } of parts) {
|
|
2193
|
+
currentSrc = resolveTarget(currentSrc, target, cond);
|
|
2194
|
+
}
|
|
2195
|
+
currentNode = currentSrc;
|
|
2196
|
+
continue;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
const chainMatch = text.match(/^\[(.+?)\]\s*->\s*(.*)$/);
|
|
2200
|
+
if (chainMatch) {
|
|
2201
|
+
const srcLabel = chainMatch[1];
|
|
2202
|
+
let rest = chainMatch[2];
|
|
2203
|
+
i++;
|
|
2204
|
+
|
|
2205
|
+
if (!nodeDecls.some(d => d.label === srcLabel)) {
|
|
2206
|
+
nodeDecls.push({ label: srcLabel, ref: '' });
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
const rawParts = rest.split('->').map(p => p.trim()).filter(p => p !== '');
|
|
2210
|
+
const parts = [];
|
|
2211
|
+
let pendingCond = null;
|
|
2212
|
+
for (const part of rawParts) {
|
|
2213
|
+
const ifMatch = part.match(/^if\s*\((.+)\)$/);
|
|
2214
|
+
if (ifMatch) {
|
|
2215
|
+
pendingCond = ifMatch[1].trim();
|
|
2216
|
+
} else {
|
|
2217
|
+
parts.push({ target: part, cond: pendingCond || '' });
|
|
2218
|
+
pendingCond = null;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
if (pendingCond) {
|
|
2222
|
+
rep.fail(
|
|
2223
|
+
`条件 "if (${pendingCond})" 后面缺少目标节点`,
|
|
2224
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'flow' }
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
let currentSrc = srcLabel;
|
|
2229
|
+
for (const { target, cond } of parts) {
|
|
2230
|
+
currentSrc = resolveTarget(currentSrc, target, cond);
|
|
2231
|
+
}
|
|
2232
|
+
currentNode = currentSrc;
|
|
2233
|
+
continue;
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
// 单节点引用(无箭头),例如 for 内部剥箭头后只剩 [A]
|
|
2237
|
+
const soloNodeMatch = text.match(/^\[(.+?)\]\s*$/);
|
|
2238
|
+
if (soloNodeMatch && !text.includes('->') && !text.includes(':')) {
|
|
2239
|
+
ensureNodeForRef(`[${soloNodeMatch[1]}]`);
|
|
2240
|
+
i++;
|
|
2241
|
+
continue;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
// 节点声明 [label]: ref
|
|
2245
|
+
const dm = text.match(/^\[(.+?)\]:\s*(.*)$/);
|
|
2246
|
+
if (dm) {
|
|
2247
|
+
const label = dm[1];
|
|
2248
|
+
const ref = dm[2].trim();
|
|
2249
|
+
const existing = nodeDecls.find(d => d.label === label);
|
|
2250
|
+
if (existing) existing.ref = ref || existing.ref;
|
|
2251
|
+
else nodeDecls.push({ label, ref });
|
|
2252
|
+
currentNode = label;
|
|
2253
|
+
i++;
|
|
2254
|
+
continue;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
rep.fail(
|
|
2261
|
+
`未识别的流程语法: "${text}"`,
|
|
2262
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'flow' }
|
|
2263
|
+
);
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
return { nodeDecls, edges };
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
export {
|
|
2270
|
+
normalizeSymbols, parseFEMO, splitTopBlocks, stripComments, stripLineComments,
|
|
2271
|
+
extractHashSketch,
|
|
2272
|
+
parseMetaBlock, parseVarsBlock, parseCodeBlock,
|
|
2273
|
+
parseActorsBlock, parseMemoryOrContextBlock,
|
|
2274
|
+
parseActionBlock, parseModuleBlock, parseMainflowBlock,
|
|
2275
|
+
parseFlowSection,
|
|
2276
|
+
};
|