@agenr/skeln-plugin 3.3.0 → 2026.6.2

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 (34) hide show
  1. package/dist/build-before-turn-artifact-NPUHVWFE.js +71 -0
  2. package/dist/build-recall-artifact-F3LS3PZX.js +62 -0
  3. package/dist/chunk-5AXMFBHR.js +14 -0
  4. package/dist/chunk-5AYIXQRF.js +4452 -0
  5. package/dist/{chunk-Z5X7T4QZ.js → chunk-5TIP2EPP.js} +1519 -2565
  6. package/dist/{chunk-5LADPJ4C.js → chunk-GAERET5Q.js} +138 -504
  7. package/dist/chunk-GF3PX3VM.js +41 -0
  8. package/dist/chunk-GKZQ5AG5.js +44 -0
  9. package/dist/chunk-LDJN7CVU.js +3231 -0
  10. package/dist/{chunk-ZYADFKX3.js → chunk-MC3C2XM5.js} +34 -1
  11. package/dist/chunk-NBS62ES5.js +3012 -0
  12. package/dist/chunk-NSLTJBUC.js +270 -0
  13. package/dist/chunk-OJSIZDZD.js +9 -0
  14. package/dist/chunk-OWGQWQUP.js +45 -0
  15. package/dist/chunk-Q5UTJXHZ.js +1069 -0
  16. package/dist/{chunk-M5M65AYP.js → chunk-SOQW7356.js} +271 -1934
  17. package/dist/chunk-VBPYU7GO.js +597 -0
  18. package/dist/chunk-VTHBPXDQ.js +1750 -0
  19. package/dist/{chunk-KH52KJSJ.js → chunk-XFJ4S4G2.js} +844 -39
  20. package/dist/chunk-Y5NB3FTH.js +106 -0
  21. package/dist/{chunk-RYMSM3OS.js → chunk-ZX55JBV2.js} +1710 -322
  22. package/dist/claim-slot-policy-CdrW_1l4.d.ts +13 -0
  23. package/dist/index.d.ts +630 -51
  24. package/dist/index.js +881 -4682
  25. package/dist/lifecycle-checkpoint-IAC5FCQU.js +154 -0
  26. package/dist/{claim-slot-policy-CQ-h0GaV.d.ts → ports-C4QkwDBS.d.ts} +168 -78
  27. package/dist/scan-6JKPOQHD.js +6 -0
  28. package/dist/service-EKFACEN6.js +15 -0
  29. package/dist/service-RHNB5AEQ.js +861 -0
  30. package/dist/sink-AUAAWC5O.js +8 -0
  31. package/package.json +1 -1
  32. package/dist/cli.d.ts +0 -1
  33. package/dist/internal-eval-server.d.ts +0 -1
  34. package/dist/internal-recall-eval-server.d.ts +0 -1
