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

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 (131) hide show
  1. package/README.md +18 -0
  2. package/dist/AgentDecisionService.d.ts +90 -0
  3. package/dist/AgentDecisionService.d.ts.map +1 -0
  4. package/dist/AgentDecisionService.js +159 -0
  5. package/dist/AgentDecisionService.js.map +1 -0
  6. package/dist/AgentRunner.d.ts +9 -0
  7. package/dist/AgentRunner.d.ts.map +1 -1
  8. package/dist/AgentRunner.js +23 -7
  9. package/dist/AgentRunner.js.map +1 -1
  10. package/dist/ConversationCompactionManager.d.ts +7 -1
  11. package/dist/ConversationCompactionManager.d.ts.map +1 -1
  12. package/dist/ConversationCompactionManager.js +4 -1
  13. package/dist/ConversationCompactionManager.js.map +1 -1
  14. package/dist/KnowledgeAgent.d.ts.map +1 -1
  15. package/dist/KnowledgeAgent.js +6 -6
  16. package/dist/KnowledgeAgent.js.map +1 -1
  17. package/dist/PayloadFeedbackManager.d.ts +116 -14
  18. package/dist/PayloadFeedbackManager.d.ts.map +1 -1
  19. package/dist/PayloadFeedbackManager.js +229 -88
  20. package/dist/PayloadFeedbackManager.js.map +1 -1
  21. package/dist/agent-context-injector.d.ts +47 -3
  22. package/dist/agent-context-injector.d.ts.map +1 -1
  23. package/dist/agent-context-injector.js +77 -10
  24. package/dist/agent-context-injector.js.map +1 -1
  25. package/dist/agent-memory-context-builder.d.ts +13 -0
  26. package/dist/agent-memory-context-builder.d.ts.map +1 -1
  27. package/dist/agent-memory-context-builder.js +24 -5
  28. package/dist/agent-memory-context-builder.js.map +1 -1
  29. package/dist/agent-types/flow-agent-type.d.ts +97 -0
  30. package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
  31. package/dist/agent-types/flow-agent-type.js +281 -24
  32. package/dist/agent-types/flow-agent-type.js.map +1 -1
  33. package/dist/agent-types/flow-graph-executor.d.ts +12 -1
  34. package/dist/agent-types/flow-graph-executor.d.ts.map +1 -1
  35. package/dist/agent-types/flow-graph-executor.js +25 -1
  36. package/dist/agent-types/flow-graph-executor.js.map +1 -1
  37. package/dist/agent-types/loop-agent-prompt-params.d.ts +239 -66
  38. package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
  39. package/dist/agent-types/loop-agent-prompt-params.js +47 -2
  40. package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
  41. package/dist/agent-types/loop-agent-response-type.d.ts +12 -1
  42. package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
  43. package/dist/agent-types/loop-agent-response-type.js.map +1 -1
  44. package/dist/agent-types/loop-agent-type.d.ts +26 -0
  45. package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
  46. package/dist/agent-types/loop-agent-type.js +115 -5
  47. package/dist/agent-types/loop-agent-type.js.map +1 -1
  48. package/dist/base-agent.d.ts +527 -10
  49. package/dist/base-agent.d.ts.map +1 -1
  50. package/dist/base-agent.js +1779 -110
  51. package/dist/base-agent.js.map +1 -1
  52. package/dist/catalog-narrowing.d.ts +136 -0
  53. package/dist/catalog-narrowing.d.ts.map +1 -0
  54. package/dist/catalog-narrowing.js +212 -0
  55. package/dist/catalog-narrowing.js.map +1 -0
  56. package/dist/decision-discovery.d.ts +401 -0
  57. package/dist/decision-discovery.d.ts.map +1 -0
  58. package/dist/decision-discovery.js +511 -0
  59. package/dist/decision-discovery.js.map +1 -0
  60. package/dist/finish-if-mode-warnings.d.ts +39 -0
  61. package/dist/finish-if-mode-warnings.d.ts.map +1 -0
  62. package/dist/finish-if-mode-warnings.js +78 -0
  63. package/dist/finish-if-mode-warnings.js.map +1 -0
  64. package/dist/finish-if-state.d.ts +72 -0
  65. package/dist/finish-if-state.d.ts.map +1 -0
  66. package/dist/finish-if-state.js +109 -0
  67. package/dist/finish-if-state.js.map +1 -0
  68. package/dist/index.d.ts +10 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +11 -0
  71. package/dist/index.js.map +1 -1
  72. package/dist/memory-manager-agent.d.ts +108 -2
  73. package/dist/memory-manager-agent.d.ts.map +1 -1
  74. package/dist/memory-manager-agent.js +172 -9
  75. package/dist/memory-manager-agent.js.map +1 -1
  76. package/dist/memory-note-gate.d.ts +208 -0
  77. package/dist/memory-note-gate.d.ts.map +1 -0
  78. package/dist/memory-note-gate.js +294 -0
  79. package/dist/memory-note-gate.js.map +1 -0
  80. package/dist/native-tools/action-tool-builder.d.ts +14 -0
  81. package/dist/native-tools/action-tool-builder.d.ts.map +1 -1
  82. package/dist/native-tools/action-tool-builder.js +62 -7
  83. package/dist/native-tools/action-tool-builder.js.map +1 -1
  84. package/dist/native-tools/control-tools.d.ts +17 -1
  85. package/dist/native-tools/control-tools.d.ts.map +1 -1
  86. package/dist/native-tools/control-tools.js +40 -3
  87. package/dist/native-tools/control-tools.js.map +1 -1
  88. package/dist/realtime/bridge-host-params.d.ts +22 -0
  89. package/dist/realtime/bridge-host-params.d.ts.map +1 -0
  90. package/dist/realtime/bridge-host-params.js +53 -0
  91. package/dist/realtime/bridge-host-params.js.map +1 -0
  92. package/dist/realtime/bridge-realtime-session-factory.d.ts +23 -2
  93. package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -1
  94. package/dist/realtime/bridge-realtime-session-factory.js +22 -6
  95. package/dist/realtime/bridge-realtime-session-factory.js.map +1 -1
  96. package/dist/realtime/bridge-room-transcript-sink.d.ts.map +1 -1
  97. package/dist/realtime/bridge-room-transcript-sink.js +15 -9
  98. package/dist/realtime/bridge-room-transcript-sink.js.map +1 -1
  99. package/dist/realtime/bridge-session-transcript-sink.d.ts +37 -0
  100. package/dist/realtime/bridge-session-transcript-sink.d.ts.map +1 -0
  101. package/dist/realtime/bridge-session-transcript-sink.js +58 -0
  102. package/dist/realtime/bridge-session-transcript-sink.js.map +1 -0
  103. package/dist/realtime/realtime-client-session-service.d.ts +117 -12
  104. package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
  105. package/dist/realtime/realtime-client-session-service.js +162 -39
  106. package/dist/realtime/realtime-client-session-service.js.map +1 -1
  107. package/dist/realtime/realtime-coagent-resolution.d.ts +90 -0
  108. package/dist/realtime/realtime-coagent-resolution.d.ts.map +1 -0
  109. package/dist/realtime/realtime-coagent-resolution.js +186 -0
  110. package/dist/realtime/realtime-coagent-resolution.js.map +1 -0
  111. package/dist/realtime/realtime-delegation-narrator.d.ts +97 -0
  112. package/dist/realtime/realtime-delegation-narrator.d.ts.map +1 -0
  113. package/dist/realtime/realtime-delegation-narrator.js +162 -0
  114. package/dist/realtime/realtime-delegation-narrator.js.map +1 -0
  115. package/dist/realtime/realtime-session-runner.d.ts +2 -82
  116. package/dist/realtime/realtime-session-runner.d.ts.map +1 -1
  117. package/dist/realtime/realtime-session-runner.js +12 -187
  118. package/dist/realtime/realtime-session-runner.js.map +1 -1
  119. package/dist/realtime/realtime-vendor-resolution.d.ts +8 -3
  120. package/dist/realtime/realtime-vendor-resolution.d.ts.map +1 -1
  121. package/dist/realtime/realtime-vendor-resolution.js +3 -3
  122. package/dist/realtime/realtime-vendor-resolution.js.map +1 -1
  123. package/dist/rubric-evaluation-agent-runner.d.ts +2 -0
  124. package/dist/rubric-evaluation-agent-runner.d.ts.map +1 -0
  125. package/dist/rubric-evaluation-agent-runner.js +47 -0
  126. package/dist/rubric-evaluation-agent-runner.js.map +1 -0
  127. package/dist/self-check.d.ts +101 -0
  128. package/dist/self-check.d.ts.map +1 -0
  129. package/dist/self-check.js +74 -0
  130. package/dist/self-check.js.map +1 -0
  131. package/package.json +19 -18
