cogmem 3.7.1 → 3.7.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 (87) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/MEMORY_ATLAS.md +2 -2
  3. package/MEMORY_MODEL.md +1 -1
  4. package/README.md +6 -5
  5. package/RELEASE_CHECKLIST.md +5 -5
  6. package/dist/atlas/MemoryAtlasService.d.ts +1 -0
  7. package/dist/atlas/MemoryAtlasService.js +36 -4
  8. package/dist/atlas/MemoryAtlasTypes.d.ts +7 -0
  9. package/dist/belief/BeliefStore.d.ts +3 -1
  10. package/dist/belief/BeliefStore.js +10 -2
  11. package/dist/bin/episode.js +107 -16
  12. package/dist/bin/import-support.js +28 -11
  13. package/dist/config/CogmemConfig.d.ts +1 -0
  14. package/dist/config/CogmemConfig.js +45 -0
  15. package/dist/core/MemoryGraph.js +25 -8
  16. package/dist/dream/DreamScheduler.d.ts +6 -1
  17. package/dist/dream/DreamScheduler.js +36 -6
  18. package/dist/engine/CognitiveGraphCompiler.js +1 -1
  19. package/dist/engine/ConsolidationPipeline.js +4 -4
  20. package/dist/engine/DeepWritePromotionPolicy.d.ts +2 -0
  21. package/dist/engine/DeepWritePromotionPolicy.js +25 -4
  22. package/dist/engine/DreamCuratorWorker.d.ts +3 -0
  23. package/dist/engine/DreamCuratorWorker.js +18 -3
  24. package/dist/engine/FactCompiler.js +2 -2
  25. package/dist/entity/EntityGovernanceService.js +1 -1
  26. package/dist/episode/EpisodeActiveScopeGuard.d.ts +3 -0
  27. package/dist/episode/EpisodeActiveScopeGuard.js +46 -0
  28. package/dist/episode/EpisodeAssembler.d.ts +20 -2
  29. package/dist/episode/EpisodeAssembler.js +458 -98
  30. package/dist/episode/EpisodeBoundaryAuditService.d.ts +70 -0
  31. package/dist/episode/EpisodeBoundaryAuditService.js +276 -0
  32. package/dist/episode/EpisodeBoundaryPolicy.d.ts +75 -0
  33. package/dist/episode/EpisodeBoundaryPolicy.js +189 -0
  34. package/dist/episode/EpisodeBoundaryReplayEngine.d.ts +65 -0
  35. package/dist/episode/EpisodeBoundaryReplayEngine.js +272 -0
  36. package/dist/episode/EpisodeImportIdentity.d.ts +1 -0
  37. package/dist/episode/EpisodeImportIdentity.js +1 -0
  38. package/dist/episode/EpisodeInvariantValidator.d.ts +16 -0
  39. package/dist/episode/EpisodeInvariantValidator.js +99 -0
  40. package/dist/episode/EpisodeSplitPlanner.d.ts +89 -0
  41. package/dist/episode/EpisodeSplitPlanner.js +225 -0
  42. package/dist/episode/EpisodeStore.d.ts +67 -2
  43. package/dist/episode/EpisodeStore.js +443 -59
  44. package/dist/episode/EpisodeTypes.d.ts +2 -2
  45. package/dist/episode/TurnRelationClassifier.d.ts +9 -0
  46. package/dist/episode/TurnRelationClassifier.js +42 -12
  47. package/dist/episode/index.d.ts +3 -0
  48. package/dist/episode/index.js +3 -0
  49. package/dist/factory.d.ts +62 -3
  50. package/dist/factory.js +308 -58
  51. package/dist/mcp/CoreMcpTools.js +103 -8
  52. package/dist/mcp/server.js +1 -1
  53. package/dist/migrations/0028_episode_boundary_guardrails.d.ts +3 -0
  54. package/dist/migrations/0028_episode_boundary_guardrails.js +47 -0
  55. package/dist/migrations/0029_episode_active_scope_guard.d.ts +3 -0
  56. package/dist/migrations/0029_episode_active_scope_guard.js +16 -0
  57. package/dist/migrations/0030_memory_event_local_date_source.d.ts +3 -0
  58. package/dist/migrations/0030_memory_event_local_date_source.js +111 -0
  59. package/dist/migrations/0031_episode_boundary_integrity_repair.d.ts +7 -0
  60. package/dist/migrations/0031_episode_boundary_integrity_repair.js +124 -0
  61. package/dist/migrations/SchemaMigrationRunner.d.ts +2 -0
  62. package/dist/migrations/SchemaMigrationRunner.js +46 -15
  63. package/dist/migrations/index.d.ts +6 -1
  64. package/dist/migrations/index.js +15 -1
  65. package/dist/public.d.ts +1 -1
  66. package/dist/public.js +1 -1
  67. package/dist/recall/BrainRecall.js +1 -1
  68. package/dist/store/DeepWriteCandidateStore.d.ts +21 -3
  69. package/dist/store/DeepWriteCandidateStore.js +118 -11
  70. package/dist/store/EntityStore.d.ts +4 -0
  71. package/dist/store/EntityStore.js +24 -12
  72. package/dist/store/EventStore.d.ts +7 -2
  73. package/dist/store/EventStore.js +144 -23
  74. package/dist/store/FactStore.js +6 -5
  75. package/dist/store/MemoryAtlasStore.d.ts +1 -0
  76. package/dist/store/MemoryAtlasStore.js +54 -0
  77. package/dist/types/ExtensionPoints.d.ts +3 -1
  78. package/dist/types/index.d.ts +1 -0
  79. package/examples/hermes-backend/AGENTS.md +1 -1
  80. package/examples/hermes-backend/README.md +1 -1
  81. package/examples/hermes-backend/SKILL.md +2 -2
  82. package/examples/hermes-backend/references/operations.md +2 -2
  83. package/examples/openclaw-backend/AGENTS.md +1 -1
  84. package/examples/openclaw-backend/README.md +1 -1
  85. package/examples/openclaw-backend/SKILL.md +2 -2
  86. package/examples/openclaw-backend/references/operations.md +2 -2
  87. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  export type EpisodeStatus = 'open' | 'soft_sealed' | 'sealed';
