@getrift/rift 0.1.0-beta.2 → 0.1.0-beta.21
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/README.md +35 -9
- package/dist/src/auth/keychain.d.ts +9 -0
- package/dist/src/auth/keychain.d.ts.map +1 -1
- package/dist/src/auth/keychain.js +37 -0
- package/dist/src/auth/keychain.js.map +1 -1
- package/dist/src/capture/auto-capture.d.ts +7 -0
- package/dist/src/capture/auto-capture.d.ts.map +1 -1
- package/dist/src/capture/auto-capture.js +82 -15
- package/dist/src/capture/auto-capture.js.map +1 -1
- package/dist/src/capture/auto-repair.d.ts +110 -0
- package/dist/src/capture/auto-repair.d.ts.map +1 -0
- package/dist/src/capture/auto-repair.js +269 -0
- package/dist/src/capture/auto-repair.js.map +1 -0
- package/dist/src/capture/codex-cli-triage-provider.d.ts.map +1 -1
- package/dist/src/capture/codex-cli-triage-provider.js +4 -3
- package/dist/src/capture/codex-cli-triage-provider.js.map +1 -1
- package/dist/src/capture/observability.d.ts +42 -0
- package/dist/src/capture/observability.d.ts.map +1 -1
- package/dist/src/capture/observability.js +45 -4
- package/dist/src/capture/observability.js.map +1 -1
- package/dist/src/capture/recover-quarantine.d.ts +260 -0
- package/dist/src/capture/recover-quarantine.d.ts.map +1 -0
- package/dist/src/capture/recover-quarantine.js +522 -0
- package/dist/src/capture/recover-quarantine.js.map +1 -0
- package/dist/src/cli/commands/backfill.d.ts.map +1 -1
- package/dist/src/cli/commands/backfill.js +5 -2
- package/dist/src/cli/commands/backfill.js.map +1 -1
- package/dist/src/cli/commands/capture-recover.d.ts +40 -0
- package/dist/src/cli/commands/capture-recover.d.ts.map +1 -0
- package/dist/src/cli/commands/capture-recover.js +184 -0
- package/dist/src/cli/commands/capture-recover.js.map +1 -0
- package/dist/src/cli/commands/capture.d.ts.map +1 -1
- package/dist/src/cli/commands/capture.js +96 -5
- package/dist/src/cli/commands/capture.js.map +1 -1
- package/dist/src/cli/commands/doctor.d.ts +6 -0
- package/dist/src/cli/commands/doctor.d.ts.map +1 -0
- package/dist/src/cli/commands/doctor.js +242 -0
- package/dist/src/cli/commands/doctor.js.map +1 -0
- package/dist/src/cli/commands/feedback.d.ts +12 -0
- package/dist/src/cli/commands/feedback.d.ts.map +1 -1
- package/dist/src/cli/commands/feedback.js +93 -4
- package/dist/src/cli/commands/feedback.js.map +1 -1
- package/dist/src/cli/commands/mcp-install.js +5 -2
- package/dist/src/cli/commands/mcp-install.js.map +1 -1
- package/dist/src/cli/commands/menubar.d.ts +80 -0
- package/dist/src/cli/commands/menubar.d.ts.map +1 -0
- package/dist/src/cli/commands/menubar.js +388 -0
- package/dist/src/cli/commands/menubar.js.map +1 -0
- package/dist/src/cli/commands/onboard.d.ts +143 -5
- package/dist/src/cli/commands/onboard.d.ts.map +1 -1
- package/dist/src/cli/commands/onboard.js +844 -188
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/commands/rebuild.d.ts.map +1 -1
- package/dist/src/cli/commands/rebuild.js +6 -3
- package/dist/src/cli/commands/rebuild.js.map +1 -1
- package/dist/src/cli/commands/reconcile.d.ts.map +1 -1
- package/dist/src/cli/commands/reconcile.js +12 -0
- package/dist/src/cli/commands/reconcile.js.map +1 -1
- package/dist/src/cli/commands/review.d.ts.map +1 -1
- package/dist/src/cli/commands/review.js +22 -7
- package/dist/src/cli/commands/review.js.map +1 -1
- package/dist/src/cli/commands/search.d.ts +2 -0
- package/dist/src/cli/commands/search.d.ts.map +1 -1
- package/dist/src/cli/commands/search.js +34 -4
- package/dist/src/cli/commands/search.js.map +1 -1
- package/dist/src/cli/commands/status.d.ts +9 -7
- package/dist/src/cli/commands/status.d.ts.map +1 -1
- package/dist/src/cli/commands/status.js +117 -12
- package/dist/src/cli/commands/status.js.map +1 -1
- package/dist/src/cli/commands/token-issue.d.ts.map +1 -1
- package/dist/src/cli/commands/token-issue.js +9 -1
- package/dist/src/cli/commands/token-issue.js.map +1 -1
- package/dist/src/cli/commands/triage.d.ts.map +1 -1
- package/dist/src/cli/commands/triage.js +7 -5
- package/dist/src/cli/commands/triage.js.map +1 -1
- package/dist/src/cli/commands/update.d.ts +80 -0
- package/dist/src/cli/commands/update.d.ts.map +1 -0
- package/dist/src/cli/commands/update.js +390 -0
- package/dist/src/cli/commands/update.js.map +1 -0
- package/dist/src/cli/default-config-path.d.ts +15 -0
- package/dist/src/cli/default-config-path.d.ts.map +1 -0
- package/dist/src/cli/default-config-path.js +27 -0
- package/dist/src/cli/default-config-path.js.map +1 -0
- package/dist/src/cli/feedback/feedback-config.d.ts +46 -0
- package/dist/src/cli/feedback/feedback-config.d.ts.map +1 -1
- package/dist/src/cli/feedback/feedback-config.js +130 -4
- package/dist/src/cli/feedback/feedback-config.js.map +1 -1
- package/dist/src/cli/feedback/feedback-history.d.ts +7 -0
- package/dist/src/cli/feedback/feedback-history.d.ts.map +1 -1
- package/dist/src/cli/feedback/feedback-history.js +39 -9
- package/dist/src/cli/feedback/feedback-history.js.map +1 -1
- package/dist/src/cli/feedback/feedback-payload.d.ts +22 -1
- package/dist/src/cli/feedback/feedback-payload.d.ts.map +1 -1
- package/dist/src/cli/feedback/feedback-payload.js.map +1 -1
- package/dist/src/cli/feedback/feedback-relay.d.ts +2 -2
- package/dist/src/cli/feedback/feedback-relay.d.ts.map +1 -1
- package/dist/src/cli/feedback/feedback-relay.js.map +1 -1
- package/dist/src/cli/feedback/invite.d.ts +17 -0
- package/dist/src/cli/feedback/invite.d.ts.map +1 -0
- package/dist/src/cli/feedback/invite.js +67 -0
- package/dist/src/cli/feedback/invite.js.map +1 -0
- package/dist/src/cli/feedback/relay-secret-store.d.ts +32 -0
- package/dist/src/cli/feedback/relay-secret-store.d.ts.map +1 -0
- package/dist/src/cli/feedback/relay-secret-store.js +137 -0
- package/dist/src/cli/feedback/relay-secret-store.js.map +1 -0
- package/dist/src/cli/http-client.d.ts +93 -1
- package/dist/src/cli/http-client.d.ts.map +1 -1
- package/dist/src/cli/http-client.js +254 -6
- package/dist/src/cli/http-client.js.map +1 -1
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +29 -6
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/postinstall-menubar.d.ts +22 -0
- package/dist/src/cli/postinstall-menubar.d.ts.map +1 -0
- package/dist/src/cli/postinstall-menubar.js +53 -0
- package/dist/src/cli/postinstall-menubar.js.map +1 -0
- package/dist/src/cli/status/friend-header.d.ts +16 -1
- package/dist/src/cli/status/friend-header.d.ts.map +1 -1
- package/dist/src/cli/status/friend-header.js +354 -26
- package/dist/src/cli/status/friend-header.js.map +1 -1
- package/dist/src/cli/status/local-signals.d.ts +18 -0
- package/dist/src/cli/status/local-signals.d.ts.map +1 -1
- package/dist/src/cli/status/local-signals.js +29 -0
- package/dist/src/cli/status/local-signals.js.map +1 -1
- package/dist/src/cli/ui.d.ts +47 -0
- package/dist/src/cli/ui.d.ts.map +1 -0
- package/dist/src/cli/ui.js +166 -0
- package/dist/src/cli/ui.js.map +1 -0
- package/dist/src/config/schema.d.ts +79 -0
- package/dist/src/config/schema.d.ts.map +1 -1
- package/dist/src/config/schema.js +44 -0
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/diagnostics/codex-preflight.d.ts +33 -0
- package/dist/src/diagnostics/codex-preflight.d.ts.map +1 -0
- package/dist/src/diagnostics/codex-preflight.js +75 -0
- package/dist/src/diagnostics/codex-preflight.js.map +1 -0
- package/dist/src/diagnostics/doctor.d.ts +114 -0
- package/dist/src/diagnostics/doctor.d.ts.map +1 -0
- package/dist/src/diagnostics/doctor.js +352 -0
- package/dist/src/diagnostics/doctor.js.map +1 -0
- package/dist/src/diagnostics/notify.d.ts +90 -0
- package/dist/src/diagnostics/notify.d.ts.map +1 -0
- package/dist/src/diagnostics/notify.js +177 -0
- package/dist/src/diagnostics/notify.js.map +1 -0
- package/dist/src/diagnostics/repair-prompt.d.ts +49 -0
- package/dist/src/diagnostics/repair-prompt.d.ts.map +1 -0
- package/dist/src/diagnostics/repair-prompt.js +223 -0
- package/dist/src/diagnostics/repair-prompt.js.map +1 -0
- package/dist/src/ingestion/inbox-core/conversation-fingerprint.d.ts +2 -0
- package/dist/src/ingestion/inbox-core/conversation-fingerprint.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/conversation-fingerprint.js +27 -0
- package/dist/src/ingestion/inbox-core/conversation-fingerprint.js.map +1 -0
- package/dist/src/ingestion/inbox-core/conversation-key.d.ts +2 -0
- package/dist/src/ingestion/inbox-core/conversation-key.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/conversation-key.js +31 -0
- package/dist/src/ingestion/inbox-core/conversation-key.js.map +1 -0
- package/dist/src/ingestion/inbox-core/extensions.d.ts +3 -0
- package/dist/src/ingestion/inbox-core/extensions.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/extensions.js +16 -0
- package/dist/src/ingestion/inbox-core/extensions.js.map +1 -0
- package/dist/src/ingestion/inbox-core/idempotency.d.ts +2 -0
- package/dist/src/ingestion/inbox-core/idempotency.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/idempotency.js +22 -0
- package/dist/src/ingestion/inbox-core/idempotency.js.map +1 -0
- package/dist/src/ingestion/inbox-core/index.d.ts +20 -0
- package/dist/src/ingestion/inbox-core/index.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/index.js +20 -0
- package/dist/src/ingestion/inbox-core/index.js.map +1 -0
- package/dist/src/ingestion/inbox-core/source-detection.d.ts +2 -0
- package/dist/src/ingestion/inbox-core/source-detection.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/source-detection.js +23 -0
- package/dist/src/ingestion/inbox-core/source-detection.js.map +1 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.d.ts +11 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.js +69 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.js.map +1 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts +70 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.js +161 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.js.map +1 -0
- package/dist/src/ingestion/inbox-watcher.d.ts.map +1 -1
- package/dist/src/ingestion/inbox-watcher.js +34 -50
- package/dist/src/ingestion/inbox-watcher.js.map +1 -1
- package/dist/src/ingestion/indexer.d.ts +7 -0
- package/dist/src/ingestion/indexer.d.ts.map +1 -1
- package/dist/src/ingestion/indexer.js +36 -2
- package/dist/src/ingestion/indexer.js.map +1 -1
- package/dist/src/ingestion/metadata-extraction.d.ts +8 -5
- package/dist/src/ingestion/metadata-extraction.d.ts.map +1 -1
- package/dist/src/ingestion/metadata-extraction.js +24 -5
- package/dist/src/ingestion/metadata-extraction.js.map +1 -1
- package/dist/src/ingestion/skip-quarantine.d.ts +10 -0
- package/dist/src/ingestion/skip-quarantine.d.ts.map +1 -0
- package/dist/src/ingestion/skip-quarantine.js +35 -0
- package/dist/src/ingestion/skip-quarantine.js.map +1 -0
- package/dist/src/jobs/handlers/compact.d.ts.map +1 -1
- package/dist/src/jobs/handlers/compact.js +30 -4
- package/dist/src/jobs/handlers/compact.js.map +1 -1
- package/dist/src/jobs/handlers/dedupe-conversations.d.ts +134 -0
- package/dist/src/jobs/handlers/dedupe-conversations.d.ts.map +1 -0
- package/dist/src/jobs/handlers/dedupe-conversations.js +371 -0
- package/dist/src/jobs/handlers/dedupe-conversations.js.map +1 -0
- package/dist/src/jobs/handlers/ingest.d.ts.map +1 -1
- package/dist/src/jobs/handlers/ingest.js +295 -41
- package/dist/src/jobs/handlers/ingest.js.map +1 -1
- package/dist/src/jobs/handlers/reconcile.d.ts +28 -0
- package/dist/src/jobs/handlers/reconcile.d.ts.map +1 -1
- package/dist/src/jobs/handlers/reconcile.js +145 -19
- package/dist/src/jobs/handlers/reconcile.js.map +1 -1
- package/dist/src/jobs/handlers/reindex.d.ts.map +1 -1
- package/dist/src/jobs/handlers/reindex.js +13 -2
- package/dist/src/jobs/handlers/reindex.js.map +1 -1
- package/dist/src/jobs/handlers/save.d.ts.map +1 -1
- package/dist/src/jobs/handlers/save.js +57 -3
- package/dist/src/jobs/handlers/save.js.map +1 -1
- package/dist/src/jobs/queue.d.ts +51 -1
- package/dist/src/jobs/queue.d.ts.map +1 -1
- package/dist/src/jobs/queue.js +466 -26
- package/dist/src/jobs/queue.js.map +1 -1
- package/dist/src/jobs/worker-entry.d.ts.map +1 -1
- package/dist/src/jobs/worker-entry.js +35 -7
- package/dist/src/jobs/worker-entry.js.map +1 -1
- package/dist/src/jobs/worker-process.d.ts +11 -0
- package/dist/src/jobs/worker-process.d.ts.map +1 -1
- package/dist/src/jobs/worker-process.js +37 -4
- package/dist/src/jobs/worker-process.js.map +1 -1
- package/dist/src/main.js +199 -46
- package/dist/src/main.js.map +1 -1
- package/dist/src/mcp/errors.d.ts.map +1 -1
- package/dist/src/mcp/errors.js +20 -1
- package/dist/src/mcp/errors.js.map +1 -1
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +43 -3
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools/context-pack.d.ts.map +1 -1
- package/dist/src/mcp/tools/context-pack.js +164 -23
- package/dist/src/mcp/tools/context-pack.js.map +1 -1
- package/dist/src/mcp/tools/search.d.ts +6 -2
- package/dist/src/mcp/tools/search.d.ts.map +1 -1
- package/dist/src/mcp/tools/search.js +35 -4
- package/dist/src/mcp/tools/search.js.map +1 -1
- package/dist/src/observability/embedding-events.d.ts +52 -0
- package/dist/src/observability/embedding-events.d.ts.map +1 -0
- package/dist/src/observability/embedding-events.js +149 -0
- package/dist/src/observability/embedding-events.js.map +1 -0
- package/dist/src/observability/index-events.d.ts +70 -0
- package/dist/src/observability/index-events.d.ts.map +1 -0
- package/dist/src/observability/index-events.js +148 -0
- package/dist/src/observability/index-events.js.map +1 -0
- package/dist/src/observability/onboarding-metric.d.ts +131 -0
- package/dist/src/observability/onboarding-metric.d.ts.map +1 -0
- package/dist/src/observability/onboarding-metric.js +351 -0
- package/dist/src/observability/onboarding-metric.js.map +1 -0
- package/dist/src/observability/tool-usage-stats.d.ts +77 -4
- package/dist/src/observability/tool-usage-stats.d.ts.map +1 -1
- package/dist/src/observability/tool-usage-stats.js +112 -32
- package/dist/src/observability/tool-usage-stats.js.map +1 -1
- package/dist/src/observability/tool-usage.d.ts +100 -7
- package/dist/src/observability/tool-usage.d.ts.map +1 -1
- package/dist/src/observability/tool-usage.js +196 -33
- package/dist/src/observability/tool-usage.js.map +1 -1
- package/dist/src/observability/version-check.d.ts +71 -0
- package/dist/src/observability/version-check.d.ts.map +1 -0
- package/dist/src/observability/version-check.js +198 -0
- package/dist/src/observability/version-check.js.map +1 -0
- package/dist/src/providers/basic-metadata-extraction.d.ts +60 -0
- package/dist/src/providers/basic-metadata-extraction.d.ts.map +1 -0
- package/dist/src/providers/basic-metadata-extraction.js +114 -0
- package/dist/src/providers/basic-metadata-extraction.js.map +1 -0
- package/dist/src/providers/codex-cli-metadata-extraction.d.ts +1 -0
- package/dist/src/providers/codex-cli-metadata-extraction.d.ts.map +1 -1
- package/dist/src/providers/codex-cli-metadata-extraction.js +6 -2
- package/dist/src/providers/codex-cli-metadata-extraction.js.map +1 -1
- package/dist/src/providers/codex-cli-model.d.ts +61 -0
- package/dist/src/providers/codex-cli-model.d.ts.map +1 -0
- package/dist/src/providers/codex-cli-model.js +194 -0
- package/dist/src/providers/codex-cli-model.js.map +1 -0
- package/dist/src/providers/codex-cli-runner.d.ts +39 -0
- package/dist/src/providers/codex-cli-runner.d.ts.map +1 -1
- package/dist/src/providers/codex-cli-runner.js +234 -48
- package/dist/src/providers/codex-cli-runner.js.map +1 -1
- package/dist/src/providers/conversation-generation.d.ts.map +1 -1
- package/dist/src/providers/conversation-generation.js +43 -6
- package/dist/src/providers/conversation-generation.js.map +1 -1
- package/dist/src/providers/ollama-embed.d.ts +2 -1
- package/dist/src/providers/ollama-embed.d.ts.map +1 -1
- package/dist/src/providers/ollama-embed.js +1 -0
- package/dist/src/providers/ollama-embed.js.map +1 -1
- package/dist/src/providers/openai-metadata-extraction.d.ts +3 -3
- package/dist/src/providers/openai-metadata-extraction.d.ts.map +1 -1
- package/dist/src/providers/openai-metadata-extraction.js +18 -3
- package/dist/src/providers/openai-metadata-extraction.js.map +1 -1
- package/dist/src/providers/placeholder-embed.d.ts +56 -0
- package/dist/src/providers/placeholder-embed.d.ts.map +1 -0
- package/dist/src/providers/placeholder-embed.js +64 -0
- package/dist/src/providers/placeholder-embed.js.map +1 -0
- package/dist/src/providers/stub.d.ts +2 -0
- package/dist/src/providers/stub.d.ts.map +1 -1
- package/dist/src/providers/stub.js +2 -0
- package/dist/src/providers/stub.js.map +1 -1
- package/dist/src/providers/types.d.ts +11 -0
- package/dist/src/providers/types.d.ts.map +1 -1
- package/dist/src/providers/voyage.d.ts +2 -1
- package/dist/src/providers/voyage.d.ts.map +1 -1
- package/dist/src/providers/voyage.js +1 -0
- package/dist/src/providers/voyage.js.map +1 -1
- package/dist/src/retrieval/compact.d.ts +116 -2
- package/dist/src/retrieval/compact.d.ts.map +1 -1
- package/dist/src/retrieval/compact.js +158 -5
- package/dist/src/retrieval/compact.js.map +1 -1
- package/dist/src/retrieval/context-pack.d.ts +114 -0
- package/dist/src/retrieval/context-pack.d.ts.map +1 -1
- package/dist/src/retrieval/context-pack.js +292 -8
- package/dist/src/retrieval/context-pack.js.map +1 -1
- package/dist/src/retrieval/current-truth.d.ts +360 -0
- package/dist/src/retrieval/current-truth.d.ts.map +1 -0
- package/dist/src/retrieval/current-truth.js +766 -0
- package/dist/src/retrieval/current-truth.js.map +1 -0
- package/dist/src/retrieval/git-state.d.ts +53 -0
- package/dist/src/retrieval/git-state.d.ts.map +1 -0
- package/dist/src/retrieval/git-state.js +174 -0
- package/dist/src/retrieval/git-state.js.map +1 -0
- package/dist/src/retrieval/lexical.d.ts.map +1 -1
- package/dist/src/retrieval/lexical.js +19 -3
- package/dist/src/retrieval/lexical.js.map +1 -1
- package/dist/src/retrieval/locator-boost.d.ts +37 -0
- package/dist/src/retrieval/locator-boost.d.ts.map +1 -0
- package/dist/src/retrieval/locator-boost.js +129 -0
- package/dist/src/retrieval/locator-boost.js.map +1 -0
- package/dist/src/retrieval/report-demotion.d.ts +46 -0
- package/dist/src/retrieval/report-demotion.d.ts.map +1 -0
- package/dist/src/retrieval/report-demotion.js +169 -0
- package/dist/src/retrieval/report-demotion.js.map +1 -0
- package/dist/src/retrieval/vector.d.ts.map +1 -1
- package/dist/src/retrieval/vector.js +11 -2
- package/dist/src/retrieval/vector.js.map +1 -1
- package/dist/src/server/app.d.ts.map +1 -1
- package/dist/src/server/app.js +92 -11
- package/dist/src/server/app.js.map +1 -1
- package/dist/src/server/routes/compact.d.ts.map +1 -1
- package/dist/src/server/routes/compact.js +4 -1
- package/dist/src/server/routes/compact.js.map +1 -1
- package/dist/src/server/routes/context.d.ts +1 -1
- package/dist/src/server/routes/context.d.ts.map +1 -1
- package/dist/src/server/routes/context.js +2 -1
- package/dist/src/server/routes/context.js.map +1 -1
- package/dist/src/server/routes/conversations-search.d.ts.map +1 -1
- package/dist/src/server/routes/conversations-search.js +28 -3
- package/dist/src/server/routes/conversations-search.js.map +1 -1
- package/dist/src/server/routes/enqueue.d.ts +11 -0
- package/dist/src/server/routes/enqueue.d.ts.map +1 -0
- package/dist/src/server/routes/enqueue.js +17 -0
- package/dist/src/server/routes/enqueue.js.map +1 -0
- package/dist/src/server/routes/friend-status.d.ts +339 -3
- package/dist/src/server/routes/friend-status.d.ts.map +1 -1
- package/dist/src/server/routes/friend-status.js +447 -13
- package/dist/src/server/routes/friend-status.js.map +1 -1
- package/dist/src/server/routes/ingest.d.ts.map +1 -1
- package/dist/src/server/routes/ingest.js +5 -2
- package/dist/src/server/routes/ingest.js.map +1 -1
- package/dist/src/server/routes/mcp-usage.d.ts +5 -4
- package/dist/src/server/routes/mcp-usage.d.ts.map +1 -1
- package/dist/src/server/routes/mcp-usage.js.map +1 -1
- package/dist/src/server/routes/reconcile.d.ts.map +1 -1
- package/dist/src/server/routes/reconcile.js +20 -1
- package/dist/src/server/routes/reconcile.js.map +1 -1
- package/dist/src/server/routes/reindex.d.ts.map +1 -1
- package/dist/src/server/routes/reindex.js +4 -1
- package/dist/src/server/routes/reindex.js.map +1 -1
- package/dist/src/server/routes/save.d.ts.map +1 -1
- package/dist/src/server/routes/save.js +4 -1
- package/dist/src/server/routes/save.js.map +1 -1
- package/dist/src/server/routes/search.d.ts +1 -1
- package/dist/src/server/routes/search.d.ts.map +1 -1
- package/dist/src/server/routes/search.js +253 -29
- package/dist/src/server/routes/search.js.map +1 -1
- package/dist/src/server/routes/triage.d.ts.map +1 -1
- package/dist/src/server/routes/triage.js +4 -1
- package/dist/src/server/routes/triage.js.map +1 -1
- package/dist/src/storage/rebuild.d.ts +35 -1
- package/dist/src/storage/rebuild.d.ts.map +1 -1
- package/dist/src/storage/rebuild.js +288 -64
- package/dist/src/storage/rebuild.js.map +1 -1
- package/dist/src/storage/tables.d.ts +29 -0
- package/dist/src/storage/tables.d.ts.map +1 -1
- package/dist/src/storage/tables.js +32 -1
- package/dist/src/storage/tables.js.map +1 -1
- package/operator/swiftbar/render-menu.py +524 -0
- package/operator/swiftbar/rift.10s.sh +176 -0
- package/package.json +9 -3
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native failure notifications for daemon-observed problems.
|
|
3
|
+
*
|
|
4
|
+
* A running daemon can see capture failures, expired Codex login, an
|
|
5
|
+
* invalid/failing Voyage key, and index-write failures. When one of
|
|
6
|
+
* those crosses into a failing state, the friend should get one calm
|
|
7
|
+
* macOS notification that points at the repair surface — not a wall of
|
|
8
|
+
* logs, and not a notification on every poll.
|
|
9
|
+
*
|
|
10
|
+
* What this module does NOT cover: a fully dead daemon cannot notify
|
|
11
|
+
* about itself. That needs a separate watchdog and is explicitly Slice D
|
|
12
|
+
* (see docs/feedback/2026-05-20-friend-onboarding-status-surface.md).
|
|
13
|
+
*
|
|
14
|
+
* Rate-limiting rules (from the status-surface plan):
|
|
15
|
+
* - Notify on state transition, not every poll.
|
|
16
|
+
* - Do not repeat the same unresolved issue more than once per day.
|
|
17
|
+
* - Notify again after the issue resolves and later recurs.
|
|
18
|
+
*
|
|
19
|
+
* The planning logic (`planNotifications`) is pure and fully tested; the
|
|
20
|
+
* IO (reading/writing dedup state, sending via osascript) is thin and
|
|
21
|
+
* best-effort so a notification failure can never break capture.
|
|
22
|
+
*/
|
|
23
|
+
import { execFile } from "node:child_process";
|
|
24
|
+
import fs from "node:fs";
|
|
25
|
+
import path from "node:path";
|
|
26
|
+
/** Re-notify cadence for an issue that stays unresolved. */
|
|
27
|
+
export const RENOTIFY_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
28
|
+
/** Cause identity for an issue: explicit fingerprint, else its kind. */
|
|
29
|
+
function issueFingerprint(issue) {
|
|
30
|
+
return issue.fingerprint ?? issue.kind;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Build the friend-facing notification for an issue. Pure. The title is
|
|
34
|
+
* intentionally constant ("Rift needs attention") so the friend learns
|
|
35
|
+
* to recognise it; the subtitle and body carry the specifics.
|
|
36
|
+
*/
|
|
37
|
+
export function buildNotificationPayload(issue) {
|
|
38
|
+
return {
|
|
39
|
+
title: "Rift needs attention",
|
|
40
|
+
subtitle: issue.title,
|
|
41
|
+
message: issue.nextAction,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Decide which notifications to send this tick and what state to persist.
|
|
46
|
+
* Pure: no IO, no clock except the injected `now`.
|
|
47
|
+
*
|
|
48
|
+
* Only `daemonObservable` issues are eligible — the daemon must not
|
|
49
|
+
* notify about things it cannot itself observe (e.g. a dead daemon, or
|
|
50
|
+
* user-side rejected imports).
|
|
51
|
+
*/
|
|
52
|
+
export function planNotifications(input) {
|
|
53
|
+
const { issues, state, now } = input;
|
|
54
|
+
const eligible = issues.filter((i) => i.daemonObservable);
|
|
55
|
+
const eligibleKinds = new Set(eligible.map((i) => i.kind));
|
|
56
|
+
const nextActive = {};
|
|
57
|
+
const notifications = [];
|
|
58
|
+
for (const issue of eligible) {
|
|
59
|
+
const prior = state.active[issue.kind];
|
|
60
|
+
const fingerprint = issueFingerprint(issue);
|
|
61
|
+
const notify = () => {
|
|
62
|
+
notifications.push(buildNotificationPayload(issue));
|
|
63
|
+
nextActive[issue.kind] = {
|
|
64
|
+
last_notified_at: new Date(now).toISOString(),
|
|
65
|
+
fingerprint,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
if (!prior) {
|
|
69
|
+
// New transition into failure → notify.
|
|
70
|
+
notify();
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
// The cause changed under the same subsystem (e.g. a Voyage network
|
|
74
|
+
// blip became a provider rejection). The action and risk differ, so
|
|
75
|
+
// treat it as a fresh failure rather than a still-unresolved repeat.
|
|
76
|
+
if ((prior.fingerprint ?? issue.kind) !== fingerprint) {
|
|
77
|
+
notify();
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const priorMs = Date.parse(prior.last_notified_at);
|
|
81
|
+
const stale = Number.isNaN(priorMs) || now - priorMs >= RENOTIFY_INTERVAL_MS;
|
|
82
|
+
if (stale) {
|
|
83
|
+
// Still failing, same cause, a day later → re-notify once.
|
|
84
|
+
notify();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Already notified within the window → stay quiet, keep record.
|
|
88
|
+
nextActive[issue.kind] = prior;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Anything previously active but no longer present has resolved; it is
|
|
92
|
+
// simply absent from `nextActive`, so a later recurrence notifies fresh.
|
|
93
|
+
void eligibleKinds;
|
|
94
|
+
return { notifications, nextState: { active: nextActive } };
|
|
95
|
+
}
|
|
96
|
+
/** Absolute path to the dedup-state file under the data dir. */
|
|
97
|
+
export function notifyStatePath(dataDir) {
|
|
98
|
+
return path.join(dataDir, "observability", "notifications.json");
|
|
99
|
+
}
|
|
100
|
+
/** Read dedup state; returns empty state on any read/parse failure. */
|
|
101
|
+
export function readNotifyState(dataDir) {
|
|
102
|
+
try {
|
|
103
|
+
const raw = fs.readFileSync(notifyStatePath(dataDir), "utf8");
|
|
104
|
+
const parsed = JSON.parse(raw);
|
|
105
|
+
if (parsed && typeof parsed === "object" && parsed.active) {
|
|
106
|
+
return { active: parsed.active };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// fall through
|
|
111
|
+
}
|
|
112
|
+
return { active: {} };
|
|
113
|
+
}
|
|
114
|
+
/** Persist dedup state best-effort; swallows IO errors. */
|
|
115
|
+
export function writeNotifyState(dataDir, state) {
|
|
116
|
+
try {
|
|
117
|
+
const file = notifyStatePath(dataDir);
|
|
118
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
119
|
+
fs.writeFileSync(file, JSON.stringify(state, null, 2) + "\n", "utf8");
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// best-effort: a failed write just means we may re-notify next tick.
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Send a single notification via macOS `osascript`. Best-effort and
|
|
127
|
+
* fire-and-forget — any failure (non-macOS, osascript missing, user has
|
|
128
|
+
* notifications disabled) is swallowed so capture is never affected.
|
|
129
|
+
*
|
|
130
|
+
* Strings are passed as argv to `execFile` (not interpolated into a
|
|
131
|
+
* shell), and AppleScript string literals are escaped, so notification
|
|
132
|
+
* text cannot inject shell or AppleScript.
|
|
133
|
+
*/
|
|
134
|
+
export function sendNotification(payload, opts = {}) {
|
|
135
|
+
const platform = opts.platform ?? process.platform;
|
|
136
|
+
if (platform !== "darwin")
|
|
137
|
+
return;
|
|
138
|
+
const script = `display notification ${asAppleScriptString(payload.message)} ` +
|
|
139
|
+
`with title ${asAppleScriptString(payload.title)} ` +
|
|
140
|
+
`subtitle ${asAppleScriptString(payload.subtitle)}`;
|
|
141
|
+
try {
|
|
142
|
+
execFile("osascript", ["-e", script], () => {
|
|
143
|
+
// ignore stdout/stderr/exit — best-effort.
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// ignore spawn errors entirely.
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Escape a string into an AppleScript double-quoted literal. */
|
|
151
|
+
export function asAppleScriptString(value) {
|
|
152
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* End-to-end daemon helper: given the diagnosed issues, send any due
|
|
156
|
+
* notifications and persist updated dedup state. Best-effort throughout
|
|
157
|
+
* — wired into the capture loop, so it must never throw.
|
|
158
|
+
*/
|
|
159
|
+
export function notifyDaemonFailures(dataDir, issues, opts = {}) {
|
|
160
|
+
try {
|
|
161
|
+
const now = opts.now ?? Date.now();
|
|
162
|
+
const state = readNotifyState(dataDir);
|
|
163
|
+
const { notifications, nextState } = planNotifications({
|
|
164
|
+
issues,
|
|
165
|
+
state,
|
|
166
|
+
now,
|
|
167
|
+
});
|
|
168
|
+
for (const payload of notifications) {
|
|
169
|
+
sendNotification(payload, opts.platform ? { platform: opts.platform } : {});
|
|
170
|
+
}
|
|
171
|
+
writeNotifyState(dataDir, nextState);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// best-effort: never let notification logic break the daemon.
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=notify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../../src/diagnostics/notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,SA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,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE;YACzC,2CAA2C;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,gCAAgC;IAClC,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,MAAqB,EACrB,OAAqD,EAAE;IAEvD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,iBAAiB,CAAC;YACrD,MAAM;YACN,KAAK;YACL,GAAG;SACJ,CAAC,CAAC;QACH,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;YACpC,gBAAgB,CACd,OAAO,EACP,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CACjD,CAAC;QACJ,CAAC;QACD,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redacted repair-prompt generator for `rift doctor --copy-prompt`.
|
|
3
|
+
*
|
|
4
|
+
* The output is designed to be pasted straight into Claude or Codex and
|
|
5
|
+
* be safe to do so. It carries enough state to debug Rift but never
|
|
6
|
+
* leaks a secret, and it forbids destructive repair so an over-eager
|
|
7
|
+
* assistant cannot wipe the user's memory.
|
|
8
|
+
*
|
|
9
|
+
* Redaction contract (see the friend-onboarding status-surface plan):
|
|
10
|
+
* - Never include full Voyage keys, auth tokens, bearer tokens, or raw
|
|
11
|
+
* private conversation content.
|
|
12
|
+
* - Voyage keys appear only as a last-4 fingerprint, and only when one
|
|
13
|
+
* is known locally.
|
|
14
|
+
* - Local paths are allowed only when they help repair (data + log
|
|
15
|
+
* locations), because they are not secrets and the assistant needs
|
|
16
|
+
* them to inspect the right folder.
|
|
17
|
+
*
|
|
18
|
+
* Safety contract:
|
|
19
|
+
* - Tell the assistant to inspect before changing anything.
|
|
20
|
+
* - Prefer commands that inspect/repair over commands that reset.
|
|
21
|
+
* - Explicitly forbid destructive resets and
|
|
22
|
+
* `rift uninstall --purge-data`.
|
|
23
|
+
*
|
|
24
|
+
* This module is pure (no IO). Centralizing prompt generation here —
|
|
25
|
+
* rather than in the SwiftBar script or the CLI command — keeps
|
|
26
|
+
* redaction, status interpretation, and future issue classes in one
|
|
27
|
+
* place (Slice C's menu bar will call this same generator).
|
|
28
|
+
*/
|
|
29
|
+
import type { FriendStatusPayload } from "../server/routes/friend-status.js";
|
|
30
|
+
import type { DoctorLocalSignals, DoctorReport } from "./doctor.js";
|
|
31
|
+
export type RepairTarget = "claude" | "codex";
|
|
32
|
+
export interface RepairPromptInput {
|
|
33
|
+
report: DoctorReport;
|
|
34
|
+
status: FriendStatusPayload | null;
|
|
35
|
+
localSignals: DoctorLocalSignals;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Commands the assistant must never run from this prompt. Kept as data
|
|
39
|
+
* so the test suite can assert every one is named in the rendered
|
|
40
|
+
* "Constraints" block.
|
|
41
|
+
*/
|
|
42
|
+
export declare const FORBIDDEN_COMMANDS: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* Build the repair prompt. `target` only changes which assistant the
|
|
45
|
+
* prompt addresses; the state and safety rules are identical so neither
|
|
46
|
+
* tool can be talked into something the other forbids.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildRepairPrompt(input: RepairPromptInput, target: RepairTarget): string;
|
|
49
|
+
//# sourceMappingURL=repair-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair-prompt.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/repair-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,kBAAkB,CAAC;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI/C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,YAAY,GACnB,MAAM,CAsER"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commands the assistant must never run from this prompt. Kept as data
|
|
3
|
+
* so the test suite can assert every one is named in the rendered
|
|
4
|
+
* "Constraints" block.
|
|
5
|
+
*/
|
|
6
|
+
export const FORBIDDEN_COMMANDS = [
|
|
7
|
+
"rift uninstall --purge-data",
|
|
8
|
+
"rift rebuild --reset",
|
|
9
|
+
"rm -rf",
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Build the repair prompt. `target` only changes which assistant the
|
|
13
|
+
* prompt addresses; the state and safety rules are identical so neither
|
|
14
|
+
* tool can be talked into something the other forbids.
|
|
15
|
+
*/
|
|
16
|
+
export function buildRepairPrompt(input, target) {
|
|
17
|
+
const { report, status, localSignals } = input;
|
|
18
|
+
const assistant = target === "claude" ? "Claude" : "Codex";
|
|
19
|
+
// Open with the right severity. "Rift is not healthy" is correct only
|
|
20
|
+
// when something is actually broken; a warning-only state (e.g. large
|
|
21
|
+
// sessions parked, an available update) must not tell the user their
|
|
22
|
+
// Rift is broken — that copy erodes trust on a working install.
|
|
23
|
+
const hasBroken = report.issues.some((i) => i.severity === "broken");
|
|
24
|
+
const onlyParked = !hasBroken &&
|
|
25
|
+
report.issues.some((i) => i.kind === "capture_quarantined" || i.kind === "capture_repairing");
|
|
26
|
+
const opener = hasBroken
|
|
27
|
+
? `Rift is not healthy on this Mac. Please help me fix it, ${assistant}.`
|
|
28
|
+
: onlyParked
|
|
29
|
+
? `Rift is working, but some large Codex sessions are not searchable yet. ` +
|
|
30
|
+
`Please help me recover them, ${assistant}.`
|
|
31
|
+
: `Rift is working, but a few things could use attention. ` +
|
|
32
|
+
`Please help me sort them out, ${assistant}.`;
|
|
33
|
+
const lines = [];
|
|
34
|
+
lines.push(opener);
|
|
35
|
+
lines.push("");
|
|
36
|
+
// --- Symptoms: the diagnosed issues, plain-language, no secrets. ---
|
|
37
|
+
lines.push("Symptoms:");
|
|
38
|
+
if (report.issues.length === 0) {
|
|
39
|
+
lines.push("- rift doctor found no specific broken signal, but I think something " +
|
|
40
|
+
"is off. Please investigate.");
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
for (const issue of report.issues) {
|
|
44
|
+
lines.push(`- ${issue.title}. ${issue.detail}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
lines.push("");
|
|
48
|
+
// --- State: redacted, debug-useful facts. ---
|
|
49
|
+
lines.push("Current state:");
|
|
50
|
+
for (const line of renderStateLines(report, status, localSignals)) {
|
|
51
|
+
lines.push(`- ${line}`);
|
|
52
|
+
}
|
|
53
|
+
lines.push("");
|
|
54
|
+
// --- Inspect-first checklist, ordered by the primary issue. ---
|
|
55
|
+
lines.push("Start by inspecting, in this order:");
|
|
56
|
+
let step = 1;
|
|
57
|
+
lines.push(`${step++}. \`rift status\` — confirm the current state for yourself.`);
|
|
58
|
+
lines.push(`${step++}. \`rift doctor\` — read the plain-language diagnosis.`);
|
|
59
|
+
for (const cmd of inspectionCommandsFor(report)) {
|
|
60
|
+
lines.push(`${step++}. ${cmd}`);
|
|
61
|
+
}
|
|
62
|
+
lines.push(`${step++}. Rift logs only if the above is not enough.`);
|
|
63
|
+
lines.push("");
|
|
64
|
+
// --- Hard constraints. ---
|
|
65
|
+
lines.push("Constraints:");
|
|
66
|
+
lines.push("- Explain the failure to me in plain English BEFORE changing anything.");
|
|
67
|
+
lines.push("- Inspect first; prefer commands that inspect and repair over commands that reset.");
|
|
68
|
+
lines.push("- Do not print or echo secrets (Voyage key, tokens).");
|
|
69
|
+
lines.push("- Do not delete or reset my Rift data.");
|
|
70
|
+
for (const forbidden of FORBIDDEN_COMMANDS) {
|
|
71
|
+
lines.push(`- Do not run \`${forbidden}\`.`);
|
|
72
|
+
}
|
|
73
|
+
lines.push("- If a fix is risky or irreversible, stop and ask me first.");
|
|
74
|
+
return lines.join("\n");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Render the redacted "Current state" facts. Every value here is either
|
|
78
|
+
* non-sensitive (versions, ports, booleans, ages) or already reduced to
|
|
79
|
+
* a safe fingerprint (Voyage last-4). Raw keys, tokens, and conversation
|
|
80
|
+
* content never reach this function.
|
|
81
|
+
*/
|
|
82
|
+
function renderStateLines(report, status, localSignals) {
|
|
83
|
+
const out = [];
|
|
84
|
+
if (!status) {
|
|
85
|
+
// The reason /status/friend could not be read drives the state copy:
|
|
86
|
+
// "not responding" is only true for a genuinely down daemon, not for
|
|
87
|
+
// an auth/config failure where the daemon may be perfectly alive.
|
|
88
|
+
switch (report.primary?.kind) {
|
|
89
|
+
case "config_missing":
|
|
90
|
+
out.push("Rift config: missing (could not resolve the daemon URL).");
|
|
91
|
+
out.push("This Mac looks like onboarding never completed.");
|
|
92
|
+
break;
|
|
93
|
+
case "daemon_auth_failed":
|
|
94
|
+
out.push("Rift daemon: reachable, but this command could not authenticate " +
|
|
95
|
+
"to it (missing or rejected token). The daemon itself may be fine.");
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
out.push("Rift daemon: not responding (could not reach /status/friend).");
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
out.push("Expected daemon label: com.getrift.daemon (managed by launchd on port 3577).");
|
|
102
|
+
out.push(voyageFingerprintLine(localSignals));
|
|
103
|
+
out.push(mcpLine(localSignals));
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
out.push(`Rift version: ${status.build.version} (node ${status.build.node}).`);
|
|
107
|
+
out.push(`Daemon: running on port ${status.daemon.port}, up ${formatSeconds(status.daemon.uptime_seconds)}.`);
|
|
108
|
+
// data_dir is a local path, not a secret, and the assistant needs it
|
|
109
|
+
// to inspect the right data root (a stale Application Support copy is
|
|
110
|
+
// a real false-alarm source).
|
|
111
|
+
out.push(`Data directory: ${status.daemon.data_dir}`);
|
|
112
|
+
out.push(`Voyage key present in daemon env: ${status.daemon.voyage_key_present ? "yes" : "no"}.`);
|
|
113
|
+
out.push(voyageFingerprintLine(localSignals));
|
|
114
|
+
if (status.voyage.last_embed_at) {
|
|
115
|
+
out.push(`Last successful embed: ${status.voyage.last_embed_at}.`);
|
|
116
|
+
}
|
|
117
|
+
if (status.voyage.last_error_at) {
|
|
118
|
+
out.push(`Last Voyage error: ${status.voyage.last_error_at} (${status.voyage.last_error_reason ?? "unknown"}).`);
|
|
119
|
+
}
|
|
120
|
+
if (status.index.last_update_at) {
|
|
121
|
+
out.push(`Last index write: ${status.index.last_update_at}.`);
|
|
122
|
+
}
|
|
123
|
+
if (status.index.last_error_at) {
|
|
124
|
+
out.push(`Last index error: ${status.index.last_error_at} (${status.index.last_error_reason ?? "unknown"}).`);
|
|
125
|
+
}
|
|
126
|
+
out.push(`Codex CLI auth: ${codexAuthLabel(status.codex.last_preflight_ok)}${status.codex.last_preflight_at
|
|
127
|
+
? ` (last checked ${status.codex.last_preflight_at})`
|
|
128
|
+
: ""}.`);
|
|
129
|
+
if (status.capture.last_run_at) {
|
|
130
|
+
out.push(`Last capture run: ${status.capture.last_run_at} — ${status.capture.last_saved} saved, ` +
|
|
131
|
+
`${status.capture.last_review} for review, ${status.capture.last_errors} errors.`);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
out.push("Last capture run: none yet.");
|
|
135
|
+
}
|
|
136
|
+
out.push(mcpLine(localSignals));
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
function voyageFingerprintLine(localSignals) {
|
|
140
|
+
return localSignals.voyageLast4
|
|
141
|
+
? `Voyage key fingerprint (last 4 only): …${localSignals.voyageLast4}.`
|
|
142
|
+
: "Voyage key fingerprint: not found locally.";
|
|
143
|
+
}
|
|
144
|
+
function mcpLine(localSignals) {
|
|
145
|
+
if (localSignals.mcpClients.length === 0) {
|
|
146
|
+
return "MCP clients: none detected.";
|
|
147
|
+
}
|
|
148
|
+
const parts = localSignals.mcpClients.map((c) => `${c.client}=${c.installed ? "connected" : "not connected"}`);
|
|
149
|
+
return `MCP clients: ${parts.join(", ")}.`;
|
|
150
|
+
}
|
|
151
|
+
function codexAuthLabel(ok) {
|
|
152
|
+
if (ok === null)
|
|
153
|
+
return "unknown (not checked yet)";
|
|
154
|
+
return ok ? "looks authenticated" : "appears expired";
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Issue-specific inspection commands, deduped and ordered by the issues
|
|
158
|
+
* present. Inspection/repair only — nothing here resets state.
|
|
159
|
+
*/
|
|
160
|
+
function inspectionCommandsFor(report) {
|
|
161
|
+
const cmds = [];
|
|
162
|
+
const seen = new Set();
|
|
163
|
+
const add = (cmd) => {
|
|
164
|
+
if (!seen.has(cmd)) {
|
|
165
|
+
seen.add(cmd);
|
|
166
|
+
cmds.push(cmd);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
for (const issue of report.issues) {
|
|
170
|
+
switch (issue.kind) {
|
|
171
|
+
case "daemon_unreachable":
|
|
172
|
+
add("`launchctl print gui/$UID/com.getrift.daemon` — check the daemon is loaded and not crash-looping.");
|
|
173
|
+
break;
|
|
174
|
+
case "daemon_auth_failed":
|
|
175
|
+
add("`rift token issue` — re-issue an access token (the existing one is missing or rejected); do not restart the daemon for this.");
|
|
176
|
+
break;
|
|
177
|
+
case "config_missing":
|
|
178
|
+
add("`rift onboard` — finish setup; there is no config for this command to read yet.");
|
|
179
|
+
break;
|
|
180
|
+
case "codex_auth_expired":
|
|
181
|
+
add("`codex login` — re-authenticate the codex CLI, then `rift capture`.");
|
|
182
|
+
break;
|
|
183
|
+
case "codex_preflight_failed":
|
|
184
|
+
add("Codex capture probe failed (NOT an auth problem — do not re-run `codex login`). If it mentions a rejected model, set `codex_cli.model` in the Rift config to a supported model; otherwise it is usually a transient backend/timeout — re-run `rift capture`.");
|
|
185
|
+
break;
|
|
186
|
+
case "voyage_key_missing":
|
|
187
|
+
case "voyage_embed_errors":
|
|
188
|
+
add("`rift onboard --reconfigure-voyage` — re-check the Voyage key (it will not be printed).");
|
|
189
|
+
break;
|
|
190
|
+
case "index_write_errors":
|
|
191
|
+
add("`rift reindex` — only after confirming the cause; this rebuilds the index, it does not delete data.");
|
|
192
|
+
break;
|
|
193
|
+
case "capture_failed":
|
|
194
|
+
add("`rift capture` — re-run capture and read the per-session output.");
|
|
195
|
+
break;
|
|
196
|
+
case "capture_quarantined":
|
|
197
|
+
case "capture_repairing":
|
|
198
|
+
// Rift self-repairs these in the background, but a user who is
|
|
199
|
+
// explicitly assembling a repair prompt wants the manual escape hatch
|
|
200
|
+
// named — it is idempotent and non-destructive, so it is safe to run
|
|
201
|
+
// even while a background pass is in flight.
|
|
202
|
+
add("`rift doctor repair capture-large-sessions` — summarize and save the oversized sessions Rift had to skip; it reads them in safe chunks and does not delete or modify the originals.");
|
|
203
|
+
break;
|
|
204
|
+
default:
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return cmds;
|
|
209
|
+
}
|
|
210
|
+
function formatSeconds(seconds) {
|
|
211
|
+
if (seconds < 60)
|
|
212
|
+
return `${seconds}s`;
|
|
213
|
+
const minutes = Math.floor(seconds / 60);
|
|
214
|
+
if (minutes < 60)
|
|
215
|
+
return `${minutes}m`;
|
|
216
|
+
const hours = Math.floor(minutes / 60);
|
|
217
|
+
const remMin = minutes % 60;
|
|
218
|
+
if (hours < 24)
|
|
219
|
+
return remMin > 0 ? `${hours}h ${remMin}m` : `${hours}h`;
|
|
220
|
+
const days = Math.floor(hours / 24);
|
|
221
|
+
return `${days}d`;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=repair-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair-prompt.js","sourceRoot":"","sources":["../../../src/diagnostics/repair-prompt.ts"],"names":[],"mappings":"AAuCA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,6BAA6B;IAC7B,sBAAsB;IACtB,QAAQ;CACT,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAwB,EACxB,MAAoB;IAEpB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAE3D,sEAAsE;IACtE,sEAAsE;IACtE,qEAAqE;IACrE,gEAAgE;IAChE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACrE,MAAM,UAAU,GACd,CAAC,SAAS;QACV,MA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,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,OAAO,GAAG,EAAE,CAAC;IAC5B,IAAI,KAAK,GAAG,EAAE;QAAE,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;IACzE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,GAAG,IAAI,GAAG,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-fingerprint.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-fingerprint.ts"],"names":[],"mappings":"AAwBA,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical content fingerprint for a parsed conversation.
|
|
3
|
+
*
|
|
4
|
+
* Pure: takes the parser-emitted role-prefixed conversation text and
|
|
5
|
+
* returns a stable hex sha256. No filesystem, no clock, no random input.
|
|
6
|
+
*
|
|
7
|
+
* Why content-only:
|
|
8
|
+
* The fingerprint must change iff the conversation's substance changes.
|
|
9
|
+
* Title / createdAt are stable across re-exports of the same provider
|
|
10
|
+
* conversation, so they are not part of the input. Including them would
|
|
11
|
+
* produce false "grew" signals on metadata-only refreshes.
|
|
12
|
+
*
|
|
13
|
+
* Why role-prefixed text:
|
|
14
|
+
* Every parser already normalises its source format into the same
|
|
15
|
+
* `content` shape (`User: ...\n\nAssistant: ...`). That makes the
|
|
16
|
+
* fingerprint source-agnostic — two parsers producing identical
|
|
17
|
+
* content for the same conversation hash to the same value.
|
|
18
|
+
*
|
|
19
|
+
* Used by the ingest handler's refresh-on-grow logic: if a re-imported
|
|
20
|
+
* conversation has the same content as the version we already stored,
|
|
21
|
+
* skip it; if it has new messages appended, refresh the row.
|
|
22
|
+
*/
|
|
23
|
+
import crypto from "node:crypto";
|
|
24
|
+
export function conversationContentFingerprint(content) {
|
|
25
|
+
return crypto.createHash("sha256").update(content, "utf8").digest("hex");
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=conversation-fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-fingerprint.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,UAAU,8BAA8B,CAAC,OAAe;IAC5D,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-key.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-key.ts"],"names":[],"mappings":"AAwBA,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,GACrB,MAAM,CAMR"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable row id for an indexed conversation.
|
|
3
|
+
*
|
|
4
|
+
* Pure: takes the source provider name and the provider's own
|
|
5
|
+
* conversation id, returns a deterministic row id. No filesystem,
|
|
6
|
+
* no clock, no random input.
|
|
7
|
+
*
|
|
8
|
+
* The key is `sha256("${source}:${conversationId}").slice(0, 32)` so:
|
|
9
|
+
* - re-imports of the same conversation (e.g. monthly full-export
|
|
10
|
+
* from ChatGPT/Claude/Grok/Gemini that re-includes everything
|
|
11
|
+
* the user has) collapse to the same row id and short-circuit
|
|
12
|
+
* on the existing "skip if already indexed" replay guard;
|
|
13
|
+
* - the same conversation id from two providers (Grok and Gemini
|
|
14
|
+
* both expose plain UUID-shaped ids) cannot collide because
|
|
15
|
+
* `source` is part of the hash input.
|
|
16
|
+
*
|
|
17
|
+
* Note: this dedupe is skip-if-exists. A conversation that has
|
|
18
|
+
* grown new messages between two exports keeps its older
|
|
19
|
+
* snapshot until a future refresh-on-grow slice lands. The
|
|
20
|
+
* duplicate-rows correctness gap is what this helper closes;
|
|
21
|
+
* stale-content is tracked separately.
|
|
22
|
+
*/
|
|
23
|
+
import crypto from "node:crypto";
|
|
24
|
+
export function stableConversationRowId(source, conversationId) {
|
|
25
|
+
return crypto
|
|
26
|
+
.createHash("sha256")
|
|
27
|
+
.update(`${source}:${conversationId}`)
|
|
28
|
+
.digest("hex")
|
|
29
|
+
.slice(0, 32);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=conversation-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-key.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/conversation-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,UAAU,uBAAuB,CACrC,MAAc,EACd,cAAsB;IAEtB,OAAO,MAAM;SACV,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,GAAG,MAAM,IAAI,cAAc,EAAE,CAAC;SACrC,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/extensions.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAGzD,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbox file extension policy.
|
|
3
|
+
*
|
|
4
|
+
* Web conversation exports are always JSON or an archive of JSON.
|
|
5
|
+
* Markdown / images / arbitrary text are rejected at the watcher
|
|
6
|
+
* boundary so they never reach the parser layer.
|
|
7
|
+
*/
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
export const SUPPORTED_INBOX_EXTENSIONS = new Set([
|
|
10
|
+
".json",
|
|
11
|
+
".zip",
|
|
12
|
+
]);
|
|
13
|
+
export function isSupportedInboxExtension(filePath) {
|
|
14
|
+
return SUPPORTED_INBOX_EXTENSIONS.has(path.extname(filePath).toLowerCase());
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAAC;IACrE,OAAO;IACP,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,UAAU,yBAAyB,CAAC,QAAgB;IACxD,OAAO,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idempotency.d.ts","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/idempotency.ts"],"names":[],"mappings":"AAcA,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO7E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable idempotency key for a file dropped into an inbox folder.
|
|
3
|
+
*
|
|
4
|
+
* Pure: takes path + mtime as input, does no filesystem access. The
|
|
5
|
+
* caller (Rift adapter or a future standalone shell) is responsible
|
|
6
|
+
* for stat'ing the file.
|
|
7
|
+
*
|
|
8
|
+
* The key combines path and mtimeMs so re-dropping the same filename
|
|
9
|
+
* with new content gets a fresh key, while a watcher restart on
|
|
10
|
+
* unchanged files produces the same key and short-circuits as a
|
|
11
|
+
* duplicate at the queue layer.
|
|
12
|
+
*/
|
|
13
|
+
import crypto from "node:crypto";
|
|
14
|
+
export function inboxIdempotencyKey(filePath, mtimeMs) {
|
|
15
|
+
const hash = crypto
|
|
16
|
+
.createHash("sha256")
|
|
17
|
+
.update(`${filePath}:${mtimeMs}`)
|
|
18
|
+
.digest("hex")
|
|
19
|
+
.slice(0, 16);
|
|
20
|
+
return `inbox:${hash}`;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=idempotency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idempotency.js","sourceRoot":"","sources":["../../../../src/ingestion/inbox-core/idempotency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,OAAe;IACnE,MAAM,IAAI,GAAG,MAAM;SAChB,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAC;SAChC,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChB,OAAO,SAAS,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inbox-core — pure file-detection primitives for an inbox watcher.
|
|
3
|
+
*
|
|
4
|
+
* Carved as a seam so the same logic can power both Rift's
|
|
5
|
+
* inbox-watcher.ts (which hands off to the job queue + ingest route)
|
|
6
|
+
* and a future standalone "AI Chat Backup Inbox" shell (which hands
|
|
7
|
+
* off to a local archive folder, with optional Rift indexing).
|
|
8
|
+
*
|
|
9
|
+
* Invariant: this module has zero Rift internals — no Fastify, no
|
|
10
|
+
* LanceDB, no Voyage, no JobQueue, no config loader, no parser
|
|
11
|
+
* registry. Only `node:` stdlib. The adapter wires it up.
|
|
12
|
+
*/
|
|
13
|
+
export { inboxIdempotencyKey } from "./idempotency.js";
|
|
14
|
+
export { stableConversationRowId } from "./conversation-key.js";
|
|
15
|
+
export { conversationContentFingerprint } from "./conversation-fingerprint.js";
|
|
16
|
+
export { detectSourceFromSubdir } from "./source-detection.js";
|
|
17
|
+
export { SUPPORTED_INBOX_EXTENSIONS, isSupportedInboxExtension, } from "./extensions.js";
|
|
18
|
+
export { sniffInboxSource, type SniffedProvider } from "./source-sniffer.js";
|
|
19
|
+
export { readZipCentralDirectoryFilenames, sniffProviderFromZipEntries, sniffZipBuffer, } from "./zip-sniffer.js";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|