agentfootprint 7.18.0 → 7.19.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 (137) hide show
  1. package/AGENTS.md +7 -5
  2. package/README.md +3 -3
  3. package/ai-instructions/claude-code/SKILL.md +7 -5
  4. package/dist/adapters/hosting/agentcore.js +23 -9
  5. package/dist/adapters/hosting/agentcore.js.map +1 -1
  6. package/dist/core/Agent.js +6 -0
  7. package/dist/core/Agent.js.map +1 -1
  8. package/dist/core/agent/AgentBuilder.js +9 -0
  9. package/dist/core/agent/AgentBuilder.js.map +1 -1
  10. package/dist/core/agent/memoryRecallInjections.js +8 -0
  11. package/dist/core/agent/memoryRecallInjections.js.map +1 -1
  12. package/dist/core/agent/stages/toolCalls.js +13 -0
  13. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  14. package/dist/core/durabilityBarrier.js +68 -0
  15. package/dist/core/durabilityBarrier.js.map +1 -0
  16. package/dist/core/slots/buildMessagesSlot.js +23 -4
  17. package/dist/core/slots/buildMessagesSlot.js.map +1 -1
  18. package/dist/esm/adapters/hosting/agentcore.d.ts +4 -4
  19. package/dist/esm/adapters/hosting/agentcore.js +24 -10
  20. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  21. package/dist/esm/core/Agent.js +6 -0
  22. package/dist/esm/core/Agent.js.map +1 -1
  23. package/dist/esm/core/agent/AgentBuilder.d.ts +5 -0
  24. package/dist/esm/core/agent/AgentBuilder.js +9 -0
  25. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  26. package/dist/esm/core/agent/memoryRecallInjections.js +8 -0
  27. package/dist/esm/core/agent/memoryRecallInjections.js.map +1 -1
  28. package/dist/esm/core/agent/stages/toolCalls.d.ts +21 -0
  29. package/dist/esm/core/agent/stages/toolCalls.js +13 -0
  30. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  31. package/dist/esm/core/durabilityBarrier.d.ts +61 -0
  32. package/dist/esm/core/durabilityBarrier.js +63 -0
  33. package/dist/esm/core/durabilityBarrier.js.map +1 -0
  34. package/dist/esm/core/slots/buildMessagesSlot.d.ts +16 -2
  35. package/dist/esm/core/slots/buildMessagesSlot.js +23 -4
  36. package/dist/esm/core/slots/buildMessagesSlot.js.map +1 -1
  37. package/dist/esm/hosting/durability.d.ts +92 -0
  38. package/dist/esm/hosting/durability.js +174 -0
  39. package/dist/esm/hosting/durability.js.map +1 -0
  40. package/dist/esm/hosting/envelope.d.ts +75 -14
  41. package/dist/esm/hosting/envelope.js +141 -16
  42. package/dist/esm/hosting/envelope.js.map +1 -1
  43. package/dist/esm/hosting/errors.d.ts +60 -11
  44. package/dist/esm/hosting/errors.js +92 -18
  45. package/dist/esm/hosting/errors.js.map +1 -1
  46. package/dist/esm/hosting/httpHost.d.ts +17 -1
  47. package/dist/esm/hosting/httpHost.js +42 -6
  48. package/dist/esm/hosting/httpHost.js.map +1 -1
  49. package/dist/esm/hosting/index.d.ts +7 -4
  50. package/dist/esm/hosting/index.js +6 -3
  51. package/dist/esm/hosting/index.js.map +1 -1
  52. package/dist/esm/hosting/nodeHost.d.ts +4 -2
  53. package/dist/esm/hosting/nodeHost.js +14 -3
  54. package/dist/esm/hosting/nodeHost.js.map +1 -1
  55. package/dist/esm/hosting/standingAgent.d.ts +22 -7
  56. package/dist/esm/hosting/standingAgent.js +144 -32
  57. package/dist/esm/hosting/standingAgent.js.map +1 -1
  58. package/dist/esm/hosting/types.d.ts +193 -19
  59. package/dist/esm/lib/injection-engine/factories/defineFact.d.ts +7 -11
  60. package/dist/esm/lib/injection-engine/factories/defineFact.js +9 -7
  61. package/dist/esm/lib/injection-engine/factories/defineFact.js.map +1 -1
  62. package/dist/esm/lib/injection-engine/factories/defineInstruction.d.ts +10 -19
  63. package/dist/esm/lib/injection-engine/factories/defineInstruction.js +6 -4
  64. package/dist/esm/lib/injection-engine/factories/defineInstruction.js.map +1 -1
  65. package/dist/esm/lib/injection-engine/messagesSlotRefusal.d.ts +31 -0
  66. package/dist/esm/lib/injection-engine/messagesSlotRefusal.js +40 -0
  67. package/dist/esm/lib/injection-engine/messagesSlotRefusal.js.map +1 -0
  68. package/dist/esm/lib/injection-engine/types.d.ts +12 -1
  69. package/dist/esm/lib/injection-engine/types.js.map +1 -1
  70. package/dist/esm/lib/mcp/mcpServe.d.ts +8 -0
  71. package/dist/esm/lib/mcp/mcpServe.js +25 -0
  72. package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
  73. package/dist/esm/lib/mcp/types.d.ts +26 -0
  74. package/dist/hosting/durability.js +178 -0
  75. package/dist/hosting/durability.js.map +1 -0
  76. package/dist/hosting/envelope.js +146 -18
  77. package/dist/hosting/envelope.js.map +1 -1
  78. package/dist/hosting/errors.js +95 -19
  79. package/dist/hosting/errors.js.map +1 -1
  80. package/dist/hosting/httpHost.js +42 -6
  81. package/dist/hosting/httpHost.js.map +1 -1
  82. package/dist/hosting/index.js +10 -2
  83. package/dist/hosting/index.js.map +1 -1
  84. package/dist/hosting/nodeHost.js +14 -3
  85. package/dist/hosting/nodeHost.js.map +1 -1
  86. package/dist/hosting/standingAgent.js +142 -30
  87. package/dist/hosting/standingAgent.js.map +1 -1
  88. package/dist/lib/injection-engine/factories/defineFact.js +9 -7
  89. package/dist/lib/injection-engine/factories/defineFact.js.map +1 -1
  90. package/dist/lib/injection-engine/factories/defineInstruction.js +6 -4
  91. package/dist/lib/injection-engine/factories/defineInstruction.js.map +1 -1
  92. package/dist/lib/injection-engine/messagesSlotRefusal.js +44 -0
  93. package/dist/lib/injection-engine/messagesSlotRefusal.js.map +1 -0
  94. package/dist/lib/injection-engine/types.js.map +1 -1
  95. package/dist/lib/mcp/mcpServe.js +25 -0
  96. package/dist/lib/mcp/mcpServe.js.map +1 -1
  97. package/dist/types/adapters/hosting/agentcore.d.ts +4 -4
  98. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  99. package/dist/types/core/Agent.d.ts.map +1 -1
  100. package/dist/types/core/agent/AgentBuilder.d.ts +5 -0
  101. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  102. package/dist/types/core/agent/memoryRecallInjections.d.ts.map +1 -1
  103. package/dist/types/core/agent/stages/toolCalls.d.ts +21 -0
  104. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  105. package/dist/types/core/durabilityBarrier.d.ts +62 -0
  106. package/dist/types/core/durabilityBarrier.d.ts.map +1 -0
  107. package/dist/types/core/slots/buildMessagesSlot.d.ts +16 -2
  108. package/dist/types/core/slots/buildMessagesSlot.d.ts.map +1 -1
  109. package/dist/types/hosting/durability.d.ts +93 -0
  110. package/dist/types/hosting/durability.d.ts.map +1 -0
  111. package/dist/types/hosting/envelope.d.ts +75 -14
  112. package/dist/types/hosting/envelope.d.ts.map +1 -1
  113. package/dist/types/hosting/errors.d.ts +60 -11
  114. package/dist/types/hosting/errors.d.ts.map +1 -1
  115. package/dist/types/hosting/httpHost.d.ts +17 -1
  116. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  117. package/dist/types/hosting/index.d.ts +7 -4
  118. package/dist/types/hosting/index.d.ts.map +1 -1
  119. package/dist/types/hosting/nodeHost.d.ts +4 -2
  120. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  121. package/dist/types/hosting/standingAgent.d.ts +22 -7
  122. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  123. package/dist/types/hosting/types.d.ts +193 -19
  124. package/dist/types/hosting/types.d.ts.map +1 -1
  125. package/dist/types/lib/injection-engine/factories/defineFact.d.ts +7 -11
  126. package/dist/types/lib/injection-engine/factories/defineFact.d.ts.map +1 -1
  127. package/dist/types/lib/injection-engine/factories/defineInstruction.d.ts +10 -19
  128. package/dist/types/lib/injection-engine/factories/defineInstruction.d.ts.map +1 -1
  129. package/dist/types/lib/injection-engine/messagesSlotRefusal.d.ts +32 -0
  130. package/dist/types/lib/injection-engine/messagesSlotRefusal.d.ts.map +1 -0
  131. package/dist/types/lib/injection-engine/types.d.ts +12 -1
  132. package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
  133. package/dist/types/lib/mcp/mcpServe.d.ts +8 -0
  134. package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
  135. package/dist/types/lib/mcp/types.d.ts +26 -0
  136. package/dist/types/lib/mcp/types.d.ts.map +1 -1
  137. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"defineFact.js","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineFact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAiCxE,MAAM,UAAU,UAAU,CAAC,IAAuB;IAChD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,CAAC,EAAE,0BAA0B,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,OAAO,GAAqB,IAAI,CAAC,UAAU;QAC/C,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;QAC/C,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,eAAe,CAAC;IAC1C,MAAM,MAAM,GACV,IAAI,KAAK,UAAU;QACjB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,IAAK,QAAkB,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE;QAChF,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAElC,MAAM,KAAK,GAAG,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACrD,iEAAiE;IACjE,qEAAqE;IACrE,uEAAuE;IACvE,gEAAgE;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1D,MAAM,EAAE,MAAe;QACvB,OAAO;QACP,MAAM;QACN,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KACnC,CAAyB,CAAC;AAC7B,CAAC"}
