@space3-npm/cybersoul-client 1.3.3 → 1.3.4

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.
Files changed (2) hide show
  1. package/dist/client.js +22 -5
  2. 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 lastKnownSceneLine = `Last Known Scene: ${ongoingScene.scene} | Outfit: ${ongoingScene.outfit}`;
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 elapsedHours = (currentTimeMs - new Date(dyn.lastInteractionAt).getTime()) / (1000 * 60 * 60);
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
- if (!isOutdated) {
190
- contextParts.push(`${lastKnownSceneLine} (Evaluate if this scene is outdated based on the time elapsed since the last interaction)`);
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@space3-npm/cybersoul-client",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",