dsh-github-copilot 0.4.0-alpha.99 → 0.4.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 (110) hide show
  1. package/AGENTS.md +104 -16
  2. package/CHANGELOG.md +223 -0
  3. package/CONTRIBUTING.md +9 -0
  4. package/README.md +108 -18
  5. package/README.zh.md +99 -18
  6. package/deployment-baseline.json +227 -8
  7. package/docs/account-management-experience.md +143 -0
  8. package/docs/auto-high-cost.md +154 -0
  9. package/docs/auto-iteration-review.json +22 -0
  10. package/docs/auto-review-sampling.md +60 -0
  11. package/docs/auto-task-routing.md +8 -6
  12. package/docs/automatic-model-routing.md +33 -5
  13. package/docs/copilot-accounts.md +409 -0
  14. package/docs/copilot-compaction.md +23 -2
  15. package/docs/copilot-usage.md +24 -4
  16. package/docs/evidence-driven-iteration.md +86 -0
  17. package/docs/images/copilot-accounts-credits.png +0 -0
  18. package/docs/images/copilot-accounts.png +0 -0
  19. package/docs/images/copilot-current-provenance.json +39 -0
  20. package/docs/images/copilot-model-preferences.png +0 -0
  21. package/docs/images/copilot-search-routing.png +0 -0
  22. package/docs/images/copilot-session-continuation.png +0 -0
  23. package/docs/manual-compaction-recovery.md +50 -7
  24. package/docs/mockups/copilot-account-dropdown.html +71 -0
  25. package/docs/mockups/copilot-account-management.html +393 -0
  26. package/docs/model-compatibility-acceptance.md +34 -16
  27. package/docs/npm-distribution.md +9 -1
  28. package/docs/official-first-020-rc2.md +1 -0
  29. package/docs/plugin-diagnostics.md +452 -0
  30. package/docs/session-continuation.md +141 -0
  31. package/docs/session-search-routing.md +1 -1
  32. package/docs/single-route-migration.md +5 -4
  33. package/lib/client.js +4415 -846
  34. package/lib/client.js.map +1 -1
  35. package/lib/diagnostics-analysis-io.js +78 -0
  36. package/lib/diagnostics-analysis.js +425 -0
  37. package/lib/diagnostics-types-FVf6zjob.js +182 -0
  38. package/lib/index.js +10455 -6037
  39. package/lib/manual-compaction-recovery.js +163 -38
  40. package/lib/remote.js +593 -34
  41. package/lib/routed-web.js +1 -1
  42. package/lib/{search-routing-jzNYveyK.js → search-routing-CV2hs8as.js} +139 -139
  43. package/lib/types/account-dropdown.d.ts +22 -0
  44. package/lib/types/account-model-auth.d.ts +1 -1
  45. package/lib/types/authorization-code-clipboard.d.ts +4 -0
  46. package/lib/types/authorization-controller.d.ts +2 -0
  47. package/lib/types/auto-allocation-card.d.ts +9 -0
  48. package/lib/types/auto-allocation-evidence.d.ts +38 -0
  49. package/lib/types/auto-allocation.d.ts +24 -0
  50. package/lib/types/auto-model-host.d.ts +2 -0
  51. package/lib/types/auto-model-routing.d.ts +6 -2
  52. package/lib/types/auto-review-sampling.d.ts +6 -0
  53. package/lib/types/auto-task-classifier.d.ts +1 -1
  54. package/lib/types/background-compaction.d.ts +2 -2
  55. package/lib/types/client.d.ts +19 -3
  56. package/lib/types/compaction-continuation-ui.d.ts +29 -0
  57. package/lib/types/compaction-continuation.d.ts +48 -0
  58. package/lib/types/compaction-input-estimate.d.ts +24 -0
  59. package/lib/types/compaction-replay.d.ts +18 -0
  60. package/lib/types/composer-notice-style.d.ts +7 -0
  61. package/lib/types/config.d.ts +42 -2
  62. package/lib/types/context-evidence-ui.d.ts +18 -1
  63. package/lib/types/context-evidence.d.ts +152 -4
  64. package/lib/types/copilot-account-presentation.d.ts +7 -0
  65. package/lib/types/copilot-accounts-card.d.ts +43 -0
  66. package/lib/types/copilot-accounts-host.d.ts +93 -0
  67. package/lib/types/copilot-accounts-remote.d.ts +85 -0
  68. package/lib/types/copilot-accounts-types.d.ts +43 -0
  69. package/lib/types/copilot-auth.d.ts +9 -2
  70. package/lib/types/copilot-usage-card.d.ts +23 -0
  71. package/lib/types/copilot-usage-host.d.ts +9 -1
  72. package/lib/types/copilot-usage-remote.d.ts +2 -1
  73. package/lib/types/copilot-usage-types.d.ts +1 -0
  74. package/lib/types/diagnostics-analysis-io.d.ts +23 -0
  75. package/lib/types/diagnostics-analysis.d.ts +295 -0
  76. package/lib/types/diagnostics-card.d.ts +11 -0
  77. package/lib/types/diagnostics-client.d.ts +13 -0
  78. package/lib/types/diagnostics-collector.d.ts +36 -0
  79. package/lib/types/diagnostics-host.d.ts +72 -0
  80. package/lib/types/diagnostics-remote.d.ts +109 -0
  81. package/lib/types/diagnostics-types.d.ts +431 -0
  82. package/lib/types/manual-compaction-recovery.d.ts +18 -3
  83. package/lib/types/model-preferences-card.d.ts +1 -1
  84. package/lib/types/native-settings-style.d.ts +10 -0
  85. package/lib/types/parent-model-follow-card.d.ts +2 -11
  86. package/lib/types/preview-provider.d.ts +5 -0
  87. package/lib/types/preview-route.d.ts +7 -5
  88. package/lib/types/remote.d.ts +9 -6
  89. package/lib/types/replay-recovery-host.d.ts +2 -2
  90. package/lib/types/replay-recovery-ui.d.ts +3 -1
  91. package/lib/types/request-body-evidence.d.ts +3 -1
  92. package/lib/types/responses-replay-compat.d.ts +2 -1
  93. package/lib/types/responses-request-compression.d.ts +33 -0
  94. package/lib/types/session-accounts-controller.d.ts +20 -0
  95. package/lib/types/session-accounts-host.d.ts +33 -0
  96. package/lib/types/session-accounts-remote.d.ts +114 -0
  97. package/lib/types/session-accounts.d.ts +38 -0
  98. package/lib/types/session-continuation-host.d.ts +45 -0
  99. package/lib/types/session-continuation-remote.d.ts +22 -0
  100. package/lib/types/session-continuation-types.d.ts +62 -0
  101. package/lib/types/session-continuation-ui.d.ts +49 -0
  102. package/lib/types/session-continuation.d.ts +14 -0
  103. package/lib/types/turn-request-models.d.ts +55 -0
  104. package/lib/types/turn-selection-card.d.ts +15 -1
  105. package/lib/types/turn-selection-host.d.ts +23 -0
  106. package/lib/types/turn-selection-remote.d.ts +4 -0
  107. package/lib/types/turn-selection.d.ts +19 -4
  108. package/package.json +29 -12
  109. package/scripts/analyze-diagnostics.mjs +91 -0
  110. package/scripts/iteration-review.mjs +53 -0
