@yeaft/webchat-agent 1.0.288 → 1.0.289

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": "1.0.288",
3
+ "version": "1.0.289",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2284,6 +2284,10 @@ export async function __testResetVpState() {
2284
2284
  sessionContexts.clear();
2285
2285
  vpCurrentTodos.clear();
2286
2286
  threadClassifier = defaultClassifyThread;
2287
+ if (_vpUnsubscribe) {
2288
+ try { _vpUnsubscribe(); } catch { /* ignore */ }
2289
+ _vpUnsubscribe = null;
2290
+ }
2287
2291
  yeaftConversationId = null;
2288
2292
  lastYeaftSlashCommandSnapshot = null;
2289
2293
  // Per-group compact in-flight + pending state lives on the session's
@@ -2834,19 +2838,30 @@ function configuredVpPaths() {
2834
2838
  };
2835
2839
  }
2836
2840
 
2837
- export function handleYeaftVpSubscribe(_msg) {
2841
+ export function handleYeaftVpSubscribe(msg = {}) {
2838
2842
  if (_vpUnsubscribe) {
2839
2843
  try { _vpUnsubscribe(); } catch { /* ignore */ }
2840
2844
  _vpUnsubscribe = null;
2841
2845
  }
2842
2846
  const { libDir } = configuredVpPaths();
2847
+ const requestId = typeof msg.requestId === 'string' && msg.requestId ? msg.requestId : null;
2843
2848
  _vpUnsubscribe = handleVpSubscribe(
2844
- sendSessionEvent,
2849
+ event => sendSessionEvent(event, event?.type === 'vp_snapshot' && requestId ? { requestId } : undefined),
2845
2850
  undefined,
2846
2851
  libDir ? { dir: libDir } : {},
2847
2852
  );
2848
2853
  }
2849
2854
 
2855
+ /**
2856
+ * Seed and publish the Agent-owned VP library as soon as the Agent registers.
2857
+ * Session creation must not wait for a Session runtime or a first user message:
2858
+ * stock VPs ship with the Agent and are cheap synchronous files to materialize.
2859
+ * Later explicit subscriptions still refresh the same authoritative library.
2860
+ */
2861
+ export function broadcastYeaftVpSnapshotEager() {
2862
+ handleYeaftVpSubscribe();
2863
+ }
2864
+
2850
2865
  /**
2851
2866
  * VP CRUD from the web client. See historic doc for full message shapes.
2852
2867
  */