@remnic/core 9.3.715 → 9.3.717

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 (81) hide show
  1. package/dist/access-boundary.d.ts +2 -2
  2. package/dist/access-boundary.js +4 -3
  3. package/dist/access-cli.js +13 -12
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +2 -2
  6. package/dist/access-http.js +8 -7
  7. package/dist/access-mcp.d.ts +2 -2
  8. package/dist/access-mcp.js +7 -6
  9. package/dist/access-operations-batch.js +5 -4
  10. package/dist/access-operations.d.ts +2 -2
  11. package/dist/access-operations.js +6 -5
  12. package/dist/{access-service-GgnA--CE.d.ts → access-service-d4Tk-Dlr.d.ts} +2 -2
  13. package/dist/access-service.d.ts +2 -2
  14. package/dist/access-service.js +3 -2
  15. package/dist/access-surface-catalog.d.ts +2 -2
  16. package/dist/bootstrap.d.ts +1 -1
  17. package/dist/{chunk-MECU6WSH.js → chunk-2B43BYYZ.js} +6 -6
  18. package/dist/chunk-2KF4HDG2.js +24 -0
  19. package/dist/chunk-2KF4HDG2.js.map +1 -0
  20. package/dist/{chunk-HHLWSWWF.js → chunk-BF2426TN.js} +2 -2
  21. package/dist/{chunk-RBHANGVX.js → chunk-BZAK3RBN.js} +2 -2
  22. package/dist/{chunk-YUJL27ET.js → chunk-CTUWGJRI.js} +40 -63
  23. package/dist/chunk-CTUWGJRI.js.map +1 -0
  24. package/dist/{chunk-6QUPUTT7.js → chunk-DZYARLJ7.js} +5 -9
  25. package/dist/{chunk-6QUPUTT7.js.map → chunk-DZYARLJ7.js.map} +1 -1
  26. package/dist/{chunk-CTAHKIG6.js → chunk-EM22PCQR.js} +7 -7
  27. package/dist/{chunk-SHRRWOVY.js → chunk-J6BH2OBA.js} +64 -21
  28. package/dist/chunk-J6BH2OBA.js.map +1 -0
  29. package/dist/{chunk-GM3BMWKR.js → chunk-KHQ433G5.js} +2 -2
  30. package/dist/{chunk-SYDHFFAW.js → chunk-OUDAU3T5.js} +4 -4
  31. package/dist/{chunk-OQH5XUH3.js → chunk-Q6IP2ARR.js} +2 -5
  32. package/dist/chunk-Q6IP2ARR.js.map +1 -0
  33. package/dist/{chunk-O62P2LFL.js → chunk-VZQXJNBD.js} +2 -2
  34. package/dist/{chunk-BNOAB5HH.js → chunk-YAINYEM3.js} +57 -48
  35. package/dist/chunk-YAINYEM3.js.map +1 -0
  36. package/dist/{chunk-3VUPWDSE.js → chunk-ZAVTEQFM.js} +4 -4
  37. package/dist/{chunk-IHMT6XTY.js → chunk-ZXLSNG3T.js} +3 -3
  38. package/dist/{cli-Do1YtfnH.d.ts → cli-insNLYs6.d.ts} +2 -2
  39. package/dist/cli.d.ts +3 -3
  40. package/dist/cli.js +12 -11
  41. package/dist/direct-answer-wiring.d.ts +9 -9
  42. package/dist/direct-answer-wiring.js +1 -1
  43. package/dist/explicit-capture.d.ts +1 -1
  44. package/dist/index.d.ts +4 -4
  45. package/dist/index.js +23 -22
  46. package/dist/index.js.map +1 -1
  47. package/dist/mcp-memory-inspector-app.d.ts +2 -2
  48. package/dist/operator-toolkit.js +5 -3
  49. package/dist/orchestration/maintenance.js +5 -2
  50. package/dist/{orchestrator-BOaVstFG.d.ts → orchestrator-XPKhY2OV.d.ts} +6 -7
  51. package/dist/orchestrator.d.ts +1 -1
  52. package/dist/orchestrator.js +7 -6
  53. package/dist/recall-planner-llm.d.ts +1 -1
  54. package/dist/recall-planner-llm.js +2 -2
  55. package/dist/recall-planner-llm.js.map +1 -1
  56. package/dist/schemas.d.ts +22 -22
  57. package/dist/transfer/types.d.ts +12 -12
  58. package/package.json +2 -2
  59. package/src/access-service.ts +56 -41
  60. package/src/capabilities.test.ts +28 -0
  61. package/src/direct-answer-wiring.test.ts +20 -13
  62. package/src/direct-answer-wiring.ts +9 -13
  63. package/src/maintenance/namespace-planner.ts +3 -10
  64. package/src/orchestrator.ts +42 -71
  65. package/src/recall-planner-llm.test.ts +30 -11
  66. package/src/recall-planner-llm.ts +4 -5
  67. package/src/scopes/scope-plan.test.ts +168 -1
  68. package/src/scopes/scope-plan.ts +163 -0
  69. package/dist/chunk-BNOAB5HH.js.map +0 -1
  70. package/dist/chunk-OQH5XUH3.js.map +0 -1
  71. package/dist/chunk-SHRRWOVY.js.map +0 -1
  72. package/dist/chunk-YUJL27ET.js.map +0 -1
  73. /package/dist/{chunk-MECU6WSH.js.map → chunk-2B43BYYZ.js.map} +0 -0
  74. /package/dist/{chunk-HHLWSWWF.js.map → chunk-BF2426TN.js.map} +0 -0
  75. /package/dist/{chunk-RBHANGVX.js.map → chunk-BZAK3RBN.js.map} +0 -0
  76. /package/dist/{chunk-CTAHKIG6.js.map → chunk-EM22PCQR.js.map} +0 -0
  77. /package/dist/{chunk-GM3BMWKR.js.map → chunk-KHQ433G5.js.map} +0 -0
  78. /package/dist/{chunk-SYDHFFAW.js.map → chunk-OUDAU3T5.js.map} +0 -0
  79. /package/dist/{chunk-O62P2LFL.js.map → chunk-VZQXJNBD.js.map} +0 -0
  80. /package/dist/{chunk-3VUPWDSE.js.map → chunk-ZAVTEQFM.js.map} +0 -0
  81. /package/dist/{chunk-IHMT6XTY.js.map → chunk-ZXLSNG3T.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { h as EngramAccessRecallResponse } from './access-service-GgnA--CE.js';
1
+ import { h as EngramAccessRecallResponse } from './access-service-d4Tk-Dlr.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-BOaVstFG.js';
25
+ import './orchestrator-XPKhY2OV.js';
26
26
  import './briefing.js';
27
27
  import './buffer.js';
28
28
  import './extraction-faithfulness.js';
@@ -13,12 +13,12 @@ import {
13
13
  summarizeProvenanceCoverage,
14
14
  summarizeTierDistribution,
15
15
  summarizeTombstoneStatus
16
- } from "./chunk-RBHANGVX.js";
16
+ } from "./chunk-BZAK3RBN.js";
17
17
  import "./chunk-VO4UICII.js";
