femo-plugin 1.0.4 → 1.0.6
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/LICENSE +1 -1
- package/NOTICE +8 -0
- package/README.md +12 -1
- 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 +630 -545
- package/femo2host/projectionCenter/app.css +61 -0
- package/femo2host/projectionCenter/composer.mjs +233 -20
- package/femo2host/projectionCenter/identity.mjs +131 -0
- package/femo2host/projectionCenter/index.html +55 -1
- package/femo2host/projectionCenter/main.mjs +231 -35
- 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 +1796 -230
- package/femo2host/python/femo_bridge.py +303 -33
- 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 +217 -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/document_ch.html +1 -0
- package/femoGen/document_en.html +1 -0
- package/femoGen/index.html +1 -0
- package/femoGen/intro_ch.html +1 -0
- package/femoGen/intro_en.html +1 -0
- package/femoGen/package.json +7 -0
- package/femoGen/public/femo-logo-slogan.svg +5 -0
- package/femoGen/public/femo-logo.svg +6 -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 +11 -1
- package/hostAdapter/webAdapter/console/index.html +13 -4
- package/hostAdapter/webAdapter/extension/background.js +16 -5
- package/hostAdapter/webAdapter/extension/seat-agent-core.js +836 -791
- 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 +31 -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/package.json +7 -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/chat.deepseek.com/SITE.md +7 -0
- package/hostAdapter/webAdapter/sites/chat.deepseek.com/content.js +83 -68
- package/hostAdapter/webAdapter/sites/chatglm.cn/inject.js +76 -4
- package/hostAdapter/webAdapter/sites/chatgpt.com/SITE.md +7 -1
- package/hostAdapter/webAdapter/sites/chatgpt.com/content.js +37 -5
- package/hostAdapter/webAdapter/sites/chatgpt.com/inject.js +40 -4
- package/hostAdapter/webAdapter/start-service.command +16 -0
- package/hostAdapter/webAdapter/tests/chatgpt-input.test.mjs +58 -0
- package/hostAdapter/webAdapter/tests/chatgpt-parser.test.mjs +37 -0
- package/hostAdapter/webAdapter/tests/deepseek-sanitize.test.mjs +68 -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/skills/femo/SKILL.md +3 -0
- package/hostAdapter/zcodeAdapter/tests/unbound-actors.test.mjs +51 -0
- package/package.json +7 -1
- package//350/257/255/346/263/225/346/226/207/346/241/243.md +1224 -1202
|
@@ -2,6 +2,8 @@ export type MirrorState = 'running' | 'suspended' | 'finished' | 'failed'
|
|
|
2
2
|
export interface WaitingHumanLike {
|
|
3
3
|
waitKey: string
|
|
4
4
|
nodeName?: string
|
|
5
|
+
/** 2026-10-10 actor 随行格:引擎报的执行者显示名(可选,交卷透传用)。 */
|
|
6
|
+
actor?: string
|
|
5
7
|
context?: string
|
|
6
8
|
memory?: string
|
|
7
9
|
showprompt?: string
|
|
@@ -46,6 +48,8 @@ export declare function noteNodeShowprompt(mirror: JobMirrorLike, nodeName: stri
|
|
|
46
48
|
export interface WaitingHumanSnapshot {
|
|
47
49
|
waitKey: string
|
|
48
50
|
nodeName?: string
|
|
51
|
+
/** 2026-10-10 actor 随行格:老引擎事件无此键时 undefined。 */
|
|
52
|
+
actor?: string
|
|
49
53
|
context: string
|
|
50
54
|
memory: string
|
|
51
55
|
showprompt?: string
|
|
@@ -136,6 +136,10 @@ export function waitingHumanFromEvent(d) {
|
|
|
136
136
|
return {
|
|
137
137
|
waitKey: String(d.wait_key ?? ''),
|
|
138
138
|
nodeName: typeof d.node_name === 'string' ? d.node_name : undefined,
|
|
139
|
+
// actor(2026-10-10 随行格):引擎报的执行者显示名,原样随行;交卷时
|
|
140
|
+
// 透传 post_speech 信封(mailbox.actor 只入账不路由)。老引擎无此键时
|
|
141
|
+
// 为 undefined,交卷侧自然不填。
|
|
142
|
+
actor: typeof d.actor_name === 'string' && d.actor_name ? d.actor_name : undefined,
|
|
139
143
|
context: typeof d.context === 'string' ? d.context : '',
|
|
140
144
|
memory: typeof d.memory === 'string' ? d.memory : '',
|
|
141
145
|
showprompt: typeof d.showprompt === 'string' ? d.showprompt : undefined,
|
|
@@ -34,25 +34,30 @@ export function lastStepReply(steps) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/** 人类席交卷信封(post_speech 参数)。soul 缺省 'human';dsh 传等待 scope
|
|
37
|
-
* 首选、投影页传引擎报的执行者名——soul 只进驿站账本,引擎路由只认 ref。
|
|
38
|
-
|
|
37
|
+
* 首选、投影页传引擎报的执行者名——soul 只进驿站账本,引擎路由只认 ref。
|
|
38
|
+
* actor(2026-10-10 随行格):剧本角色名,可选;只随信入账不路由(mailbox
|
|
39
|
+
* 头注旁注),不带则信封无此格——老调用方零改动。 */
|
|
40
|
+
export function humanSpeechArgs({ jobId, waitKey, soul, node, text, variables = {}, actor }) {
|
|
39
41
|
const cleanVars = {}
|
|
40
42
|
for (const [k, v] of Object.entries(variables ?? {})) {
|
|
41
43
|
if (typeof v === 'string' && v.trim().length > 0) cleanVars[k] = v.trim()
|
|
42
44
|
}
|
|
45
|
+
const actorClean = String(actor ?? '').trim()
|
|
43
46
|
return {
|
|
44
47
|
job_id: jobId,
|
|
45
48
|
wait_key: waitKey,
|
|
46
49
|
soul: soul || 'human',
|
|
47
50
|
...(node ? { node } : {}),
|
|
51
|
+
...(actorClean ? { actor: actorClean } : {}),
|
|
48
52
|
payload: text,
|
|
49
53
|
body: { chat_text: text, ...(Object.keys(cleanVars).length > 0 ? { variables: cleanVars } : {}) },
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
/** 执行体(主Agent/AI 角色)交卷信封(post_speech 参数)。output 参数=台词
|
|
54
|
-
* 文本(构造时合并进末步 reply,信封上不再有 output 字段);steps 可不给。
|
|
55
|
-
|
|
58
|
+
* 文本(构造时合并进末步 reply,信封上不再有 output 字段);steps 可不给。
|
|
59
|
+
* actor(2026-10-10 随行格):可选,剧本角色名;不带则信封无此格。 */
|
|
60
|
+
export function executorSpeechArgs({ jobId, waitKey, soul = 'main', node, output, steps, modelId, actor }) {
|
|
56
61
|
const merged = (Array.isArray(steps) ? steps : [])
|
|
57
62
|
.map(s => (s && typeof s === 'object' ? { ...s } : { reply: String(s ?? '') }))
|
|
58
63
|
if (merged.length > 0) {
|
|
@@ -61,11 +66,13 @@ export function executorSpeechArgs({ jobId, waitKey, soul = 'main', node, output
|
|
|
61
66
|
} else {
|
|
62
67
|
merged.push({ step: 0, reply: output })
|
|
63
68
|
}
|
|
69
|
+
const actorClean = String(actor ?? '').trim()
|
|
64
70
|
return {
|
|
65
71
|
job_id: jobId,
|
|
66
72
|
wait_key: waitKey,
|
|
67
73
|
soul,
|
|
68
74
|
...(node ? { node } : {}),
|
|
75
|
+
...(actorClean ? { actor: actorClean } : {}),
|
|
69
76
|
payload: output,
|
|
70
77
|
body: {
|
|
71
78
|
steps: merged,
|
|
@@ -26,6 +26,17 @@ export declare function normalizeChronicaOpts(args: Record<string, unknown>): {
|
|
|
26
26
|
export declare function chronicaCliArgs(opts: { show?: number; list?: number; scope?: boolean; full?: boolean }): string[]
|
|
27
27
|
export declare function validateSoulCreate(args: Record<string, unknown>): string | null
|
|
28
28
|
|
|
29
|
+
/** 剧本演员表解析(actors 区全量,actor 带 @ 全名;见 tools-core.mjs)。 */
|
|
30
|
+
export interface ScriptActorEntry {
|
|
31
|
+
actor: string
|
|
32
|
+
kind: 'ai' | 'human'
|
|
33
|
+
}
|
|
34
|
+
export declare function scriptActors(femoText: unknown): ScriptActorEntry[]
|
|
35
|
+
export declare function actorBindingDeltas(actors: ScriptActorEntry[], boundActorNames: unknown): {
|
|
36
|
+
errors: string[]
|
|
37
|
+
warnings: string[]
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
/** 挂载状态(运行时内一份)。 */
|
|
30
41
|
export interface MountState {
|
|
31
42
|
get(): { femoText: string; scriptPath?: string; baseDir?: string; scriptName: string } | undefined
|
|
@@ -272,6 +272,45 @@ export function unboundActorSouls(femoText, nominatedSouls) {
|
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
/** 剧本演员表·全量版(2026-10-10 演员绑定账 accompanying 解析):提取 actors 区
|
|
276
|
+
* 全部角色 [{actor, kind}]——actor 带 @ 全名(@ 是名字的一部分,语法文档铁律
|
|
277
|
+
* 「代码中任何地方不得去掉」),kind=声明类型 'ai'|'human'(blueprint 蓝图角色
|
|
278
|
+
* 尚未实现、不收)。与 scriptActorSouls 是两把尺:那把服务「绑定窗口出演」
|
|
279
|
+
* (只收 ai、按 soul 对账),这把服务「演员绑定账」(ai/human 都记,账键=
|
|
280
|
+
* @全名)。source:main 是导演亲自出演,也算一个角色(他的戏份也要有人接——
|
|
281
|
+
* 演员绑定按戏内角色对账,不分谁演)。纯函数:femoText → 名单,方便单测。 */
|
|
282
|
+
export function scriptActors(femoText) {
|
|
283
|
+
const out = [];
|
|
284
|
+
let inActors = false;
|
|
285
|
+
for (const line of String(femoText ?? '').split(/\r?\n/)) {
|
|
286
|
+
if (/^\s*(meta|actors|vars|code|mainflow|module|action)\s*:/.test(line) || /^action\s/.test(line)) {
|
|
287
|
+
inActors = /^\s*actors\s*:/.test(line);
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (!inActors) continue;
|
|
291
|
+
const decl = line.match(/^\s*(ai|human)\s+@(\S+?)\s*=/);
|
|
292
|
+
if (!decl) continue;
|
|
293
|
+
out.push({ actor: `@${decl[2]}`, kind: decl[1] });
|
|
294
|
+
}
|
|
295
|
+
return out;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** 演员绑定点名(web 宿主 /seats/attendance 用,2026-10-10):已挂载剧本的演员
|
|
299
|
+
* 逐个 × 演员绑定账——
|
|
300
|
+
* · 账里绑了剧本里没有的演员 = 多绑(绑错名字),每条一句报错(error);
|
|
301
|
+
* · 剧本要的演员账里没有 = 少绑,每条一句提醒(warning——不拦运行);
|
|
302
|
+
* 返回 {errors, warnings} 两个字符串数组。纯函数:演员表 + 已绑演员全名数组
|
|
303
|
+
* → 两桶,方便单测。 */
|
|
304
|
+
export function actorBindingDeltas(actors, boundActorNames) {
|
|
305
|
+
const bound = new Set((boundActorNames ?? []).map(n => String(n)));
|
|
306
|
+
const declared = new Set((actors ?? []).map(a => a.actor));
|
|
307
|
+
const errors = (boundActorNames ?? []).map(String).filter(n => n && !declared.has(n))
|
|
308
|
+
.map(n => `绑定的演员 ${n} 不在剧本演员表里——检查名字(演员名带 @,照剧本里写的那样)`);
|
|
309
|
+
const warnings = (actors ?? []).map(a => a.actor).filter(n => !bound.has(n))
|
|
310
|
+
.map(n => `演员 ${n} 还没绑定——轮到它时按缺员处置`);
|
|
311
|
+
return { errors, warnings };
|
|
312
|
+
}
|
|
313
|
+
|
|
275
314
|
// ── 直连桥形态的完整执行体(zcode 用;dsh 的会话型执行体自备)────────
|
|
276
315
|
|
|
277
316
|
/**
|