agentfootprint 7.20.0 → 7.22.0

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 (214) hide show
  1. package/AGENTS.md +10 -3
  2. package/README.md +1 -1
  3. package/ai-instructions/claude-code/SKILL.md +10 -3
  4. package/dist/adapters/hosting/agentcore.js +12 -2
  5. package/dist/adapters/hosting/agentcore.js.map +1 -1
  6. package/dist/adapters/llm/AnthropicProvider.js +12 -0
  7. package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
  8. package/dist/adapters/llm/BedrockProvider.js +12 -0
  9. package/dist/adapters/llm/BedrockProvider.js.map +1 -1
  10. package/dist/adapters/llm/BrowserAnthropicProvider.js +45 -6
  11. package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  12. package/dist/adapters/llm/BrowserOpenAIProvider.js +13 -0
  13. package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
  14. package/dist/adapters/llm/MockProvider.js +10 -0
  15. package/dist/adapters/llm/MockProvider.js.map +1 -1
  16. package/dist/adapters/llm/OpenAIProvider.js +15 -0
  17. package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
  18. package/dist/adapters/types.js +10 -0
  19. package/dist/adapters/types.js.map +1 -1
  20. package/dist/cache/CacheDecisionSubflow.js +67 -3
  21. package/dist/cache/CacheDecisionSubflow.js.map +1 -1
  22. package/dist/conventions.js +8 -0
  23. package/dist/conventions.js.map +1 -1
  24. package/dist/core/Agent.js +47 -0
  25. package/dist/core/Agent.js.map +1 -1
  26. package/dist/core/agent/AgentBuilder.js +13 -6
  27. package/dist/core/agent/AgentBuilder.js.map +1 -1
  28. package/dist/core/agent/buildAgentChart.js +17 -1
  29. package/dist/core/agent/buildAgentChart.js.map +1 -1
  30. package/dist/core/agent/buildDynamicAgentChart.js +49 -4
  31. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  32. package/dist/core/agent/delivery/rules.js +121 -0
  33. package/dist/core/agent/delivery/rules.js.map +1 -0
  34. package/dist/core/agent/delivery/types.js +12 -0
  35. package/dist/core/agent/delivery/types.js.map +1 -0
  36. package/dist/core/agent/stages/callLLM.js +27 -1
  37. package/dist/core/agent/stages/callLLM.js.map +1 -1
  38. package/dist/core/agent/stages/deliver.js +155 -0
  39. package/dist/core/agent/stages/deliver.js.map +1 -0
  40. package/dist/core/agent/stages/seed.js +4 -0
  41. package/dist/core/agent/stages/seed.js.map +1 -1
  42. package/dist/core/slots/buildMessagesSlot.js +43 -48
  43. package/dist/core/slots/buildMessagesSlot.js.map +1 -1
  44. package/dist/esm/adapters/hosting/agentcore.d.ts +27 -0
  45. package/dist/esm/adapters/hosting/agentcore.js +12 -2
  46. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  47. package/dist/esm/adapters/llm/AnthropicProvider.d.ts +2 -1
  48. package/dist/esm/adapters/llm/AnthropicProvider.js +12 -0
  49. package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
  50. package/dist/esm/adapters/llm/BedrockProvider.d.ts +2 -1
  51. package/dist/esm/adapters/llm/BedrockProvider.js +12 -0
  52. package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
  53. package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +2 -1
  54. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +45 -6
  55. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  56. package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +3 -1
  57. package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +13 -0
  58. package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
  59. package/dist/esm/adapters/llm/MockProvider.d.ts +2 -1
  60. package/dist/esm/adapters/llm/MockProvider.js +10 -0
  61. package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
  62. package/dist/esm/adapters/llm/OpenAIProvider.d.ts +2 -1
  63. package/dist/esm/adapters/llm/OpenAIProvider.js +15 -0
  64. package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
  65. package/dist/esm/adapters/types.d.ts +69 -0
  66. package/dist/esm/adapters/types.js +9 -1
  67. package/dist/esm/adapters/types.js.map +1 -1
  68. package/dist/esm/cache/CacheDecisionSubflow.d.ts +11 -0
  69. package/dist/esm/cache/CacheDecisionSubflow.js +67 -3
  70. package/dist/esm/cache/CacheDecisionSubflow.js.map +1 -1
  71. package/dist/esm/conventions.d.ts +8 -0
  72. package/dist/esm/conventions.js +8 -0
  73. package/dist/esm/conventions.js.map +1 -1
  74. package/dist/esm/core/Agent.d.ts +16 -0
  75. package/dist/esm/core/Agent.js +47 -0
  76. package/dist/esm/core/Agent.js.map +1 -1
  77. package/dist/esm/core/agent/AgentBuilder.d.ts +9 -4
  78. package/dist/esm/core/agent/AgentBuilder.js +14 -7
  79. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  80. package/dist/esm/core/agent/buildAgentChart.d.ts +14 -0
  81. package/dist/esm/core/agent/buildAgentChart.js +17 -1
  82. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  83. package/dist/esm/core/agent/buildDynamicAgentChart.js +49 -4
  84. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  85. package/dist/esm/core/agent/delivery/rules.d.ts +79 -0
  86. package/dist/esm/core/agent/delivery/rules.js +113 -0
  87. package/dist/esm/core/agent/delivery/rules.js.map +1 -0
  88. package/dist/esm/core/agent/delivery/types.d.ts +51 -0
  89. package/dist/esm/core/agent/delivery/types.js +11 -0
  90. package/dist/esm/core/agent/delivery/types.js.map +1 -0
  91. package/dist/esm/core/agent/stages/callLLM.js +27 -1
  92. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  93. package/dist/esm/core/agent/stages/deliver.d.ts +59 -0
  94. package/dist/esm/core/agent/stages/deliver.js +150 -0
  95. package/dist/esm/core/agent/stages/deliver.js.map +1 -0
  96. package/dist/esm/core/agent/stages/seed.js +4 -0
  97. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  98. package/dist/esm/core/agent/types.d.ts +14 -0
  99. package/dist/esm/core/slots/buildMessagesSlot.d.ts +23 -8
  100. package/dist/esm/core/slots/buildMessagesSlot.js +43 -48
  101. package/dist/esm/core/slots/buildMessagesSlot.js.map +1 -1
  102. package/dist/esm/hosting/httpHost.d.ts +62 -3
  103. package/dist/esm/hosting/httpHost.js +73 -9
  104. package/dist/esm/hosting/httpHost.js.map +1 -1
  105. package/dist/esm/hosting/index.d.ts +3 -1
  106. package/dist/esm/hosting/index.js +3 -1
  107. package/dist/esm/hosting/index.js.map +1 -1
  108. package/dist/esm/hosting/nodeHost.d.ts +21 -2
  109. package/dist/esm/hosting/nodeHost.js +10 -0
  110. package/dist/esm/hosting/nodeHost.js.map +1 -1
  111. package/dist/esm/hosting/types.d.ts +6 -0
  112. package/dist/esm/lib/injection-engine/factories/defineFact.d.ts +38 -10
  113. package/dist/esm/lib/injection-engine/factories/defineFact.js +20 -8
  114. package/dist/esm/lib/injection-engine/factories/defineFact.js.map +1 -1
  115. package/dist/esm/lib/injection-engine/factories/defineInstruction.d.ts +42 -15
  116. package/dist/esm/lib/injection-engine/factories/defineInstruction.js +17 -6
  117. package/dist/esm/lib/injection-engine/factories/defineInstruction.js.map +1 -1
  118. package/dist/esm/lib/injection-engine/messagesSlotRefusal.d.ts +70 -27
  119. package/dist/esm/lib/injection-engine/messagesSlotRefusal.js +91 -34
  120. package/dist/esm/lib/injection-engine/messagesSlotRefusal.js.map +1 -1
  121. package/dist/esm/lib/injection-engine/types.d.ts +35 -9
  122. package/dist/esm/lib/injection-engine/types.js +6 -0
  123. package/dist/esm/lib/injection-engine/types.js.map +1 -1
  124. package/dist/esm/memory/asRoleRefusal.d.ts +15 -11
  125. package/dist/esm/memory/asRoleRefusal.js +21 -15
  126. package/dist/esm/memory/asRoleRefusal.js.map +1 -1
  127. package/dist/esm/resilience/withCircuitBreaker.js +6 -0
  128. package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
  129. package/dist/esm/resilience/withFallback.js +18 -0
  130. package/dist/esm/resilience/withFallback.js.map +1 -1
  131. package/dist/esm/resilience/withRetry.js +8 -0
  132. package/dist/esm/resilience/withRetry.js.map +1 -1
  133. package/dist/hosting/httpHost.js +73 -9
  134. package/dist/hosting/httpHost.js.map +1 -1
  135. package/dist/hosting/index.js +3 -1
  136. package/dist/hosting/index.js.map +1 -1
  137. package/dist/hosting/nodeHost.js +10 -0
  138. package/dist/hosting/nodeHost.js.map +1 -1
  139. package/dist/lib/injection-engine/factories/defineFact.js +19 -7
  140. package/dist/lib/injection-engine/factories/defineFact.js.map +1 -1
  141. package/dist/lib/injection-engine/factories/defineInstruction.js +16 -5
  142. package/dist/lib/injection-engine/factories/defineInstruction.js.map +1 -1
  143. package/dist/lib/injection-engine/messagesSlotRefusal.js +95 -36
  144. package/dist/lib/injection-engine/messagesSlotRefusal.js.map +1 -1
  145. package/dist/lib/injection-engine/types.js +6 -0
  146. package/dist/lib/injection-engine/types.js.map +1 -1
  147. package/dist/memory/asRoleRefusal.js +21 -15
  148. package/dist/memory/asRoleRefusal.js.map +1 -1
  149. package/dist/resilience/withCircuitBreaker.js +6 -0
  150. package/dist/resilience/withCircuitBreaker.js.map +1 -1
  151. package/dist/resilience/withFallback.js +18 -0
  152. package/dist/resilience/withFallback.js.map +1 -1
  153. package/dist/resilience/withRetry.js +8 -0
  154. package/dist/resilience/withRetry.js.map +1 -1
  155. package/dist/types/adapters/hosting/agentcore.d.ts +27 -0
  156. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  157. package/dist/types/adapters/llm/AnthropicProvider.d.ts +2 -1
  158. package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
  159. package/dist/types/adapters/llm/BedrockProvider.d.ts +2 -1
  160. package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
  161. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts +2 -1
  162. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
  163. package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +3 -1
  164. package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
  165. package/dist/types/adapters/llm/MockProvider.d.ts +2 -1
  166. package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
  167. package/dist/types/adapters/llm/OpenAIProvider.d.ts +2 -1
  168. package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
  169. package/dist/types/adapters/types.d.ts +69 -0
  170. package/dist/types/adapters/types.d.ts.map +1 -1
  171. package/dist/types/cache/CacheDecisionSubflow.d.ts +11 -0
  172. package/dist/types/cache/CacheDecisionSubflow.d.ts.map +1 -1
  173. package/dist/types/conventions.d.ts +8 -0
  174. package/dist/types/conventions.d.ts.map +1 -1
  175. package/dist/types/core/Agent.d.ts +16 -0
  176. package/dist/types/core/Agent.d.ts.map +1 -1
  177. package/dist/types/core/agent/AgentBuilder.d.ts +9 -4
  178. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  179. package/dist/types/core/agent/buildAgentChart.d.ts +14 -0
  180. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  181. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  182. package/dist/types/core/agent/delivery/rules.d.ts +80 -0
  183. package/dist/types/core/agent/delivery/rules.d.ts.map +1 -0
  184. package/dist/types/core/agent/delivery/types.d.ts +52 -0
  185. package/dist/types/core/agent/delivery/types.d.ts.map +1 -0
  186. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  187. package/dist/types/core/agent/stages/deliver.d.ts +60 -0
  188. package/dist/types/core/agent/stages/deliver.d.ts.map +1 -0
  189. package/dist/types/core/agent/types.d.ts +14 -0
  190. package/dist/types/core/agent/types.d.ts.map +1 -1
  191. package/dist/types/core/slots/buildMessagesSlot.d.ts +23 -8
  192. package/dist/types/core/slots/buildMessagesSlot.d.ts.map +1 -1
  193. package/dist/types/hosting/httpHost.d.ts +62 -3
  194. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  195. package/dist/types/hosting/index.d.ts +3 -1
  196. package/dist/types/hosting/index.d.ts.map +1 -1
  197. package/dist/types/hosting/nodeHost.d.ts +21 -2
  198. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  199. package/dist/types/hosting/types.d.ts +6 -0
  200. package/dist/types/hosting/types.d.ts.map +1 -1
  201. package/dist/types/lib/injection-engine/factories/defineFact.d.ts +38 -10
  202. package/dist/types/lib/injection-engine/factories/defineFact.d.ts.map +1 -1
  203. package/dist/types/lib/injection-engine/factories/defineInstruction.d.ts +42 -15
  204. package/dist/types/lib/injection-engine/factories/defineInstruction.d.ts.map +1 -1
  205. package/dist/types/lib/injection-engine/messagesSlotRefusal.d.ts +70 -27
  206. package/dist/types/lib/injection-engine/messagesSlotRefusal.d.ts.map +1 -1
  207. package/dist/types/lib/injection-engine/types.d.ts +35 -9
  208. package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
  209. package/dist/types/memory/asRoleRefusal.d.ts +15 -11
  210. package/dist/types/memory/asRoleRefusal.d.ts.map +1 -1
  211. package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
  212. package/dist/types/resilience/withFallback.d.ts.map +1 -1
  213. package/dist/types/resilience/withRetry.d.ts.map +1 -1
  214. package/package.json +1 -1
