@aexol/spectral 0.9.184 → 0.9.185

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 (52) hide show
  1. package/dist/agent/index.d.ts.map +1 -1
  2. package/dist/agent/index.js +8 -2
  3. package/dist/memory/branch.d.ts +13 -0
  4. package/dist/memory/branch.d.ts.map +1 -1
  5. package/dist/memory/branch.js +100 -0
  6. package/dist/memory/hooks/compaction-hook.d.ts.map +1 -1
  7. package/dist/memory/hooks/compaction-hook.js +43 -1
  8. package/dist/memory/hooks/observer-trigger.d.ts.map +1 -1
  9. package/dist/memory/hooks/observer-trigger.js +9 -3
  10. package/dist/memory/index.d.ts +13 -0
  11. package/dist/memory/index.d.ts.map +1 -1
  12. package/dist/memory/index.js +17 -26
  13. package/dist/memory/project-observation-memory.d.ts +16 -0
  14. package/dist/memory/project-observation-memory.d.ts.map +1 -0
  15. package/dist/memory/project-observation-memory.js +27 -0
  16. package/dist/memory/project-observations-store.d.ts +8 -0
  17. package/dist/memory/project-observations-store.d.ts.map +1 -1
  18. package/dist/memory/project-observations-store.js +5 -0
  19. package/dist/memory/prompts.d.ts +2 -2
  20. package/dist/memory/prompts.d.ts.map +1 -1
  21. package/dist/memory/prompts.js +1 -1
  22. package/dist/memory/session-memory.d.ts +21 -0
  23. package/dist/memory/session-memory.d.ts.map +1 -0
  24. package/dist/memory/session-memory.js +33 -0
  25. package/dist/memory/tool-output-compressor.d.ts +0 -1
  26. package/dist/memory/tool-output-compressor.d.ts.map +1 -1
  27. package/dist/memory/tool-output-compressor.js +0 -1
  28. package/dist/memory/tools/compact-context.d.ts +31 -0
  29. package/dist/memory/tools/compact-context.d.ts.map +1 -1
  30. package/dist/memory/tools/compact-context.js +187 -16
  31. package/dist/memory/tools/read-project-observations.d.ts.map +1 -1
  32. package/dist/memory/tools/read-project-observations.js +6 -3
  33. package/dist/memory/tools/recall-observation.d.ts.map +1 -1
  34. package/dist/memory/tools/recall-observation.js +18 -4
  35. package/dist/memory/tools/receive-agent-observations.d.ts.map +1 -1
  36. package/dist/memory/tools/receive-agent-observations.js +4 -2
  37. package/dist/memory/tools/share-project-observation.d.ts.map +1 -1
  38. package/dist/memory/tools/share-project-observation.js +5 -3
  39. package/dist/memory/tools/write-project-observation.d.ts.map +1 -1
  40. package/dist/memory/tools/write-project-observation.js +16 -3
  41. package/dist/sdk/coding-agent/core/compaction/compaction.d.ts +11 -0
  42. package/dist/sdk/coding-agent/core/compaction/compaction.d.ts.map +1 -1
  43. package/dist/sdk/coding-agent/core/compaction/compaction.js +13 -0
  44. package/dist/server/inter-agent-broker.d.ts +12 -7
  45. package/dist/server/inter-agent-broker.d.ts.map +1 -1
  46. package/dist/server/inter-agent-broker.js +12 -7
  47. package/dist/server/session-stream.d.ts.map +1 -1
  48. package/dist/server/session-stream.js +2 -0
  49. package/dist/server/storage.d.ts +14 -0
  50. package/dist/server/storage.d.ts.map +1 -1
  51. package/dist/server/storage.js +43 -0
  52. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ import { registerStatusCommand } from "./commands/status.js";
2
+ import { registerViewCommand } from "./commands/view.js";
3
+ import { registerCompactionHook } from "./hooks/compaction-hook.js";
4
+ import { registerCompactionTrigger } from "./hooks/compaction-trigger.js";
5
+ import { registerObserverTrigger } from "./hooks/observer-trigger.js";
6
+ import { registerToolOutputCompressor } from "./tool-output-compressor.js";
7
+ import { registerCompactContextTool } from "./tools/compact-context.js";
8
+ /**
9
+ * Session/branch memory layer.
10
+ *
11
+ * This layer owns the branch-scoped observational-memory pipeline:
12
+ * - the observer (`observer.ts` via `observer-trigger.ts`) extracts
13
+ * observations from new conversation turns;
14
+ * - the deterministic pruner (`deterministic-pruner.ts` via
15
+ * `compaction-hook.ts`) drops low-value observations at compaction time;
16
+ * - the summary render path (`compaction.ts`) produces the compacted memory
17
+ * that is persisted into `session_memory_snapshots`;
18
+ * - the snapshot persistence hooks (`compaction-hook.ts`,
19
+ * `compaction-trigger.ts`, `observer-trigger.ts`) keep that session memory
20
+ * alive across compactions.
21
+ *
22
+ * It is intentionally separate from `project-observation-memory.ts`, which
23
+ * owns the per-machine + per-cwd, cross-session project observation store.
24
+ */
25
+ export function registerSessionMemory(ext, runtime) {
26
+ registerObserverTrigger(ext, runtime);
27
+ registerCompactContextTool(ext, runtime);
28
+ registerCompactionTrigger(ext, runtime);
29
+ registerCompactionHook(ext, runtime);
30
+ registerToolOutputCompressor(ext, runtime);
31
+ registerStatusCommand(ext, runtime);
32
+ registerViewCommand(ext, runtime);
33
+ }
@@ -5,7 +5,6 @@
5
5
  * This is complementary to the conversation-level compaction pipeline:
