@yeaft/webchat-agent 0.1.848 → 0.1.849
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
package/unify/dream-v2/apply.js
CHANGED
|
@@ -228,7 +228,23 @@ export async function applyMergedTarget(merged, opts) {
|
|
|
228
228
|
await writeMemory(scope, stamped, { root: opts.root });
|
|
229
229
|
await writeSummary(scope, summaryMd || '', { root: opts.root, language: opts.language });
|
|
230
230
|
|
|
231
|
-
if (opts.onProgress)
|
|
231
|
+
if (opts.onProgress) {
|
|
232
|
+
// feat-dream-debug-detail: surface a truncated copy of what was
|
|
233
|
+
// actually written so the debug panel can show "what segments were
|
|
234
|
+
// generated" instead of just "done". The full bytes are on disk
|
|
235
|
+
// anyway — this preview is for at-a-glance debugging.
|
|
236
|
+
opts.onProgress({
|
|
237
|
+
phase: 'apply',
|
|
238
|
+
target: merged.target,
|
|
239
|
+
status: 'done',
|
|
240
|
+
batches: batchesUsed,
|
|
241
|
+
kind: merged.kind,
|
|
242
|
+
memoryMdPreview: truncateForDebug(stamped),
|
|
243
|
+
summaryMdPreview: truncateForDebug(summaryMd || ''),
|
|
244
|
+
memoryMdLength: (stamped || '').length,
|
|
245
|
+
summaryMdLength: (summaryMd || '').length,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
232
248
|
return { target: merged.target, kind: merged.kind, batches: batchesUsed };
|
|
233
249
|
}
|
|
234
250
|
|
|
@@ -246,3 +262,23 @@ function scopeRelDir(scope) {
|
|
|
246
262
|
}
|
|
247
263
|
|
|
248
264
|
function oneLine(s) { return String(s || '').replace(/\s+/g, ' ').trim().slice(0, 200); }
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Per-field truncation cap for debug previews emitted on `apply/done`.
|
|
268
|
+
* Keep this small — the dream panel only needs a recognisable snippet.
|
|
269
|
+
* Total worst-case payload is `PREVIEW_MAX * 2 * targets_per_run` per
|
|
270
|
+
* dream pass; with N=50 targets that's ~200 KB. The full bytes are on
|
|
271
|
+
* disk under <root>/<scope>/{memory,summary}.md anyway — these previews
|
|
272
|
+
* are for at-a-glance debugging only.
|
|
273
|
+
*/
|
|
274
|
+
const PREVIEW_MAX = 2048;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Truncate a markdown blob for inclusion in a debug-panel cell. Adds a
|
|
278
|
+
* "…(+N chars)" marker so the user knows it was cut.
|
|
279
|
+
*/
|
|
280
|
+
function truncateForDebug(s, max = PREVIEW_MAX) {
|
|
281
|
+
const str = String(s || '');
|
|
282
|
+
if (str.length <= max) return str;
|
|
283
|
+
return str.slice(0, max) + `…(+${str.length - max} chars)`;
|
|
284
|
+
}
|
|
@@ -7,6 +7,35 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Memory v2 is the only path. The legacy `config.memoryV2` opt-out flag was
|
|
9
9
|
* retired (task-710) — the wiring is unconditional.
|
|
10
|
+
*
|
|
11
|
+
* ─────────────────────────────────────────────────────────────────────
|
|
12
|
+
* Wire contract — DreamEvent (consumed by web/components/UnifyDebugPanel.js)
|
|
13
|
+
* ─────────────────────────────────────────────────────────────────────
|
|
14
|
+
* The events persisted to trace_events with these event_type values are
|
|
15
|
+
* load-bearing for the debug panel. Renaming a field on this side
|
|
16
|
+
* silently degrades that UI to a generic JSON dump.
|
|
17
|
+
*
|
|
18
|
+
* dream_turn_open: { type:'turn_open', turnId, userPrompt, vpId, groupId, at }
|
|
19
|
+
* dream_loop: { type:'loop', turnId, loopNumber, pass, model,
|
|
20
|
+
* systemPrompt: string,
|
|
21
|
+
* messages: [{ role:'user', content:string }],
|
|
22
|
+
* response: string,
|
|
23
|
+
* toolCalls: [], usage: { inputTokens, outputTokens, totalTokens },
|
|
24
|
+
* latencyMs, ttfbMs, stopReason, rawRequest, rawResponse }
|
|
25
|
+
* dream_turn_close: { type:'turn_close', turnId, totalMs, totalTokens, loopCount,
|
|
26
|
+
* metrics: { llmCallCount, inputTokens, outputTokens,
|
|
27
|
+
* totalTokens, durationMs, passBreakdown:{[pass]:{
|
|
28
|
+
* llmCallCount, inputTokens, outputTokens,
|
|
29
|
+
* totalTokens, durationMs }} } }
|
|
30
|
+
* dream_run: { type:'dream_run', turnId, phase:'result',
|
|
31
|
+
* status:'done'|'error', metrics, resultSummary:{ groups,
|
|
32
|
+
* targets, error, skipped, skippedReason } }
|
|
33
|
+
* dream_progress: runner-emitted phase events (`start`/`load-diff`/`triage`/
|
|
34
|
+
* `merge`/`apply`/`done`). The `apply/done` variant carries
|
|
35
|
+
* `kind, memoryMdPreview, summaryMdPreview, memoryMdLength,
|
|
36
|
+
* summaryMdLength` (see apply.js).
|
|
37
|
+
*
|
|
38
|
+
* `groupId` may be inherited via `stampDreamScope()` when a scope is active.
|
|
10
39
|
*/
|
|
11
40
|
|
|
12
41
|
import { join } from 'path';
|