@@ -1,31 +1,74 @@
1
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.
2
+ * The messages-slot refusals — said in the same words wherever they are said.
3
+ *
4
+ * ── The arc this module records ──────────────────────────────────────
5
+ * 7.19.1 refused `slot: 'messages'` BY NAME. An Injection targeting the
6
+ * messages slot was RECORDED as injected — `context.injected` fired with
7
+ * its content, the slot composition counted it, the engine routed it —
8
+ * while the request assembled its message list from the conversation
9
+ * itself, so the model never saw it. The recording said one thing and the
10
+ * wire said another, and absence beat that lie.
11
+ *
12
+ * 7.21.0 delivers it, so the refusal moves: from "this placement never
13
+ * reaches the model" to "this placement reaches the model, but not with
14
+ * THAT role on THIS provider, and not at THAT position this iteration."
15
+ * The two facts the old sentence bundled together are now separate, and
16
+ * each is decided against something real:
17
+ *
18
+ * • ROLE — the wire has no system role inside the message list on the
19
+ * Anthropic family (system is a separate top-level field) while the
20
+ * OpenAI family carries it. A provider declares what it carries
21
+ * (`LLMProvider.carriesInMessages`); a role it does not carry is
22
+ * REFUSED at run start, naming the provider and the roles it does
23
+ * carry. Never silently re-roled: changing who appears to speak is a
24
+ * meaning change the app must make, not the library.
25
+ *
26
+ * • POSITION — a delivered injection goes at the END of the history the
27
+ * iteration assembled. If its role would collide with the turn already
28
+ * there, or the tail is waiting on a tool result, delivery is DEFERRED
29
+ * to the next boundary and the deferral is recorded on
30
+ * `messagesDelivery.deferred`. Never a silent drop, never a reorder,
31
+ * never a split `tool_use` / `tool_result` pair.
32
+ *
33
+ * Both refusals are stated in full sentences that name the fix, because a
34
+ * refusal that does not teach just moves the puzzle.
35
+ */
36
+ import type { WireRole } from '../../adapters/types.js';
37
+ /**
38
+ * The role refusal (D2), addressed from `site` (e.g.
39
+ * `defineFact('turn-time')` or the run-start check).
40
+ *
41
+ * Thrown when a `slot: 'messages'` injection declares a role the attached
42
+ * provider drops on the wire. The alternative — quietly rewriting the role
43
+ * to one that fits — would make the recording true and the meaning false.
44
+ */
45
+ export declare function messagesRoleRefusal(args: {
46
+ readonly site: string;
47
+ readonly role: string;
48
+ readonly providerName: string;
49
+ readonly carries: readonly WireRole[];
50
+ }): string;
51
+ /**
52
+ * The role refusal for a role no wire can carry (`'tool'`).
53
+ *
54
+ * A tool message answers one specific `tool_use` id. An injection has no
55
+ * call to answer, so the message it would produce is malformed on every
56
+ * provider — this one is refused by shape, not by capability.
25
57
  */
