@memberjunction/ai-agents 6.2.0-edge.3 → 6.2.0-edge.5

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 (182) hide show
  1. package/README.md +100 -7
  2. package/dist/AgentRunner.d.ts +55 -5
  3. package/dist/AgentRunner.d.ts.map +1 -1
  4. package/dist/AgentRunner.js +277 -59
  5. package/dist/AgentRunner.js.map +1 -1
  6. package/dist/ArtifactToolManager.d.ts +11 -3
  7. package/dist/ArtifactToolManager.d.ts.map +1 -1
  8. package/dist/ArtifactToolManager.js +72 -6
  9. package/dist/ArtifactToolManager.js.map +1 -1
  10. package/dist/ClientToolRequestManager.d.ts +11 -1
  11. package/dist/ClientToolRequestManager.d.ts.map +1 -1
  12. package/dist/ClientToolRequestManager.js +19 -6
  13. package/dist/ClientToolRequestManager.js.map +1 -1
  14. package/dist/ConversationCompactionManager.d.ts +2 -0
  15. package/dist/ConversationCompactionManager.d.ts.map +1 -1
  16. package/dist/ConversationCompactionManager.js +2 -2
  17. package/dist/ConversationCompactionManager.js.map +1 -1
  18. package/dist/ConversationToolManager.d.ts +13 -2
  19. package/dist/ConversationToolManager.d.ts.map +1 -1
  20. package/dist/ConversationToolManager.js +19 -3
  21. package/dist/ConversationToolManager.js.map +1 -1
  22. package/dist/KnowledgeAgent.d.ts.map +1 -1
  23. package/dist/KnowledgeAgent.js +6 -1
  24. package/dist/KnowledgeAgent.js.map +1 -1
  25. package/dist/MJAIAgentRequestEntityServer.d.ts +6 -0
  26. package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
  27. package/dist/MJAIAgentRequestEntityServer.js +26 -1
  28. package/dist/MJAIAgentRequestEntityServer.js.map +1 -1
  29. package/dist/PayloadChangeAnalyzer.d.ts.map +1 -1
  30. package/dist/PayloadChangeAnalyzer.js +53 -30
  31. package/dist/PayloadChangeAnalyzer.js.map +1 -1
  32. package/dist/PayloadManager.d.ts +35 -2
  33. package/dist/PayloadManager.d.ts.map +1 -1
  34. package/dist/PayloadManager.js +250 -149
  35. package/dist/PayloadManager.js.map +1 -1
  36. package/dist/ScratchpadManager.d.ts +18 -0
  37. package/dist/ScratchpadManager.d.ts.map +1 -1
  38. package/dist/ScratchpadManager.js +61 -0
  39. package/dist/ScratchpadManager.js.map +1 -1
  40. package/dist/agent-audience.d.ts +38 -0
  41. package/dist/agent-audience.d.ts.map +1 -0
  42. package/dist/agent-audience.js +99 -0
  43. package/dist/agent-audience.js.map +1 -0
  44. package/dist/agent-context-injector.d.ts +17 -2
  45. package/dist/agent-context-injector.d.ts.map +1 -1
  46. package/dist/agent-context-injector.js +23 -7
  47. package/dist/agent-context-injector.js.map +1 -1
  48. package/dist/agent-memory-context-builder.d.ts +7 -2
  49. package/dist/agent-memory-context-builder.d.ts.map +1 -1
  50. package/dist/agent-memory-context-builder.js +12 -3
  51. package/dist/agent-memory-context-builder.js.map +1 -1
  52. package/dist/agent-pre-execution-rag.d.ts +101 -9
  53. package/dist/agent-pre-execution-rag.d.ts.map +1 -1
  54. package/dist/agent-pre-execution-rag.js +224 -23
  55. package/dist/agent-pre-execution-rag.js.map +1 -1
  56. package/dist/agent-run-watchdog.d.ts +65 -5
  57. package/dist/agent-run-watchdog.d.ts.map +1 -1
  58. package/dist/agent-run-watchdog.js +143 -28
  59. package/dist/agent-run-watchdog.js.map +1 -1
  60. package/dist/agent-types/flow-agent-type.d.ts +8 -0
  61. package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
  62. package/dist/agent-types/flow-agent-type.js +48 -6
  63. package/dist/agent-types/flow-agent-type.js.map +1 -1
  64. package/dist/agent-types/loop-agent-prompt-params.d.ts +7 -0
  65. package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
  66. package/dist/agent-types/loop-agent-prompt-params.js +1 -0
  67. package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
  68. package/dist/agent-types/loop-agent-response-type.d.ts +8 -2
  69. package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
  70. package/dist/agent-types/loop-agent-response-type.js.map +1 -1
  71. package/dist/agent-types/loop-agent-type.d.ts +9 -2
  72. package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
  73. package/dist/agent-types/loop-agent-type.js +60 -16
  74. package/dist/agent-types/loop-agent-type.js.map +1 -1
  75. package/dist/artifact-tools/SearchResultSetToolLibrary.js +4 -4
  76. package/dist/artifact-tools/SearchResultSetToolLibrary.js.map +1 -1
  77. package/dist/base-agent.d.ts +837 -43
  78. package/dist/base-agent.d.ts.map +1 -1
  79. package/dist/base-agent.js +3081 -663
  80. package/dist/base-agent.js.map +1 -1
  81. package/dist/client-tool-results.d.ts +45 -0
  82. package/dist/client-tool-results.d.ts.map +1 -0
  83. package/dist/client-tool-results.js +94 -0
  84. package/dist/client-tool-results.js.map +1 -0
  85. package/dist/index.d.ts +9 -0
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +9 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/memory-manager-agent.d.ts.map +1 -1
  90. package/dist/memory-manager-agent.js +46 -34
  91. package/dist/memory-manager-agent.js.map +1 -1
  92. package/dist/native-tools/action-param-schema.d.ts +57 -0
  93. package/dist/native-tools/action-param-schema.d.ts.map +1 -0
  94. package/dist/native-tools/action-param-schema.js +238 -0
  95. package/dist/native-tools/action-param-schema.js.map +1 -0
  96. package/dist/native-tools/action-tool-builder.d.ts +5 -4
  97. package/dist/native-tools/action-tool-builder.d.ts.map +1 -1
  98. package/dist/native-tools/action-tool-builder.js +29 -71
  99. package/dist/native-tools/action-tool-builder.js.map +1 -1
  100. package/dist/native-tools/json-argument.d.ts +41 -0
  101. package/dist/native-tools/json-argument.d.ts.map +1 -0
  102. package/dist/native-tools/json-argument.js +79 -0
  103. package/dist/native-tools/json-argument.js.map +1 -0
  104. package/dist/prior-turn-tool-result-cache.d.ts +31 -12
  105. package/dist/prior-turn-tool-result-cache.d.ts.map +1 -1
  106. package/dist/prior-turn-tool-result-cache.js +59 -16
  107. package/dist/prior-turn-tool-result-cache.js.map +1 -1
  108. package/dist/query-builder-agent.d.ts +13 -4
  109. package/dist/query-builder-agent.d.ts.map +1 -1
  110. package/dist/query-builder-agent.js +102 -27
  111. package/dist/query-builder-agent.js.map +1 -1
  112. package/dist/realtime/bridge-realtime-session-factory.d.ts +44 -2
  113. package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -1
  114. package/dist/realtime/bridge-realtime-session-factory.js +68 -20
  115. package/dist/realtime/bridge-realtime-session-factory.js.map +1 -1
  116. package/dist/realtime/bridge-realtime-usage-recorder.d.ts +81 -0
  117. package/dist/realtime/bridge-realtime-usage-recorder.d.ts.map +1 -0
  118. package/dist/realtime/bridge-realtime-usage-recorder.js +194 -0
  119. package/dist/realtime/bridge-realtime-usage-recorder.js.map +1 -0
  120. package/dist/realtime/client-only-channel-server.d.ts +83 -0
  121. package/dist/realtime/client-only-channel-server.d.ts.map +1 -0
  122. package/dist/realtime/client-only-channel-server.js +107 -0
  123. package/dist/realtime/client-only-channel-server.js.map +1 -0
  124. package/dist/realtime/identity-verification-channel-server.d.ts +50 -0
  125. package/dist/realtime/identity-verification-channel-server.d.ts.map +1 -0
  126. package/dist/realtime/identity-verification-channel-server.js +66 -0
  127. package/dist/realtime/identity-verification-channel-server.js.map +1 -0
  128. package/dist/realtime/interactive-component-channel-server.d.ts +39 -0
  129. package/dist/realtime/interactive-component-channel-server.d.ts.map +1 -0
  130. package/dist/realtime/interactive-component-channel-server.js +55 -0
  131. package/dist/realtime/interactive-component-channel-server.js.map +1 -0
  132. package/dist/realtime/realtime-avatar-resolution.d.ts +194 -0
  133. package/dist/realtime/realtime-avatar-resolution.d.ts.map +1 -0
  134. package/dist/realtime/realtime-avatar-resolution.js +208 -0
  135. package/dist/realtime/realtime-avatar-resolution.js.map +1 -0
  136. package/dist/realtime/realtime-channel-policy.d.ts +81 -0
  137. package/dist/realtime/realtime-channel-policy.d.ts.map +1 -0
  138. package/dist/realtime/realtime-channel-policy.js +91 -0
  139. package/dist/realtime/realtime-channel-policy.js.map +1 -0
  140. package/dist/realtime/realtime-channel-server-host.d.ts +14 -0
  141. package/dist/realtime/realtime-channel-server-host.d.ts.map +1 -1
  142. package/dist/realtime/realtime-channel-server-host.js +35 -0
  143. package/dist/realtime/realtime-channel-server-host.js.map +1 -1
  144. package/dist/realtime/realtime-client-session-service.d.ts +435 -34
  145. package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
  146. package/dist/realtime/realtime-client-session-service.js +806 -139
  147. package/dist/realtime/realtime-client-session-service.js.map +1 -1
  148. package/dist/realtime/realtime-coagent-config.d.ts +102 -16
  149. package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
  150. package/dist/realtime/realtime-coagent-config.js +126 -5
  151. package/dist/realtime/realtime-coagent-config.js.map +1 -1
  152. package/dist/realtime/realtime-recording-ledger.d.ts +130 -0
  153. package/dist/realtime/realtime-recording-ledger.d.ts.map +1 -0
  154. package/dist/realtime/realtime-recording-ledger.js +190 -0
  155. package/dist/realtime/realtime-recording-ledger.js.map +1 -0
  156. package/dist/realtime/realtime-recording-opus-assembly.d.ts +211 -0
  157. package/dist/realtime/realtime-recording-opus-assembly.d.ts.map +1 -0
  158. package/dist/realtime/realtime-recording-opus-assembly.js +706 -0
  159. package/dist/realtime/realtime-recording-opus-assembly.js.map +1 -0
  160. package/dist/realtime/realtime-recording-store.d.ts +174 -17
  161. package/dist/realtime/realtime-recording-store.d.ts.map +1 -1
  162. package/dist/realtime/realtime-recording-store.js +552 -58
  163. package/dist/realtime/realtime-recording-store.js.map +1 -1
  164. package/dist/realtime/realtime-session-runner.js +4 -4
  165. package/dist/realtime/realtime-session-runner.js.map +1 -1
  166. package/dist/realtime/realtime-turn-moderator.d.ts +2 -1
  167. package/dist/realtime/realtime-turn-moderator.d.ts.map +1 -1
  168. package/dist/realtime/realtime-turn-moderator.js +7 -1
  169. package/dist/realtime/realtime-turn-moderator.js.map +1 -1
  170. package/dist/realtime/realtime-vendor-resolution.d.ts +9 -0
  171. package/dist/realtime/realtime-vendor-resolution.d.ts.map +1 -1
  172. package/dist/realtime/realtime-vendor-resolution.js +16 -5
  173. package/dist/realtime/realtime-vendor-resolution.js.map +1 -1
  174. package/dist/realtime/realtime-video-output-gate.d.ts +83 -0
  175. package/dist/realtime/realtime-video-output-gate.d.ts.map +1 -0
  176. package/dist/realtime/realtime-video-output-gate.js +79 -0
  177. package/dist/realtime/realtime-video-output-gate.js.map +1 -0
  178. package/dist/tool-result-format.d.ts +14 -0
  179. package/dist/tool-result-format.d.ts.map +1 -1
  180. package/dist/tool-result-format.js.map +1 -1
  181. package/dist/volatile-child-prompt.js +3 -3
  182. package/package.json +21 -19
