@memberjunction/ai-agents 5.40.2 → 5.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -0
- package/dist/AgentRunner.d.ts +5 -2
- package/dist/AgentRunner.d.ts.map +1 -1
- package/dist/AgentRunner.js +14 -4
- package/dist/AgentRunner.js.map +1 -1
- package/dist/MemoryWriteManager.d.ts +188 -0
- package/dist/MemoryWriteManager.d.ts.map +1 -0
- package/dist/MemoryWriteManager.js +299 -0
- package/dist/MemoryWriteManager.js.map +1 -0
- package/dist/agent-context-injector.d.ts +29 -0
- package/dist/agent-context-injector.d.ts.map +1 -1
- package/dist/agent-context-injector.js +90 -32
- package/dist/agent-context-injector.js.map +1 -1
- package/dist/agent-memory-context-builder.d.ts +100 -0
- package/dist/agent-memory-context-builder.d.ts.map +1 -0
- package/dist/agent-memory-context-builder.js +172 -0
- package/dist/agent-memory-context-builder.js.map +1 -0
- package/dist/agent-types/index.d.ts +1 -0
- package/dist/agent-types/index.d.ts.map +1 -1
- package/dist/agent-types/index.js +1 -0
- package/dist/agent-types/index.js.map +1 -1
- package/dist/agent-types/loop-agent-response-type.d.ts +12 -1
- package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-response-type.js.map +1 -1
- package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-type.js +4 -0
- package/dist/agent-types/loop-agent-type.js.map +1 -1
- package/dist/agent-types/realtime-agent-type.d.ts +146 -0
- package/dist/agent-types/realtime-agent-type.d.ts.map +1 -0
- package/dist/agent-types/realtime-agent-type.js +176 -0
- package/dist/agent-types/realtime-agent-type.js.map +1 -0
- package/dist/base-agent.d.ts +386 -39
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +1121 -261
- package/dist/base-agent.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/dist/memory-manager-agent.d.ts +99 -4
- package/dist/memory-manager-agent.d.ts.map +1 -1
- package/dist/memory-manager-agent.js +349 -117
- package/dist/memory-manager-agent.js.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.d.ts +111 -0
- package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -0
- package/dist/realtime/bridge-realtime-session-factory.js +163 -0
- package/dist/realtime/bridge-realtime-session-factory.js.map +1 -0
- package/dist/realtime/bridge-room-transcript-sink.d.ts +58 -0
- package/dist/realtime/bridge-room-transcript-sink.d.ts.map +1 -0
- package/dist/realtime/bridge-room-transcript-sink.js +127 -0
- package/dist/realtime/bridge-room-transcript-sink.js.map +1 -0
- package/dist/realtime/meeting-controls-channel-server.d.ts +198 -0
- package/dist/realtime/meeting-controls-channel-server.d.ts.map +1 -0
- package/dist/realtime/meeting-controls-channel-server.js +319 -0
- package/dist/realtime/meeting-controls-channel-server.js.map +1 -0
- package/dist/realtime/meeting-controls-state.d.ts +191 -0
- package/dist/realtime/meeting-controls-state.d.ts.map +1 -0
- package/dist/realtime/meeting-controls-state.js +219 -0
- package/dist/realtime/meeting-controls-state.js.map +1 -0
- package/dist/realtime/realtime-channel-server-host.d.ts +166 -0
- package/dist/realtime/realtime-channel-server-host.d.ts.map +1 -0
- package/dist/realtime/realtime-channel-server-host.js +378 -0
- package/dist/realtime/realtime-channel-server-host.js.map +1 -0
- package/dist/realtime/realtime-client-session-service.d.ts +1026 -0
- package/dist/realtime/realtime-client-session-service.d.ts.map +1 -0
- package/dist/realtime/realtime-client-session-service.js +1607 -0
- package/dist/realtime/realtime-client-session-service.js.map +1 -0
- package/dist/realtime/realtime-coagent-config.d.ts +258 -0
- package/dist/realtime/realtime-coagent-config.d.ts.map +1 -0
- package/dist/realtime/realtime-coagent-config.js +408 -0
- package/dist/realtime/realtime-coagent-config.js.map +1 -0
- package/dist/realtime/realtime-narration.d.ts +67 -0
- package/dist/realtime/realtime-narration.d.ts.map +1 -0
- package/dist/realtime/realtime-narration.js +127 -0
- package/dist/realtime/realtime-narration.js.map +1 -0
- package/dist/realtime/realtime-session-runner.d.ts +383 -0
- package/dist/realtime/realtime-session-runner.d.ts.map +1 -0
- package/dist/realtime/realtime-session-runner.js +532 -0
- package/dist/realtime/realtime-session-runner.js.map +1 -0
- package/dist/realtime/realtime-tool-broker.d.ts +294 -0
- package/dist/realtime/realtime-tool-broker.d.ts.map +1 -0
- package/dist/realtime/realtime-tool-broker.js +206 -0
- package/dist/realtime/realtime-tool-broker.js.map +1 -0
- package/dist/realtime/whiteboard-channel-server.d.ts +50 -0
- package/dist/realtime/whiteboard-channel-server.d.ts.map +1 -0
- package/dist/realtime/whiteboard-channel-server.js +85 -0
- package/dist/realtime/whiteboard-channel-server.js.map +1 -0
- package/package.json +17 -17
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './AgentRunner.js';
|
|
|
18
18
|
export * from './PayloadManager.js';
|
|
19
19
|
export * from './ScratchpadManager.js';
|
|
20
20
|
export * from './ArtifactToolManager.js';
|
|
21
|
+
export * from './MemoryWriteManager.js';
|
|
21
22
|
export * from './pipeline/index.js';
|
|
22
23
|
export * from './file-input-resolver.js';
|
|
23
24
|
export * from './artifact-tools/DataSnapshotToolLibrary.js';
|
|
@@ -34,11 +35,23 @@ export * from './PayloadFeedbackManager.js';
|
|
|
34
35
|
export * from './types/payload-operations.js';
|
|
35
36
|
export * from './AgentDataPreloader.js';
|
|
36
37
|
export * from './agent-context-injector.js';
|
|
38
|
+
export * from './agent-memory-context-builder.js';
|
|
37
39
|
export * from './agent-pre-execution-rag.js';
|
|
38
40
|
export * from './memory-manager-agent.js';
|
|
39
41
|
export * from './query-builder-agent.js';
|
|
40
42
|
export * from './MJAIAgentRequestEntityServer.js';
|
|
41
43
|
export * from './KnowledgeAgent.js';
|
|
42
44
|
export * from './ClientToolRequestManager.js';
|
|
45
|
+
export * from './realtime/realtime-session-runner.js';
|
|
46
|
+
export * from './realtime/bridge-realtime-session-factory.js';
|
|
47
|
+
export * from './realtime/bridge-room-transcript-sink.js';
|
|
48
|
+
export { RealtimeToolBroker, RealtimeToolBrokerDeps, ExecutedToolCall, DelegatedRunArtifact } from './realtime/realtime-tool-broker.js';
|
|
49
|
+
export * from './realtime/realtime-client-session-service.js';
|
|
50
|
+
export * from './realtime/realtime-coagent-config.js';
|
|
51
|
+
export * from './realtime/realtime-narration.js';
|
|
52
|
+
export * from './realtime/realtime-channel-server-host.js';
|
|
53
|
+
export * from './realtime/whiteboard-channel-server.js';
|
|
54
|
+
export * from './realtime/meeting-controls-state.js';
|
|
55
|
+
export * from './realtime/meeting-controls-channel-server.js';
|
|
43
56
|
export { RerankerService, RerankerConfiguration, parseRerankerConfiguration, RerankServiceResult, RerankObservabilityOptions, LLMReranker, } from '@memberjunction/ai-reranker';
|
|
44
57
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iCAAiC,CAAC;AAChD,c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AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AAKvD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACrI,cAAc,4CAA4C,CAAC;AAC3D,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAG3D,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,GACZ,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export * from './AgentRunner.js';
|
|
|
18
18
|
export * from './PayloadManager.js';
|
|
19
19
|
export * from './ScratchpadManager.js';
|
|
20
20
|
export * from './ArtifactToolManager.js';
|
|
21
|
+
export * from './MemoryWriteManager.js';
|
|
21
22
|
export * from './pipeline/index.js';
|
|
22
23
|
export * from './file-input-resolver.js';
|
|
23
24
|
export * from './artifact-tools/DataSnapshotToolLibrary.js';
|
|
@@ -34,12 +35,28 @@ export * from './PayloadFeedbackManager.js';
|
|
|
34
35
|
export * from './types/payload-operations.js';
|
|
35
36
|
export * from './AgentDataPreloader.js';
|
|
36
37
|
export * from './agent-context-injector.js';
|
|
38
|
+
export * from './agent-memory-context-builder.js';
|
|
37
39
|
export * from './agent-pre-execution-rag.js';
|
|
38
40
|
export * from './memory-manager-agent.js';
|
|
39
41
|
export * from './query-builder-agent.js';
|
|
40
42
|
export * from './MJAIAgentRequestEntityServer.js';
|
|
41
43
|
export * from './KnowledgeAgent.js';
|
|
42
44
|
export * from './ClientToolRequestManager.js';
|
|
45
|
+
export * from './realtime/realtime-session-runner.js';
|
|
46
|
+
export * from './realtime/bridge-realtime-session-factory.js';
|
|
47
|
+
export * from './realtime/bridge-room-transcript-sink.js';
|
|
48
|
+
// Broker-unique exports. The shared tool-execution contract (INVOKE_TARGET_AGENT_TOOL_NAME,
|
|
49
|
+
// DelegateToTargetRequest, DelegatedResult, ToolExecutionResult, loggers) is surfaced via the
|
|
50
|
+
// runner's `export *` above, so only the broker-specific symbols are named here to avoid a
|
|
51
|
+
// duplicate-export collision.
|
|
52
|
+
export { RealtimeToolBroker } from './realtime/realtime-tool-broker.js';
|
|
53
|
+
export * from './realtime/realtime-client-session-service.js';
|
|
54
|
+
export * from './realtime/realtime-coagent-config.js';
|
|
55
|
+
export * from './realtime/realtime-narration.js';
|
|
56
|
+
export * from './realtime/realtime-channel-server-host.js';
|
|
57
|
+
export * from './realtime/whiteboard-channel-server.js';
|
|
58
|
+
export * from './realtime/meeting-controls-state.js';
|
|
59
|
+
export * from './realtime/meeting-controls-channel-server.js';
|
|
43
60
|
// Re-export from ai-reranker for backward compatibility
|
|
44
61
|
export { RerankerService, parseRerankerConfiguration, LLMReranker, } from '@memberjunction/ai-reranker';
|
|
45
62
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cA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AAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,4FAA4F;AAC5F,8FAA8F;AAC9F,2FAA2F;AAC3F,8BAA8B;AAC9B,OAAO,EAAE,kBAAkB,EAAkE,MAAM,iCAAiC,CAAC;AACrI,cAAc,4CAA4C,CAAC;AAC3D,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAE3D,wDAAwD;AACxD,OAAO,EACL,eAAe,EAEf,0BAA0B,EAG1B,WAAW,GACZ,MAAM,6BAA6B,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BaseAgent } from './base-agent.js';
|
|
2
2
|
import { UserInfo } from '@memberjunction/core';
|
|
3
|
-
import {
|
|
3
|
+
import { MJAIAgentNoteEntity } from '@memberjunction/core-entities';
|
|
4
|
+
import { AIPromptRunner } from '@memberjunction/ai-prompts';
|
|
5
|
+
import { ExecuteAgentParams, AgentConfiguration, BaseAgentNextStep, MJAIPromptEntityExtended } from '@memberjunction/ai-core-plus';
|
|
4
6
|
/** Per-cluster verification result, aggregated into a phase-level observability step. */
|
|
5
7
|
interface ConsolidationVerificationResult {
|
|
6
8
|
entitiesChecked: number;
|
|
@@ -37,6 +39,12 @@ export declare class MemoryManagerAgent extends BaseAgent {
|
|
|
37
39
|
* For first run, returns null to process all history (limited by MaxRows).
|
|
38
40
|
*/
|
|
39
41
|
private GetLastRunTime;
|
|
42
|
+
/**
|
|
43
|
+
* Load a source agent run's scope fields (read-only) for scope inheritance, memoized in
|
|
44
|
+
* the supplied per-cycle cache. Uses a 'simple' projection so it does not trigger the
|
|
45
|
+
* agent-run entity's LoadRelatedData steps sub-query.
|
|
46
|
+
*/
|
|
47
|
+
private loadSourceRunScope;
|
|
40
48
|
/**
|
|
41
49
|
* Load agents that have note or example injection enabled.
|
|
42
50
|
* Only extract notes/examples for agents that actually use these features.
|
|
@@ -51,6 +59,12 @@ export declare class MemoryManagerAgent extends BaseAgent {
|
|
|
51
59
|
/**
|
|
52
60
|
* Load agent runs with high-usage artifacts since last run.
|
|
53
61
|
* Links through: ArtifactUse -> ArtifactVersion -> ConversationDetailArtifact -> ConversationDetail -> Conversation -> AIAgentRun
|
|
62
|
+
*
|
|
63
|
+
* The caller only consumes the row count (`.length`) of the returned set, so this reads a
|
|
64
|
+
* 'simple' ID-only projection rather than full entity objects. Loading these as
|
|
65
|
+
* 'entity_object' would build up to 50 MJAIAgentRunEntityExtended instances, each firing a
|
|
66
|
+
* secondary "MJ: AI Agent Run Steps" RunView via InnerLoad/LoadRelatedData — exactly the
|
|
67
|
+
* redundant round-trips the telemetry flagged. The simple projection skips all of them.
|
|
54
68
|
*/
|
|
55
69
|
private LoadHighValueAgentRuns;
|
|
56
70
|
/**
|
|
@@ -253,8 +267,22 @@ export declare class MemoryManagerAgent extends BaseAgent {
|
|
|
253
267
|
* Batches each depth level into a single `ID IN (...)` query instead of one query per ID.
|
|
254
268
|
*/
|
|
255
269
|
private resolveOriginalSources;
|
|
256
|
-
/**
|
|
270
|
+
/**
|
|
271
|
+
* Load a batch of notes by ID with the fields needed for source resolution.
|
|
272
|
+
*
|
|
273
|
+
* AIEngineBase caches `MJ: AI Agent Notes` unfiltered as full entity objects
|
|
274
|
+
* (`AIEngine.Instance.AgentNotes`), so source-chain ancestors — which are pre-existing
|
|
275
|
+
* notes, never ones created earlier in this same cycle — are already in memory. We serve
|
|
276
|
+
* those from the cache and only issue a RunView for IDs the cache doesn't have, instead of
|
|
277
|
+
* a DB round-trip per BFS depth level. This resolves the redundancy telemetry's
|
|
278
|
+
* "Entity Already in Engine" warning for AIEngineBase while preserving exact behavior
|
|
279
|
+
* (the projection shape and field set are unchanged).
|
|
280
|
+
*/
|
|
257
281
|
private loadResolvedNotes;
|
|
282
|
+
/** Project a cached note entity into the read-only shape used by source resolution. */
|
|
283
|
+
private projectResolvedNote;
|
|
284
|
+
/** RunView fallback for note IDs not present in the AIEngine cache. */
|
|
285
|
+
private loadResolvedNotesFromDatabase;
|
|
258
286
|
/**
|
|
259
287
|
* Partition a batch of resolved notes into terminal originals (pushed into `originals`)
|
|
260
288
|
* and parent IDs that need further resolution. Mutates `originals` and `visited`.
|
|
@@ -351,7 +379,20 @@ export declare class MemoryManagerAgent extends BaseAgent {
|
|
|
351
379
|
*/
|
|
352
380
|
private pruneStaleReferences;
|
|
353
381
|
/**
|
|
354
|
-
*
|
|
382
|
+
* Collect auto-generated, non-immutable `Active` notes that are candidates for orphan
|
|
383
|
+
* pruning, oldest first.
|
|
384
|
+
*
|
|
385
|
+
* Served from the `AIEngine` cache rather than a `RunView`: `AIEngine.Instance.AgentNotes`
|
|
386
|
+
* holds the full note pool, loaded unfiltered as entity objects and kept current via
|
|
387
|
+
* `BaseEntity` save/delete events, so an equivalent in-memory filter/sort/cap avoids both a
|
|
388
|
+
* DB round-trip and the "Entity Already in Engine" redundancy-telemetry warning each cycle.
|
|
389
|
+
* Note `.filter()` returns a fresh array, so the subsequent `.sort()` never reorders the
|
|
390
|
+
* engine's cached array. The result is projected to plain {@link PruneCandidateNote} rows —
|
|
391
|
+
* we never hand a cached `BaseEntity` instance to a mutating caller; `pruneStaleReferences`
|
|
392
|
+
* re-`Load()`s a fresh, owned entity before archiving.
|
|
393
|
+
*
|
|
394
|
+
* @param maxRows Hard cap on candidates returned this cycle (oldest-`__mj_CreatedAt` first).
|
|
395
|
+
* @returns Lightweight projection rows for orphan-reference evaluation.
|
|
355
396
|
*/
|
|
356
397
|
private loadPruneCandidateNotes;
|
|
357
398
|
/**
|
|
@@ -398,6 +439,25 @@ export declare class MemoryManagerAgent extends BaseAgent {
|
|
|
398
439
|
private summarizeDecayFactors;
|
|
399
440
|
/** Archive notes and examples past their explicit ExpiresAt timestamp, regardless of decay score. */
|
|
400
441
|
private archiveExpiredItems;
|
|
442
|
+
/**
|
|
443
|
+
* Find notes and examples whose explicit `ExpiresAt` timestamp has passed, so the
|
|
444
|
+
* archival pass can expire them regardless of decay score.
|
|
445
|
+
*
|
|
446
|
+
* Served from the `AIEngine` caches (`AgentNotes` / `AgentExamples`) instead of a batched
|
|
447
|
+
* `RunViews`: both pools are loaded unfiltered as entity objects and kept current via
|
|
448
|
+
* `BaseEntity` events, so an in-memory filter/cap reproduces the former queries while
|
|
449
|
+
* removing two DB round-trips and the pair of "Entity Already in Engine" redundancy
|
|
450
|
+
* warnings they emitted. Rows are projected to plain shapes; `archiveExpiredNote` /
|
|
451
|
+
* `archiveExpiredExample` re-`Load()` a fresh, owned entity before mutating.
|
|
452
|
+
*
|
|
453
|
+
* Notes include `Provisional` (via {@link IsInjectableNoteStatus} — the same Active+Provisional
|
|
454
|
+
* predicate used by the read-path injection queries) so the TTL safety net on in-flight
|
|
455
|
+
* agent writes is enforced: a provisional note the hardening pass never reaches must still
|
|
456
|
+
* expire.
|
|
457
|
+
*
|
|
458
|
+
* @param nowISO Current time as an ISO string; items with `ExpiresAt` strictly before this are expired.
|
|
459
|
+
* @returns A `[expiredNotes, expiredExamples]` tuple of projection rows (each capped at 200).
|
|
460
|
+
*/
|
|
401
461
|
private loadExpiredItems;
|
|
402
462
|
private archiveExpiredNote;
|
|
403
463
|
private archiveExpiredExample;
|
|
@@ -412,7 +472,17 @@ export declare class MemoryManagerAgent extends BaseAgent {
|
|
|
412
472
|
*/
|
|
413
473
|
private applyProportionalDecay;
|
|
414
474
|
/**
|
|
415
|
-
* Fetch notes and examples
|
|
475
|
+
* Fetch decay-candidate notes and examples from the AIEngine caches.
|
|
476
|
+
*
|
|
477
|
+
* Served from `AIEngine.Instance.AgentNotes` / `AgentExamples` (loaded unfiltered as
|
|
478
|
+
* entity objects and kept current via BaseEntity events), filtered/capped in-memory to
|
|
479
|
+
* mirror the former RunViews — avoids two "Entity Already in Engine" redundancy warnings
|
|
480
|
+
* and a DB round-trip per maintenance cycle. We project to plain candidate rows; the
|
|
481
|
+
* actual decay/archival re-Loads fresh entities.
|
|
482
|
+
*
|
|
483
|
+
* @returns A `[activeNotes, activeExamples]` tuple of decay-candidate projection rows
|
|
484
|
+
* (auto-generated `Active` notes capped at 1000; auto-generated `Active` examples
|
|
485
|
+
* scoring below 50, capped at 500).
|
|
416
486
|
*/
|
|
417
487
|
private loadDecayCandidates;
|
|
418
488
|
/**
|
|
@@ -426,6 +496,31 @@ export declare class MemoryManagerAgent extends BaseAgent {
|
|
|
426
496
|
* Archives if the effective score drops below the archival floor.
|
|
427
497
|
*/
|
|
428
498
|
private decayOneExample;
|
|
499
|
+
/**
|
|
500
|
+
* Hardening pass over in-flight agent-written notes (Status='Provisional',
|
|
501
|
+
* AuthorType='Agent'). Runs UNCONDITIONALLY at the start of every MM cycle —
|
|
502
|
+
* before the consolidation-gated maintenance phases — so that:
|
|
503
|
+
* 1. provisional notes never languish waiting for a consolidation trigger, and
|
|
504
|
+
* 2. notes hardened here participate in importance scoring, consolidation,
|
|
505
|
+
* contradiction detection, and decay in the SAME cycle via the existing
|
|
506
|
+
* machinery (no duplicated reconciliation logic in this pass).
|
|
507
|
+
*
|
|
508
|
+
* Per note: dedupe against hardened (Active) notes using the same LLM dedupe
|
|
509
|
+
* prompt as extraction — duplicates are Archived with ConsolidatedIntoNoteID
|
|
510
|
+
* lineage; survivors are hardened (Status='Active', ExpiresAt=NULL so the
|
|
511
|
+
* standard decay machinery owns their lifetime).
|
|
512
|
+
*/
|
|
513
|
+
protected runHardeningPhase(contextUser: UserInfo): Promise<{
|
|
514
|
+
hardened: number;
|
|
515
|
+
deduped: number;
|
|
516
|
+
failed: number;
|
|
517
|
+
}>;
|
|
518
|
+
/**
|
|
519
|
+
* Harden one provisional note: archive it as a duplicate when the LLM dedupe
|
|
520
|
+
* decision says an equivalent hardened note exists, otherwise promote it to
|
|
521
|
+
* Active with decay-managed lifetime.
|
|
522
|
+
*/
|
|
523
|
+
protected hardenSingleNote(note: MJAIAgentNoteEntity, dedupePrompt: MJAIPromptEntityExtended | undefined, runner: AIPromptRunner, contextUser: UserInfo): Promise<'hardened' | 'deduped' | 'failed'>;
|
|
429
524
|
/**
|
|
430
525
|
* Run all 5 maintenance phases in order: importance scoring, consolidation,
|
|
431
526
|
* contradiction detection, stale-reference pruning, and decay-based archival.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-manager-agent.d.ts","sourceRoot":"","sources":["../src/memory-manager-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"memory-manager-agent.d.ts","sourceRoot":"","sources":["../src/memory-manager-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAA0E,MAAM,sBAAsB,CAAC;AACxH,OAAO,EAEH,mBAAmB,EAKtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAqC,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAA2B,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAgK/L,yFAAyF;AACzF,UAAU,+BAA+B;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;CACnB;AA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