@@ -0,0 +1,154 @@
1
+ import {
2
+ normalizeOptionalString
3
+ } from "./chunk-OJSIZDZD.js";
4
+
5
+ // src/app/working-memory/lifecycle-checkpoint.ts
6
+ async function attachWorkingCheckpointRefresh(event, result, workingMemory) {
7
+ const refreshRequest = resolveWorkingCheckpointRefreshRequest(event, result);
8
+ if (!refreshRequest) {
9
+ return result;
10
+ }
11
+ const workingCheckpointRefresh = workingMemory ? await mergeWorkingCheckpoint(refreshRequest, workingMemory) : skippedRefreshWithoutWorkingMemory(refreshRequest.attachLabel);
12
+ return {
13
+ ...result,
14
+ workingCheckpointRefresh
15
+ };
16
+ }
17
+ async function mergeWorkingCheckpoint(request, workingMemory) {
18
+ const scope = resolveWorkingRefreshScope(request.event);
19
+ if (!scope) {
20
+ return {
21
+ ok: false,
22
+ reason: "missing_scope",
23
+ message: `${request.lifecycleLabel} requires working-scope facts.`
24
+ };
25
+ }
26
+ const result = await workingMemory.run({
27
+ action: "update",
28
+ scope,
29
+ operation: {
30
+ type: "merge_checkpoint",
31
+ checkpoint: {
32
+ summary: request.summary,
33
+ recordedAt: request.event.observedAt
34
+ }
35
+ },
36
+ updateReason: request.updateReason,
37
+ actor: "runtime",
38
+ source: "lifecycle_hook"
39
+ });
40
+ if (!result.ok) {
41
+ return mapWorkingMemoryRefreshFailure(result.code, result.message, request.lifecycleLabel);
42
+ }
43
+ if (result.action !== "update") {
44
+ return {
45
+ ok: false,
46
+ reason: "working_memory_unavailable",
47
+ message: `Expected working-memory update result, received ${result.action}.`
48
+ };
49
+ }
50
+ return {
51
+ ok: true,
52
+ action: "working_checkpoint_refreshed",
53
+ workingSetId: result.workingSet.id,
54
+ revision: result.workingSet.revision
55
+ };
56
+ }
57
+ function resolveWorkingCheckpointRefreshRequest(event, result) {
58
+ const compactionEvent = resolveCompactionCheckpointRefreshEvent(event, result);
59
+ if (compactionEvent) {
60
+ const summary = normalizeOptionalString(compactionEvent.artifact.summary);
61
+ if (!summary) {
62
+ return void 0;
63
+ }
64
+ const sourceId = normalizeOptionalString(compactionEvent.artifact.sourceId) ?? "unknown";
65
+ return {
66
+ event: compactionEvent,
67
+ summary,
68
+ updateReason: `Refreshed working checkpoint from session compaction ${sourceId}.`,
69
+ lifecycleLabel: "compaction checkpoint refresh",
70
+ attachLabel: "Compaction checkpoint refresh"
71
+ };
72
+ }
73
+ const shutdownEvent = resolveShutdownCheckpointRefreshEvent(event, result);
74
+ if (!shutdownEvent) {
75
+ return void 0;
76
+ }
77
+ const reason = normalizeShutdownReason(shutdownEvent.shutdownReason);
78
+ return {
79
+ event: shutdownEvent,
80
+ summary: `Session shutdown (${reason}) recorded. Resume from the latest working-set snapshot; no implicit close was performed.`,
81
+ updateReason: `Recorded working checkpoint from session shutdown (${reason}).`,
82
+ lifecycleLabel: "shutdown checkpoint refresh",
83
+ attachLabel: "Shutdown checkpoint refresh"
84
+ };
85
+ }
86
+ function resolveCompactionCheckpointRefreshEvent(event, result) {
87
+ if (event.type !== "session_compact" || result.artifact?.kind !== "compaction_checkpoint") {
88
+ return void 0;
89
+ }
90
+ const artifact = event.artifact;
91
+ if (!isCompactionCheckpointArtifact(artifact)) {
92
+ return void 0;
93
+ }
94
+ return {
95
+ ...event,
96
+ type: "session_compact",
97
+ artifact
98
+ };
99
+ }
100
+ function resolveShutdownCheckpointRefreshEvent(event, result) {
101
+ if (event.type !== "session_shutdown" || result.accepted !== true) {
102
+ return void 0;
103
+ }
104
+ return {
105
+ ...event,
106
+ type: "session_shutdown"
107
+ };
108
+ }
109
+ function isCompactionCheckpointArtifact(artifact) {
110
+ return artifact?.kind === "compaction_checkpoint";
111
+ }
112
+ function resolveWorkingRefreshScope(event) {
113
+ if (event.workingScope && Object.keys(event.workingScope).length > 0) {
114
+ return event.workingScope;
115
+ }
116
+ return void 0;
117
+ }
118
+ function mapWorkingMemoryRefreshFailure(code, message, lifecycleLabel) {
119
+ if (code === "feature_disabled") {
120
+ return {
121
+ ok: false,
122
+ reason: "not_applicable",
123
+ message: `Working memory is disabled; ${lifecycleLabel} was skipped.`
124
+ };
125
+ }
126
+ if (code === "missing_active_set") {
127
+ return {
128
+ ok: false,
129
+ reason: "no_active_working_set",
130
+ code,
131
+ message
132
+ };
133
+ }
134
+ return {
135
+ ok: false,
136
+ reason: "working_memory_unavailable",
137
+ code,
138
+ message
139
+ };
140
+ }
141
+ function normalizeShutdownReason(shutdownReason) {
142
+ const trimmed = shutdownReason?.trim();
143
+ return trimmed && trimmed.length > 0 ? trimmed : "unknown";
144
+ }
145
+ function skippedRefreshWithoutWorkingMemory(label) {
146
+ return {
147
+ ok: false,
148
+ reason: "not_applicable",
149
+ message: `${label} requires a working-memory service, but none was wired into the runtime.`
150
+ };
151
+ }
152
+ export {
153
+ attachWorkingCheckpointRefresh
154
+ };
@@ -2,18 +2,22 @@
2
2
  * Core domain types for agenr.
3
3
  * These types have zero infrastructure dependencies.
4
4
  */
5
- /** Ordered list of supported durable knowledge entry categories. */
6
- declare const ENTRY_TYPES: readonly ["fact", "decision", "preference", "lesson", "relationship", "milestone"];
5
+ /** Ordered list of supported durable memory kinds. */
6
+ declare const DURABLE_KINDS: readonly ["fact", "decision", "preference", "lesson", "relationship", "milestone", "directive"];
7
7
  /**
8
- * Union of all supported knowledge entry categories.
8
+ * Union of all supported durable memory kinds.
9
9
  */
