@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
@@ -0,0 +1,208 @@
1
+ /**
2
+ * @fileoverview Pure typed-decision gate module for extracted memory notes.
3
+ *
4
+ * Implements question generation, state projection, Platt calibration application,
5
+ * and note filtering for durable memory candidates.
6
+ *
7
+ * @module @memberjunction/ai-agents
8
+ */
9
+ import { type AIModelConfiguration, type DecisionAnswer, type LikelihoodQuestion, type PlattCalibration } from '@memberjunction/ai';
10
+ import { type DecisionAnsweringModel, type DecisionModelCalibration, type MJAIPromptEntityExtended } from '@memberjunction/ai-core-plus';
11
+ import type { MJAIModelVendorEntity, MJAIPromptModelEntity } from '@memberjunction/core-entities';
12
+ /**
13
+ * Standard instructions used for Likelihood questions evaluating candidate memory notes.
14
+ */
15
+ export declare const MEMORY_NOTE_QUESTION_INSTRUCTIONS = "This note is a correct, durable fact or preference about the user, their organization or how they want the agent to work, that is worth remembering in future conversations; it is not a one-off request, a guess, or a detail of this conversation only.";
16
+ /**
17
+ * Maximum character limit for a candidate note's content in the decision state.
18
+ */
19
+ export declare const MEMORY_NOTE_MAX_CONTENT_CHARS = 1000;
20
+ /**
21
+ * Maximum character limit for conversation excerpts in the decision state.
22
+ */
23
+ export declare const MEMORY_NOTE_MAX_EXCERPT_CHARS = 4000;
24
+ /**
25
+ * The least **calibrated** probability at which a candidate note is kept.
26
+ *
27
+ * Set from the memory-note gate measurement (plan Task 3.4, 2026-09-29): 60 synthetic conversations,
28
+ * 337 candidate notes labelled durable, ephemeral, wrong or speculative, two repeats. At a calibrated
29
+ * 0.6, Jev kept durable notes at 96.1% precision and 95.4% recall, and kept 6.2% of the
30
+ * conversation-only (ephemeral) notes. A proxy self-report scorer's `confidence >= 80` kept 40.0% of
31
+ * them at 85.3% precision and 98.7% recall. Neither kept a wrong note; the gate kept 3.4% of the
32
+ * speculative ones, the proxy none.
33
+ *
34
+ * **The baseline is a proxy, not today's Memory Manager.** Its self-reported confidence came from a
35
+ * separate scoring call with a four-band rubric (90-100 stated, 75-89 strongly implied, 50-74
36
+ * possible, below 50 skip). Production's `Memory Manager - Extract Notes` template has three bands
37
+ * (90-100, 80-89, below 80 skip), and skip rules the proxy doesn't have: one-time requests, matters
38
+ * resolved within the conversation, and task-scoped clarifications. Those rules drop exactly the
39
+ * ephemeral notes counted here before any confidence filter runs, so production probably keeps fewer
40
+ * than 40% of them. The gate's own figures stand; the comparison is against the proxy.
41
+ */
42
+ export declare const MEMORY_NOTE_MIN_PROBABILITY = 0.6;
43
+ /**
44
+ * Platt calibration of the memory-note Likelihood, each tied to the exact model it was fitted on (see
45
+ * `FindDecisionCalibration` in `@memberjunction/ai-core-plus`): the MJ decision model that answered
46
+ * (`ModelName`, from `modelInfo.modelName`) and the model its driver reports behind it
47
+ * (`ResolvedModel`, from `DecisionResult.ResolvedModel`). Fitted on the memory-note gate measurement:
48
+ * - **Jev** at its pinned `APIName`, `typesafe/jev-1.13-20260917`, which it reports back as the
49
+ * resolved model.
50
+ *
51
+ * Only models that beat the proxy self-report scorer (see {@link MEMORY_NOTE_MIN_PROBABILITY}) are
52
+ * listed. LLM Decision was measured and left out: at any threshold it kept more wrong and speculative
53
+ * notes than the proxy's `confidence >= 80` (at a calibrated 0.6, 11.5% of wrong notes). A batch answered by any other model, including Jev at another version,
54
+ * falls back to the self-reported confidence rule, as a failed decision does. Refit, and add the new
55
+ * pair, whenever a model, its version or the question changes.
56
+ */
57
+ export declare const MEMORY_NOTE_DECISION_CALIBRATION: readonly DecisionModelCalibration<PlattCalibration>[];
58
+ /**
59
+ * Shape of a candidate note evaluated by the decision gate.
60
+ */
61
+ export interface MemoryNoteCandidate {
62
+ readonly type: 'Preference' | 'Constraint' | 'Context' | 'Issue' | string;
63
+ readonly content: string;
64
+ readonly confidence?: number;
65
+ readonly scopeLevel?: 'global' | 'company' | 'user' | string;
66
+ readonly agentId?: string | null;
67
+ readonly userId?: string | null;
68
+ readonly companyId?: string | null;
69
+ /** The conversation the note was extracted from: the one it is judged against. */
70
+ readonly sourceConversationId?: string | null;
71
+ }
72
+ /** One turn of the conversation a note came from, as the gate's state quotes it. */
73
+ export interface MemoryNoteExcerptTurn {
74
+ readonly role: string;
75
+ readonly text: string;
76
+ }
77
+ /** A conversation candidate notes may have come from. */
78
+ export interface MemoryNoteConversation {
79
+ readonly ConversationId: string;
80
+ readonly Turns: ReadonlyArray<MemoryNoteExcerptTurn>;
81
+ }
82
+ /** The candidate notes of one conversation, with that conversation's excerpt: one decision state. */
83
+ export interface MemoryNoteConversationBatch<T extends MemoryNoteCandidate = MemoryNoteCandidate> {
84
+ readonly ConversationId: string;
85
+ readonly Excerpt: string;
86
+ readonly Notes: T[];
87
+ }
88
+ /** Candidate notes grouped by the conversation they came from. */
89
+ export interface MemoryNoteConversationGrouping<T extends MemoryNoteCandidate = MemoryNoteCandidate> {
90
+ /** One batch per conversation with notes, in the conversations' order; each keeps its notes' order. */
91
+ readonly Batches: MemoryNoteConversationBatch<T>[];
92
+ /** The notes whose conversation could not be told: they must not be judged against any. */
93
+ readonly Unattributed: T[];
94
+ }
95
+ /**
96
+ * Projection of a candidate note in the decision state payload.
97
+ */
98
+ export interface MemoryNoteStateItem {
99
+ readonly type: string;
100
+ readonly scope: string;
101
+ readonly content: string;
102
+ }
103
+ /**
104
+ * Decision state object sent with the decision prompt.
105
+ */
106
+ export type MemoryNoteDecisionState = {
107
+ readonly notes: Record<string, MemoryNoteStateItem>;
108
+ readonly conversationExcerpt?: string;
109
+ };
110
+ /**
111
+ * Individual evaluated note verdict.
112
+ */
113
+ export interface JudgedMemoryNote<T extends MemoryNoteCandidate = MemoryNoteCandidate> {
114
+ readonly Note: T;
115
+ readonly Key: string;
116
+ readonly RawProbability?: number;
117
+ readonly CalibratedProbability?: number;
118
+ readonly Kept: boolean;
119
+ readonly Reason: string;
120
+ }
121
+ /**
122
+ * Aggregate verdict for a batch of evaluated memory notes.
123
+ */
124
+ export interface MemoryNoteGateVerdict<T extends MemoryNoteCandidate = MemoryNoteCandidate> {
125
+ readonly KeptNotes: T[];
126
+ readonly JudgedNotes: JudgedMemoryNote<T>[];
127
+ /** The model that answered, as the decision result reported it. */
128
+ readonly AnsweredBy: DecisionAnsweringModel;
129
+ readonly Calibrated: boolean;
130
+ }
131
+ /**
132
+ * What {@link MemoryNotePromptQuestionCap} reads from the AI engine to resolve the question limit.
133
+ * `AIEngine.Instance` satisfies it.
134
+ */
135
+ export interface MemoryNoteEngineSource {
136
+ readonly Prompts: ReadonlyArray<Pick<MJAIPromptEntityExtended, 'ID' | 'Name'>>;
137
+ readonly PromptModels: ReadonlyArray<Pick<MJAIPromptModelEntity, 'PromptID' | 'ModelID' | 'VendorID' | 'Status'>>;
138
+ readonly ModelVendors: ReadonlyArray<Pick<MJAIModelVendorEntity, 'ID' | 'ModelID' | 'VendorID'>>;
139
+ GetEffectiveModelConfiguration(modelID: string, vendorModelVendorID?: string): Pick<AIModelConfiguration, 'Decision'> | null;
140
+ }
141
+ /**
142
+ * Builds likelihood questions for each candidate note, keyed n1, n2, etc.
143
+ *
144
+ * Each question quotes its own note. Question keys are labels for code, not instructions to the
145
+ * model, and a native decision driver (Jev) may answer each question separately against the state,
146
+ * so a question that only named its key would ask the same thing about every note. Measured: with
147
+ * the note left out of the question, Jev's answers were at chance (AUC 0.51).
148
+ *
149
+ * @param notes The candidate notes to build questions for.
150
+ */
151
+ export declare function BuildMemoryNoteQuestions(notes: ReadonlyArray<MemoryNoteCandidate>): Record<string, LikelihoodQuestion>;
152
+ /** One note's question: the durable-memory test, then the note itself, capped. */
153
+ export declare function MemoryNoteQuestionInstructions(note: MemoryNoteCandidate): string;
154
+ /**
155
+ * The conversation a batch of notes came from, as the gate's state quotes it: one `[role]: text`
156
+ * line per turn. The measurement rig wrote its corpus excerpts with this, one conversation per
157
+ * state, which is what the Platt fit and the threshold were set on; {@link BuildMemoryNoteState}
158
+ * caps it.
159
+ *
160
+ * @param turns The conversation's turns, in order.
161
+ */
162
+ export declare function FormatMemoryNoteExcerpt(turns: ReadonlyArray<MemoryNoteExcerptTurn>): string;
163
+ /**
164
+ * Groups candidate notes by the conversation they came from, so each note is judged against its own
165
+ * conversation, as the gate was measured: one conversation per decision state. A note whose
166
+ * `sourceConversationId` names none of the conversations belongs to the only conversation when there
167
+ * is one; with several, it is unattributed, and must not be judged against another conversation.
168
+ *
169
+ * @param notes The candidate notes.
170
+ * @param conversations The conversations they were extracted from.
171
+ */
172
+ export declare function GroupMemoryNotesByConversation<T extends MemoryNoteCandidate>(notes: ReadonlyArray<T>, conversations: ReadonlyArray<MemoryNoteConversation>): MemoryNoteConversationGrouping<T>;
173
+ /**
174
+ * Builds the state object for the decision prompt, capping content and excerpts.
175
+ *
176
+ * @param notes Candidate notes to project.
177
+ * @param sourceExcerpts Optional conversation thread context.
178
+ */
179
+ export declare function BuildMemoryNoteState(notes: ReadonlyArray<MemoryNoteCandidate>, sourceExcerpts?: string | Record<string, string> | readonly string[]): MemoryNoteDecisionState;
180
+ /**
181
+ * Evaluates decision answers against candidate notes using Platt calibration.
182
+ *
183
+ * The calibration is the one fitted on the exact model that answered (`FindDecisionCalibration`).
184
+ * An answer from any other model, including a calibrated model at another version, is uncalibrated
185
+ * and keeps nothing (fails safe toward writing no durable memory).
186
+ *
187
+ * @param answers The answers returned by the decision runner.
188
+ * @param notes The candidate notes evaluated.
189
+ * @param answeredBy The model that answered: the MJ decision model and the model its driver resolved.
190
+ * @param threshold The calibrated probability at which a note is kept (default: {@link MEMORY_NOTE_MIN_PROBABILITY}, 0.6).
191
+ * @param calibrations Optional calibration table override (defaults to {@link MEMORY_NOTE_DECISION_CALIBRATION}).
192
+ */
193
+ export declare function JudgeMemoryNotes<T extends MemoryNoteCandidate = MemoryNoteCandidate>(answers: Record<string, DecisionAnswer> | undefined, notes: ReadonlyArray<T>, answeredBy?: DecisionAnsweringModel, threshold?: number, calibrations?: readonly DecisionModelCalibration<PlattCalibration>[]): MemoryNoteGateVerdict<T>;
194
+ /**
195
+ * Looks up the prompt's configured MaxQuestionsPerCall limit from active PromptModels.
196
+ *
197
+ * @param engine AIEngine metadata source.
198
+ * @param promptName Name of the decision prompt (default: 'Default Decision').
199
+ */
200
+ export declare function MemoryNotePromptQuestionCap(engine: MemoryNoteEngineSource, promptName?: string): number | undefined;
201
+ /**
202
+ * Splits candidate notes into chunks not exceeding the specified chunk size.
203
+ *
204
+ * @param notes The notes to chunk.
205
+ * @param chunkSize Maximum number of notes per chunk.
206
+ */
207
+ export declare function ChunkMemoryNotes<T>(notes: ReadonlyArray<T>, chunkSize?: number): T[][];
208
+ //# sourceMappingURL=memory-note-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-note-gate.d.ts","sourceRoot":"","sources":["../src/memory-note-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEH,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGH,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAChC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGlG;;GAEG;AACH,eAAO,MAAM,iCAAiC,8PACiN,CAAC;AAEhQ;;GAEG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,wBAAwB,CAAC,gBAAgB,CAAC,EAEhG,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;I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E,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAStF"}
@@ -0,0 +1,294 @@
1
+ /**
2
+ * @fileoverview Pure typed-decision gate module for extracted memory notes.
3
+ *
4
+ * Implements question generation, state projection, Platt calibration application,
5
+ * and note filtering for durable memory candidates.
6
+ *
7
+ * @module @memberjunction/ai-agents
8
+ */
9
+ import { ApplyPlattCalibration } from '@memberjunction/ai';
10
+ import { DescribeAnsweringModel, FindDecisionCalibration } from '@memberjunction/ai-core-plus';
11
+ import { UUIDsEqual } from '@memberjunction/global';
12
+ /**
13
+ * Standard instructions used for Likelihood questions evaluating candidate memory notes.
14
+ */
15
+ export const MEMORY_NOTE_QUESTION_INSTRUCTIONS = 'This note is a correct, durable fact or preference about the user, their organization or how they want the agent to work, that is worth remembering in future conversations; it is not a one-off request, a guess, or a detail of this conversation only.';
16
+ /**
17
+ * Maximum character limit for a candidate note's content in the decision state.
18
+ */
19
+ export const MEMORY_NOTE_MAX_CONTENT_CHARS = 1000;
20
+ /**
21
+ * Maximum character limit for conversation excerpts in the decision state.
22
+ */
23
+ export const MEMORY_NOTE_MAX_EXCERPT_CHARS = 4000;
24
+ /**
25
+ * The least **calibrated** probability at which a candidate note is kept.
26
+ *
27
+ * Set from the memory-note gate measurement (plan Task 3.4, 2026-09-29): 60 synthetic conversations,
28
+ * 337 candidate notes labelled durable, ephemeral, wrong or speculative, two repeats. At a calibrated
29
+ * 0.6, Jev kept durable notes at 96.1% precision and 95.4% recall, and kept 6.2% of the
30
+ * conversation-only (ephemeral) notes. A proxy self-report scorer's `confidence >= 80` kept 40.0% of
31
+ * them at 85.3% precision and 98.7% recall. Neither kept a wrong note; the gate kept 3.4% of the
32
+ * speculative ones, the proxy none.
33
+ *
34
+ * **The baseline is a proxy, not today's Memory Manager.** Its self-reported confidence came from a
35
+ * separate scoring call with a four-band rubric (90-100 stated, 75-89 strongly implied, 50-74
36
+ * possible, below 50 skip). Production's `Memory Manager - Extract Notes` template has three bands
37
+ * (90-100, 80-89, below 80 skip), and skip rules the proxy doesn't have: one-time requests, matters
38
+ * resolved within the conversation, and task-scoped clarifications. Those rules drop exactly the
39
+ * ephemeral notes counted here before any confidence filter runs, so production probably keeps fewer
40
+ * than 40% of them. The gate's own figures stand; the comparison is against the proxy.
41
+ */
42
+ export const MEMORY_NOTE_MIN_PROBABILITY = 0.6;
43
+ /**
44
+ * Platt calibration of the memory-note Likelihood, each tied to the exact model it was fitted on (see
45
+ * `FindDecisionCalibration` in `@memberjunction/ai-core-plus`): the MJ decision model that answered
46
+ * (`ModelName`, from `modelInfo.modelName`) and the model its driver reports behind it
47
+ * (`ResolvedModel`, from `DecisionResult.ResolvedModel`). Fitted on the memory-note gate measurement:
48
+ * - **Jev** at its pinned `APIName`, `typesafe/jev-1.13-20260917`, which it reports back as the
49
+ * resolved model.
50
+ *
51
+ * Only models that beat the proxy self-report scorer (see {@link MEMORY_NOTE_MIN_PROBABILITY}) are
52
+ * listed. LLM Decision was measured and left out: at any threshold it kept more wrong and speculative
53
+ * notes than the proxy's `confidence >= 80` (at a calibrated 0.6, 11.5% of wrong notes). A batch answered by any other model, including Jev at another version,
54
+ * falls back to the self-reported confidence rule, as a failed decision does. Refit, and add the new
55
+ * pair, whenever a model, its version or the question changes.
56
+ */
57
+ export const MEMORY_NOTE_DECISION_CALIBRATION = Object.freeze([
58
+ Object.freeze({ ModelName: 'Jev', ResolvedModel: 'typesafe/jev-1.13-20260917', Calibration: Object.freeze({ A: 3.6391, B: -5.7059 }) })
59
+ ]);
60
+ /**
61
+ * Builds likelihood questions for each candidate note, keyed n1, n2, etc.
62
+ *
63
+ * Each question quotes its own note. Question keys are labels for code, not instructions to the
64
+ * model, and a native decision driver (Jev) may answer each question separately against the state,
65
+ * so a question that only named its key would ask the same thing about every note. Measured: with
66
+ * the note left out of the question, Jev's answers were at chance (AUC 0.51).
67
+ *
68
+ * @param notes The candidate notes to build questions for.
69
+ */
70
+ export function BuildMemoryNoteQuestions(notes) {
71
+ const questions = {};
72
+ for (let i = 0; i < notes.length; i++) {
73
+ questions[`n${i + 1}`] = {
74
+ Kind: 'Likelihood',
75
+ Instructions: MemoryNoteQuestionInstructions(notes[i])
76
+ };
77
+ }
78
+ return questions;
79
+ }
80
+ /** One note's question: the durable-memory test, then the note itself, capped. */
81
+ export function MemoryNoteQuestionInstructions(note) {
82
+ const content = (note.content ?? '').slice(0, MEMORY_NOTE_MAX_CONTENT_CHARS);
83
+ return `${MEMORY_NOTE_QUESTION_INSTRUCTIONS}\n\nThe note (${note.type}, ${note.scopeLevel ?? 'user'} scope): "${content}"`;
84
+ }
85
+ /**
86
+ * The conversation a batch of notes came from, as the gate's state quotes it: one `[role]: text`
87
+ * line per turn. The measurement rig wrote its corpus excerpts with this, one conversation per
88
+ * state, which is what the Platt fit and the threshold were set on; {@link BuildMemoryNoteState}
89
+ * caps it.
90
+ *
91
+ * @param turns The conversation's turns, in order.
92
+ */
93
+ export function FormatMemoryNoteExcerpt(turns) {
94
+ return turns.map(turn => `[${turn.role}]: ${turn.text}`).join('\n');
95
+ }
96
+ /** The conversation a note names, compared as UUIDs, or null when it names none of them. */
97
+ function conversationOf(note, conversations) {
98
+ const source = note.sourceConversationId;
99
+ return source ? conversations.find(c => UUIDsEqual(c.ConversationId, source)) ?? null : null;
100
+ }
101
+ /**
102
+ * Groups candidate notes by the conversation they came from, so each note is judged against its own
103
+ * conversation, as the gate was measured: one conversation per decision state. A note whose
104
+ * `sourceConversationId` names none of the conversations belongs to the only conversation when there
105
+ * is one; with several, it is unattributed, and must not be judged against another conversation.
106
+ *
107
+ * @param notes The candidate notes.
108
+ * @param conversations The conversations they were extracted from.
109
+ */
110
+ export function GroupMemoryNotesByConversation(notes, conversations) {
111
+ const byConversation = new Map();
112
+ const unattributed = [];
113
+ for (const note of notes) {
114
+ const conversation = conversationOf(note, conversations) ?? (conversations.length === 1 ? conversations[0] : null);
115
+ if (!conversation) {
116
+ unattributed.push(note);
117
+ continue;
118
+ }
119
+ byConversation.set(conversation, [...(byConversation.get(conversation) ?? []), note]);
120
+ }
121
+ const batches = conversations
122
+ .filter(c => byConversation.has(c))
123
+ .map(c => ({ ConversationId: c.ConversationId, Excerpt: FormatMemoryNoteExcerpt(c.Turns), Notes: byConversation.get(c) ?? [] }));
124
+ return { Batches: batches, Unattributed: unattributed };
125
+ }
126
+ /**
127
+ * Formats source conversation excerpts into a single string within max character limits.
128
+ */
129
+ function formatExcerpt(sourceExcerpts) {
130
+ if (!sourceExcerpts) {
131
+ return undefined;
132
+ }
133
+ let text;
134
+ if (typeof sourceExcerpts === 'string') {
135
+ text = sourceExcerpts.trim();
136
+ }
137
+ else if (Array.isArray(sourceExcerpts)) {
138
+ text = sourceExcerpts.join('\n---\n').trim();
139
+ }
140
+ else {
141
+ text = Object.entries(sourceExcerpts)
142
+ .map(([id, excerpt]) => `[${id}]: ${excerpt}`)
143
+ .join('\n---\n')
144
+ .trim();
145
+ }
146
+ return text.length > 0 ? text.slice(0, MEMORY_NOTE_MAX_EXCERPT_CHARS) : undefined;
147
+ }
148
+ /**
149
+ * Builds the state object for the decision prompt, capping content and excerpts.
150
+ *
151
+ * @param notes Candidate notes to project.
152
+ * @param sourceExcerpts Optional conversation thread context.
153
+ */
154
+ export function BuildMemoryNoteState(notes, sourceExcerpts) {
155
+ const notesMap = {};
156
+ for (let i = 0; i < notes.length; i++) {
157
+ const note = notes[i];
158
+ const key = `n${i + 1}`;
159
+ notesMap[key] = {
160
+ type: note.type,
161
+ scope: note.scopeLevel ?? 'user',
162
+ content: (note.content ?? '').slice(0, MEMORY_NOTE_MAX_CONTENT_CHARS)
163
+ };
164
+ }
165
+ const excerpt = formatExcerpt(sourceExcerpts);
166
+ return excerpt ? { notes: notesMap, conversationExcerpt: excerpt } : { notes: notesMap };
167
+ }
168
+ /**
169
+ * Extracts raw probability from a decision answer if it is a valid Likelihood.
170
+ */
171
+ function extractRawProbability(answer) {
172
+ if (!answer || answer.Kind !== 'Likelihood') {
173
+ return undefined;
174
+ }
175
+ if (typeof answer.Probability !== 'number' || !Number.isFinite(answer.Probability)) {
176
+ return undefined;
177
+ }
178
+ return answer.Probability;
179
+ }
180
+ /**
181
+ * Judges a single note when the model is uncalibrated.
182
+ */
183
+ function judgeUncalibratedNote(note, key, rawProb, answeredBy) {
184
+ const reason = answeredBy.ModelName?.trim() || answeredBy.ResolvedModel?.trim()
185
+ ? `The answering model ${DescribeAnsweringModel(answeredBy)} has no memory-note calibration, so the gate keeps nothing`
186
+ : 'No answering model was reported, so the gate keeps nothing';
187
+ return {
188
+ Note: note,
189
+ Key: key,
190
+ RawProbability: rawProb,
191
+ Kept: false,
192
+ Reason: reason
193
+ };
194
+ }
195
+ /**
196
+ * Judges a single note when calibration parameters are present.
197
+ */
198
+ function judgeCalibratedNote(note, key, rawProb, calibration, threshold) {
199
+ if (rawProb === undefined) {
200
+ return {
201
+ Note: note,
202
+ Key: key,
203
+ Kept: false,
204
+ Reason: `Missing or invalid Likelihood answer for question '${key}'`
205
+ };
206
+ }
207
+ const calProb = ApplyPlattCalibration(rawProb, calibration);
208
+ const kept = calProb >= threshold;
209
+ const reason = kept
210
+ ? `Calibrated probability ${calProb.toFixed(4)} >= threshold ${threshold}`
211
+ : `Calibrated probability ${calProb.toFixed(4)} < threshold ${threshold}`;
212
+ return {
213
+ Note: note,
214
+ Key: key,
215
+ RawProbability: rawProb,
216
+ CalibratedProbability: calProb,
217
+ Kept: kept,
218
+ Reason: reason
219
+ };
220
+ }
221
+ /**
222
+ * Evaluates decision answers against candidate notes using Platt calibration.
223
+ *
224
+ * The calibration is the one fitted on the exact model that answered (`FindDecisionCalibration`).
225
+ * An answer from any other model, including a calibrated model at another version, is uncalibrated
226
+ * and keeps nothing (fails safe toward writing no durable memory).
227
+ *
228
+ * @param answers The answers returned by the decision runner.
229
+ * @param notes The candidate notes evaluated.
230
+ * @param answeredBy The model that answered: the MJ decision model and the model its driver resolved.
231
+ * @param threshold The calibrated probability at which a note is kept (default: {@link MEMORY_NOTE_MIN_PROBABILITY}, 0.6).
232
+ * @param calibrations Optional calibration table override (defaults to {@link MEMORY_NOTE_DECISION_CALIBRATION}).
233
+ */
234
+ export function JudgeMemoryNotes(answers, notes, answeredBy = {}, threshold = MEMORY_NOTE_MIN_PROBABILITY, calibrations = MEMORY_NOTE_DECISION_CALIBRATION) {
235
+ const calibration = FindDecisionCalibration(calibrations, answeredBy);
236
+ const judgedNotes = [];
237
+ for (let i = 0; i < notes.length; i++) {
238
+ const note = notes[i];
239
+ const key = `n${i + 1}`;
240
+ const rawProb = extractRawProbability(answers?.[key]);
241
+ const judged = calibration
242
+ ? judgeCalibratedNote(note, key, rawProb, calibration, threshold)
243
+ : judgeUncalibratedNote(note, key, rawProb, answeredBy);
244
+ judgedNotes.push(judged);
245
+ }
246
+ const keptNotes = judgedNotes.filter(j => j.Kept).map(j => j.Note);
247
+ return {
248
+ KeptNotes: keptNotes,
249
+ JudgedNotes: judgedNotes,
250
+ AnsweredBy: answeredBy,
251
+ Calibrated: calibration !== null
252
+ };
253
+ }
254
+ /**
255
+ * Looks up the prompt's configured MaxQuestionsPerCall limit from active PromptModels.
256
+ *
257
+ * @param engine AIEngine metadata source.
258
+ * @param promptName Name of the decision prompt (default: 'Default Decision').
259
+ */
260
+ export function MemoryNotePromptQuestionCap(engine, promptName = 'Default Decision') {
261
+ const target = promptName.trim().toLowerCase();
262
+ const prompt = engine.Prompts?.find(p => (p.Name ?? '').trim().toLowerCase() === target);
263
+ if (!prompt) {
264
+ return undefined;
265
+ }
266
+ const caps = (engine.PromptModels ?? [])
267
+ .filter(pm => UUIDsEqual(pm.PromptID, prompt.ID) && (pm.Status === 'Active' || pm.Status === 'Preview'))
268
+ .map(pm => {
269
+ const modelVendor = pm.VendorID
270
+ ? (engine.ModelVendors ?? []).find(mv => UUIDsEqual(mv.ModelID, pm.ModelID) && UUIDsEqual(mv.VendorID, pm.VendorID))
271
+ : undefined;
272
+ return engine.GetEffectiveModelConfiguration(pm.ModelID, modelVendor?.ID)?.Decision
273
+ ?.MaxQuestionsPerCall;
274
+ });
275
+ const declared = caps.filter((cap) => typeof cap === 'number' && cap > 0);
276
+ return declared.length > 0 ? Math.min(...declared) : undefined;
277
+ }
278
+ /**
279
+ * Splits candidate notes into chunks not exceeding the specified chunk size.
280
+ *
281
+ * @param notes The notes to chunk.
282
+ * @param chunkSize Maximum number of notes per chunk.
283
+ */
284
+ export function ChunkMemoryNotes(notes, chunkSize) {
285
+ if (!chunkSize || chunkSize <= 0 || !Number.isFinite(chunkSize) || notes.length <= chunkSize) {
286
+ return [Array.from(notes)];
287
+ }
288
+ const chunks = [];
289
+ for (let i = 0; i < notes.length; i += chunkSize) {
290
+ chunks.push(notes.slice(i, i + chunkSize));
291
+ }
292
+ return chunks;
293
+ }
294
+ //# sourceMappingURL=memory-note-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-note-gate.js","sourceRoot":"","sources":["../src/memory-note-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACH,qBAAqB,EAKxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EAI1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAC1C,2PAA2P,CAAC;AAEhQ;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA0D,MAAM,CAAC,MAAM,CAAC;IACjH,MAAM,CAAC,MAAM,CAAC,EAAE,S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MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -14,6 +14,8 @@ export interface ActionToolBinding {
14
14
  /** The Action the framework dispatches when that name comes back. */
