@remnic/core 9.3.714 → 9.3.716

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 (39) hide show
  1. package/dist/access-boundary.d.ts +2 -2
  2. package/dist/access-cli.js +2 -2
  3. package/dist/access-http.d.ts +2 -2
  4. package/dist/access-mcp.d.ts +2 -2
  5. package/dist/access-operations.d.ts +2 -2
  6. package/dist/{access-service-lddjZoRh.d.ts → access-service-BW8cm_uU.d.ts} +1 -1
  7. package/dist/access-service.d.ts +2 -2
  8. package/dist/access-surface-catalog.d.ts +2 -2
  9. package/dist/bootstrap.d.ts +1 -1
  10. package/dist/{chunk-OQH5XUH3.js → chunk-Q6IP2ARR.js} +2 -5
  11. package/dist/chunk-Q6IP2ARR.js.map +1 -0
  12. package/dist/{chunk-FXZKXW7C.js → chunk-SQ4LU27I.js} +48 -20
  13. package/dist/chunk-SQ4LU27I.js.map +1 -0
  14. package/dist/{cli-iAiVkbYJ.d.ts → cli-Dpivy32W.d.ts} +2 -2
  15. package/dist/cli.d.ts +3 -3
  16. package/dist/direct-answer-wiring.d.ts +9 -9
  17. package/dist/direct-answer-wiring.js +1 -1
  18. package/dist/explicit-capture.d.ts +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +2 -2
  21. package/dist/mcp-memory-inspector-app.d.ts +2 -2
  22. package/dist/{orchestrator-iVZWi8aW.d.ts → orchestrator-vygo2YIM.d.ts} +15 -5
  23. package/dist/orchestrator.d.ts +1 -1
  24. package/dist/orchestrator.js +2 -2
  25. package/dist/recall-planner-llm.d.ts +1 -1
  26. package/dist/recall-planner-llm.js +2 -2
  27. package/dist/recall-planner-llm.js.map +1 -1
  28. package/dist/schemas.d.ts +22 -22
  29. package/dist/transfer/types.d.ts +12 -12
  30. package/package.json +2 -2
  31. package/src/capabilities.test.ts +28 -0
  32. package/src/direct-answer-wiring.test.ts +20 -13
  33. package/src/direct-answer-wiring.ts +9 -13
  34. package/src/faithfulness-graph-guard.test.ts +214 -8
  35. package/src/orchestrator.ts +68 -27
  36. package/src/recall-planner-llm.test.ts +30 -11
  37. package/src/recall-planner-llm.ts +4 -5
  38. package/dist/chunk-FXZKXW7C.js.map +0 -1
  39. package/dist/chunk-OQH5XUH3.js.map +0 -1
@@ -7,7 +7,7 @@ import { RebuildMemoryLifecycleLedgerResult } from './maintenance/rebuild-memory
7
7
  import { RebuildObservationsResult } from './maintenance/rebuild-observations.js';
8
8
  import { ArchiveObservationsResult } from './maintenance/archive-observations.js';
9
9
  import { Writable, Readable } from 'node:stream';
10
- import { O as Orchestrator } from './orchestrator-iVZWi8aW.js';
10
+ import { O as Orchestrator } from './orchestrator-vygo2YIM.js';
11
11
  import { ReplayRunSummary } from './replay/runner.js';
12
12
  import { ReplaySource, ReplayTurn } from './replay/types.js';
13
13
  import { b as BulkImportResult } from './types-gb_SNtjR.js';
@@ -16,7 +16,7 @@ import { WorkProjectStatus, WorkTaskStatus, WorkTaskPriority } from './work/type
16
16
  import { RoutePatternType } from './routing/engine.js';
17
17
  import { TailscaleSyncOptions } from './network/tailscale.js';
18
18
  import { DashboardStatus } from './dashboard-runtime.js';
19
- import { g as EngramAccessService } from './access-service-lddjZoRh.js';
19
+ import { g as EngramAccessService } from './access-service-BW8cm_uU.js';
20
20
  import { ResolveSecretRefFn } from './resolve-auth-token.js';
21
21
  import { CompatRunner, CompatReport } from './compat/types.js';
22
22
  import { EvalBaselineDeltaReport, EvalBaselineSnapshot, EvalCiGateReport, EvalBenchmarkPackSummary, EvalHarnessStatus, EvalStoredBaselineCiGateReport } from './evals.js';
package/dist/cli.d.ts CHANGED
@@ -7,7 +7,7 @@ import './maintenance/rebuild-memory-lifecycle-ledger.js';
7
7
  import './maintenance/rebuild-observations.js';
8
8
  import './maintenance/archive-observations.js';
9
9
  import 'node:stream';
10
- import './orchestrator-iVZWi8aW.js';
10
+ import './orchestrator-vygo2YIM.js';
11
11
  import './replay/runner.js';
12
12
  import './replay/types.js';
13
13
  import './types-gb_SNtjR.js';
@@ -16,7 +16,7 @@ import './work/types.js';
16
16
  import './routing/engine.js';
17
17
  import './network/tailscale.js';
18
18
  import './dashboard-runtime.js';
19
- import './access-service-lddjZoRh.js';
19
+ import './access-service-BW8cm_uU.js';
20
20
  import './resolve-auth-token.js';
21
21
  import './compat/types.js';
22
22
  import './evals.js';
@@ -38,7 +38,7 @@ import './trust-zones.js';
38
38
  import './session-integrity.js';
39
39
  import './recall-state.js';
40
40
  import './policy-runtime.js';