58
+ export declare function messagesToolRoleRefusal(site: string): string;
59
+ /** Why a delivery was held back this iteration. Recorded, never thrown. */
60
+ export type DeferralReason = 'role-collision' | 'unanswered-tool-call';
26
61
  /**
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.
62
+ * The deferral note (D3) — a sentence on `messagesDelivery.deferred`, which
63
+ * is the committed answer to "why is my declaration not on the wire yet?".
64
+ *
65
+ * Not an error: the next boundary retries it unchanged. The note names what
66
+ * blocked it so the reader does not have to reconstruct the window to find out.
30
67
  */
31
- export declare function messagesSlotRefusal(site: string): string;
68
+ export declare function messagesDeferralNote(args: {
69
+ readonly injectionId: string;
70
+ readonly role: string;
71
+ readonly reason: DeferralReason;
72
+ /** The effective wire role of the turn currently at the end of the window. */
73
+ readonly tailRole?: string;
74
+ }): string;
@@ -1,40 +1,97 @@
1
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.
2
+ * The messages-slot refusals — said in the same words wherever they are said.
3
+ *
4
+ * ── The arc this module records ──────────────────────────────────────
5
+ * 7.19.1 refused `slot: 'messages'` BY NAME. An Injection targeting the
6
+ * messages slot was RECORDED as injected — `context.injected` fired with
7
+ * its content, the slot composition counted it, the engine routed it —
8
+ * while the request assembled its message list from the conversation
9
+ * itself, so the model never saw it. The recording said one thing and the
10
+ * wire said another, and absence beat that lie.
11
+ *
12
+ * 7.21.0 delivers it, so the refusal moves: from "this placement never
13
+ * reaches the model" to "this placement reaches the model, but not with
14
+ * THAT role on THIS provider, and not at THAT position this iteration."
15
+ * The two facts the old sentence bundled together are now separate, and
16
+ * each is decided against something real:
17
+ *
18
+ * • ROLE — the wire has no system role inside the message list on the
19
+ * Anthropic family (system is a separate top-level field) while the
20
+ * OpenAI family carries it. A provider declares what it carries
21
+ * (`LLMProvider.carriesInMessages`); a role it does not carry is
22
+ * REFUSED at run start, naming the provider and the roles it does
23
+ * carry. Never silently re-roled: changing who appears to speak is a
24
+ * meaning change the app must make, not the library.
25
+ *
26
+ * • POSITION — a delivered injection goes at the END of the history the
27
+ * iteration assembled. If its role would collide with the turn already
28
+ * there, or the tail is waiting on a tool result, delivery is DEFERRED
29
+ * to the next boundary and the deferral is recorded on
30
+ * `messagesDelivery.deferred`. Never a silent drop, never a reorder,
31
+ * never a split `tool_use` / `tool_result` pair.
32
+ *
33
+ * Both refusals are stated in full sentences that name the fix, because a
34
+ * refusal that does not teach just moves the puzzle.
25
35
  */