1
+ {"version":3,"file":"defineFact.js","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineFact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAgCxE,MAAM,UAAU,UAAU,CAAC,IAAuB;IAChD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,CAAC,EAAE,0BAA0B,CAAC,CAAC;IACnE,CAAC;IACD,uEAAuE;IACvE,kEAAkE;IAClE,6DAA6D;IAC7D,IAAK,IAAI,CAAC,IAA2B,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,eAAe,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,OAAO,GAAqB,IAAI,CAAC,UAAU;QAC/C,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;QAC/C,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAE3C,MAAM,KAAK,GAAG,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACrD,iEAAiE;IACjE,qEAAqE;IACrE,uEAAuE;IACvE,gEAAgE;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1D,MAAM,EAAE,MAAe;QACvB,OAAO;QACP,MAAM;QACN,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KACnC,CAAyB,CAAC;AAC7B,CAAC"}
@@ -27,7 +27,6 @@
27
27
  * prompt: 'PII has been redacted. Do not include emails or phone numbers.',
28
28
  * });
29
29
  */
30
- import type { ContextRole } from '../../../events/types.js';
31
30
  import type { Injection, InjectionContext } from '../types.js';
32
31
  import type { CachePolicy } from '../../../cache/types.js';
33
32
  export interface DefineInstructionOptions {
@@ -42,28 +41,20 @@ export interface DefineInstructionOptions {
42
41
  * `agentfootprint.context.evaluated`.
43
42
  */
44
43
  readonly activeWhen?: (ctx: InjectionContext) => boolean;
45
- /** Instruction text. Lands in the slot specified by `slot` (default system-prompt). */
44
+ /** Instruction text. Lands in the system-prompt slot. */
46
45
  readonly prompt: string;
47
46
  /**
48
- * Where the instruction lands.
47
+ * Where the instruction lands. `'system-prompt'` (the default) is the
48
+ * only slot an instruction can land in: it is the one every provider
49
+ * delivers.
49
50
  *
50
- * - `'system-prompt'` (default) — appended to the system prompt.
51
- * Lower attention than recent messages but always available.
52
- * - `'messages'` — appended as a recent message. **Higher attention
53
- * weight** — the LLM reads recent messages more carefully than
54
- * system-prompt text. Use this for guidance that MUST be salient
55
- * on this turn (post-tool-result reminders, urgent corrections).
56
- *
57
- * Same instruction object can target both slots in different agents
58
- * — the trigger semantics don't change.
59
- */
60
- readonly slot?: 'system-prompt' | 'messages';
61
- /**
62
- * When `slot: 'messages'`, the role to use. Default `'system'`.
63
- * `'user'` is also valid; `'assistant'` and `'tool'` work in
64
- * principle but rarely make pedagogical sense.
51
+ * `'messages'` is REFUSED — see {@link messagesSlotRefusal}. It was
52
+ * accepted before 7.19.1 and documented as the recency-first
53
+ * placement; it was recorded as injected and never sent. To make a
54
+ * rule salient at the moment it matters, return it from the tool whose
55
+ * result it is about — a tool result IS a recent message.
65
56
  */
66
- readonly role?: ContextRole;
57
+ readonly slot?: 'system-prompt';
67
58
  /**
68
59
  * Cache policy for this instruction. Defaults to `'never'` —
69
60
  * instructions are typically rule-based (volatile per-iter
@@ -27,6 +27,7 @@
27
27
  * prompt: 'PII has been redacted. Do not include emails or phone numbers.',
28
28
  * });
29
29
  */
30
+ import { messagesSlotRefusal } from '../messagesSlotRefusal.js';
30
31
  import { resolveCachePolicy } from '../../../cache/applyCachePolicy.js';
31
32
  export function defineInstruction(opts) {
32
33
  if (!opts.id || opts.id.trim().length === 0) {
@@ -35,13 +36,14 @@ export function defineInstruction(opts) {
35
36
  if (!opts.prompt || opts.prompt.length === 0) {
36
37
  throw new Error(`defineInstruction(${opts.id}): \`prompt\` is required.`);
37
38
  }
39
+ // Refused at run time as well as in the type — see defineFact for why.
40
+ if (opts.slot === 'messages') {
41
+ throw new Error(messagesSlotRefusal(`defineInstruction('${opts.id}')`));
42
+ }
38
43
  const trigger = opts.activeWhen
39
44
  ? { kind: 'rule', activeWhen: opts.activeWhen }
40
45
  : { kind: 'always' };
41
- const slot = opts.slot ?? 'system-prompt';
42
- const inject = slot === 'messages'
43
- ? { messages: [{ role: opts.role ?? 'system', content: opts.prompt }] }
44
- : { systemPrompt: opts.prompt };
46
+ const inject = { systemPrompt: opts.prompt };
45
47
  const cache = resolveCachePolicy('instruction', opts.cache);
46
48
  return Object.freeze({
47
49
  id: opts.id,
@@ -1 +1 @@
1
- {"version":3,"file":"defineInstruction.js","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineInstruction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAiDxE,MAAM,UAAU,iBAAiB,CAAC,IAA8B;IAC9D,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,CAAC,EAAE,4BAA4B,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU;QAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;QACxD,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,eAAe,CAAC;IAC1C,MAAM,MAAM,GACV,IAAI,KAAK,UAAU;QACjB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;QACvE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,kBAAkB,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1D,MAAM,EAAE,cAAuB;QAC/B,OAAO;QACP,MAAM;QACN,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KACnC,CAAyB,CAAC;AAC7B,CAAC"}
1
+ {"version":3,"file":"defineInstruction.js","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineInstruction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAyCxE,MAAM,UAAU,iBAAiB,CAAC,IAA8B;IAC9D,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,CAAC,EAAE,4BAA4B,CAAC,CAAC;IAC5E,CAAC;IACD,uEAAuE;IACvE,IAAK,IAAI,CAAC,IAA2B,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,sBAAsB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU;QAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;QACxD,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,CAAC;IAChC,MAAM,MAAM,GAAqB,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC/D,MAAM,KAAK,GAAG,kBAAkB,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1D,MAAM,EAAE,cAAuB;QAC/B,OAAO;QACP,MAAM;QACN,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KACnC,CAAyB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The messages-slot refusal — one sentence, said in every place the
3
+ * declaration can be made.
4
+ *
5
+ * WHY this exists at all: an Injection targeting the messages slot was
6
+ * RECORDED as injected — `context.injected` fired with its content, the
7
+ * slot composition counted it, the engine routed it — while the request
8
+ * assembled its message list from the conversation itself, so the model
9
+ * never saw it. The recording said one thing and the wire said another.
10
+ *
11
+ * Delivering it instead is not a one-line change, and doing it badly
12
+ * would be worse than the gap: the wire has no system role INSIDE the
13
+ * message list (the Anthropic and Bedrock adapters drop such a message —
14
+ * system is a separate top-level field — while the OpenAI adapters carry
15
+ * it), and `'system'` was the default role here. Wiring the slot up
16
+ * without a per-provider notion of what a provider can carry would
17
+ * replace one uniform gap with a provider-dependent one, and nothing in
18
+ * the recording would tell the two apart. Honest delivery needs a
19
+ * wire-carrying key out of the slot, that provider capability, and a
20
+ * message-sequence rule — a designed feature, not a patch.
21
+ *
22
+ * So until that exists, the declaration is refused where it is written.
23
+ * Absence beats a lie: nothing that worked stops working, and something
24
+ * that never worked stops pretending.
25
+ */
26
+ /**
27
+ * The refusal text, addressed from `site` (e.g. `defineFact('turn-time')`).
28
+ * Names the limitation and the three placements that DO reach the model,
29
+ * because a refusal that does not teach just moves the puzzle.
30
+ */
31
+ export declare function messagesSlotRefusal(site: string): string;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The messages-slot refusal — one sentence, said in every place the
3
+ * declaration can be made.
4
+ *
5
+ * WHY this exists at all: an Injection targeting the messages slot was
6
+ * RECORDED as injected — `context.injected` fired with its content, the
7
+ * slot composition counted it, the engine routed it — while the request
8
+ * assembled its message list from the conversation itself, so the model
9
+ * never saw it. The recording said one thing and the wire said another.
10
+ *
11
+ * Delivering it instead is not a one-line change, and doing it badly
12
+ * would be worse than the gap: the wire has no system role INSIDE the
13
+ * message list (the Anthropic and Bedrock adapters drop such a message —
14
+ * system is a separate top-level field — while the OpenAI adapters carry
15
+ * it), and `'system'` was the default role here. Wiring the slot up
16
+ * without a per-provider notion of what a provider can carry would
17
+ * replace one uniform gap with a provider-dependent one, and nothing in
18
+ * the recording would tell the two apart. Honest delivery needs a
19
+ * wire-carrying key out of the slot, that provider capability, and a
20
+ * message-sequence rule — a designed feature, not a patch.
21
+ *
22
+ * So until that exists, the declaration is refused where it is written.
23
+ * Absence beats a lie: nothing that worked stops working, and something
24
+ * that never worked stops pretending.
25
+ */
26
+ /**
27
+ * The refusal text, addressed from `site` (e.g. `defineFact('turn-time')`).
28
+ * Names the limitation and the three placements that DO reach the model,
29
+ * because a refusal that does not teach just moves the puzzle.
30
+ */
31
+ export function messagesSlotRefusal(site) {
32
+ return (`${site}: the messages slot does not reach the model, so this content would be ` +
33
+ `recorded as injected and never sent. The request's message list is assembled from ` +
34
+ `the conversation itself; the messages slot is the observability projection of it. ` +
35
+ `Three placements do reach the model: \`slot: 'system-prompt'\` (the default — ` +
36
+ `delivered by every provider), a tool's return value (tool results are real ` +
37
+ `messages, at the recency this option was reaching for), and the text passed to ` +
38
+ `\`agent.run({ message })\`.`);
39
+ }
40
+ //# sourceMappingURL=messagesSlotRefusal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messagesSlotRefusal.js","sourceRoot":"","sources":["../../../../src/lib/injection-engine/messagesSlotRefusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,CACL,GAAG,IAAI,yEAAyE;QAChF,oFAAoF;QACpF,oFAAoF;QACpF,gFAAgF;QAChF,6EAA6E;QAC7E,iFAAiF;QACjF,6BAA6B,CAC9B,CAAC;AACJ,CAAC"}
@@ -56,7 +56,18 @@ export type InjectionTrigger =
56
56
  export interface InjectionContent {
57
57
  /** Text appended to the system-prompt slot when active. */
58
58
  readonly systemPrompt?: string;
59
- /** Messages prepended to the messages slot when active. */
59
+ /**
60
+ * Messages appended to the messages slot when active.
61
+ *
62
+ * **Not delivered to the model, and refused where it can be declared**
63
+ * (`defineFact` / `defineInstruction` / `Agent.injection()`) since
64
+ * 7.19.1: the request's message list is assembled from the
65
+ * conversation, so content placed here was recorded as injected and
66
+ * never sent. The field stays on the type for the engine's internal
67
+ * memory-recall bridge and for the delivery feature that will make it
68
+ * true; nothing a consumer can declare reaches it. See
69
+ * `messagesSlotRefusal.ts` for the full reasoning.
70
+ */
60
71
  readonly messages?: ReadonlyArray<{
61
72
  readonly role: ContextRole;
62
73
  readonly content: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/injection-engine/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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AAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -9,6 +9,14 @@
9
9
  * // …later
10
10
  * await handle.close();
11
11
  *
12
+ * Over HTTP the handle also reports the socket it bound, so `port: 0`
13
+ * ("any free port") is usable from the outside:
14
+ *
15
+ * const handle = await mcpServe(tools, {
16
+ * transport: { transport: 'http', port: 0, host: '127.0.0.1' },
17
+ * });
18
+ * connect(`http://127.0.0.1:${handle.port}/mcp`);
19
+ *
12
20
  * `mcpClient` pulls someone else's tools in. This pushes yours out, so
13
21
  * the tool you already wrote, tested and governed can be called by any
14
22
  * MCP client — a desktop host, another team's agent, an IDE — without
@@ -9,6 +9,14 @@
9
9
  * // …later
10
10
  * await handle.close();
11
11
  *
12
+ * Over HTTP the handle also reports the socket it bound, so `port: 0`
13
+ * ("any free port") is usable from the outside:
14
+ *
15
+ * const handle = await mcpServe(tools, {
16
+ * transport: { transport: 'http', port: 0, host: '127.0.0.1' },
17
+ * });
18
+ * connect(`http://127.0.0.1:${handle.port}/mcp`);
19
+ *
12
20
  * `mcpClient` pulls someone else's tools in. This pushes yours out, so
13
21
  * the tool you already wrote, tested and governed can be called by any
14
22
  * MCP client — a desktop host, another team's agent, an IDE — without
@@ -158,6 +166,14 @@ export async function mcpServe(tools, opts = {}) {
158
166
  return {
159
167
  name,
160
168
  toolNames: listing.map((t) => t.name),
169
+ // Present only when a socket was bound (the http transport). Spread so
170
+ // a stdio handle has no `port` key at all, rather than one holding
171
+ // undefined — "there is no socket" and "the socket is unknown" are
172
+ // different claims.
173
+ ...(connection.bound !== undefined && {
174
+ port: connection.bound.port,
175
+ address: connection.bound.address,
176
+ }),
161
177
  async close() {
162
178
  if (closed)
163
179
  return;
@@ -398,7 +414,16 @@ async function connectHttp(transport, newServer) {
398
414
  else
399
415
  listener.listen(transport.port, resolve);
400
416
  });
417
+ // Read the socket AFTER listen resolves — before that, `port: 0` is still
418
+ // 0 and the address is null. A pipe/socket-path bind reports a string
419
+ // instead of an AddressInfo; there is no port to report then, so we report
420
+ // none rather than a made-up one.
421
+ const bound = listener.address();
401
422
  return {
423
+ ...(bound !== null &&
424
+ typeof bound === 'object' && {
425
+ bound: { port: bound.port, address: bound.address },
426
+ }),
402
427
  close: () => new Promise((resolve, reject) => {
403
428
  listener.close((err) => (err ? reject(err) : resolve()));
404
429
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"mcpServe.js","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpServe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAQH,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AASzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAC7C,MAAM,sBAAsB,GAAG,OAAO,CAAC;AACvC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,KAAsB,EACtB,OAAwB,EAAE;IAE1B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,mBAAmB,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,sBAAsB,CAAC;IACvD,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,8BAA8B,EAAE,CAAC;IAEzE,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI;QACnB,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,E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IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;gBACrB,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,GAAG,CAAC,GAAG,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC/B,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS;YAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;YACtF,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,0EAA0E;IAC1E,sEAAsE;IACtE,2EAA2E;IAC3E,kCAAkC;IAClC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;IAEjC,OAAO;QACL,GAAG,CAAC,KAAK,KAAK,IAAI;YAChB,OAAO,KAAK,KAAK,QAAQ,IAAI;YAC3B,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;SACpD,CAAC;QACJ,KAAK,EAAE,GAAG,EAAE,CACV,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC;KACL,CAAC;AACJ,CAAC"}
@@ -274,6 +274,32 @@ export interface McpServeHandle {
274
274
  readonly name: string;
275
275
  /** Names of the tools being served, in the order clients will list them. */
276
276
  readonly toolNames: readonly string[];
277
+ /**
278
+ * The port the listener actually bound, for the `http` transport only —
279
+ * absent for `stdio`, which has no socket.
280
+ *
281
+ * It is here because `port: 0` means "any free port", and the caller who
282
+ * asked for one had no way to learn which one they got: the number the OS
283
+ * chose lived inside a listener nobody could see. Serving on `0` and
284
+ * reading this back is the supported way to run a server on an
285
+ * unpredictable port — a test suite, a dev tool, several replicas on one
286
+ * machine.
287
+ *
288
+ * With an explicit port this reports the same number back, so code can
289
+ * read it unconditionally rather than branching on how the port was set.
290
+ */
291
+ readonly port?: number;
292
+ /**
293
+ * The address the listener bound, for the `http` transport only — as the
294
+ * OS reports it, so `'127.0.0.1'` when a host was given and `'::'` (or
295
+ * `'0.0.0.0'`) when one was not.
296
+ *
297
+ * Reported rather than assembled into a URL on purpose: a wildcard bind is
298
+ * not an address a client can dial, and a handle that handed one out would
299
+ * be inventing reachability it cannot promise. Pair it with `port` and the
300
+ * host you know your callers can reach.
301
+ */
302
+ readonly address?: string;
277
303
  /**
278
304
  * Stop serving: closes the transport (and, for `http`, the listening
279
305
  * socket) and then the MCP server. Idempotent — calling it twice is
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ /**
3
+ * hosting/durability — how often a run's progress becomes crash-survivable.
4
+ *
5
+ * A standing agent that only writes at the end of a turn is one restart away
6
+ * from losing everything the turn had done: the tool calls it made, the results
7
+ * it read, the iterations it spent. This is the dial that decides how much of
8
+ * that survives, and what it costs.
9
+ *
10
+ * ── Where a mid-run write can honestly come from ─────────────────────────────
11
+ * From the COMMIT boundary, and nowhere else. footprintjs commits a stage's
12
+ * writes after the stage function returns, and committed state is
13
+ * immutable-after-swap — so `ScopeRecorder.onCommit` is the one moment where
14
+ * "what the run has agreed on so far" is a real, complete, consistent thing.
15
+ * Reading the agent's live state at any other moment would be reading a stage's
16
+ * work in progress.
17
+ *
18
+ * There is no mid-run engine checkpoint to store: footprintjs builds a
19
+ * `FlowchartCheckpoint` only at a pause (`getCheckpoint()` is documented as "the
20
+ * most recent PAUSED execution"). So what a mid-run write can carry is a
21
+ * CONVERSATION — the same `AgentRunCheckpoint` every finished turn stores — and
22
+ * that is exactly enough, because that is what the next turn resumes from.
23
+ *
24
+ * ── Why it writes on SOME commits and not all of them ────────────────────────
25
+ * A two-iteration turn commits about forty times. Exactly two of those commits
26
+ * change the conversation: `Initialize` (the user's message lands) and
27
+ * `ToolCalls` (an iteration's assistant turn and its tool results land). Every
28
+ * other commit would store bytes identical to the last write. So the trigger is
29
+ * "this commit wrote `history`", which is not an optimisation but the honest
30
+ * reading of the question: the conversation moved iff `history` moved.
31
+ *
32
+ * ── What a commit boundary actually guarantees, and what it does not ─────────
33
+ * It guarantees the whole stage. The agent dispatches ALL of one iteration's
34
+ * tool calls inside one stage body, so a crash part-way through that body stores
35
+ * nothing from it and a replay re-runs that iteration's tools. That is the
36
+ * shipped idempotency requirement, unchanged — mutating tools must be
37
+ * idempotent, keyed on stable call content rather than `ctx.toolCallId`. What
38
+ * `'sync'` adds is a BOUND on it: iteration N's tools do not start until
39
+ * iteration N-1's write has landed, so the replay is the current iteration and
40
+ * never an earlier one.
41
+ *
42
+ * Pattern: an observer (`CombinedRecorder`) for the snapshot, a serialiser for
43
+ * the writes, and — for `'sync'` only — a barrier the tool dispatch waits on.
44
+ * Role: internal to `standingAgent`. Deliberately not exported: it is how the
45
+ * composer keeps its promise, not a second way to write to a store.
46
+ */
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.durableWriter = void 0;
49
+ const durabilityBarrier_js_1 = require("../core/durabilityBarrier.js");
50
+ /**
51
+ * Build the writer.
52
+ *
53
+ * Under `'sync'` it also answers the tool-dispatch barrier, which is what turns
54
+ * "we write often" into a bound on how much can re-run.
55
+ */
56
+ function durableWriter(options) {
57
+ const { mode, session, runId, write } = options;
58
+ /** The write currently on the wire, or `undefined` when nothing is. */
59
+ let inFlight;
60
+ /**
61
+ * The newest snapshot that has not been started yet. At most ONE, and a newer
62
+ * one replaces it: the conversation only grows, so a superseded snapshot is a
63
+ * prefix of the one replacing it and writing it first would buy nothing.
64
+ */
65
+ let queued;
66
+ /**
67
+ * Why the NEWEST write did not land, or `undefined` when it did. Cleared by a
68
+ * write that succeeds — a store that failed once and then took the newer
69
+ * state has made that state durable, and reporting the older failure would be
70
+ * describing a problem that no longer exists.
71
+ */
72
+ let failure;
73
+ /** Per-run accumulation, rebuilt from the commits themselves. */
74
+ let history = [];
75
+ let userMessage = '';
76
+ let iteration = 0;
77
+ function pump() {
78
+ if (inFlight !== undefined || queued === undefined)
79
+ return;
80
+ const next = queued;
81
+ queued = undefined;
82
+ inFlight = write(next.sessionId, next.conversation)
83
+ .then(() => {
84
+ failure = undefined;
85
+ }, (err) => {
86
+ failure = new Error(`[hosting] the session store did not accept this run's progress, so nothing ` +
87
+ `after this point may proceed as if it had` +
88
+ (mode === 'sync' ? ` — the next tool call was not allowed to run` : '') +
89
+ `. Underlying error: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
90
+ })
91
+ .then(() => {
92
+ inFlight = undefined;
93
+ pump();
94
+ });
95
+ }
96
+ function enqueue(sessionId) {
97
+ queued = {
98
+ sessionId,
99
+ conversation: {
100
+ version: 1,
101
+ runId: runId() ?? 'unknown',
102
+ // The commit event hands over the stage's retained write view. Clone on
103
+ // the way to a store so nothing a persistence layer does can reach back
104
+ // into the run's own snapshot.
105
+ history: structuredClone(history),
106
+ lastCompletedIteration: iteration,
107
+ originalInput: { message: userMessage },
108
+ checkpointedAt: Date.now(),
109
+ },
110
+ };
111
+ pump();
112
+ }
113
+ const recorder = {
114
+ id: 'af-hosting-durability',
115
+ // INLINE, always. A write delivered one beat behind is a write that can be
116
+ // lost by the very crash it exists to survive — and under `'sync'` the
117
+ // barrier would be waiting on a snapshot the queue had not handed over yet.
118
+ // The causal-evidence bridge and the compaction meter are inline for the
119
+ // same class of reason.
120
+ delivery: 'inline',
121
+ onCommit(event) {
122
+ let conversationMoved = false;
123
+ for (const mutation of event.mutations) {
124
+ if (mutation.key === 'history' && Array.isArray(mutation.value)) {
125
+ history = mutation.value;
126
+ conversationMoved = true;
127
+ }
128
+ else if (mutation.key === 'userMessage' && typeof mutation.value === 'string') {
129
+ userMessage = mutation.value;
130
+ }
131
+ else if (mutation.key === 'iteration' && typeof mutation.value === 'number') {
132
+ iteration = mutation.value;
133
+ }
134
+ }
135
+ if (!conversationMoved)
136
+ return;
137
+ const sessionId = session();
138
+ if (sessionId === undefined)
139
+ return;
140
+ enqueue(sessionId);
141
+ },
142
+ // A fresh run starts from a fresh conversation. Without this a resumed run
143
+ // whose first commit has not landed yet could stamp the previous run's
144
+ // history onto this run's id.
145
+ clear() {
146
+ history = [];
147
+ userMessage = '';
148
+ iteration = 0;
149
+ },
150
+ };
151
+ const settle = async () => {
152
+ // Loop rather than await once: a write that completes may release a queued
153
+ // successor, and "settled" has to mean nothing is left.
154
+ while (inFlight !== undefined || queued !== undefined) {
155
+ pump();
156
+ await inFlight;
157
+ }
158
+ if (failure)
159
+ throw failure;
160
+ };
161
+ return {
162
+ recorder,
163
+ install(agent) {
164
+ // `'async'` deliberately takes NO barrier: its whole promise is that the
165
+ // run does not wait, and a barrier would be that promise broken quietly.
166
+ if (mode !== 'sync')
167
+ return () => undefined;
168
+ return (0, durabilityBarrier_js_1.installDurabilityBarrier)(agent, () => {
169
+ if (inFlight === undefined && queued === undefined && failure === undefined)
170
+ return undefined;
171
+ return settle();
172
+ });
173
+ },
174
+ settle,
175
+ };
176
+ }
177
+ exports.durableWriter = durableWriter;
178
+ //# sourceMappingURL=durability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durability.js","sourceRoot":"","sources":["../../src/hosting/durability.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;;;AAIH,uEAAwE;AA4CxE;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,OAA6B;IACzD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,E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