@yeaft/webchat-agent 0.1.834 → 0.1.836

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/unify/session.js +19 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.834",
3
+ "version": "0.1.836",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/unify/session.js CHANGED
@@ -193,11 +193,28 @@ export async function loadSession(options = {}) {
193
193
  console.warn(`[Yeaft] ${yeaftDir} is not writable — running in read-only mode`);
194
194
  }
195
195
 
196
- // ─── 3. Create debug trace ─────────────────────────────
196
+ // ─── 3. Create trajectory trace ─────────────────────────
197
+ // feat-always-on-trajectory-store: the trace is no longer gated on
198
+ // config.debug. It is a TRAJECTORY STORE: every turn's full
199
+ // (system_prompt, messages, tool_calls, tool_results, response, usage)
200
+ // is persisted to ~/.yeaft/debug.db so it can serve two purposes:
201
+ // 1. Debug panel hydration — user opens "请求日志" and sees prior turns.
202
+ // 2. SFT / RL training data — scripts can later dump JSONL trajectories.
203
+ // Cost is negligible (one insert per turn, WAL mode), and the data only
204
+ // accumulates while the user actually uses the agent. The previous gate
205
+ // silently discarded every turn unless the user had set debug:true in
206
+ // ~/.yeaft/config.json, which nobody ever did — wasting the asset.
197
207
  const trace = createTrace({
198
- enabled: config.debug,
208
+ enabled: true,
199
209
  dbPath: join(yeaftDir, 'debug.db'),
200
210
  });
211
+ // Bound disk growth: prune trajectories older than 30 days on session load.
212
+ // Cheap (indexed DELETE), runs once per process start, not per turn. Without
213
+ // this the always-on store grows unbounded — cleanup() existed but had zero
214
+ // call sites before this PR.
215
+ try { trace.cleanup?.(30); } catch (err) {
216
+ console.warn('[Yeaft] trace.cleanup failed:', err?.message || err);
217
+ }
201
218
 
202
219
  // ─── 4. Create LLM adapter ────────────────────────────
203
220
  const adapter = await createLLMAdapter(config);