@probelabs/probe 0.6.0-rc307 → 0.6.0-rc308

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.
@@ -3814,10 +3814,13 @@ or
3814
3814
  const jsonStr = responseText.replace(/^```(?:json)?\s*/, '').replace(/\s*```$/, '');
3815
3815
  const decision = JSON.parse(jsonStr);
3816
3816
 
3817
+ let grantedMs = 0;
3818
+ let grantedMin = 0;
3819
+
3817
3820
  if (decision.extend && decision.minutes > 0) {
3818
3821
  const requestedMs = Math.min(decision.minutes, maxPerReqMin) * 60000;
3819
- const grantedMs = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
3820
- const grantedMin = Math.round(grantedMs / 60000 * 10) / 10;
3822
+ grantedMs = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
3823
+ grantedMin = Math.round(grantedMs / 60000 * 10) / 10;
3821
3824
 
3822
3825
  // Update state
3823
3826
  negotiatedTimeoutState.extensionsUsed++;
@@ -103905,40 +103905,42 @@ or
103905
103905
  }
103906
103906
  const jsonStr = responseText.replace(/^```(?:json)?\s*/, "").replace(/\s*```$/, "");
103907
103907
  const decision = JSON.parse(jsonStr);
103908
+ let grantedMs = 0;
103909
+ let grantedMin = 0;
103908
103910
  if (decision.extend && decision.minutes > 0) {
103909
103911
  const requestedMs = Math.min(decision.minutes, maxPerReqMin) * 6e4;
103910
- const grantedMs2 = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
103911
- const grantedMin2 = Math.round(grantedMs2 / 6e4 * 10) / 10;
103912
+ grantedMs = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
103913
+ grantedMin = Math.round(grantedMs / 6e4 * 10) / 10;
103912
103914
  negotiatedTimeoutState.extensionsUsed++;
103913
- negotiatedTimeoutState.totalExtraTimeMs += grantedMs2;
103914
- negotiatedTimeoutState.extensionMessage = `\u23F0 Time limit was reached. The timeout observer granted ${grantedMin2} more minute(s) (reason: ${decision.reason || "work in progress"}). Extensions remaining: ${negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed}. Continue your work efficiently.`;
103915
+ negotiatedTimeoutState.totalExtraTimeMs += grantedMs;
103916
+ negotiatedTimeoutState.extensionMessage = `\u23F0 Time limit was reached. The timeout observer granted ${grantedMin} more minute(s) (reason: ${decision.reason || "work in progress"}). Extensions remaining: ${negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed}. Continue your work efficiently.`;
103915
103917
  negotiatedTimeoutState.softTimeoutId = setTimeout(() => {
103916
103918
  runTimeoutObserver();
103917
- }, grantedMs2);
103919
+ }, grantedMs);
103918
103920
  if (this.debug) {
103919
- console.log(`[DEBUG] Timeout observer: granted ${grantedMin2} min (reason: ${decision.reason}). Extensions: ${negotiatedTimeoutState.extensionsUsed}/${negotiatedTimeoutState.maxRequests}`);
103921
+ console.log(`[DEBUG] Timeout observer: granted ${grantedMin} min (reason: ${decision.reason}). Extensions: ${negotiatedTimeoutState.extensionsUsed}/${negotiatedTimeoutState.maxRequests}`);
103920
103922
  }
103921
103923
  if (this.tracer) {
103922
103924
  this.tracer.addEvent("negotiated_timeout.observer_extended", {
103923
103925
  decision_reason: decision.reason,
103924
103926
  requested_minutes: decision.minutes,
103925
- granted_ms: grantedMs2,
103926
- granted_min: grantedMin2,
103927
+ granted_ms: grantedMs,
103928
+ granted_min: grantedMin,
103927
103929
  extensions_used: negotiatedTimeoutState.extensionsUsed,
103928
103930
  max_requests: negotiatedTimeoutState.maxRequests,
103929
103931
  total_extra_time_ms: negotiatedTimeoutState.totalExtraTimeMs,
103930
- budget_remaining_ms: remainingBudgetMs - grantedMs2,
103932
+ budget_remaining_ms: remainingBudgetMs - grantedMs,
103931
103933
  active_tools: activeToolsList.map((t) => t.name),
103932
103934
  active_tools_count: activeToolsList.length
103933
103935
  });
103934
103936
  }
103935
103937
  this.events.emit("timeout.extended", {
103936
- grantedMs: grantedMs2,
103938
+ grantedMs,
103937
103939
  reason: decision.reason || "work in progress",
103938
103940
  extensionsUsed: negotiatedTimeoutState.extensionsUsed,
103939
103941
  extensionsRemaining: negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed,
103940
103942
  totalExtraTimeMs: negotiatedTimeoutState.totalExtraTimeMs,
103941
- budgetRemainingMs: remainingBudgetMs - grantedMs2
103943
+ budgetRemainingMs: remainingBudgetMs - grantedMs
103942
103944
  });