2
2
  export type EpisodeDreamState = 'pending' | 'processing' | 'processed' | 'failed_retryable' | 'failed_terminal' | 'retry_scheduled' | 'skipped';
3
- export type EpisodeDreamStatusValue = 'none' | 'queued' | 'processing' | 'processed' | 'failed';
3
+ export type EpisodeDreamStatusValue = 'none' | 'queued' | 'processing' | 'processed' | 'failed' | 'skipped';
4
4
  export type EpisodeClosureMode = 'soft' | 'hard' | 'manual' | 'batch';
5
- export type EpisodeClosureReasonCode = 'explicit_user_closure' | 'topic_switch' | 'batch_boundary' | 'idle_timeout' | 'manual' | 'soft_seal_stabilized' | 'repair';
5
+ export type EpisodeClosureReasonCode = 'explicit_user_closure' | 'topic_switch' | 'event_limit' | 'duration_limit' | 'idle_gap' | 'local_date_boundary' | 'batch_boundary' | 'idle_timeout' | 'manual' | 'soft_seal_stabilized' | 'repair';
6
6
  export type EpisodeType = 'discussion' | 'decision' | 'correction' | 'preference' | 'goal' | 'debugging' | 'planning' | 'prospective' | 'general';
7
7
  export type EpisodeCandidateType = 'belief' | 'entity' | 'temporal' | 'prospective' | 'correction' | 'preference' | 'goal' | 'decision';
8
8
  export type TurnRelation = 'continues_previous' | 'clarifies_previous' | 'corrects_previous' | 'answers_assistant_question' | 'confirms_assistant_fact' | 'accepts_assistant_proposal' | 'rejects_assistant_proposal' | 'assistant_response' | 'assistant_proposal' | 'assistant_summary' | 'assistant_question' | 'assistant_clarification' | 'tool_result_context' | 'hard_topic_switch' | 'subtopic_shift' | 'ambiguous_shift' | 'switches_topic' | 'starts_new_topic' | 'returns_to_old_topic' | 'confirms_future_intent' | 'closes_episode' | 'noise';
