@memberjunction/ai-agents 6.1.4 → 6.2.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.
Files changed (147) hide show
  1. package/README.md +25 -0
  2. package/dist/AgentDataPreloader.d.ts +4 -0
  3. package/dist/AgentDataPreloader.d.ts.map +1 -1
  4. package/dist/AgentDataPreloader.js +10 -2
  5. package/dist/AgentDataPreloader.js.map +1 -1
  6. package/dist/AgentRunner.d.ts +9 -4
  7. package/dist/AgentRunner.d.ts.map +1 -1
  8. package/dist/AgentRunner.js +39 -27
  9. package/dist/AgentRunner.js.map +1 -1
  10. package/dist/ArtifactToolManager.d.ts +4 -4
  11. package/dist/ArtifactToolManager.js +10 -10
  12. package/dist/ConversationToolManager.d.ts +16 -3
  13. package/dist/ConversationToolManager.d.ts.map +1 -1
  14. package/dist/ConversationToolManager.js +28 -5
  15. package/dist/ConversationToolManager.js.map +1 -1
  16. package/dist/PayloadChangeAnalyzer.d.ts +4 -0
  17. package/dist/PayloadChangeAnalyzer.d.ts.map +1 -1
  18. package/dist/PayloadChangeAnalyzer.js +10 -2
  19. package/dist/PayloadChangeAnalyzer.js.map +1 -1
  20. package/dist/PayloadFeedbackManager.d.ts +8 -0
  21. package/dist/PayloadFeedbackManager.d.ts.map +1 -1
  22. package/dist/PayloadFeedbackManager.js +20 -4
  23. package/dist/PayloadFeedbackManager.js.map +1 -1
  24. package/dist/PayloadManager.d.ts +27 -0
  25. package/dist/PayloadManager.d.ts.map +1 -1
  26. package/dist/PayloadManager.js +47 -15
  27. package/dist/PayloadManager.js.map +1 -1
  28. package/dist/agent-types/base-agent-type.d.ts +16 -0
  29. package/dist/agent-types/base-agent-type.d.ts.map +1 -1
  30. package/dist/agent-types/base-agent-type.js +20 -1
  31. package/dist/agent-types/base-agent-type.js.map +1 -1
  32. package/dist/agent-types/flow-agent-type.d.ts +9 -0
  33. package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
  34. package/dist/agent-types/flow-agent-type.js +18 -5
  35. package/dist/agent-types/flow-agent-type.js.map +1 -1
  36. package/dist/agent-types/loop-agent-prompt-params.d.ts +74 -0
  37. package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
  38. package/dist/agent-types/loop-agent-prompt-params.js +2 -0
  39. package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
  40. package/dist/artifact-target-plan.d.ts +2 -0
  41. package/dist/artifact-target-plan.d.ts.map +1 -1
  42. package/dist/artifact-target-plan.js +5 -1
  43. package/dist/artifact-target-plan.js.map +1 -1
  44. package/dist/base-agent.d.ts +408 -3
  45. package/dist/base-agent.d.ts.map +1 -1
  46. package/dist/base-agent.js +924 -78
  47. package/dist/base-agent.js.map +1 -1
  48. package/dist/constants.d.ts +57 -0
  49. package/dist/constants.d.ts.map +1 -0
  50. package/dist/constants.js +70 -0
  51. package/dist/constants.js.map +1 -0
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +3 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/memory-manager-agent.d.ts +12 -12
  57. package/dist/memory-manager-agent.js +65 -65
  58. package/dist/native-tools/action-tool-builder.d.ts +8 -0
  59. package/dist/native-tools/action-tool-builder.d.ts.map +1 -1
  60. package/dist/native-tools/action-tool-builder.js +22 -6
  61. package/dist/native-tools/action-tool-builder.js.map +1 -1
  62. package/dist/native-tools/control-tools.d.ts +8 -0
  63. package/dist/native-tools/control-tools.d.ts.map +1 -1
  64. package/dist/native-tools/control-tools.js +25 -9
  65. package/dist/native-tools/control-tools.js.map +1 -1
  66. package/dist/native-tools/dual-channel.d.ts +2 -0
  67. package/dist/native-tools/dual-channel.d.ts.map +1 -1
  68. package/dist/native-tools/dual-channel.js +5 -1
  69. package/dist/native-tools/dual-channel.js.map +1 -1
  70. package/dist/native-tools/tool-result-turns.d.ts +9 -0
  71. package/dist/native-tools/tool-result-turns.d.ts.map +1 -1
  72. package/dist/native-tools/tool-result-turns.js +15 -3
  73. package/dist/native-tools/tool-result-turns.js.map +1 -1
  74. package/dist/pipeline/coerce.d.ts +14 -0
  75. package/dist/pipeline/coerce.d.ts.map +1 -1
  76. package/dist/pipeline/coerce.js +37 -9
  77. package/dist/pipeline/coerce.js.map +1 -1
  78. package/dist/pipeline/jsonpath-eval.d.ts +4 -0
  79. package/dist/pipeline/jsonpath-eval.d.ts.map +1 -1
  80. package/dist/pipeline/jsonpath-eval.js +10 -2
  81. package/dist/pipeline/jsonpath-eval.js.map +1 -1
  82. package/dist/pipeline/operators.js +16 -16
  83. package/dist/pipeline/path.d.ts +6 -0
  84. package/dist/pipeline/path.d.ts.map +1 -1
  85. package/dist/pipeline/path.js +17 -5
  86. package/dist/pipeline/path.js.map +1 -1
  87. package/dist/pipeline/pipeline-executor.js +10 -10
  88. package/dist/pipeline/predicate.d.ts +4 -0
  89. package/dist/pipeline/predicate.d.ts.map +1 -1
  90. package/dist/pipeline/predicate.js +15 -7
  91. package/dist/pipeline/predicate.js.map +1 -1
  92. package/dist/pipeline/providers/action-provider.js +2 -2
  93. package/dist/pipeline/providers/artifact-tool-provider.js +2 -2
  94. package/dist/pipeline/providers/serialize.d.ts +4 -0
  95. package/dist/pipeline/providers/serialize.d.ts.map +1 -1
  96. package/dist/pipeline/providers/serialize.js +10 -2
  97. package/dist/pipeline/providers/serialize.js.map +1 -1
  98. package/dist/pipeline/template.d.ts +4 -0
  99. package/dist/pipeline/template.d.ts.map +1 -1
  100. package/dist/pipeline/template.js +15 -7
  101. package/dist/pipeline/template.js.map +1 -1
  102. package/dist/realtime/agent-media-library.d.ts +10 -0
  103. package/dist/realtime/agent-media-library.d.ts.map +1 -1
  104. package/dist/realtime/agent-media-library.js +29 -9
  105. package/dist/realtime/agent-media-library.js.map +1 -1
  106. package/dist/realtime/media-channel-server.js +2 -2
  107. package/dist/realtime/meeting-controls-state.d.ts +2 -0
  108. package/dist/realtime/meeting-controls-state.d.ts.map +1 -1
  109. package/dist/realtime/meeting-controls-state.js +6 -2
  110. package/dist/realtime/meeting-controls-state.js.map +1 -1
  111. package/dist/realtime/realtime-channel-server-data-context.d.ts +2 -0
  112. package/dist/realtime/realtime-channel-server-data-context.d.ts.map +1 -1
  113. package/dist/realtime/realtime-channel-server-data-context.js +5 -1
  114. package/dist/realtime/realtime-channel-server-data-context.js.map +1 -1
  115. package/dist/realtime/realtime-channel-server-host.js +2 -2
  116. package/dist/realtime/realtime-client-session-service.d.ts +4 -0
  117. package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
  118. package/dist/realtime/realtime-client-session-service.js +15 -6
  119. package/dist/realtime/realtime-client-session-service.js.map +1 -1
  120. package/dist/realtime/realtime-coagent-config.d.ts +2 -0
  121. package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
  122. package/dist/realtime/realtime-coagent-config.js +6 -2
  123. package/dist/realtime/realtime-coagent-config.js.map +1 -1
  124. package/dist/realtime/realtime-recording-store.d.ts +15 -0
  125. package/dist/realtime/realtime-recording-store.d.ts.map +1 -1
  126. package/dist/realtime/realtime-recording-store.js +31 -7
  127. package/dist/realtime/realtime-recording-store.js.map +1 -1
  128. package/dist/realtime/realtime-session-runner.d.ts +4 -4
  129. package/dist/realtime/realtime-session-runner.js +9 -9
  130. package/dist/realtime/realtime-session-runner.js.map +1 -1
  131. package/dist/runtime-state-fragment.d.ts +101 -0
  132. package/dist/runtime-state-fragment.d.ts.map +1 -0
  133. package/dist/runtime-state-fragment.js +173 -0
  134. package/dist/runtime-state-fragment.js.map +1 -0
  135. package/dist/types/payload-operations.d.ts +8 -0
  136. package/dist/types/payload-operations.d.ts.map +1 -1
  137. package/dist/types/payload-operations.js +21 -5
  138. package/dist/types/payload-operations.js.map +1 -1
  139. package/dist/utils/ConversationMessageResolver.d.ts +4 -0
  140. package/dist/utils/ConversationMessageResolver.d.ts.map +1 -1
  141. package/dist/utils/ConversationMessageResolver.js +10 -2
  142. package/dist/utils/ConversationMessageResolver.js.map +1 -1
  143. package/dist/volatile-child-prompt.d.ts +33 -0
  144. package/dist/volatile-child-prompt.d.ts.map +1 -0
  145. package/dist/volatile-child-prompt.js +76 -0
  146. package/dist/volatile-child-prompt.js.map +1 -0
  147. package/package.json +20 -18