6
6
  * - Compressor: compresses raw tool output (pre-context)
7
7
  * - Compaction: summarizes + prunes conversation history (post-context)
8
- * - Unified compaction: narrative summary + observation extraction (at compaction boundary)
9
8
  *
10
9
  * Strategies (mirroring RTK's four-pronged approach):
11
10
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tool-output-compressor.d.ts","sourceRoot":"","sources":["../../src/memory/tool-output-compressor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAEX,gBAAgB,EAIhB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAGN,KAAK,0BAA0B,EAC/B,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAO5C,MAAM,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAE1D,eAAO,MAAM,yBAAyB,EAAE,gBAEvC,CAAC;AAgsBF,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,8BAA8B;IAC9C,MAAM,EAAE,MAAM,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;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CAYvG;AAED,wBAAgB,4BAA4B,CAC3C,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,OAAO,GACd,IAAI,CAkCN"}
@@ -5,7 +5,6 @@
5
5
  * This is complementary to the conversation-level compaction pipeline:
6
6
  * - Compressor: compresses raw tool output (pre-context)
7
7
  * - Compaction: summarizes + prunes conversation history (post-context)
8
- * - Unified compaction: narrative summary + observation extraction (at compaction boundary)
9
8
  *
10
9
  * Strategies (mirroring RTK's four-pronged approach):
11
10
  *
@@ -3,7 +3,38 @@ import { type CompactionPolicy } from "../../sdk/coding-agent/core/compaction/in
3
3
  import { type ExtensionAPI } from "../../sdk/coding-agent/index.js";
4
4
  import type { Runtime } from "../runtime.js";
5
5
  export declare const COMPACT_CONTEXT_TOOL_NAME = "compact_context";
6
+ export interface AutoPruneFrozen {
7
+ /** Session identity used to invalidate the frozen cut after branch/session switches. */
8
+ branchId: string;
9
+ /** First kept entry id — the byte-stable cut point from the original prune. */
10
+ anchorEntryId: string;
11
+ /** Deterministic DCP-lite summary generated at the original prune. */
12
+ summary: string;
13
+ /** Number of provider messages covered by the original frozen boundary. */
14
+ frozenAtBoundaryEnd: number;
15
+ /** Raw token estimate at the moment the cut was frozen. */
16
+ rawTokensAtFreeze: number;
17
+ /** Original tokensBefore for the frozen compaction summary message. */
18
+ tokensBefore: number;
19
+ /** Original compaction timestamp for the frozen compaction summary message. */
20
+ timestamp: string;
21
+ /** Stable AgentMessage references for the frozen leading boundary. */
22
+ leadingMessageRefs: readonly AgentMessage[];
23
+ }
6
24
  /** Request-time DCP adapter for isolated loops: it borrows only pure policy helpers. */
7
25
  export declare function buildIsolatedRequestTimePrunedMessages(currentMessages: AgentMessage[], policy?: CompactionPolicy, keepRecentTokens?: number): AgentMessage[];
26
+ export interface IsolatedRequestTimePruneResult {
27
+ messages: AgentMessage[];
28
+ frozen: AutoPruneFrozen | null;
29
+ }
30
+ /**
31
+ * Stateful per-run variant of {@link buildIsolatedRequestTimePrunedMessages}.
32
+ *
33
+ * The subagent loop owns the returned `frozen` value across provider requests.
34
+ * On the first prune we freeze the deterministic summary + cut, then reuse that
35
+ * exact prefix until the leading message references change (which can only
36
+ * happen at the end of the isolated run).
37
+ */
38
+ export declare function buildIsolatedRequestTimePrunedMessagesResult(currentMessages: AgentMessage[], policy?: CompactionPolicy, keepRecentTokens?: number, frozen?: AutoPruneFrozen | null): IsolatedRequestTimePruneResult;
8
39
  export declare function registerCompactContextTool(ext: ExtensionAPI, runtime: Runtime): void;
9
40
  //# sourceMappingURL=compact-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compact-context.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/compact-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAUN,KAAK,gBAAgB,EACrB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAc,KAAK,YAAY,EAAyB,MAAM,iCAAiC,CAAC;AAKvG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAkX3D,wFAAwF;AACxF,wBAAgB,sCAAsC,CACrD,eAAe,EAAE,YAAY,EAAE,EAC/B,MAAM,GAAE,gBAA4C,EACpD,gBAAgB,CAAC,EAAE,MAAM,GACvB,YAAY,EAAE,CAchB;AAmRD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAgPpF"}
1
+ {"version":3,"file":"compact-context.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/compact-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MA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State(runtime) {
61
61
  request: null,
62
62
  turnCount: 0,
63
63
  lastAgentDrivenRequestTurn: null,
64
+ autoPruneFrozen: null,
64
65
  };
65
66
  stateByRuntime.set(runtime, state);
66
67
  }
@@ -241,12 +242,31 @@ function getRequestTimeCompactionSettings(request, policy) {
241
242
  function getBranchEntries(ctx) {
242
243
  return ctx.sessionManager.getBranch();
243
244
  }
244
- function createVirtualCompactionEntry(pathEntries, result) {
245
+ function getAutoPruneBranchId(ctx) {
246
+ try {
247
+ return ctx.sessionManager.getSessionId();
248
+ }
249
+ catch {
250
+ return "unknown-session";
251
+ }
252
+ }
253
+ function autoPruneIdentityMatches(frozen, branchId, currentMessages) {
254
+ if (frozen.branchId !== branchId)
255
+ return false;
256
+ if (frozen.frozenAtBoundaryEnd > currentMessages.length)
257
+ return false;
258
+ for (let index = 0; index < frozen.frozenAtBoundaryEnd; index += 1) {
259
+ if (currentMessages[index] !== frozen.leadingMessageRefs[index])
260
+ return false;
261
+ }
262
+ return true;
263
+ }
264
+ function createVirtualCompactionEntry(pathEntries, result, timestamp) {
245
265
  return {
246
266
  type: "compaction",
247
267
  id: REQUEST_TIME_VIRTUAL_COMPACTION_ID,
248
268
  parentId: pathEntries[pathEntries.length - 1]?.id ?? null,
249
- timestamp: pathEntries[pathEntries.length - 1]?.timestamp ?? new Date().toISOString(),
269
+ timestamp: timestamp ?? pathEntries[pathEntries.length - 1]?.timestamp ?? new Date().toISOString(),
250
270
  summary: result.summary,
251
271
  firstKeptEntryId: result.firstKeptEntryId,
252
272
  tokensBefore: result.tokensBefore,
@@ -254,7 +274,7 @@ function createVirtualCompactionEntry(pathEntries, result) {
254
274
  fromHook: false,
255
275
  };
256
276
  }
257
- function buildRequestTimePrunedMessages(ctx, request, policy, currentMessages, onFailure) {
277
+ function buildRequestTimePrunedMessages(ctx, request, policy, currentMessages, onFailure, frozen) {
258
278
  // During an active provider request the event payload is the source of truth.
259
279
  // The session branch can lag behind it (notably while a tool result or the
260
280
  // current assistant turn is still being appended), which used to make the
@@ -269,13 +289,24 @@ function buildRequestTimePrunedMessages(ctx, request, policy, currentMessages, o
269
289
  timestamp: new Date(index).toISOString(),
270
290
  message,
271
291
  }));
272
- const fromCurrentMessages = buildRequestTimePrunedMessagesFromEntries(currentEntries, request, policy, currentMessages, onFailure);
292
+ const fromCurrentMessages = buildRequestTimePrunedMessagesFromEntries(currentEntries, request, policy, currentMessages, onFailure, frozen);
273
293
  if (fromCurrentMessages)
274
294
  return fromCurrentMessages;
275
- return buildRequestTimePrunedMessagesFromEntries(getBranchEntries(ctx), request, policy, currentMessages, onFailure);
295
+ return buildRequestTimePrunedMessagesFromEntries(getBranchEntries(ctx), request, policy, currentMessages, onFailure, frozen);
276
296
  }
277
297
  /** Request-time DCP adapter for isolated loops: it borrows only pure policy helpers. */
278
298
  export function buildIsolatedRequestTimePrunedMessages(currentMessages, policy = DEFAULT_COMPACTION_POLICY, keepRecentTokens) {
299
+ return buildIsolatedRequestTimePrunedMessagesResult(currentMessages, policy, keepRecentTokens).messages;
300
+ }
301
+ /**
302
+ * Stateful per-run variant of {@link buildIsolatedRequestTimePrunedMessages}.
303
+ *
304
+ * The subagent loop owns the returned `frozen` value across provider requests.
305
+ * On the first prune we freeze the deterministic summary + cut, then reuse that
306
+ * exact prefix until the leading message references change (which can only
307
+ * happen at the end of the isolated run).
308
+ */
309
+ export function buildIsolatedRequestTimePrunedMessagesResult(currentMessages, policy = DEFAULT_COMPACTION_POLICY, keepRecentTokens, frozen) {
279
310
  const syntheticEntries = currentMessages.map((message, index) => ({
280
311
  type: "message",
281
312
  id: `isolated-${index}`,
@@ -283,18 +314,89 @@ export function buildIsolatedRequestTimePrunedMessages(currentMessages, policy =
283
314
  timestamp: new Date(index).toISOString(),
284
315
  message,
285
316
  }));
286
- return buildRequestTimePrunedMessagesFromEntries(syntheticEntries, { source: "auto", mode: "request_time", scope: "older_history", keepRecentTokens, phaseBoundary: false, minRawTokens: 0, pinLatestUserMessage: true }, policy, currentMessages)?.messages ?? currentMessages;
317
+ const request = {
318
+ source: "auto",
319
+ mode: "request_time",
320
+ scope: "older_history",
321
+ keepRecentTokens,
322
+ phaseBoundary: false,
323
+ minRawTokens: 0,
324
+ pinLatestUserMessage: true,
325
+ };
326
+ const branchId = "isolated-subagent-run";
327
+ if (frozen && autoPruneIdentityMatches(frozen, branchId, currentMessages)) {
328
+ const reused = buildRequestTimePrunedMessagesFromEntries(syntheticEntries, request, policy, currentMessages, undefined, frozen);
329
+ if (reused)
330
+ return { messages: reused.messages, frozen };
331
+ }
332
+ const pruned = buildRequestTimePrunedMessagesFromEntries(syntheticEntries, request, policy, currentMessages);
333
+ if (!pruned || typeof pruned.anchorEntryId !== "string" || typeof pruned.summary !== "string") {
334
+ return { messages: currentMessages, frozen: null };
335
+ }
336
+ const nextFrozen = {
337
+ branchId,
338
+ anchorEntryId: pruned.anchorEntryId,
339
+ summary: pruned.summary,
340
+ frozenAtBoundaryEnd: currentMessages.length,
341
+ rawTokensAtFreeze: rawTokensForCurrentMessages(currentMessages),
342
+ tokensBefore: pruned.tokensBefore ?? 0,
343
+ timestamp: pruned.timestamp ?? new Date().toISOString(),
344
+ leadingMessageRefs: currentMessages.slice(),
345
+ };
346
+ return { messages: pruned.messages, frozen: nextFrozen };
287
347
  }
288
- function buildRequestTimePrunedMessagesFromEntries(pathEntries, request, policy, currentMessages, onFailure) {
348
+ function buildRequestTimePrunedMessagesFromEntries(pathEntries, request, policy, currentMessages, onFailure, frozen) {
289
349
  const settings = getRequestTimeCompactionSettings(request, policy);
290
- const preparation = prepareCompaction(pathEntries, settings, { phaseBoundary: request.phaseBoundary, pinLatestUserMessage: request.pinLatestUserMessage });
291
- if (!preparation) {
292
- onFailure?.("prepare_compaction_returned_undefined");
293
- return undefined;
350
+ let summary;
351
+ let firstKeptEntryId;
352
+ let tokensBefore;
353
+ let details;
354
+ let tokensRemoved;
355
+ if (frozen) {
356
+ // Reuse the frozen cut. We still run prepareCompaction with an explicit
357
+ // anchor so the fixed boundary is validated against the current path,
358
+ // but we intentionally do NOT regenerate the summary (that would change
359
+ // the prompt-cache prefix on every request).
360
+ const preparation = prepareCompaction(pathEntries, settings, {
361
+ phaseBoundary: request.phaseBoundary,
362
+ pinLatestUserMessage: request.pinLatestUserMessage,
363
+ anchorEntryId: frozen.anchorEntryId,
364
+ });
365
+ if (!preparation || preparation.firstKeptEntryId !== frozen.anchorEntryId) {
366
+ onFailure?.(`frozen_anchor_not_found:${frozen.anchorEntryId}`);
367
+ return undefined;
368
+ }
369
+ summary = frozen.summary;
370
+ firstKeptEntryId = frozen.anchorEntryId;
371
+ tokensBefore = frozen.tokensBefore;
372
+ details = undefined;
373
+ tokensRemoved = 0;
294
374
  }
295
- const result = compactDcpLite(preparation);
296
- const tokensRemoved = Math.max(0, result.tokensRemoved ?? 0);
297
- const virtualCompaction = createVirtualCompactionEntry(pathEntries, result);
375
+ else {
376
+ const preparation = prepareCompaction(pathEntries, settings, {
377
+ phaseBoundary: request.phaseBoundary,
378
+ pinLatestUserMessage: request.pinLatestUserMessage,
379
+ });
380
+ if (!preparation) {
381
+ onFailure?.("prepare_compaction_returned_undefined");
382
+ return undefined;
383
+ }
384
+ const result = compactDcpLite(preparation);
385
+ summary = result.summary;
386
+ firstKeptEntryId = result.firstKeptEntryId;
387
+ tokensBefore = result.tokensBefore;
388
+ details = result.details;
389
+ tokensRemoved = Math.max(0, result.tokensRemoved ?? 0);
390
+ }
391
+ const virtualTimestamp = frozen?.timestamp ??
392
+ pathEntries[pathEntries.length - 1]?.timestamp ??
393
+ new Date().toISOString();
394
+ const virtualCompaction = createVirtualCompactionEntry(pathEntries, {
395
+ summary,
396
+ firstKeptEntryId,
397
+ tokensBefore,
398
+ details,
399
+ }, virtualTimestamp);
298
400
  const virtualContext = buildSessionContext([...pathEntries, virtualCompaction]);
299
401
  if (virtualContext.messages.length === 0) {
300
402
  onFailure?.("virtual_context_has_no_messages");
@@ -306,12 +408,21 @@ function buildRequestTimePrunedMessagesFromEntries(pathEntries, request, policy,
306
408
  const originalTokens = currentMessages.reduce((total, message) => total + estimateTokens(message), 0);
307
409
  const prunedTokens = virtualContext.messages.reduce((total, message) => total + estimateTokens(message), 0);
308
410
  if (prunedTokens >= originalTokens) {
309
- onFailure?.(tokensRemoved <= 0
411
+ onFailure?.(!frozen && tokensRemoved <= 0
310
412
  ? `summary_removed_zero_tokens:${originalTokens}->${prunedTokens}`
311
413
  : `pruned_context_not_smaller:${originalTokens}->${prunedTokens}`);
312
414
  return undefined;
313
415
  }
314
- return { messages: virtualContext.messages, tokensRemoved, originalTokens, prunedTokens };
416
+ const effectiveTokensRemoved = frozen
417
+ ? Math.max(0, originalTokens - prunedTokens)
418
+ : tokensRemoved;
419
+ return {
420
+ messages: virtualContext.messages,
421
+ tokensRemoved: effectiveTokensRemoved,
422
+ originalTokens,
423
+ prunedTokens,
424
+ ...(frozen ? {} : { anchorEntryId: firstKeptEntryId, summary, tokensBefore, timestamp: virtualTimestamp }),
425
+ };
315
426
  }
316
427
  function notifyDcp(ctx, message, level, telemetry) {
317
428
  const notify = ctx.ui?.notify;
@@ -571,6 +682,53 @@ export function registerCompactContextTool(ext, runtime) {
571
682
  const autoUsage = ctx.getContextUsage();
572
683
  const autoContextTokens = autoUsage?.tokens;
573
684
  const autoPercent = autoUsage?.percent;
685
+ const autoBranchId = getAutoPruneBranchId(ctx);
686
+ const autoHysteresisTokens = autoSettings.keepRecentTokens
687
+ ? autoSettings.keepRecentTokens * 2
688
+ : 0;
689
+ // 2a. Frozen cut reuse. Once the auto path has pruned, keep reusing the
690
+ // exact summary + anchor so the provider prompt prefix stays byte
691
+ // stable across requests. Only invalidate on identity mismatch or
692
+ // when raw growth exceeds the hysteresis threshold.
693
+ let frozen = state.autoPruneFrozen ?? null;
694
+ if (frozen && isMidRun) {
695
+ const identityMatches = autoPruneIdentityMatches(frozen, autoBranchId, _event.messages);
696
+ const hysteresisExceeded = autoHysteresisTokens > 0 &&
697
+ autoRawTokens - frozen.rawTokensAtFreeze > autoHysteresisTokens;
698
+ if (!identityMatches || hysteresisExceeded) {
699
+ state.autoPruneFrozen = null;
700
+ frozen = null;
701
+ }
702
+ else {
703
+ const frozenRequest = { source: "auto", mode: "request_time", ...autoSettings };
704
+ let frozenFailure;
705
+ const frozenPruned = buildRequestTimePrunedMessages(ctx, frozenRequest, policy, _event.messages, (reason) => {
706
+ frozenFailure = reason;
707
+ }, frozen);
708
+ if (frozenPruned) {
709
+ debugLog("compact_context.request_time.auto_frozen_reuse", {
710
+ rawTokens: autoRawTokens,
711
+ contextTokens: autoContextTokens ?? null,
712
+ percent: autoPercent ?? null,
713
+ originalTokens: frozenPruned.originalTokens,
714
+ prunedTokens: frozenPruned.prunedTokens,
715
+ tokensRemoved: frozenPruned.tokensRemoved,
716
+ anchorEntryId: frozen.anchorEntryId,
717
+ });
718
+ notifyRequestTimeApplied(ctx, frozenPruned, frozenRequest);
719
+ return { messages: frozenPruned.messages };
720
+ }
721
+ debugLog("compact_context.request_time.auto_frozen_invalid", {
722
+ rawTokens: autoRawTokens,
723
+ contextTokens: autoContextTokens ?? null,
724
+ percent: autoPercent ?? null,
725
+ reason: frozenFailure ?? "unknown",
726
+ anchorEntryId: frozen.anchorEntryId,
727
+ });
728
+ state.autoPruneFrozen = null;
729
+ frozen = null;
730
+ }
731
+ }
574
732
  const autoDecision = decideAutoCompaction(ctx, runtime, state, policy, autoRawTokens, autoContextTokens, autoPercent, false, isMidRun);
575
733
  if (autoDecision.mode !== "request_time")
576
734
  return;
@@ -597,7 +755,20 @@ export function registerCompactContextTool(ext, runtime) {
597
755
  originalTokens: autoPruned.originalTokens,
598
756
  prunedTokens: autoPruned.prunedTokens,
599
757
  tokensRemoved: autoPruned.tokensRemoved,
758
+ frozen: false,
600
759
  });
760
+ if (typeof autoPruned.anchorEntryId === "string" && typeof autoPruned.summary === "string") {
761
+ state.autoPruneFrozen = {
762
+ branchId: autoBranchId,
763
+ anchorEntryId: autoPruned.anchorEntryId,
764
+ summary: autoPruned.summary,
765
+ frozenAtBoundaryEnd: _event.messages.length,
766
+ rawTokensAtFreeze: autoRawTokens,
767
+ tokensBefore: autoPruned.tokensBefore ?? 0,
768
+ timestamp: autoPruned.timestamp ?? new Date().toISOString(),
769
+ leadingMessageRefs: _event.messages.slice(),
770
+ };
771
+ }
601
772
  notifyRequestTimeApplied(ctx, autoPruned, autoRequest);
602
773
  return { messages: autoPruned.messages };
603
774
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"read-project-observations.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/read-project-observations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAGhF,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AAE/E,eAAO,MAAM,2BAA2B;;iFAqFtC,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE3E"}
1
+ {"version":3,"file":"read-project-observations.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/read-project-observations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAGhF,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AAE/E,eAAO,MAAM,2BAA2B;;iFAwFtC,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE3E"}
@@ -5,13 +5,16 @@ export const READ_PROJECT_OBSERVATIONS_TOOL_NAME = "read_project_observations";
5
5
  export const readProjectObservationsTool = defineTool({
6
6
  name: READ_PROJECT_OBSERVATIONS_TOOL_NAME,
7
7
  label: "Search project observations",
8
- description: "Search all past observations across ALL sessions in this project. " +
8
+ description: "Search past observations across sessions in this project, stored per-machine " +
9
+ "and per-working-directory (cwd). " +
9
10
  "Use this when you need to recall project conventions, past decisions, " +
10
11
  "file locations, or user preferences before editing or creating files. " +
11
12
  "Uses simple substring matching — be specific with your query terms. " +
12
- "Returns up to 20 most recent matching observations with relevance tags.",
13
- promptSnippet: "Use read_project_observations(<query>) to search past observations across ALL sessions in this project.",
13
+ "Returns up to 20 most recent matching observations with relevance tags. " +
14
+ "Results are local to this machine and cwd; they are NOT synced across machines or teams.",
15
+ promptSnippet: "Use read_project_observations(<query>) to search past observations across sessions in this local project working directory.",
14
16
  promptGuidelines: [
17
+ "Results are per-machine + per-cwd and cross-session; they are NOT shared across machines or teams.",
15
18
  "Use read_project_observations before creating new files to find conventions for that file kind.",
16
19
  "Use read_project_observations before editing a file to find past context about that file or its directory.",
17
20
  "Be specific: search for file paths, technology names, or pattern keywords.",
@@ -1 +1 @@
1
- {"version":3,"file":"recall-observation.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/recall-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAGN,KAAK,uBAAuB,EAE5B,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,4BAA4B,WAAW,CAAC;AAIrD,KAAK,2BAA2B,GAC7B,IAAI,GACJ,SAAS,GACT,YAAY,GACZ,WAAW,GACX,WAAW,GACX,oBAAoB,GACpB,eAAe,CAAC;AAEnB,KAAK,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC;AAChG,KAAK,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,SAAS,GAAG,0BAA0B,GAAG,QAAQ,CAAC,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC;AAEx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,EAAE,CAAC;IACnF,+BAA+B,EAAE,4CAA4C,EAAE,CAAC;IAChF,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAuUF,eAAO,MAAM,qBAAqB;;iFAqDhC,CAAC;AAEH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE1D"}
@@ -1,6 +1,7 @@
1
1
  import { Type } from "../../sdk/ai/index.js";
2
2
  import { defineTool } from "../../sdk/coding-agent/index.js";
3
3
  import { recallMemorySources, } from "../branch.js";
4
+ import { getProjectObsStore } from "../project-observations-store.js";
4
5
  import { renderRecallSourceEntries, renderRecallSourceEntry } from "../serialize.js";
5
6
  import { estimateEntryTokens } from "../tokens.js";
6
7
  export const RECALL_OBSERVATION_TOOL_NAME = "recall";
@@ -315,7 +316,8 @@ function renderFoundResult(result) {
315
316
  export const recallObservationTool = defineTool({
316
317
  name: RECALL_OBSERVATION_TOOL_NAME,
317
318
  label: "Recall memory evidence",
318
- description: "Recover exact evidence and source context behind a compacted observational-memory observation or reflection id on the current branch. " +
319
+ description: "Recover exact evidence and source context behind a compacted observational-memory observation or reflection id " +
320
+ "from the current branch or an earlier session in the same working directory. " +
319
321
  "Use when compressed memory is important and original source context is needed before acting.",
320
322
  promptSnippet: "Use recall(<id>) to recover exact source context behind compacted memory observations/reflections when precision matters.",
321
323
  promptGuidelines: [
@@ -340,10 +342,22 @@ export const recallObservationTool = defineTool({
340
342
  return textResult(message, emptyDetails("invalid_id", memoryId, message));
341
343
  }
342
344
  const branchEntries = ctx.sessionManager.getBranch();
343
- const result = recallMemorySources(branchEntries, memoryId);
345
+ let result = recallMemorySources(branchEntries, memoryId);
344
346
  if (result.status === "not_found") {
345
- const message = `No observation or reflection with id ${memoryId} was found on the current branch.`;
346
- return textResult(message, emptyDetails("not_found", memoryId, message));
347
+ const store = getProjectObsStore();
348
+ const projectId = store?.getProjectByCwd(ctx.cwd);
349
+ const archiveEntries = projectId ? store?.getProjectRecallSource?.(projectId, memoryId) : null;
350
+ if (archiveEntries && archiveEntries.length > 0) {
351
+ const archivedResult = recallMemorySources(archiveEntries, memoryId);
352
+ if (archivedResult.status === "found") {
353
+ result = archivedResult;
354
+ }
355
+ }
356
+ if (result.status === "not_found") {
357
+ const message = `No observation or reflection with id ${memoryId} was found on the current branch ` +
358
+ `or in this project's cross-session memory.`;
359
+ return textResult(message, emptyDetails("not_found", memoryId, message));
360
+ }
347
361
  }
348
362
  return renderFoundResult(result);
349
363
  },
@@ -1 +1 @@
1
- {"version":3,"file":"receive-agent-observations.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/receive-agent-observations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,eAAO,MAAM,oCAAoC,+BAA+B,CAAC;AAEjF,MAAM,WAAW,uBAAuB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAClD,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,aAAa,GAAG,YAAY,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,4BAA4B;;;iFAmEvC,CAAC;AAEH,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE5E"}
1
+ {"version":3,"file":"receive-agent-observations.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/receive-agent-observations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,eAAO,MAAM,oCAAoC,+BAA+B,CAAC;AAEjF,MAAM,WAAW,uBAAuB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAClD,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,aAAa,GAAG,YAAY,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,4BAA4B;;;iFAqEvC,CAAC;AAEH,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE5E"}
@@ -6,10 +6,12 @@ export const RECEIVE_AGENT_OBSERVATIONS_TOOL_NAME = "receive_agent_observations"
6
6
  export const receiveAgentObservationsTool = defineTool({
7
7
  name: RECEIVE_AGENT_OBSERVATIONS_TOOL_NAME,
8
8
  label: "Receive observations from other agents",
9
- description: "Poll for observations shared by other active sessions on this project. " +
9
+ description: "Poll for observations shared by other active sessions on this machine working in the " +
10
+ "same directory (same-machine, same-cwd; no cross-machine or team relay). " +
10
11
  "Call this before starting work or when you suspect another agent has shared context.",
11
- promptSnippet: "Use receive_agent_observations() to pull shared observations from other active sessions.",
12
+ promptSnippet: "Use receive_agent_observations() to pull shared observations from other active sessions on this machine.",
12
13
  promptGuidelines: [
14
+ "Messages are same-machine + same-cwd only; there is no cross-machine or team fan-out.",
13
15
  "Call at the start of a session or task to pick up context shared by collaborators.",
14
16
  "Deduplicate results by memory_id against observations already in your context.",
15
17
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"share-project-observation.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/share-project-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAOhF,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AA6C/E,eAAO,MAAM,2BAA2B;;iFAqEtC,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE3E"}
1
+ {"version":3,"file":"share-project-observation.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/share-project-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAOhF,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AA6C/E,eAAO,MAAM,2BAA2B;;iFAuEtC,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE3E"}
@@ -40,12 +40,14 @@ function findObservationInStore(store, projectId, memoryId) {
40
40
  export const shareProjectObservationTool = defineTool({
41
41
  name: SHARE_PROJECT_OBSERVATION_TOOL_NAME,
42
42
  label: "Share observation with other agents",
43
- description: "Broadcast a project observation or reflection to other active sessions working on this project. " +
43
+ description: "Share a project observation or reflection with other active sessions on this machine " +
44
+ "working in the same directory (same-machine, same-cwd broadcast — no cross-machine or team relay). " +
44
45
  "Use this when you discover a fact another agent should know immediately, " +
45
46
  "rather than waiting for them to search project memory.",
46
- promptSnippet: "Use share_project_observation(memory_id) to push a known observation to other active sessions.",
47
+ promptSnippet: "Use share_project_observation(memory_id) to push a known observation to other active sessions on this machine.",
47
48
  promptGuidelines: [
48
- "Only share observations that are relevant to collaborators on the same project.",
49
+ "Delivery is same-machine + same-cwd only; there is no cross-machine or team fan-out.",
50
+ "Only share observations that are relevant to collaborators in the same local project directory.",
49
51
  "Prefer sharing high/critical relevance facts — avoid noise.",
50
52
  "The memory_id must be a 12-character lowercase hex id from the current branch or project memory.",
51
53
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"write-project-observation.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/write-project-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AAE/E,eAAO,MAAM,2BAA2B;;;iFA6DtC,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE3E"}
1
+ {"version":3,"file":"write-project-observation.d.ts","sourceRoot":"","sources":["../../../src/memory/tools/write-project-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AAE/E,eAAO,MAAM,2BAA2B;;;iFA2EtC,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAE3E"}
@@ -7,12 +7,15 @@ export const writeProjectObservationTool = defineTool({
7
7
  name: WRITE_PROJECT_OBSERVATION_TOOL_NAME,
8
8
  label: "Write project observation",
9
9
  description: "Write a durable, cross-session observation about this project. " +
10
+ "Observations are stored per-machine and per-working-directory (cwd) in local SQLite; " +
11
+ "they are shared across sessions on this machine but are NOT synced across machines or teams. " +
10
12
  "Use this to persist discovered conventions, architectural rules, " +
11
13
  "gotchas, and directory purposes. Observations are deduplicated by " +
12
14
  "content hash — writing the same fact twice is harmless (idempotent). " +
13
- "Future sessions can discover these via read_project_observations.",
14
- promptSnippet: "Use write_project_observation(content, relevance) to persist project-level knowledge.",
15
+ "Future sessions in this working directory can discover these via read_project_observations.",
16
+ promptSnippet: "Use write_project_observation(content, relevance) to persist local, cross-session knowledge for this working directory.",
15
17
  promptGuidelines: [
18
+ "Storage is per-machine + per-cwd and cross-session; it is NOT shared across machines or teams.",
16
19
  "Use for STABLE facts: conventions, architecture decisions, gotchas, file roles.",
17
20
  "Use relevance='critical' for NEVER-EDIT rules (auto-generated files, invariant constraints).",
18
21
  "Use relevance='high' for important conventions the agent must follow.",
@@ -47,8 +50,18 @@ export const writeProjectObservationTool = defineTool({
47
50
  details: { status: "no_project" },
48
51
  };
49
52
  }
53
+ // Use the real session id from the execution context, matching the
54
+ // automatic compaction path. Tool execution always runs inside a
55
+ // session, so getSessionId() is expected to be populated.
56
+ const sessionId = ctx.sessionManager.getSessionId();
57
+ if (!sessionId) {
58
+ return {
59
+ content: [{ type: "text", text: "No session context available." }],
60
+ details: { status: "no_session" },
61
+ };
62
+ }
50
63
  const id = hashId(params.content);
51
- store.insertProjectObservations(projectId, "auto-research", [{ id, content: params.content, relevance: params.relevance }], Date.now());
64
+ store.insertProjectObservations(projectId, sessionId, [{ id, content: params.content, relevance: params.relevance }], Date.now());
52
65
  return {
53
66
  content: [{ type: "text", text: `Observation [${id}] recorded (relevance: ${params.relevance}).` }],
54
67
  details: { id, status: "ok" },
@@ -104,6 +104,12 @@ export interface FindCutPointOptions {
104
104
  * over retaining a large just-finished turn as the recent raw suffix.
105
105
  */
106
106
  phaseBoundary?: boolean;
107
+ /**
108
+ * When provided, use this entry id as a fixed cut point instead of walking
109
+ * backwards from the newest entry. This lets request-time adapters freeze a
110
+ * previously-computed cut without regenerating the summary.
111
+ */
112
+ anchorEntryId?: string;
107
113
  /**
108
114
  * When true, ensure the most recent user message is never folded into the
109
115
  * compaction summary — the cut point is pulled back to (or before) the
@@ -160,6 +166,11 @@ export interface CompactionPreparation {
160
166
  export interface PrepareCompactionOptions {
161
167
  /** Prefer a caller-provided phase boundary over the usual recent-token suffix. */
162
168
  phaseBoundary?: boolean;
169
+ /**
170
+ * Use a fixed entry id as the cut point. The caller owns the anchor and is
171
+ * responsible for validating that it still belongs to the current branch.
172
+ */
173
+ anchorEntryId?: string;
163
174
  /**
164
175
  * Protect the most recent user message from being folded into the compaction
165
176
  * summary. Useful for isolated agent loops (subagents) where the latest user
@@ -1 +1 @@
1
- {"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/coding-agent/core/compaction/compaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,KAAK,EAA6B,KAAK,EAAuB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAQzG,OAAO,EAA6C,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrG,OAAO,EAIN,KAAK,cAAc,EAInB,MAAM,YAAY,CAAC;AACpB,OAAO,EAGN,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,MAAM,aAAa,CAAC;AAMrB,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEnD,MAAM,WAAW,2BAA2B;IAC3C,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf;AAkED,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,2BAA2B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