10
- type EntryType = (typeof ENTRY_TYPES)[number];
10
+ type DurableKind = (typeof DURABLE_KINDS)[number];
11
+ /** Ordered list of supported behavioral directive polarities. */
12
+ declare const DIRECTIVE_POLARITIES: readonly ["abstain", "proactive"];
13
+ /** Ordered list of non-topic behavioral directive triggers. */
14
+ declare const DIRECTIVE_BASE_TRIGGERS: readonly ["session_start", "always"];
11
15
  /** Ordered list of supported recall durability levels. */
12
16
  declare const EXPIRY_LEVELS: readonly ["core", "permanent", "temporary"];
13
17
  /** Ordered list of supported claim-key lifecycle statuses. */
14
18
  declare const CLAIM_KEY_STATUSES: readonly ["trusted", "tentative", "unresolved"];
15
19
  /** Ordered list of supported claim-key provenance sources. */
16
- declare const CLAIM_KEY_SOURCES: readonly ["manual", "model", "json_retry", "deterministic_repair", "surgeon_metadata_rewrite", "surgeon_family_reuse", "surgeon_compaction"];
20
+ declare const CLAIM_KEY_SOURCES: readonly ["manual", "model", "json_retry", "deterministic_repair", "dreaming_extract", "dreaming_reconcile", "dreaming_temporalize", "dreaming_project"];
17
21
  /** Ordered list of supported claim-support provenance modes. */
18
22
  declare const CLAIM_SUPPORT_MODES: readonly ["explicit", "normalized", "inferred"];
19
23
 
@@ -33,6 +37,14 @@ type ClaimKeySource = (typeof CLAIM_KEY_SOURCES)[number];
33
37
  * Union of all supported claim-support provenance modes.
34
38
  */
35
39
  type ClaimSupportMode = (typeof CLAIM_SUPPORT_MODES)[number];
40
+ /**
41
+ * Union of supported directive polarity values.
42
+ */
43
+ type DirectivePolarity = (typeof DIRECTIVE_POLARITIES)[number];
44
+ /**
45
+ * Supported directive trigger shape.
46
+ */
47
+ type DirectiveTrigger = (typeof DIRECTIVE_BASE_TRIGGERS)[number] | `topic:${string}`;
36
48
  /** Ordered list of supported episode sources. */
37
49
  declare const EPISODE_SOURCES: readonly ["openclaw", "skeln", "codex", "cli", "synthesis"];
38
50
  /** Ordered list of supported episode activity levels. */
