@memberjunction/ai-agents 6.2.0-edge.4 → 6.2.0-edge.6

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 (161) hide show
  1. package/README.md +154 -7
  2. package/dist/AgentDataPreloader.d.ts +4 -2
  3. package/dist/AgentDataPreloader.d.ts.map +1 -1
  4. package/dist/AgentDataPreloader.js +21 -12
  5. package/dist/AgentDataPreloader.js.map +1 -1
  6. package/dist/AgentRunner.d.ts +61 -6
  7. package/dist/AgentRunner.d.ts.map +1 -1
  8. package/dist/AgentRunner.js +313 -68
  9. package/dist/AgentRunner.js.map +1 -1
  10. package/dist/AgentWakeTriggerService.d.ts +183 -0
  11. package/dist/AgentWakeTriggerService.d.ts.map +1 -0
  12. package/dist/AgentWakeTriggerService.js +478 -0
  13. package/dist/AgentWakeTriggerService.js.map +1 -0
  14. package/dist/ArtifactToolManager.d.ts +12 -3
  15. package/dist/ArtifactToolManager.d.ts.map +1 -1
  16. package/dist/ArtifactToolManager.js +77 -6
  17. package/dist/ArtifactToolManager.js.map +1 -1
  18. package/dist/ClientToolRequestManager.d.ts +11 -1
  19. package/dist/ClientToolRequestManager.d.ts.map +1 -1
  20. package/dist/ClientToolRequestManager.js +19 -6
  21. package/dist/ClientToolRequestManager.js.map +1 -1
  22. package/dist/ConversationToolManager.d.ts +1 -1
  23. package/dist/ConversationToolManager.d.ts.map +1 -1
  24. package/dist/ConversationToolManager.js +10 -4
  25. package/dist/ConversationToolManager.js.map +1 -1
  26. package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
  27. package/dist/MJAIAgentRequestEntityServer.js +20 -0
  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 +38 -6
  45. package/dist/agent-context-injector.d.ts.map +1 -1
  46. package/dist/agent-context-injector.js +72 -20
  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 +14 -5
  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 +227 -29
  55. package/dist/agent-pre-execution-rag.js.map +1 -1
  56. package/dist/agent-run-watchdog.d.ts +23 -8
  57. package/dist/agent-run-watchdog.d.ts.map +1 -1
  58. package/dist/agent-run-watchdog.js +141 -76
  59. package/dist/agent-run-watchdog.js.map +1 -1
  60. package/dist/agent-types/flow-agent-type.d.ts +15 -0
  61. package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
  62. package/dist/agent-types/flow-agent-type.js +129 -13
  63. package/dist/agent-types/flow-agent-type.js.map +1 -1
  64. package/dist/agent-types/loop-agent-prompt-params.d.ts +6 -2
  65. package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
  66. package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
  67. package/dist/agent-types/loop-agent-response-type.d.ts +8 -2
  68. package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
  69. package/dist/agent-types/loop-agent-response-type.js.map +1 -1
  70. package/dist/agent-types/loop-agent-type.d.ts +85 -7
  71. package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
  72. package/dist/agent-types/loop-agent-type.js +290 -66
  73. package/dist/agent-types/loop-agent-type.js.map +1 -1
  74. package/dist/base-agent.d.ts +809 -38
  75. package/dist/base-agent.d.ts.map +1 -1
  76. package/dist/base-agent.js +3308 -609
  77. package/dist/base-agent.js.map +1 -1
  78. package/dist/bound-action-params.d.ts +57 -0
  79. package/dist/bound-action-params.d.ts.map +1 -0
  80. package/dist/bound-action-params.js +91 -0
  81. package/dist/bound-action-params.js.map +1 -0
  82. package/dist/index.d.ts +9 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +9 -0
  85. package/dist/index.js.map +1 -1
  86. package/dist/memory-cleanup-agent.d.ts.map +1 -1
  87. package/dist/memory-cleanup-agent.js +3 -0
  88. package/dist/memory-cleanup-agent.js.map +1 -1
  89. package/dist/memory-manager-agent.d.ts.map +1 -1
  90. package/dist/memory-manager-agent.js +52 -35
  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/agent-tools.d.ts +64 -0
  101. package/dist/native-tools/agent-tools.d.ts.map +1 -0
  102. package/dist/native-tools/agent-tools.js +23 -0
  103. package/dist/native-tools/agent-tools.js.map +1 -0
  104. package/dist/native-tools/control-tools.d.ts +26 -4
  105. package/dist/native-tools/control-tools.d.ts.map +1 -1
  106. package/dist/native-tools/control-tools.js +114 -42
  107. package/dist/native-tools/control-tools.js.map +1 -1
  108. package/dist/native-tools/framework-tools.d.ts +47 -0
  109. package/dist/native-tools/framework-tools.d.ts.map +1 -0
  110. package/dist/native-tools/framework-tools.js +187 -0
  111. package/dist/native-tools/framework-tools.js.map +1 -0
  112. package/dist/native-tools/json-argument.d.ts +41 -0
  113. package/dist/native-tools/json-argument.d.ts.map +1 -0
  114. package/dist/native-tools/json-argument.js +79 -0
  115. package/dist/native-tools/json-argument.js.map +1 -0
  116. package/dist/native-tools/native-control-config.d.ts +93 -0
  117. package/dist/native-tools/native-control-config.d.ts.map +1 -0
  118. package/dist/native-tools/native-control-config.js +104 -0
  119. package/dist/native-tools/native-control-config.js.map +1 -0
  120. package/dist/native-tools/tool-result-turns.d.ts +41 -8
  121. package/dist/native-tools/tool-result-turns.d.ts.map +1 -1
  122. package/dist/native-tools/tool-result-turns.js +76 -2
  123. package/dist/native-tools/tool-result-turns.js.map +1 -1
  124. package/dist/native-tools/turn-mode.d.ts +8 -0
  125. package/dist/native-tools/turn-mode.d.ts.map +1 -0
  126. package/dist/native-tools/turn-mode.js +14 -0
  127. package/dist/native-tools/turn-mode.js.map +1 -0
  128. package/dist/query-builder-agent.d.ts +33 -5
  129. package/dist/query-builder-agent.d.ts.map +1 -1
  130. package/dist/query-builder-agent.js +137 -30
  131. package/dist/query-builder-agent.js.map +1 -1
  132. package/dist/realtime/bridge-room-transcript-sink.js +1 -0
  133. package/dist/realtime/bridge-room-transcript-sink.js.map +1 -1
  134. package/dist/realtime/bridge-session-transcript-sink.js +1 -0
  135. package/dist/realtime/bridge-session-transcript-sink.js.map +1 -1
  136. package/dist/realtime/realtime-client-session-service.d.ts +5 -4
  137. package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
  138. package/dist/realtime/realtime-client-session-service.js +42 -30
  139. package/dist/realtime/realtime-client-session-service.js.map +1 -1
  140. package/dist/realtime/realtime-coagent-config.d.ts +8 -1
  141. package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
  142. package/dist/realtime/realtime-coagent-config.js +17 -1
  143. package/dist/realtime/realtime-coagent-config.js.map +1 -1
  144. package/dist/realtime/realtime-recording-ledger.d.ts +150 -0
  145. package/dist/realtime/realtime-recording-ledger.d.ts.map +1 -0
  146. package/dist/realtime/realtime-recording-ledger.js +206 -0
  147. package/dist/realtime/realtime-recording-ledger.js.map +1 -0
  148. package/dist/realtime/realtime-recording-opus-assembly.d.ts +211 -0
  149. package/dist/realtime/realtime-recording-opus-assembly.d.ts.map +1 -0
  150. package/dist/realtime/realtime-recording-opus-assembly.js +706 -0
  151. package/dist/realtime/realtime-recording-opus-assembly.js.map +1 -0
  152. package/dist/realtime/realtime-recording-store.d.ts +44 -6
  153. package/dist/realtime/realtime-recording-store.d.ts.map +1 -1
  154. package/dist/realtime/realtime-recording-store.js +105 -51
  155. package/dist/realtime/realtime-recording-store.js.map +1 -1
  156. package/dist/realtime/realtime-turn-moderator.d.ts +2 -1
  157. package/dist/realtime/realtime-turn-moderator.d.ts.map +1 -1
  158. package/dist/realtime/realtime-turn-moderator.js +7 -1
  159. package/dist/realtime/realtime-turn-moderator.js.map +1 -1
  160. package/dist/volatile-child-prompt.js +3 -3
  161. 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.
