@yeaft/webchat-agent 0.1.516 → 0.1.517

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": "@yeaft/webchat-agent",
3
- "version": "0.1.516",
3
+ "version": "0.1.517",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,6 +23,7 @@
23
23
  import { readFileSync, readdirSync, statSync, mkdirSync, existsSync } from 'fs';
24
24
  import { homedir } from 'os';
25
25
  import { join } from 'path';
26
+ import { createHash } from 'crypto';
26
27
 
27
28
  /**
28
29
  * @typedef {Object} VP
@@ -32,6 +33,7 @@ import { join } from 'path';
32
33
  * @property {string[]} traits
33
34
  * @property {'fast'|'primary'|undefined} modelHint
34
35
  * @property {string} persona — markdown body (persona / system prompt seed)
36
+ * @property {string} personaHash — sha256(persona).slice(0,8); changes when persona body changes
35
37
  * @property {string} dir — absolute path to VP dir
36
38
  * @property {string} memoryDir — absolute path to VP memory dir
37
39
  * @property {number} mtimeMs — role.md mtime (for hot-reload)
@@ -116,6 +118,11 @@ export function loadVpFromDir(dir) {
116
118
  const modelHintRaw = typeof meta.modelHint === 'string' ? meta.modelHint : undefined;
117
119
  const modelHint = modelHintRaw === 'primary' || modelHintRaw === 'fast' ? modelHintRaw : undefined;
118
120
 
121
+ // personaHash: sync sha256 of persona body, first 8 hex chars.
122
+ // Computed at load time (not lazy) so downstream consumers (system prompt
123
+ // builders, web-bridge live-diff in 334h) can compare cheaply.
124
+ const personaHash = createHash('sha256').update(body).digest('hex').slice(0, 8);
125
+
119
126
  /** @type {VP} */
120
127
  return {
121
128
  id,
@@ -124,6 +131,7 @@ export function loadVpFromDir(dir) {
124
131
  traits: Array.isArray(meta.traits) ? meta.traits.map(String) : [],
125
132
  modelHint,
126
133
  persona: body,
134
+ personaHash,
127
135
  dir,
128
136
  memoryDir,
129
137
  mtimeMs: st.mtimeMs,