@memberjunction/ai-agents 6.2.0-edge.6 → 6.2.0-edge.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -2
- package/dist/AgentRunner.d.ts +96 -3
- package/dist/AgentRunner.d.ts.map +1 -1
- package/dist/AgentRunner.js +438 -34
- package/dist/AgentRunner.js.map +1 -1
- package/dist/AgentWakeTriggerService.d.ts.map +1 -1
- package/dist/AgentWakeTriggerService.js +8 -1
- package/dist/AgentWakeTriggerService.js.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.d.ts +15 -1
- package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.js +43 -3
- package/dist/MJAIAgentRequestEntityServer.js.map +1 -1
- package/dist/MemoryWriteManager.d.ts +12 -0
- package/dist/MemoryWriteManager.d.ts.map +1 -1
- package/dist/MemoryWriteManager.js +18 -3
- package/dist/MemoryWriteManager.js.map +1 -1
- package/dist/agent-pre-execution-rag.d.ts.map +1 -1
- package/dist/agent-pre-execution-rag.js +1 -0
- package/dist/agent-pre-execution-rag.js.map +1 -1
- package/dist/agent-run-watchdog.d.ts +51 -13
- package/dist/agent-run-watchdog.d.ts.map +1 -1
- package/dist/agent-run-watchdog.js +89 -21
- package/dist/agent-run-watchdog.js.map +1 -1
- package/dist/agent-types/flow-agent-type.d.ts +6 -0
- package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
- package/dist/agent-types/flow-agent-type.js +70 -6
- package/dist/agent-types/flow-agent-type.js.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.d.ts +46 -3
- package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.js +9 -4
- package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
- package/dist/agent-types/loop-agent-response-type.d.ts +35 -4
- package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-response-type.js +1 -1
- package/dist/agent-types/loop-agent-response-type.js.map +1 -1
- package/dist/agent-types/loop-agent-type.d.ts +27 -4
- package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-type.js +121 -18
- package/dist/agent-types/loop-agent-type.js.map +1 -1
- package/dist/base-agent.d.ts +390 -37
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +2046 -433
- package/dist/base-agent.js.map +1 -1
- package/dist/catalog-narrowing.d.ts.map +1 -1
- package/dist/catalog-narrowing.js +6 -3
- package/dist/catalog-narrowing.js.map +1 -1
- package/dist/client-tool-results.d.ts +12 -0
- package/dist/client-tool-results.d.ts.map +1 -1
- package/dist/client-tool-results.js +21 -0
- package/dist/client-tool-results.js.map +1 -1
- package/dist/handoff-target.d.ts +80 -0
- package/dist/handoff-target.d.ts.map +1 -0
- package/dist/handoff-target.js +158 -0
- package/dist/handoff-target.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/memory-manager-agent.d.ts.map +1 -1
- package/dist/memory-manager-agent.js +2 -0
- package/dist/memory-manager-agent.js.map +1 -1
- package/dist/native-tools/action-tool-builder.d.ts +6 -0
- package/dist/native-tools/action-tool-builder.d.ts.map +1 -1
- package/dist/native-tools/action-tool-builder.js +21 -5
- package/dist/native-tools/action-tool-builder.js.map +1 -1
- package/dist/native-tools/control-tools.d.ts +15 -4
- package/dist/native-tools/control-tools.d.ts.map +1 -1
- package/dist/native-tools/control-tools.js +31 -14
- package/dist/native-tools/control-tools.js.map +1 -1
- package/dist/pipeline/pipeline-registry.d.ts +5 -12
- package/dist/pipeline/pipeline-registry.d.ts.map +1 -1
- package/dist/pipeline/pipeline-registry.js +28 -2
- package/dist/pipeline/pipeline-registry.js.map +1 -1
- package/dist/pipeline/providers/serialize.d.ts +7 -3
- package/dist/pipeline/providers/serialize.d.ts.map +1 -1
- package/dist/pipeline/providers/serialize.js +9 -5
- package/dist/pipeline/providers/serialize.js.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.d.ts +3 -3
- package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.js +12 -6
- package/dist/realtime/bridge-realtime-session-factory.js.map +1 -1
- package/dist/realtime/bridge-room-transcript-sink.js +2 -0
- package/dist/realtime/bridge-room-transcript-sink.js.map +1 -1
- package/dist/realtime/realtime-client-session-service.d.ts +72 -25
- package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
- package/dist/realtime/realtime-client-session-service.js +154 -54
- package/dist/realtime/realtime-client-session-service.js.map +1 -1
- package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
- package/dist/realtime/realtime-coagent-config.js +2 -28
- package/dist/realtime/realtime-coagent-config.js.map +1 -1
- package/dist/realtime/realtime-platform-credentials.d.ts +65 -0
- package/dist/realtime/realtime-platform-credentials.d.ts.map +1 -0
- package/dist/realtime/realtime-platform-credentials.js +148 -0
- package/dist/realtime/realtime-platform-credentials.js.map +1 -0
- package/dist/realtime/realtime-recording-capture.d.ts +1 -0
- package/dist/realtime/realtime-recording-capture.d.ts.map +1 -1
- package/dist/realtime/realtime-recording-capture.js +17 -3
- package/dist/realtime/realtime-recording-capture.js.map +1 -1
- package/dist/realtime/realtime-recording-opus-assembly.d.ts.map +1 -1
- package/dist/realtime/realtime-recording-opus-assembly.js +9 -4
- package/dist/realtime/realtime-recording-opus-assembly.js.map +1 -1
- package/dist/realtime/realtime-session-runner.d.ts.map +1 -1
- package/dist/realtime/realtime-session-runner.js +5 -7
- package/dist/realtime/realtime-session-runner.js.map +1 -1
- package/dist/realtime/realtime-turn-moderator.d.ts.map +1 -1
- package/dist/realtime/realtime-turn-moderator.js +1 -0
- package/dist/realtime/realtime-turn-moderator.js.map +1 -1
- package/dist/realtime/realtime-vendor-resolution.d.ts +41 -2
- package/dist/realtime/realtime-vendor-resolution.d.ts.map +1 -1
- package/dist/realtime/realtime-vendor-resolution.js +86 -4
- package/dist/realtime/realtime-vendor-resolution.js.map +1 -1
- package/dist/rubric-evaluation-agent-runner.js +1 -0
- package/dist/rubric-evaluation-agent-runner.js.map +1 -1
- package/dist/runtime-state-fragment.d.ts.map +1 -1
- package/dist/runtime-state-fragment.js +3 -0
- package/dist/runtime-state-fragment.js.map +1 -1
- package/dist/sub-agent-consult.d.ts +75 -0
- package/dist/sub-agent-consult.d.ts.map +1 -0
- package/dist/sub-agent-consult.js +193 -0
- package/dist/sub-agent-consult.js.map +1 -0
- package/dist/volatile-child-prompt.d.ts +7 -0
- package/dist/volatile-child-prompt.d.ts.map +1 -1
- package/dist/volatile-child-prompt.js +8 -0
- package/dist/volatile-child-prompt.js.map +1 -1
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -127,10 +127,12 @@ Abstract base that all agent types extend. Defines the `DetermineNextStep()` int
|
|
|
127
127
|
| `Chat` | Send a message back to the user |
|
|
128
128
|
| `Actions` | Execute one or more server-side actions |
|
|
129
129
|
| `ClientTools` | Invoke browser-side tools (navigate, switch tabs, show results) |
|
|
130
|
-
| `SubAgents` | Delegate to sub-agents |
|
|
130
|
+
| `SubAgents` / `Sub-Agent` | Delegate to child, related, or runtime-granted sub-agents and receive their result in-run |
|
|
131
|
+
| `Handoff` | Transfer a top-level interactive conversation to a directly discoverable peer agent (hosts that pass `handoffChain` only) |
|
|
132
|
+
| `Tasks` | Submit a durable `TaskGraphSpec` to the task-graph dispatcher and detach |
|
|
131
133
|
| `MoreInfo` | Ask the user for additional information |
|
|
132
134
|
| `Retry` | Retry the current step (e.g., after validation failure) |
|
|
133
|
-
| `End` | Complete execution |
|
|
135
|
+
| `End` / `Success` / `Failed` | Complete execution |
|
|
134
136
|
| `ForEach` | Iterate over a collection |
|
|
135
137
|
| `While` | Loop while a condition is true |
|
|
136
138
|
|
|
@@ -153,6 +155,21 @@ An agent can ask a fast decision model typed questions in six places on its own.
|
|
|
153
155
|
|
|
154
156
|
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
157
|
|
|
158
|
+
##### Untrusted external data
|
|
159
|
+
|
|
160
|
+
Some actions return content that nobody inside MJ wrote: web pages, search results, mail, feeds, arbitrary HTTP responses, MCP tool output. The loop agent wraps such a result in an `<untrusted_external_data source="…" trust="…" warning="…">` envelope (any closing tag inside the content is escaped first), drops the action's `AIDirectives`, and marks the run **tainted**. A tainted run's `memory_write` notes land with `Status = 'Pending'` and the sources named in `Comments`, so an instruction smuggled in a web page cannot become an active memory. A parent run absorbs its sub-agents' sources when the sub-agent step completes. `ExecuteAgentResult.taintedSources` carries them to the caller.
|
|
161
|
+
|
|
162
|
+
How a result's trust level is decided, first match wins:
|
|
163
|
+
|
|
164
|
+
| Precedence | Source |
|
|
165
|
+
|---|---|
|
|
166
|
+
| 1 | `actionTrustLevels: { "<action>": "Trusted" \| "SemiTrusted" \| "Untrusted" }` in the agent's `AgentTypePromptParams` or the run's `data.__agentTypePromptParams` |
|
|
167
|
+
| 2 | `trustedActionNames` / `untrustedActionNames` lists in the same prompt params |
|
|
168
|
+
| 3 | `Action.Config_Object?.outputTrustLevel` on the `MJ: Actions` metadata record (`IActionConfiguration` JSONType on `Action.Config`) |
|
|
169
|
+
| 4 | `Trusted` |
|
|
170
|
+
|
|
171
|
+
Client tools declare `TrustLevel` on their `ClientToolMetadata`; a browser DOM extractor should say `Untrusted`. In the `MJ: Actions` metadata catalog, `outputTrustLevel: "Untrusted"` is set on actions that ingest external content (web search and page content, inbox reader, HTTP request, URL metadata, RSS feeds, `Execute MCP Tool`), not on actions that send to an external system or list MJ's own MCP catalog.
|
|
172
|
+
|
|
156
173
|
##### Output Artifact Lifecycle (`artifactDirective`) & `_ARTIFACTS_ENABLED` Gating
|
|
157
174
|
|
|
158
175
|
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? }`:
|
|
@@ -170,6 +187,20 @@ When a Loop agent (such as `Sage`) emits `nextStep.type: 'Tasks'`, `LoopAgentTyp
|
|
|
170
187
|
- **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
188
|
- **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
189
|
|
|
190
|
+
##### Execution Primitive Hierarchy & Native Tool-Calling JSON Envelope Bridge
|
|
191
|
+
|
|
192
|
+
Loop agents choose from four structured execution primitives depending on dataflow, iteration, and durability needs:
|
|
193
|
+
|
|
194
|
+
| Primitive | When to Use | Execution & Persistence |
|
|
195
|
+
|---|---|---|
|
|
196
|
+
| `Actions` / Native tool calls | 1–3 independent calls whose raw results the LLM needs in context | In-turn `Actions` / `Sub-Agents` run steps |
|
|
197
|
+
| `Pipeline` (`nextStep.type = 'Pipeline'`) | Linear server-side tool chains (`tool`, `jsonpath`, `select`, `grep`, `slice`, `head`, `tail`, `count`, `unique`, `sort`, `parse_json`) where intermediate outputs stay out of context | Single `Tool` (`Pipeline: N step(s)`) run step; `StructureActionResult` automatically coerces structured JSON `ActionResult.Message` payloads when an action declares no `Output` params |
|
|
198
|
+
| `ForEach` / `While` (`nextStep.type = 'ForEach' \| 'While'`) | In-turn batch iteration or bounded convergence, either with a single `action` / `subAgent` body or an ordered multi-step `steps?: LoopBodyActionStep[]` sequence chaining outputs via `{{steps.<id>.<field>}}` | Single `ForEach` / `While` run step plus linked child `Actions` / `Sub-Agents` steps |
|
|
199
|
+
| `Tasks` (`nextStep.type = 'Tasks'`) | Durable DAGs (`Agent`, `Action`, `Human`, `Prompt`, `ForEach` including `steps[]`, `While`, `Decision`), conditional/XOR `exclusiveGroup` forks, or long-running sleep/wake (`continuation: 'reinvoke'`) | Persisted `StepType = 'TaskGraph'` run step; submitting `AIAgentRun` parks in `Paused` until `TaskGraphDispatcher` settles the graph to `Completed` |
|
|
200
|
+
|
|
201
|
+
- **Native tool-calling JSON envelope bridge**: When a model runs in `Native` (hybrid) or `NativeImplicit` tool-calling mode (`ResolveNativeToolCalling`), it uses native tool calls for ordinary `Actions` / `Sub-Agent` / `ClientTools` turns, and bridges cleanly to `Pipeline`, `ForEach`, `While`, or `Tasks` by emitting **no native tool call on that turn** and replying with a `LoopAgentResponse` JSON envelope (`{ "taskComplete": false, "nextStep": { "type": "..." } }`).
|
|
202
|
+
- **Sanitized tool-name normalization**: `PipelineToolRegistry`, `BaseAgent` (`Actions`, `Sub-Agent`, `ForEach`/`While`, and `validateTasksNextStep`), and `TaskGraphService` / `TaskGraphDispatcher` normalize sanitized native tool names (`calculate_expression` → `"Calculate Expression"`, `delegate_to_query_builder` → `"Query Builder"`) via `SanitizeToolName` so JSON envelopes work seamlessly whether the model writes canonical MJ names or native tool identifiers.
|
|
203
|
+
|
|
173
204
|
#### FlowAgentType
|
|
174
205
|
|
|
175
206
|
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.
|
|
@@ -302,6 +333,17 @@ Optimizes agent startup by batch-loading all required metadata in parallel:
|
|
|
302
333
|
- Sub-agent data
|
|
303
334
|
- Prompt configurations
|
|
304
335
|
|
|
336
|
+
### AgentRunWatchdog
|
|
337
|
+
|
|
338
|
+
Process-wide guard that keeps an `AIAgentRun` from being left `Running` forever when its process dies or its final save fails. `BaseAgent` calls `Track()` once the run row exists and `Untrack()` as soon as the run leaves `Running` (Completed, Failed, Cancelled, AwaitingFeedback or Paused) — first thing in `Execute()`'s teardown, before any subclass `finalizeRun` hook.
|
|
339
|
+
|
|
340
|
+
- **Heartbeat** — every `heartbeatIntervalMs` (30s) it stamps `LastHeartbeatAt` on this process's in-flight runs.
|
|
341
|
+
- **Sweep** — every `sweepIntervalMs` (5 min) it force-fails `Running` runs whose heartbeat went stale (`staleThresholdMinutes`, 5) and drops finished runs from its tracked set. Once the process has tracked a run, the sweep keeps running even with nothing tracked, so it also closes runs that other, crashed instances left `Running`. The host also runs `SweepOrphanedRuns` once at startup.
|
|
342
|
+
- **Stop relay** — every 3s it checks whether one of its runs was marked `Cancelled` (the Stop button) and aborts that run.
|
|
343
|
+
- **Idle** — the heartbeat and the stop relay run only while at least one run is tracked: the last run leaving stops them, and the next `Track()` starts them again. With `sweepIntervalMs: 0` the sweep never starts either, so an idle process issues no periodic database statements; see the [Serverless Database Auto-Pause Guide](../../../guides/SERVERLESS_DATABASE_AUTO_PAUSE_GUIDE.md) for the trade-off.
|
|
344
|
+
|
|
345
|
+
Tune it with `AgentRunWatchdog.Instance.Configure({ ... })`; MJServer passes its `agentRunWatchdog` settings through at startup. `sweepIntervalMs: 0` turns the periodic sweep off (the startup sweep still runs, and the tracked-set prune moves to the heartbeat). Other values must be greater than 0; an invalid value throws.
|
|
346
|
+
|
|
305
347
|
> 📖 **Memory is a big topic.** For the complete architecture — the three-tier model, injection and scoping, the in-flight write pipeline, and the Memory Manager's hardening/consolidation/decay phases — see the **[Agent Memory Guide](../../../guides/AGENT_MEMORY_GUIDE.md)**. The sections below are component-level summaries.
|
|
306
348
|
|
|
307
349
|
### MemoryWriteManager (In-Flight Memory Writes)
|
package/dist/AgentRunner.d.ts
CHANGED
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
* @since 2.49.0
|
|
11
11
|
*/
|
|
12
12
|
import { UserInfo, IMetadataProvider } from '@memberjunction/core';
|
|
13
|
-
import { ExecuteAgentResult, ExecuteAgentParams, MediaOutput, FileOutputRef } from '@memberjunction/ai-core-plus';
|
|
13
|
+
import { ExecuteAgentResult, ExecuteAgentParams, MediaOutput, FileOutputRef, MJAIAgentEntityExtended, AgentHandoffResult, AgentExecutionProgressCallback, AgentExecutionStreamingCallback } from '@memberjunction/ai-core-plus';
|
|
14
|
+
import { AgentPresetSource } from '@memberjunction/ai-engine-base';
|
|
14
15
|
import { ArtifactTargetPlan } from './artifact-target-plan.js';
|
|
15
|
-
import { MJConversationDetailEntity, MJConversationDetailEntityExtended } from '@memberjunction/core-entities';
|
|
16
|
+
import { MJConversationDetailEntity, MJConversationDetailEntityExtended, MJAIAgentConfigurationEntity } from '@memberjunction/core-entities';
|
|
16
17
|
/**
|
|
17
18
|
* Identifies an artifact (and the version) that a run created.
|
|
18
19
|
*/
|
|
@@ -32,6 +33,78 @@ export interface CreatedArtifactInfo {
|
|
|
32
33
|
export declare function SelectPrimaryArtifact(fileArtifacts: readonly CreatedArtifactInfo[] | undefined, payloadArtifact: CreatedArtifactInfo | undefined): CreatedArtifactInfo | undefined;
|
|
33
34
|
/** @deprecated Use {@link SelectPrimaryArtifact}. */
|
|
34
35
|
export declare function selectPrimaryArtifact(fileArtifacts: readonly CreatedArtifactInfo[] | undefined, payloadArtifact: CreatedArtifactInfo | undefined): CreatedArtifactInfo | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Builds the system message injected at index `0` of the target agent's `conversationMessages`
|
|
38
|
+
* when a conversation is transferred via handoff.
|
|
39
|
+
*/
|
|
40
|
+
export declare function HandoffBriefMessage(sourceName: string, brief: string, reason?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Metadata describing a single handoff hop passed to {@link FollowHandoffsHooks}.
|
|
43
|
+
*/
|
|
44
|
+
export interface HandoffHopInfo {
|
|
45
|
+
hopIndex: number;
|
|
46
|
+
sourceAgent: MJAIAgentEntityExtended;
|
|
47
|
+
sourceConversationDetailId: string;
|
|
48
|
+
targetAgent: MJAIAgentEntityExtended;
|
|
49
|
+
targetConversationDetailId: string;
|
|
50
|
+
preset: MJAIAgentConfigurationEntity | null;
|
|
51
|
+
presetSource: AgentPresetSource;
|
|
52
|
+
handoff: AgentHandoffResult;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Information about the run that just handed off, passed to `OnHopStart`.
|
|
56
|
+
*/
|
|
57
|
+
export interface HandoffPreviousRunInfo {
|
|
58
|
+
agentResult: ExecuteAgentResult;
|
|
59
|
+
conversationDetailId: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Callbacks returned by `OnHopStart` for a handoff hop's execution.
|
|
63
|
+
*/
|
|
64
|
+
export interface HandoffHopCallbacks {
|
|
65
|
+
onProgress?: AgentExecutionProgressCallback;
|
|
66
|
+
onStreaming?: AgentExecutionStreamingCallback;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Outcome recorded for a single handoff hop by {@link AgentRunner.FollowHandoffs}.
|
|
70
|
+
*/
|
|
71
|
+
export interface HandoffHopOutcome {
|
|
72
|
+
hopIndex: number;
|
|
73
|
+
targetAgent: MJAIAgentEntityExtended;
|
|
74
|
+
targetConversationDetailId: string;
|
|
75
|
+
preset: MJAIAgentConfigurationEntity | null;
|
|
76
|
+
presetSource: AgentPresetSource;
|
|
77
|
+
agentResult?: ExecuteAgentResult;
|
|
78
|
+
artifactInfo?: CreatedArtifactInfo;
|
|
79
|
+
error?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Lifecycle hooks for {@link AgentRunner.FollowHandoffs}.
|
|
83
|
+
*/
|
|
84
|
+
export interface FollowHandoffsHooks {
|
|
85
|
+
OnHopStart?: (hop: HandoffHopInfo, previous: HandoffPreviousRunInfo) => Promise<HandoffHopCallbacks | void> | HandoffHopCallbacks | void;
|
|
86
|
+
OnHopEnd?: (hop: HandoffHopInfo, outcome: HandoffHopOutcome) => Promise<void> | void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Input options for {@link AgentRunner.FollowHandoffs}.
|
|
90
|
+
*/
|
|
91
|
+
export interface FollowHandoffsInput<C = any> {
|
|
92
|
+
params: ExecuteAgentParams<C>;
|
|
93
|
+
sourceResult: ExecuteAgentResult;
|
|
94
|
+
conversationId: string;
|
|
95
|
+
sourceConversationDetailId: string;
|
|
96
|
+
createArtifacts?: boolean;
|
|
97
|
+
hooks?: FollowHandoffsHooks;
|
|
98
|
+
/**
|
|
99
|
+
* The user who writes this run's conversation rows (the target reply row and any refusal notice
|
|
100
|
+
* on the source row). Defaults to `params.contextUser`.
|
|
101
|
+
*/
|
|
102
|
+
ConversationWriter?: UserInfo;
|
|
103
|
+
/**
|
|
104
|
+
* Optional pre-loaded server-authored source conversation detail entity for hop 0.
|
|
105
|
+
*/
|
|
106
|
+
sourceConversationDetail?: MJConversationDetailEntityExtended;
|
|
107
|
+
}
|
|
35
108
|
/**
|
|
36
109
|
* AgentRunner provides a thin wrapper for executing AI agents.
|
|
37
110
|
*
|
|
@@ -84,6 +157,8 @@ export declare class AgentRunner {
|
|
|
84
157
|
* instead: a truncated title still names the artifact the user is looking at.
|
|
85
158
|
*/
|
|
86
159
|
private static readonly ARTIFACT_NAME_MAX_LENGTH;
|
|
160
|
+
/** How long the end of a run waits for the generated conversation name before keeping the initial one. */
|
|
161
|
+
private static readonly NAMING_WAIT_MS;
|
|
87
162
|
private readonly _provider;
|
|
88
163
|
constructor(provider?: IMetadataProvider);
|
|
89
164
|
/**
|
|
@@ -208,6 +283,22 @@ export declare class AgentRunner {
|
|
|
208
283
|
*/
|
|
209
284
|
artifactInfo?: CreatedArtifactInfo;
|
|
210
285
|
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Executes server-side handoff hops sequentially in the same turn while the active run's
|
|
288
|
+
* result carries a resolved `handoff`.
|
|
289
|
+
*/
|
|
290
|
+
FollowHandoffs<C = any>(input: FollowHandoffsInput<C>): Promise<HandoffHopOutcome[]>;
|
|
291
|
+
private findLatestHandoffStep;
|
|
292
|
+
private recordRefusedHandoffOnSource;
|
|
293
|
+
private updateSourceHandoffStepOutput;
|
|
294
|
+
private lookupTargetPriorRunId;
|
|
295
|
+
private buildHandoffTargetParams;
|
|
296
|
+
/**
|
|
297
|
+
* Starts the "Name Conversation" prompt for a new conversation so it runs alongside the agent, and
|
|
298
|
+
* returns the step that saves the generated name. That step runs after the run's own writes, which
|
|
299
|
+
* share the request's connection. A failed generation or save keeps the initial name.
|
|
300
|
+
*/
|
|
301
|
+
private startConversationNaming;
|
|
211
302
|
/**
|
|
212
303
|
* Gets the maximum version number for an artifact.
|
|
213
304
|
* Used when creating new versions of explicitly specified artifacts.
|
|
@@ -507,6 +598,8 @@ export declare class AgentRunner {
|
|
|
507
598
|
* @param agentRunId - The ID of the agent run
|
|
508
599
|
* @param mediaOutputs - Array of media outputs to save
|
|
509
600
|
* @param contextUser - User context for the operation
|
|
601
|
+
* @param provider - Optional metadata provider for multi-provider support
|
|
602
|
+
* @param resolvedStorageAccountId - Optional pre-resolved storage account ID from the agent's resolution chain
|
|
510
603
|
* @returns Array of saved AIAgentRunMedia IDs
|
|
511
604
|
* @since 3.1.0
|
|
512
605
|
*
|
|
@@ -521,7 +614,7 @@ export declare class AgentRunner {
|
|
|
521
614
|
* console.log(`Saved ${mediaIds.length} media outputs`);
|
|
522
615
|
* ```
|
|
523
616
|
*/
|
|
524
|
-
SaveAgentRunMedia(agentRunId: string, mediaOutputs: MediaOutput[] | undefined, contextUser: UserInfo, provider?: IMetadataProvider): Promise<string[]>;
|
|
617
|
+
SaveAgentRunMedia(agentRunId: string, mediaOutputs: MediaOutput[] | undefined, contextUser: UserInfo, provider?: IMetadataProvider, resolvedStorageAccountId?: string): Promise<string[]>;
|
|
525
618
|
/**
|
|
526
619
|
* Determines whether a media output's bytes are already embedded inside the agent's
|
|
527
620
|
* output payload (which is serialized into the report artifact by
|
|
@@ -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;
|
|
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;AAI3M,OAAO,EACH,kBAAkB,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EACpC,uBAAuB,EACrD,kBAAkB,EAAE,8BAA8B,EAAE,+BAA+B,EACtF,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAkC,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAA+C,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAIzG,OAAO,EACmB,0BAA0B,EAAE,kCAAkC,EACvB,4BAA4B,EAE5F,MAAM,+BAA+B,CAAC;AA2BvC;;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,mB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