@hasna/assistants 0.6.24 → 0.6.25

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
@@ -41924,9 +41924,15 @@ Use /help to see available commands.
41924
41924
  const lines = content.split(`
41925
41925
  `);
41926
41926
  const processedLines = [];
41927
+ let inCodeBlock = false;
41927
41928
  for (const line of lines) {
41928
41929
  const trimmed = line.trim();
41929
- if (trimmed.startsWith("!")) {
41930
+ if (trimmed.startsWith("```")) {
41931
+ inCodeBlock = !inCodeBlock;
41932
+ processedLines.push(line);
41933
+ continue;
41934
+ }
41935
+ if (!inCodeBlock && trimmed.startsWith("!")) {
41930
41936
  const command = trimmed.slice(1).trim();
41931
41937
  const output = await this.executeShell(command, cwd2);
41932
41938
  processedLines.push(`\`\`\`
@@ -46287,6 +46293,13 @@ class AgentLoop {
46287
46293
  hook_event_name: "Stop",
46288
46294
  cwd: this.cwd
46289
46295
  });
46296
+ const shouldSkipVerification = this.shouldStop || streamError !== null;
46297
+ if (shouldSkipVerification) {
46298
+ this.scopeContextManager.clear();
46299
+ this.context.clearScopeContext();
46300
+ this.emit({ type: "done" });
46301
+ return;
46302
+ }
46290
46303
  const verificationResult = await this.runScopeVerification();
46291
46304
  if (verificationResult && verificationResult.continue === false) {
46292
46305
  if (verificationResult.systemMessage) {
@@ -47541,6 +47554,7 @@ class SessionRegistry {
47541
47554
  chunkCallbacks = [];
47542
47555
  errorCallbacks = [];
47543
47556
  clientFactory;
47557
+ maxBufferedChunks = 2000;
47544
47558
  constructor(clientFactory) {
47545
47559
  this.clientFactory = clientFactory ?? ((cwd2) => new EmbeddedClient(cwd2));
47546
47560
  }
@@ -47563,7 +47577,9 @@ class SessionRegistry {
47563
47577
  for (const callback of this.errorCallbacks) {
47564
47578
  callback(error2);
47565
47579
  }
47580
+ return;
47566
47581
  }
47582
+ this.handleChunk(sessionInfo.id, { type: "error", error: error2.message });
47567
47583
  });
47568
47584
  this.sessions.set(sessionInfo.id, sessionInfo);
47569
47585
  this.chunkBuffers.set(sessionInfo.id, []);
@@ -47591,6 +47607,9 @@ class SessionRegistry {
47591
47607
  const buffer = this.chunkBuffers.get(sessionId);
47592
47608
  if (buffer) {
47593
47609
  buffer.push(chunk);
47610
+ if (buffer.length > this.maxBufferedChunks) {
47611
+ buffer.splice(0, buffer.length - this.maxBufferedChunks);
47612
+ }
47594
47613
  }
47595
47614
  }
47596
47615
  }
@@ -47642,6 +47661,17 @@ class SessionRegistry {
47642
47661
  if (this.activeSessionId === id) {
47643
47662
  const remaining = this.listSessions();
47644
47663
  this.activeSessionId = remaining.length > 0 ? remaining[0].id : null;
47664
+ if (this.activeSessionId) {
47665
+ const buffer = this.chunkBuffers.get(this.activeSessionId);
47666
+ if (buffer && buffer.length > 0) {
47667
+ for (const chunk of buffer) {
47668
+ for (const callback of this.chunkCallbacks) {
47669
+ callback(chunk);
47670
+ }
47671
+ }
47672
+ this.chunkBuffers.set(this.activeSessionId, []);
47673
+ }
47674
+ }
47645
47675
  }
47646
47676
  }
47647
47677
  }
@@ -51311,4 +51341,4 @@ if (options.print !== null) {
51311
51341
  });
51312
51342
  }
51313
51343
 
51314
- //# debugId=9F02420A08D7C81964756E2164756E21
51344
+ //# debugId=CB2FADE01C1A298664756E2164756E21