femo-plugin 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +632 -635
- package/docs/ActiveRoadmaps/ARCHITECTURE.md +466 -0
- package/docs/ActiveRoadmaps/compiler/345/244/232job/345/220/214/350/267/221/346/224/271/351/200/240-/346/226/275/345/267/245/346/270/205/345/215/225.md +164 -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/ActiveRoadmaps//347/224/273/345/270/203/347/233/264/350/277/236/345/274/225/346/223/216/346/226/275/345/267/245/346/270/205/345/215/225.md +259 -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 +569 -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/engine-client.mjs +255 -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 +90 -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 +356 -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/mail_courier.py +104 -0
- package/femo2host/mailbox.py +545 -0
- package/femo2host/projectionCenter/app.css +848 -0
- package/femo2host/projectionCenter/composer.mjs +272 -0
- package/femo2host/projectionCenter/debug-panel.mjs +131 -0
- package/femo2host/projectionCenter/index.html +96 -0
- package/femo2host/projectionCenter/main.mjs +479 -0
- package/femo2host/projectionCenter/panels.mjs +280 -0
- package/femo2host/projectionCenter/render.mjs +695 -0
- package/femo2host/projectionCenter/sessions.mjs +138 -0
- package/femo2host/projectionCenter/state.mjs +105 -0
- package/femo2host/projectionCenter/theme.css +250 -0
- package/femo2host/projectionCenter/util.mjs +96 -0
- package/femo2host/projection_hub.py +8422 -0
- package/femo2host/python/femo_bridge.py +2131 -0
- package/femo2host/python/femo_daemon.py +1209 -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 +203 -61
- 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/270/246agent/347/211/210.femo +142 -0
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/AI/350/201/212/345/244/251/345/256/244.femo +111 -0
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/random_wait_time.py +80 -10
- package/{hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/LuxFiat/luxfiat.femo → femoExamples/LuxFiat/luxfiat-loop.femo} +67 -38
- 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/{hostAdapter/zcodeAdapter/femo-zcode-dist/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 → 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} +308 -53
- 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 +222 -47
- 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/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 +126 -42
- package/femoGen/AGENTS.md +145 -0
- package/femoGen/document_ch.html +20 -13
- package/femoGen/document_en.html +9 -2
- package/femoGen/index.html +4 -2
- package/femoGen/intro_ch.html +28 -26
- package/femoGen/intro_en.html +9 -2
- package/femoGen/src/FemoWorAuto.jsx +1215 -257
- 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 +94 -20
- package/femoGen/src/debugPanel.jsx +170 -43
- package/femoGen/src/engineWatch.jsx +323 -0
- 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 +30 -0
- package/femoGen/src/femoSaveReminder.jsx +75 -0
- package/femoGen/src/graphBuilder.jsx +2 -2
- package/femoGen/src/indentEdit.js +81 -0
- package/femoGen/src/libPanel.jsx +1 -1
- package/femoGen/src/mobileView.jsx +2871 -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/styles/font.css +13 -10
- package/femoGen/src/themes.js +297 -12
- package/femoGen/src/watchMirror.js +170 -0
- package/femoGen/vite.config.js +33 -28
- package/hostAdapter/dshAdapter/README.md +112 -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 -1100
- 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 +4 -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/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/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/femo-skill.ts +153 -0
- package/hostAdapter/dshAdapter/host/femoIdentity.ts +101 -0
- 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 +354 -638
- 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 +50 -96
- 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/engine-gateway.ts +128 -0
- package/hostAdapter/dshAdapter/host/routes/index.ts +603 -0
- package/hostAdapter/dshAdapter/host/{projection-input.ts → routes/projection-input.ts} +255 -246
- 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 +687 -641
- package/hostAdapter/dshAdapter/host/session-roster.ts +407 -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 +299 -0
- package/hostAdapter/dshAdapter/host/tools.ts +395 -486
- package/hostAdapter/dshAdapter/host/verbs.ts +81 -0
- package/hostAdapter/dshAdapter/host.manifest.json +2 -1
- package/hostAdapter/dshAdapter/lib/client.js +9209 -6558
- package/hostAdapter/dshAdapter/lib/client.js.map +4 -4
- package/hostAdapter/dshAdapter/lib/index.js +13 -8213
- package/hostAdapter/dshAdapter/lib/index.js.map +4 -4
- package/hostAdapter/dshAdapter/lib/main.js +10154 -0
- package/hostAdapter/dshAdapter/lib/main.js.map +7 -0
- package/hostAdapter/dshAdapter/package.json +5 -4
- package/hostAdapter/dshAdapter/pnpm-lock.yaml +606 -596
- 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/hostAdapter/webAdapter/AGENTS.md +203 -0
- package/hostAdapter/webAdapter/console/index.html +760 -0
- package/hostAdapter/webAdapter/extension/background.js +738 -0
- package/hostAdapter/webAdapter/extension/bubble.js +201 -0
- package/hostAdapter/webAdapter/extension/icons/icon128.png +0 -0
- package/hostAdapter/webAdapter/extension/icons/icon16.png +0 -0
- package/hostAdapter/webAdapter/extension/icons/icon32.png +0 -0
- package/hostAdapter/webAdapter/extension/icons/icon48.png +0 -0
- package/hostAdapter/webAdapter/extension/seat-agent-core.js +791 -0
- package/hostAdapter/webAdapter/extension/sidepanel/conn.mjs +25 -0
- package/hostAdapter/webAdapter/extension/sidepanel/feeds.mjs +57 -0
- package/hostAdapter/webAdapter/extension/sidepanel/human-seat.mjs +111 -0
- package/hostAdapter/webAdapter/extension/sidepanel/main.mjs +186 -0
- package/hostAdapter/webAdapter/extension/sidepanel/run-control.mjs +183 -0
- package/hostAdapter/webAdapter/extension/sidepanel/seats.mjs +172 -0
- package/hostAdapter/webAdapter/extension/sidepanel/svclog.mjs +78 -0
- package/hostAdapter/webAdapter/extension/sidepanel.html +600 -0
- package/hostAdapter/webAdapter/manifest.json +158 -0
- package/hostAdapter/webAdapter/native/install-native-host.cmd +8 -0
- package/hostAdapter/webAdapter/native/install-native-host.mjs +27 -0
- package/hostAdapter/webAdapter/native/register-core.mjs +101 -0
- package/hostAdapter/webAdapter/native/web-launcher.cs +141 -0
- package/hostAdapter/webAdapter/native/web-launcher.mjs +160 -0
- package/hostAdapter/webAdapter/package.json +13 -0
- package/hostAdapter/webAdapter/readme.md +365 -0
- package/hostAdapter/webAdapter/server/board.mjs +42 -0
- package/hostAdapter/webAdapter/server/bridge.mjs +68 -0
- package/hostAdapter/webAdapter/server/canvas.mjs +520 -0
- package/hostAdapter/webAdapter/server/http-io.mjs +20 -0
- package/hostAdapter/webAdapter/server/keeper.mjs +114 -0
- package/hostAdapter/webAdapter/server/mailbox-push.mjs +184 -0
- package/hostAdapter/webAdapter/server/runtime.mjs +1025 -0
- package/hostAdapter/webAdapter/server/seats.mjs +239 -0
- package/hostAdapter/webAdapter/server/service.mjs +1051 -0
- package/hostAdapter/webAdapter/shared/dom.mjs +33 -0
- package/hostAdapter/webAdapter/shared/femo-logo.mjs +36 -0
- package/hostAdapter/webAdapter/shared/guard.mjs +28 -0
- package/hostAdapter/webAdapter/shared/human-seat-core.mjs +56 -0
- package/hostAdapter/webAdapter/shared/run-core.mjs +20 -0
- package/hostAdapter/webAdapter/shared/seats-core.mjs +73 -0
- package/hostAdapter/webAdapter/sites/aistudio.google.com/SITE.md +66 -0
- package/hostAdapter/webAdapter/sites/aistudio.google.com/content.js +144 -0
- package/hostAdapter/webAdapter/sites/aistudio.google.com/inject.js +240 -0
- package/hostAdapter/webAdapter/sites/aistudio.google.com/site.mjs +70 -0
- package/hostAdapter/webAdapter/sites/chat.deepseek.com/SITE.md +77 -0
- package/hostAdapter/webAdapter/sites/chat.deepseek.com/content.js +103 -0
- package/hostAdapter/webAdapter/sites/chat.deepseek.com/inject.js +181 -0
- package/hostAdapter/webAdapter/sites/chat.deepseek.com/site.mjs +73 -0
- package/hostAdapter/webAdapter/sites/chatglm.cn/SITE.md +63 -0
- package/hostAdapter/webAdapter/sites/chatglm.cn/content.js +121 -0
- package/hostAdapter/webAdapter/sites/chatglm.cn/inject.js +190 -0
- package/hostAdapter/webAdapter/sites/chatglm.cn/site.mjs +63 -0
- package/hostAdapter/webAdapter/sites/chatgpt.com/SITE.md +58 -0
- package/hostAdapter/webAdapter/sites/chatgpt.com/content.js +124 -0
- package/hostAdapter/webAdapter/sites/chatgpt.com/inject.js +404 -0
- package/hostAdapter/webAdapter/sites/chatgpt.com/site.mjs +68 -0
- package/hostAdapter/webAdapter/sites/grok.com/SITE.md +42 -0
- package/hostAdapter/webAdapter/sites/grok.com/content.js +120 -0
- package/hostAdapter/webAdapter/sites/grok.com/inject.js +259 -0
- package/hostAdapter/webAdapter/sites/grok.com/site.mjs +73 -0
- package/hostAdapter/webAdapter/sites/www.doubao.com/SITE.md +62 -0
- package/hostAdapter/webAdapter/sites/www.doubao.com/content.js +115 -0
- package/hostAdapter/webAdapter/sites/www.doubao.com/inject.js +232 -0
- package/hostAdapter/webAdapter/sites/www.doubao.com/site.mjs +62 -0
- package/hostAdapter/webAdapter/sites/www.kimi.com/SITE.md +57 -0
- package/hostAdapter/webAdapter/sites/www.kimi.com/content.js +117 -0
- package/hostAdapter/webAdapter/sites/www.kimi.com/inject.js +194 -0
- package/hostAdapter/webAdapter/sites/www.kimi.com/site.mjs +61 -0
- package/hostAdapter/webAdapter/sites/www.qianwen.com/SITE.md +43 -0
- package/hostAdapter/webAdapter/sites/www.qianwen.com/content.js +123 -0
- package/hostAdapter/webAdapter/sites/www.qianwen.com/inject.js +273 -0
- package/hostAdapter/webAdapter/sites/www.qianwen.com/site.mjs +72 -0
- package/hostAdapter/webAdapter/sites.mjs +67 -0
- package/hostAdapter/webAdapter/start-service.cmd +13 -0
- package/hostAdapter/webAdapter/tests/canvas-files.test.mjs +134 -0
- package/hostAdapter/webAdapter/tests/chatgpt-parser.test.mjs +161 -0
- package/hostAdapter/webAdapter/tests/doubao-parser.test.mjs +151 -0
- package/hostAdapter/webAdapter/tests/keeper.test.mjs +108 -0
- package/hostAdapter/webAdapter/tests/runtime.test.mjs +962 -0
- package/hostAdapter/webAdapter/tests/seats-core.test.mjs +134 -0
- package/hostAdapter/webAdapter/tests/site-boundary.test.mjs +161 -0
- package/hostAdapter/webAdapter/tests/smoke-bridge.mjs +65 -0
- package/hostAdapter/webAdapter/tests/smoke-service.mjs +232 -0
- package/hostAdapter/webAdapter/web.host.manifest.json +6 -0
- package/hostAdapter/zcodeAdapter/.zcode-plugin/plugin.json +23 -23
- package/hostAdapter/zcodeAdapter/README.md +73 -61
- package/hostAdapter/zcodeAdapter/commands/femo.md +8 -9
- package/hostAdapter/zcodeAdapter/hooks/hooks.json +13 -16
- package/hostAdapter/zcodeAdapter/hooks/lib.mjs +318 -59
- package/hostAdapter/zcodeAdapter/hooks/mail-context.mjs +4 -0
- package/hostAdapter/zcodeAdapter/hooks/stop-intent.mjs +4 -3
- package/hostAdapter/zcodeAdapter/hooks/turn-collect.mjs +3 -0
- package/hostAdapter/zcodeAdapter/icon.png +0 -0
- package/hostAdapter/zcodeAdapter/mcp/engine-bind.mjs +56 -0
- package/hostAdapter/zcodeAdapter/mcp/event-router.mjs +42 -258
- package/hostAdapter/zcodeAdapter/mcp/femo-server.mjs +198 -320
- package/hostAdapter/zcodeAdapter/paths.mjs +78 -0
- package/hostAdapter/zcodeAdapter/runtime/femo-possess.mjs +356 -0
- package/hostAdapter/zcodeAdapter/runtime/femo-stream-watcher.mjs +214 -0
- package/hostAdapter/zcodeAdapter/runtime/mailbox-cli.mjs +33 -0
- package/hostAdapter/zcodeAdapter/runtime/pulled-letter.mjs +36 -0
- package/hostAdapter/zcodeAdapter/runtime/speech-collect.mjs +547 -0
- package/hostAdapter/zcodeAdapter/skills/femo/SKILL.md +52 -89
- package/hostAdapter/zcodeAdapter/tests/bridge-smoke.mjs +16 -6
- package/hostAdapter/zcodeAdapter/tests/event-router.test.mjs +160 -157
- package/hostAdapter/zcodeAdapter/tests/harness.mjs +91 -0
- package/hostAdapter/zcodeAdapter/tests/hooks-smoke.mjs +205 -0
- package/hostAdapter/zcodeAdapter/tests/integration-human.mjs +34 -17
- package/hostAdapter/zcodeAdapter/tests/main-actor.mjs +203 -107
- package/hostAdapter/zcodeAdapter/tests/mcp-smoke.mjs +100 -130
- package/hostAdapter/zcodeAdapter/tests/memory-store.mjs +72 -0
- package/hostAdapter/zcodeAdapter/tests/modelio-weave.test.mjs +82 -0
- package/hostAdapter/zcodeAdapter/tests/mount-state.test.mjs +150 -0
- package/hostAdapter/zcodeAdapter/tests/pulled-letter.test.mjs +77 -0
- package/hostAdapter/zcodeAdapter/tests/run-state-core.test.mjs +95 -0
- package/hostAdapter/zcodeAdapter/tests/speech-draft.mjs +163 -0
- package/hostAdapter/zcodeAdapter/tests/stream-watcher.test.mjs +154 -0
- package/hostAdapter/zcodeAdapter/tests/turn-marker.test.mjs +110 -0
- package/hostAdapter/zcodeAdapter/tests/unbound-actors.test.mjs +48 -0
- package/hostAdapter/zcodeAdapter/tests/variable-api.test.mjs +79 -0
- package/hostAdapter/zcodeAdapter/zcode.host.manifest.json +2 -1
- package/package.json +2 -2
- package//350/257/255/346/263/225/346/226/207/346/241/243.md +1202 -1136
- package/FEMO_logo.svg +0 -55
- package/FEMO_logo_slogan.svg +0 -29
- package/_tmp/fallback/driver2.py +0 -176
- package/_tmp/fallback/events.jsonl +0 -108
- package/_tmp/fallback/gateway_ui.py +0 -325
- package/_tmp/fallback/outbox/j1553_human_[/347/234/213/347/211/214]_1.done +0 -1
- package/_tmp/fallback/outbox/r1.done +0 -1
- package/_tmp/fallback/outbox/r2.done +0 -1
- package/_tmp/fallback/outbox/r3.done +0 -1
- package/_tmp/fallback/outbox/r4.done +0 -1
- package/_tmp/fallback/outbox/r5.done +0 -1
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/group-chat.femo +0 -42
- package/femoGen/src/useCanvasInteraction.jsx +0 -319
- 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 -894
- package/hostAdapter/dshAdapter/host/god-mirror.ts +0 -234
- package/hostAdapter/dshAdapter/host/preset-install.ts +0 -59
- 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/preset/agent.cordis.yml +0 -220
- package/hostAdapter/dshAdapter/preset/preset.yml +0 -3
- package/hostAdapter/dshAdapter/python/dev-bridge-test.py +0 -43
- package/hostAdapter/dshAdapter/python/femo_bridge.py +0 -533
- package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/gateway.port +0 -1
- package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-a-_40_52a9_624b.jsonl +0 -3
- package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-a-_40_6211.jsonl +0 -10
- package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-god.jsonl +0 -11
- package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-stage.jsonl +0 -11
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/.zcode-plugin/plugin.json +0 -23
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/LICENSE +0 -201
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/README.md +0 -635
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/commands/femo.md +0 -9
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/__init__.py +0 -4
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femoToolcall/chronica.py +0 -156
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femoToolcall/femo-chat.mjs +0 -69
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femoToolcall/femo_debugger.py +0 -1515
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femo_api.py +0 -437
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femo_gen_api.jsx +0 -77
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/ContextExample.py +0 -555
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/MemoryExample.py +0 -163
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/__init__.py +0 -1
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/getDir/get_dir.py +0 -56
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/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 +0 -10
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/llmBridge.py +0 -247
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/llmProviders.py +0 -308
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_CLIrenderer.py +0 -198
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_config.py +0 -35
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_errors.py +0 -278
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_interpreter.py +0 -163
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_normalizer.py +0 -396
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_parser.py +0 -2468
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_runtime.py +0 -3630
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_scope_resolver.py +0 -209
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/__init__.py +0 -1
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/actor_resolver.py +0 -86
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/block_collector.py +0 -441
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/db_utils.py +0 -485
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/femoAsync.py +0 -401
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/host_manifest.py +0 -68
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/job_manager.py +0 -767
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/protocol.py +0 -126
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/save_dialog.py +0 -402
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/task_world.py +0 -544
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/__init__.py +0 -19
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/checkpoint.py +0 -113
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/env.py +0 -686
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/evaluator.py +0 -567
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/join.py +0 -303
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/merge.py +0 -157
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/model.py +0 -245
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/AI/345/211/252/350/247/206/351/242/221/AI/345/211/252/350/247/206/351/242/221.femo +0 -192
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/AI/350/201/212/345/244/251/345/256/244/group-chat.femo +0 -42
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/AI/350/201/212/345/244/251/345/256/244/random_wait_time.py +0 -10
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/LuxFiat/wait.py +0 -29
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/debug/347/245/236/345/231/250/debug/347/245/236/345/231/250.femo +0 -222
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/discussion.femo +0 -70
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/goal-mode.femo +0 -23
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//345/270/270/347/224/250/345/267/245/345/205/267python/wait.py +0 -29
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//347/213/274/344/272/272/346/235/200/werewolf_utils.py +0 -205
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//347/213/274/344/272/272/346/235/200/werewolf_utils2.py +0 -324
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200.femo +0 -331
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225/undercover_utils.py +0 -683
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/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 +0 -348
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/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 +0 -393
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/after-tool.mjs +0 -3
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/hooks.json +0 -16
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/lib.mjs +0 -59
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/prompt-state.mjs +0 -3
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/session-start.mjs +0 -3
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/stop-intent.mjs +0 -3
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hostAdapter/dshAdapter/python/dev-bridge-test.py +0 -43
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/hostAdapter/dshAdapter/python/femo_bridge.py +0 -533
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/bridge-manager.mjs +0 -192
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/event-router.mjs +0 -258
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/femo-server.mjs +0 -429
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/gateway.mjs +0 -163
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/projection-writer.mjs +0 -294
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/skills/femo/SKILL.md +0 -93
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/bridge-smoke.mjs +0 -26
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/event-router.test.mjs +0 -157
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/gateway-smoke.mjs +0 -107
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/integration-human.mjs +0 -111
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/main-actor.mjs +0 -107
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/mcp-smoke.mjs +0 -130
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/projection-writer.test.mjs +0 -144
- package/hostAdapter/zcodeAdapter/femo-zcode-dist/zcode.host.manifest.json +0 -5
- package/hostAdapter/zcodeAdapter/femo-zcode-dist//346/212/225/345/275/261/347/252/227/351/207/215/350/256/276/350/256/241-/350/256/250/350/256/272/347/250/277.md +0 -113
- package/hostAdapter/zcodeAdapter/femo-zcode-dist//350/257/255/346/263/225/346/226/207/346/241/243.md +0 -1136
- package/hostAdapter/zcodeAdapter/hooks/after-tool.mjs +0 -3
- package/hostAdapter/zcodeAdapter/hooks/prompt-state.mjs +0 -3
- package/hostAdapter/zcodeAdapter/hooks/session-start.mjs +0 -3
- package/hostAdapter/zcodeAdapter/mcp/bridge-manager.mjs +0 -192
- package/hostAdapter/zcodeAdapter/mcp/gateway.mjs +0 -163
- package/hostAdapter/zcodeAdapter/mcp/projection-writer.mjs +0 -294
- package/hostAdapter/zcodeAdapter/tests/gateway-smoke.mjs +0 -107
- package/hostAdapter/zcodeAdapter/tests/projection-writer.test.mjs +0 -144
- package/hostAdapter/zcodeAdapter//346/212/225/345/275/261/347/252/227/351/207/215/350/256/276/350/256/241-/350/256/250/350/256/272/347/250/277.md +0 -113
- package/scripts/diag-find-redblue.mjs +0 -38
- package/scripts/diag-god-log.mjs +0 -31
- package/scripts/diag-god-log2.mjs +0 -39
- package/scripts/diag-god-log3.mjs +0 -35
- package/scripts/diag-god-log4.mjs +0 -59
- package/scripts/diag-god-log4b.mjs +0 -39
- package/scripts/diag-redblue-god.mjs +0 -39
- package/scripts/diag-redblue-log.mjs +0 -37
- package/scripts/diag-redblue-span.mjs +0 -41
- package/scripts/diag-stage-1017.mjs +0 -63
- package/scripts/dump_session.py +0 -36
- package/scripts/link-workspace.ps1 +0 -51
- package/scripts/list_souls.py +0 -18
- package/scripts/probe-composer-refresh.mjs +0 -197
- package/scripts/seed_story_souls.py +0 -86
- package/scripts/sync-zcode-dist.ps1 +0 -55
- package/scripts/theme-tokenize/color-extract.txt +0 -288
- package/scripts/theme-tokenize/round1-quoted.ps1 +0 -149
- package/scripts/theme-tokenize/round2-bare.ps1 +0 -138
- package/scripts/theme-tokenize/round3-shape.ps1 +0 -110
- package/tests/_diag_r4_join.femo +0 -32
- package/tests/conftest.py +0 -95
- package/tests/diag-subagent-dir-3081.mjs +0 -101
- package/tests/femoGenerator.test.mjs +0 -3909
- package/tests/femoParser.test.mjs +0 -4813
- package/tests/femogen_notice.test.mjs +0 -109
- package/tests/femoparser_validation.test.mjs +0 -84
- package/tests/main-delivery-queue.test.mjs +0 -329
- package/tests/pre-step-gate.test.mjs +0 -282
- package/tests/read-subagent-model.mjs +0 -24
- package/tests/run-script-tests.py +0 -97
- package/tests/safe-steer.test.mjs +0 -59
- package/tests/strip_comments.test.mjs +0 -164
- package/tests/test_actor_failed.py +0 -92
- package/tests/test_compile_warnings.py +0 -99
- package/tests/test_debug_log_bus.py +0 -108
- package/tests/test_debugger_module_mode.py +0 -141
- package/tests/test_error_buckets.py +0 -117
- package/tests/test_error_dispatcher.py +0 -261
- package/tests/test_exec_ai_retry.py +0 -155
- package/tests/test_exec_human_retry.py +0 -159
- package/tests/test_file_resolve.py +0 -104
- package/tests/test_flow_events.py +0 -311
- package/tests/test_flow_ref_validation.py +0 -92
- package/tests/test_func_dict_fallback.py +0 -39
- package/tests/test_job_lifecycle.py +0 -236
- package/tests/test_job_manager.py +0 -424
- package/tests/test_mind.py +0 -99
- package/tests/test_module_call_args.py +0 -258
- package/tests/test_module_visibility.py +0 -238
- package/tests/test_notice.py +0 -143
- package/tests/test_out_whitelist.py +0 -83
- package/tests/test_par_if_dispatch.py +0 -64
- package/tests/test_par_nested_for.py +0 -78
- package/tests/test_parser.py +0 -494
- package/tests/test_pause.py +0 -102
- package/tests/test_pause_contract.py +0 -135
- package/tests/test_protocol_transcript.py +0 -158
- package/tests/test_scope_self.py +0 -202
- package/tests/test_source_validate.py +0 -113
- package/tests/test_task_world.py +0 -447
- package/tests/test_town_structure.py +0 -70
- package/tests/test_v2_checkpoint.py +0 -115
- package/tests/test_v2_env.py +0 -383
- package/tests/test_v2_evaluator.py +0 -227
- package/tests/test_v2_join.py +0 -315
- package/tests/test_v2_join_wiring.py +0 -429
- package/tests/test_v2_merge.py +0 -167
- package/tests/test_v2_model.py +0 -143
- package/tests/test_v2_resume_e2e.py +0 -472
- package/tests/test_var_decls.py +0 -271
- package/tests/verify-model-functions.mjs +0 -90
- package/tests/verify-subagent-model-3081.mjs +0 -153
- package//346/226/275/345/267/245/346/270/205/345/215/225/node-notice-/346/226/275/345/267/245/346/270/205/345/215/225.md +0 -395
- package//346/226/275/345/267/245/346/270/205/345/215/225//344/270/244/344/270/252/345/276/205/350/247/243/345/206/263/347/232/204/351/227/256/351/242/230.MD +0 -66
- package//346/226/275/345/267/245/346/270/205/345/215/225//345/201/234/346/255/242/351/223/276/344/277/256/345/244/215-/346/226/275/345/267/245/346/270/205/345/215/225.md +0 -475
- package//346/226/275/345/267/245/346/270/205/345/215/225//345/217/230/351/207/217/344/270/216task/347/263/273/347/273/237/351/207/215/346/236/204-/346/226/275/345/267/245/346/270/205/345/215/225-v2.md +0 -847
- package//346/226/275/345/267/245/346/270/205/345/215/225//350/277/220/350/241/214/347/212/266/346/200/201/351/223/276/350/267/257/351/207/215/346/236/204-/346/226/275/345/267/245/346/270/205/345/215/225v4.md +0 -654
- package//346/226/275/345/267/245/346/270/205/345/215/225//351/224/231/350/257/257/346/263/250/345/205/245/347/273/255/350/201/212-/346/226/275/345/267/245/346/270/205/345/215/225.md +0 -471
- /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,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* gateway-smoke.mjs — 网关集成检测(SSE + HTTP 输入通道 + hooks 端点)
|
|
3
|
-
* 手动运行:node zcodeAdapter/tests/gateway-smoke.mjs
|
|
4
|
-
*/
|
|
5
|
-
import { spawn } from 'node:child_process';
|
|
6
|
-
import { existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
7
|
-
import { dirname, join } from 'node:path';
|
|
8
|
-
import { fileURLToPath } from 'node:url';
|
|
9
|
-
|
|
10
|
-
const ADAPTER = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
-
const SERVER = join(ADAPTER, 'mcp', 'femo-server.mjs');
|
|
12
|
-
const TMP = join(ADAPTER, '.tmp'); // 冒烟自留沙盒:锚定本适配器目录,随目录搬家不受影响
|
|
13
|
-
mkdirSync(TMP, { recursive: true });
|
|
14
|
-
|
|
15
|
-
const proc = spawn(process.execPath, [SERVER], { cwd: TMP, env: { ...process.env, FEMO_DATA_DIR: TMP }, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
16
|
-
proc.stderr.on('data', () => {}); // 静音服务端日志
|
|
17
|
-
|
|
18
|
-
let id = 0;
|
|
19
|
-
const pending = new Map();
|
|
20
|
-
let buf = '';
|
|
21
|
-
proc.stdout.on('data', d => {
|
|
22
|
-
buf += d;
|
|
23
|
-
let i;
|
|
24
|
-
while ((i = buf.indexOf('\n')) !== -1) {
|
|
25
|
-
const line = buf.slice(0, i).trim(); buf = buf.slice(i + 1);
|
|
26
|
-
if (!line) continue;
|
|
27
|
-
try { const m = JSON.parse(line); if (m.id !== undefined) { const r = pending.get(m.id); if (r) { pending.delete(m.id); r(m); } } } catch {}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
const call = (method, params) => new Promise(res => { const mid = ++id; pending.set(mid, res); proc.stdin.write(JSON.stringify({ jsonrpc: '2.0', id: mid, method, params }) + '\n'); });
|
|
31
|
-
const tool = async (name, args) => {
|
|
32
|
-
const r = await call('tools/call', { name, arguments: args });
|
|
33
|
-
if (r.error) throw new Error(`RPC ${name}: ${JSON.stringify(r.error).slice(0, 200)}`);
|
|
34
|
-
if (!r.result?.content?.[0]) throw new Error(`RPC ${name}: no content — ${JSON.stringify(r.result).slice(0, 200)}`);
|
|
35
|
-
return JSON.parse(r.result.content[0].text);
|
|
36
|
-
};
|
|
37
|
-
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
|
38
|
-
async function waitFor(fn, label, timeoutMs = 30000) { const t0 = Date.now(); while (!(await fn())) { if (Date.now() - t0 > timeoutMs) throw new Error('timeout: ' + label); await sleep(200); } }
|
|
39
|
-
|
|
40
|
-
let fail = 0;
|
|
41
|
-
const check = (l, ok, d = '') => { console.log(`${ok ? '✅' : '❌'} ${l}${d ? ' ' + d : ''}`); if (!ok) fail = 1; };
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
await call('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'gw-smoke', version: '0' } });
|
|
45
|
-
proc.stdin.write(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n');
|
|
46
|
-
|
|
47
|
-
// 等端口文件出现(DATA_DIR = FEMO_DATA_DIR/femo,端口文件在其 host-history/ 下)
|
|
48
|
-
const portFile = join(TMP, 'femo', 'host-history', 'gateway.port');
|
|
49
|
-
await waitFor(() => existsSync(portFile), 'gateway.port');
|
|
50
|
-
const port = readFileSync(portFile, 'utf8').trim();
|
|
51
|
-
const base = `http://127.0.0.1:${port}`;
|
|
52
|
-
check('网关端口文件', Number(port) >= 3789, `port=${port}`);
|
|
53
|
-
|
|
54
|
-
// SSE 客户端挂上
|
|
55
|
-
const sse = await fetch(`${base}/events`);
|
|
56
|
-
check('SSE 连接', sse.ok && sse.headers.get('content-type').includes('event-stream'));
|
|
57
|
-
|
|
58
|
-
// 空闲态 session-state
|
|
59
|
-
const st0 = await (await fetch(`${base}/api/session-state`)).json();
|
|
60
|
-
check('session-state(空闲)', st0.running === false);
|
|
61
|
-
|
|
62
|
-
// 空闲态 human-input → 409
|
|
63
|
-
const idle = await fetch(`${base}/api/human-input`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: '早了' }) });
|
|
64
|
-
check('空闲输入 → 409', idle.status === 409);
|
|
65
|
-
|
|
66
|
-
// 开一场 human 剧
|
|
67
|
-
const script = `meta:\n name = 网关冒烟\n session = new\n\nactors:\n human @我 = soul:human\n\naction ask @human(@我):\n prompt: 请说点什么\n\nmainflow:\n [START] -> ask -> [END]\n`;
|
|
68
|
-
const mount = await tool('femo_mount', { femo_text: script });
|
|
69
|
-
check('挂载', mount.mounted === true);
|
|
70
|
-
const run = await tool('femo_run', { action: 'fresh_start' });
|
|
71
|
-
check('开演', run.started === true, `job=${run.job_id}`);
|
|
72
|
-
|
|
73
|
-
// 等待人类输入态(HTTP 轮询运行态——hooks 同款通路)
|
|
74
|
-
await waitFor(async () => (await (await fetch(`${base}/api/session-state`)).json()).waitingHuman, 'waitingHuman');
|
|
75
|
-
const st1 = await (await fetch(`${base}/api/session-state`)).json();
|
|
76
|
-
check('waitingHuman 就绪', st1.waitingHuman.wait_key.length > 0, st1.waitingHuman.wait_key);
|
|
77
|
-
|
|
78
|
-
// hook 端点:运行中状态播报
|
|
79
|
-
const ps = await (await fetch(`${base}/hook/prompt-state`)).json();
|
|
80
|
-
check('prompt-state 注入', (ps.additionalContext ?? '').includes('运行中'));
|
|
81
|
-
|
|
82
|
-
// ── HTTP 通道交卷(§6 通道 1,不经模型)──
|
|
83
|
-
const hi = await fetch(`${base}/api/human-input`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: '网关通道台词。' }) });
|
|
84
|
-
check('human-input 200', hi.status === 200);
|
|
85
|
-
|
|
86
|
-
// 剧终(femo_wait 拿到 flow_done——注意 human_wait 拍还在队列里,先取它)
|
|
87
|
-
const w1 = await tool('femo_wait', {});
|
|
88
|
-
check('femo_wait → human_wait 拍(对话通道存根)', w1.kind === 'human_wait');
|
|
89
|
-
const w2 = await tool('femo_wait', {});
|
|
90
|
-
check('femo_wait → flow_done', w2.kind === 'flow_done');
|
|
91
|
-
|
|
92
|
-
// 投影窗历史(femoGen 装配数据源)
|
|
93
|
-
const god = await (await fetch(`${base}/api/projection/god`)).json();
|
|
94
|
-
const texts = god.rows.map(r => String(r.data.text ?? ''));
|
|
95
|
-
check('投影历史完整', texts.some(t => t.includes('开演')) && texts.some(t => t.includes('网关通道台词')) && texts.some(t => t.includes('剧本已跑完')), `${god.rows.length} 行`);
|
|
96
|
-
|
|
97
|
-
// 空闲后 stop-intent 不拦截
|
|
98
|
-
const si = await (await fetch(`${base}/hook/stop-intent`)).json();
|
|
99
|
-
check('stop-intent 空闲不拦', !si.continue);
|
|
100
|
-
} catch (e) {
|
|
101
|
-
console.log('❌ EXCEPTION:', String(e).slice(0, 250));
|
|
102
|
-
fail = 1;
|
|
103
|
-
} finally {
|
|
104
|
-
proc.kill();
|
|
105
|
-
console.log(fail === 0 ? 'GATEWAY SMOKE OK' : 'GATEWAY SMOKE FAIL');
|
|
106
|
-
process.exitCode = fail;
|
|
107
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* projection-writer.test.mjs — 投影窗存储器/区块闸门单测
|
|
3
|
-
* 运行:node --test zcodeAdapter/tests/projection-writer.test.mjs
|
|
4
|
-
* 移植自 tests/ 里 dsh 侧单测的口径(pre-step-gate / main-delivery-queue 同风格)。
|
|
5
|
-
*/
|
|
6
|
-
import { test } from 'node:test';
|
|
7
|
-
import assert from 'node:assert/strict';
|
|
8
|
-
import { mkdtempSync, rmSync, existsSync } from 'node:fs';
|
|
9
|
-
import { tmpdir } from 'node:os';
|
|
10
|
-
import { join } from 'node:path';
|
|
11
|
-
|
|
12
|
-
import { createProjectionStore, SectionGate, actorKeyOf, dedupeStructKey, CHAT_TYPE } from '../mcp/projection-writer.mjs';
|
|
13
|
-
|
|
14
|
-
function tmpStore(t) {
|
|
15
|
-
const dir = mkdtempSync(join(tmpdir(), 'femo-proj-'));
|
|
16
|
-
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
17
|
-
return { store: createProjectionStore({ dir }), dir };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
test('actorKeyOf:中文名逐码点转义且互异', () => {
|
|
21
|
-
assert.equal(actorKeyOf('女巫'), '_5973_5deb');
|
|
22
|
-
assert.notEqual(actorKeyOf('女巫'), actorKeyOf('猎人'));
|
|
23
|
-
assert.equal(actorKeyOf('Alice-01'), 'Alice-01');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('dedupeStructKey:骨架事件键、chat 行无键', () => {
|
|
27
|
-
assert.equal(dedupeStructKey('turn/start', { turn: 3 }), 'turn/start:3');
|
|
28
|
-
assert.equal(dedupeStructKey('step/end', { turn: 3, step: 2 }), 'step/end:3:2');
|
|
29
|
-
assert.equal(dedupeStructKey(CHAT_TYPE, { turn: 3 }), undefined);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('ensureWindows 建齐三窗,scope 分发符合 DSH projectionAppend 语义', t => {
|
|
33
|
-
const { store, dir } = tmpStore(t);
|
|
34
|
-
store.ensureWindows('s1', ['@女巫', '@猎人']);
|
|
35
|
-
assert.deepEqual(store.listWindows('s1').slice(0, 2), ['god', 'stage']);
|
|
36
|
-
|
|
37
|
-
// undefined → god + stage + 全部角色窗
|
|
38
|
-
const n1 = store.append('s1', 'femo/chat', { text: '全场可见', kind: 'notice', seq: 1 });
|
|
39
|
-
assert.equal(n1, 4);
|
|
40
|
-
|
|
41
|
-
// 空数组 = scope 未限定 = 同 undefined(绝不解释为"无人可见")
|
|
42
|
-
const n2 = store.append('s1', 'femo/chat', { text: '未限定', kind: 'notice', seq: 2 }, { targetActors: [] });
|
|
43
|
-
assert.equal(n2, 4);
|
|
44
|
-
|
|
45
|
-
// 显式列表 → 只进列出的角色窗(god/stage 恒全量)
|
|
46
|
-
const n3 = store.append('s1', 'femo/chat', { text: '女巫私语', kind: 'role', actor: '女巫', visible: ['女巫'], seq: 3 }, { targetActors: ['@女巫'] });
|
|
47
|
-
assert.equal(n3, 3); // god + stage + 女巫窗
|
|
48
|
-
|
|
49
|
-
const witch = store.readWindow('s1', '@女巫').map(r => r.data.text);
|
|
50
|
-
assert.deepEqual(witch, ['全场可见', '未限定', '女巫私语']);
|
|
51
|
-
const hunter = store.readWindow('s1', '@猎人').map(r => r.data.text);
|
|
52
|
-
assert.deepEqual(hunter, ['全场可见', '未限定']); // 收不到女巫私语
|
|
53
|
-
const god = store.readWindow('s1', 'god').map(r => r.data.text);
|
|
54
|
-
assert.deepEqual(god, ['全场可见', '未限定', '女巫私语']);
|
|
55
|
-
assert.ok(existsSync(join(dir, 's1-god.jsonl')));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('_srcSeq 源级去重 + 结构键去重', t => {
|
|
59
|
-
const { store } = tmpStore(t);
|
|
60
|
-
store.ensureWindows('s1', ['@女巫']);
|
|
61
|
-
|
|
62
|
-
// 同 _srcSeq 二次投递 → 全部窗都跳过
|
|
63
|
-
assert.equal(store.append('s1', 'femo/chat', { text: 'x', seq: 1, _srcSeq: 'childA#7' }, { targetActors: [] }), 3);
|
|
64
|
-
assert.equal(store.append('s1', 'femo/chat', { text: 'x', seq: 1, _srcSeq: 'childA#7' }, { targetActors: [] }), 0);
|
|
65
|
-
|
|
66
|
-
// 结构键:同 turn 的 turn/start 二次到达 → 跳过
|
|
67
|
-
assert.equal(store.append('s1', 'turn/start', { turn: 5 }), 3);
|
|
68
|
-
assert.equal(store.append('s1', 'turn/start', { turn: 5 }), 0);
|
|
69
|
-
assert.equal(store.append('s1', 'turn/start', { turn: 6 }), 3);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test('跨重启幂等:新 store 实例懒建索引,重复行被拒', t => {
|
|
73
|
-
const dir = mkdtempSync(join(tmpdir(), 'femo-proj-'));
|
|
74
|
-
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
75
|
-
const first = createProjectionStore({ dir });
|
|
76
|
-
first.ensureWindows('s1', ['女巫']);
|
|
77
|
-
first.append('s1', 'femo/chat', { text: 'a', seq: 1, _srcSeq: 'k#1' }, { targetActors: [] });
|
|
78
|
-
first.append('s1', 'turn/start', { turn: 1 });
|
|
79
|
-
|
|
80
|
-
// 模拟重启:全新实例,同目录
|
|
81
|
-
const second = createProjectionStore({ dir });
|
|
82
|
-
second.ensureWindows('s1', ['女巫']);
|
|
83
|
-
assert.equal(second.append('s1', 'femo/chat', { text: 'a', seq: 1, _srcSeq: 'k#1' }, { targetActors: [] }), 0);
|
|
84
|
-
assert.equal(second.append('s1', 'turn/start', { turn: 1 }), 0);
|
|
85
|
-
assert.equal(second.readWindow('s1', 'god').length, 2); // 没有重复行落盘
|
|
86
|
-
// 行号游标也恢复了:新行 seq 接着走
|
|
87
|
-
second.append('s1', 'femo/chat', { text: 'b', seq: 2 }, { targetActors: [] });
|
|
88
|
-
assert.equal(second.readWindow('s1', 'god').at(-1).seq, 3);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('readWindow afterSeq 增量拉取', t => {
|
|
92
|
-
const { store } = tmpStore(t);
|
|
93
|
-
store.ensureWindows('s1', []);
|
|
94
|
-
store.append('s1', 'femo/chat', { text: '1', seq: 1 }, { targetActors: [] });
|
|
95
|
-
store.append('s1', 'femo/chat', { text: '2', seq: 2 }, { targetActors: [] });
|
|
96
|
-
const tail = store.readWindow('s1', 'god', { afterSeq: 1 });
|
|
97
|
-
assert.deepEqual(tail.map(r => r.data.text), ['2']);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test('SectionGate:甲乙乙甲 —— commit 乱序到达,落盘按 begin 顺序', () => {
|
|
101
|
-
const gate = new SectionGate();
|
|
102
|
-
const order = [];
|
|
103
|
-
gate.begin('s', 1, '甲');
|
|
104
|
-
gate.begin('s', 2, '乙');
|
|
105
|
-
gate.begin('s', 3, '乙');
|
|
106
|
-
gate.commit('s', 2, '乙', () => order.push('乙1'));
|
|
107
|
-
assert.deepEqual(order, []); // 甲未就绪,乙1 排队
|
|
108
|
-
gate.commit('s', 3, '乙', () => order.push('乙2'));
|
|
109
|
-
assert.deepEqual(order, []); // 仍在等甲
|
|
110
|
-
gate.commit('s', 1, '甲', () => order.push('甲'));
|
|
111
|
-
assert.deepEqual(order, ['甲', '乙1', '乙2']); // FIFO = 开跑顺序
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test('SectionGate:waitActorFlush 同角色防串桶', async () => {
|
|
115
|
-
const gate = new SectionGate();
|
|
116
|
-
gate.begin('s', 1, '女巫');
|
|
117
|
-
let flushed = false;
|
|
118
|
-
gate.commit('s', 1, '女巫', () => { flushed = true; });
|
|
119
|
-
assert.ok(flushed); // commit 内同步冲刷
|
|
120
|
-
await gate.waitActorFlush('s', '女巫'); // 已落盘 → 立即通过
|
|
121
|
-
await gate.waitActorFlush('s', '猎人'); // 未登记 → 立即通过
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('SectionGate:同 turn 重复 begin 幂等;dropPending 清队', () => {
|
|
125
|
-
const gate = new SectionGate();
|
|
126
|
-
gate.begin('s', 1, '甲');
|
|
127
|
-
gate.begin('s', 1, '甲');
|
|
128
|
-
gate.commit('s', 1, '甲', () => {});
|
|
129
|
-
gate.begin('s', 2, '乙'); // 未 commit
|
|
130
|
-
assert.deepEqual(gate.dropPending('s'), [2]); // 乙被丢弃
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
test('chat 便捷写入:行 schema 与 DSH femo-plugin/chat 同构', t => {
|
|
134
|
-
const { store } = tmpStore(t);
|
|
135
|
-
store.ensureWindows('s1', ['@女巫']);
|
|
136
|
-
store.chat('s1', '今晚我查了谁', { kind: 'role', actor: '女巫', visible: ['女巫'], turn: 4 }, { targetActors: ['@女巫'] });
|
|
137
|
-
const row = store.readWindow('s1', '@女巫')[0];
|
|
138
|
-
assert.equal(row.type, CHAT_TYPE);
|
|
139
|
-
assert.equal(row.data.kind, 'role');
|
|
140
|
-
assert.equal(row.data.actor, '女巫');
|
|
141
|
-
assert.deepEqual(row.data.visible, ['女巫']);
|
|
142
|
-
assert.equal(typeof row.data.seq, 'number'); // data.seq = Date.now()(DSH 同款)
|
|
143
|
-
assert.equal(typeof row.seq, 'number'); // 窗内行号独立
|
|
144
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# 投影窗重设计 · 讨论稿
|
|
2
|
-
|
|
3
|
-
> 2026-09-14 · 由「谁是卧底」首演实战引出(MCP 网关断连 → 兜底直驱 → 网页在 ZCode 手机端打不开)。
|
|
4
|
-
> 状态:设计原则已拍板,技术路径待细化。
|
|
5
|
-
|
|
6
|
-
## 一、【角色运行窗】三种
|
|
7
|
-
|
|
8
|
-
1. **子代理**——非主 agent 的其他所有 AI 角色。节点轮到他们说话的时候,他们会收到
|
|
9
|
-
该他们看的上下文(由引擎发送),并进一步作出反应;一场剧本全程都由这一个子代理
|
|
10
|
-
窗口来提供反应。但是用户无法查看,所以需要投影。
|
|
11
|
-
2. **主 agent**(导演兼主演)。节点轮到你说话的时候,引擎直接把你该看的上下文发给
|
|
12
|
-
你,并收集你的整轮反应。不轮到你说话的时候,主窗口用户和你依然可以聊,不影响;
|
|
13
|
-
引擎只是在轮到你的时候主动叫你。用户能看见(就是主会话),不用做投影。
|
|
14
|
-
3. **人类用户**——这个不等节点轮到,而是由引擎实时发送:每一处节点有 AI 实时说话
|
|
15
|
-
的时候,如果这条消息的 scope 里有用户角色,就立即推给用户看见(最好能流式输出)。
|
|
16
|
-
**如何实现推送是问题。** 用户必须能看见、能发消息,不用做投影(用户席本身就是
|
|
17
|
-
交互面,不缺可见性)。
|
|
18
|
-
|
|
19
|
-
## 二、【视角投影窗】三种(都是给用户看的)
|
|
20
|
-
|
|
21
|
-
1. **AI 角色视角投影窗**。因为用户看不见子代理 session,所以需要专门给用户做投影。
|
|
22
|
-
给用户看的依然遵循实时的推送:任何节点只要产生了新消息、只要这条消息的 scope
|
|
23
|
-
包含这个 AI 角色,就立即显示在它的视角投影窗里。
|
|
24
|
-
2. **戏内视角窗**。FEMO 戏内所有消息,只要产生,都实时更新在这里。
|
|
25
|
-
3. **上帝视角窗**。FEMO 戏内所有消息 + 主窗口的消息(用户和导演的戏外闲聊)都在这里。
|
|
26
|
-
|
|
27
|
-
## 三、技术路径
|
|
28
|
-
|
|
29
|
-
1. **AI 回答**:引擎获取增量上下文,直接发给子代理;引擎获取增量上下文,直接发送给
|
|
30
|
-
主代理。能够获取 AI 收到引擎之后反应的一整轮(可能包括多步工具调用),返回给引擎
|
|
31
|
-
落库。
|
|
32
|
-
2. **给用户看**:节点输出时,按 scope 构建投影窗,最好能流式输出。要求是 showprompt、
|
|
33
|
-
AI 名字、CoT、回答、工具、CoT……多轮一直到结束,这整块要输出在一起,**作为一整块;
|
|
34
|
-
如果有多个节点在同时输出(par),不能穿插**。
|
|
35
|
-
而且最好 ZCode 手机端能打开。
|
|
36
|
-
用户要能输入(用户节点发言也走这条路线)。
|
|
37
|
-
|
|
38
|
-
## 四、一些探索?
|
|
39
|
-
就是不想让主模型播报嘛,有没有什么真能让手机打开,且能实时播放给用户的?
|
|
40
|
-
我目前想到的一些不一定可行的点子:
|
|
41
|
-
1. 终端,如果我们写个tui,用户手机端可以起几个终端,每个终端一个角色。包括用户节点他也可以在终端输入。这个可以很好的实现角色视角和用户节点,但无法实现戏内/上帝吧,多人并发的时候tui是不是一定会乱?我问问你~
|
|
42
|
-
|
|
43
|
-
2. 网页,待验证,我还在试图探索手机zcode能打开电脑网页的方法。我不想用tailscale,我浏览器远程连不上自己的电脑。但是zcode本身有连接,我只想走zcode的连接,如果能找到一种方法把网页打开在zcode的边栏里,这就可行(我试过了可行),问题是“把网页打开在zcode边栏”这件事,似乎只有在你新写、新编辑了一个网页之后,显示在对话流里说本轮文件,我点这个,能打开在侧边栏……但如果是已经写好的网页,我现在还没找到打开的方法……
|
|
44
|
-
网页的好处是……很多,如果能打开,他是最好的。一切都能实现的很完美,以后还能迁移到其他harness上去。
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## 附:现状对照(2026-09-14 晚,落地时对表用)
|
|
49
|
-
|
|
50
|
-
- 引擎事实源已是事件流(兜底形态 = `_tmp/fallback/events.jsonl`,每事件一行 JSON)。
|
|
51
|
-
- 三窗投影已有两份实现:MCP 网关 `projection-writer.mjs`(JSONL 镜像)+ 兜底适配器
|
|
52
|
-
`gateway_ui.py`(内存三窗,语义对齐:god/stage 恒全量、角色窗按 scope、空 scope=全员)。
|
|
53
|
-
- 输入回程契约已收敛:`{wait_key, text}` → outbox → 引擎信箱(网页 `/api/human-input`
|
|
54
|
-
与 `femo_cli` 同走此路)。
|
|
55
|
-
- 已知缺口(对应第三节的三个要求):
|
|
56
|
-
- 子代理"整轮落库":现行台词回传只有最终台词(`human_input` 单条),多步工具调用
|
|
57
|
-
的整轮轨迹需要演员侧回传 steps(`femo_submit` 已留 steps 字段);
|
|
58
|
-
- 流式推送:网页面有 SSE(`run_state`/`femo_stream` 帧);ZCode 手机端无网页,
|
|
59
|
-
终端一次性快照(`stage`)或块级追加文件是候选,真正的流式推送待设计;
|
|
60
|
-
- par 多节点不穿插:投影行天然按节点 settled 顺序成块落行,渲染端需按块消费。
|
|
61
|
-
- 通道矩阵(当前):网页舞台=桌面端;ZCode 手机端=终端(`femo_cli stage/say`,待建);
|
|
62
|
-
聊天代转=兜底的兜底。
|
|
63
|
-
|
|
64
|
-
## 五、手机端实测结论(2026-09-14 下午,真机验证)
|
|
65
|
-
|
|
66
|
-
| 通道 | 手机端结果 |
|
|
67
|
-
|---|---|
|
|
68
|
-
| `.html` 文件卡片 | ❌ 点不开 |
|
|
69
|
-
| `.canvas.tsx` | ❌ 本构建未接入(桌面也打不开) |
|
|
70
|
-
| `.svg` 文件卡片 | ⚠️ 能打开,但只是静态图(内嵌脚本不执行,链接不响应) |
|
|
71
|
-
| `.md` 文件卡片 | ✅ 能渲染富文本(表格/链接/样式都出) |
|
|
72
|
-
| .md 里的链接 | ❌ 点了会跳进手机本地浏览器,够不着 PC 的 localhost |
|
|
73
|
-
| 聊天里的链接 | ⬜ 待真机补测(桌面端已验证可打开内嵌浏览器) |
|
|
74
|
-
| 终端 | ✅ 可用(能跑 PC 命令)——`femo.py stage` 看战况 / `femo.py say 台词` 发言 |
|
|
75
|
-
| **PC 局域网地址** | ⬜ 待真机验证:适配器已改绑 0.0.0.0,手机浏览器直开 `http://192.168.3.88:3890`(同一 Wi-Fi;绕开 ZCode 通道,SSE 实时流式全功能)。ZCode 源码考古结论:桌面 asar 无 Canvas 功能(renderer/main/host 全无),手机 App 为桥接 RPC 固定屏幕(chat/终端/文本查看),无"推送任意网页"能力——应用能力边界,非文件格式问题 |
|
|
76
|
-
|
|
77
|
-
**定型:手机端「编辑即推送」**——
|
|
78
|
-
- **投影(看)**:导演每拍重写 `.md` 快照页 → 新卡片排进对话流 → 用户永远点最新一张
|
|
79
|
-
(表格/高亮全渲染;这就是手机端的"实时推送"形态:不是服务器推,是编辑推);
|
|
80
|
-
- **推送(叫人)**:聊天流本身(轮到你我就在对话里喊,这是唯一主动出现的信道);
|
|
81
|
-
- **输入(说)**:聊天原文代投 / 终端 `python femo.py say 台词`;
|
|
82
|
-
- **桌面加映**:3890 网页实时舞台(SSE 流式)保留为豪华版。
|
|
83
|
-
|
|
84
|
-
**拍级超时(活体证据)**:宿主拍超时(约 1h)被引擎空行放行,戏继续走——没人喂拍,
|
|
85
|
-
戏就静默残缺(本次实测:人类看牌拍、老李陈述拍双双超时空过)。这就是"实时推送 +
|
|
86
|
-
用户席常开"的必要性,也是本设计要解决的第一等问题。
|
|
87
|
-
|
|
88
|
-
## 六、femo_wait 退役案(2026-09-14 深夜裁定)
|
|
89
|
-
|
|
90
|
-
裁定:`femo_wait/femo_submit` 轮询机制不是必要设计。主模型是被动进程,"引擎发送给
|
|
91
|
-
主模型"的唯一正确实现是**唤醒(hook 注入)**,不是**拉取(轮询)**。目标架构下
|
|
92
|
-
wait/submit 无存在意义,应退役。
|
|
93
|
-
|
|
94
|
-
**退役后的演出循环(无轮询、无转发):**
|
|
95
|
-
- AI 拍:引擎 spawn_request 直发子代理并自动认领(机制已实现),导演零参与零 token;
|
|
96
|
-
- 人类拍:引擎 → 网关 → 席位/投影直通(`femo.py view/say`、网页输入框,均已实现),
|
|
97
|
-
导演零参与;通知用户走聊天一行话或终端横幅,不转播私人提词全文;
|
|
98
|
-
- **main 拍**:stop hook 注入本拍指令(additionalContext)→ 主模型在聊天里直接说出
|
|
99
|
-
台词(用户全程可见,天然透明)→ stop hook 从该回合文本收割台词回传引擎
|
|
100
|
-
(替代 femo_submit)。一拍 = 一次模型回合,零工具调用开销;
|
|
101
|
-
- 无 `source:main` 角色的剧本:主模型整场零参与,一场戏零导演 token。
|
|
102
|
-
|
|
103
|
-
**风险与对策:**
|
|
104
|
-
- 收割歧义(导演回了非台词)→ 注入指令即声明"只回台词";hook 只收割自己注入过
|
|
105
|
-
的回合;收割前非空校验;引擎 ai_retry 兜底重试;
|
|
106
|
-
- par 多拍并发 → 引擎队列逐拍注入,天然串行成块;
|
|
107
|
-
- 戏外聊天共存 → 无指令注入的回合 hook 不收割,戏外自由。
|
|
108
|
-
|
|
109
|
-
**保留 / 退役清单:**
|
|
110
|
-
- 保留:`femo_mount / femo_run / femo_debug / femo_soul / femo_chronica / femo_script`
|
|
111
|
-
(会话管理面,与演出循环无关);全部 hook(退役案就跑在它们上面);
|
|
112
|
-
- 退役:`femo_wait`、`femo_submit`(被 hook 注入/收割替代);
|
|
113
|
-
- 形态 B(兜底直驱)同样适用:driver2 直喂 hook/席位,同样不经导演。
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// 诊断5:遍历全部投影窗日志,定位红蓝队场次
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import zlib from 'node:zlib';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
|
|
6
|
-
const root = 'D:/myFiles/dsh/dsh-home/sessions';
|
|
7
|
-
const dirs = [];
|
|
8
|
-
const walk = (d) => {
|
|
9
|
-
for (const e of fs.readdirSync(d, { withFileTypes: true })) {
|
|
10
|
-
const p = path.join(d, e.name);
|
|
11
|
-
if (e.isDirectory()) walk(p);
|
|
12
|
-
else if (e.name === 'session.jsonl.zstd' && p.includes('femo-proj-')) dirs.push(p);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
walk(root);
|
|
16
|
-
console.log('total proj windows:', dirs.length);
|
|
17
|
-
const MAGIC = Buffer.from([0x28, 0xB5, 0x2F, 0xFD]);
|
|
18
|
-
for (const p of dirs) {
|
|
19
|
-
const buf = fs.readFileSync(p);
|
|
20
|
-
const starts = [];
|
|
21
|
-
for (let i = 0; i <= buf.length - 4; i++) {
|
|
22
|
-
if (buf[i] === 0x28 && buf[i + 1] === 0xB5 && buf[i + 2] === 0x2F && buf[i + 3] === 0xFD) starts.push(i);
|
|
23
|
-
}
|
|
24
|
-
let all = '';
|
|
25
|
-
for (let s = 0; s < starts.length; s++) {
|
|
26
|
-
const end = s + 1 < starts.length ? starts[s + 1] : buf.length;
|
|
27
|
-
try { all += zlib.zstdDecompressSync(buf.subarray(starts[s], end)).toString('utf8'); } catch {}
|
|
28
|
-
}
|
|
29
|
-
const hits = [];
|
|
30
|
-
if (all.includes('红队')) hits.push('红队');
|
|
31
|
-
if (all.includes('蓝队')) hits.push('蓝队');
|
|
32
|
-
if (hits.length > 0) {
|
|
33
|
-
const lines = all.split('\n').filter(l => l.trim());
|
|
34
|
-
const hosts = lines.filter(l => l.includes('stream-host')).length;
|
|
35
|
-
const speakers = lines.filter(l => l.includes('"speaker"')).length;
|
|
36
|
-
console.log(`HIT [${hits.join(',')}] ${path.basename(path.dirname(p))} lines=${lines.length} host=${hosts} speaker=${speakers} mtime=${fs.statSync(p).mtime.toISOString()}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
package/scripts/diag-god-log.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// 诊断:多帧 zstd 解压投影窗 god 日志,统计 stream-host/speaker/turn 行
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import zlib from 'node:zlib';
|
|
4
|
-
const path = 'D:/myFiles/dsh/dsh-home/sessions/--D-myFiles-5m--/femo-proj-session-31340b5b-8291-47a1-bc51-aa3059d5e839-god/session.jsonl.zstd';
|
|
5
|
-
const buf = fs.readFileSync(path);
|
|
6
|
-
const starts = [];
|
|
7
|
-
for (let i = 0; i <= buf.length - 4; i++) {
|
|
8
|
-
if (buf[i] === 0x28 && buf[i + 1] === 0xB5 && buf[i + 2] === 0x2F && buf[i + 3] === 0xFD) starts.push(i);
|
|
9
|
-
}
|
|
10
|
-
const chunks = [];
|
|
11
|
-
for (let s = 0; s < starts.length; s++) {
|
|
12
|
-
const end = s + 1 < starts.length ? starts[s + 1] : buf.length;
|
|
13
|
-
chunks.push(buf.subarray(starts[s], end));
|
|
14
|
-
}
|
|
15
|
-
let all = '';
|
|
16
|
-
let okFrames = 0;
|
|
17
|
-
for (const c of chunks) {
|
|
18
|
-
try { all += zlib.zstdDecompressSync(c).toString('utf8'); okFrames++; } catch { /* 魔数误报 */ }
|
|
19
|
-
}
|
|
20
|
-
const lines = all.split('\n').filter(l => l.trim().length > 0);
|
|
21
|
-
console.log('frames:', okFrames, 'total lines:', lines.length);
|
|
22
|
-
const hosts = lines.filter(l => l.includes('stream-host'));
|
|
23
|
-
console.log('stream-host lines:', hosts.length);
|
|
24
|
-
for (const h of hosts.slice(0, 6)) {
|
|
25
|
-
try { const j = JSON.parse(h); console.log(' seq=' + j.seq, JSON.stringify(j.data).slice(0, 240)); } catch {}
|
|
26
|
-
}
|
|
27
|
-
console.log('speaker lines:', lines.filter(l => l.includes('"speaker"')).length);
|
|
28
|
-
console.log('turn/start lines:', lines.filter(l => l.includes('"turn/start"')).length);
|
|
29
|
-
console.log('step/start lines:', lines.filter(l => l.includes('"step/start"')).length);
|
|
30
|
-
console.log('--- tail 3 ---');
|
|
31
|
-
for (const l of lines.slice(-3)) console.log(l.slice(0, 240));
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// 诊断2:god 窗日志按重启时间切分,统计 12:43:19 之后的事件构成
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import zlib from 'node:zlib';
|
|
4
|
-
const path = 'D:/myFiles/dsh/dsh-home/sessions/--D-myFiles-5m--/femo-proj-session-31340b5b-8291-47a1-bc51-aa3059d5e839-god/session.jsonl.zstd';
|
|
5
|
-
const buf = fs.readFileSync(path);
|
|
6
|
-
const starts = [];
|
|
7
|
-
for (let i = 0; i <= buf.length - 4; i++) {
|
|
8
|
-
if (buf[i] === 0x28 && buf[i + 1] === 0xB5 && buf[i + 2] === 0x2F && buf[i + 3] === 0xFD) starts.push(i);
|
|
9
|
-
}
|
|
10
|
-
let all = '';
|
|
11
|
-
for (let s = 0; s < starts.length; s++) {
|
|
12
|
-
const end = s + 1 < starts.length ? starts[s + 1] : buf.length;
|
|
13
|
-
try { all += zlib.zstdDecompressSync(buf.subarray(starts[s], end)).toString('utf8'); } catch {}
|
|
14
|
-
}
|
|
15
|
-
const lines = all.split('\n').filter(l => l.trim().length > 0);
|
|
16
|
-
const RESTART = new Date('2026-08-29T12:43:19-04:00').getTime();
|
|
17
|
-
const after = [];
|
|
18
|
-
for (const l of lines) {
|
|
19
|
-
try { const j = JSON.parse(l); if ((j.time ?? 0) >= RESTART) after.push(j); } catch {}
|
|
20
|
-
}
|
|
21
|
-
console.log('events after restart:', after.length);
|
|
22
|
-
const byType = {};
|
|
23
|
-
for (const j of after) byType[j.type] = (byType[j.type] ?? 0) + 1;
|
|
24
|
-
console.log('by type:', JSON.stringify(byType));
|
|
25
|
-
// 演员turn(>=100000)与 femo-plugin/chat kind 分布
|
|
26
|
-
const actorTurns = after.filter(j => j.type === 'turn/start' && typeof j.data?.turn === 'number' && j.data.turn >= 100000);
|
|
27
|
-
console.log('actor turn/start (>=100000):', actorTurns.length, actorTurns.map(j => j.data.turn).join(','));
|
|
28
|
-
const chatKinds = {};
|
|
29
|
-
for (const j of after) {
|
|
30
|
-
if (j.type === 'femo-plugin/chat') { const k = j.data?.kind ?? '?'; chatKinds[k] = (chatKinds[k] ?? 0) + 1; }
|
|
31
|
-
}
|
|
32
|
-
console.log('femo-plugin/chat kinds:', JSON.stringify(chatKinds));
|
|
33
|
-
// 有 step/start 的 turn 号分布
|
|
34
|
-
const steps = after.filter(j => j.type === 'step/start').map(j => j.data?.turn);
|
|
35
|
-
const stepTurns = [...new Set(steps)];
|
|
36
|
-
console.log('step/start turns:', stepTurns.join(','));
|
|
37
|
-
// 最后 6 行
|
|
38
|
-
console.log('--- tail 6 (post-restart) ---');
|
|
39
|
-
for (const j of after.slice(-6)) console.log(JSON.stringify({ t: j.type, seq: j.seq, turn: j.data?.turn, kind: j.data?.kind, text: typeof j.data?.text === 'string' ? j.data.text.slice(0, 60) : undefined }));
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// 诊断3:看重启后 speaker 行详情 + 全时段演员 turn 分布
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import zlib from 'node:zlib';
|
|
4
|
-
const path = 'D:/myFiles/dsh/dsh-home/sessions/--D-myFiles-5m--/femo-proj-session-31340b5b-8291-47a1-bc51-aa3059d5e839-god/session.jsonl.zstd';
|
|
5
|
-
const buf = fs.readFileSync(path);
|
|
6
|
-
const starts = [];
|
|
7
|
-
for (let i = 0; i <= buf.length - 4; i++) {
|
|
8
|
-
if (buf[i] === 0x28 && buf[i + 1] === 0xB5 && buf[i + 2] === 0x2F && buf[i + 3] === 0xFD) starts.push(i);
|
|
9
|
-
}
|
|
10
|
-
let all = '';
|
|
11
|
-
for (let s = 0; s < starts.length; s++) {
|
|
12
|
-
const end = s + 1 < starts.length ? starts[s + 1] : buf.length;
|
|
13
|
-
try { all += zlib.zstdDecompressSync(buf.subarray(starts[s], end)).toString('utf8'); } catch {}
|
|
14
|
-
}
|
|
15
|
-
const lines = all.split('\n').filter(l => l.trim().length > 0);
|
|
16
|
-
const events = [];
|
|
17
|
-
for (const l of lines) { try { events.push(JSON.parse(l)); } catch {} }
|
|
18
|
-
const RESTART = new Date('2026-08-29T12:43:19-04:00').getTime();
|
|
19
|
-
const after = events.filter(j => (j.time ?? 0) >= RESTART);
|
|
20
|
-
console.log('=== post-restart speaker lines ===');
|
|
21
|
-
for (const j of after.filter(j => j.type === 'femo-plugin/chat' && j.data?.kind === 'speaker')) {
|
|
22
|
-
console.log(JSON.stringify(j).slice(0, 300));
|
|
23
|
-
}
|
|
24
|
-
console.log('=== post-restart user/message + assistant/message heads ===');
|
|
25
|
-
for (const j of after.filter(j => j.type === 'user/message' || j.type === 'assistant/message')) {
|
|
26
|
-
const txt = JSON.stringify(j.data?.message?.content ?? j.data?.content ?? j.data ?? {}).slice(0, 110);
|
|
27
|
-
console.log(j.type, 'seq=' + j.seq, 'turn=' + j.data?.turn, txt);
|
|
28
|
-
}
|
|
29
|
-
console.log('=== all-time actor turn/start distribution ===');
|
|
30
|
-
const at = events.filter(j => j.type === 'turn/start' && typeof j.data?.turn === 'number' && j.data.turn >= 100000);
|
|
31
|
-
console.log('count:', at.length, 'turns:', at.map(j => j.data.turn).join(','));
|
|
32
|
-
if (at.length > 0) console.log('last actor turn time:', new Date(at[at.length - 1].time).toISOString());
|
|
33
|
-
console.log('=== all-time speaker count by time ===');
|
|
34
|
-
const sp = events.filter(j => j.type === 'femo-plugin/chat' && j.data?.kind === 'speaker');
|
|
35
|
-
for (const j of sp) console.log(new Date(j.time).toISOString(), 'actor=' + j.data?.actor, 'seq=' + j.seq);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// 诊断4(2026-08-30):本场 par 带工具调用,god 窗物理落盘顺序全量 dump。
|
|
2
|
-
// 目的:实测 V5 乱序的结构性根因——每个事件的实际 seq 顺序 + turn 归属。
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import zlib from 'node:zlib';
|
|
5
|
-
const path = 'D:/myFiles/dsh/dsh-home/sessions/--D-myFiles-5m--/femo-proj-session-0cea9ee1-13ba-4bd3-9285-90ece030c98c-god/session.jsonl.zstd';
|
|
6
|
-
const buf = fs.readFileSync(path);
|
|
7
|
-
const starts = [];
|
|
8
|
-
for (let i = 0; i <= buf.length - 4; i++) {
|
|
9
|
-
if (buf[i] === 0x28 && buf[i + 1] === 0xB5 && buf[i + 2] === 0x2F && buf[i + 3] === 0xFD) starts.push(i);
|
|
10
|
-
}
|
|
11
|
-
let all = '';
|
|
12
|
-
for (let s = 0; s < starts.length; s++) {
|
|
13
|
-
const end = s + 1 < starts.length ? starts[s + 1] : buf.length;
|
|
14
|
-
try { all += zlib.zstdDecompressSync(buf.subarray(starts[s], end)).toString('utf8'); } catch {}
|
|
15
|
-
}
|
|
16
|
-
const lines = all.split('\n').filter(l => l.trim().length > 0);
|
|
17
|
-
const events = [];
|
|
18
|
-
for (const l of lines) { try { events.push(JSON.parse(l)); } catch {} }
|
|
19
|
-
events.sort((a, b) => (a.seq ?? 0) - (b.seq ?? 0));
|
|
20
|
-
|
|
21
|
-
function brief(j) {
|
|
22
|
-
const d = j.data ?? {};
|
|
23
|
-
const t = j.type;
|
|
24
|
-
if (t === 'femo-plugin/chat') {
|
|
25
|
-
if (d.kind === 'speaker') return `SPEAKER actor=${d.actor} turn=${d.turn}`;
|
|
26
|
-
return `chat kind=${d.kind} actor=${d.actor ?? ''}`;
|
|
27
|
-
}
|
|
28
|
-
if (t === 'assistant/chunk') {
|
|
29
|
-
const c = d.chunk ?? {};
|
|
30
|
-
const bt = c.block?.type ?? c.blockType ?? '';
|
|
31
|
-
let extra = '';
|
|
32
|
-
if (typeof c.text === 'string' && c.text.length > 0) extra = ' text=' + JSON.stringify(c.text.slice(0, 40));
|
|
33
|
-
if (typeof c.name === 'string') extra += ' name=' + c.name;
|
|
34
|
-
return `chunk ${c.type}/${bt}${extra}`;
|
|
35
|
-
}
|
|
36
|
-
if (t === 'assistant/message') {
|
|
37
|
-
const content = d.message?.content ?? d.content;
|
|
38
|
-
let s = '';
|
|
39
|
-
if (Array.isArray(content)) {
|
|
40
|
-
s = content.map(b => (b.type ?? '?') + (typeof b.text === 'string' ? '(' + b.text.length + 'ch)' : '')).join(',');
|
|
41
|
-
} else if (typeof content === 'string') s = 'str(' + content.length + 'ch)';
|
|
42
|
-
return `MESSAGE [${s}] turn=${d.turn} step=${d.step}`;
|
|
43
|
-
}
|
|
44
|
-
if (t === 'tool/call') return `TOOL_CALL ${d.name ?? d.tool ?? JSON.stringify(d).slice(0, 60)}`;
|
|
45
|
-
if (t === 'tool/result') return `TOOL_RESULT ${String(d.content ?? d.output ?? '').slice(0, 40)}`;
|
|
46
|
-
if (t === 'turn/start') return `TURN_START ${d.turn}`;
|
|
47
|
-
if (t === 'turn/end') return `TURN_END ${d.turn}`;
|
|
48
|
-
if (t === 'step/start') return `STEP_START ${d.turn}:${d.step}`;
|
|
49
|
-
if (t === 'step/end') return `STEP_END ${d.turn}:${d.step}`;
|
|
50
|
-
if (t === 'user/message') return 'USER_MSG ' + JSON.stringify(d).slice(0, 50);
|
|
51
|
-
return t + ' ' + JSON.stringify(d).slice(0, 60);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log('frames=' + starts.length + ' events=' + events.length);
|
|
55
|
-
console.log('=== physical order (seq asc) ===');
|
|
56
|
-
for (const j of events) {
|
|
57
|
-
const tm = j.time ? new Date(j.time).toTimeString().slice(0, 8) : '?';
|
|
58
|
-
console.log(`#${String(j.seq).padStart(6)} ${tm} ${brief(j)}`);
|
|
59
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// 诊断4b:chunk 事件是否携带 turn/step(决定 V5 head/stream Context 匹配)。
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import zlib from 'node:zlib';
|
|
4
|
-
const path = 'D:/myFiles/dsh/dsh-home/sessions/--D-myFiles-5m--/femo-proj-session-0cea9ee1-13ba-4bd3-9285-90ece030c98c-god/session.jsonl.zstd';
|
|
5
|
-
const buf = fs.readFileSync(path);
|
|
6
|
-
const starts = [];
|
|
7
|
-
for (let i = 0; i <= buf.length - 4; i++) {
|
|
8
|
-
if (buf[i] === 0x28 && buf[i + 1] === 0xB5 && buf[i + 2] === 0x2F && buf[i + 3] === 0xFD) starts.push(i);
|
|
9
|
-
}
|
|
10
|
-
let all = '';
|
|
11
|
-
for (let s = 0; s < starts.length; s++) {
|
|
12
|
-
const end = s + 1 < starts.length ? starts[s + 1] : buf.length;
|
|
13
|
-
try { all += zlib.zstdDecompressSync(buf.subarray(starts[s], end)).toString('utf8'); } catch {}
|
|
14
|
-
}
|
|
15
|
-
const events = [];
|
|
16
|
-
for (const l of all.split('\n')) { if (l.trim()) try { events.push(JSON.parse(l)); } catch {} }
|
|
17
|
-
events.sort((a, b) => (a.seq ?? 0) - (b.seq ?? 0));
|
|
18
|
-
console.log('=== every event with turn field status ===');
|
|
19
|
-
for (const j of events) {
|
|
20
|
-
const s = j.seq;
|
|
21
|
-
if (s === undefined) continue;
|
|
22
|
-
const d = j.data ?? {};
|
|
23
|
-
if (s < 76) continue;
|
|
24
|
-
const turn = 'turn' in d ? d.turn : '∅';
|
|
25
|
-
const step = 'step' in d ? d.step : '∅';
|
|
26
|
-
let extra = '';
|
|
27
|
-
if (j.type === 'assistant/chunk') {
|
|
28
|
-
const c = d.chunk ?? {};
|
|
29
|
-
extra = `${c.type}/${c.block?.type ?? c.blockType ?? ''}`;
|
|
30
|
-
if (typeof c.text === 'string' && c.text.length > 0) extra += ' ' + JSON.stringify(c.text.slice(0, 30));
|
|
31
|
-
}
|
|
32
|
-
if (j.type === 'femo-plugin/chat') extra = `kind=${d.kind} actor=${d.actor ?? ''} turn=${d.turn}`;
|
|
33
|
-
if (j.type === 'assistant/message') {
|
|
34
|
-
const content = d.message?.content ?? [];
|
|
35
|
-
extra = Array.isArray(content) ? content.map(b => b.type).join('+') : '?';
|
|
36
|
-
}
|
|
37
|
-
if (j.type === 'tool/call') extra = d.name ?? '';
|
|
38
|
-
console.log(`#${String(s).padStart(4)} turn=${String(turn).padStart(12)} step=${String(step)} ${j.type.padEnd(16)} ${extra}`);
|
|
39
|
-
}
|