ei-tui 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ei-tui",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "author": "Flare576",
5
5
  "repository": {
6
6
  "type": "git",
@@ -272,15 +272,24 @@ export async function buildResponsePromptData(
272
272
  const filteredHuman = await filterHumanDataByVisibility(human, persona, queries);
273
273
  const visiblePersonas = getVisiblePersonas(sm, persona);
274
274
 
275
+ const contextWindowMs = persona.context_window_ms ?? human.settings?.default_context_window_ms ?? 28800000;
276
+ const contextBoundaryMs = persona.context_boundary ? new Date(persona.context_boundary).getTime() : 0;
277
+ const windowStartMs = Date.now() - contextWindowMs;
278
+
275
279
  const alwaysMessages = sm.messages_getAlways(persona.id);
276
- const temporalAnchors = alwaysMessages.map(m => ({
277
- id: m.id,
278
- role: m.role === "human" ? "human" as const : "system" as const,
279
- content: m.content,
280
- silence_reason: m.silence_reason,
281
- timestamp: m.timestamp,
282
- _synthesis: m._synthesis,
283
- }));
280
+ const temporalAnchors = alwaysMessages
281
+ .filter(m => {
282
+ const msgMs = new Date(m.timestamp).getTime();
283
+ return msgMs < windowStartMs || (contextBoundaryMs > 0 && msgMs < contextBoundaryMs);
284
+ })
285
+ .map(m => ({
286
+ id: m.id,
287
+ role: m.role === "human" ? "human" as const : "system" as const,
288
+ content: m.content,
289
+ silence_reason: m.silence_reason,
290
+ timestamp: m.timestamp,
291
+ _synthesis: m._synthesis,
292
+ }));
284
293
 
285
294
  return {
286
295
  persona: {
@@ -1,7 +1,7 @@
1
1
  import type { Message } from "../core/types.js";
2
2
  import { getMessageContent } from "../core/handlers/utils.js";
3
3
 
4
- const MESSAGE_PLACEHOLDER_REGEX = /\[mid:([a-zA-Z0-9_-]+):([^\]]+)\]/g;
4
+ const MESSAGE_PLACEHOLDER_REGEX = /\[mid:([a-zA-Z0-9_:-]+):([^:\]]+)\]/g;
5
5
 
6
6
  export function getMessageDisplayText(message: Message): string | null {
7
7
  const parts: string[] = [];