@@ -33,8 +33,17 @@ export interface TurnRelationAdvisoryReviewer {
33
33
  cpuDecision: TurnRelationDecision;
34
34
  }): Promise<unknown>;
35
35
  }
36
+ export type TurnRelationReviewStatus = 'not_invoked' | 'accepted' | 'failed' | 'invalid' | 'stale_ignored';
37
+ export interface TurnRelationHybridTrace {
38
+ cpuDecision: TurnRelationDecision;
39
+ reviewerInvoked: boolean;
40
+ reviewerRawResultStatus: TurnRelationReviewStatus;
41
+ reviewerDecision?: TurnRelationDecision;
42
+ finalDecision: TurnRelationDecision;
43
+ }
36
44
  export declare function classifyTurnRelation(input: string | TurnClassificationContext): TurnRelationDecision;
37
45
  export declare function classifyAssistantRelation(text: string, role?: string): TurnRelation;
38
46
  /** Background-only semantic review. The reviewer can suggest classification fields but cannot mutate memory. */
39
47
  export declare function classifyTurnRelationHybrid(context: TurnClassificationContext, reviewer?: TurnRelationAdvisoryReviewer): Promise<TurnRelationDecision>;
48
+ export declare function classifyTurnRelationHybridTrace(context: TurnClassificationContext, reviewer?: TurnRelationAdvisoryReviewer): Promise<TurnRelationHybridTrace>;
40
49
  //# sourceMappingURL=TurnRelationClassifier.d.ts.map
