@memberjunction/ai-agents 6.2.2 → 6.3.0-edge.1
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 +29 -6
- package/dist/AgentContextAssembler.d.ts +127 -0
- package/dist/AgentContextAssembler.d.ts.map +1 -0
- package/dist/AgentContextAssembler.js +482 -0
- package/dist/AgentContextAssembler.js.map +1 -0
- package/dist/AgentDataPreloader.d.ts +14 -3
- package/dist/AgentDataPreloader.d.ts.map +1 -1
- package/dist/AgentDataPreloader.js +147 -22
- package/dist/AgentDataPreloader.js.map +1 -1
- package/dist/AgentDecisionService.d.ts +10 -1
- package/dist/AgentDecisionService.d.ts.map +1 -1
- package/dist/AgentDecisionService.js +28 -13
- package/dist/AgentDecisionService.js.map +1 -1
- package/dist/AgentFeedbackCoordinator.d.ts +169 -0
- package/dist/AgentFeedbackCoordinator.d.ts.map +1 -0
- package/dist/AgentFeedbackCoordinator.js +593 -0
- package/dist/AgentFeedbackCoordinator.js.map +1 -0
- package/dist/AgentRunner.d.ts +57 -15
- package/dist/AgentRunner.d.ts.map +1 -1
- package/dist/AgentRunner.js +692 -101
- package/dist/AgentRunner.js.map +1 -1
- package/dist/AgentStepDispatcher.d.ts +211 -0
- package/dist/AgentStepDispatcher.d.ts.map +1 -0
- package/dist/AgentStepDispatcher.js +729 -0
- package/dist/AgentStepDispatcher.js.map +1 -0
- package/dist/AgentTreeBudgetTracker.d.ts +163 -0
- package/dist/AgentTreeBudgetTracker.d.ts.map +1 -0
- package/dist/AgentTreeBudgetTracker.js +415 -0
- package/dist/AgentTreeBudgetTracker.js.map +1 -0
- package/dist/AgentWakeTriggerService.d.ts +41 -1
- package/dist/AgentWakeTriggerService.d.ts.map +1 -1
- package/dist/AgentWakeTriggerService.js +154 -8
- package/dist/AgentWakeTriggerService.js.map +1 -1
- package/dist/ArtifactToolManager.d.ts +134 -39
- package/dist/ArtifactToolManager.d.ts.map +1 -1
- package/dist/ArtifactToolManager.js +2761 -321
- package/dist/ArtifactToolManager.js.map +1 -1
- package/dist/GovernedArtifactService.d.ts +367 -0
- package/dist/GovernedArtifactService.d.ts.map +1 -0
- package/dist/GovernedArtifactService.js +2569 -0
- package/dist/GovernedArtifactService.js.map +1 -0
- package/dist/MJAIAgentRequestEntityServer.d.ts +32 -1
- package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.js +105 -3
- package/dist/MJAIAgentRequestEntityServer.js.map +1 -1
- package/dist/SkillMarkdownConverter.d.ts +1 -1
- package/dist/SkillMarkdownConverter.d.ts.map +1 -1
- package/dist/SkillMarkdownConverter.js +8 -6
- package/dist/SkillMarkdownConverter.js.map +1 -1
- package/dist/agent-context-injector.d.ts +2 -25
- package/dist/agent-context-injector.d.ts.map +1 -1
- package/dist/agent-context-injector.js +38 -153
- package/dist/agent-context-injector.js.map +1 -1
- package/dist/agent-instance.d.ts +28 -0
- package/dist/agent-instance.d.ts.map +1 -0
- package/dist/agent-instance.js +39 -0
- package/dist/agent-instance.js.map +1 -0
- package/dist/agent-memory-context-builder.d.ts.map +1 -1
- package/dist/agent-memory-context-builder.js +46 -42
- package/dist/agent-memory-context-builder.js.map +1 -1
- package/dist/agent-pre-execution-rag.d.ts +5 -0
- package/dist/agent-pre-execution-rag.d.ts.map +1 -1
- package/dist/agent-pre-execution-rag.js +10 -0
- package/dist/agent-pre-execution-rag.js.map +1 -1
- package/dist/agent-run-watchdog.d.ts +38 -6
- package/dist/agent-run-watchdog.d.ts.map +1 -1
- package/dist/agent-run-watchdog.js +75 -13
- package/dist/agent-run-watchdog.js.map +1 -1
- package/dist/agent-types/flow-agent-type.d.ts +6 -1
- package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
- package/dist/agent-types/flow-agent-type.js +30 -7
- package/dist/agent-types/flow-agent-type.js.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.d.ts +18 -0
- package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.js +2 -0
- package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
- package/dist/agent-types/loop-agent-type.d.ts +4 -0
- package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-type.js +29 -0
- package/dist/agent-types/loop-agent-type.js.map +1 -1
- package/dist/artifact-presence-locator.d.ts +132 -0
- package/dist/artifact-presence-locator.d.ts.map +1 -0
- package/dist/artifact-presence-locator.js +472 -0
- package/dist/artifact-presence-locator.js.map +1 -0
- package/dist/artifact-tools/CSVToolLibrary.d.ts +2 -2
- package/dist/artifact-tools/CSVToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/CSVToolLibrary.js +41 -14
- package/dist/artifact-tools/CSVToolLibrary.js.map +1 -1
- package/dist/artifact-tools/DataSnapshotToolLibrary.d.ts +2 -2
- package/dist/artifact-tools/DataSnapshotToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/DataSnapshotToolLibrary.js +53 -21
- package/dist/artifact-tools/DataSnapshotToolLibrary.js.map +1 -1
- package/dist/artifact-tools/DocumentToolLibrary.d.ts +101 -0
- package/dist/artifact-tools/DocumentToolLibrary.d.ts.map +1 -0
- package/dist/artifact-tools/DocumentToolLibrary.js +1846 -0
- package/dist/artifact-tools/DocumentToolLibrary.js.map +1 -0
- package/dist/artifact-tools/DocxToolLibrary.d.ts +2 -4
- package/dist/artifact-tools/DocxToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/DocxToolLibrary.js +42 -30
- package/dist/artifact-tools/DocxToolLibrary.js.map +1 -1
- package/dist/artifact-tools/ExcelToolLibrary.d.ts +2 -3
- package/dist/artifact-tools/ExcelToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/ExcelToolLibrary.js +105 -49
- package/dist/artifact-tools/ExcelToolLibrary.js.map +1 -1
- package/dist/artifact-tools/GenericBinaryToolLibrary.d.ts +2 -2
- package/dist/artifact-tools/GenericBinaryToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/GenericBinaryToolLibrary.js +3 -2
- package/dist/artifact-tools/GenericBinaryToolLibrary.js.map +1 -1
- package/dist/artifact-tools/JSONToolLibrary.d.ts +4 -4
- package/dist/artifact-tools/JSONToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/JSONToolLibrary.js +32 -11
- package/dist/artifact-tools/JSONToolLibrary.js.map +1 -1
- package/dist/artifact-tools/PDFToolLibrary.d.ts +27 -3
- package/dist/artifact-tools/PDFToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/PDFToolLibrary.js +36 -21
- package/dist/artifact-tools/PDFToolLibrary.js.map +1 -1
- package/dist/artifact-tools/SearchResultSetToolLibrary.d.ts +2 -2
- package/dist/artifact-tools/SearchResultSetToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/SearchResultSetToolLibrary.js +83 -24
- package/dist/artifact-tools/SearchResultSetToolLibrary.js.map +1 -1
- package/dist/artifact-tools/SlideDeckToolLibrary.d.ts +50 -0
- package/dist/artifact-tools/SlideDeckToolLibrary.d.ts.map +1 -0
- package/dist/artifact-tools/SlideDeckToolLibrary.js +1617 -0
- package/dist/artifact-tools/SlideDeckToolLibrary.js.map +1 -0
- package/dist/artifact-tools/SpreadsheetToolLibrary.d.ts +87 -0
- package/dist/artifact-tools/SpreadsheetToolLibrary.d.ts.map +1 -0
- package/dist/artifact-tools/SpreadsheetToolLibrary.js +3351 -0
- package/dist/artifact-tools/SpreadsheetToolLibrary.js.map +1 -0
- package/dist/artifact-tools/TextToolLibrary.d.ts +3 -3
- package/dist/artifact-tools/TextToolLibrary.d.ts.map +1 -1
- package/dist/artifact-tools/TextToolLibrary.js +34 -24
- package/dist/artifact-tools/TextToolLibrary.js.map +1 -1
- package/dist/artifact-tools/WhiteboardToolLibrary.d.ts +69 -0
- package/dist/artifact-tools/WhiteboardToolLibrary.d.ts.map +1 -0
- package/dist/artifact-tools/WhiteboardToolLibrary.js +555 -0
- package/dist/artifact-tools/WhiteboardToolLibrary.js.map +1 -0
- package/dist/artifact-tools/artifact-comment-suggestion-helper.d.ts +98 -0
- package/dist/artifact-tools/artifact-comment-suggestion-helper.d.ts.map +1 -0
- package/dist/artifact-tools/artifact-comment-suggestion-helper.js +851 -0
- package/dist/artifact-tools/artifact-comment-suggestion-helper.js.map +1 -0
- package/dist/artifact-tools/artifact-tool-helpers.d.ts +21 -0
- package/dist/artifact-tools/artifact-tool-helpers.d.ts.map +1 -0
- package/dist/artifact-tools/artifact-tool-helpers.js +74 -0
- package/dist/artifact-tools/artifact-tool-helpers.js.map +1 -0
- package/dist/artifact-tools/grepHelper.d.ts +27 -0
- package/dist/artifact-tools/grepHelper.d.ts.map +1 -0
- package/dist/artifact-tools/grepHelper.js +229 -0
- package/dist/artifact-tools/grepHelper.js.map +1 -0
- package/dist/artifact-tools/node-vm-safe-regex.d.ts +10 -0
- package/dist/artifact-tools/node-vm-safe-regex.d.ts.map +1 -0
- package/dist/artifact-tools/node-vm-safe-regex.js +148 -0
- package/dist/artifact-tools/node-vm-safe-regex.js.map +1 -0
- package/dist/base-agent.d.ts +151 -137
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +727 -1550
- package/dist/base-agent.js.map +1 -1
- package/dist/catalog-narrowing.d.ts +112 -5
- package/dist/catalog-narrowing.d.ts.map +1 -1
- package/dist/catalog-narrowing.js +181 -6
- package/dist/catalog-narrowing.js.map +1 -1
- package/dist/decision-discovery.d.ts +42 -15
- package/dist/decision-discovery.d.ts.map +1 -1
- package/dist/decision-discovery.js +90 -20
- package/dist/decision-discovery.js.map +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/memory-decision-uses.d.ts +206 -0
- package/dist/memory-decision-uses.d.ts.map +1 -0
- package/dist/memory-decision-uses.js +259 -0
- package/dist/memory-decision-uses.js.map +1 -0
- package/dist/memory-manager-agent.d.ts +66 -6
- package/dist/memory-manager-agent.d.ts.map +1 -1
- package/dist/memory-manager-agent.js +184 -31
- package/dist/memory-manager-agent.js.map +1 -1
- package/dist/memory-note-gate.d.ts +12 -9
- package/dist/memory-note-gate.d.ts.map +1 -1
- package/dist/memory-note-gate.js +16 -11
- package/dist/memory-note-gate.js.map +1 -1
- package/dist/native-tools/control-tools.d.ts +8 -1
- package/dist/native-tools/control-tools.d.ts.map +1 -1
- package/dist/native-tools/control-tools.js +38 -5
- package/dist/native-tools/control-tools.js.map +1 -1
- package/dist/native-tools/framework-tools.d.ts +3 -3
- package/dist/native-tools/framework-tools.d.ts.map +1 -1
- package/dist/native-tools/framework-tools.js +20 -8
- package/dist/native-tools/framework-tools.js.map +1 -1
- package/dist/pipeline/operators.d.ts.map +1 -1
- package/dist/pipeline/operators.js +1 -1
- package/dist/pipeline/operators.js.map +1 -1
- package/dist/pipeline/pipeline-executor.d.ts +29 -1
- package/dist/pipeline/pipeline-executor.d.ts.map +1 -1
- package/dist/pipeline/pipeline-executor.js +159 -2
- package/dist/pipeline/pipeline-executor.js.map +1 -1
- package/dist/pipeline/pipeline.types.d.ts +19 -1
- package/dist/pipeline/pipeline.types.d.ts.map +1 -1
- package/dist/pipeline/template.d.ts +16 -0
- package/dist/pipeline/template.d.ts.map +1 -1
- package/dist/pipeline/template.js +55 -6
- package/dist/pipeline/template.js.map +1 -1
- package/dist/realtime/artifact-workspace-channel-server.d.ts +27 -0
- package/dist/realtime/artifact-workspace-channel-server.d.ts.map +1 -0
- package/dist/realtime/artifact-workspace-channel-server.js +43 -0
- package/dist/realtime/artifact-workspace-channel-server.js.map +1 -0
- package/dist/realtime/bridge-realtime-session-factory.d.ts +2 -2
- package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.js +7 -56
- package/dist/realtime/bridge-realtime-session-factory.js.map +1 -1
- package/dist/realtime/bridge-room-transcript-sink.d.ts.map +1 -1
- package/dist/realtime/bridge-room-transcript-sink.js +28 -1
- package/dist/realtime/bridge-room-transcript-sink.js.map +1 -1
- package/dist/realtime/media-channel-server.js +1 -1
- package/dist/realtime/media-channel-server.js.map +1 -1
- package/dist/realtime/realtime-artifact-helpers.d.ts +37 -0
- package/dist/realtime/realtime-artifact-helpers.d.ts.map +1 -0
- package/dist/realtime/realtime-artifact-helpers.js +150 -0
- package/dist/realtime/realtime-artifact-helpers.js.map +1 -0
- package/dist/realtime/realtime-client-session-service.d.ts +209 -19
- package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
- package/dist/realtime/realtime-client-session-service.js +670 -41
- package/dist/realtime/realtime-client-session-service.js.map +1 -1
- package/dist/realtime/realtime-coagent-config.d.ts +26 -9
- package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
- package/dist/realtime/realtime-coagent-config.js +47 -60
- package/dist/realtime/realtime-coagent-config.js.map +1 -1
- package/dist/realtime/realtime-delegation-narrator.js +1 -1
- package/dist/realtime/realtime-delegation-narrator.js.map +1 -1
- package/dist/realtime/realtime-moderator-decision.d.ts +86 -0
- package/dist/realtime/realtime-moderator-decision.d.ts.map +1 -0
- package/dist/realtime/realtime-moderator-decision.js +131 -0
- package/dist/realtime/realtime-moderator-decision.js.map +1 -0
- package/dist/realtime/realtime-session-runner.d.ts +2 -0
- package/dist/realtime/realtime-session-runner.d.ts.map +1 -1
- package/dist/realtime/realtime-session-runner.js +24 -3
- package/dist/realtime/realtime-session-runner.js.map +1 -1
- package/dist/realtime/realtime-tool-broker.d.ts +6 -0
- package/dist/realtime/realtime-tool-broker.d.ts.map +1 -1
- package/dist/realtime/realtime-tool-broker.js +4 -2
- package/dist/realtime/realtime-tool-broker.js.map +1 -1
- package/dist/realtime/realtime-turn-moderator.d.ts +20 -0
- package/dist/realtime/realtime-turn-moderator.d.ts.map +1 -1
- package/dist/realtime/realtime-turn-moderator.js +63 -8
- package/dist/realtime/realtime-turn-moderator.js.map +1 -1
- package/dist/repeated-failing-step.d.ts +50 -0
- package/dist/repeated-failing-step.d.ts.map +1 -0
- package/dist/repeated-failing-step.js +130 -0
- package/dist/repeated-failing-step.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +20 -20
package/dist/base-agent.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { CompactionOutcome, EffectiveContextBudget } from './ConversationCompact
|
|
|
30
30
|
import { ConversationToolCall, ConversationToolExecutionResult, ConversationToolSummaryHost } from './ConversationToolManager.js';
|
|
31
31
|
import { CarryForwardStepRecord, StoppedRunStepRecord } from './tool-result-format.js';
|
|
32
32
|
import { AgentPreExecutionRAGResult } from './agent-pre-execution-rag.js';
|
|
33
|
-
import { AIPromptParams, AIPromptRunResult, ExecuteAgentParams, AgentTreeBudget, AgentConfiguration, ExecuteAgentResult, AgentAction, AgentSubAgentRequest, BaseAgentNextStep, MessageLifecycleEvent, AgentChatMessage, AgentChatMessageMetadata, AgentToolCallRequest, AIModelSelectionInfo, ActionChange, ActionChangeScope, SubAgentChange, MediaOutput, FileOutputRef, SecondaryScopeConfig, SecondaryScopeValue, AgentResponseForm, AgentPipelineRequest, AgentSkillActivationRequest, AgentSkillInvocation, SkillAvailabilityPurpose, AgentDecisionRequest, AgentDecisionResult, AgentDecisionAnswerSummary, StopContinuationMode } from '@memberjunction/ai-core-plus';
|
|
33
|
+
import { AIPromptParams, AIPromptRunResult, ExecuteAgentParams, AgentTreeBudget, AgentConfiguration, ExecuteAgentResult, AgentAction, AgentSubAgentRequest, BaseAgentNextStep, MessageLifecycleEvent, AgentChatMessage, AgentChatMessageMetadata, AgentToolCallRequest, AIModelSelectionInfo, ActionChange, ActionChangeScope, SubAgentChange, MediaOutput, FileOutputRef, SecondaryScopeConfig, SecondaryScopeValue, AgentResponseForm, AgentPipelineRequest, AgentSkillActivationRequest, AgentSkillInvocation, SkillAvailabilityPurpose, AgentDecisionRequest, AgentDecisionResult, AgentDecisionAnswerSummary, StopContinuationMode, type AIPromptExecutionScope } from '@memberjunction/ai-core-plus';
|
|
34
34
|
import { MJActionEntityExtended, ActionResult, ActionParam, AIDirective, type ActionOutputTrustLevel, type ActionErrorRecovery } from '@memberjunction/actions-base';
|
|
35
35
|
import { RuntimeStateDateTime, RuntimeStateScratchpad } from './runtime-state-fragment.js';
|
|
36
36
|
import { ScratchpadManager } from './ScratchpadManager.js';
|
|
@@ -125,12 +125,15 @@ export interface ExecuteSingleActionOptions {
|
|
|
125
125
|
* - `'audience'` — the action engine refused the action for the run's audience (`AUDIENCE_UNSUPPORTED`): it cannot
|
|
126
126
|
* limit what it returns to what everyone in a shared conversation may see, so it is locked out for the run. Not a
|
|
127
127
|
* configuration or credential error, and the model is told so.
|
|
128
|
+
* - `'tainted'` — the run read untrusted content under a task-graph envelope and the action is `disallowWhenTainted`
|
|
129
|
+
* (`TAINTED_EGRESS_BLOCKED`), so it is locked out until a person reviews that content. Not a configuration or
|
|
130
|
+
* credential error either, and the model is told so.
|
|
128
131
|
* - `'identical-arguments'` — the action already failed {@link IDENTICAL_FAILURE_THRESHOLD} times
|
|
129
132
|
* with these exact arguments.
|
|
130
133
|
* - `'attempts-exhausted'` — the action has failed {@link ACTION_FAILURE_BUDGET} consecutive times
|
|
131
134
|
* across any arguments.
|
|
132
135
|
*/
|
|
133
|
-
export type ActionCircuitBreakerReason = 'fatal' | 'audience' | 'identical-arguments' | 'attempts-exhausted';
|
|
136
|
+
export type ActionCircuitBreakerReason = 'fatal' | 'audience' | 'tainted' | 'identical-arguments' | 'attempts-exhausted';
|
|
134
137
|
/**
|
|
135
138
|
* What {@link BaseAgent.classifyActionFailure} names for a failed action: the breaker rule that fired, a refusal by
|
|
136
139
|
* the user's agent policy (`'policy'` — governance, not a parameter error, so the guidance must not tell the model
|
|
@@ -248,6 +251,18 @@ export declare class BaseAgent {
|
|
|
248
251
|
* @protected
|
|
249
252
|
*/
|
|
250
253
|
protected _treeBudget: AgentTreeBudget | undefined;
|
|
254
|
+
private __budgetTracker?;
|
|
255
|
+
/** Collaborator tracking hierarchical token, cost, wall-clock, and attempt budgets across the agent tree. */
|
|
256
|
+
private get _budgetTracker();
|
|
257
|
+
private __feedbackCoordinator?;
|
|
258
|
+
/** Collaborator coordinating HITL feedback requests, assignment strategy resolution, and List routing. */
|
|
259
|
+
private get _feedbackCoordinator();
|
|
260
|
+
private __contextAssembler?;
|
|
261
|
+
/** Collaborator assembling outgoing message arrays, trailing runtime-state fragments, and prompt catalogs. */
|
|
262
|
+
private get _contextAssembler();
|
|
263
|
+
private __stepDispatcher?;
|
|
264
|
+
/** Collaborator dispatching step/loop formatting, payload mapping, and template resolution. */
|
|
265
|
+
private get _stepDispatcher();
|
|
251
266
|
/**
|
|
252
267
|
* Gets the shared {@link AgentTreeBudget} tracking cumulative steps, tokens, cost,
|
|
253
268
|
* and elapsed wall-clock duration across the root agent and all descendant sub-agents.
|
|
@@ -309,6 +324,13 @@ export declare class BaseAgent {
|
|
|
309
324
|
* @private
|
|
310
325
|
*/
|
|
311
326
|
private _audienceLockedActions;
|
|
327
|
+
/**
|
|
328
|
+
* Actions refused because the run read untrusted content under a task-graph envelope (`TAINTED_EGRESS_BLOCKED`) —
|
|
329
|
+
* locked out like {@link _fatalActionFailures}, under their own breaker reason (`'tainted'`) so the model is told
|
|
330
|
+
* a person must review that content first rather than that the action is misconfigured.
|
|
331
|
+
* @private
|
|
332
|
+
*/
|
|
333
|
+
private _taintLockedActions;
|
|
312
334
|
/**
|
|
313
335
|
* The run's audience readers beyond the caller (`ExecuteAgentParams.Audience`), hydrated from the user cache:
|
|
314
336
|
* `[]` when the audience adds nobody, `undefined` until hydrated for this run. Set after the permission check
|
|
@@ -431,17 +453,21 @@ export declare class BaseAgent {
|
|
|
431
453
|
*/
|
|
432
454
|
protected recordActionFailure(action: AgentAction, actionEntity: MJActionEntityExtended | undefined, message: string | null | undefined, normalizedParams: string): void;
|
|
433
455
|
/**
|
|
434
|
-
* Locks an action out for the rest of the run: later calls short-circuit on the breaker's `'fatal'` rule,
|
|
435
|
-
* its `'audience'` rule for an action the engine refused for the run's audience
|
|
456
|
+
* Locks an action out for the rest of the run: later calls short-circuit on the breaker's `'fatal'` rule, on
|
|
457
|
+
* its `'audience'` rule for an action the engine refused for the run's audience, or on its `'tainted'` rule for
|
|
458
|
+
* an action refused because the run read untrusted content.
|
|
436
459
|
*/
|
|
437
460
|
private lockOutAction;
|
|
438
461
|
/** Clears the run-scoped circuit-breaker state (both lockouts and the failure history) for a new run. */
|
|
439
462
|
private resetActionCircuitBreaker;
|
|
440
463
|
/**
|
|
441
|
-
* The blocked result for an action locked out for the run — refused for the audience (`'audience'`),
|
|
442
|
-
*
|
|
464
|
+
* The blocked result for an action locked out for the run — refused for the audience (`'audience'`), refused
|
|
465
|
+
* because the run read untrusted content (`'tainted'`), or failed with an unrecoverable configuration or
|
|
466
|
+
* credential error (`'fatal'`) — or null when it is not locked out.
|
|
443
467
|
*/
|
|
444
468
|
private lockedOutActionResult;
|
|
469
|
+
/** What the model is told about an action locked out because the run read untrusted content (`'tainted'`). */
|
|
470
|
+
private taintLockoutText;
|
|
445
471
|
/**
|
|
446
472
|
* Clears the parameter-aware failure history for an action after it succeeds, so the
|
|
447
473
|
* identical-arguments rule and the consecutive-attempt budget start over.
|
|
@@ -539,6 +565,21 @@ export declare class BaseAgent {
|
|
|
539
565
|
* @protected
|
|
540
566
|
*/
|
|
541
567
|
protected recordTaintedSource(stepNumber: number, sourceName: string, trustLevel: AgentTaintedSource['trustLevel']): void;
|
|
568
|
+
/**
|
|
569
|
+
* Starts a run tainted when it executes a task-graph node whose input is tainted
|
|
570
|
+
* (`ExecuteAgentParams.SecurityEnvelope.IsRunTainted`): the node's input derives from untrusted content no
|
|
571
|
+
* completed Human step reviewed, so the run is tainted before it reads anything itself, exactly as the run
|
|
572
|
+
* that ingested the content was. Private: a security seed is not an extension point, and an override that
|
|
573
|
+
* skipped it would start a tainted run clean.
|
|
574
|
+
*/
|
|
575
|
+
private seedTaintFromSecurityEnvelope;
|
|
576
|
+
/**
|
|
577
|
+
* Starts a sub-agent run tainted when its parent, running outside any task graph, was tainted
|
|
578
|
+
* (`ExecuteAgentParams.ParentRunTainted`): it works from the parent's context. A sub-agent of a graph
|
|
579
|
+
* node is seeded through its envelope instead ({@link seedTaintFromSecurityEnvelope}). Private for
|
|
580
|
+
* the same reason.
|
|
581
|
+
*/
|
|
582
|
+
private seedTaintFromParentRun;
|
|
542
583
|
/**
|
|
543
584
|
* Folds a finished sub-agent's tainted sources into this run's, attributed to the sub-agent step,
|
|
544
585
|
* so delegating a web search taints the parent exactly as searching itself would. Runs whether or
|
|
@@ -638,8 +679,8 @@ export declare class BaseAgent {
|
|
|
638
679
|
*/
|
|
639
680
|
private _awaitingWorkflowTaskID;
|
|
640
681
|
/**
|
|
641
|
-
* Stores the ID of an AIAgentRequest created when a Chat step fires.
|
|
642
|
-
* Populated by
|
|
682
|
+
* Stores the ID of an AIAgentRequest created when a Chat or Plan step fires.
|
|
683
|
+
* Populated by createFeedbackRequest(), returned in ExecuteAgentResult.feedbackRequestId.
|
|
643
684
|
* Only set for root agents (depth 0), not sub-agents.
|
|
644
685
|
* @private
|
|
645
686
|
*/
|
|
@@ -993,6 +1034,13 @@ export declare class BaseAgent {
|
|
|
993
1034
|
* @private
|
|
994
1035
|
*/
|
|
995
1036
|
private _runExecutionScope;
|
|
1037
|
+
/**
|
|
1038
|
+
* The current run's {@link AIPromptExecutionScope} (its user, provider, configuration, runtime API
|
|
1039
|
+
* keys and credential scope), set when the run starts, or undefined before one has. A subclass that
|
|
1040
|
+
* asks a decision or runs a prompt outside the agent's own turn passes it on, so the call runs on
|
|
1041
|
+
* the run's keys and configuration rather than the platform's.
|
|
1042
|
+
*/
|
|
1043
|
+
protected get RunExecutionScope(): AIPromptExecutionScope | undefined;
|
|
996
1044
|
/**
|
|
997
1045
|
* Whether the run answers its conversation's opening request ({@link IsOpeningTurn}), read from
|
|
998
1046
|
* the messages it started with. Decision discovery asks about no other turn.
|
|
@@ -1232,6 +1280,7 @@ export declare class BaseAgent {
|
|
|
1232
1280
|
*/
|
|
1233
1281
|
protected get DefaultAgentTimeoutMS(): number;
|
|
1234
1282
|
Execute<C = any, R = any>(params: ExecuteAgentParams<C>): Promise<ExecuteAgentResult<R>>;
|
|
1283
|
+
private executeRun;
|
|
1235
1284
|
/**
|
|
1236
1285
|
* {@link Execute}'s per-run teardown, called from its top-level `finally` on every exit path.
|
|
1237
1286
|
* The run leaves the watchdog first, before the subclass {@link finalizeRun} hook, so a hook
|
|
@@ -1275,16 +1324,22 @@ export declare class BaseAgent {
|
|
|
1275
1324
|
* A malformed audience counts as adding one (the run fails before the gates are reached anyway).
|
|
1276
1325
|
*/
|
|
1277
1326
|
private runAudienceAddsReader;
|
|
1327
|
+
/**
|
|
1328
|
+
* What this run carries that a graph would have to carry too, or null when nothing: an audience that adds a
|
|
1329
|
+
* reader, host-assigned search scopes, a tenant or secondary dimension (`ActionRunScopeIsBounded`), bound
|
|
1330
|
+
* action parameters, the caller's tenant context, or taint. A graph runs outside the run — its nodes are claimed later
|
|
1331
|
+
* by a dispatcher, as a background worker — so each of these is lost unless the graph's security envelope
|
|
1332
|
+
* carries it.
|
|
1333
|
+
*/
|
|
1334
|
+
private taskGraphConstraint;
|
|
1278
1335
|
/**
|
|
1279
1336
|
* Why this run is not offered task graphs and refuses one the model writes, or null when it may use them — the one
|
|
1280
|
-
* predicate,
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* agent node would drop it. Likewise when the host assigned the run's search scopes (`SearchScopeIDs`): a graph's
|
|
1287
|
-
* Scoped Search node would fall back to the agent's own search access.
|
|
1337
|
+
* predicate, read by the prompt (`promptWithholding`) and by {@link executeTasksStep} alike, so the two cannot
|
|
1338
|
+
* disagree. A constrained run ({@link taskGraphConstraint}) may use graphs only when the registered submitter
|
|
1339
|
+
* enforces security envelopes (`TaskGraphSubmitter.SupportsSecurityEnvelope`): then the envelope carries the
|
|
1340
|
+
* audience, the validated run scope (tenant, dimensions and search scopes), the bound parameters, the caller's
|
|
1341
|
+
* tenant context and the taint into every node. Nothing the caller passes opens this gate. What the envelope
|
|
1342
|
+
* cannot carry keeps the refusal: a malformed audience, and a tenant context JSON would change.
|
|
1288
1343
|
*/
|
|
1289
1344
|
private taskGraphWithholdingReason;
|
|
1290
1345
|
/** Whether this run withholds task graphs ({@link taskGraphWithholdingReason}). */
|
|
@@ -1759,6 +1814,14 @@ export declare class BaseAgent {
|
|
|
1759
1814
|
* @param params
|
|
1760
1815
|
*/
|
|
1761
1816
|
protected initializeStartingPayload<P = any>(params: ExecuteAgentParams<any, P>): Promise<void>;
|
|
1817
|
+
/**
|
|
1818
|
+
* Feeds one executed decision (never a prompt turn) to the repeated-failing-step guard (#4832).
|
|
1819
|
+
* The consecutive-failed-steps counter cannot see a model that re-issues the same failing step:
|
|
1820
|
+
* the prompt between two failures returns a non-Failed decision and resets it. When the same
|
|
1821
|
+
* decision has failed {@link MAX_REPEATED_FAILING_STEP} times in a row, `nextStep` is turned
|
|
1822
|
+
* into a terminating Failed step naming the step type and the last error.
|
|
1823
|
+
*/
|
|
1824
|
+
private checkRepeatedFailingStep;
|
|
1762
1825
|
/**
|
|
1763
1826
|
* Executes the agent's internal logic.
|
|
1764
1827
|
*
|
|
@@ -1969,7 +2032,7 @@ export declare class BaseAgent {
|
|
|
1969
2032
|
/**
|
|
1970
2033
|
* The Choice's options, rebuilt on every call and never cached ({@link BuildDecisionDiscoveryOptionSet}):
|
|
1971
2034
|
* from AIEngine's current catalog, the agents the user may run, the decision prompt's option cap,
|
|
1972
|
-
* and the semantic search over the opening request when the provider can run it.
|
|
2035
|
+
* and the client's sanitized pre-filter or semantic search over the opening request when the provider can run it.
|
|
1973
2036
|
*/
|
|
1974
2037
|
private decisionDiscoveryOptionSet;
|
|
1975
2038
|
/** Opens the `Agent discovery` Decision step. Without a run there is no step. */
|
|
@@ -2321,6 +2384,12 @@ export declare class BaseAgent {
|
|
|
2321
2384
|
private dropReasoningBehindChangedHistory;
|
|
2322
2385
|
/** Whether this run replays reasoning to a driver that binds it to an unchanged request prefix. */
|
|
2323
2386
|
private replaysPrefixBoundReasoning;
|
|
2387
|
+
/**
|
|
2388
|
+
* Returns `true` when outgoing message fingerprinting is needed to detect prefix changes
|
|
2389
|
+
* for replayed reasoning blocks. Skips hashing on envelope runs (`_nativeToolBindings === undefined`)
|
|
2390
|
+
* and on subsequent turns once a non-prefix-bound model is selected and no message carries reasoning.
|
|
2391
|
+
*/
|
|
2392
|
+
private shouldTrackSentFingerprints;
|
|
2324
2393
|
/**
|
|
2325
2394
|
* Keeps the system-prompt-and-tools fingerprint of the request just sent, for the next one. When
|
|
2326
2395
|
* it changed, the runner sent this request without replayed reasoning; the history drops it too,
|
|
@@ -2331,6 +2400,7 @@ export declare class BaseAgent {
|
|
|
2331
2400
|
* next request skip the comparison and replay thinking made under a prompt or tools it no longer has.
|
|
2332
2401
|
*/
|
|
2333
2402
|
private trackSentPrefix;
|
|
2403
|
+
private static readonly _messageFingerprintCache;
|
|
2334
2404
|
/** What makes a message the same message to a provider — reasoning aside, which only this check removes. */
|
|
2335
2405
|
private static messageFingerprint;
|
|
2336
2406
|
/**
|
|
@@ -2607,6 +2677,14 @@ export declare class BaseAgent {
|
|
|
2607
2677
|
* need these actions in scope alongside {@link getEffectiveActionsForValidation}.
|
|
2608
2678
|
*/
|
|
2609
2679
|
private getFlowStepActions;
|
|
2680
|
+
/**
|
|
2681
|
+
* Returns the active agents named by an agent's own active Flow steps: a `Sub-Agent` step's
|
|
2682
|
+
* `SubAgentID`, or the `SubAgentID` of a `ForEach`/`While` step whose `LoopBodyType` is
|
|
2683
|
+
* `'Sub-Agent'`. Flow agents bind sub-agents on `AIAgentStep` rather than through `ParentID`
|
|
2684
|
+
* or `AIAgentRelationship`, so {@link resolveSubAgentByName} needs these in scope, as
|
|
2685
|
+
* {@link getFlowStepActions} does for actions.
|
|
2686
|
+
*/
|
|
2687
|
+
private getFlowStepSubAgents;
|
|
2610
2688
|
/**
|
|
2611
2689
|
* Combines {@link getEffectiveActionsForValidation} with {@link getFlowStepActions} (deduplicated
|
|
2612
2690
|
* by `ID`) so both Loop agents (strictly `AIAgentAction` / `_effectiveActions`) and Flow agents
|
|
@@ -3727,7 +3805,8 @@ export declare class BaseAgent {
|
|
|
3727
3805
|
private reachableCatalogNarrowingLimits;
|
|
3728
3806
|
/**
|
|
3729
3807
|
* Every item of the three lists as a narrowing candidate. An action or sub-agent with
|
|
3730
|
-
* `MinExecutionsPerRun` set,
|
|
3808
|
+
* `MinExecutionsPerRun` set, explicitly assigned `MJ: AI Agent Skills` (when the agent also has
|
|
3809
|
+
* unpinned auto-activatable skills), and the Find Candidate tools, are pinned: always shown.
|
|
3731
3810
|
*/
|
|
3732
3811
|
private catalogNarrowingCandidates;
|
|
3733
3812
|
/**
|
|
@@ -4028,12 +4107,21 @@ export declare class BaseAgent {
|
|
|
4028
4107
|
* @throws {Error} If the action fails to execute
|
|
4029
4108
|
*/
|
|
4030
4109
|
ExecuteSingleAction(params: ExecuteAgentParams, action: AgentAction, actionEntity: MJActionEntityExtended, contextUser?: UserInfo, options?: ExecuteSingleActionOptions): Promise<ActionResult>;
|
|
4110
|
+
/**
|
|
4111
|
+
* Refuses a `disallowWhenTainted` action (`Action.Config_Object`) in a run that executes under a
|
|
4112
|
+
* task-graph security envelope (`ExecuteAgentParams.SecurityEnvelope`: a graph's agent node, its
|
|
4113
|
+
* continuation turn, or a sub-agent of either) once the run is tainted — checked on every call against
|
|
4114
|
+
* the run's current taint. The node's runner takes those actions away from a run that starts tainted;
|
|
4115
|
+
* this is what stops one that becomes tainted mid-run (it read a web page, then tries to send mail).
|
|
4116
|
+
*/
|
|
4117
|
+
private checkTaintedEgress;
|
|
4031
4118
|
/**
|
|
4032
4119
|
* Checks per-(Agent, User) action policy narrowing rules (`MJ: AI Agent User Policies`)
|
|
4033
|
-
* before dispatching an action.
|
|
4034
|
-
*
|
|
4120
|
+
* before dispatching an action. Loads the user's policy on cold cache (failing closed on
|
|
4121
|
+
* lookup error) and returns a synthetic ActionResult when the action is denied, deferred
|
|
4122
|
+
* outside a configured time window, or requires explicit user approval.
|
|
4035
4123
|
*/
|
|
4036
|
-
protected checkUserActionPolicy(params: ExecuteAgentParams, action: AgentAction, actionEntity: MJActionEntityExtended, contextUser?: UserInfo): ActionResult | null
|
|
4124
|
+
protected checkUserActionPolicy(params: ExecuteAgentParams, action: AgentAction, actionEntity: MJActionEntityExtended, contextUser?: UserInfo): Promise<ActionResult | null>;
|
|
4037
4125
|
/**
|
|
4038
4126
|
* Makes a SLICED conversation window safe to send on its own.
|
|
4039
4127
|
*
|
|
@@ -4233,7 +4321,7 @@ export declare class BaseAgent {
|
|
|
4233
4321
|
protected buildActionResultsMessage(actionSummaries: ActionResultSummary[]): string;
|
|
4234
4322
|
/**
|
|
4235
4323
|
* Formats an array of action result summaries as compact markdown instead of
|
|
4236
|
-
* pretty-printed JSON.
|
|
4324
|
+
* pretty-printed JSON. This typically saves 60-70 % of the tokens that the
|
|
4237
4325
|
* old `JSON.stringify(actionSummaries, null, 2)` approach consumed, while
|
|
4238
4326
|
* remaining equally parseable by LLMs.
|
|
4239
4327
|
*
|
|
@@ -4255,7 +4343,7 @@ export declare class BaseAgent {
|
|
|
4255
4343
|
protected formatActionResultsAsMarkdown(actionSummaries: ActionResultSummary[]): string;
|
|
4256
4344
|
/**
|
|
4257
4345
|
* Formats an ExecuteAgentResult as compact markdown for inclusion in
|
|
4258
|
-
* conversation messages.
|
|
4346
|
+
* conversation messages. Extracts only the fields that are meaningful
|
|
4259
4347
|
* to the calling agent (success, status, error, and payload) and
|
|
4260
4348
|
* presents them in a concise format.
|
|
4261
4349
|
*
|
|
@@ -4265,23 +4353,6 @@ export declare class BaseAgent {
|
|
|
4265
4353
|
* @private
|
|
4266
4354
|
*/
|
|
4267
4355
|
private formatSubAgentResultAsMarkdown;
|
|
4268
|
-
/**
|
|
4269
|
-
* Formats a single output parameter value for inclusion in action result
|
|
4270
|
-
* markdown. Scalars are shown inline with backtick formatting; objects and
|
|
4271
|
-
* arrays use compact (single-line) JSON to avoid the indentation overhead
|
|
4272
|
-
* of pretty-printed JSON.
|
|
4273
|
-
*
|
|
4274
|
-
* By default, values are **not truncated** — the expiration/compaction lifecycle
|
|
4275
|
-
* handles context window management. Truncating at formatting time permanently
|
|
4276
|
-
* discards data before the LLM ever sees it. Pass an explicit maxLength only
|
|
4277
|
-
* when you have a specific reason to limit output size.
|
|
4278
|
-
*
|
|
4279
|
-
* @param value - The parameter value (any type)
|
|
4280
|
-
* @param maxLength - Maximum character length before truncation (0 = no limit, default 0)
|
|
4281
|
-
* @returns Formatted string
|
|
4282
|
-
* @private
|
|
4283
|
-
*/
|
|
4284
|
-
private formatParamValueForResult;
|
|
4285
4356
|
/**
|
|
4286
4357
|
* Resolve the per-run action-result compression config from the agent-type prompt
|
|
4287
4358
|
* params. Crushing is on by default and only disabled when an agent explicitly sets
|
|
@@ -4289,34 +4360,11 @@ export declare class BaseAgent {
|
|
|
4289
4360
|
* @private
|
|
4290
4361
|
*/
|
|
4291
4362
|
protected resolveActionResultCrush(params: ExecuteAgentParams): ActionResultCrushConfig | undefined;
|
|
4292
|
-
/**
|
|
4293
|
-
* AST-reduce a large code-string action-result value when the agent opted into a code
|
|
4294
|
-
* language (via `crushCodeLang` or a subclass override) and the value clears the size
|
|
4295
|
-
* threshold. Returns reduced code plus a one-line legend, or null to keep the string
|
|
4296
|
-
* verbatim (crushing disabled, too small, or no net saving).
|
|
4297
|
-
*
|
|
4298
|
-
* token optimization via @memberjunction/context-crush (CodeCompressor-inspired)
|
|
4299
|
-
* @private
|
|
4300
|
-
*/
|
|
4301
|
-
private crushCodeValue;
|
|
4302
|
-
/**
|
|
4303
|
-
* Structurally compress a JSON action-result value when crushing is enabled for the run
|
|
4304
|
-
* and the value clears the size threshold. Accepts either the `JSON.stringify` of an
|
|
4305
|
-
* object/array param, or a raw string param that itself contains JSON (many actions
|
|
4306
|
-
* stringify their payloads, e.g. `run-adhoc-query`'s `Results`). Returns crushed text
|
|
4307
|
-
* plus a one-line legend, or null when crushing is disabled, the value is too small, the
|
|
4308
|
-
* value isn't valid JSON, or compression wouldn't actually save characters — so callers
|
|
4309
|
-
* fall back to verbatim (and, for strings, to code crushing) behavior.
|
|
4310
|
-
*
|
|
4311
|
-
* token optimization via @memberjunction/context-crush (SmartCrusher-inspired)
|
|
4312
|
-
* @private
|
|
4313
|
-
*/
|
|
4314
|
-
private crushParamValue;
|
|
4315
4363
|
/**
|
|
4316
4364
|
* Formats a parameter value for display in action execution messages.
|
|
4317
4365
|
* Truncates long strings and formats objects/arrays for readability.
|
|
4318
4366
|
*
|
|
4319
|
-
* @param {
|
|
4367
|
+
* @param {unknown} value - The parameter value to format
|
|
4320
4368
|
* @param {number} maxLength - Maximum length before truncation (default: 100)
|
|
4321
4369
|
* @returns {string} Formatted value suitable for message display
|
|
4322
4370
|
* @private
|
|
@@ -4786,7 +4834,8 @@ export declare class BaseAgent {
|
|
|
4786
4834
|
private processSubAgentStep;
|
|
4787
4835
|
/**
|
|
4788
4836
|
* Finds a sub-agent by name, checking child agents (ParentID) first, then
|
|
4789
|
-
* related agents (AgentRelationships)
|
|
4837
|
+
* related agents (AgentRelationships), then agents named on this agent's own
|
|
4838
|
+
* Flow steps, then runtime-granted sub-agents. Returns `undefined` when the name
|
|
4790
4839
|
* doesn't resolve to an active agent reachable from `params.agent`.
|
|
4791
4840
|
*
|
|
4792
4841
|
* Used by both the single and parallel sub-agent dispatch paths so name
|
|
@@ -4977,22 +5026,6 @@ export declare class BaseAgent {
|
|
|
4977
5026
|
* @private
|
|
4978
5027
|
*/
|
|
4979
5028
|
private applySubAgentOutputMapping;
|
|
4980
|
-
/**
|
|
4981
|
-
* Sets a value in a target object, supporting array append operations.
|
|
4982
|
-
* If the key ends with [], the value is appended to an array instead of replacing.
|
|
4983
|
-
*
|
|
4984
|
-
* @param target - Target object to modify
|
|
4985
|
-
* @param key - Property key, optionally ending with [] for array append
|
|
4986
|
-
* @param value - Value to set or append
|
|
4987
|
-
* @private
|
|
4988
|
-
*/
|
|
4989
|
-
/**
|
|
4990
|
-
* Sets a value on a target object, honouring the `[]` array-append suffix.
|
|
4991
|
-
*
|
|
4992
|
-
* Delegates for the same reason as {@link getValueFromPath} — `results[]` must mean append in
|
|
4993
|
-
* both engines, or a workflow accumulates in one and overwrites in the other.
|
|
4994
|
-
*/
|
|
4995
|
-
private setMappedValue;
|
|
4996
5029
|
/**
|
|
4997
5030
|
* Applies sub-agent input mapping to prepare initial payload for related sub-agent.
|
|
4998
5031
|
* Maps parent payload paths to sub-agent initial payload paths.
|
|
@@ -5308,6 +5341,22 @@ export declare class BaseAgent {
|
|
|
5308
5341
|
* @protected
|
|
5309
5342
|
*/
|
|
5310
5343
|
protected executeTasksStep(params: ExecuteAgentParams, previousDecision: BaseAgentNextStep): Promise<BaseAgentNextStep>;
|
|
5344
|
+
/**
|
|
5345
|
+
* How a sub-agent run inherits this run's taint (S2). A sub-agent works from this run's context, so it
|
|
5346
|
+
* starts tainted when this run is tainted now, and carries the taint into its memory writes and any graph
|
|
5347
|
+
* it submits. When this run executes under a task-graph envelope (`params.SecurityEnvelope`), the
|
|
5348
|
+
* sub-agent gets that envelope with `IsRunTainted` set, and so refuses `disallowWhenTainted` actions as
|
|
5349
|
+
* an agent node does. A run outside any graph hands down only the taint (`ParentRunTainted`): its
|
|
5350
|
+
* sub-agent is held to what the run itself is, not to a gate the run is not under.
|
|
5351
|
+
*/
|
|
5352
|
+
private subAgentTaint;
|
|
5353
|
+
/**
|
|
5354
|
+
* The security envelope a graph this run submits carries: the run's bound parameters, the readers its audience
|
|
5355
|
+
* adds, its validated scope exactly as each action dispatch is handed it ({@link runScopeFor}), the caller's
|
|
5356
|
+
* tenant context and its taint — merged with the envelope this run itself executes under, when it is a
|
|
5357
|
+
* task-graph node (`ExecuteAgentParams.SecurityEnvelope`), keeping the stricter of each part.
|
|
5358
|
+
*/
|
|
5359
|
+
private taskGraphSecurityEnvelope;
|
|
5311
5360
|
/**
|
|
5312
5361
|
* Executes a `'Handoff'` next step: records the `'Handoff'` step entity with the resolved
|
|
5313
5362
|
* target agent ID, stores {@link _handoffResult} for {@link ExecuteAgentResult.handoff},
|
|
@@ -5357,32 +5406,18 @@ export declare class BaseAgent {
|
|
|
5357
5406
|
*/
|
|
5358
5407
|
private raiseFeedbackRequest;
|
|
5359
5408
|
/**
|
|
5360
|
-
* Creates a persistent AIAgentRequest row when a Chat step fires.
|
|
5361
|
-
* Resolves the target user via the assignment chain
|
|
5362
|
-
*
|
|
5363
|
-
*
|
|
5364
|
-
*
|
|
5365
|
-
*
|
|
5366
|
-
*
|
|
5409
|
+
* Creates a persistent AIAgentRequest row when a Chat or Plan step fires.
|
|
5410
|
+
* Resolves the target user via the assignment chain (delegating to
|
|
5411
|
+
* {@link AgentFeedbackCoordinator.CreateFeedbackRequest}):
|
|
5412
|
+
* 1. ExecuteAgentParams.assignmentStrategy (per-invocation override)
|
|
5413
|
+
* 2. Agent Type's AssignmentStrategy
|
|
5414
|
+
* 3. Agent's Category AssignmentStrategy (walks up ParentID tree)
|
|
5415
|
+
* 4. Request Type's DefaultAssignmentStrategy
|
|
5416
|
+
* 5. Fallback: contextUser (explicit caller) or null (system-level, visible to admins)
|
|
5367
5417
|
*
|
|
5368
5418
|
* @private
|
|
5369
5419
|
*/
|
|
5370
5420
|
private createFeedbackRequest;
|
|
5371
|
-
/**
|
|
5372
|
-
* Walks the assignment strategy resolution chain (bottom-up, first-non-null wins):
|
|
5373
|
-
* 1. ExecuteAgentParams.assignmentStrategy (per-invocation)
|
|
5374
|
-
* 2. Agent Type's AssignmentStrategy
|
|
5375
|
-
* 3. Agent's Category AssignmentStrategy (walks up ParentID tree)
|
|
5376
|
-
* 4. Request Type's DefaultAssignmentStrategy
|
|
5377
|
-
* 5. Fallback: null (caller uses contextUser + warning)
|
|
5378
|
-
* @private
|
|
5379
|
-
*/
|
|
5380
|
-
private resolveAssignmentStrategy;
|
|
5381
|
-
/**
|
|
5382
|
-
* Walks up the agent's category hierarchy looking for an AssignmentStrategy.
|
|
5383
|
-
* Uses AIEngine.Instance.AgentCategories (cached during engine Config).
|
|
5384
|
-
*/
|
|
5385
|
-
private resolveCategoryAssignmentStrategy;
|
|
5386
5421
|
/**
|
|
5387
5422
|
* Resolves the file storage account ID for this agent's file artifacts.
|
|
5388
5423
|
*
|
|
@@ -5398,32 +5433,6 @@ export declare class BaseAgent {
|
|
|
5398
5433
|
* @returns The resolved FileStorageAccount ID, or null if none configured
|
|
5399
5434
|
*/
|
|
5400
5435
|
protected getStorageAccountID(params: ExecuteAgentParams): Promise<string | null>;
|
|
5401
|
-
/**
|
|
5402
|
-
* Resolves the target user ID from a resolved assignment strategy.
|
|
5403
|
-
* For simple strategies (RunUser, AgentOwner, SpecificUser), resolves immediately.
|
|
5404
|
-
* For List/SharedInbox strategies, delegates to list-based resolution.
|
|
5405
|
-
* Falls back to contextUser with a warning if no strategy is provided.
|
|
5406
|
-
* @private
|
|
5407
|
-
*/
|
|
5408
|
-
private resolveUserFromStrategy;
|
|
5409
|
-
/**
|
|
5410
|
-
* Determines the request type ID based on the Chat step's context.
|
|
5411
|
-
* - If the responseForm has only approve/reject-style buttons, uses "Approval"
|
|
5412
|
-
* - If there's a responseForm with fields, uses "Information"
|
|
5413
|
-
* - Otherwise defaults to "Information"
|
|
5414
|
-
*
|
|
5415
|
-
* Request types come from the AI engine's cached `MJ: AI Agent Request Types` rows
|
|
5416
|
-
* (`AIEngineBase.ResolveAgentRequestTypeID`), the same source the agent actions use.
|
|
5417
|
-
* @private
|
|
5418
|
-
*/
|
|
5419
|
-
private resolveRequestTypeId;
|
|
5420
|
-
/**
|
|
5421
|
-
* Inspects an AgentResponseForm to determine the best request type name.
|
|
5422
|
-
* Returns "Approval" if the form is a simple two-option approve/reject pattern,
|
|
5423
|
-
* otherwise returns "Information".
|
|
5424
|
-
* @private
|
|
5425
|
-
*/
|
|
5426
|
-
private detectRequestTypeName;
|
|
5427
5436
|
/**
|
|
5428
5437
|
* Executes a ForEach loop with actual for loop
|
|
5429
5438
|
*/
|
|
@@ -5505,12 +5514,6 @@ export declare class BaseAgent {
|
|
|
5505
5514
|
* Flow agents don't inject loop results, so for them this is just the Failed step.
|
|
5506
5515
|
*/
|
|
5507
5516
|
private failLoopBeforeFirstIteration;
|
|
5508
|
-
/**
|
|
5509
|
-
* One loop error as readable text. Joining the error objects directly wrote "[object Object]"
|
|
5510
|
-
* into the step's ErrorMessage. Falls back to JSON when an iteration threw something with no
|
|
5511
|
-
* message (a thrown non-Error).
|
|
5512
|
-
*/
|
|
5513
|
-
private describeLoopError;
|
|
5514
5517
|
/** All loop errors as text for a step's ErrorMessage. */
|
|
5515
5518
|
private formatLoopErrors;
|
|
5516
5519
|
/**
|
|
@@ -5518,7 +5521,7 @@ export declare class BaseAgent {
|
|
|
5518
5521
|
* depending on whether the loop body executed actions or sub-agents:
|
|
5519
5522
|
*
|
|
5520
5523
|
* - **Action iterations**: `priorStepResult` is an `ActionResultSummary[]`, set by
|
|
5521
|
-
* `executeActionsStep()
|
|
5524
|
+
* `executeActionsStep()`. These are formatted via `formatActionResultsAsMarkdown()`.
|
|
5522
5525
|
*
|
|
5523
5526
|
* - **Sub-agent iterations**: `priorStepResult` is a **pre-formatted markdown string**,
|
|
5524
5527
|
* set by the loop handlers (`executeSingleForEachIteration` / `executeSingleWhileIteration`)
|
|
@@ -5596,7 +5599,9 @@ export declare class BaseAgent {
|
|
|
5596
5599
|
* Maps the reason an abort signal carried to the run's `CancellationReason` value: the
|
|
5597
5600
|
* watchdog's stop relay raises {@link AgentRunWatchdog.UserCancelAbortReason} for a row marked
|
|
5598
5601
|
* `User Request`; the wall-clock guard's reason starts with {@link AgentTimeoutAbortReason};
|
|
5599
|
-
* anything else (an upstream caller's token, a shutdown) is `System`.
|
|
5602
|
+
* anything else (an upstream caller's token, a shutdown) is `System`. A watchdog force-fail
|
|
5603
|
+
* ({@link AgentRunWatchdog.ForceFailedAbortReason}) never gets here: {@link createCancelledResult}
|
|
5604
|
+
* finalizes it `Failed`, with no cancellation reason.
|
|
5600
5605
|
*/
|
|
5601
5606
|
static CancellationReasonForAbort(reason: string | null | undefined): NonNullable<MJAIAgentRunEntityExtended['CancellationReason']>;
|
|
5602
5607
|
/**
|
|
@@ -5612,6 +5617,14 @@ export declare class BaseAgent {
|
|
|
5612
5617
|
PayloadAtStartSourceStepID?: string | null;
|
|
5613
5618
|
PayloadAtEndSourceStepID?: string | null;
|
|
5614
5619
|
}> | null | undefined): string | null;
|
|
5620
|
+
/**
|
|
5621
|
+
* Stops the watchdog guarding this run once its final state is saved. MJAPI's event-loop
|
|
5622
|
+
* stall warning names the runs "in flight" from the watchdog's tracked set, and the periodic
|
|
5623
|
+
* prune only drops finished runs every few minutes, so without this the warning would name
|
|
5624
|
+
* runs that ended long before the stall (MJ #5510). A failed save keeps the run tracked: the
|
|
5625
|
+
* watchdog's heartbeat and sweep still own a run whose final state never reached the database.
|
|
5626
|
+
*/
|
|
5627
|
+
private releaseFinishedRun;
|
|
5615
5628
|
/**
|
|
5616
5629
|
* Finalizes the agent run with success.
|
|
5617
5630
|
*
|
|
@@ -5887,6 +5900,7 @@ export declare class BaseAgent {
|
|
|
5887
5900
|
protected estimateTokens(content: ChatMessage['content'], modelName?: string): number;
|
|
5888
5901
|
/**
|
|
5889
5902
|
* Provides an improved heuristic token count when tokenizer is unavailable.
|
|
5903
|
+
* Zero-allocation scan over character codes to prevent multi-megabyte match arrays on large tool outputs.
|
|
5890
5904
|
* @param text - The text to estimate tokens for
|
|
5891
5905
|
* @returns Estimated token count
|
|
5892
5906
|
* @private
|