@@ -6,13 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  var MemoryManagerAgent_1;
8
8
  import { BaseAgent } from './base-agent.js';
9
- import { RegisterClass, CleanAndParseJSON } from '@memberjunction/global';
9
+ import { RegisterClass, CleanAndParseJSON, IsPlainObject } from '@memberjunction/global';
10
10
  import { RunView, RunQuery, LogError, LogStatus, LogStatusEx } from '@memberjunction/core';
11
11
  import { IsInjectableNoteStatus } from '@memberjunction/core-entities';
12
12
  import { AIPromptRunner } from '@memberjunction/ai-prompts';
13
- import { AIPromptParams } from '@memberjunction/ai-core-plus';
13
+ import { AIPromptParams, DescribeAnsweringModel } from '@memberjunction/ai-core-plus';
14
14
  import { AIEngine } from '@memberjunction/aiengine';
15
15
  import { UUIDsEqual } from '@memberjunction/global';
16
+ import { AgentDecisionService } from './AgentDecisionService.js';
17
+ import { BuildMemoryNoteQuestions, BuildMemoryNoteState, JudgeMemoryNotes, MemoryNotePromptQuestionCap, ChunkMemoryNotes, GroupMemoryNotesByConversation, MEMORY_NOTE_MIN_PROBABILITY } from './memory-note-gate.js';
16
18
  /**
17
19
  * Configuration for extraction limits to ensure sparsity
18
20
  */
