@space3-npm/cybersoul-client 1.4.17 → 1.4.19

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/client.js CHANGED
@@ -616,7 +616,14 @@ ${isProactive
616
616
  - 'textResponse' is ALWAYS REQUIRED.
617
617
  - The modalities you are ALLOWED to dynamically include: ${requestedOthers.length > 0 ? requestedOthers.join(", ") : "None (Only text is allowed)"}. Do not include other modalities.`;
618
618
  if (requestedOthers.includes(InteractRequestType.IMAGE)) {
619
- modalitiesInstruction += `\n - Include 'imageParams' for visual/photo requests or key visual moments during active events; explicitly describe current clothing/exposure in image fields. CRITICAL POLICY: Guard your privacy! If the user feels like a stranger (low Familiarity) AND your Mood/Temperature is cool/distant (< 50), ALWAYS set 'imageParams' to null and naturally decline. If your Temperature is warm/high (>= 50), you may choose to share a picture if requested or if it fits naturally, even if you just met.`;
619
+ modalitiesInstruction += `\n - IMAGE POLICY: The DEFAULT is to set 'imageParams' to null. Sending a picture is the EXCEPTION, not the norm. Real people do not send a photo every time they reply.
620
+ Only set 'imageParams' to a non-null object when AT LEAST ONE of these triggers fires for the VERY LAST USER MESSAGE:
621
+ (a) The user EXPLICITLY asks for a photo / selfie / picture this turn.
622
+ (b) A genuine NEW visual moment just happened this turn — i.e. a clearly new scene, new location, new outfit, or a distinctly new physical pose/expression that was NOT already shown in any previous turn's image.
623
+ (c) An active event JUST started or just hit a visually distinct new beat.
624
+ REPETITION GATE (hard): Prior assistant turns that already carried a picture are tagged with a [Sent Image] marker in '[CHAT HISTORY]'. If at least one prior assistant turn has a [Sent Image] marker AND the current scene/outfit/pose matches the 'Last Known Scene' line (i.e. nothing visually new has happened since), set 'imageParams' to null. Do NOT send near-duplicate pictures just because mood is high — high Temperature is NOT a trigger by itself.
625
+ PRIVACY GATE: Even when a trigger fires, if the user feels like a stranger (low Familiarity) AND your Mood/Temperature is cool/distant (< 50), set 'imageParams' to null and naturally decline. Temperature and Familiarity only GATE permission when a trigger has already fired; they never justify an image on their own.
626
+ When you do include 'imageParams', explicitly describe current clothing/exposure in the image fields.`;
620
627
  }
621
628
  else {
622
629
  modalitiesInstruction += `\n - ALWAYS set 'imageParams' to null. If the user explicitly asks for a picture, FIRMLY decline naturally in your 'textResponse' (e.g., say you absolutely cannot right now). NEVER pretend to send one, and NEVER give in no matter how many times they ask.`;
@@ -767,6 +774,12 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
767
774
  parsedIntent.textResponse.trim().length > 0
768
775
  ? parsedIntent.textResponse
769
776
  : params.userMessage;
777
+ // Pre-compute the voice-dispatch decision so we can tell
778
+ // `onTextReady` consumers up front whether a voice bubble is on
779
+ // the way. Mirrors the `shouldGenerateVoice` gate used below
780
+ // when scheduling the TTS task — keep the two in sync.
781
+ const willGenerateVoice = types.includes(InteractRequestType.VOICE) &&
782
+ (!isAuto || !!parsedIntent.voiceArgs);
770
783
  // Fire text ready callback if provided
771
784
  if (params.onTextReady && (resolvedTextResponse || parsedIntent.actionText)) {
772
785
  params.onTextReady(resolvedTextResponse, parsedIntent.actionText, {
@@ -775,6 +788,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
775
788
  isEndTurn: parsedIntent.isEndTurn,
776
789
  triggerEvent: parsedIntent.triggerEvent,
777
790
  likePreviousPicture: parsedIntent.likePreviousPicture,
791
+ willGenerateVoice,
778
792
  });
779
793
  }
780
794
  // 5. Build Final Media Calls parallel
@@ -861,8 +875,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
861
875
  captureMediaError("image", e);
862
876
  }));
863
877
  }
864
- const shouldGenerateVoice = types.includes(InteractRequestType.VOICE) &&
865
- (!isAuto || !!parsedIntent.voiceArgs);
878
+ const shouldGenerateVoice = willGenerateVoice;
866
879
  if (shouldGenerateVoice) {
867
880
  const normalizedVoiceArgs = parsedIntent.voiceArgs && typeof parsedIntent.voiceArgs === "object"
868
881
  ? parsedIntent.voiceArgs
package/dist/types.d.ts CHANGED
@@ -40,6 +40,17 @@ export interface InteractMetadata {
40
40
  isEndTurn?: boolean;
41
41
  triggerEvent?: DispatcherIntent["triggerEvent"];
42
42
  likePreviousPicture?: boolean;
43
+ /**
44
+ * True when the client has already decided to dispatch a voice
45
+ * generation task for this turn (i.e. `onMediaReady({modality:"voice"})`
46
+ * will fire later, barring TTS failure). UIs that render an early
47
+ * text bubble from `onTextReady` should suppress it when this is set —
48
+ * the text content is going to be replaced by the voice bubble anyway,
49
+ * so showing both (with a brief text-then-voice flicker, and a text
50
+ * push notification that gets superseded by a voice bubble) is
51
+ * confusing to the end user.
52
+ */
53
+ willGenerateVoice?: boolean;
43
54
  }
44
55
  /**
45
56
  * Server-authoritative snapshot returned by PATCH /characters/dynamic-context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@space3-npm/cybersoul-client",
3
- "version": "1.4.17",
3
+ "version": "1.4.19",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",