package/README.md CHANGED
@@ -153,6 +153,23 @@ An agent can ask a fast decision model typed questions in six places on its own.
153
153
 
154
154
  Set it in an agent's `AgentTypePromptParams` (`{"decisionsEnabled": true, "finishIfMode": "shadow"}`) or for one run in `data.__agentTypePromptParams`. Uses someone placed explicitly do not read it: a Flow or task-graph Decision step, the Run Decision action, and other direct callers of `AgentDecisionService`. See the [Decision Models guide](./docs/loop-agent-decisions.md).
155
155
 
156
+ ##### Output Artifact Lifecycle (`artifactDirective`) & `_ARTIFACTS_ENABLED` Gating
157
+
158
+ When an artifact-producing Loop agent finishes a turn (`taskComplete: true`), it controls whether its final payload creates a new artifact, versions an existing artifact in the conversation, or suppresses artifact creation via `artifactDirective: { behavior: 'create-new' | 'version-source' | 'suppress', targetArtifactId?, name?, description? }`:
159
+
160
+ - **Default-on per-agent gating (`_ARTIFACTS_ENABLED`)**: `BaseAgent.isArtifactSupportEnabled(agent)` returns `true` unless `AIAgent.ArtifactCreationMode` is `'Never'` or `'System Only'`. The Loop Agent system prompt (`{% if _ARTIFACTS_ENABLED != false %}`) and `<mj-runtime-state>` automatically omit all `artifactDirective` instructions and the `_CONVERSATION_ARTIFACTS` catalog for non-artifact agents (such as `Sage` and `Knowledge Agent`), while enabling them by default for artifact-producing agents (`Query Builder`, `SkillSmith`, `Codesmith`, `Research Agent`, etc.).
161
+ - **Full-conversation artifact targeting (`targetArtifactId`)**: `AgentRunner` loads the conversation's prior output artifacts into `_CONVERSATION_ARTIFACTS` so the agent can version any earlier artifact by `targetArtifactId` (not just the immediately preceding turn's artifact).
162
+ - **Clean payload reset on `create-new`**: When `artifactDirective.behavior === 'create-new'` and the current payload is still the unmodified inherited payload from the prior conversation turn (`payload === params.payload`, even after read-only action steps) or `replaceElements` is used, `BaseAgent.executePromptStep` applies `payloadChangeRequest` against a fresh `{}` object so fields from a prior artifact never bleed into the new artifact.
163
+
164
+ See the [Artifact Tools & Output Lifecycle Guide](./docs/ARTIFACT_TOOLS_GUIDE.md#output-artifact-lifecycle-artifactdirective--_artifacts_enabled-prompt-gating).
165
+
166
+ ##### Single-Node Task Graph Folding (`foldSingleTaskStep`) vs. Multi-Step Durable Workflows
167
+
168
+ When a Loop agent (such as `Sage`) emits `nextStep.type: 'Tasks'`, `LoopAgentType.foldSingleTaskStep` inspects the `taskGraph`:
169
+
170
+ - **Single-node task graphs (1 task of kind `'Agent'` or `'Action'`)**: Automatically fold inline into a standard in-process `'Sub-Agents'` or `'Actions'` step — even when `taskGraph.continuation === 'reinvoke'` is specified (`terminateAfter: false` so the parent Loop agent gets another turn to synthesize the specialist's output). This avoids durable task-graph dispatch overhead for 1-step specialist delegations (e.g., `Query Builder`, `Visualization Agent`) and keeps live sub-agent streaming in the active chat turn.
171
+ - **Multi-node task graphs (2+ tasks with `dependsOn` / `payloadMapping` or non-trivial scheduling)**: Dispatch as durable `MJ: Tasks` rows through [`@memberjunction/task-graph`](../../TaskGraph/README.md), broadcasting real-time step transitions via `TaskGraphFrameBroadcaster` and delivering synthesized continuation replies and artifacts back to the conversation via `TaskGraphContinuationDeliverer`.
172
+
156
173
  #### FlowAgentType
157
174
 
158
175
  Step-based agent that follows a predefined flow graph — steps with explicit conditional paths between them. Best for deterministic workflows where the execution path is known in advance.
@@ -166,6 +183,7 @@ Consequences worth knowing before you debug one:
166
183
  - **The mode is on the run.** A completed `Decision` step named "Workflow runs in this run" or "Workflow runs on the task-graph dispatcher" records which engine ran it and why.
167
184
  - **A dispatched `Sub-Agent` node starts its own `AIAgentRun`**, linked from `Task.AgentRunID` and parented to the submitting run. If that sub-agent is itself a Flow agent, it runs in-process and returns its result to the task.
168
185
  - **A `Decision` step routes the same way in both modes.** Paths read its answers only through `decisions.<key>.<question>`; its `stepResult.result` is the payload, which carries no answers. A flow with a Decision step is compiled and validated before its first step in-run too, so an incomplete Choice fork, a decision read before it can answer, or one read through the payload is refused in both modes. An answer below its `minConfidence` stops an in-run flow (the dispatcher holds the fork, and `Retry` on the step asks again). A failed decision call is a failed step: the paths that read its answers are passed over, and a recovery path such as `stepResult.Success === false` is taken whatever its rank.
186
+ - **Multiple starting steps are supported.** A Flow agent with more than one active `StartingStep: true` step (for example, a workflow saved from a task graph with parallel wave-1 roots) compiles all active starting steps as root nodes (`dependsOn: []`) in dispatch mode, and walks all starting branches sequentially before entering any downstream join step in `inRun` mode.
169
187
  - **Answers live in the run, not the payload.** A run started with `startAtStep` past a Decision step has no answers from it, so every path that reads that decision stops the run with the reason. Start at or before the Decision step to route on it.
170
188
 
171
189
  See the **[Workflows and Task Graphs Guide](../../../guides/WORKFLOW_AND_TASK_GRAPH_GUIDE.md)** for the full model: node kinds, exclusive groups, payload mappings, loops, failure semantics, observability, and a worked configuration example.
@@ -240,6 +258,12 @@ Key pieces in this package:
240
258
  - **`MediaChannelServer`** (`src/realtime/media-channel-server.ts`, key `'MediaChannelServer'`) — the server channel plugin for the **Media** surface. Like the Whiteboard it canonicalizes the channel's persisted media state, and additionally resolves the agent's **media kit** at session start: it implements `IRealtimeChannelServerDataAware` to receive the session `contextUser`+`provider`, reads a per-session `mediaCollectionID` override out of `RealtimeChannelServerContext.AgentSessionConfig` (the persisted `AIAgentSession.Config_`), and feeds the model a manifest via `SendContextNote`. The kit-resolution logic is the pure, unit-tested `agent-media-library.ts` (`buildAgentMediaContextNote` / `resolveAgentMediaManifest` / `formatAgentMediaManifest`); precedence is `runtime override > AIAgent.DefaultMediaCollectionID > none`. The agent then surfaces items with the existing `Media_ShowMedia` client tool — no new client tool. `LoadMediaChannelServer()` is invoked from MJServer's `agentSessions` module. See the [Real-Time Co-Agents Guide](../../../guides/REALTIME_CO_AGENTS_GUIDE.md).
241
259
  - **`AgentMemoryContextBuilder`** (`src/agent-memory-context-builder.ts`) — the memory/RAG injection orchestration extracted out of `BaseAgent` so the co-agent assembles the **same** notes/examples/context a loop agent does, with no duplicated logic.
242
260
 
261
+ - **`realtime-channel-policy.ts`** (`BuildSessionChannelPolicy`) — the **server half of channel scoping** for client-direct sessions, pure and unit-tested. At mint the browser reports its channel candidates (`channelCandidatesJson`); `RealtimeClientSessionService` matches each to its `MJ: AI Agent Channels` row *from the server's own registry* (the client's view is never trusted), folds the cascade's `realtime.channels` section (agent layers plus `Application.AgentSettings.Realtime.Channels`) through `ResolveRealtimeChannelScope`, and returns the resolved `RealtimeSessionClientPolicy` (`PrepareClientSession` → `ClientPolicy`; the resolver returns it as `ClientPolicyJson` and persists the in-scope channel keys on the session). The tools the model is told about are narrowed to match: a vetoed channel's native tools never reach the provider, an included `'opt-in'` channel's are added by name, an `'on-demand'` channel declares none (it is opened through `ContextTool`), and tools no candidate owns (the host's own) pass through. Server plugins start before the scope is known, so `RealtimeChannelServerHost.PruneSessionChannels` drops the excluded channels' server halves afterwards. Absent candidates (a client that predates scoping, or a host that mints through its own proxy) ⇒ tools used exactly as declared and no policy.
262
+ - **`ClientOnlyChannelServer`** (`src/realtime/client-only-channel-server.ts`, key `'ClientOnlyChannelServer'`) — the generic server half for any channel that runs entirely in the browser. `MJ: AI Agent Channels.ServerPluginClass` is `NOT NULL`, so a client-only channel (an Open App's form or game channel) sets its row's `ServerPluginClass` to this key instead of writing an empty plugin. It takes its channel name from the registry row it was resolved for (`BindChannelName`, called by `RealtimeChannelServerHost`), contributes no server tools and does not interpret or rewrite saves. It does not decide scope (resolved before any plugin exists) and cannot stop a save (the host persists whatever the client submits when a plugin returns `null`), so persistence is controlled by the client plugin's `SerializeState()`. `LoadClientOnlyChannelServer()` is invoked from MJServer's `agentSessions` module.
263
+ - **`InteractiveComponentChannelServer`** (`src/realtime/interactive-component-channel-server.ts`, key `'InteractiveComponentChannelServer'`) — the deliberately thin server half of the **Interactive Component** channel (`MJ: AI Agent Channels` row `InteractiveComponent`), a `ClientOnlyChannelServer` subclass that keeps its existing registry key: no server tools, and the client plugin saves no state of record, because the channel's actions are derived from the open component's spec and run in the browser. `LoadInteractiveComponentChannelServer()` is invoked from MJServer's `agentSessions` module.
264
+ - **Channel exposure and zero data retention.** `BuildSessionChannelPolicy` also resolves each channel's **exposure** (`min(channel ceiling, agent cap, zero-data-retention ceiling)`; the user's own choice is applied by the browser). The agent cap is `realtime.channels.config.<Key>.maxExposure`; `requireZeroDataRetentionFor: ['state' | 'pixels']` (in the realtime configuration cascade and in `Application.AgentSettings.Realtime.Channels.RequireZeroDataRetentionFor`) lowers exposure when the session model's effective configuration (`AIEngine.GetEffectiveModelConfiguration`) does not declare `Privacy.ZeroDataRetention: true`; a failed model lookup fails closed. The resolved exposure and the reasons for any downgrade ride back in `ClientPolicyJson`. Also in the realtime session tuning section: `session.unverifiedMaxSeconds` / `session.verifiedMaxSeconds` (positive integers, carried through the cascade for the session-deadline logic; never forwarded to the provider driver).
265
+ - **App client tools and the unified resolver.** `Application.AgentSettings.ClientTools` is now actually read by the realtime path: resolved against the tool-definition catalog and layered, through `ResolveClientTools` (`override → session → app → static`), beneath the live surface's manifest in the app-context snapshot the companion prompt renders. The agent's static `MJ: AI Agent Client Tools` junction tools ride the returned policy (so the browser can describe them) but are deliberately not added to the voice prompt — voice prompts are token-sensitive and a tool with no browser handler is noise. The app's `AgentSettings` column is parsed with `ParseAgentSettings` rather than the generated accessor.
266
+
243
267
  Delegated runs link to the co-agent's run via `ParentRunID` and share the session's `AgentSessionID`, so the whole episode — session, co-agent run (with its prompt run + Timeline step), delegated runs, transcript (`ConversationDetail` rows), channel state, usage telemetry (checkpointed server-side, or relayed from the browser via `RelayRealtimeUsage`) — groups under one session record with full standard observability.
