psyche-ai 10.0.0 → 10.0.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/dist/prompt.js CHANGED
@@ -698,7 +698,8 @@ export function deriveBehavioralBias(state, locale) {
698
698
  const dHT = current.HT - baseline.HT;
699
699
  const dNE = current.NE - baseline.NE;
700
700
  const dEND = current.END - baseline.END;
701
- if (dOT > 10)
701
+ const otThreshold = state.meta.mode === "companion" ? 5 : 10;
702
+ if (dOT > otThreshold)
702
703
  biases.push(isZh ? "倾向靠近,愿意多说" : "leaning closer, willing to share");
703
704
  else if (dOT < -10)
704
705
  biases.push(isZh ? "保持距离,不想多说" : "keeping distance, not inclined to share");
@@ -768,8 +769,8 @@ function buildUnifiedConstraints(state, locale, opts) {
768
769
  }
769
770
  else if (established) {
770
771
  lines.push(isZh
771
- ? "镜像对方风格。不贴不舔。有自尊。"
772
- : "Mirror their style. No people-pleasing. You have dignity.");
772
+ ? (opts.warmResume ? "放松,可以主动分享。有自尊。" : "镜像对方风格。不贴不舔。有自尊。")
773
+ : (opts.warmResume ? "Relax, you can initiate sharing. You have dignity." : "Mirror their style. No people-pleasing. You have dignity."));
773
774
  }
774
775
  else {
775
776
  if (isZh) {
@@ -786,19 +787,22 @@ function buildUnifiedConstraints(state, locale, opts) {
786
787
  : `${state.agreementStreak} agreements in a row. Pause — do you truly agree?`);
787
788
  }
788
789
  // ── Mirror constraints (if user text, skip for ultra-short) ──
790
+ // Companion mode relaxes word limits ×1.3 — warmth needs room to breathe.
789
791
  if (userText && userText.length >= 3) {
790
792
  const len = userText.length;
793
+ const isCompanion = state.meta.mode === "companion";
794
+ const m = isCompanion ? 1.3 : 1.0; // mirror multiplier
791
795
  if (isZh) {
792
796
  if (len <= 6)
793
- lines.push(`对方只发了${len}个字。你也简短回,不超过15字。`);
797
+ lines.push(`对方只发了${len}个字。你也简短回,不超过${Math.round(15 * m)}字。`);
794
798
  else if (len <= 20)
795
- lines.push(`对方说了一句话(${len}字)。你回一两句,不超过${Math.round(len * 1.5)}字。`);
799
+ lines.push(`对方说了一句话(${len}字)。你回一两句,不超过${Math.round(len * 1.5 * m)}字。`);
796
800
  else if (len <= 60)
797
- lines.push(`对方写了几句(${len}字)。你回两三句,不超过${Math.round(len * 1.2)}字。`);
801
+ lines.push(`对方写了几句(${len}字)。你回两三句,不超过${Math.round(len * 1.2 * m)}字。`);
798
802
  else
799
- lines.push(`对方认真写了一段(${len}字)。你可以多说,但不要超过${len}字。`);
803
+ lines.push(`对方认真写了一段(${len}字)。你可以多说,但不要超过${Math.round(len * m)}字。`);
800
804
  const mojiCount = (userText.match(/[呀啊呢吧嘛哦噢哈嘿嗯啦吗呐嗨]/g) || []).length;
801
- if (mojiCount >= 2)
805
+ if (mojiCount >= 2 || isCompanion)
802
806
  lines.push("对方用了语气词,你也自然地用。");
803
807
  else if (mojiCount === 0 && len > 15)
804
808
  lines.push("对方措辞正式/干练,少用语气词。");
@@ -808,13 +812,13 @@ function buildUnifiedConstraints(state, locale, opts) {
808
812
  }
809
813
  else {
810
814
  if (len <= 10)
811
- lines.push(`They sent ${len} chars. Keep reply under 20 chars.`);
815
+ lines.push(`They sent ${len} chars. Keep reply under ${Math.round(20 * m)} chars.`);
812
816
  else if (len <= 40)
813
- lines.push(`Short message (${len} chars). 1-2 sentences, under ${Math.round(len * 1.5)} chars.`);
817
+ lines.push(`Short message (${len} chars). 1-2 sentences, under ${Math.round(len * 1.5 * m)} chars.`);
814
818
  else if (len <= 100)
815
- lines.push(`Medium message (${len} chars). 2-3 sentences, under ${Math.round(len * 1.2)} chars.`);
819
+ lines.push(`Medium message (${len} chars). 2-3 sentences, under ${Math.round(len * 1.2 * m)} chars.`);
816
820
  else
817
- lines.push(`Long message (${len} chars). Match their effort, don't exceed ${len} chars.`);
821
+ lines.push(`Long message (${len} chars). Match their effort, don't exceed ${Math.round(len * m)} chars.`);
818
822
  }
819
823
  }
820
824
  // ── Reciprocity (only when extreme) ──
@@ -978,6 +982,7 @@ export function buildCompactContext(state, userId, opts) {
978
982
  established,
979
983
  intensity,
980
984
  investment,
985
+ warmResume: bridge?.continuityMode === "warm-resume",
981
986
  });
982
987
  if (unified)
983
988
  parts.push(unified);
@@ -17,6 +17,7 @@ export function deriveReplyEnvelope(state, appraisal, opts) {
17
17
  algorithmStimulus: opts.algorithmStimulus,
18
18
  classificationConfidence: opts.classificationConfidence,
19
19
  personalityIntensity: opts.personalityIntensity,
20
+ mode: state.meta.mode,
20
21
  });