@@ -3,13 +3,14 @@ const CORRECTION = /^\s*(不对|不是|不,|不是这样|纠正|更正|我(?:
3
3
  const CONTINUATION = /^\s*(继续|接着|然后呢|上面那个|刚才说的|go on|continue|and then|続けて|そのまま)/iu;
4
4
  const EXPLICIT_SWITCH = /^\s*(换个话题|换一个话题|另一个问题|另外一个问题|说点别的|题外话|new topic|switch topics?|on another topic|unrelated question)/iu;
5
5
  const SUBTOPIC = /^\s*(另外|同时|还有|以及|顺便|also|additionally|and for|それと|また)/iu;
6
- const CLOSURE = /(就这样|按这个(?:方案)?做|方案确认|到这里|先这样|结论就是|done|that settles it|proceed with this)/iu;
6
+ const CLOSURE = /(?:^|[\s,。,.!?!?])(?:就这样|按这个(?:方案)?做|方案确认|到这里|先这样|结论就是|done|that settles it|proceed with this)(?:$|[\s,。,.!?!?])/iu;
7
+ const NEGATED_CLOSURE = /(?:不要|别|还不能|不能|not|don't|do not).{0,16}(?:就这样|按这个(?:方案)?做|到这里|结束|done|proceed)/iu;
7
8
  const PREFERENCE = /(请以后|以后请|始终|总是|偏好|喜欢|希望|不要|别|必须|一定要|边界|local-first|prefer|always|never|must|do not)/iu;
8
9
  const GOAL = /(长期目标|目标是|计划要|希望最终|goal|objective)/iu;
9
10
  const DECISION = /(决定|确定采用|选用|按.+方案|decision|decide|chosen|确认采用)/iu;
10
11
  const PROSPECTIVE = /(提醒我|记得在|明天|下周|到时候|remind me|tomorrow|next week)/iu;
11
12
  const DEBUGGING = /(bug|错误|失败|报错|根因|修复|debug|exception)/iu;
12
- const SHORT_ACCEPT = /^\s*(对|是|可以|确认|就这个|第二个|第[一二三四五六七八九十\d]+个|yes|yep|correct|sounds good|そう|はい)[。.!!\s]*$/iu;
13
+ const SHORT_ACCEPT = /^\s*(对|是|可以|确认|好的|好|收到|明白了|就这个|第二个|第[一二三四五六七八九十\d]+个|yes|yep|correct|sounds good|ok|okay|そう|はい)[。.!!\s]*$/iu;
13
14
  const SHORT_REJECT = /^\s*(不对|不是|不行|不要|否|no|nope|違う|いいえ)[。.!!\s]*$/iu;
14
15
  const ASSISTANT_PROPOSAL = /(建议|可以选|选项|should we|recommend|option|propose|どうですか)|^\s*(下一版|应该|推荐|可以考虑)|(?:方案|采用|下一版).{0,80}(?:吗|[??])/iu;
15
16
  const ASSISTANT_QUESTION = /[??]\s*$|(?:是否|要不要|可以吗|确认吗|which|what|when|do you|should we)/iu;
@@ -20,8 +21,6 @@ function classifyTurnRelationBase(input) {
20
21
  const text = String(context.currentUserText || '').trim();
21
22
  const previousAssistant = String(context.previousAssistantText || '').trim();
22
23
  const signals = [];
23
- if (!text || NOISE.test(text))
24
- return decision('noise', 0.98, 'general', 0.05, 'deterministic_noise', ['noise'], false, []);
25
24
  if (SHORT_ACCEPT.test(text) && previousAssistant) {
26
25
  if (ASSISTANT_PROPOSAL.test(previousAssistant)) {
27
26
  return decision('accepts_assistant_proposal', 0.91, inferEpisodeType(previousAssistant), 0.88, 'assistant_context_acceptance', ['short_accept', 'assistant_proposal'], false, inferCandidateTypes(previousAssistant));
@@ -37,9 +36,11 @@ function classifyTurnRelationBase(input) {
37
36
  }
38
37
  return decision('corrects_previous', 0.9, 'correction', 0.9, 'assistant_fact_or_question_correction', ['short_reject', ASSISTANT_QUESTION.test(previousAssistant) ? 'assistant_question' : 'assistant_fact'], false, ['correction']);
39
38
  }
40
- if (CORRECTION.test(text)) {
39
+ if (CORRECTION.test(text) || NEGATED_CLOSURE.test(text)) {
41
40
  return decision('corrects_previous', 0.94, 'correction', 0.9, 'explicit_correction', ['correction_marker'], false, ['correction']);
42
41
  }
42
+ if (!text || NOISE.test(text))
43
+ return decision('noise', 0.98, 'general', 0.05, 'deterministic_noise', ['noise'], false, []);
43
44
  if (EXPLICIT_SWITCH.test(text)) {
44
45
  const active = `${context.activeEpisodeSummary || ''} ${context.activeEpisodeTopicPath || ''}`.trim();
45
46
  const shift = active && hasSpecificTopicPayload(text) ? 'hard' : 'ambiguous';
@@ -86,19 +87,48 @@ export function classifyAssistantRelation(text, role = 'assistant') {
86
87
  }
87
88
  /** Background-only semantic review. The reviewer can suggest classification fields but cannot mutate memory. */
88
89
  export async function classifyTurnRelationHybrid(context, reviewer) {
90
+ return (await classifyTurnRelationHybridTrace(context, reviewer)).finalDecision;
91
+ }
92
+ export async function classifyTurnRelationHybridTrace(context, reviewer) {
89
93
  const cpuDecision = classifyTurnRelation(context);
90
- if (!cpuDecision.needsLlmReview || !reviewer)
91
- return cpuDecision;
94
+ if (!cpuDecision.needsLlmReview || !reviewer) {
95
+ return {
96
+ cpuDecision,
97
+ reviewerInvoked: false,
98
+ reviewerRawResultStatus: 'not_invoked',
99
+ finalDecision: cpuDecision,
100
+ };
101
+ }
92
102
  let value;
93
103
  try {
94
104
  value = await reviewer.review({ context, cpuDecision });
95
105
  }
96
106
  catch {
97
- return { ...cpuDecision, signals: [...cpuDecision.signals, 'advisory_review_failed'] };
107
+ return {
108
+ cpuDecision,
109
+ reviewerInvoked: true,
110
+ reviewerRawResultStatus: 'failed',
111
+ finalDecision: { ...cpuDecision, signals: [...cpuDecision.signals, 'advisory_review_failed'] },
112
+ };
113
+ }
114
+ if (!value || typeof value !== 'object') {
115
+ return {
116
+ cpuDecision,
117
+ reviewerInvoked: true,
118
+ reviewerRawResultStatus: 'invalid',
119
+ finalDecision: cpuDecision,
120
+ };
98
121
  }
99
- if (!value || typeof value !== 'object')
100
- return cpuDecision;
101
- const record = value;
122
+ const finalDecision = applyReviewerDecision(cpuDecision, value);
123
+ return {
124
+ cpuDecision,
125
+ reviewerInvoked: true,
126
+ reviewerRawResultStatus: 'accepted',
127
+ reviewerDecision: finalDecision,
128
+ finalDecision,
129
+ };
130
+ }
131
+ function applyReviewerDecision(cpuDecision, record) {
102
132
  const relation = isTurnRelation(record.relation) ? record.relation : cpuDecision.relation;
103
133
  const confidence = typeof record.confidence === 'number' && Number.isFinite(record.confidence)
104
134
  ? Math.max(0, Math.min(record.confidence, 1))
@@ -124,7 +154,7 @@ export async function classifyTurnRelationHybrid(context, reviewer) {
124
154
  };
125
155
  }
126
156
  function hasConfirmedOverlap(context, text) {
127
- if (context.topicPathMatch === true || context.projectMatch === true)
157
+ if (context.topicPathMatch === true)
128
158
  return true;
129
159
  if ((context.entityOverlap ?? 0) >= 0.5 || (context.semanticSimilarity ?? 0) >= 0.72)
130
160
  return true;
@@ -4,6 +4,9 @@ export * from './EpisodeImportIdentity.js';
4
4
  export * from './EpisodeSemanticSummarizer.js';
5
5
  export * from './EpisodeStore.js';
6
6
  export * from './EpisodeAssembler.js';
7
+ export * from './EpisodeBoundaryAuditService.js';
8
+ export * from './EpisodeBoundaryPolicy.js';
9
+ export * from './EpisodeSplitPlanner.js';
7
10
  export * from './CogmemBlockStripper.js';
8
11
  export * from './CorrectionResolver.js';
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -4,5 +4,8 @@ export * from './EpisodeImportIdentity.js';
4
4
  export * from './EpisodeSemanticSummarizer.js';
5
5
  export * from './EpisodeStore.js';
6
6
  export * from './EpisodeAssembler.js';
7
+ export * from './EpisodeBoundaryAuditService.js';
8
+ export * from './EpisodeBoundaryPolicy.js';
9
+ export * from './EpisodeSplitPlanner.js';
7
10
  export * from './CogmemBlockStripper.js';
8
11
  export * from './CorrectionResolver.js';
package/dist/factory.d.ts CHANGED
@@ -23,9 +23,12 @@ import { ContextCortex } from './context/index.js';
23
23
  import { ProspectiveMemoryService } from './prospective/index.js';
24
24
  import { StrategyCortex } from './strategy/index.js';
25
25
  import { ContextOutcomeStore, MemoryUseJudge } from './eval/strategy/index.js';
26
- import { EpisodeAssembler, EpisodeStore, type EpisodeClosureMode, type EpisodeClosureReceipt, type EpisodeDreamStatus, type EpisodeListOptions, type MemoryEpisode, type TurnRelationAdvisoryReviewer } from './episode/index.js';
26
+ import { EpisodeAssembler, EpisodeStore, type EpisodeBoundaryDecisionRecord, type EpisodeClosureMode, type EpisodeClosureReceipt, type EpisodeDreamStatus, type EpisodeListOptions, type MemoryEpisode, type TurnRelationAdvisoryReviewer } from './episode/index.js';
27
+ import { EpisodeBoundaryAuditService, type EpisodeBoundaryAuditResult } from './episode/EpisodeBoundaryAuditService.js';
28
+ import { EpisodeBoundaryPolicy, type EpisodeBoundaryConfig } from './episode/EpisodeBoundaryPolicy.js';
29
+ import { EpisodeSplitPlanner, type EpisodeSplitPlan } from './episode/EpisodeSplitPlanner.js';
27
30
  import { type DreamTickOptions, type DreamTickResult } from './dream/index.js';
28
- import { type EnvLike } from './config/CogmemConfig.js';
31
+ import { type EnvLike, type ConfigDiagnosticLike } from './config/CogmemConfig.js';
29
32
  import { ModelRegistry } from './models/ModelRegistry.js';
30
33
  import type { Embedder } from './store/Embedder.js';
31
34
  import { CognitiveGraphStore } from './store/CognitiveGraphStore.js';
@@ -43,7 +46,7 @@ import { MemoryGovernanceStore } from './store/MemoryGovernanceStore.js';
43
46
  import { TemporalAdjacencyStore } from './store/TemporalAdjacencyStore.js';
44
47
  import { TopologyStore } from './store/TopologyStore.js';
45
48
  import type { IVectorStore, VectorBackend } from './store/IVectorStore.js';
46
- import type { IngestInput, MemoryEvent, MemoryEventCausalityType, MemoryEventContext, MemoryRawEventType, MemoryEventRole, Neuron } from './types/index.js';
49
+ import type { IngestInput, MemoryEvent, MemoryEventCausalityType, MemoryEventContext, MemoryRawEventType, MemoryEventRole, Neuron, OrderingConfidence } from './types/index.js';
47
50
  import { type ImportOptions, type ImportResult, type SnapshotMeta } from './snapshot/index.js';
48
51
  export type { DreamCuratorRunOptions, DreamCuratorRunResult } from './engine/DreamCuratorWorker.js';
49
52
  export type { DreamTickOptions, DreamTickResult } from './dream/index.js';
@@ -59,6 +62,8 @@ export interface MemoryKernelOptions {
59
62
  encryptionProvider?: EncryptionProvider;
60
63
  redactionPolicy?: RedactionPolicy | false;
61
64
  turnRelationReviewer?: TurnRelationAdvisoryReviewer;
65
+ episodeBoundary?: Partial<EpisodeBoundaryConfig>;
66
+ configDiagnostics?: ConfigDiagnosticLike[];
62
67
  }
63
68
  export interface MemoryKernelFromConfigOptions extends MemoryKernelOptions {
64
69
  configPath?: string;
@@ -267,7 +272,9 @@ export interface RawMemoryEventInput {
267
272
  lineEnd?: number;
268
273
  charStart?: number;
269
274
  charEnd?: number;
275
+ orderingConfidence?: OrderingConfidence;
270
276
  localDate?: string;
277
+ localDateSource?: 'explicit' | 'generated_utc' | 'legacy_unknown';
271
278
  metadata?: Record<string, unknown>;
272
279
  }
273
280
  export interface EpisodeMessageInput {
@@ -279,6 +286,10 @@ export interface EpisodeMessageInput {
279
286
  externalMessageId?: string;
280
287
  timestamp?: number;
281
288
  threadId?: string;
289
+ turnId?: string;
290
+ turnSeq?: number;
291
+ localDate?: string;
292
+ eventOrdinal?: number;
282
293
  metadata?: Record<string, unknown>;
283
294
  }
284
295
  export interface EpisodeMessageResult {
@@ -290,6 +301,17 @@ export interface EpisodeMessageResult {
290
301
  sealed: boolean;
291
302
  dreamRecommended: boolean;
292
303
  dreamRan: false;
304
+ boundaryTriggered?: boolean;
305
+ boundaryDetected?: boolean;
306
+ boundaryApplied?: boolean;
307
+ boundaryMode?: string;
308
+ boundaryDecisionId?: string;
309
+ boundaryGuardCodes?: string[];
310
+ boundaryAuditRecorded?: boolean;
311
+ boundaryAuditStatus?: string;
312
+ previousEpisodeId?: string;
313
+ reviewerRawResultStatus?: string;
314
+ warnings?: string[];
293
315
  }
294
316
  export type EpisodeRepairInput = {
295
317
  operation: 'move-event';
@@ -458,10 +480,14 @@ export declare class MemoryKernel {
458
480
  readonly pipelineMetrics: PipelineMetrics;
459
481
  readonly episodeStore: EpisodeStore;
460
482
  readonly episodeAssembler: EpisodeAssembler;
483
+ readonly episodeBoundaryPolicy: EpisodeBoundaryPolicy;
484
+ readonly episodeBoundaryAuditService: EpisodeBoundaryAuditService;
485
+ readonly episodeSplitPlanner: EpisodeSplitPlanner;
461
486
  readonly userTopicPathRegistry: UserTopicPathRegistry;
462
487
  readonly topicAliasRegistry: TopicAliasRegistry;
463
488
  readonly topicRelationGraph: TopicRelationGraph;
464
489
  readonly topicGovernance: TopicGovernance;
490
+ readonly configDiagnostics: ConfigDiagnosticLike[];
465
491
  private readonly dbPath;
466
492
  private readonly embedder;
467
493
  private readonly embeddingProvider?;
@@ -559,6 +585,7 @@ export declare class MemoryKernel {
559
585
  now?: number;
560
586
  batchSeal?: boolean;
561
587
  forceBatchSeal?: boolean;
588
+ allowNonUserEpisodeStart?: boolean;
562
589
  }): import("./episode/EpisodeAssembler.js").EpisodeAssemblyResult;
563
590
  assembleEpisodeTurnAsync(events: MemoryEvent[], input: {
564
591
  projectId: string;
@@ -568,6 +595,7 @@ export declare class MemoryKernel {
568
595
  now?: number;
569
596
  batchSeal?: boolean;
570
597
  forceBatchSeal?: boolean;
598
+ allowNonUserEpisodeStart?: boolean;
571
599
  }): Promise<import("./episode/EpisodeAssembler.js").EpisodeAssemblyResult>;
572
600
  appendRawEventToEpisode(event: MemoryEvent, input: {
573
601
  projectId: string;
@@ -577,6 +605,8 @@ export declare class MemoryKernel {
577
605
  }): import("./episode/EpisodeAssembler.js").EpisodeAssemblyResult;
578
606
  appendEpisodeMessage(input: EpisodeMessageInput): EpisodeMessageResult;
579
607
  appendEpisodeMessageAsync(input: EpisodeMessageInput): Promise<EpisodeMessageResult>;
608
+ private finishIngestMessage;
609
+ private finishIngestMessageAsync;
580
610
  private resumeEpisodeMessage;
581
611
  private resumeEpisodeMessageAsync;
582
612
  private assertEpisodeIngestIdentity;
@@ -603,6 +633,31 @@ export declare class MemoryKernel {
603
633
  limit?: number;
604
634
  }): EpisodeClosureReceipt[];
605
635
  listEpisodeEventLinks(episodeId: string): import("./episode/EpisodeTypes.js").EpisodeEventLink[];
636
+ auditEpisodeBoundaries(options: {
637
+ projectId: string;
638
+ episodeId?: string;
639
+ status?: MemoryEpisode['status'];
640
+ limit?: number;
641
+ cursor?: string;
642
+ maxEvents?: number;
643
+ maxDurationMs?: number;
644
+ maxIdleGapMs?: number;
645
+ timezone?: string;
646
+ }): EpisodeBoundaryAuditResult;
647
+ listEpisodeBoundaryDecisions(options: {
648
+ projectId: string;
649
+ primaryEventId?: string;
650
+ limit?: number;
651
+ }): EpisodeBoundaryDecisionRecord[];
652
+ planEpisodeSplit(options: {
653
+ projectId: string;
654
+ episodeId: string;
655
+ maxEvents?: number;
656
+ maxDurationMs?: number;
657
+ maxIdleGapMs?: number;
658
+ timezone?: string;
659
+ includeEventIds?: boolean;
660
+ }): EpisodeSplitPlan;
606
661
  getEpisodeDreamStatus(projectId?: string): EpisodeDreamStatus;
607
662
  retryFailedEpisodeDreams(projectId?: string): number;
608
663
  repairEpisodes(options?: {
@@ -614,8 +669,12 @@ export declare class MemoryKernel {
614
669
  assigned: number;
615
670
  unassigned: number;
616
671
  unassignedEventIds: string[];
672
+ nextGlobalSeq: number | undefined;
673
+ hasMore: boolean;
617
674
  };
618
675
  repairEpisode(input: EpisodeRepairInput): EpisodeRepairResult;
676
+ private repairEpisodeInTransaction;
677
+ private invalidatePromotedCandidate;
619
678
  listDreamCandidates(options?: DreamCandidateListOptions): DreamCandidateRecord[];
620
679
  countDreamCandidates(options?: Omit<DreamCandidateListOptions, 'limit'>): number;
621
680
  reviewDreamCandidate(input: CandidateReviewInput): CandidateReviewResult;