@hexis-ai/engram-server 0.12.0 → 0.14.0

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/storage.js CHANGED
@@ -35,6 +35,26 @@ export function foldEvents(row, events, now) {
35
35
  ...(row.trigger_event_id !== undefined
36
36
  ? { trigger_event_id: row.trigger_event_id }
37
37
  : {}),
38
+ ...(row.trigger_purpose !== undefined
39
+ ? { trigger_purpose: row.trigger_purpose }
40
+ : {}),
41
+ ...(row.trigger_resume_hint !== undefined
42
+ ? { trigger_resume_hint: row.trigger_resume_hint }
43
+ : {}),
38
44
  updated_at: row.updatedAt,
39
45
  };
40
46
  }
47
+ const PERSON_ID_ALPHA = "abcdefghijklmnopqrstuvwxyz0123456789";
48
+ /**
49
+ * Allocate a fresh person id (`p_` + 8 alphanumeric chars). Cryptographically
50
+ * random via `crypto.getRandomValues`; shared between every adapter so id
51
+ * shape and entropy stay aligned.
52
+ */
53
+ export function newPersonId() {
54
+ const buf = new Uint8Array(8);
55
+ crypto.getRandomValues(buf);
56
+ let out = "p_";
57
+ for (const b of buf)
58
+ out += PERSON_ID_ALPHA[b % PERSON_ID_ALPHA.length];
59
+ return out;
60
+ }