36
+ /** Render a role list the way the refusals quote it. */
37
+ function listRoles(roles) {
38
+ if (roles.length === 0)
39
+ return 'no roles at all';
40
+ if (roles.length === 1)
41
+ return `\`${roles[0]}\``;
42
+ const quoted = roles.map((r) => `\`${r}\``);
43
+ return `${quoted.slice(0, -1).join(', ')} and ${quoted[quoted.length - 1]}`;
44
+ }
26
45
  /**
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.
46
+ * The role refusal (D2), addressed from `site` (e.g.
47
+ * `defineFact('turn-time')` or the run-start check).
48
+ *
49
+ * Thrown when a `slot: 'messages'` injection declares a role the attached
50
+ * provider drops on the wire. The alternative — quietly rewriting the role
51
+ * to one that fits — would make the recording true and the meaning false.
52
+ */
53
+ export function messagesRoleRefusal(args) {
54
+ return (`${args.site}: \`role: '${args.role}'\` cannot be delivered inside the message ` +
55
+ `list by the '${args.providerName}' provider, which carries ${listRoles(args.carries)}. ` +
56
+ `The message would be recorded as injected and dropped on the wire, so it is ` +
57
+ `refused here instead. Pick a role this provider carries, put the content in ` +
58
+ `\`slot: 'system-prompt'\` (delivered by every provider), or return it from the ` +
59
+ `tool whose result it is about — a tool result IS a real message at the recency ` +
60
+ `this option is reaching for. The role is never rewritten for you: who appears ` +
61
+ `to speak is your decision, not the library's.`);
62
+ }
63
+ /**
64
+ * The role refusal for a role no wire can carry (`'tool'`).
65
+ *
66
+ * A tool message answers one specific `tool_use` id. An injection has no
67
+ * call to answer, so the message it would produce is malformed on every
68
+ * provider — this one is refused by shape, not by capability.
69
+ */
70
+ export function messagesToolRoleRefusal(site) {
71
+ return (`${site}: \`role: 'tool'\` cannot be injected. A tool message is the answer to a ` +
72
+ `specific tool call and carries that call's id; an injection has no call to ` +
73
+ `answer, so no provider would accept the result. Use \`'user'\` or \`'assistant'\` ` +
74
+ `(\`'system'\` on providers that carry it), or return the content from the tool itself.`);
75
+ }
76
+ /**
77
+ * The deferral note (D3) — a sentence on `messagesDelivery.deferred`, which
78
+ * is the committed answer to "why is my declaration not on the wire yet?".
79
+ *
80
+ * Not an error: the next boundary retries it unchanged. The note names what
81
+ * blocked it so the reader does not have to reconstruct the window to find out.
30
82
  */
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 })\`.`);
83
+ export function messagesDeferralNote(args) {
84
+ if (args.reason === 'unanswered-tool-call') {
85
+ return (`'${args.injectionId}' was held back this iteration: the window ends on a tool ` +
86
+ `call that has not been answered yet, and placing a message there would split a ` +
87
+ `tool_use / tool_result pair. It is retried at the next boundary, unchanged.`);
88
+ }
89
+ return (`'${args.injectionId}' was held back this iteration: it would land as ` +
90
+ `\`${args.role}\` immediately after a \`${args.tailRole ?? 'unknown'}\` turn, and ` +
91
+ `providers reject two turns of the same role in a row. It is retried at the next ` +
92
+ `boundary, unchanged — nothing is reordered to make room. In a tool-using loop the ` +
93
+ `window ends on the user's turn or on tool results, so a \`user\` role typically ` +
94
+ `never gets a slot; use \`assistant\`, use \`system\` on a provider that carries it, ` +
95
+ `or return the content from the tool.`);
39
96
  }
