neoagent 2.5.2-beta.5 → 2.5.2-beta.6

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": "neoagent",
3
- "version": "2.5.2-beta.5",
3
+ "version": "2.5.2-beta.6",
4
4
  "description": "Proactive personal AI agent with no limits",
5
5
  "license": "AGPL-3.0-only",
6
6
  "main": "server/index.js",
@@ -1 +1 @@
1
- 686c0241f8a0ccd4581a0d28d54b568e
1
+ 1050e01e6b4a9c529922c7db724d0188
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"77e2e94772b6eb43759e34ed1ad7da4674e19c
37
37
 
38
38
  _flutter.loader.load({
39
39
  serviceWorkerSettings: {
40
- serviceWorkerVersion: "3861825221" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
40
+ serviceWorkerVersion: "1247404091" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
41
41
  }
42
42
  });
@@ -134794,7 +134794,7 @@ r===$&&A.b()
134794
134794
  p.push(A.jP(q,A.j9(!1,new A.a_(B.uG,A.d8(new A.cA(B.jt,new A.a7N(r,q),q),q,q),q),!1,B.H,!0),q,q,0,0,0,q))}r=!1
134795
134795
  if(!s.ay)if(!s.ch){r=s.e
134796
134796
  r===$&&A.b()
134797
- r=B.b.u("mqfhwocj-bf9ea71").length!==0&&r.b}if(r){r=s.d
134797
+ r=B.b.u("mqfmnj9i-24c1816").length!==0&&r.b}if(r){r=s.d
134798
134798
  r===$&&A.b()
134799
134799
  r=r.aP&&!r.ai?84:0
134800
134800
  s=s.e
@@ -140506,7 +140506,7 @@ $S:0}
140506
140506
  A.a_6.prototype={}
140507
140507
  A.SQ.prototype={
140508
140508
  nb(a){var s=this
140509
- if(B.b.u("mqfhwocj-bf9ea71").length===0||s.a!=null)return
140509
+ if(B.b.u("mqfmnj9i-24c1816").length===0||s.a!=null)return
140510
140510
  s.AU()
140511
140511
  s.a=A.on(B.RH,new A.bc8(s))},
140512
140512
  AU(){var s=0,r=A.l(t.H),q,p=2,o=[],n=this,m,l,k,j,i,h,g,f
@@ -140524,7 +140524,7 @@ if(!t.f.b(k)){s=1
140524
140524
  break}i=J.a3(k,"buildId")
140525
140525
  h=i==null?null:B.b.u(J.p(i))
140526
140526
  j=h==null?"":h
140527
- if(J.bi(j)===0||J.d(j,"mqfhwocj-bf9ea71")){s=1
140527
+ if(J.bi(j)===0||J.d(j,"mqfmnj9i-24c1816")){s=1
140528
140528
  break}n.b=!0
140529
140529
  n.F()
140530
140530
  p=2
@@ -140541,7 +140541,7 @@ case 2:return A.i(o.at(-1),r)}})
140541
140541
  return A.k($async$AU,r)},
140542
140542
  vE(){var s=0,r=A.l(t.H),q,p=2,o=[],n=this,m,l,k,j,i,h,g,f,e,d,c,b,a,a0,a1
140543
140543
  var $async$vE=A.h(function(a2,a3){if(a2===1){o.push(a3)
140544
- s=p}for(;;)switch(s){case 0:if(B.b.u("mqfhwocj-bf9ea71").length===0||n.c){s=1
140544
+ s=p}for(;;)switch(s){case 0:if(B.b.u("mqfmnj9i-24c1816").length===0||n.c){s=1
140545
140545
  break}n.c=!0
140546
140546
  n.F()
140547
140547
  p=4
@@ -2228,7 +2228,7 @@ class AgentEngine {
2228
2228
  if (!runMeta || runMeta.aborted || runMeta.triggerSource !== 'messaging') {
2229
2229
  return { sent: false, skipped: true };
2230
2230
  }
2231
- if (runMeta.finalDeliverySent === true || runMeta.terminalInterim) {
2231
+ if (runMeta.terminalInterim) {
2232
2232
  return { sent: false, skipped: true };
2233
2233
  }
2234
2234
 
@@ -2596,6 +2596,7 @@ class AgentEngine {
2596
2596
  this.activeRuns.set(runId, {
2597
2597
  userId,
2598
2598
  agentId,
2599
+ title: runTitle,
2599
2600
  status: 'running',
2600
2601
  aborted: false,
2601
2602
  messagingSent: false,
@@ -3748,9 +3749,43 @@ class AgentEngine {
3748
3749
  );
3749
3750
  }
3750
3751
  if (iteration >= maxIterations) {
3751
- throw new Error(`Iteration limit reached before explicit completion after ${maxIterations} iterations.`);
3752
+ // Grace call: budget exhausted but no content yet.
3753
+ // Strip tools and ask the model to summarise what it accomplished.
3754
+ // Mirrors the Hermes handle_max_iterations() pattern.
3755
+ console.warn(`[Run ${shortenRunId(runId)}] iteration_limit runId=${shortenRunId(runId)} — making grace call`);
3756
+ try {
3757
+ const graceMessages = sanitizeConversationMessages([
3758
+ ...messages,
3759
+ {
3760
+ role: 'user',
3761
+ content: 'You have reached the maximum number of tool-calling iterations allowed. Please provide a final response summarising what you found and accomplished so far, without calling any more tools.',
3762
+ },
3763
+ ]);
3764
+ const graceResponse = await withModelCallTimeout(
3765
+ provider.chat(graceMessages, [], {
3766
+ model,
3767
+ reasoningEffort: this.getReasoningEffort(providerName, options),
3768
+ }),
3769
+ options,
3770
+ `Grace call after ${maxIterations} iterations`,
3771
+ );
3772
+ totalTokens += graceResponse.usage?.totalTokens || 0;
3773
+ lastContent = sanitizeModelOutput(graceResponse.content || '', { model });
3774
+ if (lastContent) {
3775
+ messages.push({ role: 'assistant', content: lastContent });
3776
+ if (conversationId) {
3777
+ db.prepare('INSERT INTO conversation_messages (conversation_id, role, content, tokens) VALUES (?, ?, ?, ?)')
3778
+ .run(conversationId, 'assistant', lastContent, graceResponse.usage?.totalTokens || 0);
3779
+ }
3780
+ }
3781
+ } catch (graceErr) {
3782
+ console.warn(`[Run ${shortenRunId(runId)}] grace call failed: ${graceErr?.message}`);
3783
+ }
3784
+ if (!normalizeOutgoingMessage(lastContent, options?.source || null)) {
3785
+ throw new Error(`Iteration limit reached before explicit completion after ${maxIterations} iterations.`);
3786
+ }
3752
3787
  }
3753
- if (stepIndex > 0 && !lastToolWasMessaging) {
3788
+ if (stepIndex > 0 && !lastToolWasMessaging && iteration < maxIterations) {
3754
3789
  throw new Error('Run ended without an explicit completion or blocker reply.');
3755
3790
  }
3756
3791
  }