@hasna/assistants 1.1.76 → 1.1.78

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
@@ -109673,7 +109673,7 @@ Not a git repository or git not available.
109673
109673
  context.setProjectContext(projectContext);
109674
109674
  }
109675
109675
  }
109676
- var VERSION2 = "1.1.76";
109676
+ var VERSION2 = "1.1.78";
109677
109677
  var init_builtin = __esm(async () => {
109678
109678
  init_src2();
109679
109679
  init_context3();
@@ -290245,7 +290245,6 @@ function App2({ cwd: cwd3, version: version4 }) {
290245
290245
  }
290246
290246
  return result;
290247
290247
  }, [messages2, wrapChars, renderWidth]);
290248
- const lastResponseIdsRef = import_react86.useRef(new Set);
290249
290248
  const [lastResponseMessages, setLastResponseMessages] = import_react86.useState([]);
290250
290249
  import_react86.useEffect(() => {
290251
290250
  if (displayMessages.length === 0)
@@ -290257,23 +290256,13 @@ function App2({ cwd: cwd3, version: version4 }) {
290257
290256
  break;
290258
290257
  }
290259
290258
  }
290260
- const newLastResponseIds = new Set;
290261
- const newLastResponseMsgs = [];
290259
+ const dynamicIds = new Set;
290260
+ const dynamicMsgs = [];
290262
290261
  if (lastUserIdx >= 0) {
290263
290262
  for (let i6 = lastUserIdx + 1;i6 < displayMessages.length; i6++) {
290264
290263
  if (displayMessages[i6].role === "assistant") {
290265
- newLastResponseIds.add(displayMessages[i6].id);
290266
- newLastResponseMsgs.push(displayMessages[i6]);
290267
- }
290268
- }
290269
- }
290270
- const toFlush = [];
290271
- for (const id of lastResponseIdsRef.current) {
290272
- if (!newLastResponseIds.has(id) && !staticMessageIdsRef.current.has(id)) {
290273
- const msg = displayMessages.find((m5) => m5.id === id);
290274
- if (msg) {
290275
- staticMessageIdsRef.current.add(id);
290276
- toFlush.push(msg);
290264
+ dynamicIds.add(displayMessages[i6].id);
290265
+ dynamicMsgs.push(displayMessages[i6]);
290277
290266
  }
290278
290267
  }
290279
290268
  }
@@ -290281,17 +290270,15 @@ function App2({ cwd: cwd3, version: version4 }) {
290281
290270
  for (const message of displayMessages) {
290282
290271
  if (staticMessageIdsRef.current.has(message.id))
290283
290272
  continue;
290284
- if (newLastResponseIds.has(message.id))
290273
+ if (dynamicIds.has(message.id))
290285
290274
  continue;
290286
290275
  staticMessageIdsRef.current.add(message.id);
290287
290276
  next.push(message);
290288
290277
  }
290289
- const allNew = [...toFlush, ...next];
290290
- if (allNew.length > 0) {
290291
- setStaticMessages((prev) => [...prev, ...allNew]);
290278
+ if (next.length > 0) {
290279
+ setStaticMessages((prev) => [...prev, ...next]);
290292
290280
  }
290293
- lastResponseIdsRef.current = newLastResponseIds;
290294
- setLastResponseMessages(newLastResponseMsgs);
290281
+ setLastResponseMessages(dynamicMsgs);
290295
290282
  }, [displayMessages]);
290296
290283
  const reservedLines = 12;
290297
290284
  const dynamicBudget = Math.max(6, rows - reservedLines);
@@ -290315,7 +290302,12 @@ function App2({ cwd: cwd3, version: version4 }) {
290315
290302
  const activityBudget = Math.max(4, dynamicBudget - streamingLineCount);
290316
290303
  return trimActivityLogByLines(activityLog, wrapChars, renderWidth, activityBudget);
290317
290304
  }, [activityLog, wrapChars, renderWidth, dynamicBudget, streamingLineCount]);
290318
- const combinedStreamingMessages = streamingMessages.length > 0 ? streamingMessages : lastResponseMessages;
290305
+ const lastResponseTrim = import_react86.useMemo(() => {
290306
+ if (lastResponseMessages.length === 0 || isProcessing)
290307
+ return { messages: lastResponseMessages, trimmed: false };
290308
+ return trimDisplayMessagesByLines(lastResponseMessages, dynamicBudget, renderWidth);
290309
+ }, [lastResponseMessages, isProcessing, dynamicBudget, renderWidth]);
290310
+ const combinedStreamingMessages = streamingMessages.length > 0 ? streamingMessages : lastResponseTrim.messages;
290319
290311
  const showDynamicPanel = isProcessing || activityTrim.entries.length > 0 || lastResponseMessages.length > 0;
290320
290312
  import_react86.useEffect(() => {
290321
290313
  if (!isBusy && activeQueue.length > 0 && activeInline.length === 0) {
@@ -293343,7 +293335,7 @@ process.on("unhandledRejection", (reason) => {
293343
293335
  cleanup();
293344
293336
  process.exit(1);
293345
293337
  });
293346
- var VERSION4 = "1.1.76";
293338
+ var VERSION4 = "1.1.78";
293347
293339
  var SYNC_START = "\x1B[?2026h";
293348
293340
  var SYNC_END = "\x1B[?2026l";
293349
293341
  function enableSynchronizedOutput() {
@@ -293488,4 +293480,4 @@ export {
293488
293480
  main
293489
293481
  };
293490
293482
 
293491
- //# debugId=5FE8166604C99EF564756E2164756E21
293483
+ //# debugId=A2CC81C0C793744C64756E2164756E21