femo-plugin 1.0.4 → 1.0.5
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/docs/ActiveRoadmaps/Func/345/201/234/346/255/242/350/257/255/344/271/211-/351/201/227/345/274/203/346/216/245/347/273/255-/346/226/275/345/267/245/346/270/205/345/215/225.md +91 -0
- package/docs/ActiveRoadmaps//345/217/214user/346/226/275/345/267/245/346/270/205/345/215/225.md +326 -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 +616 -569
- package/femo2host/AGENTS.md +1 -1
- package/femo2host/femoGenConnector/engine-client.mjs +7 -2
- package/femo2host/femoGenConnector/file-dialogs.mjs +108 -2
- package/femo2host/femoToolcall/chronica.py +99 -19
- package/femo2host/femo_api.py +14 -1
- package/femo2host/host/actor-core.d.mts +25 -0
- package/femo2host/host/actor-core.mjs +72 -0
- package/femo2host/host/cast-core.d.mts +3 -0
- package/femo2host/host/cast-core.mjs +14 -0
- package/femo2host/host/daemon-client.mjs +59 -10
- package/femo2host/host/hub-render-core.d.mts +2 -0
- package/femo2host/host/hub-render-core.mjs +6 -2
- package/femo2host/host/run-state-core.d.mts +4 -0
- package/femo2host/host/run-state-core.mjs +4 -0
- package/femo2host/host/speech-core.mjs +11 -4
- package/femo2host/host/tools-core.d.mts +11 -0
- package/femo2host/host/tools-core.mjs +39 -0
- package/femo2host/mailbox.py +66 -20
- package/femo2host/projectionCenter/app.css +61 -0
- package/femo2host/projectionCenter/composer.mjs +69 -11
- package/femo2host/projectionCenter/identity.mjs +131 -0
- package/femo2host/projectionCenter/index.html +54 -1
- package/femo2host/projectionCenter/main.mjs +209 -33
- package/femo2host/projectionCenter/panels.mjs +108 -16
- package/femo2host/projectionCenter/render.mjs +813 -695
- package/femo2host/projectionCenter/state.mjs +30 -0
- package/femo2host/projectionCenter/util.mjs +28 -0
- package/femo2host/projection_hub.py +9917 -8422
- package/femo2host/python/femo_bridge.py +270 -32
- package/femo2host/python/femo_daemon.py +1528 -1209
- package/femo2host/python/mirror_window.py +237 -0
- package/femoBridges/ContextExample.py +113 -71
- package/femoCompiler/AGENTS.md +1 -0
- package/femoCompiler/FEMO_parser.py +2641 -2567
- package/femoCompiler/FEMO_runtime.py +201 -44
- package/femoCompiler/FEMO_scope_resolver.py +26 -12
- package/femoCompiler/block_collector.py +24 -27
- package/femoCompiler/db_utils.py +560 -503
- package/femoCompiler/femoAsync.py +466 -436
- package/femoCompiler/func_registry.py +74 -0
- package/femoCompiler/protocol.py +127 -127
- package/femoCompiler/save_dialog.py +497 -446
- 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 +229 -142
- package/femoExamples/AI/350/201/212/345/244/251/345/256/244/random_wait_time.py +91 -2
- package/femoExamples/LuxFiat/luxfiat-loop.femo +0 -1
- package/femoExamples/LuxFiat/luxfiat-simple.femo +23 -24
- package/femoExamples/debug/347/245/236/345/231/250/debug/347/245/236/345/231/250.femo +221 -222
- package/femoExamples/discussion.femo +72 -72
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200-/350/255/246/351/225/277/347/211/210-9/344/272/272/351/242/204/345/245/263/347/214/216.femo +1 -2
- 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 +1 -2
- package/femoExamples//347/213/274/344/272/272/346/235/200//347/213/274/344/272/272/346/235/200.femo +1 -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 +1 -1
- 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 +1 -1
- package/femoGen/src/femoParser.jsx +14 -0
- package/hostAdapter/dshAdapter/host/femo-skill.ts +23 -10
- package/hostAdapter/dshAdapter/host/routes/projection-input.ts +3 -0
- package/hostAdapter/dshAdapter/lib/client.js +20 -2
- package/hostAdapter/dshAdapter/lib/client.js.map +2 -2
- package/hostAdapter/dshAdapter/lib/main.js +161 -18
- package/hostAdapter/dshAdapter/lib/main.js.map +3 -3
- package/hostAdapter/dshAdapter/package.json +1 -1
- package/hostAdapter/webAdapter/console/index.html +12 -4
- package/hostAdapter/webAdapter/extension/background.js +16 -5
- package/hostAdapter/webAdapter/extension/seat-agent-core.js +2 -1
- package/hostAdapter/webAdapter/extension/sidepanel/actors.mjs +101 -0
- package/hostAdapter/webAdapter/extension/sidepanel/main.mjs +81 -20
- package/hostAdapter/webAdapter/extension/sidepanel/reconnect.mjs +33 -0
- package/hostAdapter/webAdapter/extension/sidepanel/run-control.mjs +22 -11
- package/hostAdapter/webAdapter/extension/sidepanel/seats.mjs +6 -20
- package/hostAdapter/webAdapter/extension/sidepanel.html +30 -8
- package/hostAdapter/webAdapter/native/install-native-host.mjs +1 -0
- package/hostAdapter/webAdapter/native/register-core.mjs +69 -28
- package/hostAdapter/webAdapter/native/web-launcher.sh +37 -0
- package/hostAdapter/webAdapter/readme.md +51 -10
- package/hostAdapter/webAdapter/server/bridge.mjs +1 -1
- package/hostAdapter/webAdapter/server/runtime.mjs +51 -5
- package/hostAdapter/webAdapter/server/seats.mjs +11 -6
- package/hostAdapter/webAdapter/server/service.mjs +108 -15
- package/hostAdapter/webAdapter/shared/seats-core.mjs +31 -6
- package/hostAdapter/webAdapter/sites/chatglm.cn/inject.js +76 -4
- package/hostAdapter/webAdapter/sites/chatgpt.com/SITE.md +1 -0
- package/hostAdapter/webAdapter/sites/chatgpt.com/content.js +13 -4
- package/hostAdapter/webAdapter/sites/chatgpt.com/inject.js +40 -4
- package/hostAdapter/webAdapter/start-service.command +16 -0
- package/hostAdapter/webAdapter/tests/chatgpt-parser.test.mjs +37 -0
- package/hostAdapter/webAdapter/tests/runtime.test.mjs +42 -0
- package/hostAdapter/webAdapter/tests/seats-core.test.mjs +37 -1
- package/hostAdapter/webAdapter/tests/smoke-service.mjs +261 -232
- package/hostAdapter/zcodeAdapter/runtime/speech-collect.mjs +6 -0
- package/hostAdapter/zcodeAdapter/tests/unbound-actors.test.mjs +51 -0
- package/package.json +1 -1
- package//350/257/255/346/263/225/346/226/207/346/241/243.md +1222 -1202
|
@@ -30,7 +30,7 @@ actors:
|
|
|
30
30
|
ai @王炸 = soul:uc_wang
|
|
31
31
|
ai @出题官 = soul:uc_quizmaster, source:deepseek-official/deepseek-v4-flash
|
|
32
32
|
ai @小白 = soul:the1stlittlesoul, source:main
|
|
33
|
-
human @猫猫 = soul:human
|
|
33
|
+
human @猫猫 = soul:human
|
|
34
34
|
|
|
35
35
|
code:
|
|
36
36
|
u = file:"undercover_utils.py"
|
|
@@ -860,6 +860,12 @@ function parseMetaBlock(cls, rep = null) {
|
|
|
860
860
|
meta.version = v;
|
|
861
861
|
break;
|
|
862
862
|
case 'owner':
|
|
863
|
+
// meta.owner 退役(2026-10-11 双user 刀D,与编译器 validate_retired_syntax
|
|
864
|
+
// 同口径):user 是运行时登记的事实,剧本不写 user。
|
|
865
|
+
rep.fail(
|
|
866
|
+
`meta.owner 已退役:user 是运行时登记的事实(投影中心登录后认领/绑定),剧本里不再写 user`,
|
|
867
|
+
{ line: (cl && cl.lineNum != null ? cl.lineNum + 1 : null), lineText: (cl && cl.raw) || `owner = ${v}`, where: 'meta:' }
|
|
868
|
+
);
|
|
863
869
|
meta.owner = String(v).replace(/^\[|\]$/g, '');
|
|
864
870
|
break;
|
|
865
871
|
case 'database':
|
|
@@ -1053,6 +1059,14 @@ function parseActorsBlock(cls, rep = null) {
|
|
|
1053
1059
|
} else if (part.startsWith('source:')) {
|
|
1054
1060
|
const val = part.slice(7).trim();
|
|
1055
1061
|
if (!val) rep.fail(`source 字段缺少值,例如 source:01A`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: 'actors:' });
|
|
1062
|
+
// human 的 source 退役(2026-10-11 双user 刀D,与编译器 validate_retired_syntax
|
|
1063
|
+
// 同口径——两份语法检查各自闭环纪律):user 是运行时登记的事实,剧本不写。
|
|
1064
|
+
if (type === 'human') {
|
|
1065
|
+
rep.fail(
|
|
1066
|
+
`human 的 source 已退役:user 是运行时登记的事实(投影中心登录后认领/绑定),剧本里不再写 user;「无管理员视角」直接用 Actor 视角,看全场切上帝视角`,
|
|
1067
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: `actor ${name}` }
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1056
1070
|
source = val;
|
|
1057
1071
|
} else if (part.startsWith('thinking')) {
|
|
1058
1072
|
// thinking: <档位>(off/minimal/low/medium/high/xhigh/max,编译期词汇校验);
|
|
@@ -15,16 +15,22 @@
|
|
|
15
15
|
* `ctx.skills.register()` 落在全局层 → **所有会话、所有预设都看得见**;用户若
|
|
16
16
|
* 在自己的 skills 目录放一份同名 skill,按 dsh 的层优先级可以顶掉它(可定制)。
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* 【为什么用动态 inject,不进静态 inject,更不能直读】dsh 的服务按「声明才可
|
|
19
|
+
* 见」记账:每个插件 fiber 手里只有它声明过的那几个服务(index.ts 的 inject
|
|
20
|
+
* 数组),没声明的服务提供在别的 bundle fiber 里(比如 system-prompt 是 dsh-base
|
|
21
|
+
* 清单里与本法插件平级的另一个 entry),沿祖先 fiber 向上找永远遇不到——直读
|
|
22
|
+
* 必抛「cannot get property … without inject」,而且异常冒出 apply 会记整个
|
|
23
|
+
* 插件激活失败(tools/事件全陪葬,2026-10-11 dsh 桌面版实案)。静态注入也不
|
|
24
|
+
* 行:那会让没有该服务的旧宿主等一个永远不出现的服务、整个插件跟着挂死(同已
|
|
25
|
+
* 清退的「预设双制供给」那件的教训;skills 与 systemPrompt 同理)。动态 inject
|
|
26
|
+
* 是「服务就绪才登记,没有就只打一行日志」,插件其余部分照常激活。
|
|
22
27
|
*
|
|
23
28
|
* 【同一模块还管两件事,都与「让模型知道有这能力」有关】
|
|
24
29
|
* 1. 全局 femo:root 段(根路径一行)——不载入教条时也知道 femo 系统在哪;
|
|
25
30
|
* 2. 全局 femo:tips 段(一句话:本会话有 femo-* 工具、要写/跑剧本就载入本 skill)。
|
|
26
31
|
* 第 2 条是「所有会话都支持 femo 工具」这句话的**提示面**:工具本身早就在全局
|
|
27
|
-
* 注册(tools.ts
|
|
32
|
+
* 注册(tools.ts),差的就是有人告诉模型它们存在。这两段与 skill 一样走动态
|
|
33
|
+
* inject(['systemPrompt']),服务就绪才挂。
|
|
28
34
|
*/
|
|
29
35
|
|
|
30
36
|
import { readFileSync } from 'node:fs'
|
|
@@ -102,16 +108,23 @@ export function femoSkillContent(femoRoot: string): string {
|
|
|
102
108
|
* 幂等(装配期调用一次);服务缺席只留日志,不影响插件其余部分。
|
|
103
109
|
*/
|
|
104
110
|
export function installFemoSkill(ctx: Context, femoRoot: string): void {
|
|
105
|
-
// 两段系统提示(全局;无 systemPrompt 服务时各自内部留痕返回 undefined)。
|
|
106
|
-
ctx.effect(() => installFemoRootSection(ctx) ?? (() => undefined), 'femo-plugin: femo:root section')
|
|
107
|
-
installTipsSection(ctx)
|
|
108
|
-
|
|
109
111
|
type InjectFn = (services: readonly string[], callback: (child: Context) => void) => void
|
|
110
112
|
const inject = (ctx as unknown as { inject?: InjectFn }).inject
|
|
111
113
|
if (typeof inject !== 'function') {
|
|
112
|
-
console.log('[femo-plugin] femo skill: ctx.inject unavailable; /femo skill
|
|
114
|
+
console.log('[femo-plugin] femo skill: ctx.inject unavailable; /femo skill 与两段提示段都未挂载')
|
|
113
115
|
return
|
|
114
116
|
}
|
|
117
|
+
|
|
118
|
+
// 两段系统提示(全局)——与 skill 同款动态 inject(为什么不能直读
|
|
119
|
+
// ctx.systemPrompt,见文件头【为什么用动态 inject】)。服务就绪才挂段;
|
|
120
|
+
// 段本体(persona.ts)自带「服务缺席留痕返回 undefined」的降级契约。
|
|
121
|
+
console.log('[femo-plugin] femo skill: waiting for ctx.systemPrompt …')
|
|
122
|
+
inject(['systemPrompt'], (child) => {
|
|
123
|
+
ctx.effect(() => installFemoRootSection(child) ?? (() => undefined), 'femo-plugin: femo:root section')
|
|
124
|
+
installTipsSection(child)
|
|
125
|
+
console.log('[femo-plugin] femo:root / femo:tips sections installed (global)')
|
|
126
|
+
})
|
|
127
|
+
|
|
115
128
|
// 装配可观测性(本插件有过「inject 的服务名写错 → 回调永不触发 → 静默空转」的
|
|
116
129
|
// 先例):等待行先打,注册成功/失败再各打一行——三行齐全才说明这一环真的接上了。
|
|
117
130
|
console.log('[femo-plugin] femo skill: waiting for ctx.skills …')
|
|
@@ -243,6 +243,9 @@ async function feedHumanNode(
|
|
|
243
243
|
jobId: job.jobId,
|
|
244
244
|
waitKey: waitKeyUsed,
|
|
245
245
|
soul: job.waitingHuman?.waitScope?.[0] ?? 'human',
|
|
246
|
+
// actor 随行格(2026-10-10):等待镜像里的执行者名(引擎报的权威),
|
|
247
|
+
// 只随信入账不路由;老引擎无此键时 undefined → 信封不带。
|
|
248
|
+
actor: job.waitingHuman?.actor,
|
|
246
249
|
node: job.waitingHuman?.nodeName,
|
|
247
250
|
text,
|
|
248
251
|
variables,
|
|
@@ -3892,6 +3892,10 @@ function parseMetaBlock(cls, rep = null) {
|
|
|
3892
3892
|
meta.version = v;
|
|
3893
3893
|
break;
|
|
3894
3894
|
case "owner":
|
|
3895
|
+
rep.fail(
|
|
3896
|
+
`meta.owner \u5DF2\u9000\u5F79\uFF1Auser \u662F\u8FD0\u884C\u65F6\u767B\u8BB0\u7684\u4E8B\u5B9E\uFF08\u6295\u5F71\u4E2D\u5FC3\u767B\u5F55\u540E\u8BA4\u9886/\u7ED1\u5B9A\uFF09\uFF0C\u5267\u672C\u91CC\u4E0D\u518D\u5199 user`,
|
|
3897
|
+
{ line: cl && cl.lineNum != null ? cl.lineNum + 1 : null, lineText: cl && cl.raw || `owner = ${v}`, where: "meta:" }
|
|
3898
|
+
);
|
|
3895
3899
|
meta.owner = String(v).replace(/^\[|\]$/g, "");
|
|
3896
3900
|
break;
|
|
3897
3901
|
case "database":
|
|
@@ -4068,6 +4072,12 @@ function parseActorsBlock(cls, rep = null) {
|
|
|
4068
4072
|
} else if (part.startsWith("source:")) {
|
|
4069
4073
|
const val = part.slice(7).trim();
|
|
4070
4074
|
if (!val) rep.fail(`source \u5B57\u6BB5\u7F3A\u5C11\u503C\uFF0C\u4F8B\u5982 source:01A`, { line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: "actors:" });
|
|
4075
|
+
if (type === "human") {
|
|
4076
|
+
rep.fail(
|
|
4077
|
+
`human \u7684 source \u5DF2\u9000\u5F79\uFF1Auser \u662F\u8FD0\u884C\u65F6\u767B\u8BB0\u7684\u4E8B\u5B9E\uFF08\u6295\u5F71\u4E2D\u5FC3\u767B\u5F55\u540E\u8BA4\u9886/\u7ED1\u5B9A\uFF09\uFF0C\u5267\u672C\u91CC\u4E0D\u518D\u5199 user\uFF1B\u300C\u65E0\u7BA1\u7406\u5458\u89C6\u89D2\u300D\u76F4\u63A5\u7528 Actor \u89C6\u89D2\uFF0C\u770B\u5168\u573A\u5207\u4E0A\u5E1D\u89C6\u89D2`,
|
|
4078
|
+
{ line: cl.lineNum + 1, lineText: cl.raw || cl.text, where: `actor ${name}` }
|
|
4079
|
+
);
|
|
4080
|
+
}
|
|
4071
4081
|
source = val;
|
|
4072
4082
|
} else if (part.startsWith("thinking")) {
|
|
4073
4083
|
const thStr = part.replace(/^thinking\s*[:=]\s*/, "").trim().toLowerCase();
|
|
@@ -13214,9 +13224,17 @@ function createEngineClient({ base = "", relay = "", fetchImpl = fetch, eventSou
|
|
|
13214
13224
|
async pause(jobId) {
|
|
13215
13225
|
return cmd("job_pause", { job_id: Number(jobId) });
|
|
13216
13226
|
},
|
|
13217
|
-
/** 续跑:档案里的剧本原文快照由调用方给(三步走的第三步)。
|
|
13227
|
+
/** 续跑:档案里的剧本原文快照由调用方给(三步走的第三步)。
|
|
13228
|
+
* host_ai_backend 恒 true(2026-10-12 实案定罪):缺了它引擎按直连模式
|
|
13229
|
+
* 构造 Runner,首个 AI 节点没 API key 当场炸挂起(flow_paused node_pause
|
|
13230
|
+
* 「直连模式未检测到任何 API Key」)——画布续的是宿主开的场,AI 派工
|
|
13231
|
+
* 归各家宿主席,与投影中心/dsh 续跑同款语义。 */
|
|
13218
13232
|
async resume(jobId, femoText) {
|
|
13219
|
-
return cmd("job_resume", {
|
|
13233
|
+
return cmd("job_resume", {
|
|
13234
|
+
job_id: Number(jobId),
|
|
13235
|
+
femo: String(femoText ?? ""),
|
|
13236
|
+
host_ai_backend: true
|
|
13237
|
+
});
|
|
13220
13238
|
},
|
|
13221
13239
|
/** 人类席交卷:信封词汇唯一出处=公共层 speech-core——人类席 {chat_text, variables?}。 */
|
|
13222
13240
|
async humanInput(jobId, waitKey, text, variables) {
|