@earendil-works/pi-coding-agent 0.81.0 → 0.81.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/core/agent-session.d.ts +22 -0
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +32 -2
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/compaction/branch-summarization.d.ts +5 -0
  7. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  8. package/dist/core/compaction/branch-summarization.js +5 -7
  9. package/dist/core/compaction/branch-summarization.js.map +1 -1
  10. package/dist/core/compaction/compaction.d.ts +13 -4
  11. package/dist/core/compaction/compaction.d.ts.map +1 -1
  12. package/dist/core/compaction/compaction.js +21 -17
  13. package/dist/core/compaction/compaction.js.map +1 -1
  14. package/dist/core/sdk.d.ts.map +1 -1
  15. package/dist/core/sdk.js +7 -3
  16. package/dist/core/sdk.js.map +1 -1
  17. package/dist/main.d.ts.map +1 -1
  18. package/dist/main.js +2 -1
  19. package/dist/main.js.map +1 -1
  20. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  21. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  22. package/dist/modes/interactive/interactive-mode.js +34 -4
  23. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  24. package/docs/json.md +5 -1
  25. package/docs/rpc.md +33 -0
  26. package/docs/sdk.md +3 -0
  27. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  28. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  29. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  30. package/examples/extensions/gondolin/package-lock.json +2 -2
  31. package/examples/extensions/gondolin/package.json +1 -1
  32. package/examples/extensions/sandbox/package-lock.json +2 -2
  33. package/examples/extensions/sandbox/package.json +1 -1
  34. package/examples/extensions/with-deps/package-lock.json +2 -2
  35. package/examples/extensions/with-deps/package.json +1 -1
  36. package/npm-shrinkwrap.json +12 -12
  37. package/package.json +4 -4
@@ -1420,7 +1420,7 @@ export class AgentSession {
1420
1420
  }
1421
1421
  else {
1422
1422
  // Generate compaction result
1423
- const result = await compact(preparation, this.model, apiKey, headers, customInstructions, this._compactionAbortController.signal, this.thinkingLevel, this.agent.streamFunction, env);
1423
+ const result = await compact(preparation, this.model, apiKey, headers, customInstructions, this._compactionAbortController.signal, this.thinkingLevel, this.agent.streamFunction, env, this.settingsManager.getRetrySettings(), this._summarizationRetryCallbacks({ source: "compaction", reason: "manual" }));
1424
1424
  summary = result.summary;
1425
1425
  firstKeptEntryId = result.firstKeptEntryId;
1426
1426
  tokensBefore = result.tokensBefore;
@@ -1659,7 +1659,7 @@ export class AgentSession {
1659
1659
  }
1660
1660
  else {
1661
1661
  // Generate compaction result
1662
- const compactResult = await compact(preparation, this.model, apiKey, headers, undefined, this._autoCompactionAbortController.signal, this.thinkingLevel, this.agent.streamFunction, env);
1662
+ const compactResult = await compact(preparation, this.model, apiKey, headers, undefined, this._autoCompactionAbortController.signal, this.thinkingLevel, this.agent.streamFunction, env, this.settingsManager.getRetrySettings(), this._summarizationRetryCallbacks({ source: "compaction", reason }));
1663
1663
  summary = compactResult.summary;
1664
1664
  firstKeptEntryId = compactResult.firstKeptEntryId;
1665
1665
  tokensBefore = compactResult.tokensBefore;
@@ -2088,6 +2088,34 @@ export class AgentSession {
2088
2088
  return false;
2089
2089
  return isRetryableAssistantError(message);
2090
2090
  }
2091
+ /**
2092
+ * Retry policy + callbacks shared by compaction and branch-summary summarization calls.
2093
+ * Uses the same `settings.retry` budget/backoff as agent-turn retries so a single transient
2094
+ * stream drop no longer fails the whole operation. `source` carries the context
2095
+ * the TUI needs to render the retry and recreate the underlying indicator.
2096
+ */
2097
+ _summarizationRetryCallbacks(source) {
2098
+ return {
2099
+ onRetryScheduled: (attempt, maxAttempts, delayMs, errorMessage) => {
2100
+ this._emit({
2101
+ type: "summarization_retry_scheduled",
2102
+ attempt,
2103
+ maxAttempts,
2104
+ delayMs,
2105
+ errorMessage,
2106
+ });
2107
+ },
2108
+ onRetryAttemptStart: () => {
2109
+ this._emit({
2110
+ type: "summarization_retry_attempt_start",
2111
+ ...source,
2112
+ });
2113
+ },
2114
+ onRetryFinished: () => {
2115
+ this._emit({ type: "summarization_retry_finished" });
2116
+ },
2117
+ };
2118
+ }
2091
2119
  /**
2092
2120
  * Prepare a retryable error for continuation with exponential backoff.
2093
2121
  * @returns true if the caller should continue the agent, false otherwise
@@ -2348,6 +2376,8 @@ export class AgentSession {
2348
2376
  replaceInstructions,
2349
2377
  reserveTokens: branchSummarySettings.reserveTokens,
2350
2378
  streamFn: this.agent.streamFunction,
2379
+ retry: this.settingsManager.getRetrySettings(),
2380
+ callbacks: this._summarizationRetryCallbacks({ source: "branchSummary" }),
2351
2381
  });
2352
2382
  if (result.aborted) {
2353
2383
  return { cancelled: true, aborted: true };