femo-plugin 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/FEMO_logo.svg +55 -0
  2. package/FEMO_logo_slogan.svg +29 -0
  3. package/README.md +10 -2
  4. package/_tmp/fallback/driver2.py +176 -0
  5. package/_tmp/fallback/events.jsonl +108 -0
  6. package/_tmp/fallback/gateway_ui.py +325 -0
  7. package/_tmp/fallback/outbox/j1553_human_[/347/234/213/347/211/214]_1.done +1 -0
  8. package/_tmp/fallback/outbox/r1.done +1 -0
  9. package/_tmp/fallback/outbox/r2.done +1 -0
  10. package/_tmp/fallback/outbox/r3.done +1 -0
  11. package/_tmp/fallback/outbox/r4.done +1 -0
  12. package/_tmp/fallback/outbox/r5.done +1 -0
  13. 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 +3 -2
  14. package/hostAdapter/dshAdapter/client/client-ui/composer.tsx +112 -9
  15. package/hostAdapter/dshAdapter/client/client-ui/styles.ts +17 -0
  16. package/hostAdapter/dshAdapter/client/fa-icons.tsx +3 -0
  17. package/hostAdapter/dshAdapter/host/engine-events.ts +4 -1
  18. package/hostAdapter/dshAdapter/host/index.ts +5 -0
  19. package/hostAdapter/dshAdapter/host/preset-install.ts +59 -0
  20. package/hostAdapter/dshAdapter/host/projection-input.ts +14 -6
  21. package/hostAdapter/dshAdapter/lib/client.js +124 -5
  22. package/hostAdapter/dshAdapter/lib/client.js.map +3 -3
  23. package/hostAdapter/dshAdapter/lib/index.js +58 -18
  24. package/hostAdapter/dshAdapter/lib/index.js.map +4 -4
  25. package/hostAdapter/dshAdapter/package.json +1 -5
  26. package/hostAdapter/dshAdapter/preset/agent.cordis.yml +220 -0
  27. package/hostAdapter/dshAdapter/preset/preset.yml +3 -0
  28. package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/gateway.port +1 -0
  29. package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-a-_40_52a9_624b.jsonl +3 -0
  30. package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-a-_40_6211.jsonl +10 -0
  31. package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-god.jsonl +11 -0
  32. package/hostAdapter/zcodeAdapter/.tmp/femo/host-history/proj-mirror/femo-main-stage.jsonl +11 -0
  33. package/hostAdapter/zcodeAdapter/.zcode-plugin/plugin.json +23 -0
  34. package/hostAdapter/zcodeAdapter/README.md +61 -0
  35. package/hostAdapter/zcodeAdapter/commands/femo.md +9 -0
  36. package/hostAdapter/zcodeAdapter/femo-zcode-dist/.zcode-plugin/plugin.json +23 -0
  37. package/hostAdapter/zcodeAdapter/femo-zcode-dist/LICENSE +201 -0
  38. package/hostAdapter/zcodeAdapter/femo-zcode-dist/README.md +635 -0
  39. package/hostAdapter/zcodeAdapter/femo-zcode-dist/commands/femo.md +9 -0
  40. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/__init__.py +4 -0
  41. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femoToolcall/chronica.py +156 -0
  42. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femoToolcall/femo-chat.mjs +69 -0
  43. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femoToolcall/femo_debugger.py +1515 -0
  44. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femo_api.py +437 -0
  45. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femo2host/femo_gen_api.jsx +77 -0
  46. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/ContextExample.py +555 -0
  47. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/MemoryExample.py +163 -0
  48. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/__init__.py +1 -0
  49. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/getDir/get_dir.py +56 -0
  50. 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 +10 -0
  51. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/llmBridge.py +247 -0
  52. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoBridges/llmProviders.py +308 -0
  53. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_CLIrenderer.py +198 -0
  54. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_config.py +35 -0
  55. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_errors.py +278 -0
  56. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_interpreter.py +163 -0
  57. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_normalizer.py +396 -0
  58. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_parser.py +2468 -0
  59. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_runtime.py +3630 -0
  60. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/FEMO_scope_resolver.py +209 -0
  61. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/__init__.py +1 -0
  62. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/actor_resolver.py +86 -0
  63. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/block_collector.py +441 -0
  64. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/db_utils.py +485 -0
  65. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/femoAsync.py +401 -0
  66. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/host_manifest.py +68 -0
  67. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/job_manager.py +767 -0
  68. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/protocol.py +126 -0
  69. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/save_dialog.py +402 -0
  70. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/task_world.py +544 -0
  71. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/__init__.py +19 -0
  72. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/checkpoint.py +113 -0
  73. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/env.py +686 -0
  74. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/evaluator.py +567 -0
  75. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/join.py +303 -0
  76. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/merge.py +157 -0
  77. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoCompiler/vars/model.py +245 -0
  78. 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 +192 -0
  79. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/AI/350/201/212/345/244/251/345/256/244/group-chat.femo +42 -0
  80. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/AI/350/201/212/345/244/251/345/256/244/random_wait_time.py +10 -0
  81. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/LuxFiat/luxfiat.femo +38 -0
  82. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/LuxFiat/wait.py +29 -0
  83. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/debug/347/245/236/345/231/250/debug/347/245/236/345/231/250.femo +222 -0
  84. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/discussion.femo +70 -0
  85. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples/goal-mode.femo +23 -0
  86. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//345/270/270/347/224/250/345/267/245/345/205/267python/wait.py +29 -0
  87. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//347/213/274/344/272/272/346/235/200/werewolf_utils.py +205 -0
  88. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//347/213/274/344/272/272/346/235/200/werewolf_utils2.py +324 -0
  89. 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 +544 -0
  90. 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 +331 -0
  91. package/hostAdapter/zcodeAdapter/femo-zcode-dist/femoExamples//350/260/201/346/230/257/345/215/247/345/272/225/undercover_utils.py +683 -0
  92. 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 +348 -0
  93. 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 +393 -0
  94. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/after-tool.mjs +3 -0
  95. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/hooks.json +16 -0
  96. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/lib.mjs +59 -0
  97. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/prompt-state.mjs +3 -0
  98. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/session-start.mjs +3 -0
  99. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hooks/stop-intent.mjs +3 -0
  100. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hostAdapter/dshAdapter/python/dev-bridge-test.py +43 -0
  101. package/hostAdapter/zcodeAdapter/femo-zcode-dist/hostAdapter/dshAdapter/python/femo_bridge.py +533 -0
  102. package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/bridge-manager.mjs +192 -0
  103. package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/event-router.mjs +258 -0
  104. package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/femo-server.mjs +429 -0
  105. package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/gateway.mjs +163 -0
  106. package/hostAdapter/zcodeAdapter/femo-zcode-dist/mcp/projection-writer.mjs +294 -0
  107. package/hostAdapter/zcodeAdapter/femo-zcode-dist/skills/femo/SKILL.md +93 -0
  108. package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/bridge-smoke.mjs +26 -0
  109. package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/event-router.test.mjs +157 -0
  110. package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/gateway-smoke.mjs +107 -0
  111. package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/integration-human.mjs +111 -0
  112. package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/main-actor.mjs +107 -0
  113. package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/mcp-smoke.mjs +130 -0
  114. package/hostAdapter/zcodeAdapter/femo-zcode-dist/tests/projection-writer.test.mjs +144 -0
  115. package/hostAdapter/zcodeAdapter/femo-zcode-dist/zcode.host.manifest.json +5 -0
  116. 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 +113 -0
  117. package/hostAdapter/zcodeAdapter/femo-zcode-dist//350/257/255/346/263/225/346/226/207/346/241/243.md +1136 -0
  118. package/hostAdapter/zcodeAdapter/hooks/after-tool.mjs +3 -0
  119. package/hostAdapter/zcodeAdapter/hooks/hooks.json +16 -0
  120. package/hostAdapter/zcodeAdapter/hooks/lib.mjs +59 -0
  121. package/hostAdapter/zcodeAdapter/hooks/prompt-state.mjs +3 -0
  122. package/hostAdapter/zcodeAdapter/hooks/session-start.mjs +3 -0
  123. package/hostAdapter/zcodeAdapter/hooks/stop-intent.mjs +3 -0
  124. package/hostAdapter/zcodeAdapter/mcp/bridge-manager.mjs +192 -0
  125. package/hostAdapter/zcodeAdapter/mcp/event-router.mjs +258 -0
  126. package/hostAdapter/zcodeAdapter/mcp/femo-server.mjs +429 -0
  127. package/hostAdapter/zcodeAdapter/mcp/gateway.mjs +163 -0
  128. package/hostAdapter/zcodeAdapter/mcp/projection-writer.mjs +294 -0
  129. package/hostAdapter/zcodeAdapter/skills/femo/SKILL.md +93 -0
  130. package/hostAdapter/zcodeAdapter/tests/bridge-smoke.mjs +26 -0
  131. package/hostAdapter/zcodeAdapter/tests/event-router.test.mjs +157 -0
  132. package/hostAdapter/zcodeAdapter/tests/gateway-smoke.mjs +107 -0
  133. package/hostAdapter/zcodeAdapter/tests/integration-human.mjs +111 -0
  134. package/hostAdapter/zcodeAdapter/tests/main-actor.mjs +107 -0
  135. package/hostAdapter/zcodeAdapter/tests/mcp-smoke.mjs +130 -0
  136. package/hostAdapter/zcodeAdapter/tests/projection-writer.test.mjs +144 -0
  137. package/hostAdapter/zcodeAdapter/zcode.host.manifest.json +5 -0
  138. 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 +113 -0
  139. package/package.json +1 -1
  140. package/scripts/diag-find-redblue.mjs +38 -0
  141. package/scripts/diag-god-log.mjs +31 -0
  142. package/scripts/diag-god-log2.mjs +39 -0
  143. package/scripts/diag-god-log3.mjs +35 -0
  144. package/scripts/diag-god-log4.mjs +59 -0
  145. package/scripts/diag-god-log4b.mjs +39 -0
  146. package/scripts/diag-redblue-god.mjs +39 -0
  147. package/scripts/diag-redblue-log.mjs +37 -0
  148. package/scripts/diag-redblue-span.mjs +41 -0
  149. package/scripts/diag-stage-1017.mjs +63 -0
  150. package/scripts/dump_session.py +36 -0
  151. package/scripts/link-workspace.ps1 +51 -0
  152. package/scripts/list_souls.py +18 -0
  153. package/scripts/probe-composer-refresh.mjs +197 -0
  154. package/scripts/seed_story_souls.py +86 -0
  155. package/scripts/sync-zcode-dist.ps1 +55 -0
  156. package/scripts/theme-tokenize/color-extract.txt +288 -0
  157. package/scripts/theme-tokenize/round1-quoted.ps1 +149 -0
  158. package/scripts/theme-tokenize/round2-bare.ps1 +138 -0
  159. package/scripts/theme-tokenize/round3-shape.ps1 +110 -0
  160. package/tests/_diag_r4_join.femo +32 -0
  161. package/tests/conftest.py +95 -0
  162. package/tests/diag-subagent-dir-3081.mjs +101 -0
  163. package/tests/femoGenerator.test.mjs +3909 -0
  164. package/tests/femoParser.test.mjs +4813 -0
  165. package/tests/femogen_notice.test.mjs +109 -0
  166. package/tests/femoparser_validation.test.mjs +84 -0
  167. package/tests/main-delivery-queue.test.mjs +329 -0
  168. package/tests/pre-step-gate.test.mjs +282 -0
  169. package/tests/read-subagent-model.mjs +24 -0
  170. package/tests/run-script-tests.py +97 -0
  171. package/tests/safe-steer.test.mjs +59 -0
  172. package/tests/strip_comments.test.mjs +164 -0
  173. package/tests/test_actor_failed.py +92 -0
  174. package/tests/test_compile_warnings.py +99 -0
  175. package/tests/test_debug_log_bus.py +108 -0
  176. package/tests/test_debugger_module_mode.py +141 -0
  177. package/tests/test_error_buckets.py +117 -0
  178. package/tests/test_error_dispatcher.py +261 -0
  179. package/tests/test_exec_ai_retry.py +155 -0
  180. package/tests/test_exec_human_retry.py +159 -0
  181. package/tests/test_file_resolve.py +104 -0
  182. package/tests/test_flow_events.py +311 -0
  183. package/tests/test_flow_ref_validation.py +92 -0
  184. package/tests/test_func_dict_fallback.py +39 -0
  185. package/tests/test_job_lifecycle.py +236 -0
  186. package/tests/test_job_manager.py +424 -0
  187. package/tests/test_mind.py +99 -0
  188. package/tests/test_module_call_args.py +258 -0
  189. package/tests/test_module_visibility.py +238 -0
  190. package/tests/test_notice.py +143 -0
  191. package/tests/test_out_whitelist.py +83 -0
  192. package/tests/test_par_if_dispatch.py +64 -0
  193. package/tests/test_par_nested_for.py +78 -0
  194. package/tests/test_parser.py +494 -0
  195. package/tests/test_pause.py +102 -0
  196. package/tests/test_pause_contract.py +135 -0
  197. package/tests/test_protocol_transcript.py +158 -0
  198. package/tests/test_scope_self.py +202 -0
  199. package/tests/test_source_validate.py +113 -0
  200. package/tests/test_task_world.py +447 -0
  201. package/tests/test_town_structure.py +70 -0
  202. package/tests/test_v2_checkpoint.py +115 -0
  203. package/tests/test_v2_env.py +383 -0
  204. package/tests/test_v2_evaluator.py +227 -0
  205. package/tests/test_v2_join.py +315 -0
  206. package/tests/test_v2_join_wiring.py +429 -0
  207. package/tests/test_v2_merge.py +167 -0
  208. package/tests/test_v2_model.py +143 -0
  209. package/tests/test_v2_resume_e2e.py +472 -0
  210. package/tests/test_var_decls.py +271 -0
  211. package/tests/verify-model-functions.mjs +90 -0
  212. package/tests/verify-subagent-model-3081.mjs +153 -0
  213. 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 +395 -0
  214. 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 +66 -0
  215. 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 +475 -0
  216. 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 +847 -0
  217. 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 +654 -0
  218. 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 +471 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "femo-plugin",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Femo (FlowEngineforMinds) 多智能体剧本引擎的 dsh 插件版 — 无主模型 Femo 会话、聊天窗口角色气泡、剧本控制(含完整引擎,自包含,整个文件夹搬走即用)",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -19,10 +19,6 @@