41
- export { A as AccessHttpServeCliCommandOptions, a as ArchiveObservationsCliCommandOptions, B as BulkImportCliCommandOptions, C as CliApi, b as CliCommand, c as CliProgram, d as CompatCliCommandOptions, e as ConnectorsRunCliOutputOptions, f as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, g as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, h as MemoryActionAuditCliNamespaceSummary, i as MemoryActionAuditCliReport, j as MemoryGovernanceCliCommandOptions, k as MemoryGovernanceReportCliCommandOptions, l as MemoryGovernanceRestoreCliCommandOptions, m as MemoryReviewDispositionCliCommandOptions, n as MemoryTimelineCliCommandOptions, o as MigrateCliOrchestrator, q as MigrateCliReport, s as MigrateObservationsCliCommandOptions, P as PolicyDiffCliReport, t as PolicyDiffEntry, u as PolicyRollbackCliReport, v as PolicyStatusCliReport, w as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, x as RebuildMemoryProjectionCliCommandOptions, y as RebuildObservationsCliCommandOptions, z as RepairMemoryProjectionCliCommandOptions, F as ReplayCliCommandOptions, H as ReplayCliOrchestrator, I as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, J as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, K as TailscaleSyncCliCommandOptions, L as TierMigrationCliOrchestrator, N as TrainingExportCliCommandOptions, V as VerifyMemoryProjectionCliCommandOptions, W as WebDavServeCliCommandOptions, O as WorkProjectCliCommandOptions, Q as WorkTaskCliCommandOptions, U as emitConnectorsRunCliResult, X as filterNormalMemorySearchResults, Y as hasDestructivePurgeFailures, Z as isNormalRetrievalVisibleMemory, _ as listMemoryMarkdownFilePaths, $ as parseDurationToMs, a0 as parseStrictCliDate, a1 as planAggressiveDuplicateDeletions, a2 as planExactDuplicateDeletions, a3 as registerCli, a4 as resolveAccessPrincipalOverride, a5 as resolveMemoryDirForNamespace, a6 as runAbstractionNodeStatusCliCommand, a7 as runAccessHttpServeCliCommand, a8 as runAccessHttpStatusCliCommand, a9 as runAccessHttpStopCliCommand, aa as runAccessMcpServeCliCommand, ab as runArchiveObservationsCliCommand, ac as runBenchmarkBaselineReportCliCommand, ad as runBenchmarkBaselineSnapshotCliCommand, ae as runBenchmarkCiGateCliCommand, af as runBenchmarkImportCliCommand, ag as runBenchmarkStatusCliCommand, ah as runBenchmarkStoredBaselineCiGateCliCommand, ai as runBenchmarkValidateCliCommand, r as runBulkImportCliCommand, aj as runCausalTrajectoryStatusCliCommand, ak as runCommitmentLifecycleCliCommand, al as runCommitmentRecordCliCommand, am as runCommitmentSetStateCliCommand, an as runCommitmentStatusCliCommand, ao as runCompatCliCommand, ap as runCompoundingPromoteCliCommand, aq as runConversationIndexHealthCliCommand, ar as runConversationIndexInspectCliCommand, as as runConversationIndexRebuildCliCommand, at as runCueAnchorStatusCliCommand, au as runDashboardStartCliCommand, av as runDashboardStatusCliCommand, aw as runDashboardStopCliCommand, ax as runGraphHealthCliCommand, ay as runHarmonicSearchCliCommand, az as runMemoryActionAuditCliCommand, aA as runMemoryGovernanceCliCommand, aB as runMemoryGovernanceReportCliCommand, aC as runMemoryGovernanceRestoreCliCommand, aD as runMemoryReviewDispositionCliCommand, aE as runMemoryTimelineCliCommand, aF as runMigrateNormalizeFrontmatterCliCommand, aG as runMigrateObservationsCliCommand, aH as runMigrateRechunkCliCommand, aI as runMigrateReextractCliCommand, aJ as runMigrateRescoreImportanceCliCommand, aK as runObjectiveStateStatusCliCommand, aL as runPolicyDiffCliCommand, aM as runPolicyRollbackCliCommand, aN as runPolicyStatusCliCommand, aO as runRebuildMemoryLifecycleLedgerCliCommand, aP as runRebuildMemoryProjectionCliCommand, aQ as runRebuildObservationsCliCommand, aR as runRepairMemoryProjectionCliCommand, aS as runReplayCliCommand, aT as runResumeBundleBuildCliCommand, aU as runResumeBundleRecordCliCommand, aV as runResumeBundleStatusCliCommand, aW as runRouteCliCommand, aX as runSemanticRulePromoteCliCommand, aY as runSemanticRuleVerifyCliCommand, aZ as runSessionCheckCliCommand, a_ as runSessionRepairCliCommand, a$ as runTailscaleStatusCliCommand, b0 as runTailscaleSyncCliCommand, b1 as runTierMigrateCliCommand, b2 as runTierStatusCliCommand, b3 as runTrainingExportCliCommand, b4 as runTrustZoneDemoSeedCliCommand, b5 as runTrustZonePromoteCliCommand, b6 as runTrustZoneStatusCliCommand, b7 as runUtilityLearningCliCommand, b8 as runUtilityLearningStatusCliCommand, b9 as runUtilityTelemetryRecordCliCommand, ba as runUtilityTelemetryStatusCliCommand, bb as runVerifiedRecallSearchCliCommand, bc as runVerifyMemoryProjectionCliCommand, bd as runWebDavServeCliCommand, be as runWebDavStopCliCommand, bf as runWorkProductRecallSearchCliCommand, bg as runWorkProductRecordCliCommand, bh as runWorkProductStatusCliCommand, bi as runWorkProjectCliCommand, bj as runWorkTaskCliCommand } from './cli-iAiVkbYJ.js';
41
+ export { A as AccessHttpServeCliCommandOptions, a as ArchiveObservationsCliCommandOptions, B as BulkImportCliCommandOptions, C as CliApi, b as CliCommand, c as CliProgram, d as CompatCliCommandOptions, e as ConnectorsRunCliOutputOptions, f as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, g as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, h as MemoryActionAuditCliNamespaceSummary, i as MemoryActionAuditCliReport, j as MemoryGovernanceCliCommandOptions, k as MemoryGovernanceReportCliCommandOptions, l as MemoryGovernanceRestoreCliCommandOptions, m as MemoryReviewDispositionCliCommandOptions, n as MemoryTimelineCliCommandOptions, o as MigrateCliOrchestrator, q as MigrateCliReport, s as MigrateObservationsCliCommandOptions, P as PolicyDiffCliReport, t as PolicyDiffEntry, u as PolicyRollbackCliReport, v as PolicyStatusCliReport, w as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, x as RebuildMemoryProjectionCliCommandOptions, y as RebuildObservationsCliCommandOptions, z as RepairMemoryProjectionCliCommandOptions, F as ReplayCliCommandOptions, H as ReplayCliOrchestrator, I as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, J as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, K as TailscaleSyncCliCommandOptions, L as TierMigrationCliOrchestrator, N as TrainingExportCliCommandOptions, V as VerifyMemoryProjectionCliCommandOptions, W as WebDavServeCliCommandOptions, O as WorkProjectCliCommandOptions, Q as WorkTaskCliCommandOptions, U as emitConnectorsRunCliResult, X as filterNormalMemorySearchResults, Y as hasDestructivePurgeFailures, Z as isNormalRetrievalVisibleMemory, _ as listMemoryMarkdownFilePaths, $ as parseDurationToMs, a0 as parseStrictCliDate, a1 as planAggressiveDuplicateDeletions, a2 as planExactDuplicateDeletions, a3 as registerCli, a4 as resolveAccessPrincipalOverride, a5 as resolveMemoryDirForNamespace, a6 as runAbstractionNodeStatusCliCommand, a7 as runAccessHttpServeCliCommand, a8 as runAccessHttpStatusCliCommand, a9 as runAccessHttpStopCliCommand, aa as runAccessMcpServeCliCommand, ab as runArchiveObservationsCliCommand, ac as runBenchmarkBaselineReportCliCommand, ad as runBenchmarkBaselineSnapshotCliCommand, ae as runBenchmarkCiGateCliCommand, af as runBenchmarkImportCliCommand, ag as runBenchmarkStatusCliCommand, ah as runBenchmarkStoredBaselineCiGateCliCommand, ai as runBenchmarkValidateCliCommand, r as runBulkImportCliCommand, aj as runCausalTrajectoryStatusCliCommand, ak as runCommitmentLifecycleCliCommand, al as runCommitmentRecordCliCommand, am as runCommitmentSetStateCliCommand, an as runCommitmentStatusCliCommand, ao as runCompatCliCommand, ap as runCompoundingPromoteCliCommand, aq as runConversationIndexHealthCliCommand, ar as runConversationIndexInspectCliCommand, as as runConversationIndexRebuildCliCommand, at as runCueAnchorStatusCliCommand, au as runDashboardStartCliCommand, av as runDashboardStatusCliCommand, aw as runDashboardStopCliCommand, ax as runGraphHealthCliCommand, ay as runHarmonicSearchCliCommand, az as runMemoryActionAuditCliCommand, aA as runMemoryGovernanceCliCommand, aB as runMemoryGovernanceReportCliCommand, aC as runMemoryGovernanceRestoreCliCommand, aD as runMemoryReviewDispositionCliCommand, aE as runMemoryTimelineCliCommand, aF as runMigrateNormalizeFrontmatterCliCommand, aG as runMigrateObservationsCliCommand, aH as runMigrateRechunkCliCommand, aI as runMigrateReextractCliCommand, aJ as runMigrateRescoreImportanceCliCommand, aK as runObjectiveStateStatusCliCommand, aL as runPolicyDiffCliCommand, aM as runPolicyRollbackCliCommand, aN as runPolicyStatusCliCommand, aO as runRebuildMemoryLifecycleLedgerCliCommand, aP as runRebuildMemoryProjectionCliCommand, aQ as runRebuildObservationsCliCommand, aR as runRepairMemoryProjectionCliCommand, aS as runReplayCliCommand, aT as runResumeBundleBuildCliCommand, aU as runResumeBundleRecordCliCommand, aV as runResumeBundleStatusCliCommand, aW as runRouteCliCommand, aX as runSemanticRulePromoteCliCommand, aY as runSemanticRuleVerifyCliCommand, aZ as runSessionCheckCliCommand, a_ as runSessionRepairCliCommand, a$ as runTailscaleStatusCliCommand, b0 as runTailscaleSyncCliCommand, b1 as runTierMigrateCliCommand, b2 as runTierStatusCliCommand, b3 as runTrainingExportCliCommand, b4 as runTrustZoneDemoSeedCliCommand, b5 as runTrustZonePromoteCliCommand, b6 as runTrustZoneStatusCliCommand, b7 as runUtilityLearningCliCommand, b8 as runUtilityLearningStatusCliCommand, b9 as runUtilityTelemetryRecordCliCommand, ba as runUtilityTelemetryStatusCliCommand, bb as runVerifiedRecallSearchCliCommand, bc as runVerifyMemoryProjectionCliCommand, bd as runWebDavServeCliCommand, be as runWebDavStopCliCommand, bf as runWorkProductRecallSearchCliCommand, bg as runWorkProductRecordCliCommand, bh as runWorkProductStatusCliCommand, bi as runWorkProjectCliCommand, bj as runWorkTaskCliCommand } from './cli-Dpivy32W.js';
42
42
  import './connectors-cli-2iaQ5tX2.js';
43
43
  import './storage.js';
44
44
  import './page-versioning.js';
@@ -21,8 +21,9 @@ import './message-parts/index.js';
21
21
  *
22
22
  * Short-circuit contract:
23
23
  *
24
- * - When the resolved gate (`input.enabled` if supplied, else
25
- * `config.recallDirectAnswerEnabled`) is `false`, the function returns the
24
+ * - When the resolved gate (`input.enabled`, projected from
25
+ * `caps.recallDirectAnswer` at the recall-operation entry) is `false`, the
26
+ * function returns the
26
27
  * eligibility verdict with reason `"disabled"` without touching any source
27
28
  * accessor. This is the documented default.
28
29
  * - When enabled, the wiring cheaply drops non-trusted-zone memories