244
268
 
245
269
  The browser-side driver layer lives in [`@memberjunction/ai-realtime-client`](../RealtimeClient/README.md); the model primitive (`BaseRealtimeModel` / `IRealtimeSession`) lives in `@memberjunction/ai`; the Angular UX (call overlay, interactive channels, the live whiteboard) lives in `@memberjunction/ng-conversations`. **The flagship guide — concept, triple-registry plugin architecture, topologies, session lifecycle, channels, narration, security — is [guides/REALTIME_CO_AGENTS_GUIDE.md](../../../guides/REALTIME_CO_AGENTS_GUIDE.md).**
@@ -249,7 +273,8 @@ The browser-side driver layer lives in [`@memberjunction/ai-realtime-client`](..
249
273
  Manages data flow through agent execution:
250
274
 
251
275
  - Stores key-value data accessible across all steps and sub-agents
252
- - Supports typed payload changes requested by the LLM
276
+ - Supports typed payload changes requested by the LLM (`newElements`, `updateElements`, `replaceElements`, `removeElements`)
277
+ - Auto-corrects LLM output shape errors (`autoCorrectStrayKeys`), moving stray sibling keys into `newElements`/`updateElements` and automatically unwrapping common LLM wrapper aliases (`setFields`, `setElements`, `createElements`, `addElements`, `modifyElements`, `patchElements`, `updates`, `fields`, `set`, `add`) when the wrapper key does not exist on the payload and is not in `allowedPaths`
253
278
  - Validates and applies changes through PayloadChangeAnalyzer
254
279
  - Provides feedback to the LLM about successful/failed changes via PayloadFeedbackManager
255
280
 
@@ -305,7 +330,7 @@ Handles persistent memory operations for agents:
305
330
  - Consolidation, decay, and protection-tier maintenance over the agent note pool (see below)
306
331
  - **Hardening pass** over agent-authored provisional notes — runs unconditionally at the start of every cycle (before the consolidation-gated phases): LLM-dedupes each `Status='Provisional'` note against hardened notes (duplicates archived with `ConsolidatedIntoNoteID` lineage), and hardens survivors to `Status='Active'` with `ExpiresAt=NULL` so they join importance scoring, consolidation, contradiction detection, and decay in the same cycle
307
332
 
308
- **Session tuning & resilience (v5.49)**: the effective config's `realtime.session` section (`effortLevel` — MJ-normalized, `parallelToolCalls`, `mcpTools`, `inputTranscriptionModel`) flows into the driver Config bag on both topologies via `GetSessionTuningSettings`. The session runner observes the chained cancellation signal (`AbortSignal` dep), performs bounded transport reconnects on fatal drops (`MaxTransportReconnects`, default 1), and accumulates per-modality usage detail (`RealtimeUsage.Input/OutputTokenDetails`) that the checkpoint persists for multi-channel cost attribution. See `guides/REALTIME_CO_AGENTS_GUIDE.md` § "Session tuning, cost attribution & resilience".
333
+ **Session tuning & resilience (v5.49)**: the effective config's `realtime.session` section (`effortLevel` — MJ-normalized, `parallelToolCalls`, `mcpTools`, `inputTranscriptionModel`, `transcriptionLanguages`) flows into the driver Config bag on both topologies via `GetSessionTuningSettings`. The session runner observes the chained cancellation signal (`AbortSignal` dep), performs bounded transport reconnects on fatal drops (`MaxTransportReconnects`, default 1), and accumulates per-modality usage detail (`RealtimeUsage.Input/OutputTokenDetails`) that the checkpoint persists for multi-channel cost attribution. See `guides/REALTIME_CO_AGENTS_GUIDE.md` § "Session tuning, cost attribution & resilience".
309
334
 
310
335
  #### Consolidation Pipeline
311
336
 
@@ -403,6 +428,21 @@ const result = await runner.ExecuteAgent({
403
428
 
404
429
  See [`docs/AGENT_MEMORY_SCOPING.md`](./docs/AGENT_MEMORY_SCOPING.md) for the full model — built-in scopes, primary/secondary semantics, inheritance modes, and how scope propagates through sub-agent invocations.
405
430
 
431
+ ### For an Audience (Shared Conversations)
432
+
433
+ When an agent answers in a conversation several people share, set `Audience` so the run shows only what the asker **and** every other participant may see. Set it from the host's own participant list, server-side; it is never read from `data`.
434
+
435
+ ```typescript
436
+ const result = await new AgentRunner().RunAgent({
437
+ agent,
438
+ conversationMessages: messages,
439
+ contextUser: asker,
440
+ Audience: { Mode: 'Intersection', UserIDs: otherParticipantIDs } // MJ: Users IDs
441
+ });
442
+ ```
443
+
444
+ The run fails before any prompt if the audience is malformed or names an ID no user has (the server's `UserCache` is refreshed once first). Under an audience that adds a reader besides the caller: pre-execution RAG checks every reader's scope permission and searches with `SearchParams.Audience`; only shared notes and examples are injected; data-source preloading and the previous turn's tool results are skipped; task graphs, client tools, the caller's app context, memory writes and realtime sessions are withheld or refused; no out-of-conversation request (`MJ: AI Agent Requests`) is raised, so the run is never resumed without the audience; and every action call carries `RunActionParams.Audience`, which the action engine refuses (`AUDIENCE_UNSUPPORTED`, locked out for the run under its own `'audience'` breaker reason) for any action that does not declare `SupportsAudience` — today only Search and Scoped Search do. Sub-agents inherit the audience. Limits (no persisted audience to resume with; per-reader scope expansion; no `Union` mode) and the full table are in [Searching for an audience](../../../guides/SEARCH_SCOPES_AND_RAG_GUIDE.md#searching-for-an-audience).
445
+
406
446
  ### With Message Lifecycle Management
407
447
 
408
448
  ```typescript
@@ -422,6 +462,28 @@ const result = await runner.ExecuteAgent({
422
462
  });
423
463
  ```
424
464
 
465
+ ### With Post-Run Compaction, Scratchpad Pruning & Memory Extraction (`compactAfterRun`)
466
+
467
+ Programmatic callers and multi-run workflows can opt into automatic post-run cleanup once an agent run settles via `ExecuteAgentParams.compactAfterRun`. When enabled (`true` or an `AgentPostRunCompactionConfig` object), `BaseAgent.finalizeAgentRun` executes a failure-isolated post-run compaction pass after pending step writes and the run record are saved:
468
+
469
+ 1. **Conversation Message Compaction** — When `params.conversationMessages.length >= messageCountThreshold` (default: `20`), older volatile result messages (`IsVolatileResultMessage`: `action-result`, `client-tool-result`, `tool-result`, `sub-agent-result`, `loop-result`) in `[1 .. length - preserveRecentCount - 1]` are compacted via `compactMessage()` while preserving the initial user goal (`index 0`), ordinary `user`/`assistant` conversational turns, turns carrying `toolCalls`, and the most recent turns.
470
+ 2. **Scratchpad Pruning** — When the loop scratchpad contains more notes or completed tasks than `maxScratchpadNotes` (default: `20`), `ScratchpadManager.PruneNotes()` and `ScratchpadManager.EnforceTaskLimit()` prune the oldest low-priority note lines first (preserving `[HIGH]` / `[IMPORTANT]` / `[PINNED]` / `❗` / `⚠️` notes) and trim excess completed tasks.
471
+ 3. **Background Memory Extraction** — When `extractMemories !== false` and `agentRun.Success` is `true`, triggers background memory extraction (`triggerPostRunMemoryExtraction`) to harvest durable learnings from the completed run without blocking the caller.
472
+
473
+ ```typescript
474
+ const result = await runner.ExecuteAgent({
475
+ agentId: 'my-agent-id',
476
+ conversationMessages: messages,
477
+ contextUser: currentUser,
478
+ compactAfterRun: {
479
+ enabled: true,
480
+ messageCountThreshold: 12,
481
+ extractMemories: true,
482
+ maxScratchpadNotes: 20
483
+ }
484
+ });
485
+ ```
486
+
425
487
  ## Latency Optimizations & Concurrent Sub-Agent Execution
426
488
 
427
489
  To drastically reduce execution latency, the framework includes the following optimizations:
@@ -440,10 +502,10 @@ In-memory caching is integrated into `AIEngine.EmbedText` to bypass redundant lo
440
502
  `AgentDataPreloader.PreloadAgentData` resolves agent data sources concurrently with a bounded concurrency cap (default 10 in-flight at once) so a long list of sources can't saturate the DB connection pool.
441
503
 
442
504
  ### 3. Non-blocking Observability DB Logging
443
- Observability writes (`AIAgentRunStep` records) are completely non-blocking:
444
- * Step creation and finalization `.Save()` operations are queued immediately into `_pendingSaves` promises.
445
- * Sequenced queueing via `_stepSavePromises` chains saves on the *same* step ID to prevent database write races (e.g. executing a step `UPDATE` before its initial `INSERT` completes).
446
- * All pending logging writes are drained with `Promise.allSettled` inside `finalizeAgentRun()` and the queues are cleared, so a reused agent instance doesn't leak settled promises. Save failures (rejected promises OR `Save()===false`) are logged via `LogError` and a summary is folded into `agentRun.ErrorMessage` for visibility.
505
+ Observability writes (`AIAgentRunStep` and `AIPromptRun` records) are non-blocking during step execution and settled at terminal boundaries:
506
+ * **Per-entity and cross-step save chaining (`AgentRunStepSaveQueue`)**: Step creation (`createStepEntity`, `createCompactionStep`) and finalization/updates (`finalizeStepEntity`, `updateCompactionStep`, `checkExecutionGuardrails`, `validateSuccessNextStep`, `handleFinalPayloadValidationFailure`) enqueue `INSERT` and `UPDATE` operations onto `_stepSaveQueue` without blocking the agent loop. Updates on a step are chained behind its initial `INSERT`, and `finalizeStepEntity` preserves pre-finalize step fields (such as `guardrailExceeded` in `OutputData` and `FinalPayloadValidationResult`/`FinalPayloadValidationMessages`) across post-INSERT reloads. Child steps (`ParentID`) are chained behind their parent step's `INSERT`.
507
+ * **In-flight `PayloadAtStartSourceStepID` FK ordering (`FK_AIAgentRunStep_PayloadAtStartSourceStep`)**: `findPayloadAtStartSource` matches the latest non-`Running` step with `PayloadAtEnd` even when that source step's initial `INSERT` is still in flight (`!sourceStep.IsSaved`), avoiding redundant multi-kilobyte `PayloadAtStart` clones on fast sequential steps. When the matched source step is not yet saved, `createStepEntity` chains the new step's `INSERT` after `[parentStepEntity, payloadAtStartSource]` and attaches a `beforeInsert` safety fallback that restores inline `PayloadAtStart` (and clears `PayloadAtStartSourceStepID = null`) if the source step's `INSERT` failed.
508
+ * **Complete terminal settlement**: `_stepSaveQueue.Flush()` and `_promptRunner.FlushPendingSaves()` are awaited across all terminal paths — normal completion (`finalizeAgentRun`), failure (`createFailureResult`), cancellation (`createCancelledResult`), and post-turn conversation compaction (`recordCompactionRunStep`) — before the final `agentRun.Save()` executes, ensuring no orphaned or `Running` steps/prompt runs remain in Flight when `ExecuteAgent()` resolves. Save failures are logged via `LogError` and folded into `agentRun.ErrorMessage` for visibility.
447
509
 
448
510
  ### 4. Concurrent Sub-Agent Execution
449
511
  Loop agents can request multiple sub-agents to run in parallel by returning a `subAgents` array in their `nextStep` decision:
@@ -512,6 +574,36 @@ Long conversations no longer grow the agent's context without bound. Two coopera
512
574
 
513
575
  A success clears both counters. A blocked call returns a `CircuitBreakerActionResult` (carrying `Reason`) in ~0 ms without reaching the action engine, and the model receives a `[CRITICAL/ACTION_UNAVAILABLE | REPEATED_IDENTICAL_CALL | ATTEMPTS_EXHAUSTED]` directive as a user message (a `[WARNING/ACTION_FAILURE]` with an "attempt N of 5" counter otherwise). Argument identity is `normalizeActionParams` (three protected layers: outer → per-entry → recursive value). The pipeline registry and the ForEach / While operators pass `{ skipCircuitBreaker: true }` and bypass every rule, leaving the history untouched. Evidence and thresholds: [Performance and Cost Briefing §4](./docs/PROMPT_CACHE_PERFORMANCE_BRIEFING.md).
514
576
 
577
+ ## Root-Tree Cumulative Budget Guards (`AgentTreeBudget`)
578
+
579
+ Per-agent entity guardrails (`MaxIterationsPerRun`, `MaxTokensPerRun`, `MaxCostPerRun`, `MaxTimePerRun`) bound each `AIAgentRun` in isolation, which cannot stop multiplicative fan-out when a parent agent delegates to sequential or parallel sub-agents (for example, a depth-3 tree where each agent stays under a 10-step limit can still execute hundreds of steps across the tree).
580
+
581
+ `BaseAgent` enforces **root-tree cumulative budget guards** via a single shared `AgentTreeBudget` instance initialized at the root run and passed by object reference (`params.treeBudget`) to every child, related, parallel, and realtime-delegated sub-agent run:
582
+
583
+ | Ceiling on `ExecuteAgentParams` / `AgentTreeBudget` | Shared Counter | Breach Message |
584
+ |---|---|---|
585
+ | `maxTreeSteps` | `totalSteps` (incremented on every `createStepEntity`) | `Agent tree step budget exceeded (${totalSteps}/${maxTreeSteps} total steps across tree)` |
586
+ | `maxTreeTokens` | `totalTokens` (accumulated after every prompt, decision, and compaction run) | `Agent tree token budget exceeded (${totalTokens}/${maxTreeTokens} total tokens across tree)` |
587
+ | `maxTreeCost` | `totalCost` (accumulated USD cost across all prompt runs in the tree) | `Agent tree cost budget exceeded ($${totalCost.toFixed(4)}/$${maxTreeCost.toFixed(4)} across tree)` |
588
+ | `maxTreeDurationMs` | `Date.now() - startedAtMs` (wall-clock elapsed time since root run started) | `Agent tree duration budget exceeded (${elapsedMs}ms/${maxTreeDurationMs}ms across tree)` |
589
+
590
+ When any ceiling is reached:
591
+ 1. `budget.breachedReason` is stamped on the shared `AgentTreeBudget` instance.
592
+ 2. `hasExceededAgentRunGuardrails()` and `executeNextStep()` immediately return a terminal `{ step: 'Failed', terminate: true }` decision with the breach reason.
593
+ 3. Any parent or parallel sibling sharing the `AgentTreeBudget` observes `breachedReason` as soon as its in-flight step settles and halts the tree cleanly.
594
+
595
+ ```typescript
596
+ const result = await runner.RunAgent({
597
+ agent: orchestratorAgent,
598
+ conversationMessages: messages,
599
+ contextUser: currentUser,
600
+ maxTreeSteps: 25,
601
+ maxTreeTokens: 100_000,
602
+ maxTreeCost: 1.50,
603
+ maxTreeDurationMs: 120_000
604
+ });
605
+ ```
606
+
515
607
  ## Documentation
516
608
 
517
609
  Detailed guides are available in the [`docs/`](./docs/) directory:
@@ -519,6 +611,7 @@ Detailed guides are available in the [`docs/`](./docs/) directory:
519
611
  | Guide | Description |
520
612
  |---|---|
521
613
  | [Actions Guide](./docs/actions-guide.md) | Action discovery, execution, result lifecycle, expiration/compaction, context recovery |
614
+ | [Artifact Tools & Output Lifecycle Guide](./docs/ARTIFACT_TOOLS_GUIDE.md) | Inbound artifact routing (`Inline` vs `ToolsOnly`), tool libraries, output `artifactDirective` lifecycle (`create-new`, `version-source`, `suppress`), `_ARTIFACTS_ENABLED` prompt gating, full-conversation artifact targeting, and `ArtifactType.ExtractRules` |
522
615
  | [Decision Models](./docs/loop-agent-decisions.md) | The `decisionsEnabled` master switch, then each automatic use: inline decisions, finishIf gates, discovery, the payload change check, catalog narrowing, the Memory Manager note gate |
523
616
  | [Prompt-Cache Performance and Cost Briefing](./docs/PROMPT_CACHE_PERFORMANCE_BRIEFING.md) | Before/after cached share and cost per model and topology for the trailing runtime-state layout; the action circuit breaker's before/after; what to re-measure |
524
617
  | [Agent Prompt Caching Guide](../../../guides/AGENT_PROMPT_CACHING_GUIDE.md) | Repo-level guide: the trailing-state layout, the `PrefixPromptCache` flag from the model catalog, the Anthropic breakpoint seam, specialization placement, the circuit breaker |
@@ -527,7 +620,7 @@ Detailed guides are available in the [`docs/`](./docs/) directory:
527
620
  | [Human-in-the-Loop](./docs/HUMAN_IN_THE_LOOP.md) | Feedback requests, assignment strategies, request lifecycle |
528
621
  | [Agent Memory Scoping](./docs/AGENT_MEMORY_SCOPING.md) | Multi-tenant memory (notes/examples) with UserScope support |
529
622
  | [Iterative Operations](./docs/guide-to-iterative-operations-in-agents.md) | ForEach and While loop patterns, parallel execution |
530
- | [State Management](./docs/state-management.md) | Payload management, agent type state |
623
+ | [State Management](./docs/state-management.md) | Payload management, agent type state, stray-key & wrapper-alias recovery |
531
624
  | [Expression Context (PRD)](./docs/prd-expression-context-phase1.md) | Expression evaluation in agent contexts |
532
625
  | [Agent Profiles (Proposal)](./docs/agent-profiles-proposal.md) | Proposed agent profile system |
533
626
  | [Code Refactoring Notes](./docs/code-refactoring.md) | Internal refactoring notes |
@@ -51,6 +51,18 @@ export declare function selectPrimaryArtifact(fileArtifacts: readonly CreatedArt
51
51
  * ```
52
52
  */
53
53
  export declare class AgentRunner {
54
+ /**
55
+ * The status and message the agent's reply detail ends with, from the run's result.
56
+ *
57
+ * A run the user stopped is not an error: its reply is marked Complete with a short "stopped"
58
+ * message, so the chat shows a quiet end rather than a red failure, and the run row (Cancelled,
59
+ * with its reason and the payload as it stood) carries the detail. Every other outcome keeps the
60
+ * long-standing mapping: the run's message when it wrote one, else Completed or the error.
61
+ */
62
+ static ResolveFinalDetailState(agentResult: ExecuteAgentResult): {
63
+ Status: 'Complete' | 'Error';
64
+ Message: string;
65
+ };
54
66
  /**
55
67
  * Why a conversation-detail `Save()` returned false, for an error or log line. The owner gate in
56
68
  * `MJConversationDetailEntityExtended` refuses a non-owner's write (e.g. the elevated System user
@@ -60,6 +72,8 @@ export declare class AgentRunner {
60
72
  private static saveFailureReason;
61
73
  /** Fallback artifact type for agent payloads when the agent declares no DefaultArtifactTypeID. */
62
74
  private static readonly JSON_ARTIFACT_TYPE_ID;
75
+ /** Artifact type for structured research report payloads containing `{ report: { html } }`. */
76
+ private static readonly RESEARCH_CONTENT_ARTIFACT_TYPE_ID;
63
77
  /**
64
78
  * Max length of `MJ: Artifacts.Name` (`nvarchar(255)`).
65
79
  *
@@ -202,6 +216,34 @@ export declare class AgentRunner {
202
216
  versionId: string;
203
217
  versionNumber: number;
204
218
  }>;
219
+ /**
220
+ * Gives the current reply an existing artifact version whose content equals the new payload.
221
+ * The reply gets an `Output` link to that version (unless it already has one), which makes the
222
+ * version visible on the reply's branch path, and the result is the same tuple the normal
223
+ * version-creation path returns. When the link-exists read fails, no link is written and the
224
+ * result is `undefined`, so a failed read never adds a second link for the same pair.
225
+ *
226
+ * @param versionId - The existing version with identical content
227
+ * @param conversationDetailId - The reply row to link the version to
228
+ * @param artifactId - The parent artifact ID
229
+ * @param versionNumber - The existing version's number
230
+ * @param contextUser - User context for the read and the save
231
+ * @param provider - Metadata provider for the read and the save
232
+ * @returns The standard artifact result tuple for the existing version, or `undefined` when
233
+ * the link-exists read failed
234
+ */
235
+ private reuseVersionForReply;
236
+ /**
237
+ * Checks whether a conversation detail already has an `Output` link to an artifact version.
238
+ * A failed read is logged and returns `null`.
239
+ *
240
+ * @param conversationDetailId - The conversation detail to check
241
+ * @param versionId - The artifact version to look for
242
+ * @param contextUser - User context for the read
243
+ * @param provider - Metadata provider for the read
244
+ * @returns `true` when the link exists, `false` when it does not, `null` when the read failed
245
+ */
246
+ private hasOutputLink;
205
247
  /**
206
248
  * Finds the most recent artifact for a conversation detail to determine versioning.
207
249
  * Queries the junction table to locate artifacts linked to a specific conversation message.
@@ -240,6 +282,11 @@ export declare class AgentRunner {
240
282
  * 3. If previous artifact exists, creates new version of it
241
283
  * 4. If no previous artifact, creates entirely new artifact
242
284
  *
285
+ * When the payload equals the version a new one would follow, no version is created. Inside a
286
+ * conversation that existing version is linked to the reply (an `Output` link, unless one
287
+ * exists) and returned; if the link-exists read fails, nothing is written and the method returns
288
+ * `undefined`. Outside a conversation the method returns `undefined`.
289
+ *
243
290
  * Respects the agent's ArtifactCreationMode configuration:
244
291
  * - "Never": Skips artifact creation entirely
245
292
  * - "System Only": Creates artifact with Visibility='System Only'
@@ -580,12 +627,14 @@ export declare class AgentRunner {
580
627
  */
581
628
  private resolveConversationId;
582
629
  /**
583
- * Gathers all artifacts from a conversation (both artifact-system records and
584
- * uploaded file attachments) so the ArtifactToolManager can make them available
630
+ * Gathers the artifacts on the run's branch path of a conversation (both artifact-system
631
+ * records and uploaded file attachments) so the ArtifactToolManager can make them available
585
632
  * to the agent as input artifacts.
586
633
  *
587
634
  * @param historyFrom The run's history floor (`ExecuteAgentParams.ConversationHistoryFrom`).
588
635
  * When set, only artifacts attached to messages written at or after it are gathered.
636
+ * @param branchId The run's branch; only artifacts of messages on its path that no rerun
637
+ * replaced are gathered.
589
638
  */
590
639
  private gatherConversationArtifacts;
591
640
  /**
@@ -613,13 +662,14 @@ export declare class AgentRunner {
613
662
  private inferArtifactTypeName;
614
663
  /**
615
664
  * Downloads binary content for a file-backed artifact from MJStorage.
616
- * Uses FileStorageEngine to resolve the storage account and driver,
617
- * then fetches the file by its ProviderKey.
665
+ * Reads the `MJ: Files` row as the user, then resolves it through
666
+ * `FileStorageEngine.ResolveFileObject`, which applies the storage-account gate and the
667
+ * tracked-file rule before any driver call — the same path every other file-ID route uses.
618
668
  *
619
669
  * @param fileId - The MJ: Files entity ID referenced by ArtifactVersion.FileID
620
670
  * @param contextUser - User context for storage driver authentication
621
671
  * @returns Buffer of file content, or null if download fails
622
672
  */
623
- private downloadArtifactFileContent;
673
+ protected DownloadArtifactFileContent(fileId: string, contextUser: UserInfo): Promise<Buffer | null>;
624
674
  }
625
675
  //# sourceMappingURL=AgentRunner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentRunner.d.ts","sourceRoot":"","sources":["../src/AgentRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAsG,QAAQ,EAAE,iBAAiB,EAAsC,MAAM,sBAAsB,CAAC;AAG3M,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAA4D,MAAM,8BAA8B,CAAC;AAC5K,OAAO,EAA+C,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAwBzG;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC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