18
18
  import "./chunk-7XH7VJN4.js";
19
19
  import "./chunk-YBPYIAA5.js";
20
- import "./chunk-GM3BMWKR.js";
21
- import "./chunk-6QUPUTT7.js";
20
+ import "./chunk-KHQ433G5.js";
21
+ import "./chunk-DZYARLJ7.js";
22
22
  import "./chunk-MPHDVHIB.js";
23
23
  import "./chunk-KFY3SGN7.js";
24
24
  import "./chunk-CMTINOFS.js";
@@ -31,6 +31,7 @@ import "./chunk-Z5LAYHGJ.js";
31
31
  import "./chunk-OO42R444.js";
32
32
  import "./chunk-K6MV3TRQ.js";
33
33
  import "./chunk-XZTUMWKQ.js";
34
+ import "./chunk-J6BH2OBA.js";
34
35
  import "./chunk-CTOQEZSN.js";
35
36
  import "./chunk-2KAYTPPT.js";
36
37
  import "./chunk-WRFKZEO6.js";
@@ -86,6 +87,7 @@ import "./chunk-J2HSAU72.js";
86
87
  import "./chunk-A6XUJE5D.js";
87
88
  import "./chunk-P7FMDTKL.js";
88
89
  import "./chunk-VS2IYZRU.js";
