@remnic/core 9.3.717 → 9.3.718
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 +5 -5
- package/dist/access-boundary.js +9 -9
- package/dist/access-cli.js +23 -23
- package/dist/access-http.d.ts +5 -5
- package/dist/access-http.js +13 -13
- package/dist/access-mcp.d.ts +5 -5
- package/dist/access-mcp.js +12 -12
- package/dist/access-operations-batch.js +10 -10
- package/dist/access-operations.d.ts +5 -5
- package/dist/access-operations.js +11 -11
- package/dist/{access-service-d4Tk-Dlr.d.ts → access-service-CZbnt0t2.d.ts} +3 -3
- package/dist/access-service.d.ts +5 -5
- package/dist/access-service.js +8 -8
- package/dist/access-surface-catalog.d.ts +5 -5
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +4 -4
- package/dist/briefing.d.ts +3 -1
- package/dist/briefing.js +3 -3
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-CbR0CsUw.d.ts → catalog-CEYlMs9X.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +4 -4
- package/dist/{chunk-JEIROMLX.js → chunk-2COL35PK.js} +95 -9
- package/dist/chunk-2COL35PK.js.map +1 -0
- package/dist/{chunk-XZTUMWKQ.js → chunk-2PTBLS2S.js} +2 -2
- package/dist/{chunk-2Y6LMOQQ.js → chunk-2VHMVWPU.js} +2 -2
- package/dist/{chunk-6UU43ZGD.js → chunk-4KZGLDJJ.js} +2 -2
- package/dist/{chunk-K44MIN6D.js → chunk-5RHM43BJ.js} +3 -3
- package/dist/{chunk-2B43BYYZ.js → chunk-72VDBALG.js} +18 -18
- package/dist/{chunk-UY4JMEAK.js → chunk-7EEVXW7X.js} +2 -2
- package/dist/{chunk-XCTDHF7U.js → chunk-A5TUPZ3N.js} +33 -1
- package/dist/chunk-A5TUPZ3N.js.map +1 -0
- package/dist/{chunk-WI4QX7GH.js → chunk-A66YRSOS.js} +2 -2
- package/dist/{chunk-EM22PCQR.js → chunk-ANI5DUAE.js} +8 -6
- package/dist/{chunk-EM22PCQR.js.map → chunk-ANI5DUAE.js.map} +1 -1
- package/dist/{chunk-VZQXJNBD.js → chunk-APUJIMDM.js} +2 -2
- package/dist/{chunk-MPHDVHIB.js → chunk-DIFU33GU.js} +2 -2
- package/dist/{chunk-DXGS5YOQ.js → chunk-EH27LHML.js} +2 -2
- package/dist/{chunk-YAINYEM3.js → chunk-F3PVXKHP.js} +25 -1398
- package/dist/chunk-F3PVXKHP.js.map +1 -0
- package/dist/{chunk-DZYARLJ7.js → chunk-HLIR3RJ7.js} +2 -2
- package/dist/{chunk-6FUJ2VYY.js → chunk-JAKYZGV4.js} +3 -3
- package/dist/{chunk-ZAVTEQFM.js → chunk-JIZGYQYH.js} +3 -3
- package/dist/{chunk-QOIONSOI.js → chunk-KRGC4EDX.js} +2 -2
- package/dist/{chunk-AJOIM6UR.js → chunk-L5ASZA2F.js} +2 -2
- package/dist/{chunk-I56LKMF7.js → chunk-LXSG4L55.js} +2 -2
- package/dist/{chunk-MSVSP5VO.js → chunk-N3DUH6OO.js} +1 -1
- package/dist/chunk-N3DUH6OO.js.map +1 -0
- package/dist/{chunk-CTUWGJRI.js → chunk-NFRBADNR.js} +166 -28
- package/dist/chunk-NFRBADNR.js.map +1 -0
- package/dist/chunk-OJU73BUX.js +1688 -0
- package/dist/chunk-OJU73BUX.js.map +1 -0
- package/dist/{chunk-JVEMUX6L.js → chunk-OZ2KQ7HF.js} +2 -2
- package/dist/{chunk-OUDAU3T5.js → chunk-P5IPFZVH.js} +4 -4
- package/dist/{chunk-KHQ433G5.js → chunk-REWQAFSA.js} +2 -2
- package/dist/{chunk-V7GDTQ6I.js → chunk-S35FX6MU.js} +2 -2
- package/dist/{chunk-MTHNJCOJ.js → chunk-S3OPGGZB.js} +2 -2
- package/dist/{chunk-ZXLSNG3T.js → chunk-U5H7WHTS.js} +6 -4
- package/dist/{chunk-ZXLSNG3T.js.map → chunk-U5H7WHTS.js.map} +1 -1
- package/dist/{chunk-BZAK3RBN.js → chunk-UCJ5CDTK.js} +6 -6
- package/dist/{chunk-BF2426TN.js → chunk-URM3HW2R.js} +2 -2
- package/dist/{chunk-VO4UICII.js → chunk-YTZLBBEB.js} +2 -2
- package/dist/{chunk-OC56UWV5.js → chunk-YYOK4GVF.js} +2 -2
- package/dist/{cli-insNLYs6.d.ts → cli-1orcdXOY.d.ts} +3 -3
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +27 -27
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +3 -3
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +3 -3
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +1 -1
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +3 -3
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +4 -4
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +33 -33
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/mcp-memory-inspector-app.d.ts +5 -5
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +2 -2
- package/dist/namespaces/migrate.js +4 -4
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +2 -2
- package/dist/namespaces/storage.js +3 -3
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +9 -9
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +5 -5
- package/dist/{orchestrator-XPKhY2OV.d.ts → orchestrator-kOxredSr.d.ts} +20 -3
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +16 -16
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +2 -2
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/index.d.ts +1 -1
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-DSjMDZ1u.d.ts → semantic-consolidation-B58v3S-a.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/{types-D9dwzU_x.d.ts → types-ACmDOScJ.d.ts} +36 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +3 -3
- package/package.json +2 -2
- package/src/briefing.ts +32 -0
- package/src/config.ts +32 -0
- package/src/correction/index.ts +24 -0
- package/src/correction/passive-capture.test.ts +500 -0
- package/src/correction/passive-capture.ts +335 -0
- package/src/correction/passive-correction-detector.test.ts +263 -0
- package/src/correction/passive-correction-detector.ts +325 -0
- package/src/correction/passive-correction-notifications.ts +123 -0
- package/src/orchestrator.ts +196 -12
- package/src/types.ts +36 -0
- package/dist/chunk-2KF4HDG2.js +0 -24
- package/dist/chunk-2KF4HDG2.js.map +0 -1
- package/dist/chunk-CTUWGJRI.js.map +0 -1
- package/dist/chunk-JEIROMLX.js.map +0 -1
- package/dist/chunk-MSVSP5VO.js.map +0 -1
- package/dist/chunk-XCTDHF7U.js.map +0 -1
- package/dist/chunk-YAINYEM3.js.map +0 -1
- /package/dist/{chunk-XZTUMWKQ.js.map → chunk-2PTBLS2S.js.map} +0 -0
- /package/dist/{chunk-2Y6LMOQQ.js.map → chunk-2VHMVWPU.js.map} +0 -0
- /package/dist/{chunk-6UU43ZGD.js.map → chunk-4KZGLDJJ.js.map} +0 -0
- /package/dist/{chunk-K44MIN6D.js.map → chunk-5RHM43BJ.js.map} +0 -0
- /package/dist/{chunk-2B43BYYZ.js.map → chunk-72VDBALG.js.map} +0 -0
- /package/dist/{chunk-UY4JMEAK.js.map → chunk-7EEVXW7X.js.map} +0 -0
- /package/dist/{chunk-WI4QX7GH.js.map → chunk-A66YRSOS.js.map} +0 -0
- /package/dist/{chunk-VZQXJNBD.js.map → chunk-APUJIMDM.js.map} +0 -0
- /package/dist/{chunk-MPHDVHIB.js.map → chunk-DIFU33GU.js.map} +0 -0
- /package/dist/{chunk-DXGS5YOQ.js.map → chunk-EH27LHML.js.map} +0 -0
- /package/dist/{chunk-DZYARLJ7.js.map → chunk-HLIR3RJ7.js.map} +0 -0
- /package/dist/{chunk-6FUJ2VYY.js.map → chunk-JAKYZGV4.js.map} +0 -0
- /package/dist/{chunk-ZAVTEQFM.js.map → chunk-JIZGYQYH.js.map} +0 -0
- /package/dist/{chunk-QOIONSOI.js.map → chunk-KRGC4EDX.js.map} +0 -0
- /package/dist/{chunk-AJOIM6UR.js.map → chunk-L5ASZA2F.js.map} +0 -0
- /package/dist/{chunk-I56LKMF7.js.map → chunk-LXSG4L55.js.map} +0 -0
- /package/dist/{chunk-JVEMUX6L.js.map → chunk-OZ2KQ7HF.js.map} +0 -0
- /package/dist/{chunk-OUDAU3T5.js.map → chunk-P5IPFZVH.js.map} +0 -0
- /package/dist/{chunk-KHQ433G5.js.map → chunk-REWQAFSA.js.map} +0 -0
- /package/dist/{chunk-V7GDTQ6I.js.map → chunk-S35FX6MU.js.map} +0 -0
- /package/dist/{chunk-MTHNJCOJ.js.map → chunk-S3OPGGZB.js.map} +0 -0
- /package/dist/{chunk-BZAK3RBN.js.map → chunk-UCJ5CDTK.js.map} +0 -0
- /package/dist/{chunk-BF2426TN.js.map → chunk-URM3HW2R.js.map} +0 -0
- /package/dist/{chunk-VO4UICII.js.map → chunk-YTZLBBEB.js.map} +0 -0
- /package/dist/{chunk-OC56UWV5.js.map → chunk-YYOK4GVF.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-DGTDRIUO.js";
|
|
8
8
|
import {
|
|
9
9
|
MaintenanceScheduler
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-APUJIMDM.js";
|
|
11
11
|
import {
|
|
12
12
|
migrateFromEngram
|
|
13
13
|
} from "./chunk-7HYPN2GC.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
CompoundingEngine,
|
|
25
25
|
defaultTierMigrationCycleBudget
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-A66YRSOS.js";
|
|
27
27
|
import {
|
|
28
28
|
SharedContextManager
|
|
29
29
|
} from "./chunk-UFS7OXGL.js";
|
|
@@ -176,7 +176,7 @@ import {
|
|
|
176
176
|
buildEntityRecallSection,
|
|
177
177
|
entityRecentTranscriptLookbackHours,
|
|
178
178
|
readRecentEntityTranscriptEntries
|
|
179
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-EH27LHML.js";
|
|
180
180
|
import {
|
|
181
181
|
formatDaySummaryMemories
|
|
182
182
|
} from "./chunk-EO5QWINU.js";
|
|
@@ -189,14 +189,14 @@ import {
|
|
|
189
189
|
import {
|
|
190
190
|
compareVerifiedEpisodeResults,
|
|
191
191
|
searchVerifiedEpisodes
|
|
192
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-S35FX6MU.js";
|
|
193
193
|
import {
|
|
194
194
|
ThreadingManager
|
|
195
195
|
} from "./chunk-QRDOSYOR.js";
|
|
196
196
|
import {
|
|
197
197
|
compareVerifiedSemanticRuleResults,
|
|
198
198
|
searchVerifiedSemanticRules
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-OZ2KQ7HF.js";
|
|
200
200
|
import {
|
|
201
201
|
searchWorkProductLedgerEntries
|
|
202
202
|
} from "./chunk-ZRWB5D4H.js";
|
|
@@ -206,14 +206,14 @@ import {
|
|
|
206
206
|
import {
|
|
207
207
|
runNamespaceMaintenanceFanout,
|
|
208
208
|
summarizeNamespaceMaintenanceHealth
|
|
209
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-REWQAFSA.js";
|
|
210
210
|
import {
|
|
211
211
|
NamespaceCatalog,
|
|
212
212
|
planNamespaceMaintenance
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-HLIR3RJ7.js";
|
|
214
214
|
import {
|
|
215
215
|
NamespaceStorageRouter
|
|
216
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-DIFU33GU.js";
|
|
217
217
|
import {
|
|
218
218
|
PolicyRuntimeManager
|
|
219
219
|
} from "./chunk-33JBK2XP.js";
|
|
@@ -258,7 +258,7 @@ import {
|
|
|
258
258
|
materializeAfterSemanticConsolidation,
|
|
259
259
|
parseConsolidationResponse,
|
|
260
260
|
parseOperatorAwareConsolidationResponse
|
|
261
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-2VHMVWPU.js";
|
|
262
262
|
import {
|
|
263
263
|
buildRecallQueryPolicy
|
|
264
264
|
} from "./chunk-LBJBNWS2.js";
|
|
@@ -295,8 +295,11 @@ import {
|
|
|
295
295
|
describeErrorForOperator
|
|
296
296
|
} from "./chunk-7WV3F5DQ.js";
|
|
297
297
|
import {
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
capturePassiveCorrections,
|
|
299
|
+
clusterByKey,
|
|
300
|
+
createCorrectionService,
|
|
301
|
+
detectPassiveCorrections
|
|
302
|
+
} from "./chunk-OJU73BUX.js";
|
|
300
303
|
import {
|
|
301
304
|
listTrustZoneRecords,
|
|
302
305
|
searchTrustZoneRecords
|
|
@@ -306,7 +309,7 @@ import {
|
|
|
306
309
|
} from "./chunk-FF4KLI5W.js";
|
|
307
310
|
import {
|
|
308
311
|
buildXraySnapshot
|
|
309
|
-
} from "./chunk-
|
|
312
|
+
} from "./chunk-L5ASZA2F.js";
|
|
310
313
|
import {
|
|
311
314
|
combineNamespaces,
|
|
312
315
|
getConfiguredNamespaces,
|
|
@@ -361,7 +364,7 @@ import {
|
|
|
361
364
|
} from "./chunk-TBBDFYXW.js";
|
|
362
365
|
import {
|
|
363
366
|
buildChainFollowupGenerator
|
|
364
|
-
} from "./chunk-
|
|
367
|
+
} from "./chunk-2COL35PK.js";
|
|
365
368
|
import {
|
|
366
369
|
ContentHashIndex,
|
|
367
370
|
StorageManager,
|
|
@@ -369,7 +372,7 @@ import {
|
|
|
369
372
|
fingerprintEntityStructuredFacts,
|
|
370
373
|
normalizeAttributePairs,
|
|
371
374
|
parseEntityFile
|
|
372
|
-
} from "./chunk-
|
|
375
|
+
} from "./chunk-YYOK4GVF.js";
|
|
373
376
|
import {
|
|
374
377
|
buildRetiredFactTombstoneInputs
|
|
375
378
|
} from "./chunk-3JJWNZTT.js";
|
|
@@ -403,7 +406,7 @@ import {
|
|
|
403
406
|
} from "./chunk-SVOZFLIQ.js";
|
|
404
407
|
import {
|
|
405
408
|
confidenceTier
|
|
406
|
-
} from "./chunk-
|
|
409
|
+
} from "./chunk-N3DUH6OO.js";
|
|
407
410
|
import {
|
|
408
411
|
inferMemoryStatus,
|
|
409
412
|
isActiveMemoryStatus
|
|
@@ -446,6 +449,7 @@ import {
|
|
|
446
449
|
} from "./chunk-I4WBNM3M.js";
|
|
447
450
|
import {
|
|
448
451
|
canReadNamespace,
|
|
452
|
+
canWriteNamespace,
|
|
449
453
|
defaultNamespaceForPrincipal,
|
|
450
454
|
recallNamespacesForPrincipal,
|
|
451
455
|
resolvePrincipal
|
|
@@ -2495,6 +2499,10 @@ var Orchestrator = class _Orchestrator {
|
|
|
2495
2499
|
// Access tracking buffer (Phase 1A)
|
|
2496
2500
|
// Maps memoryId -> {count, lastAccessed} for batched updates
|
|
2497
2501
|
accessTrackingBuffer = /* @__PURE__ */ new Map();
|
|
2502
|
+
// Passive correction capture (issue #1581) — dedup state + lazy service.
|
|
2503
|
+
passiveCorrectionDedup = /* @__PURE__ */ new Set();
|
|
2504
|
+
_passiveCorrectionService = null;
|
|
2505
|
+
passiveCorrectionTelemetry = { detected: 0, queued: 0, autoApplied: 0, suppressedReasonCounts: {} };
|
|
2498
2506
|
// Background serial queue for extractions (agent_end optimization)
|
|
2499
2507
|
// Queue stores promises that resolve when extraction should run
|
|
2500
2508
|
extractionQueue = [];
|
|
@@ -10613,6 +10621,120 @@ ${normalized}`).digest("hex");
|
|
|
10613
10621
|
log.error(failed, err);
|
|
10614
10622
|
}
|
|
10615
10623
|
}
|
|
10624
|
+
/**
|
|
10625
|
+
* Passive correction capture (issue #1581) — detects corrections expressed
|
|
10626
|
+
* passively in conversation turns and routes them to the Correction Contract
|
|
10627
|
+
* (#1580). Called from `runExtraction` after persistence completes.
|
|
10628
|
+
*
|
|
10629
|
+
* Thin wiring: delegates ALL correction logic to the detector + capture
|
|
10630
|
+
* modules + the CorrectionService. This method only checks gates, calls the
|
|
10631
|
+
* detector, and routes results. Fail-open: capture errors never block the
|
|
10632
|
+
* extraction return path.
|
|
10633
|
+
*/
|
|
10634
|
+
async maybeCapturePassiveCorrections(turns, opts) {
|
|
10635
|
+
const mode = this.config.correctionCaptureMode;
|
|
10636
|
+
if (mode === "off") return;
|
|
10637
|
+
if (!this.config.correctionEnabled) return;
|
|
10638
|
+
try {
|
|
10639
|
+
const corrections = detectPassiveCorrections(
|
|
10640
|
+
turns.map((t) => ({ role: t.role, content: t.content }))
|
|
10641
|
+
);
|
|
10642
|
+
if (corrections.length === 0) return;
|
|
10643
|
+
const effectiveMode = opts.isLiveSession ? mode : "queue";
|
|
10644
|
+
const captureConfig = {
|
|
10645
|
+
mode: effectiveMode,
|
|
10646
|
+
confidenceFloor: this.config.correctionCaptureConfidenceFloor,
|
|
10647
|
+
autoApplyMaxAffected: this.config.correctionCaptureAutoApplyMaxAffected
|
|
10648
|
+
};
|
|
10649
|
+
const service = this.passiveCorrectionService();
|
|
10650
|
+
const result = await capturePassiveCorrections(
|
|
10651
|
+
corrections,
|
|
10652
|
+
{
|
|
10653
|
+
correctionEnabled: this.config.correctionEnabled,
|
|
10654
|
+
isLiveSession: opts.isLiveSession,
|
|
10655
|
+
bufferKey: opts.bufferKey,
|
|
10656
|
+
sessionKey: opts.sessionKey,
|
|
10657
|
+
principal: opts.principal,
|
|
10658
|
+
namespace: opts.namespace
|
|
10659
|
+
},
|
|
10660
|
+
captureConfig,
|
|
10661
|
+
{
|
|
10662
|
+
planCorrection: (req) => service.plan(req),
|
|
10663
|
+
applyCorrection: (planId, applyOpts) => service.apply(planId, applyOpts),
|
|
10664
|
+
storageDir: async (ns) => (await this.getStorage(ns)).dir,
|
|
10665
|
+
// Resolve `[m:xxxx]` handles to concrete memory ids via the single
|
|
10666
|
+
// shared helper (#1582). Returns null on miss/ambiguity so the
|
|
10667
|
+
// capture loop drops the handle and the planner falls back to text
|
|
10668
|
+
// search (review: "memory handles not resolved").
|
|
10669
|
+
resolveHandle: (ref, sessionKey) => {
|
|
10670
|
+
try {
|
|
10671
|
+
return this.resolveMemoryIdOrHandle(ref, sessionKey);
|
|
10672
|
+
} catch {
|
|
10673
|
+
return null;
|
|
10674
|
+
}
|
|
10675
|
+
}
|
|
10676
|
+
},
|
|
10677
|
+
this.passiveCorrectionDedup
|
|
10678
|
+
);
|
|
10679
|
+
this.passiveCorrectionTelemetry.detected += result.telemetry.detected;
|
|
10680
|
+
this.passiveCorrectionTelemetry.queued += result.telemetry.queued;
|
|
10681
|
+
this.passiveCorrectionTelemetry.autoApplied += result.telemetry.autoApplied;
|
|
10682
|
+
for (const [reason, count] of Object.entries(result.telemetry.suppressedReasons)) {
|
|
10683
|
+
this.passiveCorrectionTelemetry.suppressedReasonCounts[reason] = (this.passiveCorrectionTelemetry.suppressedReasonCounts[reason] ?? 0) + count;
|
|
10684
|
+
}
|
|
10685
|
+
} catch (err) {
|
|
10686
|
+
log.debug(
|
|
10687
|
+
`passive-correction: capture failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
|
|
10688
|
+
);
|
|
10689
|
+
}
|
|
10690
|
+
}
|
|
10691
|
+
/** Lazily construct the CorrectionService for passive capture. Stateless
|
|
10692
|
+
* across requests (per #1580 design); cached for the orchestrator's life. */
|
|
10693
|
+
passiveCorrectionService() {
|
|
10694
|
+
if (this._passiveCorrectionService) return this._passiveCorrectionService;
|
|
10695
|
+
this._passiveCorrectionService = createCorrectionService({
|
|
10696
|
+
orchestrator: this,
|
|
10697
|
+
// Session-scoped write ACL (review: "passive capture bypasses write
|
|
10698
|
+
// ACL"). A correction detected in session S plans only against S readable
|
|
10699
|
+
// namespaces and applies only to writable ones (rule 42) — passive
|
|
10700
|
+
// capture never becomes a cross-tenant mutation vector. Mirrors the
|
|
10701
|
+
// access-service createCorrectionService wiring rather than bypassing it.
|
|
10702
|
+
resolveAuthorizedNamespace: async (req) => {
|
|
10703
|
+
const principal = req.principal || resolvePrincipal(req.sessionKey, this.config);
|
|
10704
|
+
const ns = req.namespace ?? defaultNamespaceForPrincipal(principal, this.config);
|
|
10705
|
+
if (!canWriteNamespace(principal, ns, this.config)) {
|
|
10706
|
+
throw new Error(
|
|
10707
|
+
`passive correction: namespace "${ns}" is not writable for principal ${principal ?? "(none)"}`
|
|
10708
|
+
);
|
|
10709
|
+
}
|
|
10710
|
+
return ns;
|
|
10711
|
+
},
|
|
10712
|
+
resolveReadableNamespaces: (req) => {
|
|
10713
|
+
const principal = req.principal || resolvePrincipal(req.sessionKey, this.config);
|
|
10714
|
+
return recallNamespacesForPrincipal(principal, this.config);
|
|
10715
|
+
},
|
|
10716
|
+
canWriteNamespace: async (req) => {
|
|
10717
|
+
const principal = req.principal || resolvePrincipal(req.sessionKey, this.config);
|
|
10718
|
+
return canWriteNamespace(principal, req.namespace, this.config);
|
|
10719
|
+
},
|
|
10720
|
+
llmComplete: async ({ system, user }) => {
|
|
10721
|
+
const llmResult = await this.localLlm.chatCompletion(
|
|
10722
|
+
[
|
|
10723
|
+
{ role: "system", content: system },
|
|
10724
|
+
{ role: "user", content: user }
|
|
10725
|
+
],
|
|
10726
|
+
{ operation: "correction-classify", priority: "background" }
|
|
10727
|
+
);
|
|
10728
|
+
if (!llmResult) {
|
|
10729
|
+
throw new Error(
|
|
10730
|
+
"passive correction classify+draft: local LLM unavailable (disabled or in cooldown)"
|
|
10731
|
+
);
|
|
10732
|
+
}
|
|
10733
|
+
return llmResult.content;
|
|
10734
|
+
}
|
|
10735
|
+
});
|
|
10736
|
+
return this._passiveCorrectionService;
|
|
10737
|
+
}
|
|
10616
10738
|
async runExtraction(turns, options = {}) {
|
|
10617
10739
|
log.debug(`running extraction on ${turns.length} turns`);
|
|
10618
10740
|
const clearBufferAfterExtraction = options.clearBufferAfterExtraction ?? true;
|
|
@@ -10658,13 +10780,11 @@ ${normalized}`).digest("hex");
|
|
|
10658
10780
|
);
|
|
10659
10781
|
if (targetTurns.length === 0) {
|
|
10660
10782
|
log.debug("skipping extraction: no non-context turns after normalization");
|
|
10783
|
+
if (normalizedTurns.length > 0) {
|
|
10784
|
+
await this.maybeCapturePassiveCorrections(normalizedTurns, { sessionKey, principal: resolvePrincipal(sessionKey, this.config), namespace: this.resolveSelfNamespace(sessionKey), bufferKey, isLiveSession: clearBufferAfterExtraction });
|
|
10785
|
+
}
|
|
10661
10786
|
await clearBuffer();
|
|
10662
|
-
return {
|
|
10663
|
-
status: "skipped",
|
|
10664
|
-
reason: "empty_normalized_turns",
|
|
10665
|
-
persistedCount: 0,
|
|
10666
|
-
durableOutputCount: 0
|
|
10667
|
-
};
|
|
10787
|
+
return { status: "skipped", reason: "empty_normalized_turns", persistedCount: 0, durableOutputCount: 0 };
|
|
10668
10788
|
}
|
|
10669
10789
|
const sourceValidAt = latestSourceValidAtFromTurns(targetTurns);
|
|
10670
10790
|
throwIfDeadlineExceeded("before_extract");
|
|
@@ -10681,6 +10801,21 @@ ${normalized}`).digest("hex");
|
|
|
10681
10801
|
`skipping extraction: below threshold (totalChars=${totalChars}, userTurns=${userTurns.length})`
|
|
10682
10802
|
);
|
|
10683
10803
|
await clearBuffer();
|
|
10804
|
+
{
|
|
10805
|
+
const capturePrincipal = typeof options.principalOverride === "string" && options.principalOverride.length > 0 ? options.principalOverride : resolvePrincipal(sessionKey, this.config);
|
|
10806
|
+
const captureWO = typeof options.writeNamespaceOverride === "string" && options.writeNamespaceOverride.length > 0 ? options.writeNamespaceOverride : void 0;
|
|
10807
|
+
const captureCodingCtx = sessionKey ? this.getCodingContextForSession(sessionKey) : null;
|
|
10808
|
+
const captureCodingOv = resolveCodingNamespaceOverlay(captureCodingCtx, this.config.codingMode, this.config.defaultNamespace);
|
|
10809
|
+
const captureScopePlan = resolveScopeProfilePlan({ config: this.config, principal: capturePrincipal, codingContext: captureCodingCtx, codingOverlay: captureCodingOv });
|
|
10810
|
+
const captureNamespace = captureWO ?? captureScopePlan?.writeNamespace ?? this.resolveSelfNamespace(sessionKey);
|
|
10811
|
+
await this.maybeCapturePassiveCorrections(normalizedTurns, {
|
|
10812
|
+
sessionKey,
|
|
10813
|
+
principal: capturePrincipal,
|
|
10814
|
+
namespace: captureNamespace,
|
|
10815
|
+
bufferKey,
|
|
10816
|
+
isLiveSession: clearBufferAfterExtraction
|
|
10817
|
+
});
|
|
10818
|
+
}
|
|
10684
10819
|
return {
|
|
10685
10820
|
status: "skipped",
|
|
10686
10821
|
reason: "below_threshold",
|
|
@@ -10824,13 +10959,9 @@ ${normalized}`).digest("hex");
|
|
|
10824
10959
|
meta.lastExtractionAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
10825
10960
|
await storage.saveMeta(meta);
|
|
10826
10961
|
}
|
|
10962
|
+
await this.maybeCapturePassiveCorrections(normalizedTurns, { sessionKey, principal, namespace: selfNamespace, bufferKey, isLiveSession: clearBufferAfterExtraction });
|
|
10827
10963
|
await clearBuffer();
|
|
10828
|
-
return {
|
|
10829
|
-
status: "skipped",
|
|
10830
|
-
reason: "empty_extraction_result",
|
|
10831
|
-
persistedCount: 0,
|
|
10832
|
-
durableOutputCount: 0
|
|
10833
|
-
};
|
|
10964
|
+
return { status: "skipped", reason: "empty_extraction_result", persistedCount: 0, durableOutputCount: 0 };
|
|
10834
10965
|
}
|
|
10835
10966
|
let threadIdForExtraction = null;
|
|
10836
10967
|
if (this.config.threadingEnabled && turns.length > 0) {
|
|
@@ -10907,6 +11038,13 @@ ${normalized}`).digest("hex");
|
|
|
10907
11038
|
);
|
|
10908
11039
|
}
|
|
10909
11040
|
await clearBuffer({ ignoreAbort: true });
|
|
11041
|
+
await this.maybeCapturePassiveCorrections(normalizedTurns, {
|
|
11042
|
+
sessionKey,
|
|
11043
|
+
principal,
|
|
11044
|
+
namespace: selfNamespace,
|
|
11045
|
+
bufferKey,
|
|
11046
|
+
isLiveSession: clearBufferAfterExtraction
|
|
11047
|
+
});
|
|
10910
11048
|
if (this.config.memoryBoxesEnabled && persistedIds.length > 0) {
|
|
10911
11049
|
const extractionTopics = deriveTopicsFromExtraction(result);
|
|
10912
11050
|
const firstUserTurn = turns.find((t) => t.role === "user");
|
|
@@ -15414,4 +15552,4 @@ export {
|
|
|
15414
15552
|
resolvePersistedMemoryRelativePath,
|
|
15415
15553
|
Orchestrator
|
|
15416
15554
|
};
|
|
15417
|
-
//# sourceMappingURL=chunk-
|
|
15555
|
+
//# sourceMappingURL=chunk-NFRBADNR.js.map
|