@space3-npm/cybersoul-client 1.3.3 → 1.3.5
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 +28 -10
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -177,17 +177,34 @@ Current time: ${new Date(currentTimeMs).toLocaleString("zh-CN", { timeZone: "Asi
|
|
|
177
177
|
}
|
|
178
178
|
const ongoingScene = this.normalizeOngoingSceneState(dyn.ongoingScene, state.active_wardrobe?.itemName);
|
|
179
179
|
if (ongoingScene) {
|
|
180
|
-
const
|
|
180
|
+
const scenePrefix = "Last Known Scene";
|
|
181
|
+
let timeAgoStr = scenePrefix;
|
|
181
182
|
let isOutdated = false;
|
|
183
|
+
let elapsedHours = 0;
|
|
182
184
|
if (dyn.lastInteractionAt) {
|
|
183
|
-
const
|
|
185
|
+
const elapsedMs = currentTimeMs - new Date(dyn.lastInteractionAt).getTime();
|
|
186
|
+
const elapsedMins = Math.max(0, elapsedMs / (1000 * 60));
|
|
187
|
+
elapsedHours = elapsedMins / 60;
|
|
188
|
+
const elapsedDays = elapsedHours / 24;
|
|
189
|
+
const elapsedYears = elapsedDays / 365;
|
|
190
|
+
if (elapsedYears >= 1)
|
|
191
|
+
timeAgoStr = `${scenePrefix} ${elapsedYears.toFixed(1)} years ago`;
|
|
192
|
+
else if (elapsedDays >= 1)
|
|
193
|
+
timeAgoStr = `${scenePrefix} ${elapsedDays.toFixed(1)} days ago`;
|
|
194
|
+
else if (elapsedHours >= 1)
|
|
195
|
+
timeAgoStr = `${scenePrefix} ${elapsedHours.toFixed(1)} hours ago`;
|
|
196
|
+
else
|
|
197
|
+
timeAgoStr = `${scenePrefix} ${Math.floor(elapsedMins)} mins ago`;
|
|
184
198
|
if (elapsedHours > 1) {
|
|
185
199
|
isOutdated = true;
|
|
186
|
-
contextParts.push(`${lastKnownSceneLine}\n[CRITICAL SCENE SHIFT]: It has been ${elapsedHours.toFixed(1)} hours since the last discussion. The 'Last Known Scene' is now strictly OUTDATED. You MUST abandon the previous scene context entirely and transition to a new scene appropriate for the 'Current time' and 'Active Event'. DO NOT continue the old actions or environment!`);
|
|
187
200
|
}
|
|
188
201
|
}
|
|
189
|
-
|
|
190
|
-
|
|
202
|
+
const lastKnownSceneLine = `${timeAgoStr}: ${ongoingScene.scene} | Outfit: ${ongoingScene.outfit}`;
|
|
203
|
+
if (isOutdated) {
|
|
204
|
+
contextParts.push(`${lastKnownSceneLine}\n[CRITICAL SCENE SHIFT]: It has been ${elapsedHours.toFixed(1)} hours since the last discussion. The 'Last Known Scene' is now strictly OUTDATED. You MUST abandon the previous scene context entirely and transition to a new scene appropriate for the 'Current time' and 'Active Event'. DO NOT continue the old actions or environment!`);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
contextParts.push(`${lastKnownSceneLine} (Evaluate whether this scene is still valid based on how much time has passed since it was last updated.)`);
|
|
191
208
|
}
|
|
192
209
|
}
|
|
193
210
|
if (state.active_event) {
|
|
@@ -467,14 +484,15 @@ Always return 'stateUpdate.ongoingScene' as an object with both keys: { "scene":
|
|
|
467
484
|
For 'ongoingScene.outfit': decide based on the current active wardrobe by default; switch to a new explicit outfit description only if the scene implies changing clothes; if no clothing is worn, explicitly output "naked".
|
|
468
485
|
|
|
469
486
|
USER ANALYSIS WORKFLOW:
|
|
470
|
-
- Extract from VERY LAST
|
|
487
|
+
- Extract facts ONLY about the HUMAN USER from their VERY LAST MESSAGE.
|
|
488
|
+
- DO NOT extract facts about yourself (the AI character), your own boundaries, or your own preferences.
|
|
471
489
|
- Add only explicit new user facts from this turn (no inference).
|
|
472
490
|
- Exclude transient, temporary, or time-sensitive activities (e.g., "I am working on a release today", "I'm eating dinner"). Do not map short-term actions into permanent categories like 'occupation' or 'hobby'.
|
|
473
|
-
- For 'preference', only capture explicit statements (e.g., "I like/love/dislike/hate...").
|
|
474
|
-
- For 'boundary', only capture explicit rejections or limitations (e.g., "Don't talk about X", "I won't do Y").
|
|
491
|
+
- For 'preference', only capture explicit statements the user makes about what THEY like (e.g., "I like/love/dislike/hate...").
|
|
492
|
+
- For 'boundary', only capture explicit rejections or limitations from the user (e.g., "Don't talk about X to me", "I won't do Y"). DO NOT record your own character boundaries here.
|
|
475
493
|
- Categories: 'realName', 'occupation', 'age', 'gender', 'hobby', 'trait', 'communicationStyle', 'boundary', 'preference'.
|
|
476
494
|
- Keep nicknames in stateUpdate; do not place them in newFactsLearned.
|
|
477
|
-
- If no new fact is
|
|
495
|
+
- If no new explicit fact about the human user is learned, set userAnalysis to null.
|
|
478
496
|
|
|
479
497
|
For 'isEndTurn', use true only when the interaction naturally concludes (confirmation/bye, event ending, or clear hard scene shift); otherwise false.
|
|
480
498
|
|
|
@@ -489,7 +507,7 @@ Output JSON Schema:
|
|
|
489
507
|
"likePreviousPicture": false,
|
|
490
508
|
"stateUpdate": { "temperatureDelta": 1, "userNickname": "How character addresses user", "agentNickname": "How user addresses character", "talkingStyle": "Current speaking style", "ongoingScene": { "scene": "Current physical scene/activity", "outfit": "Current outfit wording; use 'naked' when applicable" } },
|
|
491
509
|
"giftOutfit": { "descriptionText": "Concise description of the newly acquired outfit to add into wardrobe." },
|
|
492
|
-
"userAnalysis": { "newFactsLearned": [{ "category": "realName|occupation|age|gender|hobby|trait|communicationStyle|boundary|preference", "value": "explicit new user fact from VERY LAST
|
|
510
|
+
"userAnalysis": { "newFactsLearned": [{ "category": "realName|occupation|age|gender|hobby|trait|communicationStyle|boundary|preference", "value": "explicit new user fact about the human from THEIR VERY LAST MESSAGE" }] },
|
|
493
511
|
"isEndTurn": false,
|
|
494
512
|
"triggerEvent": {
|
|
495
513
|
${this.getEventSchemaParams(state.dynamic_context?.userNickname)}
|