19
19
  "./cordis.patch.yml": "./cordis.patch.yml",
20
20
  "./package.json": "./package.json"
21
21
  },
22
- "files": [
23
- "lib",
24
- "cordis.patch.yml"
25
- ],
26
22
  "license": "Apache-2.0",
27
23
  "dsh": {
28
24
  "client": {
@@ -0,0 +1,220 @@
1
+ # The `femo-plugin` agent preset: a Femo script stage session.
2
+ #
3
+ # The session has a main model (dsh default): idle sessions converse/write
4
+ # scripts normally; while a script runs, the femo-plugin plugin rejects
5
+ # pre-step so the engine owns the conversation (the input bridge routes user
6
+ # text to human nodes / hard stop).
7
+ #
8
+ # Tools here are inherited by the femo-plugin SUBAGENTS (each Femo AI node runs
9
+ # as a fresh child under this preset): the child joins the parent's preset,
10
+ # so whatever is mounted here is what the script characters may call.
11
+
12
+ - id: persona
13
+ name: '@deepseek-ai/dsh-persona'
14
+ config:
15
+ # 0.1.5 起 persona 行的 schema 是 { prefix, suffix, complete,
16
+ # includeRuntimeContext }:prefix 必填(原 text 键已废弃)。
17
+ # 占位符 {FEMO_ROOT}(femo 系统根目录)不在本文件解析——运行时才知道,
18
+ # 由插件的 femo:root section 注入实际值(host/persona.ts)。
19
+ # 2026-09-14:全文由作者定稿替换(bak-20260914-userfinal 为前一版)。
20
+ prefix: |-
21
+ 【FEMO是什么】
22
+
23
+ FEMO = Flow Emerges Mag Opus.
24
+ 这是一个多智能体编排模式:把"多个 AI 协作完成一件事"编排成.femo脚本,后由femo引擎运行脚本来实现你设计的任何多智能体流程。
25
+
26
+ 你是 FEMO 模式的导演,同时也是用户在这个会话里的 AI 助手。
27
+ 你可以帮用户写femo脚本,或者使用femo脚本来帮用户完成需求。
28
+ 本会话是混合模式:
29
+ - 空闲时:正常聊天,写脚本、调用工具、回答用户问题——和普通 dsh 会话一样。
30
+ - 剧本运行中:femo脚本在后台运行,你不会被实况打扰(角色发言只进投影窗,不进你的上下文);
31
+ 用户给你发消息你依然能收到;运行结果/报错见【运行出错时】。
32
+ - 用户可以通过「视角菜单」切换到上帝视角/角色视角投影窗。
33
+ - 主agent下场模式:你也可以参与femo脚本的舞台,那时你会收到femo流程中的上下文,并可以做出回应。
34
+
35
+ 【FEMO模式指导】
36
+
37
+ FEMO模式非常强大,可能性非常多。
38
+ 它编排的是AI工作的流程,所以你列的to do list可以使用femo,狼人杀等游戏可以使用femo,用户提出的工作流可以使用femo,任何时候当你想用流程限制AI的动作以获取稳定性或者可复现性可以写femo,你和用户想找其他更多AI聊天可以用femo,斯坦福小镇类的AI交流可以用femo。
39
+ femo可以是能跑的游戏源代码,可以是skill,可以是harness,可以是故事,可以是AI的生活,还可以是涌现的种子。
40
+
41
+ 1. 写剧本之前:
42
+ 先想清楚:你的目的是什么?这个目的要如何达成才更好?你需要哪些角色(actors)?每个角色一步一步的做什么(action)?
43
+ 比如,如果你想写个专门找复杂bug的femo,你可以思考你自己找bug的工作流、经验和教训,先看什么,再看什么,把它固化为femo脚本的prompt和流程,下次遇到这种场合就可以直接调用该femo。
44
+ 比如,如果你有个复杂问题,可以使用femo,设置多个性格迥异、各当一面的子代理AI,让他们分头调研,进行讨论。
45
+ 比如,如果用户想玩游戏,你可以给他写个角色扮演游戏,由用户饰演一个角色,剧本中再设定其他各种AI角色,你甚至不需要设计剧情,因为AI们聊起来会自然发生涌现。
46
+ 比如,如果用户想跟你一起玩,你可以给自己也在剧本中认领一个角色。
47
+
48
+ 2. 剧本怎么写:
49
+ 语法速查表:
50
+ | 语法 | 作用 |
51
+ |---|---|
52
+ | meta: | 元信息:name / owner / session / system_safety / output_style |
53
+ | vars: | 全局变量池,先声明后使用;@开头的变量是角色类型 |
54
+ | actors: | 角色:ai @名 = soul:角色id(soul 可选);human @名 = soul:human, source:0 |
55
+ | code: | 引入 Python 文件:别名 = file:"路径" |
56
+ | action 名 @ai(@执行者): | 定义 AI 动作:prompt 是给角色的话({变量} 替换),scope 是可见房间,out 声明输出变量 |
57
+ | @assign | 不调 LLM 的纯赋值动作(out: 变量 += 1) |
58
+ | @func(模块.函数) | 调用 code 区 Python 函数 |
59
+ | @mind(@变量) | 运行时按执行者实际类型分发(AI/人类) |
60
+ | SET VARIABLE: <<变量 = 值>> | AI 回复里的赋值信号(支持 =、+=、-=、add()、remove()) |
61
+ | mainflow: | 主流程:[START] -> 动作 -> [END];循环必须回节点位置([A]),不能回 action 名 |
62
+ | fork / if / join | 并行分支 / 条件分支 / 合并 |
63
+ | for / par | 串行循环 / 并行遍历(par 并发调 LLM) |
64
+ | module 名(...): | 子流程黑盒,flow 里用 &名 调用 |
65
+ | scope: all / 不写 / 留空 | 全员可见(默认开放,写了才收窄) |
66
+ | scope: self | 只有发言者和 owner 可见(私密碎碎念) |
67
+ 关于 soul:soul 非必须——无角色设定的简单剧本(如 goal 模式)不写 soul,角色就是裸执行者
68
+ (无 soul 角色看到本 session 全部上下文,不隔离);有角色设定的剧本才写 soul
69
+ (soul:角色id,写剧本前先用 femo-soul list 查库选角;库里没有的角色先用 femo-soul create 新建)。
70
+ 最小可运行模板(复制结构照着改):
71
+ meta:
72
+ name = Goal 模式
73
+ actors:
74
+ ai @执行者
75
+ vars:
76
+ done = false
77
+ action 执行 @ai(@执行者):
78
+ prompt: |
79
+ 你的目标:为社区咖啡馆设计一份周末活动方案。
80
+ 继续推进目标,直到你认为完成。
81
+ 如果还没完成,继续。
82
+ 如果已经完成,输出:SET VARIABLE: <<done = true>>
83
+ out: done(bool, "是否完成")
84
+ mainflow:
85
+ [START] -> [work]:执行
86
+ [work] -> if (done == true) -> [END]
87
+ [work] -> if (done == false) -> [work]
88
+
89
+ - actors(角色)= 执行者可以有 AI 角色、人类角色(用户)、主Agent(你)。
90
+ 几个特殊的写法:
91
+ ai @玩家甲 = source:main # 这是你把自己写进剧本的写法,使用source:main。role可以写也可以不写。你的视角听从femo剧本规定。
92
+ human @用户 # 这是用户的标准写法,他的femo角色视角=上帝视角。
93
+ human @用户玩家 = soul: human, source:0 # 如果规定人类source 0,他将失去上帝视角,只有作为@用户玩家的角色视角,视角跟着femo脚本规定的走。适合狼人杀等场合。
94
+ - action(动作)= 行为单元:AI 动作本质是一次带 prompt 的 LLM 回合;
95
+ 关于变量赋值:
96
+ 可用 out 声明变量,让 AI 用 SET VARIABLE: <<变量 = 值>> 输出赋值来驱动流程。如果action节点缺少out声明,则无法赋值变量。
97
+ 注意,AI共享上下文,femo系统通过上下文传递消息,想告诉别的AI什么事儿,直接自然语言说就行了。变量赋值只负责控制流程里的支线选择,不要滥用变量赋值传递信息。
98
+ - mainflow 流程= 类似于mermaid的语法。节点图:[START] -> 动作 -> [END],支持顺序、循环 for、并行 par/fork、条件 if、合并 join。
99
+ - scope 视野 = 上下文信息隔离的房间:同一 scope 的角色共享聊天记录,跨 scope 天然隔离。不写 scope 或留空 = 全员可见(默认开放);scope: self = 只有发言者和用户上帝视角可见(私密碎碎念)。scope 是显式的视野要求:写了才收窄。
100
+ - vars 变量 = 流程控制参数:驱动条件判断和角色视野,必须先声明后使用。
101
+ - 核心哲学:上下文不是变量——角色间传话靠共享 scope 的聊天记录,不靠变量传递;变量赋值主要用于控制流程走向。LLM 是智慧体不是函数:同房间直接聊天,跨房间靠文件/工具沟通。
102
+ - 这里说的极为简略,更多详细内容可参照官方示例,或者去阅读语法文档。
103
+
104
+ 3. 先看示例以了解语法:
105
+ femo系统根目录:{FEMO_ROOT}
106
+ 官方示例剧本在 {FEMO_ROOT}\femoExamples\:
107
+ - goal-loop.femo 循环 + 变量退出
108
+ - group-chat.femo par 并行 + @func 随机间隔
109
+ - discussion.femo for + if + par + 人类拍板
110
+ - town.femo 动态 scope + add/remove 移动
111
+ 写剧本前先读一个最接近需求的示例照着改;写复杂剧本前建议把 femoExamples\ 整体读一遍,
112
+ 学习 scope/vars/flow 的常见套路。
113
+ 冷门语法(memory/context/module 等)查完整语法文档:{FEMO_ROOT}\语法文档.md。不要凭印象猜语法。
114
+
115
+
116
+ 4. femo脚本保存:
117
+ femo系统根目录:{FEMO_ROOT}
118
+ 你和用户写的femo脚本建议存放:{FEMO_ROOT}\user_data\projects
119
+ femo脚本中如果引用外部python函数,file地址规则:剧本里 file:"路径" 支持相对路径与绝对路径。相对路径为”相对剧本文件所在目录“;剧本未保存(纯文本直接运行)时只支持绝对路径。
120
+ 如果是有外部依赖的复杂项目,建议新建文件夹,把python脚本和其他文件以及femo都存在一个文件夹里。
121
+
122
+
123
+ 5. 干跑自检——改完剧本、正式运行前先做
124
+ femo-debug 把当前挂载的剧本空跑一遍:不调用任何 AI/人类(AI 动作与人类输入由调试器合成替答),
125
+ 引擎按真实管线跑完整流程。
126
+ - 返回两部分:①逐条调试流水(节点进出、变量 old→new、AI 合成赋值与来源、人类合成输入、重试、告警);
127
+ ②终报(每轮结局与报错、节点执行顺序、边覆盖、变量快照 diff、未达节点)。编译失败时把编译器报错
128
+ 原话给你。
129
+ - 拿它确认这些事:流程按预期走、条件分支走对、循环能退出(步数预算 200,疑似死循环会中止并说明)、
130
+ 没有变成死分支的节点(终报的「未达节点」)、变量赋值如期发生。
131
+ - 代价为零:不花 token、不占 Job、不写生产台账(调试器用独立 DB 沙盒),可以反复跑——改完剧本再跑
132
+ 一遍,直到干跑干净再去 femo-run。
133
+ - 它跑的是「当前挂载的剧本」:挂载之后又改了剧本,要重新 femo-mount(或在 femoGen 编辑器里写入)
134
+ 再干跑,否则跑的还是旧版。
135
+ - 想撞随机分支/概率沉默:runs 多跑几轮(每轮换种子);想复现某一场:seed 给同一个种子。
136
+ - 注意:合成输入是调试器按 out 声明/变量初值猜的,只验证流程与接线,不代表内容质量;台词好不好要
137
+ 正式运行或人工看。
138
+ 进阶调试 CLI(单测某个 module / 定向注入变量 / 概率沉默 / 注入无效赋值测重试链路):
139
+ python {FEMO_ROOT}\femo2host\femoToolcall\femo_debugger.py run <剧本>
140
+ --module 名 / --set 变量=值 / --assign-prob 0.7 / --flaky 0.3
141
+ (用法见文件头注释;产出的流水与终报跟 femo-debug 返回同源。)
142
+
143
+
144
+ 6.运行——两种工作流,按用户意图选择
145
+ - 结果导向:用户只想要结果(如"让一个团队完成某任务")。
146
+ 你自主闭环:写剧本 → femo-mount 挂载 → femo-debug 干跑自检 → 改到干跑干净 → femo-run fresh_start 运行 → 等系统通知(跑完/报错) → 分析结果、迭代剧本,直到用户满意。
147
+ - 过程导向:用户想参与/观看过程(如狼人杀、互动演出)。
148
+ 你写好剧本挂载后,先 femo-debug 干跑确认,流程跑得通,再让用户在 femogen 里运行或你调用femo-run运行;
149
+ 剧本运行时,可提醒用户去FEMO标签页,或者对话标签页投影窗(如上帝视角)查看femo舞台的演出。
150
+ 如果有 human 节点等用户输入,用户可以在上帝视角、戏内视角、他自己的角色视角以及FEMO标签页输入。
151
+ - 拿不准时问用户要哪种。
152
+
153
+ 7. 运行出错时:
154
+ 剧本运行时,如果运行正常,你不会收到剧本运行消息。
155
+ 如果编译出错、运行中报错、正常跑完,系统会告诉你。如果报错,你会看到报错信息。
156
+ 出错时:先看错误信息,判断是否与剧本语法或依赖 Python 文件有关。
157
+ 如果剧本和python文件是你自己写的,你可以立即改正,不用问用户。
158
+ 如果剧本和python文件是用户提供的,你动手改剧本或文件前先跟用户确认。
159
+
160
+ 8. 查台账:
161
+ femo运行记录:{FEMO_ROOT}\user_data\memory\Chronica.wor(SQLite/WAL)
162
+ 用 mode=ro 只读连接即可,不影响运行中的引擎,无需停演再查。
163
+ - 现成查询器:python {FEMO_ROOT}\femo2host\femoToolcall\chronica.py
164
+ - 无参数 最新场次的发言流
165
+ - 场次号 看指定场次
166
+ - --list N 最近 N 场一览
167
+ - --scope 每行附带可见用户/可见角色(排查视野类问题用)
168
+ - 输出分两幕:【对话流】= showprompt 旁白 + AI 发言 + 人类输入(这是戏本身);
169
+ 【幕后指令】= 节点 prompt(教 AI 怎么说话用的,不属于对话流)。
170
+
171
+
172
+ 【FEMO工具列表】
173
+
174
+ femo-mount 挂载剧本,femogen 立即可见
175
+ femo-script 查看当前挂载剧本全文
176
+ femo-debug 零 token 干跑自检
177
+ femo-run 控制运行:fresh_start 从头跑、pause 停止并挂起、resume 从断点续跑,运行中随时可停止/续跑。list_jobs 查挂起的 Job。
178
+ femo-soul 角色库 list 选角 / create 新建
179
+ femo-chronica 查询femo运行聊天记录。
180
+
181
+ # ── tools available to Femo subagents ────────────────────────────────────────
182
+
183
+ - id: tool-fs
184
+ name: '@deepseek-ai/dsh-tool-fs'
185
+
186
+ - id: tool-fs-search
187
+ name: '@deepseek-ai/dsh-tool-fs-search'
188
+ config:
189
+ sampleOverCapGlobResults: false
190
+
191
+ - id: tool-bash
192
+ name: '@deepseek-ai/dsh-tool-bash'
193
+
194
+ # ── compaction ──────────────────────────────────────────────────────────────
195
+ # 与 standard preset 同款三件套:/compact 命令 + 自动压力压缩 + 超长工具结果先剪。
196
+ # group + isolate realm 写法照抄 standard:compaction 服务是 entry 本地的,
197
+ # 不会与普通会话(standard preset)挂载的同名服务相撞;tokenMeter 留在 host
198
+ # 平面,此处只 resolve 不重挂(同 standard 的取舍)。
199
+ # pruner 阈值比 standard 默认(8192/4096/1024)调大:femo-script 返回的剧本
200
+ # 全文、femo-run 的输出是导演主模型需要完整看到的产物,8192 会把剧本中段剪掉;
201
+ # 65536 起剪,真超长的垃圾结果仍有防护。改动只影响此后新开的 femo 会话。
202
+ - id: compaction
203
+ name: cordis:group
204
+ group: true
205
+ isolate:
206
+ compaction: true
207
+ toolResultPruner: true
208
+ config:
209
+ - id: compaction-basic
210
+ name: '@deepseek-ai/dsh-compaction-basic'
211
+
212
+ - id: command-compact
213
+ name: '@deepseek-ai/dsh-command-compact'
214
+
215
+ - id: tool-result-pruner
216
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
217
+ config:
218
+ thresholdChars: 65536
219
+ headChars: 32768
220
+ tailChars: 8192
@@ -0,0 +1,3 @@
1
+ name: FEMO模式
2
+ description: FEMO 多智能体剧本舞台。主模型可对话、写剧本、运行剧本;剧本运行期间由引擎按角色组装 system prompt 驱动。
3
+ order: 10
@@ -0,0 +1,3 @@
1
+ {"seq":1,"ts":"2026-09-14T15:50:37.175Z","type":"femo/chat","data":{"text":"🎬 《AI回路冒烟》开演","kind":"sys","seq":1789401037174}}
2
+ {"seq":2,"ts":"2026-09-14T15:50:43.970Z","type":"femo/chat","data":{"actor":"@助手(AI助手)","text":"你好,我是 AI 助手。","kind":"role","seq":1789401043969}}
3
+ {"seq":3,"ts":"2026-09-14T15:50:43.974Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401043973}}
@@ -0,0 +1,10 @@
1
+ {"seq":1,"ts":"2026-09-14T15:50:04.488Z","type":"femo/chat","data":{"text":"🎬 《网关冒烟》开演","kind":"sys","seq":1789401004487}}
2
+ {"seq":2,"ts":"2026-09-14T15:50:07.037Z","type":"femo/chat","data":{"text":"🎭 等待你的回应:请说点什么","kind":"human_wait","seq":1789401007036}}
3
+ {"seq":3,"ts":"2026-09-14T15:50:07.219Z","type":"femo/chat","data":{"actor":"@我","text":"网关通道台词。","kind":"role","seq":1789401007219}}
4
+ {"seq":4,"ts":"2026-09-14T15:50:08.396Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401008364}}
5
+ {"seq":5,"ts":"2026-09-14T15:50:26.922Z","type":"femo/chat","data":{"text":"🎬 《MCP冒烟》开演","kind":"sys","seq":1789401026690}}
6
+ {"seq":6,"ts":"2026-09-14T15:50:27.393Z","type":"femo/chat","data":{"text":"🎭 等待你的回应:请说点什么","kind":"human_wait","seq":1789401027393}}
7
+ {"seq":7,"ts":"2026-09-14T15:50:27.395Z","type":"femo/chat","data":{"actor":"@我","text":"MCP 冒烟台词。","kind":"role","seq":1789401027394}}
8
+ {"seq":8,"ts":"2026-09-14T15:50:28.188Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401028188}}
9
+ {"seq":9,"ts":"2026-09-14T15:50:37.175Z","type":"femo/chat","data":{"text":"🎬 《AI回路冒烟》开演","kind":"sys","seq":1789401037174}}
10
+ {"seq":10,"ts":"2026-09-14T15:50:43.974Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401043973}}
@@ -0,0 +1,11 @@
1
+ {"seq":1,"ts":"2026-09-14T15:50:04.487Z","type":"femo/chat","data":{"text":"🎬 《网关冒烟》开演","kind":"sys","seq":1789401004487}}
2
+ {"seq":2,"ts":"2026-09-14T15:50:07.036Z","type":"femo/chat","data":{"text":"🎭 等待你的回应:请说点什么","kind":"human_wait","seq":1789401007036}}
3
+ {"seq":3,"ts":"2026-09-14T15:50:07.219Z","type":"femo/chat","data":{"actor":"@我","text":"网关通道台词。","kind":"role","seq":1789401007219}}
4
+ {"seq":4,"ts":"2026-09-14T15:50:08.364Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401008364}}
5
+ {"seq":5,"ts":"2026-09-14T15:50:26.694Z","type":"femo/chat","data":{"text":"🎬 《MCP冒烟》开演","kind":"sys","seq":1789401026690}}
6
+ {"seq":6,"ts":"2026-09-14T15:50:27.393Z","type":"femo/chat","data":{"text":"🎭 等待你的回应:请说点什么","kind":"human_wait","seq":1789401027393}}
7
+ {"seq":7,"ts":"2026-09-14T15:50:27.394Z","type":"femo/chat","data":{"actor":"@我","text":"MCP 冒烟台词。","kind":"role","seq":1789401027394}}
8
+ {"seq":8,"ts":"2026-09-14T15:50:28.188Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401028188}}
9
+ {"seq":9,"ts":"2026-09-14T15:50:37.174Z","type":"femo/chat","data":{"text":"🎬 《AI回路冒烟》开演","kind":"sys","seq":1789401037174}}
10
+ {"seq":10,"ts":"2026-09-14T15:50:43.969Z","type":"femo/chat","data":{"actor":"@助手(AI助手)","text":"你好,我是 AI 助手。","kind":"role","seq":1789401043969}}
11
+ {"seq":11,"ts":"2026-09-14T15:50:43.973Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401043973}}
@@ -0,0 +1,11 @@
1
+ {"seq":1,"ts":"2026-09-14T15:50:04.487Z","type":"femo/chat","data":{"text":"🎬 《网关冒烟》开演","kind":"sys","seq":1789401004487}}
2
+ {"seq":2,"ts":"2026-09-14T15:50:07.036Z","type":"femo/chat","data":{"text":"🎭 等待你的回应:请说点什么","kind":"human_wait","seq":1789401007036}}
3
+ {"seq":3,"ts":"2026-09-14T15:50:07.219Z","type":"femo/chat","data":{"actor":"@我","text":"网关通道台词。","kind":"role","seq":1789401007219}}
4
+ {"seq":4,"ts":"2026-09-14T15:50:08.364Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401008364}}
5
+ {"seq":5,"ts":"2026-09-14T15:50:26.883Z","type":"femo/chat","data":{"text":"🎬 《MCP冒烟》开演","kind":"sys","seq":1789401026690}}
6
+ {"seq":6,"ts":"2026-09-14T15:50:27.393Z","type":"femo/chat","data":{"text":"🎭 等待你的回应:请说点什么","kind":"human_wait","seq":1789401027393}}
7
+ {"seq":7,"ts":"2026-09-14T15:50:27.395Z","type":"femo/chat","data":{"actor":"@我","text":"MCP 冒烟台词。","kind":"role","seq":1789401027394}}
8
+ {"seq":8,"ts":"2026-09-14T15:50:28.188Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401028188}}
9
+ {"seq":9,"ts":"2026-09-14T15:50:37.175Z","type":"femo/chat","data":{"text":"🎬 《AI回路冒烟》开演","kind":"sys","seq":1789401037174}}
10
+ {"seq":10,"ts":"2026-09-14T15:50:43.970Z","type":"femo/chat","data":{"actor":"@助手(AI助手)","text":"你好,我是 AI 助手。","kind":"role","seq":1789401043969}}
11
+ {"seq":11,"ts":"2026-09-14T15:50:43.973Z","type":"femo/chat","data":{"text":"✅ 剧本已跑完","kind":"sys","seq":1789401043973}}
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "femo-plugin",
3
+ "version": "0.1.0",
4
+ "description": "FEMO multi-agent play engine (ZCode adapter) - script-driven multi-agent theater; the main model directs, subagents act, humans play along.",
5
+ "description_i18n": {
6
+ "en": "FEMO multi-agent play engine (ZCode adapter): mount .femo scripts, run multi-agent plays with ZCode subagents as actors, main model as director/lead, browser stage monitor via femoGen.",
7
+ "zh-CN": "FEMO 多智能体剧本引擎(ZCode 适配):挂载 .femo 剧本,ZCode 子代理当演员、主模型当导演兼主演、femoGen 舞台监视器。"
8
+ },
9
+ "mcpServers": {
10
+ "gateway": {
11
+ "command": "node",
12
+ "args": ["${ZCODE_PLUGIN_ROOT}/mcp/femo-server.mjs"],
13
+ "env": {
14
+ "FEMO_PYTHON": "python"
15
+ },
16
+ "timeoutMs": 600000,
17
+ "enabled": true
18
+ }
19
+ },
20
+ "hooks": "hooks/hooks.json",
21
+ "skills": "skills",
22
+ "commands": "commands"
23
+ }
@@ -0,0 +1,61 @@
1
+ # zcodeAdapter — zcode 接口侧
2
+
3
+ FEMO 引擎与 ZCode 宿主之间的全部胶水代码。与 `dshAdapter/`(dsh 侧)同栖
4
+ `hostAdapter/`(宿主适配层,2026-09-13 归拢);引擎侧的 `femoCompiler/`(本体)、
5
+ `femoGen/`(编辑器)与边界层 `femo2host/`(门面 API + CLI 工具箱)在仓库根——
6
+ 整个仓库双宿主:dsh 装 dshAdapter,ZCode 装本目录
7
+ (根 `.zcode-plugin/plugin.json` 的组件字段指进 hostAdapter/zcodeAdapter/)。
8
+
9
+ 设计文档:仓库外 `D:/myFiles/dsh/zcode-femo-架构设计.md`(v3)。M0 验证结论:
10
+ 子代理=投影窗(桌面侧栏一等支持)、app-server 协议面已实测、拉取式主演循环。
11
+
12
+ ## 结构
13
+
14
+ ```
15
+ zcodeAdapter/
16
+ ├── mcp/
17
+ │ ├── projection-writer.mjs 投影窗三窗 JSONL 存储器 + 回合区块闸门(✅ 已实现,10/10 单测)
18
+ │ ├── femo-server.mjs MCP stdio 入口(工具面 + 总装) [待建]
19
+ │ ├── gateway.mjs HTTP + SSE 网关 + 静态托管 femoGen/dist(舞台监视器;human_wait 拍带 editor_url——导演转告时附链接,ZCode 桌面端点开即在右侧预览窗看舞台) [待建]
20
+ │ ├── bridge-manager.mjs 拉起 hostAdapter/dshAdapter/python/femo_bridge.py [待建]
21
+ │ ├── actor-runtime.mjs app-server 演员驱动器(协议雏形见 .tmp/as7.mjs)[待建]
22
+ │ └── event-router.mjs bridge 事件 → 投影/SSE/主演员队列 [待建]
23
+ ├── hooks/ SessionStart / UserPromptSubmit / Stop / PostToolUse [待建]
24
+ ├── skills/femo/SKILL.md 工作流教学 + 语法文档指路 [待建]
25
+ ├── commands/ /femo 快捷入口 [待建]
26
+ └── tests/ node --test 单测
27
+ ```
28
+
29
+ ## projection-writer.mjs — 投影窗存储器
30
+
31
+ 移植自 `dshAdapter/host/` 三件套,语义逐条对齐(文件头注释有移植对照表):
32
+
33
+ - **三窗**:`god`(全知)/ `stage`(戏内归档)/ `a-<actorKey>`(角色精装窗),
34
+ 每窗一个 JSONL 文件,定址由调用方给(约定 `<user_data>/host-history/proj-mirror/`)。
35
+ - **scope 分发**(projectionAppend 全语义):god+stage 恒全量;`targetActors` 为
36
+ `undefined` 或**空数组**(scope 未限定 = 全可见,2026-08-22 剧中人视角空白 bug 教训)
37
+ → 全部角色窗;显式列表 → 只进列出的窗。
38
+ - **两级去重**:`_srcSeq`(「源id#seq」复合键)+ 结构键(`turn/start:3` 这类骨架键),
39
+ O(1) Set;跨重启从文件懒建索引——重复投递幂等。
40
+ - **回合区块闸门**(section-gate v7 移植):par 并发下上帝窗段落顺序 = 演员开跑顺序
41
+ (甲乙乙甲),`waitActorFlush` 防同角色串桶,`dropPending` 收尾清队。
42
+ - **行格式**:`{seq(窗内行号), ts, type, data}`;`type='femo/chat'` 时 data 与 DSH 的
43
+ `femo-plugin/chat` 行同构(`{actor?, text, kind, visible?, turn?, step?, seq}`)——
44
+ femoGen zcode 模式只换类型常量。
45
+
46
+ 与 DSH 版的本质差异:**窗不再是宿主会话**(ensureProjectionWindow / 冷唤醒 / 单写者
47
+ 句柄 / 事件白名单全套不需要),窗 = 自有文件;角色视角窗由演员常驻子代理会话承担
48
+ (ZCode 原生侧栏),本模块的三窗只喂 femoGen 精装舞台。
49
+
50
+ ## 运行测试
51
+
52
+ ```bash
53
+ node --test zcodeAdapter/tests/projection-writer.test.mjs
54
+ ```
55
+
56
+ ## 注意
57
+
58
+ - `host.manifest.json` 留仓库根(dsh 约定);本侧的 `zcode.host.manifest.json`
59
+ (`host:"zcode"`)建好后经桥的 `--host-manifest` 参数指路,互不干扰。
60
+ - 仓库 `tests/` 里的 dsh 侧单测(safe-steer / pre-step-gate / main-delivery-queue)
61
+ 与本目录无关;本目录单测独立运行,零依赖(纯 node:test,无 zcode 依赖)。
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: 挂载并开演一部 FEMO 剧本(参数=剧本路径或剧本名)
3
+ allowed-tools: femo_mount, femo_run, femo_wait, femo_submit
4
+ ---
5
+ 请把「$ARGUMENTS」当作 FEMO 剧本路径(或 user_data/projects 下的剧本名):
6
+ 1. 先读 femo 技能确认工具循环与视角纪律;
7
+ 2. femo_mount 挂载该剧本(编译报错则修到通过);
8
+ 3. femo_run{action:"fresh_start"} 开演;
9
+ 4. femo_wait 进场循环(wait → 演出/转告 → submit),直到终局,向用户转述结局。
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "femo-plugin",
3
+ "version": "0.1.0",
4
+ "description": "FEMO multi-agent play engine (ZCode adapter) - script-driven multi-agent theater; the main model directs, subagents act, humans play along.",
5
+ "description_i18n": {
6
+ "en": "FEMO multi-agent play engine (ZCode adapter): mount .femo scripts, run multi-agent plays with ZCode subagents as actors, main model as director/lead, browser stage monitor via femoGen.",
7
+ "zh-CN": "FEMO 多智能体剧本引擎(ZCode 适配):挂载 .femo 剧本,ZCode 子代理当演员、主模型当导演兼主演、femoGen 舞台监视器。"
8
+ },
9
+ "mcpServers": {
10
+ "gateway": {
11
+ "command": "node",
12
+ "args": ["${ZCODE_PLUGIN_ROOT}/mcp/femo-server.mjs"],
13
+ "env": {
14
+ "FEMO_PYTHON": "python"
15
+ },
16
+ "timeoutMs": 600000,
17
+ "enabled": true
18
+ }
19
+ },
20
+ "hooks": "hooks/hooks.json",
21
+ "skills": "skills",
22
+ "commands": "commands"
23
+ }
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.