@@ -1,12 +1,38 @@
1
+ import { d as diagnosticsReason, u as diagnosticsOutcome } from "./diagnostics-types-FVf6zjob.js";
1
2
  import "./copilot-identity-DRZY_d2X.js";
2
3
  import { i as resolveRequestBudgetPolicy, r as calculateRequestBudget } from "./request-budget-DLY_aRq0.js";
3
- import { createUserMessage } from "@deepseek-ai/dsh-llm";
4
+ import z from "@deepseek-ai/schemastery";
5
+ import { LlmError, createUserMessage } from "@deepseek-ai/dsh-llm";
4
6
  import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
5
7
  import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
6
8
  //#region lib/types/background-compaction.js
7
9
  const WAIT_MS = 2147483647;
8
- const USAGE = "Usage: /copilot-compact [status|cancel]";
10
+ const USAGE = "Usage: /copilot-compact [status|cancel|visible-history]. visible-history authorizes one lossy summary without old encrypted reasoning or its embedded summaries; stored source history is unchanged.";
9
11
  const FAILED = "COPILOT_BACKGROUND_COMPACTION_FAILED: inspect the native compaction/end record; no success is implied.";
12
+ function failureDetail(cause) {
13
+ const allowed = /* @__PURE__ */ new Set([
14
+ "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH",
15
+ "COPILOT_RESPONSES_REPLAY_UNSUPPORTED",
16
+ "COPILOT_RESPONSES_REPLAY_INVALID_PAYLOAD",
17
+ "CONTEXT_WINDOW_EXCEEDED",
18
+ "COPILOT_MANUAL_RECOVERY_ACCOUNT_PROOF_UNAVAILABLE",
19
+ "COPILOT_MANUAL_RECOVERY_FIXED_PREFIX",
20
+ "COPILOT_MANUAL_RECOVERY_INDIVISIBLE",
21
+ "COPILOT_MANUAL_RECOVERY_CALL_LIMIT",
22
+ "COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY",
23
+ "COPILOT_MANUAL_RECOVERY_UNBALANCED",
24
+ "COPILOT_COMPACTION_REPLAY_UNAVAILABLE",
25
+ "COPILOT_COMPACTION_REPLAY_REVOKED"
26
+ ]);
27
+ const visited = /* @__PURE__ */ new Set();
28
+ for (let depth = 0; depth < 8 && cause instanceof Error && !visited.has(cause); depth++) {
29
+ visited.add(cause);
30
+ const code = /^[A-Z][A-Z_]+(?=:|$)/.exec(cause.message)?.[0];
31
+ if (code && allowed.has(code)) return `${code}: compaction failed; stored source history is unchanged.${code === "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH" ? " Review loss of hidden context before explicitly using /copilot-compact visible-history. No automatic retry." : ""} Inspect the native compaction/end record.`;
32
+ cause = cause.cause;
33
+ }
34
+ return FAILED;
35
+ }
10
36
  /** Own only admission and job lifetime; the selected engine owns all history transactions. */
