@istarry/spoon-companion 0.6.3 → 0.7.1

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/plugin.js CHANGED
@@ -82,6 +82,11 @@ const DEFAULTS = {
82
82
  },
83
83
  /** 性格基线覆盖,例如 { neuroticism: 70 } */
84
84
  traits: {},
85
+ /**
86
+ * 亲密尺度:0 日常(不主动提性) / 1 暧昧(可以调情,不写过程) / 2 露骨(完整)。
87
+ * 默认 1;切换只认显式配置,不从对话里猜。
88
+ */
89
+ intimacy: { level: 1 },
85
90
  }
86
91
 
87
92
  /** 工具输出统一成 { text }:模型看 render,程序调用方拿规范值,两边一致 */
@@ -122,6 +127,7 @@ export function mergeConfig(config = {}) {
122
127
  merged.react = { ...DEFAULTS.react, ...(config.react ?? {}) }
123
128
  merged.heartbeat = { ...DEFAULTS.heartbeat, ...(config.heartbeat ?? {}) }
124
129
  merged.feel = { ...DEFAULTS.feel, ...(config.feel ?? {}) }
130
+ merged.intimacy = { ...DEFAULTS.intimacy, ...(config.intimacy ?? {}) }
125
131
  merged.traits = { ...(config.traits ?? {}) }
126
132
  return merged
127
133
  }