@@ -131,7 +133,7 @@ const SOURCE_RUN_SCOPE_FIELDS = ['AgentID', 'CompanyID', 'UserID', 'PrimaryScope
131
133
  * This agent runs on a schedule (every 15 minutes) and analyzes high-quality conversations
132
134
  * and agent runs to extract learnings and example interactions.
133
135
  */
134
- let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends BaseAgent {
136
+ let MemoryManagerAgent = class MemoryManagerAgent extends BaseAgent {
135
137
  constructor() {
136
138
  super(...arguments);
137
139
  /** Verbose logging flag from params.verbose */
@@ -142,6 +144,21 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
142
144
  this._stepCounter = 0;
143
145
  /** Context user for step operations */
144
146
  this._contextUser = null;
147
+ /** Flag to enable typed decision gate instead of self-confidence threshold */
148
+ this._enableDecisionGate = false;
149
+ }
150
+ static { MemoryManagerAgent_1 = this; }
151
+ /**
152
+ * Whether the typed decision gate is enabled for filtering extracted memory notes.
153
+ * When false (default), uses the self-reported confidence filter (confidence >= 80).
154
+ * The gate also needs the master switch: the run's agent-type prompt params must set
155
+ * `decisionsEnabled: true` ({@link DecisionsEnabled}), or the confidence filter is used.
156
+ */
157
+ get EnableDecisionGate() {
158
+ return this._enableDecisionGate;
159
+ }
160
+ set EnableDecisionGate(value) {
161
+ this._enableDecisionGate = value;
145
162
  }
146
163
  /** Check if a string is a valid UUID format. Filters out LLM-generated placeholders like "user-uuid-here". */
147
164
  static isValidUUID(id) {
@@ -152,6 +169,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
152
169
  /**
153
170
  * Create an agent run step record for observability.
154
171
  * Returns null if agentRunID is not set (defensive check).
172
+ * Protected so a test can stand in for the database.
155
173
  */
156
174
  async createRunStep(stepType, stepName, inputData, targetId) {
157
175
  if (!this._agentRunID || !this._contextUser) {
@@ -468,7 +486,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
468
486
  companyId: n.CompanyID
469
487
  }))
470
488
  };
471
- return this.executeNoteExtraction(promptData, existingNotes, contextUser);
489
+ return this.executeNoteExtraction(promptData, existingNotes, contextUser, true);
472
490
  }
473
491
  /**
474
492
  * Mine corrective ("avoid this") memory from failed/cancelled agent runs. Each failed run
@@ -508,7 +526,9 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
508
526
  companyId: n.CompanyID
509
527
  }))
510
528
  };
511
- const extracted = await this.executeNoteExtraction(promptData, existingNotes, contextUser);
529
+ // The decision gate was measured on conversation notes only; a corrective lesson from a failed run
530
+ // is not the durable user fact its question asks about, so these keep the self-reported rule.
531
+ const extracted = await this.executeNoteExtraction(promptData, existingNotes, contextUser, false);
512
532
  return this.markCorrectiveNotes(extracted);
513
533
  }
514
534
  /**
@@ -546,7 +566,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
546
566
  *
547
567
  * Each step is its own private helper so the pipeline can be read top-to-bottom.
548
568
  */
549
- async executeNoteExtraction(promptData, existingNotes, contextUser) {
569
+ async executeNoteExtraction(promptData, existingNotes, contextUser, decisionGateApplies) {
550
570
  // Step 1: run the extraction prompt and parse out the raw notes
551
571
  const rawNotes = await this.runNoteExtractionPrompt(promptData, existingNotes.length, contextUser);
552
572
  if (!rawNotes)
@@ -559,11 +579,11 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
559
579
  LogStatus(`Memory Manager: Raw note: [${note.type}] "${note.content}" (confidence: ${note.confidence})${note.mergeWithExistingIds?.length ? ` mergeWith: ${note.mergeWithExistingIds.join(', ')}` : ''}`);
560
580
  }
561
581
  }
562
- // Step 3: filter by confidence and content length
563
- const candidateNotes = this.filterByConfidenceAndLength(rawNotes);
582
+ // Step 3: filter by decision gate or confidence/content length
583
+ const candidateNotes = await this.filterCandidateNotes(rawNotes, promptData.conversationThreads, contextUser, decisionGateApplies);
564
584
  if (candidateNotes.length === 0) {
565
585
  if (this._verbose)
566
- LogStatus('Memory Manager: No candidates passed confidence/length thresholds');
586
+ LogStatus('Memory Manager: No candidates passed gating thresholds');
567
587
  return [];
568
588
  }
569
589
  // Step 4: apply per-message and per-conversation sparsity caps
@@ -689,6 +709,134 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
689
709
  }