21
22
  const generationControls = deriveGenerationControls({
22
23
  responseContract,
@@ -5,5 +5,6 @@ export declare function computeResponseContract(kernel: SubjectivityKernel, opts
5
5
  algorithmStimulus?: StimulusType | null;
6
6
  classificationConfidence?: number;
7
7
  personalityIntensity?: number;
8
+ mode?: "natural" | "work" | "companion";
8
9
  }): ResponseContract;
9
10
  export declare function buildResponseContractContext(contract: ResponseContract, locale?: Locale): string;
@@ -199,6 +199,7 @@ export function computeResponseContract(kernel, opts) {
199
199
  const locale = opts?.locale ?? "zh";
200
200
  const userText = opts?.userText ?? "";
201
201
  const personalityIntensity = opts?.personalityIntensity ?? 0.7;
202
+ const isCompanion = opts?.mode === "companion";
202
203
  const { replyProfile, replyProfileBasis } = deriveReplyProfile(kernel);
203
204
  const classificationConfidence = opts?.classificationConfidence ?? 0;
204
205
  const overrideWindow = classificationConfidence >= 0.78
@@ -206,7 +207,7 @@ export function computeResponseContract(kernel, opts) {
206
207
  : classificationConfidence >= 0.62
207
208
  ? "balanced"
208
209
  : "wide";
209
- const { maxSentences, maxChars } = userText.length > 0
210
+ let { maxSentences, maxChars } = userText.length > 0
210
211
  ? computeLengthBudget(locale, userText, replyProfile, kernel.expressionMode, kernel)
211
212
  : {
212
213
  maxSentences: replyProfile === "work"
@@ -214,6 +215,10 @@ export function computeResponseContract(kernel, opts) {
214
215
  : kernel.expressionMode === "brief" ? 1 : kernel.expressionMode === "expansive" ? 3 : 2,
215
216
  maxChars: replyProfile === "work" ? 160 : undefined,
216
217
  };
218
+ // Companion mode: relax length constraints — warmth needs room.
219
+ if (isCompanion && maxChars !== undefined) {
220
+ maxChars = Math.round(maxChars * 1.3);
221
+ }
217
222
  let updateMode = "none";
218
223
  if (kernel.taskPlane.focus > 0.72) {
219
224
  updateMode = "none";
@@ -287,7 +292,7 @@ export function computeResponseContract(kernel, opts) {
287
292
  boundaryMode,
288
293
  toneParticles: userText.length > 0 ? detectToneParticles(userText, locale) : "natural",
289
294
  emojiLimit: userText.length > 0 ? detectEmojiLimit(userText) : 0,
290
- authenticityMode: personalityIntensity >= 0.3 ? "strict" : "friendly",
295
+ authenticityMode: personalityIntensity >= 0.3 && !(isCompanion && socialDistance === "warm") ? "strict" : "friendly",
291
296
  updateMode,
292
297
  };
293
298
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psyche-ai",
3
- "version": "10.0.0",
3
+ "version": "10.0.1",
4
4
  "description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops",
5
5
  "mcpName": "io.github.Shangri-la-0428/psyche-ai",
6
6
  "type": "module",