40
97
  //# sourceMappingURL=messagesSlotRefusal.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"messagesSlotRefusal.js","sourceRoot":"","sources":["../../../../src/lib/injection-engine/messagesSlotRefusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,wDAAwD;AACxD,SAAS,SAAS,CAAC,KAA0B;IAC3C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,iBAAiB,CAAC;IACjD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAKnC;IACC,OAAO,CACL,GAAG,IAAI,CAAC,IAAI,cAAc,IAAI,CAAC,IAAI,6CAA6C;QAChF,gBAAgB,IAAI,CAAC,YAAY,6BAA6B,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI;QACzF,8EAA8E;QAC9E,8EAA8E;QAC9E,iFAAiF;QACjF,iFAAiF;QACjF,gFAAgF;QAChF,+CAA+C,CAChD,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,CACL,GAAG,IAAI,2EAA2E;QAClF,6EAA6E;QAC7E,oFAAoF;QACpF,wFAAwF,CACzF,CAAC;AACJ,CAAC;AAKD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAMpC;IACC,IAAI,IAAI,CAAC,MAAM,KAAK,sBAAsB,EAAE,CAAC;QAC3C,OAAO,CACL,IAAI,IAAI,CAAC,WAAW,4DAA4D;YAChF,iFAAiF;YACjF,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IACD,OAAO,CACL,IAAI,IAAI,CAAC,WAAW,mDAAmD;QACvE,KAAK,IAAI,CAAC,IAAI,4BAA4B,IAAI,CAAC,QAAQ,IAAI,SAAS,eAAe;QACnF,kFAAkF;QAClF,oFAAoF;QACpF,kFAAkF;QAClF,sFAAsF;QACtF,sCAAsC,CACvC,CAAC;AACJ,CAAC"}
