nox-mem 3.0.0
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/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/api/answer.d.ts +116 -0
- package/dist/api/answer.js +274 -0
- package/dist/api/answer.validate-patch.d.ts +72 -0
- package/dist/api/answer.validate-patch.js +52 -0
- package/dist/api/brief-diversity.d.ts +64 -0
- package/dist/api/brief-diversity.js +91 -0
- package/dist/api/brief.d.ts +114 -0
- package/dist/api/brief.js +524 -0
- package/dist/api/conflict.d.ts +33 -0
- package/dist/api/conflict.js +143 -0
- package/dist/api/cors.d.ts +73 -0
- package/dist/api/cors.js +124 -0
- package/dist/api/events-stream-limited.d.ts +133 -0
- package/dist/api/events-stream-limited.js +217 -0
- package/dist/api/events-stream.d.ts +53 -0
- package/dist/api/events-stream.js +125 -0
- package/dist/api/export.d.ts +42 -0
- package/dist/api/export.js +85 -0
- package/dist/api/health-confidence-adapter.d.ts +29 -0
- package/dist/api/health-confidence-adapter.js +73 -0
- package/dist/api/health-confidence.d.ts +36 -0
- package/dist/api/health-confidence.js +141 -0
- package/dist/api/hooks.d.ts +50 -0
- package/dist/api/hooks.js +115 -0
- package/dist/api/import.d.ts +38 -0
- package/dist/api/import.js +87 -0
- package/dist/api/ingest-event.d.ts +65 -0
- package/dist/api/ingest-event.js +153 -0
- package/dist/api/mark.d.ts +42 -0
- package/dist/api/mark.js +127 -0
- package/dist/api/server-deps-a2.d.ts +55 -0
- package/dist/api/server-deps-a2.js +138 -0
- package/dist/api/server-deps-l2-l3.d.ts +68 -0
- package/dist/api/server-deps-l2-l3.js +123 -0
- package/dist/api/server-deps-p1.d.ts +84 -0
- package/dist/api/server-deps-p1.js +156 -0
- package/dist/api/server-deps-p2.d.ts +32 -0
- package/dist/api/server-deps-p2.js +84 -0
- package/dist/api/server-deps-p5.d.ts +66 -0
- package/dist/api/server-deps-p5.js +139 -0
- package/dist/api/viewer-static.d.ts +30 -0
- package/dist/api/viewer-static.js +102 -0
- package/dist/api/wire-up.d.ts +54 -0
- package/dist/api/wire-up.js +521 -0
- package/dist/api-impact.d.ts +30 -0
- package/dist/api-impact.js +196 -0
- package/dist/api-server.d.ts +2 -0
- package/dist/api-server.js +614 -0
- package/dist/backfill-fts-anchor.d.ts +15 -0
- package/dist/backfill-fts-anchor.js +97 -0
- package/dist/backfill-source-type.d.ts +20 -0
- package/dist/backfill-source-type.js +182 -0
- package/dist/churn.d.ts +31 -0
- package/dist/churn.js +98 -0
- package/dist/cli/answer.d.ts +66 -0
- package/dist/cli/answer.js +287 -0
- package/dist/cli/conflict.d.ts +38 -0
- package/dist/cli/conflict.js +282 -0
- package/dist/cli/export.d.ts +51 -0
- package/dist/cli/export.js +280 -0
- package/dist/cli/hooks.d.ts +54 -0
- package/dist/cli/hooks.js +133 -0
- package/dist/cli/import.d.ts +52 -0
- package/dist/cli/import.js +274 -0
- package/dist/cli/mark.d.ts +33 -0
- package/dist/cli/mark.js +130 -0
- package/dist/cli/ocr-batch.d.ts +12 -0
- package/dist/cli/ocr-batch.js +411 -0
- package/dist/cli/snapshot-main.d.ts +30 -0
- package/dist/cli/snapshot-main.js +47 -0
- package/dist/cli/viewer.d.ts +35 -0
- package/dist/cli/viewer.js +71 -0
- package/dist/cli-telemetry.d.ts +36 -0
- package/dist/cli-telemetry.js +150 -0
- package/dist/compact.d.ts +7 -0
- package/dist/compact.js +147 -0
- package/dist/consolidate.d.ts +18 -0
- package/dist/consolidate.js +475 -0
- package/dist/consolidation.d.ts +32 -0
- package/dist/consolidation.js +212 -0
- package/dist/cross-agent-v2.d.ts +45 -0
- package/dist/cross-agent-v2.js +271 -0
- package/dist/cross-search.d.ts +11 -0
- package/dist/cross-search.js +119 -0
- package/dist/crystallize.d.ts +43 -0
- package/dist/crystallize.js +111 -0
- package/dist/db.d.ts +11 -0
- package/dist/db.js +388 -0
- package/dist/dedup.d.ts +1 -0
- package/dist/dedup.js +106 -0
- package/dist/detect-changes.d.ts +29 -0
- package/dist/detect-changes.js +236 -0
- package/dist/digest.d.ts +1 -0
- package/dist/digest.js +205 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +71 -0
- package/dist/embed.d.ts +45 -0
- package/dist/embed.js +257 -0
- package/dist/evals.d.ts +176 -0
- package/dist/evals.js +351 -0
- package/dist/generate-user-profile.d.ts +18 -0
- package/dist/generate-user-profile.js +163 -0
- package/dist/graphify-ingest.d.ts +18 -0
- package/dist/graphify-ingest.js +158 -0
- package/dist/impact.d.ts +39 -0
- package/dist/impact.js +143 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +689 -0
- package/dist/ingest-entity.d.ts +44 -0
- package/dist/ingest-entity.js +197 -0
- package/dist/ingest.d.ts +13 -0
- package/dist/ingest.js +210 -0
- package/dist/kg-llm.d.ts +39 -0
- package/dist/kg-llm.js +295 -0
- package/dist/knowledge-graph.d.ts +72 -0
- package/dist/knowledge-graph.js +507 -0
- package/dist/lib/answer/config.d.ts +41 -0
- package/dist/lib/answer/config.js +70 -0
- package/dist/lib/answer/index.d.ts +47 -0
- package/dist/lib/answer/index.js +221 -0
- package/dist/lib/answer/prompt.d.ts +37 -0
- package/dist/lib/answer/prompt.js +88 -0
- package/dist/lib/answer/provider.d.ts +47 -0
- package/dist/lib/answer/provider.js +101 -0
- package/dist/lib/answer/retrieval.d.ts +36 -0
- package/dist/lib/answer/retrieval.js +92 -0
- package/dist/lib/answer/telemetry.d.ts +99 -0
- package/dist/lib/answer/telemetry.js +154 -0
- package/dist/lib/answer/types.d.ts +108 -0
- package/dist/lib/answer/types.js +1 -0
- package/dist/lib/api/error-leak-fix.d.ts +54 -0
- package/dist/lib/api/error-leak-fix.js +55 -0
- package/dist/lib/api/safe-error-message.d.ts +70 -0
- package/dist/lib/api/safe-error-message.js +122 -0
- package/dist/lib/archive/common-passwords.d.ts +37 -0
- package/dist/lib/archive/common-passwords.js +753 -0
- package/dist/lib/archive/encryption.d.ts +81 -0
- package/dist/lib/archive/encryption.js +236 -0
- package/dist/lib/archive/enforce-strength.d.ts +54 -0
- package/dist/lib/archive/enforce-strength.js +70 -0
- package/dist/lib/archive/entropy.d.ts +34 -0
- package/dist/lib/archive/entropy.js +180 -0
- package/dist/lib/archive/export-locking.d.ts +102 -0
- package/dist/lib/archive/export-locking.js +202 -0
- package/dist/lib/archive/format.d.ts +20 -0
- package/dist/lib/archive/format.js +174 -0
- package/dist/lib/archive/index.d.ts +23 -0
- package/dist/lib/archive/index.js +17 -0
- package/dist/lib/archive/manifest.d.ts +53 -0
- package/dist/lib/archive/manifest.js +183 -0
- package/dist/lib/archive/migration.d.ts +36 -0
- package/dist/lib/archive/migration.js +100 -0
- package/dist/lib/archive/migrations/v18_to_v19.d.ts +16 -0
- package/dist/lib/archive/migrations/v18_to_v19.js +18 -0
- package/dist/lib/archive/orchestrator.d.ts +166 -0
- package/dist/lib/archive/orchestrator.js +428 -0
- package/dist/lib/archive/serializers/chunks.d.ts +30 -0
- package/dist/lib/archive/serializers/chunks.js +113 -0
- package/dist/lib/archive/serializers/embeddings.d.ts +36 -0
- package/dist/lib/archive/serializers/embeddings.js +115 -0
- package/dist/lib/archive/serializers/kg.d.ts +28 -0
- package/dist/lib/archive/serializers/kg.js +184 -0
- package/dist/lib/archive/serializers/ops_audit.d.ts +21 -0
- package/dist/lib/archive/serializers/ops_audit.js +97 -0
- package/dist/lib/archive/server-deps.d.ts +131 -0
- package/dist/lib/archive/server-deps.js +232 -0
- package/dist/lib/archive/strength.d.ts +50 -0
- package/dist/lib/archive/strength.js +77 -0
- package/dist/lib/archive/types.d.ts +159 -0
- package/dist/lib/archive/types.js +45 -0
- package/dist/lib/archive/unpack-streaming.d.ts +70 -0
- package/dist/lib/archive/unpack-streaming.js +255 -0
- package/dist/lib/auth/localhost-guard.d.ts +106 -0
- package/dist/lib/auth/localhost-guard.js +164 -0
- package/dist/lib/confidence/config.d.ts +37 -0
- package/dist/lib/confidence/config.js +107 -0
- package/dist/lib/confidence/db-shim-singleton.d.ts +20 -0
- package/dist/lib/confidence/db-shim-singleton.js +41 -0
- package/dist/lib/confidence/db-shim.d.ts +47 -0
- package/dist/lib/confidence/db-shim.js +141 -0
- package/dist/lib/confidence/mark.d.ts +58 -0
- package/dist/lib/confidence/mark.js +168 -0
- package/dist/lib/confidence/ranking.d.ts +69 -0
- package/dist/lib/confidence/ranking.js +101 -0
- package/dist/lib/confidence/search-filter.d.ts +44 -0
- package/dist/lib/confidence/search-filter.js +103 -0
- package/dist/lib/confidence/types.d.ts +146 -0
- package/dist/lib/confidence/types.js +20 -0
- package/dist/lib/confidence/write-hooks.d.ts +50 -0
- package/dist/lib/confidence/write-hooks.js +159 -0
- package/dist/lib/conflict/audit-fk-check.d.ts +72 -0
- package/dist/lib/conflict/audit-fk-check.js +131 -0
- package/dist/lib/conflict/audit-writer.d.ts +39 -0
- package/dist/lib/conflict/audit-writer.js +133 -0
- package/dist/lib/conflict/db-singleton.d.ts +28 -0
- package/dist/lib/conflict/db-singleton.js +61 -0
- package/dist/lib/conflict/db.d.ts +27 -0
- package/dist/lib/conflict/db.js +20 -0
- package/dist/lib/conflict/detector-direct.d.ts +21 -0
- package/dist/lib/conflict/detector-direct.js +105 -0
- package/dist/lib/conflict/evidence.d.ts +24 -0
- package/dist/lib/conflict/evidence.js +76 -0
- package/dist/lib/conflict/index.d.ts +14 -0
- package/dist/lib/conflict/index.js +12 -0
- package/dist/lib/conflict/scheduler.d.ts +78 -0
- package/dist/lib/conflict/scheduler.js +111 -0
- package/dist/lib/conflict/shadow.d.ts +75 -0
- package/dist/lib/conflict/shadow.js +161 -0
- package/dist/lib/conflict/types.d.ts +133 -0
- package/dist/lib/conflict/types.js +19 -0
- package/dist/lib/cost-cap.d.ts +94 -0
- package/dist/lib/cost-cap.js +129 -0
- package/dist/lib/deps/deps-registry.d.ts +111 -0
- package/dist/lib/deps/deps-registry.js +209 -0
- package/dist/lib/error-sanitizer/middleware.d.ts +43 -0
- package/dist/lib/error-sanitizer/middleware.js +100 -0
- package/dist/lib/error-sanitizer/sanitize.d.ts +78 -0
- package/dist/lib/error-sanitizer/sanitize.js +202 -0
- package/dist/lib/eval-batch.d.ts +34 -0
- package/dist/lib/eval-batch.js +103 -0
- package/dist/lib/eval-metrics.d.ts +36 -0
- package/dist/lib/eval-metrics.js +95 -0
- package/dist/lib/eval.d.ts +106 -0
- package/dist/lib/eval.js +343 -0
- package/dist/lib/events/bus.d.ts +135 -0
- package/dist/lib/events/bus.js +95 -0
- package/dist/lib/fts-anchor.d.ts +1 -0
- package/dist/lib/fts-anchor.js +131 -0
- package/dist/lib/hooks/classifier.d.ts +47 -0
- package/dist/lib/hooks/classifier.js +129 -0
- package/dist/lib/hooks/config.d.ts +49 -0
- package/dist/lib/hooks/config.js +106 -0
- package/dist/lib/hooks/decorators.d.ts +35 -0
- package/dist/lib/hooks/decorators.js +59 -0
- package/dist/lib/hooks/pipeline.d.ts +76 -0
- package/dist/lib/hooks/pipeline.js +213 -0
- package/dist/lib/hooks/privacy-filter-adapter.d.ts +55 -0
- package/dist/lib/hooks/privacy-filter-adapter.js +84 -0
- package/dist/lib/hooks/rate-limit-constant-time.d.ts +57 -0
- package/dist/lib/hooks/rate-limit-constant-time.js +69 -0
- package/dist/lib/hooks/rate-limit-dryrun-fix.d.ts +71 -0
- package/dist/lib/hooks/rate-limit-dryrun-fix.js +110 -0
- package/dist/lib/hooks/rate-limit.d.ts +54 -0
- package/dist/lib/hooks/rate-limit.js +122 -0
- package/dist/lib/hooks/server-deps.d.ts +61 -0
- package/dist/lib/hooks/server-deps.js +92 -0
- package/dist/lib/hooks/source-allowlist.d.ts +26 -0
- package/dist/lib/hooks/source-allowlist.js +53 -0
- package/dist/lib/hooks/types.d.ts +129 -0
- package/dist/lib/hooks/types.js +24 -0
- package/dist/lib/hooks/worker.d.ts +56 -0
- package/dist/lib/hooks/worker.js +150 -0
- package/dist/lib/ingest-router.d.ts +25 -0
- package/dist/lib/ingest-router.js +103 -0
- package/dist/lib/ocr-detector.d.ts +61 -0
- package/dist/lib/ocr-detector.js +138 -0
- package/dist/lib/ocr-engine-stub.d.ts +48 -0
- package/dist/lib/ocr-engine-stub.js +190 -0
- package/dist/lib/ocr-engines/google-doc-ai.d.ts +36 -0
- package/dist/lib/ocr-engines/google-doc-ai.js +164 -0
- package/dist/lib/ocr-jobs.d.ts +67 -0
- package/dist/lib/ocr-jobs.js +129 -0
- package/dist/lib/op-audit-extension/ran-at-guard.d.ts +86 -0
- package/dist/lib/op-audit-extension/ran-at-guard.js +110 -0
- package/dist/lib/op-audit.d.ts +71 -0
- package/dist/lib/op-audit.js +777 -0
- package/dist/lib/privacy-br/detector.d.ts +42 -0
- package/dist/lib/privacy-br/detector.js +130 -0
- package/dist/lib/privacy-br/index.d.ts +20 -0
- package/dist/lib/privacy-br/index.js +20 -0
- package/dist/lib/privacy-br/integration.d.ts +71 -0
- package/dist/lib/privacy-br/integration.js +74 -0
- package/dist/lib/privacy-br/patterns.d.ts +117 -0
- package/dist/lib/privacy-br/patterns.js +434 -0
- package/dist/lib/privacy-br/redact.d.ts +42 -0
- package/dist/lib/privacy-br/redact.js +103 -0
- package/dist/lib/privacy-br/types.d.ts +55 -0
- package/dist/lib/privacy-br/types.js +25 -0
- package/dist/lib/regex-extract/extractor.d.ts +30 -0
- package/dist/lib/regex-extract/extractor.js +91 -0
- package/dist/lib/regex-extract/frontmatter.d.ts +44 -0
- package/dist/lib/regex-extract/frontmatter.js +169 -0
- package/dist/lib/regex-extract/index.d.ts +14 -0
- package/dist/lib/regex-extract/index.js +14 -0
- package/dist/lib/regex-extract/ingest-router-l4.d.ts +76 -0
- package/dist/lib/regex-extract/ingest-router-l4.js +102 -0
- package/dist/lib/regex-extract/patterns.d.ts +61 -0
- package/dist/lib/regex-extract/patterns.js +91 -0
- package/dist/lib/regex-extract/production-wire.d.ts +128 -0
- package/dist/lib/regex-extract/production-wire.js +202 -0
- package/dist/lib/regex-extract/reconcile.d.ts +162 -0
- package/dist/lib/regex-extract/reconcile.js +210 -0
- package/dist/lib/regex-extract/strip-code.d.ts +24 -0
- package/dist/lib/regex-extract/strip-code.js +52 -0
- package/dist/lib/regex-extract/types.d.ts +48 -0
- package/dist/lib/regex-extract/types.js +25 -0
- package/dist/lib/reranker.d.ts +80 -0
- package/dist/lib/reranker.js +324 -0
- package/dist/lib/shadow-tracker.d.ts +191 -0
- package/dist/lib/shadow-tracker.js +384 -0
- package/dist/lib/spo-injection.d.ts +52 -0
- package/dist/lib/spo-injection.js +166 -0
- package/dist/lib/telemetry-collector.d.ts +158 -0
- package/dist/lib/telemetry-collector.js +249 -0
- package/dist/lib/temporal-detector.d.ts +27 -0
- package/dist/lib/temporal-detector.js +81 -0
- package/dist/lib/viewer/auth.d.ts +37 -0
- package/dist/lib/viewer/auth.js +70 -0
- package/dist/lib/viewer/backpressure.d.ts +59 -0
- package/dist/lib/viewer/backpressure.js +100 -0
- package/dist/lib/viewer/broadcast-singleton.d.ts +34 -0
- package/dist/lib/viewer/broadcast-singleton.js +49 -0
- package/dist/lib/viewer/broadcast.d.ts +66 -0
- package/dist/lib/viewer/broadcast.js +96 -0
- package/dist/lib/viewer/event-types.d.ts +132 -0
- package/dist/lib/viewer/event-types.js +74 -0
- package/dist/lib/viewer/instrumentation.d.ts +106 -0
- package/dist/lib/viewer/instrumentation.js +224 -0
- package/dist/lib/viewer/migration.d.ts +23 -0
- package/dist/lib/viewer/migration.js +56 -0
- package/dist/lib/viewer/redaction.d.ts +44 -0
- package/dist/lib/viewer/redaction.js +139 -0
- package/dist/lib/viewer/session.d.ts +51 -0
- package/dist/lib/viewer/session.js +87 -0
- package/dist/mcp/tools/answer.d.ts +94 -0
- package/dist/mcp/tools/answer.js +213 -0
- package/dist/mcp/tools/archive.d.ts +152 -0
- package/dist/mcp/tools/archive.js +170 -0
- package/dist/mcp/tools/conflict.d.ts +44 -0
- package/dist/mcp/tools/conflict.js +130 -0
- package/dist/mcp/tools/hooks.d.ts +29 -0
- package/dist/mcp/tools/hooks.js +78 -0
- package/dist/mcp/tools/mark.d.ts +38 -0
- package/dist/mcp/tools/mark.js +82 -0
- package/dist/mcp/tools/viewer.d.ts +58 -0
- package/dist/mcp/tools/viewer.js +64 -0
- package/dist/mcp-server.d.ts +2 -0
- package/dist/mcp-server.js +395 -0
- package/dist/metrics.d.ts +3 -0
- package/dist/metrics.js +59 -0
- package/dist/noise-filter.d.ts +18 -0
- package/dist/noise-filter.js +142 -0
- package/dist/notion-sync.d.ts +7 -0
- package/dist/notion-sync.js +97 -0
- package/dist/observability/adapters/a3-adapter.d.ts +63 -0
- package/dist/observability/adapters/a3-adapter.js +83 -0
- package/dist/observability/adapters/p1-adapter.d.ts +49 -0
- package/dist/observability/adapters/p1-adapter.js +63 -0
- package/dist/observability/adapters/p5-adapter.d.ts +36 -0
- package/dist/observability/adapters/p5-adapter.js +71 -0
- package/dist/observability/cardinality.d.ts +61 -0
- package/dist/observability/cardinality.js +300 -0
- package/dist/observability/collectors/db-stats.collector.d.ts +9 -0
- package/dist/observability/collectors/db-stats.collector.js +88 -0
- package/dist/observability/collectors/eventbus.collector.d.ts +6 -0
- package/dist/observability/collectors/eventbus.collector.js +50 -0
- package/dist/observability/collectors/process.collector.d.ts +7 -0
- package/dist/observability/collectors/process.collector.js +93 -0
- package/dist/observability/collectors/provider-telemetry.collector.d.ts +11 -0
- package/dist/observability/collectors/provider-telemetry.collector.js +112 -0
- package/dist/observability/collectors/search-telemetry.collector.d.ts +12 -0
- package/dist/observability/collectors/search-telemetry.collector.js +76 -0
- package/dist/observability/exporter.d.ts +30 -0
- package/dist/observability/exporter.js +182 -0
- package/dist/observability/index.d.ts +22 -0
- package/dist/observability/index.js +21 -0
- package/dist/observability/metrics.d.ts +53 -0
- package/dist/observability/metrics.js +213 -0
- package/dist/observability/privacy-guard.d.ts +32 -0
- package/dist/observability/privacy-guard.js +116 -0
- package/dist/observability/record.d.ts +83 -0
- package/dist/observability/record.js +217 -0
- package/dist/observability/registry.d.ts +60 -0
- package/dist/observability/registry.js +93 -0
- package/dist/observability/types.d.ts +115 -0
- package/dist/observability/types.js +235 -0
- package/dist/observability.d.ts +131 -0
- package/dist/observability.js +234 -0
- package/dist/plugins/nox-hooks/index.d.ts +61 -0
- package/dist/plugins/nox-hooks/index.js +99 -0
- package/dist/primer.d.ts +1 -0
- package/dist/primer.js +100 -0
- package/dist/privacy/filter.d.ts +27 -0
- package/dist/privacy/filter.js +74 -0
- package/dist/privacy/patterns.d.ts +29 -0
- package/dist/privacy/patterns.js +178 -0
- package/dist/privacy/tag-parser.d.ts +24 -0
- package/dist/privacy/tag-parser.js +29 -0
- package/dist/project-context-gen.d.ts +10 -0
- package/dist/project-context-gen.js +106 -0
- package/dist/providers/embedding/gemini.d.ts +73 -0
- package/dist/providers/embedding/gemini.js +118 -0
- package/dist/providers/embedding/openai.d.ts +76 -0
- package/dist/providers/embedding/openai.js +123 -0
- package/dist/providers/embedding/types.d.ts +39 -0
- package/dist/providers/embedding/types.js +1 -0
- package/dist/providers/embedding/voyage.d.ts +36 -0
- package/dist/providers/embedding/voyage.js +29 -0
- package/dist/providers/index.d.ts +116 -0
- package/dist/providers/index.js +158 -0
- package/dist/providers/llm/anthropic.d.ts +29 -0
- package/dist/providers/llm/anthropic.js +28 -0
- package/dist/providers/llm/chain.d.ts +99 -0
- package/dist/providers/llm/chain.js +213 -0
- package/dist/providers/llm/gemini.d.ts +48 -0
- package/dist/providers/llm/gemini.js +96 -0
- package/dist/providers/llm/openai.d.ts +64 -0
- package/dist/providers/llm/openai.js +109 -0
- package/dist/providers/llm/types.d.ts +47 -0
- package/dist/providers/llm/types.js +1 -0
- package/dist/providers/telemetry.d.ts +87 -0
- package/dist/providers/telemetry.js +156 -0
- package/dist/providers/types.d.ts +42 -0
- package/dist/providers/types.js +59 -0
- package/dist/query-entity-count.d.ts +54 -0
- package/dist/query-entity-count.js +171 -0
- package/dist/reflect.d.ts +26 -0
- package/dist/reflect.js +290 -0
- package/dist/reindex-errors.d.ts +7 -0
- package/dist/reindex-errors.js +21 -0
- package/dist/reindex.d.ts +16 -0
- package/dist/reindex.js +293 -0
- package/dist/retention.d.ts +40 -0
- package/dist/retention.js +86 -0
- package/dist/salience.d.ts +85 -0
- package/dist/salience.js +245 -0
- package/dist/scripts/migrate-v17-ops-audit.d.ts +17 -0
- package/dist/scripts/migrate-v17-ops-audit.js +70 -0
- package/dist/search-dedup.d.ts +44 -0
- package/dist/search-dedup.js +137 -0
- package/dist/search-expansion.d.ts +20 -0
- package/dist/search-expansion.js +99 -0
- package/dist/search.d.ts +62 -0
- package/dist/search.js +582 -0
- package/dist/seh-detector.d.ts +31 -0
- package/dist/seh-detector.js +201 -0
- package/dist/self-improve.d.ts +1 -0
- package/dist/self-improve.js +189 -0
- package/dist/session-distill.d.ts +29 -0
- package/dist/session-distill.js +325 -0
- package/dist/session-update.d.ts +1 -0
- package/dist/session-update.js +54 -0
- package/dist/shared-memory.d.ts +24 -0
- package/dist/shared-memory.js +104 -0
- package/dist/stats.d.ts +1 -0
- package/dist/stats.js +44 -0
- package/dist/temporal-retrieval.d.ts +132 -0
- package/dist/temporal-retrieval.js +495 -0
- package/dist/tier-manager.d.ts +69 -0
- package/dist/tier-manager.js +225 -0
- package/dist/vectorize.d.ts +16 -0
- package/dist/vectorize.js +91 -0
- package/dist/watch.d.ts +8 -0
- package/dist/watch.js +124 -0
- package/package.json +74 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* T12 — CLI `nox-mem import` (framework-agnostic argv parser + runner).
|
|
3
|
+
*
|
|
4
|
+
* Detects encryption via `manifest.encryption.enabled` (always plaintext in
|
|
5
|
+
* the archive — D41 #2). Reads passphrase via env or interactive prompt.
|
|
6
|
+
*
|
|
7
|
+
* Args:
|
|
8
|
+
* <archive-path> positional, required
|
|
9
|
+
* --passphrase-env <ENV> read passphrase from env (preferred)
|
|
10
|
+
* --merge | --replace conflict mode (default: merge)
|
|
11
|
+
* --target-db <path> optional override (used by production wiring)
|
|
12
|
+
* --dry-run preview JSON, no DB writes
|
|
13
|
+
* --verify integrity check only, no decrypt-to-DB
|
|
14
|
+
*
|
|
15
|
+
* Exit codes: 0 ok, 1 system, 2 user (cancel/bad-args/cancelled prompt).
|
|
16
|
+
*/
|
|
17
|
+
import { readFile } from "node:fs/promises";
|
|
18
|
+
import { runImport, } from "../lib/archive/orchestrator.js";
|
|
19
|
+
import { getPassphrase } from "../lib/archive/encryption.js";
|
|
20
|
+
import { parseManifest } from "../lib/archive/manifest.js";
|
|
21
|
+
import { unpackArchive } from "../lib/archive/format.js";
|
|
22
|
+
export function parseImportArgs(argv) {
|
|
23
|
+
let positional;
|
|
24
|
+
const args = {
|
|
25
|
+
mode: "merge",
|
|
26
|
+
dryRun: false,
|
|
27
|
+
verifyOnly: false,
|
|
28
|
+
};
|
|
29
|
+
for (let i = 0; i < argv.length; i++) {
|
|
30
|
+
const arg = argv[i];
|
|
31
|
+
if (arg === "--passphrase" ||
|
|
32
|
+
arg.startsWith("--passphrase=") ||
|
|
33
|
+
arg === "-p") {
|
|
34
|
+
throw new CliError("REFUSED: passphrase must never be passed via argv (visible in `ps aux`).", 2);
|
|
35
|
+
}
|
|
36
|
+
switch (arg) {
|
|
37
|
+
case "--passphrase-env":
|
|
38
|
+
args.passphraseEnv = requireNext(argv, i++, "--passphrase-env");
|
|
39
|
+
break;
|
|
40
|
+
case "--merge":
|
|
41
|
+
args.mode = "merge";
|
|
42
|
+
break;
|
|
43
|
+
case "--replace":
|
|
44
|
+
args.mode = "replace";
|
|
45
|
+
break;
|
|
46
|
+
case "--target-db":
|
|
47
|
+
args.targetDb = requireNext(argv, i++, "--target-db");
|
|
48
|
+
break;
|
|
49
|
+
case "--dry-run":
|
|
50
|
+
args.dryRun = true;
|
|
51
|
+
break;
|
|
52
|
+
case "--verify":
|
|
53
|
+
args.verifyOnly = true;
|
|
54
|
+
break;
|
|
55
|
+
case "--help":
|
|
56
|
+
case "-h":
|
|
57
|
+
throw new CliHelpRequest();
|
|
58
|
+
default:
|
|
59
|
+
if (arg.startsWith("--")) {
|
|
60
|
+
throw new CliError(`Unknown flag: ${arg}`, 2);
|
|
61
|
+
}
|
|
62
|
+
if (positional) {
|
|
63
|
+
throw new CliError(`Only one positional archive path allowed (got ${positional} and ${arg})`, 2);
|
|
64
|
+
}
|
|
65
|
+
positional = arg;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!positional) {
|
|
69
|
+
throw new CliError("missing archive path (positional argument)", 2);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
archivePath: positional,
|
|
73
|
+
passphraseEnv: args.passphraseEnv,
|
|
74
|
+
mode: args.mode,
|
|
75
|
+
targetDb: args.targetDb,
|
|
76
|
+
dryRun: args.dryRun,
|
|
77
|
+
verifyOnly: args.verifyOnly,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function requireNext(argv, i, name) {
|
|
81
|
+
const v = argv[i + 1];
|
|
82
|
+
if (!v || v.startsWith("--")) {
|
|
83
|
+
throw new CliError(`${name} requires a value`, 2);
|
|
84
|
+
}
|
|
85
|
+
return v;
|
|
86
|
+
}
|
|
87
|
+
export async function runCliImport(argv, deps) {
|
|
88
|
+
const env = deps.env ?? process.env;
|
|
89
|
+
const log = deps.log ?? ((m) => process.stdout.write(m + "\n"));
|
|
90
|
+
let parsed;
|
|
91
|
+
try {
|
|
92
|
+
parsed = parseImportArgs(argv);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
if (err instanceof CliHelpRequest) {
|
|
96
|
+
log(HELP_TEXT);
|
|
97
|
+
return { exitCode: 0 };
|
|
98
|
+
}
|
|
99
|
+
if (err instanceof CliError) {
|
|
100
|
+
log(`error: ${err.message}`);
|
|
101
|
+
return { exitCode: err.exitCode };
|
|
102
|
+
}
|
|
103
|
+
throw err;
|
|
104
|
+
}
|
|
105
|
+
// Read archive
|
|
106
|
+
const reader = deps.readArchive ?? defaultReader;
|
|
107
|
+
let archive;
|
|
108
|
+
try {
|
|
109
|
+
archive = await reader(parsed.archivePath);
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
log(`error: failed to read ${parsed.archivePath}: ${err.message}`);
|
|
113
|
+
return { exitCode: 1 };
|
|
114
|
+
}
|
|
115
|
+
// Peek manifest BEFORE any decryption attempt — to know if passphrase is
|
|
116
|
+
// needed AND to validate signature shape early (fail fast).
|
|
117
|
+
let needsPassphrase = false;
|
|
118
|
+
try {
|
|
119
|
+
const entries = unpackArchive(archive);
|
|
120
|
+
const manifestEntry = entries.find((e) => e.name === "manifest.json");
|
|
121
|
+
if (!manifestEntry) {
|
|
122
|
+
throw new Error("manifest.json missing from archive");
|
|
123
|
+
}
|
|
124
|
+
const manifest = parseManifest(manifestEntry.content);
|
|
125
|
+
needsPassphrase = manifest.encryption.enabled === true;
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
log(`error: invalid archive: ${err.message}`);
|
|
129
|
+
return { exitCode: 1 };
|
|
130
|
+
}
|
|
131
|
+
let passphrase;
|
|
132
|
+
if (needsPassphrase) {
|
|
133
|
+
if (parsed.passphraseEnv) {
|
|
134
|
+
const v = env[parsed.passphraseEnv];
|
|
135
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
136
|
+
log(`error: env var ${parsed.passphraseEnv} is not set`);
|
|
137
|
+
return { exitCode: 2 };
|
|
138
|
+
}
|
|
139
|
+
passphrase = v;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
const prompt = deps.promptPassphrase ?? (() => getPassphrase({ envOverride: env, isTTY: deps.isTTY }));
|
|
143
|
+
try {
|
|
144
|
+
passphrase = await prompt();
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
log(`error: ${err.message}`);
|
|
148
|
+
return { exitCode: 2 };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const currentSchemaVersion = await deps.currentSchemaVersion();
|
|
153
|
+
const existing = parsed.verifyOnly
|
|
154
|
+
? { chunks: [], kg_entities: [], kg_relations: [], ops_audit: [] }
|
|
155
|
+
: await deps.loadExisting();
|
|
156
|
+
let lastPrint = Date.now();
|
|
157
|
+
const onProgress = (ev) => {
|
|
158
|
+
const now = Date.now();
|
|
159
|
+
switch (ev.phase) {
|
|
160
|
+
case "import.start":
|
|
161
|
+
log("[import] starting");
|
|
162
|
+
break;
|
|
163
|
+
case "import.unpack":
|
|
164
|
+
log(`[import] unpacked ${ev.entries} entries`);
|
|
165
|
+
break;
|
|
166
|
+
case "import.decrypt":
|
|
167
|
+
log(`[import] decrypting ${ev.files} files…`);
|
|
168
|
+
break;
|
|
169
|
+
case "import.migrate":
|
|
170
|
+
log(`[import] migrating schema v${ev.from} → v${ev.to} (${ev.steps} steps)`);
|
|
171
|
+
break;
|
|
172
|
+
case "import.chunks":
|
|
173
|
+
if (now - lastPrint > 500 || ev.imported === ev.total) {
|
|
174
|
+
log(`[import] chunks: ${ev.imported}/${ev.total}`);
|
|
175
|
+
lastPrint = now;
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
case "import.kg":
|
|
179
|
+
log(`[import] kg: ${ev.imported}/${ev.total}`);
|
|
180
|
+
break;
|
|
181
|
+
case "import.done":
|
|
182
|
+
log(`[import] done — ${ev.duration_ms} ms`);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const req = {
|
|
187
|
+
archive,
|
|
188
|
+
passphrase,
|
|
189
|
+
mode: parsed.mode,
|
|
190
|
+
dry_run: parsed.dryRun,
|
|
191
|
+
verify_only: parsed.verifyOnly,
|
|
192
|
+
current_schema_version: currentSchemaVersion,
|
|
193
|
+
existing,
|
|
194
|
+
signal: deps.signal,
|
|
195
|
+
onProgress,
|
|
196
|
+
};
|
|
197
|
+
let result;
|
|
198
|
+
try {
|
|
199
|
+
result = await runImport(req);
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
const msg = err.message;
|
|
203
|
+
if (/cancel/i.test(msg)) {
|
|
204
|
+
log(`[import] cancelled: ${msg}`);
|
|
205
|
+
return { exitCode: 2 };
|
|
206
|
+
}
|
|
207
|
+
log(`error: ${msg}`);
|
|
208
|
+
return { exitCode: 1 };
|
|
209
|
+
}
|
|
210
|
+
// Persist (or skip for dry-run / verify_only)
|
|
211
|
+
if (!parsed.dryRun && !parsed.verifyOnly) {
|
|
212
|
+
if (deps.persist) {
|
|
213
|
+
try {
|
|
214
|
+
await deps.persist(result.resolved);
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
log(`error: persist failed: ${err.message}`);
|
|
218
|
+
return { exitCode: 1 };
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// Summary
|
|
223
|
+
log("--- import summary ---");
|
|
224
|
+
log(JSON.stringify({
|
|
225
|
+
mode: parsed.mode,
|
|
226
|
+
dry_run: parsed.dryRun,
|
|
227
|
+
verify_only: parsed.verifyOnly,
|
|
228
|
+
target_db: parsed.targetDb ?? "<default>",
|
|
229
|
+
stats: result.stats,
|
|
230
|
+
duration_ms: result.duration_ms,
|
|
231
|
+
}, null, 2));
|
|
232
|
+
return { exitCode: 0, result };
|
|
233
|
+
}
|
|
234
|
+
async function defaultReader(p) {
|
|
235
|
+
return await readFile(p);
|
|
236
|
+
}
|
|
237
|
+
class CliError extends Error {
|
|
238
|
+
exitCode;
|
|
239
|
+
constructor(message, exitCode) {
|
|
240
|
+
super(message);
|
|
241
|
+
this.exitCode = exitCode;
|
|
242
|
+
this.name = "CliError";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
class CliHelpRequest extends Error {
|
|
246
|
+
constructor() {
|
|
247
|
+
super("help");
|
|
248
|
+
this.name = "CliHelpRequest";
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const HELP_TEXT = `
|
|
252
|
+
nox-mem import — restore memory state from an archive
|
|
253
|
+
|
|
254
|
+
Usage:
|
|
255
|
+
nox-mem import <archive-path> [options]
|
|
256
|
+
|
|
257
|
+
Options:
|
|
258
|
+
--passphrase-env <ENV> Read passphrase from env (required for encrypted archives)
|
|
259
|
+
--merge Skip rows that already exist (default)
|
|
260
|
+
--replace Wipe target tables before inserting (ops_audit always preserved)
|
|
261
|
+
--target-db <path> Target DB path (default: current configured DB)
|
|
262
|
+
--dry-run Preview JSON, no DB writes
|
|
263
|
+
--verify Integrity check only (checksums + GCM tags + FK), no DB writes
|
|
264
|
+
-h, --help Show this help
|
|
265
|
+
|
|
266
|
+
Security:
|
|
267
|
+
Passphrase is NEVER read from argv. Use --passphrase-env or interactive prompt.
|
|
268
|
+
|
|
269
|
+
Examples:
|
|
270
|
+
nox-mem import /backup/nox.tgz # interactive passphrase prompt
|
|
271
|
+
NOX_IMPORT_PASS=hunter2 nox-mem import /backup/nox.tgz --passphrase-env NOX_IMPORT_PASS
|
|
272
|
+
nox-mem import /backup/nox.tgz --dry-run # preview, no writes
|
|
273
|
+
nox-mem import /backup/nox.tgz --verify # integrity only
|
|
274
|
+
`.trim();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/cli/mark.ts — CLI front-end for L3 mark workflow.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* nox-mem mark <chunk-id> --canonical → confidence=1.0 + provenance=user-marked
|
|
6
|
+
* nox-mem mark <chunk-id> --refuted → confidence=0.05 + provenance=user-marked
|
|
7
|
+
* nox-mem mark <chunk-id> --stale → provenance=user-marked (confidence unchanged)
|
|
8
|
+
* nox-mem mark <chunk-id> --supersede-by <id> → set superseded_by FK, mark stale
|
|
9
|
+
* nox-mem mark <chunk-id> --notes "..." → optional free text → ops_audit
|
|
10
|
+
*
|
|
11
|
+
* Returns JSON to stdout. Non-zero exit on error.
|
|
12
|
+
*
|
|
13
|
+
* Append-only audit guarantee preserved: all ops emit an ops_audit row via
|
|
14
|
+
* mark.ts core; this CLI layer only parses argv + dispatches.
|
|
15
|
+
*/
|
|
16
|
+
import type { Db } from "../lib/confidence/db-shim.js";
|
|
17
|
+
import type { MarkKind, MarkResult } from "../lib/confidence/types.js";
|
|
18
|
+
export interface ParsedArgs {
|
|
19
|
+
chunk_id: number;
|
|
20
|
+
kind?: MarkKind;
|
|
21
|
+
supersede_by?: number;
|
|
22
|
+
notes?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class CliError extends Error {
|
|
25
|
+
readonly code: string;
|
|
26
|
+
constructor(code: string, message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Parses `mark <id> [--canonical|--refuted|--stale] [--supersede-by N] [--notes "..."]`. */
|
|
29
|
+
export declare function parseMarkArgs(argv: string[]): ParsedArgs;
|
|
30
|
+
/** Runs the parsed CLI op against `db`. Returns the MarkResult JSON. */
|
|
31
|
+
export declare function runMark(db: Db, args: ParsedArgs): MarkResult;
|
|
32
|
+
/** Top-level CLI entry: argv slice + db handle → printable JSON string. */
|
|
33
|
+
export declare function markCommand(db: Db, argv: string[]): string;
|
package/dist/cli/mark.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/cli/mark.ts — CLI front-end for L3 mark workflow.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* nox-mem mark <chunk-id> --canonical → confidence=1.0 + provenance=user-marked
|
|
6
|
+
* nox-mem mark <chunk-id> --refuted → confidence=0.05 + provenance=user-marked
|
|
7
|
+
* nox-mem mark <chunk-id> --stale → provenance=user-marked (confidence unchanged)
|
|
8
|
+
* nox-mem mark <chunk-id> --supersede-by <id> → set superseded_by FK, mark stale
|
|
9
|
+
* nox-mem mark <chunk-id> --notes "..." → optional free text → ops_audit
|
|
10
|
+
*
|
|
11
|
+
* Returns JSON to stdout. Non-zero exit on error.
|
|
12
|
+
*
|
|
13
|
+
* Append-only audit guarantee preserved: all ops emit an ops_audit row via
|
|
14
|
+
* mark.ts core; this CLI layer only parses argv + dispatches.
|
|
15
|
+
*/
|
|
16
|
+
import { markChunk, supersedeChunk, } from "../lib/confidence/mark.js";
|
|
17
|
+
import { resolveConfig } from "../lib/confidence/config.js";
|
|
18
|
+
export class CliError extends Error {
|
|
19
|
+
code;
|
|
20
|
+
constructor(code, message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.code = code;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Parses `mark <id> [--canonical|--refuted|--stale] [--supersede-by N] [--notes "..."]`. */
|
|
26
|
+
export function parseMarkArgs(argv) {
|
|
27
|
+
// argv expected to start at first arg after "mark"
|
|
28
|
+
if (argv.length === 0) {
|
|
29
|
+
throw new CliError("usage", "missing chunk_id");
|
|
30
|
+
}
|
|
31
|
+
const idStr = argv[0];
|
|
32
|
+
if (idStr === undefined) {
|
|
33
|
+
throw new CliError("usage", "missing chunk_id");
|
|
34
|
+
}
|
|
35
|
+
const chunk_id = parseInt(idStr, 10);
|
|
36
|
+
if (!Number.isFinite(chunk_id) || chunk_id <= 0) {
|
|
37
|
+
throw new CliError("usage", `invalid chunk_id: ${idStr}`);
|
|
38
|
+
}
|
|
39
|
+
let kind;
|
|
40
|
+
let supersede_by;
|
|
41
|
+
let notes;
|
|
42
|
+
for (let i = 1; i < argv.length; i++) {
|
|
43
|
+
const arg = argv[i];
|
|
44
|
+
if (arg === "--canonical")
|
|
45
|
+
kind = "canonical";
|
|
46
|
+
else if (arg === "--refuted")
|
|
47
|
+
kind = "refuted";
|
|
48
|
+
else if (arg === "--stale")
|
|
49
|
+
kind = "stale";
|
|
50
|
+
else if (arg === "--supersede-by") {
|
|
51
|
+
const next = argv[++i];
|
|
52
|
+
if (next === undefined) {
|
|
53
|
+
throw new CliError("usage", "--supersede-by requires an id");
|
|
54
|
+
}
|
|
55
|
+
const n = parseInt(next, 10);
|
|
56
|
+
if (!Number.isFinite(n) || n <= 0) {
|
|
57
|
+
throw new CliError("usage", `invalid supersede-by id: ${next}`);
|
|
58
|
+
}
|
|
59
|
+
supersede_by = n;
|
|
60
|
+
}
|
|
61
|
+
else if (arg === "--notes") {
|
|
62
|
+
const next = argv[++i];
|
|
63
|
+
if (next === undefined) {
|
|
64
|
+
throw new CliError("usage", "--notes requires a string");
|
|
65
|
+
}
|
|
66
|
+
notes = next;
|
|
67
|
+
}
|
|
68
|
+
else if (arg !== undefined) {
|
|
69
|
+
throw new CliError("usage", `unknown flag: ${arg}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!kind && supersede_by === undefined) {
|
|
73
|
+
throw new CliError("usage", "must specify one of --canonical, --refuted, --stale, --supersede-by");
|
|
74
|
+
}
|
|
75
|
+
return { chunk_id, kind, supersede_by, notes };
|
|
76
|
+
}
|
|
77
|
+
/** Runs the parsed CLI op against `db`. Returns the MarkResult JSON. */
|
|
78
|
+
export function runMark(db, args) {
|
|
79
|
+
const cfg = resolveConfig();
|
|
80
|
+
if (args.supersede_by !== undefined) {
|
|
81
|
+
// Supersede implies stale; run supersede first then mark stale for audit.
|
|
82
|
+
const supersedeResult = supersedeChunk({
|
|
83
|
+
db,
|
|
84
|
+
chunk_id: args.chunk_id,
|
|
85
|
+
by_chunk_id: args.supersede_by,
|
|
86
|
+
notes: args.notes,
|
|
87
|
+
cfg,
|
|
88
|
+
});
|
|
89
|
+
if (args.kind && args.kind !== "stale") {
|
|
90
|
+
// Caller explicitly combined supersede + canonical/refuted — apply mark.
|
|
91
|
+
return markChunk({
|
|
92
|
+
db,
|
|
93
|
+
chunk_id: args.chunk_id,
|
|
94
|
+
kind: args.kind,
|
|
95
|
+
notes: args.notes,
|
|
96
|
+
cfg,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return supersedeResult;
|
|
100
|
+
}
|
|
101
|
+
if (!args.kind) {
|
|
102
|
+
// Should be unreachable due to parseMarkArgs validation.
|
|
103
|
+
throw new CliError("usage", "no kind specified");
|
|
104
|
+
}
|
|
105
|
+
return markChunk({
|
|
106
|
+
db,
|
|
107
|
+
chunk_id: args.chunk_id,
|
|
108
|
+
kind: args.kind,
|
|
109
|
+
notes: args.notes,
|
|
110
|
+
cfg,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** Top-level CLI entry: argv slice + db handle → printable JSON string. */
|
|
114
|
+
export function markCommand(db, argv) {
|
|
115
|
+
try {
|
|
116
|
+
const parsed = parseMarkArgs(argv);
|
|
117
|
+
const result = runMark(db, parsed);
|
|
118
|
+
return JSON.stringify(result, null, 2);
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
if (err instanceof CliError) {
|
|
122
|
+
return JSON.stringify({ ok: false, code: err.code, error: err.message });
|
|
123
|
+
}
|
|
124
|
+
return JSON.stringify({
|
|
125
|
+
ok: false,
|
|
126
|
+
code: "runtime",
|
|
127
|
+
error: err instanceof Error ? err.message : String(err),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { sha256OfFile } from "../lib/ocr-jobs.js";
|
|
2
|
+
export interface OcrBatchOpts {
|
|
3
|
+
folder?: string;
|
|
4
|
+
engine: string;
|
|
5
|
+
forceOcr: boolean;
|
|
6
|
+
limit: number;
|
|
7
|
+
dryRun: boolean;
|
|
8
|
+
smokeTest?: string;
|
|
9
|
+
retryFailed?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function ocrBatch(opts: OcrBatchOpts): Promise<void>;
|
|
12
|
+
export { sha256OfFile };
|