@@ -65,16 +66,15 @@ interface DirectAnswerSources {
65
66
  interface DirectAnswerWiringInput {
66
67
  query: string;
67
68
  namespace: string;
68
- config: Pick<PluginConfig, "recallDirectAnswerEnabled" | "recallDirectAnswerTokenOverlapFloor" | "recallDirectAnswerImportanceFloor" | "recallDirectAnswerAmbiguityMargin" | "recallDirectAnswerEligibleTaxonomyBuckets">;
69
+ config: Pick<PluginConfig, "recallDirectAnswerTokenOverlapFloor" | "recallDirectAnswerImportanceFloor" | "recallDirectAnswerAmbiguityMargin" | "recallDirectAnswerEligibleTaxonomyBuckets">;
69
70
  /**
70
71
  * Direct-answer capability gate, resolved once at the recall-operation entry
71
- * (issue #1523: `caps.recallDirectAnswer`). OPTIONAL and additive: when the
72
- * caller supplies it, this module and the orchestrator agree on a single
73
- * resolved gate value for the whole operation. When omitted, we fall back to
74
- * `config.recallDirectAnswerEnabled` so existing callers on the old input
75
- * shape keep identical behavior.
72
+ * via `resolveCapabilities(config).recallDirectAnswer` (issue #1523). This
73
+ * is the sole gate the function no longer reads the config flag directly.
74
+ * Callers MUST pass the resolved capability so the whole operation agrees on
75
+ * a single gate value.
76
76
  */
77
- enabled?: boolean;
77
+ enabled: boolean;
78
78
  sources: DirectAnswerSources;
79
79
  queryEntityRefs?: string[];
80
80
  abortSignal?: AbortSignal;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tryDirectAnswer
3
- } from "./chunk-OQH5XUH3.js";
3
+ } from "./chunk-Q6IP2ARR.js";
4
4
  import "./chunk-6HEM6HTQ.js";
5
5
  import "./chunk-ZBJMUXZH.js";
6
6
  import "./chunk-PVGDJXVK.js";
@@ -1,4 +1,4 @@
1
- import { O as Orchestrator } from './orchestrator-iVZWi8aW.js';
1
+ import { O as Orchestrator } from './orchestrator-vygo2YIM.js';
2
2
  import { M as MemoryCategory, P as PluginConfig } from './types-D9dwzU_x.js';
3
3
  import './briefing.js';
4
4
  import './storage.js';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { PluginEntryResolverOptions, resolvePluginEntry } from './plugin-entry-resolver.js';
2
2
  export { isOpenaiApiKeyDisabled, parseConfig, resolveEnvVars } from './config.js';
3
3
  export { MigrationOptions, MigrationResult, RollbackResult, migrateFromEngram, rollbackFromEngramMigration } from './migrate/from-engram.js';
4
- import { S as SpeakerRegistry, W as WearablesService } from './orchestrator-iVZWi8aW.js';
5
- export { D as DEFAULT_SELF_NAME, O as Orchestrator, R as ResolvedSpeaker, a as SpeakerOverride, b as WEARABLE_SOURCE_PREFIX, c as WearableDayTranscriptView, d as WearableMemoryGenDeps, e as WearableMemoryGenResult, f as WearableMemorySearchResult, g as WearableMemoryWriter, h as WearableSearchBackend, i as WearableStorageIo, j as WearableSyncDeps, k as WearableSyncOptions, l as WearableTranscriptSearchResult, m as WearablesServiceDeps, n as buildExtractionTurns, o as dateInTimezone, p as defaultTimezone, q as defaultWorkspaceDir, r as distinctSpeakerLabels, s as emptySpeakerRegistry, t as generateWearableMemories, u as importNativeMemories, v as loadSpeakerRegistry, w as locateTranscriptPath, x as memoryStatusForMode, y as resolveSpeaker, z as resolveSyncDates, A as sanitizeSessionKeyForFilename, B as saveSpeakerRegistry, C as speakerRegistryKey, E as speakersFilePath, F as syncWearableSource, H as wearableDayTag, J as wearableSourceLabel, K as writeDailyDigestMemory } from './orchestrator-iVZWi8aW.js';
4
+ import { S as SpeakerRegistry, W as WearablesService } from './orchestrator-vygo2YIM.js';
5
+ export { D as DEFAULT_SELF_NAME, O as Orchestrator, R as ResolvedSpeaker, a as SpeakerOverride, b as WEARABLE_SOURCE_PREFIX, c as WearableDayTranscriptView, d as WearableMemoryGenDeps, e as WearableMemoryGenResult, f as WearableMemorySearchResult, g as WearableMemoryWriter, h as WearableSearchBackend, i as WearableStorageIo, j as WearableSyncDeps, k as WearableSyncOptions, l as WearableTranscriptSearchResult, m as WearablesServiceDeps, n as buildExtractionTurns, o as dateInTimezone, p as defaultTimezone, q as defaultWorkspaceDir, r as distinctSpeakerLabels, s as emptySpeakerRegistry, t as generateWearableMemories, u as importNativeMemories, v as loadSpeakerRegistry, w as locateTranscriptPath, x as memoryStatusForMode, y as resolveSpeaker, z as resolveSyncDates, A as sanitizeSessionKeyForFilename, B as saveSpeakerRegistry, C as speakerRegistryKey, E as speakersFilePath, F as syncWearableSource, H as wearableDayTag, J as wearableSourceLabel, K as writeDailyDigestMemory } from './orchestrator-vygo2YIM.js';
6
6
  export { normalizeProjectionPreview, normalizeProjectionTags } from './memory-projection-format.js';
7
7
  export { ModelCapabilities, ModelRegistry } from './model-registry.js';
8
8
  export { ACTIVE_STATUSES, ContradictionFilter, ContradictionJudgeBatchResult, ContradictionJudgeInput, ContradictionJudgeResult, ContradictionListResult, ContradictionVerdict, ResolutionResult, ResolutionVerb, ScanDependencies, ScanResult, computePairId, executeResolution, isCoolingDown, isValidResolutionVerb, judgeContradictionPairs, listPairs, readPair, resolvePair, runContradictionScan, writePair, writePairs } from './contradiction/index.js';