90
+ import "./chunk-UZYLX7M6.js";
89
91
  import "./chunk-U3PN77QT.js";
90
92
  import "./chunk-RVLB4E6N.js";
91
93
  import "./chunk-5GKPFL3S.js";
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  MaintenanceScheduler
3
- } from "../chunk-O62P2LFL.js";
3
+ } from "../chunk-VZQXJNBD.js";
4
4
  import "../chunk-666A3MOW.js";
5
- import "../chunk-6QUPUTT7.js";
5
+ import "../chunk-DZYARLJ7.js";
6
6
  import "../chunk-MPHDVHIB.js";
7
+ import "../chunk-J6BH2OBA.js";
7
8
  import "../chunk-ZFXCQPNO.js";
9
+ import "../chunk-O75CRYGF.js";
8
10
  import "../chunk-OC56UWV5.js";
9
11
  import "../chunk-3JJWNZTT.js";
10
12
  import "../chunk-M7XQSUBB.js";
@@ -37,6 +39,7 @@ import "../chunk-J2HSAU72.js";
37
39
  import "../chunk-A6XUJE5D.js";
38
40
  import "../chunk-P7FMDTKL.js";
39
41
  import "../chunk-VS2IYZRU.js";
42
+ import "../chunk-UZYLX7M6.js";
40
43
  import "../chunk-U3PN77QT.js";
41
44
  import "../chunk-RVLB4E6N.js";
42
45
  import "../chunk-5GKPFL3S.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;
@@ -1249,7 +1248,7 @@ declare class Orchestrator {
1249
1248
  readFallbacks: string[];
1250
1249
  } | null;
1251
1250
  getStorageForNamespace(namespace?: string): Promise<StorageManager>;
1252
- private configuredNamespaces;
1251
+ private configuredNamespaceList;
1253
1252
  private rememberNamespaceStorageDirHint;
1254
1253
  private storageDirMatchesNamespaceHint;
1255
1254
  private namespaceStorageDirHintOwnershipRank;
