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
@@ -385,10 +385,15 @@ export declare class AgentBuilder {
385
385
  * for built-in flavors use the typed sugar (`.skill`, `.steering`,
386
386
  * `.instruction`, `.fact`).
387
387
  *
388
- * An Injection carrying `inject.messages` is refused here — the named
389
- * factories refuse the same thing at declaration, and this is the one
390
- * funnel every flavor passes through, so a hand-built Injection cannot
391
- * reach the run by going around them. See {@link messagesSlotRefusal}.
388
+ * An Injection carrying `inject.messages` is ROUTED here, not refused
389
+ * (7.19.1 refused it; 7.21.0 delivers it). What still gets refused is the
390
+ * pair the wire cannot take: a `role: 'tool'` message has no tool call to
391
+ * answer, so it is rejected here, at the declaration, on every provider.
392
+ * A role the ATTACHED provider cannot carry is a different question — it
393
+ * depends on the provider, which this builder does not have — so it is
394
+ * refused at run start instead, by name. This is the one funnel every
395
+ * flavor passes through, so a hand-built Injection cannot go around the
396
+ * checks the named factories make.
392
397
  */
393
398
  injection(injection: Injection): this;
394
399
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAG7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sB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OAAO,CAAC,IAAI,GAAE,qBAA0B,GAAG,IAAI;IAQ/C,WAAW,CAAC,IAAI,GAAE,kBAAuB,GAAG,IAAI;IAmBhD,KAAK,IAAI,KAAK;CAsFf"}
@@ -92,6 +92,20 @@ export interface AgentChartDeps {
92
92
  readonly strategyName: string;
93
93
  readonly run: (scope: never) => Promise<void>;
94
94
  };
95
+ /**
96
+ * The messages-slot DELIVERY stage (7.21). Present ONLY when the agent has
97
+ * something that could target the messages slot — a registered injection
98
+ * declaring `inject.messages`, or any `.memory()` whose recall might format
99
+ * as a non-system role. When absent the chart is the one it always was, so
100
+ * an agent with nothing to deliver is byte-identical to 7.20.
101
+ *
102
+ * Mounted between the InjectionEngine and the Context fan-out: after the
103
+ * engine has decided what is active, before anything reads the window. The
104
+ * placement is the design — a delivered message has to be part of the past
105
+ * that the slots project, the cache decision indexes, and the wire sends,
106
+ * or the recording and the request would disagree about the conversation.
107
+ */
108
+ readonly deliverStage?: (scope: never) => void;
95
109
  readonly systemPromptSubflow: FlowChart;
96
110
  readonly messagesSubflow: FlowChart;
97
111
  readonly toolsSubflow: FlowChart;
@@ -1 +1 @@
1
- {"version":3,"file":"buildAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAc,MAAM,aAAa,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAUrE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAE/C;;;8DAG0D;IAC1D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,OAAO,yCA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Chart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildDynamicAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAezD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgD3D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAuYtE"}
1
+ {"version":3,"file":"buildDynamicAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildDynamicAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAezD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA4D3D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAkbtE"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * delivery/rules — where a delivered injection may go, and whether it is
3
+ * already there.
4
+ *
5
+ * Pattern: Pure functions over the window (no scope, no I/O, no provider).
6
+ * Role: core/ layer. The counterpart to `window/turns.ts`: that module
7
+ * decides what may LEAVE the window, this one decides what may
8
+ * ENTER it. Both answer with a refusal that names itself, and both
9
+ * exist so the rule lives in exactly one place instead of being
10
+ * re-derived at each call site.
11
+ * Emits: N/A.
12
+ *
13
+ * ── The one rule worth arguing about ─────────────────────────────────
14
+ * Collision is judged on the EFFECTIVE wire role, where `'tool'` counts as
15
+ * `'user'`. That is deliberately more conservative than any single provider
16
+ * requires: Anthropic coalesces `tool_result`s into a user turn (so a user
17
+ * message after tool results breaks its strict alternation), while OpenAI
18
+ * keeps `role: 'tool'` and would accept one. Judging per-provider would make
19
+ * the SAME declaration deliver on one wire and defer on another, with
20
+ * nothing in the recording to tell them apart — which is the exact
21
+ * provider-dependent truth this whole feature exists to avoid. So the floor
22
+ * is the rule, uniformly.
23
+ *
24
+ * The consequence is real and stated rather than hidden: inside a tool-using
25
+ * agent loop the window ends on the user's turn (iteration 1) or on tool
26
+ * results (every iteration after), so a `'user'`-role injection typically
27
+ * never gets a slot. `'assistant'` does, and `'system'` does on the providers
28
+ * that carry it.
29
+ *
30
+ * Testable on its own — see `test/core/delivery/delivery-rules.test.ts`.
31
+ */
32
+ import type { LLMMessage, WireRole } from '../../../adapters/types.js';
33
+ import type { DeferralReason } from '../../../lib/injection-engine/messagesSlotRefusal.js';
34
+ /**
35
+ * The role a message OCCUPIES on the wire, for sequencing purposes.
36
+ *
37
+ * A `tool` message is folded into `user` because that is what the strictest
38
+ * provider does with it. Everything else is itself.
39
+ */
40
+ export declare function effectiveWireRole(role: LLMMessage['role']): WireRole;
41
+ /**
42
+ * The stable identity of one deliverable message: who declared it, and what
43
+ * it says.
44
+ *
45
+ * Position within the injection's own list is deliberately NOT part of the
46
+ * key — it cannot be recovered from a message already sitting in the window,
47
+ * and the key has to mean the same thing whether it is read from the run's
48
+ * ledger or recovered from a marker on a restored history. Content identity
49
+ * is what matters: a memory recall whose text changed between iterations is a
50
+ * NEW delivery (it is new content), an always-on fact repeating verbatim is
51
+ * the same one and is delivered once, and one injection declaring the same
52
+ * sentence twice says it once.
53
+ */
54
+ export declare function deliveryKey(injectionId: string, role: string, content: string): string;
55
+ /**
56
+ * Every delivery key already present as a marker in the window.
57
+ *
58
+ * Unioned with the run's ledger before deciding what to deliver, and that
59
+ * union is what makes replay safe: `agent.resumeOnError` rebuilds the
60
+ * conversation but starts a fresh scope, so the ledger is empty while the
61
+ * delivered messages are right there in the restored history. Reading the
62
+ * window itself is the only way to know that.
63
+ */
64
+ export declare function keysInWindow(history: readonly LLMMessage[]): ReadonlySet<string>;
65
+ /**
66
+ * Why a message may NOT be appended to the end of `history` right now, or
67
+ * `undefined` when it may.
68
+ *
69
+ * Two refusals, in the order a reader cares about them:
70
+ * • `unanswered-tool-call` — the tail is an assistant turn whose tool calls
71
+ * have no results yet. Appending here would sit BETWEEN a `tool_use` and
72
+ * its `tool_result`, which is the one split the window family refuses in
73
+ * the other direction too.
74
+ * • `role-collision` — the turn at the end already speaks in this effective
75
+ * role, and providers reject two in a row.
76
+ */
77
+ export declare function refusalForPlacement(history: readonly LLMMessage[], role: WireRole): DeferralReason | undefined;
78
+ /** The effective role of the turn a delivery would land behind, for the note. */
79
+ export declare function tailWireRole(history: readonly LLMMessage[]): WireRole | undefined;
80
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/delivery/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AAE3F;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,QAAQ,CAEpE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAQhF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,IAAI,EAAE,QAAQ,GACb,cAAc,GAAG,SAAS,CAc5B;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,QAAQ,GAAG,SAAS,CAGjF"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * delivery/types — what the `Deliver` stage records about itself.
3
+ *
4
+ * Two shapes, one per outcome, both plain data so they survive
5
+ * `structuredClone` and land in the commit log as-is. Together they are the
6
+ * committed answer to "is my `slot: 'messages'` declaration on the wire, and
7
+ * if not, why not?" — asked of `snapshot.sharedState.messagesDelivery`, or of
8
+ * any commit-log query over the `Deliver` stage's own write.
9
+ */
10
+ import type { ContextSource } from '../../../events/types.js';
11
+ import type { WireRole } from '../../../adapters/types.js';
12
+ import type { DeferralReason } from '../../../lib/injection-engine/messagesSlotRefusal.js';
13
+ /** One injection message that entered the window this iteration. */
14
+ export interface DeliveredMessage {
15
+ readonly injectionId: string;
16
+ readonly flavor: ContextSource;
17
+ readonly role: WireRole;
18
+ /**
19
+ * Index of the message in `scope.history` — which IS the index in
20
+ * `LLMRequest.messages`, because `callLLM` sends the window verbatim.
21
+ * This is the index a `CacheMarker{field:'messages'}` names.
22
+ */
23
+ readonly wireIndex: number;
24
+ /**
25
+ * The same content hash the messages slot reports as injected and the
26
+ * window stage reports as evicted, so all three name one piece of context
27
+ * by one name.
28
+ */
29
+ readonly contentHash: string;
30
+ /** The stable key that keeps a delivery from happening twice. */
31
+ readonly key: string;
32
+ }
33
+ /** One injection message that was held back this iteration, and why. */
34
+ export interface DeferredMessage {
35
+ readonly injectionId: string;
36
+ readonly flavor: ContextSource;
37
+ readonly role: WireRole;
38
+ readonly reason: DeferralReason;
39
+ /** The full sentence — see `messagesDeferralNote`. */
40
+ readonly note: string;
41
+ }
42
+ /**
43
+ * The `Deliver` stage's per-iteration record. Overwritten each iteration
44
+ * (the commit log preserves the sequence), like every other per-iteration
45
+ * value in `AgentState`.
46
+ */
47
+ export interface MessagesDelivery {
48
+ readonly iteration: number;
49
+ readonly delivered: readonly DeliveredMessage[];
50
+ readonly deferred: readonly DeferredMessage[];
51
+ }
52
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/delivery/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AAE3F,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;CAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"callLLM.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"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a,CAAC;IACtC;;sEAEkE;IAClE,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C;;;;;uBAKmB;IACnB,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IACzC;;;;;;oCAMgC;IAChC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC1D;;yDAEqD;IACrD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,GACrB,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CA4PlD"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * deliver — the stage that lets a `slot: 'messages'` injection into the window.
3
+ *
4
+ * Runs once per ReAct iteration, immediately after the Injection Engine has
5
+ * decided what is active and BEFORE the three slots compose, so everything
6
+ * downstream in the turn — the messages projection, the cache decision, and
7
+ * the wire itself — sees the same past. The window law, from the entering
8
+ * side: no component gets a different past than the model does.
9
+ *
10
+ * ── Why history, and not a splice at send time ───────────────────────
11
+ * A delivered injection IS part of the conversation or it is a lie. Writing
12
+ * it into `scope.history` (rather than into a parallel array the request
13
+ * builder concatenates) is what makes every existing mechanism true of it
14
+ * for free: the window strategies see it, count it and may fold it under the
15
+ * standard refusal rules; the commit log records its arrival as a write by
16
+ * THIS stage, so "who let it in" has an answer with a runtimeStageId on it;
17
+ * `traceVariable` and the slices read it with no changes at all. The
18
+ * alternative — a second list merged at the last moment — would have given
19
+ * the model a past that no recorder in the library had ever seen.
20
+ *
21
+ * ── The three ways this stage says no ────────────────────────────────
22
+ * 1. ROLE (D2, fatal) — the attached provider does not carry that role
23
+ * inside `messages`. Throws, naming the provider and what it carries.
24
+ * The statically-declared injections were already checked at run start;
25
+ * this catches what only appears at runtime (a hand-built memory-recall
26
+ * subflow formatting recall as a non-system role).
27
+ * 2. PLACEMENT (D3, deferral) — the role would collide with the turn at the
28
+ * end of the window, or the tail is waiting on a tool result. Recorded on
29
+ * `messagesDelivery.deferred` with a sentence, and retried unchanged at
30
+ * the next boundary. Never dropped, never reordered.
31
+ * 3. ALREADY THERE (dedupe) — this exact declaration has been delivered in
32
+ * this run. Deliberately silent: it is not a refusal, it is the absence
33
+ * of a second event.
34
+ *
35
+ * A deferral stops that INJECTION for the iteration, not the whole stage: a
36
+ * later injection with a role that does fit still gets its slot. What it
37
+ * cannot do is jump the one in front of it within its own message list —
38
+ * order inside a declaration is the declaration's meaning.
39
+ *
40
+ * Writes (visible stage state — no new event contract; the per-slot route and
41
+ * delta ride the same way):
42
+ * history — the delivered messages, appended, marked
43
+ * messagesDelivery — this iteration's delivered + deferred record
44
+ * deliveredMessageKeys — the run's delivery ledger (dedupe)
45
+ */
46
+ import type { TypedScope } from 'footprintjs';
47
+ import type { LLMProvider, WireRole } from '../../../adapters/types.js';
48
+ import type { AgentState } from '../types.js';
49
+ export interface DeliverStageDeps {
50
+ /** The attached provider — the authority on what the wire can carry. */
51
+ readonly provider: LLMProvider;
52
+ /** Memory ids whose recall composes into the active set, exactly as the
53
+ * slots compose it (so the stage and the slots agree on what is active). */
54
+ readonly memoryIds: readonly string[];
55
+ }
56
+ /** What a provider carries inside `messages`, with the floor applied. */
57
+ export declare function carriedRoles(provider: LLMProvider): readonly WireRole[];
58
+ /** Build the delivery stage. */
59
+ export declare function buildDeliverStage(deps: DeliverStageDeps): (scope: TypedScope<AgentState>) => void;
60
+ //# sourceMappingURL=deliver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deliver.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/deliver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAc,WAAW,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAWpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B;iFAC6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,QAAQ,EAAE,CAEvE;AAED,gCAAgC;AAChC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAuGjG"}
@@ -19,6 +19,7 @@ import type { ToolArgValidationMode } from './toolArgsValidation.js';
19
19
  import type { ThinkingBlock } from '../../thinking/types.js';
20
20
  import type { ReliabilityScope } from '../../reliability/types.js';
21
21
  import type { WindowRecord } from './window/types.js';
22
+ import type { MessagesDelivery } from './delivery/types.js';
22
23
  import type { MiddlewareDecision } from './middleware/types.js';
23
24
  /**
24
25
  * Dials for the deferred observer queue (RFC-001) — only meaningful with
@@ -380,6 +381,19 @@ export interface AgentState {
380
381
  toolName: string;
381
382
  result: string;
382
383
  };
384
+ /** The `Deliver` stage's record for THIS iteration: which messages-slot
385
+ * injections entered the window, and which were held back with the
386
+ * sentence saying why. Overwritten per iteration (the commit log keeps
387
+ * the sequence). This is the committed answer to "why is my declaration
388
+ * not on the wire?" — read it from `snapshot.sharedState`. Absent for an
389
+ * agent that has no messages-slot delivery mounted. */
390
+ messagesDelivery?: MessagesDelivery;
391
+ /** The run's delivery ledger — every `deliveryKey` already let in, so an
392
+ * always-on injection is delivered ONCE rather than re-appended every
393
+ * iteration. Unioned with the markers found in the window itself, which
394
+ * is what keeps a replayed run (`resumeOnError` restores history into a
395
+ * fresh scope) from delivering the same message twice. */
396
+ deliveredMessageKeys: readonly string[];
383
397
  /** Tool schemas resolved by the tools slot subflow each iteration
384
398
  * (registry + injection-supplied). Used by callLLM. */
385
399
  dynamicToolSchemas: readonly LLMToolSchema[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,qBAAqB,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ACvD,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAGtC;;;;0EAIsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;0BAEsB;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,yCAAyC;IACzC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B;;;6EAGyE;IACzE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;0CAIsC;IACtC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;IAGzC;;;;;;iFAM6E;IAC7E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;kEAC8D;IAC9D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC"}
@@ -17,16 +17,23 @@
17
17
  * the LLM-protocol shape a provider needs — an assistant turn's
18
18
  * `toolCalls[]`, a tool turn's `toolCallId`.
19
19
  *
20
- * Windowing and summarizing are not pending here either: they arrived in
21
- * 7.16–7.17 as the window-strategy family, and they govern the window by
22
- * editing `scope.history` at the loop-head window stage (`stages/window.ts`)
23
- * — BEFORE this slot runs, so the projection and the wire describe the same
24
- * past. Content declared for this slot is refused at the declaration site
25
- * (`lib/injection-engine/messagesSlotRefusal.ts`) precisely because this
26
- * slot cannot deliver it.
20
+ * Nothing enters the conversation HERE, and that is the point. Two stages
21
+ * upstream edit `scope.history` before this one reads it: the window
22
+ * strategy takes messages out (`stages/window.ts`, 7.16–7.17) and the
23
+ * delivery stage lets declared ones in (`stages/deliver.ts`, 7.21). Both run
24
+ * at the loop head, before the slots, so the projection and the wire always
25
+ * describe the same past.
26
+ *
27
+ * That is why this file no longer walks `activeInjections` looking for
28
+ * `inject.messages`. Until 7.19.1 it did, and it produced a record — an
29
+ * emitted `context.injected` — for content the request never carried, which
30
+ * is the exact bug the wire-truth test now guards. A delivered injection is
31
+ * IN the window by the time this runs, so it is projected like any other
32
+ * message and attributed to its injection by the `injectedBy` marker the
33
+ * delivery stage stamped. One wire message, one record, one name.
27
34
  */
28
35
  import type { FlowChart } from 'footprintjs';
29
- import type { ContextRole } from '../../events/types.js';
36
+ import type { ContextRole, ContextSource } from '../../events/types.js';
30
37
  /**
31
38
  * A single message supplied by the caller. Structurally matches the
32
39
  * LLMMessage adapter type but local-aliased to keep this file free of
@@ -37,6 +44,14 @@ export interface InputMessage {
37
44
  readonly content: string;
38
45
  readonly toolCallId?: string;
39
46
  readonly toolName?: string;
47
+ /** Set by the delivery stage on a message an Injection put here — the
48
+ * marker this slot attributes by. Mirrors `LLMMessage.injectedBy`. */
49
+ readonly injectedBy?: {
50
+ readonly injectionId: string;
51
+ readonly flavor: ContextSource;
52
+ readonly reason?: string;
53
+ readonly iteration: number;
54
+ };
40
55
  }
41
56
  export interface MessagesSlotConfig {
42
57
  /** Budget cap (chars). Default: 10000. */
@@ -1 +1 @@
1
- {"version":3,"file":"buildMessagesSlot.d.ts","sourceRoot":"","sources":["../../../../src/core/slots/buildMessagesSlot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAEzD,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMzE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,Q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@ -25,9 +25,20 @@
25
25
  * `HostRequest` and `HostReply` say exactly what they said before. The gap was
26
26
  * in the first adapter, which had no seam, not in the port, which needed none.
27
27
  *
28
+ * ── The second thing a deployment gets to re-decide: who owns the socket ─────
29
+ * By default this file creates a server and listens on it. Pass `server` and it
30
+ * attaches to yours instead — because a container is sometimes given exactly
31
+ * one port, and an agent that privately owns the socket cannot share it with a
32
+ * WebSocket upgrade or with routes that were there first. Attached, the host
33
+ * answers its two paths, writes nothing on anyone else's, and `close()`
34
+ * detaches and drains without closing a socket it never opened. That is the
35
+ * whole difference; every other law on this page is the same either way.
36
+ *
28
37
  * Pattern: Template method via configuration (Strategy on the wire format).
29
38
  * Everything HTTP lives here and in the wires; `types.ts` knows none of it.
30
39
  */
40
+ /// <reference types="node" />
41
+ import type { Server } from 'node:http';
31
42
  import type { AgentHost, HostCapability, HostHandle, HostHandler, PendingAsk } from './types.js';
32
43
  /** Everything a {@link HttpWire} may read when pulling a request apart. */
33
44
  export interface HttpRequestFacts {
@@ -101,16 +112,64 @@ export interface HttpHostOptions {
101
112
  readonly invokePath: string;
102
113
  /** Path that answers a health probe. Required, for the same reason. */
103
114
  readonly healthPath: string;
104
- /** Port to bind. Default `8080`. Pass `0` for an ephemeral port. */
115
+ /**
116
+ * Port to bind. Default `8080`. Pass `0` for an ephemeral port.
117
+ *
118
+ * Refused together with {@link HttpHostOptions.server}: a server you own
119
+ * already has an address, and a port here would name a socket this host does
120
+ * not bind.
121
+ */
105
122
  readonly port?: number;
106
- /** Interface to bind. Default `'0.0.0.0'`. */
123
+ /** Interface to bind. Default `'0.0.0.0'`. Refused together with `server`, for the same reason. */
107
124
  readonly hostname?: string;
108
125
  /** What this adapter claims beyond the baseline. Default `['streaming']`. */
109
126
  readonly capabilities?: readonly HostCapability[];
127
+ /**
128
+ * A `node:http` server **you** own. Given one, this host ATTACHES its two
129
+ * routes to it instead of creating and listening on a server of its own.
130
+ *
131
+ * ── Why ──────────────────────────────────────────────────────────────────
132
+ * Some runtimes hand a container exactly one port, and a container that must
133
+ * also answer a WebSocket upgrade — or anything else — on that port cannot
134
+ * use a host that privately owns the socket. Attaching costs nothing anyone
135
+ * else was using: `node:http` calls EVERY `'request'` listener for every
136
+ * request, so this host and your own routes share the port by taking turns.
137
+ *
138
+ * ── What changes, exactly ────────────────────────────────────────────────
139
+ * - **You own the socket.** `listen()` is yours, and so is closing it. The
140
+ * server must ALREADY be listening when `serve()` is called — a handle
141
+ * that promises `url` and `port` cannot honestly report an address that
142
+ * does not exist yet, so `serve()` refuses rather than guess one.
143
+ * - **The host never writes a 404.** A path it does not own is yours to
144
+ * answer, and answering it with a refusal from this host would be this
145
+ * host answering for your application. Note the consequence: a request no
146
+ * listener answers is not a 404, it HANGS — if this server has no other
147
+ * `'request'` listener, unmatched paths go unanswered until the socket
148
+ * times out. With no `server`, the 404 behaviour is unchanged.
149
+ * - **`close()` detaches and drains, and leaves your server listening.** It
150
+ * removes this host's listener, waits for the requests it is already
151
+ * serving, and touches nothing else — not your connections, not your
152
+ * socket.
153
+ * - It never writes to a response an earlier listener already answered.
154
+ *
155
+ * @example One port, an agent and a WebSocket upgrade
156
+ * const server = createServer();
157
+ * server.on('upgrade', (req, socket, head) => acceptWebSocket(req, socket, head));
158
+ * await new Promise<void>((r) => server.listen(8080, '0.0.0.0', r));
159
+ * const handle = await httpHost({ ...wireOptions, server }).serve(handler);
160
+ * // …later: the host goes away, the socket and the upgrade stay.
161
+ * await handle.close();
162
+ */
163
+ readonly server?: Server;
110
164
  }
111
165
  /** A {@link HostHandle} that also says where it landed. */
112
166
  export interface HttpHostHandle extends HostHandle {
113
- /** Where it is actually listening, e.g. `http://127.0.0.1:53211`. */
167
+ /**
168
+ * Where it is actually listening, e.g. `http://127.0.0.1:53211`. With a
169
+ * caller-owned {@link HttpHostOptions.server} this is that server's real
170
+ * address — the host reports where it is answering, never where it bound,
171
+ * because with your server it bound nothing.
172
+ */
114
173
  readonly url: string;
115
174
  /** The port it actually bound — the real one, when you asked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,IAAI,EAAE,QAAQ,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,2DAA2D;AAC3D,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,oDAAoD;AACpD,MAAM,WAAW,QAAS,SAAQ,SAAS;IACzC,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACtD;AA8BD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAgI3D;AAyJD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,MAAM,EACZ,GAAG,SAAS,EAAE,MAAM,EAAE,GACrB,MAAM,GAAG,SAAS,CAMpB"}
@@ -31,7 +31,9 @@
31
31
  * itself, parameterised by the JSON dialect it speaks. `nodeHost` is one
32
32
  * configuration of it; an adapter for someone's container runtime is
33
33
  * another. Two paths and five body shapes are all a second HTTP adapter
34
- * re-decides.
34
+ * re-decides. Pass `server` and it attaches to a `node:http` server YOU
35
+ * own instead of binding one — for the container that gets a single port
36
+ * and must serve a WebSocket upgrade (or anything else) beside the agent.
35
37
  * • `memorySessions()` — conversations in a Map, for tests and local dev.
36
38
  * • `standingAgent({ agent, sessions, host, durability? })` — the composer.
37
39
  * • `toEnvelope` / `readEnvelope` — pack a conversation, and refuse by name to
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,GACX,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,GACX,MAAM,YAAY,CAAC"}
@@ -16,6 +16,11 @@
16
16
  * a colleague's convention. A path is a deployment detail, so it is a knob
17
17
  * here and absent from the port entirely.
18
18
  *
19
+ * **The socket can be yours.** Pass `server` — a `node:http` server you
20
+ * created and listened on — and this adapter attaches its two routes to it
21
+ * instead of binding one, so a WebSocket upgrade or your own routes can share
22
+ * the port. `close()` then detaches and drains, and your socket stays up.
23
+ *
19
24
  * **Streaming is the caller's choice, not the server's.** Send
20
25
  * `Accept: text/event-stream` and the reply is Server-Sent Events, one `chunk`
21
26
  * event per `reply.emit(...)` then a final `complete`. Send anything else and
@@ -29,17 +34,31 @@
29
34
  * never quietly drift apart on what `close()` drains or what a handler that
30
35
  * throws does. `types.ts` knows none of it either way.
31
36
  */
37
+ /// <reference types="node" />
32
38
  import { type HttpHost, type HttpHostHandle, type HttpWire } from './httpHost.js';
33
39
  /** Options for {@link nodeHost}. */
34
40
  export interface NodeHostOptions {
35
- /** Port to bind. Default `8080`. Pass `0` for an ephemeral port. */
41
+ /** Port to bind. Default `8080`. Pass `0` for an ephemeral port. Refused alongside `server`. */
36
42
  readonly port?: number;
37
- /** Interface to bind. Default `'0.0.0.0'`. */
43
+ /** Interface to bind. Default `'0.0.0.0'`. Refused alongside `server`. */
38
44
  readonly hostname?: string;
39
45
  /** Path that takes a request. Default `'/invoke'`. */
40
46
  readonly invokePath?: string;
41
47
  /** Path that answers a health probe. Default `'/health'`. */
42
48
  readonly healthPath?: string;
49
+ /**
50
+ * A `node:http` server **you** own, already listening. Given one, this
51
+ * adapter attaches its two routes to it instead of binding a socket of its
52
+ * own — the only way to serve something else (a WebSocket upgrade, routes
53
+ * that were there first) on the same port, which matters when the thing
54
+ * running your process gives it exactly one.
55
+ *
56
+ * You keep `listen()` and you keep the shutdown; `close()` detaches this
57
+ * host and drains what it was already serving. On a server you own the host
58
+ * never writes a 404 either: a path it does not own is yours to answer. The
59
+ * full set of laws is on `httpHost`'s own `server` option, which this is.
60
+ */
61
+ readonly server?: import('node:http').Server;
43
62
  }
44
63
  /**
45
64
  * What {@link nodeHost}'s `serve()` resolves to — a `HostHandle` that also
@@ -1 +1 @@
1
- {"version":3,"file":"nodeHost.d.ts","sourceRoot":"","sources":["../../../src/hosting/nodeHost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAY,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE5F,oCAAoC;AACpC,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G,cAAc,CAAC;AAE5C,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAIhC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,QAsBtB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAgBhE"}
@@ -140,6 +140,12 @@ export interface HostHandle {
140
140
  * transport. Idempotent, so a shutdown hook and an explicit close can
141
141
  * coexist. Requests arriving after it are refused with a
142
142
  * {@link HostClosedError} naming the adapter.
143
+ *
144
+ * "Release the transport" is as strong as the port can be, because an
145
+ * adapter may be serving on a transport the CALLER owns rather than one it
146
+ * created. Releasing one of those means handing the routes back — never
147
+ * closing it — and a request arriving afterwards is the caller's to answer,
148
+ * not this host's to refuse.
143
149
  */
144
150
  close(): Promise<void>;
145
151
  }