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.
- package/AGENTS.md +10 -3
- package/README.md +1 -1
- package/ai-instructions/claude-code/SKILL.md +10 -3
- package/dist/adapters/hosting/agentcore.js +12 -2
- package/dist/adapters/hosting/agentcore.js.map +1 -1
- package/dist/adapters/llm/AnthropicProvider.js +12 -0
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BedrockProvider.js +12 -0
- package/dist/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js +45 -6
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserOpenAIProvider.js +13 -0
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/MockProvider.js +10 -0
- package/dist/adapters/llm/MockProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +15 -0
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/types.js +10 -0
- package/dist/adapters/types.js.map +1 -1
- package/dist/cache/CacheDecisionSubflow.js +67 -3
- package/dist/cache/CacheDecisionSubflow.js.map +1 -1
- package/dist/conventions.js +8 -0
- package/dist/conventions.js.map +1 -1
- package/dist/core/Agent.js +47 -0
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +13 -6
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +17 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +49 -4
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/delivery/rules.js +121 -0
- package/dist/core/agent/delivery/rules.js.map +1 -0
- package/dist/core/agent/delivery/types.js +12 -0
- package/dist/core/agent/delivery/types.js.map +1 -0
- package/dist/core/agent/stages/callLLM.js +27 -1
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/deliver.js +155 -0
- package/dist/core/agent/stages/deliver.js.map +1 -0
- package/dist/core/agent/stages/seed.js +4 -0
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/slots/buildMessagesSlot.js +43 -48
- package/dist/core/slots/buildMessagesSlot.js.map +1 -1
- package/dist/esm/adapters/hosting/agentcore.d.ts +27 -0
- package/dist/esm/adapters/hosting/agentcore.js +12 -2
- package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
- package/dist/esm/adapters/llm/AnthropicProvider.d.ts +2 -1
- package/dist/esm/adapters/llm/AnthropicProvider.js +12 -0
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BedrockProvider.d.ts +2 -1
- package/dist/esm/adapters/llm/BedrockProvider.js +12 -0
- package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +2 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +45 -6
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +3 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +13 -0
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/MockProvider.d.ts +2 -1
- package/dist/esm/adapters/llm/MockProvider.js +10 -0
- package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +2 -1
- package/dist/esm/adapters/llm/OpenAIProvider.js +15 -0
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/types.d.ts +69 -0
- package/dist/esm/adapters/types.js +9 -1
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/cache/CacheDecisionSubflow.d.ts +11 -0
- package/dist/esm/cache/CacheDecisionSubflow.js +67 -3
- package/dist/esm/cache/CacheDecisionSubflow.js.map +1 -1
- package/dist/esm/conventions.d.ts +8 -0
- package/dist/esm/conventions.js +8 -0
- package/dist/esm/conventions.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +16 -0
- package/dist/esm/core/Agent.js +47 -0
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +9 -4
- package/dist/esm/core/agent/AgentBuilder.js +14 -7
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +14 -0
- package/dist/esm/core/agent/buildAgentChart.js +17 -1
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +49 -4
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/delivery/rules.d.ts +79 -0
- package/dist/esm/core/agent/delivery/rules.js +113 -0
- package/dist/esm/core/agent/delivery/rules.js.map +1 -0
- package/dist/esm/core/agent/delivery/types.d.ts +51 -0
- package/dist/esm/core/agent/delivery/types.js +11 -0
- package/dist/esm/core/agent/delivery/types.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM.js +27 -1
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/deliver.d.ts +59 -0
- package/dist/esm/core/agent/stages/deliver.js +150 -0
- package/dist/esm/core/agent/stages/deliver.js.map +1 -0
- package/dist/esm/core/agent/stages/seed.js +4 -0
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +14 -0
- package/dist/esm/core/slots/buildMessagesSlot.d.ts +23 -8
- package/dist/esm/core/slots/buildMessagesSlot.js +43 -48
- package/dist/esm/core/slots/buildMessagesSlot.js.map +1 -1
- package/dist/esm/hosting/httpHost.d.ts +62 -3
- package/dist/esm/hosting/httpHost.js +73 -9
- package/dist/esm/hosting/httpHost.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +3 -1
- package/dist/esm/hosting/index.js +3 -1
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/nodeHost.d.ts +21 -2
- package/dist/esm/hosting/nodeHost.js +10 -0
- package/dist/esm/hosting/nodeHost.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +6 -0
- package/dist/esm/lib/injection-engine/factories/defineFact.d.ts +38 -10
- package/dist/esm/lib/injection-engine/factories/defineFact.js +20 -8
- package/dist/esm/lib/injection-engine/factories/defineFact.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineInstruction.d.ts +42 -15
- package/dist/esm/lib/injection-engine/factories/defineInstruction.js +17 -6
- package/dist/esm/lib/injection-engine/factories/defineInstruction.js.map +1 -1
- package/dist/esm/lib/injection-engine/messagesSlotRefusal.d.ts +70 -27
- package/dist/esm/lib/injection-engine/messagesSlotRefusal.js +91 -34
- package/dist/esm/lib/injection-engine/messagesSlotRefusal.js.map +1 -1
- package/dist/esm/lib/injection-engine/types.d.ts +35 -9
- package/dist/esm/lib/injection-engine/types.js +6 -0
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/memory/asRoleRefusal.d.ts +15 -11
- package/dist/esm/memory/asRoleRefusal.js +21 -15
- package/dist/esm/memory/asRoleRefusal.js.map +1 -1
- package/dist/esm/resilience/withCircuitBreaker.js +6 -0
- package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/esm/resilience/withFallback.js +18 -0
- package/dist/esm/resilience/withFallback.js.map +1 -1
- package/dist/esm/resilience/withRetry.js +8 -0
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/hosting/httpHost.js +73 -9
- package/dist/hosting/httpHost.js.map +1 -1
- package/dist/hosting/index.js +3 -1
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/nodeHost.js +10 -0
- package/dist/hosting/nodeHost.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineFact.js +19 -7
- package/dist/lib/injection-engine/factories/defineFact.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineInstruction.js +16 -5
- package/dist/lib/injection-engine/factories/defineInstruction.js.map +1 -1
- package/dist/lib/injection-engine/messagesSlotRefusal.js +95 -36
- package/dist/lib/injection-engine/messagesSlotRefusal.js.map +1 -1
- package/dist/lib/injection-engine/types.js +6 -0
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/memory/asRoleRefusal.js +21 -15
- package/dist/memory/asRoleRefusal.js.map +1 -1
- package/dist/resilience/withCircuitBreaker.js +6 -0
- package/dist/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/resilience/withFallback.js +18 -0
- package/dist/resilience/withFallback.js.map +1 -1
- package/dist/resilience/withRetry.js +8 -0
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/types/adapters/hosting/agentcore.d.ts +27 -0
- package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/llm/AnthropicProvider.d.ts +2 -1
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BedrockProvider.d.ts +2 -1
- package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts +2 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +3 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/MockProvider.d.ts +2 -1
- package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +2 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +69 -0
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/cache/CacheDecisionSubflow.d.ts +11 -0
- package/dist/types/cache/CacheDecisionSubflow.d.ts.map +1 -1
- package/dist/types/conventions.d.ts +8 -0
- package/dist/types/conventions.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +16 -0
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +9 -4
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +14 -0
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/delivery/rules.d.ts +80 -0
- package/dist/types/core/agent/delivery/rules.d.ts.map +1 -0
- package/dist/types/core/agent/delivery/types.d.ts +52 -0
- package/dist/types/core/agent/delivery/types.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/deliver.d.ts +60 -0
- package/dist/types/core/agent/stages/deliver.d.ts.map +1 -0
- package/dist/types/core/agent/types.d.ts +14 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/slots/buildMessagesSlot.d.ts +23 -8
- package/dist/types/core/slots/buildMessagesSlot.d.ts.map +1 -1
- package/dist/types/hosting/httpHost.d.ts +62 -3
- package/dist/types/hosting/httpHost.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +3 -1
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/nodeHost.d.ts +21 -2
- package/dist/types/hosting/nodeHost.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +6 -0
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineFact.d.ts +38 -10
- package/dist/types/lib/injection-engine/factories/defineFact.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineInstruction.d.ts +42 -15
- package/dist/types/lib/injection-engine/factories/defineInstruction.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/messagesSlotRefusal.d.ts +70 -27
- package/dist/types/lib/injection-engine/messagesSlotRefusal.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/types.d.ts +35 -9
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/memory/asRoleRefusal.d.ts +15 -11
- package/dist/types/memory/asRoleRefusal.d.ts.map +1 -1
- package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
- package/dist/types/resilience/withFallback.d.ts.map +1 -1
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -23,6 +23,25 @@ import { resilienceHooks } from '../../../recorders/core/resilienceHooks.js';
|
|
|
23
23
|
import { emitCostTick } from '../../cost.js';
|
|
24
24
|
import { applyOutputSchema } from '../../outputSchema.js';
|
|
25
25
|
import { executeWithReliability, ValidationFailure, } from './reliabilityExecution.js';
|
|
26
|
+
/**
|
|
27
|
+
* Drop the fields that exist for the library and never for the model.
|
|
28
|
+
*
|
|
29
|
+
* Today that is exactly one: `injectedBy`, the delivery marker (7.21).
|
|
30
|
+
* Messages without it pass through by reference, so an agent that delivers
|
|
31
|
+
* nothing allocates nothing — and the array's length and order are untouched
|
|
32
|
+
* either way, which is what keeps `CacheMarker{field:'messages'}` honest.
|
|
33
|
+
*/
|
|
34
|
+
function stripFrameworkFields(messages) {
|
|
35
|
+
if (!messages.some((m) => m.injectedBy !== undefined))
|
|
36
|
+
return messages;
|
|
37
|
+
return messages.map((m) => {
|
|
38
|
+
if (m.injectedBy === undefined)
|
|
39
|
+
return m;
|
|
40
|
+
const { injectedBy: _marker, ...wire } = m;
|
|
41
|
+
void _marker;
|
|
42
|
+
return wire;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
26
45
|
/**
|
|
27
46
|
* Build the callLLM stage function. Captures the LLM provider + model
|
|
28
47
|
* config + cache strategy via the deps object; everything per-iteration
|
|
@@ -59,7 +78,14 @@ export function buildCallLLMStage(deps) {
|
|
|
59
78
|
// the full LLM-protocol shape (assistant `toolCalls[]`, etc.). For
|
|
60
79
|
// Anthropic's API contract we need the original LLMMessage with
|
|
61
80
|
// `toolCalls` intact so tool_use → tool_result correlation survives.
|
|
62
|
-
|
|
81
|
+
// `stripFrameworkFields` takes off `injectedBy` — the marker the delivery
|
|
82
|
+
// stage stamps so the messages slot can say WHO put a message here. It is
|
|
83
|
+
// framework bookkeeping, not conversation, and it is removed BEFORE the
|
|
84
|
+
// request exists rather than trusted to be ignored: a consumer-authored
|
|
85
|
+
// adapter that serializes a message wholesale would otherwise put library
|
|
86
|
+
// internals on someone's wire. Stripping removes a FIELD, never a message,
|
|
87
|
+
// so `messages[i]` is still the message the cache marker's index names.
|
|
88
|
+
const messages = stripFrameworkFields(scope.history ?? []);
|
|
63
89
|
// Dynamic schemas — registry tools + injection-supplied tools (Skills'
|
|
64
90
|
// `inject.tools` when their Injection is active). Falls back to the static
|
|
65
91
|
// schemas at startup before the tools slot has run. Computed BEFORE the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callLLM.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAYH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAA2B,MAAM,uBAAuB,CAAC;AACnF,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAElB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"callLLM.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAYH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,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CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACtC,KAA2D,CAAC,WAAW;gBACtE,QAAQ,CAAC,WAAW,CAAC;QACzB,CAAC;QAED,SAAS,CAAC,KAAK,EAAE,+BAA+B,EAAE;YAChD,SAAS;YACT,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM;YACxC,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,UAAU;SACX,CAAC,CAAC;QAEH,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjF,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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;
|
|
@@ -0,0 +1,150 @@
|
|
|
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 { DEFAULT_CARRIES_IN_MESSAGES } from '../../../adapters/types.js';
|
|
47
|
+
import { messagesDeferralNote, messagesRoleRefusal, } from '../../../lib/injection-engine/messagesSlotRefusal.js';
|
|
48
|
+
import { fnv1a } from '../../slots/helpers.js';
|
|
49
|
+
import { withMemoryRecall } from '../memoryRecallInjections.js';
|
|
50
|
+
import { deliveryKey, keysInWindow, refusalForPlacement, tailWireRole } from '../delivery/rules.js';
|
|
51
|
+
/** What a provider carries inside `messages`, with the floor applied. */
|
|
52
|
+
export function carriedRoles(provider) {
|
|
53
|
+
return provider.carriesInMessages ?? DEFAULT_CARRIES_IN_MESSAGES;
|
|
54
|
+
}
|
|
55
|
+
/** Build the delivery stage. */
|
|
56
|
+
export function buildDeliverStage(deps) {
|
|
57
|
+
const carries = carriedRoles(deps.provider);
|
|
58
|
+
const carriesSet = new Set(carries);
|
|
59
|
+
return (scope) => {
|
|
60
|
+
const active = withMemoryRecall(scope.activeInjections, scope, deps.memoryIds);
|
|
61
|
+
const iteration = scope.iteration ?? 1;
|
|
62
|
+
// Materialise the window: `history` is a reactive proxy reference, and
|
|
63
|
+
// this stage appends to it.
|
|
64
|
+
const history = (scope.history ?? []).slice();
|
|
65
|
+
const incoming = scope.deliveredMessageKeys ?? [];
|
|
66
|
+
const ledger = new Set(incoming);
|
|
67
|
+
// The union that makes replay safe — see `keysInWindow`.
|
|
68
|
+
for (const key of keysInWindow(history))
|
|
69
|
+
ledger.add(key);
|
|
70
|
+
const delivered = [];
|
|
71
|
+
const deferred = [];
|
|
72
|
+
for (const inj of active) {
|
|
73
|
+
const messages = inj.inject.messages ?? [];
|
|
74
|
+
for (const msg of messages) {
|
|
75
|
+
const key = deliveryKey(inj.id, msg.role, msg.content);
|
|
76
|
+
if (ledger.has(key))
|
|
77
|
+
continue;
|
|
78
|
+
const role = msg.role;
|
|
79
|
+
if (!carriesSet.has(role)) {
|
|
80
|
+
// Fatal: silently re-roling would change who appears to speak, and
|
|
81
|
+
// silently dropping is the 7.19.1 lie this feature was built to end.
|
|
82
|
+
throw new Error(messagesRoleRefusal({
|
|
83
|
+
site: `Agent injection '${inj.id}'`,
|
|
84
|
+
role: msg.role,
|
|
85
|
+
providerName: deps.provider.name,
|
|
86
|
+
carries,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
const refusal = refusalForPlacement(history, role);
|
|
90
|
+
if (refusal !== undefined) {
|
|
91
|
+
deferred.push({
|
|
92
|
+
injectionId: inj.id,
|
|
93
|
+
flavor: inj.flavor,
|
|
94
|
+
role,
|
|
95
|
+
reason: refusal,
|
|
96
|
+
note: messagesDeferralNote({
|
|
97
|
+
injectionId: inj.id,
|
|
98
|
+
role,
|
|
99
|
+
reason: refusal,
|
|
100
|
+
...(tailWireRole(history) !== undefined && { tailRole: tailWireRole(history) }),
|
|
101
|
+
}),
|
|
102
|
+
});
|
|
103
|
+
// This injection's remaining messages wait too: delivering message 2
|
|
104
|
+
// without message 1 would reorder the declaration.
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
const wireIndex = history.length;
|
|
108
|
+
history.push({
|
|
109
|
+
role,
|
|
110
|
+
content: msg.content,
|
|
111
|
+
injectedBy: {
|
|
112
|
+
injectionId: inj.id,
|
|
113
|
+
flavor: inj.flavor,
|
|
114
|
+
...(inj.description !== undefined && { reason: inj.description }),
|
|
115
|
+
iteration,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
ledger.add(key);
|
|
119
|
+
delivered.push({
|
|
120
|
+
injectionId: inj.id,
|
|
121
|
+
flavor: inj.flavor,
|
|
122
|
+
role,
|
|
123
|
+
wireIndex,
|
|
124
|
+
// The messages slot and the window stage both name a piece of
|
|
125
|
+
// context by `${role}:${index}:${content}`. Using the same formula
|
|
126
|
+
// here means injected, delivered and evicted all say one name.
|
|
127
|
+
contentHash: fnv1a(`${role}:${wireIndex}:${msg.content}`),
|
|
128
|
+
key,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Record every iteration, including the empty one: "the stage looked and
|
|
133
|
+
// there was nothing to do" and "the stage never ran" are different facts
|
|
134
|
+
// about a run, and only one of them is visible in the chart.
|
|
135
|
+
scope.messagesDelivery = { iteration, delivered, deferred };
|
|
136
|
+
if (delivered.length > 0)
|
|
137
|
+
scope.history = history;
|
|
138
|
+
// Persist the ledger whenever it GREW, not only when this iteration
|
|
139
|
+
// delivered. It also grows by recovery — reading markers out of a window
|
|
140
|
+
// that a replay restored into a fresh scope — and those keys are the whole
|
|
141
|
+
// replay-safety argument. Dropping them because nothing happened to be
|
|
142
|
+
// delivered this pass would make "is this already in?" depend on whether an
|
|
143
|
+
// unrelated injection landed at the same moment, and would let a window
|
|
144
|
+
// strategy's later eviction resurrect a message the run had already sent.
|
|
145
|
+
// The ledger is a superset of what came in, so a size change is exact.
|
|
146
|
+
if (ledger.size !== incoming.length)
|
|
147
|
+
scope.deliveredMessageKeys = [...ledger];
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//#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AAG,OAAO,CAAC;QAClD,oEAAoE;QACpE,yEAAyE;QACzE,2EAA2E;QAC3E,uEAAuE;QACvE,4EAA4E;QAC5E,wEAAwE;QACxE,0EAA0E;QAC1E,uEAAuE;QACvE,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM;YAAE,KAAK,CAAC,oBAAoB,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;IAChF,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -121,6 +121,10 @@ function seedFrom(scope, message, deps) {
|
|
|
121
121
|
scope.activeInjections = [];
|
|
122
122
|
scope.activatedInjectionIds = [];
|
|
123
123
|
scope.dynamicToolSchemas = deps.toolSchemas;
|
|
124
|
+
// Messages-slot delivery ledger (7.21) — empty at the start of every run.
|
|
125
|
+
// A resumed run rebuilds it from the markers in the restored window rather
|
|
126
|
+
// than trusting this, so an empty ledger never means "deliver it again".
|
|
127
|
+
scope.deliveredMessageKeys = [];
|
|
124
128
|
// Cache layer state (v2.6) — initialized to inert defaults.
|
|
125
129
|
// CacheDecision subflow populates `cacheMarkers` per iteration;
|
|
126
130
|
// UpdateSkillHistory + CacheGate consume `cachingDisabled`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAoD1D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAmB;IAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAC;IAC3C,uEAAuE;IACvE,yEAAyE;IACzE,6EAA6E;IAC7E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EA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AAS;YAAE,KAAK,CAAC,oBAAoB,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC/F,CAAC;IAED,SAAS,CAAC,KAAK,EAAE,iCAAiC,EAAE;QAClD,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,OAAO;KACpB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -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[];
|
|
@@ -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
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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. */
|
|
@@ -17,13 +17,20 @@
|
|
|
17
17
|
* the LLM-protocol shape a provider needs — an assistant turn's
|
|
18
18
|
* `toolCalls[]`, a tool turn's `toolCallId`.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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 { flowChart } from 'footprintjs';
|
|
29
36
|
import { INJECTION_KEYS } from '../../conventions.js';
|
|
@@ -46,47 +53,35 @@ export function buildMessagesSlot(config = {}) {
|
|
|
46
53
|
const args = scope.$getArgs();
|
|
47
54
|
const messages = args.messages ?? [];
|
|
48
55
|
const iteration = args.iteration ?? 1;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
slot: 'messages',
|
|
79
|
-
source: inj.flavor,
|
|
80
|
-
sourceId: inj.id,
|
|
81
|
-
reason: inj.description ?? `${inj.flavor} '${inj.id}' active`,
|
|
82
|
-
rawContent: msg.content,
|
|
83
|
-
asRole: msg.role,
|
|
84
|
-
asRecency: 'latest',
|
|
85
|
-
position,
|
|
86
|
-
});
|
|
87
|
-
position++;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
56
|
+
// ONE record per message on the wire. Every message in the window gets
|
|
57
|
+
// exactly one, and the only question is who to credit: a message the
|
|
58
|
+
// Deliver stage let in carries `injectedBy`, so it is attributed to its
|
|
59
|
+
// injection (flavor / id / description); everything else is baseline
|
|
60
|
+
// conversation flow, attributed by role.
|
|
61
|
+
//
|
|
62
|
+
// The content hash is the SAME formula for both, deliberately. The
|
|
63
|
+
// window stage reports an eviction under `${role}:${index}:${content}`,
|
|
64
|
+
// so an injected message and the eviction that later removes it name
|
|
65
|
+
// one piece of context by one name — which they would not if a
|
|
66
|
+
// delivered message got its own hash scheme.
|
|
67
|
+
const injections = messages.map((m, i) => {
|
|
68
|
+
const by = m.injectedBy;
|
|
69
|
+
return {
|
|
70
|
+
contentSummary: truncate(m.content, 80),
|
|
71
|
+
contentHash: fnv1a(`${m.role}:${i}:${m.content}`),
|
|
72
|
+
slot: 'messages',
|
|
73
|
+
source: by ? by.flavor : inferSource(m.role),
|
|
74
|
+
reason: by
|
|
75
|
+
? by.reason ?? `${by.flavor} '${by.injectionId}' delivered at iteration ${by.iteration}`
|
|
76
|
+
: `conversation history [${i}]`,
|
|
77
|
+
rawContent: m.content,
|
|
78
|
+
asRole: m.role,
|
|
79
|
+
asRecency: (i === messages.length - 1 ? 'latest' : 'earlier'),
|
|
80
|
+
position: i,
|
|
81
|
+
...(by !== undefined && { sourceId: by.injectionId }),
|
|
82
|
+
...(by === undefined && m.toolCallId !== undefined && { sourceId: m.toolCallId }),
|
|
83
|
+
};
|
|
84
|
+
});
|
|
90
85
|
scope.$setValue(INJECTION_KEYS.MESSAGES, injections);
|
|
91
86
|
const composition = composeSlot('messages', iteration, injections, budgetCap, 'history-order');
|
|
92
87
|
scope.$setValue(COMPOSITION_KEYS.SLOT_COMPOSED, composition);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildMessagesSlot.js","sourceRoot":"","sources":["../../../../src/core/slots/buildMessagesSlot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"buildMessagesSlot.js","sourceRoot":"","sources":["../../../../src/core/slots/buildMessagesSlot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AA+BjG;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAA6B,EAAE;IAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC;IAC5C,0EAA0E;IAC1E,IAAI,cAAc,GAAG,KAAK,CAAC;IAE3B,OAAO,SAAS,CACd,SAAS,EACT,CAAC,KAAuC,EAAE,EAAE;Q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QACvB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -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
|
-
/**
|
|
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
|
-
/**
|
|
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 for `0`. */
|
|
116
175
|
readonly port: number;
|