@vellumai/assistant 0.10.3-dev.202606291517.f0c68f7 → 0.10.3-dev.202606291709.2b4d83d
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/ARCHITECTURE.md +13 -13
- package/package.json +1 -1
- package/src/__tests__/app-builder-tool-scripts.test.ts +2 -2
- package/src/__tests__/app-bundler.test.ts +1 -1
- package/src/__tests__/app-conversation-ids-backfill.test.ts +2 -2
- package/src/__tests__/app-conversation-ids.test.ts +1 -1
- package/src/__tests__/app-dir-path-guard.test.ts +2 -2
- package/src/__tests__/app-executors.test.ts +1 -1
- package/src/__tests__/app-git-history.test.ts +2 -2
- package/src/__tests__/app-git-service.test.ts +2 -2
- package/src/__tests__/app-routes-csp.test.ts +2 -2
- package/src/__tests__/app-source-watcher.test.ts +1 -1
- package/src/__tests__/app-store-dir-names.test.ts +1 -1
- package/src/__tests__/approval-cascade.test.ts +1 -1
- package/src/__tests__/attachments-store.test.ts +2 -2
- package/src/__tests__/audit-log-rotation.test.ts +3 -3
- package/src/__tests__/auth-fallback-events-store.test.ts +4 -4
- package/src/__tests__/auto-analysis-end-to-end.test.ts +1 -1
- package/src/__tests__/background-workers-disk-pressure.test.ts +2 -2
- package/src/__tests__/btw-routes.test.ts +1 -1
- package/src/__tests__/call-controller.test.ts +2 -2
- package/src/__tests__/call-domain.test.ts +1 -1
- package/src/__tests__/cancel-resolves-conversation-key.test.ts +1 -1
- package/src/__tests__/canonical-guardian-store.test.ts +1 -1
- package/src/__tests__/channel-approval-routes.test.ts +3 -3
- package/src/__tests__/channel-delivery-store.test.ts +1 -1
- package/src/__tests__/channel-guardian.test.ts +7 -7
- package/src/__tests__/channel-retry-sweep.test.ts +45 -0
- package/src/__tests__/compaction-events.test.ts +2 -2
- package/src/__tests__/config-watcher-cleanup-throttle.test.ts +2 -2
- package/src/__tests__/config-watcher-skill-reseed.test.ts +1 -1
- package/src/__tests__/confirmation-request-guardian-bridge.test.ts +2 -2
- package/src/__tests__/context-search-conversations-source.test.ts +1 -1
- package/src/__tests__/conversation-abort-tool-results.test.ts +1 -1
- package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +33 -5
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +2 -2
- package/src/__tests__/conversation-agent-loop.test.ts +7 -7
- package/src/__tests__/conversation-analysis-routes.test.ts +1 -1
- package/src/__tests__/conversation-app-control-instantiation.test.ts +1 -1
- package/src/__tests__/conversation-app-control-lifecycle.test.ts +2 -2
- package/src/__tests__/conversation-attention-store.test.ts +1 -1
- package/src/__tests__/conversation-attention-telegram.test.ts +1 -1
- package/src/__tests__/conversation-confirmation-signals.test.ts +1 -1
- package/src/__tests__/conversation-directories-parse.test.ts +1 -1
- package/src/__tests__/conversation-disk-view-integration.test.ts +4 -4
- package/src/__tests__/conversation-disk-view.test.ts +12 -12
- package/src/__tests__/conversation-evictor.test.ts +32 -7
- package/src/__tests__/conversation-fork-crud.test.ts +6 -6
- package/src/__tests__/conversation-fork-retrospective.test.ts +1 -1
- package/src/__tests__/conversation-key-store-disk-view.test.ts +1 -1
- package/src/__tests__/conversation-process-app-control-preactivation.test.ts +2 -2
- package/src/__tests__/conversation-process-callsite.test.ts +1 -1
- package/src/__tests__/conversation-provider-retry-repair.test.ts +1 -1
- package/src/__tests__/conversation-queue.test.ts +6 -3
- package/src/__tests__/conversation-routes-disk-view.test.ts +7 -7
- package/src/__tests__/conversation-routes-guardian-reply.test.ts +2 -2
- package/src/__tests__/conversation-routes-slash-commands.test.ts +6 -4
- package/src/__tests__/conversation-runtime-workspace.test.ts +1 -1
- package/src/__tests__/conversation-skill-tools.test.ts +2 -2
- package/src/__tests__/conversation-slash-queue.test.ts +2 -2
- package/src/__tests__/conversation-slash-unknown.test.ts +2 -2
- package/src/__tests__/conversation-speed-override.test.ts +1 -1
- package/src/__tests__/conversation-surfaces-activation-emit.test.ts +1 -1
- package/src/__tests__/conversation-sync-tags.test.ts +1 -1
- package/src/__tests__/conversation-title-service.test.ts +1 -1
- package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +1 -1
- package/src/__tests__/conversation-tool-setup-attribution.test.ts +1 -1
- package/src/__tests__/conversation-unread-route.test.ts +2 -2
- package/src/__tests__/conversation-workspace-cache-state.test.ts +2 -2
- package/src/__tests__/conversation-workspace-injection.test.ts +2 -2
- package/src/__tests__/conversation-workspace-tool-tracking.test.ts +2 -2
- package/src/__tests__/db-conversation-inference-profile-migration.test.ts +2 -2
- package/src/__tests__/deterministic-verification-control-plane.test.ts +2 -2
- package/src/__tests__/dm-persistence.test.ts +1 -1
- package/src/__tests__/edit-propagation.test.ts +1 -1
- package/src/__tests__/empty-state-greeting-cache.test.ts +1 -1
- package/src/__tests__/exploration-drift-hook.test.ts +7 -24
- package/src/__tests__/filing-service.test.ts +1 -1
- package/src/__tests__/guardian-card-withdrawal.test.ts +1 -1
- package/src/__tests__/guardian-decision-primitive-canonical.test.ts +1 -1
- package/src/__tests__/guardian-expiry-notifier.test.ts +2 -2
- package/src/__tests__/guardian-principal-id-roundtrip.test.ts +1 -1
- package/src/__tests__/guardian-routing-invariants.test.ts +1 -1
- package/src/__tests__/guardian-verification-voice-binding.test.ts +2 -2
- package/src/__tests__/handlers-user-message-approval-consumption.test.ts +2 -2
- package/src/__tests__/heartbeat-disk-pressure.test.ts +1 -1
- package/src/__tests__/heartbeat-service.test.ts +1 -1
- package/src/__tests__/helpers/create-guardian-binding.ts +1 -1
- package/src/__tests__/http-conversation-lineage.test.ts +1 -1
- package/src/__tests__/http-user-message-parity.test.ts +2 -2
- package/src/__tests__/inbound-slack-persistence.test.ts +1 -1
- package/src/__tests__/internal-telemetry-routes.test.ts +1 -1
- package/src/__tests__/media-stream-server-integration.test.ts +1 -1
- package/src/__tests__/memory-jobs-worker-lanes.test.ts +1 -1
- package/src/__tests__/messaging-send-tool.test.ts +1 -1
- package/src/__tests__/non-member-access-request.test.ts +1 -1
- package/src/__tests__/notification-candidate-guardian-context.test.ts +1 -1
- package/src/__tests__/oauth-provider-visibility.test.ts +1 -1
- package/src/__tests__/oauth-store.test.ts +1 -1
- package/src/__tests__/outbound-slack-persistence.test.ts +2 -2
- package/src/__tests__/persistence-layering-guard.test.ts +3 -43
- package/src/__tests__/persistence-secret-redaction.test.ts +1 -1
- package/src/__tests__/platform-bash-auto-approve.test.ts +2 -2
- package/src/__tests__/plugin-import-boundary-guard.test.ts +3 -8
- package/src/__tests__/process-message-background-slack.test.ts +2 -2
- package/src/__tests__/process-message-display-content.test.ts +1 -1
- package/src/__tests__/processing-flag-persist-failure.test.ts +1 -1
- package/src/__tests__/prune-jobs-changes-parser.test.ts +1 -1
- package/src/__tests__/prune-old-conversations-job.test.ts +1 -1
- package/src/__tests__/published-app-updater.test.ts +3 -3
- package/src/__tests__/reaction-persistence.test.ts +2 -2
- package/src/__tests__/relay-server.test.ts +7 -7
- package/src/__tests__/require-fresh-approval.test.ts +1 -1
- package/src/__tests__/resolve-app-id.test.ts +3 -3
- package/src/__tests__/runtime-attachment-metadata.test.ts +2 -2
- package/src/__tests__/runtime-events-sse-bilingual.test.ts +1 -1
- package/src/__tests__/runtime-events-sse-parity.test.ts +1 -1
- package/src/__tests__/runtime-events-sse-reconnect.test.ts +1 -1
- package/src/__tests__/runtime-events-sse.test.ts +1 -1
- package/src/__tests__/schedule-routes.test.ts +1 -1
- package/src/__tests__/scoped-approval-grants.test.ts +1 -1
- package/src/__tests__/scoped-grant-security-matrix.test.ts +1 -1
- package/src/__tests__/secret-ingress-channel.test.ts +1 -1
- package/src/__tests__/secret-ingress-http.test.ts +2 -2
- package/src/__tests__/send-endpoint-busy.test.ts +4 -4
- package/src/__tests__/skill-projection-feature-flag.test.ts +1 -1
- package/src/__tests__/skill-projection.benchmark.test.ts +1 -1
- package/src/__tests__/slack-messaging-token-resolution.test.ts +1 -1
- package/src/__tests__/slack-reaction-canonical-approval.test.ts +2 -2
- package/src/__tests__/slack-share-routes.test.ts +1 -1
- package/src/__tests__/starter-task-flow.test.ts +1 -1
- package/src/__tests__/subagent-tool-gate-mode.test.ts +1 -1
- package/src/__tests__/suggestion-routes.test.ts +1 -1
- package/src/__tests__/task-progress-nudge-hook.test.ts +65 -101
- package/src/__tests__/title-generate-hook.test.ts +2 -2
- package/src/__tests__/tool-audit-listener.test.ts +1 -1
- package/src/__tests__/tool-error-hook.test.ts +2 -1
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +2 -2
- package/src/__tests__/tool-executor.test.ts +2 -2
- package/src/__tests__/tool-grant-request-escalation.test.ts +1 -1
- package/src/__tests__/tool-preview-lifecycle.test.ts +1 -1
- package/src/__tests__/tool-result-truncate-hook.test.ts +2 -1
- package/src/__tests__/tool-side-effects-slack-dm.test.ts +1 -1
- package/src/__tests__/trace-emitter.test.ts +1 -1
- package/src/__tests__/trust-context-guards.test.ts +1 -1
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +2 -2
- package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +1 -1
- package/src/__tests__/turn-call-site.test.ts +29 -0
- package/src/__tests__/turn-events-store.test.ts +1 -1
- package/src/__tests__/usage-cache-backfill-migration.test.ts +1 -1
- package/src/__tests__/usage-grouped-buckets.test.ts +1 -1
- package/src/__tests__/verification-control-plane-policy.test.ts +2 -2
- package/src/__tests__/voice-scoped-grant-consumer.test.ts +5 -5
- package/src/__tests__/workspace-migration-009-backfill-conversation-disk-view.test.ts +1 -1
- package/src/__tests__/workspace-migration-013-repair-conversation-disk-view.test.ts +2 -2
- package/src/__tests__/workspace-migration-backfill-installation-id.test.ts +1 -1
- package/src/a2a/task-store.ts +1 -1
- package/src/agent/loop.ts +9 -2
- package/src/approvals/approval-primitive.ts +1 -1
- package/src/approvals/guardian-card-withdrawal.ts +2 -2
- package/src/approvals/guardian-decision-primitive.ts +1 -1
- package/src/approvals/guardian-expiry-notifier.ts +1 -1
- package/src/approvals/guardian-request-resolvers.ts +4 -4
- package/src/{memory → approvals}/scoped-approval-grants.ts +1 -1
- package/src/{memory → apps}/app-store.ts +1 -1
- package/src/{memory → apps}/shared-app-links-store.ts +1 -1
- package/src/bundler/app-bundler.ts +1 -1
- package/src/calls/call-controller.ts +5 -5
- package/src/calls/call-domain.ts +3 -3
- package/src/calls/call-store.ts +1 -1
- package/src/calls/guardian-dispatch.ts +5 -5
- package/src/calls/media-stream-server.ts +1 -1
- package/src/calls/relay-access-wait.ts +1 -1
- package/src/calls/relay-server.ts +2 -2
- package/src/cli.ts +5 -5
- package/src/config/bundled-skills/app-builder/tools/app-create.ts +2 -2
- package/src/config/bundled-skills/app-builder/tools/app-delete.ts +2 -2
- package/src/config/bundled-skills/app-builder/tools/app-generate-icon.ts +2 -2
- package/src/config/bundled-skills/app-builder/tools/app-list.ts +1 -1
- package/src/config/bundled-skills/app-builder/tools/app-refresh.ts +2 -2
- package/src/config/bundled-skills/app-builder/tools/app-update.ts +2 -2
- package/src/config/bundled-skills/messaging/tools/messaging-send.ts +1 -1
- package/src/{memory → contacts}/canonical-guardian-store.ts +1 -1
- package/src/daemon/__tests__/conversation-lifecycle-auto-analyze.test.ts +7 -7
- package/src/daemon/__tests__/conversation-surfaces-launch.test.ts +3 -2
- package/src/daemon/app-source-watcher.ts +2 -2
- package/src/daemon/channel-ui-capability.ts +25 -0
- package/src/daemon/config-watcher.ts +1 -1
- package/src/daemon/conversation-agent-loop-handlers.ts +3 -3
- package/src/daemon/conversation-agent-loop.ts +15 -11
- package/src/daemon/conversation-evictor.ts +42 -9
- package/src/daemon/conversation-launch.ts +1 -1
- package/src/daemon/conversation-lifecycle.ts +2 -2
- package/src/daemon/conversation-messaging.ts +4 -4
- package/src/daemon/conversation-process.ts +1 -1
- package/src/daemon/conversation-runtime-assembly.ts +6 -6
- package/src/daemon/conversation-skill-tools.ts +1 -1
- package/src/daemon/conversation-store.ts +9 -48
- package/src/daemon/conversation-surfaces.ts +3 -3
- package/src/daemon/conversation-workspace.ts +1 -1
- package/src/daemon/conversation.ts +2 -2
- package/src/daemon/event-loop-watchdog.ts +1 -1
- package/src/daemon/handlers/conversations.ts +3 -3
- package/src/daemon/handlers/recording.ts +1 -1
- package/src/daemon/lifecycle.ts +4 -4
- package/src/daemon/process-message.ts +1 -1
- package/src/daemon/shutdown-handlers.ts +3 -5
- package/src/daemon/tool-side-effects.ts +1 -1
- package/src/daemon/trace-emitter.ts +1 -1
- package/src/daemon/turn-call-site.ts +25 -0
- package/src/daemon/wake-conversation-ops.ts +1 -1
- package/src/documents/document-comments-store.test.ts +1 -1
- package/src/documents/document-comments-store.ts +1 -1
- package/src/documents/document-store.ts +1 -1
- package/src/events/tool-audit-listener.ts +4 -4
- package/src/heartbeat/heartbeat-run-store.ts +1 -1
- package/src/home/__tests__/suggested-prompts.test.ts +1 -1
- package/src/{memory → home}/conversation-starter-checkpoints.ts +1 -1
- package/src/home/feed-source-enrichment.ts +1 -1
- package/src/home/home-greeting-cache.ts +1 -1
- package/src/{memory → home}/job-handlers/conversation-starters.ts +16 -16
- package/src/home/suggested-prompts.ts +1 -1
- package/src/{memory → jobs}/register-job-handlers.ts +29 -29
- package/src/live-voice/__tests__/live-voice-archive.test.ts +1 -1
- package/src/live-voice/live-voice-archive.ts +1 -1
- package/src/media/app-icon-generator.ts +1 -1
- package/src/memory/__tests__/conversation-queries.test.ts +1 -1
- package/src/memory/__tests__/db-maintenance.test.ts +3 -2
- package/src/memory/__tests__/jobs-store-enqueue-gate.test.ts +3 -3
- package/src/memory/__tests__/jobs-worker-v2-graph-trigger-embed.test.ts +1 -1
- package/src/memory/__tests__/jobs-worker-v2-schedule.test.ts +2 -2
- package/src/memory/context-search/sources/conversations.ts +2 -2
- package/src/memory/graph/bootstrap.test.ts +7 -2
- package/src/memory/graph/bootstrap.ts +5 -2
- package/src/memory/graph/extraction-job.ts +4 -1
- package/src/memory/graph/extraction.ts +1 -1
- package/src/memory/graph/image-ref-utils.ts +1 -1
- package/src/memory/graph/retriever.test.ts +1 -1
- package/src/memory/graph/store.test.ts +1 -1
- package/src/memory/indexer.ts +10 -7
- package/src/memory/job-handlers/backfill.ts +5 -5
- package/src/memory/job-handlers/embedding.ts +1 -1
- package/src/memory/job-handlers/index-maintenance.ts +1 -1
- package/src/memory/memory-v2-concept-frequency.ts +1 -1
- package/src/memory/task-memory-cleanup.ts +6 -1
- package/src/memory/v2/__tests__/backfill-jobs.test.ts +1 -1
- package/src/memory/v2/backfill-jobs.ts +1 -1
- package/src/memory/v2/sweep-job.ts +1 -1
- package/src/memory/v3-eval/eval-packets.ts +1 -1
- package/src/memory/worker.ts +1 -1
- package/src/messaging/providers/telegram-bot/adapter.ts +1 -1
- package/src/messaging/providers/whatsapp/adapter.ts +1 -1
- package/src/notifications/canonical-delivery-recorder.ts +1 -1
- package/src/notifications/conversation-candidates.ts +1 -1
- package/src/notifications/deliveries-store.ts +1 -1
- package/src/oauth/oauth-store.ts +1 -1
- package/src/persistence/attachments-store.ts +2 -2
- package/src/persistence/bookmark-crud.ts +1 -1
- package/src/{memory → persistence}/checkpoints.ts +2 -2
- package/src/{memory → persistence}/conversation-attention-store.ts +3 -3
- package/src/persistence/conversation-bootstrap.ts +2 -2
- package/src/persistence/conversation-crud.ts +16 -16
- package/src/{memory → persistence}/conversation-disk-view.ts +3 -3
- package/src/{memory/__tests__ → persistence}/conversation-group-migration.test.ts +4 -4
- package/src/{memory → persistence}/conversation-key-store.ts +2 -5
- package/src/persistence/conversation-queries.ts +3 -3
- package/src/{memory → persistence}/conversation-title-service.ts +6 -6
- package/src/persistence/db-maintenance.ts +1 -4
- package/src/persistence/delivery-crud.ts +4 -4
- package/src/persistence/group-crud.ts +2 -2
- package/src/{memory → persistence}/job-handlers/cleanup.ts +1 -1
- package/src/persistence/jobs-store.ts +1 -1
- package/src/persistence/jobs-worker.ts +6 -9
- package/src/persistence/llm-usage-store.ts +12 -12
- package/src/{memory/__tests__ → persistence}/message-content.test.ts +1 -1
- package/src/{memory → persistence}/raw-query.ts +1 -5
- package/src/persistence/steps.ts +1 -1
- package/src/{memory → persistence}/usage-buckets.ts +1 -4
- package/src/{memory → persistence}/usage-grouped-buckets.ts +1 -1
- package/src/{memory → persistence}/worker-control.ts +1 -1
- package/src/plugin-api/types.ts +19 -9
- package/src/plugins/defaults/exploration-drift/hooks/post-tool-use.ts +5 -8
- package/src/plugins/defaults/memory/v3/maintain-job.ts +3 -3
- package/src/plugins/defaults/memory/v3/shadow-plugin.ts +1 -1
- package/src/plugins/defaults/task-progress-nudge/hooks/post-tool-use.ts +33 -41
- package/src/plugins/defaults/title-generate/hooks/stop.ts +3 -3
- package/src/plugins/defaults/title-generate/hooks/user-prompt-submit.ts +2 -2
- package/src/runtime/__tests__/agent-wake.test.ts +1 -1
- package/src/runtime/__tests__/pre-first-message-gate.test.ts +1 -1
- package/src/runtime/access-request-helper.ts +3 -3
- package/src/runtime/agent-wake.ts +4 -1
- package/src/runtime/assistant-event-hub.ts +1 -1
- package/src/runtime/background-job-runner.ts +1 -1
- package/src/runtime/channel-retry-sweep.ts +20 -0
- package/src/runtime/channel-verification-service.ts +9 -9
- package/src/runtime/confirmation-request-guardian-bridge.ts +1 -1
- package/src/runtime/guardian-action-service.ts +1 -2
- package/src/runtime/guardian-reply-router.ts +1 -1
- package/src/runtime/pre-first-message-gate.ts +1 -1
- package/src/runtime/routes/__tests__/backup-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/consolidation-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/conversation-list-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/memory-worker-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/retrospective-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/surface-action-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/surface-content-routes.test.ts +1 -1
- package/src/runtime/routes/acp-routes.ts +1 -1
- package/src/runtime/routes/app-management-routes.ts +9 -9
- package/src/runtime/routes/app-routes.ts +3 -7
- package/src/runtime/routes/approval-routes.ts +2 -4
- package/src/runtime/routes/audit-routes.ts +2 -3
- package/src/runtime/routes/backup-routes.ts +1 -1
- package/src/runtime/routes/btw-routes.ts +1 -1
- package/src/runtime/routes/canonical-guardian-expiry-sweep.ts +1 -1
- package/src/runtime/routes/consolidation-routes.ts +1 -1
- package/src/runtime/routes/conversation-attention-routes.ts +1 -1
- package/src/runtime/routes/conversation-cli-routes.ts +1 -1
- package/src/runtime/routes/conversation-list-routes.ts +3 -3
- package/src/runtime/routes/conversation-management-routes.ts +5 -5
- package/src/runtime/routes/conversation-query-routes.ts +1 -1
- package/src/runtime/routes/conversation-routes.ts +10 -10
- package/src/runtime/routes/conversation-starter-routes.ts +2 -2
- package/src/runtime/routes/conversations-import-routes.ts +4 -4
- package/src/runtime/routes/debug-routes.ts +1 -1
- package/src/runtime/routes/documents-routes.ts +1 -1
- package/src/runtime/routes/empty-state-greeting-cache.ts +1 -1
- package/src/runtime/routes/events-routes.ts +1 -1
- package/src/runtime/routes/global-search-routes.ts +1 -1
- package/src/runtime/routes/guardian-action-routes.ts +1 -1
- package/src/runtime/routes/inbound-conversation.ts +1 -1
- package/src/runtime/routes/inbound-message-handler.ts +4 -4
- package/src/runtime/routes/inbound-stages/background-dispatch.test.ts +2 -2
- package/src/runtime/routes/inbound-stages/background-dispatch.ts +8 -8
- package/src/runtime/routes/inbound-stages/escalation-intercept.ts +1 -1
- package/src/runtime/routes/inbound-stages/guardian-reply-intercept.test.ts +1 -1
- package/src/runtime/routes/inbound-stages/guardian-reply-intercept.ts +1 -1
- package/src/runtime/routes/inbound-stages/secret-ingress-check.ts +1 -1
- package/src/runtime/routes/inference-profile-session-handler.ts +1 -1
- package/src/runtime/routes/integrations/slack/__tests__/share.test.ts +3 -4
- package/src/runtime/routes/integrations/slack/share.ts +1 -1
- package/src/runtime/routes/internal-telemetry-routes.ts +1 -1
- package/src/runtime/routes/log-export/__tests__/workspace-allowlist-error-contract.test.ts +1 -1
- package/src/runtime/routes/log-export/workspace-allowlist.ts +1 -1
- package/src/runtime/routes/memory-worker-routes.ts +1 -1
- package/src/runtime/routes/publish-routes.ts +3 -3
- package/src/runtime/routes/surface-conversation-resolver.ts +1 -1
- package/src/runtime/routes/trace-event-routes.ts +1 -1
- package/src/runtime/routes/usage-routes.ts +1 -1
- package/src/runtime/services/__tests__/analyze-conversation.test.ts +1 -1
- package/src/{memory → runtime/services}/__tests__/auto-analysis-enqueue.test.ts +5 -5
- package/src/{memory → runtime/services}/__tests__/auto-analysis-guard.test.ts +6 -6
- package/src/{memory → runtime/services}/__tests__/conversation-analyze-job.test.ts +5 -5
- package/src/runtime/services/analyze-conversation.ts +3 -3
- package/src/{memory → runtime/services}/auto-analysis-enqueue.ts +7 -7
- package/src/{memory → runtime/services}/auto-analysis-guard.ts +2 -6
- package/src/{memory → runtime/services}/conversation-analyze-job.ts +4 -4
- package/src/runtime/services/conversation-serializer.ts +2 -2
- package/src/runtime/tool-grant-request-helper.ts +1 -1
- package/src/schedule/schedule-store.ts +1 -1
- package/src/schedule/schedule-usage-store.ts +2 -2
- package/src/sequence/store.ts +1 -1
- package/src/services/published-app-updater.ts +2 -2
- package/src/signals/cancel.ts +1 -1
- package/src/signals/user-message.ts +1 -1
- package/src/subagent/manager.ts +3 -2
- package/src/telemetry/usage-telemetry-reporter.test.ts +6 -6
- package/src/telemetry/usage-telemetry-reporter.ts +11 -11
- package/src/tools/apps/executors.ts +2 -2
- package/src/tools/apps/resolve-app-id.ts +1 -1
- package/src/tools/document/document-comment-tool.test.ts +1 -1
- package/src/tools/filesystem/write.ts +3 -2
- package/src/tools/tool-approval-handler.ts +1 -1
- package/src/watcher/__tests__/telemetry.test.ts +1 -1
- package/src/watcher/telemetry.ts +1 -1
- package/src/watcher/watcher-store.ts +1 -1
- package/src/workflows/journal-store.ts +1 -1
- package/src/workspace/migrations/011-backfill-installation-id.ts +1 -1
- package/src/workspace/migrations/041-backfill-google-gmail-settings-scope.ts +1 -1
- package/src/workspace/migrations/rebuild-conversation-disk-view.ts +2 -2
- /package/src/{memory → apps}/app-git-service.ts +0 -0
- /package/src/{memory → apps}/published-pages-store.ts +0 -0
- /package/src/{memory → channels}/channel-verification-sessions.ts +0 -0
- /package/src/{memory → channels}/slack-thread-store.ts +0 -0
- /package/src/{memory → contacts}/guardian-rate-limits.ts +0 -0
- /package/src/{memory → conversations}/job-handlers/summarization.ts +0 -0
- /package/src/{memory → home}/conversation-starter-validation.ts +0 -0
- /package/src/{memory → media}/job-handlers/media-processing.ts +0 -0
- /package/src/{memory → onboarding}/__tests__/onboarding-events-store.test.ts +0 -0
- /package/src/{memory → onboarding}/onboarding-events-store.ts +0 -0
- /package/src/{memory → persistence}/__tests__/worker-control.test.ts +0 -0
- /package/src/{memory → persistence}/auto-analysis-constants.ts +0 -0
- /package/src/{memory → persistence}/cleanup-schedule-state.ts +0 -0
- /package/src/{memory → persistence}/conversation-directories.ts +0 -0
- /package/src/{memory → persistence}/conversation-display-order-migration.ts +0 -0
- /package/src/{memory → persistence}/conversation-group-migration.ts +0 -0
- /package/src/{memory → persistence}/message-content.ts +0 -0
- /package/src/{memory → persistence}/schedule-attribution-sql.ts +0 -0
- /package/src/{memory → security}/auth-fallback-events-store.ts +0 -0
- /package/src/{memory → telemetry}/__tests__/watchdog-events-store.test.ts +0 -0
- /package/src/{memory → telemetry}/skill-loaded-events-store.test.ts +0 -0
- /package/src/{memory → telemetry}/skill-loaded-events-store.ts +0 -0
- /package/src/{memory → telemetry}/tool-executed-events-store.test.ts +0 -0
- /package/src/{memory → telemetry}/tool-executed-events-store.ts +0 -0
- /package/src/{memory → telemetry}/tool-usage-store.ts +0 -0
- /package/src/{memory → telemetry}/trace-event-store.ts +0 -0
- /package/src/{memory → telemetry}/turn-events-store.ts +0 -0
- /package/src/{memory → telemetry}/turn-trace-store.test.ts +0 -0
- /package/src/{memory → telemetry}/turn-trace-store.ts +0 -0
- /package/src/{memory → telemetry}/watchdog-events-store.ts +0 -0
package/ARCHITECTURE.md
CHANGED
|
@@ -99,7 +99,7 @@ All HTTP API requests use a single `Authorization: Bearer <jwt>` header for auth
|
|
|
99
99
|
| `src/runtime/routes/guardian-bootstrap-routes.ts` | `POST /v1/guardian/init` (initial JWT issuance) |
|
|
100
100
|
| `src/runtime/routes/guardian-refresh-routes.ts` | `POST /v1/guardian/refresh` (token rotation) |
|
|
101
101
|
| `src/runtime/local-actor-identity.ts` | `resolveLocalGuardianContext` — deterministic local identity |
|
|
102
|
-
| `src/
|
|
102
|
+
| `src/channels/channel-verification-sessions.ts` | Guardian binding types, verification session management |
|
|
103
103
|
|
|
104
104
|
### Channel-Agnostic Scoped Approval Grants
|
|
105
105
|
|
|
@@ -178,7 +178,7 @@ The canonical guardian request system provides a channel-agnostic, unified domai
|
|
|
178
178
|
|
|
179
179
|
**Architecture layers:**
|
|
180
180
|
|
|
181
|
-
1. **Canonical domain (single source of truth):** All guardian requests — tool approvals, pending questions, access requests — are persisted in the `canonical_guardian_requests` table (`src/
|
|
181
|
+
1. **Canonical domain (single source of truth):** All guardian requests — tool approvals, pending questions, access requests — are persisted in the `canonical_guardian_requests` table (`src/contacts/canonical-guardian-store.js`). Each request has a unique ID, a short human-readable request code, and a status that follows a CAS (compare-and-swap) lifecycle: `pending` -> `approved` | `denied` | `expired` | `cancelled`. Deliveries (notifications sent to guardians) are tracked in `canonical_guardian_deliveries`.
|
|
182
182
|
|
|
183
183
|
2. **Unified apply primitive (single write path):** `applyCanonicalGuardianDecision()` in `src/approvals/guardian-decision-primitive.ts` is the single write path for all guardian decisions. It enforces identity validation, expiry checks, CAS resolution, `approve_always` downgrade (guardian-on-behalf invariant), kind-specific resolver dispatch via the resolver registry, and scoped grant minting. All callers — HTTP API, inbound channel router, desktop session — route decisions through this function.
|
|
184
184
|
|
|
@@ -200,7 +200,7 @@ The canonical guardian request system provides a channel-agnostic, unified domai
|
|
|
200
200
|
|
|
201
201
|
| File | Purpose |
|
|
202
202
|
| ------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
203
|
-
| `src/
|
|
203
|
+
| `src/contacts/canonical-guardian-store.ts` | Canonical request and delivery persistence (CRUD, CAS resolve, list with filters) |
|
|
204
204
|
| `src/approvals/guardian-decision-primitive.ts` | Canonical decision primitive: `applyCanonicalGuardianDecision` + scoped grant minting |
|
|
205
205
|
| `src/approvals/guardian-request-resolvers.ts` | Resolver registry: kind-specific side-effect dispatch after CAS resolution |
|
|
206
206
|
| `src/runtime/guardian-reply-router.ts` | Shared inbound router: callback -> code -> NL classification pipeline |
|
|
@@ -434,7 +434,7 @@ External users who are not the guardian can gain access to the assistant through
|
|
|
434
434
|
| `src/runtime/invite-service.ts` | Business logic for invite operations |
|
|
435
435
|
| `src/contacts/contact-store.ts` | Contact read queries — lookup, search, list, and channel operations |
|
|
436
436
|
| `src/memory/guardian-approvals.ts` | Approval request persistence |
|
|
437
|
-
| `src/
|
|
437
|
+
| `src/channels/channel-verification-sessions.ts` | Verification challenge persistence |
|
|
438
438
|
| `src/config/bundled-skills/contacts/SKILL.md` | Unified skill for contact management, access control, and invite links |
|
|
439
439
|
|
|
440
440
|
### Guardian-Initiated Invite Links
|
|
@@ -594,7 +594,7 @@ All guardian decisions for voice access requests flow through:
|
|
|
594
594
|
| `src/approvals/guardian-decision-primitive.ts` | `applyCanonicalGuardianDecision` — unified decision primitive |
|
|
595
595
|
| `src/approvals/guardian-request-resolvers.ts` | `access_request` resolver — voice direct activation, text-channel verification session |
|
|
596
596
|
| `src/runtime/actor-trust-resolver.ts` | `resolveActorTrust` — caller trust classification |
|
|
597
|
-
| `src/
|
|
597
|
+
| `src/contacts/canonical-guardian-store.ts` | Canonical request persistence and CAS resolution |
|
|
598
598
|
|
|
599
599
|
### Speech-to-Text (STT) Boundaries
|
|
600
600
|
|
|
@@ -2152,7 +2152,7 @@ The guardian trust system uses a three-valued `TrustClass` — `'guardian'`, `'t
|
|
|
2152
2152
|
|
|
2153
2153
|
**Explicit trust gates:** `trustClass` is a **required** field in `ToolContext` (in `src/tools/types.ts`). Every tool execution must carry a trust classification — the field is not optional. This ensures trust-gated tool policies (guardian control-plane restrictions, host-tool blocking for untrusted actors) cannot be bypassed by omitting the classification.
|
|
2154
2154
|
|
|
2155
|
-
**Guardian bindings** (in `src/
|
|
2155
|
+
**Guardian bindings** (in `src/channels/channel-verification-sessions.ts`) always carry `guardianPrincipalId: string` as a required, non-null field. A binding without a principal ID is invalid and cannot be created.
|
|
2156
2156
|
|
|
2157
2157
|
**Strict retry sweep parsing:** The channel retry sweep (`src/runtime/channel-retry-sweep.ts`) uses `parseTrustRuntimeContext()` which validates `trustClass` against the canonical three-value set. There is no fallback to a legacy `actorRole` field — stored payloads that lack a valid `trustClass` are rejected deterministically to prevent silent privilege escalation. When `trustCtx` is entirely absent from a stored payload (pre-guardian events), the sweep synthesizes an explicit `trustClass: 'unknown'` context so that replay never proceeds without a trust classification.
|
|
2158
2158
|
|
|
@@ -2160,13 +2160,13 @@ The guardian trust system uses a three-valued `TrustClass` — `'guardian'`, `'t
|
|
|
2160
2160
|
|
|
2161
2161
|
**Key files:**
|
|
2162
2162
|
|
|
2163
|
-
| File
|
|
2164
|
-
|
|
|
2165
|
-
| `src/daemon/conversation-runtime-assembly.ts`
|
|
2166
|
-
| `src/tools/types.ts`
|
|
2167
|
-
| `src/runtime/channel-retry-sweep.ts`
|
|
2168
|
-
| `src/
|
|
2169
|
-
| `src/__tests__/trust-context-guards.test.ts`
|
|
2163
|
+
| File | Purpose |
|
|
2164
|
+
| ----------------------------------------------- | ----------------------------------------------------- |
|
|
2165
|
+
| `src/daemon/conversation-runtime-assembly.ts` | `TrustContext` type definition |
|
|
2166
|
+
| `src/tools/types.ts` | `ToolContext.trustClass` (required trust gate) |
|
|
2167
|
+
| `src/runtime/channel-retry-sweep.ts` | Strict `trustClass` parser for retry sweep |
|
|
2168
|
+
| `src/channels/channel-verification-sessions.ts` | `GuardianBinding` with required `guardianPrincipalId` |
|
|
2169
|
+
| `src/__tests__/trust-context-guards.test.ts` | Guard tests enforcing trust-context type invariants |
|
|
2170
2170
|
|
|
2171
2171
|
### TTS Provider Abstraction (`services.tts`)
|
|
2172
2172
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, mock, test } from "bun:test";
|
|
2
2
|
|
|
3
|
-
import type { AppDefinition } from "../
|
|
3
|
+
import type { AppDefinition } from "../apps/app-store.js";
|
|
4
4
|
import type { AppStore } from "../tools/apps/executors.js";
|
|
5
5
|
import type { ToolContext } from "../tools/types.js";
|
|
6
6
|
|
|
@@ -53,7 +53,7 @@ function makeContext(overrides: Partial<ToolContext> = {}): ToolContext {
|
|
|
53
53
|
|
|
54
54
|
const mockStore = makeMockStore();
|
|
55
55
|
|
|
56
|
-
mock.module("../
|
|
56
|
+
mock.module("../apps/app-store.js", () => ({
|
|
57
57
|
...mockStore,
|
|
58
58
|
getAppsDir: () => "/tmp/test-apps",
|
|
59
59
|
getAppDirPath: (appId: string) => `/tmp/test-apps/${appId}`,
|
|
@@ -25,7 +25,7 @@ const testAppsDir = join(tmpdir(), `app-bundler-test-${Date.now()}`);
|
|
|
25
25
|
|
|
26
26
|
// Mock app-store so packageApp can find our test apps
|
|
27
27
|
const mockApps = new Map<string, Record<string, unknown>>();
|
|
28
|
-
mock.module("../
|
|
28
|
+
mock.module("../apps/app-store.js", () => ({
|
|
29
29
|
getApp: (id: string) => mockApps.get(id) ?? null,
|
|
30
30
|
getAppsDir: () => testAppsDir,
|
|
31
31
|
getAppDirPath: (id: string) => join(testAppsDir, id),
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
backfillAppConversationIds,
|
|
16
16
|
createApp,
|
|
17
17
|
getApp,
|
|
18
|
-
} from "../
|
|
19
|
-
import { rawRun } from "../memory/raw-query.js";
|
|
18
|
+
} from "../apps/app-store.js";
|
|
20
19
|
import { getDb } from "../persistence/db-connection.js";
|
|
21
20
|
import { initializeDb } from "../persistence/db-init.js";
|
|
21
|
+
import { rawRun } from "../persistence/raw-query.js";
|
|
22
22
|
|
|
23
23
|
// Initialize db once for all tests
|
|
24
24
|
await initializeDb();
|
|
@@ -16,8 +16,8 @@ import { describe, expect, test } from "bun:test";
|
|
|
16
16
|
|
|
17
17
|
/** Files that are permitted to import getAppsDir. */
|
|
18
18
|
const ALLOWLIST = new Set([
|
|
19
|
-
"assistant/src/
|
|
20
|
-
"assistant/src/
|
|
19
|
+
"assistant/src/apps/app-store.ts", // defines getAppsDir
|
|
20
|
+
"assistant/src/apps/app-git-service.ts", // uses getAppsDir for git repo root, not per-app paths
|
|
21
21
|
"assistant/src/daemon/app-source-watcher.ts", // uses getAppsDir for recursive fs.watch root, not per-app paths
|
|
22
22
|
"assistant/src/tools/filesystem/write.ts", // uses getAppsDir as an exemption root for the artifact-HTML guard, not per-app paths
|
|
23
23
|
]);
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
getAppFileAtVersion,
|
|
14
14
|
getAppHistory,
|
|
15
15
|
restoreAppVersion,
|
|
16
|
-
} from "../
|
|
17
|
-
import { createApp, getAppDirPath, updateApp } from "../
|
|
16
|
+
} from "../apps/app-git-service.js";
|
|
17
|
+
import { createApp, getAppDirPath, updateApp } from "../apps/app-store.js";
|
|
18
18
|
|
|
19
19
|
describe("App Git History", () => {
|
|
20
20
|
beforeEach(() => {
|
|
@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
6
6
|
|
|
7
|
-
import { commitAppTurnChanges } from "../
|
|
7
|
+
import { commitAppTurnChanges } from "../apps/app-git-service.js";
|
|
8
8
|
import {
|
|
9
9
|
createApp,
|
|
10
10
|
deleteApp,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
getAppsDir,
|
|
13
13
|
updateApp,
|
|
14
14
|
writeAppFile,
|
|
15
|
-
} from "../
|
|
15
|
+
} from "../apps/app-store.js";
|
|
16
16
|
import { _resetGitServiceRegistry } from "../workspace/git-service.js";
|
|
17
17
|
|
|
18
18
|
let testDataDir: string;
|
|
@@ -34,7 +34,7 @@ const apps = new Map<string, typeof legacyApp | typeof multifileApp>([
|
|
|
34
34
|
["multi-1", multifileApp],
|
|
35
35
|
]);
|
|
36
36
|
|
|
37
|
-
mock.module("../
|
|
37
|
+
mock.module("../apps/app-store.js", () => ({
|
|
38
38
|
getApp: (id: string) => apps.get(id) ?? null,
|
|
39
39
|
getAppsDir: () => "/fake/apps",
|
|
40
40
|
getAppDirPath: (appId: string) => `/fake/apps/${appId}`,
|
|
@@ -42,7 +42,7 @@ mock.module("../memory/app-store.js", () => ({
|
|
|
42
42
|
}));
|
|
43
43
|
|
|
44
44
|
// Mock shared-app-links-store (imported by app-routes but unused here)
|
|
45
|
-
mock.module("../
|
|
45
|
+
mock.module("../apps/shared-app-links-store.js", () => ({
|
|
46
46
|
createSharedAppLink: () => ({ shareToken: "tok" }),
|
|
47
47
|
getSharedAppLink: () => null,
|
|
48
48
|
incrementDownloadCount: () => {},
|
|
@@ -44,7 +44,7 @@ mock.module("node:fs", () => {
|
|
|
44
44
|
};
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
mock.module("../
|
|
47
|
+
mock.module("../apps/app-store.js", () => ({
|
|
48
48
|
getAppsDir: mock(() => TEST_APPS_DIR),
|
|
49
49
|
resolveAppIdByDirName: mock(
|
|
50
50
|
(dirName: string) => testDirNameMap.get(dirName) ?? null,
|
|
@@ -222,7 +222,7 @@ mock.module("../agent/loop.js", () => ({
|
|
|
222
222
|
},
|
|
223
223
|
}));
|
|
224
224
|
|
|
225
|
-
mock.module("../
|
|
225
|
+
mock.module("../contacts/canonical-guardian-store.js", () => ({
|
|
226
226
|
listPendingCanonicalGuardianRequestsByDestinationConversation: () => [],
|
|
227
227
|
listCanonicalGuardianRequests: () => [],
|
|
228
228
|
listPendingRequestsByConversationScope: () => [],
|
|
@@ -20,8 +20,6 @@ mock.module("../config/loader.js", () => ({
|
|
|
20
20
|
}),
|
|
21
21
|
}));
|
|
22
22
|
|
|
23
|
-
import { getConversationDirPath } from "../memory/conversation-disk-view.js";
|
|
24
|
-
import { rawGet, rawRun } from "../memory/raw-query.js";
|
|
25
23
|
import {
|
|
26
24
|
AttachmentUploadError,
|
|
27
25
|
deleteAttachment,
|
|
@@ -41,8 +39,10 @@ import {
|
|
|
41
39
|
addMessage,
|
|
42
40
|
createConversation,
|
|
43
41
|
} from "../persistence/conversation-crud.js";
|
|
42
|
+
import { getConversationDirPath } from "../persistence/conversation-disk-view.js";
|
|
44
43
|
import { getDb } from "../persistence/db-connection.js";
|
|
45
44
|
import { initializeDb } from "../persistence/db-init.js";
|
|
45
|
+
import { rawGet, rawRun } from "../persistence/raw-query.js";
|
|
46
46
|
import { getConversationsDir } from "../util/platform.js";
|
|
47
47
|
|
|
48
48
|
await initializeDb();
|
|
@@ -12,12 +12,12 @@ mock.module("../util/logger.js", () => ({
|
|
|
12
12
|
}),
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
|
+
import { getSqlite } from "../persistence/db-connection.js";
|
|
16
|
+
import { initializeDb } from "../persistence/db-init.js";
|
|
15
17
|
import {
|
|
16
18
|
getRecentInvocations,
|
|
17
19
|
rotateToolInvocations,
|
|
18
|
-
} from "../
|
|
19
|
-
import { getSqlite } from "../persistence/db-connection.js";
|
|
20
|
-
import { initializeDb } from "../persistence/db-init.js";
|
|
20
|
+
} from "../telemetry/tool-usage-store.js";
|
|
21
21
|
import { resetDbForTesting } from "./db-test-helpers.js";
|
|
22
22
|
|
|
23
23
|
// ---------------------------------------------------------------------------
|
|
@@ -13,14 +13,14 @@ mock.module("../platform/consent-cache.js", () => ({
|
|
|
13
13
|
getCachedShareAnalytics: () => shareAnalytics,
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
+
import { getDb } from "../persistence/db-connection.js";
|
|
17
|
+
import { initializeDb } from "../persistence/db-init.js";
|
|
18
|
+
import { authFallbackEvents } from "../persistence/schema/index.js";
|
|
16
19
|
import {
|
|
17
20
|
type AuthFallbackCount,
|
|
18
21
|
queryUnreportedAuthFallbackEvents,
|
|
19
22
|
recordAuthFallbackCounts,
|
|
20
|
-
} from "../
|
|
21
|
-
import { getDb } from "../persistence/db-connection.js";
|
|
22
|
-
import { initializeDb } from "../persistence/db-init.js";
|
|
23
|
-
import { authFallbackEvents } from "../persistence/schema/index.js";
|
|
23
|
+
} from "../security/auth-fallback-events-store.js";
|
|
24
24
|
|
|
25
25
|
await initializeDb();
|
|
26
26
|
|
|
@@ -130,7 +130,6 @@ mock.module("../runtime/services/analyze-conversation.js", () => ({
|
|
|
130
130
|
|
|
131
131
|
// ── Real imports ──────────────────────────────────────────────────
|
|
132
132
|
|
|
133
|
-
import { conversationAnalyzeJob } from "../memory/conversation-analyze-job.js";
|
|
134
133
|
import { indexMessageNow } from "../memory/indexer.js";
|
|
135
134
|
import { createConversation } from "../persistence/conversation-crud.js";
|
|
136
135
|
import { getDb, getMemoryDb } from "../persistence/db-connection.js";
|
|
@@ -141,6 +140,7 @@ import {
|
|
|
141
140
|
memoryJobs,
|
|
142
141
|
messages,
|
|
143
142
|
} from "../persistence/schema/index.js";
|
|
143
|
+
import { conversationAnalyzeJob } from "../runtime/services/conversation-analyze-job.js";
|
|
144
144
|
import { setOverridesForTesting } from "./feature-flag-test-helpers.js";
|
|
145
145
|
|
|
146
146
|
// ── Helpers ───────────────────────────────────────────────────────
|
|
@@ -165,7 +165,7 @@ mock.module("../persistence/conversation-crud.js", () => ({
|
|
|
165
165
|
extractImageSourcePaths: () => undefined,
|
|
166
166
|
}));
|
|
167
167
|
|
|
168
|
-
mock.module("../
|
|
168
|
+
mock.module("../persistence/conversation-title-service.js", () => ({
|
|
169
169
|
GENERATING_TITLE: "Generating title...",
|
|
170
170
|
AUTO_TITLE_DETERMINISTIC: 2,
|
|
171
171
|
deriveDeterministicTitle: (context: { systemHint?: string }) =>
|
|
@@ -207,7 +207,7 @@ mock.module("../persistence/db-maintenance.js", () => ({
|
|
|
207
207
|
maybeRunDbMaintenance: mockMaybeRunDbMaintenance,
|
|
208
208
|
}));
|
|
209
209
|
|
|
210
|
-
mock.module("../
|
|
210
|
+
mock.module("../persistence/cleanup-schedule-state.js", () => ({
|
|
211
211
|
getLastScheduledCleanupEnqueueMs: () => 0,
|
|
212
212
|
markScheduledCleanupEnqueued: mock(() => {}),
|
|
213
213
|
}));
|
|
@@ -31,7 +31,7 @@ const mockGetConversationByKey = mock(
|
|
|
31
31
|
}),
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
mock.module("../
|
|
34
|
+
mock.module("../persistence/conversation-key-store.js", () => ({
|
|
35
35
|
getConversationByKey: mockGetConversationByKey,
|
|
36
36
|
getOrCreateConversation: () => {
|
|
37
37
|
throw new Error(
|
|
@@ -269,11 +269,11 @@ import { loadConfig } from "../config/loader.js";
|
|
|
269
269
|
import {
|
|
270
270
|
getCanonicalGuardianRequest,
|
|
271
271
|
getPendingCanonicalRequestByCallSessionId,
|
|
272
|
-
} from "../
|
|
273
|
-
import { resetTestTables } from "../memory/raw-query.js";
|
|
272
|
+
} from "../contacts/canonical-guardian-store.js";
|
|
274
273
|
import { getMessages } from "../persistence/conversation-crud.js";
|
|
275
274
|
import { getDb } from "../persistence/db-connection.js";
|
|
276
275
|
import { initializeDb } from "../persistence/db-init.js";
|
|
276
|
+
import { resetTestTables } from "../persistence/raw-query.js";
|
|
277
277
|
import { conversations } from "../persistence/schema/index.js";
|
|
278
278
|
import { resetDbForTesting } from "./db-test-helpers.js";
|
|
279
279
|
import { createGuardianBinding } from "./helpers/create-guardian-binding.js";
|
|
@@ -95,7 +95,7 @@ mock.module("../inbound/public-ingress-urls.js", () => ({
|
|
|
95
95
|
"https://test.example.com/webhooks/twilio/status",
|
|
96
96
|
}));
|
|
97
97
|
|
|
98
|
-
mock.module("../
|
|
98
|
+
mock.module("../persistence/conversation-title-service.js", () => ({
|
|
99
99
|
queueGenerateConversationTitle: () => {},
|
|
100
100
|
}));
|
|
101
101
|
|
|
@@ -54,7 +54,7 @@ mock.module("../daemon/handlers/conversations.js", () => ({
|
|
|
54
54
|
regenerateResponse: async () => null,
|
|
55
55
|
}));
|
|
56
56
|
|
|
57
|
-
import { getOrCreateConversation } from "../
|
|
57
|
+
import { getOrCreateConversation } from "../persistence/conversation-key-store.js";
|
|
58
58
|
import { initializeDb } from "../persistence/db-init.js";
|
|
59
59
|
import { ROUTES } from "../runtime/routes/conversation-management-routes.js";
|
|
60
60
|
import { routeDefinitionsToHTTPRoutes } from "../runtime/routes/http-adapter.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
resolveCanonicalGuardianRequest,
|
|
22
22
|
updateCanonicalGuardianDelivery,
|
|
23
23
|
updateCanonicalGuardianRequest,
|
|
24
|
-
} from "../
|
|
24
|
+
} from "../contacts/canonical-guardian-store.js";
|
|
25
25
|
import { getDb } from "../persistence/db-connection.js";
|
|
26
26
|
import { initializeDb } from "../persistence/db-init.js";
|
|
27
27
|
await initializeDb();
|
|
@@ -69,16 +69,16 @@ mock.module("../daemon/approval-generators.js", () => ({
|
|
|
69
69
|
createApprovalConversationGenerator: () => _testApprovalConversationGenerator,
|
|
70
70
|
}));
|
|
71
71
|
|
|
72
|
-
import type { Conversation } from "../daemon/conversation.js";
|
|
73
72
|
import {
|
|
74
73
|
createCanonicalGuardianDelivery,
|
|
75
74
|
createCanonicalGuardianRequest,
|
|
76
75
|
getCanonicalGuardianRequest,
|
|
77
|
-
} from "../
|
|
78
|
-
import {
|
|
76
|
+
} from "../contacts/canonical-guardian-store.js";
|
|
77
|
+
import type { Conversation } from "../daemon/conversation.js";
|
|
79
78
|
import { getDb } from "../persistence/db-connection.js";
|
|
80
79
|
import { initializeDb } from "../persistence/db-init.js";
|
|
81
80
|
import * as deliveryChannels from "../persistence/delivery-channels.js";
|
|
81
|
+
import { resetTestTables } from "../persistence/raw-query.js";
|
|
82
82
|
import { conversations } from "../persistence/schema/index.js";
|
|
83
83
|
import { initAuthSigningKey } from "../runtime/auth/token-service.js";
|
|
84
84
|
import * as gatewayClient from "../runtime/gateway-client.js";
|
|
@@ -21,7 +21,7 @@ import { eq } from "drizzle-orm";
|
|
|
21
21
|
import {
|
|
22
22
|
getConversationByKey,
|
|
23
23
|
setConversationKey,
|
|
24
|
-
} from "../
|
|
24
|
+
} from "../persistence/conversation-key-store.js";
|
|
25
25
|
import { getDb } from "../persistence/db-connection.js";
|
|
26
26
|
import { initializeDb } from "../persistence/db-init.js";
|
|
27
27
|
import {
|
|
@@ -112,11 +112,6 @@ mock.module("../contacts/guardian-delivery-reader.js", () => ({
|
|
|
112
112
|
) => list.find((g) => g.channelType === channelType && g.status === "active"),
|
|
113
113
|
}));
|
|
114
114
|
|
|
115
|
-
import { handleChannelVerificationSession } from "../daemon/handlers/config-channels.js";
|
|
116
|
-
import type {
|
|
117
|
-
ChannelVerificationSessionRequest,
|
|
118
|
-
ChannelVerificationSessionResponse,
|
|
119
|
-
} from "../daemon/message-protocol.js";
|
|
120
115
|
import {
|
|
121
116
|
bindSessionIdentity as _storeBindSessionIdentity,
|
|
122
117
|
consumeSession,
|
|
@@ -129,12 +124,17 @@ import {
|
|
|
129
124
|
findSessionByIdentity as _storeFindSessionByIdentity,
|
|
130
125
|
updateSessionDelivery as storeUpdateSessionDelivery,
|
|
131
126
|
updateSessionStatus as _storeUpdateSessionStatus,
|
|
132
|
-
} from "../
|
|
127
|
+
} from "../channels/channel-verification-sessions.js";
|
|
133
128
|
import {
|
|
134
129
|
getRateLimit,
|
|
135
130
|
recordInvalidAttempt,
|
|
136
131
|
resetRateLimit,
|
|
137
|
-
} from "../
|
|
132
|
+
} from "../contacts/guardian-rate-limits.js";
|
|
133
|
+
import { handleChannelVerificationSession } from "../daemon/handlers/config-channels.js";
|
|
134
|
+
import type {
|
|
135
|
+
ChannelVerificationSessionRequest,
|
|
136
|
+
ChannelVerificationSessionResponse,
|
|
137
|
+
} from "../daemon/message-protocol.js";
|
|
138
138
|
import { getDb } from "../persistence/db-connection.js";
|
|
139
139
|
import { initializeDb } from "../persistence/db-init.js";
|
|
140
140
|
import { upsertBinding as upsertExternalBinding } from "../persistence/external-conversation-store.js";
|
|
@@ -251,6 +251,51 @@ describe("channel-retry-sweep", () => {
|
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
+
test("restores member-grounding + timezone trust fields on replay", async () => {
|
|
255
|
+
const eventId = seedFailedEventWithTrustClass("trusted_contact", {
|
|
256
|
+
requesterContactId: "contact-77",
|
|
257
|
+
memberStatus: "active",
|
|
258
|
+
memberPolicy: "allow",
|
|
259
|
+
requesterTimezone: "America/New_York",
|
|
260
|
+
requesterTimezoneLabel: "EST",
|
|
261
|
+
requesterTimezoneOffsetSeconds: -18000,
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
let capturedTrust: Record<string, unknown> | undefined;
|
|
265
|
+
await sweepFailedEvents(async (conversationId, _content, options) => {
|
|
266
|
+
capturedTrust = (options as { trustContext?: Record<string, unknown> })
|
|
267
|
+
.trustContext;
|
|
268
|
+
const messageId = "message-grounding";
|
|
269
|
+
getDb()
|
|
270
|
+
.insert(messages)
|
|
271
|
+
.values({
|
|
272
|
+
id: messageId,
|
|
273
|
+
conversationId,
|
|
274
|
+
role: "user",
|
|
275
|
+
content: JSON.stringify([{ type: "text", text: "retry me" }]),
|
|
276
|
+
createdAt: Date.now(),
|
|
277
|
+
})
|
|
278
|
+
.run();
|
|
279
|
+
return { messageId };
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// Member-grounding + timezone fields survive the store→replay round-trip,
|
|
283
|
+
// so the replayed turn keeps its member grounding.
|
|
284
|
+
expect(capturedTrust?.requesterContactId).toBe("contact-77");
|
|
285
|
+
expect(capturedTrust?.memberStatus).toBe("active");
|
|
286
|
+
expect(capturedTrust?.memberPolicy).toBe("allow");
|
|
287
|
+
expect(capturedTrust?.requesterTimezone).toBe("America/New_York");
|
|
288
|
+
expect(capturedTrust?.requesterTimezoneLabel).toBe("EST");
|
|
289
|
+
expect(capturedTrust?.requesterTimezoneOffsetSeconds).toBe(-18000);
|
|
290
|
+
|
|
291
|
+
const eventRow = getDb()
|
|
292
|
+
.select()
|
|
293
|
+
.from(channelInboundEvents)
|
|
294
|
+
.where(eq(channelInboundEvents.id, eventId))
|
|
295
|
+
.get();
|
|
296
|
+
expect(eventRow?.processingStatus).toBe("processed");
|
|
297
|
+
});
|
|
298
|
+
|
|
254
299
|
test("marks legacy payloads with only actorRole (no trustClass) as failed", async () => {
|
|
255
300
|
const actorRoles: Array<
|
|
256
301
|
"guardian" | "non-guardian" | "unverified_channel"
|
|
@@ -229,7 +229,7 @@ mock.module("../persistence/llm-usage-store.js", () => ({
|
|
|
229
229
|
listUsageEvents: () => [],
|
|
230
230
|
}));
|
|
231
231
|
|
|
232
|
-
mock.module("../
|
|
232
|
+
mock.module("../runtime/services/auto-analysis-enqueue.js", () => ({
|
|
233
233
|
enqueueAutoAnalysisOnCompaction: () => {},
|
|
234
234
|
}));
|
|
235
235
|
|
|
@@ -255,7 +255,7 @@ mock.module("../agent/loop.js", () => ({
|
|
|
255
255
|
},
|
|
256
256
|
}));
|
|
257
257
|
|
|
258
|
-
mock.module("../
|
|
258
|
+
mock.module("../contacts/canonical-guardian-store.js", () => ({
|
|
259
259
|
listPendingCanonicalGuardianRequestsByDestinationConversation: () => [],
|
|
260
260
|
listCanonicalGuardianRequests: () => [],
|
|
261
261
|
listPendingRequestsByConversationScope: () => [],
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* maybeEnqueueScheduledCleanupJobs (in jobs-worker) early-returns while
|
|
8
8
|
* the throttle is still within its window.
|
|
9
9
|
*
|
|
10
|
-
* The shared throttle state lives in
|
|
10
|
+
* The shared throttle state lives in persistence/cleanup-schedule-state.ts so
|
|
11
11
|
* that config-watcher can reset it without pulling jobs-worker's large
|
|
12
12
|
* transitive import graph into test modules. This test stubs the
|
|
13
13
|
* schedule-state module so calls from config-watcher can be counted
|
|
@@ -113,7 +113,7 @@ describe("cleanupSettingsChanged", () => {
|
|
|
113
113
|
// Track calls from config-watcher into the (mocked) cleanup-schedule-state.
|
|
114
114
|
let resetCleanupScheduleThrottleCalls = 0;
|
|
115
115
|
|
|
116
|
-
mock.module("../
|
|
116
|
+
mock.module("../persistence/cleanup-schedule-state.js", () => ({
|
|
117
117
|
resetCleanupScheduleThrottle: () => {
|
|
118
118
|
resetCleanupScheduleThrottleCalls++;
|
|
119
119
|
},
|
|
@@ -87,7 +87,7 @@ mock.module("../persistence/embeddings/embedding-backend.js", () => ({
|
|
|
87
87
|
clearEmbeddingBackendCache: () => {},
|
|
88
88
|
}));
|
|
89
89
|
|
|
90
|
-
mock.module("../
|
|
90
|
+
mock.module("../persistence/cleanup-schedule-state.js", () => ({
|
|
91
91
|
resetCleanupScheduleThrottle: () => {},
|
|
92
92
|
}));
|
|
93
93
|
|
|
@@ -69,12 +69,12 @@ mock.module("../runtime/channel-verification-service.js", () => ({
|
|
|
69
69
|
},
|
|
70
70
|
}));
|
|
71
71
|
|
|
72
|
-
import type { TrustContext } from "../daemon/trust-context.js";
|
|
73
72
|
import {
|
|
74
73
|
createCanonicalGuardianRequest,
|
|
75
74
|
generateCanonicalRequestCode,
|
|
76
75
|
listCanonicalGuardianDeliveries,
|
|
77
|
-
} from "../
|
|
76
|
+
} from "../contacts/canonical-guardian-store.js";
|
|
77
|
+
import type { TrustContext } from "../daemon/trust-context.js";
|
|
78
78
|
import { getDb } from "../persistence/db-connection.js";
|
|
79
79
|
import { initializeDb } from "../persistence/db-init.js";
|
|
80
80
|
import { bridgeConfirmationRequestToGuardian } from "../runtime/confirmation-request-guardian-bridge.js";
|
|
@@ -2,10 +2,10 @@ import { beforeEach, describe, expect, test } from "bun:test";
|
|
|
2
2
|
|
|
3
3
|
import { searchConversationSource } from "../memory/context-search/sources/conversations.js";
|
|
4
4
|
import type { RecallSearchContext } from "../memory/context-search/types.js";
|
|
5
|
-
import { rawRun } from "../memory/raw-query.js";
|
|
6
5
|
import { writeSlackMetadata } from "../messaging/providers/slack/message-metadata.js";
|
|
7
6
|
import { getDb } from "../persistence/db-connection.js";
|
|
8
7
|
import { initializeDb } from "../persistence/db-init.js";
|
|
8
|
+
import { rawRun } from "../persistence/raw-query.js";
|
|
9
9
|
await initializeDb();
|
|
10
10
|
|
|
11
11
|
let seedId = 0;
|
|
@@ -282,7 +282,7 @@ mock.module("../agent/loop.js", () => ({
|
|
|
282
282
|
}
|
|
283
283
|
},
|
|
284
284
|
}));
|
|
285
|
-
mock.module("../
|
|
285
|
+
mock.module("../contacts/canonical-guardian-store.js", () => ({
|
|
286
286
|
listPendingCanonicalGuardianRequestsByDestinationConversation: () => [],
|
|
287
287
|
listCanonicalGuardianRequests: () => [],
|
|
288
288
|
listPendingRequestsByConversationScope: () => [],
|