@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
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
buildResumeBundleFromState,
|
|
102
102
|
getResumeBundleStatus,
|
|
103
103
|
recordResumeBundle
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-ZKZCJRRO.js";
|
|
105
105
|
import {
|
|
106
106
|
getWorkProductLedgerStatus,
|
|
107
107
|
recordWorkProductLedgerEntry,
|
|
@@ -134,7 +134,7 @@ import {
|
|
|
134
134
|
runOperatorInventory,
|
|
135
135
|
runOperatorRepair,
|
|
136
136
|
runOperatorSetup
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-OAKATRAN.js";
|
|
138
138
|
import {
|
|
139
139
|
analyzeSessionIntegrity,
|
|
140
140
|
applySessionRepair,
|
|
@@ -197,11 +197,16 @@ import {
|
|
|
197
197
|
} from "./chunk-6TBIWIAG.js";
|
|
198
198
|
import {
|
|
199
199
|
parseConfig
|
|
200
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-W272SWN7.js";
|
|
201
|
+
import {
|
|
202
|
+
expandVaultTemplateTokens,
|
|
203
|
+
resolveVaultNotePath,
|
|
204
|
+
validateRegionName
|
|
205
|
+
} from "./chunk-OGUKSLYZ.js";
|
|
201
206
|
import {
|
|
202
207
|
EngramAccessHttpServer,
|
|
203
208
|
MeetingsInputError
|
|
204
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-F2ERDKY2.js";
|
|
205
210
|
import {
|
|
206
211
|
WearablesInputError
|
|
207
212
|
} from "./chunk-V7IZKJI3.js";
|
|
@@ -211,10 +216,11 @@ import {
|
|
|
211
216
|
loadChatSession,
|
|
212
217
|
processChatMessage,
|
|
213
218
|
sessionBelongsToPrincipal
|
|
214
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-W6GEMUZM.js";
|
|
215
220
|
import {
|
|
216
|
-
EngramAccessService
|
|
217
|
-
|
|
221
|
+
EngramAccessService,
|
|
222
|
+
journalPath
|
|
223
|
+
} from "./chunk-MSDIETFC.js";
|
|
218
224
|
import {
|
|
219
225
|
WorkStorage
|
|
220
226
|
} from "./chunk-GDB4J2H3.js";
|
|
@@ -310,6 +316,10 @@ import {
|
|
|
310
316
|
import {
|
|
311
317
|
getCausalTrajectoryStoreStatus
|
|
312
318
|
} from "./chunk-P6GKRT2H.js";
|
|
319
|
+
import {
|
|
320
|
+
activityDateInTimezone,
|
|
321
|
+
isValidActivityDate
|
|
322
|
+
} from "./chunk-P6FHFTZ7.js";
|
|
313
323
|
import {
|
|
314
324
|
padEndDisplay,
|
|
315
325
|
truncateGraphemeSafe
|
|
@@ -379,9 +389,9 @@ import {
|
|
|
379
389
|
} from "./chunk-3WCASNQZ.js";
|
|
380
390
|
|
|
381
391
|
// src/cli.ts
|
|
382
|
-
import
|
|
392
|
+
import path8 from "path";
|
|
383
393
|
import { access, lstat as lstat3, readFile as readFile2, readdir as readdir3, realpath as realpath3, unlink } from "fs/promises";
|
|
384
|
-
import { createHash } from "crypto";
|
|
394
|
+
import { createHash as createHash3 } from "crypto";
|
|
385
395
|
|
|
386
396
|
// src/wearables/registry.ts
|
|
387
397
|
var registrations = /* @__PURE__ */ new Map();
|
|
@@ -2058,11 +2068,800 @@ function registerCreationLedgerCommands(cmd, orchestrator) {
|
|
|
2058
2068
|
});
|
|
2059
2069
|
}
|
|
2060
2070
|
|
|
2061
|
-
// src/
|
|
2071
|
+
// src/activity/timeline/publish-cli.ts
|
|
2072
|
+
import { existsSync, readFileSync as readFileSync4 } from "fs";
|
|
2073
|
+
|
|
2074
|
+
// src/activity/vault-publisher.ts
|
|
2075
|
+
import { createHash as createHash2, randomBytes as randomBytes2 } from "crypto";
|
|
2076
|
+
import { chmodSync, chownSync, lstatSync, mkdirSync, readFileSync as readFileSync3, realpathSync, renameSync as renameSync2, statSync as statSync3, unlinkSync as unlinkSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
2077
|
+
import path5 from "path";
|
|
2078
|
+
|
|
2079
|
+
// src/activity/vault-publish.ts
|
|
2080
|
+
import { createHash, randomBytes } from "crypto";
|
|
2081
|
+
import { readFileSync as readFileSync2, renameSync, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync } from "fs";
|
|
2062
2082
|
import path4 from "path";
|
|
2083
|
+
function applyManagedRegion(fileText, opts) {
|
|
2084
|
+
if (opts.strategy === "heading") return applyHeadingRegion(fileText, opts.name, opts.content);
|
|
2085
|
+
const startMarker = `<!-- remnic:${opts.name}:start -->`;
|
|
2086
|
+
const endMarker = `<!-- remnic:${opts.name}:end -->`;
|
|
2087
|
+
const rows = fileLines(fileText);
|
|
2088
|
+
let startRow;
|
|
2089
|
+
let endRow;
|
|
2090
|
+
for (const row of rows) {
|
|
2091
|
+
if (row.fenced) continue;
|
|
2092
|
+
const trimmed = row.line.trim();
|
|
2093
|
+
if (startRow === void 0) {
|
|
2094
|
+
if (trimmed === startMarker) startRow = row;
|
|
2095
|
+
} else if (endRow === void 0 && trimmed === endMarker) {
|
|
2096
|
+
endRow = row;
|
|
2097
|
+
break;
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
if (startRow === void 0 || endRow === void 0) {
|
|
2101
|
+
return { ok: false, reason: "no_marker", text: fileText };
|
|
2102
|
+
}
|
|
2103
|
+
const { body, eol } = ownedBody(fileText, opts.content);
|
|
2104
|
+
return {
|
|
2105
|
+
ok: true,
|
|
2106
|
+
text: `${fileText.slice(0, startRow.start + startRow.line.length)}${eol}${body}${eol}${fileText.slice(endRow.start)}`
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
function applyHeadingRegion(fileText, name, content) {
|
|
2110
|
+
const wanted = name.trim();
|
|
2111
|
+
const rows = fileLines(fileText);
|
|
2112
|
+
const hits = [];
|
|
2113
|
+
for (const row of rows) {
|
|
2114
|
+
if (row.fenced) continue;
|
|
2115
|
+
const heading = parseAtxHeading(row.line);
|
|
2116
|
+
if (heading && heading.text === wanted) {
|
|
2117
|
+
hits.push({ line: row.number, level: heading.level, next: row.next });
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
if (hits.length === 0) return { ok: false, reason: "no_heading", text: fileText };
|
|
2121
|
+
if (hits.length > 1) {
|
|
2122
|
+
return { ok: false, reason: "duplicate_heading", lines: hits.map((hit2) => hit2.line), text: fileText };
|
|
2123
|
+
}
|
|
2124
|
+
const hit = hits[0];
|
|
2125
|
+
let sectionEnd = fileText.length;
|
|
2126
|
+
for (const row of rows) {
|
|
2127
|
+
if (row.start < hit.next || row.fenced) continue;
|
|
2128
|
+
const heading = parseAtxHeading(row.line);
|
|
2129
|
+
if (heading && heading.level <= hit.level) {
|
|
2130
|
+
sectionEnd = row.start;
|
|
2131
|
+
break;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
const { body, eol } = ownedBody(fileText, demoteOwnedHeadings(content, hit.level));
|
|
2135
|
+
const prefix = hit.next === fileText.length && !fileText.endsWith("\n") && !fileText.endsWith("\r") ? `${fileText}${eol}` : fileText.slice(0, hit.next);
|
|
2136
|
+
return { ok: true, text: `${prefix}${body}${eol}${fileText.slice(sectionEnd)}` };
|
|
2137
|
+
}
|
|
2138
|
+
function demoteOwnedHeadings(content, owningLevel) {
|
|
2139
|
+
const rows = fileLines(content);
|
|
2140
|
+
let out = "";
|
|
2141
|
+
let cursor = 0;
|
|
2142
|
+
for (const row of rows) {
|
|
2143
|
+
const heading = row.fenced ? null : parseAtxHeading(row.line);
|
|
2144
|
+
if (heading === null) continue;
|
|
2145
|
+
const level = Math.min(owningLevel + heading.level, 6);
|
|
2146
|
+
const replacement = level > owningLevel ? `${"#".repeat(level)} ${heading.text}` : `**${heading.text}**`;
|
|
2147
|
+
out += content.slice(cursor, row.start) + replacement;
|
|
2148
|
+
cursor = row.start + row.line.length;
|
|
2149
|
+
}
|
|
2150
|
+
return out + content.slice(cursor);
|
|
2151
|
+
}
|
|
2152
|
+
function ownedBody(fileText, content) {
|
|
2153
|
+
const eol = fileText.includes("\r\n") ? "\r\n" : "\n";
|
|
2154
|
+
let body = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2155
|
+
if (eol === "\r\n") body = body.replace(/\n/g, "\r\n");
|
|
2156
|
+
if (body.endsWith(eol)) body = body.slice(0, -eol.length);
|
|
2157
|
+
return { body, eol };
|
|
2158
|
+
}
|
|
2159
|
+
function fileLines(fileText) {
|
|
2160
|
+
const rows = [];
|
|
2161
|
+
let start = 0;
|
|
2162
|
+
let number = 1;
|
|
2163
|
+
let fence = null;
|
|
2164
|
+
while (start < fileText.length) {
|
|
2165
|
+
let i = start;
|
|
2166
|
+
while (i < fileText.length && fileText[i] !== "\n" && fileText[i] !== "\r") i++;
|
|
2167
|
+
let next = i;
|
|
2168
|
+
if (fileText[i] === "\r" && fileText[i + 1] === "\n") next = i + 2;
|
|
2169
|
+
else if (fileText[i] === "\n" || fileText[i] === "\r") next = i + 1;
|
|
2170
|
+
else next = fileText.length;
|
|
2171
|
+
const line = fileText.slice(start, i);
|
|
2172
|
+
const indentedCode = indentColumn(line) >= 4;
|
|
2173
|
+
const run = indentedCode ? null : fenceRun(line);
|
|
2174
|
+
let fenced;
|
|
2175
|
+
if (fence === null) {
|
|
2176
|
+
if (run !== null && !(run.char === "`" && run.info.includes("`"))) {
|
|
2177
|
+
fence = { char: run.char, len: run.len };
|
|
2178
|
+
}
|
|
2179
|
+
fenced = fence !== null || indentedCode;
|
|
2180
|
+
} else {
|
|
2181
|
+
fenced = true;
|
|
2182
|
+
if (run !== null && run.char === fence.char && run.len >= fence.len && run.info.length === 0) {
|
|
2183
|
+
fence = null;
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
rows.push({ line, start, next, number, fenced });
|
|
2187
|
+
number += 1;
|
|
2188
|
+
start = next;
|
|
2189
|
+
}
|
|
2190
|
+
return rows;
|
|
2191
|
+
}
|
|
2192
|
+
function indentColumn(line) {
|
|
2193
|
+
let col = 0;
|
|
2194
|
+
for (let i = 0; i < line.length; i += 1) {
|
|
2195
|
+
const ch = line[i];
|
|
2196
|
+
if (ch === " ") col += 1;
|
|
2197
|
+
else if (ch === " ") col += 4 - col % 4;
|
|
2198
|
+
else break;
|
|
2199
|
+
}
|
|
2200
|
+
return col;
|
|
2201
|
+
}
|
|
2202
|
+
function fenceRun(line) {
|
|
2203
|
+
const body = line.trimStart();
|
|
2204
|
+
const char = body[0];
|
|
2205
|
+
if (char !== "`" && char !== "~") return null;
|
|
2206
|
+
let len = 0;
|
|
2207
|
+
while (len < body.length && body[len] === char) len++;
|
|
2208
|
+
if (len < 3) return null;
|
|
2209
|
+
return { char, len, info: body.slice(len).trim() };
|
|
2210
|
+
}
|
|
2211
|
+
function parseAtxHeading(line) {
|
|
2212
|
+
let at = 0;
|
|
2213
|
+
let indent = 0;
|
|
2214
|
+
while (at < line.length && (line[at] === " " || line[at] === " ")) {
|
|
2215
|
+
indent += line[at] === " " ? 1 : 4 - indent % 4;
|
|
2216
|
+
if (indent >= 4) return null;
|
|
2217
|
+
at += 1;
|
|
2218
|
+
}
|
|
2219
|
+
let level = 0;
|
|
2220
|
+
while (level < 6 && line[at + level] === "#") level++;
|
|
2221
|
+
if (level === 0) return null;
|
|
2222
|
+
const after = line[at + level];
|
|
2223
|
+
if (after !== " " && after !== " ") return null;
|
|
2224
|
+
let start = at + level + 1;
|
|
2225
|
+
let end = line.length;
|
|
2226
|
+
while (start < end && (line[start] === " " || line[start] === " ")) start++;
|
|
2227
|
+
while (end > start && (line[end - 1] === " " || line[end - 1] === " ")) end--;
|
|
2228
|
+
let hashEnd = end;
|
|
2229
|
+
while (hashEnd > start && line[hashEnd - 1] === "#") hashEnd--;
|
|
2230
|
+
if (hashEnd < end && hashEnd > start && (line[hashEnd - 1] === " " || line[end - 1] === " ")) {
|
|
2231
|
+
end = hashEnd;
|
|
2232
|
+
while (end > start && (line[end - 1] === " " || line[end - 1] === " ")) end--;
|
|
2233
|
+
}
|
|
2234
|
+
return { level, text: line.slice(start, end) };
|
|
2235
|
+
}
|
|
2236
|
+
function publishVaultRegion(input) {
|
|
2237
|
+
const vault = expandTildePath(input.vaultPath);
|
|
2238
|
+
try {
|
|
2239
|
+
if (!statSync2(vault).isDirectory()) return { ok: false, reason: "not_directory" };
|
|
2240
|
+
} catch {
|
|
2241
|
+
return { ok: false, reason: "not_directory" };
|
|
2242
|
+
}
|
|
2243
|
+
if (input.relativeFile.length === 0 || path4.isAbsolute(input.relativeFile)) {
|
|
2244
|
+
return { ok: false, reason: "missing_file" };
|
|
2245
|
+
}
|
|
2246
|
+
const root = path4.resolve(vault);
|
|
2247
|
+
const dest = path4.resolve(root, input.relativeFile);
|
|
2248
|
+
const rel = path4.relative(root, dest);
|
|
2249
|
+
if (rel.length === 0 || rel.startsWith("..") || path4.isAbsolute(rel)) {
|
|
2250
|
+
return { ok: false, reason: "missing_file" };
|
|
2251
|
+
}
|
|
2252
|
+
let existing;
|
|
2253
|
+
try {
|
|
2254
|
+
if (!statSync2(dest).isFile()) return { ok: false, reason: "missing_file" };
|
|
2255
|
+
existing = readFileSync2(dest, "utf8");
|
|
2256
|
+
} catch (err) {
|
|
2257
|
+
if (err.code === "ENOENT") return { ok: false, reason: "missing_file" };
|
|
2258
|
+
throw err;
|
|
2259
|
+
}
|
|
2260
|
+
const applied = applyManagedRegion(existing, {
|
|
2261
|
+
strategy: "markers",
|
|
2262
|
+
name: input.name,
|
|
2263
|
+
content: input.content
|
|
2264
|
+
});
|
|
2265
|
+
if (!applied.ok) return { ok: false, reason: "no_marker" };
|
|
2266
|
+
const prevHash = createHash("sha256").update(existing, "utf8").digest("hex");
|
|
2267
|
+
const nextHash = createHash("sha256").update(applied.text, "utf8").digest("hex");
|
|
2268
|
+
if (prevHash === nextHash) return { ok: true, status: "unchanged" };
|
|
2269
|
+
const tmpPath = path4.join(path4.dirname(dest), `.remnic-vault-${randomBytes(8).toString("hex")}.tmp`);
|
|
2270
|
+
writeFileSync(tmpPath, applied.text);
|
|
2271
|
+
try {
|
|
2272
|
+
renameSync(tmpPath, dest);
|
|
2273
|
+
} catch (renameErr) {
|
|
2274
|
+
try {
|
|
2275
|
+
unlinkSync2(tmpPath);
|
|
2276
|
+
} catch {
|
|
2277
|
+
}
|
|
2278
|
+
throw renameErr;
|
|
2279
|
+
}
|
|
2280
|
+
return { ok: true, status: "updated" };
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
// src/activity/vault-insert.ts
|
|
2284
|
+
function insertMarkersUnderHeading(fileText, opts) {
|
|
2285
|
+
if (typeof opts.heading !== "string" || opts.heading.length === 0) {
|
|
2286
|
+
throw new RangeError("Heading must be non-empty.");
|
|
2287
|
+
}
|
|
2288
|
+
if (typeof opts.name !== "string" || opts.name.length === 0) {
|
|
2289
|
+
throw new RangeError("Region name must be non-empty.");
|
|
2290
|
+
}
|
|
2291
|
+
const startMarker = `<!-- remnic:${opts.name}:start -->`;
|
|
2292
|
+
const endMarker = `<!-- remnic:${opts.name}:end -->`;
|
|
2293
|
+
const rows = fileLines(fileText);
|
|
2294
|
+
const present = rows.some((row) => !row.fenced && row.line.includes(startMarker)) && rows.some((row) => !row.fenced && row.line.includes(endMarker));
|
|
2295
|
+
if (present) return { ok: true, text: fileText, inserted: false };
|
|
2296
|
+
const hits = [];
|
|
2297
|
+
for (const row of rows) {
|
|
2298
|
+
if (row.fenced) continue;
|
|
2299
|
+
const heading = parseAtxHeading(row.line);
|
|
2300
|
+
if (heading && heading.text === opts.heading) {
|
|
2301
|
+
hits.push({ row, level: heading.level });
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
if (hits.length === 0) return { ok: false, reason: "no_heading", text: fileText };
|
|
2305
|
+
if (hits.length > 1) {
|
|
2306
|
+
return { ok: false, reason: "duplicate_heading", lines: hits.map((hit2) => hit2.row.number), text: fileText };
|
|
2307
|
+
}
|
|
2308
|
+
const hit = hits[0];
|
|
2309
|
+
const eol = fileText.includes("\r\n") ? "\r\n" : "\n";
|
|
2310
|
+
const prefix = hit.row.next === fileText.length && !fileText.endsWith("\n") && !fileText.endsWith("\r") ? `${fileText}${eol}` : fileText.slice(0, hit.row.next);
|
|
2311
|
+
let content = opts.content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2312
|
+
if (eol === "\r\n") content = content.replace(/\n/g, "\r\n");
|
|
2313
|
+
if (content.length > 0 && !content.endsWith(eol)) content += eol;
|
|
2314
|
+
const text = `${prefix}${startMarker}${eol}${content}${endMarker}${eol}${fileText.slice(hit.row.next)}`;
|
|
2315
|
+
return { ok: true, text, inserted: true };
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
// src/activity/vault-region-pair.ts
|
|
2319
|
+
function assertBeginEndPair({ beginName, endName }) {
|
|
2320
|
+
const begin = beginName.trim();
|
|
2321
|
+
const end = endName.trim();
|
|
2322
|
+
if (begin.length === 0 || end.length === 0) {
|
|
2323
|
+
throw new RangeError("Region name must be non-empty.");
|
|
2324
|
+
}
|
|
2325
|
+
if (begin !== end) {
|
|
2326
|
+
return { ok: false, error: "name_mismatch" };
|
|
2327
|
+
}
|
|
2328
|
+
return { ok: true };
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
// src/activity/vault-status.ts
|
|
2332
|
+
var VAULT_PUBLISH_OUTCOMES = ["updated", "unchanged", "skipped", "error"];
|
|
2333
|
+
function compareEntries(a, b) {
|
|
2334
|
+
if (a.path !== b.path) return a.path < b.path ? -1 : 1;
|
|
2335
|
+
const rankA = VAULT_PUBLISH_OUTCOMES.indexOf(a.outcome);
|
|
2336
|
+
const rankB = VAULT_PUBLISH_OUTCOMES.indexOf(b.outcome);
|
|
2337
|
+
if (rankA !== rankB) return rankA < rankB ? -1 : 1;
|
|
2338
|
+
const reasonA = a.reason ?? "";
|
|
2339
|
+
const reasonB = b.reason ?? "";
|
|
2340
|
+
if (reasonA !== reasonB) return reasonA < reasonB ? -1 : 1;
|
|
2341
|
+
return 0;
|
|
2342
|
+
}
|
|
2343
|
+
function summarizeVaultPublish(results) {
|
|
2344
|
+
if (!Array.isArray(results)) {
|
|
2345
|
+
throw new TypeError(`summarizeVaultPublish expects an array of results (got ${typeof results})`);
|
|
2346
|
+
}
|
|
2347
|
+
const entries = [];
|
|
2348
|
+
for (const entry of results) {
|
|
2349
|
+
if (typeof entry !== "object" || entry === null) {
|
|
2350
|
+
throw new TypeError(`vault publish result entries must be objects (got ${typeof entry})`);
|
|
2351
|
+
}
|
|
2352
|
+
if (typeof entry.path !== "string" || entry.path.trim() === "") {
|
|
2353
|
+
throw new RangeError(`vault publish result requires a non-blank path (got ${JSON.stringify(entry.path)})`);
|
|
2354
|
+
}
|
|
2355
|
+
const outcome = VAULT_PUBLISH_OUTCOMES.find((candidate) => candidate === entry.outcome);
|
|
2356
|
+
if (outcome === void 0) {
|
|
2357
|
+
throw new TypeError(
|
|
2358
|
+
`unknown vault publish outcome ${JSON.stringify(entry.outcome)}; expected one of: ${VAULT_PUBLISH_OUTCOMES.join(", ")}`
|
|
2359
|
+
);
|
|
2360
|
+
}
|
|
2361
|
+
if (outcome === "skipped" || outcome === "error") {
|
|
2362
|
+
if (typeof entry.reason !== "string" || entry.reason.trim() === "") {
|
|
2363
|
+
throw new TypeError(
|
|
2364
|
+
`vault publish outcome "${outcome}" requires a non-blank reason, e.g. "no_marker" (got ${JSON.stringify(entry.reason)})`
|
|
2365
|
+
);
|
|
2366
|
+
}
|
|
2367
|
+
entries.push({ path: entry.path, outcome, reason: entry.reason });
|
|
2368
|
+
} else {
|
|
2369
|
+
if (entry.reason !== void 0) {
|
|
2370
|
+
throw new TypeError(
|
|
2371
|
+
`vault publish outcome "${outcome}" must not carry a reason (got ${JSON.stringify(entry.reason)})`
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
entries.push({ path: entry.path, outcome });
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
const sorted = [...entries].sort(compareEntries);
|
|
2378
|
+
const counts = {};
|
|
2379
|
+
for (const outcome of VAULT_PUBLISH_OUTCOMES) counts[outcome] = 0;
|
|
2380
|
+
for (const entry of sorted) counts[entry.outcome] += 1;
|
|
2381
|
+
return {
|
|
2382
|
+
results: sorted,
|
|
2383
|
+
counts,
|
|
2384
|
+
hasError: counts.error > 0
|
|
2385
|
+
};
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
// src/activity/vault-publisher.ts
|
|
2389
|
+
var START_MARKER_RE = /^<!--\s{0,8}remnic:(.+):start\s{0,8}-->$/;
|
|
2390
|
+
var END_MARKER_RE = /^<!--\s{0,8}remnic:(.+):end\s{0,8}-->$/;
|
|
2391
|
+
function publishVaultNote(input) {
|
|
2392
|
+
if (typeof input !== "object" || input === null) {
|
|
2393
|
+
throw new TypeError("publishVaultNote requires an input object.");
|
|
2394
|
+
}
|
|
2395
|
+
if (!Array.isArray(input.sections) || input.sections.length === 0) {
|
|
2396
|
+
throw new RangeError("publishVaultNote requires at least one section.");
|
|
2397
|
+
}
|
|
2398
|
+
const strategy = input.strategy ?? "markers";
|
|
2399
|
+
const propertiesMode = input.propertiesMode ?? "off";
|
|
2400
|
+
const prefix = input.propertiesPrefix ?? "remnic_";
|
|
2401
|
+
if (typeof prefix !== "string" || prefix.length === 0) {
|
|
2402
|
+
throw new RangeError("propertiesPrefix must be a non-empty string.");
|
|
2403
|
+
}
|
|
2404
|
+
for (const section of input.sections) {
|
|
2405
|
+
const name = validateRegionName(section.name);
|
|
2406
|
+
if (!name.ok) {
|
|
2407
|
+
throw new RangeError(`Section name ${JSON.stringify(section.name)} is not a valid region name.`);
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
const relative = resolveVaultNotePath(input.notePathTemplate, input.date);
|
|
2411
|
+
const result = publishRelative(input, relative, { strategy, propertiesMode, prefix });
|
|
2412
|
+
return summarizeVaultPublish(result);
|
|
2413
|
+
}
|
|
2414
|
+
function publishRelative(input, relative, opts) {
|
|
2415
|
+
const vault = expandTildePath(input.vaultPath);
|
|
2416
|
+
try {
|
|
2417
|
+
const rootStat = lstatSync(vault);
|
|
2418
|
+
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) return refuse(relative, "error", "not_directory");
|
|
2419
|
+
} catch {
|
|
2420
|
+
return refuse(relative, "error", "not_directory");
|
|
2421
|
+
}
|
|
2422
|
+
const root = path5.resolve(vault);
|
|
2423
|
+
const dest = path5.resolve(root, relative);
|
|
2424
|
+
const lexical = path5.relative(root, dest);
|
|
2425
|
+
if (lexical.length === 0 || lexical === ".." || lexical.startsWith(`..${path5.sep}`) || path5.isAbsolute(lexical)) {
|
|
2426
|
+
return refuse(relative, "error", "path_escape");
|
|
2427
|
+
}
|
|
2428
|
+
if (!containedBySymlinks(root, dest)) {
|
|
2429
|
+
return refuse(relative, "error", "symlink_escape");
|
|
2430
|
+
}
|
|
2431
|
+
let currentText = null;
|
|
2432
|
+
let expected = null;
|
|
2433
|
+
try {
|
|
2434
|
+
if (lstatSync(dest).isSymbolicLink()) {
|
|
2435
|
+
return refuse(relative, "error", "symlinked_note");
|
|
2436
|
+
}
|
|
2437
|
+
const st = statSync3(dest);
|
|
2438
|
+
if (st.isFile()) {
|
|
2439
|
+
currentText = readFileSync3(dest, "utf8");
|
|
2440
|
+
expected = {
|
|
2441
|
+
ino: st.ino,
|
|
2442
|
+
mtimeMs: st.mtimeMs,
|
|
2443
|
+
size: st.size,
|
|
2444
|
+
sha256: createHash2("sha256").update(currentText, "utf8").digest("hex")
|
|
2445
|
+
};
|
|
2446
|
+
} else return refuse(relative, "error", "not_a_file");
|
|
2447
|
+
} catch (err) {
|
|
2448
|
+
if (err.code !== "ENOENT") throw err;
|
|
2449
|
+
}
|
|
2450
|
+
let created = false;
|
|
2451
|
+
if (currentText === null) {
|
|
2452
|
+
if (input.createMissingNotes === true && typeof input.noteTemplate === "string" && input.noteTemplate.length > 0) {
|
|
2453
|
+
const templatePath = path5.resolve(root, input.noteTemplate);
|
|
2454
|
+
const templateRel = path5.relative(root, templatePath);
|
|
2455
|
+
if (templateRel === ".." || templateRel.startsWith(`..${path5.sep}`) || path5.isAbsolute(templateRel) || templateRel.length === 0 || !containedBySymlinks(root, templatePath)) {
|
|
2456
|
+
return refuse(relative, "error", "template_escape");
|
|
2457
|
+
}
|
|
2458
|
+
try {
|
|
2459
|
+
const templateText = readFileSync3(templatePath, "utf8");
|
|
2460
|
+
currentText = expandVaultTemplateTokens(templateText, input.date);
|
|
2461
|
+
if (!currentText.endsWith("\n")) currentText += "\n";
|
|
2462
|
+
created = true;
|
|
2463
|
+
} catch {
|
|
2464
|
+
return refuse(relative, "error", "template_unreadable");
|
|
2465
|
+
}
|
|
2466
|
+
} else {
|
|
2467
|
+
return refuse(relative, "skipped", "missing_file");
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
const original = currentText;
|
|
2471
|
+
let text = original;
|
|
2472
|
+
const failures = [];
|
|
2473
|
+
const appliedSections = [];
|
|
2474
|
+
for (const section of input.sections) {
|
|
2475
|
+
const prefixed = opts.propertiesMode === "off" || !section.properties ? void 0 : Object.fromEntries(
|
|
2476
|
+
Object.entries(section.properties).map(([key, value]) => [`${opts.prefix}${key}`, value])
|
|
2477
|
+
);
|
|
2478
|
+
const content = decorate(section, prefixed, opts.propertiesMode);
|
|
2479
|
+
const step = applySection(text, section, content, opts.strategy, input.insertUnderHeading, created);
|
|
2480
|
+
if (step.ok) {
|
|
2481
|
+
text = step.text;
|
|
2482
|
+
appliedSections.push(section);
|
|
2483
|
+
} else {
|
|
2484
|
+
failures.push({ outcome: step.outcome, reason: step.reason });
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
if (failures.length > 0 && appliedSections.length === 0) {
|
|
2488
|
+
const worst = failures.find((f) => f.outcome === "error") ?? failures[0];
|
|
2489
|
+
return [{ path: relative, outcome: worst.outcome, reason: failures.map((f) => f.reason).join("; ") }];
|
|
2490
|
+
}
|
|
2491
|
+
if (failures.some((f) => f.outcome === "error")) {
|
|
2492
|
+
return [{ path: relative, outcome: "error", reason: failures.map((f) => f.reason).join("; ") }];
|
|
2493
|
+
}
|
|
2494
|
+
const skippedReason = failures.length > 0 ? failures.map((f) => f.reason).join("; ") : void 0;
|
|
2495
|
+
const withSkipped = (rows) => skippedReason === void 0 ? rows : [...rows, { path: relative, outcome: "skipped", reason: skippedReason }];
|
|
2496
|
+
if (opts.propertiesMode === "frontmatter") {
|
|
2497
|
+
const updates = frontmatterUpdates(appliedSections, opts.prefix);
|
|
2498
|
+
if (Object.keys(updates).length > 0) {
|
|
2499
|
+
const merged = mergeFrontmatterKeys(text, updates);
|
|
2500
|
+
if (!merged.ok) {
|
|
2501
|
+
return [{ path: relative, outcome: "error", reason: merged.reason }];
|
|
2502
|
+
}
|
|
2503
|
+
text = merged.text;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
const prevHash = createHash2("sha256").update(original, "utf8").digest("hex");
|
|
2507
|
+
const nextHash = createHash2("sha256").update(text, "utf8").digest("hex");
|
|
2508
|
+
if (prevHash === nextHash) {
|
|
2509
|
+
return withSkipped([{ path: relative, outcome: "unchanged" }]);
|
|
2510
|
+
}
|
|
2511
|
+
if (input.dryRun === true) {
|
|
2512
|
+
return withSkipped([{ path: relative, outcome: "updated" }]);
|
|
2513
|
+
}
|
|
2514
|
+
if (created) {
|
|
2515
|
+
try {
|
|
2516
|
+
mkdirSync(path5.dirname(dest), { recursive: true });
|
|
2517
|
+
} catch {
|
|
2518
|
+
return refuse(relative, "error", "mkdir_failed");
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
const write = writeAtomic(dest, text, expected);
|
|
2522
|
+
if (write === "concurrent") {
|
|
2523
|
+
return [{ path: relative, outcome: "error", reason: "concurrent_write" }];
|
|
2524
|
+
}
|
|
2525
|
+
if (write !== "written") {
|
|
2526
|
+
return [{ path: relative, outcome: "error", reason: "rename_failed" }];
|
|
2527
|
+
}
|
|
2528
|
+
return withSkipped([{ path: relative, outcome: "updated" }]);
|
|
2529
|
+
}
|
|
2530
|
+
function refuse(relative, outcome, reason) {
|
|
2531
|
+
return [{ path: relative, outcome, reason }];
|
|
2532
|
+
}
|
|
2533
|
+
function decorate(section, prefixed, mode) {
|
|
2534
|
+
const parts = [section.content];
|
|
2535
|
+
if (prefixed !== void 0 && mode === "dataview-inline") {
|
|
2536
|
+
for (const [key, value] of Object.entries(prefixed)) {
|
|
2537
|
+
parts.push(`${key}:: ${value}`);
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
if (section.provenance !== void 0) {
|
|
2541
|
+
parts.push(
|
|
2542
|
+
`*(generated by Remnic timeline \xB7 ${section.provenance.generatorVersion} \xB7 ${section.provenance.generatedAt})*`
|
|
2543
|
+
);
|
|
2544
|
+
}
|
|
2545
|
+
return parts.join("\n");
|
|
2546
|
+
}
|
|
2547
|
+
function applySection(text, section, content, strategy, insertUnderHeading, freshNote) {
|
|
2548
|
+
if (strategy === "markers") {
|
|
2549
|
+
const mismatch = findMarkerMismatch(text);
|
|
2550
|
+
if (mismatch !== null) {
|
|
2551
|
+
return { ok: false, outcome: "skipped", reason: mismatch };
|
|
2552
|
+
}
|
|
2553
|
+
const applied2 = applyManagedRegion(text, { strategy: "markers", name: section.name, content });
|
|
2554
|
+
if (applied2.ok) return { ok: true, text: applied2.text };
|
|
2555
|
+
if (typeof insertUnderHeading === "string" && insertUnderHeading.length > 0) {
|
|
2556
|
+
const inserted = insertMarkersUnderHeading(text, {
|
|
2557
|
+
heading: insertUnderHeading,
|
|
2558
|
+
name: section.name,
|
|
2559
|
+
content
|
|
2560
|
+
});
|
|
2561
|
+
if (inserted.ok) return { ok: true, text: inserted.text };
|
|
2562
|
+
if (inserted.reason === "duplicate_heading") {
|
|
2563
|
+
return {
|
|
2564
|
+
ok: false,
|
|
2565
|
+
outcome: "error",
|
|
2566
|
+
reason: `duplicate_heading:${inserted.lines.join(",")}`
|
|
2567
|
+
};
|
|
2568
|
+
}
|
|
2569
|
+
return { ok: false, outcome: "skipped", reason: "no_marker" };
|
|
2570
|
+
}
|
|
2571
|
+
if (freshNote) {
|
|
2572
|
+
const suffix = `${text.endsWith("\n") ? "" : "\n"}<!-- remnic:${section.name}:start -->
|
|
2573
|
+
${content}
|
|
2574
|
+
<!-- remnic:${section.name}:end -->
|
|
2575
|
+
`;
|
|
2576
|
+
return { ok: true, text: text + suffix };
|
|
2577
|
+
}
|
|
2578
|
+
return { ok: false, outcome: "skipped", reason: "no_marker" };
|
|
2579
|
+
}
|
|
2580
|
+
const applied = applyManagedRegion(text, { strategy: "heading", name: section.name, content });
|
|
2581
|
+
if (applied.ok) return { ok: true, text: applied.text };
|
|
2582
|
+
if (applied.reason === "duplicate_heading") {
|
|
2583
|
+
return { ok: false, outcome: "error", reason: `duplicate_heading:${applied.lines.join(",")}` };
|
|
2584
|
+
}
|
|
2585
|
+
return { ok: false, outcome: "skipped", reason: "no_heading" };
|
|
2586
|
+
}
|
|
2587
|
+
function findMarkerMismatch(text) {
|
|
2588
|
+
let begin = null;
|
|
2589
|
+
for (const row of fileLines(text)) {
|
|
2590
|
+
if (row.fenced) continue;
|
|
2591
|
+
const trimmed = row.line.trim();
|
|
2592
|
+
const start = START_MARKER_RE.exec(trimmed);
|
|
2593
|
+
if (start) {
|
|
2594
|
+
const name = start[1];
|
|
2595
|
+
if (begin !== null) return `nested_start:${begin}:${name}`;
|
|
2596
|
+
begin = name;
|
|
2597
|
+
continue;
|
|
2598
|
+
}
|
|
2599
|
+
const match = END_MARKER_RE.exec(trimmed);
|
|
2600
|
+
if (!match) {
|
|
2601
|
+
if (looksLikeRemnicMarkerLine(trimmed)) return `unparsable_marker:${trimmed}`;
|
|
2602
|
+
continue;
|
|
2603
|
+
}
|
|
2604
|
+
const end = match[1];
|
|
2605
|
+
if (begin === null) return `orphan_end:${end}`;
|
|
2606
|
+
if (begin.trim().length === 0 || end.trim().length === 0) return `name_mismatch:${begin}:${end}`;
|
|
2607
|
+
if (!assertBeginEndPair({ beginName: begin, endName: end }).ok) return `name_mismatch:${begin}:${end}`;
|
|
2608
|
+
begin = null;
|
|
2609
|
+
}
|
|
2610
|
+
return null;
|
|
2611
|
+
}
|
|
2612
|
+
function looksLikeRemnicMarkerLine(trimmed) {
|
|
2613
|
+
if (!trimmed.startsWith("<!--") || !trimmed.endsWith("-->")) return false;
|
|
2614
|
+
const inner = trimmed.slice(4, -3).trim();
|
|
2615
|
+
if (!inner.startsWith("remnic:")) return false;
|
|
2616
|
+
return inner.endsWith(":start") || inner.endsWith(":end");
|
|
2617
|
+
}
|
|
2618
|
+
function frontmatterUpdates(sections, prefix) {
|
|
2619
|
+
const updates = {};
|
|
2620
|
+
for (const section of sections) {
|
|
2621
|
+
if (!section.properties) continue;
|
|
2622
|
+
for (const [key, value] of Object.entries(section.properties)) {
|
|
2623
|
+
updates[`${prefix}${key}`] = value;
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
return updates;
|
|
2627
|
+
}
|
|
2628
|
+
function mergeFrontmatterKeys(noteText, updates) {
|
|
2629
|
+
const entries = Object.entries(updates);
|
|
2630
|
+
if (entries.length === 0) return { ok: true, text: noteText };
|
|
2631
|
+
for (const [key] of entries) {
|
|
2632
|
+
if (key.includes("\n") || key.includes("\r") || key.trim() !== key || key.length === 0) {
|
|
2633
|
+
return { ok: false, reason: "invalid_property_key" };
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
const eol = noteText.includes("\r\n") ? "\r\n" : "\n";
|
|
2637
|
+
const openRe = /^---\r?$/;
|
|
2638
|
+
const firstLineEnd = noteText.indexOf("\n");
|
|
2639
|
+
const firstLine = firstLineEnd === -1 ? noteText : noteText.slice(0, firstLineEnd);
|
|
2640
|
+
if (!openRe.test(firstLine)) {
|
|
2641
|
+
const block = ["---", ...entries.map(([key, value]) => `${key}: ${value}`), "---", ""].join(eol);
|
|
2642
|
+
return { ok: true, text: block + eol + noteText };
|
|
2643
|
+
}
|
|
2644
|
+
const lines = noteText.split(eol);
|
|
2645
|
+
let closeIdx = -1;
|
|
2646
|
+
for (let i = 1; i < lines.length; i += 1) {
|
|
2647
|
+
if (openRe.test(lines[i])) {
|
|
2648
|
+
closeIdx = i;
|
|
2649
|
+
break;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
if (closeIdx === -1) {
|
|
2653
|
+
return { ok: false, reason: "malformed_frontmatter" };
|
|
2654
|
+
}
|
|
2655
|
+
const pending = new Map(entries);
|
|
2656
|
+
for (let i = 1; i < closeIdx; i += 1) {
|
|
2657
|
+
const line = lines[i];
|
|
2658
|
+
const idx = line.indexOf(":");
|
|
2659
|
+
if (idx === -1) continue;
|
|
2660
|
+
const rawKey = line.slice(0, idx);
|
|
2661
|
+
if (rawKey !== rawKey.trimStart()) continue;
|
|
2662
|
+
const key = rawKey.trimEnd();
|
|
2663
|
+
if (!pending.has(key)) continue;
|
|
2664
|
+
lines[i] = `${rawKey}: ${pending.get(key)}`;
|
|
2665
|
+
pending.delete(key);
|
|
2666
|
+
}
|
|
2667
|
+
const insertAt = closeIdx;
|
|
2668
|
+
const added = [];
|
|
2669
|
+
for (const [key, value] of pending.entries()) {
|
|
2670
|
+
added.push(`${key}: ${value}`);
|
|
2671
|
+
}
|
|
2672
|
+
lines.splice(insertAt, 0, ...added);
|
|
2673
|
+
return { ok: true, text: lines.join(eol) };
|
|
2674
|
+
}
|
|
2675
|
+
function containedBySymlinks(root, dest) {
|
|
2676
|
+
const realRoot = realpathSync(root);
|
|
2677
|
+
let probe = dest;
|
|
2678
|
+
for (; ; ) {
|
|
2679
|
+
try {
|
|
2680
|
+
if (lstatSync(probe).isSymbolicLink() || statSync3(probe).isFile() || statSync3(probe).isDirectory()) {
|
|
2681
|
+
const real = realpathSync(probe);
|
|
2682
|
+
return real === realRoot || real.startsWith(`${realRoot}${path5.sep}`);
|
|
2683
|
+
}
|
|
2684
|
+
} catch {
|
|
2685
|
+
}
|
|
2686
|
+
const parent = path5.dirname(probe);
|
|
2687
|
+
if (parent === probe) return false;
|
|
2688
|
+
probe = parent;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
var vaultPublisherTestHooks = null;
|
|
2692
|
+
function setVaultPublisherTestHooks(hooks) {
|
|
2693
|
+
vaultPublisherTestHooks = hooks;
|
|
2694
|
+
}
|
|
2695
|
+
function writeAtomic(dest, text, expect) {
|
|
2696
|
+
const tmpPath = path5.join(path5.dirname(dest), `.remnic-vault-${randomBytes2(8).toString("hex")}.tmp`);
|
|
2697
|
+
writeFileSync2(tmpPath, text);
|
|
2698
|
+
let prev = null;
|
|
2699
|
+
try {
|
|
2700
|
+
prev = statSync3(dest);
|
|
2701
|
+
} catch {
|
|
2702
|
+
prev = null;
|
|
2703
|
+
}
|
|
2704
|
+
if (prev !== null) {
|
|
2705
|
+
try {
|
|
2706
|
+
chmodSync(tmpPath, prev.mode & 4095);
|
|
2707
|
+
chownSync(tmpPath, prev.uid, prev.gid);
|
|
2708
|
+
} catch {
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
vaultPublisherTestHooks?.beforeReplaceVerify?.(dest);
|
|
2712
|
+
try {
|
|
2713
|
+
const concurrent = expect === null ? prev !== null : prev === null || // the note vanished since it was read
|
|
2714
|
+
prev.ino !== expect.ino || prev.mtimeMs !== expect.mtimeMs || prev.size !== expect.size || createHash2("sha256").update(readFileSync3(dest, "utf8"), "utf8").digest("hex") !== expect.sha256;
|
|
2715
|
+
if (concurrent) {
|
|
2716
|
+
try {
|
|
2717
|
+
unlinkSync3(tmpPath);
|
|
2718
|
+
} catch {
|
|
2719
|
+
}
|
|
2720
|
+
return "concurrent";
|
|
2721
|
+
}
|
|
2722
|
+
} catch {
|
|
2723
|
+
try {
|
|
2724
|
+
unlinkSync3(tmpPath);
|
|
2725
|
+
} catch {
|
|
2726
|
+
}
|
|
2727
|
+
return "concurrent";
|
|
2728
|
+
}
|
|
2729
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
2730
|
+
try {
|
|
2731
|
+
renameSync2(tmpPath, dest);
|
|
2732
|
+
return "written";
|
|
2733
|
+
} catch (err) {
|
|
2734
|
+
const code = err.code;
|
|
2735
|
+
if (attempt === 1 || code !== "EBUSY" && code !== "EPERM") {
|
|
2736
|
+
try {
|
|
2737
|
+
unlinkSync3(tmpPath);
|
|
2738
|
+
} catch {
|
|
2739
|
+
}
|
|
2740
|
+
if (code === "EBUSY" || code === "EPERM") return "failed";
|
|
2741
|
+
throw err;
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
return "failed";
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
// src/activity/timeline/publish-cli.ts
|
|
2749
|
+
var AVAILABLE_KINDS = ["timeline"];
|
|
2750
|
+
var KNOWN_KINDS = ["timeline", "standup", "weekly", "locations"];
|
|
2751
|
+
var UNLANDED_REASONS = {
|
|
2752
|
+
standup: "the standup renderer lands with timeline phase 3",
|
|
2753
|
+
weekly: "the weekly review renderer lands with timeline phase 4",
|
|
2754
|
+
locations: "the location day renderer is not wired to publishing yet"
|
|
2755
|
+
};
|
|
2756
|
+
function runTimelinePublishCli(config, options, io) {
|
|
2757
|
+
const vault = config.activity?.timeline?.vault;
|
|
2758
|
+
if (options.week !== void 0) {
|
|
2759
|
+
io.stderr.write("--week is not available yet: the weekly review renderer lands with timeline phase 4.\n");
|
|
2760
|
+
return 1;
|
|
2761
|
+
}
|
|
2762
|
+
if (!vault || vault.enabled !== true) {
|
|
2763
|
+
io.stderr.write(
|
|
2764
|
+
"Vault publishing is disabled: set activity.timeline.vault.enabled=true and configure vaultPath first.\n"
|
|
2765
|
+
);
|
|
2766
|
+
return 1;
|
|
2767
|
+
}
|
|
2768
|
+
const date = typeof options.date === "string" && options.date.length > 0 ? options.date : activityDateInTimezone(/* @__PURE__ */ new Date(), config.activity?.timezone ?? "UTC");
|
|
2769
|
+
if (!isValidActivityDate(date)) {
|
|
2770
|
+
io.stderr.write(`Invalid --date "${date}"; expected YYYY-MM-DD.
|
|
2771
|
+
`);
|
|
2772
|
+
return 1;
|
|
2773
|
+
}
|
|
2774
|
+
const requested = parseKinds(typeof options.what === "string" && options.what.length > 0 ? options.what : "timeline");
|
|
2775
|
+
if (typeof requested !== "string") {
|
|
2776
|
+
io.stderr.write(requested.error);
|
|
2777
|
+
return 1;
|
|
2778
|
+
}
|
|
2779
|
+
const kinds = requested.split(",");
|
|
2780
|
+
const sections = [];
|
|
2781
|
+
let notePathTemplate = vault.dailyNotePath;
|
|
2782
|
+
for (const kind of kinds) {
|
|
2783
|
+
if (AVAILABLE_KINDS.indexOf(kind) === -1) {
|
|
2784
|
+
io.stderr.write(`--what ${kind} is not available yet: ${UNLANDED_REASONS[kind] ?? "unknown kind"}.
|
|
2785
|
+
`);
|
|
2786
|
+
return 1;
|
|
2787
|
+
}
|
|
2788
|
+
const target = vault.publish[kind];
|
|
2789
|
+
if (target.enabled !== true) {
|
|
2790
|
+
io.stderr.write(`--what ${kind} is disabled: enable activity.timeline.vault.publish.${kind}.enabled.
|
|
2791
|
+
`);
|
|
2792
|
+
return 1;
|
|
2793
|
+
}
|
|
2794
|
+
notePathTemplate = target.target === "weekly" ? vault.weeklyNotePath : vault.dailyNotePath;
|
|
2795
|
+
const source = journalPath(config.memoryDir, date);
|
|
2796
|
+
if (!existsSync(source)) {
|
|
2797
|
+
io.stderr.write(
|
|
2798
|
+
`No timeline artifact for ${date}: run the journal recap generation first (${kind} target reads the persisted day recap).
|
|
2799
|
+
`
|
|
2800
|
+
);
|
|
2801
|
+
return 1;
|
|
2802
|
+
}
|
|
2803
|
+
sections.push({ name: target.section, content: readFileSync4(source, "utf8").trimEnd() });
|
|
2804
|
+
}
|
|
2805
|
+
const status = publishVaultNote({
|
|
2806
|
+
vaultPath: vault.vaultPath,
|
|
2807
|
+
notePathTemplate,
|
|
2808
|
+
date,
|
|
2809
|
+
sections,
|
|
2810
|
+
strategy: vault.sectionStrategy,
|
|
2811
|
+
insertUnderHeading: vault.insertUnderHeading.length > 0 ? vault.insertUnderHeading : void 0,
|
|
2812
|
+
createMissingNotes: vault.createMissingNotes,
|
|
2813
|
+
noteTemplate: vault.noteTemplate.length > 0 ? vault.noteTemplate : void 0,
|
|
2814
|
+
propertiesMode: vault.properties.mode,
|
|
2815
|
+
propertiesPrefix: vault.properties.prefix,
|
|
2816
|
+
dryRun: options.dryRun === true
|
|
2817
|
+
});
|
|
2818
|
+
for (const row of status.results) {
|
|
2819
|
+
const label = row.outcome === "updated" && options.dryRun === true ? "would update" : row.outcome;
|
|
2820
|
+
io.stdout.write(`${label} ${row.path}${row.reason ? ` (${row.reason})` : ""}
|
|
2821
|
+
`);
|
|
2822
|
+
}
|
|
2823
|
+
io.stdout.write(
|
|
2824
|
+
`updated=${status.counts.updated} unchanged=${status.counts.unchanged} skipped=${status.counts.skipped} error=${status.counts.error}
|
|
2825
|
+
`
|
|
2826
|
+
);
|
|
2827
|
+
return status.hasError ? 1 : 0;
|
|
2828
|
+
}
|
|
2829
|
+
function parseKinds(raw) {
|
|
2830
|
+
const kinds = raw.split(",").map((part) => part.trim()).filter((part) => part.length > 0);
|
|
2831
|
+
for (const kind of kinds) {
|
|
2832
|
+
if (KNOWN_KINDS.indexOf(kind) === -1) {
|
|
2833
|
+
return { error: `Unknown --what kind "${kind}"; valid kinds are ${KNOWN_KINDS.join(", ")}.
|
|
2834
|
+
` };
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
if (new Set(kinds).size !== kinds.length) {
|
|
2838
|
+
return { error: "--what must not repeat a kind.\n" };
|
|
2839
|
+
}
|
|
2840
|
+
if (kinds.length === 0) {
|
|
2841
|
+
return { error: `--what must name at least one artifact; valid kinds are ${KNOWN_KINDS.join(", ")}.
|
|
2842
|
+
` };
|
|
2843
|
+
}
|
|
2844
|
+
return kinds.join(",");
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
// src/cli/timeline-publish-commands.ts
|
|
2848
|
+
function registerTimelineCommands(cmd, orchestrator) {
|
|
2849
|
+
const timelineCmd = cmd.command("timeline").description("Timeline artifacts: publish the day's recap into a markdown vault (issue #1985)");
|
|
2850
|
+
timelineCmd.command("publish").description("Publish timeline artifacts into the vault daily note via managed regions").option("--date <date>", "Local day to publish (YYYY-MM-DD; defaults to today)").option("--week <week>", "ISO week to publish (YYYY-Www)").option("--what <kinds>", "Comma-separated artifacts to publish (default: timeline)").option("--dry-run", "Report per-file outcomes without writing").action((...args) => {
|
|
2851
|
+
const options = args[0] ?? {};
|
|
2852
|
+
const code = runTimelinePublishCli(orchestrator.config, options, {
|
|
2853
|
+
stdout: process.stdout,
|
|
2854
|
+
stderr: process.stderr
|
|
2855
|
+
});
|
|
2856
|
+
if (code !== 0) process.exitCode = code;
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
// src/maintenance/rebuild-memory-lifecycle-ledger-cli.ts
|
|
2861
|
+
import path6 from "path";
|
|
2063
2862
|
async function runRebuildMemoryLifecycleLedgerCliCommand(options) {
|
|
2064
2863
|
const storage = options.storage;
|
|
2065
|
-
const ledgerPath =
|
|
2864
|
+
const ledgerPath = path6.join(options.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
|
|
2066
2865
|
const encrypted = await probeEncryptedRegularFileHeader(ledgerPath);
|
|
2067
2866
|
if (encrypted && !(storage?.isSecureStoreUnlocked() ?? false)) {
|
|
2068
2867
|
throw new Error(
|
|
@@ -2560,7 +3359,7 @@ assistant> ${result.reply}
|
|
|
2560
3359
|
// src/training-export/converter.ts
|
|
2561
3360
|
import { constants } from "fs";
|
|
2562
3361
|
import { lstat as lstat2, open, readdir as readdir2, realpath as realpath2 } from "fs/promises";
|
|
2563
|
-
import
|
|
3362
|
+
import path7 from "path";
|
|
2564
3363
|
function parseFrontmatter(raw) {
|
|
2565
3364
|
const match = raw.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
|
|
2566
3365
|
if (!match) return null;
|
|
@@ -2600,7 +3399,7 @@ async function safeRealpath(p) {
|
|
|
2600
3399
|
}
|
|
2601
3400
|
}
|
|
2602
3401
|
function isContainedPath(real, containmentRoot) {
|
|
2603
|
-
return real === containmentRoot || real.startsWith(containmentRoot +
|
|
3402
|
+
return real === containmentRoot || real.startsWith(containmentRoot + path7.sep);
|
|
2604
3403
|
}
|
|
2605
3404
|
async function collectMarkdownFiles(dir, containmentRoot) {
|
|
2606
3405
|
const files = [];
|
|
@@ -2620,7 +3419,7 @@ async function collectMarkdownFiles(dir, containmentRoot) {
|
|
|
2620
3419
|
}
|
|
2621
3420
|
const sorted = [...entries].sort((a, b) => a.name.localeCompare(b.name));
|
|
2622
3421
|
for (const entry of sorted) {
|
|
2623
|
-
const full =
|
|
3422
|
+
const full = path7.join(d, entry.name);
|
|
2624
3423
|
if (entry.isSymbolicLink()) continue;
|
|
2625
3424
|
if (entry.isDirectory()) {
|
|
2626
3425
|
await walk(full);
|
|
@@ -2702,9 +3501,9 @@ async function convertMemoriesToRecords(options) {
|
|
|
2702
3501
|
const { memoryDir } = options;
|
|
2703
3502
|
const containmentRoot = await safeRealpath(memoryDir);
|
|
2704
3503
|
if (!containmentRoot) return [];
|
|
2705
|
-
const dirs = RECALL_FALLBACK_DIRS.map((dir) =>
|
|
3504
|
+
const dirs = RECALL_FALLBACK_DIRS.map((dir) => path7.join(memoryDir, dir));
|
|
2706
3505
|
if (options.includeEntities) {
|
|
2707
|
-
dirs.push(
|
|
3506
|
+
dirs.push(path7.join(memoryDir, "entities"));
|
|
2708
3507
|
}
|
|
2709
3508
|
const allFiles = [];
|
|
2710
3509
|
for (const dir of dirs) {
|
|
@@ -2967,14 +3766,14 @@ async function runTrainingExportCliCommand(opts) {
|
|
|
2967
3766
|
`Unknown training-export format "${opts.format}". ${validList}`
|
|
2968
3767
|
);
|
|
2969
3768
|
}
|
|
2970
|
-
const { statSync:
|
|
2971
|
-
if (!
|
|
3769
|
+
const { statSync: statSync4, existsSync: existsSync2 } = await import("fs");
|
|
3770
|
+
if (!existsSync2(expandedMemoryDir)) {
|
|
2972
3771
|
throw new Error(
|
|
2973
3772
|
`--memory-dir "${opts.memoryDir}" does not exist. Provide the path to an existing memory directory.`
|
|
2974
3773
|
);
|
|
2975
3774
|
}
|
|
2976
3775
|
try {
|
|
2977
|
-
if (!
|
|
3776
|
+
if (!statSync4(expandedMemoryDir).isDirectory()) {
|
|
2978
3777
|
throw new Error(
|
|
2979
3778
|
`--memory-dir "${opts.memoryDir}" is not a directory. Provide the path to a memory directory, not a file.`
|
|
2980
3779
|
);
|
|
@@ -3022,9 +3821,9 @@ async function runTrainingExportCliCommand(opts) {
|
|
|
3022
3821
|
const formatted = adapter.formatRecords(records);
|
|
3023
3822
|
const { writeFile: fsWriteFile } = await import("fs/promises");
|
|
3024
3823
|
const { dirname } = await import("path");
|
|
3025
|
-
const { mkdirSync } = await import("fs");
|
|
3824
|
+
const { mkdirSync: mkdirSync2 } = await import("fs");
|
|
3026
3825
|
try {
|
|
3027
|
-
|
|
3826
|
+
mkdirSync2(dirname(expandedOutput), { recursive: true });
|
|
3028
3827
|
} catch {
|
|
3029
3828
|
}
|
|
3030
3829
|
await fsWriteFile(expandedOutput, formatted, "utf-8");
|
|
@@ -3709,10 +4508,10 @@ function effectivePolicyValuesForVersion(values, config) {
|
|
|
3709
4508
|
}
|
|
3710
4509
|
function policyVersionForValues(values, config) {
|
|
3711
4510
|
const normalized = effectivePolicyValuesForVersion(values, config);
|
|
3712
|
-
return
|
|
4511
|
+
return createHash3("sha256").update(JSON.stringify(normalized)).digest("hex").slice(0, 12);
|
|
3713
4512
|
}
|
|
3714
4513
|
async function readRuntimePolicySnapshot2(config, fileName) {
|
|
3715
|
-
const filePath =
|
|
4514
|
+
const filePath = path8.join(config.memoryDir, "state", fileName);
|
|
3716
4515
|
const snapshot = await readRuntimePolicySnapshot(filePath, {
|
|
3717
4516
|
maxStaleDecayThreshold: config.lifecycleArchiveDecayThreshold
|
|
3718
4517
|
});
|
|
@@ -4489,7 +5288,7 @@ async function exists(p) {
|
|
|
4489
5288
|
}
|
|
4490
5289
|
}
|
|
4491
5290
|
function assertSafeNamespaceSegment(namespace) {
|
|
4492
|
-
if (namespace.length === 0 || namespace === "." || namespace === ".." || namespace.includes("/") || namespace.includes("\\") ||
|
|
5291
|
+
if (namespace.length === 0 || namespace === "." || namespace === ".." || namespace.includes("/") || namespace.includes("\\") || path8.isAbsolute(namespace) || path8.win32.isAbsolute(namespace)) {
|
|
4493
5292
|
throw new Error(`invalid namespace: ${namespace}`);
|
|
4494
5293
|
}
|
|
4495
5294
|
}
|
|
@@ -4539,7 +5338,7 @@ async function walkMemoryMarkdownFiles(memoryDir, visit) {
|
|
|
4539
5338
|
for (const entry of entries) {
|
|
4540
5339
|
if (entry.isSymbolicLink()) continue;
|
|
4541
5340
|
const entryName = typeof entry.name === "string" ? entry.name : entry.name.toString("utf-8");
|
|
4542
|
-
const fullPath =
|
|
5341
|
+
const fullPath = path8.join(dir, entryName);
|
|
4543
5342
|
try {
|
|
4544
5343
|
assertPathInsideRoot(memoryRootReal, await realpath3(fullPath), fullPath);
|
|
4545
5344
|
} catch (err) {
|
|
@@ -4554,7 +5353,7 @@ async function walkMemoryMarkdownFiles(memoryDir, visit) {
|
|
|
4554
5353
|
await visit(fullPath);
|
|
4555
5354
|
}
|
|
4556
5355
|
};
|
|
4557
|
-
for (const root of RECALL_FALLBACK_DIRS.map((dir) =>
|
|
5356
|
+
for (const root of RECALL_FALLBACK_DIRS.map((dir) => path8.join(memoryDir, dir))) {
|
|
4558
5357
|
await walk(root);
|
|
4559
5358
|
}
|
|
4560
5359
|
}
|
|
@@ -5164,7 +5963,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
5164
5963
|
if (plan.moved.length > 0) {
|
|
5165
5964
|
console.log("\nEntries:");
|
|
5166
5965
|
for (const move of plan.moved) {
|
|
5167
|
-
console.log(`- ${
|
|
5966
|
+
console.log(`- ${path8.basename(move.from)}`);
|
|
5168
5967
|
}
|
|
5169
5968
|
}
|
|
5170
5969
|
if (dryRun) {
|
|
@@ -5465,15 +6264,15 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
5465
6264
|
const capsulesDir = defaultCapsulesDir(memoryDir);
|
|
5466
6265
|
const { stat: statMerge } = await import("fs/promises");
|
|
5467
6266
|
let sourceArchive = expandTildePath(parsed.archive);
|
|
5468
|
-
const looksLikePath = sourceArchive.startsWith("/") || sourceArchive.startsWith("./") || sourceArchive.startsWith("../") || sourceArchive.includes(
|
|
6267
|
+
const looksLikePath = sourceArchive.startsWith("/") || sourceArchive.startsWith("./") || sourceArchive.startsWith("../") || sourceArchive.includes(path8.sep);
|
|
5469
6268
|
if (!looksLikePath) {
|
|
5470
|
-
const cwdResolved =
|
|
6269
|
+
const cwdResolved = path8.resolve(sourceArchive);
|
|
5471
6270
|
const cwdSt = await statMerge(cwdResolved).catch(() => null);
|
|
5472
6271
|
if (cwdSt && cwdSt.isFile()) {
|
|
5473
6272
|
sourceArchive = cwdResolved;
|
|
5474
6273
|
} else {
|
|
5475
|
-
const byId =
|
|
5476
|
-
const byIdEnc =
|
|
6274
|
+
const byId = path8.join(capsulesDir, `${sourceArchive}.capsule.json.gz`);
|
|
6275
|
+
const byIdEnc = path8.join(capsulesDir, `${sourceArchive}.capsule.json.gz.enc`);
|
|
5477
6276
|
const stId = await statMerge(byId).catch(() => null);
|
|
5478
6277
|
if (stId && stId.isFile()) {
|
|
5479
6278
|
sourceArchive = byId;
|
|
@@ -5554,10 +6353,10 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
5554
6353
|
).sort();
|
|
5555
6354
|
const entries = [];
|
|
5556
6355
|
for (const archiveName of archives) {
|
|
5557
|
-
const archivePath =
|
|
6356
|
+
const archivePath = path8.join(capsulesDir, archiveName);
|
|
5558
6357
|
const id = archiveName.replace(/\.capsule\.json\.gz\.enc$/, "").replace(/\.capsule\.json\.gz$/, "");
|
|
5559
6358
|
const manifestName = `${id}.manifest.json`;
|
|
5560
|
-
const manifestPath =
|
|
6359
|
+
const manifestPath = path8.join(capsulesDir, manifestName);
|
|
5561
6360
|
let createdAt = null;
|
|
5562
6361
|
let pluginVersion = null;
|
|
5563
6362
|
let fileCount = null;
|
|
@@ -5612,15 +6411,15 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
5612
6411
|
const parsed = parseCapsuleInspectOptions(archiveArg, opts);
|
|
5613
6412
|
const { stat } = await import("fs/promises");
|
|
5614
6413
|
let archivePath = expandTildePath(parsed.archive);
|
|
5615
|
-
const looksLikePath = archivePath.startsWith("/") || archivePath.startsWith("./") || archivePath.startsWith("../") || archivePath.includes(
|
|
6414
|
+
const looksLikePath = archivePath.startsWith("/") || archivePath.startsWith("./") || archivePath.startsWith("../") || archivePath.includes(path8.sep);
|
|
5616
6415
|
if (!looksLikePath) {
|
|
5617
|
-
const cwdResolved =
|
|
6416
|
+
const cwdResolved = path8.resolve(archivePath);
|
|
5618
6417
|
const cwdSt = await stat(cwdResolved).catch(() => null);
|
|
5619
6418
|
if (cwdSt && cwdSt.isFile()) {
|
|
5620
6419
|
archivePath = cwdResolved;
|
|
5621
6420
|
} else {
|
|
5622
|
-
const byId =
|
|
5623
|
-
const byIdEnc =
|
|
6421
|
+
const byId = path8.join(capsulesDir, `${archivePath}.capsule.json.gz`);
|
|
6422
|
+
const byIdEnc = path8.join(capsulesDir, `${archivePath}.capsule.json.gz.enc`);
|
|
5624
6423
|
const st = await stat(byId).catch(() => null);
|
|
5625
6424
|
if (st && st.isFile()) {
|
|
5626
6425
|
archivePath = byId;
|
|
@@ -6571,6 +7370,7 @@ ${doc.content}` : doc.content,
|
|
|
6571
7370
|
registerMeetingsCommands(cmd, orchestrator);
|
|
6572
7371
|
registerOkfCommands(cmd, orchestrator);
|
|
6573
7372
|
registerDeepRecallCommands(cmd, orchestrator);
|
|
7373
|
+
registerTimelineCommands(cmd, orchestrator);
|
|
6574
7374
|
cmd.command("trust-zone-promote").description("Dry-run or apply a trust-zone promotion with provenance enforcement").requiredOption("--record-id <recordId>", "Source trust-zone record id").requiredOption("--target-zone <targetZone>", "Promotion target zone (working|trusted)").requiredOption("--reason <reason>", "Human-readable promotion reason").option("--recorded-at <isoTimestamp>", "Promotion timestamp (defaults to now)").option("--summary <summary>", "Optional replacement summary for the promoted record").option("--dry-run", "Show the promotion plan without writing the promoted record").action(async (...args) => {
|
|
6575
7375
|
const options = args[0] ?? {};
|
|
6576
7376
|
const result = await runTrustZonePromoteCliCommand({
|
|
@@ -7612,7 +8412,7 @@ Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=
|
|
|
7612
8412
|
return;
|
|
7613
8413
|
}
|
|
7614
8414
|
const expandedTarget = expandTildePath(rawTarget);
|
|
7615
|
-
const targetPath =
|
|
8415
|
+
const targetPath = path8.isAbsolute(expandedTarget) ? expandedTarget : path8.join(orchestrator.config.memoryDir, expandedTarget);
|
|
7616
8416
|
const { runConsolidationUndo, formatConsolidationUndoResult } = await import("./consolidation-undo.js");
|
|
7617
8417
|
const result = await runConsolidationUndo({
|
|
7618
8418
|
storage: orchestrator.storage,
|
|
@@ -7650,7 +8450,7 @@ Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=
|
|
|
7650
8450
|
}
|
|
7651
8451
|
});
|
|
7652
8452
|
cmd.command("identity").description("Show agent identity reflections").action(async () => {
|
|
7653
|
-
const workspaceDir =
|
|
8453
|
+
const workspaceDir = path8.join(resolveHomeDir(), ".openclaw", "workspace");
|
|
7654
8454
|
const identity = await orchestrator.storage.readIdentity(workspaceDir);
|
|
7655
8455
|
if (!identity) {
|
|
7656
8456
|
console.log("No identity file found.");
|
|
@@ -7873,8 +8673,8 @@ Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=
|
|
|
7873
8673
|
const options = args[0] ?? {};
|
|
7874
8674
|
const threadId = options.thread;
|
|
7875
8675
|
const top = parseInt(options.top ?? "10", 10);
|
|
7876
|
-
const memoryDir =
|
|
7877
|
-
const threading = new ThreadingManager(
|
|
8676
|
+
const memoryDir = path8.join(resolveHomeDir(), ".openclaw", "workspace", "memory", "local");
|
|
8677
|
+
const threading = new ThreadingManager(path8.join(memoryDir, "threads"));
|
|
7878
8678
|
if (threadId) {
|
|
7879
8679
|
const thread = await threading.loadThread(threadId);
|
|
7880
8680
|
if (!thread) {
|
|
@@ -8807,6 +9607,18 @@ export {
|
|
|
8807
9607
|
runMeetingsCliCommand,
|
|
8808
9608
|
runOkfCliCommand,
|
|
8809
9609
|
runHarmonicSearchCliCommand,
|
|
9610
|
+
applyManagedRegion,
|
|
9611
|
+
fileLines,
|
|
9612
|
+
parseAtxHeading,
|
|
9613
|
+
publishVaultRegion,
|
|
9614
|
+
insertMarkersUnderHeading,
|
|
9615
|
+
assertBeginEndPair,
|
|
9616
|
+
VAULT_PUBLISH_OUTCOMES,
|
|
9617
|
+
summarizeVaultPublish,
|
|
9618
|
+
publishVaultNote,
|
|
9619
|
+
mergeFrontmatterKeys,
|
|
9620
|
+
setVaultPublisherTestHooks,
|
|
9621
|
+
runTimelinePublishCli,
|
|
8810
9622
|
runRebuildMemoryLifecycleLedgerCliCommand,
|
|
8811
9623
|
convertMemoriesToRecords,
|
|
8812
9624
|
registerTrainingExportAdapter,
|
|
@@ -8904,4 +9716,4 @@ export {
|
|
|
8904
9716
|
listMemoryMarkdownFilePaths,
|
|
8905
9717
|
registerCli
|
|
8906
9718
|
};
|
|
8907
|
-
//# sourceMappingURL=chunk-
|
|
9719
|
+
//# sourceMappingURL=chunk-7JV4JST3.js.map
|