@remnic/core 9.69.12 → 9.69.13
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.d.ts +11 -11
- package/dist/access-admin-ops-surface.js +4 -4
- package/dist/access-authorization-probe.d.ts +11 -11
- package/dist/access-authorization-probe.js +5 -5
- package/dist/access-boundary.d.ts +11 -11
- package/dist/access-boundary.js +4 -4
- package/dist/access-cli.js +28 -28
- package/dist/access-coding-context-resolution.d.ts +1 -1
- package/dist/access-extraction-force-flush.d.ts +11 -11
- package/dist/access-extraction-force-flush.js +4 -4
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +11 -11
- package/dist/access-http-lifecycle-flush.d.ts +11 -11
- package/dist/access-http-offline-stream.d.ts +11 -11
- package/dist/access-http-query.d.ts +2 -2
- package/dist/access-http-query.js +4 -4
- package/dist/access-http.d.ts +12 -12
- package/dist/access-http.js +15 -15
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +4 -4
- package/dist/access-lcm-surface.d.ts +11 -11
- package/dist/access-lcm-surface.js +4 -4
- package/dist/access-mcp.d.ts +11 -11
- package/dist/access-mcp.js +11 -11
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-Cy0yPsaE.d.ts → access-namespace-preflight-Rzuo1nGR.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +4 -4
- package/dist/access-observe-write-surface.d.ts +11 -11
- package/dist/access-observe-write-surface.js +4 -4
- package/dist/access-offline-manifest.d.ts +9 -9
- package/dist/access-operations-batch.js +5 -5
- package/dist/access-operations.d.ts +12 -12
- package/dist/access-operations.js +10 -10
- package/dist/access-recall-concurrency.d.ts +11 -11
- package/dist/access-recall-concurrency.js +4 -4
- package/dist/access-recall-response.d.ts +11 -11
- package/dist/access-recall-response.js +4 -4
- package/dist/access-recall-surface.d.ts +11 -11
- package/dist/access-recall-surface.js +4 -4
- package/dist/{access-service-Baz5xW5X.d.ts → access-service-Bb2Fykzc.d.ts} +7 -7
- package/dist/access-service-helpers.d.ts +11 -11
- package/dist/access-service.d.ts +11 -11
- package/dist/access-service.js +4 -4
- package/dist/access-surface-catalog.d.ts +11 -11
- package/dist/access-surface-catalog.js +6 -6
- package/dist/access-wearables-meetings-surface.d.ts +3 -3
- 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 +4 -4
- package/dist/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -9
- package/dist/briefing-window.d.ts +2 -2
- package/dist/briefing.d.ts +2 -2
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/buffer.js +4 -4
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{catalog-9X8WpZNO.d.ts → catalog-DjTLVOYp.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-TEZ2HTC7.js → chunk-33JKYLPX.js} +2 -2
- package/dist/{chunk-MNH2GM4O.js → chunk-3BS2OGDT.js} +6 -19
- package/dist/{chunk-MNH2GM4O.js.map → chunk-3BS2OGDT.js.map} +1 -1
- package/dist/{chunk-5PTS43CH.js → chunk-4LG4CPOC.js} +2 -2
- package/dist/{chunk-Z33VUMKY.js → chunk-5H2G5X4R.js} +2 -2
- package/dist/{chunk-XFPHV65N.js → chunk-5JQV4T5Q.js} +2 -2
- package/dist/{chunk-OASGWNYL.js → chunk-63I7LMLG.js} +2 -2
- package/dist/{chunk-J3NGQ5SC.js → chunk-7GSSHAXC.js} +2 -2
- package/dist/{chunk-X4FIZAVQ.js → chunk-7JV4JST3.js} +854 -42
- package/dist/chunk-7JV4JST3.js.map +1 -0
- package/dist/{chunk-VHAKBUBD.js → chunk-B64IVEOH.js} +2 -2
- package/dist/{chunk-R7FXPG4T.js → chunk-C25N5HWX.js} +2 -2
- package/dist/{chunk-DH3V7RCQ.js → chunk-F2ERDKY2.js} +7 -7
- package/dist/{chunk-LJNLLNEM.js → chunk-HODFGQGT.js} +2 -2
- package/dist/{chunk-B75VCEX5.js → chunk-K2IJH4D3.js} +2 -2
- package/dist/{chunk-227WJVPY.js → chunk-KLSPKMIO.js} +2 -2
- package/dist/{chunk-5P2KNFJZ.js → chunk-MSDIETFC.js} +3 -3
- package/dist/{chunk-HFRGCNFY.js → chunk-OAKATRAN.js} +2 -2
- package/dist/chunk-OGUKSLYZ.js +560 -0
- package/dist/chunk-OGUKSLYZ.js.map +1 -0
- package/dist/{chunk-M6L7HI7R.js → chunk-P6FHFTZ7.js} +16 -1
- package/dist/chunk-P6FHFTZ7.js.map +1 -0
- package/dist/{chunk-LWBSEYW3.js → chunk-PAWIY5OQ.js} +5 -5
- package/dist/{chunk-3ITTF7YH.js → chunk-QVI63XSO.js} +90 -383
- package/dist/chunk-QVI63XSO.js.map +1 -0
- package/dist/{chunk-6TOWUN2R.js → chunk-RE3H6Y2X.js} +2 -2
- package/dist/{chunk-V3HUBF7T.js → chunk-S35IIP5P.js} +2 -2
- package/dist/{chunk-3YKOFCKP.js → chunk-SXHBZXHK.js} +2 -2
- package/dist/{chunk-7NCUHD5U.js → chunk-VAMZYOOV.js} +2 -2
- package/dist/{chunk-PGCZLHRB.js → chunk-W272SWN7.js} +3 -3
- package/dist/{chunk-5HO3QBAD.js → chunk-W6GEMUZM.js} +2 -2
- package/dist/{chunk-UCNQV43K.js → chunk-XQYTSZW3.js} +2 -2
- package/dist/{chunk-GR4C3FHT.js → chunk-ZKZCJRRO.js} +2 -2
- package/dist/{cli-CMtkGBdz.d.ts → cli-DXXy60A4.d.ts} +5 -5
- package/dist/cli.d.ts +13 -13
- package/dist/cli.js +21 -21
- package/dist/coding/export-okf-codegraph.d.ts +1 -1
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/compounding/engine.d.ts +2 -2
- 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 +4 -4
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +3 -3
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- 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/corpus-watermark.d.ts +1 -1
- package/dist/cross-lingual-recall.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/deep-recall-http-glue.d.ts +11 -11
- package/dist/deep-recall-mcp-tools.d.ts +11 -11
- package/dist/deep-recall-policy-llm.d.ts +1 -1
- package/dist/deep-recall-seeds.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/dependency-propagation-config.d.ts +1 -1
- package/dist/{dependency-propagation-delivery-BZGUecZf.d.ts → dependency-propagation-delivery-37JdQv_3.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-origin-fields.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +2 -2
- package/dist/entity-schema.d.ts +1 -1
- package/dist/episodic-context.d.ts +1 -1
- package/dist/eval-trajectory-contracts.d.ts +1 -1
- package/dist/eval-trajectory-store.d.ts +1 -1
- package/dist/eval-trajectory.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/external-wiki-access.d.ts +11 -11
- package/dist/external-wiki-access.js +5 -5
- package/dist/external-wiki-collection-registration.d.ts +1 -1
- package/dist/external-wiki-collection.d.ts +1 -1
- package/dist/external-wiki-mcp-tools.d.ts +11 -11
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction-liveness.d.ts +1 -1
- package/dist/extraction-normalization.d.ts +1 -1
- package/dist/extraction-prompt.d.ts +1 -1
- package/dist/extraction-source-grounding-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/extraction.js +5 -5
- 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-path-reconstruction.d.ts +1 -1
- package/dist/graph-path-scoring.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/importers/index.d.ts +1 -1
- package/dist/in-flight-reads.d.ts +1 -1
- package/dist/{index-B4iTvT-w.d.ts → index-DquhYqsc.d.ts} +2 -2
- package/dist/index.d.ts +200 -62
- package/dist/index.js +59 -37
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/location/index.d.ts +3 -3
- package/dist/location/index.js +5 -5
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/{maintenance-BBpNqEeJ.d.ts → maintenance-CizZOycr.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +11 -11
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-controller.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-snapshot.d.ts +1 -1
- package/dist/memory-subject-cli.d.ts +11 -11
- package/dist/memory-subject.d.ts +11 -11
- package/dist/memory-worth-outcomes.d.ts +2 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +5 -5
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +6 -6
- package/dist/{orchestrator-DglY1H0w.d.ts → orchestrator-DqLcuNMP.d.ts} +8 -8
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +28 -28
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-C7qRsy6g.d.ts → pipeline-DbJpmcRu.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/proactive-contention.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/{public-http-CU-Cwwdb.d.ts → public-http-NQ3UUp6W.d.ts} +1 -1
- package/dist/{qmd-YRLTa3AE.d.ts → qmd-DA_7fbSz.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-concurrency-config.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-memory-map.d.ts +1 -1
- package/dist/recall-navigate-access.d.ts +1 -1
- package/dist/recall-navigate-disclosure.d.ts +1 -1
- package/dist/recall-navigate.d.ts +1 -1
- 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-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray.d.ts +1 -1
- package/dist/reconcile/cursor.d.ts +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/plan.d.ts +1 -1
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +5 -5
- package/dist/retrieval-agents.d.ts +2 -2
- 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/salvage-envelope.d.ts +1 -1
- package/dist/{scope-profiles-BVvqVzJX.d.ts → scope-profiles-BpiWKZzx.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/index.d.ts +1 -1
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-BzCI6Kuu.d.ts → semantic-consolidation-NJpaZpkY.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/{service-DQ3Gscy5.d.ts → service-DdlZjX1D.d.ts} +2 -2
- 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/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +4 -4
- package/dist/standup/build.js +2 -2
- package/dist/{storage-DmTbQdD0.d.ts → storage-C7BWrpU9.d.ts} +1 -1
- package/dist/storage.d.ts +2 -2
- package/dist/subject-config.d.ts +1 -1
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +14 -14
- package/dist/support-passport/index.js +7 -7
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-timeline-recall.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 +2 -2
- 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/export-okf.d.ts +1 -1
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-CLRTESSD.d.ts → types-Cy1l6fzp.d.ts} +48 -1
- package/dist/types.d.ts +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/who-knows-cli.d.ts +11 -11
- package/dist/who-knows.d.ts +11 -11
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -2
- package/src/activity/config.test.ts +94 -1
- package/src/activity/config.ts +256 -3
- package/src/activity/digest.ts +21 -0
- package/src/activity/index.ts +2 -0
- package/src/activity/runner.ts +2 -17
- package/src/activity/timeline/publish-cli.test.ts +169 -0
- package/src/activity/timeline/publish-cli.ts +144 -0
- package/src/activity/timeline/query.ts +51 -15
- package/src/activity/types.ts +45 -0
- package/src/activity/vault-insert.ts +14 -33
- package/src/activity/vault-path.ts +100 -22
- package/src/activity/vault-publish.test.ts +51 -0
- package/src/activity/vault-publish.ts +157 -17
- package/src/activity/vault-publisher.test.ts +881 -0
- package/src/activity/vault-publisher.ts +597 -0
- package/src/activity/vault-region.test.ts +5 -0
- package/src/activity/vault-region.ts +7 -2
- package/src/cli/timeline-publish-commands.ts +34 -0
- package/src/cli.ts +2 -2
- package/src/config.test.ts +24 -1
- package/dist/chunk-3ITTF7YH.js.map +0 -1
- package/dist/chunk-KJUWWN3T.js +0 -237
- package/dist/chunk-KJUWWN3T.js.map +0 -1
- package/dist/chunk-M6L7HI7R.js.map +0 -1
- package/dist/chunk-X4FIZAVQ.js.map +0 -1
- /package/dist/{chunk-TEZ2HTC7.js.map → chunk-33JKYLPX.js.map} +0 -0
- /package/dist/{chunk-5PTS43CH.js.map → chunk-4LG4CPOC.js.map} +0 -0
- /package/dist/{chunk-Z33VUMKY.js.map → chunk-5H2G5X4R.js.map} +0 -0
- /package/dist/{chunk-XFPHV65N.js.map → chunk-5JQV4T5Q.js.map} +0 -0
- /package/dist/{chunk-OASGWNYL.js.map → chunk-63I7LMLG.js.map} +0 -0
- /package/dist/{chunk-J3NGQ5SC.js.map → chunk-7GSSHAXC.js.map} +0 -0
- /package/dist/{chunk-VHAKBUBD.js.map → chunk-B64IVEOH.js.map} +0 -0
- /package/dist/{chunk-R7FXPG4T.js.map → chunk-C25N5HWX.js.map} +0 -0
- /package/dist/{chunk-DH3V7RCQ.js.map → chunk-F2ERDKY2.js.map} +0 -0
- /package/dist/{chunk-LJNLLNEM.js.map → chunk-HODFGQGT.js.map} +0 -0
- /package/dist/{chunk-B75VCEX5.js.map → chunk-K2IJH4D3.js.map} +0 -0
- /package/dist/{chunk-227WJVPY.js.map → chunk-KLSPKMIO.js.map} +0 -0
- /package/dist/{chunk-5P2KNFJZ.js.map → chunk-MSDIETFC.js.map} +0 -0
- /package/dist/{chunk-HFRGCNFY.js.map → chunk-OAKATRAN.js.map} +0 -0
- /package/dist/{chunk-LWBSEYW3.js.map → chunk-PAWIY5OQ.js.map} +0 -0
- /package/dist/{chunk-6TOWUN2R.js.map → chunk-RE3H6Y2X.js.map} +0 -0
- /package/dist/{chunk-V3HUBF7T.js.map → chunk-S35IIP5P.js.map} +0 -0
- /package/dist/{chunk-3YKOFCKP.js.map → chunk-SXHBZXHK.js.map} +0 -0
- /package/dist/{chunk-7NCUHD5U.js.map → chunk-VAMZYOOV.js.map} +0 -0
- /package/dist/{chunk-PGCZLHRB.js.map → chunk-W272SWN7.js.map} +0 -0
- /package/dist/{chunk-5HO3QBAD.js.map → chunk-W6GEMUZM.js.map} +0 -0
- /package/dist/{chunk-UCNQV43K.js.map → chunk-XQYTSZW3.js.map} +0 -0
- /package/dist/{chunk-GR4C3FHT.js.map → chunk-ZKZCJRRO.js.map} +0 -0
|
@@ -29,22 +29,40 @@ export function applyManagedRegion(
|
|
|
29
29
|
|
|
30
30
|
const startMarker = `<!-- remnic:${opts.name}:start -->`;
|
|
31
31
|
const endMarker = `<!-- remnic:${opts.name}:end -->`;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
// Markers are owned only outside a code block — fenced or indented: a
|
|
33
|
+
// complete pair inside a ``` or four-space-indented example is sample
|
|
34
|
+
// text the user wrote, and replacing between it would overwrite their
|
|
35
|
+
// bytes (issue #1985).
|
|
36
|
+
const rows = fileLines(fileText);
|
|
37
|
+
let startRow: FileLine | undefined;
|
|
38
|
+
let endRow: FileLine | undefined;
|
|
39
|
+
for (const row of rows) {
|
|
40
|
+
if (row.fenced) continue;
|
|
41
|
+
const trimmed = row.line.trim();
|
|
42
|
+
if (startRow === undefined) {
|
|
43
|
+
if (trimmed === startMarker) startRow = row;
|
|
44
|
+
} else if (endRow === undefined && trimmed === endMarker) {
|
|
45
|
+
endRow = row;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (startRow === undefined || endRow === undefined) {
|
|
50
|
+
return { ok: false, reason: "no_marker", text: fileText };
|
|
51
|
+
}
|
|
36
52
|
|
|
37
53
|
const { body, eol } = ownedBody(fileText, opts.content);
|
|
38
54
|
return {
|
|
39
55
|
ok: true,
|
|
40
|
-
text: `${fileText.slice(0,
|
|
56
|
+
text: `${fileText.slice(0, startRow.start + startRow.line.length)}${eol}${body}${eol}${fileText.slice(endRow.start)}`,
|
|
41
57
|
};
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
function applyHeadingRegion(fileText: string, name: string, content: string): ApplyManagedRegionResult {
|
|
45
61
|
const wanted = name.trim();
|
|
62
|
+
const rows = fileLines(fileText);
|
|
46
63
|
const hits: Array<{ line: number; level: number; next: number }> = [];
|
|
47
|
-
for (const row of
|
|
64
|
+
for (const row of rows) {
|
|
65
|
+
if (row.fenced) continue;
|
|
48
66
|
const heading = parseAtxHeading(row.line);
|
|
49
67
|
if (heading && heading.text === wanted) {
|
|
50
68
|
hits.push({ line: row.number, level: heading.level, next: row.next });
|
|
@@ -57,8 +75,8 @@ function applyHeadingRegion(fileText: string, name: string, content: string): Ap
|
|
|
57
75
|
|
|
58
76
|
const hit = hits[0]!;
|
|
59
77
|
let sectionEnd = fileText.length;
|
|
60
|
-
for (const row of
|
|
61
|
-
if (row.start < hit.next) continue;
|
|
78
|
+
for (const row of rows) {
|
|
79
|
+
if (row.start < hit.next || row.fenced) continue;
|
|
62
80
|
const heading = parseAtxHeading(row.line);
|
|
63
81
|
if (heading && heading.level <= hit.level) {
|
|
64
82
|
sectionEnd = row.start;
|
|
@@ -66,7 +84,7 @@ function applyHeadingRegion(fileText: string, name: string, content: string): Ap
|
|
|
66
84
|
}
|
|
67
85
|
}
|
|
68
86
|
|
|
69
|
-
const { body, eol } = ownedBody(fileText, content);
|
|
87
|
+
const { body, eol } = ownedBody(fileText, demoteOwnedHeadings(content, hit.level));
|
|
70
88
|
const prefix =
|
|
71
89
|
hit.next === fileText.length && !fileText.endsWith("\n") && !fileText.endsWith("\r")
|
|
72
90
|
? `${fileText}${eol}`
|
|
@@ -74,6 +92,32 @@ function applyHeadingRegion(fileText: string, name: string, content: string): Ap
|
|
|
74
92
|
return { ok: true, text: `${prefix}${body}${eol}${fileText.slice(sectionEnd)}` };
|
|
75
93
|
}
|
|
76
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Re-level every ATX heading in the owned content so it sits strictly
|
|
97
|
+
* below the owning heading (issue #1985 review). A published recap that
|
|
98
|
+
* itself starts with `#`/`##` headings would otherwise terminate its own
|
|
99
|
+
* managed region on the NEXT publish — the new copy lands before the old
|
|
100
|
+
* heading and each republish leaves a stale duplicate behind. New level is
|
|
101
|
+
* owning + original, clamped at six. A level-6 owning heading has no
|
|
102
|
+
* deeper ATX level, so its owned headings flatten to bold text — still
|
|
103
|
+
* rendered, never a terminator. Headings inside fenced or indented code
|
|
104
|
+
* are content, not structure, and pass through untouched.
|
|
105
|
+
*/
|
|
106
|
+
function demoteOwnedHeadings(content: string, owningLevel: number): string {
|
|
107
|
+
const rows = fileLines(content);
|
|
108
|
+
let out = "";
|
|
109
|
+
let cursor = 0;
|
|
110
|
+
for (const row of rows) {
|
|
111
|
+
const heading = row.fenced ? null : parseAtxHeading(row.line);
|
|
112
|
+
if (heading === null) continue;
|
|
113
|
+
const level = Math.min(owningLevel + heading.level, 6);
|
|
114
|
+
const replacement = level > owningLevel ? `${"#".repeat(level)} ${heading.text}` : `**${heading.text}**`;
|
|
115
|
+
out += content.slice(cursor, row.start) + replacement;
|
|
116
|
+
cursor = row.start + row.line.length;
|
|
117
|
+
}
|
|
118
|
+
return out + content.slice(cursor);
|
|
119
|
+
}
|
|
120
|
+
|
|
77
121
|
function ownedBody(fileText: string, content: string): { body: string; eol: string } {
|
|
78
122
|
const eol = fileText.includes("\r\n") ? "\r\n" : "\n";
|
|
79
123
|
let body = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
@@ -82,10 +126,44 @@ function ownedBody(fileText: string, content: string): { body: string; eol: stri
|
|
|
82
126
|
return { body, eol };
|
|
83
127
|
}
|
|
84
128
|
|
|
85
|
-
|
|
86
|
-
|
|
129
|
+
export interface FileLine {
|
|
130
|
+
line: string;
|
|
131
|
+
start: number;
|
|
132
|
+
next: number;
|
|
133
|
+
number: number;
|
|
134
|
+
/** True inside a fenced or indented code block, delimiter lines included. */
|
|
135
|
+
fenced: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The one shared code-aware line scanner (issue #1985): marker discovery,
|
|
140
|
+
* marker replacement, mismatch scanning, and heading insertion all classify
|
|
141
|
+
* lines through it, so code examples are invisible to every scan.
|
|
142
|
+
*
|
|
143
|
+
* A line is code when a fence is open, or when its own indentation reaches
|
|
144
|
+
* four columns (CommonMark indented code block; one tab covers all four).
|
|
145
|
+
* Classification reads the RAW line — no consumer trims first — so the
|
|
146
|
+
* indentation cannot be erased before it is seen.
|
|
147
|
+
*
|
|
148
|
+
* Two deliberate simplifications, both resolving toward "code" (skip):
|
|
149
|
+
* - CommonMark lets an indented line lazily continue an open paragraph
|
|
150
|
+
* instead of opening a code block; we still call it code.
|
|
151
|
+
* - CommonMark measures indentation relative to the containing block, so
|
|
152
|
+
* a marker indented under a list item can be live content; we call it
|
|
153
|
+
* code. Distinguishing either case needs full block tracking.
|
|
154
|
+
* Skipping a line refuses a publish; mis-reading one as live overwrites the
|
|
155
|
+
* user's bytes. The refusal is recoverable, the overwrite is not.
|
|
156
|
+
*
|
|
157
|
+
* A fence delimiter run is only live at indent < 4: deeper, the run is
|
|
158
|
+
* literal text inside an indented code block (and inside an open fence a
|
|
159
|
+
* 4+-indented closing run is content, not a closer), so `fenceRun` never
|
|
160
|
+
* sees an indented line.
|
|
161
|
+
*/
|
|
162
|
+
export function fileLines(fileText: string): FileLine[] {
|
|
163
|
+
const rows: FileLine[] = [];
|
|
87
164
|
let start = 0;
|
|
88
165
|
let number = 1;
|
|
166
|
+
let fence: { char: string; len: number } | null = null;
|
|
89
167
|
while (start < fileText.length) {
|
|
90
168
|
let i = start;
|
|
91
169
|
while (i < fileText.length && fileText[i] !== "\n" && fileText[i] !== "\r") i++;
|
|
@@ -93,28 +171,90 @@ function fileLines(fileText: string): Array<{ line: string; start: number; next:
|
|
|
93
171
|
if (fileText[i] === "\r" && fileText[i + 1] === "\n") next = i + 2;
|
|
94
172
|
else if (fileText[i] === "\n" || fileText[i] === "\r") next = i + 1;
|
|
95
173
|
else next = fileText.length;
|
|
96
|
-
|
|
174
|
+
const line = fileText.slice(start, i);
|
|
175
|
+
|
|
176
|
+
const indentedCode = indentColumn(line) >= 4;
|
|
177
|
+
const run = indentedCode ? null : fenceRun(line);
|
|
178
|
+
let fenced: boolean;
|
|
179
|
+
if (fence === null) {
|
|
180
|
+
// A backtick fence's info string may not contain a backtick, so a
|
|
181
|
+
// ``` ` ``` run with one is not an opening delimiter.
|
|
182
|
+
if (run !== null && !(run.char === "`" && run.info.includes("`"))) {
|
|
183
|
+
fence = { char: run.char, len: run.len };
|
|
184
|
+
}
|
|
185
|
+
fenced = fence !== null || indentedCode;
|
|
186
|
+
} else {
|
|
187
|
+
fenced = true;
|
|
188
|
+
if (run !== null && run.char === fence.char && run.len >= fence.len && run.info.length === 0) {
|
|
189
|
+
fence = null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
rows.push({ line, start, next, number, fenced });
|
|
97
194
|
number += 1;
|
|
98
195
|
start = next;
|
|
99
196
|
}
|
|
100
197
|
return rows;
|
|
101
198
|
}
|
|
102
199
|
|
|
103
|
-
|
|
200
|
+
/**
|
|
201
|
+
* The column a line's first non-whitespace character sits at: spaces count
|
|
202
|
+
* one, a tab advances to the next multiple of four (CommonMark tab handling).
|
|
203
|
+
*/
|
|
204
|
+
function indentColumn(line: string): number {
|
|
205
|
+
let col = 0;
|
|
206
|
+
for (let i = 0; i < line.length; i += 1) {
|
|
207
|
+
const ch = line[i];
|
|
208
|
+
if (ch === " ") col += 1;
|
|
209
|
+
else if (ch === "\t") col += 4 - (col % 4);
|
|
210
|
+
else break;
|
|
211
|
+
}
|
|
212
|
+
return col;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* A fence delimiter run: three or more backticks or tildes at the line's
|
|
217
|
+
* start (leading whitespace allowed), plus the trailing info string. An
|
|
218
|
+
* unterminated fence therefore keeps every following line fenced, which
|
|
219
|
+
* makes a malformed note refuse to publish instead of overwriting bytes.
|
|
220
|
+
*/
|
|
221
|
+
function fenceRun(line: string): { char: string; len: number; info: string } | null {
|
|
222
|
+
const body = line.trimStart();
|
|
223
|
+
const char = body[0];
|
|
224
|
+
if (char !== "`" && char !== "~") return null;
|
|
225
|
+
let len = 0;
|
|
226
|
+
while (len < body.length && body[len] === char) len++;
|
|
227
|
+
if (len < 3) return null;
|
|
228
|
+
return { char, len, info: body.slice(len).trim() };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export function parseAtxHeading(line: string): { level: number; text: string } | null {
|
|
232
|
+
// CommonMark permits up to three columns of indentation before the
|
|
233
|
+
// hashes; the fourth column is an indented code block, which
|
|
234
|
+
// `fileLines` already classifies as fenced (a tab advances to the
|
|
235
|
+
// next multiple of four, matching `indentColumn`). Replacement and
|
|
236
|
+
// insertion both scan headings through this one parser.
|
|
237
|
+
let at = 0;
|
|
238
|
+
let indent = 0;
|
|
239
|
+
while (at < line.length && (line[at] === " " || line[at] === "\t")) {
|
|
240
|
+
indent += line[at] === " " ? 1 : 4 - (indent % 4);
|
|
241
|
+
if (indent >= 4) return null;
|
|
242
|
+
at += 1;
|
|
243
|
+
}
|
|
104
244
|
let level = 0;
|
|
105
|
-
while (level <
|
|
245
|
+
while (level < 6 && line[at + level] === "#") level++;
|
|
106
246
|
if (level === 0) return null;
|
|
107
|
-
const after = line[level];
|
|
247
|
+
const after = line[at + level];
|
|
108
248
|
if (after !== " " && after !== "\t") return null;
|
|
109
249
|
|
|
110
|
-
let start = level + 1;
|
|
250
|
+
let start = at + level + 1;
|
|
111
251
|
let end = line.length;
|
|
112
252
|
while (start < end && (line[start] === " " || line[start] === "\t")) start++;
|
|
113
253
|
while (end > start && (line[end - 1] === " " || line[end - 1] === "\t")) end--;
|
|
114
254
|
|
|
115
255
|
let hashEnd = end;
|
|
116
256
|
while (hashEnd > start && line[hashEnd - 1] === "#") hashEnd--;
|
|
117
|
-
if (hashEnd < end && hashEnd > start && (line[hashEnd - 1] === " " || line[
|
|
257
|
+
if (hashEnd < end && hashEnd > start && (line[hashEnd - 1] === " " || line[end - 1] === "\t")) {
|
|
118
258
|
end = hashEnd;
|
|
119
259
|
while (end > start && (line[end - 1] === " " || line[end - 1] === "\t")) end--;
|
|
120
260
|
}
|