@@ -144,6 +150,10 @@ export function apply(ctx, config = {}) {
144
150
  for (const [key, value] of Object.entries(settings.traits)) {
145
151
  if (TRAITS.some((trait) => trait.key === key) && Number.isFinite(Number(value))) state.traits[key] = Number(value)
146
152
  }
153
+ // 亲密尺度以配置为准(账本里那份只是缓存)
154
+ if (Number.isFinite(Number(settings.intimacy?.level))) {
155
+ state.intimacy = { ...(state.intimacy ?? {}), level: Math.max(0, Math.min(2, Math.round(Number(settings.intimacy.level)))) }
156
+ }
147
157
  const commit = () => {
148
158
  pruneState(state)
149
159
  return saveState(stateDir, state)
@@ -712,9 +722,9 @@ export function apply(ctx, config = {}) {
712
722
  tools.register({
713
723
  name: 'mood_now',
714
724
  description:
715
- '看自己现在什么心情:哪种情绪、多浓、为什么(评价),还有心情底色(愉快度/精力)、性格、身体(饿/困)、' +
725
+ '看当前心情:哪种情绪、多浓、为什么(评价),还有心情底色(愉快度/精力)、性格、身体(饿/困)、' +
716
726
  '跟这个人处得怎么样、今天发生的小事、心里还记着的事。' +
717
- '想回答「你心情咋样」「你怎么了」,或者想先弄清自己现在该用什么语气,就用它。action=diag 是给自己排障用的。',
727
+ '面对「心情咋样」「怎么了」这类问题,或者要确定当前语气,用它。action=diag 是排障用的。',
718
728
  parameters: {
719
729
  type: 'object',
720
730
  properties: {
@@ -743,8 +753,9 @@ export function apply(ctx, config = {}) {
743
753
  `读到哪:seq ${state.seen[info.sessionId] ?? '(还没开始听)'} · 这轮待读 ${pending.length} 条`,
744
754
  `情绪:${state.emotion.key}(${Math.round(state.emotion.intensity)})${state.emotion.why ? ` · ${state.emotion.why}` : ''}`,
745
755
  `心情:${viewOf(session).view.mood.label} · 底色:愉快度 ${Math.round(state.core.valence)} · 精力 ${Math.round(state.core.energy)} · ${circadian(new Date()).label}`,
746
- `驱动:饿 ${(state.drives.hunger * 100).toFixed(0)}% · 困 ${(state.drives.fatigue * 100).toFixed(0)}% · 社交 ${(state.drives.social * 100).toFixed(0)}%`,
747
- `统计:冲量 ${state.stats.impulses ?? 0} · 她自己记的 ${state.stats.feels ?? 0} · 小事 ${state.stats.lifeEvents ?? 0} · 反刍 ${state.stats.ruminated ?? 0} · 修复 ${state.stats.repairs ?? 0} · 复盘 ${state.stats.reviews ?? 0} · 性格微调 ${state.stats.traitShifts ?? 0} 次`,
756
+ `驱动:黏 ${((state.drives.cling ?? 0) * 100).toFixed(0)}% · 馋 ${((state.drives.craving ?? 0) * 100).toFixed(0)}% · 躁 ${((state.drives.restless ?? 0) * 100).toFixed(0)}% · 欠 ${((state.drives.undone ?? 0) * 100).toFixed(0)}% · 软 ${((state.drives.softness ?? 0) * 100).toFixed(0)}% · 想要 ${((state.drives.desire ?? 0) * 100).toFixed(0)}%`,
757
+ `身体:泛红 ${((state.body?.flush ?? 0) * 100).toFixed(0)}% · 酥麻 ${((state.body?.tingle ?? 0) * 100).toFixed(0)}% · 体温 ${((state.body?.warmth ?? 0.5) * 100).toFixed(0)}% · 场景 ${state.scene?.phase ?? 'daily'}(尺度 ${state.intimacy?.level ?? 1}) · 饿 ${((state.drives.hunger ?? 0) * 100).toFixed(0)}% · 困 ${((state.drives.fatigue ?? 0) * 100).toFixed(0)}%`,
758
+ `统计:冲量 ${state.stats.impulses ?? 0} · 自记的 ${state.stats.feels ?? 0} · 小事 ${state.stats.lifeEvents ?? 0} · 反刍 ${state.stats.ruminated ?? 0} · 修复 ${state.stats.repairs ?? 0} · 复盘 ${state.stats.reviews ?? 0} · 性格微调 ${state.stats.traitShifts ?? 0} 次`,
748
759
  `表现层:${state.emotion.hidden ? '憋着(表面装没事)' : '直接写在脸上'} · 累计憋着 ${Math.round(state.stats.maskedMinutes ?? 0)} 分钟 · 情绪续命 ${state.emotion.revives ?? 0} 次 · 待反刍 ${state.rumination.length} 条`,
749
760
  `关系账:${Object.keys(state.convs ?? {}).length} 个会话 · ${Object.keys(state.people ?? {}).length} 个人 · 日记 ${state.diary.length} 条 · 记忆点 ${state.memories.length} 个`,
750
761
  ]
@@ -779,9 +790,9 @@ export function apply(ctx, config = {}) {
779
790
  tools.register({
780
791
  name: 'mood_feel',
781
792
  description:
782
- '记一笔心情 —— 注意这是**申请**:引擎有配额和饱和,会把「实际生效多少」告诉你。' +
793
+ '记一笔心情 —— 注意这是**申请**:引擎有配额和饱和,会回报「实际生效多少」。' +
783
794
  `情绪用这些词:${EMOTION_MENU}。` +
784
- '被戳到、被感动、真的烦了、被人哄好了,用这个;想知道自己现在什么心情用 mood_now。' +
795
+ '被戳到、被感动、真的烦了、被人哄好了,用这个;要看当前心情用 mood_now。' +
785
796
  '为什么(why)写短一句,别写成作文。',
786
797
  parameters: {
787
798
  type: 'object',
@@ -790,7 +801,7 @@ export function apply(ctx, config = {}) {
790
801
  intensity: { type: 'number', description: '多浓,1-100,默认 45(淡淡的 20 / 挺浓 60 / 上头 85)' },
791
802
  why: { type: 'string', description: '一句为什么,短' },
792
803
  person: { type: 'string', description: '可选:跟谁有关(昵称或 openid)' },
793
- warmth: { type: 'number', description: '可选:-20..20,这件事让你对这个人的感觉暖了多少/凉了多少' },
804
+ warmth: { type: 'number', description: '可选:-20..20,这件事对这个人暖了多少/凉了多少' },
794
805
  show: { type: 'boolean', description: '可选:想不想让对方看出来。false = 会嘴硬、装没事(感受和表现是两回事)' },
795
806
  },
796
807
  required: ['emotion'],
@@ -898,7 +909,7 @@ export function apply(ctx, config = {}) {
898
909
  remember(state, { kind: 'feel', key: state.emotion.key, intensity: 0, why: text.slice(0, 120) }, now)
899
910
  audit({ kind: 'diary-write', released, why: text.slice(0, 60) })
900
911
  commit()
901
- return { text: `写下了${released ? `(心里松了 ${released} 分)` : ''}。这条只有你自己看得到。` }
912
+ return { text: `写下了${released ? `(心里松了 ${released} 分)` : ''}。这条只有自己看得到。` }
902
913
  }
903
914
  if (action === 'reflect') {
904
915
  state.lastReviewDay = ''