11
37
  var BackgroundCompaction = class {
12
38
  jobs;
@@ -30,12 +56,12 @@ var BackgroundCompaction = class {
30
56
  text: "Compaction admission cancelled."
31
57
  };
32
58
  const action = rawInput.trim();
33
- if (action !== "" && action !== "status" && action !== "cancel") return {
59
+ if (action !== "" && action !== "status" && action !== "cancel" && action !== "visible-history") return {
34
60
  kind: "error",
35
61
  text: USAGE
36
62
  };
37
63
  const id = this.latest.get(agent);
38
- if (action !== "") {
64
+ if (action === "status" || action === "cancel") {
39
65
  if (id === void 0) return {
40
66
  kind: "error",
41
67
  text: "No background compaction job for this Session."
@@ -74,20 +100,21 @@ var BackgroundCompaction = class {
74
100
  done = Promise.resolve().then(async () => {
75
101
  try {
76
102
  cancel.signal.throwIfAborted();
77
- const result = await this.compact(agent, cancel.signal);
103
+ const result = await this.compact(agent, cancel.signal, action === "visible-history");
78
104
  return {
79
105
  status: "completed",
80
106
  detail: result === null ? "No compactable history." : `Compacted ${result.shadowedSeqs.length} history items (~${result.shadowedTokenCount} tokens).`
81
107
  };
82
- } catch {
108
+ } catch (cause) {
83
109
  if (cancel.signal.aborted) return {
84
110
  status: "killed",
85
111
  detail: "Compaction cancelled; inspect native history for its transaction outcome."
86
112
  };
87
- this.warn(FAILED);
113
+ const detail = failureDetail(cause);
114
+ this.warn(detail);
88
115
  return {
89
116
  status: "failed",
90
- detail: FAILED
117
+ detail
91
118
  };
92
119
  } finally {
93
120
  this.active.delete(agent);
@@ -146,12 +173,67 @@ function installBackgroundCompaction(ctx, compact) {
146
173
  definitionId: CommandDefinitionId("dsh-github-copilot/background-compaction"),
147
174
  name: "copilot-compact",
148
175
  description: "Start background manual compaction, inspect status, or cancel",
149
- input: { hint: "status | cancel (omit to start)" },
176
+ input: { hint: "status | cancel | visible-history (explicit lossy recovery; omit for normal compaction)" },
150
177
  handler: (invocation) => controller.execute(invocation.agent, invocation.rawInput, invocation.signal)
151
178
  });
152
179
  }, "Copilot background compaction");
153
180
  }
154
181
  //#endregion
182
+ //#region lib/types/compaction-input-estimate.js
183
+ function compactionSafeBoundaries(messages) {
184
+ const pending = /* @__PURE__ */ new Set();
185
+ const boundaries = [0];
186
+ for (let index = 0; index < messages.length; index++) {
187
+ const message = messages[index];
188
+ if (message.role === "assistant") for (const block of message.content) {
189
+ if (block.type !== "tool-call") continue;
190
+ if (!block.id || pending.has(block.id)) throw new Error("COPILOT_MANUAL_RECOVERY_UNBALANCED");
191
+ pending.add(block.id);
192
+ }
193
+ if (message.role === "tool" && (!message.toolCallId || !pending.delete(message.toolCallId))) throw new Error("COPILOT_MANUAL_RECOVERY_UNBALANCED");
194
+ if (pending.size === 0) boundaries.push(index + 1);
195
+ }
196
+ if (pending.size !== 0) throw new Error("COPILOT_MANUAL_RECOVERY_UNBALANCED");
197
+ return boundaries;
198
+ }
199
+ /**
200
+ * Conservative content-byte planning, not provider-exact token accounting.
201
+ * Native admission still checks converted replay, images and the full request.
202
+ */
203
+ function estimateCompactionInputBytes(input) {
204
+ return Buffer.byteLength(JSON.stringify({
205
+ tools: input.tools,
206
+ messages: input.messages.map((message) => ({
207
+ role: message.role,
208
+ content: message.content,
209
+ ...message.role === "tool" ? {
210
+ toolCallId: message.toolCallId,
211
+ isError: message.isError
212
+ } : {}
213
+ }))
214
+ }), "utf8");
215
+ }
216
+ function reduceCompactionInputLimit(input, inputLimit) {
217
+ const originalSize = estimateCompactionInputBytes(input);
218
+ const fixedSize = estimateCompactionInputBytes({
219
+ tools: input.tools,
220
+ messages: input.messages[0]?.role === "system" ? input.messages.slice(0, 1) : []
221
+ });
222
+ const prefix = input.messages[0]?.role === "system" ? input.messages.slice(0, 1) : [];
223
+ const messages = input.messages.slice(prefix.length);
224
+ let start = 0;
225
+ let minimum = fixedSize;
226
+ for (const end of compactionSafeBoundaries(messages).slice(1)) {
227
+ minimum = Math.max(minimum, estimateCompactionInputBytes({
228
+ tools: input.tools,
229
+ messages: [...prefix, ...messages.slice(start, end)]
230
+ }));
231
+ start = end;
232
+ }
233
+ if (minimum >= originalSize) throw new Error("COPILOT_MANUAL_RECOVERY_INDIVISIBLE");
234
+ return Math.min(inputLimit, Math.max(minimum, fixedSize + Math.floor((originalSize - fixedSize) / 2)));
235
+ }
236
+ //#endregion
155
237
  //#region lib/types/manual-compaction-recovery.js
156
238
  function recoverError(code) {
157
239
  return /* @__PURE__ */ new Error(`COPILOT_MANUAL_RECOVERY_${code}`);
@@ -169,7 +251,7 @@ function sumUsage(usages) {
169
251
  };
170
252
  }
171
253
  /**
172
- * Bounded, explicit manual-only map/fold. The native engine still owns the only
254
+ * Bounded map/fold. The native engine still owns the only
173
255
  * durable transaction, source-stability check, shrink check and cancellation.
174
256
  */
175
257
  async function summarizeOversizedManualInput(options) {
@@ -179,22 +261,7 @@ async function summarizeOversizedManualInput(options) {
179
261
  const prefix = input.messages[0]?.role === "system" ? input.messages.slice(0, 1) : [];
180
262
  const messages = input.messages.slice(prefix.length);
181
263
  if (messages.length === 0) throw recoverError("NO_HISTORY");
182
- const pending = /* @__PURE__ */ new Set();
183
- const safeBoundaries = /* @__PURE__ */ new Set([0]);
184
- for (let index = 0; index < messages.length; index++) {
185
- const message = messages[index];
186
- if (message.role === "assistant") {
187
- for (const block of message.content) if (block.type === "tool-call") {
188
- if (!block.id || pending.has(block.id)) throw recoverError("UNBALANCED");
189
- pending.add(block.id);
190
- }
191
- }
192
- if (message.role === "tool") {
193
- if (!message.toolCallId || !pending.delete(message.toolCallId)) throw recoverError("UNBALANCED");
194
- }
195
- if (pending.size === 0) safeBoundaries.add(index + 1);
196
- }
197
- if (pending.size !== 0) throw recoverError("UNBALANCED");
264
+ const safeBoundaries = new Set(compactionSafeBoundaries(messages));
198
265
  let previous;
199
266
  let offset = 0;
200
267
  let calls = 0;
@@ -244,11 +311,22 @@ async function summarizeOversizedManualInput(options) {
244
311
  * mount both: Cordis compaction is a singleton, not an overridable service.
245
312
  */
246
313
  var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine {
314
+ static Config = z.intersect([BasicCompactionEngine.Config, z.object({ automaticRecovery: z.boolean().default(true) })]);
247
315
  manual = /* @__PURE__ */ new WeakMap();
316
+ visibleHistory = /* @__PURE__ */ new WeakSet();
317
+ automaticRecovery;
248
318
  constructor(ctx, config = {}) {
249
- super(ctx, config);
319
+ const { automaticRecovery = true, ...nativeConfig } = config;
320
+ if (typeof automaticRecovery !== "boolean") throw recoverError("INVALID_POLICY");
321
+ super(ctx, nativeConfig);
322
+ this.automaticRecovery = automaticRecovery;
250
323
  ctx.inject(["commands", "jobs"], (scope) => {
251
- installBackgroundCompaction(scope, (agent, signal) => this.compactNow(agent, signal));
324
+ installBackgroundCompaction(scope, (agent, signal, visibleHistory) => {
325
+ if (!visibleHistory) return this.compactNow(agent, signal);
326
+ if (this.manual.has(agent)) throw recoverError("BUSY");
327
+ this.visibleHistory.add(agent);
328
+ return this.compactNow(agent, signal).finally(() => this.visibleHistory.delete(agent));
329
+ });
252
330
  });
253
331
  }
254
332
  async compactNow(agent, signal, sourceCommandId) {
@@ -263,7 +341,8 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
263
341
  }
264
342
  async summarize(input, agent, signal) {
265
343
  const routed = agent.session.requestHeader()?.config;
266
- const policy = this.config.modelPolicies.find((item) => item.provider === routed?.provider && item.model === routed.model);
344
+ const target = routed?.provider && routed.model ? routed : agent.options;
345
+ const policy = this.config.modelPolicies.find((item) => item.provider === target.provider && item.model === target.model);
267
346
  const configuredProvider = policy?.summarizationProvider ?? this.config.summarizationProvider;
268
347
  const configuredModel = policy?.summarizationModel ?? this.config.summarizationModel;
269
348
  const selected = configuredProvider.length > 0 ? {
@@ -275,23 +354,64 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
275
354
  };
276
355
  const summaryProvider = selected.provider;
277
356
  const summaryModel = selected.model;
278
- if (!this.manual.has(agent) || summaryProvider !== "github-copilot-preview" || !summaryModel) return super.summarize(input, agent, signal);
279
- const lease = this.ctx.get("githubCopilotPreview")?.recoveryLimits(summaryModel);
280
- if (lease === void 0) throw recoverError("ACCOUNT_PROOF_UNAVAILABLE");
357
+ if (!this.manual.has(agent) && !this.automaticRecovery || summaryProvider !== "github-copilot-preview" || !summaryModel) {
358
+ if (this.visibleHistory.has(agent)) throw new Error("COPILOT_COMPACTION_REPLAY_UNAVAILABLE");
359
+ return super.summarize(input, agent, signal);
360
+ }
281
361
  const maxTokens = policy?.maxTokens ?? this.config.maxTokens;
362
+ const operationSignal = signal ?? new AbortController().signal;
363
+ const summarize = () => this.summarizeManaged(input, agent, summaryModel, maxTokens, operationSignal);
364
+ if (!this.visibleHistory.has(agent)) return summarize();
365
+ const recovery = this.ctx.get("githubCopilotCompactionReplay");
366
+ if (!recovery) throw new Error("COPILOT_COMPACTION_REPLAY_UNAVAILABLE");
367
+ return recovery.run(agent.session.id, summaryModel, operationSignal, summarize);
368
+ }
369
+ async summarizeManaged(input, agent, summaryModel, maxTokens, operationSignal) {
370
+ const lease = this.ctx.get("githubCopilotPreview")?.recoveryLimits(summaryModel, agent);
371
+ if (lease === void 0) throw recoverError("ACCOUNT_PROOF_UNAVAILABLE");
372
+ if (this.visibleHistory.has(agent) && lease.api !== "openai-responses") throw new Error("COPILOT_COMPACTION_REPLAY_UNAVAILABLE");
373
+ const agents = this.ctx.get("agents");
374
+ if (this.ctx.get("githubCopilotSessionAccounts") !== void 0 && agents === void 0) throw recoverError("INITIATOR_UNAVAILABLE");
375
+ const summarize = async (candidate) => {
376
+ const observed = this.ctx.get("githubCopilotDiagnostics")?.collector.begin("compaction-summary");
377
+ observed?.stage("summary-attempt");
378
+ try {
379
+ const result = await (agents === void 0 ? super.summarize(candidate, agent, operationSignal) : agents.withInitiator(agent, () => super.summarize(candidate, agent, operationSignal)));
380
+ observed?.finish("success");
381
+ return result;
382
+ } catch (error) {
383
+ const reason = diagnosticsReason(error);
384
+ if (operationSignal.aborted) this.ctx.get("githubCopilotDiagnostics")?.markCompactionCancelled(agent.session);
385
+ observed?.finish(operationSignal.aborted ? "cancelled" : diagnosticsOutcome(reason), reason);
386
+ throw error;
387
+ }
388
+ };
282
389
  const budget = calculateRequestBudget(lease.limits, maxTokens, resolveRequestBudgetPolicy(lease.policy));
283
390
  if (!budget.ok) throw recoverError(budget.code);
284
391
  const toolHistoryBytes = Buffer.byteLength(JSON.stringify(agent.session.toolHistory()), "utf8");
285
- const inputLimit = budget.budget.hardInputLimit - 4096 - toolHistoryBytes;
392
+ let inputLimit = budget.budget.hardInputLimit - 4096 - toolHistoryBytes;
286
393
  if (inputLimit <= 0) throw recoverError("FIXED_PREFIX");
287
- const operationSignal = signal ?? new AbortController().signal;
288
- const estimate = (candidate) => Buffer.byteLength(JSON.stringify(candidate), "utf8");
289
- if (estimate(input) <= inputLimit) return super.summarize(input, agent, signal);
290
- return summarizeOversizedManualInput({
394
+ const estimate = estimateCompactionInputBytes;
395
+ operationSignal.throwIfAborted();
396
+ lease.assertCurrent();
397
+ const originalSize = estimate(input);
398
+ let failedAttempt = false;
399
+ if (originalSize <= inputLimit) try {
400
+ return await summarize(input);
401
+ } catch (error) {
402
+ operationSignal.throwIfAborted();
403
+ if (!(error instanceof LlmError) || error.code !== "CONTEXT_WINDOW_EXCEEDED") throw error;
404
+ lease.assertCurrent();
405
+ inputLimit = reduceCompactionInputLimit(input, inputLimit);
406
+ failedAttempt = true;
407
+ }
408
+ this.ctx.logger.info("[github-copilot] Segmented compaction recovery started; up to %d additional model calls.", failedAttempt ? 15 : 16);
409
+ const result = await summarizeOversizedManualInput({
291
410
  input,
292
411
  inputLimit,
293
412
  signal: operationSignal,
294
413
  estimate,
414
+ maxCalls: failedAttempt ? 15 : 16,
295
415
  assertCurrent: lease.assertCurrent,
296
416
  makeCheckpoint: (summary) => createUserMessage({
297
417
  source: { kind: "user" },
@@ -307,8 +427,13 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
307
427
  }
308
428
  ]
309
429
  }),
310
- summarize: (candidate) => super.summarize(candidate, agent, signal)
430
+ summarize
311
431
  });
432
+ if (failedAttempt) {
433
+ const { usage: _usage, ...unaccounted } = result;
434
+ return unaccounted;
435
+ }
436
+ return result;
312
437
  }
313
438
  };
314
439
  //#endregion