@remnic/core 10.0.168 → 10.0.170
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-admin-ops-surface.js +181 -179
- package/dist/access-cli.js +181 -179
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.js +11 -11
- package/dist/access-extraction-force-flush-preempt.js +181 -179
- package/dist/access-extraction-force-flush.js +181 -179
- package/dist/access-http-briefing.js +181 -179
- package/dist/access-http-query.js +181 -179
- package/dist/access-http.js +181 -179
- package/dist/access-identity-continuity-surface.js +181 -179
- package/dist/access-lcm-surface.js +181 -179
- package/dist/access-mcp.js +181 -179
- package/dist/access-observe-write-category.js +11 -11
- package/dist/access-observe-write-surface.js +181 -179
- package/dist/access-offline-manifest.js +9 -9
- package/dist/access-operations-batch.js +181 -179
- package/dist/access-operations.js +181 -179
- package/dist/access-recall-concurrency.js +181 -179
- package/dist/access-recall-diagnostics.js +2 -2
- package/dist/access-recall-excerpt-attribution.d.ts +19 -0
- package/dist/access-recall-excerpt-attribution.d.ts.map +1 -0
- package/dist/access-recall-excerpt-attribution.js +8 -0
- package/dist/access-recall-response.js +181 -179
- package/dist/access-recall-surface.d.ts.map +1 -1
- package/dist/access-recall-surface.js +181 -179
- package/dist/access-schema.js +10 -10
- package/dist/access-service.js +181 -179
- package/dist/active-recall.js +30 -29
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +7 -7
- package/dist/adapters/registry.js +3 -3
- package/dist/{auto-sync-L3M4RKJD.js → auto-sync-ACP5U5A3.js} +3 -3
- package/dist/behavior-learner.js +1 -1
- package/dist/binary-lifecycle/scanner.d.ts +2 -4
- package/dist/binary-lifecycle/scanner.d.ts.map +1 -1
- package/dist/briefing.js +19 -19
- package/dist/buffer-add-turns-bounded.d.ts +11 -1
- package/dist/buffer-add-turns-bounded.d.ts.map +1 -1
- package/dist/buffer-add-turns-bounded.js +3 -3
- package/dist/buffer-session-cap.d.ts +2 -2
- package/dist/buffer-session-cap.d.ts.map +1 -1
- package/dist/buffer-session-cap.js +1 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +13 -13
- package/dist/calibration.d.ts +19 -2
- package/dist/calibration.d.ts.map +1 -1
- package/dist/calibration.js +28 -5
- package/dist/calibration.js.map +1 -1
- package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{capsule-merge-VHBRF65A.js → capsule-merge-BADOICNP.js} +2 -2
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +23 -23
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-CKELO7Q6.js → chunk-2OAFPBQB.js} +2 -2
- package/dist/{chunk-2DL3OFLD.js → chunk-45GEJRIG.js} +2 -2
- package/dist/{chunk-5IZL4DCV.js → chunk-4DF5LMBJ.js} +2 -2
- package/dist/{chunk-A5UOREWD.js → chunk-4DLGKTM6.js} +2 -2
- package/dist/{chunk-WEFFO2MJ.js → chunk-4E2Z44CV.js} +2 -2
- package/dist/{chunk-X67XNZ64.js → chunk-4LVQSHHN.js} +14 -14
- package/dist/{chunk-RB7NXZ2E.js → chunk-4X7HQKAG.js} +2 -2
- package/dist/{chunk-I74SUMNI.js → chunk-5ACIRCBO.js} +65 -3
- package/dist/chunk-5ACIRCBO.js.map +1 -0
- package/dist/{chunk-LPUEBFX2.js → chunk-5JCYPBY5.js} +2 -2
- package/dist/{chunk-IMULTENA.js → chunk-5SOSQTVE.js} +2 -2
- package/dist/{chunk-D6BOOYNJ.js → chunk-5YIOUS5T.js} +384 -345
- package/dist/chunk-5YIOUS5T.js.map +1 -0
- package/dist/{chunk-5PUZV73Z.js → chunk-6VFMEBXY.js} +12 -12
- package/dist/{chunk-333SBFXB.js → chunk-7AAMJQFW.js} +2 -2
- package/dist/{chunk-BKTCVXMK.js → chunk-7SNEJNA3.js} +96 -23
- package/dist/chunk-7SNEJNA3.js.map +1 -0
- package/dist/{chunk-PFLN6TTW.js → chunk-A2XFG462.js} +2 -2
- package/dist/{chunk-WEHSQBFR.js → chunk-AIF6V2OX.js} +9 -4
- package/dist/chunk-AIF6V2OX.js.map +1 -0
- package/dist/{chunk-HXFIILGF.js → chunk-BFPF5N3H.js} +4 -4
- package/dist/{chunk-QFTK6EDM.js → chunk-BFZFNXOC.js} +13 -13
- package/dist/{chunk-7OCKK5M5.js → chunk-BJOQQCYC.js} +9 -9
- package/dist/{chunk-ZX546Y3Y.js → chunk-CY2C5LM4.js} +3 -3
- package/dist/{chunk-73TPOGS4.js → chunk-DC55RIEZ.js} +9 -9
- package/dist/{chunk-ZDZJNXL6.js → chunk-DK2VBJ6Q.js} +4 -4
- package/dist/{chunk-CLVILSBR.js → chunk-DNXQVCIC.js} +22 -22
- package/dist/{chunk-7VIJUZYW.js → chunk-E53NLIAP.js} +3 -3
- package/dist/{chunk-2LA3H54D.js → chunk-E5IZTY4W.js} +2 -2
- package/dist/{chunk-J74YOBB3.js → chunk-EBI6FI5U.js} +12 -12
- package/dist/{chunk-YYXYZM2I.js → chunk-ETTV5F53.js} +2 -2
- package/dist/{chunk-FRYCXXTB.js → chunk-FSORYJRP.js} +3 -3
- package/dist/{chunk-TH6OYP6I.js → chunk-GOZXQNIM.js} +3 -3
- package/dist/{chunk-TNRGWJYT.js → chunk-GUF2JKG5.js} +2 -2
- package/dist/{chunk-AL3TCNSJ.js → chunk-H3MLOQ7F.js} +24 -53
- package/dist/chunk-H3MLOQ7F.js.map +1 -0
- package/dist/{chunk-SIONKXLU.js → chunk-H6TCS5XX.js} +18 -15
- package/dist/chunk-H6TCS5XX.js.map +1 -0
- package/dist/{chunk-FEUWI5QH.js → chunk-HHPY5SSE.js} +2 -2
- package/dist/{chunk-QPFM6DHY.js → chunk-HHVK2JRE.js} +2 -2
- package/dist/{chunk-YY57TRKN.js → chunk-HR3DKJCU.js} +2 -2
- package/dist/{chunk-FMFCQRDM.js → chunk-IJKO5RVJ.js} +3 -3
- package/dist/{chunk-UMEUU66X.js → chunk-IK7NPYYU.js} +2 -2
- package/dist/{chunk-ILNPU5W5.js → chunk-IMA4DJ7K.js} +5 -45
- package/dist/chunk-IMA4DJ7K.js.map +1 -0
- package/dist/chunk-IUGOGDCP.js +39 -0
- package/dist/chunk-IUGOGDCP.js.map +1 -0
- package/dist/{chunk-CKZWLAHN.js → chunk-JDH2BA2P.js} +2 -2
- package/dist/{chunk-QVXEXGIM.js → chunk-JNBSTHVT.js} +2 -2
- package/dist/chunk-JVVWCZ2P.js +18 -0
- package/dist/chunk-JVVWCZ2P.js.map +1 -0
- package/dist/{chunk-OBPOIZNR.js → chunk-KBHUGMUW.js} +2 -2
- package/dist/{chunk-OZKVVUJB.js → chunk-KIM5VNZN.js} +2 -2
- package/dist/{chunk-ZWDDY4WF.js → chunk-KW4XA7GM.js} +3 -3
- package/dist/{chunk-OAQRZ4SV.js → chunk-L5EE2CXU.js} +2 -2
- package/dist/{chunk-QNUNAXBE.js → chunk-L7LZDISF.js} +1 -9
- package/dist/{chunk-QNUNAXBE.js.map → chunk-L7LZDISF.js.map} +1 -1
- package/dist/{chunk-RO5EGRAI.js → chunk-LAOJHOTG.js} +2 -2
- package/dist/{chunk-FOTFLHBN.js → chunk-LH57QATU.js} +3 -2
- package/dist/chunk-LH57QATU.js.map +1 -0
- package/dist/{chunk-BFPQJNFZ.js → chunk-LXSDEPEK.js} +60 -11
- package/dist/{chunk-BFPQJNFZ.js.map → chunk-LXSDEPEK.js.map} +1 -1
- package/dist/{chunk-3PNJZTDV.js → chunk-NDPS6OU2.js} +2 -2
- package/dist/{chunk-N7AIFTSH.js → chunk-NJG63FY2.js} +1 -1
- package/dist/{chunk-N7AIFTSH.js.map → chunk-NJG63FY2.js.map} +1 -1
- package/dist/{chunk-BUKK5SWA.js → chunk-NKAGGDSL.js} +3 -3
- package/dist/{chunk-BUKK5SWA.js.map → chunk-NKAGGDSL.js.map} +1 -1
- package/dist/{chunk-U3BCW7GX.js → chunk-OGQL7QC7.js} +3 -3
- package/dist/{chunk-K3FH3LAQ.js → chunk-OJXK5C6Z.js} +4 -4
- package/dist/{chunk-HDLNSDLK.js → chunk-P3XO7HE3.js} +2 -2
- package/dist/{chunk-RFLC6PKQ.js → chunk-PQIFYBUX.js} +2 -2
- package/dist/{chunk-WLT6LTQP.js → chunk-PRRWKTK6.js} +2 -2
- package/dist/{chunk-LWZNSQN3.js → chunk-PUQQPLVV.js} +3 -3
- package/dist/{chunk-LWZNSQN3.js.map → chunk-PUQQPLVV.js.map} +1 -1
- package/dist/{chunk-4L25GAYL.js → chunk-Q7OKGBZY.js} +2 -2
- package/dist/{chunk-ZQUOUPP3.js → chunk-QJBULLKG.js} +4 -4
- package/dist/{chunk-W7N7NWG5.js → chunk-QKAFFVSO.js} +2 -2
- package/dist/{chunk-EZG54YDS.js → chunk-QKBFVLDH.js} +2 -2
- package/dist/{chunk-MOUSHJAR.js → chunk-QMFHKWHN.js} +5 -5
- package/dist/{chunk-QLQUAVVP.js → chunk-QRCE77YX.js} +16 -16
- package/dist/chunk-QRCE77YX.js.map +1 -0
- package/dist/{chunk-4D2EY4WM.js → chunk-R2AJAAHJ.js} +6 -6
- package/dist/{chunk-5BE3FLKL.js → chunk-R3UQIS3F.js} +8 -8
- package/dist/{chunk-B3M56D2A.js → chunk-RDHEBINJ.js} +2 -2
- package/dist/{chunk-L7SEYUHS.js → chunk-RHQL2RIM.js} +3 -3
- package/dist/{chunk-2MWKUVHT.js → chunk-RK7SE3BL.js} +5 -5
- package/dist/{chunk-CUPILBIP.js → chunk-SA2YALFU.js} +2 -2
- package/dist/{chunk-VRHY7Y5A.js → chunk-SAPC7N43.js} +3 -3
- package/dist/{chunk-6QWFZ3X5.js → chunk-SOQOUZ2Y.js} +2 -2
- package/dist/{chunk-VHXRLD6S.js → chunk-T2JZF45K.js} +2 -2
- package/dist/{chunk-HLWXCDUQ.js → chunk-T4MKFTJF.js} +5 -5
- package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
- package/dist/{chunk-YZYAYUJQ.js → chunk-TLRIRISJ.js} +4 -4
- package/dist/{chunk-LVGTH6IQ.js → chunk-UFX24WNJ.js} +14 -14
- package/dist/{chunk-OM5ESBES.js → chunk-UH3FPX3L.js} +2 -2
- package/dist/{chunk-4NBUHYUV.js → chunk-V5W67PQV.js} +3 -3
- package/dist/{chunk-TAD6QMMD.js → chunk-VAQIBC2L.js} +2 -2
- package/dist/{chunk-3Q3XD3NO.js → chunk-W2E2WFXL.js} +3 -3
- package/dist/{chunk-UYIBNDQE.js → chunk-W2UV6VE3.js} +2 -2
- package/dist/{chunk-AVWOULJH.js → chunk-W35ICLYZ.js} +2 -2
- package/dist/{chunk-HDDRVXX4.js → chunk-W5LJ3SJ7.js} +2 -2
- package/dist/{chunk-FGT7CUYZ.js → chunk-WF2LYKOB.js} +2 -2
- package/dist/{chunk-JIF22AXI.js → chunk-WGKIXNLY.js} +5 -2
- package/dist/{chunk-JIF22AXI.js.map → chunk-WGKIXNLY.js.map} +1 -1
- package/dist/{chunk-FFWFFAP3.js → chunk-WI2WTIMY.js} +14 -8
- package/dist/chunk-WI2WTIMY.js.map +1 -0
- package/dist/{chunk-OWM2VWNX.js → chunk-X5MFCZDL.js} +82 -44
- package/dist/chunk-X5MFCZDL.js.map +1 -0
- package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-22V3CMIW.js → chunk-XJTRIHTH.js} +8 -8
- package/dist/{chunk-3SL52JKD.js → chunk-XVZA6VXC.js} +4 -4
- package/dist/{chunk-WWQMZBDI.js → chunk-XYNUEXLC.js} +7 -7
- package/dist/{chunk-HDWISXFH.js → chunk-Y65XX5PC.js} +2 -2
- package/dist/{chunk-3YOX2BQD.js → chunk-YE77U5HZ.js} +3 -3
- package/dist/{chunk-U2PSE7MB.js → chunk-YLTU2DC4.js} +2 -2
- package/dist/{chunk-BPCR5DZP.js → chunk-YRD525ZO.js} +6 -6
- package/dist/chunk-YRD525ZO.js.map +1 -0
- package/dist/{chunk-SBRUTD5O.js → chunk-YSATDEBY.js} +5 -5
- package/dist/{chunk-TBBDFYXW.js → chunk-YVUNHNB6.js} +2 -3
- package/dist/chunk-YVUNHNB6.js.map +1 -0
- package/dist/{chunk-GBSXTTLP.js → chunk-YY5UXARJ.js} +24 -12
- package/dist/chunk-YY5UXARJ.js.map +1 -0
- package/dist/{chunk-L272A5QW.js → chunk-YYDUBGUF.js} +30 -22
- package/dist/chunk-YYDUBGUF.js.map +1 -0
- package/dist/{chunk-5QDTZIGH.js → chunk-ZJ3CEAJD.js} +2 -2
- package/dist/{chunk-GMO3BGOF.js → chunk-ZOJUWVAU.js} +1 -1
- package/dist/{chunk-T4BT4FQN.js → chunk-ZYP4YEEI.js} +3 -3
- package/dist/cli.js +181 -179
- package/dist/coding/export-okf-codegraph.js +30 -30
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +20 -20
- package/dist/config-deprecations.d.ts +3 -0
- package/dist/config-deprecations.d.ts.map +1 -0
- package/dist/config-deprecations.js +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -29
- package/dist/connectors/codex-marketplace.d.ts.map +1 -1
- package/dist/connectors/codex-materialize-runner.js +20 -20
- package/dist/connectors/codex-materialize.d.ts.map +1 -1
- package/dist/connectors/codex-materialize.js +1 -1
- package/dist/connectors/index.js +21 -21
- package/dist/consolidation-provenance-check.js +2 -2
- package/dist/convergence-refresh.js +22 -22
- package/dist/conversation-index/backend.js +2 -2
- package/dist/corpus-watermark.js +21 -21
- package/dist/deep-recall-http-glue.js +11 -11
- package/dist/deep-recall.js +2 -2
- package/dist/embedding-fallback.js +2 -2
- package/dist/entity-retrieval.js +21 -21
- package/dist/event-order-recall.js +3 -3
- package/dist/explicit-capture.js +181 -179
- package/dist/extraction-judge.js +1 -1
- package/dist/extraction-normalization.js +1 -1
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +35 -35
- package/dist/{first-start-migration-BPVJ4HJQ.js → first-start-migration-PPPP54X6.js} +5 -5
- package/dist/{graph-edge-decay-BC3IO2J4.js → graph-edge-decay-EKWXRBWF.js} +6 -6
- package/dist/graph-edge-decay-EKWXRBWF.js.map +1 -0
- package/dist/graph-jsonl.js +4 -4
- package/dist/graph-snapshot.js +4 -4
- package/dist/graph.js +5 -5
- package/dist/harmonic-retrieval.js +19 -19
- package/dist/index.js +272 -269
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +7 -7
- package/dist/lifecycle.d.ts +0 -6
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +1 -1
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +31 -21
- package/dist/location/provider-setup.d.ts +26 -1
- package/dist/location/provider-setup.d.ts.map +1 -1
- package/dist/maintenance/memory-governance.js +20 -20
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +19 -19
- package/dist/maintenance/rebuild-memory-projection-runner.js +22 -22
- package/dist/maintenance/rebuild-memory-projection.js +21 -21
- package/dist/memory-browse.js +6 -6
- package/dist/memory-controller.d.ts.map +1 -1
- package/dist/memory-controller.js +1 -1
- package/dist/{migrate-from-identity-anchor-MJYB6NNN.js → migrate-from-identity-anchor-TZSZXJ6L.js} +2 -2
- package/dist/migrate-from-identity-anchor-TZSZXJ6L.js.map +1 -0
- package/dist/model-registry.d.ts +0 -5
- package/dist/model-registry.d.ts.map +1 -1
- package/dist/model-registry.js +1 -1
- package/dist/namespaces/migrate.js +20 -20
- package/dist/namespaces/search.js +9 -9
- package/dist/namespaces/storage.d.ts.map +1 -1
- package/dist/namespaces/storage.js +19 -19
- package/dist/offline-sync-changeset-generations.js +4 -4
- package/dist/offline-sync-embedding-generation.js +3 -3
- package/dist/offline-sync-snapshot-stream.js +7 -7
- package/dist/offline-sync.js +6 -6
- package/dist/operator-doctor-corpus.js +22 -22
- package/dist/operator-toolkit.js +42 -41
- package/dist/orchestration/backlog-scheduler.d.ts +4 -0
- package/dist/orchestration/backlog-scheduler.d.ts.map +1 -1
- package/dist/orchestration/backlog-scheduler.js +192 -184
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +182 -180
- package/dist/orchestration/extraction-persist-citation.d.ts +2 -2
- package/dist/orchestration/extraction-persist-citation.d.ts.map +1 -1
- package/dist/orchestration/extraction-persist.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +30 -30
- package/dist/orchestration/recall-internal.d.ts.map +1 -1
- package/dist/orchestration/semantic-consolidation-coordinator.d.ts.map +1 -1
- package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
- package/dist/orchestration/workspace-ops.d.ts.map +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +183 -181
- package/dist/peers/index.d.ts +2 -1
- package/dist/peers/index.d.ts.map +1 -1
- package/dist/peers/index.js +3 -3
- package/dist/peers/interaction-log-append.d.ts +8 -0
- package/dist/peers/interaction-log-append.d.ts.map +1 -0
- package/dist/peers/storage.d.ts +22 -8
- package/dist/peers/storage.d.ts.map +1 -1
- package/dist/policy-runtime.js +2 -2
- package/dist/qmd.js +4 -4
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation.js +181 -179
- package/dist/recall-state-view-admission.js +6 -6
- package/dist/recall-state-view-packet.d.ts.map +1 -1
- package/dist/recall-state-view-packet.js +30 -8
- package/dist/recall-state-view-packet.js.map +1 -1
- package/dist/recall-why-service.js +6 -6
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/manifest.js +2 -2
- package/dist/resume-bundles.js +31 -30
- package/dist/retrieval.js +2 -2
- package/dist/search/factory.js +8 -8
- package/dist/search/index.js +14 -14
- package/dist/semantic-consolidation.d.ts +10 -16
- package/dist/semantic-consolidation.d.ts.map +1 -1
- package/dist/semantic-consolidation.js +24 -24
- package/dist/semantic-rule-promotion.js +19 -19
- package/dist/semantic-rule-verifier.js +19 -19
- package/dist/source-agent-qualifier.js +25 -25
- package/dist/source-attribution.d.ts +3 -3
- package/dist/source-attribution.d.ts.map +1 -1
- package/dist/source-attribution.js +1 -1
- package/dist/standup/build.js +19 -19
- package/dist/storage/links-frontmatter.d.ts +3 -0
- package/dist/storage/links-frontmatter.d.ts.map +1 -0
- package/dist/storage.d.ts +1 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +18 -18
- package/dist/summarizer.d.ts +7 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +4 -4
- package/dist/support-passport/index.js +16 -16
- package/dist/tier-routing.js +2 -2
- package/dist/{tier-stats-FLFKN7Y6.js → tier-stats-XWJSVEHC.js} +5 -5
- package/dist/transfer/autodetect.js +3 -3
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +3 -3
- package/dist/transfer/export-okf.js +19 -19
- package/dist/transfer/import-json.js +2 -2
- package/dist/transfer/import-md.js +2 -2
- package/dist/transfer/types.d.ts +15 -3
- package/dist/transfer/types.d.ts.map +1 -1
- package/dist/transfer/types.js +3 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-learner.js +2 -2
- package/dist/utility-runtime.js +3 -3
- package/dist/verified-recall.js +19 -19
- package/dist/who-knows-cli.js +20 -20
- package/dist/who-knows.js +19 -19
- package/package.json +2 -2
- package/src/access-cli.test.ts +9 -9
- package/src/access-recall-excerpt-attribution.ts +69 -0
- package/src/access-recall-surface.ts +23 -23
- package/src/access-service-raw-excerpt-read-gate.test.ts +192 -11
- package/src/backlog-scheduler.test.ts +31 -0
- package/src/binary-lifecycle/scanner.ts +35 -14
- package/src/buffer-add-turns-bounded.ts +16 -2
- package/src/buffer-session-cap.ts +4 -4
- package/src/buffer.ts +5 -5
- package/src/calibration.ts +56 -4
- package/src/config-deprecations.ts +14 -0
- package/src/config.ts +2 -1
- package/src/connectors/codex-marketplace-git.test.ts +267 -0
- package/src/connectors/codex-marketplace.ts +76 -13
- package/src/connectors/codex-materialize.ts +29 -55
- package/src/lifecycle.ts +0 -8
- package/src/location/provider-setup.test.ts +273 -2
- package/src/location/provider-setup.ts +138 -32
- package/src/memory-controller.test.ts +11 -0
- package/src/memory-controller.ts +5 -1
- package/src/model-registry.ts +0 -11
- package/src/namespaces/storage.ts +1 -0
- package/src/orchestration/backlog-scheduler.ts +12 -3
- package/src/orchestration/extraction-persist-citation.ts +5 -3
- package/src/orchestration/extraction-persist.ts +15 -14
- package/src/orchestration/recall-internal.ts +2 -3
- package/src/orchestration/semantic-consolidation-coordinator.ts +40 -33
- package/src/orchestration/semantic-consolidation-split.test.ts +72 -0
- package/src/orchestration/turn-ingestion-buffered.test.ts +52 -1
- package/src/orchestration/turn-ingestion-buffered.ts +26 -8
- package/src/orchestration/workspace-ops.test.ts +23 -0
- package/src/orchestration/workspace-ops.ts +6 -5
- package/src/orchestrator.ts +1 -0
- package/src/peers/index.ts +1 -1
- package/src/peers/interaction-log-append.ts +132 -0
- package/src/peers/peers.test.ts +30 -0
- package/src/peers/profile-reasoner.ts +1 -1
- package/src/peers/storage.ts +4 -105
- package/src/recall-state-view-packet.test.ts +40 -0
- package/src/recall-state-view-packet.ts +46 -9
- package/src/semantic-consolidation.ts +35 -27
- package/src/source-attribution.test.ts +57 -0
- package/src/source-attribution.ts +46 -43
- package/src/storage/links-frontmatter.ts +69 -0
- package/src/storage-links-parse.test.ts +153 -0
- package/src/storage.ts +8 -21
- package/src/summarizer-shutdown.test.ts +49 -16
- package/src/summarizer.ts +13 -5
- package/src/testing/subjects/dependency-propagation.test.ts +5 -4
- package/src/testing/subjects/memory-maintenance.test.ts +293 -0
- package/src/transfer/capsule-export.ts +2 -1
- package/src/transfer/capsule-taxonomy-version.test.ts +70 -0
- package/src/transfer/types.ts +13 -3
- package/src/types.ts +1 -0
- package/dist/chunk-AL3TCNSJ.js.map +0 -1
- package/dist/chunk-BKTCVXMK.js.map +0 -1
- package/dist/chunk-BPCR5DZP.js.map +0 -1
- package/dist/chunk-D6BOOYNJ.js.map +0 -1
- package/dist/chunk-FFWFFAP3.js.map +0 -1
- package/dist/chunk-FOTFLHBN.js.map +0 -1
- package/dist/chunk-GBSXTTLP.js.map +0 -1
- package/dist/chunk-I74SUMNI.js.map +0 -1
- package/dist/chunk-ILNPU5W5.js.map +0 -1
- package/dist/chunk-L272A5QW.js.map +0 -1
- package/dist/chunk-OWM2VWNX.js.map +0 -1
- package/dist/chunk-QLQUAVVP.js.map +0 -1
- package/dist/chunk-SIONKXLU.js.map +0 -1
- package/dist/chunk-TBBDFYXW.js.map +0 -1
- package/dist/chunk-WEHSQBFR.js.map +0 -1
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-recall-excerpt-attribution.js.map} +0 -0
- /package/dist/{auto-sync-L3M4RKJD.js.map → auto-sync-ACP5U5A3.js.map} +0 -0
- /package/dist/{graph-edge-decay-BC3IO2J4.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{capsule-merge-VHBRF65A.js.map → capsule-merge-BADOICNP.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-CKELO7Q6.js.map → chunk-2OAFPBQB.js.map} +0 -0
- /package/dist/{chunk-2DL3OFLD.js.map → chunk-45GEJRIG.js.map} +0 -0
- /package/dist/{chunk-5IZL4DCV.js.map → chunk-4DF5LMBJ.js.map} +0 -0
- /package/dist/{chunk-A5UOREWD.js.map → chunk-4DLGKTM6.js.map} +0 -0
- /package/dist/{chunk-WEFFO2MJ.js.map → chunk-4E2Z44CV.js.map} +0 -0
- /package/dist/{chunk-X67XNZ64.js.map → chunk-4LVQSHHN.js.map} +0 -0
- /package/dist/{chunk-RB7NXZ2E.js.map → chunk-4X7HQKAG.js.map} +0 -0
- /package/dist/{chunk-LPUEBFX2.js.map → chunk-5JCYPBY5.js.map} +0 -0
- /package/dist/{chunk-IMULTENA.js.map → chunk-5SOSQTVE.js.map} +0 -0
- /package/dist/{chunk-5PUZV73Z.js.map → chunk-6VFMEBXY.js.map} +0 -0
- /package/dist/{chunk-333SBFXB.js.map → chunk-7AAMJQFW.js.map} +0 -0
- /package/dist/{chunk-PFLN6TTW.js.map → chunk-A2XFG462.js.map} +0 -0
- /package/dist/{chunk-HXFIILGF.js.map → chunk-BFPF5N3H.js.map} +0 -0
- /package/dist/{chunk-QFTK6EDM.js.map → chunk-BFZFNXOC.js.map} +0 -0
- /package/dist/{chunk-7OCKK5M5.js.map → chunk-BJOQQCYC.js.map} +0 -0
- /package/dist/{chunk-ZX546Y3Y.js.map → chunk-CY2C5LM4.js.map} +0 -0
- /package/dist/{chunk-73TPOGS4.js.map → chunk-DC55RIEZ.js.map} +0 -0
- /package/dist/{chunk-ZDZJNXL6.js.map → chunk-DK2VBJ6Q.js.map} +0 -0
- /package/dist/{chunk-CLVILSBR.js.map → chunk-DNXQVCIC.js.map} +0 -0
- /package/dist/{chunk-7VIJUZYW.js.map → chunk-E53NLIAP.js.map} +0 -0
- /package/dist/{chunk-2LA3H54D.js.map → chunk-E5IZTY4W.js.map} +0 -0
- /package/dist/{chunk-J74YOBB3.js.map → chunk-EBI6FI5U.js.map} +0 -0
- /package/dist/{chunk-YYXYZM2I.js.map → chunk-ETTV5F53.js.map} +0 -0
- /package/dist/{chunk-FRYCXXTB.js.map → chunk-FSORYJRP.js.map} +0 -0
- /package/dist/{chunk-TH6OYP6I.js.map → chunk-GOZXQNIM.js.map} +0 -0
- /package/dist/{chunk-TNRGWJYT.js.map → chunk-GUF2JKG5.js.map} +0 -0
- /package/dist/{chunk-FEUWI5QH.js.map → chunk-HHPY5SSE.js.map} +0 -0
- /package/dist/{chunk-QPFM6DHY.js.map → chunk-HHVK2JRE.js.map} +0 -0
- /package/dist/{chunk-YY57TRKN.js.map → chunk-HR3DKJCU.js.map} +0 -0
- /package/dist/{chunk-FMFCQRDM.js.map → chunk-IJKO5RVJ.js.map} +0 -0
- /package/dist/{chunk-UMEUU66X.js.map → chunk-IK7NPYYU.js.map} +0 -0
- /package/dist/{chunk-CKZWLAHN.js.map → chunk-JDH2BA2P.js.map} +0 -0
- /package/dist/{chunk-QVXEXGIM.js.map → chunk-JNBSTHVT.js.map} +0 -0
- /package/dist/{chunk-OBPOIZNR.js.map → chunk-KBHUGMUW.js.map} +0 -0
- /package/dist/{chunk-OZKVVUJB.js.map → chunk-KIM5VNZN.js.map} +0 -0
- /package/dist/{chunk-ZWDDY4WF.js.map → chunk-KW4XA7GM.js.map} +0 -0
- /package/dist/{chunk-OAQRZ4SV.js.map → chunk-L5EE2CXU.js.map} +0 -0
- /package/dist/{chunk-RO5EGRAI.js.map → chunk-LAOJHOTG.js.map} +0 -0
- /package/dist/{chunk-3PNJZTDV.js.map → chunk-NDPS6OU2.js.map} +0 -0
- /package/dist/{chunk-U3BCW7GX.js.map → chunk-OGQL7QC7.js.map} +0 -0
- /package/dist/{chunk-K3FH3LAQ.js.map → chunk-OJXK5C6Z.js.map} +0 -0
- /package/dist/{chunk-HDLNSDLK.js.map → chunk-P3XO7HE3.js.map} +0 -0
- /package/dist/{chunk-RFLC6PKQ.js.map → chunk-PQIFYBUX.js.map} +0 -0
- /package/dist/{chunk-WLT6LTQP.js.map → chunk-PRRWKTK6.js.map} +0 -0
- /package/dist/{chunk-4L25GAYL.js.map → chunk-Q7OKGBZY.js.map} +0 -0
- /package/dist/{chunk-ZQUOUPP3.js.map → chunk-QJBULLKG.js.map} +0 -0
- /package/dist/{chunk-W7N7NWG5.js.map → chunk-QKAFFVSO.js.map} +0 -0
- /package/dist/{chunk-EZG54YDS.js.map → chunk-QKBFVLDH.js.map} +0 -0
- /package/dist/{chunk-MOUSHJAR.js.map → chunk-QMFHKWHN.js.map} +0 -0
- /package/dist/{chunk-4D2EY4WM.js.map → chunk-R2AJAAHJ.js.map} +0 -0
- /package/dist/{chunk-5BE3FLKL.js.map → chunk-R3UQIS3F.js.map} +0 -0
- /package/dist/{chunk-B3M56D2A.js.map → chunk-RDHEBINJ.js.map} +0 -0
- /package/dist/{chunk-L7SEYUHS.js.map → chunk-RHQL2RIM.js.map} +0 -0
- /package/dist/{chunk-2MWKUVHT.js.map → chunk-RK7SE3BL.js.map} +0 -0
- /package/dist/{chunk-CUPILBIP.js.map → chunk-SA2YALFU.js.map} +0 -0
- /package/dist/{chunk-VRHY7Y5A.js.map → chunk-SAPC7N43.js.map} +0 -0
- /package/dist/{chunk-6QWFZ3X5.js.map → chunk-SOQOUZ2Y.js.map} +0 -0
- /package/dist/{chunk-VHXRLD6S.js.map → chunk-T2JZF45K.js.map} +0 -0
- /package/dist/{chunk-HLWXCDUQ.js.map → chunk-T4MKFTJF.js.map} +0 -0
- /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
- /package/dist/{chunk-YZYAYUJQ.js.map → chunk-TLRIRISJ.js.map} +0 -0
- /package/dist/{chunk-LVGTH6IQ.js.map → chunk-UFX24WNJ.js.map} +0 -0
- /package/dist/{chunk-OM5ESBES.js.map → chunk-UH3FPX3L.js.map} +0 -0
- /package/dist/{chunk-4NBUHYUV.js.map → chunk-V5W67PQV.js.map} +0 -0
- /package/dist/{chunk-TAD6QMMD.js.map → chunk-VAQIBC2L.js.map} +0 -0
- /package/dist/{chunk-3Q3XD3NO.js.map → chunk-W2E2WFXL.js.map} +0 -0
- /package/dist/{chunk-UYIBNDQE.js.map → chunk-W2UV6VE3.js.map} +0 -0
- /package/dist/{chunk-AVWOULJH.js.map → chunk-W35ICLYZ.js.map} +0 -0
- /package/dist/{chunk-HDDRVXX4.js.map → chunk-W5LJ3SJ7.js.map} +0 -0
- /package/dist/{chunk-FGT7CUYZ.js.map → chunk-WF2LYKOB.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-22V3CMIW.js.map → chunk-XJTRIHTH.js.map} +0 -0
- /package/dist/{chunk-3SL52JKD.js.map → chunk-XVZA6VXC.js.map} +0 -0
- /package/dist/{chunk-WWQMZBDI.js.map → chunk-XYNUEXLC.js.map} +0 -0
- /package/dist/{chunk-HDWISXFH.js.map → chunk-Y65XX5PC.js.map} +0 -0
- /package/dist/{chunk-3YOX2BQD.js.map → chunk-YE77U5HZ.js.map} +0 -0
- /package/dist/{chunk-U2PSE7MB.js.map → chunk-YLTU2DC4.js.map} +0 -0
- /package/dist/{chunk-SBRUTD5O.js.map → chunk-YSATDEBY.js.map} +0 -0
- /package/dist/{chunk-5QDTZIGH.js.map → chunk-ZJ3CEAJD.js.map} +0 -0
- /package/dist/{chunk-GMO3BGOF.js.map → chunk-ZOJUWVAU.js.map} +0 -0
- /package/dist/{chunk-T4BT4FQN.js.map → chunk-ZYP4YEEI.js.map} +0 -0
- /package/dist/{migrate-from-identity-anchor-MJYB6NNN.js.map → config-deprecations.js.map} +0 -0
- /package/dist/{first-start-migration-BPVJ4HJQ.js.map → first-start-migration-PPPP54X6.js.map} +0 -0
- /package/dist/{tier-stats-FLFKN7Y6.js.map → tier-stats-XWJSVEHC.js.map} +0 -0
|
@@ -12,23 +12,44 @@ import crypto from "node:crypto";
|
|
|
12
12
|
import type { BinaryLifecycleConfig, BinaryLifecycleManifest } from "./types.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Case-insensitive glob match of one filename (no directory part) against one
|
|
16
|
+
* pattern: `*` matches any run of characters, `?` exactly one, every other
|
|
17
|
+
* character itself, all over Unicode code points. Two-pointer backtracking, O(name x pattern) worst case and
|
|
18
|
+
* no regular expression, so a hostile pattern cannot blow up.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
function globMatches(nameText: string, patternText: string): boolean {
|
|
21
|
+
const name = Array.from(nameText);
|
|
22
|
+
const pattern = Array.from(patternText);
|
|
23
|
+
let n = 0;
|
|
24
|
+
let p = 0;
|
|
25
|
+
let starP = -1;
|
|
26
|
+
let starN = 0;
|
|
27
|
+
while (n < name.length) {
|
|
28
|
+
const c = pattern[p];
|
|
29
|
+
if (c === "*") {
|
|
30
|
+
starP = p++;
|
|
31
|
+
starN = n;
|
|
32
|
+
} else if (p < pattern.length && (c === "?" || c === name[n])) {
|
|
33
|
+
p++;
|
|
34
|
+
n++;
|
|
35
|
+
} else if (starP >= 0) {
|
|
36
|
+
p = starP + 1;
|
|
37
|
+
n = ++starN;
|
|
38
|
+
} else {
|
|
39
|
+
return false;
|
|
29
40
|
}
|
|
30
41
|
}
|
|
31
|
-
|
|
42
|
+
while (pattern[p] === "*") p++;
|
|
43
|
+
return p === pattern.length;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Test whether a filename matches any of the provided glob patterns
|
|
48
|
+
* (`*.png`, `IMG_*.jpg`, `scan-??.png`, or an exact name), case-insensitively.
|
|
49
|
+
*/
|
|
50
|
+
export function matchesPatterns(filename: string, patterns: string[]): boolean {
|
|
51
|
+
const lower = filename.toLowerCase();
|
|
52
|
+
return patterns.some((pattern) => globMatches(lower, pattern.toLowerCase()));
|
|
32
53
|
}
|
|
33
54
|
|
|
34
55
|
/**
|
|
@@ -17,6 +17,13 @@ export type AddTurnsBoundedOutcome =
|
|
|
17
17
|
| null
|
|
18
18
|
| "duplicate";
|
|
19
19
|
|
|
20
|
+
/** Why a bounded batch was refused; the batch itself still resolves to null. */
|
|
21
|
+
export type BoundedAdmissionRefusal =
|
|
22
|
+
| { reason: "session_turn_cap"; bufferKey: string; maxTurnsPerSession: number }
|
|
23
|
+
| { reason: "session_entry_cap"; maxSessionEntries: number };
|
|
24
|
+
|
|
25
|
+
export type BoundedRefusalListener = (refusal: BoundedAdmissionRefusal) => void;
|
|
26
|
+
|
|
20
27
|
export interface AddTurnsBoundedHost {
|
|
21
28
|
readonly config: PluginConfig;
|
|
22
29
|
readonly maxSessionEntries: number;
|
|
@@ -38,6 +45,7 @@ export async function addTurnsBoundedWithAdmissionKey(
|
|
|
38
45
|
host: AddTurnsBoundedHost,
|
|
39
46
|
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
40
47
|
admissionKey?: string,
|
|
48
|
+
onRefused?: BoundedRefusalListener,
|
|
41
49
|
): Promise<AddTurnsBoundedOutcome> {
|
|
42
50
|
const pending = await host.enqueueMutation(async () => {
|
|
43
51
|
await host.loadUnlocked();
|
|
@@ -51,7 +59,10 @@ export async function addTurnsBoundedWithAdmissionKey(
|
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
|
|
62
|
+
const maxTurnsPerSession = resolveMaxTurnsPerSession(host.config.bufferMaxTurnsPerSession);
|
|
63
|
+
const overCapKey = refuseOverCapBatch((key) => host.peekEntry(key) ?? null, batches, maxTurnsPerSession);
|
|
64
|
+
if (overCapKey !== null) {
|
|
65
|
+
onRefused?.({ reason: "session_turn_cap", bufferKey: overCapKey, maxTurnsPerSession });
|
|
55
66
|
return host.ingress.refuseAll(additions);
|
|
56
67
|
}
|
|
57
68
|
const entries = host.state.entries ?? {};
|
|
@@ -67,7 +78,10 @@ export async function addTurnsBoundedWithAdmissionKey(
|
|
|
67
78
|
if (requiredEvictions > 0) {
|
|
68
79
|
const target = Math.max(0, host.maxSessionEntries - newKeys.length);
|
|
69
80
|
const evicted = selectEvictedBufferKeys(entries, newKeys, target, EVICTION_HOOKS);
|
|
70
|
-
if (newKeys.length > 0 && evicted.length < requiredEvictions)
|
|
81
|
+
if (newKeys.length > 0 && evicted.length < requiredEvictions) {
|
|
82
|
+
onRefused?.({ reason: "session_entry_cap", maxSessionEntries: host.maxSessionEntries });
|
|
83
|
+
return host.ingress.refuseAll(additions);
|
|
84
|
+
}
|
|
71
85
|
for (const key of evicted) delete entries[key];
|
|
72
86
|
host.persistence.markEvicted(evicted);
|
|
73
87
|
}
|
|
@@ -31,19 +31,19 @@ export function refuseOverCapSingle(entry: BufferEntryState | null, maxTurns: nu
|
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/** Batch path: sums incoming turns per key across all batches, new keys included. */
|
|
34
|
+
/** Batch path: sums incoming turns per key across all batches, new keys included. Returns the first over-cap key. */
|
|
35
35
|
export function refuseOverCapBatch(
|
|
36
36
|
peekEntry: (key: string) => BufferEntryState | null,
|
|
37
37
|
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
38
38
|
maxTurns: number,
|
|
39
|
-
):
|
|
39
|
+
): string | null {
|
|
40
40
|
const incomingByKey = new Map<string, number>();
|
|
41
41
|
for (const batch of batches) incomingByKey.set(batch.bufferKey, (incomingByKey.get(batch.bufferKey) ?? 0) + batch.turns.length);
|
|
42
42
|
for (const [bufferKey, incoming] of incomingByKey) {
|
|
43
43
|
if (heldTurnCount(peekEntry(bufferKey)) + incoming > maxTurns) {
|
|
44
44
|
warnTurnCapRefused(bufferKey, maxTurns);
|
|
45
|
-
return
|
|
45
|
+
return bufferKey;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
return
|
|
48
|
+
return null;
|
|
49
49
|
}
|
package/src/buffer.ts
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./buffer-turn-helpers.js";
|
|
37
37
|
import { BufferAdmissionRefusedError, BufferSessionTurnRefusedError, canAdmitNewEntryUnlocked } from "./buffer-admission.js";
|
|
38
38
|
import { BufferIngressCounters } from "./buffer-ingress-counters.js";
|
|
39
|
-
import { addTurnsBoundedWithAdmissionKey, type AddTurnsBoundedHost } from "./buffer-add-turns-bounded.js";
|
|
39
|
+
import { addTurnsBoundedWithAdmissionKey, type AddTurnsBoundedHost, type BoundedRefusalListener } from "./buffer-add-turns-bounded.js";
|
|
40
40
|
import { refuseOverCapSingle, resolveMaxTurnsPerSession, sessionTurnCapReached } from "./buffer-session-cap.js";
|
|
41
41
|
export { BufferAdmissionRefusedError, BufferSessionTurnRefusedError } from "./buffer-admission.js";
|
|
42
42
|
import type { AddTurnMutationResult, AddTurnOutcome, RetainedTurnCleanupOptions, TriggerDecision } from "./buffer-types.js";
|
|
@@ -541,18 +541,18 @@ export class SmartBuffer {
|
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
async addTurnsBounded(
|
|
544
|
-
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
544
|
+
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[], onRefused?: BoundedRefusalListener,
|
|
545
545
|
): Promise<Array<{ bufferKey: string; turn: BufferTurn; outcome: AddTurnOutcome }> | null> {
|
|
546
|
-
const result = await addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches);
|
|
546
|
+
const result = await addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches, undefined, onRefused);
|
|
547
547
|
return result === "duplicate" ? null : result;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
550
|
/** #3368 durable observe replay only; duplicate means the scoped client key already landed. */
|
|
551
551
|
async addTurnsBoundedForObserveReplay(
|
|
552
552
|
batches: readonly { bufferKey: string; turns: readonly BufferTurn[] }[],
|
|
553
|
-
admissionKey: string,
|
|
553
|
+
admissionKey: string, onRefused?: BoundedRefusalListener,
|
|
554
554
|
): Promise<Array<{ bufferKey: string; turn: BufferTurn; outcome: AddTurnOutcome }> | null | "duplicate"> {
|
|
555
|
-
return addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches, admissionKey.trim());
|
|
555
|
+
return addTurnsBoundedWithAdmissionKey(this.addTurnsBoundedHost(), batches, admissionKey.trim(), onRefused);
|
|
556
556
|
}
|
|
557
557
|
|
|
558
558
|
/** Free one slot only when an empty entry can be reclaimed. */
|
package/src/calibration.ts
CHANGED
|
@@ -416,19 +416,71 @@ export async function synthesizeCalibrationRules(
|
|
|
416
416
|
|
|
417
417
|
// ─── Recall Section ──────────────────────────────────────────────────────────
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Lexical similarity score in `[0, 1]` between a query and a calibration
|
|
421
|
+
* rule — the same token-overlap idiom as `session-experience-recall.ts`
|
|
422
|
+
* (Jaccard over lowercase tokens longer than two chars). Shared code so
|
|
423
|
+
* the ranker and any future embedding scorer share one field mapping:
|
|
424
|
+
* the rule's *when/how* text, not its id.
|
|
425
|
+
*/
|
|
426
|
+
export function calibrationRuleQueryScore(
|
|
427
|
+
rule: CalibrationRule,
|
|
428
|
+
query: string,
|
|
429
|
+
): number {
|
|
430
|
+
const norm = (s: string) =>
|
|
431
|
+
s
|
|
432
|
+
.toLowerCase()
|
|
433
|
+
.split(/[^a-z0-9]+/)
|
|
434
|
+
.filter((t) => t.length > 2);
|
|
435
|
+
const queryTokens = new Set(norm(query));
|
|
436
|
+
const ruleTokens = new Set(
|
|
437
|
+
norm(
|
|
438
|
+
`${rule.condition} ${rule.modelTendency} ${rule.userExpectation} ${rule.calibration}`,
|
|
439
|
+
),
|
|
440
|
+
);
|
|
441
|
+
if (queryTokens.size === 0 || ruleTokens.size === 0) return 0;
|
|
442
|
+
let inter = 0;
|
|
443
|
+
for (const t of queryTokens) {
|
|
444
|
+
if (ruleTokens.has(t)) inter++;
|
|
445
|
+
}
|
|
446
|
+
const union = new Set([...queryTokens, ...ruleTokens]);
|
|
447
|
+
return inter / Math.max(1, union.size);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Order calibration rules by query relevance (issue #3552). Highest
|
|
452
|
+
* lexical-similarity first; ties and all-zero scores keep index order, so
|
|
453
|
+
* an unscoreable query yields the historical include-all ordering.
|
|
454
|
+
*/
|
|
455
|
+
export function rankCalibrationRulesForQuery(
|
|
456
|
+
rules: readonly CalibrationRule[],
|
|
457
|
+
query: string,
|
|
458
|
+
): CalibrationRule[] {
|
|
459
|
+
return rules
|
|
460
|
+
.map((rule, index) => ({ rule, index, score: calibrationRuleQueryScore(rule, query) }))
|
|
461
|
+
.sort((a, b) => b.score - a.score || a.index - b.index)
|
|
462
|
+
.map((entry) => entry.rule);
|
|
463
|
+
}
|
|
464
|
+
|
|
419
465
|
/**
|
|
420
466
|
* Build a recall section from calibration rules relevant to the current query.
|
|
421
|
-
*
|
|
467
|
+
* Rules are similarity-ranked against the query before `maxRules` and
|
|
468
|
+
* `maxChars` caps apply, so relevant rules win the budget instead of
|
|
469
|
+
* whichever happen to sit earliest in the index. When nothing matches
|
|
470
|
+
* the query the index order is preserved — the include-all fallback.
|
|
422
471
|
*/
|
|
423
472
|
export function buildCalibrationRecallSection(
|
|
424
473
|
rules: CalibrationRule[],
|
|
425
474
|
query: string,
|
|
426
475
|
maxChars: number = 1200,
|
|
476
|
+
maxRules?: number,
|
|
427
477
|
): string | null {
|
|
428
478
|
if (rules.length === 0) return null;
|
|
429
479
|
|
|
430
|
-
|
|
431
|
-
|
|
480
|
+
const ranked = rankCalibrationRulesForQuery(rules, query);
|
|
481
|
+
const selected =
|
|
482
|
+
maxRules !== undefined ? ranked.slice(0, Math.max(0, maxRules)) : ranked;
|
|
483
|
+
|
|
432
484
|
const lines: string[] = [
|
|
433
485
|
"## Model Calibration (learned from past corrections)",
|
|
434
486
|
"",
|
|
@@ -438,7 +490,7 @@ export function buildCalibrationRecallSection(
|
|
|
438
490
|
|
|
439
491
|
let totalChars = lines.join("\n").length;
|
|
440
492
|
|
|
441
|
-
for (const rule of
|
|
493
|
+
for (const rule of selected) {
|
|
442
494
|
const line = `- **${rule.condition}**: ${rule.modelTendency} → Instead: ${rule.calibration}`;
|
|
443
495
|
if (totalChars + line.length + 1 > maxChars) break;
|
|
444
496
|
lines.push(line);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Config keys parsed only so existing configs keep loading; each warns when set. */
|
|
2
|
+
import { log } from "./logger.js";
|
|
3
|
+
|
|
4
|
+
const DEFAULT_CAUSAL_IMPACT_WEIGHT = 0.05;
|
|
5
|
+
|
|
6
|
+
/** Lifecycle scoring never had a causal impact signal, so this weight was never read (#3667). */
|
|
7
|
+
export function warnDeprecatedCausalImpactWeight(weight: number | undefined): number {
|
|
8
|
+
if (weight === undefined) return DEFAULT_CAUSAL_IMPACT_WEIGHT;
|
|
9
|
+
log.warn(
|
|
10
|
+
"cmcLifecycleCausalImpactWeight is deprecated and has no effect: lifecycle scoring has no causal impact signal (#3667). " +
|
|
11
|
+
"Remove it from your config.",
|
|
12
|
+
);
|
|
13
|
+
return weight;
|
|
14
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -28,6 +28,7 @@ import type {
|
|
|
28
28
|
} from "./types.js";
|
|
29
29
|
import { parseBackgroundGeneration } from "./background-generation-config.js";
|
|
30
30
|
import { parseSearchBackend } from "./config-search-backend.js";
|
|
31
|
+
import { warnDeprecatedCausalImpactWeight } from "./config-deprecations.js";
|
|
31
32
|
import { parseLocalLlmConfig } from "./local-llm-config.js";
|
|
32
33
|
import { parseCorrectionConfig } from "./correction/correction-config.js";
|
|
33
34
|
import { parseConvergeConfig } from "./converge-config.js";
|
|
@@ -3081,7 +3082,7 @@ export function parseConfig(
|
|
|
3081
3082
|
cmcBehaviorMinFrequency: typeof cfg.cmcBehaviorMinFrequency === "number" ? cfg.cmcBehaviorMinFrequency : 3,
|
|
3082
3083
|
cmcBehaviorMinSessions: typeof cfg.cmcBehaviorMinSessions === "number" ? cfg.cmcBehaviorMinSessions : 2,
|
|
3083
3084
|
cmcBehaviorConfidenceThreshold: typeof cfg.cmcBehaviorConfidenceThreshold === "number" ? cfg.cmcBehaviorConfidenceThreshold : 0.6,
|
|
3084
|
-
cmcLifecycleCausalImpactWeight:
|
|
3085
|
+
cmcLifecycleCausalImpactWeight: warnDeprecatedCausalImpactWeight(coerceNumber(cfg.cmcLifecycleCausalImpactWeight)),
|
|
3085
3086
|
|
|
3086
3087
|
// PEDC (Prediction-Error-Driven Calibration) — model-user alignment
|
|
3087
3088
|
calibrationEnabled: cfg.calibrationEnabled === true,
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #3611: `resolveGit` delegated git URLs to raw-URL resolution — only
|
|
3
|
+
* GitHub-HTTPS-shaped inputs survived; SSH URLs (git@host:o/r.git), GitLab,
|
|
4
|
+
* self-hosted remotes, and file:// / local-path git sources all threw
|
|
5
|
+
* "Git URL resolution requires a GitHub-format URL", and the error even
|
|
6
|
+
* misdirected to --type github, which cannot parse SSH form either.
|
|
7
|
+
*
|
|
8
|
+
* Root fix: resolve the manifest by really cloning the source
|
|
9
|
+
* (`git clone --depth 1`), then reading marketplace.json from the
|
|
10
|
+
* checkout. These tests use local file:// remotes so they are hermetic —
|
|
11
|
+
* the same code path carries SSH and hosted HTTPS URLs because git
|
|
12
|
+
* handles the transport.
|
|
13
|
+
*/
|
|
14
|
+
import assert from "node:assert/strict";
|
|
15
|
+
import { execFileSync } from "node:child_process";
|
|
16
|
+
import { existsSync } from "node:fs";
|
|
17
|
+
import { mkdir, mkdtemp, readdir, rm, writeFile } from "node:fs/promises";
|
|
18
|
+
import os from "node:os";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import test from "node:test";
|
|
21
|
+
|
|
22
|
+
import { parseConfig } from "../config.js";
|
|
23
|
+
import { installFromMarketplace } from "./codex-marketplace.js";
|
|
24
|
+
|
|
25
|
+
const MANIFEST = JSON.stringify(
|
|
26
|
+
{
|
|
27
|
+
version: 1,
|
|
28
|
+
name: "test-market",
|
|
29
|
+
description: "fixture",
|
|
30
|
+
plugins: [
|
|
31
|
+
{
|
|
32
|
+
name: "demo",
|
|
33
|
+
version: "1.0.0",
|
|
34
|
+
description: "demo plugin",
|
|
35
|
+
repository: "owner/repo",
|
|
36
|
+
installType: "git",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
null,
|
|
41
|
+
2,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
function git(cwd: string, args: string[]): void {
|
|
45
|
+
execFileSync("git", args, {
|
|
46
|
+
cwd,
|
|
47
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
48
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function makeGitRemote(): Promise<{ dir: string; fileUrl: string }> {
|
|
53
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-git-"));
|
|
54
|
+
git(dir, ["init", "-q", "-b", "main"]);
|
|
55
|
+
// Fleet git-identity-guard hook lives in a global core.hooksPath and
|
|
56
|
+
// refuses fixture commits; point this throwaway repo at an empty dir.
|
|
57
|
+
const noHooks = path.join(dir, ".no-hooks");
|
|
58
|
+
await mkdir(noHooks);
|
|
59
|
+
git(dir, ["config", "core.hooksPath", noHooks]);
|
|
60
|
+
git(dir, ["config", "user.email", "test@example.com"]);
|
|
61
|
+
git(dir, ["config", "user.name", "test"]);
|
|
62
|
+
await writeFile(path.join(dir, "marketplace.json"), MANIFEST);
|
|
63
|
+
git(dir, ["add", "marketplace.json"]);
|
|
64
|
+
git(dir, ["commit", "-qm", "init"]);
|
|
65
|
+
return { dir, fileUrl: `file://${dir}` };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function marketplaceConfig(memoryDir: string) {
|
|
69
|
+
return parseConfig({
|
|
70
|
+
openaiApiKey: "sk-test",
|
|
71
|
+
memoryDir,
|
|
72
|
+
workspaceDir: path.join(memoryDir, "workspace"),
|
|
73
|
+
codexMarketplaceEnabled: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
test("#3611 git source resolves a file:// remote by cloning", async () => {
|
|
78
|
+
const remote = await makeGitRemote();
|
|
79
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
|
|
80
|
+
try {
|
|
81
|
+
const result = await installFromMarketplace(
|
|
82
|
+
remote.fileUrl,
|
|
83
|
+
"git",
|
|
84
|
+
marketplaceConfig(memoryDir),
|
|
85
|
+
);
|
|
86
|
+
assert.equal(result.ok, true, result.message);
|
|
87
|
+
assert.deepEqual(result.pluginsFound, ["demo"]);
|
|
88
|
+
} finally {
|
|
89
|
+
await rm(remote.dir, { recursive: true, force: true });
|
|
90
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("#3611 git source resolves a local-path remote by cloning", async () => {
|
|
95
|
+
const remote = await makeGitRemote();
|
|
96
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
|
|
97
|
+
try {
|
|
98
|
+
const result = await installFromMarketplace(
|
|
99
|
+
remote.dir,
|
|
100
|
+
"git",
|
|
101
|
+
marketplaceConfig(memoryDir),
|
|
102
|
+
);
|
|
103
|
+
assert.equal(result.ok, true, result.message);
|
|
104
|
+
assert.deepEqual(result.pluginsFound, ["demo"]);
|
|
105
|
+
} finally {
|
|
106
|
+
await rm(remote.dir, { recursive: true, force: true });
|
|
107
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test("#3611 ambient git config cannot re-enable ext:: or run hooks", async () => {
|
|
112
|
+
// w7X's second exploit: a hostile global gitconfig can re-enable the ext::
|
|
113
|
+
// transport (arbitrary command execution) and point hooksPath at a
|
|
114
|
+
// post-checkout hook that runs during our clone. The clone must run with
|
|
115
|
+
// GIT_CONFIG_NOSYSTEM/GIT_CONFIG_GLOBAL neutralized, a closed protocol
|
|
116
|
+
// allowlist, and hooks disabled.
|
|
117
|
+
const hostile = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-hostile-"));
|
|
118
|
+
const remote = await makeGitRemote();
|
|
119
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
|
|
120
|
+
const hooksDir = path.join(hostile, "hooks");
|
|
121
|
+
const hookMarker = path.join(hostile, "hook-ran");
|
|
122
|
+
const extMarker = path.join(hostile, "ext-ran");
|
|
123
|
+
try {
|
|
124
|
+
await mkdir(hooksDir);
|
|
125
|
+
await writeFile(
|
|
126
|
+
path.join(hooksDir, "post-checkout"),
|
|
127
|
+
`#!/bin/sh\ntouch ${hookMarker}\n`,
|
|
128
|
+
{ mode: 0o755 },
|
|
129
|
+
);
|
|
130
|
+
const cfgFile = path.join(hostile, "gitconfig");
|
|
131
|
+
await writeFile(
|
|
132
|
+
cfgFile,
|
|
133
|
+
`[protocol "ext"]\n\tallow = always\n[core]\n\thooksPath = ${hooksDir}\n`,
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const prev = process.env.GIT_CONFIG_GLOBAL;
|
|
137
|
+
process.env.GIT_CONFIG_GLOBAL = cfgFile;
|
|
138
|
+
try {
|
|
139
|
+
const cloned = await installFromMarketplace(
|
|
140
|
+
remote.fileUrl,
|
|
141
|
+
"git",
|
|
142
|
+
marketplaceConfig(memoryDir),
|
|
143
|
+
);
|
|
144
|
+
assert.equal(cloned.ok, true, cloned.message);
|
|
145
|
+
assert.equal(
|
|
146
|
+
existsSync(hookMarker),
|
|
147
|
+
false,
|
|
148
|
+
"ambient hooksPath ran a post-checkout hook during clone",
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const ext = await installFromMarketplace(
|
|
152
|
+
`ext::sh -c "touch ${extMarker}"`,
|
|
153
|
+
"git",
|
|
154
|
+
marketplaceConfig(memoryDir),
|
|
155
|
+
);
|
|
156
|
+
assert.equal(ext.ok, false, "ext:: transport must not be allowed");
|
|
157
|
+
assert.equal(
|
|
158
|
+
existsSync(extMarker),
|
|
159
|
+
false,
|
|
160
|
+
"ambient protocol.ext.allow=always let ext:: execute a command",
|
|
161
|
+
);
|
|
162
|
+
} finally {
|
|
163
|
+
if (prev === undefined) {
|
|
164
|
+
delete process.env.GIT_CONFIG_GLOBAL;
|
|
165
|
+
} else {
|
|
166
|
+
process.env.GIT_CONFIG_GLOBAL = prev;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
} finally {
|
|
170
|
+
await rm(hostile, { recursive: true, force: true });
|
|
171
|
+
await rm(remote.dir, { recursive: true, force: true });
|
|
172
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("#3611 a failed clone leaves no temp dir behind", async () => {
|
|
177
|
+
// w7X's third finding: mkdtemp ran before the clone, and the rm sat in a
|
|
178
|
+
// finally that only wrapped resolveLocal — every clone failure (including
|
|
179
|
+
// timeout) leaked remnic-marketplace-git-* dirs.
|
|
180
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
|
|
181
|
+
try {
|
|
182
|
+
const count = async () =>
|
|
183
|
+
(await readdir(os.tmpdir())).filter((d) =>
|
|
184
|
+
d.startsWith("remnic-marketplace-git-"),
|
|
185
|
+
).length;
|
|
186
|
+
const before = await count();
|
|
187
|
+
const result = await installFromMarketplace(
|
|
188
|
+
"file:///definitely/not/a/repo-3611",
|
|
189
|
+
"git",
|
|
190
|
+
marketplaceConfig(memoryDir),
|
|
191
|
+
);
|
|
192
|
+
assert.equal(result.ok, false);
|
|
193
|
+
assert.equal(await count(), before, "failed clone leaked a temp dir");
|
|
194
|
+
} finally {
|
|
195
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("#3611 scheme-less github.com/owner/repo resolves via the github route", async () => {
|
|
200
|
+
// Post-#3628 regression (Main's diff read): the removed regex also accepted
|
|
201
|
+
// scheme-less `github.com/owner/repo` and routed it to resolveGithub. With
|
|
202
|
+
// resolveGit = clone, the same string is treated as a local path and fails.
|
|
203
|
+
// The fix must restore the github route for that form — proven here by a
|
|
204
|
+
// stubbed fetch observing the raw.githubusercontent.com request.
|
|
205
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
|
|
206
|
+
const prevFetch = globalThis.fetch;
|
|
207
|
+
const calls: string[] = [];
|
|
208
|
+
globalThis.fetch = async (input: Parameters<typeof fetch>[0]) => {
|
|
209
|
+
calls.push(String(input));
|
|
210
|
+
return new Response(MANIFEST, { status: 200 });
|
|
211
|
+
};
|
|
212
|
+
try {
|
|
213
|
+
const result = await installFromMarketplace(
|
|
214
|
+
"github.com/owner/repo",
|
|
215
|
+
"git",
|
|
216
|
+
marketplaceConfig(memoryDir),
|
|
217
|
+
);
|
|
218
|
+
assert.equal(result.ok, true, result.message);
|
|
219
|
+
assert.deepEqual(result.pluginsFound, ["demo"]);
|
|
220
|
+
assert.ok(
|
|
221
|
+
calls.some((u) => u.includes("raw.githubusercontent.com/owner/repo")),
|
|
222
|
+
`expected a GitHub raw manifest fetch, got: ${calls.join(", ") || "(none)"}`,
|
|
223
|
+
);
|
|
224
|
+
} finally {
|
|
225
|
+
globalThis.fetch = prevFetch;
|
|
226
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test("#3611 flag-shaped git source is rejected before clone", async () => {
|
|
231
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
|
|
232
|
+
try {
|
|
233
|
+
const result = await installFromMarketplace(
|
|
234
|
+
"--upload-pack=/bin/false",
|
|
235
|
+
"git",
|
|
236
|
+
marketplaceConfig(memoryDir),
|
|
237
|
+
);
|
|
238
|
+
assert.equal(result.ok, false);
|
|
239
|
+
assert.ok(
|
|
240
|
+
result.errors.some((e) => e.includes("must not look like a flag")),
|
|
241
|
+
`expected the flag guard, got: ${result.errors.join("; ")}`,
|
|
242
|
+
);
|
|
243
|
+
} finally {
|
|
244
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
test("#3611 non-repo git source fails as a clone error, not the stub", async () => {
|
|
249
|
+
const notRepo = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-notgit-"));
|
|
250
|
+
const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-mkt-cfg-"));
|
|
251
|
+
try {
|
|
252
|
+
const result = await installFromMarketplace(
|
|
253
|
+
`file://${notRepo}`,
|
|
254
|
+
"git",
|
|
255
|
+
marketplaceConfig(memoryDir),
|
|
256
|
+
);
|
|
257
|
+
assert.equal(result.ok, false);
|
|
258
|
+
assert.equal(result.pluginsFound.length, 0);
|
|
259
|
+
assert.ok(
|
|
260
|
+
!result.errors.some((e) => e.includes("GitHub-format URL")),
|
|
261
|
+
`must not fall back to the raw-URL delegation stub: ${result.errors.join("; ")}`,
|
|
262
|
+
);
|
|
263
|
+
} finally {
|
|
264
|
+
await rm(notRepo, { recursive: true, force: true });
|
|
265
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
266
|
+
}
|
|
267
|
+
});
|
|
@@ -17,8 +17,11 @@
|
|
|
17
17
|
* manifest files.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
import { execFile, type ExecFileException } from "node:child_process";
|
|
20
21
|
import fs from "node:fs";
|
|
22
|
+
import os from "node:os";
|
|
21
23
|
import path from "node:path";
|
|
24
|
+
import { promisify } from "node:util";
|
|
22
25
|
|
|
23
26
|
import { log } from "../logger.js";
|
|
24
27
|
import type { PluginConfig } from "../types.js";
|
|
@@ -105,6 +108,11 @@ export const MARKETPLACE_MANIFEST_FILENAME = "marketplace.json";
|
|
|
105
108
|
/** Valid install types for validation. */
|
|
106
109
|
const VALID_INSTALL_TYPES = new Set<string>(["github", "git", "local", "url"]);
|
|
107
110
|
|
|
111
|
+
/** Bound on a manifest-fetching shallow clone (issue #3611). */
|
|
112
|
+
const GIT_CLONE_TIMEOUT_MS = 120_000;
|
|
113
|
+
|
|
114
|
+
const execFileAsync = promisify(execFile);
|
|
115
|
+
|
|
108
116
|
// ── Generate ──────────────────────────────────────────────────────────────
|
|
109
117
|
|
|
110
118
|
/**
|
|
@@ -445,27 +453,82 @@ async function resolveGithub(
|
|
|
445
453
|
/**
|
|
446
454
|
* Resolve marketplace.json from a git URL.
|
|
447
455
|
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
456
|
+
* Shallow-clones the source into a temp dir and reads the manifest from the
|
|
457
|
+
* checkout, so every transport git supports (HTTPS, SSH, file://, local
|
|
458
|
+
* paths, self-hosted) resolves the same way. The clone runs hermetically:
|
|
459
|
+
* ambient git config is ignored (a hostile ~/.gitconfig could re-enable the
|
|
460
|
+
* ext:: transport, which runs arbitrary commands), the protocol allowlist
|
|
461
|
+
* is closed to https/ssh/file, hooks and templates are neutralized, and
|
|
462
|
+
* GIT_TERMINAL_PROMPT=0 keeps a credential prompt from hanging the install.
|
|
450
463
|
*/
|
|
451
464
|
async function resolveGit(
|
|
452
465
|
gitUrl: string,
|
|
453
466
|
logger: MarketplaceLogger,
|
|
454
467
|
): Promise<MarketplaceManifest> {
|
|
455
|
-
//
|
|
456
|
-
//
|
|
457
|
-
|
|
458
|
-
|
|
468
|
+
// Scheme-less github.com/owner/repo is a form the pre-#3628 code accepted:
|
|
469
|
+
// git clone would treat it as a local path, so route it to the GitHub
|
|
470
|
+
// resolver instead.
|
|
471
|
+
const ghSchemaless = gitUrl.match(
|
|
472
|
+
/^github\.com\/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+?)(?:\.git)?$/u,
|
|
459
473
|
);
|
|
460
|
-
if (
|
|
461
|
-
|
|
462
|
-
return resolveGithub(ghMatch[1], logger);
|
|
474
|
+
if (ghSchemaless?.[1]) {
|
|
475
|
+
return resolveGithub(ghSchemaless[1], logger);
|
|
463
476
|
}
|
|
464
477
|
|
|
465
|
-
|
|
466
|
-
`
|
|
467
|
-
|
|
468
|
-
|
|
478
|
+
if (gitUrl.startsWith("-")) {
|
|
479
|
+
throw new Error(`Invalid git source: ${gitUrl} (must not look like a flag)`);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "remnic-marketplace-git-"));
|
|
483
|
+
const cloneDir = path.join(tmpDir, "repo");
|
|
484
|
+
const emptyTemplate = path.join(tmpDir, "template");
|
|
485
|
+
fs.mkdirSync(emptyTemplate);
|
|
486
|
+
|
|
487
|
+
try {
|
|
488
|
+
logger.debug?.(`cloning git source for marketplace manifest: ${gitUrl}`);
|
|
489
|
+
try {
|
|
490
|
+
await execFileAsync(
|
|
491
|
+
"git",
|
|
492
|
+
[
|
|
493
|
+
"-c",
|
|
494
|
+
"core.hooksPath=/dev/null",
|
|
495
|
+
"clone",
|
|
496
|
+
"--quiet",
|
|
497
|
+
"--depth",
|
|
498
|
+
"1",
|
|
499
|
+
"--template",
|
|
500
|
+
emptyTemplate,
|
|
501
|
+
"--",
|
|
502
|
+
gitUrl,
|
|
503
|
+
cloneDir,
|
|
504
|
+
],
|
|
505
|
+
{
|
|
506
|
+
env: {
|
|
507
|
+
...process.env,
|
|
508
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
509
|
+
GIT_CONFIG_NOSYSTEM: "1",
|
|
510
|
+
GIT_CONFIG_GLOBAL: "/dev/null",
|
|
511
|
+
// Ambient GIT_CONFIG_KEY_*/GIT_CONFIG_VALUE_* pairs cannot inject
|
|
512
|
+
// config either.
|
|
513
|
+
GIT_CONFIG_COUNT: "0",
|
|
514
|
+
GIT_ALLOW_PROTOCOL: "https:ssh:file",
|
|
515
|
+
},
|
|
516
|
+
timeout: GIT_CLONE_TIMEOUT_MS,
|
|
517
|
+
},
|
|
518
|
+
);
|
|
519
|
+
} catch (err) {
|
|
520
|
+
// SAFETY: the only awaited call in the try block is the git clone, and
|
|
521
|
+
// execFile rejections are always ExecFileException carrying the child's
|
|
522
|
+
// stderr.
|
|
523
|
+
const stderr = (err as ExecFileException).stderr?.toString().trim();
|
|
524
|
+
const detail = stderr || (err instanceof Error ? err.message : String(err));
|
|
525
|
+
throw new Error(`Failed to clone git source ${gitUrl}: ${detail}`);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return resolveLocal(cloneDir, logger);
|
|
529
|
+
} finally {
|
|
530
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
531
|
+
}
|
|
469
532
|
}
|
|
470
533
|
|
|
471
534
|
// ── Helpers ───────────────────────────────────────────────────────────────
|