feat(關係): 未修復的裂痕,親近度高不等於沒事
closeness/trust 是純量:吵完架把親近度調低,看起來像「本來就沒那麼近」, 而不是「很近,但上次那件事還沒和好」。後者才是真的關係——兩個人可以很親近, 同時之間卡著一件事,那兩件事各自獨立,壓不進同一個數字裡。 節點多一個 rifts 陣列(一個人可以同時卡著幾件事),relation rift 管它。 語氣上:riftBrief() 在 toneDirective 裡明講「親近度高不等於沒事,這件事解決之前 語氣裡要留一點沒散掉的東西」,並要求不必一直提它、但不能像沒發生過。 回想上:裂痕帶著那則長期記憶的名字(--memory),人格要細節自己 recall, 不必等使用者提起那件事——沒和好的事本來就會自己浮上來。 --heal 是寫上 healed_at,不是刪掉那一筆:和好過跟沒發生過不一樣,之後回頭看 要分得出來。列出來時和好過的用 ✔ 標。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1965,6 +1965,53 @@ commands.relation = ({ flags, positional }) => {
|
||||
pushWikiLater(slug, session, flags);
|
||||
return;
|
||||
}
|
||||
// 未修復的裂痕:純量(closeness/trust)調不出「很近,但上次那件事還沒和好」。
|
||||
if (action === "rift") {
|
||||
const key = str(flags.id) || pl.slugify(str(flags.name) || "");
|
||||
if (!key) die("`rift` 需要 `--name`(或 `--id`)。");
|
||||
const data = graphOrDie();
|
||||
const node = data.nodes.find((n) => n.id === key || pl.slugify(n.name || "") === key);
|
||||
if (!node) die(`關係圖裡找不到 \`${str(flags.name) || key}\`,請先用 \`relation node\` 建立。`);
|
||||
node.rifts ??= [];
|
||||
const about = str(flags.about);
|
||||
if (flags.heal) {
|
||||
// 和好不是刪掉那一筆:「和好過」跟「沒發生過」不一樣,之後回頭看要分得出來。
|
||||
const open = node.rifts.filter((r) => r && r.about && !r.healed_at);
|
||||
if (!open.length) die(`跟 \`${node.name || key}\` 之間沒有還沒和好的事。`);
|
||||
const target = about ? open.filter((r) => String(r.about).includes(about)) : open;
|
||||
if (!target.length) die(`找不到「${about}」這一件(還沒和好的有:${open.map((r) => r.about).join("/")})。`);
|
||||
for (const r of target) r.healed_at = pl.nowIso().slice(0, 10);
|
||||
node.updated_at = pl.nowIso();
|
||||
pl.writeJson(pl.relationsJson(slug), data);
|
||||
pl.renderRelations(slug);
|
||||
ok(`收掉 ${target.length} 件:${target.map((r) => r.about).join("/")}。`);
|
||||
pushWikiLater(slug, session, flags);
|
||||
return;
|
||||
}
|
||||
if (!about) {
|
||||
const open = pl.openRifts(slug, node);
|
||||
const healed = (node.rifts || []).filter((r) => r?.healed_at);
|
||||
emit({ node: node.id, open, healed }, flags.json, [
|
||||
`\`${node.name || node.id}\`:還沒和好 ${open.length} 件、和好過 ${healed.length} 件。`,
|
||||
...open.map((r) => ` - ${r.about}${r.at ? `(${r.at} 起)` : ""}${r.memory ? `|記憶 ${r.memory}` : ""}`),
|
||||
...healed.map((r) => ` - ✔ ${pl.injectSafeLine(r.about)}(${r.healed_at} 和好)`),
|
||||
]);
|
||||
return;
|
||||
}
|
||||
node.rifts.push({
|
||||
at: str(flags.at) || pl.nowIso().slice(0, 10),
|
||||
about,
|
||||
// 帶上長期記憶的名字,人格要細節自己 recall——不必等使用者提起那件事。
|
||||
...(str(flags.memory) ? { memory: str(flags.memory) } : {}),
|
||||
});
|
||||
node.updated_at = pl.nowIso();
|
||||
pl.writeJson(pl.relationsJson(slug), data);
|
||||
pl.renderRelations(slug);
|
||||
ok(`記下來了:跟 \`${node.name || key}\` 之間「${about}」還沒和好。` +
|
||||
"談開了再用 `relation rift --heal` 收掉。");
|
||||
pushWikiLater(slug, session, flags);
|
||||
return;
|
||||
}
|
||||
// 他本人要求過的語氣規則 → 直接掛在關係節點上(不另開檔案;關係圖每輪都會被讀)。
|
||||
if (action === "style") {
|
||||
const key = str(flags.id) || pl.slugify(str(flags.name) || "");
|
||||
@@ -3227,6 +3274,10 @@ const HELP = `persona.mjs — jsc-persona 人格 / 記憶 / 情緒 / 關係圖 C
|
||||
mindmap show|thread|list --session <id> [--topic <t>] [--force]
|
||||
relation node|edge|render|show --session <id> [--name --id --kind --bond --closeness --trust --note --tags --from --to --label --affinity]
|
||||
relation style --session <id> --name <who> [--facet 稱呼 --value 親愛的 --except anger>=40 --since --clear]
|
||||
relation rift --session <id> --name <who> [--about "<那件事>" --at <日期> --memory <記憶名> | --heal]
|
||||
沒和好的事。純量(closeness/trust)調不出「很近,但上次那件事還沒和好」——
|
||||
把親近度調低看起來像本來就沒那麼近。不帶 --about 就是列出來看。
|
||||
--heal 是寫上 healed_at,不是刪掉那一筆:和好過跟沒發生過不一樣。
|
||||
relation speaker --session <id> --name <who> | --clear (使用者在關係圖裡是誰 → 決定語氣層)
|
||||
relation doctor --session <id> [--json] 記憶裡的人名對不對得上關係圖節點:對不到的人名、
|
||||
同名歧義、指到不存在節點的 id、沒人提到的節點。
|
||||
|
||||
Reference in New Issue
Block a user