@hasna/assistants 1.1.90 → 1.1.92

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/dist/index.js CHANGED
@@ -112152,7 +112152,7 @@ ${defs.length} agent(s) total. Use /agents show <name> for details.
112152
112152
  };
112153
112153
  }
112154
112154
  }
112155
- var VERSION2 = "1.1.90";
112155
+ var VERSION2 = "1.1.92";
112156
112156
  var init_builtin = __esm(async () => {
112157
112157
  init_src2();
112158
112158
  init_context3();
@@ -203738,6 +203738,7 @@ class SessionRegistry {
203738
203738
  chunkBuffers = new Map;
203739
203739
  chunkCallbacks = [];
203740
203740
  errorCallbacks = [];
203741
+ labelChangeCallbacks = [];
203741
203742
  clientFactory;
203742
203743
  maxBufferedChunks = 2000;
203743
203744
  store;
@@ -203772,6 +203773,9 @@ class SessionRegistry {
203772
203773
  session.label = label;
203773
203774
  session.updatedAt = Date.now();
203774
203775
  this.persistSession(session);
203776
+ for (const callback of this.labelChangeCallbacks) {
203777
+ callback(sessionId, label);
203778
+ }
203775
203779
  }
203776
203780
  }
203777
203781
  };
@@ -203827,6 +203831,9 @@ class SessionRegistry {
203827
203831
  session.label = label;
203828
203832
  session.updatedAt = Date.now();
203829
203833
  this.persistSession(session);
203834
+ for (const callback of this.labelChangeCallbacks) {
203835
+ callback(sessionId, label);
203836
+ }
203830
203837
  }
203831
203838
  persistSession(session) {
203832
203839
  this.store.save({
@@ -203992,6 +203999,9 @@ class SessionRegistry {
203992
203999
  onError(callback) {
203993
204000
  this.errorCallbacks.push(callback);
203994
204001
  }
204002
+ onLabelChange(callback) {
204003
+ this.labelChangeCallbacks.push(callback);
204004
+ }
203995
204005
  setProcessing(id, isProcessing) {
203996
204006
  const session = this.sessions.get(id);
203997
204007
  if (session) {
@@ -215894,9 +215904,11 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
215894
215904
  if (!this.sessionAutoNamed && this.onSessionLabel && source === "user") {
215895
215905
  this.sessionAutoNamed = true;
215896
215906
  const bgModel = this.config?.backgroundModel;
215907
+ const sessionId = this.sessionId;
215908
+ const labelCallback = this.onSessionLabel;
215897
215909
  generateSessionName(userMessage, { model: bgModel }).then((label) => {
215898
- this.onSessionLabel?.(this.sessionId, label);
215899
- }).catch(() => {});
215910
+ labelCallback?.(sessionId, label);
215911
+ }).catch((err) => {});
215900
215912
  }
215901
215913
  return { ok: true, summary: summary ? summary.slice(0, 200) : undefined };
215902
215914
  } catch (error4) {
@@ -264872,7 +264884,7 @@ function Status({
264872
264884
  const total = inputCost + outputCost + cacheReadCost + cacheWriteCost;
264873
264885
  return total < 0.01 ? `$${total.toFixed(3)}` : `$${total.toFixed(2)}`;
264874
264886
  }, [tokenUsage, modelId]);
264875
- const sessionInfo = sessionCount && sessionCount > 1 && sessionIndex !== undefined ? `${sessionIndex + 1}/${sessionCount}` : "";
264887
+ const sessionInfo = sessionCount && sessionCount > 1 && sessionIndex !== undefined ? `${sessionIndex}/${sessionCount}` : "";
264876
264888
  const bgIndicator = backgroundProcessingCount > 0 ? ` +${backgroundProcessingCount}` : "";
264877
264889
  const voiceLabel = voiceState?.enabled ? voiceState.isTalking ? "talk" : voiceState.isListening ? "mic" : voiceState.isSpeaking ? "spk" : "voice" : "";
264878
264890
  const heartbeatLabel = heartbeatState?.enabled ? heartbeatState.isStale ? "hb!" : "hb" : "";
@@ -292844,6 +292856,7 @@ function App2({ cwd: cwd3, version: version4, permissionMode: initialPermissionM
292844
292856
  const [activeSessionId, setActiveSessionId] = import_react86.useState(null);
292845
292857
  const [isInitializing, setIsInitializing] = import_react86.useState(true);
292846
292858
  const [showSessionSelector, setShowSessionSelector] = import_react86.useState(false);
292859
+ const [sessionVersion, setSessionVersion] = import_react86.useState(0);
292847
292860
  const [recoverableSessions, setRecoverableSessions] = import_react86.useState([]);
292848
292861
  const [showRecoveryPanel, setShowRecoveryPanel] = import_react86.useState(false);
292849
292862
  const [showConnectorsPanel, setShowConnectorsPanel] = import_react86.useState(false);
@@ -293476,8 +293489,15 @@ function App2({ cwd: cwd3, version: version4, permissionMode: initialPermissionM
293476
293489
  }, []);
293477
293490
  const saveCurrentSessionState = import_react86.useCallback(() => {
293478
293491
  if (activeSessionId) {
293492
+ const seen = new Set;
293493
+ const dedupedMessages = messages2.filter((msg) => {
293494
+ if (seen.has(msg.id))
293495
+ return false;
293496
+ seen.add(msg.id);
293497
+ return true;
293498
+ });
293479
293499
  sessionUIStates.current.set(activeSessionId, {
293480
- messages: messages2,
293500
+ messages: dedupedMessages,
293481
293501
  currentResponse: responseRef.current,
293482
293502
  activityLog: activityLogRef.current,
293483
293503
  toolCalls: toolCallsRef.current,
@@ -293498,7 +293518,14 @@ function App2({ cwd: cwd3, version: version4, permissionMode: initialPermissionM
293498
293518
  const askState = askUserStateRef.current.get(sessionId) || null;
293499
293519
  const ivState = interviewStateRef.current.get(sessionId) || null;
293500
293520
  if (state) {
293501
- setMessages(state.messages);
293521
+ const seen = new Set;
293522
+ const deduped = state.messages.filter((msg) => {
293523
+ if (seen.has(msg.id))
293524
+ return false;
293525
+ seen.add(msg.id);
293526
+ return true;
293527
+ });
293528
+ setMessages(deduped);
293502
293529
  setCurrentResponse(state.currentResponse);
293503
293530
  responseRef.current = state.currentResponse;
293504
293531
  setActivityLog(state.activityLog);
@@ -293715,8 +293742,15 @@ function App2({ cwd: cwd3, version: version4, permissionMode: initialPermissionM
293715
293742
  initialPermissionMode
293716
293743
  ]);
293717
293744
  const seedSessionState = import_react86.useCallback((sessionId, seededMessages) => {
293745
+ const seen = new Set;
293746
+ const deduped = seededMessages.filter((msg) => {
293747
+ if (seen.has(msg.id))
293748
+ return false;
293749
+ seen.add(msg.id);
293750
+ return true;
293751
+ });
293718
293752
  sessionUIStates.current.set(sessionId, {
293719
- messages: seededMessages,
293753
+ messages: deduped,
293720
293754
  currentResponse: "",
293721
293755
  activityLog: [],
293722
293756
  toolCalls: [],
@@ -294427,6 +294461,9 @@ function App2({ cwd: cwd3, version: version4, permissionMode: initialPermissionM
294427
294461
  }
294428
294462
  setQueueFlushTrigger((prev) => prev + 1);
294429
294463
  });
294464
+ registry3.onLabelChange(() => {
294465
+ setSessionVersion((prev) => prev + 1);
294466
+ });
294430
294467
  }
294431
294468
  let initialMessages;
294432
294469
  let sessionId;
@@ -294442,9 +294479,16 @@ function App2({ cwd: cwd3, version: version4, permissionMode: initialPermissionM
294442
294479
  }
294443
294480
  clearRecoveryState(recoverSession.sessionId, workspaceBaseDir);
294444
294481
  }
294445
- const session = await registry3.createSession(effectiveCwd);
294482
+ const session = await registry3.createSession(initialMessages && initialMessages.length > 0 ? { cwd: effectiveCwd, sessionId, initialMessages, startedAt } : effectiveCwd);
294446
294483
  if (initialMessages && initialMessages.length > 0) {
294447
- setMessages(initialMessages);
294484
+ const seen = new Set;
294485
+ const deduped = initialMessages.filter((msg) => {
294486
+ if (seen.has(msg.id))
294487
+ return false;
294488
+ seen.add(msg.id);
294489
+ return true;
294490
+ });
294491
+ setMessages(deduped);
294448
294492
  }
294449
294493
  setActiveSessionId(session.id);
294450
294494
  session.client.setAskUserHandler((request2) => beginAskUser(session.id, request2));
@@ -294781,7 +294825,11 @@ function App2({ cwd: cwd3, version: version4, permissionMode: initialPermissionM
294781
294825
  const wrapChars = renderWidth ?? MESSAGE_WRAP_CHARS;
294782
294826
  const displayMessages = import_react86.useMemo(() => {
294783
294827
  const result = [];
294828
+ const seenIds = new Set;
294784
294829
  for (const msg of messages2) {
294830
+ if (seenIds.has(msg.id))
294831
+ continue;
294832
+ seenIds.add(msg.id);
294785
294833
  const signature = [
294786
294834
  msg.role,
294787
294835
  msg.content?.length ?? 0,
@@ -297877,7 +297925,7 @@ process.on("unhandledRejection", (reason) => {
297877
297925
  cleanup();
297878
297926
  process.exit(1);
297879
297927
  });
297880
- var VERSION4 = "1.1.90";
297928
+ var VERSION4 = "1.1.92";
297881
297929
  var SYNC_START = "\x1B[?2026h";
297882
297930
  var SYNC_END = "\x1B[?2026l";
297883
297931
  function enableSynchronizedOutput() {
@@ -298051,4 +298099,4 @@ export {
298051
298099
  main
298052
298100
  };
298053
298101
 
298054
- //# debugId=EE26EDB19ADBEA5764756E2164756E21
298102
+ //# debugId=3E5D9413D8BCEB8464756E2164756E21