@yeaft/webchat-agent 0.1.664 → 0.1.666
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/connection/message-router.js +1 -24
- package/package.json +1 -1
- package/unify/cli.js +5 -84
- package/unify/engine.js +22 -130
- package/unify/features/summary.js +15 -98
- package/unify/index.js +0 -2
- package/unify/memory/consolidate.js +10 -125
- package/unify/prompts.js +3 -19
- package/unify/session.js +1 -21
- package/unify/stop-hooks.js +8 -44
- package/unify/tools/index.js +0 -11
- package/unify/tools/web-search.js +216 -40
- package/unify/web-bridge.js +0 -98
- package/unify/memory/dream-shard.js +0 -722
- package/unify/memory/extract.js +0 -101
- package/unify/memory/layout.js +0 -358
- package/unify/memory/schema.js +0 -166
- package/unify/memory/shard-store.js +0 -373
- package/unify/memory/store.js +0 -578
- package/unify/memory/types.js +0 -139
- package/unify/memory/user-memory-store.js +0 -452
- package/unify/tools/memory-query.js +0 -134
- package/unify/tools/memory-read.js +0 -90
- package/unify/tools/memory-search.js +0 -140
- package/unify/tools/memory-trace.js +0 -135
- package/unify/tools/memory-write.js +0 -113
- package/unify/user-memory.js +0 -107
package/unify/web-bridge.js
CHANGED
|
@@ -26,10 +26,6 @@ import { createVp, updateVp, deleteVp, readVp, VpCrudError } from './vp/vp-crud.
|
|
|
26
26
|
import { scanVpLibrary } from './vp/vp-store.js';
|
|
27
27
|
import { createRouter } from './routing/router.js';
|
|
28
28
|
import { handleUnifyFeatureMessage as _handleUnifyFeatureMessage } from './feature-message.js';
|
|
29
|
-
import {
|
|
30
|
-
handleUnifyUserMemoryWrite as _handleUnifyUserMemoryWrite,
|
|
31
|
-
handleUnifyUserMemoryRemove as _handleUnifyUserMemoryRemove,
|
|
32
|
-
} from './user-memory.js';
|
|
33
29
|
import {
|
|
34
30
|
GroupCrudError,
|
|
35
31
|
createGroupFromSpec,
|
|
@@ -209,36 +205,6 @@ export function handleUnifyFeatureMessage(msg) {
|
|
|
209
205
|
_handleUnifyFeatureMessage(msg, sendUnifyEvent);
|
|
210
206
|
}
|
|
211
207
|
|
|
212
|
-
export function handleUnifyUserMemoryWrite(msg) {
|
|
213
|
-
_handleUnifyUserMemoryWrite(msg, sendUnifyEvent);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export function handleUnifyUserMemoryRemove(msg) {
|
|
217
|
-
_handleUnifyUserMemoryRemove(msg, sendUnifyEvent);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export function handleUnifyMemoryScopeList(msg) {
|
|
221
|
-
const requestId = msg && typeof msg.requestId === 'string' ? msg.requestId : undefined;
|
|
222
|
-
try {
|
|
223
|
-
const store = session && session.memoryStore;
|
|
224
|
-
const entries = store && typeof store.listEntries === 'function'
|
|
225
|
-
? store.listEntries()
|
|
226
|
-
: [];
|
|
227
|
-
sendUnifyEvent({
|
|
228
|
-
type: 'memory_scope_snapshot',
|
|
229
|
-
entries,
|
|
230
|
-
...(requestId ? { requestId } : {}),
|
|
231
|
-
});
|
|
232
|
-
} catch (err) {
|
|
233
|
-
sendUnifyEvent({
|
|
234
|
-
type: 'memory_scope_snapshot',
|
|
235
|
-
entries: [],
|
|
236
|
-
error: String(err && err.message || err),
|
|
237
|
-
...(requestId ? { requestId } : {}),
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
208
|
export function handleUnifyVpRead(msg) {
|
|
243
209
|
const requestId = msg && msg.requestId;
|
|
244
210
|
const vpId = msg && msg.vpId;
|
|
@@ -1130,70 +1096,6 @@ export function handleUnifyModeSwitch(_msg) {
|
|
|
1130
1096
|
console.warn('[Unify] unify_mode_switch is deprecated and ignored — Unify now runs in a single unified mode.');
|
|
1131
1097
|
}
|
|
1132
1098
|
|
|
1133
|
-
/** Read-only memory query for the UI memory browser. */
|
|
1134
|
-
export function handleUnifyMemoryQuery(msg = {}) {
|
|
1135
|
-
const requestId = typeof msg.requestId === 'string' ? msg.requestId : undefined;
|
|
1136
|
-
const vpId = typeof msg.vpId === 'string' ? msg.vpId : null;
|
|
1137
|
-
const featureId = typeof msg.featureId === 'string' ? msg.featureId : null;
|
|
1138
|
-
const limit = Number.isFinite(msg.limit) ? Math.max(1, Math.min(200, msg.limit)) : 50;
|
|
1139
|
-
|
|
1140
|
-
const reply = (extra = {}) => sendUnifyEvent({
|
|
1141
|
-
type: 'unify_memory_query_result',
|
|
1142
|
-
scope: { vpId, featureId },
|
|
1143
|
-
...extra,
|
|
1144
|
-
...(requestId ? { requestId } : {}),
|
|
1145
|
-
});
|
|
1146
|
-
|
|
1147
|
-
if (!session || !session.memoryShardStore) {
|
|
1148
|
-
reply({ entries: [], error: 'no_memory_store' });
|
|
1149
|
-
return;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
try {
|
|
1153
|
-
const filter = {};
|
|
1154
|
-
if (vpId) filter.vp = vpId;
|
|
1155
|
-
if (featureId) filter.feature = featureId;
|
|
1156
|
-
const res = session.memoryShardStore.query(filter);
|
|
1157
|
-
const list = Array.isArray(res?.results) ? res.results : [];
|
|
1158
|
-
list.sort((a, b) => {
|
|
1159
|
-
const ax = (a && (a.updatedAt || a.createdAt)) || 0;
|
|
1160
|
-
const bx = (b && (b.updatedAt || b.createdAt)) || 0;
|
|
1161
|
-
const at = typeof ax === 'string' ? Date.parse(ax) : ax;
|
|
1162
|
-
const bt = typeof bx === 'string' ? Date.parse(bx) : bx;
|
|
1163
|
-
return (bt || 0) - (at || 0);
|
|
1164
|
-
});
|
|
1165
|
-
reply({ entries: list.slice(0, limit) });
|
|
1166
|
-
} catch (err) {
|
|
1167
|
-
reply({ entries: [], error: String(err?.message || err) });
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
/** Open the source message behind a memory entry. */
|
|
1172
|
-
export function handleUnifyMemoryTrace(msg = {}) {
|
|
1173
|
-
const requestId = typeof msg.requestId === 'string' ? msg.requestId : undefined;
|
|
1174
|
-
const entryId = typeof msg.entryId === 'string' ? msg.entryId : null;
|
|
1175
|
-
|
|
1176
|
-
const reply = (extra = {}) => sendUnifyEvent({
|
|
1177
|
-
type: 'unify_memory_trace_result',
|
|
1178
|
-
entryId,
|
|
1179
|
-
...extra,
|
|
1180
|
-
...(requestId ? { requestId } : {}),
|
|
1181
|
-
});
|
|
1182
|
-
|
|
1183
|
-
if (!entryId) { reply({ entry: null, sourceRef: null, error: 'missing_entry_id' }); return; }
|
|
1184
|
-
if (!session || !session.memoryShardStore) {
|
|
1185
|
-
reply({ entry: null, sourceRef: null, error: 'no_memory_store' });
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
try {
|
|
1189
|
-
const entry = session.memoryShardStore.get(entryId);
|
|
1190
|
-
if (!entry) { reply({ entry: null, sourceRef: null, error: 'not_found' }); return; }
|
|
1191
|
-
reply({ entry, sourceRef: entry.sourceRef || null });
|
|
1192
|
-
} catch (err) {
|
|
1193
|
-
reply({ entry: null, sourceRef: null, error: String(err?.message || err) });
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
1099
|
/** Fetch a feature's summary history (revision chain). */
|
|
1198
1100
|
export async function handleUnifyFetchSummaryHistory(msg = {}) {
|
|
1199
1101
|
const requestId = typeof msg.requestId === 'string' ? msg.requestId : undefined;
|