@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.
- package/dist/access-boundary.d.ts +2 -2
- package/dist/access-cli.js +2 -2
- package/dist/access-http.d.ts +2 -2
- package/dist/access-mcp.d.ts +2 -2
- package/dist/access-operations.d.ts +2 -2
- package/dist/{access-service-lddjZoRh.d.ts → access-service-BW8cm_uU.d.ts} +1 -1
- package/dist/access-service.d.ts +2 -2
- package/dist/access-surface-catalog.d.ts +2 -2
- package/dist/bootstrap.d.ts +1 -1
- package/dist/{chunk-OQH5XUH3.js → chunk-Q6IP2ARR.js} +2 -5
- package/dist/chunk-Q6IP2ARR.js.map +1 -0
- package/dist/{chunk-FXZKXW7C.js → chunk-SQ4LU27I.js} +48 -20
- package/dist/chunk-SQ4LU27I.js.map +1 -0
- package/dist/{cli-iAiVkbYJ.d.ts → cli-Dpivy32W.d.ts} +2 -2
- package/dist/cli.d.ts +3 -3
- package/dist/direct-answer-wiring.d.ts +9 -9
- package/dist/direct-answer-wiring.js +1 -1
- package/dist/explicit-capture.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/mcp-memory-inspector-app.d.ts +2 -2
- package/dist/{orchestrator-iVZWi8aW.d.ts → orchestrator-vygo2YIM.d.ts} +15 -5
- package/dist/orchestrator.d.ts +1 -1
- package/dist/orchestrator.js +2 -2
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-planner-llm.js +2 -2
- package/dist/recall-planner-llm.js.map +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/transfer/types.d.ts +12 -12
- package/package.json +2 -2
- package/src/capabilities.test.ts +28 -0
- package/src/direct-answer-wiring.test.ts +20 -13
- package/src/direct-answer-wiring.ts +9 -13
- package/src/faithfulness-graph-guard.test.ts +214 -8
- package/src/orchestrator.ts +68 -27
- package/src/recall-planner-llm.test.ts +30 -11
- package/src/recall-planner-llm.ts +4 -5
- package/dist/chunk-FXZKXW7C.js.map +0 -1
- package/dist/chunk-OQH5XUH3.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { g as EngramAccessService } from './access-service-
|
|
2
|
+
import { g as EngramAccessService } from './access-service-BW8cm_uU.js';
|
|
3
3
|
import './catalog-CbR0CsUw.js';
|
|
4
4
|
import './types-D9dwzU_x.js';
|
|
5
5
|
import './types-gb_SNtjR.js';
|
|
@@ -21,7 +21,7 @@ import './memory-provenance.js';
|
|
|
21
21
|
import './user-model.js';
|
|
22
22
|
import './recall-audit-anomaly.js';
|
|
23
23
|
import './recall-audit.js';
|
|
24
|
-
import './orchestrator-
|
|
24
|
+
import './orchestrator-vygo2YIM.js';
|
|
25
25
|
import './briefing.js';
|
|
26
26
|
import './buffer.js';
|
|
27
27
|
import './extraction-faithfulness.js';
|
package/dist/access-cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Orchestrator
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SQ4LU27I.js";
|
|
4
4
|
import "./chunk-DGTDRIUO.js";
|
|
5
5
|
import "./chunk-O62P2LFL.js";
|
|
6
6
|
import "./chunk-7HYPN2GC.js";
|
|
@@ -62,7 +62,7 @@ import "./chunk-LUPVCGYK.js";
|
|
|
62
62
|
import "./chunk-PYPOFEMK.js";
|
|
63
63
|
import "./chunk-XHYGJVXL.js";
|
|
64
64
|
import "./chunk-VEWZZM3H.js";
|
|
65
|
-
import "./chunk-
|
|
65
|
+
import "./chunk-Q6IP2ARR.js";
|
|
66
66
|
import "./chunk-6HEM6HTQ.js";
|
|
67
67
|
import "./chunk-ZA2S2VLL.js";
|
|
68
68
|
import "./chunk-DXGS5YOQ.js";
|
package/dist/access-http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IncomingMessage } from 'node:http';
|
|
2
|
-
import { g as EngramAccessService } from './access-service-
|
|
2
|
+
import { g as EngramAccessService } from './access-service-BW8cm_uU.js';
|
|
3
3
|
import { ResolvedIdentity } from './adapters/types.js';
|
|
4
4
|
import { AdapterRegistry } from './adapters/registry.js';
|
|
5
5
|
import './catalog-CbR0CsUw.js';
|
|
@@ -23,7 +23,7 @@ import './memory-provenance.js';
|
|
|
23
23
|
import './user-model.js';
|
|
24
24
|
import './recall-audit-anomaly.js';
|
|
25
25
|
import './recall-audit.js';
|
|
26
|
-
import './orchestrator-
|
|
26
|
+
import './orchestrator-vygo2YIM.js';
|
|
27
27
|
import './briefing.js';
|
|
28
28
|
import './buffer.js';
|
|
29
29
|
import './extraction-faithfulness.js';
|
package/dist/access-mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Readable, Writable } from 'node:stream';
|
|
2
|
-
import { g as EngramAccessService } from './access-service-
|
|
2
|
+
import { g as EngramAccessService } from './access-service-BW8cm_uU.js';
|
|
3
3
|
import './catalog-CbR0CsUw.js';
|
|
4
4
|
import './types-D9dwzU_x.js';
|
|
5
5
|
import './types-gb_SNtjR.js';
|
|
@@ -21,7 +21,7 @@ import './memory-provenance.js';
|
|
|
21
21
|
import './user-model.js';
|
|
22
22
|
import './recall-audit-anomaly.js';
|
|
23
23
|
import './recall-audit.js';
|
|
24
|
-
import './orchestrator-
|
|
24
|
+
import './orchestrator-vygo2YIM.js';
|
|
25
25
|
import './briefing.js';
|
|
26
26
|
import './buffer.js';
|
|
27
27
|
import './extraction-faithfulness.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OperationName, BoundOperation } from './access-boundary.js';
|
|
2
2
|
import { MemoryStoreRequest } from './access-schema.js';
|
|
3
|
-
import { A as ArchitectureSurfaceRequest, a as ArchitectureSurfaceResponse, D as DecisionSurfaceRequest, b as DecisionSurfaceResponse, c as DeltaSurfaceRequest, d as DeltaSurfaceResponse, E as EngramAccessMemoryResponse, e as EngramAccessWriteResponse, C as CodegraphSurfaceRequest, f as CodegraphSurfaceResponse } from './access-service-
|
|
3
|
+
import { A as ArchitectureSurfaceRequest, a as ArchitectureSurfaceResponse, D as DecisionSurfaceRequest, b as DecisionSurfaceResponse, c as DeltaSurfaceRequest, d as DeltaSurfaceResponse, E as EngramAccessMemoryResponse, e as EngramAccessWriteResponse, C as CodegraphSurfaceRequest, f as CodegraphSurfaceResponse } from './access-service-BW8cm_uU.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './catalog-CbR0CsUw.js';
|
|
6
6
|
import './types-D9dwzU_x.js';
|
|
@@ -23,7 +23,7 @@ import './memory-provenance.js';
|
|
|
23
23
|
import './user-model.js';
|
|
24
24
|
import './recall-audit-anomaly.js';
|
|
25
25
|
import './recall-audit.js';
|
|
26
|
-
import './orchestrator-
|
|
26
|
+
import './orchestrator-vygo2YIM.js';
|
|
27
27
|
import './briefing.js';
|
|
28
28
|
import './buffer.js';
|
|
29
29
|
import './extraction-faithfulness.js';
|
|
@@ -4,7 +4,7 @@ import { StorageManager } from './storage.js';
|
|
|
4
4
|
import { a as Peer, b as PeerProfile } from './types-B1VHaf2w.js';
|
|
5
5
|
import { RecallExplainJsonPayload } from './recall-explain-renderer.js';
|
|
6
6
|
import { AnomalyDetectorResult } from './recall-audit-anomaly.js';
|
|
7
|
-
import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot, P as PatternReinforcementResult, W as WearablesService } from './orchestrator-
|
|
7
|
+
import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot, P as PatternReinforcementResult, W as WearablesService } from './orchestrator-vygo2YIM.js';
|
|
8
8
|
import { ExplicitCaptureInput } from './explicit-capture.js';
|
|
9
9
|
import { BudgetDecision } from './cross-namespace-budget.js';
|
|
10
10
|
import { readMemoryGovernanceRunArtifact } from './maintenance/memory-governance.js';
|
package/dist/access-service.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { o as CodingScopedWriteInput, p as ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, q as EngramAccessActionConfidenceRequest, r as EngramAccessActionConfidenceResponse, s as EngramAccessBriefingRequest, t as EngramAccessBriefingResponse, u as EngramAccessCapsuleListResponse, v as EngramAccessDaySummaryRequest, w as EngramAccessEntityListResponse, x as EngramAccessEntityResponse, y as EngramAccessEntitySummary, z as EngramAccessHealthResponse, i as EngramAccessInputError, B as EngramAccessLcmCompactionFlushRequest, F as EngramAccessLcmCompactionFlushResponse, G as EngramAccessLcmCompactionRecordRequest, H as EngramAccessLcmCompactionRecordResponse, I as EngramAccessLcmSearchRequest, J as EngramAccessLcmSearchResponse, K as EngramAccessLcmStatusResponse, L as EngramAccessMaintenanceResponse, M as EngramAccessMemoryBrowseRequest, N as EngramAccessMemoryBrowseResponse, O as EngramAccessMemoryRecord, E as EngramAccessMemoryResponse, Q as EngramAccessMemoryStoreRequest, R as EngramAccessMemorySummary, S as EngramAccessObserveMessage, T as EngramAccessObserveRequest, U as EngramAccessObserveResponse, V as EngramAccessOfflineSyncApplyFileContentRequest, W as EngramAccessOfflineSyncApplyFileContentResponse, X as EngramAccessOfflineSyncApplyRequest, Y as EngramAccessOfflineSyncApplyResponse, Z as EngramAccessOfflineSyncFileContentRequest, _ as EngramAccessOfflineSyncFileContentResponse, $ as EngramAccessOfflineSyncFilesRequest, a0 as EngramAccessOfflineSyncFilesResponse, a1 as EngramAccessOfflineSyncSnapshotRequest, a2 as EngramAccessOfflineSyncSnapshotResponse, a3 as EngramAccessOfflineSyncSnapshotStreamResponse, a4 as EngramAccessQmdCollectionState, a5 as EngramAccessQmdHealthResponse, a6 as EngramAccessQualityResponse, a7 as EngramAccessRecallExplainRequest, a8 as EngramAccessRecallExplainResponse, a9 as EngramAccessRecallRequest, h as EngramAccessRecallResponse, aa as EngramAccessReviewDispositionRequest, ab as EngramAccessReviewDispositionResponse, ac as EngramAccessReviewQueueResponse, ad as EngramAccessScopeDebug, g as EngramAccessService, ae as EngramAccessSetCodingContextRequest, af as EngramAccessSuggestionSubmitRequest, ag as EngramAccessTimelineResponse, ah as EngramAccessTrustZoneBrowseRequest, ai as EngramAccessTrustZoneBrowseResponse, aj as EngramAccessTrustZoneDemoSeedRequest, ak as EngramAccessTrustZoneDemoSeedResponse, al as EngramAccessTrustZonePromoteRequest, am as EngramAccessTrustZonePromoteResponse, an as EngramAccessTrustZoneRecordSummary, ao as EngramAccessTrustZoneStatusResponse, ap as EngramAccessWriteEnvelope, e as EngramAccessWriteResponse, aq as MemoryScopePlan, ar as shapeMemorySummary } from './access-service-
|
|
1
|
+
export { o as CodingScopedWriteInput, p as ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, q as EngramAccessActionConfidenceRequest, r as EngramAccessActionConfidenceResponse, s as EngramAccessBriefingRequest, t as EngramAccessBriefingResponse, u as EngramAccessCapsuleListResponse, v as EngramAccessDaySummaryRequest, w as EngramAccessEntityListResponse, x as EngramAccessEntityResponse, y as EngramAccessEntitySummary, z as EngramAccessHealthResponse, i as EngramAccessInputError, B as EngramAccessLcmCompactionFlushRequest, F as EngramAccessLcmCompactionFlushResponse, G as EngramAccessLcmCompactionRecordRequest, H as EngramAccessLcmCompactionRecordResponse, I as EngramAccessLcmSearchRequest, J as EngramAccessLcmSearchResponse, K as EngramAccessLcmStatusResponse, L as EngramAccessMaintenanceResponse, M as EngramAccessMemoryBrowseRequest, N as EngramAccessMemoryBrowseResponse, O as EngramAccessMemoryRecord, E as EngramAccessMemoryResponse, Q as EngramAccessMemoryStoreRequest, R as EngramAccessMemorySummary, S as EngramAccessObserveMessage, T as EngramAccessObserveRequest, U as EngramAccessObserveResponse, V as EngramAccessOfflineSyncApplyFileContentRequest, W as EngramAccessOfflineSyncApplyFileContentResponse, X as EngramAccessOfflineSyncApplyRequest, Y as EngramAccessOfflineSyncApplyResponse, Z as EngramAccessOfflineSyncFileContentRequest, _ as EngramAccessOfflineSyncFileContentResponse, $ as EngramAccessOfflineSyncFilesRequest, a0 as EngramAccessOfflineSyncFilesResponse, a1 as EngramAccessOfflineSyncSnapshotRequest, a2 as EngramAccessOfflineSyncSnapshotResponse, a3 as EngramAccessOfflineSyncSnapshotStreamResponse, a4 as EngramAccessQmdCollectionState, a5 as EngramAccessQmdHealthResponse, a6 as EngramAccessQualityResponse, a7 as EngramAccessRecallExplainRequest, a8 as EngramAccessRecallExplainResponse, a9 as EngramAccessRecallRequest, h as EngramAccessRecallResponse, aa as EngramAccessReviewDispositionRequest, ab as EngramAccessReviewDispositionResponse, ac as EngramAccessReviewQueueResponse, ad as EngramAccessScopeDebug, g as EngramAccessService, ae as EngramAccessSetCodingContextRequest, af as EngramAccessSuggestionSubmitRequest, ag as EngramAccessTimelineResponse, ah as EngramAccessTrustZoneBrowseRequest, ai as EngramAccessTrustZoneBrowseResponse, aj as EngramAccessTrustZoneDemoSeedRequest, ak as EngramAccessTrustZoneDemoSeedResponse, al as EngramAccessTrustZonePromoteRequest, am as EngramAccessTrustZonePromoteResponse, an as EngramAccessTrustZoneRecordSummary, ao as EngramAccessTrustZoneStatusResponse, ap as EngramAccessWriteEnvelope, e as EngramAccessWriteResponse, aq as MemoryScopePlan, ar as shapeMemorySummary } from './access-service-BW8cm_uU.js';
|
|
2
2
|
import './storage.js';
|
|
3
3
|
import './types-B1VHaf2w.js';
|
|
4
4
|
import './recall-explain-renderer.js';
|
|
5
5
|
import './types-D9dwzU_x.js';
|
|
6
6
|
import './recall-audit-anomaly.js';
|
|
7
|
-
import './orchestrator-
|
|
7
|
+
import './orchestrator-vygo2YIM.js';
|
|
8
8
|
import './explicit-capture.js';
|
|
9
9
|
import './cross-namespace-budget.js';
|
|
10
10
|
import './maintenance/memory-governance.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OperationName } from './access-boundary.js';
|
|
2
2
|
import 'zod';
|
|
3
|
-
import './access-service-
|
|
3
|
+
import './access-service-BW8cm_uU.js';
|
|
4
4
|
import './catalog-CbR0CsUw.js';
|
|
5
5
|
import './types-D9dwzU_x.js';
|
|
6
6
|
import './types-gb_SNtjR.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-
|
|
25
|
+
import './orchestrator-vygo2YIM.js';
|
|
26
26
|
import './briefing.js';
|
|
27
27
|
import './buffer.js';
|
|
28
28
|
import './extraction-faithfulness.js';
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as PluginConfig } from './types-D9dwzU_x.js';
|
|
2
|
-
import { O as Orchestrator } from './orchestrator-
|
|
2
|
+
import { O as Orchestrator } from './orchestrator-vygo2YIM.js';
|
|
3
3
|
import './types-gb_SNtjR.js';
|
|
4
4
|
import './message-parts/index.js';
|
|
5
5
|
import './briefing.js';
|
|
@@ -118,10 +118,7 @@ var TAXONOMY_KEYWORD_STOPWORDS = /* @__PURE__ */ new Set([
|
|
|
118
118
|
async function tryDirectAnswer(input) {
|
|
119
119
|
const { query, namespace, config, enabled, sources, queryEntityRefs, abortSignal } = input;
|
|
120
120
|
const eligibilityConfig = {
|
|
121
|
-
|
|
122
|
-
// flag so callers on the old input shape (config-only, no `enabled`) get
|
|
123
|
-
// identical gating (issue #1523 backward-compat).
|
|
124
|
-
enabled: enabled ?? config.recallDirectAnswerEnabled,
|
|
121
|
+
enabled,
|
|
125
122
|
tokenOverlapFloor: config.recallDirectAnswerTokenOverlapFloor,
|
|
126
123
|
importanceFloor: config.recallDirectAnswerImportanceFloor,
|
|
127
124
|
ambiguityMargin: config.recallDirectAnswerAmbiguityMargin,
|
|
@@ -180,4 +177,4 @@ export {
|
|
|
180
177
|
resolveCategory,
|
|
181
178
|
tryDirectAnswer
|
|
182
179
|
};
|
|
183
|
-
//# sourceMappingURL=chunk-
|
|
180
|
+
//# sourceMappingURL=chunk-Q6IP2ARR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/taxonomy/resolver.ts","../src/direct-answer-wiring.ts"],"sourcesContent":["/**\n * Resolver decision tree for the MECE taxonomy.\n *\n * Given extracted content and its MemoryCategory, determines which\n * taxonomy category the knowledge should be filed under.\n */\n\nimport type { MemoryCategory } from \"../types.js\";\nimport type { ResolverDecision, Taxonomy, TaxonomyCategory } from \"./types.js\";\n\nconst DEFAULT_CATEGORY_ID = \"facts\";\n\n/**\n * Resolve a piece of content to a taxonomy category.\n *\n * Algorithm:\n * 1. Find all taxonomy categories whose `memoryCategories` include\n * the given `memoryCategory`.\n * 2. If exactly one match, return it with confidence 1.0.\n * 3. If multiple matches, prefer the strongest exact-token keyword\n * overlap from filing rules. Use priority only as a tie-breaker.\n * If no filing rules match, choose the explicit/default fallback\n * category instead of letting low-priority generic terms win.\n * 4. If no match, fall back to the \"facts\" category (or first\n * category if \"facts\" is absent) with low confidence.\n * 5. Always populate `alternatives` with other plausible categories.\n */\nexport function resolveCategory(\n content: string,\n memoryCategory: MemoryCategory,\n taxonomy: Taxonomy,\n): ResolverDecision {\n const contentTokens = tokenizeKeywordText(content);\n\n // Step 1: find matching categories\n const matches = taxonomy.categories.filter((cat) =>\n cat.memoryCategories.includes(memoryCategory),\n );\n\n if (matches.length === 0) {\n // No taxonomy category accepts this MemoryCategory — fall back\n const fallback =\n taxonomy.categories.find((c) => c.id === DEFAULT_CATEGORY_ID) ??\n taxonomy.categories[0];\n if (!fallback) {\n return {\n categoryId: DEFAULT_CATEGORY_ID,\n confidence: 0,\n reason: \"Taxonomy is empty; using default category\",\n alternatives: [],\n };\n }\n const alternatives = taxonomy.categories\n .filter((c) => c.id !== fallback.id)\n .map((c) => ({\n categoryId: c.id,\n reason: c.description,\n }));\n return {\n categoryId: fallback.id,\n confidence: 0.3,\n reason: `No taxonomy category maps to MemoryCategory \"${memoryCategory}\"; falling back to \"${fallback.name}\"`,\n alternatives,\n };\n }\n\n if (matches.length === 1) {\n const match = matches[0]!;\n const alternatives = taxonomy.categories\n .filter((c) => c.id !== match.id)\n .map((c) => ({\n categoryId: c.id,\n reason: c.description,\n }));\n return {\n categoryId: match.id,\n confidence: 1.0,\n reason: `Unique match: MemoryCategory \"${memoryCategory}\" maps to \"${match.name}\"`,\n alternatives,\n };\n }\n\n // Multiple matches — use filing rule keyword heuristics + priority\n const scored = matches.map((cat) => ({\n cat,\n keywordScore: computeKeywordScoreForTokens(contentTokens, cat),\n }));\n\n // Sort by keyword score descending, then priority ascending (lower wins)\n scored.sort((a, b) => {\n if (b.keywordScore !== a.keywordScore) return b.keywordScore - a.keywordScore;\n return a.cat.priority - b.cat.priority;\n });\n\n const topScored = scored[0]!;\n const best = topScored.keywordScore > 0\n ? topScored\n : {\n cat: selectFallbackCategory(matches) ?? topScored.cat,\n keywordScore: 0,\n };\n const runnerUp = scored[1];\n\n // Confidence is higher when keyword match clearly differentiates\n const confidence =\n best.keywordScore > 0 && (!runnerUp || best.keywordScore > runnerUp.keywordScore)\n ? 0.9\n : 0.7;\n\n const alternatives = taxonomy.categories\n .filter((c) => c.id !== best.cat.id)\n .map((c) => ({\n categoryId: c.id,\n reason: c.description,\n }));\n\n const reason =\n best.keywordScore > 0\n ? `Filing rules for \"${best.cat.name}\" matched content keywords (priority ${best.cat.priority})`\n : `No filing rules matched content keywords; using fallback category \"${best.cat.name}\"`;\n\n return {\n categoryId: best.cat.id,\n confidence,\n reason,\n alternatives,\n };\n}\n\n/**\n * Compute a simple keyword overlap score between content and\n * a category's filing rules + description.\n */\nfunction computeKeywordScoreForTokens(contentTokens: Set<string>, cat: TaxonomyCategory): number {\n let score = 0;\n const ruleText = [...cat.filingRules, cat.description]\n .join(\" \")\n .toLowerCase();\n\n const keywords = tokenizeKeywordText(ruleText);\n\n for (const kw of keywords) {\n if (contentTokens.has(kw)) {\n score += 1;\n }\n }\n return score;\n}\n\nfunction tokenizeKeywordText(value: string): Set<string> {\n return new Set(\n value\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .map((word) => word.trim())\n .filter((word) => word.length >= 3 && !TAXONOMY_KEYWORD_STOPWORDS.has(word)),\n );\n}\n\nfunction selectFallbackCategory(\n categories: readonly TaxonomyCategory[],\n): TaxonomyCategory | undefined {\n return categories.find((cat) => cat.id === DEFAULT_CATEGORY_ID) ??\n categories.find((cat) => {\n const text = `${cat.id} ${cat.name} ${cat.description} ${cat.filingRules.join(\" \")}`.toLowerCase();\n return /\\b(general|fallback)\\b/.test(text);\n });\n}\n\nconst TAXONOMY_KEYWORD_STOPWORDS = new Set([\n \"about\",\n \"all\",\n \"and\",\n \"are\",\n \"for\",\n \"from\",\n \"has\",\n \"into\",\n \"not\",\n \"the\",\n \"this\",\n \"was\",\n \"with\",\n]);\n","/**\n * Direct-answer wiring (issue #518 slice 3).\n *\n * Binds the pure eligibility decision (`direct-answer.ts`) to the data\n * sources needed to build candidates: storage, trust-zones, taxonomy,\n * and importance scoring. Kept as a separate module so that:\n *\n * - The eligibility layer stays pure and unit-testable without stores.\n * - Each caller injects its own source accessors. The orchestrator\n * binding is a follow-on slice; tests here use mock sources.\n * - The wiring is safe to ship alone — nothing calls `tryDirectAnswer`\n * yet, so enabling this module's presence does not change recall\n * behavior. The next slice adds exactly one call site before QMD.\n *\n * Short-circuit contract:\n *\n * - When the resolved gate (`input.enabled`, projected from\n * `caps.recallDirectAnswer` at the recall-operation entry) is `false`, the\n * function returns the\n * eligibility verdict with reason `\"disabled\"` without touching any source\n * accessor. This is the documented default.\n * - When enabled, the wiring cheaply drops non-trusted-zone memories\n * and ineligible taxonomy buckets before computing importance, so\n * the eligibility module sees a pre-filtered candidate set. The\n * eligibility module still performs the same checks itself — this\n * module is purely an I/O and prefiltering layer.\n */\n\nimport type { MemoryFile, PluginConfig } from \"./types.js\";\nimport type { TrustZoneName } from \"./trust-zones.js\";\nimport type { Taxonomy } from \"./taxonomy/types.js\";\nimport { resolveCategory } from \"./taxonomy/resolver.js\";\nimport { normalizeRecallTokens } from \"./recall-tokenization.js\";\nimport { throwIfAborted } from \"./abort-error.js\";\nimport {\n isDirectAnswerEligible,\n type DirectAnswerCandidate,\n type DirectAnswerConfig,\n type DirectAnswerResult,\n} from \"./direct-answer.js\";\n\n/**\n * Caller-provided accessors for candidate sourcing. Decouples the\n * wiring from any specific storage / trust-zone / importance backend.\n */\nexport interface DirectAnswerSources {\n /**\n * List memories eligible to be considered for direct-answer.\n * Callers are expected to return only active, non-superseded memories\n * in the requested namespace; the wiring will cheaply re-filter on\n * trust zone and taxonomy bucket and hand the rest to the eligibility\n * module, which applies the full gate ladder.\n */\n listCandidateMemories(options: {\n namespace: string;\n abortSignal?: AbortSignal;\n }): Promise<MemoryFile[]>;\n /**\n * Resolve the trust-zone record for a memory. Returns `null` when\n * the memory has no trust-zone record (treated as not trusted).\n */\n trustZoneFor(memoryId: string): Promise<TrustZoneName | null>;\n /**\n * Resolve a calibrated importance score in [0, 1] for a memory.\n */\n importanceFor(memory: MemoryFile): number;\n /**\n * Taxonomy used to classify memories into direct-answer buckets.\n */\n taxonomy: Taxonomy;\n}\n\nexport interface DirectAnswerWiringInput {\n query: string;\n namespace: string;\n config: Pick<\n PluginConfig,\n | \"recallDirectAnswerTokenOverlapFloor\"\n | \"recallDirectAnswerImportanceFloor\"\n | \"recallDirectAnswerAmbiguityMargin\"\n | \"recallDirectAnswerEligibleTaxonomyBuckets\"\n >;\n /**\n * Direct-answer capability gate, resolved once at the recall-operation entry\n * via `resolveCapabilities(config).recallDirectAnswer` (issue #1523). This\n * is the sole gate — the function no longer reads the config flag directly.\n * Callers MUST pass the resolved capability so the whole operation agrees on\n * a single gate value.\n */\n enabled: boolean;\n sources: DirectAnswerSources;\n queryEntityRefs?: string[];\n abortSignal?: AbortSignal;\n}\n\n/**\n * Attempt direct-answer resolution. Returns the eligibility verdict\n * produced by `isDirectAnswerEligible` with candidates materialized\n * from the caller-supplied sources.\n */\nexport async function tryDirectAnswer(\n input: DirectAnswerWiringInput,\n): Promise<DirectAnswerResult> {\n const { query, namespace, config, enabled, sources, queryEntityRefs, abortSignal } = input;\n\n const eligibilityConfig: DirectAnswerConfig = {\n enabled,\n tokenOverlapFloor: config.recallDirectAnswerTokenOverlapFloor,\n importanceFloor: config.recallDirectAnswerImportanceFloor,\n ambiguityMargin: config.recallDirectAnswerAmbiguityMargin,\n eligibleTaxonomyBuckets: config.recallDirectAnswerEligibleTaxonomyBuckets,\n };\n\n // Short-circuit disabled case before touching any I/O.\n if (!eligibilityConfig.enabled) {\n return isDirectAnswerEligible({\n query,\n candidates: [],\n config: eligibilityConfig,\n queryEntityRefs,\n });\n }\n\n // Short-circuit empty-query case before any I/O. isDirectAnswerEligible\n // deterministically returns reason \"empty-query\" when the query\n // normalizes to zero searchable tokens; there's no point materializing\n // candidates just to reach the same verdict, and doing so would\n // surface avoidable upstream errors for requests that should exit\n // immediately.\n if (normalizeRecallTokens(query).length === 0) {\n return isDirectAnswerEligible({\n query,\n candidates: [],\n config: eligibilityConfig,\n queryEntityRefs,\n });\n }\n\n throwIfAborted(abortSignal, \"direct-answer wiring aborted\");\n const memories = await sources.listCandidateMemories({ namespace, abortSignal });\n throwIfAborted(abortSignal, \"direct-answer wiring aborted\");\n const candidates: DirectAnswerCandidate[] = [];\n\n for (const memory of memories) {\n // Throw rather than returning a partial verdict — a mid-loop abort\n // that left competing candidates unprocessed could otherwise surface\n // a spurious \"eligible\" result that the ambiguity gate never got a\n // chance to reject. The check repeats after every await so an\n // abort that lands during the in-flight I/O on the final memory\n // (after which no further iteration would exist) still stops us.\n throwIfAborted(abortSignal, \"direct-answer wiring aborted\");\n\n const trustZone = await sources.trustZoneFor(memory.frontmatter.id);\n throwIfAborted(abortSignal, \"direct-answer wiring aborted\");\n\n // Cheap pre-filter: non-trusted memories can't qualify, so skip\n // taxonomy and importance resolution for them.\n if (trustZone !== \"trusted\") continue;\n\n const decision = resolveCategory(\n memory.content,\n memory.frontmatter.category,\n sources.taxonomy,\n );\n const taxonomyBucket = decision.categoryId;\n if (!eligibilityConfig.eligibleTaxonomyBuckets.includes(taxonomyBucket)) continue;\n\n const importanceScore = sources.importanceFor(memory);\n\n candidates.push({\n memory,\n trustZone,\n taxonomyBucket,\n importanceScore,\n });\n }\n\n // Final check — if abort landed during the trust-zone await for the\n // last memory, the loop condition no longer fires. Guard before we\n // hand candidates to the eligibility gate.\n throwIfAborted(abortSignal, \"direct-answer wiring aborted\");\n\n return isDirectAnswerEligible({\n query,\n candidates,\n config: eligibilityConfig,\n queryEntityRefs,\n });\n}\n"],"mappings":"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","names":["alternatives"]}
|
|
@@ -168,7 +168,7 @@ import {
|
|
|
168
168
|
} from "./chunk-XHYGJVXL.js";
|
|
169
169
|
import {
|
|
170
170
|
tryDirectAnswer
|
|
171
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-Q6IP2ARR.js";
|
|
172
172
|
import {
|
|
173
173
|
EmbeddingFallback
|
|
174
174
|
} from "./chunk-ZA2S2VLL.js";
|
|
@@ -2081,7 +2081,7 @@ function resolveRecallModeDecision(options) {
|
|
|
2081
2081
|
}
|
|
2082
2082
|
async function resolveRecallModeDecisionAsync(options) {
|
|
2083
2083
|
const heuristicDecision = resolveRecallModeDecision(options);
|
|
2084
|
-
const plannerLlmEnabled = options.caps
|
|
2084
|
+
const plannerLlmEnabled = options.caps.recallPlannerLlm;
|
|
2085
2085
|
if (!options.plannerEnabled || !plannerLlmEnabled) {
|
|
2086
2086
|
return heuristicDecision;
|
|
2087
2087
|
}
|
|
@@ -2090,9 +2090,9 @@ async function resolveRecallModeDecisionAsync(options) {
|
|
|
2090
2090
|
options.prompt,
|
|
2091
2091
|
options.hints,
|
|
2092
2092
|
options.config,
|
|
2093
|
+
options.caps,
|
|
2093
2094
|
options.llm,
|
|
2094
|
-
options.signal
|
|
2095
|
-
options.caps
|
|
2095
|
+
options.signal
|
|
2096
2096
|
);
|
|
2097
2097
|
if (options.config.recallPlannerShadowMode) {
|
|
2098
2098
|
return {
|
|
@@ -2300,7 +2300,10 @@ function resolveRecentThreadMemoryPaths(options) {
|
|
|
2300
2300
|
if (options.threadEpisodeIds.length === 0 || maxRecent === 0) return [];
|
|
2301
2301
|
const pathById = options.pathById ?? buildMemoryPathById(options.allMemsForGraph, options.storageDir);
|
|
2302
2302
|
if (pathById.size === 0) return [];
|
|
2303
|
-
|
|
2303
|
+
const pendingReviewIds = new Set(
|
|
2304
|
+
(options.allMemsForGraph ?? []).filter((m) => m.frontmatter.status === "pending_review" && m.frontmatter.id).map((m) => m.frontmatter.id)
|
|
2305
|
+
);
|
|
2306
|
+
return options.threadEpisodeIds.filter((id) => id !== options.currentMemoryId).filter((id) => !pendingReviewIds.has(id)).slice(-maxRecent).map((id) => pathById.get(id)).filter((p) => typeof p === "string" && p.length > 0);
|
|
2304
2307
|
}
|
|
2305
2308
|
function buildMemoryPathById(allMemsForGraph, storageDir) {
|
|
2306
2309
|
const pathById = /* @__PURE__ */ new Map();
|
|
@@ -2393,6 +2396,11 @@ var Orchestrator = class _Orchestrator {
|
|
|
2393
2396
|
* callers already destructure `persistedIds` by position.
|
|
2394
2397
|
*/
|
|
2395
2398
|
lastPersistExtractionDeferredCount = 0;
|
|
2399
|
+
/**
|
|
2400
|
+
* Side-channel (#1635): pending_review persisted ids from the last
|
|
2401
|
+
* persistExtraction; runExtraction excludes them from the thread episode set.
|
|
2402
|
+
*/
|
|
2403
|
+
lastPersistExtractionPendingReviewIds = [];
|
|
2396
2404
|
_fastGatewayLlm;
|
|
2397
2405
|
get fastGatewayLlm() {
|
|
2398
2406
|
return this._fastGatewayLlm;
|
|
@@ -10917,17 +10925,10 @@ ${normalized}`).digest("hex");
|
|
|
10917
10925
|
);
|
|
10918
10926
|
}
|
|
10919
10927
|
if (this.config.threadingEnabled && threadIdForExtraction && persistedIds.length > 0) {
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
);
|
|
10925
|
-
} catch (err) {
|
|
10926
|
-
log.warn(
|
|
10927
|
-
"[threading] appendEpisodeIds failed after persistence (non-fatal)",
|
|
10928
|
-
err
|
|
10929
|
-
);
|
|
10930
|
-
}
|
|
10928
|
+
await this.appendPersistedThreadEpisodes(
|
|
10929
|
+
threadIdForExtraction,
|
|
10930
|
+
persistedIds
|
|
10931
|
+
);
|
|
10931
10932
|
}
|
|
10932
10933
|
if (this.config.threadingEnabled && threadIdForExtraction) {
|
|
10933
10934
|
const conversationContent = turns.map((t) => t.content).join(" ");
|
|
@@ -11193,13 +11194,17 @@ ${normalized}`).digest("hex");
|
|
|
11193
11194
|
};
|
|
11194
11195
|
return attachCitation(content, citationContext, citationTemplate);
|
|
11195
11196
|
};
|
|
11196
|
-
const supersessionOrderingAt = (validAt) => validAt && validAt.length > 0 ? validAt : (/* @__PURE__ */ new Date()).toISOString();
|
|
11197
11197
|
const persistedIds = [];
|
|
11198
|
+
const supersessionOrderingAt = (validAt) => validAt && validAt.length > 0 ? validAt : (/* @__PURE__ */ new Date()).toISOString();
|
|
11199
|
+
const pendingReviewPersistedIds = [];
|
|
11198
11200
|
const persistedIdsByStorage = /* @__PURE__ */ new Map();
|
|
11199
11201
|
const trackPersistedId = (targetStorage, id, options = {}) => {
|
|
11200
11202
|
if (options.includeReturnedIds !== false) {
|
|
11201
11203
|
persistedIds.push(id);
|
|
11202
11204
|
}
|
|
11205
|
+
if (options.pendingReview) {
|
|
11206
|
+
pendingReviewPersistedIds.push(id);
|
|
11207
|
+
}
|
|
11203
11208
|
const key = targetStorage.dir;
|
|
11204
11209
|
const existing = persistedIdsByStorage.get(key);
|
|
11205
11210
|
if (existing) {
|
|
@@ -12032,7 +12037,9 @@ ${normalized}`).digest("hex");
|
|
|
12032
12037
|
log.debug(
|
|
12033
12038
|
`chunked memory ${parentId} into ${chunkResult.chunks.length} chunks`
|
|
12034
12039
|
);
|
|
12035
|
-
trackPersistedId(targetStorage, parentId
|
|
12040
|
+
trackPersistedId(targetStorage, parentId, {
|
|
12041
|
+
pendingReview: faithfulnessEnforceStatus === "pending_review"
|
|
12042
|
+
});
|
|
12036
12043
|
if (faithfulnessEnforceStatus !== "pending_review" && threadEpisodeIdsForGraph && !threadEpisodeIdsForGraph.includes(parentId)) {
|
|
12037
12044
|
threadEpisodeIdsForGraph.push(parentId);
|
|
12038
12045
|
}
|
|
@@ -12230,7 +12237,9 @@ ${normalized}`).digest("hex");
|
|
|
12230
12237
|
source: "extraction"
|
|
12231
12238
|
})
|
|
12232
12239
|
);
|
|
12233
|
-
trackPersistedId(targetStorage, memoryId
|
|
12240
|
+
trackPersistedId(targetStorage, memoryId, {
|
|
12241
|
+
pendingReview: faithfulnessEnforceStatus === "pending_review"
|
|
12242
|
+
});
|
|
12234
12243
|
if (faithfulnessEnforceStatus !== "pending_review" && threadEpisodeIdsForGraph && !threadEpisodeIdsForGraph.includes(memoryId)) {
|
|
12235
12244
|
threadEpisodeIdsForGraph.push(memoryId);
|
|
12236
12245
|
}
|
|
@@ -12441,8 +12450,27 @@ ${normalized}`).digest("hex");
|
|
|
12441
12450
|
})().catch(
|
|
12442
12451
|
(err) => log.debug(`temporal-index update error (non-fatal): ${err}`)
|
|
12443
12452
|
);
|
|
12453
|
+
this.lastPersistExtractionPendingReviewIds = pendingReviewPersistedIds;
|
|
12444
12454
|
return persistedIds;
|
|
12445
12455
|
}
|
|
12456
|
+
/**
|
|
12457
|
+
* Append persisted ids to the thread episode set, excluding pending_review
|
|
12458
|
+
* fact ids (#1635) so they don't re-seed predecessor edges. Fail-open like
|
|
12459
|
+
* the raw appendEpisodeIds call it replaces.
|
|
12460
|
+
*/
|
|
12461
|
+
async appendPersistedThreadEpisodes(threadId, persistedIds) {
|
|
12462
|
+
const pendingReviewIds = this.lastPersistExtractionPendingReviewIds ?? [];
|
|
12463
|
+
const episodeIds = pendingReviewIds.length > 0 ? persistedIds.filter((id) => !pendingReviewIds.includes(id)) : persistedIds;
|
|
12464
|
+
if (episodeIds.length === 0) return;
|
|
12465
|
+
try {
|
|
12466
|
+
await this.threading.appendEpisodeIds(threadId, episodeIds);
|
|
12467
|
+
} catch (err) {
|
|
12468
|
+
log.warn(
|
|
12469
|
+
"[threading] appendEpisodeIds failed after persistence (non-fatal)",
|
|
12470
|
+
err
|
|
12471
|
+
);
|
|
12472
|
+
}
|
|
12473
|
+
}
|
|
12446
12474
|
async indexPersistedMemory(storage, memoryId) {
|
|
12447
12475
|
if (!this.config.embeddingFallbackEnabled) return;
|
|
12448
12476
|
if (!await this.embeddingFallback.isAvailable()) return;
|
|
@@ -15409,4 +15437,4 @@ export {
|
|
|
15409
15437
|
resolvePersistedMemoryRelativePath,
|
|
15410
15438
|
Orchestrator
|
|
15411
15439
|
};
|
|
15412
|
-
//# sourceMappingURL=chunk-
|
|
15440
|
+
//# sourceMappingURL=chunk-SQ4LU27I.js.map
|