@@ -1969,7 +1968,7 @@ declare class Orchestrator {
1969
1968
  private graphSeedPathRelativeToStorage;
1970
1969
  private graphSeedPathsWithinDeadline;
1971
1970
  private namespaceFromPath;
1972
- private namespaceFromStorageDir;
1971
+ private storageDirNamespace;
1973
1972
  /**
1974
1973
  * Public best-effort catalog write touch (issue #1499). User-facing explicit
1975
1974
  * captures (`memory_store`) and review-queue approvals persist via
@@ -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-BOaVstFG.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-XPKhY2OV.js';
13
13
  import './model-registry.js';
14
14
  import './relevance.js';
15
15
  import './negative.js';
@@ -28,9 +28,9 @@ import {
28
28
  sanitizeSessionKeyForFilename,
29
29
  shouldFilterLifecycleRecallCandidate,
30
30
  summarizeGraphShadowComparison
31
- } from "./chunk-YUJL27ET.js";
31
+ } from "./chunk-CTUWGJRI.js";
32
32
  import "./chunk-DGTDRIUO.js";
33
- import "./chunk-O62P2LFL.js";
33
+ import "./chunk-VZQXJNBD.js";
34
34
  import "./chunk-7HYPN2GC.js";
35
35
  import "./chunk-666A3MOW.js";
36
36
  import "./chunk-HHLLAQGZ.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";
@@ -105,8 +105,8 @@ import "./chunk-JVEMUX6L.js";
105
105
  import "./chunk-ZRWB5D4H.js";
106
106
  import "./chunk-GY3SKOS4.js";
107
107
  import "./chunk-SFQ6QNL7.js";
108
- import "./chunk-GM3BMWKR.js";
109
- import "./chunk-6QUPUTT7.js";
108
+ import "./chunk-KHQ433G5.js";
109
+ import "./chunk-DZYARLJ7.js";
110
110
  import "./chunk-MPHDVHIB.js";
111
111
  import "./chunk-KFY3SGN7.js";
112
112
  import "./chunk-33JBK2XP.js";
@@ -139,12 +139,13 @@ import "./chunk-NDAH7BJ5.js";
139
139
  import "./chunk-Z5LAYHGJ.js";
140
140
  import "./chunk-OADWQ5CR.js";
141
141
  import "./chunk-7WV3F5DQ.js";
142
- import "./chunk-SHRRWOVY.js";
142
+ import "./chunk-2KF4HDG2.js";
143
143
  import "./chunk-RS25QOKZ.js";
144
144
  import "./chunk-JGSKJHF7.js";
145
145
  import "./chunk-S4DDLTPX.js";
146
146
  import "./chunk-FF4KLI5W.js";
147
147
  import "./chunk-AJOIM6UR.js";
148
+ import "./chunk-J6BH2OBA.js";
148
149
  import "./chunk-CTOQEZSN.js";
149
150
  import "./chunk-2KAYTPPT.js";
150
151
  import "./chunk-WRFKZEO6.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,MAA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AEA,QAAM,eAAe,WAAW,OAAO,OAAO,2BAA2B;AACzE,QAAM,WAAW,cAAc,YAAY,cAAc,MAAM;AAE/D,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}\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/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":[]}
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;
@@ -313,13 +313,13 @@ declare const CapsuleBlockSchema: z.ZodObject<{
313
313
  peerProfiles: boolean;
314
314
  }>;
315
315
  }, "strip", z.ZodTypeAny, {
316
- schemaVersion: string;
317
316
  includes: {
318
317
  procedural: boolean;
319
318
  taxonomy: boolean;
320
319
  identityAnchors: boolean;
321
320
  peerProfiles: boolean;
322
321
  };
322
+ schemaVersion: string;
323
323
  id: string;
324
324
  version: string;
325
325
  description: string;
@@ -334,13 +334,13 @@ declare const CapsuleBlockSchema: z.ZodObject<{
334
334
  directAnswerEnabled: boolean;
335
335
  };
336
336
  }, {
337
- schemaVersion: string;
338
337
  includes: {
339
338
  procedural: boolean;
340
339
  taxonomy: boolean;
341
340
  identityAnchors: boolean;
342
341
  peerProfiles: boolean;
343
342
  };
343
+ schemaVersion: string;
344
344
  id: string;
345
345
  version: string;
346
346
  description: string;
@@ -464,13 +464,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
464
464
  peerProfiles: boolean;
465
465
  }>;
466
466
  }, "strip", z.ZodTypeAny, {
467
- schemaVersion: string;
468
467
  includes: {
469
468
  procedural: boolean;
470
469
  taxonomy: boolean;
471
470
  identityAnchors: boolean;
472
471
  peerProfiles: boolean;
473
472
  };
473
+ schemaVersion: string;
474
474
  id: string;
475
475
  version: string;
476
476
  description: string;
@@ -485,13 +485,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
485
485
  directAnswerEnabled: boolean;
486
486
  };
487
487
  }, {
488
- schemaVersion: string;
489
488
  includes: {
490
489
  procedural: boolean;
491
490
  taxonomy: boolean;
492
491
  identityAnchors: boolean;
493
492
  peerProfiles: boolean;
494
493
  };
494
+ schemaVersion: string;
495
495
  id: string;
496
496
  version: string;
497
497
  description: string;
@@ -518,13 +518,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
518
518
  pluginVersion: string;
519
519
  includesTranscripts: boolean;
520
520
  capsule: {
521
- schemaVersion: string;
522
521
  includes: {
523
522
  procedural: boolean;
524
523
  taxonomy: boolean;
525
524
  identityAnchors: boolean;
526
525
  peerProfiles: boolean;
527
526
  };
527
+ schemaVersion: string;
528
528
  id: string;
529
529
  version: string;
530
530
  description: string;
@@ -551,13 +551,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
551
551
  pluginVersion: string;
552
552
  includesTranscripts: boolean;
553
553
  capsule: {
554
- schemaVersion: string;
555
554
  includes: {
556
555
  procedural: boolean;
557
556
  taxonomy: boolean;
558
557
  identityAnchors: boolean;
559
558
  peerProfiles: boolean;
560
559
  };
560
+ schemaVersion: string;
561
561
  id: string;
562
562
  version: string;
563
563
  description: string;
@@ -683,13 +683,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
683
683
  peerProfiles: boolean;
684
684
  }>;
685
685
  }, "strip", z.ZodTypeAny, {
686
- schemaVersion: string;
687
686
  includes: {
688
687
  procedural: boolean;
689
688
  taxonomy: boolean;
690
689
  identityAnchors: boolean;
691
690
  peerProfiles: boolean;
692
691
  };
692
+ schemaVersion: string;
693
693
  id: string;
694
694
  version: string;
695
695
  description: string;
@@ -704,13 +704,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
704
704
  directAnswerEnabled: boolean;
705
705
  };
706
706
  }, {
707
- schemaVersion: string;
708
707
  includes: {
709
708
  procedural: boolean;
710
709
  taxonomy: boolean;
711
710
  identityAnchors: boolean;
712
711
  peerProfiles: boolean;
713
712
  };
713
+ schemaVersion: string;
714
714
  id: string;
715
715
  version: string;
716
716
  description: string;
@@ -737,13 +737,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
737
737
  pluginVersion: string;
738
738
  includesTranscripts: boolean;
739
739
  capsule: {
740
- schemaVersion: string;
741
740
  includes: {
742
741
  procedural: boolean;
743
742
  taxonomy: boolean;
744
743
  identityAnchors: boolean;
745
744
  peerProfiles: boolean;
746
745
  };
746
+ schemaVersion: string;
747
747
  id: string;
748
748
  version: string;
749
749
  description: string;
@@ -770,13 +770,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
770
770
  pluginVersion: string;
771
771
  includesTranscripts: boolean;
772
772
  capsule: {
773
- schemaVersion: string;
774
773
  includes: {
775
774
  procedural: boolean;
776
775
  taxonomy: boolean;
777
776
  identityAnchors: boolean;
778
777
  peerProfiles: boolean;
779
778
  };
779
+ schemaVersion: string;
780
780
  id: string;
781
781
  version: string;
782
782
  description: string;
@@ -819,13 +819,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
819
819
  pluginVersion: string;
820
820
  includesTranscripts: boolean;
821
821
  capsule: {
822
- schemaVersion: string;
823
822
  includes: {
824
823
  procedural: boolean;
825
824
  taxonomy: boolean;
826
825
  identityAnchors: boolean;
827
826
  peerProfiles: boolean;
828
827
  };
828
+ schemaVersion: string;
829
829
  id: string;
830
830
  version: string;
831
831
  description: string;
@@ -858,13 +858,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
858
858
  pluginVersion: string;
859
859
  includesTranscripts: boolean;
860
860
  capsule: {
861
- schemaVersion: string;
862
861
  includes: {
863
862
  procedural: boolean;
864
863
  taxonomy: boolean;
865
864
  identityAnchors: boolean;
866
865
  peerProfiles: boolean;
867
866
  };
867
+ schemaVersion: string;
868
868
  id: string;
869
869
  version: string;
870
870
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/core",
3
- "version": "9.3.715",
3
+ "version": "9.3.717",
4
4
  "description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -2966,7 +2966,7 @@
2966
2966
  "core"
2967
2967
  ],
2968
2968
  "peerDependencies": {
2969
- "@remnic/coding-graph": "^9.3.715"
2969
+ "@remnic/coding-graph": "^9.3.717"
2970
2970
  },
2971
2971
  "peerDependenciesMeta": {
2972
2972
  "@remnic/coding-graph": {