@@ -153,7 +153,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
153
153
  * Create an agent run step record for observability.
154
154
  * Returns null if agentRunID is not set (defensive check).
155
155
  */
156
- async CreateRunStep(stepType, stepName, inputData, targetId) {
156
+ async createRunStep(stepType, stepName, inputData, targetId) {
157
157
  if (!this._agentRunID || !this._contextUser) {
158
158
  return null;
159
159
  }
@@ -188,7 +188,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
188
188
  /**
189
189
  * Finalize an agent run step with success/failure status and output data.
190
190
  */
191
- async FinalizeRunStep(step, success, outputData, targetLogId, errorMessage) {
191
+ async finalizeRunStep(step, success, outputData, targetLogId, errorMessage) {
192
192
  if (!step) {
193
193
  return;
194
194
  }
@@ -217,7 +217,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
217
217
  * Get the last run timestamp for this agent to determine what to process.
218
218
  * For first run, returns null to process all history (limited by MaxRows).
219
219
  */
220
- async GetLastRunTime(agentId, contextUser) {
220
+ async getLastRunTime(agentId, contextUser) {
221
221
  // Read-only: we only need StartedAt, so use a 'simple' projection with a narrow Fields
222
222
  // list. Loading this as 'entity_object' would build a full MJAIAgentRunEntityExtended,
223
223
  // whose InnerLoad fires a secondary "MJ: AI Agent Run Steps" RunView (LoadRelatedData) —
@@ -263,7 +263,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
263
263
  * Load agents that have note or example injection enabled.
264
264
  * Only extract notes/examples for agents that actually use these features.
265
265
  */
266
- async LoadAgentsUsingMemory(contextUser) {
266
+ async loadAgentsUsingMemory(contextUser) {
267
267
  const allAgents = AIEngine.Instance.Agents;
268
268
  const filteredAgents = allAgents.filter(a => a.Status === 'Active' && (a.InjectNotes || a.InjectExamples));
269
269
  // Debug logging only in verbose mode
@@ -290,7 +290,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
290
290
  * Uses a single optimized RunQuery that replaces 4 separate database queries.
291
291
  * Returns conversations with their details, ratings, and agent run IDs for scope inheritance.
292
292
  */
293
- async LoadConversationsWithNewActivity(since, agentsUsingMemory, contextUser) {
293
+ async loadConversationsWithNewActivity(since, agentsUsingMemory, contextUser) {
294
294
  if (agentsUsingMemory.length === 0) {
295
295
  LogStatus('Memory Manager: No agents have memory injection enabled - skipping');
296
296
  return [];
@@ -362,7 +362,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
362
362
  * secondary "MJ: AI Agent Run Steps" RunView via InnerLoad/LoadRelatedData — exactly the
363
363
  * redundant round-trips the telemetry flagged. The simple projection skips all of them.
364
364
  */
365
- async LoadHighValueAgentRuns(since, contextUser) {
365
+ async loadHighValueAgentRuns(since, contextUser) {
366
366
  const rv = new RunView();
367
367
  // Use subquery to find agent runs with high-usage artifacts
368
368
  const sinceFilter = since ? `AND au.__mj_CreatedAt >= '${since.toISOString()}'` : '';
@@ -415,7 +415,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
415
415
  * matching the high-value loader's lightweight projection. The confidence gate (≥80) downstream
416
416
  * discards transient/low-signal failures that carry no generalizable lesson.
417
417
  */
418
- async LoadInstructiveFailedAgentRuns(since, contextUser) {
418
+ async loadInstructiveFailedAgentRuns(since, contextUser) {
419
419
  const rv = new RunView();
420
420
  const sinceFilter = since ? ` AND __mj_CreatedAt >= '${since.toISOString()}'` : '';
421
421
  const filter = `((Status IN ('Failed', 'Cancelled') AND ErrorMessage IS NOT NULL) OR (Success = 0 AND Status NOT IN ('Running', 'Paused')))${sinceFilter}`;
@@ -434,7 +434,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
434
434
  * This is the primary method that handles rated, unrated, positive, and negative feedback.
435
435
  * Uses LLM-based deduplication and applies sparsity controls.
436
436
  */
437
- async ExtractNotesFromConversations(conversations, contextUser) {
437
+ async extractNotesFromConversations(conversations, contextUser) {
438
438
  if (conversations.length === 0) {
439
439
  return [];
440
440
  }
@@ -477,7 +477,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
477
477
  * to the corrective note types (Issue/Context only, never Constraint/Preference/Example) and
478
478
  * tagged 'Ephemeral' so a one-off transient failure decays unless reinforced by recurrence.
479
479
  */
480
- async ExtractNotesFromFailedRuns(failedRuns, contextUser) {
480
+ async extractNotesFromFailedRuns(failedRuns, contextUser) {
481
481
  if (failedRuns.length === 0) {
482
482
  return [];
483
483
  }
@@ -592,7 +592,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
592
592
  return null;
593
593
  const conversationThreads = promptData.conversationThreads;
594
594
  this.logExtractionPromptContext(prompt, conversationThreads);
595
- const step = await this.CreateRunStep('Prompt', 'Extract Notes from Conversations', {
595
+ const step = await this.createRunStep('Prompt', 'Extract Notes from Conversations', {
596
596
  conversationCount: conversationThreads.length,
597
597
  messageCount: conversationThreads.reduce((sum, t) => sum + t.messages.length, 0),
598
598
  existingNoteCount
@@ -605,7 +605,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
605
605
  params.attemptJSONRepair = true;
606
606
  params.additionalParameters = DETERMINISTIC_PROMPT_PARAMS;
607
607
  const result = await runner.ExecutePrompt(params);
608
- await this.FinalizeRunStep(step, result.success, {
608
+ await this.finalizeRunStep(step, result.success, {
609
609
  success: result.success,
610
610
  rawNoteCount: result.result && typeof result.result !== 'string' ? (result.result.notes?.length || 0) : 0
611
611
  }, result.promptRun?.ID, result.errorMessage || undefined);
@@ -731,7 +731,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
731
731
  * replacing). Creates and finalizes its own observability run step.
732
732
  */
733
733
  async deduplicateCandidates(candidates, existingNotes, contextUser) {
734
- const step = await this.CreateRunStep('Decision', 'Deduplicate Note Candidates', {
734
+ const step = await this.createRunStep('Decision', 'Deduplicate Note Candidates', {
735
735
  candidateCount: candidates.length,
736
736
  existingNoteCount: existingNotes.length
737
737
  });
@@ -750,7 +750,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
750
750
  approved.push(candidate);
751
751
  }
752
752
  }
753
- await this.FinalizeRunStep(step, true, {
753
+ await this.finalizeRunStep(step, true, {
754
754
  approvedCount: approved.length,
755
755
  rejectedCount: stats.rejectedCount,
756
756
  llmCallCount: stats.llmCallCount
@@ -855,7 +855,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
855
855
  * Extract examples from conversation details with high ratings.
856
856
  * Uses LLM-based deduplication to avoid adding redundant examples.
857
857
  */
858
- async ExtractExamples(conversationDetails, contextUser) {
858
+ async extractExamples(conversationDetails, contextUser) {
859
859
  if (conversationDetails.length === 0) {
860
860
  return [];
861
861
  }
@@ -874,7 +874,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
874
874
  return [];
875
875
  }
876
876
  // Step 5: Execute AI extraction
877
- const step5 = await this.CreateRunStep('Prompt', 'Extract Examples from Conversations', {
877
+ const step5 = await this.createRunStep('Prompt', 'Extract Examples from Conversations', {
878
878
  qaPairCount: qaPairs.length
879
879
  }, extractPrompt.ID);
880
880
  const runner = new AIPromptRunner();
@@ -886,7 +886,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
886
886
  extractParams.additionalParameters = { temperature: 0 };
887
887
  const extractResult = await runner.ExecutePrompt(extractParams);
888
888
  if (!extractResult.success || !extractResult.result) {
889
- await this.FinalizeRunStep(step5, false, {
889
+ await this.finalizeRunStep(step5, false, {
890
890
  success: false
891
891
  }, extractResult.promptRun?.ID, extractResult.errorMessage || undefined);
892
892
  LogError('Failed to extract examples:', extractResult.errorMessage);
@@ -909,7 +909,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
909
909
  const candidateExamples = (parsedResult.examples || [])
910
910
  .filter(e => e.successScore >= 70 && e.confidence >= 70);
911
911
  // Finalize Step 5 after extraction parsing
912
- await this.FinalizeRunStep(step5, true, {
912
+ await this.finalizeRunStep(step5, true, {
913
913
  rawExampleCount: parsedResult.examples?.length || 0,
914
914
  candidateCount: candidateExamples.length
915
915
  }, extractResult.promptRun?.ID);
@@ -917,7 +917,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
917
917
  return [];
918
918
  }
919
919
  // Step 6: Deduplicate example candidates (summary step)
920
- const step6 = await this.CreateRunStep('Decision', 'Deduplicate Example Candidates', {
920
+ const step6 = await this.createRunStep('Decision', 'Deduplicate Example Candidates', {
921
921
  candidateCount: candidateExamples.length
922
922
  });
923
923
  const approvedExamples = [];
@@ -967,7 +967,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
967
967
  }
968
968
  }
969
969
  // Finalize Step 6 after deduplication loop
970
- await this.FinalizeRunStep(step6, true, {
970
+ await this.finalizeRunStep(step6, true, {
971
971
  approvedCount: approvedExamples.length,
972
972
  rejectedCount: exampleDedupeRejectedCount,
973
973
  llmCallCount: exampleDedupeLlmCallCount
@@ -978,9 +978,9 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
978
978
  * Create note records from extracted data.
979
979
  * Inherits scope from source agent run and applies scopeLevel to determine scope specificity.
980
980
  */
981
- async CreateNoteRecords(extractedNotes, contextUser) {
981
+ async createNoteRecords(extractedNotes, contextUser) {
982
982
  // Step 7: Create Note Records
983
- const step7 = await this.CreateRunStep('Decision', 'Create Note Records', {
983
+ const step7 = await this.createRunStep('Decision', 'Create Note Records', {
984
984
  noteCount: extractedNotes.length
985
985
  });
986
986
  let created = 0;
@@ -993,7 +993,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
993
993
  const aiNoteTypeId = AIEngine.Instance.AgenteNoteTypeIDByName('AI');
994
994
  if (!aiNoteTypeId) {
995
995
  LogError('Memory Manager: Could not find "AI" note type - cannot create notes');
996
- await this.FinalizeRunStep(step7, false, {
996
+ await this.finalizeRunStep(step7, false, {
997
997
  created: 0,
998
998
  merged: 0,
999
999
  failed: extractedNotes.length
@@ -1108,7 +1108,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
1108
1108
  }
1109
1109
  }
1110
1110
  // Finalize Step 7
1111
- await this.FinalizeRunStep(step7, failed === 0 || created > 0 || merged > 0, {
1111
+ await this.finalizeRunStep(step7, failed === 0 || created > 0 || merged > 0, {
1112
1112
  created,
1113
1113
  merged,
1114
1114
  failed
@@ -1865,7 +1865,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
1865
1865
  */
1866
1866
  async processConsolidationCluster(cluster, consolidatePrompt, aiNoteTypeId, runner, md, contextUser) {
1867
1867
  const maxGeneration = Math.max(...cluster.map(n => n.ConsolidationCount || 0));
1868
- const clusterStep = await this.CreateRunStep('Prompt', 'Process Consolidation Cluster', {
1868
+ const clusterStep = await this.createRunStep('Prompt', 'Process Consolidation Cluster', {
1869
1869
  clusterSize: cluster.length,
1870
1870
  noteIds: cluster.map(n => n.ID),
1871
1871
  maxGeneration
@@ -1918,7 +1918,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
1918
1918
  finally {
1919
1919
  // Treat skip (shouldConsolidate: false) as a successful completion rather than a
1920
1920
  // failure — the phase intentionally chose not to consolidate this cluster.
1921
- await this.FinalizeRunStep(clusterStep, outcome.consolidated === 1 || stepOutput.shouldConsolidate === false, stepOutput);
1921
+ await this.finalizeRunStep(clusterStep, outcome.consolidated === 1 || stepOutput.shouldConsolidate === false, stepOutput);
1922
1922
  }
1923
1923
  }
1924
1924
  /**
@@ -2523,7 +2523,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2523
2523
  */
2524
2524
  async runHardeningPhase(contextUser) {
2525
2525
  const counters = { hardened: 0, deduped: 0, failed: 0 };
2526
- const step = await this.CreateRunStep('Decision', 'Harden Provisional Notes', {
2526
+ const step = await this.createRunStep('Decision', 'Harden Provisional Notes', {
2527
2527
  maxNotesPerRun: HARDENING_CONFIG.maxNotesPerRun
2528
2528
  });
2529
2529
  try {
@@ -2541,7 +2541,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2541
2541
  .sort((a, b) => new Date(a.__mj_CreatedAt).getTime() - new Date(b.__mj_CreatedAt).getTime())
2542
2542
  .slice(0, HARDENING_CONFIG.maxNotesPerRun);
2543
2543
  if (provisionalNotes.length === 0) {
2544
- await this.FinalizeRunStep(step, true, { ...counters, provisionalCount: 0 });
2544
+ await this.finalizeRunStep(step, true, { ...counters, provisionalCount: 0 });
2545
2545
  return counters;
2546
2546
  }
2547
2547
  const runner = new AIPromptRunner();
@@ -2553,11 +2553,11 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2553
2553
  if (this._verbose) {
2554
2554
  LogStatus(`Memory Manager: Hardening pass — ${counters.hardened} hardened, ${counters.deduped} deduped, ${counters.failed} failed of ${provisionalNotes.length} provisional notes`);
2555
2555
  }
2556
- await this.FinalizeRunStep(step, counters.failed === 0, { ...counters, provisionalCount: provisionalNotes.length });
2556
+ await this.finalizeRunStep(step, counters.failed === 0, { ...counters, provisionalCount: provisionalNotes.length });
2557
2557
  }
2558
2558
  catch (error) {
2559
2559
  LogError('Memory Manager: Hardening pass failed, continuing with run:', error);
2560
- await this.FinalizeRunStep(step, false, counters, undefined, error instanceof Error ? error.message : String(error));
2560
+ await this.finalizeRunStep(step, false, counters, undefined, error instanceof Error ? error.message : String(error));
2561
2561
  }
2562
2562
  return counters;
2563
2563
  }
@@ -2634,7 +2634,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2634
2634
  return r;
2635
2635
  }
2636
2636
  async runImportancePhase(r, contextUser) {
2637
- const importanceStep = await this.CreateRunStep('Decision', 'Compute Importance Scores', {
2637
+ const importanceStep = await this.createRunStep('Decision', 'Compute Importance Scores', {
2638
2638
  activeNoteCount: AIEngine.Instance.AgentNotes.filter(n => n.Status === 'Active').length
2639
2639
  });
2640
2640
  try {
@@ -2643,7 +2643,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2643
2643
  r.tierPromotions = scoringResult.tierPromotions;
2644
2644
  if (this._verbose)
2645
2645
  LogStatus(`Memory Manager: Scored ${r.importanceScored} notes, ${r.tierPromotions} tier promotions`);
2646
- await this.FinalizeRunStep(importanceStep, true, {
2646
+ await this.finalizeRunStep(importanceStep, true, {
2647
2647
  notesScored: r.importanceScored,
2648
2648
  tierPromotions: r.tierPromotions,
2649
2649
  scoreDistribution: scoringResult.scoreDistribution
@@ -2651,12 +2651,12 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2651
2651
  }
2652
2652
  catch (error) {
2653
2653
  LogError('Memory Manager: Importance scoring failed, continuing with other phases:', error);
2654
- await this.FinalizeRunStep(importanceStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2654
+ await this.finalizeRunStep(importanceStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2655
2655
  }
2656
2656
  }
2657
2657
  async runConsolidationPhase(r, contextUser, triggerType) {
2658
2658
  const consolidatedNoteIds = new Set();
2659
- const consolidationStep = await this.CreateRunStep('Decision', 'Consolidate Related Notes', {
2659
+ const consolidationStep = await this.createRunStep('Decision', 'Consolidate Related Notes', {
2660
2660
  frequency: CONSOLIDATION_CONFIG.frequency,
2661
2661
  triggerType,
2662
2662
  activeNoteCount: AIEngine.Instance.AgentNotes.filter(n => n.Status === 'Active' && n.IsAutoGenerated).length
@@ -2671,7 +2671,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2671
2671
  if (r.consolidatedCount > 0 && this._verbose) {
2672
2672
  LogStatus(`Memory Manager: Consolidated ${r.consolidatedCount} clusters, archived ${r.consolidationArchived} source notes`);
2673
2673
  }
2674
- await this.FinalizeRunStep(consolidationStep, true, {
2674
+ await this.finalizeRunStep(consolidationStep, true, {
2675
2675
  consolidatedClusterCount: r.consolidatedCount,
2676
2676
  sourceNotesArchived: r.consolidationArchived,
2677
2677
  newConsolidatedNoteIds: Array.from(consolidatedNoteIds)
@@ -2679,7 +2679,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2679
2679
  }
2680
2680
  catch (error) {
2681
2681
  LogError('Memory Manager: Consolidation failed, continuing with other phases:', error);
2682
- await this.FinalizeRunStep(consolidationStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2682
+ await this.finalizeRunStep(consolidationStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2683
2683
  }
2684
2684
  // Emit the phase-level verification run step (spec Task 8c). Runs whether or not
2685
2685
  // any clusters were consolidated so "no items" runs still produce a visible step.
@@ -2688,14 +2688,14 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2688
2688
  }
2689
2689
  /** Aggregate per-cluster verification results into a single phase-level run step. */
2690
2690
  async emitVerificationRunStep(verifications) {
2691
- const verificationStep = await this.CreateRunStep('Validation', 'Verify Consolidation Output', {
2691
+ const verificationStep = await this.createRunStep('Validation', 'Verify Consolidation Output', {
2692
2692
  clustersVerified: verifications.length
2693
2693
  });
2694
2694
  const verificationsFlagged = verifications.filter(v => !v.passed).length;
2695
2695
  const verificationsPassed = verifications.filter(v => v.passed).length;
2696
2696
  const entitiesChecked = verifications.reduce((sum, v) => sum + v.entitiesChecked, 0);
2697
2697
  const entitiesMissing = verifications.flatMap(v => v.entitiesMissing);
2698
- await this.FinalizeRunStep(verificationStep, true, {
2698
+ await this.finalizeRunStep(verificationStep, true, {
2699
2699
  clustersVerified: verifications.length,
2700
2700
  entitiesChecked,
2701
2701
  entitiesMissing,
@@ -2704,7 +2704,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2704
2704
  });
2705
2705
  }
2706
2706
  async runContradictionPhase(r, contextUser, consolidatedNoteIds) {
2707
- const contradictionStep = await this.CreateRunStep('Decision', 'Detect Note Contradictions', {
2707
+ const contradictionStep = await this.createRunStep('Decision', 'Detect Note Contradictions', {
2708
2708
  consolidatedNoteIdsCount: consolidatedNoteIds.size
2709
2709
  });
2710
2710
  try {
@@ -2715,7 +2715,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2715
2715
  if (r.contradictionsFound > 0 && this._verbose) {
2716
2716
  LogStatus(`Memory Manager: Found ${r.contradictionsFound} contradictions — resolved ${r.contradictionsResolved}, flagged ${r.contradictionsFlagged}`);
2717
2717
  }
2718
- await this.FinalizeRunStep(contradictionStep, true, {
2718
+ await this.finalizeRunStep(contradictionStep, true, {
2719
2719
  pairsAnalyzed: contradictionResult.pairsAnalyzed,
2720
2720
  contradictionsFound: r.contradictionsFound,
2721
2721
  contradictionsResolved: r.contradictionsResolved,
@@ -2725,7 +2725,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2725
2725
  }
2726
2726
  catch (error) {
2727
2727
  LogError('Memory Manager: Contradiction detection failed, continuing with other phases:', error);
2728
- await this.FinalizeRunStep(contradictionStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2728
+ await this.finalizeRunStep(contradictionStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2729
2729
  }
2730
2730
  }
2731
2731
  /**
@@ -2733,8 +2733,8 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2733
2733
  * doesn't block the other.
2734
2734
  */
2735
2735
  async runPruneAndDecayPhases(r, contextUser) {
2736
- const pruneStep = await this.CreateRunStep('Decision', 'Prune Stale References', {});
2737
- const decayStep = await this.CreateRunStep('Decision', 'Decay-Based Archival', {});
2736
+ const pruneStep = await this.createRunStep('Decision', 'Prune Stale References', {});
2737
+ const decayStep = await this.createRunStep('Decision', 'Decay-Based Archival', {});
2738
2738
  await Promise.allSettled([
2739
2739
  this.runPrunePhase(r, contextUser, pruneStep),
2740
2740
  this.runDecayPhase(r, contextUser, decayStep),
@@ -2747,7 +2747,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2747
2747
  if (r.staleNotesArchived > 0 && this._verbose) {
2748
2748
  LogStatus(`Memory Manager: Pruned ${r.staleNotesArchived} orphaned notes`);
2749
2749
  }
2750
- await this.FinalizeRunStep(pruneStep, true, {
2750
+ await this.finalizeRunStep(pruneStep, true, {
2751
2751
  notesArchived: r.staleNotesArchived,
2752
2752
  orphanedAgents: pruneResult.orphanedAgents,
2753
2753
  orphanedUsers: pruneResult.orphanedUsers,
@@ -2757,7 +2757,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2757
2757
  }
2758
2758
  catch (error) {
2759
2759
  LogError('Memory Manager: Stale reference pruning failed:', error);
2760
- await this.FinalizeRunStep(pruneStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2760
+ await this.finalizeRunStep(pruneStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2761
2761
  }
2762
2762
  }
2763
2763
  async runDecayPhase(r, contextUser, decayStep) {
@@ -2769,7 +2769,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2769
2769
  if (totalDecayArchived > 0 && this._verbose) {
2770
2770
  LogStatus(`Memory Manager: Decay archival — ${decayResult.notesArchived} notes, ${decayResult.examplesArchived} examples, ${decayResult.notesExpired} expired notes, ${decayResult.examplesExpired} expired examples`);
2771
2771
  }
2772
- await this.FinalizeRunStep(decayStep, true, {
2772
+ await this.finalizeRunStep(decayStep, true, {
2773
2773
  notesArchived: decayResult.notesArchived,
2774
2774
  examplesArchived: decayResult.examplesArchived,
2775
2775
  notesExpired: decayResult.notesExpired,
@@ -2781,7 +2781,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2781
2781
  }
2782
2782
  catch (error) {
2783
2783
  LogError('Memory Manager: Decay-based archival failed:', error);
2784
- await this.FinalizeRunStep(decayStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2784
+ await this.finalizeRunStep(decayStep, false, undefined, undefined, error instanceof Error ? error.message : String(error));
2785
2785
  }
2786
2786
  }
2787
2787
  /** Build a human-readable summary string from maintenance phase results. */
@@ -2803,9 +2803,9 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2803
2803
  * Create example records from extracted data.
2804
2804
  * Inherits scope from source agent run and applies scopeLevel to determine scope specificity.
2805
2805
  */
2806
- async CreateExampleRecords(extractedExamples, contextUser) {
2806
+ async createExampleRecords(extractedExamples, contextUser) {
2807
2807
  // Step 8: Create Example Records
2808
- const step8 = await this.CreateRunStep('Decision', 'Create Example Records', {
2808
+ const step8 = await this.createRunStep('Decision', 'Create Example Records', {
2809
2809
  exampleCount: extractedExamples.length
2810
2810
  });
2811
2811
  let created = 0;
@@ -2879,7 +2879,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2879
2879
  }
2880
2880
  }
2881
2881
  // Finalize Step 8
2882
- await this.FinalizeRunStep(step8, failed === 0 || created > 0, {
2882
+ await this.finalizeRunStep(step8, failed === 0 || created > 0, {
2883
2883
  created,
2884
2884
  skipped,
2885
2885
  failed
@@ -2903,8 +2903,8 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2903
2903
  // Phase 1: the last-run-time and the memory-enabled agent set are independent — load in
2904
2904
  // parallel (avoids two back-to-back sequential RunViews flagged by the parallelization telemetry).
2905
2905
  const [lastRunTime, agentsUsingMemory] = await Promise.all([
2906
- this.GetLastRunTime(params.agent.ID, params.contextUser),
2907
- this.LoadAgentsUsingMemory(params.contextUser)
2906
+ this.getLastRunTime(params.agent.ID, params.contextUser),
2907
+ this.loadAgentsUsingMemory(params.contextUser)
2908
2908
  ]);
2909
2909
  if (this._verbose) {
2910
2910
  const sinceMessage = lastRunTime ? `since ${lastRunTime.toISOString()}` : 'all history';
@@ -2922,34 +2922,34 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2922
2922
  // Phase 2: conversations-with-new-activity and high-value agent runs both depend only on
2923
2923
  // (lastRunTime, agentsUsingMemory) — never on each other — so load them in parallel, each
2924
2924
  // recorded in its own run step.
2925
- const step1 = await this.CreateRunStep('Decision', 'Load Conversations With New Activity', {
2925
+ const step1 = await this.createRunStep('Decision', 'Load Conversations With New Activity', {
2926
2926
  since: lastRunTime?.toISOString() || null,
2927
2927
  agentCount: agentsUsingMemory.length,
2928
2928
  agentIds: agentsUsingMemory.map(a => a.ID)
2929
2929
  });
2930
- const step2 = await this.CreateRunStep('Decision', 'Load High-Value Agent Runs', {
2930
+ const step2 = await this.createRunStep('Decision', 'Load High-Value Agent Runs', {
2931
2931
  since: lastRunTime?.toISOString() || null
2932
2932
  });
2933
- const step3 = await this.CreateRunStep('Decision', 'Load Instructive Failed Agent Runs', {
2933
+ const step3 = await this.createRunStep('Decision', 'Load Instructive Failed Agent Runs', {
2934
2934
  since: lastRunTime?.toISOString() || null
2935
2935
  });
2936
2936
  const [conversations, agentRuns, failedRuns] = await Promise.all([
2937
- this.LoadConversationsWithNewActivity(lastRunTime, agentsUsingMemory, params.contextUser),
2938
- this.LoadHighValueAgentRuns(lastRunTime, params.contextUser),
2939
- this.LoadInstructiveFailedAgentRuns(lastRunTime, params.contextUser)
2937
+ this.loadConversationsWithNewActivity(lastRunTime, agentsUsingMemory, params.contextUser),
2938
+ this.loadHighValueAgentRuns(lastRunTime, params.contextUser),
2939
+ this.loadInstructiveFailedAgentRuns(lastRunTime, params.contextUser)
2940
2940
  ]);
2941
2941
  const totalMessages = conversations.reduce((sum, c) => sum + c.messages.length, 0);
2942
- await this.FinalizeRunStep(step1, true, {
2942
+ await this.finalizeRunStep(step1, true, {
2943
2943
  conversationCount: conversations.length,
2944
2944
  totalMessages,
2945
2945
  positiveCount: conversations.filter(c => c.hasPositiveRating).length,
2946
2946
  negativeCount: conversations.filter(c => c.hasNegativeRating).length,
2947
2947
  unratedCount: conversations.filter(c => c.isUnrated).length
2948
2948
  });
2949
- await this.FinalizeRunStep(step2, true, {
2949
+ await this.finalizeRunStep(step2, true, {
2950
2950
  runCount: agentRuns.length
2951
2951
  });
2952
- await this.FinalizeRunStep(step3, true, {
2952
+ await this.finalizeRunStep(step3, true, {
2953
2953
  runCount: failedRuns.length
2954
2954
  });
2955
2955
  if (this._verbose) {
@@ -2968,12 +2968,12 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2968
2968
  let notesCreated = 0;
2969
2969
  let examplesCreated = 0;
2970
2970
  if (hasNewData) {
2971
- const extractedNotes = await this.ExtractNotesFromConversations(conversations, params.contextUser);
2971
+ const extractedNotes = await this.extractNotesFromConversations(conversations, params.contextUser);
2972
2972
  if (this._verbose) {
2973
2973
  LogStatus(`Memory Manager: Extracted ${extractedNotes.length} potential notes`);
2974
2974
  }
2975
2975
  // Mine corrective notes from failed runs (Issue/Context only, Ephemeral tier).
2976
- const correctiveNotes = await this.ExtractNotesFromFailedRuns(failedRuns, params.contextUser);
2976
+ const correctiveNotes = await this.extractNotesFromFailedRuns(failedRuns, params.contextUser);
2977
2977
  if (this._verbose) {
2978
2978
  LogStatus(`Memory Manager: Extracted ${correctiveNotes.length} corrective notes from failed runs`);
2979
2979
  }
@@ -2987,7 +2987,7 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
2987
2987
  Message: msg.message,
2988
2988
  __mj_CreatedAt: msg.createdAt
2989
2989
  })));
2990
- const extractedExamples = await this.ExtractExamples(conversationDetails, params.contextUser);
2990
+ const extractedExamples = await this.extractExamples(conversationDetails, params.contextUser);
2991
2991
  if (this._verbose) {
2992
2992
  LogStatus(`Memory Manager: Extracted ${extractedExamples.length} potential examples`);
2993
2993
  }
@@ -3024,8 +3024,8 @@ let MemoryManagerAgent = MemoryManagerAgent_1 = class MemoryManagerAgent extends
3024
3024
  example.agentId = '';
3025
3025
  }
3026
3026
  }
3027
- notesCreated = await this.CreateNoteRecords([...extractedNotes, ...correctiveNotes], params.contextUser);
3028
- examplesCreated = await this.CreateExampleRecords(extractedExamples, params.contextUser);
3027
+ notesCreated = await this.createNoteRecords([...extractedNotes, ...correctiveNotes], params.contextUser);
3028
+ examplesCreated = await this.createExampleRecords(extractedExamples, params.contextUser);
3029
3029
  if (this._verbose)
3030
3030
  LogStatus(`Memory Manager: Created ${notesCreated} notes and ${examplesCreated} examples`);
3031
3031
  }
@@ -54,6 +54,8 @@ export declare const MAX_TOOL_DESCRIPTION_LENGTH = 1024;
54
54
  * the Action that produced it; the collision check lives in {@link buildActionToolSet} rather than
55
55
  * here, so this stays a pure function of the name.
56
56
  */
57
+ export declare function SanitizeToolName(actionName: string): string;
58
+ /** @deprecated Use {@link SanitizeToolName}. */
57
59
  export declare function sanitizeToolName(actionName: string): string;
58
60
  /**
59
61
  * Builds the `ChatTool` declaration for one Action.
@@ -61,6 +63,8 @@ export declare function sanitizeToolName(actionName: string): string;
61
63
  * Only `Input` and `Both` params are declared: an `Output` param is something the Action returns,
62
64
  * and declaring it would invite the model to supply it.
63
65
  */
66
+ export declare function BuildToolFromAction(action: MJActionEntityExtended, params: readonly MJActionParamEntity[]): ChatTool;
67
+ /** @deprecated Use {@link BuildToolFromAction}. */
64
68
  export declare function buildToolFromAction(action: MJActionEntityExtended, params: readonly MJActionParamEntity[]): ChatTool;
65
69
  /**
66
70
  * Builds the full tool set for an agent's available Actions, with the reverse map.
@@ -71,6 +75,8 @@ export declare function buildToolFromAction(action: MJActionEntityExtended, para
71
75
  * looks like a model error and would be found, if at all, by someone reading eval failures.
72
76
  * Failing at build time turns it into a metadata problem with a name attached.
73
77
  */
78
+ export declare function BuildActionToolSet(actions: readonly MJActionEntityExtended[], paramsByActionId: ReadonlyMap<string, readonly MJActionParamEntity[]>): ActionToolSet;
79
+ /** @deprecated Use {@link BuildActionToolSet}. */
74
80
  export declare function buildActionToolSet(actions: readonly MJActionEntityExtended[], paramsByActionId: ReadonlyMap<string, readonly MJActionParamEntity[]>): ActionToolSet;
75
81
  /** The two fields of an `MJ: AI Agent Actions` row that declaration control reads. */
76
82
  export interface AgentActionDeclarationRow {
@@ -88,5 +94,7 @@ export interface AgentActionDeclarationRow {
88
94
  * Note the consequence the design accepts: in native mode the prose catalog is not rendered, so an
89
95
  * action removed here is unreachable on that turn, not merely de-emphasised.
90
96
  */
97
+ export declare function FilterDeclarableActions(actions: readonly MJActionEntityExtended[], agentActionRows: ReadonlyArray<AgentActionDeclarationRow>): MJActionEntityExtended[];
98
+ /** @deprecated Use {@link FilterDeclarableActions}. */
91
99
  export declare function filterDeclarableActions(actions: readonly MJActionEntityExtended[], agentActionRows: ReadonlyArray<AgentActionDeclarationRow>): MJActionEntityExtended[];
92
100
  //# sourceMappingURL=action-tool-builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-tool-builder.d.ts","sourceRoot":"","sources":["../../src/native-tools/action-tool-builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAC9B,gFAAgF;IAChF,IAAI,EAAE,QAAQ,CAAC;IACf,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,MAAM,EAAE,sBAAsB,CAAC;IAC/B,IAAI,EAAE,QAAQ,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,wCAAwC;IACxC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC9C;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAKhD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO3D;AAwHD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,SAAS,mBAAmB,EAAE,GAAG,QAAQ,CA4BpH;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAC1C,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,GACtE,aAAa,CAqBf;AAED,sFAAsF;AACtF,MAAM,WAAW,yBAAyB;IACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAC1C,eAAe,EAAE,aAAa,CAAC,yBAAyB,CAAC,GAC1D,sBAAsB,EAAE,CAO1B"}
1
+ {"version":3,"file":"action-tool-builder.d.ts","sourceRoot":"","sources":["../../src/native-tools/action-tool-builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAC9B,gFAAgF;IAChF,IAAI,EAAE,QAAQ,CAAC;IACf,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,MAAM,EAAE,sBAAsB,CAAC;IAC/B,IAAI,EAAE,QAAQ,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,wCAAwC;IACxC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC9C;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAKhD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3D;AAwHD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,SAAS,mBAAmB,EAAE,GAAG,QAAQ,CA4BpH;AAED,mDAAmD;AACnD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,SAAS,mBAAmB,EAAE,GAAG,QAAQ,CAEpH;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAC1C,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,GACtE,aAAa,CAqBf;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAC1C,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,GACtE,aAAa,CAEf;AAED,sFAAsF;AACtF,MAAM,WAAW,yBAAyB;IACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAC1C,eAAe,EAAE,aAAa,CAAC,yBAAyB,CAAC,GAC1D,sBAAsB,EAAE,CAO1B;AAED,uDAAuD;AACvD,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAC1C,eAAe,EAAE,aAAa,CAAC,yBAAyB,CAAC,GAC1D,sBAAsB,EAAE,CAE1B"}
@@ -33,7 +33,7 @@ const DESCRIPTION_DETAIL_LEVELS = [160, 110, 70, 40, 0];
33
33
  * the Action that produced it; the collision check lives in {@link buildActionToolSet} rather than
34
34
  * here, so this stays a pure function of the name.
35
35
  */
36
- export function sanitizeToolName(actionName) {
36
+ export function SanitizeToolName(actionName) {
37
37
  return actionName
38
38
  .trim()
39
39
  .replace(/[^a-zA-Z0-9]+/g, '_')
@@ -41,6 +41,10 @@ export function sanitizeToolName(actionName) {
41
41
  .toLowerCase()
42
42
  .slice(0, MAX_TOOL_NAME_LENGTH);
43
43
  }
44
+ /** @deprecated Use {@link SanitizeToolName}. */
45
+ export function sanitizeToolName(actionName) {
46
+ return SanitizeToolName(actionName);
47
+ }
44
48
  /**
45
49
  * Maps one param's `ValueType` onto a JSON Schema fragment (§8.2 table).
46
50
  *
@@ -153,7 +157,7 @@ function describeTool(action, params) {
153
157
  * Only `Input` and `Both` params are declared: an `Output` param is something the Action returns,
154
158
  * and declaring it would invite the model to supply it.
155
159
  */
156
- export function buildToolFromAction(action, params) {
160
+ export function BuildToolFromAction(action, params) {
157
161
  const properties = {};
158
162
  const required = [];
159
163
  for (const param of params) {
@@ -174,11 +178,15 @@ export function buildToolFromAction(action, params) {
174
178
  inputSchema.required = required;
175
179
  }
176
180
  return {
177
- name: sanitizeToolName(action.Name),
181
+ name: SanitizeToolName(action.Name),
178
182
  description: describeTool(action, params),
179
183
  inputSchema
180
184
  };
181
185
  }
186
+ /** @deprecated Use {@link BuildToolFromAction}. */
187
+ export function buildToolFromAction(action, params) {
188
+ return BuildToolFromAction(action, params);
189
+ }
182
190
  /**
183
191
  * Builds the full tool set for an agent's available Actions, with the reverse map.
184
192
  *
@@ -188,11 +196,11 @@ export function buildToolFromAction(action, params) {
188
196
  * looks like a model error and would be found, if at all, by someone reading eval failures.
189
197
  * Failing at build time turns it into a metadata problem with a name attached.
190
198
  */
191
- export function buildActionToolSet(actions, paramsByActionId) {
199
+ export function BuildActionToolSet(actions, paramsByActionId) {
192
200
  const byToolName = new Map();
193
201
  const tools = [];
194
202
  for (const action of actions) {
195
- const tool = buildToolFromAction(action, paramsByActionId.get(action.ID) ?? []);
203
+ const tool = BuildToolFromAction(action, paramsByActionId.get(action.ID) ?? []);
196
204
  const existing = byToolName.get(tool.name);
197
205
  if (existing) {
198
206
  throw new Error(`Action tool name collision: '${existing.action.Name}' and '${action.Name}' both sanitize to `
@@ -206,6 +214,10 @@ export function buildActionToolSet(actions, paramsByActionId) {
206
214
  }
207
215
  return { tools, byToolName };
208
216
  }
217
+ /** @deprecated Use {@link BuildActionToolSet}. */
218
+ export function buildActionToolSet(actions, paramsByActionId) {
219
+ return BuildActionToolSet(actions, paramsByActionId);
220
+ }
209
221
  /**
210
222
  * Removes the Actions an agent has chosen not to declare as native tools.
211
223
  *
@@ -217,10 +229,14 @@ export function buildActionToolSet(actions, paramsByActionId) {
217
229
  * Note the consequence the design accepts: in native mode the prose catalog is not rendered, so an
218
230
  * action removed here is unreachable on that turn, not merely de-emphasised.
219
231
  */
220
- export function filterDeclarableActions(actions, agentActionRows) {
232
+ export function FilterDeclarableActions(actions, agentActionRows) {
221
233
  const excluded = new Set(agentActionRows
222
234
  .filter((row) => row.DeclareAsNativeTool === false && row.ActionID)
223
235
  .map((row) => row.ActionID.toLowerCase()));
224
236
  return actions.filter((action) => !excluded.has(action.ID.toLowerCase()));
225
237
  }
238
+ /** @deprecated Use {@link FilterDeclarableActions}. */
239
+ export function filterDeclarableActions(actions, agentActionRows) {
240
+ return FilterDeclarableActions(actions, agentActionRows);
241
+ }
226
242
  //# sourceMappingURL=action-tool-builder.js.map