@@ -255,7 +273,8 @@ The browser-side driver layer lives in [`@memberjunction/ai-realtime-client`](..
255
273
  Manages data flow through agent execution:
256
274
 
257
275
  - Stores key-value data accessible across all steps and sub-agents
258
- - 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`
259
278
  - Validates and applies changes through PayloadChangeAnalyzer
260
279
  - Provides feedback to the LLM about successful/failed changes via PayloadFeedbackManager
261
280
 
@@ -311,7 +330,7 @@ Handles persistent memory operations for agents:
311
330
  - Consolidation, decay, and protection-tier maintenance over the agent note pool (see below)
312
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
313
332
 
314
- **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".
315
334
 
316
335
  #### Consolidation Pipeline
317
336
 
@@ -390,6 +409,24 @@ const result = await runner.ExecuteAgent({
390
409
  });
391
410
  ```
392
411
 
412
+ ### With Bound Action Parameters
413
+
414
+ A host can fix some of an action's input parameters for the run, so the model can neither see nor change them. A bound parameter is left out of the action's description in the prompt, out of its native tool schema, out of the result echoed to the model and out of what Find Candidate Actions / Find Best Action report; at dispatch the bound value replaces whatever the model sent under that name, the override is logged with the run and step IDs, and the action's execution log marks the parameter `Bound`. Bindings reach every sub-agent run. A required parameter bound to nothing, or a binding that names a parameter the action does not have, refuses the action before it runs: the model is told only that the action is unavailable, and the action is locked out for the rest of the run. A binding keyed by anything other than a known Action ID fails the run at its start.
415
+
416
+ ```typescript
417
+ const result = await runner.RunAgent({
418
+ agent: spaceAgent,
419
+ conversationMessages: messages,
420
+ contextUser: currentUser,
421
+ // Action ID → parameter name → value. The model is never told ChapterID exists.
422
+ boundActionParams: {
423
+ [listMembersActionId]: { ChapterID: space.ChapterID }
424
+ }
425
+ });
426
+ ```
427
+
428
+ **Limits.** Bindings are server-side only (no GraphQL input reaches them). A run with bindings has task graphs withheld, because a graph's action nodes are dispatched outside the agent's binding gate. A run stores its bindings on `MJ: AI Agent Runs.BoundActionParams`, and a run that continues another (`lastRunId`, including a resume from a stored request) applies them when its caller passes none; a prior run that cannot be read (missing, hidden from the context user, or holding bindings that do not parse to an object) fails the continuing run. `actionChanges` are not persisted, so a resumed run starts without them. Bindings hide a value from the model; they are not a boundary against the user, who can start an unbound run. The realtime client-direct action path and the `Execute Agent` action (along with Loop, Conditional, Retry and Parallel Execute when run without a `RunScope` that refuses them) dispatch without forwarding `boundActionParams`, so do not grant them to a bound agent. An action's own message text may mention a bound value. The rules are exported for hosts that dispatch actions themselves: `BindingsForAction`, `UnboundParams`, `IsBoundParamName`, `ApplyBoundActionParams`.
429
+
393
430
  ### With Memory Scope (Multi-Tenant)
394
431
 
395
432
  Multi-tenant deployments can isolate the agent's memory cohort (notes and examples) per request by passing scope fields on `ExecuteAgentParams`. The fields are top-level — there is no `userScope` wrapper:
@@ -409,6 +446,21 @@ const result = await runner.ExecuteAgent({
409
446
 
410
447
  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.
411
448
 
449
+ ### For an Audience (Shared Conversations)
450
+
451
+ 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`.
452
+
453
+ ```typescript
454
+ const result = await new AgentRunner().RunAgent({
455
+ agent,
456
+ conversationMessages: messages,
457
+ contextUser: asker,
458
+ Audience: { Mode: 'Intersection', UserIDs: otherParticipantIDs } // MJ: Users IDs
459
+ });
460
+ ```
461
+
462
+ 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).
463
+
412
464
  ### With Message Lifecycle Management
413
465
 
414
466
  ```typescript
@@ -428,6 +480,28 @@ const result = await runner.ExecuteAgent({
428
480
  });
429
481
  ```
430
482
 
483
+ ### With Post-Run Compaction, Scratchpad Pruning & Memory Extraction (`compactAfterRun`)
484
+
485
+ 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:
486
+
487
+ 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.
488
+ 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.
489
+ 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.
490
+
491
+ ```typescript
492
+ const result = await runner.ExecuteAgent({
493
+ agentId: 'my-agent-id',
494
+ conversationMessages: messages,
495
+ contextUser: currentUser,
496
+ compactAfterRun: {
497
+ enabled: true,
498
+ messageCountThreshold: 12,
499
+ extractMemories: true,
500
+ maxScratchpadNotes: 20
501
+ }
502
+ });
503
+ ```
504
+
431
505
  ## Latency Optimizations & Concurrent Sub-Agent Execution
432
506
 
433
507
  To drastically reduce execution latency, the framework includes the following optimizations:
@@ -446,10 +520,10 @@ In-memory caching is integrated into `AIEngine.EmbedText` to bypass redundant lo
446
520
  `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.
447
521
 
448
522
  ### 3. Non-blocking Observability DB Logging
449
- Observability writes (`AIAgentRunStep` records) are completely non-blocking:
450
- * Step creation and finalization `.Save()` operations are queued immediately into `_pendingSaves` promises.
451
- * 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).
452
- * 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.
523
+ Observability writes (`AIAgentRunStep` and `AIPromptRun` records) are non-blocking during step execution and settled at terminal boundaries:
524
+ * **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`.
525
+ * **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.
526
+ * **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.
453
527
 
454
528
  ### 4. Concurrent Sub-Agent Execution
455
529
  Loop agents can request multiple sub-agents to run in parallel by returning a `subAgents` array in their `nextStep` decision:
@@ -518,6 +592,78 @@ Long conversations no longer grow the agent's context without bound. Two coopera
518
592
 
519
593
  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).
520
594
 
595
+ ## Root-Tree Cumulative Budget Guards (`AgentTreeBudget`)
596
+
597
+ 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).
598
+
599
+ `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:
600
+
601
+ | Ceiling on `ExecuteAgentParams` / `AgentTreeBudget` | Shared Counter | Breach Message |
602
+ |---|---|---|
603
+ | `maxTreeSteps` | `totalSteps` (incremented on every `createStepEntity`) | `Agent tree step budget exceeded (${totalSteps}/${maxTreeSteps} total steps across tree)` |
604
+ | `maxTreeTokens` | `totalTokens` (accumulated after every prompt, decision, and compaction run) | `Agent tree token budget exceeded (${totalTokens}/${maxTreeTokens} total tokens across tree)` |
605
+ | `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)` |
606
+ | `maxTreeDurationMs` | `Date.now() - startedAtMs` (wall-clock elapsed time since root run started) | `Agent tree duration budget exceeded (${elapsedMs}ms/${maxTreeDurationMs}ms across tree)` |
607
+
608
+ When any ceiling is reached:
609
+ 1. `budget.breachedReason` is stamped on the shared `AgentTreeBudget` instance.
610
+ 2. `hasExceededAgentRunGuardrails()` and `executeNextStep()` immediately return a terminal `{ step: 'Failed', terminate: true }` decision with the breach reason.
611
+ 3. Any parent or parallel sibling sharing the `AgentTreeBudget` observes `breachedReason` as soon as its in-flight step settles and halts the tree cleanly.
612
+
613
+ ```typescript
614
+ const result = await runner.RunAgent({
615
+ agent: orchestratorAgent,
616
+ conversationMessages: messages,
617
+ contextUser: currentUser,
618
+ maxTreeSteps: 25,
619
+ maxTreeTokens: 100_000,
620
+ maxTreeCost: 1.50,
621
+ maxTreeDurationMs: 120_000
622
+ });
623
+ ```
624
+
625
+ ## Event-Driven Agent Wakes (`AgentWakeTriggerService`)
626
+
627
+ Self-scheduling agents such as the Chief of Staff normally wake on a cron or adaptive `MJ: User Routines` schedule guarded by the 3-tier wake gate (see [Built-In Agents Guide](../../../guides/BUILT_IN_AGENTS_GUIDE.md)). `AgentWakeTriggerService` (a `BaseSingleton`, exported from this package) adds the event-driven complement: when something happens that an agent should react to now, it writes a one-shot `AgentWake` routine for the right user so the agent runs on the dispatcher's next sweep instead of waiting for its next scheduled slot.
628
+
629
+ **Delivery is a routine row, not a direct agent invocation.** Every trigger ends in `upsertImmediateWakeRoutine`, which finds (by `UserID` + `TargetID` + `WakeConfigurationObject.workstreamKey`) or creates an `MJ: User Routines` row with `RoutineType = 'AgentWake'`, `TargetType = 'Agent'`, `ScheduleMode = 'OneShot'`, `Status = 'Active'`, `NextRunAt = now`, and stores `{ workstreamKey, wakeReason, resumeState }` in `WakeConfigurationObject` (also mirrored into `StartingPayload` and `InitialMessage`). `resumeState` carries the latest event at its top level **and** every event since the last dispatcher claim in `resumeState.pendingEvents`: while the routine is still waiting (`Status = 'Active'` with a `NextRunAt`), a new event is appended rather than replacing the previous one, so two approvals clicked within one sweep both reach the agent; once the dispatcher has claimed the routine the list starts over. The same request in the same status is queued once. With more than one pending event, `wakeReason` / `InitialMessage` enumerate them. `UserRoutineDispatcherDriver` sweeps due routines once a minute, so "immediate" means **on the next sweep, within about a minute**. The dispatcher hands the agent `payload._wakeContext.resumeState` and runs it with `compactAfterRun: true`. A freshly created event routine carries no tier configuration, so `WakeGateEvaluator` fails open; an existing routine for the same workstream keeps whatever gate it already had.
630
+
631
+ | Trigger | Fired by | Whose agent wakes | `workstreamKey` | `resumeState.triggerType` |
632
+ |---|---|---|---|---|
633
+ | `TriggerWakeOnAgentRequestResolution` | `MJAIAgentRequestEntityServer.Save()` when an action-created `MJ: AI Agent Requests` row (`OriginatingAgentRunID` and `OriginatingTaskID` both null) moves from `Requested` to `Approved`, `Rejected` or `Responded` | The request owner (`RequestForUserID`) and `AgentID` | `approval-resolution` | `AgentRequestResolution` — `requestID`, `status`, `request`, `response`, parsed `responseData` and `commentsData`, `respondedByUserID`, `respondedAt` |
634
+ | Same method, inter-agent envelope | The resolved request's `Comments` is a `Send Inter-Agent Request` envelope (`interAgentCoordination: true`) | The **sender** user (`envelope.senderUserID`) and `senderAgentID` | envelope `workstreamKey`, else `inter-agent-resolution` | `InterAgentRequestResolved` — `requestID`, `status`, `subject`, `response`, `responseData`, `respondedByUserID`, `respondedAt`, `targetUserID`, `targetUserName` |
635
+ | `TriggerWakeOnIncomingInterAgentRequest` | `MJAIAgentRequestEntityServer.Save()` on a **new** `Requested` row whose `Comments` is an inter-agent envelope (`interAgentCoordination: true`) | The **target** user (`envelope.targetUserID`) and the request's `AgentID` | envelope `workstreamKey`, else `inter-agent-inbox` | `InterAgentRequestReceived` — `requestID`, `senderUserID`, `senderUserName`, `senderAgentID`, `subject`, `messageBody` |
636
+ | `RouteInboundUtilityMailboxWake` | An inbound-email ingestion path (none wired yet) passing an `InboundUtilityMailboxEmailInput` | The verified internal sender (`fromAddress` matches an active `MJ: Users` row) and the `AgentID` of the matching `MJ: AI Bridge Agent Identities` row (`IdentityType = 'Email'`, `IsActive`) | input `workstreamKey`, else identity `Configuration.defaultWorkstreamKey`, else `inbound-utility-mailbox` | `InboundUtilityMailboxEmail` — `identityID`, `utilityMailboxAddress`, `senderUserID`, `senderEmail`, `messageID`, `subject`, `bodyPreview`, `receivedAt` |
637
+
638
+ Every `resumeState` also repeats the `workstreamKey`. Requests that carry `OriginatingAgentRunID` (a paused run) or `OriginatingTaskID` (a task graph) are skipped — those resume through the existing `lastRunId` path and the task dispatcher, not through a wake.
639
+
640
+ **Policy checks.** `AgentUserPolicyEngine.GetPolicyForAgentAndUser` is consulted for the target user. A `Disabled` or `Paused` `MJ: AI Agent User Policies` row blocks every trigger; the incoming inter-agent trigger additionally requires an `Active` policy with `AllowInterAgentCoordination` not `false`; the mailbox trigger also refuses `EmailChannelMode = 'Disabled'`, enforces the identity's optional `Configuration.allowedUserID` / `allowedEmailDomains`, and rejects any sender that is not an active internal user.
641
+
642
+ **Result.** Each method returns an `AgentWakeTriggerResult` — `{ triggered, resultCode, reason, routineID, targetUserID, targetAgentID, workstreamKey, nextRunAtISO }` — and never throws for business outcomes. `resultCode` is one of `WAKE_SCHEDULED`, `SKIPPED_NOT_APPLICABLE`, `POLICY_DENIED`, `IDENTITY_NOT_FOUND`, `UNVERIFIED_EXTERNAL_SENDER`, `SENDER_NOT_AUTHORIZED_FOR_IDENTITY`, `SAVE_FAILED`.
643
+
644
+ ```typescript
645
+ import { LogStatus } from '@memberjunction/core';
646
+ import { AgentWakeTriggerService } from '@memberjunction/ai-agents';
647
+
648
+ // Inside a server-side entity subclass or resolver, after the request has saved:
649
+ const result = await AgentWakeTriggerService.Instance.TriggerWakeOnAgentRequestResolution(
650
+ request, // MJAIAgentRequestEntity, Status already Approved/Rejected/Responded
651
+ contextUser, // UserInfo the save ran under
652
+ this.ProviderToUse // IMetadataProvider; defaults to Metadata.Provider when omitted
653
+ );
654
+ if (!result.triggered) {
655
+ LogStatus(`No wake scheduled (${result.resultCode}): ${result.reason}`);
656
+ }
657
+ ```
658
+
659
+ **Current limitations**
660
+
661
+ - Routines are private to their owner (`MJUserRoutineEntityServer.validateOwnership`, plus row-level security on the lookup). A wake for the caller's own agent is saved in the caller's scope; a wake for another user (inter-agent arrival, or a resolution that wakes the sender) is saved as the scheduler's **system user** from `UserCache`, which the ownership gate exempts. If no system user is cached (unit tests, unusual hosts) the service falls back to the caller and logs that the save may be rejected.
662
+ - The service's `InterAgentCoordinationEnvelopeShape` accepts both the `InterAgentCoordinationEnvelope` field names the action writes (`protocolVersion`, `message`) and the older `envelopeVersion` / `messageBody` names. The two shapes are still declared separately because `@memberjunction/core-actions` depends on this package, not the reverse.
663
+ - Wakes are keyed by `UserID` + `TargetID` + `workstreamKey`; events for the same workstream that land between sweeps are queued in `resumeState.pendingEvents` (see above). The queue is at-least-once: an event that lands between the dispatcher's claim save and the service's save can be delivered twice, so the agent should treat `requestID` as idempotent and re-check the request's current status.
664
+ - `RouteInboundUtilityMailboxWake` has no production caller. Wiring it needs an inbound-email ingestion path (mailbox poller or provider webhook) that does not exist yet, and `resolveVerifiedInternalSender` should then resolve the sender through `UserCache` rather than building a role-less `UserInfo`. Deferred to a follow-up by decision.
665
+ - The wake is a `OneShot` `MJ: User Routines` row picked up by the dispatcher, not a direct `AgentRunner` call, so delivery latency is bounded by the sweep interval and the dispatcher's concurrency limit.
666
+
521
667
  ## Documentation
522
668
 
523
669
  Detailed guides are available in the [`docs/`](./docs/) directory:
@@ -525,6 +671,7 @@ Detailed guides are available in the [`docs/`](./docs/) directory:
525
671
  | Guide | Description |
526
672
  |---|---|
527
673
  | [Actions Guide](./docs/actions-guide.md) | Action discovery, execution, result lifecycle, expiration/compaction, context recovery |
674
+ | [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` |
528
675
  | [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 |
529
676
  | [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 |
530
677
  | [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 |
@@ -533,7 +680,7 @@ Detailed guides are available in the [`docs/`](./docs/) directory:
533
680
  | [Human-in-the-Loop](./docs/HUMAN_IN_THE_LOOP.md) | Feedback requests, assignment strategies, request lifecycle |
534
681
  | [Agent Memory Scoping](./docs/AGENT_MEMORY_SCOPING.md) | Multi-tenant memory (notes/examples) with UserScope support |
535
682
  | [Iterative Operations](./docs/guide-to-iterative-operations-in-agents.md) | ForEach and While loop patterns, parallel execution |
536
- | [State Management](./docs/state-management.md) | Payload management, agent type state |
683
+ | [State Management](./docs/state-management.md) | Payload management, agent type state, stray-key & wrapper-alias recovery |
537
684
  | [Expression Context (PRD)](./docs/prd-expression-context-phase1.md) | Expression evaluation in agent contexts |
538
685
  | [Agent Profiles (Proposal)](./docs/agent-profiles-proposal.md) | Proposed agent profile system |
539
686
  | [Code Refactoring Notes](./docs/code-refactoring.md) | Internal refactoring notes |
@@ -37,7 +37,7 @@ export interface PreloadedDataResult {
37
37
  }
38
38
  export declare class AgentDataPreloader extends BaseSingleton<AgentDataPreloader> {
39
39
  /**
40
- * Per-agent cache (global, TTL-based)
40
+ * Per-agent cache (TTL-based), keyed by agent, data source and user
41
41
  */
42
42
  private _perAgentCache;
43
43
  /**
@@ -139,7 +139,9 @@ export declare class AgentDataPreloader extends BaseSingleton<AgentDataPreloader
139
139
  */
140
140
  private cacheData;
141
141
  /**
142
- * Generates a cache key for per-agent caching.
142
+ * Generates a cache key for per-agent caching. The key includes the user, because the rows were
143
+ * loaded under that user's row- and field-level permissions and must never be served to another
144
+ * user. Returns null when there is no user, in which case the data is not cached.
143
145
  *
144
146
  * @private
145
147
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AgentDataPreloader.d.ts","sourceRoot":"","sources":["../src/AgentDataPreloader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAqE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAc,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC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A0CrB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAuCjB;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;CAG9B"}
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import { AIEngine } from '@memberjunction/aiengine';
14
14
  import { LogError, LogStatusEx, IsVerboseLoggingEnabled, RunView, RunQuery } from '@memberjunction/core';
15
- import { UUIDsEqual, BaseSingleton } from '@memberjunction/global';
15
+ import { UUIDsEqual, BaseSingleton, UserScopedCacheKey } from '@memberjunction/global';
16
16
  import _ from 'lodash';
17
17
  /**
18
18
  * Singleton service for preloading agent data sources.
@@ -21,7 +21,8 @@ import _ from 'lodash';
21
21
  * in AIAgentDataSource metadata. Supports three cache policies:
22
22
  * - None: No caching, data is loaded fresh every time
23
23
  * - PerRun: Data is cached for the duration of a single agent run
24
- * - PerAgent: Data is cached globally with a TTL, shared across all runs
24
+ * - PerAgent: Data is cached with a TTL across runs of the agent, separately for each user,
25
+ * because the rows were loaded under that user's permissions
25
26
  *
26
27
  * @class AgentDataPreloader
27
28
  * @example
@@ -40,7 +41,7 @@ export class AgentDataPreloader extends BaseSingleton {
40
41
  constructor() {
41
42
  super();
42
43
  /**
43
- * Per-agent cache (global, TTL-based)
44
+ * Per-agent cache (TTL-based), keyed by agent, data source and user
44
45
  */
45
46
  this._perAgentCache = new Map();
46
47
  /**
@@ -256,7 +257,7 @@ export class AgentDataPreloader extends BaseSingleton {
256
257
  */
257
258
  async executeDataSource(source, contextUser, runId) {
258
259
  // Check cache first
259
- const cachedData = this.getCachedData(source, runId);
260
+ const cachedData = this.getCachedData(source, contextUser, runId);
260
261
  if (cachedData !== null) {
261
262
  LogStatusEx({
262
263
  message: `AgentDataPreloader: Using cached data for '${source.Name}'`,
@@ -277,7 +278,7 @@ export class AgentDataPreloader extends BaseSingleton {
277
278
  throw new Error(`Unknown source type: ${source.SourceType}`);
278
279
  }
279
280
  // Cache the data if policy dictates
280
- this.cacheData(source, data, runId);
281
+ this.cacheData(source, data, contextUser, runId);
281
282
  return data;
282
283
  }
283
284
  /**
@@ -348,7 +349,7 @@ export class AgentDataPreloader extends BaseSingleton {
348
349
  * @private
349
350
  * @returns Cached data or null if not cached/expired
350
351
  */
351
- getCachedData(source, runId) {
352
+ getCachedData(source, contextUser, runId) {
352
353
  if (source.CachePolicy === 'None') {
353
354
  return null;
354
355
  }
@@ -360,7 +361,10 @@ export class AgentDataPreloader extends BaseSingleton {
360
361
  return null;
361
362
  }
362
363
  if (source.CachePolicy === 'PerAgent') {
363
- const cacheKey = this.getPerAgentCacheKey(source);
364
+ const cacheKey = this.getPerAgentCacheKey(source, contextUser);
365
+ if (cacheKey === null) {
366
+ return null;
367
+ }
364
368
  const entry = this._perAgentCache.get(cacheKey);
365
369
  if (entry) {
366
370
  // Check if expired
@@ -383,7 +387,7 @@ export class AgentDataPreloader extends BaseSingleton {
383
387
  *
384
388
  * @private
385
389
  */
386
- cacheData(source, data, runId) {
390
+ cacheData(source, data, contextUser, runId) {
387
391
  if (source.CachePolicy === 'None') {
388
392
  return;
389
393
  }
@@ -401,7 +405,10 @@ export class AgentDataPreloader extends BaseSingleton {
401
405
  LogError(`PerAgent cache policy requires CacheTimeoutSeconds > 0 for data source '${source.Name}'`);
402
406
  return;
403
407
  }
404
- const cacheKey = this.getPerAgentCacheKey(source);
408
+ const cacheKey = this.getPerAgentCacheKey(source, contextUser);
409
+ if (cacheKey === null) {
410
+ return;
411
+ }
405
412
  const entry = {
406
413
  data,
407
414
  timestamp: new Date(),
@@ -411,12 +418,14 @@ export class AgentDataPreloader extends BaseSingleton {
411
418
  }
412
419
  }
413
420
  /**
414
- * Generates a cache key for per-agent caching.
421
+ * Generates a cache key for per-agent caching. The key includes the user, because the rows were
422
+ * loaded under that user's row- and field-level permissions and must never be served to another
423
+ * user. Returns null when there is no user, in which case the data is not cached.
415
424
  *
416
425
  * @private
417
426
  */
418
- getPerAgentCacheKey(source) {
419
- return `${source.AgentID}:${source.Name}`;
427
+ getPerAgentCacheKey(source, contextUser) {
428
+ return UserScopedCacheKey(contextUser?.ID, source.AgentID, source.Name);
420
429
  }
421
430
  }
422
431
  //# sourceMappingURL=AgentDataPreloader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentDataPreloader.js","sourceRoot":"","sources":["../src/AgentDataPreloader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,CAAC,MAAM,QAAQ,CAAC;AAoCvB;;;;;;;;;;;;;;;;GAgBG;AACH;;;GAGG;AACH,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC,MAAM,OAAO,kBAAmB,SAAQ,aAAiC;IAWrE;QACI,KAAK,EAAE,CAAC;QAXZ;;WAEG;QACK,mBAAc,GAA4B,IAAI,GAAG,EAAE,CAAC;QAE5D;;WAEG;QACK,iBAAY,GAAsC,IAAI,GAAG,EAAE,CAAC;IAIpE,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,QAAQ;QACtB,OAAO,kBAAkB,CAAC,WAAW,EAAsB,CAAC;IAChE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,KAAK,CAAC,gBAAgB,CACzB,OAAe,EACf,WAAqB,EACrB,KAAc;QAEd,IAAI,CAAC;YACD,WAAW,CAAC;gBACR,OAAO,EAAE,sDAAsD,OAAO,EAAE;gBACxE,WAAW,EAAE,IAAI;gBACjB,gBAAgB,EAAE,uBAAuB;aAC5C,CAAC,CAAC;YAEH,+BAA+B;YAC/B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAE7E,IAAI,WAAW,C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MAAM,CAAC,mBAAmB;aAC7C,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACK,mBAAmB,CAAC,MAAiC,EAAE,WAAqB;QAChF,OAAO,kBAAkB,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;CACJ"}
@@ -12,6 +12,7 @@
12
12
  import { UserInfo, IMetadataProvider } from '@memberjunction/core';
13
13
  import { ExecuteAgentResult, ExecuteAgentParams, MediaOutput, FileOutputRef } from '@memberjunction/ai-core-plus';
14
14
  import { ArtifactTargetPlan } from './artifact-target-plan.js';
15
+ import { MJConversationDetailEntity, MJConversationDetailEntityExtended } from '@memberjunction/core-entities';
15
16
  /**
16
17
  * Identifies an artifact (and the version) that a run created.
17
18
  */
@@ -72,6 +73,8 @@ export declare class AgentRunner {
72
73
  private static saveFailureReason;
73
74
  /** Fallback artifact type for agent payloads when the agent declares no DefaultArtifactTypeID. */
74
75
  private static readonly JSON_ARTIFACT_TYPE_ID;
76
+ /** Artifact type for structured research report payloads containing `{ report: { html } }`. */
77
+ private static readonly RESEARCH_CONTENT_ARTIFACT_TYPE_ID;
75
78
  /**
76
79
  * Max length of `MJ: Artifacts.Name` (`nvarchar(255)`).
77
80
  *
@@ -99,6 +102,35 @@ export declare class AgentRunner {
99
102
  * @throws {Error} Throws if agent type loading fails or agent instantiation fails
100
103
  */
101
104
  RunAgent<C = any, R = any>(params: ExecuteAgentParams<C>): Promise<ExecuteAgentResult<R>>;
105
+ /**
106
+ * Creates the reply row for an agent's turn on the server: `Role` `AI`, In-Progress, '⏳ Starting...', marked with
107
+ * `MarkServerAuthoredReply()` so the conversation detail gate accepts it. Only the server writes replies, so this is
108
+ * the one place a reply row starts; pass the returned instance to {@link RunAgentInConversation} as
109
+ * `agentResponseDetail` and the run writes its progress and result into it.
110
+ *
111
+ * @param args.conversationId The conversation the reply belongs to.
112
+ * @param args.branchId The fork it sits on, the same as the message it answers; null or omitted is Main.
113
+ * @param args.agentId The agent the reply is from; null for a status line no agent wrote (a workflow's).
114
+ * @param args.contextUser Whom the row is written as: the person the reply is for. They must own the conversation
115
+ * or hold an `Edit` grant on it.
116
+ * @param args.parentId The message the reply answers, when known.
117
+ * @param args.testRunId A test run to link the row to.
118
+ * @param args.provider The provider to write through; defaults to this runner's.
119
+ * @param args.message The row's text, for a server-composed status line; defaults to '⏳ Starting...'.
120
+ * @param args.status The row's status; defaults to In-Progress (a reply a run will fill).
121
+ * @returns The saved row. Throws with the gate's reason when the save is refused.
122
+ */
123
+ CreateAgentReplyDetail(args: {
124
+ conversationId: string;
125
+ branchId?: string | null;
126
+ agentId: string | null;
127
+ contextUser: UserInfo;
128
+ parentId?: string;
129
+ testRunId?: string;
130
+ provider?: IMetadataProvider;
131
+ message?: string;
132
+ status?: MJConversationDetailEntity['Status'];
133
+ }): Promise<MJConversationDetailEntityExtended>;
102
134
  /**
103
135
  * Runs an AI agent within a conversation context, handling conversation and artifact management.
104
136
  *
@@ -132,6 +164,12 @@ export declare class AgentRunner {
132
164
  conversationId?: string;
133
165
  /** Optional existing conversation detail ID. If provided, skips conversation/detail creation */
134
166
  conversationDetailId?: string;
167
+ /**
168
+ * The reply row the caller already created on the server for this run, with
169
+ * {@link CreateAgentReplyDetail}. The run's progress and result are written into this instance, so the
170
+ * writes carry its server-authored marker and its context user. Wins over `conversationDetailId`.
171
+ */
172
+ agentResponseDetail?: MJConversationDetailEntityExtended;
135
173
  /** The user's message text for this conversation turn (required if conversationDetailId not provided) */
136
174
  userMessage?: string;
137
175
  /** Whether to create artifacts from the agent's payload (default: true) */
@@ -142,6 +180,14 @@ export declare class AgentRunner {
142
180
  conversationName?: string;
143
181
  /** Optional test run ID to link conversation and details to (for test execution traceability) */
144
182
  testRunId?: string;
183
+ /**
184
+ * The user who writes this run's conversation rows: the conversation, the user's message and the agent's
185
+ * reply. Defaults to `params.contextUser`. A caller that runs the agent under an elevated principal on
186
+ * someone else's behalf (a public widget guest runs as the system user) names the conversation's owner
187
+ * here, because only the owner or a grantee may write a conversation's messages; the run's own records
188
+ * (run, steps, prompt runs, artifacts) are still written as `params.contextUser`.
189
+ */
190
+ ConversationWriter?: UserInfo;
145
191
  }): Promise<{
146
192
  /** The agent execution result */
147
193
  agentResult: ExecuteAgentResult<R>;
@@ -648,11 +694,19 @@ export declare class AgentRunner {
648
694
  * `ArtifactToolManager`. No-op for binary content, non-JSON content, or
649
695
  * content that already has rows populated.
650
696
  *
651
- * Security: `RunQuery` uses the same read-only, `SQLExpressionValidator`-
652
- * checked execution path that `data-artifact-viewer` already uses at
653
- * render time — identical security posture to the existing view path.
697
+ * Security: the stored SQL runs as ad-hoc SQL for `contextUser`, so the provider
698
+ * allows only a single read statement over entity views that user may read in
699
+ * full (no row-level filter, no denied field). It runs on the host's read-only
700
+ * database login when one is configured, and on the default provider otherwise.
654
701
  */
655
702
  private hydrateSqlBackedContent;
703
+ /** True when the parsed artifact carries stored SQL whose rows are missing. */
704
+ private hasUnhydratedSql;
705
+ /**
706
+ * A RunQuery on the host's read-only database login when one is registered with the action
707
+ * engine, otherwise on the default provider.
708
+ */
709
+ private adhocSqlRunner;
656
710
  /**
657
711
  * Infer an artifact type name from a MIME type so ArtifactToolManager
658
712
  * can resolve the correct tool library.
@@ -660,13 +714,14 @@ export declare class AgentRunner {
660
714
  private inferArtifactTypeName;
661
715
  /**
662
716
  * Downloads binary content for a file-backed artifact from MJStorage.
663
- * Uses FileStorageEngine to resolve the storage account and driver,
664
- * then fetches the file by its ProviderKey.
717
+ * Reads the `MJ: Files` row as the user, then resolves it through
718
+ * `FileStorageEngine.ResolveFileObject`, which applies the storage-account gate and the
719
+ * tracked-file rule before any driver call — the same path every other file-ID route uses.
665
720
  *
666
721
  * @param fileId - The MJ: Files entity ID referenced by ArtifactVersion.FileID
667
722
  * @param contextUser - User context for storage driver authentication
668
723
  * @returns Buffer of file content, or null if download fails
669
724
  */
670
- private downloadArtifactFileContent;
725
+ protected DownloadArtifactFileContent(fileId: string, contextUser: UserInfo): Promise<Buffer | null>;
671
726
  }
672
727
  //# 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;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,aAAa,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,EACzD,eAAe,EAAE,mBAAmB,GAAG,SAAS,GACjD,mBAAmB,GAAG,SAAS,CAEjC;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CACjC,aAAa,EAAE,SAAS,mBAAmB,EAAE,GAAG,SAAS,EACzD,eAAe,EAAE,mBAAmB,GAAG,SAAS,GACjD,mBAAmB,GAAG,SAAS,CAEjC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,WAAW;IACpB;;;;;;;OAOG;WACW,uBAAuB,CAAC,WAAW,EAAE,kBAAkB,GAAG;QAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAezH;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAIhC,kGAAkG;IACl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