103943
103945
  } else {
103944
103946
  if (this.debug) {
package/cjs/index.cjs CHANGED
@@ -100485,40 +100485,42 @@ or
100485
100485
  }
100486
100486
  const jsonStr = responseText.replace(/^```(?:json)?\s*/, "").replace(/\s*```$/, "");
100487
100487
  const decision = JSON.parse(jsonStr);
100488
+ let grantedMs = 0;
100489
+ let grantedMin = 0;
100488
100490
  if (decision.extend && decision.minutes > 0) {
100489
100491
  const requestedMs = Math.min(decision.minutes, maxPerReqMin) * 6e4;
100490
- const grantedMs2 = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
100491
- const grantedMin2 = Math.round(grantedMs2 / 6e4 * 10) / 10;
100492
+ grantedMs = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
100493
+ grantedMin = Math.round(grantedMs / 6e4 * 10) / 10;
100492
100494
  negotiatedTimeoutState.extensionsUsed++;
100493
- negotiatedTimeoutState.totalExtraTimeMs += grantedMs2;
100494
- negotiatedTimeoutState.extensionMessage = `\u23F0 Time limit was reached. The timeout observer granted ${grantedMin2} more minute(s) (reason: ${decision.reason || "work in progress"}). Extensions remaining: ${negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed}. Continue your work efficiently.`;
100495
+ negotiatedTimeoutState.totalExtraTimeMs += grantedMs;
100496
+ negotiatedTimeoutState.extensionMessage = `\u23F0 Time limit was reached. The timeout observer granted ${grantedMin} more minute(s) (reason: ${decision.reason || "work in progress"}). Extensions remaining: ${negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed}. Continue your work efficiently.`;
100495
100497
  negotiatedTimeoutState.softTimeoutId = setTimeout(() => {
100496
100498
  runTimeoutObserver();
100497
- }, grantedMs2);
100499
+ }, grantedMs);
100498
100500
  if (this.debug) {
100499
- console.log(`[DEBUG] Timeout observer: granted ${grantedMin2} min (reason: ${decision.reason}). Extensions: ${negotiatedTimeoutState.extensionsUsed}/${negotiatedTimeoutState.maxRequests}`);
100501
+ console.log(`[DEBUG] Timeout observer: granted ${grantedMin} min (reason: ${decision.reason}). Extensions: ${negotiatedTimeoutState.extensionsUsed}/${negotiatedTimeoutState.maxRequests}`);
100500
100502
  }
100501
100503
  if (this.tracer) {
100502
100504
  this.tracer.addEvent("negotiated_timeout.observer_extended", {
100503
100505
  decision_reason: decision.reason,
100504
100506
  requested_minutes: decision.minutes,
100505
- granted_ms: grantedMs2,
100506
- granted_min: grantedMin2,
100507
+ granted_ms: grantedMs,
100508
+ granted_min: grantedMin,
100507
100509
  extensions_used: negotiatedTimeoutState.extensionsUsed,
100508
100510
  max_requests: negotiatedTimeoutState.maxRequests,
100509
100511
  total_extra_time_ms: negotiatedTimeoutState.totalExtraTimeMs,
100510
- budget_remaining_ms: remainingBudgetMs - grantedMs2,
100512
+ budget_remaining_ms: remainingBudgetMs - grantedMs,
100511
100513
  active_tools: activeToolsList.map((t) => t.name),
100512
100514
  active_tools_count: activeToolsList.length
100513
100515
  });
100514
100516
  }
100515
100517
  this.events.emit("timeout.extended", {
100516
- grantedMs: grantedMs2,
100518
+ grantedMs,
100517
100519
  reason: decision.reason || "work in progress",
100518
100520
  extensionsUsed: negotiatedTimeoutState.extensionsUsed,
100519
100521
  extensionsRemaining: negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed,
100520
100522
  totalExtraTimeMs: negotiatedTimeoutState.totalExtraTimeMs,
100521
- budgetRemainingMs: remainingBudgetMs - grantedMs2
100523
+ budgetRemainingMs: remainingBudgetMs - grantedMs
100522
100524
  });
100523
100525
  } else {
100524
100526
  if (this.debug) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc307",
3
+ "version": "0.6.0-rc308",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -3814,10 +3814,13 @@ or
3814
3814
  const jsonStr = responseText.replace(/^```(?:json)?\s*/, '').replace(/\s*```$/, '');
3815
3815
  const decision = JSON.parse(jsonStr);
3816
3816
 
3817
+ let grantedMs = 0;
3818
+ let grantedMin = 0;
3819
+
3817
3820
  if (decision.extend && decision.minutes > 0) {
3818
3821
  const requestedMs = Math.min(decision.minutes, maxPerReqMin) * 60000;
3819
- const grantedMs = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
3820
- const grantedMin = Math.round(grantedMs / 60000 * 10) / 10;
3822
+ grantedMs = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
3823
+ grantedMin = Math.round(grantedMs / 60000 * 10) / 10;
3821
3824
 
3822
3825
  // Update state
3823
3826
  negotiatedTimeoutState.extensionsUsed++;