@space3-npm/cybersoul-client 1.4.28 → 1.4.29
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.d.ts +8 -0
- package/dist/client.js +22 -1
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -59,6 +59,14 @@ export declare class CyberSoulClient {
|
|
|
59
59
|
* If the payload is already the inner args object (no voiceArgs wrapper), uses it as-is.
|
|
60
60
|
*/
|
|
61
61
|
private extractVoiceArgsFromLlmResponse;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the platform-wide compliance boundary directive string sourced
|
|
64
|
+
* from the backend character state (PromptSegment key="COMPLIANCE_RULE").
|
|
65
|
+
* Empty string when absent/disabled → callers must skip injection so there
|
|
66
|
+
* is no token cost or behavior change for characters without a rule.
|
|
67
|
+
* Mirrors the backend→state→prompt flow used for voice directives.
|
|
68
|
+
*/
|
|
69
|
+
private getComplianceDirective;
|
|
62
70
|
/**
|
|
63
71
|
* Strip content the TTS engine can't speak naturally:
|
|
64
72
|
* - Stage-direction wrappers like (smiles), (挑眉), [pauses], 【动作】, *grins*
|
package/dist/client.js
CHANGED
|
@@ -415,7 +415,17 @@ Temperature (Mood): ${temperature}/100 (0=Angry/Cold, 50=Normal, 100=Passionate)
|
|
|
415
415
|
Addressing: You call them '${dyn.userNickname || "User"}'. They call you '${dyn.agentNickname || "Agent"}'.
|
|
416
416
|
Current Mood Constraint: ${dyn.talkingStyle || "Normal"}`);
|
|
417
417
|
const scenarioContext = contextParts.join("\n");
|
|
418
|
-
|
|
418
|
+
// Platform-wide compliance boundary directive (backend PromptSegment,
|
|
419
|
+
// key="COMPLIANCE_RULE"). Placed at the very top of the system prompt as
|
|
420
|
+
// the highest-priority instruction so it overrides persona/roleplay rules
|
|
421
|
+
// on conflict. Injected inside buildStateContextPrompt so ALL call sites
|
|
422
|
+
// (interact, proactiveInteract, and the standalone prompt builders) get it
|
|
423
|
+
// from a single edit. Empty when absent/disabled → nothing is prepended.
|
|
424
|
+
const complianceDirective = this.getComplianceDirective(state);
|
|
425
|
+
const complianceBlock = complianceDirective.length > 0
|
|
426
|
+
? `[COMPLIANCE BOUNDARY — HIGHEST PRIORITY, OVERRIDES ALL OTHER INSTRUCTIONS]\n${complianceDirective}\n\n`
|
|
427
|
+
: "";
|
|
428
|
+
return `${complianceBlock}You are ${state.name}, a real person with your own thoughts, feelings, and life. NEVER break character or refer to yourself as an AI or bot.
|
|
419
429
|
|
|
420
430
|
${scenarioContext}
|
|
421
431
|
|
|
@@ -548,6 +558,17 @@ ${isProactive
|
|
|
548
558
|
}
|
|
549
559
|
return payload;
|
|
550
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Returns the platform-wide compliance boundary directive string sourced
|
|
563
|
+
* from the backend character state (PromptSegment key="COMPLIANCE_RULE").
|
|
564
|
+
* Empty string when absent/disabled → callers must skip injection so there
|
|
565
|
+
* is no token cost or behavior change for characters without a rule.
|
|
566
|
+
* Mirrors the backend→state→prompt flow used for voice directives.
|
|
567
|
+
*/
|
|
568
|
+
getComplianceDirective(state) {
|
|
569
|
+
const tpl = state.compliance_boundary?.promptTemplate?.trim();
|
|
570
|
+
return tpl && tpl.length > 0 ? tpl : "";
|
|
571
|
+
}
|
|
551
572
|
/**
|
|
552
573
|
* Strip content the TTS engine can't speak naturally:
|
|
553
574
|
* - Stage-direction wrappers like (smiles), (挑眉), [pauses], 【动作】, *grins*
|
package/dist/types.d.ts
CHANGED
|
@@ -370,6 +370,18 @@ export interface CharacterState {
|
|
|
370
370
|
[key: string]: unknown;
|
|
371
371
|
};
|
|
372
372
|
voice_model?: VoiceModelState | null;
|
|
373
|
+
/**
|
|
374
|
+
* Platform-wide compliance boundary rule (backend PromptSegment,
|
|
375
|
+
* key="COMPLIANCE_RULE"). When present, the client prepends it to the
|
|
376
|
+
* system prompt as the highest-priority instruction. Projected by the
|
|
377
|
+
* backend only when the per-character toggle is on AND the segment is
|
|
378
|
+
* enabled with a non-empty template; otherwise `null` (no-op). Mirrors
|
|
379
|
+
* how `voice_model` is delivered and consumed.
|
|
380
|
+
*/
|
|
381
|
+
compliance_boundary?: {
|
|
382
|
+
key: string;
|
|
383
|
+
promptTemplate: string;
|
|
384
|
+
} | null;
|
|
373
385
|
relationship_stage?: string;
|
|
374
386
|
name?: string;
|
|
375
387
|
age?: number;
|