@murphai/murph 1.2.0 → 1.2.3
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/CHANGELOG.md +1298 -0
- package/config.schema.json +412 -50
- package/dist/cli-entry.d.ts.map +1 -1
- package/dist/cli-entry.js +13 -20
- package/dist/cli-entry.js.map +1 -1
- package/dist/commands/audit-command-helpers.js.map +1 -1
- package/dist/commands/audit.js +2 -2
- package/dist/commands/automation.d.ts +118 -7
- package/dist/commands/automation.d.ts.map +1 -1
- package/dist/commands/automation.js +140 -54
- package/dist/commands/automation.js.map +1 -1
- package/dist/commands/batch.d.ts.map +1 -1
- package/dist/commands/batch.js +12 -4
- package/dist/commands/batch.js.map +1 -1
- package/dist/commands/capture.d.ts +9 -9
- package/dist/commands/capture.d.ts.map +1 -1
- package/dist/commands/clinical-imports.d.ts +101 -101
- package/dist/commands/command-factory-primitives.d.ts +3 -3
- package/dist/commands/command-factory-primitives.d.ts.map +1 -1
- package/dist/commands/command-factory-primitives.js +1 -1
- package/dist/commands/commons.d.ts +9 -9
- package/dist/commands/document.d.ts.map +1 -1
- package/dist/commands/document.js +3 -0
- package/dist/commands/document.js.map +1 -1
- package/dist/commands/encounter.d.ts +42 -42
- package/dist/commands/encounter.d.ts.map +1 -1
- package/dist/commands/event.js +1 -1
- package/dist/commands/exercise.js.map +1 -1
- package/dist/commands/experiment.d.ts.map +1 -1
- package/dist/commands/experiment.js +1 -0
- package/dist/commands/experiment.js.map +1 -1
- package/dist/commands/export-intake-read-helpers.d.ts +4 -4
- package/dist/commands/export-intake-read-helpers.d.ts.map +1 -1
- package/dist/commands/export-intake-read-helpers.js +1 -1
- package/dist/commands/export-intake-read-helpers.js.map +1 -1
- package/dist/commands/export.js +1 -1
- package/dist/commands/food.d.ts +4 -4
- package/dist/commands/food.js +1 -1
- package/dist/commands/group.d.ts +81 -0
- package/dist/commands/group.d.ts.map +1 -0
- package/dist/commands/group.js +242 -0
- package/dist/commands/group.js.map +1 -0
- package/dist/commands/habitat.d.ts +3 -0
- package/dist/commands/habitat.d.ts.map +1 -0
- package/dist/commands/habitat.js +282 -0
- package/dist/commands/habitat.js.map +1 -0
- package/dist/commands/health-allergy-save.d.ts.map +1 -1
- package/dist/commands/health-allergy-save.js +1 -1
- package/dist/commands/health-allergy-save.js.map +1 -1
- package/dist/commands/health-condition-save.d.ts.map +1 -1
- package/dist/commands/health-condition-save.js +1 -1
- package/dist/commands/health-condition-save.js.map +1 -1
- package/dist/commands/health-goal-save.d.ts.map +1 -1
- package/dist/commands/health-goal-save.js +1 -1
- package/dist/commands/health-goal-save.js.map +1 -1
- package/dist/commands/intake.js +1 -1
- package/dist/commands/intervention.d.ts.map +1 -1
- package/dist/commands/intervention.js +10 -0
- package/dist/commands/intervention.js.map +1 -1
- package/dist/commands/knowledge.js +2 -2
- package/dist/commands/measurement.d.ts +7 -7
- package/dist/commands/measurement.d.ts.map +1 -1
- package/dist/commands/medication.d.ts +3 -3
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +26 -2
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/model.js.map +1 -1
- package/dist/commands/murph-age.d.ts +499 -498
- package/dist/commands/murph-age.d.ts.map +1 -1
- package/dist/commands/murph-age.js +3 -2
- package/dist/commands/murph-age.js.map +1 -1
- package/dist/commands/payload-schema-command.d.ts +1 -1
- package/dist/commands/protocol.js +2 -2
- package/dist/commands/provider.js +1 -1
- package/dist/commands/recipe.js +1 -1
- package/dist/commands/record-mutation-command-helpers.d.ts +3 -3
- package/dist/commands/record-mutation-command-helpers.d.ts.map +1 -1
- package/dist/commands/research.js.map +1 -1
- package/dist/commands/sample-batch-command-helpers.js.map +1 -1
- package/dist/commands/sample-import-command-helpers.d.ts.map +1 -1
- package/dist/commands/sample-query-command-helpers.d.ts +1 -1
- package/dist/commands/sample-query-command-helpers.d.ts.map +1 -1
- package/dist/commands/sample-query-command-helpers.js.map +1 -1
- package/dist/commands/samples.js +2 -2
- package/dist/commands/scheduled-log.d.ts +127 -275
- package/dist/commands/scheduled-log.d.ts.map +1 -1
- package/dist/commands/scheduled-log.js +28 -3
- package/dist/commands/scheduled-log.js.map +1 -1
- package/dist/commands/search.js +1 -1
- package/dist/commands/supplement.js +1 -1
- package/dist/commands/vault.d.ts +2 -1
- package/dist/commands/vault.d.ts.map +1 -1
- package/dist/commands/vault.js +111 -1
- package/dist/commands/vault.js.map +1 -1
- package/dist/commands/wearables.d.ts +695 -667
- package/dist/commands/wearables.d.ts.map +1 -1
- package/dist/commands/wearables.js +10 -3
- package/dist/commands/wearables.js.map +1 -1
- package/dist/commands/workout.d.ts.map +1 -1
- package/dist/commands/workout.js +9 -2
- package/dist/commands/workout.js.map +1 -1
- package/dist/device-services.d.ts.map +1 -1
- package/dist/device-services.js +33 -8
- package/dist/device-services.js.map +1 -1
- package/dist/food-labels.d.ts +39 -39
- package/dist/food-labels.js.map +1 -1
- package/dist/foreground-terminal-logging.js.map +1 -1
- package/dist/hosted-data-api-labels.d.ts +117 -117
- package/dist/hosted-data-api-labels.js.map +1 -1
- package/dist/incur.generated.d.ts +93 -0
- package/dist/incur.generated.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/mapbox-route-contracts.d.ts +13 -13
- package/dist/mapbox-route-contracts.d.ts.map +1 -1
- package/dist/mapbox-route.js.map +1 -1
- package/dist/research-scout-client.js.map +1 -1
- package/dist/supplement-labels.d.ts +39 -39
- package/dist/supplement-labels.js.map +1 -1
- package/dist/vault-cli-command-manifest.d.ts +1451 -1478
- package/dist/vault-cli-command-manifest.d.ts.map +1 -1
- package/dist/vault-cli-command-manifest.js +80 -2
- package/dist/vault-cli-command-manifest.js.map +1 -1
- package/dist/vault-cli-command-routing.d.ts.map +1 -1
- package/dist/vault-cli-command-routing.js +79 -2
- package/dist/vault-cli-command-routing.js.map +1 -1
- package/dist/vault-cli-package.d.ts +1 -1
- package/dist/vault-cli-package.d.ts.map +1 -1
- package/dist/vault-cli-package.js.map +1 -1
- package/dist/vault-cli-routing.d.ts +4 -1
- package/dist/vault-cli-routing.d.ts.map +1 -1
- package/dist/vault-cli-routing.js +45 -5
- package/dist/vault-cli-routing.js.map +1 -1
- package/dist/vault-cli-shell.d.ts +3 -1
- package/dist/vault-cli-shell.d.ts.map +1 -1
- package/dist/vault-cli-shell.js +4 -1
- package/dist/vault-cli-shell.js.map +1 -1
- package/dist/vault-cli-skill-hash.generated.d.ts +2 -0
- package/dist/vault-cli-skill-hash.generated.d.ts.map +1 -0
- package/dist/vault-cli-skill-hash.generated.js +3 -0
- package/dist/vault-cli-skill-hash.generated.js.map +1 -0
- package/dist/vault-cli-vault-context.js.map +1 -1
- package/dist/vault-cli.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/automation/run-loop.d.ts +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/doctor-security.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/doctor.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/service.d.ts +24 -22
- package/node_modules/@murphai/assistant-cli/dist/assistant/service.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/stop.d.ts +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/store.d.ts +3 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/store.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/store.js +5 -2
- package/node_modules/@murphai/assistant-cli/dist/assistant/store.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-composer-panel.d.ts +4 -4
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-composer-panel.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-layout.d.ts +9 -9
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-layout.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-message-text.d.ts +4 -4
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-message-text.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-message-text.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-transcript.d.ts +4 -4
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink-transcript.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/theme.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/view-model.d.ts +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant/ui/view-model.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant-daemon-client.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/assistant-daemon-client.js +2 -2
- package/node_modules/@murphai/assistant-cli/dist/assistant-daemon-client.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/commands/assistant.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/commands/assistant.js +52 -7
- package/node_modules/@murphai/assistant-cli/dist/commands/assistant.js.map +1 -1
- package/node_modules/@murphai/assistant-cli/dist/run-terminal-logging.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/README.md +55 -7
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-experiment-context.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-experiment-context.js +36 -24
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-experiment-context.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.d.ts +10 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.js +89 -7
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-journal.d.ts +36 -36
- package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-journal.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.d.ts +32 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.js +347 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-artifact-paths.d.ts +2 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-artifact-paths.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-evidence-model.d.ts +5 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-evidence-model.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-evidence-model.js +163 -42
- package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-evidence-model.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/evidence.d.ts +3 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/evidence.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/evidence.js +8 -7
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/evidence.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.d.ts +2 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.js +11 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/input-summary.d.ts +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/input-summary.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/input-summary.js +2 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/input-summary.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/operation-scope.d.ts +11 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/operation-scope.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/operation-scope.js +2 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/operation-scope.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.d.ts +18 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.js +66 -16
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.d.ts +26 -8
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.js +644 -158
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.d.ts +15 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.js +90 -29
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.d.ts +6 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.js +18 -6
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/shared.d.ts +9 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/shared.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/shared.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.d.ts +5 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.js +30 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/turn-envelope.d.ts +4 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/turn-envelope.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/turn-envelope.js +4 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation/turn-envelope.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation.d.ts +5 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation.js +3 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/automation.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/bindings.d.ts +2 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/bindings.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/bindings.js +22 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/bindings.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.d.ts +2 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.js +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-typing.d.ts +4 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-typing.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-typing.js +51 -18
- package/node_modules/@murphai/assistant-engine/dist/assistant/channel-typing.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/descriptors.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/descriptors.js +87 -49
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/descriptors.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/helpers.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/helpers.js +5 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/helpers.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.d.ts +2 -10
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.js +80 -61
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/types.d.ts +31 -20
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/types.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/channels/types.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.d.ts +5 -24
- package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.js +95 -228
- package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-contract.generated.json +4 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-manifest.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-contract-fingerprint.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-resume-binding.d.ts +4 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-resume-binding.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-resume-binding.js +24 -5
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-resume-binding.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-thread-route.d.ts +2 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-thread-route.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-thread-route.js +26 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-thread-route.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/attempt-observability.d.ts +0 -29
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/attempt-observability.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/attempt-observability.js +50 -129
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/attempt-observability.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.d.ts +22 -19
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.js +186 -109
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.d.ts +9 -8
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.js +42 -73
- package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.d.ts +3 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.js +83 -91
- package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-policy.d.ts +4 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-policy.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-policy.js +48 -11
- package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-policy.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-ref.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-ref.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.d.ts +3 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.js +33 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/delivery-reconciliation.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/delivery-reconciliation.js +38 -31
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/delivery-reconciliation.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.d.ts +47 -6
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.js +881 -117
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/schedule.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/schedule.js +84 -19
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/schedule.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/scheduled-log.d.ts +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/scheduled-log.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/scheduled-log.js +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/scheduled-log.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.d.ts +4 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.js +3 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/targets.d.ts +7 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/targets.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/targets.js +27 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron/targets.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron.d.ts +9 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron.js +134 -65
- package/node_modules/@murphai/assistant-engine/dist/assistant/cron.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.d.ts +5 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.js +131 -22
- package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-automations.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-automations.js +58 -90
- package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-automations.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.d.ts +4 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.js +9 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/diagnostics.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/diagnostics.js +6 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/diagnostics.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.d.ts +43 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.js +79 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/experiment-support-automations.d.ts +5 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/experiment-support-automations.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/experiment-support-automations.js +73 -6
- package/node_modules/@murphai/assistant-engine/dist/assistant/experiment-support-automations.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/fault-injection.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/first-contact-welcome.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/first-contact-welcome.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/generate-cli-surface-contract.js +1 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/generate-cli-surface-contract.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-context-diagnostics.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-context-diagnostics.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-context-diagnostics.js +0 -27
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-context-diagnostics.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-mailbox-input-items.d.ts +22 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-mailbox-input-items.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-mailbox-input-items.js +78 -4
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-mailbox-input-items.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.d.ts +46 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.js +47 -5
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-turn-timing.d.ts +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-turn-timing.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-turn-timing.js +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-turn-timing.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/inbox-attachment-evidence.js +23 -12
- package/node_modules/@murphai/assistant-engine/dist/assistant/inbox-attachment-evidence.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.d.ts +8 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.js +37 -6
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.d.ts +109 -44
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.js +46 -10
- package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/local-service.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/local-service.js +335 -120
- package/node_modules/@murphai/assistant-engine/dist/assistant/local-service.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.d.ts +7 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.js +101 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.d.ts +69 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.js +234 -49
- package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.js +3 -4
- package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/newsletter-outbox.d.ts +12 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/newsletter-outbox.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/newsletter-outbox.js +294 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/newsletter-outbox.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.d.ts +20 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.js +556 -113
- package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-automation.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-automation.js +11 -9
- package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-automation.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-state.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/operator-authority.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/operator-authority.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.d.ts +3 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.js +132 -21
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/ordering.d.ts +7 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/ordering.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/ordering.js +140 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/ordering.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.d.ts +3 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.js +79 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/store.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/store.js +28 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/store.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.d.ts +20 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.js +154 -19
- package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/progress-constants.d.ts +7 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/progress-constants.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/progress-constants.js +16 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/progress-constants.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/provider-progress.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/provider-progress.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/codex-cli.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/codex-cli.js +55 -173
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/codex-cli.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/helpers.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/helpers.js +5 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/helpers.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/types.d.ts +24 -25
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/types.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/providers/types.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/receipts.d.ts +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/receipts.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-bubbles.d.ts +6 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-bubbles.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-bubbles.js +47 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-bubbles.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.js +8 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-budget-policy.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-budgets.d.ts +2 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-budgets.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-budgets.js +92 -40
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-budgets.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.d.ts +3 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.js +107 -37
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-write-lock.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-write-lock.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-write-lock.js +2 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-write-lock.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-contracts.d.ts +15 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-contracts.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-turn-routes.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-turn-routes.js +11 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-turn-routes.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.d.ts +2 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.js +9 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service.d.ts +29 -24
- package/node_modules/@murphai/assistant-engine/dist/assistant/service.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/service.js +5 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/service.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/session-resolution.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/session-resolution.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/session-resolution.js +81 -13
- package/node_modules/@murphai/assistant-engine/dist/assistant/session-resolution.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/state-write-lock.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/state-write-lock.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/state-write-lock.js +35 -5
- package/node_modules/@murphai/assistant-engine/dist/assistant/state-write-lock.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/status.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/status.js +36 -4
- package/node_modules/@murphai/assistant-engine/dist/assistant/status.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/paths.d.ts +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/paths.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/paths.js +23 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/paths.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.d.ts +6 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.js +137 -16
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/types.d.ts +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/store/types.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store.d.ts +6 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/store.js +94 -22
- package/node_modules/@murphai/assistant-engine/dist/assistant/store.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.d.ts +16 -6
- package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.js +546 -230
- package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/transcript-audit.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.d.ts +16 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.js +58 -10
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-input.d.ts +2 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-input.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-input.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-plan.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-plan.js +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-plan.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.d.ts +3 -6
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.js +29 -22
- package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turns.d.ts +7 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turns.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/turns.js +33 -5
- package/node_modules/@murphai/assistant-engine/dist/assistant/turns.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/usage-attribution.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/usage-attribution.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/usage-attribution.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.d.ts +12 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.js +53 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-ask.d.ts +70 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-ask.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-ask.js +218 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-ask.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.d.ts +2 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.js +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.js +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-cli-access.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-cli-access.js +4 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-cli-access.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-requests.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-requests.js +25 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-requests.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.d.ts +5 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.js +12 -5
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.d.ts +82 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.d.ts.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.js +190 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.js.map +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.d.ts +18 -18
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.js +2 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.d.ts +8 -8
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.js +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-voice-memo.d.ts +10 -10
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-voice-memo.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.d.ts +4 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.js +17 -8
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.d.ts +1273 -268
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.js +1724 -34
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/failures.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/failures.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/failures.js +4 -13
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/failures.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.d.ts +3 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.js +352 -74
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.d.ts +1 -0
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.js +6 -12
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/image-reference-resolver.d.ts +2 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/image-reference-resolver.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/image-reference-resolver.js +89 -39
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/image-reference-resolver.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/openai-image-generation.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/openai-image-generation.js +4 -4
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/openai-image-generation.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex-events.d.ts +2 -2
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex-events.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex-events.js +1 -6
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex-events.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex.d.ts +23 -15
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex.js +868 -533
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-service.d.ts +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-service.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-service.js +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-service.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.d.ts +140 -48
- package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.js +118 -3
- package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-skill-env.d.ts +2 -2
- package/node_modules/@murphai/assistant-engine/dist/attachment-prompt-contracts.d.ts +17 -17
- package/node_modules/@murphai/assistant-engine/dist/attachment-prompt-contracts.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/codex-lifecycle.d.ts +3 -1
- package/node_modules/@murphai/assistant-engine/dist/codex-lifecycle.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/codex-lifecycle.js +7 -1
- package/node_modules/@murphai/assistant-engine/dist/codex-lifecycle.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/inbox-routing-vision.d.ts +2 -2
- package/node_modules/@murphai/assistant-engine/dist/inbox-routing-vision.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/index.d.ts +2 -0
- package/node_modules/@murphai/assistant-engine/dist/index.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/index.js +1 -0
- package/node_modules/@murphai/assistant-engine/dist/index.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/knowledge/service.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/outbound-channel.d.ts +3 -2
- package/node_modules/@murphai/assistant-engine/dist/outbound-channel.d.ts.map +1 -1
- package/node_modules/@murphai/assistant-engine/dist/outbound-channel.js +4 -2
- package/node_modules/@murphai/assistant-engine/dist/outbound-channel.js.map +1 -1
- package/node_modules/@murphai/assistant-engine/package.json +4 -0
- package/node_modules/@murphai/assistant-engine/skills/aerobic-fitness/SKILL.md +56 -0
- package/node_modules/@murphai/assistant-engine/skills/appointment-scheduling/SKILL.md +249 -0
- package/node_modules/@murphai/assistant-engine/skills/behavior-followthrough/SKILL.md +18 -9
- package/node_modules/@murphai/assistant-engine/skills/body-composition/SKILL.md +56 -0
- package/node_modules/@murphai/assistant-engine/skills/cardiometabolic-health/SKILL.md +56 -0
- package/node_modules/@murphai/assistant-engine/skills/circadian-rhythm/SKILL.md +57 -0
- package/node_modules/@murphai/assistant-engine/skills/cognitive-focus/SKILL.md +55 -0
- package/node_modules/@murphai/assistant-engine/skills/computer-use/SKILL.md +163 -121
- package/node_modules/@murphai/assistant-engine/skills/computer-use/references/health-browser-playbook.md +16 -9
- package/node_modules/@murphai/assistant-engine/skills/cycle-hormonal-health/SKILL.md +55 -0
- package/node_modules/@murphai/assistant-engine/skills/daily-activity/SKILL.md +55 -0
- package/node_modules/@murphai/assistant-engine/skills/energy-fatigue/SKILL.md +57 -0
- package/node_modules/@murphai/assistant-engine/skills/experiment-onboarding/SKILL.md +24 -10
- package/node_modules/@murphai/assistant-engine/skills/food-journal/SKILL.md +26 -0
- package/node_modules/@murphai/assistant-engine/skills/general-eye-health/SKILL.md +77 -0
- package/node_modules/@murphai/assistant-engine/skills/general-eye-health/references/evidence-register.md +34 -0
- package/node_modules/@murphai/assistant-engine/skills/general-eye-health/references/triage-and-contact-lenses.md +103 -0
- package/node_modules/@murphai/assistant-engine/skills/group-challenge/SKILL.md +346 -0
- package/node_modules/@murphai/assistant-engine/skills/group-chat/SKILL.md +296 -0
- package/node_modules/@murphai/assistant-engine/skills/group-newsletter/SKILL.md +210 -0
- package/node_modules/@murphai/assistant-engine/skills/groupchat-comedy/SKILL.md +182 -0
- package/node_modules/@murphai/assistant-engine/skills/gut-digestion/SKILL.md +57 -0
- package/node_modules/@murphai/assistant-engine/skills/hrv-resting-heart-rate/SKILL.md +55 -0
- package/node_modules/@murphai/assistant-engine/skills/micronutrients-supplements/SKILL.md +80 -0
- package/node_modules/@murphai/assistant-engine/skills/mobility-posture/SKILL.md +56 -0
- package/node_modules/@murphai/assistant-engine/skills/murph-onboarding/SKILL.md +358 -124
- package/node_modules/@murphai/assistant-engine/skills/music-generation/SKILL.md +162 -0
- package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/SKILL.md +73 -109
- package/node_modules/@murphai/assistant-engine/skills/physical-therapy/SKILL.md +3 -1
- package/node_modules/@murphai/assistant-engine/skills/recovery-modalities/SKILL.md +57 -0
- package/node_modules/@murphai/assistant-engine/skills/red-light-therapy/SKILL.md +145 -0
- package/node_modules/@murphai/assistant-engine/skills/red-light-therapy/device-seeds.json +259 -0
- package/node_modules/@murphai/assistant-engine/skills/shared/exercise-catalog-runtime.md +29 -0
- package/node_modules/@murphai/assistant-engine/skills/shared/murph-character-sheet-v1.png +0 -0
- package/node_modules/@murphai/assistant-engine/skills/sleep-improvement/SKILL.md +60 -0
- package/node_modules/@murphai/assistant-engine/skills/sleep-recovery-readiness/SKILL.md +68 -178
- package/node_modules/@murphai/assistant-engine/skills/strength-training/SKILL.md +1 -1
- package/node_modules/@murphai/assistant-engine/skills/substance-load/SKILL.md +56 -0
- package/node_modules/@murphai/assistantd/dist/client.js.map +1 -1
- package/node_modules/@murphai/assistantd/dist/config.js.map +1 -1
- package/node_modules/@murphai/assistantd/dist/http-protocol.d.ts.map +1 -1
- package/node_modules/@murphai/assistantd/dist/http-protocol.js.map +1 -1
- package/node_modules/@murphai/clinical-records/README.md +82 -0
- package/node_modules/@murphai/clinical-records/dist/index.d.ts +1865 -0
- package/node_modules/@murphai/clinical-records/dist/index.d.ts.map +1 -0
- package/node_modules/@murphai/clinical-records/dist/index.js +488 -0
- package/node_modules/@murphai/clinical-records/dist/index.js.map +1 -0
- package/node_modules/@murphai/clinical-records/package.json +27 -0
- package/node_modules/@murphai/core/dist/atomic-write.d.ts +4 -0
- package/node_modules/@murphai/core/dist/atomic-write.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/atomic-write.js +26 -0
- package/node_modules/@murphai/core/dist/atomic-write.js.map +1 -1
- package/node_modules/@murphai/core/dist/automation.d.ts +8 -2
- package/node_modules/@murphai/core/dist/automation.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/automation.js +66 -2
- package/node_modules/@murphai/core/dist/automation.js.map +1 -1
- package/node_modules/@murphai/core/dist/bank/goals.js.map +1 -1
- package/node_modules/@murphai/core/dist/bank/habitat.d.ts +36 -0
- package/node_modules/@murphai/core/dist/bank/habitat.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/habitat.js +179 -0
- package/node_modules/@murphai/core/dist/bank/habitat.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/regimens.js.map +1 -1
- package/node_modules/@murphai/core/dist/constants.d.ts +4 -0
- package/node_modules/@murphai/core/dist/constants.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/domains/events/attachment-backed.d.ts +41 -1
- package/node_modules/@murphai/core/dist/domains/events/attachment-backed.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/domains/events/attachment-backed.js +311 -5
- package/node_modules/@murphai/core/dist/domains/events/attachment-backed.js.map +1 -1
- package/node_modules/@murphai/core/dist/domains/events/capture-lookup.d.ts +6 -0
- package/node_modules/@murphai/core/dist/domains/events/capture-lookup.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/domains/events/capture-lookup.js +7 -0
- package/node_modules/@murphai/core/dist/domains/events/capture-lookup.js.map +1 -0
- package/node_modules/@murphai/core/dist/domains/events/ledger.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/domains/events/ledger.js +4 -0
- package/node_modules/@murphai/core/dist/domains/events/ledger.js.map +1 -1
- package/node_modules/@murphai/core/dist/domains/events.d.ts +2 -2
- package/node_modules/@murphai/core/dist/domains/events.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/domains/events.js +1 -1
- package/node_modules/@murphai/core/dist/domains/events.js.map +1 -1
- package/node_modules/@murphai/core/dist/domains/experiments.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/domains/experiments.js +9 -3
- package/node_modules/@murphai/core/dist/domains/experiments.js.map +1 -1
- package/node_modules/@murphai/core/dist/domains/shared.js.map +1 -1
- package/node_modules/@murphai/core/dist/errors.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/errors.js.map +1 -1
- package/node_modules/@murphai/core/dist/event-attachments.d.ts +2 -1
- package/node_modules/@murphai/core/dist/event-attachments.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/event-attachments.js +1 -0
- package/node_modules/@murphai/core/dist/event-attachments.js.map +1 -1
- package/node_modules/@murphai/core/dist/experiment-media-repair.d.ts +33 -0
- package/node_modules/@murphai/core/dist/experiment-media-repair.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/experiment-media-repair.js +685 -0
- package/node_modules/@murphai/core/dist/experiment-media-repair.js.map +1 -0
- package/node_modules/@murphai/core/dist/experiment-storage.d.ts +12 -0
- package/node_modules/@murphai/core/dist/experiment-storage.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/experiment-storage.js +70 -0
- package/node_modules/@murphai/core/dist/experiment-storage.js.map +1 -0
- package/node_modules/@murphai/core/dist/frontmatter.js.map +1 -1
- package/node_modules/@murphai/core/dist/fs.d.ts +1 -0
- package/node_modules/@murphai/core/dist/fs.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/fs.js +3 -0
- package/node_modules/@murphai/core/dist/fs.js.map +1 -1
- package/node_modules/@murphai/core/dist/history/api.d.ts +11 -0
- package/node_modules/@murphai/core/dist/history/api.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/history/api.js +60 -3
- package/node_modules/@murphai/core/dist/history/api.js.map +1 -1
- package/node_modules/@murphai/core/dist/history/types.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/ids.js.map +1 -1
- package/node_modules/@murphai/core/dist/index.d.ts +12 -6
- package/node_modules/@murphai/core/dist/index.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/index.js +6 -4
- package/node_modules/@murphai/core/dist/index.js.map +1 -1
- package/node_modules/@murphai/core/dist/integration-ingest-migration.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/integration-ingest-migration.js +1 -1
- package/node_modules/@murphai/core/dist/integration-ingest-migration.js.map +1 -1
- package/node_modules/@murphai/core/dist/integration-ingests.d.ts +73 -2
- package/node_modules/@murphai/core/dist/integration-ingests.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/integration-ingests.js +1196 -77
- package/node_modules/@murphai/core/dist/integration-ingests.js.map +1 -1
- package/node_modules/@murphai/core/dist/jsonl.d.ts +10 -0
- package/node_modules/@murphai/core/dist/jsonl.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/jsonl.js +63 -12
- package/node_modules/@murphai/core/dist/jsonl.js.map +1 -1
- package/node_modules/@murphai/core/dist/markdown-documents.js.map +1 -1
- package/node_modules/@murphai/core/dist/memory.d.ts +7 -2
- package/node_modules/@murphai/core/dist/memory.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/memory.js +36 -1
- package/node_modules/@murphai/core/dist/memory.js.map +1 -1
- package/node_modules/@murphai/core/dist/mutations.d.ts +33 -5
- package/node_modules/@murphai/core/dist/mutations.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/mutations.js +1684 -205
- package/node_modules/@murphai/core/dist/mutations.js.map +1 -1
- package/node_modules/@murphai/core/dist/operations/canonical-resource-lock.js.map +1 -1
- package/node_modules/@murphai/core/dist/operations/canonical-write-lock.js.map +1 -1
- package/node_modules/@murphai/core/dist/operations/index.d.ts +1 -1
- package/node_modules/@murphai/core/dist/operations/index.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/operations/index.js +1 -1
- package/node_modules/@murphai/core/dist/operations/index.js.map +1 -1
- package/node_modules/@murphai/core/dist/operations/write-batch.d.ts +34 -1
- package/node_modules/@murphai/core/dist/operations/write-batch.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/operations/write-batch.js +684 -39
- package/node_modules/@murphai/core/dist/operations/write-batch.js.map +1 -1
- package/node_modules/@murphai/core/dist/path-safety.js.map +1 -1
- package/node_modules/@murphai/core/dist/preferences.d.ts +21 -2
- package/node_modules/@murphai/core/dist/preferences.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/preferences.js +249 -12
- package/node_modules/@murphai/core/dist/preferences.js.map +1 -1
- package/node_modules/@murphai/core/dist/public-mutations.d.ts +13 -2
- package/node_modules/@murphai/core/dist/public-mutations.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/public-mutations.js +20 -3
- package/node_modules/@murphai/core/dist/public-mutations.js.map +1 -1
- package/node_modules/@murphai/core/dist/raw-artifact-integrity.js.map +1 -1
- package/node_modules/@murphai/core/dist/registry/api.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/scheduled-logs.d.ts +1 -0
- package/node_modules/@murphai/core/dist/scheduled-logs.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/scheduled-logs.js +1 -0
- package/node_modules/@murphai/core/dist/scheduled-logs.js.map +1 -1
- package/node_modules/@murphai/core/dist/vault.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/vault.js +174 -11
- package/node_modules/@murphai/core/dist/vault.js.map +1 -1
- package/node_modules/@murphai/core/dist/wearable-receipts.js.map +1 -1
- package/node_modules/@murphai/core/dist/wearable-storage-migration.js.map +1 -1
- package/node_modules/@murphai/core/dist/write-policy.d.ts +3 -0
- package/node_modules/@murphai/core/dist/write-policy.d.ts.map +1 -1
- package/node_modules/@murphai/core/dist/write-policy.js +54 -3
- package/node_modules/@murphai/core/dist/write-policy.js.map +1 -1
- package/node_modules/@murphai/device-syncd/README.md +45 -5
- package/node_modules/@murphai/device-syncd/dist/callback-redirect.d.ts +7 -0
- package/node_modules/@murphai/device-syncd/dist/callback-redirect.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/callback-redirect.js +9 -0
- package/node_modules/@murphai/device-syncd/dist/callback-redirect.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/client.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata-parser.d.ts +30 -0
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata-parser.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata-parser.js +130 -0
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata-parser.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata.d.ts +18 -0
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata.js +18 -0
- package/node_modules/@murphai/device-syncd/dist/companion-health-metadata.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config/connect-routes.d.ts +4 -1
- package/node_modules/@murphai/device-syncd/dist/config/connect-routes.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/connect-routes.js +39 -4
- package/node_modules/@murphai/device-syncd/dist/config/connect-routes.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/env-keys.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.d.ts +9 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.js +56 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-config.d.ts +3 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-config.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-config.js +46 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-config.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config/junction-connect-sources.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/{providers → config}/junction-connect-sources.js +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/junction-connect-sources.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config/provider-configs.d.ts +3 -5
- package/node_modules/@murphai/device-syncd/dist/config/provider-configs.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-configs.js +69 -14
- package/node_modules/@murphai/device-syncd/dist/config/provider-configs.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-env.d.ts +2 -3
- package/node_modules/@murphai/device-syncd/dist/config/provider-env.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-env.js +0 -3
- package/node_modules/@murphai/device-syncd/dist/config/provider-env.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-factory.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-factory.js +9 -5
- package/node_modules/@murphai/device-syncd/dist/config/provider-factory.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.d.ts +26 -16
- package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.js +236 -339
- package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/provider-types.d.ts +62 -5
- package/node_modules/@murphai/device-syncd/dist/config/provider-types.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/runtime-config.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/runtime-config.js +7 -361
- package/node_modules/@murphai/device-syncd/dist/config/runtime-config.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/serializable-provider-configs.d.ts +17 -1
- package/node_modules/@murphai/device-syncd/dist/config/serializable-provider-configs.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config/serializable-provider-configs.js +104 -11
- package/node_modules/@murphai/device-syncd/dist/config/serializable-provider-configs.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config.d.ts +5 -3
- package/node_modules/@murphai/device-syncd/dist/config.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/config.js +4 -2
- package/node_modules/@murphai/device-syncd/dist/config.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/configured-provider-descriptors.d.ts +6 -0
- package/node_modules/@murphai/device-syncd/dist/configured-provider-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/configured-provider-descriptors.js +7 -0
- package/node_modules/@murphai/device-syncd/dist/configured-provider-descriptors.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.d.ts +3 -0
- package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.js +2 -0
- package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/connect-config.d.ts +2 -2
- package/node_modules/@murphai/device-syncd/dist/connect-config.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/connect-config.js +4 -11
- package/node_modules/@murphai/device-syncd/dist/connect-config.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/errors.d.ts +8 -0
- package/node_modules/@murphai/device-syncd/dist/errors.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/errors.js +26 -0
- package/node_modules/@murphai/device-syncd/dist/errors.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/hosted-hints.js +1 -1
- package/node_modules/@murphai/device-syncd/dist/hosted-hints.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts +24 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js +187 -28
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/http.d.ts +2 -9
- package/node_modules/@murphai/device-syncd/dist/http.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/http.js +26 -29
- package/node_modules/@murphai/device-syncd/dist/http.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/index.d.ts +7 -7
- package/node_modules/@murphai/device-syncd/dist/index.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/index.js +1 -1
- package/node_modules/@murphai/device-syncd/dist/index.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.d.ts +60 -0
- package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.js +382 -0
- package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/junction-resources.d.ts +17 -0
- package/node_modules/@murphai/device-syncd/dist/junction-resources.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/junction-resources.js +28 -0
- package/node_modules/@murphai/device-syncd/dist/junction-resources.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/metadata.d.ts +1 -0
- package/node_modules/@murphai/device-syncd/dist/metadata.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/metadata.js +1 -1
- package/node_modules/@murphai/device-syncd/dist/metadata.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/provider-configs.d.ts +3 -0
- package/node_modules/@murphai/device-syncd/dist/provider-configs.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/provider-configs.js +2 -0
- package/node_modules/@murphai/device-syncd/dist/provider-configs.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/provider-credential-policy.d.ts +6 -0
- package/node_modules/@murphai/device-syncd/dist/provider-credential-policy.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/provider-credential-policy.js +22 -0
- package/node_modules/@murphai/device-syncd/dist/provider-credential-policy.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/provider-job-definitions.d.ts +7 -0
- package/node_modules/@murphai/device-syncd/dist/provider-job-definitions.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/provider-job-definitions.js +116 -0
- package/node_modules/@murphai/device-syncd/dist/provider-job-definitions.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/provider-label.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/provider-label.js +5 -5
- package/node_modules/@murphai/device-syncd/dist/provider-label.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/junction-client.d.ts +22 -5
- package/node_modules/@murphai/device-syncd/dist/providers/junction-client.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/junction-client.js +93 -58
- package/node_modules/@murphai/device-syncd/dist/providers/junction-client.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/junction-config.d.ts +3 -0
- package/node_modules/@murphai/device-syncd/dist/providers/junction-config.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/junction-config.js +2 -0
- package/node_modules/@murphai/device-syncd/dist/providers/junction-config.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/junction.d.ts +5 -28
- package/node_modules/@murphai/device-syncd/dist/providers/junction.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/junction.js +927 -719
- package/node_modules/@murphai/device-syncd/dist/providers/junction.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/oura.d.ts +2 -14
- package/node_modules/@murphai/device-syncd/dist/providers/oura.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/oura.js +3 -26
- package/node_modules/@murphai/device-syncd/dist/providers/oura.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/provider-diagnostics.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/provider-diagnostics.js +34 -30
- package/node_modules/@murphai/device-syncd/dist/providers/provider-diagnostics.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/strava-webhooks.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/strava.d.ts +2 -15
- package/node_modules/@murphai/device-syncd/dist/providers/strava.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/strava.js +8 -43
- package/node_modules/@murphai/device-syncd/dist/providers/strava.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.d.ts +2 -12
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.js +3 -22
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/public-account.d.ts +25 -0
- package/node_modules/@murphai/device-syncd/dist/public-account.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/public-account.js +32 -0
- package/node_modules/@murphai/device-syncd/dist/public-account.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts +9 -4
- package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/public-ingress.js +125 -40
- package/node_modules/@murphai/device-syncd/dist/public-ingress.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptor-shared.d.ts +3 -0
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptor-shared.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptor-shared.js +4 -0
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptor-shared.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptors.d.ts +10 -0
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptors.js +41 -0
- package/node_modules/@murphai/device-syncd/dist/public-provider-descriptors.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/registry.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/service.d.ts +1 -1
- package/node_modules/@murphai/device-syncd/dist/service.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/service.js +219 -61
- package/node_modules/@murphai/device-syncd/dist/service.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/shared.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/accounts.d.ts +6 -0
- package/node_modules/@murphai/device-syncd/dist/store/accounts.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/accounts.js +129 -40
- package/node_modules/@murphai/device-syncd/dist/store/accounts.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/hosted-account-hydration.d.ts +2 -0
- package/node_modules/@murphai/device-syncd/dist/store/hosted-account-hydration.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/hosted-account-hydration.js +80 -6
- package/node_modules/@murphai/device-syncd/dist/store/hosted-account-hydration.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/jobs.d.ts +15 -0
- package/node_modules/@murphai/device-syncd/dist/store/jobs.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/jobs.js +119 -39
- package/node_modules/@murphai/device-syncd/dist/store/jobs.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/oauth-states.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/oauth-states.js +14 -8
- package/node_modules/@murphai/device-syncd/dist/store/oauth-states.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/schema.d.ts +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/schema.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/schema.js +22 -4
- package/node_modules/@murphai/device-syncd/dist/store/schema.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/sync-state.d.ts +9 -1
- package/node_modules/@murphai/device-syncd/dist/store/sync-state.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store/sync-state.js +57 -52
- package/node_modules/@murphai/device-syncd/dist/store/sync-state.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store.d.ts +46 -2
- package/node_modules/@murphai/device-syncd/dist/store.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/store.js +103 -6
- package/node_modules/@murphai/device-syncd/dist/store.js.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/types.d.ts +24 -1
- package/node_modules/@murphai/device-syncd/dist/types.d.ts.map +1 -1
- package/node_modules/@murphai/device-syncd/dist/types.js.map +1 -1
- package/node_modules/@murphai/device-syncd/package.json +28 -0
- package/node_modules/@murphai/exercise-library/content/seed/at-home-exercise-strength-addon-250.csv +251 -251
- package/node_modules/@murphai/exercise-library/content/seed/at-home-exercise-stretch-addon-500.csv +359 -359
- package/node_modules/@murphai/exercise-library/content/seed/at-home-exercise-stretch.csv +154 -154
- package/node_modules/@murphai/exercise-library/dist/build.js.map +1 -1
- package/node_modules/@murphai/exercise-library/dist/runtime.js.map +1 -1
- package/node_modules/@murphai/exercise-library/dist/schema.d.ts.map +1 -1
- package/node_modules/@murphai/exercise-library/generated/catalog.hash +1 -1
- package/node_modules/@murphai/exercise-library/generated/exercise-details.json +12082 -764
- package/node_modules/@murphai/exercise-library/generated/exercise-facets.json +1 -1
- package/node_modules/@murphai/exercise-library/generated/exercise-index.json +1 -1
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-11776448.md +60 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-18306161.md +60 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-19817517.md +60 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-19913903.md +60 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-19995444.md +62 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-20662037.md +60 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-24568233.md +62 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-26914684.md +60 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-27141153.md +62 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-28186867.md +62 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-36495670.md +62 -0
- package/node_modules/@murphai/health-commons/content/sources/photobiomodulation-intake/pmid-37760145.md +62 -0
- package/node_modules/@murphai/health-commons/dist/build.js.map +1 -1
- package/node_modules/@murphai/health-commons/dist/catalog.d.ts +4 -4
- package/node_modules/@murphai/health-commons/dist/hash-artifact.js.map +1 -1
- package/node_modules/@murphai/health-commons/dist/runtime.d.ts +3 -7
- package/node_modules/@murphai/health-commons/dist/runtime.d.ts.map +1 -1
- package/node_modules/@murphai/health-commons/dist/runtime.js +59 -47
- package/node_modules/@murphai/health-commons/dist/runtime.js.map +1 -1
- package/node_modules/@murphai/health-commons/dist/sync-cloudflare-r2.js.map +1 -1
- package/node_modules/@murphai/health-commons/generated/catalog.hash +1 -1
- package/node_modules/@murphai/health-commons/generated/protocol-family-graph.json +1 -1
- package/node_modules/@murphai/health-commons/generated/protocol-index.json +1 -1
- package/node_modules/@murphai/health-commons/generated/protocol-run-specs.json +1 -1
- package/node_modules/@murphai/health-commons/generated/source-artifact-index.json +1 -1
- package/node_modules/@murphai/health-commons/generated/source-identities.ndjson +54 -0
- package/node_modules/@murphai/health-commons/generated/source-index.json +727 -1
- package/node_modules/@murphai/health-commons/generated/web/browse/biomarkers.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/browse/experiments.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/added-sugar-intake.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/adherence.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/adverse-symptoms.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alanine-aminotransferase.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-craving.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-free-days.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-intake.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-withdrawal-symptoms.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ankle-knee-to-wall-distance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/apolipoprotein-b.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/aspartate-aminotransferase.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/bilirubin.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-glucose.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-ketones-beta-hydroxybutyrate.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-oxygen-spo2.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-pressure.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-urea-nitrogen.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/body-fat-percent.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/body-weight.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/chosen-primary-outcome-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/continuous-glucose.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/creatine-kinase.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-energy-intake-kcal.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-protein-g-per-kg.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-protein-grams.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-step-count.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daytime-sleepiness.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/deep-sleep-minutes.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/dietary-fiber-g-day.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/digestive-comfort.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/egfr.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/estimated-gfr.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/estimated-vo2max.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/fasting-triglycerides.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/gi-symptom-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/gi-tolerance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hbot-session-tolerability.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hdl-c.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hrv-rmssd.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lateral-knee-pain.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-c.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-cholesterol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lean-body-mass.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lean-mass.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/leg-heaviness-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/liver-enzyme-panel.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/macular-health-safety.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/moderate-to-vigorous-activity-minutes.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/mood-affect.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/morning-blood-pressure.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/muscle-soreness-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/musculoskeletal-pain.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/non-hdl-c.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/non-hdl-cholesterol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/omega-3-index.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-recovery-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-recovery.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-stiffness.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-stress.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/periocular-wrinkle-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/postprandial-glucose-excursion.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/pre-sleep-arousal.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/rem-sleep-minutes.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/resting-heart-rate.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/running-tolerance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/saturated-fat-g-day.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sedentary-time.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/self-reported-mood.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/serum-25-hydroxyvitamin-d.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/serum-creatinine.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/serum-uric-acid.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/shoulder-reach-distance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sit-and-reach-distance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/skin-texture-roughness-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/skin-tolerability-symptoms.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sleep-efficiency.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sleep-onset-latency.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sleep-quality.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/standardized-skin-photo-score.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/step-floor-days.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/stretching-adherence-sessions.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/stretching-session-burden.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/stretching-symptoms.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/subjective-eye-strain.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/subjective-satiety.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/supplement-adherence.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/task-performance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/toe-touch-distance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-cholesterol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-sleep-time.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/training-performance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/training-volume.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/triglycerides.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/urine-albumin-creatinine-ratio.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/visual-fatigue.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/visual-performance.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/waist-circumference.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/wake-time-variability.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/walking-bout-minutes.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/walking-cadence.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/walking-safety-events.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/measurement_method/clinic-imaging-upgrade.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/measurement_method/home-standardized-photo-roi-analysis.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/measurement_method/standardized-photo-score-workflow.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/at-home-static-stretching-for-flexibility.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/bryan-johnson-blueprint.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/caffeine-curfew-dose-reset.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/cold-plunge.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/consistent-wake-time.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/creatine-monohydrate.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/daily-step-floor.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/daily-vitamin-d3-supplementation.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/digital-sunset.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/finnish-sauna.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/hydrolyzed-collagen-peptides.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/hyperbaric-oxygen-therapy.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/it-band-syndrome-rehab-and-return-to-run.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/morning-outdoor-light-exposure.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/no-added-sugar-diet.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/norwegian-4x4.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/oral-epa-dha-supplementation.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/pneumatic-compression-pants.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/pre-sleep-resonance-breathing-and-meditation.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/pre-sleep-silent-meditation.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/prolonged-fasting-24-72-hours.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/protein-floor-high-protein-intake.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/psyllium-husk-for-cholesterol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/red-light-glasses-before-bed.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/red-near-infrared-skin-texture-photoaging.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/red-yeast-rice-for-cholesterol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/short-term-alcohol-abstinence.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/social-media-fast.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/tabata-20-10-interval-training.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/time-restricted-eating-18-6.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/walking-after-every-meal.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/whole-body-red-and-near-infrared-light-exposure.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/zone-2-aerobic-base-block.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/blood-oxygen-spo2/overview.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/blood-oxygen-spo2/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/deep-sleep-minutes/overview.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/deep-sleep-minutes/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/estimated-vo2max/overview.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/estimated-vo2max/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/hrv-rmssd/overview.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/hrv-rmssd/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/rem-sleep-minutes/overview.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/rem-sleep-minutes/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/resting-heart-rate/overview.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/resting-heart-rate/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/routes/index.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/blood-oxygen-spo2.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/deep-sleep-minutes.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/estimated-vo2max.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/hrv-rmssd.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/rem-sleep-minutes.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/resting-heart-rate.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/at-home-static-stretching-for-flexibility.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/bryan-johnson-blueprint.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/caffeine-curfew-dose-reset.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/cold-plunge.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/consistent-wake-time.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/daily-step-floor.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/digital-sunset.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/finnish-sauna.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/hyperbaric-oxygen-therapy.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/morning-outdoor-light-exposure.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/no-added-sugar-diet.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/norwegian-4x4.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/pneumatic-compression-pants.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/pre-sleep-resonance-breathing-and-meditation.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/pre-sleep-silent-meditation.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/prolonged-fasting-24-72-hours.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/protein-floor-high-protein-intake.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/red-light-glasses-before-bed.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/red-near-infrared-skin-texture-photoaging.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/short-term-alcohol-abstinence.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/tabata-20-10-interval-training.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/time-restricted-eating-18-6.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/walking-after-every-meal.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/whole-body-red-and-near-infrared-light-exposure.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/shell/experiments/zone-2-aerobic-base-block.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/at-home-static-stretching-for-flexibility/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/at-home-static-stretching-for-flexibility/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/at-home-static-stretching-for-flexibility/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/bryan-johnson-blueprint/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/bryan-johnson-blueprint/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/bryan-johnson-blueprint/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/caffeine-curfew-dose-reset/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/caffeine-curfew-dose-reset/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/caffeine-curfew-dose-reset/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/cold-plunge/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/cold-plunge/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/cold-plunge/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/consistent-wake-time/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/consistent-wake-time/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/consistent-wake-time/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/daily-step-floor/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/daily-step-floor/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/daily-step-floor/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/digital-sunset/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/digital-sunset/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/digital-sunset/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/finnish-sauna/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/finnish-sauna/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/finnish-sauna/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/hyperbaric-oxygen-therapy/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/hyperbaric-oxygen-therapy/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/hyperbaric-oxygen-therapy/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/morning-outdoor-light-exposure/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/morning-outdoor-light-exposure/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/morning-outdoor-light-exposure/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/no-added-sugar-diet/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/no-added-sugar-diet/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/no-added-sugar-diet/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/norwegian-4x4/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/norwegian-4x4/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/norwegian-4x4/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pneumatic-compression-pants/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pneumatic-compression-pants/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pneumatic-compression-pants/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pre-sleep-resonance-breathing-and-meditation/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pre-sleep-resonance-breathing-and-meditation/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pre-sleep-resonance-breathing-and-meditation/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pre-sleep-silent-meditation/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pre-sleep-silent-meditation/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pre-sleep-silent-meditation/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/prolonged-fasting-24-72-hours/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/prolonged-fasting-24-72-hours/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/prolonged-fasting-24-72-hours/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/protein-floor-high-protein-intake/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/protein-floor-high-protein-intake/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/protein-floor-high-protein-intake/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/red-light-glasses-before-bed/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/red-light-glasses-before-bed/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/red-light-glasses-before-bed/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/red-near-infrared-skin-texture-photoaging/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/red-near-infrared-skin-texture-photoaging/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/red-near-infrared-skin-texture-photoaging/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/short-term-alcohol-abstinence/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/short-term-alcohol-abstinence/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/short-term-alcohol-abstinence/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/tabata-20-10-interval-training/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/tabata-20-10-interval-training/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/tabata-20-10-interval-training/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/time-restricted-eating-18-6/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/time-restricted-eating-18-6/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/time-restricted-eating-18-6/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/walking-after-every-meal/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/walking-after-every-meal/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/walking-after-every-meal/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/whole-body-red-and-near-infrared-light-exposure/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/whole-body-red-and-near-infrared-light-exposure/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/whole-body-red-and-near-infrared-light-exposure/results-public.json +2 -2
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/zone-2-aerobic-base-block/protocol.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/zone-2-aerobic-base-block/research.json +1 -1
- package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/zone-2-aerobic-base-block/results-public.json +2 -2
- package/node_modules/@murphai/health-metrics/README.md +4 -0
- package/node_modules/@murphai/health-metrics/dist/catalog.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/activity.d.ts +15 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/activity.d.ts.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/activity.js +99 -0
- package/node_modules/@murphai/health-metrics/dist/definitions/activity.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/labs.d.ts +1 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/recovery.d.ts +1 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/recovery.d.ts.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/recovery.js +12 -0
- package/node_modules/@murphai/health-metrics/dist/definitions/recovery.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/definitions/sleep.d.ts +1 -1
- package/node_modules/@murphai/health-metrics/dist/format.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/goals.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/index.d.ts +0 -2
- package/node_modules/@murphai/health-metrics/dist/index.d.ts.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/index.js +0 -2
- package/node_modules/@murphai/health-metrics/dist/index.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/murph-age-source-routes.d.ts.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/murph-age-source-routes.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/murph-age.d.ts.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/murph-age.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/normalize.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/selectors.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/wearable-metric-catalog.d.ts.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/wearable-metric-catalog.js.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/wearable-provider-catalog.d.ts.map +1 -1
- package/node_modules/@murphai/health-metrics/dist/wearable-provider-catalog.js.map +1 -1
- package/node_modules/@murphai/health-metrics/package.json +10 -0
- package/node_modules/@murphai/importers/README.md +13 -0
- package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.js.map +1 -1
- package/node_modules/@murphai/importers/dist/clinical-records/index.d.ts +19 -0
- package/node_modules/@murphai/importers/dist/clinical-records/index.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/clinical-records/index.js +1523 -0
- package/node_modules/@murphai/importers/dist/clinical-records/index.js.map +1 -0
- package/node_modules/@murphai/importers/dist/core-port.d.ts +1 -0
- package/node_modules/@murphai/importers/dist/core-port.d.ts.map +1 -1
- package/node_modules/@murphai/importers/dist/core-port.js.map +1 -1
- package/node_modules/@murphai/importers/dist/create-importers.d.ts.map +1 -1
- package/node_modules/@murphai/importers/dist/create-importers.js.map +1 -1
- package/node_modules/@murphai/importers/dist/csv-sample-import-planner.js.map +1 -1
- package/node_modules/@murphai/importers/dist/csv-sample-importer.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/index.d.ts +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/index.d.ts.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/index.js +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/index.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/junction-origin.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/junction-resources.d.ts +3 -2
- package/node_modules/@murphai/importers/dist/device-providers/junction-resources.d.ts.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/junction-resources.js +12 -20
- package/node_modules/@murphai/importers/dist/device-providers/junction-resources.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/junction.d.ts +18 -0
- package/node_modules/@murphai/importers/dist/device-providers/junction.d.ts.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/junction.js +1026 -123
- package/node_modules/@murphai/importers/dist/device-providers/junction.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.d.ts +132 -132
- package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.d.ts.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/registry.js.map +1 -1
- package/node_modules/@murphai/importers/dist/device-providers/whoop.js.map +1 -1
- package/node_modules/@murphai/importers/dist/document-importer.js.map +1 -1
- package/node_modules/@murphai/importers/dist/meal-importer.js.map +1 -1
- package/node_modules/@murphai/importers/dist/preset-registry.js.map +1 -1
- package/node_modules/@murphai/importers/package.json +5 -0
- package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-app/environment.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-app/reads.js +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-app/reads.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-app/service.d.ts.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-app/service.js +2 -0
- package/node_modules/@murphai/inbox-services/dist/inbox-app/service.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-app/storage-repair.d.ts +3 -0
- package/node_modules/@murphai/inbox-services/dist/inbox-app/storage-repair.d.ts.map +1 -0
- package/node_modules/@murphai/inbox-services/dist/inbox-app/storage-repair.js +37 -0
- package/node_modules/@murphai/inbox-services/dist/inbox-app/storage-repair.js.map +1 -0
- package/node_modules/@murphai/inbox-services/dist/inbox-app/types.d.ts +22 -2
- package/node_modules/@murphai/inbox-services/dist/inbox-app/types.d.ts.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/connectors.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/daemon.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/parser.d.ts +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/parser.js +2 -2
- package/node_modules/@murphai/inbox-services/dist/inbox-services/parser.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/promotions.d.ts +2 -2
- package/node_modules/@murphai/inbox-services/dist/inbox-services/promotions.d.ts.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/promotions.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/query.d.ts +27 -27
- package/node_modules/@murphai/inbox-services/dist/inbox-services/query.d.ts.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/query.js +2 -2
- package/node_modules/@murphai/inbox-services/dist/inbox-services/query.js.map +1 -1
- package/node_modules/@murphai/inbox-services/dist/inbox-services/state.js.map +1 -1
- package/node_modules/@murphai/inboxd/README.md +3 -2
- package/node_modules/@murphai/inboxd/dist/checkpoint.d.ts +2 -0
- package/node_modules/@murphai/inboxd/dist/checkpoint.d.ts.map +1 -0
- package/node_modules/@murphai/inboxd/dist/checkpoint.js +2 -0
- package/node_modules/@murphai/inboxd/dist/checkpoint.js.map +1 -0
- package/node_modules/@murphai/inboxd/dist/connectors/email/directness.d.ts +11 -0
- package/node_modules/@murphai/inboxd/dist/connectors/email/directness.d.ts.map +1 -0
- package/node_modules/@murphai/inboxd/dist/connectors/email/directness.js +67 -0
- package/node_modules/@murphai/inboxd/dist/connectors/email/directness.js.map +1 -0
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize-parsed.d.ts +3 -1
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize-parsed.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize-parsed.js +18 -9
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize-parsed.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.d.ts +1 -10
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.js +2 -65
- package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/connectors/hosted-conversation.d.ts +0 -15
- package/node_modules/@murphai/inboxd/dist/connectors/hosted-conversation.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/connectors/hosted-conversation.js +0 -33
- package/node_modules/@murphai/inboxd/dist/connectors/hosted-conversation.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/connectors/telegram/connector.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/contracts/capture.d.ts +1 -2
- package/node_modules/@murphai/inboxd/dist/contracts/capture.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/contracts/search.d.ts +2 -2
- package/node_modules/@murphai/inboxd/dist/contracts/search.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/index.d.ts +1 -0
- package/node_modules/@murphai/inboxd/dist/index.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/index.js +1 -0
- package/node_modules/@murphai/inboxd/dist/index.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/envelope-migration.d.ts +21 -0
- package/node_modules/@murphai/inboxd/dist/indexing/envelope-migration.d.ts.map +1 -0
- package/node_modules/@murphai/inboxd/dist/indexing/envelope-migration.js +259 -0
- package/node_modules/@murphai/inboxd/dist/indexing/envelope-migration.js.map +1 -0
- package/node_modules/@murphai/inboxd/dist/indexing/parser-derivatives.d.ts +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/parser-derivatives.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/parser-derivatives.js +7 -4
- package/node_modules/@murphai/inboxd/dist/indexing/parser-derivatives.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/persist/canonical-records.d.ts +13 -1
- package/node_modules/@murphai/inboxd/dist/indexing/persist/canonical-records.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/persist/canonical-records.js +68 -13
- package/node_modules/@murphai/inboxd/dist/indexing/persist/canonical-records.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/persist.d.ts +12 -6
- package/node_modules/@murphai/inboxd/dist/indexing/persist.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/persist.js +226 -73
- package/node_modules/@murphai/inboxd/dist/indexing/persist.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/indexing/retention.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/kernel/pipeline.js +4 -4
- package/node_modules/@murphai/inboxd/dist/kernel/pipeline.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/kernel/registry.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/kernel/sqlite/rows.d.ts +2 -2
- package/node_modules/@murphai/inboxd/dist/kernel/sqlite/rows.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/kernel/sqlite/rows.js +3 -3
- package/node_modules/@murphai/inboxd/dist/kernel/sqlite/rows.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/kernel/sqlite.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/kernel/sqlite.js +42 -12
- package/node_modules/@murphai/inboxd/dist/kernel/sqlite.js.map +1 -1
- package/node_modules/@murphai/inboxd/dist/retention.d.ts +2 -0
- package/node_modules/@murphai/inboxd/dist/retention.d.ts.map +1 -0
- package/node_modules/@murphai/inboxd/dist/retention.js +2 -0
- package/node_modules/@murphai/inboxd/dist/retention.js.map +1 -0
- package/node_modules/@murphai/inboxd/dist/runtime.d.ts +2 -1
- package/node_modules/@murphai/inboxd/dist/runtime.d.ts.map +1 -1
- package/node_modules/@murphai/inboxd/dist/runtime.js +1 -0
- package/node_modules/@murphai/inboxd/dist/runtime.js.map +1 -1
- package/node_modules/@murphai/inboxd/package.json +12 -0
- package/node_modules/@murphai/messaging-ingress/README.md +1 -5
- package/node_modules/@murphai/messaging-ingress/dist/internal.d.ts.map +1 -1
- package/node_modules/@murphai/messaging-ingress/dist/internal.js +4 -0
- package/node_modules/@murphai/messaging-ingress/dist/internal.js.map +1 -1
- package/node_modules/@murphai/messaging-ingress/dist/linq-webhook.d.ts.map +1 -1
- package/node_modules/@murphai/messaging-ingress/dist/linq-webhook.js.map +1 -1
- package/node_modules/@murphai/messaging-ingress/package.json +0 -4
- package/node_modules/@murphai/operator-config/dist/agentmail-runtime.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.d.ts +2 -0
- package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.js +5 -0
- package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.d.ts +5 -0
- package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.js +58 -0
- package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/delivery-failure.d.ts +2 -2
- package/node_modules/@murphai/operator-config/dist/assistant/delivery-failure.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/delivery-failure.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/hosted-config.d.ts +5 -5
- package/node_modules/@murphai/operator-config/dist/assistant/hosted-config.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.d.ts +32 -31
- package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.js +4 -2
- package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant-backend.d.ts +2 -2
- package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.d.ts +488 -317
- package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.js +171 -22
- package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/device-cli-contracts.d.ts +32 -27
- package/node_modules/@murphai/operator-config/dist/device-cli-contracts.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/device-cli-contracts.js +11 -1
- package/node_modules/@murphai/operator-config/dist/device-cli-contracts.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/device-daemon/paths.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/device-daemon.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/device-sync-browser-opener.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/device-sync-client.d.ts +1 -1
- package/node_modules/@murphai/operator-config/dist/device-sync-client.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/device-sync-client.js +6 -2
- package/node_modules/@murphai/operator-config/dist/device-sync-client.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/hosted-assistant-config-constants.d.ts +1 -1
- package/node_modules/@murphai/operator-config/dist/hosted-assistant-config-constants.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/hosted-assistant-config.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.d.ts +138 -93
- package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.js +40 -3
- package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/linq-runtime.d.ts +7 -11
- package/node_modules/@murphai/operator-config/dist/linq-runtime.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/linq-runtime.js +25 -10
- package/node_modules/@murphai/operator-config/dist/linq-runtime.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/message-formatting.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/message-formatting.js +14 -3
- package/node_modules/@murphai/operator-config/dist/message-formatting.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/operator-config/self-delivery-targets.d.ts +4 -2
- package/node_modules/@murphai/operator-config/dist/operator-config/self-delivery-targets.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/operator-config/storage.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/operator-config.d.ts +7 -5
- package/node_modules/@murphai/operator-config/dist/operator-config.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/operator-config.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/setup-cli-contracts.d.ts +54 -54
- package/node_modules/@murphai/operator-config/dist/setup-cli-contracts.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/setup-runtime-env.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/telegram-runtime.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/dist/telegram-runtime.js +11 -1
- package/node_modules/@murphai/operator-config/dist/telegram-runtime.js.map +1 -1
- package/node_modules/@murphai/operator-config/dist/vault-cli-contracts.d.ts +85 -85
- package/node_modules/@murphai/operator-config/dist/vault-cli-contracts.js +1 -1
- package/node_modules/@murphai/operator-config/dist/vault-cli-errors.d.ts.map +1 -1
- package/node_modules/@murphai/operator-config/package.json +0 -5
- package/node_modules/@murphai/parsers/README.md +4 -2
- package/node_modules/@murphai/parsers/dist/adapters/ffmpeg.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/adapters/poppler-pdf.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/adapters/text-file.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/adapters/whisper-cpp.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/adapters/zxing-wasm.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/contracts/parser-output.d.ts +15 -0
- package/node_modules/@murphai/parsers/dist/contracts/parser-output.d.ts.map +1 -0
- package/node_modules/@murphai/parsers/dist/contracts/parser-output.js +368 -0
- package/node_modules/@murphai/parsers/dist/contracts/parser-output.js.map +1 -0
- package/node_modules/@murphai/parsers/dist/index.d.ts +5 -2
- package/node_modules/@murphai/parsers/dist/index.d.ts.map +1 -1
- package/node_modules/@murphai/parsers/dist/index.js +3 -1
- package/node_modules/@murphai/parsers/dist/index.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/parser-result.d.ts +2 -0
- package/node_modules/@murphai/parsers/dist/parser-result.d.ts.map +1 -0
- package/node_modules/@murphai/parsers/dist/parser-result.js +2 -0
- package/node_modules/@murphai/parsers/dist/parser-result.js.map +1 -0
- package/node_modules/@murphai/parsers/dist/pipelines/parse-attachment.d.ts.map +1 -1
- package/node_modules/@murphai/parsers/dist/pipelines/parse-attachment.js +2 -245
- package/node_modules/@murphai/parsers/dist/pipelines/parse-attachment.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/pipelines/worker.d.ts +1 -1
- package/node_modules/@murphai/parsers/dist/pipelines/worker.d.ts.map +1 -1
- package/node_modules/@murphai/parsers/dist/pipelines/worker.js +12 -4
- package/node_modules/@murphai/parsers/dist/pipelines/worker.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/publish/legacy-attempt-compactor.d.ts +18 -0
- package/node_modules/@murphai/parsers/dist/publish/legacy-attempt-compactor.d.ts.map +1 -0
- package/node_modules/@murphai/parsers/dist/publish/legacy-attempt-compactor.js +480 -0
- package/node_modules/@murphai/parsers/dist/publish/legacy-attempt-compactor.js.map +1 -0
- package/node_modules/@murphai/parsers/dist/publish/writer.d.ts +26 -8
- package/node_modules/@murphai/parsers/dist/publish/writer.d.ts.map +1 -1
- package/node_modules/@murphai/parsers/dist/publish/writer.js +168 -57
- package/node_modules/@murphai/parsers/dist/publish/writer.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/registry/policy.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/registry/registry.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/shared.js.map +1 -1
- package/node_modules/@murphai/parsers/dist/toolchain/discover.js.map +1 -1
- package/node_modules/@murphai/parsers/package.json +4 -0
- package/node_modules/@murphai/query/dist/automation.d.ts +3 -2
- package/node_modules/@murphai/query/dist/automation.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/automation.js +68 -5
- package/node_modules/@murphai/query/dist/automation.js.map +1 -1
- package/node_modules/@murphai/query/dist/biomarker-change-sentiment.d.ts +10 -0
- package/node_modules/@murphai/query/dist/biomarker-change-sentiment.d.ts.map +1 -0
- package/node_modules/@murphai/query/dist/biomarker-change-sentiment.js +24 -0
- package/node_modules/@murphai/query/dist/biomarker-change-sentiment.js.map +1 -0
- package/node_modules/@murphai/query/dist/browser-experiments.d.ts +4 -0
- package/node_modules/@murphai/query/dist/browser-experiments.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/browser-experiments.js +3 -0
- package/node_modules/@murphai/query/dist/browser-experiments.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/biomarker-panel.js +3 -3
- package/node_modules/@murphai/query/dist/browser-replica/biomarker-panel.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/build.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/build.js +20 -0
- package/node_modules/@murphai/query/dist/browser-replica/build.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/experiments.d.ts +8 -2
- package/node_modules/@murphai/query/dist/browser-replica/experiments.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/experiments.js +128 -26
- package/node_modules/@murphai/query/dist/browser-replica/experiments.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/murph-age.d.ts +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/murph-age.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/murph-age.js +2 -1
- package/node_modules/@murphai/query/dist/browser-replica/murph-age.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/query.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/shared.d.ts +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/shared.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/shared.js +1 -0
- package/node_modules/@murphai/query/dist/browser-replica/shared.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica/views.js +1 -0
- package/node_modules/@murphai/query/dist/browser-replica/views.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica.d.ts +1 -3
- package/node_modules/@murphai/query/dist/browser-replica.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/browser-replica.js +0 -1
- package/node_modules/@murphai/query/dist/browser-replica.js.map +1 -1
- package/node_modules/@murphai/query/dist/browser.d.ts +2 -2
- package/node_modules/@murphai/query/dist/browser.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/browser.js +1 -1
- package/node_modules/@murphai/query/dist/browser.js.map +1 -1
- package/node_modules/@murphai/query/dist/canonical-entities.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/canonical-entities.js +1 -0
- package/node_modules/@murphai/query/dist/canonical-entities.js.map +1 -1
- package/node_modules/@murphai/query/dist/entity-families.d.ts +1 -1
- package/node_modules/@murphai/query/dist/entity-families.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/entity-families.js +1 -0
- package/node_modules/@murphai/query/dist/entity-families.js.map +1 -1
- package/node_modules/@murphai/query/dist/experiment-adherence.d.ts +55 -2
- package/node_modules/@murphai/query/dist/experiment-adherence.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/experiment-adherence.js +367 -13
- package/node_modules/@murphai/query/dist/experiment-adherence.js.map +1 -1
- package/node_modules/@murphai/query/dist/experiment-progress-card.d.ts +6 -1
- package/node_modules/@murphai/query/dist/experiment-progress-card.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/experiment-progress-card.js +48 -13
- package/node_modules/@murphai/query/dist/experiment-progress-card.js.map +1 -1
- package/node_modules/@murphai/query/dist/experiments.d.ts +11 -1
- package/node_modules/@murphai/query/dist/experiments.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/experiments.js +265 -36
- package/node_modules/@murphai/query/dist/experiments.js.map +1 -1
- package/node_modules/@murphai/query/dist/export-pack.js.map +1 -1
- package/node_modules/@murphai/query/dist/group-weekly.d.ts +32 -0
- package/node_modules/@murphai/query/dist/group-weekly.d.ts.map +1 -0
- package/node_modules/@murphai/query/dist/group-weekly.js +166 -0
- package/node_modules/@murphai/query/dist/group-weekly.js.map +1 -0
- package/node_modules/@murphai/query/dist/health/assessments.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/blood-tests.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/canonical-collector.d.ts +1 -0
- package/node_modules/@murphai/query/dist/health/canonical-collector.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/health/canonical-collector.js +4 -1
- package/node_modules/@murphai/query/dist/health/canonical-collector.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/foods.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/habitat.d.ts +6 -0
- package/node_modules/@murphai/query/dist/health/habitat.d.ts.map +1 -0
- package/node_modules/@murphai/query/dist/health/habitat.js +12 -0
- package/node_modules/@murphai/query/dist/health/habitat.js.map +1 -0
- package/node_modules/@murphai/query/dist/health/immunizations.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/index.d.ts +1 -0
- package/node_modules/@murphai/query/dist/health/index.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/health/index.js +1 -0
- package/node_modules/@murphai/query/dist/health/index.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/projections.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/projectors/history.d.ts +1 -1
- package/node_modules/@murphai/query/dist/health/providers.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/recipes.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/registries.d.ts +11 -0
- package/node_modules/@murphai/query/dist/health/registries.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/health/registries.js +18 -2
- package/node_modules/@murphai/query/dist/health/registries.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/supplements.js.map +1 -1
- package/node_modules/@murphai/query/dist/health/workout-formats.js.map +1 -1
- package/node_modules/@murphai/query/dist/id-families.d.ts +1 -13
- package/node_modules/@murphai/query/dist/id-families.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/id-families.js +1 -119
- package/node_modules/@murphai/query/dist/id-families.js.map +1 -1
- package/node_modules/@murphai/query/dist/index.d.ts +10 -15
- package/node_modules/@murphai/query/dist/index.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/index.js +7 -31
- package/node_modules/@murphai/query/dist/index.js.map +1 -1
- package/node_modules/@murphai/query/dist/knowledge-format.js +1 -1
- package/node_modules/@murphai/query/dist/knowledge-graph.js +4 -4
- package/node_modules/@murphai/query/dist/knowledge-model.d.ts +1 -1
- package/node_modules/@murphai/query/dist/knowledge-search.js +2 -2
- package/node_modules/@murphai/query/dist/knowledge-search.js.map +1 -1
- package/node_modules/@murphai/query/dist/meal-nutrition.js.map +1 -1
- package/node_modules/@murphai/query/dist/memory.d.ts +3 -2
- package/node_modules/@murphai/query/dist/memory.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/memory.js +4 -1
- package/node_modules/@murphai/query/dist/memory.js.map +1 -1
- package/node_modules/@murphai/query/dist/metrics/index.js +23 -1
- package/node_modules/@murphai/query/dist/metrics/index.js.map +1 -1
- package/node_modules/@murphai/query/dist/metrics/projection.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/metrics/projection.js +101 -7
- package/node_modules/@murphai/query/dist/metrics/projection.js.map +1 -1
- package/node_modules/@murphai/query/dist/murph-age.d.ts +1 -1
- package/node_modules/@murphai/query/dist/murph-age.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/murph-age.js +2 -1
- package/node_modules/@murphai/query/dist/murph-age.js.map +1 -1
- package/node_modules/@murphai/query/dist/overview-weekly-stats.js.map +1 -1
- package/node_modules/@murphai/query/dist/overview.js.map +1 -1
- package/node_modules/@murphai/query/dist/projection/entity-store.d.ts +2 -0
- package/node_modules/@murphai/query/dist/projection/entity-store.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/projection/entity-store.js +56 -0
- package/node_modules/@murphai/query/dist/projection/entity-store.js.map +1 -1
- package/node_modules/@murphai/query/dist/projection/rebuild.js.map +1 -1
- package/node_modules/@murphai/query/dist/projection/schema.d.ts +1 -1
- package/node_modules/@murphai/query/dist/projection/schema.js +2 -2
- package/node_modules/@murphai/query/dist/projection/schema.js.map +1 -1
- package/node_modules/@murphai/query/dist/projection/wearable-summary-compose.js +25 -2
- package/node_modules/@murphai/query/dist/projection/wearable-summary-compose.js.map +1 -1
- package/node_modules/@murphai/query/dist/projection/wearable-summary-projector.js +1 -0
- package/node_modules/@murphai/query/dist/projection/wearable-summary-projector.js.map +1 -1
- package/node_modules/@murphai/query/dist/projection/wearable-summary-store.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/protocols.js.map +1 -1
- package/node_modules/@murphai/query/dist/query-projection-types.d.ts +7 -0
- package/node_modules/@murphai/query/dist/query-projection-types.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/query-projection.d.ts +3 -2
- package/node_modules/@murphai/query/dist/query-projection.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/query-projection.js +5 -1
- package/node_modules/@murphai/query/dist/query-projection.js.map +1 -1
- package/node_modules/@murphai/query/dist/read-model.d.ts +4 -0
- package/node_modules/@murphai/query/dist/read-model.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/read-model.js +1 -0
- package/node_modules/@murphai/query/dist/read-model.js.map +1 -1
- package/node_modules/@murphai/query/dist/scheduled-logs.js.map +1 -1
- package/node_modules/@murphai/query/dist/search-shared.js.map +1 -1
- package/node_modules/@murphai/query/dist/search.js.map +1 -1
- package/node_modules/@murphai/query/dist/summaries.js.map +1 -1
- package/node_modules/@murphai/query/dist/timeline.js.map +1 -1
- package/node_modules/@murphai/query/dist/vault-source.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/vault-source.js +39 -3
- package/node_modules/@murphai/query/dist/vault-source.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/candidates.d.ts +5 -2
- package/node_modules/@murphai/query/dist/wearables/candidates.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/candidates.js +305 -7
- package/node_modules/@murphai/query/dist/wearables/candidates.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/dedupe.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/dedupe.js +3 -1
- package/node_modules/@murphai/query/dist/wearables/dedupe.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/observation.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/origin.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/provider-policy.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/public-output.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/public-output.js +6 -79
- package/node_modules/@murphai/query/dist/wearables/public-output.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/selection.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/selection.js +5 -1
- package/node_modules/@murphai/query/dist/wearables/selection.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/sleep-association.d.ts +9 -0
- package/node_modules/@murphai/query/dist/wearables/sleep-association.d.ts.map +1 -0
- package/node_modules/@murphai/query/dist/wearables/sleep-association.js +81 -0
- package/node_modules/@murphai/query/dist/wearables/sleep-association.js.map +1 -0
- package/node_modules/@murphai/query/dist/wearables/types.d.ts +29 -4
- package/node_modules/@murphai/query/dist/wearables/types.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/wearables/types.js.map +1 -1
- package/node_modules/@murphai/query/dist/wearables.d.ts.map +1 -1
- package/node_modules/@murphai/query/dist/wearables.js +50 -50
- package/node_modules/@murphai/query/dist/wearables.js.map +1 -1
- package/node_modules/@murphai/query/package.json +5 -0
- package/node_modules/@murphai/runtime-state/README.md +1 -1
- package/node_modules/@murphai/runtime-state/dist/assistant-state-fs.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/assistant-state-security.js +1 -1
- package/node_modules/@murphai/runtime-state/dist/assistant-state-security.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/atomic-write.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/clinical-records-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/clinical-records-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/clinical-records-local-state-descriptors.js +12 -0
- package/node_modules/@murphai/runtime-state/dist/clinical-records-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js +65 -31
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.d.ts +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.d.ts.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.js +10 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts +11 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-email.js +56 -3
- package/node_modules/@murphai/runtime-state/dist/hosted-email.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-storage.d.ts +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-storage.d.ts.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/hosted-storage.js +12 -2
- package/node_modules/@murphai/runtime-state/dist/hosted-storage.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.d.ts.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.js +2 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/locks.d.ts.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/process-env.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/process-identity.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.d.ts +2 -0
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.d.ts.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.js +2 -0
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/shared.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/sqlite-warning-filter.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/sqlite.js.map +1 -1
- package/node_modules/@murphai/runtime-state/dist/ulid.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-agentmail.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-assistant-account.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-assistant-defaults.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-assistant-wizard.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-assistant.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-cli.d.ts.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-cli.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-services/toolchain.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-services.js.map +1 -1
- package/node_modules/@murphai/setup-cli/dist/setup-wizard-options.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/README.md +11 -0
- package/node_modules/@murphai/vault-usecases/dist/assistant-vault-paths.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/clinical-records.d.ts +102 -0
- package/node_modules/@murphai/vault-usecases/dist/clinical-records.d.ts.map +1 -0
- package/node_modules/@murphai/vault-usecases/dist/clinical-records.js +374 -0
- package/node_modules/@murphai/vault-usecases/dist/clinical-records.js.map +1 -0
- package/node_modules/@murphai/vault-usecases/dist/commands/query-record-command-helpers.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/commands/query-record-command-helpers.js +13 -4
- package/node_modules/@murphai/vault-usecases/dist/commands/query-record-command-helpers.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/experiment-onboarding-options.d.ts +2 -2
- package/node_modules/@murphai/vault-usecases/dist/health-cli-descriptors.d.ts +3 -3
- package/node_modules/@murphai/vault-usecases/dist/health-cli-descriptors.js +1 -1
- package/node_modules/@murphai/vault-usecases/dist/preferences.d.ts +34 -3
- package/node_modules/@murphai/vault-usecases/dist/preferences.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/preferences.js +84 -1
- package/node_modules/@murphai/vault-usecases/dist/preferences.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/testing/junction-wearable-fixture.d.ts +16 -2
- package/node_modules/@murphai/vault-usecases/dist/testing/junction-wearable-fixture.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/testing/junction-wearable-fixture.js +20 -1
- package/node_modules/@murphai/vault-usecases/dist/testing/junction-wearable-fixture.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/testing.d.ts +2 -2
- package/node_modules/@murphai/vault-usecases/dist/testing.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/testing.js +1 -1
- package/node_modules/@murphai/vault-usecases/dist/testing.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/capture.d.ts +18 -18
- package/node_modules/@murphai/vault-usecases/dist/usecases/capture.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.d.ts +154 -154
- package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.js +3 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.d.ts +10 -9
- package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.js +2 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/encounter.d.ts +35 -35
- package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.d.ts +38 -37
- package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.js +37 -5
- package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/explicit-health-family-services.js +7 -7
- package/node_modules/@murphai/vault-usecases/dist/usecases/food.d.ts +2 -2
- package/node_modules/@murphai/vault-usecases/dist/usecases/food.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/integrated-services.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/integrated-services.js +57 -20
- package/node_modules/@murphai/vault-usecases/dist/usecases/integrated-services.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/intervention-experiment-link.d.ts +20 -10
- package/node_modules/@murphai/vault-usecases/dist/usecases/intervention-experiment-link.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/intervention-experiment-link.js +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/intervention-experiment-link.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/intervention.d.ts +6 -6
- package/node_modules/@murphai/vault-usecases/dist/usecases/intervention.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/measurement-read.d.ts +9 -9
- package/node_modules/@murphai/vault-usecases/dist/usecases/measurement-read.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/measurement.d.ts +4 -4
- package/node_modules/@murphai/vault-usecases/dist/usecases/measurement.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/provider-event.d.ts +13 -13
- package/node_modules/@murphai/vault-usecases/dist/usecases/provider-event.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/recipe.d.ts +3 -3
- package/node_modules/@murphai/vault-usecases/dist/usecases/runtime.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/runtime.js +1 -0
- package/node_modules/@murphai/vault-usecases/dist/usecases/runtime.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/shared.d.ts +1 -0
- package/node_modules/@murphai/vault-usecases/dist/usecases/shared.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/shared.js +101 -8
- package/node_modules/@murphai/vault-usecases/dist/usecases/shared.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/types.d.ts +34 -0
- package/node_modules/@murphai/vault-usecases/dist/usecases/types.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/vault-usecase-helpers.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-format.d.ts +33 -33
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-format.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-measurement.d.ts +4 -4
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-model.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.d.ts +8 -8
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.js +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout.d.ts +48 -48
- package/node_modules/@murphai/vault-usecases/dist/usecases/workout.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/vault-services.d.ts.map +1 -1
- package/node_modules/@murphai/vault-usecases/dist/vault-services.js +1 -0
- package/node_modules/@murphai/vault-usecases/dist/vault-services.js.map +1 -1
- package/node_modules/@murphai/vault-usecases/package.json +8 -0
- package/node_modules/incur/dist/Cli.d.ts +4 -0
- package/node_modules/incur/dist/Cli.js +10 -3
- package/node_modules/incur/dist/SyncSkills.d.ts +2 -0
- package/node_modules/incur/dist/SyncSkills.js +5 -2
- package/node_modules/incur/src/Cli.ts +14 -3
- package/node_modules/incur/src/SyncSkills.ts +9 -2
- package/package.json +6 -4
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/turn-attachment-image-refs.d.ts +0 -15
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/turn-attachment-image-refs.d.ts.map +0 -1
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/turn-attachment-image-refs.js +0 -79
- package/node_modules/@murphai/assistant-engine/dist/assistant-codex/turn-attachment-image-refs.js.map +0 -1
- package/node_modules/@murphai/device-syncd/dist/providers/junction-connect-sources.d.ts.map +0 -1
- package/node_modules/@murphai/device-syncd/dist/providers/junction-connect-sources.js.map +0 -1
- package/node_modules/@murphai/messaging-ingress/dist/whatsapp-webhook.d.ts +0 -73
- package/node_modules/@murphai/messaging-ingress/dist/whatsapp-webhook.d.ts.map +0 -1
- package/node_modules/@murphai/messaging-ingress/dist/whatsapp-webhook.js +0 -212
- package/node_modules/@murphai/messaging-ingress/dist/whatsapp-webhook.js.map +0 -1
- package/node_modules/@murphai/operator-config/dist/runtime-errors.d.ts +0 -4
- package/node_modules/@murphai/operator-config/dist/runtime-errors.d.ts.map +0 -1
- package/node_modules/@murphai/operator-config/dist/runtime-errors.js +0 -19
- package/node_modules/@murphai/operator-config/dist/runtime-errors.js.map +0 -1
- package/node_modules/@murphai/operator-config/dist/whatsapp-runtime.d.ts +0 -34
- package/node_modules/@murphai/operator-config/dist/whatsapp-runtime.d.ts.map +0 -1
- package/node_modules/@murphai/operator-config/dist/whatsapp-runtime.js +0 -208
- package/node_modules/@murphai/operator-config/dist/whatsapp-runtime.js.map +0 -1
- package/node_modules/@murphai/vault-usecases/dist/query-id-families.d.ts +0 -4
- package/node_modules/@murphai/vault-usecases/dist/query-id-families.d.ts.map +0 -1
- package/node_modules/@murphai/vault-usecases/dist/query-id-families.js +0 -104
- package/node_modules/@murphai/vault-usecases/dist/query-id-families.js.map +0 -1
- /package/node_modules/@murphai/device-syncd/dist/{providers → config}/junction-connect-sources.d.ts +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { assertContractId, deviceDataOriginSchema, experimentFrontmatterSchema, externalRefSchema, journalDayFrontmatterSchema, eventRecordSchema, safeParseContract, sampleRecordSchema, } from "@murphai/contracts";
|
|
2
|
+
import { assertContractId, compareIsoTimestampsAscending, COMPANION_HRV_RMSSD_METHOD_VERSION, deviceDataOriginSchema, experimentFrontmatterSchema, externalRefSchema, journalDayFrontmatterSchema, eventRecordSchema, eventImportDecisionSchema, isWritableIsoDateTime, safeParseContract, sampleRecordSchema, } from "@murphai/contracts";
|
|
3
3
|
import { BASELINE_EVENT_KINDS, BASELINE_SAMPLE_STREAMS, EVENT_SCHEMA_VERSION, EVENT_SOURCES, FRONTMATTER_SCHEMA_VERSIONS, ID_PREFIXES, SAMPLE_QUALITIES, SAMPLE_SCHEMA_VERSION, SAMPLE_SOURCES, VAULT_LAYOUT, } from "./constants.js";
|
|
4
4
|
import { emitAuditRecord } from "./audit.js";
|
|
5
5
|
import { prepareEventAttachments, stagePreparedEventAttachmentsInBatch, } from "./event-attachments.js";
|
|
6
6
|
import { assertNoLegacyRelatedIds, normalizeCanonicalEventLinks, } from "./event-links.js";
|
|
7
7
|
import { VaultError } from "./errors.js";
|
|
8
|
-
import { pathExists, readUtf8File, walkVaultFiles, writeVaultTextFile } from "./fs.js";
|
|
8
|
+
import { pathExists, readUtf8File, walkVaultFiles, walkVaultFilesInterruptible, writeVaultTextFile, } from "./fs.js";
|
|
9
9
|
import { parseFrontmatterDocument, stringifyFrontmatterDocument } from "./frontmatter.js";
|
|
10
10
|
import { deterministicContractId, generateRecordId } from "./ids.js";
|
|
11
|
-
import { readJsonlRecords, toMonthlyShardRelativePath } from "./jsonl.js";
|
|
11
|
+
import { readJsonlRecords, toMonthlyShardRelativePath, visitJsonlRecordsInterruptible, } from "./jsonl.js";
|
|
12
12
|
import { buildEventSpineLifecycle, collapseEventSpineEntries, compareEventSpineEntries, eventSpineRevision, isDeletedEventSpineRecord, selectLatestEventSpineEntry, } from "./history/event-spine.js";
|
|
13
13
|
import { buildPublicEventImportRecord, loadEventLedgerShardsById, selectLatestMatchedEvent, toEventLedgerFile, } from "./domains/events/ledger.js";
|
|
14
14
|
import { normalizeMealNutrition, } from "./nutrition.js";
|
|
@@ -18,7 +18,7 @@ import { assertCanonicalWriteLockScope } from "./operations/canonical-write-lock
|
|
|
18
18
|
import { resolveVaultPath } from "./path-safety.js";
|
|
19
19
|
import { sanitizePathSegment } from "./path-safety.js";
|
|
20
20
|
import { prepareInlineRawArtifact, prepareRawArtifact, resolveRawAssetDirectory } from "./raw.js";
|
|
21
|
-
import { buildIntegrationEvidencePart, buildIntegrationIngestAppendPlan, buildIntegrationIngestRecord, stageIntegrationIngestAppendPlan, compactIntegrationIngestReceipt, } from "./integration-ingests.js";
|
|
21
|
+
import { buildIntegrationEvidencePart, buildIntegrationIngestAppendPlan, buildIntegrationIngestAppendPlanFromInspection, buildIntegrationIngestRecord, stageIntegrationIngestAppendPlan, compactIntegrationIngestReceipt, inspectIntegrationIngestIdsForImportedAt, selectNovelIntegrationIngestEvidence, } from "./integration-ingests.js";
|
|
22
22
|
import { normalizeUniqueTextList } from "./bank/shared.js";
|
|
23
23
|
import { defaultTimeZone, normalizeTimeZone, toIsoTimestamp, toLocalDayKey, } from "./time.js";
|
|
24
24
|
import { loadVault } from "./vault.js";
|
|
@@ -450,18 +450,24 @@ function buildSampleRecord({ recordId, ...input }) {
|
|
|
450
450
|
recordId: recordId ?? generateRecordId(ID_PREFIXES.sample),
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
|
-
async function readExistingRecordIds(vaultRoot, relativePath) {
|
|
453
|
+
async function readExistingRecordIds(vaultRoot, relativePath, signal) {
|
|
454
|
+
signal?.throwIfAborted();
|
|
454
455
|
const resolved = resolveVaultPath(vaultRoot, relativePath);
|
|
455
456
|
if (!(await pathExists(resolved.absolutePath))) {
|
|
456
457
|
return new Set();
|
|
457
458
|
}
|
|
458
|
-
const
|
|
459
|
+
const ids = new Set();
|
|
460
|
+
await visitJsonlRecordsInterruptible({
|
|
459
461
|
vaultRoot,
|
|
460
462
|
relativePath,
|
|
463
|
+
signal,
|
|
464
|
+
visit(record) {
|
|
465
|
+
if (typeof record.id === "string") {
|
|
466
|
+
ids.add(record.id);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
461
469
|
});
|
|
462
|
-
return
|
|
463
|
-
.map((record) => (typeof record.id === "string" ? record.id : null))
|
|
464
|
-
.filter((id) => id !== null));
|
|
470
|
+
return ids;
|
|
465
471
|
}
|
|
466
472
|
async function buildJsonlAppendPlan(vaultRoot, entries, options = {}) {
|
|
467
473
|
assertCanonicalWriteLockScope(vaultRoot);
|
|
@@ -470,8 +476,9 @@ async function buildJsonlAppendPlan(vaultRoot, entries, options = {}) {
|
|
|
470
476
|
const targetShardPaths = [...new Set(entries.map((entry) => entry.relativePath))].sort();
|
|
471
477
|
const appendedRecordIds = [];
|
|
472
478
|
for (const entry of entries) {
|
|
479
|
+
options.signal?.throwIfAborted();
|
|
473
480
|
const existingIds = existingIdsByShard.get(entry.relativePath) ??
|
|
474
|
-
(await readExistingRecordIds(vaultRoot, entry.relativePath));
|
|
481
|
+
(await readExistingRecordIds(vaultRoot, entry.relativePath, options.signal));
|
|
475
482
|
existingIdsByShard.set(entry.relativePath, existingIds);
|
|
476
483
|
if (existingIds.has(entry.record.id) && !options.forceAppendIds?.has(entry.record.id)) {
|
|
477
484
|
continue;
|
|
@@ -514,13 +521,22 @@ function normalizeDeviceEventInputs(eventInputs, context) {
|
|
|
514
521
|
errorMessage: `Device event ${index + 1} relatedIds is no longer supported; use links.`,
|
|
515
522
|
});
|
|
516
523
|
const normalizedLegacyExternalRefs = normalizeLegacyExternalRefs(eventInput.legacyExternalRefs, index);
|
|
524
|
+
const externalRefUpdatePolicy = eventInput.externalRefUpdatePolicy;
|
|
525
|
+
if (externalRefUpdatePolicy !== undefined && externalRefUpdatePolicy !== "immutable") {
|
|
526
|
+
throw new VaultError("VAULT_INVALID_EXTERNAL_REF", `Device event ${index + 1} externalRefUpdatePolicy must be "immutable" when provided.`);
|
|
527
|
+
}
|
|
528
|
+
const inputDayKey = typeof eventInput.dayKey === "string" ? eventInput.dayKey : undefined;
|
|
529
|
+
const inputTimeZone = typeof eventInput.timeZone === "string" ? eventInput.timeZone : undefined;
|
|
530
|
+
const preservesProviderDayWithoutTimeZone = Boolean(inputDayKey &&
|
|
531
|
+
!inputTimeZone &&
|
|
532
|
+
isJunctionSleepStageExternalRefInput(eventInput.externalRef));
|
|
517
533
|
const seed = buildNormalizedEventSeed({
|
|
518
534
|
kind,
|
|
519
535
|
occurredAt: eventInput.occurredAt ?? eventInput.recordedAt ?? context.importedAt,
|
|
520
536
|
recordedAt: eventInput.recordedAt ?? eventInput.occurredAt,
|
|
521
|
-
dayKey:
|
|
522
|
-
timeZone:
|
|
523
|
-
defaultTimeZone: context.defaultTimeZone,
|
|
537
|
+
dayKey: inputDayKey,
|
|
538
|
+
timeZone: inputTimeZone,
|
|
539
|
+
defaultTimeZone: preservesProviderDayWithoutTimeZone ? undefined : context.defaultTimeZone,
|
|
524
540
|
source: eventInput.source ?? context.source,
|
|
525
541
|
title: typeof eventInput.title === "string" ? eventInput.title : undefined,
|
|
526
542
|
note: eventInput.note,
|
|
@@ -536,9 +552,13 @@ function normalizeDeviceEventInputs(eventInputs, context) {
|
|
|
536
552
|
if (legacyExternalRefs.length > 0 && !seed.externalRef) {
|
|
537
553
|
throw new VaultError("VAULT_INVALID_EXTERNAL_REF", `Device event ${index + 1} legacyExternalRefs require externalRef.`);
|
|
538
554
|
}
|
|
555
|
+
if (externalRefUpdatePolicy === "immutable" && !seed.externalRef) {
|
|
556
|
+
throw new VaultError("VAULT_INVALID_EXTERNAL_REF", `Device event ${index + 1} immutable externalRefUpdatePolicy requires externalRef.`);
|
|
557
|
+
}
|
|
539
558
|
return {
|
|
540
559
|
seed,
|
|
541
560
|
evidenceRoles,
|
|
561
|
+
...(externalRefUpdatePolicy === "immutable" ? { externalRefUpdatePolicy } : {}),
|
|
542
562
|
legacyExternalRefs,
|
|
543
563
|
recordId: deterministicContractId(ID_PREFIXES.event, stableStringify({
|
|
544
564
|
provider: context.provider,
|
|
@@ -630,7 +650,8 @@ function normalizeDeviceBatchInputs({ provider, accountId, importedAt = new Date
|
|
|
630
650
|
const normalizedSource = normalizeSource(source, EVENT_SOURCE_SET, "device");
|
|
631
651
|
const defaultTimeZone = normalizeTimeZone(fallbackTimeZone);
|
|
632
652
|
const normalizedProvenance = normalizeLooseRecord(provenance, "VAULT_INVALID_DEVICE_PROVENANCE", "Device import provenance must be a plain object.") ?? {};
|
|
633
|
-
const
|
|
653
|
+
const legacyIngestReceipt = normalizeLooseRecord(ingestReceipt, "INTEGRATION_INGEST_RECEIPT_INVALID", "Device ingest receipt must be a plain object.");
|
|
654
|
+
const normalizedIngestReceipt = compactIntegrationIngestReceipt(legacyIngestReceipt);
|
|
634
655
|
const eventInputs = normalizeDeviceBatchObjectArray({
|
|
635
656
|
value: events,
|
|
636
657
|
code: "VAULT_INVALID_DEVICE_EVENTS",
|
|
@@ -666,6 +687,7 @@ function normalizeDeviceBatchInputs({ provider, accountId, importedAt = new Date
|
|
|
666
687
|
defaultTimeZone,
|
|
667
688
|
provenance: normalizedProvenance,
|
|
668
689
|
ingestReceipt: normalizedIngestReceipt,
|
|
690
|
+
legacyIngestReceipt,
|
|
669
691
|
events: normalizeDeviceEventInputs(eventInputs, {
|
|
670
692
|
provider: normalizedProvider,
|
|
671
693
|
accountId: normalizedAccountId,
|
|
@@ -713,6 +735,9 @@ function prepareDeviceEventEntries(events, evidenceParts) {
|
|
|
713
735
|
evidenceRolesByPreparedRecordId.set(event.recordId, uniqueRoles);
|
|
714
736
|
return {
|
|
715
737
|
...prepareStoredEventLedgerEntry(event.seed, event.recordId),
|
|
738
|
+
...(event.externalRefUpdatePolicy
|
|
739
|
+
? { externalRefUpdatePolicy: event.externalRefUpdatePolicy }
|
|
740
|
+
: {}),
|
|
716
741
|
legacyExternalRefs: event.legacyExternalRefs,
|
|
717
742
|
};
|
|
718
743
|
});
|
|
@@ -736,6 +761,17 @@ function eventExternalRefKey(externalRef) {
|
|
|
736
761
|
facet: externalRef.facet ?? null,
|
|
737
762
|
});
|
|
738
763
|
}
|
|
764
|
+
function compareIncomingExternalRefVersion(existing, incoming) {
|
|
765
|
+
const existingVersion = existing.version;
|
|
766
|
+
const incomingVersion = incoming.version;
|
|
767
|
+
if (!existingVersion
|
|
768
|
+
|| !incomingVersion
|
|
769
|
+
|| !isWritableIsoDateTime(existingVersion)
|
|
770
|
+
|| !isWritableIsoDateTime(incomingVersion)) {
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
return compareIsoTimestampsAscending(incomingVersion, existingVersion);
|
|
774
|
+
}
|
|
739
775
|
// Device-sync content equality ignores per-import identity (id, lifecycle,
|
|
740
776
|
// recordedAt) AND rawRefs, because device imports mint fresh raw-artifact
|
|
741
777
|
// paths on every sync run.
|
|
@@ -743,59 +779,178 @@ function deviceEventContentKey(record) {
|
|
|
743
779
|
const { id: _id, rawRefs: _rawRefs, lifecycle: _lifecycle, recordedAt: _recordedAt, ...content } = record;
|
|
744
780
|
return stableStringify(content);
|
|
745
781
|
}
|
|
782
|
+
function isWhoopCompanionHrvRmssdAdmissionEvent(record) {
|
|
783
|
+
const externalRef = record.externalRef;
|
|
784
|
+
const admissionId = externalRef?.resourceId;
|
|
785
|
+
return record.kind === "observation"
|
|
786
|
+
&& externalRef?.system === "whoop"
|
|
787
|
+
&& externalRef.resourceType === "ble-hrv-rmssd"
|
|
788
|
+
&& externalRef.facet === "hrv-rmssd"
|
|
789
|
+
&& typeof admissionId === "string"
|
|
790
|
+
&& /^[a-f0-9]{64}$/u.test(admissionId)
|
|
791
|
+
&& externalRef.version === `${COMPANION_HRV_RMSSD_METHOD_VERSION}:${admissionId}`
|
|
792
|
+
&& record.dataOrigin?.aggregatorProvider === "murph-companion"
|
|
793
|
+
&& record.dataOrigin.sourceProviderSlug === "whoop"
|
|
794
|
+
&& record.dataOrigin.sourceType === "ble-pulse-interval"
|
|
795
|
+
&& record.dataOrigin.normalizerVersion === "companion-hrv-rmssd-normalizer.v1";
|
|
796
|
+
}
|
|
797
|
+
function isWhoopCompanionHrvRmssdTemporalReplay(existing, incoming) {
|
|
798
|
+
if (!isWhoopCompanionHrvRmssdAdmissionEvent(existing)
|
|
799
|
+
|| !isWhoopCompanionHrvRmssdAdmissionEvent(incoming)) {
|
|
800
|
+
return false;
|
|
801
|
+
}
|
|
802
|
+
const { id: _existingId, rawRefs: _existingRawRefs, lifecycle: _existingLifecycle, recordedAt: _existingRecordedAt, dayKey: _existingDayKey, timeZone: _existingTimeZone, ...existingContent } = existing;
|
|
803
|
+
const { id: _incomingId, rawRefs: _incomingRawRefs, lifecycle: _incomingLifecycle, recordedAt: _incomingRecordedAt, dayKey: _incomingDayKey, timeZone: _incomingTimeZone, ...incomingContent } = incoming;
|
|
804
|
+
return stableStringify(existingContent) === stableStringify(incomingContent);
|
|
805
|
+
}
|
|
806
|
+
function deviceEventContentFingerprint(record) {
|
|
807
|
+
return createHash("sha256").update(deviceEventContentKey(record)).digest("hex");
|
|
808
|
+
}
|
|
746
809
|
// Public bulk-import content equality also ignores per-import identity (id,
|
|
747
810
|
// lifecycle, and recordedAt, which defaults to the import wall clock), but it
|
|
748
|
-
// keeps rawRefs
|
|
749
|
-
//
|
|
750
|
-
// skipped
|
|
811
|
+
// keeps rawRefs. For unversioned rows, a rawRefs-only correction supersedes the
|
|
812
|
+
// stored event. Comparable versioned rows are ordered by source revision:
|
|
813
|
+
// older revisions are skipped, equal revisions must replay-match or the batch
|
|
814
|
+
// is rejected as a conflict, and newer revisions supersede.
|
|
751
815
|
function eventImportContentKey(record) {
|
|
752
816
|
const { id: _id, lifecycle: _lifecycle, recordedAt: _recordedAt, ...content } = record;
|
|
753
817
|
return stableStringify(content);
|
|
754
818
|
}
|
|
755
|
-
|
|
819
|
+
// Equal source revisions must compare caller-supplied provenance while
|
|
820
|
+
// ignoring vault-local day placement and equivalent version lexemes.
|
|
821
|
+
function eventImportVersionedReplayContentKey(record) {
|
|
822
|
+
const { id: _id, dayKey: _dayKey, lifecycle: _lifecycle, recordedAt: _recordedAt, externalRef, ...content } = record;
|
|
823
|
+
const semanticExternalRef = externalRef
|
|
824
|
+
? {
|
|
825
|
+
system: externalRef.system,
|
|
826
|
+
resourceType: externalRef.resourceType,
|
|
827
|
+
resourceId: externalRef.resourceId,
|
|
828
|
+
facet: externalRef.facet,
|
|
829
|
+
}
|
|
830
|
+
: undefined;
|
|
831
|
+
return stableStringify({ ...content, externalRef: semanticExternalRef });
|
|
832
|
+
}
|
|
833
|
+
// Comparable source revisions describe the provider resource, not the local
|
|
834
|
+
// retrieval that happened to carry it. Ignore capture-local provenance, the
|
|
835
|
+
// vault-timezone-derived day key, and the version lexeme while deciding
|
|
836
|
+
// whether an equal revision is a replay.
|
|
837
|
+
function eventImportSourceSemanticContentKey(record) {
|
|
838
|
+
const { id: _id, dayKey: _dayKey, lifecycle: _lifecycle, recordedAt: _recordedAt, rawRefs: _rawRefs, evidence: _evidence, externalRef, ...content } = record;
|
|
839
|
+
const semanticExternalRef = externalRef
|
|
840
|
+
? {
|
|
841
|
+
system: externalRef.system,
|
|
842
|
+
resourceType: externalRef.resourceType,
|
|
843
|
+
resourceId: externalRef.resourceId,
|
|
844
|
+
facet: externalRef.facet,
|
|
845
|
+
}
|
|
846
|
+
: undefined;
|
|
847
|
+
return stableStringify({ ...content, externalRef: semanticExternalRef });
|
|
848
|
+
}
|
|
849
|
+
const EVENT_IMPORT_RETRACTION_MARKER_NOTE_TYPE = "event_import_retraction_marker";
|
|
850
|
+
function preparedEventImportDecisionExternalRef(decision) {
|
|
851
|
+
return decision.action === "retract"
|
|
852
|
+
? decision.externalRef
|
|
853
|
+
: decision.entry.record.externalRef;
|
|
854
|
+
}
|
|
855
|
+
function orderEventImportDecisionsBySourceVersion(decisions) {
|
|
856
|
+
const ordered = [...decisions];
|
|
857
|
+
const groups = new Map();
|
|
858
|
+
decisions.forEach((decision, index) => {
|
|
859
|
+
const externalRef = preparedEventImportDecisionExternalRef(decision);
|
|
860
|
+
const isExplicitDecision = decision.action === "retract" || decision.allowsKindReplacement;
|
|
861
|
+
if (!isExplicitDecision
|
|
862
|
+
|| !externalRef?.version
|
|
863
|
+
|| !isWritableIsoDateTime(externalRef.version)) {
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
const refKey = eventExternalRefKey(externalRef);
|
|
867
|
+
const group = groups.get(refKey) ?? [];
|
|
868
|
+
group.push({ decision, index });
|
|
869
|
+
groups.set(refKey, group);
|
|
870
|
+
});
|
|
871
|
+
for (const group of groups.values()) {
|
|
872
|
+
const sortedDecisions = group
|
|
873
|
+
.map(({ decision }) => decision)
|
|
874
|
+
.sort((left, right) => {
|
|
875
|
+
const leftRef = preparedEventImportDecisionExternalRef(left);
|
|
876
|
+
const rightRef = preparedEventImportDecisionExternalRef(right);
|
|
877
|
+
return compareIsoTimestampsAscending(leftRef?.version ?? "", rightRef?.version ?? "");
|
|
878
|
+
});
|
|
879
|
+
group.forEach(({ index }, groupIndex) => {
|
|
880
|
+
ordered[index] = sortedDecisions[groupIndex];
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
return ordered;
|
|
884
|
+
}
|
|
885
|
+
async function indexLatestEventsByExternalRef(vaultRoot, relativePaths, signal) {
|
|
886
|
+
const deviceOwnerRevisionsByRefKeyAndFingerprint = new Map();
|
|
756
887
|
const latestByRefKey = new Map();
|
|
888
|
+
const latestById = new Map();
|
|
757
889
|
const maxRevisionById = new Map();
|
|
890
|
+
const revisionsById = new Map();
|
|
758
891
|
const entriesById = new Map();
|
|
759
892
|
for (const relativePath of relativePaths) {
|
|
893
|
+
signal?.throwIfAborted();
|
|
760
894
|
const resolved = resolveVaultPath(vaultRoot, relativePath);
|
|
761
895
|
if (!(await pathExists(resolved.absolutePath))) {
|
|
762
896
|
continue;
|
|
763
897
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
if (entry.record.source === "device" && entry.record.externalRef) {
|
|
774
|
-
const refKey = eventExternalRefKey(entry.record.externalRef);
|
|
775
|
-
const latestDeviceExternalRefEntry = latestDeviceExternalRefEntryByRefKey.get(refKey);
|
|
776
|
-
if (!latestDeviceExternalRefEntry || compareEventSpineEntries(latestDeviceExternalRefEntry, entry) < 0) {
|
|
777
|
-
latestDeviceExternalRefEntryByRefKey.set(refKey, entry);
|
|
898
|
+
await visitJsonlRecordsInterruptible({
|
|
899
|
+
vaultRoot,
|
|
900
|
+
relativePath,
|
|
901
|
+
signal,
|
|
902
|
+
visit(raw) {
|
|
903
|
+
signal?.throwIfAborted();
|
|
904
|
+
const parsed = safeParseContract(eventRecordSchema, raw);
|
|
905
|
+
if (!parsed.success) {
|
|
906
|
+
return;
|
|
778
907
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
latestDeviceExternalRefEntryByRefKey
|
|
786
|
-
|
|
908
|
+
const entry = { relativePath, record: parsed.data };
|
|
909
|
+
maxRevisionById.set(entry.record.id, Math.max(maxRevisionById.get(entry.record.id) ?? 0, eventSpineRevision(entry.record)));
|
|
910
|
+
const revisions = revisionsById.get(entry.record.id) ?? new Set();
|
|
911
|
+
revisions.add(eventSpineRevision(entry.record));
|
|
912
|
+
revisionsById.set(entry.record.id, revisions);
|
|
913
|
+
const state = entriesById.get(entry.record.id);
|
|
914
|
+
const latestDeviceExternalRefEntryByRefKey = state?.latestDeviceExternalRefEntryByRefKey ?? new Map();
|
|
915
|
+
if (entry.record.source === "device" && entry.record.externalRef) {
|
|
916
|
+
const refKey = eventExternalRefKey(entry.record.externalRef);
|
|
917
|
+
const ownersByFingerprint = deviceOwnerRevisionsByRefKeyAndFingerprint.get(refKey)
|
|
918
|
+
?? new Map();
|
|
919
|
+
const fingerprint = deviceEventContentFingerprint(entry.record);
|
|
920
|
+
const revisionsByOwnerId = ownersByFingerprint.get(fingerprint)
|
|
921
|
+
?? new Map();
|
|
922
|
+
const ownerRevisions = revisionsByOwnerId.get(entry.record.id) ?? new Set();
|
|
923
|
+
ownerRevisions.add(eventSpineRevision(entry.record));
|
|
924
|
+
revisionsByOwnerId.set(entry.record.id, ownerRevisions);
|
|
925
|
+
ownersByFingerprint.set(fingerprint, revisionsByOwnerId);
|
|
926
|
+
deviceOwnerRevisionsByRefKeyAndFingerprint.set(refKey, ownersByFingerprint);
|
|
927
|
+
const latestDeviceExternalRefEntry = latestDeviceExternalRefEntryByRefKey.get(refKey);
|
|
928
|
+
if (!latestDeviceExternalRefEntry || compareEventSpineEntries(latestDeviceExternalRefEntry, entry) < 0) {
|
|
929
|
+
latestDeviceExternalRefEntryByRefKey.set(refKey, entry);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
const latestExternalRefEntry = entry.record.externalRef &&
|
|
933
|
+
(!state?.latestExternalRefEntry || compareEventSpineEntries(state.latestExternalRefEntry, entry) < 0)
|
|
787
934
|
? entry
|
|
788
|
-
: state
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
935
|
+
: state?.latestExternalRefEntry ?? null;
|
|
936
|
+
entriesById.set(entry.record.id, {
|
|
937
|
+
latestDeviceExternalRefEntryByRefKey,
|
|
938
|
+
latestEntry: !state || compareEventSpineEntries(state.latestEntry, entry) < 0
|
|
939
|
+
? entry
|
|
940
|
+
: state.latestEntry,
|
|
941
|
+
latestExternalRefEntry,
|
|
942
|
+
});
|
|
943
|
+
},
|
|
944
|
+
});
|
|
792
945
|
}
|
|
793
946
|
const groupedByRefKey = new Map();
|
|
794
947
|
for (const state of entriesById.values()) {
|
|
948
|
+
signal?.throwIfAborted();
|
|
795
949
|
// Collapse each event id globally before indexing external refs. An event
|
|
796
950
|
// whose latest revision moved to a corrected ref must not remain
|
|
797
951
|
// discoverable through an older historical ref.
|
|
798
952
|
const latestForId = state.latestEntry;
|
|
953
|
+
latestById.set(latestForId.record.id, latestForId.record);
|
|
799
954
|
const externalRefEntry = latestForId.record.externalRef
|
|
800
955
|
? latestForId
|
|
801
956
|
: state.latestExternalRefEntry;
|
|
@@ -814,6 +969,7 @@ async function indexLatestEventsByExternalRef(vaultRoot, relativePaths) {
|
|
|
814
969
|
groupedByRefKey.set(refKey, refGroup);
|
|
815
970
|
}
|
|
816
971
|
for (const [refKey, group] of groupedByRefKey) {
|
|
972
|
+
signal?.throwIfAborted();
|
|
817
973
|
// Preserve the prior duplicate-ref behavior: if multiple live ids still
|
|
818
974
|
// claim one external ref, reconcile against the latest comparable spine.
|
|
819
975
|
const latest = selectLatestIndexedEventExternalRefMatch(group);
|
|
@@ -821,7 +977,13 @@ async function indexLatestEventsByExternalRef(vaultRoot, relativePaths) {
|
|
|
821
977
|
latestByRefKey.set(refKey, latest);
|
|
822
978
|
}
|
|
823
979
|
}
|
|
824
|
-
return {
|
|
980
|
+
return {
|
|
981
|
+
deviceOwnerRevisionsByRefKeyAndFingerprint,
|
|
982
|
+
latestByRefKey,
|
|
983
|
+
latestById,
|
|
984
|
+
maxRevisionById,
|
|
985
|
+
revisionsById,
|
|
986
|
+
};
|
|
825
987
|
}
|
|
826
988
|
function isSameObservationFacet(existing, incoming) {
|
|
827
989
|
return existing.kind === "observation" &&
|
|
@@ -836,6 +998,14 @@ function isSameObservationValue(existing, incoming) {
|
|
|
836
998
|
incoming.kind === "observation" &&
|
|
837
999
|
existing.value === incoming.value;
|
|
838
1000
|
}
|
|
1001
|
+
const JUNCTION_SLEEP_STAGE_METRIC_FACETS = new Set([
|
|
1002
|
+
"sleep-awake-minutes",
|
|
1003
|
+
"sleep-light-minutes",
|
|
1004
|
+
"sleep-deep-minutes",
|
|
1005
|
+
"sleep-rem-minutes",
|
|
1006
|
+
]);
|
|
1007
|
+
const JUNCTION_SLEEP_STAGE_SUMMARY_NORMALIZER_VERSION = "junction-sleep-stage-summary.v1";
|
|
1008
|
+
const JUNCTION_SLEEP_STAGE_CYCLE_FALLBACK_NORMALIZER_VERSION = "junction-sleep-stage-cycle-fallback.v1";
|
|
839
1009
|
function deviceDataOriginSourceMatches(existing, incoming) {
|
|
840
1010
|
if (!existing || !incoming) {
|
|
841
1011
|
return false;
|
|
@@ -869,6 +1039,78 @@ function isWhoopBodyMeasurementDateOnlyLegacyRef(legacyExternalRef, incoming) {
|
|
|
869
1039
|
incoming.externalRef.resourceType === "body-measurement" &&
|
|
870
1040
|
isScopedDateLikeWhoopBodyMeasurementResourceId(incoming.externalRef.resourceId);
|
|
871
1041
|
}
|
|
1042
|
+
function isJunctionSleepStageExternalRefInput(value) {
|
|
1043
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1044
|
+
return false;
|
|
1045
|
+
}
|
|
1046
|
+
const externalRef = value;
|
|
1047
|
+
return externalRef.system === "junction" &&
|
|
1048
|
+
typeof externalRef.resourceType === "string" &&
|
|
1049
|
+
/^junction-[a-z0-9-]+-sleep$/u.test(externalRef.resourceType) &&
|
|
1050
|
+
typeof externalRef.facet === "string" &&
|
|
1051
|
+
JUNCTION_SLEEP_STAGE_METRIC_FACETS.has(externalRef.facet);
|
|
1052
|
+
}
|
|
1053
|
+
function isJunctionSleepStageObservation(record) {
|
|
1054
|
+
return record.kind === "observation" &&
|
|
1055
|
+
isJunctionSleepStageExternalRefInput(record.externalRef);
|
|
1056
|
+
}
|
|
1057
|
+
function isJunctionSleepStageSummaryObservation(record) {
|
|
1058
|
+
return isJunctionSleepStageObservation(record) &&
|
|
1059
|
+
record.dataOrigin?.normalizerVersion === JUNCTION_SLEEP_STAGE_SUMMARY_NORMALIZER_VERSION;
|
|
1060
|
+
}
|
|
1061
|
+
function isJunctionSleepStageCycleFallbackObservation(record) {
|
|
1062
|
+
return isJunctionSleepStageObservation(record) &&
|
|
1063
|
+
record.dataOrigin?.normalizerVersion === JUNCTION_SLEEP_STAGE_CYCLE_FALLBACK_NORMALIZER_VERSION;
|
|
1064
|
+
}
|
|
1065
|
+
function isJunctionSleepStageSummaryLegacyRef(legacyExternalRef, incoming) {
|
|
1066
|
+
return isJunctionSleepStageSummaryObservation(incoming) &&
|
|
1067
|
+
legacyExternalRef.system === "junction" &&
|
|
1068
|
+
incoming.externalRef?.system === "junction" &&
|
|
1069
|
+
legacyExternalRef.resourceType === incoming.externalRef.resourceType &&
|
|
1070
|
+
/^junction-[a-z0-9-]+-sleep$/u.test(legacyExternalRef.resourceType) &&
|
|
1071
|
+
legacyExternalRef.facet !== undefined &&
|
|
1072
|
+
legacyExternalRef.facet === incoming.externalRef.facet &&
|
|
1073
|
+
JUNCTION_SLEEP_STAGE_METRIC_FACETS.has(legacyExternalRef.facet);
|
|
1074
|
+
}
|
|
1075
|
+
function hasStableJunctionSleepStageSummaryLegacyProof(existing, incoming) {
|
|
1076
|
+
if (!isSameObservationFacet(existing.record, incoming)) {
|
|
1077
|
+
return false;
|
|
1078
|
+
}
|
|
1079
|
+
const existingDataOrigin = existing.indexedRecord.dataOrigin ?? existing.record.dataOrigin;
|
|
1080
|
+
return existing.record.occurredAt === incoming.occurredAt &&
|
|
1081
|
+
deviceDataOriginSourceMatches(existingDataOrigin, incoming.dataOrigin);
|
|
1082
|
+
}
|
|
1083
|
+
function shouldKeepExistingJunctionSleepStageSummaryObservation(existing, incoming) {
|
|
1084
|
+
if (!isSameObservationFacet(existing, incoming)) {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
return isJunctionSleepStageSummaryObservation(existing) &&
|
|
1088
|
+
isJunctionSleepStageCycleFallbackObservation(incoming);
|
|
1089
|
+
}
|
|
1090
|
+
const JUNCTION_COMPANION_HEALTH_METADATA_SOURCE_TYPE = "companion-whoop-metadata-unverified";
|
|
1091
|
+
function parseJunctionCompanionSyncVersion(version) {
|
|
1092
|
+
if (!version || !/^(?:0|[1-9]\d*)$/u.test(version)) {
|
|
1093
|
+
return undefined;
|
|
1094
|
+
}
|
|
1095
|
+
const parsed = Number(version);
|
|
1096
|
+
return Number.isSafeInteger(parsed) ? parsed : undefined;
|
|
1097
|
+
}
|
|
1098
|
+
function shouldKeepExistingJunctionCompanionHealthMetadata(existing, incoming) {
|
|
1099
|
+
if (existing.kind !== "observation"
|
|
1100
|
+
|| incoming.kind !== "observation"
|
|
1101
|
+
|| existing.externalRef?.system !== "junction"
|
|
1102
|
+
|| incoming.externalRef?.system !== "junction"
|
|
1103
|
+
|| existing.dataOrigin?.sourceType !== JUNCTION_COMPANION_HEALTH_METADATA_SOURCE_TYPE
|
|
1104
|
+
|| incoming.dataOrigin?.sourceType !== JUNCTION_COMPANION_HEALTH_METADATA_SOURCE_TYPE) {
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1107
|
+
const existingVersion = parseJunctionCompanionSyncVersion(existing.externalRef.version);
|
|
1108
|
+
if (existingVersion === undefined) {
|
|
1109
|
+
return false;
|
|
1110
|
+
}
|
|
1111
|
+
const incomingVersion = parseJunctionCompanionSyncVersion(incoming.externalRef.version);
|
|
1112
|
+
return incomingVersion === undefined || incomingVersion <= existingVersion;
|
|
1113
|
+
}
|
|
872
1114
|
function hasStableLegacyOccurrenceProof(existing, incoming, legacyExternalRef) {
|
|
873
1115
|
if (isWhoopBodyMeasurementDateOnlyLegacyRef(legacyExternalRef, incoming)) {
|
|
874
1116
|
return existing.record.recordedAt === incoming.recordedAt &&
|
|
@@ -900,6 +1142,9 @@ function isCompatibleLegacyExternalRefMatch(existing, incoming, legacyExternalRe
|
|
|
900
1142
|
return isSameObservationFacet(existing.record, incoming) &&
|
|
901
1143
|
hasStableLegacyOccurrenceProof(existing, incoming, legacyExternalRef);
|
|
902
1144
|
}
|
|
1145
|
+
if (isJunctionSleepStageSummaryLegacyRef(legacyExternalRef, incoming)) {
|
|
1146
|
+
return hasStableJunctionSleepStageSummaryLegacyProof(existing, incoming);
|
|
1147
|
+
}
|
|
903
1148
|
return existing.record.dayKey === incoming.dayKey ||
|
|
904
1149
|
(isSameObservationFacet(existing.record, incoming) &&
|
|
905
1150
|
hasStableLegacyOccurrenceProof(existing, incoming, legacyExternalRef));
|
|
@@ -908,6 +1153,30 @@ function selectLatestIndexedEventExternalRefMatch(entries) {
|
|
|
908
1153
|
if (entries.length === 0) {
|
|
909
1154
|
return null;
|
|
910
1155
|
}
|
|
1156
|
+
const hasOrderedImportSourceVersions = entries.every((entry) => entry.record.source === "import"
|
|
1157
|
+
&& entry.indexedExternalRef.version !== undefined
|
|
1158
|
+
&& isWritableIsoDateTime(entry.indexedExternalRef.version));
|
|
1159
|
+
if (hasOrderedImportSourceVersions) {
|
|
1160
|
+
return entries.reduce((latest, candidate) => {
|
|
1161
|
+
const sourceVersionComparison = compareIncomingExternalRefVersion(latest.indexedExternalRef, candidate.indexedExternalRef);
|
|
1162
|
+
if (sourceVersionComparison !== null && sourceVersionComparison !== 0) {
|
|
1163
|
+
return sourceVersionComparison > 0 ? candidate : latest;
|
|
1164
|
+
}
|
|
1165
|
+
const latestDeleted = isDeletedEventSpineRecord(latest.record);
|
|
1166
|
+
const candidateDeleted = isDeletedEventSpineRecord(candidate.record);
|
|
1167
|
+
if (latestDeleted !== candidateDeleted) {
|
|
1168
|
+
return candidateDeleted ? latest : candidate;
|
|
1169
|
+
}
|
|
1170
|
+
const recordedAtComparison = compareIsoTimestampsAscending(candidate.record.recordedAt, latest.record.recordedAt);
|
|
1171
|
+
if (recordedAtComparison !== 0) {
|
|
1172
|
+
return recordedAtComparison > 0 ? candidate : latest;
|
|
1173
|
+
}
|
|
1174
|
+
if (candidate.relativePath !== latest.relativePath) {
|
|
1175
|
+
return candidate.relativePath > latest.relativePath ? candidate : latest;
|
|
1176
|
+
}
|
|
1177
|
+
return candidate.record.id > latest.record.id ? candidate : latest;
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
911
1180
|
const liveEntries = entries.filter((entry) => !isDeletedEventSpineRecord(entry.record));
|
|
912
1181
|
const candidates = liveEntries.length > 0 ? liveEntries : entries;
|
|
913
1182
|
return candidates.reduce((latest, candidate) => compareEventSpineEntries(latest, candidate) >= 0 ? latest : candidate);
|
|
@@ -959,87 +1228,282 @@ function buildLegacyExternalRefReservations(entries, index) {
|
|
|
959
1228
|
}
|
|
960
1229
|
return reservations;
|
|
961
1230
|
}
|
|
1231
|
+
async function buildDeviceEventIdentityContext(vaultRoot, entries) {
|
|
1232
|
+
if (entries.length === 0) {
|
|
1233
|
+
return {
|
|
1234
|
+
index: {
|
|
1235
|
+
deviceOwnerRevisionsByRefKeyAndFingerprint: new Map(),
|
|
1236
|
+
latestByRefKey: new Map(),
|
|
1237
|
+
latestById: new Map(),
|
|
1238
|
+
maxRevisionById: new Map(),
|
|
1239
|
+
revisionsById: new Map(),
|
|
1240
|
+
},
|
|
1241
|
+
legacyReservations: new Map(),
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
const shardPaths = await walkVaultFiles(vaultRoot, VAULT_LAYOUT.eventLedgerDirectory, {
|
|
1245
|
+
extension: ".jsonl",
|
|
1246
|
+
});
|
|
1247
|
+
const index = await indexLatestEventsByExternalRef(vaultRoot, shardPaths);
|
|
1248
|
+
return {
|
|
1249
|
+
index,
|
|
1250
|
+
legacyReservations: buildLegacyExternalRefReservations(entries, index),
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
function cloneDeviceEventIdentityContext(context) {
|
|
1254
|
+
return {
|
|
1255
|
+
index: {
|
|
1256
|
+
deviceOwnerRevisionsByRefKeyAndFingerprint: context.index.deviceOwnerRevisionsByRefKeyAndFingerprint,
|
|
1257
|
+
latestByRefKey: new Map(context.index.latestByRefKey),
|
|
1258
|
+
latestById: new Map(context.index.latestById),
|
|
1259
|
+
maxRevisionById: new Map(context.index.maxRevisionById),
|
|
1260
|
+
revisionsById: new Map(context.index.revisionsById),
|
|
1261
|
+
},
|
|
1262
|
+
legacyReservations: new Map(context.legacyReservations),
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
function buildEmptyDeviceEventIdentityContext(entries) {
|
|
1266
|
+
const index = {
|
|
1267
|
+
deviceOwnerRevisionsByRefKeyAndFingerprint: new Map(),
|
|
1268
|
+
latestByRefKey: new Map(),
|
|
1269
|
+
latestById: new Map(),
|
|
1270
|
+
maxRevisionById: new Map(),
|
|
1271
|
+
revisionsById: new Map(),
|
|
1272
|
+
};
|
|
1273
|
+
return {
|
|
1274
|
+
index,
|
|
1275
|
+
legacyReservations: buildLegacyExternalRefReservations(entries, index),
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
function eventSpineRevisionsAreComplete(index, eventId) {
|
|
1279
|
+
const maxRevision = index.maxRevisionById.get(eventId) ?? 0;
|
|
1280
|
+
const revisions = index.revisionsById.get(eventId);
|
|
1281
|
+
return Number.isSafeInteger(maxRevision)
|
|
1282
|
+
&& maxRevision > 0
|
|
1283
|
+
&& revisions !== undefined
|
|
1284
|
+
&& revisions.size === maxRevision;
|
|
1285
|
+
}
|
|
1286
|
+
function resolveDeviceEventIdentity(entry, context, options = {}) {
|
|
1287
|
+
const externalRef = entry.record.externalRef;
|
|
1288
|
+
if (!externalRef) {
|
|
1289
|
+
return null;
|
|
1290
|
+
}
|
|
1291
|
+
const { index, legacyReservations } = context;
|
|
1292
|
+
const refKey = eventExternalRefKey(externalRef);
|
|
1293
|
+
const reservedForLegacyClaim = legacyReservations.get(refKey);
|
|
1294
|
+
const primaryMatch = reservedForLegacyClaim && reservedForLegacyClaim.entry !== entry
|
|
1295
|
+
? undefined
|
|
1296
|
+
: index.latestByRefKey.get(refKey);
|
|
1297
|
+
const legacyMatchedEntries = entry.legacyExternalRefs
|
|
1298
|
+
.map((legacyExternalRef) => ({
|
|
1299
|
+
legacyExternalRef,
|
|
1300
|
+
refKey: eventExternalRefKey(legacyExternalRef),
|
|
1301
|
+
}))
|
|
1302
|
+
.filter((match) => match.refKey !== refKey)
|
|
1303
|
+
.map(({ legacyExternalRef, refKey: legacyRefKey }) => {
|
|
1304
|
+
const reservation = legacyReservations.get(legacyRefKey);
|
|
1305
|
+
return {
|
|
1306
|
+
legacyExternalRef,
|
|
1307
|
+
refKey: legacyRefKey,
|
|
1308
|
+
indexedMatch: reservation?.entry === entry
|
|
1309
|
+
? reservation.indexedMatch
|
|
1310
|
+
: index.latestByRefKey.get(legacyRefKey),
|
|
1311
|
+
};
|
|
1312
|
+
})
|
|
1313
|
+
.filter((match) => {
|
|
1314
|
+
if (!match.indexedMatch) {
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1317
|
+
const reservation = legacyReservations.get(match.refKey);
|
|
1318
|
+
return (!reservation || reservation.entry === entry)
|
|
1319
|
+
&& isCompatibleLegacyExternalRefMatch(match.indexedMatch, entry.record, match.legacyExternalRef);
|
|
1320
|
+
});
|
|
1321
|
+
const matchedEntries = [
|
|
1322
|
+
...(primaryMatch ? [{ refKey, indexedMatch: primaryMatch }] : []),
|
|
1323
|
+
...legacyMatchedEntries,
|
|
1324
|
+
];
|
|
1325
|
+
const selectedPrimaryMatch = matchedEntries.find((match) => match.refKey === refKey);
|
|
1326
|
+
const latest = selectedPrimaryMatch?.indexedMatch.record ?? matchedEntries[0]?.indexedMatch.record;
|
|
1327
|
+
let associationSafe = true;
|
|
1328
|
+
for (const match of matchedEntries) {
|
|
1329
|
+
if (match.indexedMatch.record.kind !== entry.record.kind) {
|
|
1330
|
+
associationSafe = false;
|
|
1331
|
+
if (options.strict) {
|
|
1332
|
+
throw new VaultError("EVENT_KIND_MISMATCH", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
1333
|
+
`${externalRef.facet ? `#${externalRef.facet}` : ""}" already belongs to kind ` +
|
|
1334
|
+
`"${match.indexedMatch.record.kind}" and cannot be rewritten as "${entry.record.kind}"; nothing was imported.`);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
const matchedIds = new Set(matchedEntries.map((match) => match.indexedMatch.record.id));
|
|
1339
|
+
if (matchedIds.size > 1) {
|
|
1340
|
+
associationSafe = false;
|
|
1341
|
+
if (options.strict) {
|
|
1342
|
+
throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
1343
|
+
`${externalRef.facet ? `#${externalRef.facet}` : ""}" matched multiple live event IDs; ` +
|
|
1344
|
+
"ambiguous legacy cleanup must be repaired explicitly.");
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
return { associationSafe, latest, matchedEntries, refKey };
|
|
1348
|
+
}
|
|
1349
|
+
function mapCurrentDeviceEventOwners(entries, context) {
|
|
1350
|
+
const associationSafePreparedIds = new Set();
|
|
1351
|
+
const canonicalIdByPreparedId = new Map();
|
|
1352
|
+
const currentRecordByPreparedId = new Map();
|
|
1353
|
+
const historicalContentOwnerRevisionsByPreparedId = new Map();
|
|
1354
|
+
const historicallyDeliveredPreparedIds = new Set();
|
|
1355
|
+
const incomingNewerPreparedIds = new Set();
|
|
1356
|
+
const physicallyExistingPreparedIds = new Set();
|
|
1357
|
+
let allExist = true;
|
|
1358
|
+
for (const entry of entries) {
|
|
1359
|
+
if (context.index.latestById.has(entry.record.id)) {
|
|
1360
|
+
physicallyExistingPreparedIds.add(entry.record.id);
|
|
1361
|
+
}
|
|
1362
|
+
const incomingContentFingerprint = deviceEventContentFingerprint(entry.record);
|
|
1363
|
+
const historicalContentOwnerRevisions = new Map();
|
|
1364
|
+
for (const externalRef of [entry.record.externalRef, ...entry.legacyExternalRefs]) {
|
|
1365
|
+
if (!externalRef) {
|
|
1366
|
+
continue;
|
|
1367
|
+
}
|
|
1368
|
+
const refKey = eventExternalRefKey(externalRef);
|
|
1369
|
+
const ownersByFingerprint = context.index.deviceOwnerRevisionsByRefKeyAndFingerprint.get(refKey);
|
|
1370
|
+
for (const [ownerId, revisions] of ownersByFingerprint?.get(incomingContentFingerprint) ?? []) {
|
|
1371
|
+
const ownerRevisions = historicalContentOwnerRevisions.get(ownerId) ?? new Set();
|
|
1372
|
+
for (const revision of revisions) {
|
|
1373
|
+
ownerRevisions.add(revision);
|
|
1374
|
+
}
|
|
1375
|
+
historicalContentOwnerRevisions.set(ownerId, ownerRevisions);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
if (historicalContentOwnerRevisions.size > 0) {
|
|
1379
|
+
historicalContentOwnerRevisionsByPreparedId.set(entry.record.id, new Map(historicalContentOwnerRevisions));
|
|
1380
|
+
}
|
|
1381
|
+
const resolved = resolveDeviceEventIdentity(entry, context);
|
|
1382
|
+
if (!resolved) {
|
|
1383
|
+
const current = context.index.latestById.get(entry.record.id);
|
|
1384
|
+
canonicalIdByPreparedId.set(entry.record.id, entry.record.id);
|
|
1385
|
+
allExist = current !== undefined && allExist;
|
|
1386
|
+
if (!current) {
|
|
1387
|
+
associationSafePreparedIds.add(entry.record.id);
|
|
1388
|
+
}
|
|
1389
|
+
else {
|
|
1390
|
+
currentRecordByPreparedId.set(entry.record.id, current);
|
|
1391
|
+
if (!isDeletedEventSpineRecord(current)
|
|
1392
|
+
&& deviceEventContentKey(current) === deviceEventContentKey(entry.record)) {
|
|
1393
|
+
associationSafePreparedIds.add(entry.record.id);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
let current = resolved.latest;
|
|
1399
|
+
if (!current) {
|
|
1400
|
+
const historicalOwners = [...historicalContentOwnerRevisions.keys()]
|
|
1401
|
+
.map((ownerId) => context.index.latestById.get(ownerId))
|
|
1402
|
+
.filter((record) => record !== undefined);
|
|
1403
|
+
if (historicalOwners.length === 1) {
|
|
1404
|
+
[current] = historicalOwners;
|
|
1405
|
+
historicallyDeliveredPreparedIds.add(entry.record.id);
|
|
1406
|
+
}
|
|
1407
|
+
else if (historicalOwners.length > 1) {
|
|
1408
|
+
canonicalIdByPreparedId.set(entry.record.id, entry.record.id);
|
|
1409
|
+
historicallyDeliveredPreparedIds.add(entry.record.id);
|
|
1410
|
+
allExist = false;
|
|
1411
|
+
continue;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
canonicalIdByPreparedId.set(entry.record.id, current?.id ?? entry.record.id);
|
|
1415
|
+
allExist = current !== undefined && allExist;
|
|
1416
|
+
if (!current) {
|
|
1417
|
+
if (resolved.associationSafe) {
|
|
1418
|
+
associationSafePreparedIds.add(entry.record.id);
|
|
1419
|
+
}
|
|
1420
|
+
continue;
|
|
1421
|
+
}
|
|
1422
|
+
currentRecordByPreparedId.set(entry.record.id, current);
|
|
1423
|
+
const incomingContentKey = deviceEventContentKey(entry.record);
|
|
1424
|
+
const wasPreviouslyDelivered = historicalContentOwnerRevisions.size > 0;
|
|
1425
|
+
const incomingExternalRef = entry.record.externalRef;
|
|
1426
|
+
const sourceVersionComparisons = incomingExternalRef === undefined
|
|
1427
|
+
? []
|
|
1428
|
+
: resolved.matchedEntries.map(({ indexedMatch }) => compareIncomingExternalRefVersion(indexedMatch.indexedExternalRef, incomingExternalRef)).filter((comparison) => comparison !== null);
|
|
1429
|
+
const incomingHasEqualOrNewerComparableVersion = sourceVersionComparisons.some((comparison) => comparison >= 0);
|
|
1430
|
+
if (sourceVersionComparisons.some((comparison) => comparison > 0)) {
|
|
1431
|
+
incomingNewerPreparedIds.add(entry.record.id);
|
|
1432
|
+
}
|
|
1433
|
+
if (wasPreviouslyDelivered
|
|
1434
|
+
&& !incomingHasEqualOrNewerComparableVersion
|
|
1435
|
+
&& deviceEventContentKey(current) !== incomingContentKey) {
|
|
1436
|
+
historicallyDeliveredPreparedIds.add(entry.record.id);
|
|
1437
|
+
}
|
|
1438
|
+
if (resolved.associationSafe
|
|
1439
|
+
&& !isDeletedEventSpineRecord(current)
|
|
1440
|
+
&& deviceEventContentKey(current) === deviceEventContentKey(entry.record)) {
|
|
1441
|
+
associationSafePreparedIds.add(entry.record.id);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
return {
|
|
1445
|
+
allExist,
|
|
1446
|
+
associationSafePreparedIds,
|
|
1447
|
+
canonicalIdByPreparedId,
|
|
1448
|
+
currentRecordByPreparedId,
|
|
1449
|
+
historicalContentOwnerRevisionsByPreparedId,
|
|
1450
|
+
historicallyDeliveredPreparedIds,
|
|
1451
|
+
incomingNewerPreparedIds,
|
|
1452
|
+
physicallyExistingPreparedIds,
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
962
1455
|
// Device-sync ingestion invariant 4: merge is idempotent on the record's own
|
|
963
1456
|
// externalRef, so overlapping push/pull re-imports of the same provider record
|
|
964
1457
|
// must not mint new events. Re-imports with identical content (ignoring
|
|
965
1458
|
// per-import identity such as id, rawRefs, lifecycle, and recordedAt) are
|
|
966
|
-
// skipped; changed content appends an event-spine revision onto the
|
|
967
|
-
// event id instead of a new event.
|
|
968
|
-
|
|
1459
|
+
// skipped; changed content normally appends an event-spine revision onto the
|
|
1460
|
+
// existing event id instead of a new event. Callers may mark a capture's
|
|
1461
|
+
// externalRef immutable when changed content must be rejected instead.
|
|
1462
|
+
async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, existingContext, preferredCanonicalIdByPreparedId = new Map()) {
|
|
969
1463
|
assertCanonicalWriteLockScope(vaultRoot);
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
});
|
|
973
|
-
const index = await indexLatestEventsByExternalRef(vaultRoot, shardPaths);
|
|
1464
|
+
const context = existingContext ?? await buildDeviceEventIdentityContext(vaultRoot, entries);
|
|
1465
|
+
const { index } = context;
|
|
974
1466
|
const appendEntries = [];
|
|
1467
|
+
const appendRecordIdByPreparedRecordId = new Map();
|
|
975
1468
|
const records = [];
|
|
976
1469
|
const forceAppendIds = new Set();
|
|
977
|
-
const
|
|
1470
|
+
const retainedPreparedIds = new Set();
|
|
978
1471
|
let skippedDuplicateCount = 0;
|
|
979
1472
|
let supersededCount = 0;
|
|
980
1473
|
for (const entry of entries) {
|
|
981
1474
|
const externalRef = entry.record.externalRef;
|
|
982
1475
|
if (!externalRef) {
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
: index.latestByRefKey.get(refKey);
|
|
992
|
-
const legacyMatchedEntries = entry.legacyExternalRefs
|
|
993
|
-
.map((legacyExternalRef) => ({
|
|
994
|
-
legacyExternalRef,
|
|
995
|
-
refKey: eventExternalRefKey(legacyExternalRef),
|
|
996
|
-
}))
|
|
997
|
-
.filter((match) => match.refKey !== refKey)
|
|
998
|
-
.map(({ legacyExternalRef, refKey }) => {
|
|
999
|
-
const reservation = legacyReservations.get(refKey);
|
|
1000
|
-
return {
|
|
1001
|
-
legacyExternalRef,
|
|
1002
|
-
refKey,
|
|
1003
|
-
indexedMatch: reservation?.entry === entry
|
|
1004
|
-
? reservation.indexedMatch
|
|
1005
|
-
: index.latestByRefKey.get(refKey),
|
|
1006
|
-
};
|
|
1007
|
-
})
|
|
1008
|
-
.filter((match) => {
|
|
1009
|
-
if (!match.indexedMatch) {
|
|
1010
|
-
return false;
|
|
1476
|
+
const current = index.latestById.get(entry.record.id);
|
|
1477
|
+
if (current
|
|
1478
|
+
&& !isDeletedEventSpineRecord(current)
|
|
1479
|
+
&& deviceEventContentKey(current) === deviceEventContentKey(entry.record)) {
|
|
1480
|
+
skippedDuplicateCount += 1;
|
|
1481
|
+
retainedPreparedIds.add(entry.record.id);
|
|
1482
|
+
records.push(current);
|
|
1483
|
+
continue;
|
|
1011
1484
|
}
|
|
1012
|
-
const reservation = legacyReservations.get(match.refKey);
|
|
1013
|
-
return (!reservation || reservation.entry === entry) &&
|
|
1014
|
-
isCompatibleLegacyExternalRefMatch(match.indexedMatch, entry.record, match.legacyExternalRef);
|
|
1015
|
-
});
|
|
1016
|
-
const matchedEntries = [
|
|
1017
|
-
...(primaryMatch ? [{ refKey, indexedMatch: primaryMatch }] : []),
|
|
1018
|
-
...legacyMatchedEntries,
|
|
1019
|
-
];
|
|
1020
|
-
const selectedPrimaryMatch = matchedEntries.find((match) => match.refKey === refKey);
|
|
1021
|
-
const latest = selectedPrimaryMatch?.indexedMatch.record ?? matchedEntries[0]?.indexedMatch.record;
|
|
1022
|
-
if (!latest) {
|
|
1023
|
-
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef));
|
|
1024
1485
|
appendEntries.push(entry);
|
|
1486
|
+
appendRecordIdByPreparedRecordId.set(entry.record.id, entry.record.id);
|
|
1025
1487
|
records.push(entry.record);
|
|
1026
1488
|
continue;
|
|
1027
1489
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
// of rewriting an existing event id as a different event kind.
|
|
1032
|
-
if (match.indexedMatch.record.kind !== entry.record.kind) {
|
|
1033
|
-
throw new VaultError("EVENT_KIND_MISMATCH", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
1034
|
-
`${externalRef.facet ? `#${externalRef.facet}` : ""}" already belongs to kind ` +
|
|
1035
|
-
`"${match.indexedMatch.record.kind}" and cannot be rewritten as "${entry.record.kind}"; nothing was imported.`);
|
|
1036
|
-
}
|
|
1490
|
+
const resolved = resolveDeviceEventIdentity(entry, context, { strict: true });
|
|
1491
|
+
if (!resolved) {
|
|
1492
|
+
throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", "Device event identity unexpectedly lost its externalRef during reconciliation.");
|
|
1037
1493
|
}
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1494
|
+
const { matchedEntries, refKey } = resolved;
|
|
1495
|
+
let latest = resolved.latest;
|
|
1496
|
+
if (!latest) {
|
|
1497
|
+
const canonicalRecordId = preferredCanonicalIdByPreparedId.get(entry.record.id)
|
|
1498
|
+
?? entry.record.id;
|
|
1499
|
+
const canonicalRecord = canonicalRecordId === entry.record.id
|
|
1500
|
+
? entry.record
|
|
1501
|
+
: { ...entry.record, id: canonicalRecordId };
|
|
1502
|
+
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(canonicalRecord, externalRef));
|
|
1503
|
+
appendEntries.push({ relativePath: entry.relativePath, record: canonicalRecord });
|
|
1504
|
+
appendRecordIdByPreparedRecordId.set(entry.record.id, canonicalRecord.id);
|
|
1505
|
+
records.push(canonicalRecord);
|
|
1506
|
+
continue;
|
|
1043
1507
|
}
|
|
1044
1508
|
// externalRef identity does not include kind. Event spines are kind-stable,
|
|
1045
1509
|
// so device reconciliation must reject under-faceted provider refs instead
|
|
@@ -1051,15 +1515,75 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries) {
|
|
|
1051
1515
|
}
|
|
1052
1516
|
if (deviceEventContentKey(latest) === deviceEventContentKey(entry.record)) {
|
|
1053
1517
|
skippedDuplicateCount += 1;
|
|
1518
|
+
retainedPreparedIds.add(entry.record.id);
|
|
1519
|
+
records.push(latest);
|
|
1520
|
+
continue;
|
|
1521
|
+
}
|
|
1522
|
+
const indexedProviderMatch = matchedEntries.find((match) => match.indexedMatch.record.id === latest.id)?.indexedMatch ?? matchedEntries[0]?.indexedMatch;
|
|
1523
|
+
if (indexedProviderMatch
|
|
1524
|
+
&& deviceEventContentKey(indexedProviderMatch.indexedRecord)
|
|
1525
|
+
=== deviceEventContentKey(entry.record)) {
|
|
1526
|
+
skippedDuplicateCount += 1;
|
|
1527
|
+
retainedPreparedIds.add(entry.record.id);
|
|
1528
|
+
records.push(latest);
|
|
1529
|
+
continue;
|
|
1530
|
+
}
|
|
1531
|
+
if (entry.externalRefUpdatePolicy === "immutable") {
|
|
1532
|
+
// The admission digest owns this observation's immutable identity. Vault
|
|
1533
|
+
// timezone metadata is mutable, so an at-least-once replay must preserve
|
|
1534
|
+
// the first canonical placement rather than turning the retained payload
|
|
1535
|
+
// into a permanent immutable-reference conflict. Compare with the stored
|
|
1536
|
+
// provider delivery when available so later user-authored revisions stay
|
|
1537
|
+
// intact while an exact provider replay remains a no-op.
|
|
1538
|
+
if (isWhoopCompanionHrvRmssdTemporalReplay(indexedProviderMatch?.indexedRecord ?? latest, entry.record)) {
|
|
1539
|
+
skippedDuplicateCount += 1;
|
|
1540
|
+
records.push(latest);
|
|
1541
|
+
continue;
|
|
1542
|
+
}
|
|
1543
|
+
throw new VaultError("EVENT_IMMUTABLE_EXTERNAL_REF_CONFLICT", "Immutable device event externalRef already exists with different content; nothing was imported.");
|
|
1544
|
+
}
|
|
1545
|
+
if (indexedProviderMatch
|
|
1546
|
+
&& indexedProviderMatch.indexedExternalRef.system === "whoop"
|
|
1547
|
+
&& externalRef.system === "whoop") {
|
|
1548
|
+
const sourceVersionComparison = compareIncomingExternalRefVersion(indexedProviderMatch.indexedExternalRef, externalRef);
|
|
1549
|
+
if (sourceVersionComparison !== null && sourceVersionComparison < 0) {
|
|
1550
|
+
skippedDuplicateCount += 1;
|
|
1551
|
+
if (eventSpineRevisionsAreComplete(index, latest.id)) {
|
|
1552
|
+
retainedPreparedIds.add(entry.record.id);
|
|
1553
|
+
}
|
|
1554
|
+
records.push(latest);
|
|
1555
|
+
continue;
|
|
1556
|
+
}
|
|
1557
|
+
if (sourceVersionComparison === 0) {
|
|
1558
|
+
throw new VaultError("EVENT_SOURCE_REVISION_CONFLICT", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
1559
|
+
`${externalRef.facet ? `#${externalRef.facet}` : ""}" has conflicting content for source revision ` +
|
|
1560
|
+
`"${externalRef.version}"; nothing was imported.`);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
// Companion HealthKit sync versions are nonnegative monotonic integers.
|
|
1564
|
+
// Keep this comparison scoped to that closed source type: other providers
|
|
1565
|
+
// use timestamp-shaped versions whose ordering semantics are not universal.
|
|
1566
|
+
if (shouldKeepExistingJunctionCompanionHealthMetadata(latest, entry.record)) {
|
|
1567
|
+
if (eventSpineRevisionsAreComplete(index, latest.id)) {
|
|
1568
|
+
retainedPreparedIds.add(entry.record.id);
|
|
1569
|
+
}
|
|
1054
1570
|
records.push(latest);
|
|
1055
1571
|
continue;
|
|
1056
1572
|
}
|
|
1057
1573
|
if (isDeletedEventSpineRecord(latest)) {
|
|
1058
1574
|
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef));
|
|
1059
1575
|
appendEntries.push(entry);
|
|
1576
|
+
appendRecordIdByPreparedRecordId.set(entry.record.id, entry.record.id);
|
|
1060
1577
|
records.push(entry.record);
|
|
1061
1578
|
continue;
|
|
1062
1579
|
}
|
|
1580
|
+
if (shouldKeepExistingJunctionSleepStageSummaryObservation(latest, entry.record)) {
|
|
1581
|
+
if (eventSpineRevisionsAreComplete(index, latest.id)) {
|
|
1582
|
+
retainedPreparedIds.add(entry.record.id);
|
|
1583
|
+
}
|
|
1584
|
+
records.push(latest);
|
|
1585
|
+
continue;
|
|
1586
|
+
}
|
|
1063
1587
|
const historicalUserEditMatch = matchedEntries.find((match) => hasHistoricalExternalRefUserAuthoredChanges(match.indexedMatch));
|
|
1064
1588
|
if (historicalUserEditMatch) {
|
|
1065
1589
|
throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
@@ -1084,13 +1608,16 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries) {
|
|
|
1084
1608
|
}
|
|
1085
1609
|
index.maxRevisionById.set(latest.id, revision);
|
|
1086
1610
|
appendEntries.push({ relativePath: entry.relativePath, record: superseding });
|
|
1611
|
+
appendRecordIdByPreparedRecordId.set(entry.record.id, superseding.id);
|
|
1087
1612
|
records.push(superseding);
|
|
1088
1613
|
supersededCount += 1;
|
|
1089
1614
|
}
|
|
1090
1615
|
return {
|
|
1091
1616
|
appendEntries,
|
|
1617
|
+
appendRecordIdByPreparedRecordId,
|
|
1092
1618
|
records,
|
|
1093
1619
|
forceAppendIds,
|
|
1620
|
+
retainedPreparedIds,
|
|
1094
1621
|
skippedDuplicateCount,
|
|
1095
1622
|
supersededCount,
|
|
1096
1623
|
};
|
|
@@ -1101,51 +1628,163 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries) {
|
|
|
1101
1628
|
// minting a duplicate. This mirrors upsertEvent, which resolves an event id
|
|
1102
1629
|
// across every shard and writes the new revision into the shard for the new
|
|
1103
1630
|
// occurredAt, so an event spine may span shards and readers collapse it by id.
|
|
1104
|
-
async function
|
|
1631
|
+
async function reconcileEventImportDecisionsByExternalRef(vaultRoot, decisions, signal) {
|
|
1105
1632
|
assertCanonicalWriteLockScope(vaultRoot);
|
|
1106
|
-
const shardPaths = await
|
|
1633
|
+
const { relativePaths: shardPaths } = await walkVaultFilesInterruptible(vaultRoot, VAULT_LAYOUT.eventLedgerDirectory, {
|
|
1107
1634
|
extension: ".jsonl",
|
|
1635
|
+
signal,
|
|
1108
1636
|
});
|
|
1109
|
-
const index = await indexLatestEventsByExternalRef(vaultRoot, shardPaths);
|
|
1637
|
+
const index = await indexLatestEventsByExternalRef(vaultRoot, shardPaths, signal);
|
|
1110
1638
|
const appendEntries = [];
|
|
1111
|
-
const records = [];
|
|
1112
1639
|
const forceAppendIds = new Set();
|
|
1113
|
-
|
|
1640
|
+
const eventIds = [];
|
|
1641
|
+
const retractedEventIds = [];
|
|
1642
|
+
const eventShardPaths = new Set();
|
|
1643
|
+
const orderedDecisions = orderEventImportDecisionsBySourceVersion(decisions);
|
|
1644
|
+
let createdCount = 0;
|
|
1645
|
+
let skippedExistingCount = 0;
|
|
1114
1646
|
let supersededCount = 0;
|
|
1115
|
-
|
|
1647
|
+
let retractedCount = 0;
|
|
1648
|
+
for (const decision of orderedDecisions) {
|
|
1649
|
+
signal?.throwIfAborted();
|
|
1650
|
+
if (decision.action === "retract") {
|
|
1651
|
+
const refKey = eventExternalRefKey(decision.externalRef);
|
|
1652
|
+
const latestMatch = index.latestByRefKey.get(refKey);
|
|
1653
|
+
const latest = latestMatch?.record;
|
|
1654
|
+
if (!latestMatch || !latest) {
|
|
1655
|
+
const marker = {
|
|
1656
|
+
...decision.markerEntry.record,
|
|
1657
|
+
lifecycle: buildEventSpineLifecycle(1, "deleted"),
|
|
1658
|
+
};
|
|
1659
|
+
eventShardPaths.add(decision.markerEntry.relativePath);
|
|
1660
|
+
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(marker, decision.externalRef, decision.markerEntry.relativePath));
|
|
1661
|
+
index.maxRevisionById.set(marker.id, 1);
|
|
1662
|
+
appendEntries.push({ relativePath: decision.markerEntry.relativePath, record: marker });
|
|
1663
|
+
retractedEventIds.push(marker.id);
|
|
1664
|
+
retractedCount += 1;
|
|
1665
|
+
continue;
|
|
1666
|
+
}
|
|
1667
|
+
const latestPath = latestMatch?.relativePath || toEventLedgerFile(latest.occurredAt);
|
|
1668
|
+
eventShardPaths.add(latestPath);
|
|
1669
|
+
const sourceVersionComparison = compareIncomingExternalRefVersion(latestMatch.indexedExternalRef, decision.externalRef);
|
|
1670
|
+
if (sourceVersionComparison === null) {
|
|
1671
|
+
throw new VaultError("EVENT_SOURCE_REVISION_UNORDERED", `Event externalRef "${decision.externalRef.system}/${decision.externalRef.resourceType}/` +
|
|
1672
|
+
`${decision.externalRef.resourceId}${decision.externalRef.facet ? `#${decision.externalRef.facet}` : ""}" ` +
|
|
1673
|
+
"cannot be retracted without comparable source revisions; nothing was imported.");
|
|
1674
|
+
}
|
|
1675
|
+
if (sourceVersionComparison < 0 || (sourceVersionComparison === 0 && isDeletedEventSpineRecord(latest))) {
|
|
1676
|
+
skippedExistingCount += 1;
|
|
1677
|
+
continue;
|
|
1678
|
+
}
|
|
1679
|
+
if (sourceVersionComparison === 0) {
|
|
1680
|
+
throw new VaultError("EVENT_SOURCE_REVISION_CONFLICT", `Event externalRef "${decision.externalRef.system}/${decision.externalRef.resourceType}/` +
|
|
1681
|
+
`${decision.externalRef.resourceId}${decision.externalRef.facet ? `#${decision.externalRef.facet}` : ""}" ` +
|
|
1682
|
+
`has conflicting content for source revision "${decision.externalRef.version}"; nothing was imported.`);
|
|
1683
|
+
}
|
|
1684
|
+
const revision = Math.max(eventSpineRevision(latest), index.maxRevisionById.get(latest.id) ?? 0) + 1;
|
|
1685
|
+
const tombstone = {
|
|
1686
|
+
...latest,
|
|
1687
|
+
recordedAt: decision.markerEntry.record.recordedAt,
|
|
1688
|
+
externalRef: decision.externalRef,
|
|
1689
|
+
...(decision.evidence ? { evidence: decision.evidence } : {}),
|
|
1690
|
+
...(latest.kind === "note" && latest.noteType === EVENT_IMPORT_RETRACTION_MARKER_NOTE_TYPE
|
|
1691
|
+
? { note: decision.reason }
|
|
1692
|
+
: {}),
|
|
1693
|
+
lifecycle: buildEventSpineLifecycle(revision, "deleted"),
|
|
1694
|
+
};
|
|
1695
|
+
forceAppendIds.add(latest.id);
|
|
1696
|
+
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(tombstone, decision.externalRef, latestPath));
|
|
1697
|
+
index.maxRevisionById.set(latest.id, revision);
|
|
1698
|
+
appendEntries.push({ relativePath: latestPath, record: tombstone });
|
|
1699
|
+
retractedEventIds.push(latest.id);
|
|
1700
|
+
retractedCount += 1;
|
|
1701
|
+
continue;
|
|
1702
|
+
}
|
|
1703
|
+
const entry = decision.entry;
|
|
1704
|
+
eventShardPaths.add(entry.relativePath);
|
|
1116
1705
|
const externalRef = entry.record.externalRef;
|
|
1117
1706
|
if (!externalRef) {
|
|
1118
1707
|
appendEntries.push(entry);
|
|
1119
|
-
|
|
1708
|
+
eventIds.push(entry.record.id);
|
|
1709
|
+
createdCount += 1;
|
|
1120
1710
|
continue;
|
|
1121
1711
|
}
|
|
1122
1712
|
const refKey = eventExternalRefKey(externalRef);
|
|
1123
|
-
const
|
|
1713
|
+
const latestMatch = index.latestByRefKey.get(refKey);
|
|
1714
|
+
const latest = latestMatch?.record;
|
|
1124
1715
|
if (!latest) {
|
|
1125
|
-
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef));
|
|
1716
|
+
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef, entry.relativePath));
|
|
1126
1717
|
appendEntries.push(entry);
|
|
1127
|
-
|
|
1718
|
+
eventIds.push(entry.record.id);
|
|
1719
|
+
createdCount += 1;
|
|
1128
1720
|
continue;
|
|
1129
1721
|
}
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1722
|
+
const sourceVersionComparison = compareIncomingExternalRefVersion(latestMatch.indexedExternalRef, externalRef);
|
|
1723
|
+
if (sourceVersionComparison !== null) {
|
|
1724
|
+
if (sourceVersionComparison < 0) {
|
|
1725
|
+
skippedExistingCount += 1;
|
|
1726
|
+
continue;
|
|
1727
|
+
}
|
|
1728
|
+
if (sourceVersionComparison === 0) {
|
|
1729
|
+
const existingContentKey = decision.allowsKindReplacement
|
|
1730
|
+
? eventImportSourceSemanticContentKey(latest)
|
|
1731
|
+
: eventImportVersionedReplayContentKey(latest);
|
|
1732
|
+
const incomingContentKey = decision.allowsKindReplacement
|
|
1733
|
+
? eventImportSourceSemanticContentKey(entry.record)
|
|
1734
|
+
: eventImportVersionedReplayContentKey(entry.record);
|
|
1735
|
+
if (existingContentKey === incomingContentKey) {
|
|
1736
|
+
skippedExistingCount += 1;
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1739
|
+
throw new VaultError("EVENT_SOURCE_REVISION_CONFLICT", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
1740
|
+
`${externalRef.facet ? `#${externalRef.facet}` : ""}" has conflicting content for source revision ` +
|
|
1741
|
+
`"${externalRef.version}"; nothing was imported.`);
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
else {
|
|
1745
|
+
// Preserve the legacy public-import contract for unversioned or
|
|
1746
|
+
// non-temporal sources: provenance changes remain content changes and a
|
|
1747
|
+
// kind mismatch remains invalid.
|
|
1748
|
+
if (latest.kind !== entry.record.kind) {
|
|
1749
|
+
throw new VaultError("EVENT_KIND_MISMATCH", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
1750
|
+
`${externalRef.facet ? `#${externalRef.facet}` : ""}" already belongs to kind ` +
|
|
1751
|
+
`"${latest.kind}" and cannot be rewritten as "${entry.record.kind}"; nothing was imported.`);
|
|
1752
|
+
}
|
|
1753
|
+
if (eventImportContentKey(latest) === eventImportContentKey(entry.record)) {
|
|
1754
|
+
skippedExistingCount += 1;
|
|
1755
|
+
continue;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
if (latest.kind !== entry.record.kind && !decision.allowsKindReplacement) {
|
|
1136
1759
|
throw new VaultError("EVENT_KIND_MISMATCH", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
|
|
1137
1760
|
`${externalRef.facet ? `#${externalRef.facet}` : ""}" already belongs to kind ` +
|
|
1138
1761
|
`"${latest.kind}" and cannot be rewritten as "${entry.record.kind}"; nothing was imported.`);
|
|
1139
1762
|
}
|
|
1140
|
-
if (eventImportContentKey(latest) === eventImportContentKey(entry.record)) {
|
|
1141
|
-
skippedDuplicateCount += 1;
|
|
1142
|
-
records.push(latest);
|
|
1143
|
-
continue;
|
|
1144
|
-
}
|
|
1145
1763
|
if (isDeletedEventSpineRecord(latest)) {
|
|
1146
|
-
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef));
|
|
1764
|
+
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef, entry.relativePath));
|
|
1147
1765
|
appendEntries.push(entry);
|
|
1148
|
-
|
|
1766
|
+
eventIds.push(entry.record.id);
|
|
1767
|
+
createdCount += 1;
|
|
1768
|
+
continue;
|
|
1769
|
+
}
|
|
1770
|
+
if (latest.kind !== entry.record.kind) {
|
|
1771
|
+
const latestPath = latestMatch?.relativePath || toEventLedgerFile(latest.occurredAt);
|
|
1772
|
+
const revision = Math.max(eventSpineRevision(latest), index.maxRevisionById.get(latest.id) ?? 0) + 1;
|
|
1773
|
+
const tombstone = {
|
|
1774
|
+
...latest,
|
|
1775
|
+
recordedAt: entry.record.recordedAt,
|
|
1776
|
+
externalRef,
|
|
1777
|
+
...(entry.record.evidence ? { evidence: entry.record.evidence } : {}),
|
|
1778
|
+
lifecycle: buildEventSpineLifecycle(revision, "deleted"),
|
|
1779
|
+
};
|
|
1780
|
+
forceAppendIds.add(latest.id);
|
|
1781
|
+
index.maxRevisionById.set(latest.id, revision);
|
|
1782
|
+
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef, entry.relativePath));
|
|
1783
|
+
appendEntries.push({ relativePath: latestPath, record: tombstone }, entry);
|
|
1784
|
+
eventShardPaths.add(latestPath);
|
|
1785
|
+
eventIds.push(entry.record.id);
|
|
1786
|
+
createdCount += 1;
|
|
1787
|
+
supersededCount += 1;
|
|
1149
1788
|
continue;
|
|
1150
1789
|
}
|
|
1151
1790
|
const revision = Math.max(eventSpineRevision(latest), index.maxRevisionById.get(latest.id) ?? 0) + 1;
|
|
@@ -1155,18 +1794,22 @@ async function reconcileEventImportEntriesByExternalRef(vaultRoot, entries) {
|
|
|
1155
1794
|
lifecycle: buildEventSpineLifecycle(revision),
|
|
1156
1795
|
};
|
|
1157
1796
|
forceAppendIds.add(latest.id);
|
|
1158
|
-
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(superseding, externalRef));
|
|
1797
|
+
index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(superseding, externalRef, entry.relativePath));
|
|
1159
1798
|
index.maxRevisionById.set(latest.id, revision);
|
|
1160
1799
|
appendEntries.push({ relativePath: entry.relativePath, record: superseding });
|
|
1161
|
-
|
|
1800
|
+
eventIds.push(superseding.id);
|
|
1162
1801
|
supersededCount += 1;
|
|
1163
1802
|
}
|
|
1164
1803
|
return {
|
|
1165
1804
|
appendEntries,
|
|
1166
|
-
records,
|
|
1167
1805
|
forceAppendIds,
|
|
1168
|
-
|
|
1806
|
+
createdCount,
|
|
1807
|
+
skippedExistingCount,
|
|
1169
1808
|
supersededCount,
|
|
1809
|
+
retractedCount,
|
|
1810
|
+
eventIds,
|
|
1811
|
+
retractedEventIds,
|
|
1812
|
+
eventShardPaths: [...eventShardPaths].sort(),
|
|
1170
1813
|
};
|
|
1171
1814
|
}
|
|
1172
1815
|
const AUDIT_TARGET_ID_LIMIT = 50;
|
|
@@ -1297,29 +1940,13 @@ export async function dedupeDeviceEventsByExternalRef({ vaultRoot, apply = false
|
|
|
1297
1940
|
});
|
|
1298
1941
|
}
|
|
1299
1942
|
function mapPreparedDeviceEventsToCanonicalIds(preparedEntries, reconciledRecords) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
const identity = record.externalRef
|
|
1303
|
-
? `external:${eventExternalRefKey(record.externalRef)}`
|
|
1304
|
-
: `id:${record.id}`;
|
|
1305
|
-
const existing = canonicalIdByIdentity.get(identity);
|
|
1306
|
-
if (existing && existing !== record.id) {
|
|
1307
|
-
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", `Device import produced multiple canonical event ids for identity "${identity}".`);
|
|
1308
|
-
}
|
|
1309
|
-
canonicalIdByIdentity.set(identity, record.id);
|
|
1943
|
+
if (preparedEntries.length !== reconciledRecords.length) {
|
|
1944
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_MISSING", "Device event reconciliation did not return one canonical result per prepared event.");
|
|
1310
1945
|
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
: `id:${entry.record.id}`;
|
|
1316
|
-
const canonicalId = canonicalIdByIdentity.get(identity);
|
|
1317
|
-
if (!canonicalId) {
|
|
1318
|
-
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_MISSING", `No reconciled canonical event matched prepared device event "${entry.record.id}".`);
|
|
1319
|
-
}
|
|
1320
|
-
result.set(entry.record.id, canonicalId);
|
|
1321
|
-
}
|
|
1322
|
-
return result;
|
|
1946
|
+
return new Map(preparedEntries.map((entry, index) => [
|
|
1947
|
+
entry.record.id,
|
|
1948
|
+
reconciledRecords[index]?.id ?? entry.record.id,
|
|
1949
|
+
]));
|
|
1323
1950
|
}
|
|
1324
1951
|
function buildIntegrationEventOutputs(preparedEntries, canonicalIdByPreparedId, evidenceRolesByPreparedId) {
|
|
1325
1952
|
const rolesByCanonicalId = new Map();
|
|
@@ -1394,17 +2021,27 @@ function prepareDeviceBatchPlan({ provider, accountId, importedAt = new Date(),
|
|
|
1394
2021
|
...normalizedInputs.events.map(({ seed }) => seed.occurredAt),
|
|
1395
2022
|
...normalizedInputs.samples.map(({ seed }) => seed.recordedAt),
|
|
1396
2023
|
], normalizedInputs.importedAt);
|
|
1397
|
-
const
|
|
2024
|
+
const rawArtifactFingerprint = [
|
|
1398
2025
|
...normalizedInputs.evidenceParts.map((part) => ({
|
|
1399
2026
|
role: part.role,
|
|
1400
2027
|
fileName: part.fileName,
|
|
1401
2028
|
mediaType: part.mediaType ?? null,
|
|
1402
2029
|
sha256: part.sha256,
|
|
2030
|
+
...(part.metadata === undefined ? {} : { metadata: part.metadata }),
|
|
1403
2031
|
})),
|
|
1404
2032
|
...buildLegacyReceiptFingerprint(normalizedInputs.ingestReceipt, normalizedInputs.provider),
|
|
1405
2033
|
];
|
|
2034
|
+
const legacyRawArtifactFingerprint = [
|
|
2035
|
+
...normalizedInputs.evidenceParts.map((part) => ({
|
|
2036
|
+
role: part.role,
|
|
2037
|
+
fileName: part.fileName,
|
|
2038
|
+
mediaType: part.mediaType ?? null,
|
|
2039
|
+
sha256: part.sha256,
|
|
2040
|
+
})),
|
|
2041
|
+
...buildLegacyReceiptFingerprint(normalizedInputs.legacyIngestReceipt, normalizedInputs.provider),
|
|
2042
|
+
];
|
|
1406
2043
|
const compactedIngestReceipt = compactIntegrationIngestReceipt(normalizedInputs.ingestReceipt);
|
|
1407
|
-
const
|
|
2044
|
+
const buildImportId = (fingerprint) => deterministicContractId(ID_PREFIXES.transform, stableStringify({
|
|
1408
2045
|
provider: normalizedInputs.provider,
|
|
1409
2046
|
accountId: normalizedInputs.accountId ?? null,
|
|
1410
2047
|
source: normalizedInputs.source,
|
|
@@ -1413,19 +2050,22 @@ function prepareDeviceBatchPlan({ provider, accountId, importedAt = new Date(),
|
|
|
1413
2050
|
receipt: compactedIngestReceipt ?? null,
|
|
1414
2051
|
eventIds: normalizedInputs.events.map(({ recordId }) => recordId),
|
|
1415
2052
|
sampleIds: normalizedInputs.samples.map(({ recordId }) => recordId),
|
|
1416
|
-
evidenceParts:
|
|
2053
|
+
evidenceParts: fingerprint,
|
|
1417
2054
|
}));
|
|
2055
|
+
const importId = buildImportId(rawArtifactFingerprint);
|
|
2056
|
+
const legacyImportId = buildImportId(legacyRawArtifactFingerprint);
|
|
1418
2057
|
const preparedEvidenceParts = prepareDeviceEvidenceParts(normalizedInputs.evidenceParts);
|
|
1419
2058
|
const eventPlan = prepareDeviceEventEntries(normalizedInputs.events, preparedEvidenceParts);
|
|
1420
2059
|
const preparedSamples = prepareDeviceSampleEntries(normalizedInputs.samples);
|
|
1421
2060
|
return {
|
|
1422
2061
|
importId,
|
|
2062
|
+
legacyImportId,
|
|
1423
2063
|
provider: normalizedInputs.provider,
|
|
1424
2064
|
accountId: normalizedInputs.accountId,
|
|
1425
2065
|
importedAt: normalizedInputs.importedAt,
|
|
1426
2066
|
source: normalizedInputs.source,
|
|
1427
2067
|
provenance: normalizedInputs.provenance,
|
|
1428
|
-
ingestReceipt:
|
|
2068
|
+
ingestReceipt: compactedIngestReceipt,
|
|
1429
2069
|
effectiveOccurredAt,
|
|
1430
2070
|
preparedEvents: eventPlan.entries,
|
|
1431
2071
|
evidenceRolesByPreparedRecordId: eventPlan.evidenceRolesByPreparedRecordId,
|
|
@@ -1830,6 +2470,294 @@ export async function importSamples({ vaultRoot, stream, unit, samples, sourcePa
|
|
|
1830
2470
|
},
|
|
1831
2471
|
});
|
|
1832
2472
|
}
|
|
2473
|
+
function integrationEvidencePartIdentity(part) {
|
|
2474
|
+
return stableStringify({
|
|
2475
|
+
role: part.role,
|
|
2476
|
+
fileName: part.fileName,
|
|
2477
|
+
mediaType: part.mediaType,
|
|
2478
|
+
sha256: part.sha256,
|
|
2479
|
+
metadata: part.metadata ?? null,
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
function storedIntegrationIngestMatchesDeviceDeliveryBase(record, plan) {
|
|
2483
|
+
return record.provider === plan.provider
|
|
2484
|
+
&& (record.accountId ?? null) === (plan.accountId ?? null)
|
|
2485
|
+
&& record.source === plan.source
|
|
2486
|
+
&& record.importedAt === plan.importedAt
|
|
2487
|
+
&& stableStringify(record.provenance ?? {}) === stableStringify(plan.provenance)
|
|
2488
|
+
&& stableStringify(record.receipt ?? null) === stableStringify(plan.ingestReceipt ?? null);
|
|
2489
|
+
}
|
|
2490
|
+
function storedIntegrationIngestIsDeviceDeliveryCandidate(record, plan) {
|
|
2491
|
+
if (!storedIntegrationIngestMatchesDeviceDeliveryBase(record, plan)) {
|
|
2492
|
+
return false;
|
|
2493
|
+
}
|
|
2494
|
+
const incomingPartIdentities = new Set(plan.preparedEvidenceParts.map(integrationEvidencePartIdentity));
|
|
2495
|
+
return record.parts.every((part) => incomingPartIdentities.has(integrationEvidencePartIdentity(part)));
|
|
2496
|
+
}
|
|
2497
|
+
function storedIntegrationIngestMatchesDeviceDelivery(record, plan) {
|
|
2498
|
+
return storedIntegrationIngestMatchesDeviceDeliveryBase(record, plan)
|
|
2499
|
+
&& stableStringify(record.parts.map(integrationEvidencePartIdentity))
|
|
2500
|
+
=== stableStringify(plan.preparedEvidenceParts.map(integrationEvidencePartIdentity));
|
|
2501
|
+
}
|
|
2502
|
+
function hasAuthorizedCurrentDeviceEventOutput(currentEventOwners, preparedId) {
|
|
2503
|
+
return currentEventOwners.associationSafePreparedIds.has(preparedId)
|
|
2504
|
+
&& currentEventOwners.currentRecordByPreparedId.has(preparedId);
|
|
2505
|
+
}
|
|
2506
|
+
function buildPreparedDeviceEventOutputOwners(input) {
|
|
2507
|
+
const baselineCanonicalIdByPreparedId = mapPreparedDeviceEventsToCanonicalIds(input.deviceBatchPlan.preparedEvents, input.baselineEventReconciliation.records);
|
|
2508
|
+
const preparedIdsByBaselineCanonicalId = new Map();
|
|
2509
|
+
for (const entry of input.deviceBatchPlan.preparedEvents) {
|
|
2510
|
+
const baselineCanonicalId = baselineCanonicalIdByPreparedId.get(entry.record.id);
|
|
2511
|
+
if (!baselineCanonicalId) {
|
|
2512
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_MISSING", `No baseline canonical event id was recorded for prepared event "${entry.record.id}".`);
|
|
2513
|
+
}
|
|
2514
|
+
const preparedIds = preparedIdsByBaselineCanonicalId.get(baselineCanonicalId)
|
|
2515
|
+
?? new Set();
|
|
2516
|
+
preparedIds.add(entry.record.id);
|
|
2517
|
+
preparedIdsByBaselineCanonicalId.set(baselineCanonicalId, preparedIds);
|
|
2518
|
+
}
|
|
2519
|
+
const ownerByBaselineCanonicalId = new Map([...preparedIdsByBaselineCanonicalId].map(([canonicalId, preparedIds]) => [
|
|
2520
|
+
canonicalId,
|
|
2521
|
+
{
|
|
2522
|
+
preparedIds: new Set(preparedIds),
|
|
2523
|
+
},
|
|
2524
|
+
]));
|
|
2525
|
+
const byPreparedId = new Map();
|
|
2526
|
+
const byOutputId = new Map();
|
|
2527
|
+
const claimOutputId = (outputId, owner) => {
|
|
2528
|
+
const existingOwner = byOutputId.get(outputId);
|
|
2529
|
+
if (existingOwner && existingOwner !== owner) {
|
|
2530
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", `Stored canonical event "${outputId}" was claimed by multiple prepared device event spines.`);
|
|
2531
|
+
}
|
|
2532
|
+
byOutputId.set(outputId, owner);
|
|
2533
|
+
};
|
|
2534
|
+
for (const entry of input.deviceBatchPlan.preparedEvents) {
|
|
2535
|
+
const baselineCanonicalId = baselineCanonicalIdByPreparedId.get(entry.record.id);
|
|
2536
|
+
const owner = baselineCanonicalId
|
|
2537
|
+
? ownerByBaselineCanonicalId.get(baselineCanonicalId)
|
|
2538
|
+
: undefined;
|
|
2539
|
+
if (!owner) {
|
|
2540
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_MISSING", `No event-spine owner was recorded for prepared event "${entry.record.id}".`);
|
|
2541
|
+
}
|
|
2542
|
+
byPreparedId.set(entry.record.id, owner);
|
|
2543
|
+
claimOutputId(entry.record.id, owner);
|
|
2544
|
+
const canonicalId = input.currentEventOwners.canonicalIdByPreparedId.get(entry.record.id);
|
|
2545
|
+
if (canonicalId) {
|
|
2546
|
+
claimOutputId(canonicalId, owner);
|
|
2547
|
+
}
|
|
2548
|
+
for (const ownerId of input.currentEventOwners.historicalContentOwnerRevisionsByPreparedId.get(entry.record.id)?.keys() ?? []) {
|
|
2549
|
+
claimOutputId(ownerId, owner);
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
return { byOutputId, byPreparedId };
|
|
2553
|
+
}
|
|
2554
|
+
function storedEventOutputMatchesPreparedOwner(input) {
|
|
2555
|
+
return input.preparedEventOutputOwners.byOutputId.get(input.output.id);
|
|
2556
|
+
}
|
|
2557
|
+
function preparedIdsRetainedByStoredEventOutput(input) {
|
|
2558
|
+
const outputRoles = new Set(input.output.roles);
|
|
2559
|
+
const preparedRolesById = [...input.owner.preparedIds]
|
|
2560
|
+
.map((preparedId) => ({
|
|
2561
|
+
preparedId,
|
|
2562
|
+
roles: input.evidenceRolesByPreparedRecordId.get(preparedId),
|
|
2563
|
+
}))
|
|
2564
|
+
.filter((entry) => entry.roles !== undefined);
|
|
2565
|
+
if (outputRoles.size === 0) {
|
|
2566
|
+
const emptyRoleOwners = preparedRolesById.filter((entry) => entry.roles.length === 0);
|
|
2567
|
+
return emptyRoleOwners.length === 1
|
|
2568
|
+
? [emptyRoleOwners[0].preparedId]
|
|
2569
|
+
: undefined;
|
|
2570
|
+
}
|
|
2571
|
+
const preparedIdsByRole = new Map();
|
|
2572
|
+
for (const { preparedId, roles } of preparedRolesById) {
|
|
2573
|
+
if (roles.length === 0 || roles.some((role) => !outputRoles.has(role))) {
|
|
2574
|
+
continue;
|
|
2575
|
+
}
|
|
2576
|
+
for (const role of roles) {
|
|
2577
|
+
const preparedIds = preparedIdsByRole.get(role) ?? [];
|
|
2578
|
+
preparedIds.push(preparedId);
|
|
2579
|
+
preparedIdsByRole.set(role, preparedIds);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
const retainedPreparedIds = new Set();
|
|
2583
|
+
for (const role of outputRoles) {
|
|
2584
|
+
const preparedIds = preparedIdsByRole.get(role);
|
|
2585
|
+
if (preparedIds?.length !== 1) {
|
|
2586
|
+
return undefined;
|
|
2587
|
+
}
|
|
2588
|
+
retainedPreparedIds.add(preparedIds[0]);
|
|
2589
|
+
}
|
|
2590
|
+
return [...retainedPreparedIds];
|
|
2591
|
+
}
|
|
2592
|
+
function storedEventOutputRolesBelongToPreparedOwner(input) {
|
|
2593
|
+
if (input.output.roles.length === 0) {
|
|
2594
|
+
return [...input.owner.preparedIds].some((preparedId) => (input.evidenceRolesByPreparedRecordId.get(preparedId) ?? []).length === 0);
|
|
2595
|
+
}
|
|
2596
|
+
return input.output.roles.every((role) => [...input.owner.preparedIds].some((preparedId) => input.evidenceRolesByPreparedRecordId.get(preparedId)?.includes(role)));
|
|
2597
|
+
}
|
|
2598
|
+
function storedOutputIdsByPreparedId(input) {
|
|
2599
|
+
const ownedOutputIds = new Set();
|
|
2600
|
+
const outputIdByPreparedId = new Map();
|
|
2601
|
+
const unresolvedOutputIds = new Set();
|
|
2602
|
+
for (const storedDelivery of input.storedDeliveries) {
|
|
2603
|
+
for (const output of storedDelivery.outputs.events) {
|
|
2604
|
+
const owner = input.preparedEventOutputOwners.byOutputId.get(output.id);
|
|
2605
|
+
const retainedPreparedIds = owner
|
|
2606
|
+
? preparedIdsRetainedByStoredEventOutput({
|
|
2607
|
+
evidenceRolesByPreparedRecordId: input.evidenceRolesByPreparedRecordId,
|
|
2608
|
+
output,
|
|
2609
|
+
owner,
|
|
2610
|
+
})
|
|
2611
|
+
: undefined;
|
|
2612
|
+
if (!owner) {
|
|
2613
|
+
unresolvedOutputIds.add(output.id);
|
|
2614
|
+
continue;
|
|
2615
|
+
}
|
|
2616
|
+
ownedOutputIds.add(output.id);
|
|
2617
|
+
if (!retainedPreparedIds) {
|
|
2618
|
+
unresolvedOutputIds.add(output.id);
|
|
2619
|
+
continue;
|
|
2620
|
+
}
|
|
2621
|
+
for (const preparedId of retainedPreparedIds) {
|
|
2622
|
+
const storedOutputId = outputIdByPreparedId.get(preparedId);
|
|
2623
|
+
if (storedOutputId && storedOutputId !== output.id) {
|
|
2624
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", `Prepared device event "${preparedId}" maps to conflicting stored canonical events.`);
|
|
2625
|
+
}
|
|
2626
|
+
outputIdByPreparedId.set(preparedId, output.id);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
return { ownedOutputIds, outputIdByPreparedId, unresolvedOutputIds };
|
|
2631
|
+
}
|
|
2632
|
+
function outputOwnerHasAuthorizedCurrentEvent(currentEventOwners, owner) {
|
|
2633
|
+
return [...owner.preparedIds].some((preparedId) => hasAuthorizedCurrentDeviceEventOutput(currentEventOwners, preparedId));
|
|
2634
|
+
}
|
|
2635
|
+
function preparedDeviceEventRetainsCurrentOutput(input) {
|
|
2636
|
+
const preparedId = input.entry.record.id;
|
|
2637
|
+
if (hasAuthorizedCurrentDeviceEventOutput(input.currentEventOwners, preparedId)
|
|
2638
|
+
|| input.currentEventOwners.historicallyDeliveredPreparedIds.has(preparedId)) {
|
|
2639
|
+
return true;
|
|
2640
|
+
}
|
|
2641
|
+
const current = input.currentEventOwners.currentRecordByPreparedId.get(preparedId);
|
|
2642
|
+
return current !== undefined && (isDeletedEventSpineRecord(current)
|
|
2643
|
+
|| (eventSpineRevision(current) > eventSpineRevision(input.entry.record)
|
|
2644
|
+
&& userAuthoredEventStateKey(current) !== userAuthoredEventStateKey(input.entry.record)));
|
|
2645
|
+
}
|
|
2646
|
+
function storedIntegrationIngestRetainsCurrentOutputs(input) {
|
|
2647
|
+
if (!input.allSamplesExist) {
|
|
2648
|
+
return false;
|
|
2649
|
+
}
|
|
2650
|
+
const associationPreparedEvents = input.deviceBatchPlan.preparedEvents.filter((entry) => input.associationEvidenceRolesByPreparedRecordId.has(entry.record.id));
|
|
2651
|
+
if (input.storedDelivery.outputs.events.length > 0
|
|
2652
|
+
&& associationPreparedEvents.some((entry) => !input.currentEventOwners.currentRecordByPreparedId.has(entry.record.id)
|
|
2653
|
+
&& !input.currentEventOwners.physicallyExistingPreparedIds.has(entry.record.id))) {
|
|
2654
|
+
return false;
|
|
2655
|
+
}
|
|
2656
|
+
const currentlyOwnedAssociationEvents = associationPreparedEvents.filter((entry) => {
|
|
2657
|
+
const owner = input.preparedEventOutputOwners.byPreparedId.get(entry.record.id);
|
|
2658
|
+
return owner
|
|
2659
|
+
? outputOwnerHasAuthorizedCurrentEvent(input.currentEventOwners, owner)
|
|
2660
|
+
: false;
|
|
2661
|
+
});
|
|
2662
|
+
const expectedEventIds = new Set(currentlyOwnedAssociationEvents
|
|
2663
|
+
.map((entry) => input.currentEventOwners.canonicalIdByPreparedId.get(entry.record.id))
|
|
2664
|
+
.filter((eventId) => eventId !== undefined));
|
|
2665
|
+
const expectedSampleIds = input.sampleRecords.map((record) => record.id).sort();
|
|
2666
|
+
const preparedEventById = new Map(input.deviceBatchPlan.preparedEvents.map((entry) => [entry.record.id, entry]));
|
|
2667
|
+
for (const output of input.storedDelivery.outputs.events) {
|
|
2668
|
+
const owner = storedEventOutputMatchesPreparedOwner({
|
|
2669
|
+
output,
|
|
2670
|
+
preparedEventOutputOwners: input.preparedEventOutputOwners,
|
|
2671
|
+
});
|
|
2672
|
+
if (!owner) {
|
|
2673
|
+
return false;
|
|
2674
|
+
}
|
|
2675
|
+
const ownerEntries = [...owner.preparedIds]
|
|
2676
|
+
.map((preparedId) => preparedEventById.get(preparedId))
|
|
2677
|
+
.filter((entry) => entry !== undefined);
|
|
2678
|
+
const outputRolesBelongToOwner = storedEventOutputRolesBelongToPreparedOwner({
|
|
2679
|
+
evidenceRolesByPreparedRecordId: input.deviceBatchPlan.evidenceRolesByPreparedRecordId,
|
|
2680
|
+
output,
|
|
2681
|
+
owner,
|
|
2682
|
+
});
|
|
2683
|
+
const retainedOwnerEntries = ownerEntries.filter((entry) => input.baselineRetainedPreparedIds.has(entry.record.id));
|
|
2684
|
+
const retainsOutput = outputRolesBelongToOwner
|
|
2685
|
+
&& retainedOwnerEntries.length > 0
|
|
2686
|
+
&& retainedOwnerEntries.every((entry) => input.replayRetainedPreparedIds.has(entry.record.id));
|
|
2687
|
+
if (!retainsOutput) {
|
|
2688
|
+
return false;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
return input.storedDelivery.outputs.eventIdsComplete
|
|
2692
|
+
&& input.storedDelivery.outputs.sampleIdsComplete
|
|
2693
|
+
&& [...expectedEventIds].every((eventId) => input.storedDelivery.outputs.events.some((output) => output.id === eventId))
|
|
2694
|
+
&& stableStringify([...input.storedDelivery.outputs.sampleIds].sort()) === stableStringify(expectedSampleIds);
|
|
2695
|
+
}
|
|
2696
|
+
function buildStoredEventRepairIds(input) {
|
|
2697
|
+
const result = new Map();
|
|
2698
|
+
const storedOutputRoles = new Set(input.storedDeliveries.flatMap((storedDelivery) => storedDelivery.outputs.events.flatMap((output) => output.roles)));
|
|
2699
|
+
for (const entry of input.deviceBatchPlan.preparedEvents) {
|
|
2700
|
+
if ((input.currentEventOwners.currentRecordByPreparedId.has(entry.record.id)
|
|
2701
|
+
&& input.currentEventOwners.associationSafePreparedIds.has(entry.record.id))
|
|
2702
|
+
|| input.currentEventOwners.historicalContentOwnerRevisionsByPreparedId.has(entry.record.id)) {
|
|
2703
|
+
continue;
|
|
2704
|
+
}
|
|
2705
|
+
const storedOutputId = input.storedOutputIdByPreparedId.get(entry.record.id);
|
|
2706
|
+
if (storedOutputId) {
|
|
2707
|
+
result.set(entry.record.id, storedOutputId);
|
|
2708
|
+
continue;
|
|
2709
|
+
}
|
|
2710
|
+
const deliveryRoles = input.deviceBatchPlan.evidenceRolesByPreparedRecordId
|
|
2711
|
+
.get(entry.record.id) ?? [];
|
|
2712
|
+
const owner = input.preparedEventOutputOwners.byPreparedId.get(entry.record.id);
|
|
2713
|
+
const ownerHasStoredOutput = owner !== undefined
|
|
2714
|
+
&& [...owner.preparedIds].some((preparedId) => input.storedOutputIdByPreparedId.has(preparedId));
|
|
2715
|
+
if ((deliveryRoles.length === 0 && ownerHasStoredOutput)
|
|
2716
|
+
|| deliveryRoles.some((role) => storedOutputRoles.has(role))) {
|
|
2717
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Missing device event member shares evidence with a different stored output.");
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
return result;
|
|
2721
|
+
}
|
|
2722
|
+
function buildStoredDeviceDeliveryNoopResult(input) {
|
|
2723
|
+
const eventsById = new Map();
|
|
2724
|
+
for (const output of input.storedDelivery.outputs.events) {
|
|
2725
|
+
const owner = storedEventOutputMatchesPreparedOwner({
|
|
2726
|
+
output,
|
|
2727
|
+
preparedEventOutputOwners: input.preparedEventOutputOwners,
|
|
2728
|
+
});
|
|
2729
|
+
if (!owner) {
|
|
2730
|
+
continue;
|
|
2731
|
+
}
|
|
2732
|
+
for (const preparedId of owner.preparedIds) {
|
|
2733
|
+
if (!hasAuthorizedCurrentDeviceEventOutput(input.currentEventOwners, preparedId)) {
|
|
2734
|
+
continue;
|
|
2735
|
+
}
|
|
2736
|
+
const current = input.currentEventOwners.currentRecordByPreparedId.get(preparedId);
|
|
2737
|
+
if (current?.id === output.id) {
|
|
2738
|
+
eventsById.set(current.id, current);
|
|
2739
|
+
break;
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
return {
|
|
2744
|
+
applied: false,
|
|
2745
|
+
ingestId: null,
|
|
2746
|
+
ingestShardPath: null,
|
|
2747
|
+
provider: input.deviceBatchPlan.provider,
|
|
2748
|
+
accountId: input.deviceBatchPlan.accountId,
|
|
2749
|
+
importedAt: input.deviceBatchPlan.importedAt,
|
|
2750
|
+
events: [...eventsById.values()],
|
|
2751
|
+
samples: [...input.sampleRecords],
|
|
2752
|
+
eventShardPaths: [...input.eventTargetShardPaths],
|
|
2753
|
+
sampleShardPaths: [
|
|
2754
|
+
...new Set(input.deviceBatchPlan.preparedSamples.map((entry) => entry.relativePath)),
|
|
2755
|
+
].sort(),
|
|
2756
|
+
evidencePartCount: input.deviceBatchPlan.preparedEvidenceParts.length,
|
|
2757
|
+
persistedEvidencePartCount: 0,
|
|
2758
|
+
auditPath: null,
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
1833
2761
|
export async function importDeviceBatch({ vaultRoot, provider, accountId, importedAt = new Date(), source = "device", events = [], samples = [], evidenceParts = [], ingestReceipt, provenance, }) {
|
|
1834
2762
|
assertDeviceSampleRowLimit(Array.isArray(samples) ? samples.length : 0);
|
|
1835
2763
|
const vault = await loadVault({ vaultRoot });
|
|
@@ -1845,29 +2773,494 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
|
|
|
1845
2773
|
ingestReceipt,
|
|
1846
2774
|
provenance,
|
|
1847
2775
|
});
|
|
1848
|
-
const eventReconciliation = await reconcileDeviceEventEntriesByExternalRef(vaultRoot, deviceBatchPlan.preparedEvents);
|
|
1849
|
-
const eventAppendPlan = await buildJsonlAppendPlan(vaultRoot, eventReconciliation.appendEntries, {
|
|
1850
|
-
dedupeWithinPlan: true,
|
|
1851
|
-
forceAppendIds: eventReconciliation.forceAppendIds,
|
|
1852
|
-
});
|
|
1853
|
-
const sampleAppendPlan = await buildJsonlAppendPlan(vaultRoot, deviceBatchPlan.preparedSamples, {
|
|
1854
|
-
dedupeWithinPlan: true,
|
|
1855
|
-
});
|
|
1856
|
-
const eventRecords = eventReconciliation.records;
|
|
1857
2776
|
const eventTargetShardPaths = [
|
|
1858
2777
|
...new Set(deviceBatchPlan.preparedEvents.map((entry) => entry.relativePath)),
|
|
1859
2778
|
].sort();
|
|
1860
2779
|
const sampleRecords = deviceBatchPlan.preparedSamples.map((entry) => entry.record);
|
|
1861
|
-
const
|
|
1862
|
-
|
|
2780
|
+
const sampleAppendPlan = await buildJsonlAppendPlan(vaultRoot, deviceBatchPlan.preparedSamples, {
|
|
2781
|
+
dedupeWithinPlan: true,
|
|
2782
|
+
});
|
|
2783
|
+
const eventIdentityContext = await buildDeviceEventIdentityContext(vaultRoot, deviceBatchPlan.preparedEvents);
|
|
2784
|
+
const currentEventOwners = mapCurrentDeviceEventOwners(deviceBatchPlan.preparedEvents, eventIdentityContext);
|
|
2785
|
+
const baselineEventReconciliation = await reconcileDeviceEventEntriesByExternalRef(vaultRoot, deviceBatchPlan.preparedEvents, buildEmptyDeviceEventIdentityContext(deviceBatchPlan.preparedEvents));
|
|
2786
|
+
const baselineRetainedPreparedIds = new Set(baselineEventReconciliation.appendRecordIdByPreparedRecordId.keys());
|
|
2787
|
+
const baselineRecordByPreparedId = new Map(deviceBatchPlan.preparedEvents.map((entry, index) => [
|
|
2788
|
+
entry.record.id,
|
|
2789
|
+
baselineEventReconciliation.records[index] ?? entry.record,
|
|
2790
|
+
]));
|
|
2791
|
+
const preparedEventOutputOwners = buildPreparedDeviceEventOutputOwners({
|
|
2792
|
+
baselineEventReconciliation,
|
|
2793
|
+
currentEventOwners,
|
|
2794
|
+
deviceBatchPlan,
|
|
2795
|
+
});
|
|
2796
|
+
const protectedPreparedEventIds = new Set(deviceBatchPlan.preparedEvents
|
|
2797
|
+
.filter((entry) => baselineRetainedPreparedIds.has(entry.record.id)
|
|
2798
|
+
&& (currentEventOwners.historicallyDeliveredPreparedIds.has(entry.record.id)
|
|
2799
|
+
|| (entry.record.externalRef === undefined
|
|
2800
|
+
&& currentEventOwners.currentRecordByPreparedId.has(entry.record.id)
|
|
2801
|
+
&& !currentEventOwners.associationSafePreparedIds.has(entry.record.id)
|
|
2802
|
+
&& preparedDeviceEventRetainsCurrentOutput({ currentEventOwners, entry }))))
|
|
2803
|
+
.map((entry) => entry.record.id));
|
|
2804
|
+
const ordinaryReconciliationEntries = deviceBatchPlan.preparedEvents.filter((entry) => baselineRetainedPreparedIds.has(entry.record.id)
|
|
2805
|
+
&& !protectedPreparedEventIds.has(entry.record.id));
|
|
2806
|
+
const currentEventReconciliation = await reconcileDeviceEventEntriesByExternalRef(vaultRoot, ordinaryReconciliationEntries, cloneDeviceEventIdentityContext(eventIdentityContext));
|
|
2807
|
+
const replayRetainedPreparedIds = new Set([
|
|
2808
|
+
...protectedPreparedEventIds,
|
|
2809
|
+
...currentEventReconciliation.retainedPreparedIds,
|
|
2810
|
+
]);
|
|
2811
|
+
const unresolvedBaselinePreparedIds = new Set([...baselineRetainedPreparedIds].filter((preparedId) => !replayRetainedPreparedIds.has(preparedId)));
|
|
2812
|
+
const associationEvidenceRolesByPreparedRecordId = new Map(deviceBatchPlan.preparedEvents
|
|
2813
|
+
.filter((entry) => baselineRetainedPreparedIds.has(entry.record.id) && (currentEventOwners.allExist
|
|
2814
|
+
? preparedDeviceEventRetainsCurrentOutput({ currentEventOwners, entry })
|
|
2815
|
+
: currentEventOwners.associationSafePreparedIds.has(entry.record.id)))
|
|
2816
|
+
.map((entry) => [
|
|
2817
|
+
entry.record.id,
|
|
2818
|
+
deviceBatchPlan.evidenceRolesByPreparedRecordId.get(entry.record.id) ?? [],
|
|
2819
|
+
]));
|
|
2820
|
+
const associationPreparedEvents = deviceBatchPlan.preparedEvents.filter((entry) => associationEvidenceRolesByPreparedRecordId.has(entry.record.id));
|
|
2821
|
+
const currentEventOutputs = buildIntegrationEventOutputs(associationPreparedEvents, currentEventOwners.canonicalIdByPreparedId, associationEvidenceRolesByPreparedRecordId);
|
|
2822
|
+
const buildAssociationImportId = (eventOutputs) => deterministicContractId(ID_PREFIXES.transform, stableStringify({
|
|
2823
|
+
associationRevisionOfDeviceImportId: deviceBatchPlan.importId,
|
|
2824
|
+
eventOutputs,
|
|
2825
|
+
sampleIds: sampleRecords.map((record) => record.id).sort(),
|
|
2826
|
+
}));
|
|
2827
|
+
const associationImportId = buildAssociationImportId(currentEventOutputs);
|
|
2828
|
+
const candidateImportIds = new Set([
|
|
2829
|
+
deviceBatchPlan.importId,
|
|
2830
|
+
deviceBatchPlan.legacyImportId,
|
|
2831
|
+
associationImportId,
|
|
2832
|
+
]);
|
|
2833
|
+
let ingestIdInspection = await inspectIntegrationIngestIdsForImportedAt(vaultRoot, deviceBatchPlan.importedAt, candidateImportIds);
|
|
2834
|
+
const orderedCandidateImportIds = [
|
|
2835
|
+
deviceBatchPlan.importId,
|
|
2836
|
+
associationImportId,
|
|
2837
|
+
deviceBatchPlan.legacyImportId,
|
|
2838
|
+
];
|
|
2839
|
+
const candidateStoredDeliveries = () => orderedCandidateImportIds
|
|
2840
|
+
.map((id) => ingestIdInspection.invalidIds.has(id)
|
|
2841
|
+
? undefined
|
|
2842
|
+
: ingestIdInspection.entriesById.get(id))
|
|
2843
|
+
.filter((record) => record !== undefined && storedIntegrationIngestIsDeviceDeliveryCandidate(record, deviceBatchPlan));
|
|
2844
|
+
const matchingStoredDeliveries = () => candidateStoredDeliveries().filter((record) => storedIntegrationIngestMatchesDeviceDelivery(record, deviceBatchPlan));
|
|
2845
|
+
const authorizedStoredDelivery = () => ingestIdInspection.unsafe
|
|
2846
|
+
? undefined
|
|
2847
|
+
: matchingStoredDeliveries().find((storedDelivery) => (currentEventOwners.allExist || storedDelivery.outputs.events.length === 0)
|
|
2848
|
+
&&
|
|
2849
|
+
storedIntegrationIngestRetainsCurrentOutputs({
|
|
2850
|
+
allSamplesExist: sampleAppendPlan.appendedRecordIds.length === 0,
|
|
2851
|
+
associationEvidenceRolesByPreparedRecordId,
|
|
2852
|
+
baselineRetainedPreparedIds,
|
|
2853
|
+
currentEventOwners,
|
|
2854
|
+
deviceBatchPlan,
|
|
2855
|
+
preparedEventOutputOwners,
|
|
2856
|
+
replayRetainedPreparedIds,
|
|
2857
|
+
sampleRecords,
|
|
2858
|
+
storedDelivery,
|
|
2859
|
+
}));
|
|
2860
|
+
const hasInvalidCandidateId = () => orderedCandidateImportIds.some((id) => ingestIdInspection.invalidIds.has(id));
|
|
2861
|
+
const assertNoCurrentImportIdConflict = () => {
|
|
2862
|
+
const current = ingestIdInspection.entriesById.get(deviceBatchPlan.importId);
|
|
2863
|
+
if (current && !storedIntegrationIngestIsDeviceDeliveryCandidate(current, deviceBatchPlan)) {
|
|
2864
|
+
throw new VaultError("INTEGRATION_INGEST_ID_CONFLICT", `Device ingest id "${deviceBatchPlan.importId}" already belongs to a different delivery.`, { ingestId: deviceBatchPlan.importId });
|
|
2865
|
+
}
|
|
2866
|
+
};
|
|
2867
|
+
const buildExactNoopResult = (storedDelivery) => buildStoredDeviceDeliveryNoopResult({
|
|
2868
|
+
associationEvidenceRolesByPreparedRecordId,
|
|
2869
|
+
currentEventOwners,
|
|
2870
|
+
deviceBatchPlan,
|
|
2871
|
+
eventTargetShardPaths,
|
|
2872
|
+
preparedEventOutputOwners,
|
|
2873
|
+
sampleRecords,
|
|
2874
|
+
storedDelivery,
|
|
2875
|
+
});
|
|
2876
|
+
let fullInspectionAttempted = false;
|
|
2877
|
+
const ensureFullInspection = async () => {
|
|
2878
|
+
if (fullInspectionAttempted || (ingestIdInspection.historyComplete && !ingestIdInspection.unsafe)) {
|
|
2879
|
+
return;
|
|
2880
|
+
}
|
|
2881
|
+
fullInspectionAttempted = true;
|
|
2882
|
+
ingestIdInspection = await inspectIntegrationIngestIdsForImportedAt(vaultRoot, deviceBatchPlan.importedAt, candidateImportIds, { fullScan: true });
|
|
2883
|
+
};
|
|
2884
|
+
const inspectExactDeliveryState = () => {
|
|
2885
|
+
assertNoCurrentImportIdConflict();
|
|
2886
|
+
const retainedDelivery = authorizedStoredDelivery();
|
|
2887
|
+
if (retainedDelivery) {
|
|
2888
|
+
return {
|
|
2889
|
+
authorizedStoredDelivery: retainedDelivery,
|
|
2890
|
+
evidenceRepairRequired: false,
|
|
2891
|
+
untrustedExactIdentityObserved: false,
|
|
2892
|
+
};
|
|
2893
|
+
}
|
|
2894
|
+
const candidateDeliveries = candidateStoredDeliveries();
|
|
2895
|
+
const hasCompleteRetainedDelivery = matchingStoredDeliveries().some((storedDelivery) => (currentEventOwners.allExist || storedDelivery.outputs.events.length === 0)
|
|
2896
|
+
&& storedIntegrationIngestRetainsCurrentOutputs({
|
|
2897
|
+
allSamplesExist: sampleAppendPlan.appendedRecordIds.length === 0,
|
|
2898
|
+
associationEvidenceRolesByPreparedRecordId,
|
|
2899
|
+
baselineRetainedPreparedIds,
|
|
2900
|
+
currentEventOwners,
|
|
2901
|
+
deviceBatchPlan,
|
|
2902
|
+
preparedEventOutputOwners,
|
|
2903
|
+
replayRetainedPreparedIds,
|
|
2904
|
+
sampleRecords,
|
|
2905
|
+
storedDelivery,
|
|
2906
|
+
}));
|
|
2907
|
+
return {
|
|
2908
|
+
evidenceRepairRequired: hasInvalidCandidateId()
|
|
2909
|
+
|| (candidateDeliveries.length > 0 && !hasCompleteRetainedDelivery),
|
|
2910
|
+
untrustedExactIdentityObserved: hasInvalidCandidateId()
|
|
2911
|
+
|| candidateDeliveries.length > 0,
|
|
2912
|
+
};
|
|
2913
|
+
};
|
|
2914
|
+
const preparePersistence = async (exactState) => {
|
|
2915
|
+
const { evidenceRepairRequired } = exactState;
|
|
2916
|
+
if (exactState.untrustedExactIdentityObserved) {
|
|
2917
|
+
const owners = new Set(deviceBatchPlan.preparedEvents
|
|
2918
|
+
.filter((entry) => baselineRetainedPreparedIds.has(entry.record.id))
|
|
2919
|
+
.map((entry) => preparedEventOutputOwners.byPreparedId.get(entry.record.id))
|
|
2920
|
+
.filter((owner) => owner !== undefined));
|
|
2921
|
+
const ownerWithoutSurvivingRevision = [...owners].some((owner) => ![...owner.preparedIds].some((preparedId) => currentEventOwners.currentRecordByPreparedId.has(preparedId)));
|
|
2922
|
+
if (ownerWithoutSurvivingRevision) {
|
|
2923
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Observed exact device delivery has no surviving event owner revision.");
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
const exactStoredDeliveries = matchingStoredDeliveries();
|
|
2927
|
+
for (const storedDelivery of exactStoredDeliveries) {
|
|
2928
|
+
for (const output of storedDelivery.outputs.events) {
|
|
2929
|
+
const owner = preparedEventOutputOwners.byOutputId.get(output.id);
|
|
2930
|
+
if (!owner) {
|
|
2931
|
+
continue;
|
|
2932
|
+
}
|
|
2933
|
+
if (!storedEventOutputRolesBelongToPreparedOwner({
|
|
2934
|
+
evidenceRolesByPreparedRecordId: deviceBatchPlan.evidenceRolesByPreparedRecordId,
|
|
2935
|
+
output,
|
|
2936
|
+
owner,
|
|
2937
|
+
})) {
|
|
2938
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", `Stored canonical event "${output.id}" has evidence roles outside its owner.`);
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
const storedOutputProof = storedOutputIdsByPreparedId({
|
|
2943
|
+
evidenceRolesByPreparedRecordId: deviceBatchPlan.evidenceRolesByPreparedRecordId,
|
|
2944
|
+
preparedEventOutputOwners,
|
|
2945
|
+
storedDeliveries: exactStoredDeliveries,
|
|
2946
|
+
});
|
|
2947
|
+
const unresolvedPreparedIdWithoutStoredProof = [...unresolvedBaselinePreparedIds].find((preparedId) => !storedOutputProof.outputIdByPreparedId.has(preparedId));
|
|
2948
|
+
if (evidenceRepairRequired && unresolvedPreparedIdWithoutStoredProof !== undefined) {
|
|
2949
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", `Unresolved device event member "${unresolvedPreparedIdWithoutStoredProof}" has no exact stored-output proof.`);
|
|
2950
|
+
}
|
|
2951
|
+
const retainedStoredEvidenceRoles = new Map([...storedOutputProof.outputIdByPreparedId.keys()].map((preparedId) => [
|
|
2952
|
+
preparedId,
|
|
2953
|
+
deviceBatchPlan.evidenceRolesByPreparedRecordId.get(preparedId) ?? [],
|
|
2954
|
+
]));
|
|
2955
|
+
const acceptedEvidenceRolesByPreparedRecordId = evidenceRepairRequired
|
|
2956
|
+
&& exactStoredDeliveries.length > 0
|
|
2957
|
+
? retainedStoredEvidenceRoles
|
|
2958
|
+
: deviceBatchPlan.evidenceRolesByPreparedRecordId;
|
|
2959
|
+
const persistenceProtectedPreparedEventIds = new Set([
|
|
2960
|
+
...protectedPreparedEventIds,
|
|
2961
|
+
...deviceBatchPlan.preparedEvents
|
|
2962
|
+
.filter((entry) => evidenceRepairRequired
|
|
2963
|
+
&& baselineRetainedPreparedIds.has(entry.record.id)
|
|
2964
|
+
&& currentEventOwners.currentRecordByPreparedId.has(entry.record.id)
|
|
2965
|
+
&& !currentEventOwners.associationSafePreparedIds.has(entry.record.id)
|
|
2966
|
+
&& !currentEventOwners.incomingNewerPreparedIds.has(entry.record.id))
|
|
2967
|
+
.map((entry) => entry.record.id),
|
|
2968
|
+
]);
|
|
2969
|
+
const reconciliationEntries = deviceBatchPlan.preparedEvents.filter((entry) => baselineRetainedPreparedIds.has(entry.record.id)
|
|
2970
|
+
&& !persistenceProtectedPreparedEventIds.has(entry.record.id)
|
|
2971
|
+
&& (!evidenceRepairRequired
|
|
2972
|
+
|| acceptedEvidenceRolesByPreparedRecordId.has(entry.record.id)));
|
|
2973
|
+
const storedEventOutputs = exactStoredDeliveries.flatMap((storedDelivery) => storedDelivery.outputs.events);
|
|
2974
|
+
const eventRepairRequired = evidenceRepairRequired
|
|
2975
|
+
&& storedEventOutputs.length > 0
|
|
2976
|
+
&& (storedEventOutputs.some((output) => !storedOutputProof.ownedOutputIds.has(output.id))
|
|
2977
|
+
|| unresolvedBaselinePreparedIds.size > 0);
|
|
2978
|
+
const unresolvedStoredOutputId = storedOutputProof.unresolvedOutputIds.values().next().value;
|
|
2979
|
+
if (eventRepairRequired && unresolvedStoredOutputId !== undefined) {
|
|
2980
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", `Stored canonical event "${unresolvedStoredOutputId}" is not owned by the prepared device event.`);
|
|
2981
|
+
}
|
|
2982
|
+
const storedEventRepairIds = eventRepairRequired
|
|
2983
|
+
? buildStoredEventRepairIds({
|
|
2984
|
+
currentEventOwners,
|
|
2985
|
+
deviceBatchPlan,
|
|
2986
|
+
preparedEventOutputOwners,
|
|
2987
|
+
storedOutputIdByPreparedId: storedOutputProof.outputIdByPreparedId,
|
|
2988
|
+
storedDeliveries: exactStoredDeliveries,
|
|
2989
|
+
})
|
|
2990
|
+
: new Map();
|
|
2991
|
+
for (const [preparedId, repairId] of storedEventRepairIds) {
|
|
2992
|
+
const owner = preparedEventOutputOwners.byPreparedId.get(preparedId);
|
|
2993
|
+
const hasSurvivingOwnerRevision = owner !== undefined
|
|
2994
|
+
&& [...owner.preparedIds].some((ownerPreparedId) => currentEventOwners.currentRecordByPreparedId.get(ownerPreparedId)?.id === repairId);
|
|
2995
|
+
if (!hasSurvivingOwnerRevision) {
|
|
2996
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Missing device event spine has no surviving owner revision.");
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
const historicalRepairEntryByPreparedId = new Map();
|
|
3000
|
+
const historicalRepairRevision = (preparedId, owner, repairId) => {
|
|
3001
|
+
const baselineRecord = baselineRecordByPreparedId.get(preparedId);
|
|
3002
|
+
const current = currentEventOwners.currentRecordByPreparedId.get(preparedId);
|
|
3003
|
+
if (!baselineRecord || !current) {
|
|
3004
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Missing historical device event revision has no surviving delivery anchor.");
|
|
3005
|
+
}
|
|
3006
|
+
if (currentEventOwners.incomingNewerPreparedIds.has(preparedId)) {
|
|
3007
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Accepted device event revision has no owner-issued historical placement proof.");
|
|
3008
|
+
}
|
|
3009
|
+
let candidateOffsets;
|
|
3010
|
+
for (const anchorPreparedId of owner.preparedIds) {
|
|
3011
|
+
if (!baselineRetainedPreparedIds.has(anchorPreparedId)
|
|
3012
|
+
|| storedOutputProof.outputIdByPreparedId.get(anchorPreparedId) !== repairId) {
|
|
3013
|
+
continue;
|
|
3014
|
+
}
|
|
3015
|
+
const anchorBaselineRecord = baselineRecordByPreparedId.get(anchorPreparedId);
|
|
3016
|
+
const matchedRevisions = currentEventOwners.historicalContentOwnerRevisionsByPreparedId
|
|
3017
|
+
.get(anchorPreparedId)
|
|
3018
|
+
?.get(repairId);
|
|
3019
|
+
if (!anchorBaselineRecord || !matchedRevisions || matchedRevisions.size === 0) {
|
|
3020
|
+
continue;
|
|
3021
|
+
}
|
|
3022
|
+
const offsets = new Set([...matchedRevisions]
|
|
3023
|
+
.map((revision) => revision - eventSpineRevision(anchorBaselineRecord))
|
|
3024
|
+
.filter((offset) => offset >= 0));
|
|
3025
|
+
candidateOffsets = candidateOffsets === undefined
|
|
3026
|
+
? offsets
|
|
3027
|
+
: new Set([...candidateOffsets].filter((offset) => offsets.has(offset)));
|
|
3028
|
+
}
|
|
3029
|
+
if (candidateOffsets?.size !== 1) {
|
|
3030
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Missing historical device event revision has no unique surviving delivery anchor.");
|
|
3031
|
+
}
|
|
3032
|
+
return eventSpineRevision(baselineRecord) + [...candidateOffsets][0];
|
|
3033
|
+
};
|
|
3034
|
+
for (const entry of deviceBatchPlan.preparedEvents) {
|
|
3035
|
+
const repairId = storedEventRepairIds.get(entry.record.id);
|
|
3036
|
+
const current = currentEventOwners.currentRecordByPreparedId.get(entry.record.id);
|
|
3037
|
+
const owner = preparedEventOutputOwners.byPreparedId.get(entry.record.id);
|
|
3038
|
+
const baselineRecord = baselineRecordByPreparedId.get(entry.record.id);
|
|
3039
|
+
if (!repairId
|
|
3040
|
+
|| !current
|
|
3041
|
+
|| current.id !== repairId
|
|
3042
|
+
|| isDeletedEventSpineRecord(current)
|
|
3043
|
+
|| !owner
|
|
3044
|
+
|| !baselineRecord) {
|
|
3045
|
+
continue;
|
|
3046
|
+
}
|
|
3047
|
+
const repairRevision = historicalRepairRevision(entry.record.id, owner, repairId);
|
|
3048
|
+
if (!Number.isSafeInteger(repairRevision)
|
|
3049
|
+
|| repairRevision < 1
|
|
3050
|
+
|| repairRevision >= eventSpineRevision(current)
|
|
3051
|
+
|| eventIdentityContext.index.revisionsById.get(repairId)?.has(repairRevision)) {
|
|
3052
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Missing historical device event revision conflicts with the surviving event spine.");
|
|
3053
|
+
}
|
|
3054
|
+
const repairedRecord = {
|
|
3055
|
+
...baselineRecord,
|
|
3056
|
+
id: repairId,
|
|
3057
|
+
lifecycle: buildEventSpineLifecycle(repairRevision),
|
|
3058
|
+
};
|
|
3059
|
+
historicalRepairEntryByPreparedId.set(entry.record.id, {
|
|
3060
|
+
relativePath: entry.relativePath,
|
|
3061
|
+
record: repairedRecord,
|
|
3062
|
+
});
|
|
3063
|
+
}
|
|
3064
|
+
for (const preparedId of storedEventRepairIds.keys()) {
|
|
3065
|
+
if (!historicalRepairEntryByPreparedId.has(preparedId)) {
|
|
3066
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Missing historical device event revision could not be restored safely.");
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
const persistenceReconciliationEntries = reconciliationEntries.filter((entry) => !storedEventRepairIds.has(entry.record.id));
|
|
3070
|
+
const repairedProtectedPreparedEventCount = [...historicalRepairEntryByPreparedId.keys()].filter((preparedId) => persistenceProtectedPreparedEventIds.has(preparedId)).length;
|
|
3071
|
+
const reconciled = evidenceRepairRequired
|
|
3072
|
+
? await reconcileDeviceEventEntriesByExternalRef(vaultRoot, persistenceReconciliationEntries, cloneDeviceEventIdentityContext(eventIdentityContext))
|
|
3073
|
+
: currentEventReconciliation;
|
|
3074
|
+
const reconciledRecordByPreparedId = new Map(persistenceReconciliationEntries.map((entry, index) => [
|
|
3075
|
+
entry.record.id,
|
|
3076
|
+
reconciled.records[index] ?? entry.record,
|
|
3077
|
+
]));
|
|
3078
|
+
const eventReconciliation = {
|
|
3079
|
+
...reconciled,
|
|
3080
|
+
appendEntries: [
|
|
3081
|
+
...reconciled.appendEntries,
|
|
3082
|
+
...historicalRepairEntryByPreparedId.values(),
|
|
3083
|
+
],
|
|
3084
|
+
appendRecordIdByPreparedRecordId: new Map([
|
|
3085
|
+
...reconciled.appendRecordIdByPreparedRecordId,
|
|
3086
|
+
...[...historicalRepairEntryByPreparedId].map(([preparedId, repairEntry]) => [
|
|
3087
|
+
preparedId,
|
|
3088
|
+
repairEntry.record.id,
|
|
3089
|
+
]),
|
|
3090
|
+
]),
|
|
3091
|
+
forceAppendIds: new Set([
|
|
3092
|
+
...reconciled.forceAppendIds,
|
|
3093
|
+
...[...historicalRepairEntryByPreparedId.values()].map((repairEntry) => repairEntry.record.id),
|
|
3094
|
+
]),
|
|
3095
|
+
records: deviceBatchPlan.preparedEvents.map((entry) => {
|
|
3096
|
+
const historicalRepair = historicalRepairEntryByPreparedId.get(entry.record.id);
|
|
3097
|
+
if (historicalRepair) {
|
|
3098
|
+
return historicalRepair.record;
|
|
3099
|
+
}
|
|
3100
|
+
const current = currentEventOwners.currentRecordByPreparedId.get(entry.record.id);
|
|
3101
|
+
if (current && persistenceProtectedPreparedEventIds.has(entry.record.id)) {
|
|
3102
|
+
return current;
|
|
3103
|
+
}
|
|
3104
|
+
return reconciledRecordByPreparedId.get(entry.record.id) ?? entry.record;
|
|
3105
|
+
}),
|
|
3106
|
+
retainedPreparedIds: new Set([
|
|
3107
|
+
...reconciled.retainedPreparedIds,
|
|
3108
|
+
...persistenceProtectedPreparedEventIds,
|
|
3109
|
+
]),
|
|
3110
|
+
skippedDuplicateCount: reconciled.skippedDuplicateCount
|
|
3111
|
+
+ persistenceProtectedPreparedEventIds.size
|
|
3112
|
+
- repairedProtectedPreparedEventCount,
|
|
3113
|
+
};
|
|
3114
|
+
const eventAppendPlan = await buildJsonlAppendPlan(vaultRoot, eventReconciliation.appendEntries, {
|
|
3115
|
+
dedupeWithinPlan: true,
|
|
3116
|
+
forceAppendIds: eventReconciliation.forceAppendIds,
|
|
3117
|
+
});
|
|
3118
|
+
const eventRecords = eventReconciliation.records;
|
|
3119
|
+
const canonicalIdByPreparedId = mapPreparedDeviceEventsToCanonicalIds(deviceBatchPlan.preparedEvents, eventRecords);
|
|
3120
|
+
const appendedEventRecordIds = new Set(eventAppendPlan.appendedRecordIds);
|
|
3121
|
+
const appendedPreparedEventIds = new Set([...eventReconciliation.appendRecordIdByPreparedRecordId.entries()]
|
|
3122
|
+
.filter(([, recordId]) => appendedEventRecordIds.has(recordId))
|
|
3123
|
+
.map(([preparedRecordId]) => preparedRecordId));
|
|
3124
|
+
const associablePreparedEventIds = new Set([
|
|
3125
|
+
...deviceBatchPlan.preparedEvents
|
|
3126
|
+
.filter((entry) => baselineRetainedPreparedIds.has(entry.record.id)
|
|
3127
|
+
&& hasAuthorizedCurrentDeviceEventOutput(currentEventOwners, entry.record.id))
|
|
3128
|
+
.map((entry) => entry.record.id),
|
|
3129
|
+
...[...appendedPreparedEventIds].filter((preparedId) => baselineRetainedPreparedIds.has(preparedId)),
|
|
3130
|
+
]);
|
|
3131
|
+
const canonicalEventRecords = eventRecords.filter((_, index) => {
|
|
3132
|
+
const preparedId = deviceBatchPlan.preparedEvents[index]?.record.id;
|
|
3133
|
+
return preparedId !== undefined && associablePreparedEventIds.has(preparedId);
|
|
3134
|
+
});
|
|
3135
|
+
const persistenceEvidenceRolesByPreparedRecordId = new Map(deviceBatchPlan.preparedEvents
|
|
3136
|
+
.filter((entry) => associablePreparedEventIds.has(entry.record.id)
|
|
3137
|
+
&& acceptedEvidenceRolesByPreparedRecordId.has(entry.record.id))
|
|
3138
|
+
.map((entry) => [
|
|
3139
|
+
entry.record.id,
|
|
3140
|
+
acceptedEvidenceRolesByPreparedRecordId.get(entry.record.id) ?? [],
|
|
3141
|
+
]));
|
|
3142
|
+
const persistencePreparedEvents = deviceBatchPlan.preparedEvents.filter((entry) => associablePreparedEventIds.has(entry.record.id)
|
|
3143
|
+
&& persistenceEvidenceRolesByPreparedRecordId.has(entry.record.id));
|
|
3144
|
+
const hasAppendedOutputs = appendedPreparedEventIds.size > 0
|
|
3145
|
+
|| sampleAppendPlan.appendedRecordIds.length > 0;
|
|
3146
|
+
const eventIdsByEvidenceRole = new Map();
|
|
3147
|
+
for (const entry of deviceBatchPlan.preparedEvents) {
|
|
3148
|
+
const canonicalEventId = canonicalIdByPreparedId.get(entry.record.id);
|
|
3149
|
+
if (!canonicalEventId) {
|
|
3150
|
+
continue;
|
|
3151
|
+
}
|
|
3152
|
+
for (const role of persistenceEvidenceRolesByPreparedRecordId.get(entry.record.id) ?? []) {
|
|
3153
|
+
const eventIds = eventIdsByEvidenceRole.get(role) ?? new Set();
|
|
3154
|
+
eventIds.add(canonicalEventId);
|
|
3155
|
+
eventIdsByEvidenceRole.set(role, eventIds);
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
const shouldCheckReceiptNovelty = !hasAppendedOutputs;
|
|
3159
|
+
const novelty = deviceBatchPlan.preparedEvidenceParts.length > 0 || (shouldCheckReceiptNovelty && deviceBatchPlan.ingestReceipt)
|
|
3160
|
+
? await selectNovelIntegrationIngestEvidence({
|
|
3161
|
+
vaultRoot,
|
|
3162
|
+
provider: deviceBatchPlan.provider,
|
|
3163
|
+
accountId: deviceBatchPlan.accountId,
|
|
3164
|
+
importedAt: deviceBatchPlan.importedAt,
|
|
3165
|
+
parts: deviceBatchPlan.preparedEvidenceParts,
|
|
3166
|
+
receipt: shouldCheckReceiptNovelty ? deviceBatchPlan.ingestReceipt : undefined,
|
|
3167
|
+
eventIdsByRole: eventIdsByEvidenceRole,
|
|
3168
|
+
sampleIds: new Set(sampleRecords.map((record) => record.id)),
|
|
3169
|
+
})
|
|
3170
|
+
: { parts: [], receiptIsNovel: false };
|
|
3171
|
+
const shouldPersistDelivery = hasAppendedOutputs
|
|
3172
|
+
|| novelty.parts.length > 0
|
|
3173
|
+
|| novelty.receiptIsNovel
|
|
3174
|
+
|| evidenceRepairRequired;
|
|
3175
|
+
const retainedEvidenceParts = shouldPersistDelivery
|
|
3176
|
+
? deviceBatchPlan.preparedEvidenceParts
|
|
3177
|
+
: [];
|
|
3178
|
+
const retainedEvidenceRoles = new Set(retainedEvidenceParts.map((part) => part.role));
|
|
3179
|
+
const retainedEvidenceRolesByPreparedRecordId = new Map();
|
|
3180
|
+
for (const entry of deviceBatchPlan.preparedEvents) {
|
|
3181
|
+
retainedEvidenceRolesByPreparedRecordId.set(entry.record.id, (persistenceEvidenceRolesByPreparedRecordId.get(entry.record.id) ?? []).filter((role) => retainedEvidenceRoles.has(role)));
|
|
3182
|
+
}
|
|
3183
|
+
const eventOutputs = buildIntegrationEventOutputs(shouldPersistDelivery ? persistencePreparedEvents : [], canonicalIdByPreparedId, retainedEvidenceRolesByPreparedRecordId);
|
|
3184
|
+
const buildNoopResult = () => ({
|
|
3185
|
+
applied: false,
|
|
3186
|
+
ingestId: null,
|
|
3187
|
+
ingestShardPath: null,
|
|
3188
|
+
provider: deviceBatchPlan.provider,
|
|
3189
|
+
accountId: deviceBatchPlan.accountId,
|
|
3190
|
+
importedAt: deviceBatchPlan.importedAt,
|
|
3191
|
+
events: canonicalEventRecords,
|
|
3192
|
+
samples: sampleRecords,
|
|
3193
|
+
eventShardPaths: eventTargetShardPaths,
|
|
3194
|
+
sampleShardPaths: sampleAppendPlan.targetShardPaths,
|
|
3195
|
+
evidencePartCount: deviceBatchPlan.preparedEvidenceParts.length,
|
|
3196
|
+
persistedEvidencePartCount: 0,
|
|
3197
|
+
auditPath: null,
|
|
3198
|
+
});
|
|
3199
|
+
return {
|
|
3200
|
+
buildNoopResult,
|
|
3201
|
+
eventAppendPlan,
|
|
3202
|
+
eventOutputs,
|
|
3203
|
+
eventReconciliation,
|
|
3204
|
+
canonicalEventRecords,
|
|
3205
|
+
retainedEvidenceParts,
|
|
3206
|
+
shouldPersistDelivery,
|
|
3207
|
+
};
|
|
3208
|
+
};
|
|
3209
|
+
let exactState = inspectExactDeliveryState();
|
|
3210
|
+
if (exactState.authorizedStoredDelivery) {
|
|
3211
|
+
return buildExactNoopResult(exactState.authorizedStoredDelivery);
|
|
3212
|
+
}
|
|
3213
|
+
let persistence;
|
|
3214
|
+
try {
|
|
3215
|
+
persistence = await preparePersistence(exactState);
|
|
3216
|
+
}
|
|
3217
|
+
catch (error) {
|
|
3218
|
+
await ensureFullInspection();
|
|
3219
|
+
exactState = inspectExactDeliveryState();
|
|
3220
|
+
if (exactState.authorizedStoredDelivery) {
|
|
3221
|
+
return buildExactNoopResult(exactState.authorizedStoredDelivery);
|
|
3222
|
+
}
|
|
3223
|
+
if (!exactState.evidenceRepairRequired) {
|
|
3224
|
+
throw error;
|
|
3225
|
+
}
|
|
3226
|
+
persistence = await preparePersistence(exactState);
|
|
3227
|
+
}
|
|
3228
|
+
const unresolvedBaselineMember = unresolvedBaselinePreparedIds.size > 0;
|
|
3229
|
+
const assertInspectionCanAuthorizeNoop = () => {
|
|
3230
|
+
if (unresolvedBaselineMember
|
|
3231
|
+
&& (!ingestIdInspection.historyComplete || ingestIdInspection.unsafe)) {
|
|
3232
|
+
throw new VaultError("INTEGRATION_INGEST_EVENT_MAPPING_AMBIGUOUS", "Unresolved device event member has no authoritative exact-delivery inspection.");
|
|
3233
|
+
}
|
|
3234
|
+
};
|
|
3235
|
+
const incompleteInspectionCannotAuthorizeNoop = unresolvedBaselineMember
|
|
3236
|
+
&& (!ingestIdInspection.historyComplete || ingestIdInspection.unsafe);
|
|
3237
|
+
if (persistence.shouldPersistDelivery || incompleteInspectionCannotAuthorizeNoop) {
|
|
3238
|
+
await ensureFullInspection();
|
|
3239
|
+
const authoritativeExactState = inspectExactDeliveryState();
|
|
3240
|
+
if (authoritativeExactState.authorizedStoredDelivery) {
|
|
3241
|
+
return buildExactNoopResult(authoritativeExactState.authorizedStoredDelivery);
|
|
3242
|
+
}
|
|
3243
|
+
persistence = await preparePersistence(authoritativeExactState);
|
|
3244
|
+
}
|
|
3245
|
+
if (!persistence.shouldPersistDelivery) {
|
|
3246
|
+
assertInspectionCanAuthorizeNoop();
|
|
3247
|
+
return persistence.buildNoopResult();
|
|
3248
|
+
}
|
|
3249
|
+
const { buildNoopResult, eventAppendPlan, eventOutputs, eventReconciliation, canonicalEventRecords, retainedEvidenceParts, } = persistence;
|
|
3250
|
+
const currentImportIdOccupied = ingestIdInspection.entriesById.has(deviceBatchPlan.importId)
|
|
3251
|
+
|| ingestIdInspection.invalidIds.has(deviceBatchPlan.importId);
|
|
3252
|
+
const finalAssociationImportId = buildAssociationImportId(eventOutputs);
|
|
3253
|
+
const persistedImportId = currentImportIdOccupied
|
|
3254
|
+
? finalAssociationImportId
|
|
3255
|
+
: deviceBatchPlan.importId;
|
|
1863
3256
|
const ingestRecord = buildIntegrationIngestRecord({
|
|
1864
|
-
id:
|
|
3257
|
+
id: persistedImportId,
|
|
1865
3258
|
provider: deviceBatchPlan.provider,
|
|
1866
3259
|
accountId: deviceBatchPlan.accountId,
|
|
1867
3260
|
source: deviceBatchPlan.source,
|
|
1868
3261
|
importedAt: deviceBatchPlan.importedAt,
|
|
1869
3262
|
receipt: deviceBatchPlan.ingestReceipt,
|
|
1870
|
-
parts:
|
|
3263
|
+
parts: retainedEvidenceParts,
|
|
1871
3264
|
eventOutputs,
|
|
1872
3265
|
eventIdsComplete: true,
|
|
1873
3266
|
sampleIds: sampleRecords.map((record) => record.id),
|
|
@@ -1876,15 +3269,29 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
|
|
|
1876
3269
|
sampleCount: sampleRecords.length,
|
|
1877
3270
|
provenance: deviceBatchPlan.provenance,
|
|
1878
3271
|
});
|
|
1879
|
-
const
|
|
3272
|
+
const persistedImportIdWasInspected = ingestIdInspection.requestedIds.has(persistedImportId);
|
|
3273
|
+
const ingestAppendPlan = !persistedImportIdWasInspected
|
|
3274
|
+
|| (ingestIdInspection.unsafe && !ingestIdInspection.failOpenAppendAllowed)
|
|
3275
|
+
? await buildIntegrationIngestAppendPlan(vaultRoot, [ingestRecord], {
|
|
3276
|
+
allowArchivedShardAmendments: true,
|
|
3277
|
+
})
|
|
3278
|
+
: buildIntegrationIngestAppendPlanFromInspection([ingestRecord], ingestIdInspection, {
|
|
3279
|
+
allowArchivedShardAmendments: true,
|
|
3280
|
+
});
|
|
1880
3281
|
const [ingestShardPath] = ingestAppendPlan.targetShardPaths;
|
|
1881
3282
|
if (!ingestShardPath) {
|
|
1882
3283
|
throw new VaultError("INTEGRATION_INGEST_SHARD_INVALID", `No integration ingest shard was prepared for "${ingestRecord.id}".`);
|
|
1883
3284
|
}
|
|
3285
|
+
if (ingestAppendPlan.appendedIds.length === 0
|
|
3286
|
+
&& eventAppendPlan.appendedRecordIds.length === 0
|
|
3287
|
+
&& sampleAppendPlan.appendedRecordIds.length === 0) {
|
|
3288
|
+
assertInspectionCanAuthorizeNoop();
|
|
3289
|
+
return buildNoopResult();
|
|
3290
|
+
}
|
|
1884
3291
|
return runCanonicalWrite({
|
|
1885
3292
|
vaultRoot,
|
|
1886
3293
|
operationType: "device_batch_import",
|
|
1887
|
-
summary: `Import ${deviceBatchPlan.provider} device batch ${
|
|
3294
|
+
summary: `Import ${deviceBatchPlan.provider} device batch ${persistedImportId}`,
|
|
1888
3295
|
occurredAt: deviceBatchPlan.effectiveOccurredAt,
|
|
1889
3296
|
mutate: async ({ batch }) => {
|
|
1890
3297
|
await stageIntegrationIngestAppendPlan(batch, ingestAppendPlan);
|
|
@@ -1902,26 +3309,28 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
|
|
|
1902
3309
|
commandName: "core.importDeviceBatch",
|
|
1903
3310
|
summary: buildDeviceBatchAuditSummary({
|
|
1904
3311
|
provider: deviceBatchPlan.provider,
|
|
1905
|
-
eventCount:
|
|
3312
|
+
eventCount: eventOutputs.length,
|
|
1906
3313
|
sampleCount: sampleRecords.length,
|
|
1907
3314
|
skippedDuplicateCount: eventReconciliation.skippedDuplicateCount,
|
|
1908
3315
|
supersededCount: eventReconciliation.supersededCount,
|
|
1909
3316
|
}),
|
|
1910
3317
|
occurredAt: deviceBatchPlan.importedAt,
|
|
1911
3318
|
files: touchedPaths,
|
|
1912
|
-
targetIds: [
|
|
3319
|
+
targetIds: [persistedImportId],
|
|
1913
3320
|
});
|
|
1914
3321
|
return {
|
|
1915
|
-
|
|
3322
|
+
applied: true,
|
|
3323
|
+
ingestId: persistedImportId,
|
|
1916
3324
|
ingestShardPath,
|
|
1917
3325
|
provider: deviceBatchPlan.provider,
|
|
1918
3326
|
accountId: deviceBatchPlan.accountId,
|
|
1919
3327
|
importedAt: deviceBatchPlan.importedAt,
|
|
1920
|
-
events:
|
|
3328
|
+
events: canonicalEventRecords,
|
|
1921
3329
|
samples: sampleRecords,
|
|
1922
3330
|
eventShardPaths: eventTargetShardPaths,
|
|
1923
3331
|
sampleShardPaths: sampleAppendPlan.targetShardPaths,
|
|
1924
3332
|
evidencePartCount: deviceBatchPlan.preparedEvidenceParts.length,
|
|
3333
|
+
persistedEvidencePartCount: retainedEvidenceParts.length,
|
|
1925
3334
|
auditPath: audit.relativePath,
|
|
1926
3335
|
};
|
|
1927
3336
|
},
|
|
@@ -1931,14 +3340,29 @@ const EVENT_BATCH_FAILURE_REPORT_LIMIT = 20;
|
|
|
1931
3340
|
// importEventBatch is public API surface, so the batch-shape invariants live
|
|
1932
3341
|
// here rather than in CLI adapters: payloads must be a non-empty array of
|
|
1933
3342
|
// plain objects.
|
|
1934
|
-
function normalizeImportEventBatchPayloads(value) {
|
|
3343
|
+
function normalizeImportEventBatchPayloads(value, signal) {
|
|
1935
3344
|
if (!Array.isArray(value)) {
|
|
1936
3345
|
throw new VaultError("EVENT_BATCH_INVALID", "Event batch payloads must be an array.");
|
|
1937
3346
|
}
|
|
1938
3347
|
if (value.length === 0) {
|
|
1939
3348
|
throw new VaultError("EVENT_BATCH_EMPTY", "Event batch payloads must not be empty.");
|
|
1940
3349
|
}
|
|
1941
|
-
return value.map((entry, index) =>
|
|
3350
|
+
return value.map((entry, index) => {
|
|
3351
|
+
signal?.throwIfAborted();
|
|
3352
|
+
return assertPlainObject(entry, "EVENT_BATCH_INVALID", `Event batch payload ${index + 1} must be a plain object.`);
|
|
3353
|
+
});
|
|
3354
|
+
}
|
|
3355
|
+
function normalizeImportEventBatchDecisions(value, signal) {
|
|
3356
|
+
if (!Array.isArray(value)) {
|
|
3357
|
+
throw new VaultError("EVENT_BATCH_INVALID", "Event batch decisions must be an array.");
|
|
3358
|
+
}
|
|
3359
|
+
if (value.length === 0) {
|
|
3360
|
+
throw new VaultError("EVENT_BATCH_EMPTY", "Event batch decisions must not be empty.");
|
|
3361
|
+
}
|
|
3362
|
+
return value.map((entry, index) => {
|
|
3363
|
+
signal?.throwIfAborted();
|
|
3364
|
+
return assertPlainObject(entry, "EVENT_BATCH_INVALID", `Event batch decision ${index + 1} must be a plain object.`);
|
|
3365
|
+
});
|
|
1942
3366
|
}
|
|
1943
3367
|
// Bulk canonical event import: every payload is validated through the same
|
|
1944
3368
|
// strict contract path as the single-event upsert before anything is staged,
|
|
@@ -1947,15 +3371,68 @@ function normalizeImportEventBatchPayloads(value) {
|
|
|
1947
3371
|
// resourceType + resourceId + facet, even when a corrected occurredAt moves
|
|
1948
3372
|
// the row to another monthly shard) and land in one canonical write with one
|
|
1949
3373
|
// audit record. Dry-run by default; `apply` commits.
|
|
1950
|
-
export async function importEventBatch(
|
|
1951
|
-
const
|
|
3374
|
+
export async function importEventBatch(input) {
|
|
3375
|
+
const { vaultRoot, apply = false, signal } = input;
|
|
3376
|
+
signal?.throwIfAborted();
|
|
3377
|
+
const usesPayloads = "payloads" in input && input.payloads !== undefined;
|
|
3378
|
+
const usesDecisions = "decisions" in input && input.decisions !== undefined;
|
|
3379
|
+
if (usesPayloads === usesDecisions) {
|
|
3380
|
+
throw new VaultError("EVENT_BATCH_INVALID", "Event batch must define exactly one of payloads or decisions.");
|
|
3381
|
+
}
|
|
3382
|
+
const normalizedRows = usesDecisions
|
|
3383
|
+
? normalizeImportEventBatchDecisions(input.decisions, signal)
|
|
3384
|
+
: normalizeImportEventBatchPayloads(input.payloads, signal);
|
|
1952
3385
|
const vault = await loadVault({ vaultRoot });
|
|
1953
|
-
const
|
|
3386
|
+
const decisions = [];
|
|
1954
3387
|
const failures = [];
|
|
1955
|
-
|
|
3388
|
+
const recordedAt = new Date().toISOString();
|
|
3389
|
+
normalizedRows.forEach((row, index) => {
|
|
3390
|
+
signal?.throwIfAborted();
|
|
1956
3391
|
try {
|
|
1957
|
-
|
|
1958
|
-
|
|
3392
|
+
if (!usesDecisions) {
|
|
3393
|
+
const record = buildPublicEventImportRecord(row, vault.metadata.timezone);
|
|
3394
|
+
decisions.push({
|
|
3395
|
+
action: "upsert",
|
|
3396
|
+
allowsKindReplacement: false,
|
|
3397
|
+
entry: { relativePath: toEventLedgerFile(record.occurredAt), record },
|
|
3398
|
+
});
|
|
3399
|
+
return;
|
|
3400
|
+
}
|
|
3401
|
+
const parsed = safeParseContract(eventImportDecisionSchema, row);
|
|
3402
|
+
if (!parsed.success) {
|
|
3403
|
+
throw new Error(parsed.errors.join("; "));
|
|
3404
|
+
}
|
|
3405
|
+
const decision = parsed.data;
|
|
3406
|
+
if (decision.action === "retract") {
|
|
3407
|
+
const markerRecord = buildPublicEventImportRecord({
|
|
3408
|
+
kind: "note",
|
|
3409
|
+
occurredAt: decision.externalRef.version,
|
|
3410
|
+
recordedAt,
|
|
3411
|
+
source: "import",
|
|
3412
|
+
title: "Retracted imported source record",
|
|
3413
|
+
note: decision.reason,
|
|
3414
|
+
noteType: EVENT_IMPORT_RETRACTION_MARKER_NOTE_TYPE,
|
|
3415
|
+
...(decision.evidence ? { evidence: decision.evidence } : {}),
|
|
3416
|
+
externalRef: decision.externalRef,
|
|
3417
|
+
}, vault.metadata.timezone);
|
|
3418
|
+
decisions.push({
|
|
3419
|
+
action: "retract",
|
|
3420
|
+
externalRef: decision.externalRef,
|
|
3421
|
+
evidence: decision.evidence,
|
|
3422
|
+
reason: decision.reason,
|
|
3423
|
+
markerEntry: {
|
|
3424
|
+
relativePath: toEventLedgerFile(markerRecord.occurredAt),
|
|
3425
|
+
record: markerRecord,
|
|
3426
|
+
},
|
|
3427
|
+
});
|
|
3428
|
+
return;
|
|
3429
|
+
}
|
|
3430
|
+
const record = buildPublicEventImportRecord({ ...decision.payload }, vault.metadata.timezone);
|
|
3431
|
+
decisions.push({
|
|
3432
|
+
action: "upsert",
|
|
3433
|
+
allowsKindReplacement: true,
|
|
3434
|
+
entry: { relativePath: toEventLedgerFile(record.occurredAt), record },
|
|
3435
|
+
});
|
|
1959
3436
|
}
|
|
1960
3437
|
catch (error) {
|
|
1961
3438
|
failures.push({
|
|
@@ -1965,45 +3442,46 @@ export async function importEventBatch({ vaultRoot, payloads, apply = false, })
|
|
|
1965
3442
|
}
|
|
1966
3443
|
});
|
|
1967
3444
|
if (failures.length > 0) {
|
|
1968
|
-
throw new VaultError("EVENT_BATCH_INVALID", `${failures.length} of ${
|
|
3445
|
+
throw new VaultError("EVENT_BATCH_INVALID", `${failures.length} of ${normalizedRows.length} event import decision(s) failed validation; nothing was imported.`, {
|
|
1969
3446
|
failureCount: failures.length,
|
|
1970
3447
|
failures: failures.slice(0, EVENT_BATCH_FAILURE_REPORT_LIMIT),
|
|
1971
3448
|
});
|
|
1972
3449
|
}
|
|
1973
|
-
|
|
3450
|
+
signal?.throwIfAborted();
|
|
3451
|
+
const reconciliation = await reconcileEventImportDecisionsByExternalRef(vaultRoot, decisions, signal);
|
|
1974
3452
|
const appendPlan = await buildJsonlAppendPlan(vaultRoot, reconciliation.appendEntries, {
|
|
1975
3453
|
dedupeWithinPlan: true,
|
|
1976
3454
|
forceAppendIds: reconciliation.forceAppendIds,
|
|
3455
|
+
signal,
|
|
1977
3456
|
});
|
|
3457
|
+
signal?.throwIfAborted();
|
|
1978
3458
|
// Target shards come from the prepared rows (pre-reconcile), matching
|
|
1979
3459
|
// importDeviceBatch: an all-skipped batch still reports the shards it
|
|
1980
3460
|
// evaluated.
|
|
1981
|
-
const eventTargetShardPaths = [
|
|
1982
|
-
...new Set(entries.map((entry) => entry.relativePath)),
|
|
1983
|
-
].sort();
|
|
1984
3461
|
const appendedCount = appendPlan.appendedRecordIds.length;
|
|
1985
|
-
const eventIds = appendPlan.appendedRecordIds;
|
|
1986
|
-
const supersededCount = reconciliation.supersededCount;
|
|
1987
3462
|
const counts = {
|
|
1988
|
-
receivedCount:
|
|
1989
|
-
createdCount:
|
|
1990
|
-
skippedExistingCount:
|
|
1991
|
-
supersededCount,
|
|
1992
|
-
|
|
3463
|
+
receivedCount: normalizedRows.length,
|
|
3464
|
+
createdCount: reconciliation.createdCount,
|
|
3465
|
+
skippedExistingCount: reconciliation.skippedExistingCount,
|
|
3466
|
+
supersededCount: reconciliation.supersededCount,
|
|
3467
|
+
retractedCount: reconciliation.retractedCount,
|
|
3468
|
+
eventIds: reconciliation.eventIds,
|
|
3469
|
+
retractedEventIds: reconciliation.retractedEventIds,
|
|
1993
3470
|
};
|
|
1994
3471
|
if (!apply || appendedCount === 0) {
|
|
1995
3472
|
return {
|
|
1996
3473
|
applied: false,
|
|
1997
3474
|
...counts,
|
|
1998
|
-
eventShardPaths:
|
|
3475
|
+
eventShardPaths: reconciliation.eventShardPaths,
|
|
1999
3476
|
auditPath: null,
|
|
2000
3477
|
};
|
|
2001
3478
|
}
|
|
2002
|
-
const occurredAt = earliestTimestamp(
|
|
3479
|
+
const occurredAt = earliestTimestamp(reconciliation.appendEntries.map((entry) => entry.record.occurredAt));
|
|
3480
|
+
signal?.throwIfAborted();
|
|
2003
3481
|
return runCanonicalWrite({
|
|
2004
3482
|
vaultRoot,
|
|
2005
3483
|
operationType: "event_batch_import",
|
|
2006
|
-
summary: `Import event batch with ${
|
|
3484
|
+
summary: `Import event batch with ${normalizedRows.length} decision(s)`,
|
|
2007
3485
|
occurredAt,
|
|
2008
3486
|
mutate: async ({ batch }) => {
|
|
2009
3487
|
await stageJsonlAppendPlan(batch, appendPlan);
|
|
@@ -2013,16 +3491,17 @@ export async function importEventBatch({ vaultRoot, payloads, apply = false, })
|
|
|
2013
3491
|
action: "event_upsert",
|
|
2014
3492
|
commandName: "core.importEventBatch",
|
|
2015
3493
|
summary: `Imported event batch: ${counts.createdCount} created, ` +
|
|
2016
|
-
`${counts.supersededCount}
|
|
3494
|
+
`${counts.supersededCount} superseded, ` +
|
|
3495
|
+
`${counts.retractedCount} retracted, ` +
|
|
2017
3496
|
`${counts.skippedExistingCount} skipped existing of ${counts.receivedCount} received.`,
|
|
2018
3497
|
occurredAt,
|
|
2019
3498
|
files: appendPlan.appendedShardPaths,
|
|
2020
|
-
targetIds: appendPlan.appendedRecordIds.slice(0, AUDIT_TARGET_ID_LIMIT),
|
|
3499
|
+
targetIds: [...new Set(appendPlan.appendedRecordIds)].slice(0, AUDIT_TARGET_ID_LIMIT),
|
|
2021
3500
|
});
|
|
2022
3501
|
return {
|
|
2023
3502
|
applied: true,
|
|
2024
3503
|
...counts,
|
|
2025
|
-
eventShardPaths:
|
|
3504
|
+
eventShardPaths: reconciliation.eventShardPaths,
|
|
2026
3505
|
auditPath: audit.relativePath,
|
|
2027
3506
|
};
|
|
2028
3507
|
},
|