@@ -24,7 +24,7 @@ import { aG as CodingContext, aR as CodingModeConfig, P as PluginConfig, M as Me
24
24
  export { J as AgentAccessAuthToken, r as BriefingActiveThread, aU as BriefingConfig, p as BriefingFocus, o as BriefingFollowup, aV as BriefingOpenCommitment, t as BriefingRecentEntity, s as BriefingResult, n as BriefingSections, aW as BriefingWindow, z as BufferSurpriseEvent, q as CalendarEvent, C as CalendarSource, aX as CodexCompatConfig, aJ as ConsolidationObservation, a6 as ContinuityImprovementLoop, aY as DEFAULT_RECALL_DISCLOSURE, E as EntityFile, $ as EntityStructuredSection, aZ as ExtractedFact, G as GatewayConfig, ac as MemoryActionEligibilityContext, a_ as MemoryActionEligibilitySource, U as MemoryActionType, g as MemoryFile, k as MemoryFrontmatter, a$ as MemoryObservation, b0 as MemoryScope, b1 as RECALL_DISCLOSURE_LEVELS, i as RecallDisclosure, D as SecretRef, b2 as WearableAuthCheck, b3 as WearableFetchOptions, b4 as WearableFetchPage, az as WearableMemoryMode, ay as WearableNativeMemory, b5 as WearableNativeMemoryPage, aD as WearableSourceStatus, aC as WearableSyncSummary, b6 as WearableTranscriptSegment, b7 as isRecallDisclosure } from './types-D9dwzU_x.js';
25
25
  export { JudgeBatchResult, JudgeCandidate, JudgeVerdict, JudgeVerdictKind, clearVerdictCache, createVerdictCache, getVerdictKind, isDurableVerdict, isValidCachedVerdict, judgeFactDurability, normalizeCachedVerdict, verdictCacheSize } from './extraction-judge.js';
26
26
  export { hasBroadGraphIntent, inferIntentFromText, intentCompatibilityScore, isTaskInitiationIntent, planRecallMode } from './intent.js';
27
- export { i as EngramAccessInputError, g as EngramAccessService, P as ProcedureStatsConfigSnapshot, j as ProcedureStatsRecent, k as ProcedureStatsReport, l as ProcedureStatusCounts, m as computeProcedureStats, n as formatProcedureStatsText } from './access-service-lddjZoRh.js';
27
+ export { i as EngramAccessInputError, g as EngramAccessService, P as ProcedureStatsConfigSnapshot, j as ProcedureStatsRecent, k as ProcedureStatsReport, l as ProcedureStatusCounts, m as computeProcedureStats, n as formatProcedureStatsText } from './access-service-BW8cm_uU.js';
28
28
  export { FILTER_LABELS as DIRECT_ANSWER_FILTER_LABELS, DirectAnswerCandidate, DirectAnswerConfig, DirectAnswerInput, DirectAnswerReason, DirectAnswerResult, isDirectAnswerEligible } from './direct-answer.js';
29
29
  export { MemoryTier, TierRoutingPolicy, TierTransitionDecision, computeTierValueScore, decideTierTransition } from './tier-routing.js';
30
30
  export { ApplyReasoningTraceBoostOptions, BoostableResult, DEFAULT_REASONING_TRACE_BOOST, applyReasoningTraceBoost, isReasoningTracePath, looksLikeProblemSolvingQuery } from './reasoning-trace-recall.js';
@@ -79,7 +79,7 @@ export { EnrichmentAuditEntry, EnrichmentCandidate, EnrichmentCostTier, Enrichme
79
79
  export { d as BulkImportError, B as BulkImportOptions, b as BulkImportResult, a as BulkImportSource, e as BulkImportSourceAdapter, f as ImportSourceRole, I as ImportTurn, g as ImportTurnValidationIssue, i as isImportRole, p as parseIsoTimestamp, v as validateImportTurn } from './types-gb_SNtjR.js';
80
80
  export { clearBulkImportSources, getBulkImportSource, listBulkImportSources, registerBulkImportSource } from './bulk-import/index.js';
81
81
  export { a as ProcessBatchContext, P as ProcessBatchFn, b as ProcessBatchResult, f as formatBatchTranscript, r as resolveBulkImportContext, c as runBulkImportPipeline, v as validateBatchSize } from './pipeline-DmqtvION.js';
82
- export { B as BulkImportCliCommandOptions, p as parseStrictCliDate, r as runBulkImportCliCommand } from './cli-iAiVkbYJ.js';
82
+ export { B as BulkImportCliCommandOptions, p as parseStrictCliDate, r as runBulkImportCliCommand } from './cli-Dpivy32W.js';
83
83
  export { DEFAULT_IMPORT_BATCH_SIZE, ImportProgress, ImportedMemory, ImporterAdapter, ImporterParseOptions, ImporterTransformOptions, ImporterWriteResult, ImporterWriteTarget, RunImportOptions, RunImporterResult, defaultWriteMemoriesToOrchestrator, importedMemoryToTurn, runImporter, validateImportBatchSize, validateImportRateLimit } from './importers/index.js';
84
84
  export { FallbackLlmClient, FallbackLlmOptions, FallbackLlmResponse, FallbackLlmRuntimeContext } from './fallback-llm.js';
85
85
  export { ComputeMemoryWorthInput, MemoryWorthResult, computeMemoryWorth } from './memory-worth.js';
package/dist/index.js CHANGED
@@ -189,7 +189,7 @@ import {
189
189
  saveTaxonomy,
190
190
  validateSlug,
191
191
  validateTaxonomy
192
- } from "./chunk-FXZKXW7C.js";
192
+ } from "./chunk-SQ4LU27I.js";
193
193
  import {
194
194
  WEARABLE_SOURCE_PREFIX,
195
195
  buildExtractionTurns,
@@ -345,7 +345,7 @@ import "./chunk-XHYGJVXL.js";
345
345
  import "./chunk-VEWZZM3H.js";
346
346
  import {
347
347
  resolveCategory
348
- } from "./chunk-OQH5XUH3.js";
348
+ } from "./chunk-Q6IP2ARR.js";
349
349
  import {
350
350
  FILTER_LABELS,
351
351
  isDirectAnswerEligible
@@ -1,4 +1,4 @@
1
- import { h as EngramAccessRecallResponse } from './access-service-lddjZoRh.js';
1
+ import { h as EngramAccessRecallResponse } from './access-service-BW8cm_uU.js';
2
2
  import { ActionConfidenceRequest } from './access-schema.js';
3
3
  import { RecallXraySnapshot } from './recall-xray.js';
4
4
  import { ActionConfidenceResult } from './action-confidence.js';
@@ -22,7 +22,7 @@ import './memory-provenance.js';
22
22
  import './user-model.js';
23
23
  import './recall-audit-anomaly.js';
24
24
  import './recall-audit.js';
25
- import './orchestrator-iVZWi8aW.js';
25
+ import './orchestrator-vygo2YIM.js';
26
26
  import './briefing.js';
27
27
  import './buffer.js';
28
28
  import './extraction-faithfulness.js';
@@ -861,12 +861,11 @@ declare function resolveRecallModeDecision(options: RecallModeGraphOptions): Rec
861
861
  declare function resolveRecallModeDecisionAsync(options: RecallModeGraphOptions & {
862
862
  config: PluginConfig;
863
863
  /**
864
- * Recall-operation capability gates (issue #1523). OPTIONAL and additive:
865
- * the recall orchestrator passes a resolved set, but existing callers that
866
- * only pass `config` + planner flags stay backward-compatible the LLM
867
- * planner gate falls back to `config.recallPlannerLlmEnabled` when omitted.
864
+ * Recall-operation capability gates (issue #1523). REQUIRED: the recall
865
+ * orchestrator always passes a resolved set the LLM planner gate reads
866
+ * `caps.recallPlannerLlm`, never re-derives from config.
868
867
  */
869
- caps?: CapabilitySet;
868
+ caps: CapabilitySet;
870
869
  hints?: string[];
871
870
  llm?: FallbackLlmClient;
872
871
  signal?: AbortSignal;
@@ -969,6 +968,11 @@ declare class Orchestrator {
969
968
  * callers already destructure `persistedIds` by position.
970
969
  */
971
970
  private lastPersistExtractionDeferredCount;
971
+ /**
972
+ * Side-channel (#1635): pending_review persisted ids from the last
973
+ * persistExtraction; runExtraction excludes them from the thread episode set.
974
+ */
975
+ private lastPersistExtractionPendingReviewIds;
972
976
  private readonly _fastGatewayLlm;
973
977
  get fastGatewayLlm(): FallbackLlmClient | null;
974
978
  /**
@@ -1757,6 +1761,12 @@ declare class Orchestrator {
1757
1761
  */
1758
1762
  requestQmdMaintenanceForTool(reason: string): void;
1759
1763
  private persistExtraction;
1764
+ /**
1765
+ * Append persisted ids to the thread episode set, excluding pending_review
1766
+ * fact ids (#1635) so they don't re-seed predecessor edges. Fail-open like
1767
+ * the raw appendEpisodeIds call it replaces.
1768
+ */
1769
+ private appendPersistedThreadEpisodes;
1760
1770
  private indexPersistedMemory;
1761
1771
  /**
1762
1772
  * Build a graph edge for a persisted memory (v8.2).
@@ -9,7 +9,7 @@ import './local-llm.js';
9
9
  import './fallback-llm.js';
10
10
  import './orchestration/maintenance.js';
11
11
  import './live-connectors-runner.js';
12
- export { L as BulkImportBatchIngestResult, M as BulkImportBatchPartialFailureError, N as GraphRecallRankedResult, Q as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, T as QmdRecallSnapshot, U as RecallInvocationOptions, V as RecallModeDecision, X as appendMemoryToGraphContext, Y as blendGraphExpandedRecallScore, Z as buildCompressionGuidelinesMarkdown, _ as buildMemoryPathById, $ as computeArtifactCandidateFetchLimit, a0 as computeArtifactRecallLimit, a1 as computeQmdHybridFetchLimit, a2 as dedupeEntitySynthesisEvidenceEntries, q as defaultWorkspaceDir, a3 as deriveTopicsFromExtraction, a4 as filterRecallCandidates, a5 as formatCompressionGuidelinesForRecall, a6 as graphPathRelativeToStorage, a7 as hasIdentityRecoveryIntent, a8 as isArtifactMemoryPath, a9 as lifecycleRecallScoreAdjustment, aa as mergeArtifactRecallCandidates, ab as mergeGraphExpandedResults, ac as resolveEffectiveIdentityInjectionMode, ad as resolveEffectiveRecallMode, ae as resolvePersistedMemoryRelativePath, af as resolveRecallModeDecision, ag as resolveRecallModeDecisionAsync, ah as resolveRecentThreadMemoryPaths, A as sanitizeSessionKeyForFilename, ai as shouldFilterLifecycleRecallCandidate, aj as summarizeGraphShadowComparison } from './orchestrator-iVZWi8aW.js';
12
+ export { L as BulkImportBatchIngestResult, M as BulkImportBatchPartialFailureError, N as GraphRecallRankedResult, Q as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, T as QmdRecallSnapshot, U as RecallInvocationOptions, V as RecallModeDecision, X as appendMemoryToGraphContext, Y as blendGraphExpandedRecallScore, Z as buildCompressionGuidelinesMarkdown, _ as buildMemoryPathById, $ as computeArtifactCandidateFetchLimit, a0 as computeArtifactRecallLimit, a1 as computeQmdHybridFetchLimit, a2 as dedupeEntitySynthesisEvidenceEntries, q as defaultWorkspaceDir, a3 as deriveTopicsFromExtraction, a4 as filterRecallCandidates, a5 as formatCompressionGuidelinesForRecall, a6 as graphPathRelativeToStorage, a7 as hasIdentityRecoveryIntent, a8 as isArtifactMemoryPath, a9 as lifecycleRecallScoreAdjustment, aa as mergeArtifactRecallCandidates, ab as mergeGraphExpandedResults, ac as resolveEffectiveIdentityInjectionMode, ad as resolveEffectiveRecallMode, ae as resolvePersistedMemoryRelativePath, af as resolveRecallModeDecision, ag as resolveRecallModeDecisionAsync, ah as resolveRecentThreadMemoryPaths, A as sanitizeSessionKeyForFilename, ai as shouldFilterLifecycleRecallCandidate, aj as summarizeGraphShadowComparison } from './orchestrator-vygo2YIM.js';
13
13
  import './model-registry.js';
14
14
  import './relevance.js';
15
15
  import './negative.js';
@@ -28,7 +28,7 @@ import {
28
28
  sanitizeSessionKeyForFilename,
29
29
  shouldFilterLifecycleRecallCandidate,
30
30
  summarizeGraphShadowComparison
31
- } from "./chunk-FXZKXW7C.js";
31
+ } from "./chunk-SQ4LU27I.js";
32
32
  import "./chunk-DGTDRIUO.js";
33
33
  import "./chunk-O62P2LFL.js";
34
34
  import "./chunk-7HYPN2GC.js";
@@ -90,7 +90,7 @@ import "./chunk-LUPVCGYK.js";
90
90
  import "./chunk-PYPOFEMK.js";
91
91
  import "./chunk-XHYGJVXL.js";
92
92
  import "./chunk-VEWZZM3H.js";
93
- import "./chunk-OQH5XUH3.js";
93
+ import "./chunk-Q6IP2ARR.js";
94
94
  import "./chunk-6HEM6HTQ.js";
95
95
  import "./chunk-ZA2S2VLL.js";
96
96
  import "./chunk-DXGS5YOQ.js";
@@ -53,6 +53,6 @@ declare function resolveRecallPlannerLlmOptions(config: Pick<PluginConfig, "mode
53
53
  * @param llm injectable client (tests pass a stub); constructed from gateway
54
54
  * config when omitted.
55
55
  */
56
- declare function planRecallModeLLM(prompt: string, hints: string[] | undefined, config: PluginConfig, llm?: FallbackLlmClient, signal?: AbortSignal, caps?: CapabilitySet): Promise<RecallPlannerLlmResult>;
56
+ declare function planRecallModeLLM(prompt: string, hints: string[] | undefined, config: PluginConfig, caps: CapabilitySet, llm?: FallbackLlmClient, signal?: AbortSignal): Promise<RecallPlannerLlmResult>;
57
57
 
58
58
  export { type RecallPlannerLlmResult, type RecallPlannerSource, planRecallModeLLM, resolveRecallPlannerLlmOptions };
@@ -93,9 +93,9 @@ var warnedNoRoutingSignatures = /* @__PURE__ */ new Set();
93
93
  function heuristicResult(heuristicMode, source, reason, latencyMs, fallbackUsed) {
94
94
  return { mode: heuristicMode, heuristicMode, source, reason, latencyMs, fallbackUsed };
95
95
  }
96
- async function planRecallModeLLM(prompt, hints, config, llm, signal, caps) {
96
+ async function planRecallModeLLM(prompt, hints, config, caps, llm, signal) {
97
97
  const heuristicMode = planRecallMode(prompt);
98
- const plannerLlmEnabled = caps?.recallPlannerLlm ?? config.recallPlannerLlmEnabled;
98
+ const plannerLlmEnabled = caps.recallPlannerLlm;
99
99
  if (!plannerLlmEnabled) {
100
100
  return heuristicResult(heuristicMode, "heuristic", "llm-disabled", 0, false);
101
101
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/recall-planner-llm.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { PluginConfig, RecallPlanMode } from \"./types.js\";\nimport type { CapabilitySet } from \"./capabilities.js\";\nimport { planRecallMode } from \"./intent.js\";\nimport {\n FallbackLlmClient,\n fallbackLlmRuntimeContextFromConfig,\n gatewayTaskChainOptions,\n type FallbackLlmOptions,\n} from \"./fallback-llm.js\";\nimport { log } from \"./logger.js\";\n\n/**\n * LLM-based recall planning (issue #1367, Option C).\n *\n * Classifies an incoming prompt into a {@link RecallPlanMode} using an LLM\n * instead of (or alongside) the regex heuristic in {@link planRecallMode}.\n *\n * Provider-agnostic by construction: it routes through {@link FallbackLlmClient},\n * which resolves the model chain from gateway providers (OpenAI, Anthropic,\n * Ollama, Codex, …) or gateway agent personas / `taskModelChain`. Nothing here\n * is hard-coded to a single provider or to OpenAI's Responses API — the API\n * dialect is chosen per-provider by the client based on each provider's `api`\n * field. The configured `recallPlannerModel` is tried first, with the broader\n * task chain (and the gateway default) as resilient fallbacks.\n *\n * Invariants:\n * - Never throws to the caller (gotcha #13). Any LLM failure, timeout, empty\n * response, or unavailable backend falls back to the heuristic result and\n * sets `fallbackUsed: true` (gotcha #34 — failures are distinct from a valid\n * classification).\n * - When `recallPlannerLlmEnabled` is false the LLM is never contacted.\n */\n\nexport type RecallPlannerSource = \"llm\" | \"heuristic\" | \"heuristic-fallback\";\n\nexport interface RecallPlannerLlmResult {\n /** The mode to act on. */\n mode: RecallPlanMode;\n /** The heuristic mode, always computed (the fallback floor / shadow baseline). */\n heuristicMode: RecallPlanMode;\n /** Where `mode` came from. */\n source: RecallPlannerSource;\n /** Short human-readable rationale (LLM reason, or why we fell back). */\n reason: string;\n /** Model that actually served the classification, when an LLM was used. */\n modelUsed?: string;\n /** Wall-clock spent in the LLM call (0 when no call was made). */\n latencyMs: number;\n /** True when the LLM was enabled but we had to fall back to the heuristic. */\n fallbackUsed: boolean;\n}\n\nconst PLANNER_SCHEMA = z.object({\n // gotcha #2: optional fields use .optional().nullable()\n mode: z.enum([\"no_recall\", \"minimal\", \"full\", \"graph_mode\"]),\n reason: z.string().max(280).optional().nullable(),\n});\n\nconst SYSTEM_PROMPT = [\n \"You are a recall-planning classifier for a long-term memory system.\",\n \"Given the user's latest message, decide how much stored memory should be retrieved before the assistant responds.\",\n \"Reply with a single JSON object: {\\\"mode\\\": <one of no_recall|minimal|full|graph_mode>, \\\"reason\\\": <short string>}.\",\n \"\",\n \"Modes:\",\n '- \"no_recall\": low-information acknowledgements or chit-chat with nothing to look up (e.g. \"ok\", \"thanks\", \"sounds good\"). Retrieve nothing.',\n '- \"minimal\": short, self-contained operational directives that rarely need history (e.g. \"restart the service\", \"run the tests\", \"show status\"). Retrieve a little.',\n '- \"full\": anything memory-seeking, analytical, or a question that benefits from prior context, decisions, or facts. This is the safe default when unsure.',\n '- \"graph_mode\": queries about timelines, sequences, history, causal chains, or root cause (\"how did we get here\", \"what led to this regression\"). Retrieve relationship/graph context.',\n \"\",\n \"When uncertain, prefer \\\"full\\\" over dropping recall. Never invent facts; only classify intent.\",\n].join(\"\\n\");\n\n/** Clamp a planner prompt to the configured character budget. */\nfunction clampPrompt(prompt: string, maxChars: number): string {\n const safeMax = Number.isFinite(maxChars) && maxChars > 0 ? Math.floor(maxChars) : 4000;\n if (prompt.length <= safeMax) return prompt;\n return prompt.slice(0, safeMax);\n}\n\n/** Trim and cap the optional memory hints used to ground the classification. */\nfunction clampHints(hints: string[] | undefined, maxHints: number): string[] {\n if (!Array.isArray(hints) || hints.length === 0) return [];\n const safeMax = Number.isFinite(maxHints) && maxHints > 0 ? Math.floor(maxHints) : 0;\n if (safeMax <= 0) return [];\n const cleaned: string[] = [];\n for (const hint of hints) {\n if (typeof hint !== \"string\") continue;\n const trimmed = hint.trim();\n if (trimmed.length === 0) continue;\n cleaned.push(trimmed);\n if (cleaned.length >= safeMax) break;\n }\n return cleaned;\n}\n\nfunction buildMessages(\n prompt: string,\n hints: string[],\n config: PluginConfig,\n): Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }> {\n const clampedPrompt = clampPrompt(prompt, config.recallPlannerMaxPromptChars);\n const userParts = [`User message:\\n${clampedPrompt}`];\n if (hints.length > 0) {\n userParts.push(\n `\\nRecent memory topics (for grounding only, do not treat as the message):\\n- ${hints.join(\"\\n- \")}`,\n );\n }\n userParts.push('\\nRespond with JSON only: {\"mode\": \"...\", \"reason\": \"...\"}.');\n return [\n { role: \"system\", content: SYSTEM_PROMPT },\n { role: \"user\", content: userParts.join(\"\\n\") },\n ];\n}\n\n/**\n * Resolve the FallbackLlmClient routing options for the recall planner.\n *\n * - The dedicated `recallPlannerModel` is tried first (as the `model`\n * override — it is prepended to the chain by FallbackLlmClient). If it does\n * not resolve to a configured provider it is silently skipped, so a stale\n * default never breaks routing.\n * - In gateway mode the shared `gatewayTaskChainOptions` (taskModelChain >\n * gatewayAgentId, gotcha #22) is layered in as the fallback chain, plus the\n * implicit gateway default appended by the client.\n * - In plugin mode only the explicit model + gateway providers apply.\n */\n/**\n * A `recallPlannerModel` value is only usable as a FallbackLlmClient `model`\n * override when it is provider-qualified (`provider/model`). The client's\n * `parseModelString` rejects bare names, so forwarding a bare value (e.g. the\n * legacy default `\"gpt-5.5\"`) would log \"invalid model format\" on every call\n * and never resolve. Bare values are dropped so routing falls through to the\n * gateway chain / agent / default instead (issue #1367 review on PR #1428).\n */\nfunction qualifiedPlannerModel(recallPlannerModel: string | undefined): string | undefined {\n if (typeof recallPlannerModel !== \"string\") return undefined;\n const trimmed = recallPlannerModel.trim();\n return trimmed.includes(\"/\") ? trimmed : undefined;\n}\n\nexport function resolveRecallPlannerLlmOptions(\n config: Pick<\n PluginConfig,\n \"modelSource\" | \"taskModelChain\" | \"gatewayAgentId\" | \"recallPlannerModel\" | \"recallPlannerTimeoutMs\"\n >,\n): FallbackLlmOptions {\n const chainOptions =\n config.modelSource === \"gateway\" ? gatewayTaskChainOptions(config) : {};\n return {\n ...chainOptions,\n model: qualifiedPlannerModel(config.recallPlannerModel),\n temperature: 0,\n maxTokens: 64,\n timeoutMs:\n typeof config.recallPlannerTimeoutMs === \"number\" && config.recallPlannerTimeoutMs > 0\n ? config.recallPlannerTimeoutMs\n : 1500,\n };\n}\n\n// One-time warning per distinct routing signature so an opted-in operator with\n// no usable model learns why planning silently uses the heuristic, without\n// spamming a line on every recall.\nconst warnedNoRoutingSignatures = new Set<string>();\n\nfunction heuristicResult(\n heuristicMode: RecallPlanMode,\n source: RecallPlannerSource,\n reason: string,\n latencyMs: number,\n fallbackUsed: boolean,\n): RecallPlannerLlmResult {\n return { mode: heuristicMode, heuristicMode, source, reason, latencyMs, fallbackUsed };\n}\n\n/**\n * Plan the recall mode for `prompt`, optionally consulting an LLM.\n *\n * Always safe to call: returns the heuristic result when the LLM is disabled,\n * unavailable, or fails.\n *\n * @param llm injectable client (tests pass a stub); constructed from gateway\n * config when omitted.\n */\nexport async function planRecallModeLLM(\n prompt: string,\n hints: string[] | undefined,\n config: PluginConfig,\n llm?: FallbackLlmClient,\n signal?: AbortSignal,\n caps?: CapabilitySet,\n): Promise<RecallPlannerLlmResult> {\n const heuristicMode = planRecallMode(prompt);\n\n // `caps` is OPTIONAL and additive (issue #1523). Prefer the resolved\n // capability when supplied; fall back to the config flag so existing callers\n // that pass only `config` keep identical gating.\n const plannerLlmEnabled = caps?.recallPlannerLlm ?? config.recallPlannerLlmEnabled;\n if (!plannerLlmEnabled) {\n return heuristicResult(heuristicMode, \"heuristic\", \"llm-disabled\", 0, false);\n }\n\n // Participate in the recall cancellation contract: if the outer recall is\n // already aborted (outer timeout / reset / session abort), don't start an LLM\n // round-trip — fall back to the heuristic immediately (#1428 review).\n if (signal?.aborted) {\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"aborted\", 0, true);\n }\n\n const safePrompt = typeof prompt === \"string\" ? prompt.trim() : \"\";\n if (safePrompt.length === 0) {\n // Empty prompts never need an LLM round-trip.\n return heuristicResult(heuristicMode, \"heuristic\", \"empty-prompt\", 0, false);\n }\n\n const client =\n llm ??\n new FallbackLlmClient(\n config.gatewayConfig,\n fallbackLlmRuntimeContextFromConfig(config),\n );\n\n // Forward the recall abort signal so an aborted/timed-out outer recall can\n // cancel an in-flight planner call (FallbackLlmClient honors `signal`).\n const options = { ...resolveRecallPlannerLlmOptions(config), signal };\n\n // Availability check uses the same routing options so plugin-mode / empty\n // chains short-circuit to the heuristic without a network attempt. `model`\n // here is already provider-qualified (bare names were dropped), so a present\n // model means the override is genuinely routable.\n const availabilityProbe = {\n agentId: options.agentId,\n modelChain: options.modelChain,\n };\n if (!client.isAvailable(availabilityProbe) && !options.model) {\n // Opted-in but nothing routable resolves (e.g. plugin mode with the bare\n // default `recallPlannerModel` and no gateway chain). Warn once so it's not\n // a silent no-op, then fall back to the heuristic.\n const signature = `${config.modelSource}:${config.recallPlannerModel ?? \"\"}`;\n if (!warnedNoRoutingSignatures.has(signature)) {\n warnedNoRoutingSignatures.add(signature);\n log.warn(\n \"[recall-planner] recallPlannerLlmEnabled is on but no routable model resolves — \" +\n \"set recallPlannerModel to a 'provider/model' value or configure a gateway model chain. \" +\n \"Falling back to the heuristic planner.\",\n );\n }\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"llm-no-model\", 0, true);\n }\n\n const clampedHints = clampHints(hints, config.recallPlannerMaxMemoryHints);\n const messages = buildMessages(safePrompt, clampedHints, config);\n\n const start = Date.now();\n try {\n const detailed = await client.parseWithSchemaDetailed(messages, PLANNER_SCHEMA, options);\n const latencyMs = Date.now() - start;\n if (!detailed?.result) {\n // Distinguish failure from a valid empty (gotcha #34): a null here means\n // no parseable classification, so fall back to the heuristic.\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"llm-empty\", latencyMs, true);\n }\n const mode = detailed.result.mode;\n const reason =\n typeof detailed.result.reason === \"string\" && detailed.result.reason.trim().length > 0\n ? detailed.result.reason.trim()\n : \"llm-classified\";\n return {\n mode,\n heuristicMode,\n source: \"llm\",\n reason,\n modelUsed: detailed.modelUsed,\n latencyMs,\n fallbackUsed: false,\n };\n } catch (err) {\n const latencyMs = Date.now() - start;\n if (signal?.aborted) {\n // Cancelled by the outer recall — expected, not an error worth warning on.\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"aborted\", latencyMs, true);\n }\n const message = err instanceof Error ? err.message : String(err);\n log.warn(`[recall-planner] LLM failed, falling back to heuristic: ${message}`);\n return heuristicResult(\n heuristicMode,\n \"heuristic-fallback\",\n `llm-error:${message}`,\n latencyMs,\n true,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAsDlB,IAAM,iBAAiB,EAAE,OAAO;AAAA;AAAA,EAE9B,MAAM,EAAE,KAAK,CAAC,aAAa,WAAW,QAAQ,YAAY,CAAC;AAAA,EAC3D,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAClD,CAAC;AAED,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAGX,SAAS,YAAY,QAAgB,UAA0B;AAC7D,QAAM,UAAU,OAAO,SAAS,QAAQ,KAAK,WAAW,IAAI,KAAK,MAAM,QAAQ,IAAI;AACnF,MAAI,OAAO,UAAU,QAAS,QAAO;AACrC,SAAO,OAAO,MAAM,GAAG,OAAO;AAChC;AAGA,SAAS,WAAW,OAA6B,UAA4B;AAC3E,MAAI,CAAC,MAAM,QAAQ,KAAK,K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QAAM,QAAQ,KAAK,IAAI;AACvB,MAAI;AACF,UAAM,WAAW,MAAM,OAAO,wBAAwB,UAAU,gBAAgB,OAAO;AACvF,UAAM,YAAY,KAAK,IAAI,IAAI;AAC/B,QAAI,CAAC,UAAU,QAAQ;AAGrB,aAAO,gBAAgB,eAAe,sBAAsB,aAAa,WAAW,IAAI;AAAA,IAC1F;AACA,UAAM,OAAO,SAAS,OAAO;AAC7B,UAAM,SACJ,OAAO,SAAS,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,KAAK,EAAE,SAAS,IACjF,SAAS,OAAO,OAAO,KAAK,IAC5B;AACN,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA,WAAW,SAAS;AAAA,MACpB;AAAA,MACA,cAAc;AAAA,IAChB;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,YAAY,KAAK,IAAI,IAAI;AAC/B,QAAI,QAAQ,SAAS;AAEnB,aAAO,gBAAgB,eAAe,sBAAsB,WAAW,WAAW,IAAI;AAAA,IACxF;AACA,UAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,QAAI,KAAK,2DAA2D,OAAO,EAAE;AAC7E,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,aAAa,OAAO;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/recall-planner-llm.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { PluginConfig, RecallPlanMode } from \"./types.js\";\nimport type { CapabilitySet } from \"./capabilities.js\";\nimport { planRecallMode } from \"./intent.js\";\nimport {\n FallbackLlmClient,\n fallbackLlmRuntimeContextFromConfig,\n gatewayTaskChainOptions,\n type FallbackLlmOptions,\n} from \"./fallback-llm.js\";\nimport { log } from \"./logger.js\";\n\n/**\n * LLM-based recall planning (issue #1367, Option C).\n *\n * Classifies an incoming prompt into a {@link RecallPlanMode} using an LLM\n * instead of (or alongside) the regex heuristic in {@link planRecallMode}.\n *\n * Provider-agnostic by construction: it routes through {@link FallbackLlmClient},\n * which resolves the model chain from gateway providers (OpenAI, Anthropic,\n * Ollama, Codex, …) or gateway agent personas / `taskModelChain`. Nothing here\n * is hard-coded to a single provider or to OpenAI's Responses API — the API\n * dialect is chosen per-provider by the client based on each provider's `api`\n * field. The configured `recallPlannerModel` is tried first, with the broader\n * task chain (and the gateway default) as resilient fallbacks.\n *\n * Invariants:\n * - Never throws to the caller (gotcha #13). Any LLM failure, timeout, empty\n * response, or unavailable backend falls back to the heuristic result and\n * sets `fallbackUsed: true` (gotcha #34 — failures are distinct from a valid\n * classification).\n * - When `recallPlannerLlmEnabled` is false the LLM is never contacted.\n */\n\nexport type RecallPlannerSource = \"llm\" | \"heuristic\" | \"heuristic-fallback\";\n\nexport interface RecallPlannerLlmResult {\n /** The mode to act on. */\n mode: RecallPlanMode;\n /** The heuristic mode, always computed (the fallback floor / shadow baseline). */\n heuristicMode: RecallPlanMode;\n /** Where `mode` came from. */\n source: RecallPlannerSource;\n /** Short human-readable rationale (LLM reason, or why we fell back). */\n reason: string;\n /** Model that actually served the classification, when an LLM was used. */\n modelUsed?: string;\n /** Wall-clock spent in the LLM call (0 when no call was made). */\n latencyMs: number;\n /** True when the LLM was enabled but we had to fall back to the heuristic. */\n fallbackUsed: boolean;\n}\n\nconst PLANNER_SCHEMA = z.object({\n // gotcha #2: optional fields use .optional().nullable()\n mode: z.enum([\"no_recall\", \"minimal\", \"full\", \"graph_mode\"]),\n reason: z.string().max(280).optional().nullable(),\n});\n\nconst SYSTEM_PROMPT = [\n \"You are a recall-planning classifier for a long-term memory system.\",\n \"Given the user's latest message, decide how much stored memory should be retrieved before the assistant responds.\",\n \"Reply with a single JSON object: {\\\"mode\\\": <one of no_recall|minimal|full|graph_mode>, \\\"reason\\\": <short string>}.\",\n \"\",\n \"Modes:\",\n '- \"no_recall\": low-information acknowledgements or chit-chat with nothing to look up (e.g. \"ok\", \"thanks\", \"sounds good\"). Retrieve nothing.',\n '- \"minimal\": short, self-contained operational directives that rarely need history (e.g. \"restart the service\", \"run the tests\", \"show status\"). Retrieve a little.',\n '- \"full\": anything memory-seeking, analytical, or a question that benefits from prior context, decisions, or facts. This is the safe default when unsure.',\n '- \"graph_mode\": queries about timelines, sequences, history, causal chains, or root cause (\"how did we get here\", \"what led to this regression\"). Retrieve relationship/graph context.',\n \"\",\n \"When uncertain, prefer \\\"full\\\" over dropping recall. Never invent facts; only classify intent.\",\n].join(\"\\n\");\n\n/** Clamp a planner prompt to the configured character budget. */\nfunction clampPrompt(prompt: string, maxChars: number): string {\n const safeMax = Number.isFinite(maxChars) && maxChars > 0 ? Math.floor(maxChars) : 4000;\n if (prompt.length <= safeMax) return prompt;\n return prompt.slice(0, safeMax);\n}\n\n/** Trim and cap the optional memory hints used to ground the classification. */\nfunction clampHints(hints: string[] | undefined, maxHints: number): string[] {\n if (!Array.isArray(hints) || hints.length === 0) return [];\n const safeMax = Number.isFinite(maxHints) && maxHints > 0 ? Math.floor(maxHints) : 0;\n if (safeMax <= 0) return [];\n const cleaned: string[] = [];\n for (const hint of hints) {\n if (typeof hint !== \"string\") continue;\n const trimmed = hint.trim();\n if (trimmed.length === 0) continue;\n cleaned.push(trimmed);\n if (cleaned.length >= safeMax) break;\n }\n return cleaned;\n}\n\nfunction buildMessages(\n prompt: string,\n hints: string[],\n config: PluginConfig,\n): Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }> {\n const clampedPrompt = clampPrompt(prompt, config.recallPlannerMaxPromptChars);\n const userParts = [`User message:\\n${clampedPrompt}`];\n if (hints.length > 0) {\n userParts.push(\n `\\nRecent memory topics (for grounding only, do not treat as the message):\\n- ${hints.join(\"\\n- \")}`,\n );\n }\n userParts.push('\\nRespond with JSON only: {\"mode\": \"...\", \"reason\": \"...\"}.');\n return [\n { role: \"system\", content: SYSTEM_PROMPT },\n { role: \"user\", content: userParts.join(\"\\n\") },\n ];\n}\n\n/**\n * Resolve the FallbackLlmClient routing options for the recall planner.\n *\n * - The dedicated `recallPlannerModel` is tried first (as the `model`\n * override — it is prepended to the chain by FallbackLlmClient). If it does\n * not resolve to a configured provider it is silently skipped, so a stale\n * default never breaks routing.\n * - In gateway mode the shared `gatewayTaskChainOptions` (taskModelChain >\n * gatewayAgentId, gotcha #22) is layered in as the fallback chain, plus the\n * implicit gateway default appended by the client.\n * - In plugin mode only the explicit model + gateway providers apply.\n */\n/**\n * A `recallPlannerModel` value is only usable as a FallbackLlmClient `model`\n * override when it is provider-qualified (`provider/model`). The client's\n * `parseModelString` rejects bare names, so forwarding a bare value (e.g. the\n * legacy default `\"gpt-5.5\"`) would log \"invalid model format\" on every call\n * and never resolve. Bare values are dropped so routing falls through to the\n * gateway chain / agent / default instead (issue #1367 review on PR #1428).\n */\nfunction qualifiedPlannerModel(recallPlannerModel: string | undefined): string | undefined {\n if (typeof recallPlannerModel !== \"string\") return undefined;\n const trimmed = recallPlannerModel.trim();\n return trimmed.includes(\"/\") ? trimmed : undefined;\n}\n\nexport function resolveRecallPlannerLlmOptions(\n config: Pick<\n PluginConfig,\n \"modelSource\" | \"taskModelChain\" | \"gatewayAgentId\" | \"recallPlannerModel\" | \"recallPlannerTimeoutMs\"\n >,\n): FallbackLlmOptions {\n const chainOptions =\n config.modelSource === \"gateway\" ? gatewayTaskChainOptions(config) : {};\n return {\n ...chainOptions,\n model: qualifiedPlannerModel(config.recallPlannerModel),\n temperature: 0,\n maxTokens: 64,\n timeoutMs:\n typeof config.recallPlannerTimeoutMs === \"number\" && config.recallPlannerTimeoutMs > 0\n ? config.recallPlannerTimeoutMs\n : 1500,\n };\n}\n\n// One-time warning per distinct routing signature so an opted-in operator with\n// no usable model learns why planning silently uses the heuristic, without\n// spamming a line on every recall.\nconst warnedNoRoutingSignatures = new Set<string>();\n\nfunction heuristicResult(\n heuristicMode: RecallPlanMode,\n source: RecallPlannerSource,\n reason: string,\n latencyMs: number,\n fallbackUsed: boolean,\n): RecallPlannerLlmResult {\n return { mode: heuristicMode, heuristicMode, source, reason, latencyMs, fallbackUsed };\n}\n\n/**\n * Plan the recall mode for `prompt`, optionally consulting an LLM.\n *\n * Always safe to call: returns the heuristic result when the LLM is disabled,\n * unavailable, or fails.\n *\n * @param llm injectable client (tests pass a stub); constructed from gateway\n * config when omitted.\n */\nexport async function planRecallModeLLM(\n prompt: string,\n hints: string[] | undefined,\n config: PluginConfig,\n caps: CapabilitySet,\n llm?: FallbackLlmClient,\n signal?: AbortSignal,\n): Promise<RecallPlannerLlmResult> {\n const heuristicMode = planRecallMode(prompt);\n\n // The recall-operation entry resolved this gate once (issue #1523); read the\n // capability, never re-derive it from raw config here.\n const plannerLlmEnabled = caps.recallPlannerLlm;\n if (!plannerLlmEnabled) {\n return heuristicResult(heuristicMode, \"heuristic\", \"llm-disabled\", 0, false);\n }\n\n // Participate in the recall cancellation contract: if the outer recall is\n // already aborted (outer timeout / reset / session abort), don't start an LLM\n // round-trip — fall back to the heuristic immediately (#1428 review).\n if (signal?.aborted) {\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"aborted\", 0, true);\n }\n\n const safePrompt = typeof prompt === \"string\" ? prompt.trim() : \"\";\n if (safePrompt.length === 0) {\n // Empty prompts never need an LLM round-trip.\n return heuristicResult(heuristicMode, \"heuristic\", \"empty-prompt\", 0, false);\n }\n\n const client =\n llm ??\n new FallbackLlmClient(\n config.gatewayConfig,\n fallbackLlmRuntimeContextFromConfig(config),\n );\n\n // Forward the recall abort signal so an aborted/timed-out outer recall can\n // cancel an in-flight planner call (FallbackLlmClient honors `signal`).\n const options = { ...resolveRecallPlannerLlmOptions(config), signal };\n\n // Availability check uses the same routing options so plugin-mode / empty\n // chains short-circuit to the heuristic without a network attempt. `model`\n // here is already provider-qualified (bare names were dropped), so a present\n // model means the override is genuinely routable.\n const availabilityProbe = {\n agentId: options.agentId,\n modelChain: options.modelChain,\n };\n if (!client.isAvailable(availabilityProbe) && !options.model) {\n // Opted-in but nothing routable resolves (e.g. plugin mode with the bare\n // default `recallPlannerModel` and no gateway chain). Warn once so it's not\n // a silent no-op, then fall back to the heuristic.\n const signature = `${config.modelSource}:${config.recallPlannerModel ?? \"\"}`;\n if (!warnedNoRoutingSignatures.has(signature)) {\n warnedNoRoutingSignatures.add(signature);\n log.warn(\n \"[recall-planner] recallPlannerLlmEnabled is on but no routable model resolves — \" +\n \"set recallPlannerModel to a 'provider/model' value or configure a gateway model chain. \" +\n \"Falling back to the heuristic planner.\",\n );\n }\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"llm-no-model\", 0, true);\n }\n\n const clampedHints = clampHints(hints, config.recallPlannerMaxMemoryHints);\n const messages = buildMessages(safePrompt, clampedHints, config);\n\n const start = Date.now();\n try {\n const detailed = await client.parseWithSchemaDetailed(messages, PLANNER_SCHEMA, options);\n const latencyMs = Date.now() - start;\n if (!detailed?.result) {\n // Distinguish failure from a valid empty (gotcha #34): a null here means\n // no parseable classification, so fall back to the heuristic.\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"llm-empty\", latencyMs, true);\n }\n const mode = detailed.result.mode;\n const reason =\n typeof detailed.result.reason === \"string\" && detailed.result.reason.trim().length > 0\n ? detailed.result.reason.trim()\n : \"llm-classified\";\n return {\n mode,\n heuristicMode,\n source: \"llm\",\n reason,\n modelUsed: detailed.modelUsed,\n latencyMs,\n fallbackUsed: false,\n };\n } catch (err) {\n const latencyMs = Date.now() - start;\n if (signal?.aborted) {\n // Cancelled by the outer recall — expected, not an error worth warning on.\n return heuristicResult(heuristicMode, \"heuristic-fallback\", \"aborted\", latencyMs, true);\n }\n const message = err instanceof Error ? err.message : String(err);\n log.warn(`[recall-planner] LLM failed, falling back to heuristic: ${message}`);\n return heuristicResult(\n heuristicMode,\n \"heuristic-fallback\",\n `llm-error:${message}`,\n latencyMs,\n true,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAsDlB,IAAM,iBAAiB,EAAE,OAAO;AAAA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,UAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,QAAI,KAAK,2DAA2D,OAAO,EAAE;AAC7E,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,aAAa,OAAO;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/dist/schemas.d.ts CHANGED
@@ -290,12 +290,12 @@ declare const EntityMentionSchema: z.ZodObject<{
290
290
  title: z.ZodString;
291
291
  facts: z.ZodArray<z.ZodString, "many">;
292
292
  }, "strip", z.ZodTypeAny, {
293
- title: string;
294
293
  key: string;
294
+ title: string;
295
295
  facts: string[];
296
296
  }, {
297
- title: string;
298
297
  key: string;
298
+ title: string;
299
299
  facts: string[];
300
300
  }>, "many">>>;
301
301
  }, "strip", z.ZodTypeAny, {
@@ -303,8 +303,8 @@ declare const EntityMentionSchema: z.ZodObject<{
303
303
  name: string;
304
304
  facts: string[];
305
305
  structuredSections?: {
306
- title: string;
307
306
  key: string;
307
+ title: string;
308
308
  facts: string[];
309
309
  }[] | null | undefined;
310
310
  promptedByQuestion?: string | null | undefined;
@@ -313,8 +313,8 @@ declare const EntityMentionSchema: z.ZodObject<{
313
313
  name: string;
314
314
  facts: string[];
315
315
  structuredSections?: {
316
- title: string;
317
316
  key: string;
317
+ title: string;
318
318
  facts: string[];
319
319
  }[] | null | undefined;
320
320
  promptedByQuestion?: string | null | undefined;
@@ -614,12 +614,12 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
614
614
  title: z.ZodString;
615
615
  facts: z.ZodArray<z.ZodString, "many">;
616
616
  }, "strip", z.ZodTypeAny, {
617
- title: string;
618
617
  key: string;
618
+ title: string;
619
619
  facts: string[];
620
620
  }, {
621
- title: string;
622
621
  key: string;
622
+ title: string;
623
623
  facts: string[];
624
624
  }>, "many">>>;
625
625
  }, "strip", z.ZodTypeAny, {
@@ -627,8 +627,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
627
627
  name: string;
628
628
  facts: string[];
629
629
  structuredSections?: {
630
- title: string;
631
630
  key: string;
631
+ title: string;
632
632
  facts: string[];
633
633
  }[] | null | undefined;
634
634
  promptedByQuestion?: string | null | undefined;
@@ -637,8 +637,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
637
637
  name: string;
638
638
  facts: string[];
639
639
  structuredSections?: {
640
- title: string;
641
640
  key: string;
641
+ title: string;
642
642
  facts: string[];
643
643
  }[] | null | undefined;
644
644
  promptedByQuestion?: string | null | undefined;
@@ -698,8 +698,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
698
698
  name: string;
699
699
  facts: string[];
700
700
  structuredSections?: {
701
- title: string;
702
701
  key: string;
702
+ title: string;
703
703
  facts: string[];
704
704
  }[] | null | undefined;
705
705
  promptedByQuestion?: string | null | undefined;
@@ -750,8 +750,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
750
750
  name: string;
751
751
  facts: string[];
752
752
  structuredSections?: {
753
- title: string;
754
753
  key: string;
754
+ title: string;
755
755
  facts: string[];
756
756
  }[] | null | undefined;
757
757
  promptedByQuestion?: string | null | undefined;
@@ -1003,12 +1003,12 @@ declare const ExtractionResultSchema: z.ZodObject<{
1003
1003
  title: z.ZodString;
1004
1004
  facts: z.ZodArray<z.ZodString, "many">;
1005
1005
  }, "strip", z.ZodTypeAny, {
1006
- title: string;
1007
1006
  key: string;
1007
+ title: string;
1008
1008
  facts: string[];
1009
1009
  }, {
1010
- title: string;
1011
1010
  key: string;
1011
+ title: string;
1012
1012
  facts: string[];
1013
1013
  }>, "many">>>;
1014
1014
  }, "strip", z.ZodTypeAny, {
@@ -1016,8 +1016,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
1016
1016
  name: string;
1017
1017
  facts: string[];
1018
1018
  structuredSections?: {
1019
- title: string;
1020
1019
  key: string;
1020
+ title: string;
1021
1021
  facts: string[];
1022
1022
  }[] | null | undefined;
1023
1023
  promptedByQuestion?: string | null | undefined;
@@ -1026,8 +1026,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
1026
1026
  name: string;
1027
1027
  facts: string[];
1028
1028
  structuredSections?: {
1029
- title: string;
1030
1029
  key: string;
1030
+ title: string;
1031
1031
  facts: string[];
1032
1032
  }[] | null | undefined;
1033
1033
  promptedByQuestion?: string | null | undefined;
@@ -1106,8 +1106,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
1106
1106
  name: string;
1107
1107
  facts: string[];
1108
1108
  structuredSections?: {
1109
- title: string;
1110
1109
  key: string;
1110
+ title: string;
1111
1111
  facts: string[];
1112
1112
  }[] | null | undefined;
1113
1113
  promptedByQuestion?: string | null | undefined;
@@ -1164,8 +1164,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
1164
1164
  name: string;
1165
1165
  facts: string[];
1166
1166
  structuredSections?: {
1167
- title: string;
1168
1167
  key: string;
1168
+ title: string;
1169
1169
  facts: string[];
1170
1170
  }[] | null | undefined;
1171
1171
  promptedByQuestion?: string | null | undefined;
@@ -1229,12 +1229,12 @@ declare const ConsolidationResultSchema: z.ZodObject<{
1229
1229
  title: z.ZodString;
1230
1230
  facts: z.ZodArray<z.ZodString, "many">;
1231
1231
  }, "strip", z.ZodTypeAny, {
1232
- title: string;
1233
1232
  key: string;
1233
+ title: string;
1234
1234
  facts: string[];
1235
1235
  }, {
1236
- title: string;
1237
1236
  key: string;
1237
+ title: string;
1238
1238
  facts: string[];
1239
1239
  }>, "many">>>;
1240
1240
  }, "strip", z.ZodTypeAny, {
@@ -1242,8 +1242,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
1242
1242
  name: string;
1243
1243
  facts: string[];
1244
1244
  structuredSections?: {
1245
- title: string;
1246
1245
  key: string;
1246
+ title: string;
1247
1247
  facts: string[];
1248
1248
  }[] | null | undefined;
1249
1249
  promptedByQuestion?: string | null | undefined;
@@ -1252,8 +1252,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
1252
1252
  name: string;
1253
1253
  facts: string[];
1254
1254
  structuredSections?: {
1255
- title: string;
1256
1255
  key: string;
1256
+ title: string;
1257
1257
  facts: string[];
1258
1258
  }[] | null | undefined;
1259
1259
  promptedByQuestion?: string | null | undefined;
@@ -1272,8 +1272,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
1272
1272
  name: string;
1273
1273
  facts: string[];
1274
1274
  structuredSections?: {
1275
- title: string;
1276
1275
  key: string;
1276
+ title: string;
1277
1277
  facts: string[];
1278
1278
  }[] | null | undefined;
1279
1279
  promptedByQuestion?: string | null | undefined;
@@ -1292,8 +1292,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
1292
1292
  name: string;
1293
1293
  facts: string[];
1294
1294
  structuredSections?: {
1295
- title: string;
1296
1295
  key: string;
1296
+ title: string;
1297
1297
  facts: string[];
1298
1298
  }[] | null | undefined;
1299
1299
  promptedByQuestion?: string | null | undefined;