@@ -40,7 +52,7 @@ declare const EPISODE_ACTIVITY_LEVELS: readonly ["substantial", "minimal", "none
40
52
  /** Ordered list of supported procedure step kinds. */
41
53
  declare const PROCEDURE_STEP_KINDS: readonly ["run_command", "read_reference", "inspect_state", "edit_file", "ask_user", "invoke_tool", "verify"];
42
54
  /** Ordered list of supported procedure provenance source kinds. */
43
- declare const PROCEDURE_SOURCE_KINDS: readonly ["skill", "doc", "entry", "episode", "repo_file", "manual"];
55
+ declare const PROCEDURE_SOURCE_KINDS: readonly ["skill", "doc", "durable", "episode", "repo_file", "manual"];
44
56
 
45
57
  /**
46
58
  * Union of all supported episode sources.
@@ -75,9 +87,9 @@ interface ClaimKeyLifecycleMetadata {
75
87
  /**
76
88
  * Canonical stored knowledge record.
77
89
  */
78
- interface Entry extends ClaimKeyLifecycleMetadata {
90
+ interface Durable extends ClaimKeyLifecycleMetadata {
79
91
  id: string;
80
- type: EntryType;
92
+ type: DurableKind;
81
93
  subject: string;
82
94
  content: string;
83
95
  importance: number;
@@ -94,15 +106,13 @@ interface Entry extends ClaimKeyLifecycleMetadata {
94
106
  superseded_by?: string;
95
107
  valid_from?: string;
96
108
  valid_to?: string;
109
+ directive_polarity?: DirectivePolarity;
110
+ directive_trigger?: DirectiveTrigger;
97
111
  claim_key?: string;
98
112
  supersession_kind?: string;
99
113
  supersession_reason?: string;
100
- cluster_id?: string;
101
114
  user_id?: string;
102
115
  project?: string;
103
- retired: boolean;
104
- retired_at?: string;
105
- retired_reason?: string;
106
116
  created_at: string;
107
117
  updated_at: string;
108
118
  }
@@ -114,21 +124,22 @@ interface Entry extends ClaimKeyLifecycleMetadata {
114
124
  * lifecycle payload for the target claim key. Partial lifecycle patches are
115
125
  * rejected at the persistence boundary.
116
126
  */
117
- interface EntryUpdateInput {
118
- importance?: Entry["importance"];
119
- expiry?: Entry["expiry"];
120
- claim_key?: Entry["claim_key"];
121
- claim_key_raw?: Entry["claim_key_raw"];
122
- claim_key_status?: Entry["claim_key_status"];
123
- claim_key_source?: Entry["claim_key_source"];
124
- claim_key_confidence?: Entry["claim_key_confidence"];
125
- claim_key_rationale?: Entry["claim_key_rationale"];
126
- claim_support_source_kind?: Entry["claim_support_source_kind"];
127
- claim_support_locator?: Entry["claim_support_locator"];
128
- claim_support_observed_at?: Entry["claim_support_observed_at"];
129
- claim_support_mode?: Entry["claim_support_mode"];
130
- valid_from?: Entry["valid_from"];
131
- valid_to?: Entry["valid_to"];
127
+ interface DurableUpdateInput {
128
+ importance?: Durable["importance"];
129
+ expiry?: Durable["expiry"];
130
+ claim_key?: Durable["claim_key"];
131
+ claim_key_raw?: Durable["claim_key_raw"];
132
+ claim_key_status?: Durable["claim_key_status"];
133
+ claim_key_source?: Durable["claim_key_source"];
134
+ claim_key_confidence?: Durable["claim_key_confidence"];
135
+ claim_key_rationale?: Durable["claim_key_rationale"];
136
+ claim_support_source_kind?: Durable["claim_support_source_kind"];
137
+ claim_support_locator?: Durable["claim_support_locator"];
138
+ claim_support_observed_at?: Durable["claim_support_observed_at"];
139
+ claim_support_mode?: Durable["claim_support_mode"];
140
+ valid_from?: Durable["valid_from"];
141
+ valid_to?: Durable["valid_to"];
142
+ project?: Durable["project"];
132
143
  }
133
144
  /**
134
145
  * Canonical stored episodic-memory record.
@@ -153,9 +164,10 @@ interface Episode {
153
164
  genVersion?: string;
154
165
  messageCount?: number;
155
166
  embedding?: number[];
156
- retired: boolean;
157
- retiredAt?: string;
158
- retiredReason?: string;
167
+ validFrom?: string;
168
+ validTo?: string;
169
+ supersessionKind?: string;
170
+ supersessionReason?: string;
159
171
  supersededBy?: string;
160
172
  createdAt: string;
161
173
  updatedAt: string;
@@ -319,9 +331,10 @@ interface ProcedureLifecycleMetadata {
319
331
  recall_text: string;
320
332
  revision_hash: string;
321
333
  source_hash: string;
322
- retired: boolean;
323
- retired_at?: string;
324
- retired_reason?: string;
334
+ valid_from?: string;
335
+ valid_to?: string;
336
+ supersession_kind?: string;
337
+ supersession_reason?: string;
325
338
  superseded_by?: string;
326
339
  created_at: string;
327
340
  updated_at: string;
@@ -334,6 +347,54 @@ interface Procedure extends ProcedureDefinition, ProcedureLifecycleMetadata {
334
347
  source_file?: string;
335
348
  embedding?: number[];
336
349
  }
350
+ /**
351
+ * Normalized transcript message emitted by transcript adapters.
352
+ */
353
+ interface TranscriptMessage {
354
+ index: number;
355
+ role: "user" | "assistant";
356
+ text: string;
357
+ timestamp?: string;
358
+ }
359
+ /**
360
+ * Session-level metadata derived while parsing a transcript file.
361
+ */
362
+ interface SessionTranscriptMetadata {
363
+ sessionId?: string;
364
+ startedAt?: string;
365
+ endedAt?: string;
366
+ messageCount: number;
367
+ transcriptHash: string;
368
+ }
369
+ /**
370
+ * Parsed transcript metadata exposed to transcript consumers.
371
+ */
372
+ interface ParsedTranscriptMetadata extends SessionTranscriptMetadata {
373
+ sessionLabel?: string;
374
+ modelsUsed?: string[];
375
+ /** Best-effort surface reconstructed from transcript content. */
376
+ reconstructedSurface?: string | null;
377
+ /** Provenance for the reconstructed surface value. */
378
+ surfaceReconstructionSource?: "reconstructed" | "none";
379
+ /** Stable source identity derived by the transcript adapter when available. */
380
+ sourceIdentity?: string;
381
+ /** Adapter-specific kind describing the stable source identity. */
382
+ sourceIdentityKind?: string;
383
+ /** Best-effort working-directory or workspace path for the session. */
384
+ workingDirectory?: string;
385
+ /** Explicit user identifier carried by the transcript source when available. */
386
+ userId?: string;
387
+ /** Explicit project identifier carried by the transcript source when available. */
388
+ project?: string;
389
+ }
390
+ /**
391
+ * Parsed transcript with normalized messages and source metadata.
392
+ */
393
+ interface ParsedTranscript {
394
+ messages: TranscriptMessage[];
395
+ metadata: ParsedTranscriptMetadata;
396
+ warnings: string[];
397
+ }
337
398
 
338
399
  /**
339
400
  * Aggregate active corpus counts for one entity prefix.
@@ -344,12 +405,11 @@ interface ClaimKeyEntityPrefixStats {
344
405
  trustedEntryCount: number;
345
406
  tentativeEntryCount: number;
346
407
  unresolvedEntryCount: number;
347
- legacyEntryCount: number;
348
408
  deterministicRepairEntryCount: number;
349
409
  manualEntryCount: number;
350
410
  modelEntryCount: number;
351
411
  jsonRetryEntryCount: number;
352
- surgeonFamilyReuseEntryCount: number;
412
+ dreamingFamilyReuseDurableCount: number;
353
413
  }
354
414
 
355
415
  /**
@@ -421,7 +481,7 @@ interface RecallInput {
421
481
  limit?: number;
422
482
  threshold?: number;
423
483
  budget?: number;
424
- types?: EntryType[];
484
+ types?: DurableKind[];
425
485
  tags?: string[];
426
486
  since?: string;
427
487
  until?: string;
@@ -443,7 +503,7 @@ interface RecallInput {
443
503
  * in the composite score directly now that RRF owns the fused signal.
444
504
  */
445
505
  interface RecallOutput {
446
- entry: Entry;
506
+ entry: Durable;
447
507
  score: number;
448
508
  scores: {
449
509
  /** Fused reciprocal rank fusion score used as the composite relevance signal. */
@@ -473,12 +533,12 @@ interface RecallOutput {
473
533
  /**
474
534
  * Minimal entry fields needed during recall scoring before final hydration.
475
535
  */
476
- type RecallCandidateEntry = Pick<Entry, "id" | "subject" | "content" | "importance" | "expiry" | "created_at" | "embedding" | "superseded_by" | "claim_key" | "claim_key_status" | "claim_support_observed_at" | "valid_from" | "valid_to" | "retired">;
536
+ type RecallCandidateDurable = Pick<Durable, "id" | "subject" | "content" | "importance" | "expiry" | "created_at" | "embedding" | "superseded_by" | "claim_key" | "claim_key_status" | "claim_support_observed_at" | "valid_from" | "valid_to">;
477
537
  /**
478
538
  * A candidate returned from vector search with ranking-time entry data.
479
539
  */
480
540
  interface VectorCandidate {
481
- entry: RecallCandidateEntry;
541
+ entry: RecallCandidateDurable;
482
542
  vectorSim: number;
483
543
  }
484
544
  /**
@@ -490,18 +550,43 @@ interface VectorCandidate {
490
550
  * final composite score.
491
551
  */
492
552
  interface FtsCandidate {
493
- entry: RecallCandidateEntry;
553
+ entry: RecallCandidateDurable;
494
554
  rank: number;
495
555
  tier: "exact" | "all_tokens" | "any_tokens";
496
556
  }
557
+ /**
558
+ * Candidate shape after the vector and FTS admission paths are merged into one
559
+ * entry-id keyed pool. Vector similarity is preserved when a candidate appeared
560
+ * in the vector channel.
561
+ */
562
+ interface RecallMergedCandidate {
563
+ entry: RecallCandidateDurable;
564
+ vectorSim?: number;
565
+ }
566
+ /**
567
+ * Merged recall candidate pool plus the per-channel ordered rank lists that
568
+ * reciprocal rank fusion consumes. This is the single shape produced by the
569
+ * merge stage and consumed by valid-time filtering and scoring.
570
+ */
571
+ interface RecallMergeOutcome {
572
+ merged: Map<string, RecallMergedCandidate>;
573
+ vectorRanks: string[];
574
+ ftsRanks: string[];
575
+ }
497
576
  /**
498
577
  * Filters that the core recall pipeline can push down into adapter queries.
499
578
  */
500
- interface EntryFilters {
501
- types?: EntryType[];
579
+ interface DurableFilters {
580
+ types?: DurableKind[];
502
581
  tags?: string[];
503
582
  since?: Date;
504
583
  until?: Date;
584
+ /**
585
+ * When set, adapter queries exclude durables whose valid-time window does not
586
+ * contain this instant. Core recall still applies the same filter after merge
587
+ * as defense in depth for non-SQL retrieval paths.
588
+ */
589
+ validAsOf?: Date;
505
590
  }
506
591
 
507
592
  /**
@@ -533,7 +618,7 @@ interface EntryFilters {
533
618
  * - `session_family` reaches across episodes originating in the same
534
619
  * session identity (same `source` plus `sourceId`).
535
620
  * - `topic_family` reaches across rows sharing a strong subject prefix and
536
- * is the weakest, retired-only fallback for entries.
621
+ * is the weakest, historical-only fallback for entries.
537
622
  */
538
623
  type NeighborhoodFamily = "supersession_chain" | "claim_key_sibling" | "procedure_revision" | "session_family" | "topic_family";
539
624
  /**
@@ -541,18 +626,18 @@ type NeighborhoodFamily = "supersession_chain" | "claim_key_sibling" | "procedur
541
626
  *
542
627
  * This is the generalized successor of the phase 1 `fetchPredecessors`
543
628
  * lookup. The adapter should honor the requested `families` exactly and
544
- * respect `includeRetired` as a hard gate so the default entry profile
545
- * never pulls retired rows into the candidate pool.
629
+ * respect `includeHistorical` as a hard gate so the default entry profile
630
+ * never pulls historical rows into the candidate pool.
546
631
  */
547
- interface EntryNeighborhoodRequest {
632
+ interface DurableNeighborhoodRequest {
548
633
  /** Seed entry IDs to expand around. */
549
634
  seedIds: string[];
550
635
  /** Maximum total rows the adapter may return. */
551
636
  budget: number;
552
637
  /** Families the adapter should traverse. */
553
638
  families: readonly NeighborhoodFamily[];
554
- /** When true, retired rows are eligible; when false, only active rows. */
555
- includeRetired?: boolean;
639
+ /** When true, historical rows are eligible; when false, only active rows. */
640
+ includeHistorical?: boolean;
556
641
  }
557
642
  /** Default total-rows budget for one neighborhood expansion call. */
558
643
  declare const DEFAULT_NEIGHBORHOOD_BUDGET = 24;
@@ -636,7 +721,7 @@ declare function seededRerank<TCandidate extends SeededRerankCandidate>(candidat
636
721
  * @param seed - Strong-seed entry the candidate is being compared to.
637
722
  * @returns True when the two entries share lineage, false otherwise.
638
723
  */
639
- declare function sharesEntryLineage(candidate: RecallCandidateEntry, seed: RecallCandidateEntry): boolean;
724
+ declare function sharesEntryLineage(candidate: RecallCandidateDurable, seed: RecallCandidateDurable): boolean;
640
725
  /**
641
726
  * Decide whether two episodes belong to the same session family.
642
727
  *
@@ -665,25 +750,25 @@ declare function sharesProcedureLineage(candidate: Procedure, seed: Procedure):
665
750
  */
666
751
  interface DatabasePort {
667
752
  /** Insert a new entry with its embedding. */
668
- insertEntry(entry: Entry, embedding: number[], contentHash: string): Promise<string>;
753
+ insertDurable(entry: Durable, embedding: number[], contentHash: string): Promise<string>;
669
754
  /** Drop expensive indexes and triggers before a bulk write phase begins. */
670
755
  prepareForBulkWrites(): Promise<void>;
671
756
  /** Rebuild expensive indexes and triggers after a bulk write phase ends. */
672
757
  finalizeBulkWrites(): Promise<void>;
673
758
  /** Get entries by IDs. */
674
- getEntries(ids: string[]): Promise<Entry[]>;
759
+ getDurables(ids: string[]): Promise<Durable[]>;
675
760
  /** Get a single entry by ID. */
676
- getEntry(id: string): Promise<Entry | null>;
761
+ getDurable(id: string): Promise<Durable | null>;
677
762
  /** Check if content hashes already exist. Returns the set of existing hashes. */
678
763
  findExistingHashes(hashes: string[]): Promise<Set<string>>;
679
764
  /** Check if normalized content hashes already exist. Returns the set of existing hashes. */
680
765
  findExistingNormHashes(hashes: string[]): Promise<Set<string>>;
681
- /** Mark an entry as retired. */
682
- retireEntry(id: string, reason?: string): Promise<boolean>;
766
+ /** Close one entry's valid-time window so it becomes stale for current recall. */
767
+ closeDurableValidity(id: string, reason?: string): Promise<boolean>;
683
768
  /** Supersede an active entry, linking it to the new entry that replaces it. */
684
- supersedeEntry(oldId: string, newId: string, kind?: string, reason?: string): Promise<boolean>;
769
+ supersedeDurable(oldId: string, newId: string, kind?: string, reason?: string): Promise<boolean>;
685
770
  /** Find active entries with the given claim key. */
686
- findActiveEntriesByClaimKey(claimKey: string): Promise<Entry[]>;
771
+ findActiveDurablesByClaimKey(claimKey: string): Promise<Durable[]>;
687
772
  /** Get distinct entity prefixes from existing claim keys. */
688
773
  getDistinctClaimKeyPrefixes(): Promise<string[]>;
689
774
  /** Get bounded full claim-key examples ordered for extraction hinting. */
@@ -691,7 +776,7 @@ interface DatabasePort {
691
776
  /** Get active per-prefix claim-key counts for conservative alias-family handling. */
692
777
  getClaimKeyEntityPrefixStats?(): Promise<ClaimKeyEntityPrefixStats[]>;
693
778
  /** Update entry fields (importance, expiry, and temporal metadata). */
694
- updateEntry(id: string, fields: EntryUpdateInput): Promise<boolean>;
779
+ updateDurable(id: string, fields: DurableUpdateInput): Promise<boolean>;
695
780
  /** Check if a file has been ingested (by path + hash). */
696
781
  getIngestLogEntry(filePath: string): Promise<{
697
782
  fileHash: string;
@@ -714,7 +799,7 @@ interface EpisodeDatabasePort {
714
799
  getEpisodeByTranscriptHash(source: EpisodeSource, transcriptHash: string): Promise<Episode | null>;
715
800
  /** Insert or update an episode using `summaryHash` change detection. */
716
801
  upsertEpisode(input: EpisodeInput): Promise<EpisodeUpsertResult>;
717
- /** List non-retired episodes whose time range overlaps the requested window. */
802
+ /** List active episodes whose time range overlaps the requested window. */
718
803
  listEpisodesByTimeWindow(window: TemporalWindow, limit?: number): Promise<Episode[]>;
719
804
  /** Find episodes by vector similarity to a query embedding. */
720
805
  episodeVectorSearch(params: {
@@ -724,7 +809,7 @@ interface EpisodeDatabasePort {
724
809
  episode: Episode;
725
810
  vectorSim: number;
726
811
  }>>;
727
- /** List non-retired episodes that still need embeddings. */
812
+ /** List active episodes that still need embeddings. */
728
813
  listEpisodesWithoutEmbeddings(limit?: number): Promise<Episode[]>;
729
814
  /** Update only the embedding payload for an existing episode row. */
730
815
  updateEpisodeEmbedding(id: string, embedding: number[]): Promise<void>;
@@ -761,10 +846,18 @@ interface ProcedureDatabasePort {
761
846
  listProceduresWithoutEmbeddings(limit?: number): Promise<Procedure[]>;
762
847
  /** Update only the embedding payload for an existing procedure row. */
763
848
  updateProcedureEmbedding(id: string, embedding: number[]): Promise<void>;
764
- /** Mark one active procedure revision as retired. */
765
- retireProcedure(id: string, reason?: string): Promise<boolean>;
849
+ /** Close one active procedure revision's valid-time window. */
850
+ closeProcedureValidity(id: string, reason?: string): Promise<boolean>;
766
851
  /** Supersede one active procedure revision with a new revision. */
767
852
  supersedeProcedure(oldId: string, newId: string, reason?: string): Promise<boolean>;
853
+ /**
854
+ * Replace one active procedure revision with a new revision atomically.
855
+ *
856
+ * Owns the active-key unique-index and `superseded_by` foreign-key ordering so
857
+ * callers do not reimplement the close-insert-link sequence. Must run inside a
858
+ * write transaction.
859
+ */
860
+ replaceProcedureRevision(existingId: string, replacement: Procedure, reason?: string): Promise<Procedure>;
768
861
  }
769
862
  /**
770
863
  * Embedding provider contract used by core ranking and storage flows.
@@ -783,26 +876,26 @@ interface RecallPorts {
783
876
  vectorSearch(params: {
784
877
  embedding: number[];
785
878
  limit: number;
786
- filters?: EntryFilters;
879
+ filters?: DurableFilters;
787
880
  }): Promise<VectorCandidate[]>;
788
881
  /** Search FTS candidates with adapter-level filtering applied. */
789
882
  ftsSearch(params: {
790
883
  text: string;
791
884
  limit: number;
792
- filters?: EntryFilters;
885
+ filters?: DurableFilters;
793
886
  }): Promise<FtsCandidate[]>;
794
887
  /**
795
888
  * Expand a typed neighborhood of entries around the provided seed IDs.
796
889
  *
797
- * The adapter honors `families` exactly and treats `includeRetired` as a
890
+ * The adapter honors `families` exactly and treats `includeHistorical` as a
798
891
  * hard gate. This is the generalized successor of the phase 1
799
892
  * `fetchPredecessors` lookup and is used by every entry ranking profile.
800
- * The default profile passes `includeRetired: false`; historical-state
801
- * passes `includeRetired: true` with a wider family set.
893
+ * The default profile passes `includeHistorical: false`; historical-state
894
+ * passes `includeHistorical: true` with a wider family set.
802
895
  */
803
- expandNeighborhood?(request: EntryNeighborhoodRequest): Promise<RecallCandidateEntry[]>;
896
+ expandNeighborhood?(request: DurableNeighborhoodRequest): Promise<RecallCandidateDurable[]>;
804
897
  /** Hydrate fully populated entries for the final ranked result set. */
805
- hydrateEntries(ids: string[]): Promise<Entry[]>;
898
+ hydrateEntries(ids: string[]): Promise<Durable[]>;
806
899
  /** Persist recall events for the returned entry set. */
807
900
  recordRecallEvents(params: {
808
901
  entryIds: string[];
@@ -864,17 +957,14 @@ interface CrossEncoderPort {
864
957
  */
865
958
  rank(query: string, passages: readonly CrossEncoderPassage[]): Promise<CrossEncoderScore[]>;
866
959
  }
867
-
868
- /**
869
- * Runtime slot-policy classes used by claim-centric read surfaces.
870
- */
871
- type ClaimSlotPolicy = "exclusive" | "multivalued";
872
960
  /**
873
- * Data-driven slot-policy overrides keyed by canonical claim-key attribute head.
961
+ * Transcript source contract for parsing external session files into core types.
874
962
  */
875
- interface ClaimSlotPolicyConfig {
876
- /** Optional attribute-head policy overrides such as `integration -> exclusive`. */
877
- attributeHeads?: Readonly<Record<string, ClaimSlotPolicy>>;
963
+ interface TranscriptPort {
964
+ /** Parse a raw session file into a structured transcript. */
965
+ parseFile(filePath: string, options?: {
966
+ verbose?: boolean;
967
+ }): Promise<ParsedTranscript>;
878
968
  }
879
969
 
880
- export { type ClaimSlotPolicyConfig as C, DEFAULT_NEIGHBORHOOD_BUDGET as D, type EntryType as E, type FtsCandidate as F, type LlmPort as L, type NeighborhoodFamily as N, type ProcedureDatabasePort as P, type RecallInput as R, type SeededRerankCandidate as S, type VectorCandidate as V, type CrossEncoderPort as a, type Expiry as b, type RecallPorts as c, type RecallOutput as d, DEFAULT_SEEDED_RERANK_WEIGHT as e, DEFAULT_STRONG_SEED_SCORE_GAP as f, DEFAULT_STRONG_SEED_TOP_N as g, type EntityAttributeKind as h, type EntityAttributeQueryShape as i, type EntryFilters as j, type EntryNeighborhoodRequest as k, type RecallCandidateEntry as l, type RecallRankingProfile as m, type SeededRerankOptions as n, selectStrongSeeds as o, sharesEntryLineage as p, sharesEpisodeLineage as q, sharesProcedureLineage as r, seededRerank as s, type Entry as t, type ClaimSlotPolicy as u, type DatabasePort as v, type EpisodeDatabasePort as w, type EmbeddingPort as x };
970
+ export { type CrossEncoderPort as C, type DurableKind as D, type Expiry as E, type FtsCandidate as F, type LlmPort as L, type NeighborhoodFamily as N, type ParsedTranscript as P, type RecallInput as R, type SeededRerankCandidate as S, type TranscriptPort as T, type VectorCandidate as V, type Durable as a, type RecallPorts as b, type RecallOutput as c, DEFAULT_NEIGHBORHOOD_BUDGET as d, DEFAULT_SEEDED_RERANK_WEIGHT as e, DEFAULT_STRONG_SEED_SCORE_GAP as f, DEFAULT_STRONG_SEED_TOP_N as g, type DurableFilters as h, type DurableNeighborhoodRequest as i, type EntityAttributeKind as j, type EntityAttributeQueryShape as k, type RecallCandidateDurable as l, type RecallMergeOutcome as m, type RecallMergedCandidate as n, type RecallRankingProfile as o, type SeededRerankOptions as p, selectStrongSeeds as q, sharesEntryLineage as r, seededRerank as s, sharesEpisodeLineage as t, sharesProcedureLineage as u, type ProcedureDatabasePort as v, type DurableUpdateInput as w, type DatabasePort as x, type EpisodeDatabasePort as y, type EmbeddingPort as z };
@@ -0,0 +1,6 @@
1
+ import {
2
+ runDreamScan
3
+ } from "./chunk-GKZQ5AG5.js";
4
+ export {
5
+ runDreamScan
6
+ };
@@ -0,0 +1,15 @@
1
+ import {
2
+ backupDatabaseFile,
3
+ runDream,
4
+ runDreamWithHeldLock
5
+ } from "./chunk-5AYIXQRF.js";
6
+ import "./chunk-GF3PX3VM.js";
7
+ import "./chunk-SOQW7356.js";
8
+ import "./chunk-VTHBPXDQ.js";
9
+ import "./chunk-VBPYU7GO.js";
10
+ import "./chunk-GKZQ5AG5.js";
11
+ export {
12
+ backupDatabaseFile,
13
+ runDream,
14
+ runDreamWithHeldLock
15
+ };