690
710
  return filtered;
691
711
  }
712
+ /**
713
+ * Filters candidate notes using either the typed decision gate (if enabled, with the master switch
714
+ * on, and the notes are ones it was measured on) or the traditional self-reported confidence and
715
+ * length filters. Protected so a test can run the gate the way extraction does.
716
+ *
717
+ * @param decisionGateApplies Whether these notes may be gated: conversation notes only.
718
+ */
719
+ async filterCandidateNotes(notes, conversationThreads, contextUser, decisionGateApplies) {
720
+ if (!this._enableDecisionGate || !this.DecisionsEnabled(this._runPromptParams) || !decisionGateApplies) {
721
+ return this.filterByConfidenceAndLength(notes);
722
+ }
723
+ return this.filterWithDecisionGate(notes, conversationThreads, contextUser);
724
+ }
725
+ /**
726
+ * Evaluates candidate notes through the typed decision gate, one conversation at a time: each note
727
+ * is judged against the conversation it came from, as the gate was measured and calibrated, in
728
+ * batches no larger than the prompt models' declared MaxQuestionsPerCall. A note whose conversation
729
+ * can't be told keeps the self-reported rule. The kept notes keep their original order.
730
+ */
731
+ async filterWithDecisionGate(notes, conversationThreads, contextUser) {
732
+ const lengthFiltered = notes.filter(n => n.content && n.content.length >= EXTRACTION_CONFIG.minContentLength);
733
+ if (lengthFiltered.length === 0) {
734
+ if (this._verbose)
735
+ LogStatus('Memory Manager: No candidates passed content length check before decision gate');
736
+ return [];
737
+ }
738
+ const cap = MemoryNotePromptQuestionCap(AIEngine.Instance, 'Default Decision');
739
+ const grouping = GroupMemoryNotesByConversation(lengthFiltered, conversationThreads.map(t => ({
740
+ ConversationId: t.conversationId,
741
+ Turns: t.messages.map(m => ({ role: m.role, text: m.message }))
742
+ })));
743
+ const kept = new Set(this.filterByConfidenceAndLength(grouping.Unattributed));
744
+ if (grouping.Unattributed.length > 0) {
745
+ LogStatus(`Memory Manager: ${grouping.Unattributed.length} note(s) name no conversation of this batch, so they keep the confidence filter`);
746
+ }
747
+ for (const conversation of grouping.Batches) {
748
+ for (const batch of ChunkMemoryNotes(conversation.Notes, cap)) {
749
+ const batchPassed = await this.judgeDecisionBatch(batch, conversation.ConversationId, conversation.Excerpt, contextUser, cap);
750
+ batchPassed.forEach(note => kept.add(note));
751
+ }
752
+ }
753
+ return lengthFiltered.filter(note => kept.has(note));
754
+ }
755
+ /**
756
+ * Runs a decision prompt call for a single batch of candidate notes from one conversation, falling
757
+ * back to the confidence filter if the decision call fails. The call's step joins the agent run's
758
+ * steps, and carries the call's prompt run, so the run's cost and token totals count it.
759
+ */
760
+ async judgeDecisionBatch(batch, conversationId, excerpt, contextUser, modelCap) {
761
+ const questions = BuildMemoryNoteQuestions(batch);
762
+ const state = BuildMemoryNoteState(batch, excerpt);
763
+ const step = await this.createRunStep('Decision', 'Judge Extracted Notes', {
764
+ conversationId,
765
+ noteCount: batch.length,
766
+ modelCap
767
+ });
768
+ if (step) {
769
+ this.AgentRun?.Steps.push(step);
770
+ }
771
+ const decisionService = this._agentDecisionService ?? new AgentDecisionService();
772
+ const result = await decisionService.Ask({
773
+ ContextUser: contextUser,
774
+ PromptName: 'Default Decision',
775
+ State: state,
776
+ Questions: questions,
777
+ AgentID: this.AgentRun?.AgentID ?? undefined,
778
+ CancellationToken: this._cancellationToken
779
+ });
780
+ await this.recordDecisionStep(step, result);
781
+ if (!result.success) {
782
+ LogStatus(`Memory Manager: Decision call failed (${result.errorMessage ?? 'unknown error'}), falling back to confidence filter for batch`);
783
+ return this.filterByConfidenceAndLength(batch);
784
+ }
785
+ const answeredBy = { ModelName: result.modelInfo?.modelName, ResolvedModel: result.DecisionResult?.ResolvedModel };
786
+ return this.evaluateDecisionVerdict(batch, result.Answers, answeredBy);
787
+ }
788
+ /**
789
+ * Puts the decision's prompt run on its step, which is how the agent run counts the call's cost
790
+ * and tokens, and marks the step complete.
791
+ */
792
+ async recordDecisionStep(step, result) {
793
+ if (!step)
794
+ return;
795
+ this.attachDecisionPromptRun(step, result);
796
+ await this.finalizeRunStep(step, result.success, { answers: result.Answers, model: result.modelInfo?.modelName, resolvedModel: result.DecisionResult?.ResolvedModel }, result.promptRun?.ID, result.errorMessage);
797
+ }
798
+ /** The answering models already logged as having no memory-note calibration, so each is logged once per process. */
799
+ static { this._uncalibratedGateModelsLogged = new Set(); }
800
+ /**
801
+ * Logs, once per model, that the decision gate fell back to the confidence filter because the
802
+ * model that answered has no memory-note calibration. That happens on a failover, when a decision
803
+ * model is added or renamed, or when a vendor model moves to another version (Jev's `APIName`).
804
+ */
805
+ static logUncalibratedGateModel(answeredBy) {
806
+ const described = DescribeAnsweringModel(answeredBy);
807
+ if (MemoryManagerAgent_1._uncalibratedGateModelsLogged.has(described)) {
808
+ return;
809
+ }
810
+ MemoryManagerAgent_1._uncalibratedGateModelsLogged.add(described);
811
+ LogStatus(`Memory Manager: ${described} has no memory-note calibration (MEMORY_NOTE_DECISION_CALIBRATION), so the decision gate falls back to the confidence filter for its batches`);
812
+ }
813
+ /**
814
+ * Applies calibrated probabilities to judge which candidate notes to keep. A note the calibrated
815
+ * model gave no usable answer for keeps the self-reported rule, as a failed call's batch does.
816
+ */
817
+ evaluateDecisionVerdict(batch, answers, answeredBy) {
818
+ const verdict = JudgeMemoryNotes(answers, batch, answeredBy, MEMORY_NOTE_MIN_PROBABILITY);
819
+ // Only a calibrated model replaces the self-reported confidence: one that answered without a
820
+ // calibration (a failover, or a calibrated model at another version) has not been shown to
821
+ // beat it, so the batch falls back to it.
822
+ if (!verdict.Calibrated) {
823
+ MemoryManagerAgent_1.logUncalibratedGateModel(answeredBy);
824
+ return this.filterByConfidenceAndLength(batch);
825
+ }
826
+ if (this._verbose) {
827
+ LogStatus(`Memory Manager: Decision gate evaluated ${batch.length} notes (calibrated: ${verdict.Calibrated}): kept ${verdict.KeptNotes.length}`);
828
+ for (const judged of verdict.JudgedNotes) {
829
+ LogStatus(`Memory Manager: Note [${judged.Note.type}] "${judged.Note.content.slice(0, 50)}..." -> kept: ${judged.Kept} (prob: ${judged.CalibratedProbability ?? judged.RawProbability ?? 'none'}), reason: ${judged.Reason}`);
830
+ }
831
+ }
832
+ const unanswered = verdict.JudgedNotes.filter(j => j.CalibratedProbability === undefined).map(j => j.Note);
833
+ if (unanswered.length === 0) {
834
+ return verdict.KeptNotes;
835
+ }
836
+ LogStatus(`Memory Manager: ${DescribeAnsweringModel(answeredBy)} gave no usable answer for ${unanswered.length} of ${batch.length} note(s), which keep the confidence filter`);
837
+ const kept = new Set([...verdict.KeptNotes, ...this.filterByConfidenceAndLength(unanswered)]);
838
+ return batch.filter(note => kept.has(note));
839
+ }
692
840
  /**
693
841
  * Enforce per-message and per-conversation note caps from EXTRACTION_CONFIG.
694
842
  * Drops any candidates that would exceed either cap.
@@ -2886,6 +3034,16 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2886
3034
  });
2887
3035
  return created;
2888
3036
  }
3037
+ /**
3038
+ * The run's merged agent-type prompt params: the agent type's defaults, then the Memory Manager
3039
+ * agent's own `AgentTypePromptParams`, then the run's `data.__agentTypePromptParams`. This agent
3040
+ * renders no Loop prompt, so it merges them itself, once per run.
3041
+ */
3042
+ runPromptParams(params) {
3043
+ const agentType = AIEngine.Instance.AgentTypes.find(at => UUIDsEqual(at.ID, params.agent.TypeID));
3044
+ const override = params.data?.__agentTypePromptParams;
3045
+ return this.buildAgentTypePromptParams(agentType, params.agent, IsPlainObject(override) ? override : undefined);
3046
+ }
2889
3047
  /**
2890
3048
  * Main execution method called by scheduler
2891
3049
  */
@@ -2893,6 +3051,11 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2893
3051
  try {
2894
3052
  // Use verbose flag from agent execution params or data payload (UI passes it via data)
2895
3053
  this._verbose = params.verbose || params.data?.verbose || false;
3054
+ if (typeof params.data?.enableDecisionGate === 'boolean') {
3055
+ this._enableDecisionGate = params.data.enableDecisionGate;
3056
+ }
3057
+ this._runPromptParams = this.runPromptParams(params);
3058
+ this._cancellationToken = params.cancellationToken;
2896
3059
  // Initialize observability state for this run
2897
3060
  this._agentRunID = this.AgentRun?.ID || null;
2898
3061
  this._stepCounter = 0;