15
15
  action: MJActionEntityExtended;
16
16
  tool: ChatTool;
17
+ /** The Action's params the tool was built from — what {@link CoerceActionArguments} reads back. */
18
+ params: readonly MJActionParamEntity[];
17
19
  }
18
20
  /**
19
21
  * A built tool set plus the reverse map from tool name back to Action.
@@ -57,6 +59,18 @@ export declare const MAX_TOOL_DESCRIPTION_LENGTH = 1024;
57
59
  export declare function SanitizeToolName(actionName: string): string;
58
60
  /** @deprecated Use {@link SanitizeToolName}. */
59
61
  export declare function sanitizeToolName(actionName: string): string;
62
+ /**
63
+ * Restores object-typed arguments a model sent as JSON strings, before the Action runs.
64
+ *
65
+ * Only `Simple Object` params are touched: an `Other` param is declared as `string` and may
66
+ * legitimately hold JSON-looking text. For an array param both the array itself and each element
67
+ * may arrive encoded.
68
+ *
69
+ * @param params The Action's params, as the tool was built from them
70
+ * @param args The call's arguments, as the provider returned them
71
+ * @returns A new argument object; `args` is not mutated
72
+ */
73
+ export declare function CoerceActionArguments(params: readonly MJActionParamEntity[], args: Record<string, unknown> | undefined): Record<string, unknown>;
60
74
  /**
61
75
  * Builds the `ChatTool` declaration for one Action.
62
76
  *
@@ -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,MAA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