@remnic/core 9.3.726 → 9.3.727
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 +20 -20
- package/dist/access-cli.js +42 -42
- package/dist/access-http.d.ts +20 -5
- package/dist/access-http.js +25 -25
- package/dist/access-mcp.d.ts +5 -5
- package/dist/access-mcp.js +24 -24
- package/dist/access-operations-batch.js +21 -21
- package/dist/access-operations.d.ts +5 -5
- package/dist/access-operations.js +23 -23
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-B2PlPtxh.d.ts → access-service-Bgpjxo4f.d.ts} +36 -4
- package/dist/access-service.d.ts +5 -5
- package/dist/access-service.js +19 -19
- 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 +3 -3
- 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 +1 -1
- package/dist/briefing.js +7 -7
- 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/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{catalog-CzUb-GyD.d.ts → catalog-bMczlO2G.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 +8 -8
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-Q6D75LVH.js → chunk-27QQC7ZX.js} +75 -14
- package/dist/{chunk-Q6D75LVH.js.map → chunk-27QQC7ZX.js.map} +1 -1
- package/dist/{chunk-53EEQYE5.js → chunk-2KAYTPPT.js} +7 -7
- package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-BIA7ELIB.js → chunk-36SEDFAU.js} +3 -3
- package/dist/{chunk-UQSVUEN2.js → chunk-37436GML.js} +2 -2
- package/dist/{chunk-RRHHQYJS.js → chunk-3TSTGI6F.js} +2 -2
- package/dist/{chunk-FO3HO52S.js → chunk-4H4F3BFL.js} +2 -2
- package/dist/{chunk-BEUCACTV.js → chunk-4NOI577P.js} +2 -2
- package/dist/{chunk-BBIE7W52.js → chunk-4NR2PDZ5.js} +2 -2
- package/dist/{chunk-TQQH2FTX.js → chunk-6PY5YJAV.js} +101 -15
- package/dist/{chunk-TQQH2FTX.js.map → chunk-6PY5YJAV.js.map} +1 -1
- package/dist/{chunk-PKMQK2WY.js → chunk-773DPI6T.js} +4 -4
- package/dist/{chunk-MQVKHFIU.js → chunk-7RLCCNHU.js} +8 -8
- package/dist/{chunk-XGTBNVIU.js → chunk-AAD2ZS6P.js} +11 -1
- package/dist/chunk-AAD2ZS6P.js.map +1 -0
- package/dist/{chunk-EZNDNMRH.js → chunk-AQLOP5F4.js} +2 -2
- package/dist/{chunk-UNNDFYUX.js → chunk-ARV3AUOM.js} +5 -5
- package/dist/{chunk-NPL7VDM6.js → chunk-ASKXIAHD.js} +2 -2
- package/dist/{chunk-K4ZNARDO.js → chunk-CBWI22JN.js} +2 -2
- package/dist/{chunk-ZOHMPFOB.js → chunk-CKFLLAIS.js} +3 -3
- package/dist/{chunk-DCKNMLEQ.js → chunk-CSRXQ6NB.js} +2 -2
- package/dist/{chunk-6AFVIOVZ.js → chunk-CTOQEZSN.js} +2 -2
- package/dist/{chunk-7NS7AWMZ.js → chunk-DKJCRGWM.js} +3 -3
- package/dist/{chunk-JPUT5NGH.js → chunk-DMQWV6SQ.js} +2 -2
- package/dist/{chunk-F3XZN24Z.js → chunk-DRUDC2UX.js} +2 -2
- package/dist/{chunk-KJR66XOM.js → chunk-EY6MDMHK.js} +2 -2
- package/dist/{chunk-3TUT4PWB.js → chunk-FVZ2ISIX.js} +2 -2
- package/dist/{chunk-C4X4QGIO.js → chunk-G6NKALRN.js} +5 -2
- package/dist/chunk-G6NKALRN.js.map +1 -0
- package/dist/{chunk-6SQQOJ4U.js → chunk-GKRLPHPU.js} +2 -2
- package/dist/{chunk-5NWYQUQC.js → chunk-HOHVIVDR.js} +2 -2
- package/dist/{chunk-6WAJQKBS.js → chunk-JYLFZWUX.js} +2 -2
- package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
- package/dist/{chunk-YTZ3VGC7.js → chunk-M4V2JVSZ.js} +2 -2
- package/dist/{chunk-PLG6JHQS.js → chunk-MJIHJ7OG.js} +38 -38
- package/dist/{chunk-TA3Y6GEX.js → chunk-MLKWJOAJ.js} +2 -2
- package/dist/{chunk-2NBP25BG.js → chunk-N3VNUM4Z.js} +171 -79
- package/dist/chunk-N3VNUM4Z.js.map +1 -0
- package/dist/{chunk-UKTDXTWX.js → chunk-NSA5ZRUL.js} +6 -6
- package/dist/{chunk-DQXPJ6HD.js → chunk-OEEW4KJA.js} +4 -4
- package/dist/{chunk-7AG54AF3.js → chunk-PUR2CKX2.js} +1 -1
- package/dist/chunk-PUR2CKX2.js.map +1 -0
- package/dist/{chunk-5OOA7SGX.js → chunk-R7IYU5DZ.js} +2 -2
- package/dist/{chunk-WGTWGDR5.js → chunk-SNKPUJHR.js} +5 -5
- package/dist/{chunk-BB57OZWC.js → chunk-UVPL565C.js} +2 -2
- package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-OAHOL3ZC.js → chunk-XPHVAOBT.js} +111 -30
- package/dist/chunk-XPHVAOBT.js.map +1 -0
- package/dist/{chunk-V7CMKMHM.js → chunk-Y4YD5TYW.js} +3 -3
- package/dist/{chunk-MDBZTH7N.js → chunk-YKBHOBJK.js} +44 -10
- package/dist/chunk-YKBHOBJK.js.map +1 -0
- package/dist/{chunk-3MS3QVX6.js → chunk-YOLZS7NY.js} +2 -2
- package/dist/{chunk-6OIDDKAA.js → chunk-YTU7WKYN.js} +35 -9
- package/dist/chunk-YTU7WKYN.js.map +1 -0
- package/dist/{cli-IOlDHSBT.d.ts → cli-BLME420h.d.ts} +3 -3
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +47 -47
- package/dist/compat/codex-cli-fallback.d.ts +1 -0
- package/dist/compat/codex-cli-fallback.js +22 -0
- package/dist/compat/codex-cli-fallback.js.map +1 -0
- package/dist/compat/codex-thread-key.d.ts +1 -0
- package/dist/compat/codex-thread-key.js +18 -0
- package/dist/compat/codex-thread-key.js.map +1 -0
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +7 -7
- 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 +3 -3
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +7 -7
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +7 -7
- 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 +7 -7
- 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-faithfulness.js +2 -2
- 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/extraction.js +2 -2
- package/dist/faithfulness-config.d.ts +1 -0
- package/dist/faithfulness-config.js +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.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 +61 -61
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +7 -7
- 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/local-model-endpoint.d.ts +9 -4
- package/dist/local-model-endpoint.js +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +7 -7
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
- package/dist/maintenance/rebuild-memory-projection.js +8 -8
- 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 +12 -12
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.d.ts +2 -2
- package/dist/namespaces/storage.js +7 -7
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +18 -18
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +9 -9
- package/dist/{orchestrator-C_OMSIMZ.d.ts → orchestrator-DqPAz8ot.d.ts} +3 -3
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +30 -30
- 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/provenance.js +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 +4 -4
- 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/factory.js +3 -3
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +7 -7
- 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-B8LiYtvx.d.ts → semantic-consolidation-Cl15ksZy.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +8 -8
- package/dist/semantic-rule-promotion.js +7 -7
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +7 -7
- 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 +6 -6
- 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/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/types.d.ts +12 -12
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-DmTaqob2.d.ts → types-ChQb9D6s.d.ts} +8 -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 +7 -7
- package/package.json +26 -2
- package/src/access-http.ts +68 -1
- package/src/admin/admin-surfaces.test.ts +289 -0
- package/src/admin/admin-surfaces.ts +138 -7
- package/src/bitemporal-dedup-backfill.test.ts +294 -0
- package/src/chat/chat-engine.test.ts +66 -1
- package/src/chat/chat-http.test.ts +119 -1
- package/src/chat/chat-http.ts +252 -97
- package/src/chat/chat-session.ts +143 -7
- package/src/compat/codex-cli-fallback.ts +23 -0
- package/src/compat/codex-subpath-aliases.test.ts +93 -0
- package/src/compat/codex-thread-key.ts +23 -0
- package/src/extraction-faithfulness.test.ts +240 -0
- package/src/extraction-faithfulness.ts +58 -6
- package/src/faithfulness-config.ts +16 -1
- package/src/local-model-endpoint.ts +24 -3
- package/src/orchestrator.ts +200 -8
- package/src/provenance-extraction.test.ts +266 -0
- package/src/provenance.ts +66 -16
- package/src/types.ts +8 -0
- package/dist/chunk-2NBP25BG.js.map +0 -1
- package/dist/chunk-6OIDDKAA.js.map +0 -1
- package/dist/chunk-7AG54AF3.js.map +0 -1
- package/dist/chunk-C4X4QGIO.js.map +0 -1
- package/dist/chunk-MDBZTH7N.js.map +0 -1
- package/dist/chunk-OAHOL3ZC.js.map +0 -1
- package/dist/chunk-XGTBNVIU.js.map +0 -1
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{chunk-53EEQYE5.js.map → chunk-2KAYTPPT.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-BIA7ELIB.js.map → chunk-36SEDFAU.js.map} +0 -0
- /package/dist/{chunk-UQSVUEN2.js.map → chunk-37436GML.js.map} +0 -0
- /package/dist/{chunk-RRHHQYJS.js.map → chunk-3TSTGI6F.js.map} +0 -0
- /package/dist/{chunk-FO3HO52S.js.map → chunk-4H4F3BFL.js.map} +0 -0
- /package/dist/{chunk-BEUCACTV.js.map → chunk-4NOI577P.js.map} +0 -0
- /package/dist/{chunk-BBIE7W52.js.map → chunk-4NR2PDZ5.js.map} +0 -0
- /package/dist/{chunk-PKMQK2WY.js.map → chunk-773DPI6T.js.map} +0 -0
- /package/dist/{chunk-MQVKHFIU.js.map → chunk-7RLCCNHU.js.map} +0 -0
- /package/dist/{chunk-EZNDNMRH.js.map → chunk-AQLOP5F4.js.map} +0 -0
- /package/dist/{chunk-UNNDFYUX.js.map → chunk-ARV3AUOM.js.map} +0 -0
- /package/dist/{chunk-NPL7VDM6.js.map → chunk-ASKXIAHD.js.map} +0 -0
- /package/dist/{chunk-K4ZNARDO.js.map → chunk-CBWI22JN.js.map} +0 -0
- /package/dist/{chunk-ZOHMPFOB.js.map → chunk-CKFLLAIS.js.map} +0 -0
- /package/dist/{chunk-DCKNMLEQ.js.map → chunk-CSRXQ6NB.js.map} +0 -0
- /package/dist/{chunk-6AFVIOVZ.js.map → chunk-CTOQEZSN.js.map} +0 -0
- /package/dist/{chunk-7NS7AWMZ.js.map → chunk-DKJCRGWM.js.map} +0 -0
- /package/dist/{chunk-JPUT5NGH.js.map → chunk-DMQWV6SQ.js.map} +0 -0
- /package/dist/{chunk-F3XZN24Z.js.map → chunk-DRUDC2UX.js.map} +0 -0
- /package/dist/{chunk-KJR66XOM.js.map → chunk-EY6MDMHK.js.map} +0 -0
- /package/dist/{chunk-3TUT4PWB.js.map → chunk-FVZ2ISIX.js.map} +0 -0
- /package/dist/{chunk-6SQQOJ4U.js.map → chunk-GKRLPHPU.js.map} +0 -0
- /package/dist/{chunk-5NWYQUQC.js.map → chunk-HOHVIVDR.js.map} +0 -0
- /package/dist/{chunk-6WAJQKBS.js.map → chunk-JYLFZWUX.js.map} +0 -0
- /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-YTZ3VGC7.js.map → chunk-M4V2JVSZ.js.map} +0 -0
- /package/dist/{chunk-PLG6JHQS.js.map → chunk-MJIHJ7OG.js.map} +0 -0
- /package/dist/{chunk-TA3Y6GEX.js.map → chunk-MLKWJOAJ.js.map} +0 -0
- /package/dist/{chunk-UKTDXTWX.js.map → chunk-NSA5ZRUL.js.map} +0 -0
- /package/dist/{chunk-DQXPJ6HD.js.map → chunk-OEEW4KJA.js.map} +0 -0
- /package/dist/{chunk-5OOA7SGX.js.map → chunk-R7IYU5DZ.js.map} +0 -0
- /package/dist/{chunk-WGTWGDR5.js.map → chunk-SNKPUJHR.js.map} +0 -0
- /package/dist/{chunk-BB57OZWC.js.map → chunk-UVPL565C.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-V7CMKMHM.js.map → chunk-Y4YD5TYW.js.map} +0 -0
- /package/dist/{chunk-3MS3QVX6.js.map → chunk-YOLZS7NY.js.map} +0 -0
|
@@ -7,35 +7,30 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
openclawReplayNormalizer
|
|
9
9
|
} from "./chunk-7F7Z6MOS.js";
|
|
10
|
+
import {
|
|
11
|
+
exportSqlite
|
|
12
|
+
} from "./chunk-7VFZTJ7K.js";
|
|
10
13
|
import {
|
|
11
14
|
importMarkdownBundle
|
|
12
15
|
} from "./chunk-HDDRVXX4.js";
|
|
13
16
|
import {
|
|
14
17
|
importSqlite
|
|
15
18
|
} from "./chunk-AGNBY3VG.js";
|
|
16
|
-
import {
|
|
17
|
-
backupMemoryDir
|
|
18
|
-
} from "./chunk-OWHERGF2.js";
|
|
19
|
-
import {
|
|
20
|
-
exportJsonBundle
|
|
21
|
-
} from "./chunk-UP6MOYCB.js";
|
|
22
|
-
import {
|
|
23
|
-
exportSqlite
|
|
24
|
-
} from "./chunk-7VFZTJ7K.js";
|
|
25
19
|
import {
|
|
26
20
|
detectImportFormat
|
|
27
21
|
} from "./chunk-OZKVVUJB.js";
|
|
28
22
|
import {
|
|
29
23
|
importJsonBundle
|
|
30
24
|
} from "./chunk-2DL3OFLD.js";
|
|
25
|
+
import {
|
|
26
|
+
backupMemoryDir
|
|
27
|
+
} from "./chunk-2NLLXCJG.js";
|
|
28
|
+
import {
|
|
29
|
+
exportJsonBundle
|
|
30
|
+
} from "./chunk-UP6MOYCB.js";
|
|
31
31
|
import {
|
|
32
32
|
exportMarkdownBundle
|
|
33
33
|
} from "./chunk-765K3SAT.js";
|
|
34
|
-
import {
|
|
35
|
-
buildReplayNormalizerRegistry,
|
|
36
|
-
clampBatchSize,
|
|
37
|
-
runReplay
|
|
38
|
-
} from "./chunk-HOJZMQ4J.js";
|
|
39
34
|
import {
|
|
40
35
|
TailscaleHelper
|
|
41
36
|
} from "./chunk-EEC4PCG5.js";
|
|
@@ -43,22 +38,27 @@ import {
|
|
|
43
38
|
WebDavServer
|
|
44
39
|
} from "./chunk-PYIFUBRK.js";
|
|
45
40
|
import {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} from "./chunk-6WAJQKBS.js";
|
|
41
|
+
buildReplayNormalizerRegistry,
|
|
42
|
+
clampBatchSize,
|
|
43
|
+
runReplay
|
|
44
|
+
} from "./chunk-HOJZMQ4J.js";
|
|
51
45
|
import {
|
|
52
46
|
rebuildMemoryProjection,
|
|
53
47
|
repairMemoryProjection,
|
|
54
48
|
verifyMemoryProjection
|
|
55
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-Y4YD5TYW.js";
|
|
56
50
|
import {
|
|
57
51
|
rebuildObservations
|
|
58
52
|
} from "./chunk-LZZNTPLR.js";
|
|
59
53
|
import {
|
|
60
54
|
archiveObservations
|
|
61
55
|
} from "./chunk-WMWVO45V.js";
|
|
56
|
+
import {
|
|
57
|
+
migrateObservations
|
|
58
|
+
} from "./chunk-D6RIFG4O.js";
|
|
59
|
+
import {
|
|
60
|
+
rebuildMemoryLifecycleLedger
|
|
61
|
+
} from "./chunk-JYLFZWUX.js";
|
|
62
62
|
import {
|
|
63
63
|
getBulkImportSource,
|
|
64
64
|
listBulkImportSources,
|
|
@@ -70,18 +70,18 @@ import {
|
|
|
70
70
|
} from "./chunk-GQL52GQ5.js";
|
|
71
71
|
import {
|
|
72
72
|
promoteSemanticRuleFromMemory
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-4H4F3BFL.js";
|
|
74
74
|
import {
|
|
75
75
|
buildResumeBundleFromState,
|
|
76
76
|
getResumeBundleStatus,
|
|
77
77
|
recordResumeBundle
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-HOHVIVDR.js";
|
|
79
79
|
import {
|
|
80
80
|
resolveAgentAccessAuthToken
|
|
81
81
|
} from "./chunk-TGQ2NTWH.js";
|
|
82
82
|
import {
|
|
83
83
|
parseXrayCliOptions
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-CKFLLAIS.js";
|
|
85
85
|
import {
|
|
86
86
|
collectPatternMemories,
|
|
87
87
|
explainPatternMemory,
|
|
@@ -98,12 +98,12 @@ import {
|
|
|
98
98
|
runOperatorInventory,
|
|
99
99
|
runOperatorRepair,
|
|
100
100
|
runOperatorSetup
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-NSA5ZRUL.js";
|
|
102
102
|
import {
|
|
103
103
|
listNamespaces,
|
|
104
104
|
runNamespaceMigration,
|
|
105
105
|
verifyNamespaces
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-DKJCRGWM.js";
|
|
107
107
|
import {
|
|
108
108
|
GraphDashboardServer
|
|
109
109
|
} from "./chunk-EZ25VE3G.js";
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
} from "./chunk-WIWPSQYU.js";
|
|
117
117
|
import {
|
|
118
118
|
searchVerifiedEpisodes
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-ASKXIAHD.js";
|
|
120
120
|
import {
|
|
121
121
|
getUtilityLearningStatus,
|
|
122
122
|
learnUtilityPromotionWeights
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
} from "./chunk-QRDOSYOR.js";
|
|
131
131
|
import {
|
|
132
132
|
searchVerifiedSemanticRules
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-UVPL565C.js";
|
|
134
134
|
import {
|
|
135
135
|
getWorkProductLedgerStatus,
|
|
136
136
|
recordWorkProductLedgerEntry,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
} from "./chunk-33JBK2XP.js";
|
|
146
146
|
import {
|
|
147
147
|
formatNamespaceMaintenanceHealthText
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-CBWI22JN.js";
|
|
149
149
|
import {
|
|
150
150
|
analyzeSessionIntegrity,
|
|
151
151
|
applySessionRepair,
|
|
@@ -209,13 +209,13 @@ import {
|
|
|
209
209
|
} from "./chunk-UQ7RN5HK.js";
|
|
210
210
|
import {
|
|
211
211
|
parseConfig
|
|
212
|
-
} from "./chunk-
|
|
212
|
+
} from "./chunk-36SEDFAU.js";
|
|
213
213
|
import {
|
|
214
214
|
getAbstractionNodeStoreStatus
|
|
215
215
|
} from "./chunk-OADWQ5CR.js";
|
|
216
216
|
import {
|
|
217
217
|
EngramAccessHttpServer
|
|
218
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-N3VNUM4Z.js";
|
|
219
219
|
import {
|
|
220
220
|
WearablesInputError
|
|
221
221
|
} from "./chunk-7WV3F5DQ.js";
|
|
@@ -228,10 +228,10 @@ import {
|
|
|
228
228
|
createProductionChatLlmAdapter,
|
|
229
229
|
loadChatSession,
|
|
230
230
|
sessionBelongsToPrincipal
|
|
231
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-6PY5YJAV.js";
|
|
232
232
|
import {
|
|
233
233
|
EngramAccessService
|
|
234
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-27QQC7ZX.js";
|
|
235
235
|
import {
|
|
236
236
|
WorkStorage
|
|
237
237
|
} from "./chunk-GDB4J2H3.js";
|
|
@@ -243,13 +243,13 @@ import {
|
|
|
243
243
|
parseRecallExplainFormat,
|
|
244
244
|
renderRecallExplain,
|
|
245
245
|
renderXray
|
|
246
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-GKRLPHPU.js";
|
|
247
247
|
import {
|
|
248
248
|
listMemoryGovernanceRuns,
|
|
249
249
|
readMemoryGovernanceRunArtifact,
|
|
250
250
|
restoreMemoryGovernanceRun,
|
|
251
251
|
runMemoryGovernance
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-4NOI577P.js";
|
|
253
253
|
import {
|
|
254
254
|
getTrustZoneStoreStatus,
|
|
255
255
|
promoteTrustZoneRecord,
|
|
@@ -274,7 +274,7 @@ import {
|
|
|
274
274
|
import {
|
|
275
275
|
RECALL_DISCLOSURE_LEVELS,
|
|
276
276
|
isRecallDisclosure
|
|
277
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-PUR2CKX2.js";
|
|
278
278
|
import {
|
|
279
279
|
RECALL_FALLBACK_DIRS
|
|
280
280
|
} from "./chunk-VS2IYZRU.js";
|
|
@@ -4133,7 +4133,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
4133
4133
|
}
|
|
4134
4134
|
}
|
|
4135
4135
|
if (sourceArchive.endsWith(".enc")) {
|
|
4136
|
-
const { isEncryptedCapsuleFile } = await import("./capsule-crypto-
|
|
4136
|
+
const { isEncryptedCapsuleFile } = await import("./capsule-crypto-7FJQINUR.js");
|
|
4137
4137
|
const encDetected = await isEncryptedCapsuleFile(sourceArchive).catch(() => true);
|
|
4138
4138
|
if (encDetected) {
|
|
4139
4139
|
throw new Error(
|
|
@@ -4296,7 +4296,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
4296
4296
|
const { parseExportBundle } = await import("./transfer/types.js");
|
|
4297
4297
|
let decryptedBuf;
|
|
4298
4298
|
try {
|
|
4299
|
-
const { decryptCapsuleFileInMemory } = await import("./capsule-crypto-
|
|
4299
|
+
const { decryptCapsuleFileInMemory } = await import("./capsule-crypto-7FJQINUR.js");
|
|
4300
4300
|
decryptedBuf = await decryptCapsuleFileInMemory(archivePath, memoryDir);
|
|
4301
4301
|
} catch (decErr) {
|
|
4302
4302
|
const msg = decErr instanceof Error ? decErr.message : String(decErr);
|
|
@@ -7505,4 +7505,4 @@ export {
|
|
|
7505
7505
|
listMemoryMarkdownFilePaths,
|
|
7506
7506
|
registerCli
|
|
7507
7507
|
};
|
|
7508
|
-
//# sourceMappingURL=chunk-
|
|
7508
|
+
//# sourceMappingURL=chunk-MJIHJ7OG.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
planNamespaceMaintenance,
|
|
12
12
|
runNamespaceMaintenanceBatchPlan
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M4V2JVSZ.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveHomeDir
|
|
16
16
|
} from "./chunk-JUC24CTX.js";
|
|
@@ -441,4 +441,4 @@ var MaintenanceScheduler = class {
|
|
|
441
441
|
export {
|
|
442
442
|
MaintenanceScheduler
|
|
443
443
|
};
|
|
444
|
-
//# sourceMappingURL=chunk-
|
|
444
|
+
//# sourceMappingURL=chunk-MLKWJOAJ.js.map
|
|
@@ -5,31 +5,25 @@ import {
|
|
|
5
5
|
WearablesInputError
|
|
6
6
|
} from "./chunk-7WV3F5DQ.js";
|
|
7
7
|
import {
|
|
8
|
-
ChatEngine,
|
|
9
8
|
EngramMcpServer,
|
|
10
|
-
|
|
11
|
-
createChatExecutor,
|
|
12
|
-
createChatSession,
|
|
13
|
-
createProductionChatLlmAdapter,
|
|
9
|
+
cleanupExpiredChatSessions,
|
|
14
10
|
loadChatSession,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
sessionBelongsToPrincipal
|
|
20
|
-
} from "./chunk-TQQH2FTX.js";
|
|
11
|
+
processChatMessage,
|
|
12
|
+
sessionBelongsToPrincipal,
|
|
13
|
+
subscribeChatTranscript
|
|
14
|
+
} from "./chunk-6PY5YJAV.js";
|
|
21
15
|
import {
|
|
22
16
|
validateRequest
|
|
23
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FVZ2ISIX.js";
|
|
24
18
|
import {
|
|
25
19
|
getOperation
|
|
26
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-R7IYU5DZ.js";
|
|
27
21
|
import {
|
|
28
22
|
EngramAccessInputError
|
|
29
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-27QQC7ZX.js";
|
|
30
24
|
import {
|
|
31
25
|
CorrectionContractError
|
|
32
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AQLOP5F4.js";
|
|
33
27
|
import {
|
|
34
28
|
isTrustZoneName
|
|
35
29
|
} from "./chunk-JGSKJHF7.js";
|
|
@@ -41,7 +35,7 @@ import {
|
|
|
41
35
|
} from "./chunk-DEUNUKTD.js";
|
|
42
36
|
import {
|
|
43
37
|
isRecallDisclosure
|
|
44
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-PUR2CKX2.js";
|
|
45
39
|
import {
|
|
46
40
|
OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
|
|
47
41
|
OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
|
|
@@ -65,6 +59,28 @@ import { fileURLToPath, URL } from "url";
|
|
|
65
59
|
import { gunzipSync } from "zlib";
|
|
66
60
|
|
|
67
61
|
// src/chat/chat-http.ts
|
|
62
|
+
import { createHash } from "crypto";
|
|
63
|
+
var chatInFlight = /* @__PURE__ */ new Map();
|
|
64
|
+
function principalFingerprintComponent(principal) {
|
|
65
|
+
return principal === void 0 ? "\0absent" : `${principal}`;
|
|
66
|
+
}
|
|
67
|
+
function chatDedupFingerprint(memoryDir, chatSessionId, principal, message) {
|
|
68
|
+
const messageHash = createHash("sha256").update(message, "utf8").digest("hex").slice(0, 32);
|
|
69
|
+
return `${memoryDir}:${chatSessionId}:${principalFingerprintComponent(principal)}:${messageHash}`;
|
|
70
|
+
}
|
|
71
|
+
function processChatMessageDedup(opts) {
|
|
72
|
+
if (!opts.chatSessionId) {
|
|
73
|
+
return processChatMessage(opts);
|
|
74
|
+
}
|
|
75
|
+
const fp = chatDedupFingerprint(opts.memoryDir, opts.chatSessionId, opts.principal, opts.message);
|
|
76
|
+
const existing = chatInFlight.get(fp);
|
|
77
|
+
if (existing) return existing;
|
|
78
|
+
const pending = processChatMessage(opts).finally(() => {
|
|
79
|
+
chatInFlight.delete(fp);
|
|
80
|
+
});
|
|
81
|
+
chatInFlight.set(fp, pending);
|
|
82
|
+
return pending;
|
|
83
|
+
}
|
|
68
84
|
async function handleChatMessage(req, res, body, opts, principal) {
|
|
69
85
|
if (!opts.config?.enabled) {
|
|
70
86
|
respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
|
|
@@ -75,63 +91,43 @@ async function handleChatMessage(req, res, body, opts, principal) {
|
|
|
75
91
|
respondJson(res, 400, { error: "message is required", code: "input_error" });
|
|
76
92
|
return;
|
|
77
93
|
}
|
|
78
|
-
|
|
79
|
-
if (!llm) {
|
|
94
|
+
if (!opts.service.fallbackLlmRef && !opts.service.localLlmRef) {
|
|
80
95
|
respondJson(res, 503, {
|
|
81
96
|
error: "No LLM model is available. Configure a local or cloud model.",
|
|
82
97
|
code: "no_llm"
|
|
83
98
|
});
|
|
84
99
|
return;
|
|
85
100
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
const chatSessionId = typeof body.chatSessionId === "string" ? body.chatSessionId : void 0;
|
|
102
|
+
let result;
|
|
103
|
+
try {
|
|
104
|
+
result = await processChatMessageDedup({
|
|
105
|
+
service: opts.service,
|
|
106
|
+
config: opts.config,
|
|
107
|
+
memoryDir: opts.memoryDir,
|
|
108
|
+
message,
|
|
109
|
+
...chatSessionId ? { chatSessionId } : {},
|
|
110
|
+
...principal ? { principal } : {}
|
|
111
|
+
});
|
|
112
|
+
} catch (err) {
|
|
113
|
+
const code = err instanceof Error ? err.message : String(err);
|
|
114
|
+
if (code === "chat_session_not_found") {
|
|
92
115
|
respondJson(res, 404, { error: "chat_session_not_found", code: "chat_session_not_found" });
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
if (!sessionBelongsToPrincipal(session, principal)) {
|
|
116
|
+
} else if (code === "access_denied") {
|
|
96
117
|
respondJson(res, 403, { error: "access_denied", code: "access_denied" });
|
|
97
|
-
|
|
118
|
+
} else if (code === "chat_session_expired") {
|
|
119
|
+
respondJson(res, 410, { error: "chat_session_expired", code: "chat_session_expired" });
|
|
120
|
+
} else if (code === "chat_disabled") {
|
|
121
|
+
respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
|
|
122
|
+
} else if (code === "no_llm_available" || code === "engine_unavailable") {
|
|
123
|
+
respondJson(res, 503, {
|
|
124
|
+
error: "No LLM model is available. Configure a local or cloud model.",
|
|
125
|
+
code: "no_llm"
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
respondJson(res, 500, { error: "internal_error", code: "internal_error" });
|
|
98
129
|
}
|
|
99
|
-
|
|
100
|
-
session = await createChatSession(opts.memoryDir, { principal });
|
|
101
|
-
}
|
|
102
|
-
const executor = createChatExecutor({
|
|
103
|
-
service: opts.service,
|
|
104
|
-
principal,
|
|
105
|
-
...session.namespace ? { namespace: session.namespace } : {},
|
|
106
|
-
...session.sessionKey ? { sessionKey: session.sessionKey } : {}
|
|
107
|
-
});
|
|
108
|
-
const engine = new ChatEngine({
|
|
109
|
-
llm: adapter,
|
|
110
|
-
executor,
|
|
111
|
-
maxToolCallsPerTurn: opts.config.maxToolCallsPerTurn,
|
|
112
|
-
...opts.config.model ? { model: opts.config.model } : {},
|
|
113
|
-
correctionAvailable: false,
|
|
114
|
-
scopeInspectAvailable: false
|
|
115
|
-
});
|
|
116
|
-
await appendTranscriptEntry(opts.memoryDir, session.id, {
|
|
117
|
-
role: "user",
|
|
118
|
-
content: message
|
|
119
|
-
});
|
|
120
|
-
const priorPendingPlanId = session.pendingPlanId;
|
|
121
|
-
const priorPendingPromotionId = session.pendingPromotionId;
|
|
122
|
-
const result = await engine.processMessage(message, session);
|
|
123
|
-
await appendTranscriptEntry(opts.memoryDir, session.id, {
|
|
124
|
-
role: "assistant",
|
|
125
|
-
content: result.reply
|
|
126
|
-
});
|
|
127
|
-
if (result.pendingPlan?.planId) {
|
|
128
|
-
await markPendingPlan(opts.memoryDir, session.id, result.pendingPlan.planId);
|
|
129
|
-
} else if (session.pendingPromotionId && !priorPendingPromotionId) {
|
|
130
|
-
await markPendingPromotion(opts.memoryDir, session.id, session.pendingPromotionId);
|
|
131
|
-
} else if (priorPendingPlanId && !session.pendingPlanId && !result.error) {
|
|
132
|
-
await markPlanResolved(opts.memoryDir, session.id, priorPendingPlanId);
|
|
133
|
-
} else if (priorPendingPromotionId && !session.pendingPromotionId && !result.error) {
|
|
134
|
-
await markPromotionResolved(opts.memoryDir, session.id, priorPendingPromotionId);
|
|
130
|
+
return;
|
|
135
131
|
}
|
|
136
132
|
const wireResult = result.error ? { reply: result.reply, chatSessionId: result.chatSessionId, ...result.pendingPlan ? { pendingPlan: result.pendingPlan } : {} } : result;
|
|
137
133
|
respondJson(res, 200, wireResult);
|
|
@@ -141,12 +137,55 @@ async function handleChatEventsSSE(req, res, chatSessionId, opts, principal) {
|
|
|
141
137
|
respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
|
|
142
138
|
return;
|
|
143
139
|
}
|
|
140
|
+
let heartbeat;
|
|
141
|
+
let closed = false;
|
|
142
|
+
const writeSse = (chunk) => {
|
|
143
|
+
if (closed) return false;
|
|
144
|
+
try {
|
|
145
|
+
res.write(chunk);
|
|
146
|
+
return true;
|
|
147
|
+
} catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const pending = [];
|
|
152
|
+
let bursting = true;
|
|
153
|
+
const unsubscribe = subscribeChatTranscript(opts.memoryDir, chatSessionId, (entry) => {
|
|
154
|
+
if (closed) return;
|
|
155
|
+
if (bursting) {
|
|
156
|
+
pending.push(entry);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
writeSse(`data: ${JSON.stringify(entry)}
|
|
160
|
+
|
|
161
|
+
`);
|
|
162
|
+
});
|
|
163
|
+
const doCleanup = () => {
|
|
164
|
+
closed = true;
|
|
165
|
+
clearInterval(heartbeat);
|
|
166
|
+
unsubscribe();
|
|
167
|
+
try {
|
|
168
|
+
res.end();
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const unregisterServerCleanup = opts.registerSseCleanup?.(doCleanup) ?? (() => {
|
|
173
|
+
});
|
|
174
|
+
req.on("close", () => {
|
|
175
|
+
doCleanup();
|
|
176
|
+
unregisterServerCleanup();
|
|
177
|
+
});
|
|
144
178
|
const session = await loadChatSession(opts.memoryDir, chatSessionId);
|
|
179
|
+
if (closed) return;
|
|
145
180
|
if (!session) {
|
|
181
|
+
unsubscribe();
|
|
182
|
+
unregisterServerCleanup();
|
|
146
183
|
respondJson(res, 404, { error: "chat_session_not_found", code: "chat_session_not_found" });
|
|
147
184
|
return;
|
|
148
185
|
}
|
|
149
186
|
if (!sessionBelongsToPrincipal(session, principal)) {
|
|
187
|
+
unsubscribe();
|
|
188
|
+
unregisterServerCleanup();
|
|
150
189
|
respondJson(res, 403, { error: "access_denied", code: "access_denied" });
|
|
151
190
|
return;
|
|
152
191
|
}
|
|
@@ -155,27 +194,29 @@ async function handleChatEventsSSE(req, res, chatSessionId, opts, principal) {
|
|
|
155
194
|
"cache-control": "no-cache",
|
|
156
195
|
connection: "keep-alive"
|
|
157
196
|
});
|
|
197
|
+
writeSse("retry: 5000\n\n");
|
|
198
|
+
const deliveredSeqs = /* @__PURE__ */ new Set();
|
|
158
199
|
for (const entry of session.transcript) {
|
|
159
|
-
|
|
200
|
+
writeSse(`data: ${JSON.stringify(entry)}
|
|
160
201
|
|
|
161
202
|
`);
|
|
203
|
+
deliveredSeqs.add(entry.seq);
|
|
162
204
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
205
|
+
bursting = false;
|
|
206
|
+
for (const entry of pending) {
|
|
207
|
+
if (!deliveredSeqs.has(entry.seq)) {
|
|
208
|
+
writeSse(`data: ${JSON.stringify(entry)}
|
|
166
209
|
|
|
167
210
|
`);
|
|
168
|
-
} catch {
|
|
169
211
|
}
|
|
212
|
+
}
|
|
213
|
+
if (closed) return;
|
|
214
|
+
heartbeat = setInterval(() => {
|
|
215
|
+
writeSse(`data: ${JSON.stringify({ type: "heartbeat" })}
|
|
216
|
+
|
|
217
|
+
`);
|
|
170
218
|
}, 25e3);
|
|
171
|
-
heartbeat.unref();
|
|
172
|
-
req.on("close", () => {
|
|
173
|
-
clearInterval(heartbeat);
|
|
174
|
-
try {
|
|
175
|
-
res.end();
|
|
176
|
-
} catch {
|
|
177
|
-
}
|
|
178
|
-
});
|
|
219
|
+
heartbeat.unref?.();
|
|
179
220
|
}
|
|
180
221
|
function respondJson(res, status, body) {
|
|
181
222
|
const json = JSON.stringify(body);
|
|
@@ -324,6 +365,12 @@ var EngramAccessHttpServer = class {
|
|
|
324
365
|
* (Cursor review thread `access-http.ts:232`).
|
|
325
366
|
*/
|
|
326
367
|
sseCleanupFns = /* @__PURE__ */ new Set();
|
|
368
|
+
/**
|
|
369
|
+
* Periodic chat-session TTL sweep handle (issue #1685 item 1 /
|
|
370
|
+
* #1687 Thread 21). unref'd so it never blocks process exit
|
|
371
|
+
* (rule 47); cleared in `stop()`.
|
|
372
|
+
*/
|
|
373
|
+
chatTtlTimer = null;
|
|
327
374
|
constructor(options) {
|
|
328
375
|
this.service = options.service;
|
|
329
376
|
this.host = options.host?.trim() || "127.0.0.1";
|
|
@@ -409,10 +456,15 @@ var EngramAccessHttpServer = class {
|
|
|
409
456
|
this.server = server;
|
|
410
457
|
const address = server.address();
|
|
411
458
|
this.boundPort = typeof address === "object" && address ? address.port : this.requestedPort;
|
|
459
|
+
this.scheduleChatSessionTtlSweep();
|
|
412
460
|
return this.status();
|
|
413
461
|
}
|
|
414
462
|
async stop() {
|
|
415
463
|
if (!this.server) return;
|
|
464
|
+
if (this.chatTtlTimer) {
|
|
465
|
+
clearInterval(this.chatTtlTimer);
|
|
466
|
+
this.chatTtlTimer = null;
|
|
467
|
+
}
|
|
416
468
|
const server = this.server;
|
|
417
469
|
this.server = null;
|
|
418
470
|
this.boundPort = 0;
|
|
@@ -439,6 +491,31 @@ var EngramAccessHttpServer = class {
|
|
|
439
491
|
server.close((err) => err ? reject(err) : resolve());
|
|
440
492
|
});
|
|
441
493
|
}
|
|
494
|
+
/**
|
|
495
|
+
* Schedule the chat-session TTL sweep: one immediate pass plus a
|
|
496
|
+
* recurring hourly pass (issue #1685 item 1 / #1687 Thread 21). Both
|
|
497
|
+
* are skipped when chat is disabled. The recurring timer is unref'd
|
|
498
|
+
* so it never keeps the event loop alive on its own (rule 47). The
|
|
499
|
+
* sweep itself is best-effort — cleanup failures are swallowed inside
|
|
500
|
+
* `cleanupExpiredChatSessions`.
|
|
501
|
+
*/
|
|
502
|
+
scheduleChatSessionTtlSweep() {
|
|
503
|
+
if (this.chatTtlTimer) {
|
|
504
|
+
clearInterval(this.chatTtlTimer);
|
|
505
|
+
this.chatTtlTimer = null;
|
|
506
|
+
}
|
|
507
|
+
const chat = this.service.configRef?.chat;
|
|
508
|
+
if (!chat?.enabled) return;
|
|
509
|
+
const ttlHours = typeof chat.sessionTtlHours === "number" && chat.sessionTtlHours > 0 ? chat.sessionTtlHours : 72;
|
|
510
|
+
void cleanupExpiredChatSessions(this.service.memoryDir, ttlHours).catch(() => {
|
|
511
|
+
});
|
|
512
|
+
const SWEEP_INTERVAL_MS = 60 * 60 * 1e3;
|
|
513
|
+
this.chatTtlTimer = setInterval(() => {
|
|
514
|
+
void cleanupExpiredChatSessions(this.service.memoryDir, ttlHours).catch(() => {
|
|
515
|
+
});
|
|
516
|
+
}, SWEEP_INTERVAL_MS);
|
|
517
|
+
this.chatTtlTimer.unref?.();
|
|
518
|
+
}
|
|
442
519
|
status() {
|
|
443
520
|
return {
|
|
444
521
|
running: this.server !== null,
|
|
@@ -1731,7 +1808,22 @@ var EngramAccessHttpServer = class {
|
|
|
1731
1808
|
req,
|
|
1732
1809
|
res,
|
|
1733
1810
|
chatEventsMatch[1] ?? "",
|
|
1734
|
-
{
|
|
1811
|
+
{
|
|
1812
|
+
service: this.service,
|
|
1813
|
+
config: this.service.configRef?.chat,
|
|
1814
|
+
memoryDir: this.service.memoryDir,
|
|
1815
|
+
// Register the chat-SSE disconnect cleanup with this server's
|
|
1816
|
+
// stop() set so an HTTP shutdown forcibly releases the heartbeat
|
|
1817
|
+
// and transcript subscription even when a lingering client never
|
|
1818
|
+
// emits 'close' (cursor Medium review; mirrors handleGraphEventsSSE
|
|
1819
|
+
// which registers in sseCleanupFns at access-http.ts:2604).
|
|
1820
|
+
registerSseCleanup: (cleanup) => {
|
|
1821
|
+
this.sseCleanupFns.add(cleanup);
|
|
1822
|
+
return () => {
|
|
1823
|
+
this.sseCleanupFns.delete(cleanup);
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
},
|
|
1735
1827
|
this.resolveRequestPrincipal(req)
|
|
1736
1828
|
);
|
|
1737
1829
|
return;
|
|
@@ -2537,4 +2629,4 @@ function positiveIntQueryParam(value, label) {
|
|
|
2537
2629
|
export {
|
|
2538
2630
|
EngramAccessHttpServer
|
|
2539
2631
|
};
|
|
2540
|
-
//# sourceMappingURL=chunk-
|
|
2632
|
+
//# sourceMappingURL=chunk-N3VNUM4Z.js.map
|