@@ -57,16 +57,26 @@ export interface InjectionContent {
57
57
  /** Text appended to the system-prompt slot when active. */
58
58
  readonly systemPrompt?: string;
59
59
  /**
60
- * Messages appended to the messages slot when active.
60
+ * Messages DELIVERED into the conversation when active (7.21.0).
61
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.
62
+ * Delivery means what it says: the agent's `Deliver` stage appends these
63
+ * to `scope.history` itself at the injection-engine boundary — never a
64
+ * parallel array spliced in at send time — so the window strategies, the
65
+ * three slots, the commit log and the wire all see one past. Two rules
66
+ * govern it, and both can say no:
67
+ *
68
+ * • a role the attached provider does not carry inside `messages` is
69
+ * REFUSED at run start, naming the provider (the Anthropic family
70
+ * drops `role: 'system'` there; the OpenAI family carries it);
71
+ * • a message whose role would collide with the turn at the end of the
72
+ * window, or that would split a `tool_use`/`tool_result` pair, is
73
+ * DEFERRED to the next boundary and recorded on
74
+ * `messagesDelivery.deferred`.
75
+ *
76
+ * Between 7.19.1 and 7.21.0 this field was unreachable by declaration:
77
+ * content placed here was recorded as injected and never sent, so the
78
+ * declaration was refused rather than believed. See
79
+ * `messagesSlotRefusal.ts` for the whole arc.
70
80
  */
71
81
  readonly messages?: ReadonlyArray<{
72
82
  readonly role: ContextRole;
@@ -223,6 +233,22 @@ export interface ActiveInjection {
223
233
  * consumers wire this manually via `agentfootprint/tool-providers`.
224
234
  */
225
235
  readonly autoActivate?: 'currentSkill';
236
+ /**
237
+ * The injection's cache directive, carried across the projection.
238
+ *
239
+ * It has to be here explicitly. `Injection.metadata` is a free-form bag
240
+ * that this projection deliberately does NOT copy wholesale, and the cache
241
+ * decision (`computeCacheMarkers`) reads exactly one key out of it — so
242
+ * before 7.21.0 every injection arrived at that decision with no policy
243
+ * and resolved to `'never'`, which meant no `tools` or `messages` cache
244
+ * marker could ever fire in a real run no matter what the consumer
245
+ * declared. Projecting the one key the decision reads makes the declared
246
+ * policy the policy that is applied.
247
+ *
248
+ * Absent when the injection declared none (hand-built Injections); the
249
+ * decision's own `?? 'never'` default then applies, as it always did.
250
+ */
251
+ readonly cache?: import('../../cache/types.js').CachePolicy;
226
252
  readonly inject: {
227
253
  readonly systemPrompt?: string;
228
254
  readonly messages?: ReadonlyArray<{
@@ -30,6 +30,12 @@ export function projectActiveInjection(inj) {
30
30
  ...(meta?.autoActivate && {
31
31
  autoActivate: meta.autoActivate,
32
32
  }),
33
+ // The cache directive rides across too — see the field's note. Without it
34
+ // the cache decision reads `undefined` for every injection and defaults to
35
+ // "never cacheable", which silently discards what the consumer declared.
36
+ ...(meta?.cache !== undefined && {
37
+ cache: meta.cache,
38
+ }),
33
39
  inject: {
34
40
  ...(inj.inject.systemPrompt && { systemPrompt: inj.inject.systemPrompt }),
35
41
  ...(inj.inject.messages && { messages: inj.inject.messages.map((m) => ({ ...m })) }),
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/injection-engine/types.ts"],"names":[],"mappings":"A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AAC,EAAE,EAAE,CAAC,CAAC;oBAClC,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE;oBACvB,WAAW,EAAE,GAAG,CAAC,EAAE;iBACpB,CAAC,CAAC;aACJ,CAAC;SACH;KACF,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -12,18 +12,22 @@
12
12
  * the lie legible: a reader could pick a role, read it back off the
13
13
  * definition, and be told a role the run would never use.
14
14
  *
15
- * Delivering it instead is not a one-line change. Role-differentiated
16
- * recall means putting non-system content into the message list, and the
17
- * messages slot does not reach the model today (see
18
- * `lib/injection-engine/messagesSlotRefusal.ts`): it is the observability
19
- * projection of the conversation, not a wire. Honouring `asRole: 'user'`
20
- * would have to route through that slot, which would trade a dead option
21
- * for a recorded-and-dropped one — strictly worse, because the recording
22
- * would then claim delivery.
15
+ * When this was written the messages slot did not reach the model at all,
16
+ * so honouring `asRole` would have traded a dead option for a
17
+ * recorded-and-dropped one. Since 7.21.0 it DOES reach the model: a
18
+ * `slot: 'messages'` injection is delivered into `scope.history`, subject to
19
+ * what the provider carries and to the sequence rule
20
+ * (`lib/injection-engine/messagesSlotRefusal.ts`). The mechanism a
21
+ * role-differentiated recall would ride now exists.
23
22
  *
24
- * So the option is refused where it is written, and the refusal points at
25
- * the feature that would make it real: role-differentiated recall arrives
26
- * with messages delivery, if field evidence asks for it.
23
+ * The refusal still stands, and the reason it stands is now the only reason
24
+ * it ever really had: **nobody has asked for it.** A recall formatter that
25
+ * emits a non-system role can be written today — it becomes a messages-slot
26
+ * injection with a declared role, checked like any other. What is missing is
27
+ * evidence that role-differentiated recall answers a real question better
28
+ * than the system prompt does. Building it because the machinery exists is
29
+ * how a library grows options nobody reads — which is exactly the thing this
30
+ * refusal is here to undo. Field evidence decides, not availability.
27
31
  *
28
32
  * A throw where there was a silent lie is a fix, not a break: nothing that
29
33
  * worked stops working, and something that never worked stops pretending.
@@ -12,18 +12,22 @@
12
12
  * the lie legible: a reader could pick a role, read it back off the
13
13
  * definition, and be told a role the run would never use.
14
14
  *
15
- * Delivering it instead is not a one-line change. Role-differentiated
16
- * recall means putting non-system content into the message list, and the
17
- * messages slot does not reach the model today (see
18
- * `lib/injection-engine/messagesSlotRefusal.ts`): it is the observability
19
- * projection of the conversation, not a wire. Honouring `asRole: 'user'`
20
- * would have to route through that slot, which would trade a dead option
21
- * for a recorded-and-dropped one — strictly worse, because the recording
22
- * would then claim delivery.
15
+ * When this was written the messages slot did not reach the model at all,
16
+ * so honouring `asRole` would have traded a dead option for a
17
+ * recorded-and-dropped one. Since 7.21.0 it DOES reach the model: a
18
+ * `slot: 'messages'` injection is delivered into `scope.history`, subject to
19
+ * what the provider carries and to the sequence rule
20
+ * (`lib/injection-engine/messagesSlotRefusal.ts`). The mechanism a
21
+ * role-differentiated recall would ride now exists.
23
22
  *
24
- * So the option is refused where it is written, and the refusal points at
25
- * the feature that would make it real: role-differentiated recall arrives
26
- * with messages delivery, if field evidence asks for it.
23
+ * The refusal still stands, and the reason it stands is now the only reason
24
+ * it ever really had: **nobody has asked for it.** A recall formatter that
25
+ * emits a non-system role can be written today — it becomes a messages-slot
26
+ * injection with a declared role, checked like any other. What is missing is
27
+ * evidence that role-differentiated recall answers a real question better
28
+ * than the system prompt does. Building it because the machinery exists is
29
+ * how a library grows options nobody reads — which is exactly the thing this
30
+ * refusal is here to undo. Field evidence decides, not availability.
27
31
  *
28
32
  * A throw where there was a silent lie is a fix, not a break: nothing that
29
33
  * worked stops working, and something that never worked stops pretending.
@@ -37,10 +41,12 @@ export function asRoleRefusal(site) {
37
41
  return (`${site}: \`asRole\` has never been read. Every formatter this library ships ` +
38
42
  `writes \`role: 'system'\`, so recall is always injected as system — the option ` +
39
43
  `was stored on the definition and ignored by the run. It is removed rather than ` +
40
- `honoured, because honouring it means putting recall into the messages slot, ` +
41
- `which does not reach the model. Role-differentiated recall arrives with the ` +
42
- `messages-delivery feature, if field evidence asks for it. Drop the option: ` +
43
- `the behaviour you already had does not change.`);
44
+ `honoured: it was refused before the messages slot could deliver anything, and ` +
45
+ `it stays refused now that it can, because no field evidence asks for ` +
46
+ `role-differentiated recall. The machinery is there — a recall formatter that ` +
47
+ `emits a non-system role becomes a \`slot: 'messages'\` injection with a declared ` +
48
+ `role — so this is a decision, not a limitation. Drop the option: the behaviour ` +
49
+ `you already had does not change.`);
44
50
  }
45
51
  /**
46
52
  * Throw the refusal when a caller passed `asRole`. Presence, not value —
@@ -1 +1 @@
1
- {"version":3,"file":"asRoleRefusal.js","sourceRoot":"","sources":["../../../src/memory/asRoleRefusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,CACL,GAAG,IAAI,uEAAuE;QAC9E,iFAAiF;QACjF,iFAAiF;QACjF,8EAA8E;QAC9E,8EAA8E;QAC9E,6EAA6E;QAC7E,gDAAgD,CACjD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,IAAY;IACxD,IAAI,QAAQ,IAAI,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE,CAAC"}
1
+ {"version":3,"file":"asRoleRefusal.js","sourceRoot":"","sources":["../../../src/memory/asRoleRefusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,CACL,GAAG,IAAI,uEAAuE;QAC9E,iFAAiF;QACjF,iFAAiF;QACjF,gFAAgF;QAChF,uEAAuE;QACvE,+EAA+E;QAC/E,mFAAmF;QACnF,iFAAiF;QACjF,kCAAkC,CACnC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,IAAY;IACxD,IAAI,QAAQ,IAAI,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE,CAAC"}
@@ -194,6 +194,12 @@ export function withCircuitBreaker(inner, options = {}) {
194
194
  }
195
195
  const wrapped = {
196
196
  name: inner.name,
197
+ // Same wire, same roles — a breaker only decides WHETHER to call. See the
198
+ // note in withRetry: this rebuilds the provider object, so the capability
199
+ // has to be carried across explicitly or it degrades to the floor.
200
+ ...(inner.carriesInMessages !== undefined && {
201
+ carriesInMessages: inner.carriesInMessages,
202
+ }),
197
203
  async complete(req, hooks) {
198
204
  rejectFastIfOpen();
199
205
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"withCircuitBreaker.js","sourceRoot":"","sources":["../../../src/resilience/withCircuitBreaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AAwCH,wEAAwE;AAExE;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,GAAG,kBAA2B,CAAC;IAC5C;+CAC2C;IAClC,KAAK,CAAU;IACxB,gEAAgE;IACvD,UAAU,CAAS;IAC5B,YAAY,YAAoB,EAAE,KAAc,EAAE,UAAkB;QAClE,KAAK,CACH,IAAI,YAAY,2DAA2D,IAAI,IAAI,CACjF,UAAU,CACX,CAAC,WAAW,EAAE,wBACZ,KAA8B,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAC1D,EAAE,CACH,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAYD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAkB,EAClB,UAAqC,EAAE;IAE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AAC,EAAE,CAAC;wBACpD,eAAe,GAAG,IAAI,CAAC;wBACvB,MAAM,KAAK,CAAC;oBACd,CAAC;oBACD,aAAa,EAAE,CAAC;gBAClB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,yDAAyD;oBACzD,2DAA2D;oBAC3D,8DAA8D;oBAC9D,kCAAkC;oBAClC,IAAI,CAAC,eAAe;wBAAE,aAAa,CAAC,GAAG,CAAC,CAAC;oBACzC,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;SACF,CAAC;KACH,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,wEAAwE;AAExE,SAAS,kBAAkB,CAAC,KAAc;IACxC,kCAAkC;IAClC,MAAM,CAAC,GAAG,KAAqD,CAAC;IAChE,IAAI,CAAC,EAAE,IAAI,KAAK,YAAY;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,CAAC,EAAE,IAAI,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -17,6 +17,17 @@
17
17
  * has yielded chunks the stream is committed — fallback would
18
18
  * duplicate the partial output.
19
19
  */
20
+ import { DEFAULT_CARRIES_IN_MESSAGES } from '../adapters/types.js';
21
+ /**
22
+ * The message roles BOTH providers carry — the only honest capability for a
23
+ * pair where either one may serve the call. An undeclared provider counts as
24
+ * the user/assistant floor, so pairing with one clamps the result to it.
25
+ */
26
+ function carriedByBoth(a, b) {
27
+ const left = a.carriesInMessages ?? DEFAULT_CARRIES_IN_MESSAGES;
28
+ const right = new Set(b.carriesInMessages ?? DEFAULT_CARRIES_IN_MESSAGES);
29
+ return Object.freeze(left.filter((role) => right.has(role)));
30
+ }
20
31
  /**
21
32
  * Wrap a primary provider with a fallback. Tries primary first; on
22
33
  * error matching the policy, calls the fallback.
@@ -48,6 +59,13 @@ export function withFallback(primary, fallback, options = {}) {
48
59
  }
49
60
  const wrapped = {
50
61
  name: `${primary.name}|${fallback.name}`,
62
+ // The INTERSECTION, and only the intersection. Either provider may serve
63
+ // the call, so a role only ONE of them carries is a role the call might
64
+ // drop — and a delivery that lands or vanishes depending on which side
65
+ // answered is precisely the provider-dependent recording this capability
66
+ // exists to prevent. Undeclared means the user/assistant floor on that
67
+ // side, so an undeclared partner clamps the pair to the floor.
68
+ carriesInMessages: carriedByBoth(primary, fallback),
51
69
  async complete(req, hooks) {
52
70
  try {
53
71
  return await primary.complete(req, hooks);
@@ -1 +1 @@
1
- {"version":3,"file":"withFallback.js","sourceRoot":"","sources":["../../../src/resilience/withFallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA8BH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAoB,EACpB,QAAqB,EACrB,UAA+B,EAAE;IAEjC,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,qBAAqB,CAAC;IACvE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAEtC;;;;;;OAMG;IACH,SAAS,cAAc,CAAC,KAA+B,EAAE,GAAY;QACnE,KAAK,EAAE,YAAY,EAAE,CAAC;YACpB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,OAAO,CAAC,IAAI;YACrB,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACzD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAgB;QAC3B,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE;QACxC,KAAK,CAAC,QAAQ,CAAC,GAAe,EAAE,KAAoB;YAClD,IAAI,CAAC;gBACH,OAAO,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,GAAG,E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AC,GAAG,EAAE,KAAK,CAAC,CAAC;;oBACnD,KAAK,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,uEAAuE;AAEvE,SAAS,qBAAqB,CAAC,GAAY;IACzC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,CAAC,GAAG,GAAuC,CAAC;IAClD,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,KAAK,SAAS,CAAC,CAAC,gBAAgB,CAC9B,QAAqB,EACrB,GAAe,EACf,KAAoB;IAEpB,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,MAAM;QACJ,UAAU,EAAE,CAAC;QACb,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,IAAI;QACV,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -39,6 +39,14 @@ export function withRetry(provider, options = {}) {
39
39
  const onRetry = options.onRetry;
40
40
  const wrapped = {
41
41
  name: `${provider.name}+retry`,
42
+ // A retry calls the SAME wire, so it carries exactly what that wire
43
+ // carries. Forwarded rather than inherited: this object is rebuilt from
44
+ // scratch, and a dropped capability silently narrows to the
45
+ // user/assistant floor — a wrapped OpenAI provider would start refusing
46
+ // system-role delivery it can perfectly well do.
47
+ ...(provider.carriesInMessages !== undefined && {
48
+ carriesInMessages: provider.carriesInMessages,
49
+ }),
42
50
  async complete(req, hooks) {
43
51
  let lastError;
44
52
  // t0 for the `recovered` report's totalDurationMs. New
@@ -1 +1 @@
1
- {"version":3,"file":"withRetry.js","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