@elizaos/agent 2.0.0-alpha.173 → 2.0.0-alpha.192
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/apps/app-companion/src/actions/emote.d.ts.map +1 -1
- package/apps/app-companion/src/actions/emote.js +1 -0
- package/apps/app-elizamaker/src/drop-routes.d.ts +22 -0
- package/apps/app-elizamaker/src/drop-routes.d.ts.map +1 -0
- package/apps/app-elizamaker/src/drop-service.d.ts +26 -0
- package/apps/app-elizamaker/src/drop-service.d.ts.map +1 -0
- package/apps/app-elizamaker/src/index.d.ts +8 -0
- package/apps/app-elizamaker/src/index.d.ts.map +1 -0
- package/apps/app-elizamaker/src/index.js +5 -0
- package/apps/app-elizamaker/src/merkle-tree.d.ts.map +1 -0
- package/apps/app-elizamaker/src/og-tracker.d.ts.map +1 -0
- package/apps/app-elizamaker/src/og-tracker.js +60 -0
- package/apps/app-elizamaker/src/twitter-verify.d.ts +25 -0
- package/apps/app-elizamaker/src/twitter-verify.d.ts.map +1 -0
- package/apps/app-elizamaker/src/twitter-verify.js +168 -0
- package/apps/app-lifeops/src/actions/activity-report.d.ts +13 -0
- package/apps/app-lifeops/src/actions/activity-report.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/activity-report.js +287 -0
- package/apps/app-lifeops/src/actions/app-blocker.d.ts +5 -0
- package/apps/app-lifeops/src/actions/app-blocker.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/app-blocker.js +446 -0
- package/apps/app-lifeops/src/actions/autofill.d.ts +35 -0
- package/apps/app-lifeops/src/actions/autofill.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/autofill.js +340 -0
- package/apps/app-lifeops/src/actions/browser-extension.d.ts +19 -0
- package/apps/app-lifeops/src/actions/browser-extension.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/browser-extension.js +88 -0
- package/apps/app-lifeops/src/actions/calendar.d.ts.map +1 -1
- package/apps/app-lifeops/src/actions/calendar.js +405 -973
- package/apps/app-lifeops/src/actions/calendly.d.ts +3 -0
- package/apps/app-lifeops/src/actions/calendly.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/calendly.js +242 -0
- package/apps/app-lifeops/src/actions/checkin.d.ts +4 -0
- package/apps/app-lifeops/src/actions/checkin.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/checkin.js +72 -0
- package/apps/app-lifeops/src/actions/computer-use.d.ts +14 -0
- package/apps/app-lifeops/src/actions/computer-use.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/computer-use.js +149 -0
- package/apps/app-lifeops/src/actions/cross-channel-send.d.ts +22 -0
- package/apps/app-lifeops/src/actions/cross-channel-send.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/cross-channel-send.js +562 -0
- package/apps/app-lifeops/src/actions/device-bus.d.ts +19 -0
- package/apps/app-lifeops/src/actions/device-bus.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/device-bus.js +233 -0
- package/apps/app-lifeops/src/actions/dossier.d.ts +5 -0
- package/apps/app-lifeops/src/actions/dossier.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/dossier.js +195 -0
- package/apps/app-lifeops/src/actions/gmail.d.ts.map +1 -1
- package/apps/app-lifeops/src/actions/gmail.js +73 -37
- package/apps/app-lifeops/src/actions/health.d.ts +9 -0
- package/apps/app-lifeops/src/actions/health.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/health.js +357 -0
- package/apps/app-lifeops/src/actions/inbox.d.ts +3 -1
- package/apps/app-lifeops/src/actions/inbox.d.ts.map +1 -1
- package/apps/app-lifeops/src/actions/inbox.js +279 -152
- package/apps/app-lifeops/src/actions/intent-sync.d.ts +3 -0
- package/apps/app-lifeops/src/actions/intent-sync.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/intent-sync.js +258 -0
- package/apps/app-lifeops/src/actions/life.d.ts +0 -4
- package/apps/app-lifeops/src/actions/life.d.ts.map +1 -1
- package/apps/app-lifeops/src/actions/life.js +162 -249
- package/apps/app-lifeops/src/actions/lifeops-google-helpers.d.ts.map +1 -1
- package/apps/app-lifeops/src/actions/lifeops-google-helpers.js +11 -3
- package/apps/app-lifeops/src/actions/list-remote-sessions.d.ts +6 -0
- package/apps/app-lifeops/src/actions/list-remote-sessions.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/list-remote-sessions.js +45 -0
- package/apps/app-lifeops/src/actions/password-manager.d.ts +3 -0
- package/apps/app-lifeops/src/actions/password-manager.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/password-manager.js +182 -0
- package/apps/app-lifeops/src/actions/relationships.d.ts +9 -0
- package/apps/app-lifeops/src/actions/relationships.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/relationships.js +504 -0
- package/apps/app-lifeops/src/actions/remote-desktop.d.ts +3 -0
- package/apps/app-lifeops/src/actions/remote-desktop.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/remote-desktop.js +244 -0
- package/apps/app-lifeops/src/actions/revoke-remote-session.d.ts +6 -0
- package/apps/app-lifeops/src/actions/revoke-remote-session.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/revoke-remote-session.js +73 -0
- package/apps/app-lifeops/src/actions/scheduling.d.ts +55 -0
- package/apps/app-lifeops/src/actions/scheduling.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/scheduling.js +914 -0
- package/apps/app-lifeops/src/actions/screen-time.d.ts +8 -0
- package/apps/app-lifeops/src/actions/screen-time.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/screen-time.js +231 -0
- package/apps/app-lifeops/src/actions/search-across-channels.d.ts +13 -0
- package/apps/app-lifeops/src/actions/search-across-channels.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/search-across-channels.js +340 -0
- package/apps/app-lifeops/src/actions/start-remote-session.d.ts +14 -0
- package/apps/app-lifeops/src/actions/start-remote-session.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/start-remote-session.js +138 -0
- package/apps/app-lifeops/src/actions/twilio-call.d.ts +20 -0
- package/apps/app-lifeops/src/actions/twilio-call.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/twilio-call.js +510 -0
- package/apps/app-lifeops/src/actions/update-owner-profile.d.ts +3 -1
- package/apps/app-lifeops/src/actions/update-owner-profile.d.ts.map +1 -1
- package/apps/app-lifeops/src/actions/update-owner-profile.js +52 -31
- package/apps/app-lifeops/src/actions/website-blocker.d.ts +10 -0
- package/apps/app-lifeops/src/actions/website-blocker.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/website-blocker.js +539 -0
- package/apps/app-lifeops/src/actions/x-read.d.ts +3 -0
- package/apps/app-lifeops/src/actions/x-read.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/x-read.js +367 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-repo.d.ts +28 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-repo.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-repo.js +62 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-reporting.d.ts +45 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-reporting.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-reporting.js +112 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-service.d.ts +26 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-service.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/activity-tracker-service.js +84 -0
- package/apps/app-lifeops/src/activity-profile/analyzer.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/analyzer.js +544 -0
- package/apps/app-lifeops/src/activity-profile/proactive-planner.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/proactive-planner.js +458 -0
- package/apps/app-lifeops/src/activity-profile/proactive-worker.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/proactive-worker.js +571 -0
- package/apps/app-lifeops/src/activity-profile/profile-metadata.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/redactor.d.ts +18 -0
- package/apps/app-lifeops/src/activity-profile/redactor.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/redactor.js +39 -0
- package/apps/app-lifeops/src/activity-profile/service.d.ts +11 -0
- package/apps/app-lifeops/src/activity-profile/service.d.ts.map +1 -0
- package/apps/app-lifeops/src/activity-profile/service.js +229 -0
- package/apps/app-lifeops/src/activity-profile/types.d.ts.map +1 -0
- package/apps/app-lifeops/src/app-blocker/access.d.ts +8 -0
- package/apps/app-lifeops/src/app-blocker/access.d.ts.map +1 -0
- package/apps/app-lifeops/src/app-blocker/access.js +28 -0
- package/apps/app-lifeops/src/app-blocker/engine.d.ts +10 -0
- package/apps/app-lifeops/src/app-blocker/engine.d.ts.map +1 -0
- package/apps/app-lifeops/src/app-blocker/engine.js +43 -0
- package/apps/app-lifeops/src/dossier/action.d.ts +9 -0
- package/apps/app-lifeops/src/dossier/action.d.ts.map +1 -0
- package/apps/app-lifeops/src/dossier/action.js +87 -0
- package/apps/app-lifeops/src/dossier/service.d.ts +145 -0
- package/apps/app-lifeops/src/dossier/service.d.ts.map +1 -0
- package/apps/app-lifeops/src/dossier/service.js +346 -0
- package/apps/app-lifeops/src/followup/actions/listOverdueFollowups.d.ts +3 -0
- package/apps/app-lifeops/src/followup/actions/listOverdueFollowups.d.ts.map +1 -0
- package/apps/app-lifeops/src/followup/actions/listOverdueFollowups.js +47 -0
- package/apps/app-lifeops/src/followup/actions/markFollowupDone.d.ts +3 -0
- package/apps/app-lifeops/src/followup/actions/markFollowupDone.d.ts.map +1 -0
- package/apps/app-lifeops/src/followup/actions/markFollowupDone.js +172 -0
- package/apps/app-lifeops/src/followup/actions/setFollowupThreshold.d.ts +3 -0
- package/apps/app-lifeops/src/followup/actions/setFollowupThreshold.d.ts.map +1 -0
- package/apps/app-lifeops/src/followup/actions/setFollowupThreshold.js +171 -0
- package/apps/app-lifeops/src/followup/followup-tracker.d.ts +81 -0
- package/apps/app-lifeops/src/followup/followup-tracker.d.ts.map +1 -0
- package/apps/app-lifeops/src/followup/followup-tracker.js +251 -0
- package/apps/app-lifeops/src/followup/index.d.ts +5 -0
- package/apps/app-lifeops/src/followup/index.d.ts.map +1 -0
- package/apps/app-lifeops/src/followup/index.js +4 -0
- package/apps/app-lifeops/src/inbox/reflection.d.ts +0 -5
- package/apps/app-lifeops/src/inbox/reflection.d.ts.map +1 -1
- package/apps/app-lifeops/src/inbox/reflection.js +9 -51
- package/apps/app-lifeops/src/inbox/repository.d.ts +0 -1
- package/apps/app-lifeops/src/inbox/repository.d.ts.map +1 -1
- package/apps/app-lifeops/src/inbox/repository.js +18 -118
- package/apps/app-lifeops/src/inbox/triage-classifier.d.ts +4 -6
- package/apps/app-lifeops/src/inbox/triage-classifier.d.ts.map +1 -1
- package/apps/app-lifeops/src/inbox/triage-classifier.js +68 -101
- package/apps/app-lifeops/src/inbox/types.d.ts +4 -42
- package/apps/app-lifeops/src/inbox/types.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/approval-queue.types.d.ts +162 -0
- package/apps/app-lifeops/src/lifeops/approval-queue.types.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/approval-queue.types.js +41 -0
- package/apps/app-lifeops/src/lifeops/autofill-whitelist.d.ts +24 -0
- package/apps/app-lifeops/src/lifeops/autofill-whitelist.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/autofill-whitelist.js +125 -0
- package/apps/app-lifeops/src/lifeops/background-planner-dispatch.d.ts +59 -0
- package/apps/app-lifeops/src/lifeops/background-planner-dispatch.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/background-planner-dispatch.js +129 -0
- package/apps/app-lifeops/src/lifeops/background-planner.d.ts +141 -0
- package/apps/app-lifeops/src/lifeops/background-planner.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/background-planner.js +308 -0
- package/apps/app-lifeops/src/lifeops/browser-extension-store.d.ts +61 -0
- package/apps/app-lifeops/src/lifeops/browser-extension-store.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/browser-extension-store.js +181 -0
- package/apps/app-lifeops/src/lifeops/calendly-client.d.ts +61 -0
- package/apps/app-lifeops/src/lifeops/calendly-client.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/calendly-client.js +218 -0
- package/apps/app-lifeops/src/lifeops/checkin/checkin-service.d.ts +24 -0
- package/apps/app-lifeops/src/lifeops/checkin/checkin-service.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/checkin/checkin-service.js +216 -0
- package/apps/app-lifeops/src/lifeops/checkin/schedule-resolver.d.ts +14 -0
- package/apps/app-lifeops/src/lifeops/checkin/schedule-resolver.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/checkin/schedule-resolver.js +33 -0
- package/apps/app-lifeops/src/lifeops/checkin/types.d.ts +42 -0
- package/apps/app-lifeops/src/lifeops/checkin/types.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/checkin/types.js +7 -0
- package/apps/app-lifeops/src/lifeops/defaults.d.ts +1 -1
- package/apps/app-lifeops/src/lifeops/defaults.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/defaults.js +8 -1
- package/apps/app-lifeops/src/lifeops/discord-browser-scraper.d.ts +106 -0
- package/apps/app-lifeops/src/lifeops/discord-browser-scraper.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/discord-browser-scraper.js +488 -0
- package/apps/app-lifeops/src/lifeops/enforcement-windows.d.ts +34 -0
- package/apps/app-lifeops/src/lifeops/enforcement-windows.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/enforcement-windows.js +110 -0
- package/apps/app-lifeops/src/lifeops/google-connector-gateway.d.ts +13 -0
- package/apps/app-lifeops/src/lifeops/google-connector-gateway.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-connector-gateway.js +23 -0
- package/apps/app-lifeops/src/lifeops/google-drive.d.ts +103 -0
- package/apps/app-lifeops/src/lifeops/google-drive.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/google-drive.js +265 -0
- package/apps/app-lifeops/src/lifeops/google-fetch.d.ts +5 -0
- package/apps/app-lifeops/src/lifeops/google-fetch.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-fetch.js +12 -1
- package/apps/app-lifeops/src/lifeops/google-gmail.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-gmail.js +19 -34
- package/apps/app-lifeops/src/lifeops/google-managed-client.d.ts +12 -1
- package/apps/app-lifeops/src/lifeops/google-managed-client.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-managed-client.js +32 -12
- package/apps/app-lifeops/src/lifeops/google-oauth.d.ts +4 -0
- package/apps/app-lifeops/src/lifeops/google-oauth.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-oauth.js +99 -13
- package/apps/app-lifeops/src/lifeops/health-bridge.d.ts +57 -0
- package/apps/app-lifeops/src/lifeops/health-bridge.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/health-bridge.js +514 -0
- package/apps/app-lifeops/src/lifeops/imessage-bridge.d.ts +98 -0
- package/apps/app-lifeops/src/lifeops/imessage-bridge.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/imessage-bridge.js +537 -0
- package/apps/app-lifeops/src/lifeops/intent-sync.d.ts +56 -0
- package/apps/app-lifeops/src/lifeops/intent-sync.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/intent-sync.js +223 -0
- package/apps/app-lifeops/src/lifeops/notifications-push.d.ts +37 -0
- package/apps/app-lifeops/src/lifeops/notifications-push.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/notifications-push.js +90 -0
- package/apps/app-lifeops/src/lifeops/owner-profile.d.ts +29 -1
- package/apps/app-lifeops/src/lifeops/owner-profile.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/owner-profile.js +106 -0
- package/apps/app-lifeops/src/lifeops/password-manager-bridge.d.ts +49 -0
- package/apps/app-lifeops/src/lifeops/password-manager-bridge.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/password-manager-bridge.js +374 -0
- package/apps/app-lifeops/src/lifeops/remote-desktop.d.ts +37 -0
- package/apps/app-lifeops/src/lifeops/remote-desktop.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/remote-desktop.js +341 -0
- package/apps/app-lifeops/src/lifeops/repository.d.ts +69 -3
- package/apps/app-lifeops/src/lifeops/repository.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/repository.js +1368 -926
- package/apps/app-lifeops/src/lifeops/runtime.d.ts +1 -0
- package/apps/app-lifeops/src/lifeops/runtime.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/runtime.js +119 -9
- package/apps/app-lifeops/src/lifeops/schema.d.ts +5022 -0
- package/apps/app-lifeops/src/lifeops/schema.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/schema.js +207 -0
- package/apps/app-lifeops/src/lifeops/service-constants.d.ts +51 -0
- package/apps/app-lifeops/src/lifeops/service-constants.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-constants.js +111 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-browser.d.ts +40 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-browser.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-browser.js +288 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-misc.d.ts +68 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-misc.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-misc.js +493 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-occurrence.d.ts +17 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-occurrence.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-occurrence.js +214 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-reminder.d.ts +24 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-reminder.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-helpers-reminder.js +170 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-browser.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-browser.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-browser.js +769 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-calendar.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-calendar.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-calendar.js +513 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-core.d.ts +49 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-core.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-core.js +433 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-definitions.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-definitions.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-definitions.js +353 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-discord.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-discord.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-discord.js +603 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-dossier.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-dossier.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-dossier.js +262 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-drive.d.ts +12 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-drive.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-drive.js +230 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-gmail.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-gmail.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-gmail.js +1013 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-goals.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-goals.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-goals.js +714 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-google.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-google.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-google.js +793 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-health.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-health.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-health.js +55 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-imessage.d.ts +3 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-imessage.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-imessage.js +106 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-relationships.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-relationships.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-relationships.js +109 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-reminders.d.ts +37 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-reminders.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-reminders.js +2436 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-scheduling.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-scheduling.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-scheduling.js +149 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-screentime.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-screentime.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-screentime.js +97 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-signal.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-signal.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-signal.js +264 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-telegram.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-telegram.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-telegram.js +270 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-whatsapp.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-whatsapp.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-whatsapp.js +56 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-workflows.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-workflows.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-workflows.js +411 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-x-read.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-x-read.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-x-read.js +190 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-x.d.ts +2 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-x.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-x.js +120 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-calendar.d.ts +42 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-calendar.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-calendar.js +294 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-connector.d.ts +18 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-connector.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-connector.js +317 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-gmail.d.ts +63 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-gmail.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-gmail.js +553 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-task.d.ts +8 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-task.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-task.js +333 -0
- package/apps/app-lifeops/src/lifeops/service-normalize.d.ts +27 -0
- package/apps/app-lifeops/src/lifeops/service-normalize.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-normalize.js +193 -0
- package/apps/app-lifeops/src/lifeops/service-types.d.ts +43 -0
- package/apps/app-lifeops/src/lifeops/service-types.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/service-types.js +8 -0
- package/apps/app-lifeops/src/lifeops/service.d.ts +1566 -272
- package/apps/app-lifeops/src/lifeops/service.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service.js +38 -9256
- package/apps/app-lifeops/src/lifeops/signal-auth.d.ts +26 -0
- package/apps/app-lifeops/src/lifeops/signal-auth.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/signal-auth.js +300 -0
- package/apps/app-lifeops/src/lifeops/signal-runtime-config.d.ts +13 -0
- package/apps/app-lifeops/src/lifeops/signal-runtime-config.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/signal-runtime-config.js +42 -0
- package/apps/app-lifeops/src/lifeops/sql.d.ts +0 -5
- package/apps/app-lifeops/src/lifeops/sql.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/sql.js +5 -125
- package/apps/app-lifeops/src/lifeops/telegram-auth.d.ts +62 -0
- package/apps/app-lifeops/src/lifeops/telegram-auth.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/telegram-auth.js +496 -0
- package/apps/app-lifeops/src/lifeops/telegram-local-client.d.ts +118 -0
- package/apps/app-lifeops/src/lifeops/telegram-local-client.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/telegram-local-client.js +376 -0
- package/apps/app-lifeops/src/lifeops/twilio.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/twilio.js +2 -1
- package/apps/app-lifeops/src/lifeops/unified-search.d.ts +88 -0
- package/apps/app-lifeops/src/lifeops/unified-search.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/unified-search.js +431 -0
- package/apps/app-lifeops/src/lifeops/whatsapp-client.d.ts +47 -0
- package/apps/app-lifeops/src/lifeops/whatsapp-client.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/whatsapp-client.js +198 -0
- package/apps/app-lifeops/src/lifeops/x-poster.d.ts +22 -0
- package/apps/app-lifeops/src/lifeops/x-poster.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/x-poster.js +67 -3
- package/apps/app-lifeops/src/lifeops/x-reader.d.ts +70 -0
- package/apps/app-lifeops/src/lifeops/x-reader.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/x-reader.js +260 -0
- package/apps/app-lifeops/src/plugin.d.ts +12 -1
- package/apps/app-lifeops/src/plugin.d.ts.map +1 -1
- package/apps/app-lifeops/src/plugin.js +245 -26
- package/apps/app-lifeops/src/provider.d.ts.map +1 -1
- package/apps/app-lifeops/src/provider.js +1 -0
- package/apps/app-lifeops/src/providers/activity-profile.d.ts.map +1 -0
- package/apps/app-lifeops/src/providers/activity-profile.js +140 -0
- package/apps/app-lifeops/src/providers/app-blocker.d.ts +3 -0
- package/apps/app-lifeops/src/providers/app-blocker.d.ts.map +1 -0
- package/apps/app-lifeops/src/providers/app-blocker.js +86 -0
- package/apps/app-lifeops/src/providers/cross-channel-context.d.ts +29 -0
- package/apps/app-lifeops/src/providers/cross-channel-context.d.ts.map +1 -0
- package/apps/app-lifeops/src/providers/cross-channel-context.js +193 -0
- package/apps/app-lifeops/src/providers/inbox-triage.d.ts.map +1 -1
- package/apps/app-lifeops/src/providers/inbox-triage.js +1 -0
- package/apps/app-lifeops/src/providers/lifeops.d.ts +1 -1
- package/apps/app-lifeops/src/providers/lifeops.d.ts.map +1 -1
- package/apps/app-lifeops/src/providers/lifeops.js +39 -11
- package/apps/app-lifeops/src/providers/website-blocker.d.ts +4 -0
- package/apps/app-lifeops/src/providers/website-blocker.d.ts.map +1 -0
- package/apps/app-lifeops/src/providers/website-blocker.js +117 -0
- package/apps/app-lifeops/src/remote/pairing-code.d.ts +39 -0
- package/apps/app-lifeops/src/remote/pairing-code.d.ts.map +1 -0
- package/apps/app-lifeops/src/remote/pairing-code.js +76 -0
- package/apps/app-lifeops/src/remote/remote-session-service.d.ts +107 -0
- package/apps/app-lifeops/src/remote/remote-session-service.d.ts.map +1 -0
- package/apps/app-lifeops/src/remote/remote-session-service.js +253 -0
- package/apps/app-lifeops/src/routes/lifeops-browser-packaging.d.ts.map +1 -1
- package/apps/app-lifeops/src/routes/lifeops-browser-packaging.js +9 -3
- package/apps/app-lifeops/src/routes/lifeops-routes.d.ts +1 -1
- package/apps/app-lifeops/src/routes/lifeops-routes.d.ts.map +1 -1
- package/apps/app-lifeops/src/routes/lifeops-routes.js +276 -40
- package/apps/app-lifeops/src/routes/website-blocker-routes.d.ts.map +1 -1
- package/apps/app-lifeops/src/routes/website-blocker-routes.js +8 -13
- package/apps/app-lifeops/src/travel-time/action.d.ts +6 -0
- package/apps/app-lifeops/src/travel-time/action.d.ts.map +1 -0
- package/apps/app-lifeops/src/travel-time/action.js +81 -0
- package/apps/app-lifeops/src/travel-time/service.d.ts +61 -0
- package/apps/app-lifeops/src/travel-time/service.d.ts.map +1 -0
- package/apps/app-lifeops/src/travel-time/service.js +145 -0
- package/apps/app-lifeops/src/types/app-blocker-settings-card.d.ts +2 -0
- package/apps/app-lifeops/src/types/app-blocker-settings-card.d.ts.map +1 -0
- package/apps/app-lifeops/src/types/index.d.ts +3 -0
- package/apps/app-lifeops/src/types/index.d.ts.map +1 -0
- package/apps/app-lifeops/src/types/website-blocker-settings-card.d.ts +2 -0
- package/apps/app-lifeops/src/types/website-blocker-settings-card.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/access.d.ts +8 -0
- package/apps/app-lifeops/src/website-blocker/access.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/access.js +32 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/blockUntilTaskComplete.d.ts +3 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/blockUntilTaskComplete.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/blockUntilTaskComplete.js +212 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/listActiveBlocks.d.ts +3 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/listActiveBlocks.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/listActiveBlocks.js +57 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/releaseBlock.d.ts +3 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/releaseBlock.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/actions/releaseBlock.js +98 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-reconciler.d.ts +7 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-reconciler.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-reconciler.js +111 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-schema.d.ts +39 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-schema.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-schema.js +123 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-service.d.ts +21 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-service.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/block-rule-service.js +227 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/index.d.ts +8 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/index.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/chat-integration/index.js +6 -0
- package/apps/app-lifeops/src/website-blocker/engine.d.ts +116 -0
- package/apps/app-lifeops/src/website-blocker/engine.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/engine.js +934 -0
- package/apps/app-lifeops/src/website-blocker/permissions.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/permissions.js +1 -0
- package/apps/app-lifeops/src/website-blocker/public.d.ts +13 -0
- package/apps/app-lifeops/src/website-blocker/public.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/public.js +10 -0
- package/apps/app-lifeops/src/website-blocker/roles.d.ts +13 -0
- package/apps/app-lifeops/src/website-blocker/roles.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/roles.js +20 -0
- package/apps/app-lifeops/src/website-blocker/service.d.ts +21 -0
- package/apps/app-lifeops/src/website-blocker/service.d.ts.map +1 -0
- package/apps/app-lifeops/src/website-blocker/service.js +268 -0
- package/apps/app-steward/src/api/tx-service.d.ts +47 -0
- package/apps/app-steward/src/api/tx-service.d.ts.map +1 -0
- package/apps/app-steward/src/api/tx-service.js +156 -0
- package/apps/app-steward/src/api/wallet-routes.d.ts +1 -9
- package/apps/app-steward/src/api/wallet-routes.d.ts.map +1 -1
- package/apps/app-steward/src/routes/wallet-export-guard.d.ts +2 -9
- package/apps/app-steward/src/routes/wallet-export-guard.d.ts.map +1 -1
- package/apps/app-steward/src/types/steward.d.ts +85 -0
- package/apps/app-steward/src/types/steward.d.ts.map +1 -0
- package/apps/app-steward/src/types/steward.js +9 -0
- package/apps/app-training/src/backends/atropos.d.ts +31 -0
- package/apps/app-training/src/backends/atropos.d.ts.map +1 -0
- package/apps/app-training/src/backends/atropos.js +63 -0
- package/apps/app-training/src/backends/native.d.ts +50 -0
- package/apps/app-training/src/backends/native.d.ts.map +1 -0
- package/apps/app-training/src/backends/native.js +128 -0
- package/apps/app-training/src/backends/tinker.d.ts +27 -0
- package/apps/app-training/src/backends/tinker.d.ts.map +1 -0
- package/apps/app-training/src/backends/tinker.js +56 -0
- package/apps/app-training/src/core/privacy-filter.d.ts +73 -0
- package/apps/app-training/src/core/privacy-filter.d.ts.map +1 -0
- package/apps/app-training/src/core/privacy-filter.js +169 -0
- package/apps/app-training/src/core/training-config.d.ts +52 -0
- package/apps/app-training/src/core/training-config.d.ts.map +1 -0
- package/apps/app-training/src/core/training-config.js +140 -0
- package/apps/app-training/src/core/training-orchestrator.d.ts +107 -0
- package/apps/app-training/src/core/training-orchestrator.d.ts.map +1 -0
- package/apps/app-training/src/core/training-orchestrator.js +409 -0
- package/apps/app-training/src/core/trajectory-task-datasets.d.ts +38 -0
- package/apps/app-training/src/core/trajectory-task-datasets.d.ts.map +1 -0
- package/apps/app-training/src/core/trajectory-task-datasets.js +281 -0
- package/apps/app-training/src/optimizers/bootstrap-fewshot.d.ts +42 -0
- package/apps/app-training/src/optimizers/bootstrap-fewshot.d.ts.map +1 -0
- package/apps/app-training/src/optimizers/bootstrap-fewshot.js +91 -0
- package/apps/app-training/src/optimizers/index.d.ts +6 -0
- package/apps/app-training/src/optimizers/index.d.ts.map +1 -0
- package/apps/app-training/src/optimizers/index.js +4 -0
- package/apps/app-training/src/optimizers/instruction-search.d.ts +39 -0
- package/apps/app-training/src/optimizers/instruction-search.d.ts.map +1 -0
- package/apps/app-training/src/optimizers/instruction-search.js +82 -0
- package/apps/app-training/src/optimizers/prompt-evolution.d.ts +39 -0
- package/apps/app-training/src/optimizers/prompt-evolution.d.ts.map +1 -0
- package/apps/app-training/src/optimizers/prompt-evolution.js +111 -0
- package/apps/app-training/src/optimizers/scoring.d.ts +63 -0
- package/apps/app-training/src/optimizers/scoring.d.ts.map +1 -0
- package/apps/app-training/src/optimizers/scoring.js +117 -0
- package/apps/app-training/src/optimizers/types.d.ts +105 -0
- package/apps/app-training/src/optimizers/types.d.ts.map +1 -0
- package/apps/app-training/src/optimizers/types.js +17 -0
- package/apps/app-training/src/services/index.d.ts +1 -0
- package/apps/app-training/src/services/index.d.ts.map +1 -1
- package/apps/app-training/src/services/index.js +1 -0
- package/apps/app-training/src/services/training-trigger.d.ts +166 -0
- package/apps/app-training/src/services/training-trigger.d.ts.map +1 -0
- package/apps/app-training/src/services/training-trigger.js +376 -0
- package/package.json +26 -21
- package/packages/agent/src/actions/app-control.js +1 -1
- package/packages/agent/src/actions/connector-resolver.d.ts.map +1 -1
- package/packages/agent/src/actions/connector-resolver.js +17 -7
- package/packages/agent/src/actions/context-signal-lexicon.d.ts +1 -1
- package/packages/agent/src/actions/context-signal-lexicon.d.ts.map +1 -1
- package/packages/agent/src/actions/context-signal-lexicon.js +7 -1
- package/packages/agent/src/actions/context-signal.d.ts +1 -1
- package/packages/agent/src/actions/context-signal.d.ts.map +1 -1
- package/packages/agent/src/actions/context-signal.js +1 -1
- package/packages/agent/src/actions/eject-plugin.d.ts.map +1 -1
- package/packages/agent/src/actions/eject-plugin.js +3 -1
- package/packages/agent/src/actions/entity-actions.d.ts +1 -0
- package/packages/agent/src/actions/entity-actions.d.ts.map +1 -1
- package/packages/agent/src/actions/entity-actions.js +233 -1
- package/packages/agent/src/actions/get-self-status.d.ts.map +1 -1
- package/packages/agent/src/actions/get-self-status.js +12 -1
- package/packages/agent/src/actions/grounded-action-reply.d.ts.map +1 -1
- package/packages/agent/src/actions/grounded-action-reply.js +1 -1
- package/packages/agent/src/actions/index.d.ts +0 -9
- package/packages/agent/src/actions/index.d.ts.map +1 -1
- package/packages/agent/src/actions/index.js +0 -9
- package/packages/agent/src/actions/install-plugin.d.ts.map +1 -1
- package/packages/agent/src/actions/install-plugin.js +3 -1
- package/packages/agent/src/actions/list-ejected.d.ts.map +1 -1
- package/packages/agent/src/actions/list-ejected.js +5 -3
- package/packages/agent/src/actions/reinject-plugin.d.ts.map +1 -1
- package/packages/agent/src/actions/reinject-plugin.js +3 -1
- package/packages/agent/src/actions/set-user-name.d.ts.map +1 -1
- package/packages/agent/src/actions/set-user-name.js +1 -1
- package/packages/agent/src/actions/sync-plugin.d.ts.map +1 -1
- package/packages/agent/src/actions/sync-plugin.js +5 -6
- package/packages/agent/src/api/agent-admin-routes.js +1 -1
- package/packages/agent/src/api/apps-routes.d.ts +2 -1
- package/packages/agent/src/api/apps-routes.d.ts.map +1 -1
- package/packages/agent/src/api/apps-routes.js +152 -2
- package/packages/agent/src/api/auth-routes.js +1 -1
- package/packages/agent/src/api/bsc-trade.d.ts +0 -4
- package/packages/agent/src/api/bsc-trade.d.ts.map +1 -1
- package/packages/agent/src/api/bsc-trade.js +0 -4
- package/packages/agent/src/api/character-routes.d.ts +2 -1
- package/packages/agent/src/api/character-routes.d.ts.map +1 -1
- package/packages/agent/src/api/chat-augmentation.js +1 -1
- package/packages/agent/src/api/chat-routes.d.ts.map +1 -1
- package/packages/agent/src/api/chat-routes.js +23 -108
- package/packages/agent/src/api/cloud-billing-routes.d.ts +1 -1
- package/packages/agent/src/api/cloud-billing-routes.d.ts.map +1 -1
- package/packages/agent/src/api/cloud-compat-routes.d.ts +1 -1
- package/packages/agent/src/api/cloud-compat-routes.d.ts.map +1 -1
- package/packages/agent/src/api/connector-health.d.ts +1 -1
- package/packages/agent/src/api/connector-health.d.ts.map +1 -1
- package/packages/agent/src/api/conversation-routes.d.ts +2 -2
- package/packages/agent/src/api/conversation-routes.d.ts.map +1 -1
- package/packages/agent/src/api/conversation-routes.js +1 -1
- package/packages/agent/src/api/curated-skills-routes.d.ts +22 -0
- package/packages/agent/src/api/curated-skills-routes.d.ts.map +1 -0
- package/packages/agent/src/api/curated-skills-routes.js +300 -0
- package/packages/agent/src/api/database.d.ts.map +1 -1
- package/packages/agent/src/api/database.js +11 -4
- package/packages/agent/src/api/discord-profiles.d.ts.map +1 -1
- package/packages/agent/src/api/discord-profiles.js +1 -4
- package/packages/agent/src/api/index.d.ts +0 -7
- package/packages/agent/src/api/index.d.ts.map +1 -1
- package/packages/agent/src/api/index.js +0 -7
- package/packages/agent/src/api/knowledge-routes.d.ts +22 -1
- package/packages/agent/src/api/knowledge-routes.d.ts.map +1 -1
- package/packages/agent/src/api/knowledge-routes.js +956 -2
- package/packages/agent/src/api/lifeops-browser-packaging.d.ts +1 -1
- package/packages/agent/src/api/lifeops-browser-packaging.d.ts.map +1 -1
- package/packages/agent/src/api/lifeops-browser-packaging.js +1 -1
- package/packages/agent/src/api/misc-routes.d.ts +2 -2
- package/packages/agent/src/api/misc-routes.d.ts.map +1 -1
- package/packages/agent/src/api/misc-routes.js +43 -6
- package/packages/agent/src/api/plugin-discovery-helpers.d.ts.map +1 -1
- package/packages/agent/src/api/plugin-discovery-helpers.js +2 -2
- package/packages/agent/src/api/plugin-routes.d.ts +1 -1
- package/packages/agent/src/api/plugin-routes.d.ts.map +1 -1
- package/packages/agent/src/api/plugin-routes.js +11 -2
- package/packages/agent/src/api/registry-service.d.ts +1 -1
- package/packages/agent/src/api/registry-service.d.ts.map +1 -1
- package/packages/agent/src/api/relationships-routes.d.ts.map +1 -1
- package/packages/agent/src/api/relationships-routes.js +70 -3
- package/packages/agent/src/api/server-auth.d.ts +2 -9
- package/packages/agent/src/api/server-auth.d.ts.map +1 -1
- package/packages/agent/src/api/server-auth.js +1 -1
- package/packages/agent/src/api/server-helpers-auth.d.ts +39 -0
- package/packages/agent/src/api/server-helpers-auth.d.ts.map +1 -0
- package/packages/agent/src/api/server-helpers-auth.js +432 -0
- package/packages/agent/src/api/server-helpers-config.d.ts +37 -0
- package/packages/agent/src/api/server-helpers-config.d.ts.map +1 -0
- package/packages/agent/src/api/server-helpers-config.js +295 -0
- package/packages/agent/src/api/server-helpers-mcp.d.ts +12 -0
- package/packages/agent/src/api/server-helpers-mcp.d.ts.map +1 -0
- package/packages/agent/src/api/server-helpers-mcp.js +315 -0
- package/packages/agent/src/api/server-helpers-plugin.d.ts +13 -0
- package/packages/agent/src/api/server-helpers-plugin.d.ts.map +1 -0
- package/packages/agent/src/api/server-helpers-plugin.js +158 -0
- package/packages/agent/src/api/server-helpers-swarm.d.ts +57 -0
- package/packages/agent/src/api/server-helpers-swarm.d.ts.map +1 -0
- package/packages/agent/src/api/server-helpers-swarm.js +325 -0
- package/packages/agent/src/api/server-helpers-wallet.d.ts +18 -0
- package/packages/agent/src/api/server-helpers-wallet.d.ts.map +1 -0
- package/packages/agent/src/api/server-helpers-wallet.js +178 -0
- package/packages/agent/src/api/server-helpers.d.ts.map +1 -1
- package/packages/agent/src/api/server-helpers.js +1 -1
- package/packages/agent/src/api/server-types.d.ts +42 -3
- package/packages/agent/src/api/server-types.d.ts.map +1 -1
- package/packages/agent/src/api/server.d.ts +10 -56
- package/packages/agent/src/api/server.d.ts.map +1 -1
- package/packages/agent/src/api/server.js +298 -1436
- package/packages/agent/src/api/signal-routes.d.ts +1 -1
- package/packages/agent/src/api/signal-routes.d.ts.map +1 -1
- package/packages/agent/src/api/signal-routes.js +1 -2
- package/packages/agent/src/api/skill-discovery-helpers.js +2 -0
- package/packages/agent/src/api/skills-routes.d.ts.map +1 -1
- package/packages/agent/src/api/skills-routes.js +69 -0
- package/packages/agent/src/api/static-file-server.js +1 -1
- package/packages/agent/src/api/stream-routes.d.ts +0 -19
- package/packages/agent/src/api/stream-routes.d.ts.map +1 -1
- package/packages/agent/src/api/trade-safety.d.ts +0 -4
- package/packages/agent/src/api/trade-safety.d.ts.map +1 -1
- package/packages/agent/src/api/trade-safety.js +0 -4
- package/packages/agent/src/api/trigger-routes.d.ts +37 -47
- package/packages/agent/src/api/trigger-routes.d.ts.map +1 -1
- package/packages/agent/src/api/trigger-routes.js +89 -18
- package/packages/agent/src/api/tts-routes.d.ts.map +1 -1
- package/packages/agent/src/api/tts-routes.js +1 -1
- package/packages/agent/src/api/tx-service.d.ts +0 -4
- package/packages/agent/src/api/tx-service.d.ts.map +1 -1
- package/packages/agent/src/api/tx-service.js +0 -4
- package/packages/agent/src/api/wallet-bsc-routes.d.ts +0 -4
- package/packages/agent/src/api/wallet-bsc-routes.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-bsc-routes.js +0 -4
- package/packages/agent/src/api/wallet-capability.d.ts +0 -5
- package/packages/agent/src/api/wallet-capability.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-capability.js +0 -5
- package/packages/agent/src/api/wallet-dex-prices.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-dex-prices.js +0 -4
- package/packages/agent/src/api/wallet-env-sync.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-env-sync.js +5 -1
- package/packages/agent/src/api/wallet-evm-balance.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-evm-balance.js +0 -4
- package/packages/agent/src/api/wallet-routes.d.ts +1 -14
- package/packages/agent/src/api/wallet-routes.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-routes.js +9 -15
- package/packages/agent/src/api/wallet-rpc.d.ts +0 -5
- package/packages/agent/src/api/wallet-rpc.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-rpc.js +0 -5
- package/packages/agent/src/api/wallet-trade-routes.d.ts +0 -5
- package/packages/agent/src/api/wallet-trade-routes.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-trade-routes.js +0 -5
- package/packages/agent/src/api/wallet-trading-profile.d.ts +2 -27
- package/packages/agent/src/api/wallet-trading-profile.d.ts.map +1 -1
- package/packages/agent/src/api/wallet-trading-profile.js +0 -5
- package/packages/agent/src/api/wallet.d.ts.map +1 -1
- package/packages/agent/src/api/wallet.js +0 -4
- package/packages/agent/src/api/whatsapp-routes.d.ts +1 -1
- package/packages/agent/src/api/whatsapp-routes.d.ts.map +1 -1
- package/packages/agent/src/api/whatsapp-routes.js +1 -2
- package/packages/agent/src/api/workbench-helpers.d.ts.map +1 -1
- package/packages/agent/src/api/workbench-helpers.js +2 -1
- package/packages/agent/src/api/workbench-routes.d.ts.map +1 -1
- package/packages/agent/src/api/workbench-routes.js +1 -1
- package/packages/agent/src/auth/anthropic.d.ts +0 -5
- package/packages/agent/src/auth/anthropic.d.ts.map +1 -1
- package/packages/agent/src/auth/anthropic.js +0 -5
- package/packages/agent/src/auth/openai-codex.d.ts +0 -5
- package/packages/agent/src/auth/openai-codex.d.ts.map +1 -1
- package/packages/agent/src/auth/openai-codex.js +0 -5
- package/packages/agent/src/cloud/cloud-wallet.d.ts +0 -2
- package/packages/agent/src/cloud/cloud-wallet.d.ts.map +1 -1
- package/packages/agent/src/config/env-vars.d.ts.map +1 -1
- package/packages/agent/src/config/env-vars.js +2 -0
- package/packages/agent/src/config/includes.js +1 -1
- package/packages/agent/src/config/index.d.ts +1 -1
- package/packages/agent/src/config/index.d.ts.map +1 -1
- package/packages/agent/src/config/index.js +1 -1
- package/packages/agent/src/config/plugin-auto-enable.d.ts +8 -0
- package/packages/agent/src/config/plugin-auto-enable.d.ts.map +1 -1
- package/packages/agent/src/config/plugin-auto-enable.js +28 -0
- package/packages/agent/src/config/types.agent-defaults.d.ts +2 -1
- package/packages/agent/src/config/types.agent-defaults.d.ts.map +1 -1
- package/packages/agent/src/config/types.eliza.d.ts +34 -0
- package/packages/agent/src/config/types.eliza.d.ts.map +1 -1
- package/packages/agent/src/contracts/index.d.ts +8 -8
- package/packages/agent/src/contracts/index.d.ts.map +1 -1
- package/packages/agent/src/contracts/index.js +8 -8
- package/packages/agent/src/contracts/onboarding-provider-defaults.d.ts +165 -0
- package/packages/agent/src/contracts/onboarding-provider-defaults.d.ts.map +1 -0
- package/packages/agent/src/contracts/onboarding-provider-defaults.js +189 -0
- package/packages/agent/src/index.d.ts +8 -6
- package/packages/agent/src/index.d.ts.map +1 -1
- package/packages/agent/src/index.js +8 -6
- package/packages/agent/src/providers/conversation-utils.d.ts.map +1 -1
- package/packages/agent/src/providers/conversation-utils.js +2 -3
- package/packages/agent/src/providers/index.d.ts +0 -1
- package/packages/agent/src/providers/index.d.ts.map +1 -1
- package/packages/agent/src/providers/index.js +0 -1
- package/packages/agent/src/providers/user-name.d.ts.map +1 -1
- package/packages/agent/src/providers/user-name.js +1 -1
- package/packages/agent/src/providers/workspace-provider.d.ts +0 -8
- package/packages/agent/src/providers/workspace-provider.d.ts.map +1 -1
- package/packages/agent/src/runtime/custom-actions.js +1 -1
- package/packages/agent/src/runtime/eliza-plugin.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza-plugin.js +1 -47
- package/packages/agent/src/runtime/eliza.d.ts +1 -91
- package/packages/agent/src/runtime/eliza.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza.js +109 -12
- package/packages/agent/src/runtime/first-time-setup.d.ts +20 -0
- package/packages/agent/src/runtime/first-time-setup.d.ts.map +1 -1
- package/packages/agent/src/runtime/first-time-setup.js +20 -25
- package/packages/agent/src/runtime/index.d.ts +1 -1
- package/packages/agent/src/runtime/index.d.ts.map +1 -1
- package/packages/agent/src/runtime/index.js +1 -1
- package/packages/agent/src/runtime/plugin-collector.d.ts +0 -12
- package/packages/agent/src/runtime/plugin-collector.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-lifecycle.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-lifecycle.js +6 -2
- package/packages/agent/src/runtime/plugin-resolver.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-resolver.js +6 -7
- package/packages/agent/src/runtime/plugin-types.d.ts +0 -6
- package/packages/agent/src/runtime/plugin-types.d.ts.map +1 -1
- package/packages/agent/src/runtime/roles/src/utils.d.ts +1 -1
- package/packages/agent/src/runtime/roles/src/utils.d.ts.map +1 -1
- package/packages/agent/src/runtime/roles/src/utils.js +1 -1
- package/packages/agent/src/runtime/subagent-output.d.ts +51 -0
- package/packages/agent/src/runtime/subagent-output.d.ts.map +1 -0
- package/packages/agent/src/runtime/subagent-output.js +173 -0
- package/packages/agent/src/runtime/task-heartbeat.d.ts +22 -0
- package/packages/agent/src/runtime/task-heartbeat.d.ts.map +1 -0
- package/packages/agent/src/runtime/task-heartbeat.js +84 -0
- package/packages/agent/src/runtime/trajectory-internals.d.ts +37 -30
- package/packages/agent/src/runtime/trajectory-internals.d.ts.map +1 -1
- package/packages/agent/src/runtime/trajectory-internals.js +73 -47
- package/packages/agent/src/runtime/trajectory-persistence.d.ts +1 -1
- package/packages/agent/src/runtime/trajectory-persistence.d.ts.map +1 -1
- package/packages/agent/src/runtime/trajectory-persistence.js +1 -1
- package/packages/agent/src/runtime/trajectory-storage.d.ts +27 -1
- package/packages/agent/src/runtime/trajectory-storage.d.ts.map +1 -1
- package/packages/agent/src/runtime/trajectory-storage.js +124 -1
- package/packages/agent/src/runtime/web-search-tools.d.ts.map +1 -1
- package/packages/agent/src/security/access.d.ts.map +1 -1
- package/packages/agent/src/security/access.js +6 -26
- package/packages/agent/src/security/audit-log.d.ts +0 -2
- package/packages/agent/src/security/audit-log.d.ts.map +1 -1
- package/packages/agent/src/security/index.d.ts +1 -0
- package/packages/agent/src/security/index.d.ts.map +1 -1
- package/packages/agent/src/security/index.js +1 -0
- package/packages/agent/src/services/app-manager.d.ts +53 -1
- package/packages/agent/src/services/app-manager.d.ts.map +1 -1
- package/packages/agent/src/services/app-manager.js +219 -15
- package/packages/agent/src/services/app-package-modules.d.ts +3 -12
- package/packages/agent/src/services/app-package-modules.d.ts.map +1 -1
- package/packages/agent/src/services/app-package-modules.js +78 -11
- package/packages/agent/src/services/browser-workspace-desktop.d.ts +22 -0
- package/packages/agent/src/services/browser-workspace-desktop.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-desktop.js +1379 -0
- package/packages/agent/src/services/browser-workspace-elements.d.ts +42 -0
- package/packages/agent/src/services/browser-workspace-elements.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-elements.js +508 -0
- package/packages/agent/src/services/browser-workspace-forms.d.ts +19 -0
- package/packages/agent/src/services/browser-workspace-forms.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-forms.js +244 -0
- package/packages/agent/src/services/browser-workspace-helpers.d.ts +20 -0
- package/packages/agent/src/services/browser-workspace-helpers.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-helpers.js +121 -0
- package/packages/agent/src/services/browser-workspace-jsdom.d.ts +16 -0
- package/packages/agent/src/services/browser-workspace-jsdom.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-jsdom.js +223 -0
- package/packages/agent/src/services/browser-workspace-network.d.ts +7 -0
- package/packages/agent/src/services/browser-workspace-network.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-network.js +137 -0
- package/packages/agent/src/services/browser-workspace-snapshots.d.ts +14 -0
- package/packages/agent/src/services/browser-workspace-snapshots.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-snapshots.js +144 -0
- package/packages/agent/src/services/browser-workspace-state.d.ts +22 -0
- package/packages/agent/src/services/browser-workspace-state.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-state.js +129 -0
- package/packages/agent/src/services/browser-workspace-types.d.ts +262 -0
- package/packages/agent/src/services/browser-workspace-types.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-types.js +1 -0
- package/packages/agent/src/services/browser-workspace-web.d.ts +8 -0
- package/packages/agent/src/services/browser-workspace-web.d.ts.map +1 -0
- package/packages/agent/src/services/browser-workspace-web.js +1141 -0
- package/packages/agent/src/services/browser-workspace.d.ts +22 -165
- package/packages/agent/src/services/browser-workspace.d.ts.map +1 -1
- package/packages/agent/src/services/browser-workspace.js +89 -4043
- package/packages/agent/src/services/built-in-app-routes/hyperscape.d.ts.map +1 -1
- package/packages/agent/src/services/built-in-app-routes/hyperscape.js +9 -6
- package/packages/agent/src/services/character-persistence.d.ts.map +1 -1
- package/packages/agent/src/services/character-persistence.js +1 -2
- package/packages/agent/src/services/client-chat-sender.d.ts.map +1 -1
- package/packages/agent/src/services/coding-task-executor.d.ts +2 -8
- package/packages/agent/src/services/coding-task-executor.d.ts.map +1 -1
- package/packages/agent/src/services/coding-task-executor.js +34 -66
- package/packages/agent/src/services/connector-setup-service.d.ts +4 -4
- package/packages/agent/src/services/connector-setup-service.d.ts.map +1 -1
- package/packages/agent/src/services/escalation.d.ts.map +1 -1
- package/packages/agent/src/services/escalation.js +1 -1
- package/packages/agent/src/services/plugin-manager-types.d.ts +1 -0
- package/packages/agent/src/services/plugin-manager-types.d.ts.map +1 -1
- package/packages/agent/src/services/privy-wallets.d.ts +0 -5
- package/packages/agent/src/services/privy-wallets.d.ts.map +1 -1
- package/packages/agent/src/services/privy-wallets.js +0 -5
- package/packages/agent/src/services/registry-client-app-meta.d.ts.map +1 -1
- package/packages/agent/src/services/registry-client-app-meta.js +1 -0
- package/packages/agent/src/services/registry-client-local.d.ts.map +1 -1
- package/packages/agent/src/services/registry-client-local.js +1 -0
- package/packages/agent/src/services/registry-client-network.d.ts.map +1 -1
- package/packages/agent/src/services/registry-client-network.js +1 -0
- package/packages/agent/src/services/registry-client-queries.d.ts +11 -0
- package/packages/agent/src/services/registry-client-queries.d.ts.map +1 -1
- package/packages/agent/src/services/registry-client-queries.js +23 -0
- package/packages/agent/src/services/registry-client-types.d.ts +8 -32
- package/packages/agent/src/services/registry-client-types.d.ts.map +1 -1
- package/packages/agent/src/services/relationships-graph.d.ts +62 -1
- package/packages/agent/src/services/relationships-graph.d.ts.map +1 -1
- package/packages/agent/src/services/relationships-graph.js +116 -6
- package/packages/agent/src/services/signal-pairing.d.ts.map +1 -1
- package/packages/agent/src/services/signal-pairing.js +15 -1
- package/packages/agent/src/services/steward-evm-account.d.ts +0 -4
- package/packages/agent/src/services/steward-evm-account.d.ts.map +1 -1
- package/packages/agent/src/services/steward-evm-account.js +0 -4
- package/packages/agent/src/services/steward-evm-bridge.d.ts +0 -4
- package/packages/agent/src/services/steward-evm-bridge.d.ts.map +1 -1
- package/packages/agent/src/services/steward-evm-bridge.js +0 -4
- package/packages/agent/src/services/steward-wallet.d.ts +1 -6
- package/packages/agent/src/services/steward-wallet.d.ts.map +1 -1
- package/packages/agent/src/services/steward-wallet.js +0 -5
- package/packages/agent/src/services/tts-stream-bridge.d.ts.map +1 -1
- package/packages/agent/src/services/tts-stream-bridge.js +1 -1
- package/packages/agent/src/test-support/route-test-helpers.d.ts +2 -2
- package/packages/agent/src/test-support/route-test-helpers.d.ts.map +1 -1
- package/packages/agent/src/test-support/test-helpers.d.ts +2 -2
- package/packages/agent/src/test-support/test-helpers.d.ts.map +1 -1
- package/packages/agent/src/triggers/runtime.d.ts +1 -0
- package/packages/agent/src/triggers/runtime.d.ts.map +1 -1
- package/packages/agent/src/triggers/runtime.js +67 -16
- package/packages/agent/src/triggers/scheduling.d.ts +6 -1
- package/packages/agent/src/triggers/scheduling.d.ts.map +1 -1
- package/packages/agent/src/triggers/scheduling.js +66 -20
- package/packages/agent/src/triggers/types.d.ts +14 -37
- package/packages/agent/src/triggers/types.d.ts.map +1 -1
- package/packages/agent/src/triggers/types.js +1 -1
- package/packages/agent/src/types/trajectory.d.ts +42 -1
- package/packages/agent/src/types/trajectory.d.ts.map +1 -1
- package/packages/agent/src/types/trajectory.js +2 -1
- package/packages/agent/src/utils/index.d.ts +1 -1
- package/packages/agent/src/utils/index.d.ts.map +1 -1
- package/packages/agent/src/utils/index.js +1 -1
- package/packages/app-core/src/api/client-types-cloud.d.ts +799 -0
- package/packages/app-core/src/api/client-types-cloud.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-cloud.js +57 -0
- package/packages/app-core/src/api/client-types-core.d.ts +334 -0
- package/packages/app-core/src/api/client-types-core.d.ts.map +1 -0
- package/packages/app-core/src/api/client-types-core.js +22 -0
- package/packages/app-core/src/api/compat-route-shared.d.ts +2 -2
- package/packages/app-core/src/api/compat-route-shared.d.ts.map +1 -1
- package/packages/app-core/src/api/server-cloud-tts.js +1 -1
- package/packages/app-core/src/bridge/native-plugins.d.ts +290 -0
- package/packages/app-core/src/bridge/native-plugins.d.ts.map +1 -0
- package/packages/app-core/src/bridge/native-plugins.js +55 -0
- package/packages/app-core/src/config/boot-config-store.d.ts +121 -2
- package/packages/app-core/src/config/boot-config-store.d.ts.map +1 -1
- package/packages/app-core/src/config/boot-config-store.js +16 -7
- package/packages/app-core/src/services/plugin-installer.d.ts +93 -0
- package/packages/app-core/src/services/plugin-installer.d.ts.map +1 -0
- package/packages/app-core/src/services/plugin-installer.js +611 -0
- package/packages/app-core/src/utils/env.d.ts.map +1 -1
- package/packages/app-core/src/utils/serialise.d.ts +12 -0
- package/packages/app-core/src/utils/serialise.d.ts.map +1 -0
- package/packages/app-core/src/utils/serialise.js +21 -0
- package/packages/native-plugins/activity-tracker/src/index.d.ts +35 -0
- package/packages/native-plugins/activity-tracker/src/index.d.ts.map +1 -0
- package/packages/native-plugins/activity-tracker/src/index.js +102 -0
- package/packages/shared/src/connectors.d.ts.map +1 -1
- package/packages/shared/src/connectors.js +8 -3
- package/packages/shared/src/contracts/apps.d.ts +53 -0
- package/packages/shared/src/contracts/apps.d.ts.map +1 -1
- package/packages/shared/src/contracts/cloud-topology.d.ts.map +1 -1
- package/packages/shared/src/contracts/cloud-topology.js +2 -4
- package/packages/shared/src/contracts/config.d.ts.map +1 -1
- package/packages/shared/src/contracts/index.d.ts +1 -1
- package/packages/shared/src/contracts/index.d.ts.map +1 -1
- package/packages/shared/src/contracts/index.js +1 -1
- package/packages/shared/src/contracts/lifeops-extensions.d.ts +181 -0
- package/packages/shared/src/contracts/lifeops-extensions.d.ts.map +1 -0
- package/packages/shared/src/contracts/lifeops-extensions.js +30 -0
- package/packages/shared/src/contracts/lifeops.d.ts +259 -0
- package/packages/shared/src/contracts/lifeops.d.ts.map +1 -1
- package/packages/shared/src/contracts/lifeops.js +62 -0
- package/packages/shared/src/contracts/onboarding.d.ts +5 -0
- package/packages/shared/src/contracts/onboarding.d.ts.map +1 -1
- package/packages/shared/src/contracts/onboarding.js +7 -6
- package/packages/shared/src/contracts/service-routing.d.ts.map +1 -1
- package/packages/shared/src/contracts/service-routing.js +1 -3
- package/packages/shared/src/contracts/wallet.d.ts +30 -103
- package/packages/shared/src/contracts/wallet.d.ts.map +1 -1
- package/packages/shared/src/env-utils.impl.d.ts.map +1 -1
- package/packages/shared/src/env-utils.impl.js +1 -8
- package/packages/shared/src/i18n/keyword-matching.d.ts.map +1 -1
- package/packages/shared/src/i18n/validation-keywords.d.ts +1 -1
- package/packages/shared/src/i18n/validation-keywords.d.ts.map +1 -1
- package/packages/shared/src/i18n/validation-keywords.js +1 -1
- package/packages/shared/src/index.d.ts +3 -3
- package/packages/shared/src/index.d.ts.map +1 -1
- package/packages/shared/src/index.js +3 -3
- package/packages/shared/src/onboarding-presets.characters.d.ts.map +1 -1
- package/packages/shared/src/onboarding-presets.characters.js +15 -5
- package/packages/shared/src/onboarding-presets.d.ts.map +1 -1
- package/packages/shared/src/onboarding-presets.js +5 -1
- package/packages/shared/src/runtime-env.d.ts.map +1 -1
- package/packages/shared/src/runtime-env.js +2 -7
- package/packages/shared/src/settings-debug.d.ts.map +1 -1
- package/packages/shared/src/settings-debug.js +1 -3
- package/packages/skills/src/formatter.d.ts +44 -0
- package/packages/skills/src/formatter.d.ts.map +1 -0
- package/packages/skills/src/formatter.js +181 -0
- package/packages/skills/src/frontmatter.d.ts +51 -0
- package/packages/skills/src/frontmatter.d.ts.map +1 -0
- package/packages/skills/src/frontmatter.js +155 -0
- package/packages/skills/src/index.d.ts +29 -0
- package/packages/skills/src/index.d.ts.map +1 -0
- package/packages/skills/src/index.js +31 -0
- package/packages/skills/src/loader.d.ts +33 -0
- package/packages/skills/src/loader.d.ts.map +1 -0
- package/packages/skills/src/loader.js +369 -0
- package/packages/skills/src/resolver.d.ts +35 -0
- package/packages/skills/src/resolver.d.ts.map +1 -0
- package/packages/skills/src/resolver.js +146 -0
- package/packages/skills/src/types.d.ts +238 -0
- package/packages/skills/src/types.d.ts.map +1 -0
- package/packages/skills/src/types.js +1 -0
- package/packages/typescript/src/action-docs.d.ts.map +1 -1
- package/packages/typescript/src/action-docs.js +2 -0
- package/packages/typescript/src/actions.d.ts.map +1 -1
- package/packages/typescript/src/actions.js +8 -3
- package/packages/typescript/src/database/inMemoryAdapter.js +1 -1
- package/packages/typescript/src/features/advanced-capabilities/evaluators/factRefinement.d.ts +20 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/factRefinement.d.ts.map +1 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/factRefinement.js +362 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/index.d.ts +3 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/index.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/evaluators/index.js +3 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/reflection.js +1 -1
- package/packages/typescript/src/features/advanced-capabilities/evaluators/relationshipExtraction.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/evaluators/relationshipExtraction.js +21 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/skillExtraction.d.ts +25 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/skillExtraction.d.ts.map +1 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/skillExtraction.js +367 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/skillRefinement.d.ts +21 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/skillRefinement.d.ts.map +1 -0
- package/packages/typescript/src/features/advanced-capabilities/evaluators/skillRefinement.js +545 -0
- package/packages/typescript/src/features/advanced-capabilities/form/service.d.ts +1 -5
- package/packages/typescript/src/features/advanced-capabilities/form/service.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/form/service.js +1 -13
- package/packages/typescript/src/features/advanced-capabilities/form/types.d.ts +3 -2
- package/packages/typescript/src/features/advanced-capabilities/form/types.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/providers/facts.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/providers/facts.js +68 -14
- package/packages/typescript/src/features/advanced-memory/services/memory-service.d.ts +1 -0
- package/packages/typescript/src/features/advanced-memory/services/memory-service.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-memory/services/memory-service.js +31 -11
- package/packages/typescript/src/features/autonomy/execution-facade.d.ts +1 -1
- package/packages/typescript/src/features/autonomy/execution-facade.d.ts.map +1 -1
- package/packages/typescript/src/features/autonomy/execution-facade.js +3 -3
- package/packages/typescript/src/features/basic-capabilities/actions/none.js +1 -1
- package/packages/typescript/src/features/basic-capabilities/index.d.ts.map +1 -1
- package/packages/typescript/src/features/basic-capabilities/index.js +9 -3
- package/packages/typescript/src/features/plugin-manager/coreExtensions.d.ts +4 -11
- package/packages/typescript/src/features/plugin-manager/coreExtensions.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/coreExtensions.js +0 -23
- package/packages/typescript/src/features/plugin-manager/index.d.ts +1 -1
- package/packages/typescript/src/features/plugin-manager/index.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/index.js +1 -1
- package/packages/typescript/src/features/plugin-manager/providers/relevance.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/providers/relevance.js +1 -3
- package/packages/typescript/src/features/trajectories/TrajectoriesService.d.ts +13 -0
- package/packages/typescript/src/features/trajectories/TrajectoriesService.d.ts.map +1 -1
- package/packages/typescript/src/features/trajectories/TrajectoriesService.js +12 -9
- package/packages/typescript/src/features/trajectories/integration.d.ts +1 -1
- package/packages/typescript/src/features/trajectories/integration.d.ts.map +1 -1
- package/packages/typescript/src/features/trajectories/types.d.ts +19 -1
- package/packages/typescript/src/features/trajectories/types.d.ts.map +1 -1
- package/packages/typescript/src/features/trust/index.d.ts +3 -52
- package/packages/typescript/src/features/trust/index.d.ts.map +1 -1
- package/packages/typescript/src/features/trust/index.js +5 -122
- package/packages/typescript/src/features/trust/services/wrappers.d.ts +56 -0
- package/packages/typescript/src/features/trust/services/wrappers.d.ts.map +1 -0
- package/packages/typescript/src/features/trust/services/wrappers.js +124 -0
- package/packages/typescript/src/generated/action-docs.d.ts +207 -3
- package/packages/typescript/src/generated/action-docs.d.ts.map +1 -1
- package/packages/typescript/src/generated/action-docs.js +271 -2
- package/packages/typescript/src/index.node.d.ts +3 -0
- package/packages/typescript/src/index.node.d.ts.map +1 -1
- package/packages/typescript/src/index.node.js +6 -0
- package/packages/typescript/src/optimization/ab-analysis.d.ts +1 -1
- package/packages/typescript/src/optimization/ab-analysis.d.ts.map +1 -1
- package/packages/typescript/src/optimization/ab-analysis.js +1 -1
- package/packages/typescript/src/optimization-root-dir.d.ts +6 -1
- package/packages/typescript/src/optimization-root-dir.d.ts.map +1 -1
- package/packages/typescript/src/optimization-root-dir.js +6 -1
- package/packages/typescript/src/prompts.d.ts +2 -2
- package/packages/typescript/src/prompts.d.ts.map +1 -1
- package/packages/typescript/src/prompts.js +4 -1
- package/packages/typescript/src/runtime.d.ts +3 -0
- package/packages/typescript/src/runtime.d.ts.map +1 -1
- package/packages/typescript/src/runtime.js +20 -5
- package/packages/typescript/src/schemas/character.d.ts +1 -1
- package/packages/typescript/src/schemas/character.d.ts.map +1 -1
- package/packages/typescript/src/schemas/character.js +1 -1
- package/packages/typescript/src/schemas/entity-identity.d.ts +29 -0
- package/packages/typescript/src/schemas/entity-identity.d.ts.map +1 -0
- package/packages/typescript/src/schemas/entity-identity.js +334 -0
- package/packages/typescript/src/schemas/index.d.ts +3 -1
- package/packages/typescript/src/schemas/index.d.ts.map +1 -1
- package/packages/typescript/src/schemas/index.js +2 -1
- package/packages/typescript/src/search.d.ts +0 -22
- package/packages/typescript/src/search.d.ts.map +1 -1
- package/packages/typescript/src/services/message.d.ts +11 -0
- package/packages/typescript/src/services/message.d.ts.map +1 -1
- package/packages/typescript/src/services/message.js +63 -36
- package/packages/typescript/src/services/optimized-prompt-resolver.d.ts +23 -0
- package/packages/typescript/src/services/optimized-prompt-resolver.d.ts.map +1 -0
- package/packages/typescript/src/services/optimized-prompt-resolver.js +50 -0
- package/packages/typescript/src/services/optimized-prompt.d.ts +117 -0
- package/packages/typescript/src/services/optimized-prompt.d.ts.map +1 -0
- package/packages/typescript/src/services/optimized-prompt.js +262 -0
- package/packages/typescript/src/services/relationships.d.ts +225 -0
- package/packages/typescript/src/services/relationships.d.ts.map +1 -1
- package/packages/typescript/src/services/relationships.js +979 -3
- package/packages/typescript/src/services/trajectories.d.ts +9 -0
- package/packages/typescript/src/services/trajectories.d.ts.map +1 -1
- package/packages/typescript/src/trajectory-context.d.ts +7 -0
- package/packages/typescript/src/trajectory-context.d.ts.map +1 -1
- package/packages/typescript/src/trajectory-utils.d.ts +24 -0
- package/packages/typescript/src/trajectory-utils.d.ts.map +1 -1
- package/packages/typescript/src/trajectory-utils.js +19 -0
- package/packages/typescript/src/types/components.d.ts +6 -0
- package/packages/typescript/src/types/components.d.ts.map +1 -1
- package/packages/typescript/src/types/plugin.d.ts +11 -0
- package/packages/typescript/src/types/plugin.d.ts.map +1 -1
- package/packages/typescript/src/types/runtime.d.ts +12 -0
- package/packages/typescript/src/types/runtime.d.ts.map +1 -1
- package/packages/typescript/src/types/service.d.ts +2 -0
- package/packages/typescript/src/types/service.d.ts.map +1 -1
- package/packages/typescript/src/types/service.js +1 -0
- package/packages/typescript/src/types/trigger.d.ts +4 -0
- package/packages/typescript/src/types/trigger.d.ts.map +1 -1
- package/packages/typescript/src/utils/batch-queue/batch-processor.d.ts +2 -3
- package/packages/typescript/src/utils/batch-queue/batch-processor.d.ts.map +1 -1
- package/packages/typescript/src/utils/batch-queue/batch-processor.js +0 -3
- package/packages/typescript/src/utils/crypto-compat.js +1 -1
- package/packages/typescript/src/utils/union-find.d.ts +30 -0
- package/packages/typescript/src/utils/union-find.d.ts.map +1 -0
- package/packages/typescript/src/utils/union-find.js +81 -0
- package/packages/typescript/src/utils.d.ts +1 -0
- package/packages/typescript/src/utils.d.ts.map +1 -1
- package/packages/typescript/src/utils.js +5 -1
- package/apps/app-lifeops/src/actions/inbox-digest.d.ts +0 -2
- package/apps/app-lifeops/src/actions/inbox-digest.d.ts.map +0 -1
- package/apps/app-lifeops/src/actions/inbox-digest.js +0 -1
- package/apps/app-lifeops/src/actions/inbox-respond.d.ts +0 -2
- package/apps/app-lifeops/src/actions/inbox-respond.d.ts.map +0 -1
- package/apps/app-lifeops/src/actions/inbox-respond.js +0 -1
- package/apps/app-lifeops/src/actions/inbox-triage.d.ts +0 -2
- package/apps/app-lifeops/src/actions/inbox-triage.d.ts.map +0 -1
- package/apps/app-lifeops/src/actions/inbox-triage.js +0 -1
- package/apps/app-lifeops/src/lifeops/index.d.ts +0 -25
- package/apps/app-lifeops/src/lifeops/index.d.ts.map +0 -1
- package/apps/app-lifeops/src/lifeops/index.js +0 -24
- package/apps/app-lifeops/src/selfcontrol/access.d.ts +0 -8
- package/apps/app-lifeops/src/selfcontrol/access.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/access.js +0 -16
- package/apps/app-lifeops/src/selfcontrol/action.d.ts +0 -10
- package/apps/app-lifeops/src/selfcontrol/action.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/action.js +0 -506
- package/apps/app-lifeops/src/selfcontrol/index.d.ts +0 -13
- package/apps/app-lifeops/src/selfcontrol/index.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/index.js +0 -10
- package/apps/app-lifeops/src/selfcontrol/permissions.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/provider.d.ts +0 -4
- package/apps/app-lifeops/src/selfcontrol/provider.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/provider.js +0 -116
- package/apps/app-lifeops/src/selfcontrol/roles.d.ts +0 -19
- package/apps/app-lifeops/src/selfcontrol/roles.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/roles.js +0 -41
- package/apps/app-lifeops/src/selfcontrol/selfcontrol.d.ts +0 -97
- package/apps/app-lifeops/src/selfcontrol/selfcontrol.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/selfcontrol.js +0 -949
- package/apps/app-lifeops/src/selfcontrol/service.d.ts +0 -21
- package/apps/app-lifeops/src/selfcontrol/service.d.ts.map +0 -1
- package/apps/app-lifeops/src/selfcontrol/service.js +0 -268
- package/packages/agent/src/actions/calendar.d.ts +0 -2
- package/packages/agent/src/actions/calendar.d.ts.map +0 -1
- package/packages/agent/src/actions/calendar.js +0 -1
- package/packages/agent/src/actions/check-balance.d.ts +0 -17
- package/packages/agent/src/actions/check-balance.d.ts.map +0 -1
- package/packages/agent/src/actions/check-balance.js +0 -167
- package/packages/agent/src/actions/execute-trade.d.ts +0 -17
- package/packages/agent/src/actions/execute-trade.d.ts.map +0 -1
- package/packages/agent/src/actions/execute-trade.js +0 -299
- package/packages/agent/src/actions/gmail.d.ts +0 -2
- package/packages/agent/src/actions/gmail.d.ts.map +0 -1
- package/packages/agent/src/actions/gmail.js +0 -1
- package/packages/agent/src/actions/inbox-digest.d.ts +0 -2
- package/packages/agent/src/actions/inbox-digest.d.ts.map +0 -1
- package/packages/agent/src/actions/inbox-digest.js +0 -1
- package/packages/agent/src/actions/inbox-respond.d.ts +0 -2
- package/packages/agent/src/actions/inbox-respond.d.ts.map +0 -1
- package/packages/agent/src/actions/inbox-respond.js +0 -1
- package/packages/agent/src/actions/inbox-triage.d.ts +0 -2
- package/packages/agent/src/actions/inbox-triage.d.ts.map +0 -1
- package/packages/agent/src/actions/inbox-triage.js +0 -1
- package/packages/agent/src/actions/inbox.d.ts +0 -2
- package/packages/agent/src/actions/inbox.d.ts.map +0 -1
- package/packages/agent/src/actions/inbox.js +0 -1
- package/packages/agent/src/actions/life-goal-extractor.d.ts +0 -2
- package/packages/agent/src/actions/life-goal-extractor.d.ts.map +0 -1
- package/packages/agent/src/actions/life-goal-extractor.js +0 -1
- package/packages/agent/src/actions/life-param-extractor.d.ts +0 -2
- package/packages/agent/src/actions/life-param-extractor.d.ts.map +0 -1
- package/packages/agent/src/actions/life-param-extractor.js +0 -1
- package/packages/agent/src/actions/life-recent-context.d.ts +0 -2
- package/packages/agent/src/actions/life-recent-context.d.ts.map +0 -1
- package/packages/agent/src/actions/life-recent-context.js +0 -1
- package/packages/agent/src/actions/life-update-extractor.d.ts +0 -2
- package/packages/agent/src/actions/life-update-extractor.d.ts.map +0 -1
- package/packages/agent/src/actions/life-update-extractor.js +0 -1
- package/packages/agent/src/actions/life.d.ts +0 -2
- package/packages/agent/src/actions/life.d.ts.map +0 -1
- package/packages/agent/src/actions/life.extractor.d.ts +0 -2
- package/packages/agent/src/actions/life.extractor.d.ts.map +0 -1
- package/packages/agent/src/actions/life.extractor.js +0 -1
- package/packages/agent/src/actions/life.js +0 -1
- package/packages/agent/src/actions/lifeops-extraction-config.d.ts +0 -2
- package/packages/agent/src/actions/lifeops-extraction-config.d.ts.map +0 -1
- package/packages/agent/src/actions/lifeops-extraction-config.js +0 -1
- package/packages/agent/src/actions/lifeops-google-helpers.d.ts +0 -2
- package/packages/agent/src/actions/lifeops-google-helpers.d.ts.map +0 -1
- package/packages/agent/src/actions/lifeops-google-helpers.js +0 -1
- package/packages/agent/src/actions/timezone-normalization.d.ts +0 -2
- package/packages/agent/src/actions/timezone-normalization.d.ts.map +0 -1
- package/packages/agent/src/actions/timezone-normalization.js +0 -1
- package/packages/agent/src/actions/transfer-token.d.ts +0 -17
- package/packages/agent/src/actions/transfer-token.d.ts.map +0 -1
- package/packages/agent/src/actions/transfer-token.js +0 -470
- package/packages/agent/src/actions/update-owner-profile.d.ts +0 -2
- package/packages/agent/src/actions/update-owner-profile.d.ts.map +0 -1
- package/packages/agent/src/actions/update-owner-profile.js +0 -1
- package/packages/agent/src/actions/wallet-action-shared.d.ts +0 -15
- package/packages/agent/src/actions/wallet-action-shared.d.ts.map +0 -1
- package/packages/agent/src/actions/wallet-action-shared.js +0 -24
- package/packages/agent/src/activity-profile/analyzer.d.ts.map +0 -1
- package/packages/agent/src/activity-profile/analyzer.js +0 -531
- package/packages/agent/src/activity-profile/proactive-planner.d.ts.map +0 -1
- package/packages/agent/src/activity-profile/proactive-planner.js +0 -455
- package/packages/agent/src/activity-profile/proactive-worker.d.ts.map +0 -1
- package/packages/agent/src/activity-profile/proactive-worker.js +0 -523
- package/packages/agent/src/activity-profile/profile-metadata.d.ts.map +0 -1
- package/packages/agent/src/activity-profile/service.d.ts +0 -11
- package/packages/agent/src/activity-profile/service.d.ts.map +0 -1
- package/packages/agent/src/activity-profile/service.js +0 -226
- package/packages/agent/src/activity-profile/types.d.ts.map +0 -1
- package/packages/agent/src/api/coding-agents-auth-sanitize.d.ts +0 -2
- package/packages/agent/src/api/coding-agents-auth-sanitize.d.ts.map +0 -1
- package/packages/agent/src/api/coding-agents-auth-sanitize.js +0 -1
- package/packages/agent/src/api/coding-agents-preflight-normalize.d.ts +0 -2
- package/packages/agent/src/api/coding-agents-preflight-normalize.d.ts.map +0 -1
- package/packages/agent/src/api/coding-agents-preflight-normalize.js +0 -1
- package/packages/agent/src/api/coordinator-types.d.ts +0 -2
- package/packages/agent/src/api/coordinator-types.d.ts.map +0 -1
- package/packages/agent/src/api/coordinator-types.js +0 -1
- package/packages/agent/src/api/coordinator-wiring.d.ts +0 -2
- package/packages/agent/src/api/coordinator-wiring.d.ts.map +0 -1
- package/packages/agent/src/api/coordinator-wiring.js +0 -1
- package/packages/agent/src/api/drop-routes.d.ts +0 -22
- package/packages/agent/src/api/drop-routes.d.ts.map +0 -1
- package/packages/agent/src/api/drop-service.d.ts +0 -26
- package/packages/agent/src/api/drop-service.d.ts.map +0 -1
- package/packages/agent/src/api/lifeops-routes.d.ts +0 -2
- package/packages/agent/src/api/lifeops-routes.d.ts.map +0 -1
- package/packages/agent/src/api/lifeops-routes.js +0 -1
- package/packages/agent/src/api/merkle-tree.d.ts.map +0 -1
- package/packages/agent/src/api/nft-verify.d.ts +0 -16
- package/packages/agent/src/api/nft-verify.d.ts.map +0 -1
- package/packages/agent/src/api/nft-verify.js +0 -81
- package/packages/agent/src/api/og-tracker.d.ts.map +0 -1
- package/packages/agent/src/api/og-tracker.js +0 -60
- package/packages/agent/src/api/task-agent-message-routing.d.ts +0 -2
- package/packages/agent/src/api/task-agent-message-routing.d.ts.map +0 -1
- package/packages/agent/src/api/task-agent-message-routing.js +0 -1
- package/packages/agent/src/api/twitter-verify.d.ts +0 -25
- package/packages/agent/src/api/twitter-verify.d.ts.map +0 -1
- package/packages/agent/src/api/twitter-verify.js +0 -168
- package/packages/agent/src/api/website-blocker-routes.d.ts +0 -2
- package/packages/agent/src/api/website-blocker-routes.d.ts.map +0 -1
- package/packages/agent/src/api/website-blocker-routes.js +0 -1
- package/packages/agent/src/config/runtime-env.d.ts +0 -2
- package/packages/agent/src/config/runtime-env.d.ts.map +0 -1
- package/packages/agent/src/config/runtime-env.js +0 -1
- package/packages/agent/src/evals/coordinator-eval-client.d.ts +0 -2
- package/packages/agent/src/evals/coordinator-eval-client.d.ts.map +0 -1
- package/packages/agent/src/evals/coordinator-eval-client.js +0 -1
- package/packages/agent/src/evals/coordinator-live-runner.d.ts +0 -2
- package/packages/agent/src/evals/coordinator-live-runner.d.ts.map +0 -1
- package/packages/agent/src/evals/coordinator-live-runner.js +0 -1
- package/packages/agent/src/evals/coordinator-preflight.d.ts +0 -2
- package/packages/agent/src/evals/coordinator-preflight.d.ts.map +0 -1
- package/packages/agent/src/evals/coordinator-preflight.js +0 -1
- package/packages/agent/src/evals/coordinator-scenarios.d.ts +0 -2
- package/packages/agent/src/evals/coordinator-scenarios.d.ts.map +0 -1
- package/packages/agent/src/evals/coordinator-scenarios.js +0 -1
- package/packages/agent/src/lifeops/app-state.d.ts +0 -2
- package/packages/agent/src/lifeops/app-state.d.ts.map +0 -1
- package/packages/agent/src/lifeops/app-state.js +0 -1
- package/packages/agent/src/lifeops/apple-reminders.d.ts +0 -2
- package/packages/agent/src/lifeops/apple-reminders.d.ts.map +0 -1
- package/packages/agent/src/lifeops/apple-reminders.js +0 -1
- package/packages/agent/src/lifeops/defaults.d.ts +0 -2
- package/packages/agent/src/lifeops/defaults.d.ts.map +0 -1
- package/packages/agent/src/lifeops/defaults.js +0 -1
- package/packages/agent/src/lifeops/engine.d.ts +0 -2
- package/packages/agent/src/lifeops/engine.d.ts.map +0 -1
- package/packages/agent/src/lifeops/engine.js +0 -1
- package/packages/agent/src/lifeops/goal-grounding.d.ts +0 -2
- package/packages/agent/src/lifeops/goal-grounding.d.ts.map +0 -1
- package/packages/agent/src/lifeops/goal-grounding.js +0 -1
- package/packages/agent/src/lifeops/goal-semantic-evaluator.d.ts +0 -2
- package/packages/agent/src/lifeops/goal-semantic-evaluator.d.ts.map +0 -1
- package/packages/agent/src/lifeops/goal-semantic-evaluator.js +0 -1
- package/packages/agent/src/lifeops/google-api-error.d.ts +0 -2
- package/packages/agent/src/lifeops/google-api-error.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-api-error.js +0 -1
- package/packages/agent/src/lifeops/google-calendar.d.ts +0 -2
- package/packages/agent/src/lifeops/google-calendar.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-calendar.js +0 -1
- package/packages/agent/src/lifeops/google-connector-gateway.d.ts +0 -2
- package/packages/agent/src/lifeops/google-connector-gateway.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-connector-gateway.js +0 -1
- package/packages/agent/src/lifeops/google-fetch.d.ts +0 -2
- package/packages/agent/src/lifeops/google-fetch.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-fetch.js +0 -1
- package/packages/agent/src/lifeops/google-gmail.d.ts +0 -2
- package/packages/agent/src/lifeops/google-gmail.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-gmail.js +0 -1
- package/packages/agent/src/lifeops/google-managed-client.d.ts +0 -2
- package/packages/agent/src/lifeops/google-managed-client.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-managed-client.js +0 -1
- package/packages/agent/src/lifeops/google-oauth.d.ts +0 -2
- package/packages/agent/src/lifeops/google-oauth.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-oauth.js +0 -1
- package/packages/agent/src/lifeops/google-scopes.d.ts +0 -2
- package/packages/agent/src/lifeops/google-scopes.d.ts.map +0 -1
- package/packages/agent/src/lifeops/google-scopes.js +0 -1
- package/packages/agent/src/lifeops/index.d.ts +0 -2
- package/packages/agent/src/lifeops/index.d.ts.map +0 -1
- package/packages/agent/src/lifeops/index.js +0 -1
- package/packages/agent/src/lifeops/owner-profile.d.ts +0 -2
- package/packages/agent/src/lifeops/owner-profile.d.ts.map +0 -1
- package/packages/agent/src/lifeops/owner-profile.js +0 -1
- package/packages/agent/src/lifeops/repository.d.ts +0 -2
- package/packages/agent/src/lifeops/repository.d.ts.map +0 -1
- package/packages/agent/src/lifeops/repository.js +0 -1
- package/packages/agent/src/lifeops/runtime.d.ts +0 -2
- package/packages/agent/src/lifeops/runtime.d.ts.map +0 -1
- package/packages/agent/src/lifeops/runtime.js +0 -1
- package/packages/agent/src/lifeops/screen-context.d.ts +0 -2
- package/packages/agent/src/lifeops/screen-context.d.ts.map +0 -1
- package/packages/agent/src/lifeops/screen-context.js +0 -1
- package/packages/agent/src/lifeops/seed-routines.d.ts +0 -2
- package/packages/agent/src/lifeops/seed-routines.d.ts.map +0 -1
- package/packages/agent/src/lifeops/seed-routines.js +0 -1
- package/packages/agent/src/lifeops/service.d.ts +0 -2
- package/packages/agent/src/lifeops/service.d.ts.map +0 -1
- package/packages/agent/src/lifeops/service.js +0 -1
- package/packages/agent/src/lifeops/sql.d.ts +0 -2
- package/packages/agent/src/lifeops/sql.d.ts.map +0 -1
- package/packages/agent/src/lifeops/sql.js +0 -1
- package/packages/agent/src/lifeops/time.d.ts +0 -2
- package/packages/agent/src/lifeops/time.d.ts.map +0 -1
- package/packages/agent/src/lifeops/time.js +0 -1
- package/packages/agent/src/lifeops/twilio.d.ts +0 -2
- package/packages/agent/src/lifeops/twilio.d.ts.map +0 -1
- package/packages/agent/src/lifeops/twilio.js +0 -1
- package/packages/agent/src/lifeops/x-poster.d.ts +0 -2
- package/packages/agent/src/lifeops/x-poster.d.ts.map +0 -1
- package/packages/agent/src/lifeops/x-poster.js +0 -1
- package/packages/agent/src/providers/activity-profile.d.ts.map +0 -1
- package/packages/agent/src/providers/activity-profile.js +0 -140
- package/packages/agent/src/providers/inbox-triage.d.ts +0 -2
- package/packages/agent/src/providers/inbox-triage.d.ts.map +0 -1
- package/packages/agent/src/providers/inbox-triage.js +0 -1
- package/packages/agent/src/providers/lifeops.d.ts +0 -2
- package/packages/agent/src/providers/lifeops.d.ts.map +0 -1
- package/packages/agent/src/providers/lifeops.js +0 -1
- package/packages/agent/src/utils/spoken-text.d.ts +0 -2
- package/packages/agent/src/utils/spoken-text.d.ts.map +0 -1
- package/packages/agent/src/utils/spoken-text.js +0 -1
- package/packages/app-core/src/config/config.d.ts +0 -12
- package/packages/app-core/src/config/config.d.ts.map +0 -1
- package/packages/app-core/src/config/config.js +0 -23
- package/packages/app-core/src/types/index.d.ts +0 -649
- package/packages/app-core/src/types/index.d.ts.map +0 -1
- package/packages/app-core/src/types/lifeops-ui.d.ts +0 -10
- package/packages/app-core/src/types/lifeops-ui.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/append.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/append.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/append.js +0 -150
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/delete.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/delete.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/delete.js +0 -136
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/list.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/list.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/list.js +0 -84
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read-attachment.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read-attachment.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read-attachment.js +0 -107
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read-file.d.ts +0 -16
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read-file.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read-file.js +0 -187
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/read.js +0 -138
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/remove-from-clipboard.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/remove-from-clipboard.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/remove-from-clipboard.js +0 -96
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/search.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/search.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/search.js +0 -139
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/write.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/write.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/actions/write.js +0 -138
- package/packages/typescript/src/advanced-capabilities/clipboard/index.d.ts +0 -39
- package/packages/typescript/src/advanced-capabilities/clipboard/index.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/index.js +0 -78
- package/packages/typescript/src/advanced-capabilities/clipboard/providers/clipboard.d.ts +0 -4
- package/packages/typescript/src/advanced-capabilities/clipboard/providers/clipboard.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/providers/clipboard.js +0 -62
- package/packages/typescript/src/advanced-capabilities/clipboard/services/attachmentContext.d.ts +0 -16
- package/packages/typescript/src/advanced-capabilities/clipboard/services/attachmentContext.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/services/attachmentContext.js +0 -162
- package/packages/typescript/src/advanced-capabilities/clipboard/services/clipboardService.d.ts +0 -65
- package/packages/typescript/src/advanced-capabilities/clipboard/services/clipboardService.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/services/clipboardService.js +0 -352
- package/packages/typescript/src/advanced-capabilities/clipboard/services/taskClipboardPersistence.d.ts +0 -24
- package/packages/typescript/src/advanced-capabilities/clipboard/services/taskClipboardPersistence.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/services/taskClipboardPersistence.js +0 -63
- package/packages/typescript/src/advanced-capabilities/clipboard/services/taskClipboardService.d.ts +0 -29
- package/packages/typescript/src/advanced-capabilities/clipboard/services/taskClipboardService.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/services/taskClipboardService.js +0 -195
- package/packages/typescript/src/advanced-capabilities/clipboard/specs.d.ts +0 -15
- package/packages/typescript/src/advanced-capabilities/clipboard/specs.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/specs.js +0 -164
- package/packages/typescript/src/advanced-capabilities/clipboard/types.d.ts +0 -92
- package/packages/typescript/src/advanced-capabilities/clipboard/types.d.ts.map +0 -1
- package/packages/typescript/src/advanced-capabilities/clipboard/types.js +0 -4
- package/packages/typescript/src/index.d.ts +0 -12
- package/packages/typescript/src/index.d.ts.map +0 -1
- package/packages/typescript/src/index.js +0 -13
- /package/{packages/agent/src/api → apps/app-elizamaker/src}/drop-routes.js +0 -0
- /package/{packages/agent/src/api → apps/app-elizamaker/src}/drop-service.js +0 -0
- /package/{packages/agent/src/api → apps/app-elizamaker/src}/merkle-tree.d.ts +0 -0
- /package/{packages/agent/src/api → apps/app-elizamaker/src}/merkle-tree.js +0 -0
- /package/{packages/agent/src/api → apps/app-elizamaker/src}/og-tracker.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/activity-profile/analyzer.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/activity-profile/proactive-planner.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/activity-profile/proactive-worker.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/activity-profile/profile-metadata.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/activity-profile/profile-metadata.js +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/activity-profile/types.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/activity-profile/types.js +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/providers/activity-profile.d.ts +0 -0
- /package/apps/app-lifeops/src/{selfcontrol/permissions.js → types/app-blocker-settings-card.js} +0 -0
- /package/{packages/app-core → apps/app-lifeops}/src/types/index.js +0 -0
- /package/{packages/app-core/src/types/lifeops-ui.js → apps/app-lifeops/src/types/website-blocker-settings-card.js} +0 -0
- /package/apps/app-lifeops/src/{selfcontrol → website-blocker}/permissions.d.ts +0 -0
|
@@ -1,43 +1,15 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
|
-
import { executeRawSql,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const rows = await executeRawSql(runtime, `SELECT 1
|
|
9
|
-
FROM information_schema.tables
|
|
10
|
-
WHERE table_schema = current_schema()
|
|
11
|
-
AND table_name = 'life_task_definitions'
|
|
12
|
-
LIMIT 1`);
|
|
13
|
-
return rows.length > 0;
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
2
|
+
import { executeRawSql, parseJsonArray, parseJsonRecord, sqlBoolean, sqlInteger, sqlJson, sqlQuote, sqlText, toBoolean, toNumber, toText, } from "./sql.js";
|
|
3
|
+
function normalizeConnectorIdentityEmail(value) {
|
|
4
|
+
if (typeof value !== "string")
|
|
5
|
+
return null;
|
|
6
|
+
const normalized = value.trim().toLowerCase();
|
|
7
|
+
return normalized.length > 0 ? normalized : null;
|
|
18
8
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// SQLite: BEGIN + SAVEPOINT is also valid.
|
|
24
|
-
await executeRawSql(runtime, "BEGIN");
|
|
25
|
-
try {
|
|
26
|
-
await executeRawSql(runtime, `SAVEPOINT ${safeName}`);
|
|
27
|
-
try {
|
|
28
|
-
await migration();
|
|
29
|
-
await executeRawSql(runtime, `RELEASE SAVEPOINT ${safeName}`);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
await executeRawSql(runtime, `ROLLBACK TO SAVEPOINT ${safeName}`).catch(() => { });
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
await executeRawSql(runtime, "COMMIT");
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
await executeRawSql(runtime, "ROLLBACK").catch(() => { });
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
9
|
+
function deriveConnectorIdentityEmail(identity) {
|
|
10
|
+
return (normalizeConnectorIdentityEmail(identity.email) ??
|
|
11
|
+
normalizeConnectorIdentityEmail(identity.emailAddress) ??
|
|
12
|
+
normalizeConnectorIdentityEmail(identity.primaryEmail));
|
|
41
13
|
}
|
|
42
14
|
function isoNow() {
|
|
43
15
|
return new Date().toISOString();
|
|
@@ -185,6 +157,55 @@ function parseChannelPolicy(row) {
|
|
|
185
157
|
updatedAt: toText(row.updated_at),
|
|
186
158
|
};
|
|
187
159
|
}
|
|
160
|
+
function parseRelationship(row) {
|
|
161
|
+
return {
|
|
162
|
+
id: toText(row.id),
|
|
163
|
+
agentId: toText(row.agent_id),
|
|
164
|
+
name: toText(row.name),
|
|
165
|
+
primaryChannel: toText(row.primary_channel),
|
|
166
|
+
primaryHandle: toText(row.primary_handle),
|
|
167
|
+
email: row.email ? toText(row.email) : null,
|
|
168
|
+
phone: row.phone ? toText(row.phone) : null,
|
|
169
|
+
notes: toText(row.notes, ""),
|
|
170
|
+
tags: parseJsonArray(row.tags_json),
|
|
171
|
+
relationshipType: toText(row.relationship_type),
|
|
172
|
+
lastContactedAt: row.last_contacted_at ? toText(row.last_contacted_at) : null,
|
|
173
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
174
|
+
createdAt: toText(row.created_at),
|
|
175
|
+
updatedAt: toText(row.updated_at),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function parseRelationshipInteraction(row) {
|
|
179
|
+
return {
|
|
180
|
+
id: toText(row.id),
|
|
181
|
+
agentId: toText(row.agent_id),
|
|
182
|
+
relationshipId: toText(row.relationship_id),
|
|
183
|
+
channel: toText(row.channel),
|
|
184
|
+
direction: toText(row.direction),
|
|
185
|
+
summary: toText(row.summary),
|
|
186
|
+
occurredAt: toText(row.occurred_at),
|
|
187
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
188
|
+
createdAt: toText(row.created_at),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function parseFollowUp(row) {
|
|
192
|
+
return {
|
|
193
|
+
id: toText(row.id),
|
|
194
|
+
agentId: toText(row.agent_id),
|
|
195
|
+
relationshipId: toText(row.relationship_id),
|
|
196
|
+
dueAt: toText(row.due_at),
|
|
197
|
+
reason: toText(row.reason),
|
|
198
|
+
status: toText(row.status),
|
|
199
|
+
priority: toNumber(row.priority, 3),
|
|
200
|
+
draft: row.draft_json
|
|
201
|
+
? parseJsonRecord(row.draft_json)
|
|
202
|
+
: null,
|
|
203
|
+
completedAt: row.completed_at ? toText(row.completed_at) : null,
|
|
204
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
205
|
+
createdAt: toText(row.created_at),
|
|
206
|
+
updatedAt: toText(row.updated_at),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
188
209
|
function parseWebsiteAccessGrant(row) {
|
|
189
210
|
return {
|
|
190
211
|
id: toText(row.id),
|
|
@@ -207,12 +228,13 @@ function parseWebsiteAccessGrant(row) {
|
|
|
207
228
|
};
|
|
208
229
|
}
|
|
209
230
|
function parseConnectorGrant(row) {
|
|
231
|
+
const identity = parseJsonRecord(row.identity_json);
|
|
210
232
|
return {
|
|
211
233
|
id: toText(row.id),
|
|
212
234
|
agentId: toText(row.agent_id),
|
|
213
235
|
provider: toText(row.provider),
|
|
214
236
|
side: toText(row.side, "owner"),
|
|
215
|
-
identity
|
|
237
|
+
identity,
|
|
216
238
|
grantedScopes: parseJsonArray(row.granted_scopes_json),
|
|
217
239
|
capabilities: parseJsonArray(row.capabilities_json),
|
|
218
240
|
tokenRef: row.token_ref ? toText(row.token_ref) : null,
|
|
@@ -621,578 +643,163 @@ function parseEscalationStateRow(row) {
|
|
|
621
643
|
updatedAt: toText(row.updated_at),
|
|
622
644
|
};
|
|
623
645
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
schemaInitializing.set(key, migrationPromise);
|
|
642
|
-
try {
|
|
643
|
-
await migrationPromise;
|
|
644
|
-
}
|
|
645
|
-
finally {
|
|
646
|
-
schemaInitializing.delete(key);
|
|
647
|
-
}
|
|
646
|
+
function parseXDm(row) {
|
|
647
|
+
return {
|
|
648
|
+
id: toText(row.id),
|
|
649
|
+
agentId: toText(row.agent_id),
|
|
650
|
+
externalDmId: toText(row.external_dm_id),
|
|
651
|
+
conversationId: toText(row.conversation_id),
|
|
652
|
+
senderHandle: toText(row.sender_handle),
|
|
653
|
+
senderId: toText(row.sender_id),
|
|
654
|
+
isInbound: toBoolean(row.is_inbound),
|
|
655
|
+
text: toText(row.text),
|
|
656
|
+
receivedAt: toText(row.received_at),
|
|
657
|
+
readAt: row.read_at ? toText(row.read_at) : null,
|
|
658
|
+
repliedAt: row.replied_at ? toText(row.replied_at) : null,
|
|
659
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
660
|
+
syncedAt: toText(row.synced_at),
|
|
661
|
+
updatedAt: toText(row.updated_at),
|
|
662
|
+
};
|
|
648
663
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
)
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
779
|
-
created_at TEXT NOT NULL,
|
|
780
|
-
updated_at TEXT NOT NULL,
|
|
781
|
-
finished_at TEXT
|
|
782
|
-
)`,
|
|
783
|
-
`CREATE TABLE IF NOT EXISTS life_browser_settings (
|
|
784
|
-
agent_id TEXT PRIMARY KEY,
|
|
785
|
-
enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
|
786
|
-
tracking_mode TEXT NOT NULL DEFAULT 'current_tab',
|
|
787
|
-
allow_browser_control BOOLEAN NOT NULL DEFAULT FALSE,
|
|
788
|
-
require_confirmation_for_account_affecting BOOLEAN NOT NULL DEFAULT TRUE,
|
|
789
|
-
incognito_enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
|
790
|
-
site_access_mode TEXT NOT NULL DEFAULT 'current_site_only',
|
|
791
|
-
granted_origins_json TEXT NOT NULL DEFAULT '[]',
|
|
792
|
-
blocked_origins_json TEXT NOT NULL DEFAULT '[]',
|
|
793
|
-
max_remembered_tabs INTEGER NOT NULL DEFAULT 10,
|
|
794
|
-
pause_until TEXT,
|
|
795
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
796
|
-
created_at TEXT NOT NULL,
|
|
797
|
-
updated_at TEXT NOT NULL
|
|
798
|
-
)`,
|
|
799
|
-
`CREATE TABLE IF NOT EXISTS life_browser_companions (
|
|
800
|
-
id TEXT PRIMARY KEY,
|
|
801
|
-
agent_id TEXT NOT NULL,
|
|
802
|
-
browser TEXT NOT NULL,
|
|
803
|
-
profile_id TEXT NOT NULL,
|
|
804
|
-
profile_label TEXT NOT NULL DEFAULT '',
|
|
805
|
-
label TEXT NOT NULL,
|
|
806
|
-
extension_version TEXT,
|
|
807
|
-
connection_state TEXT NOT NULL DEFAULT 'disconnected',
|
|
808
|
-
permissions_json TEXT NOT NULL DEFAULT '{}',
|
|
809
|
-
last_seen_at TEXT,
|
|
810
|
-
paired_at TEXT,
|
|
811
|
-
pairing_token_hash TEXT,
|
|
812
|
-
pending_pairing_token_hashes_json TEXT NOT NULL DEFAULT '[]',
|
|
813
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
814
|
-
created_at TEXT NOT NULL,
|
|
815
|
-
updated_at TEXT NOT NULL,
|
|
816
|
-
UNIQUE(agent_id, browser, profile_id)
|
|
817
|
-
)`,
|
|
818
|
-
`CREATE TABLE IF NOT EXISTS life_browser_tabs (
|
|
819
|
-
id TEXT PRIMARY KEY,
|
|
820
|
-
agent_id TEXT NOT NULL,
|
|
821
|
-
companion_id TEXT,
|
|
822
|
-
browser TEXT NOT NULL,
|
|
823
|
-
profile_id TEXT NOT NULL,
|
|
824
|
-
window_id TEXT NOT NULL,
|
|
825
|
-
tab_id TEXT NOT NULL,
|
|
826
|
-
url TEXT NOT NULL,
|
|
827
|
-
title TEXT NOT NULL,
|
|
828
|
-
active_in_window BOOLEAN NOT NULL DEFAULT FALSE,
|
|
829
|
-
focused_window BOOLEAN NOT NULL DEFAULT FALSE,
|
|
830
|
-
focused_active BOOLEAN NOT NULL DEFAULT FALSE,
|
|
831
|
-
incognito BOOLEAN NOT NULL DEFAULT FALSE,
|
|
832
|
-
favicon_url TEXT,
|
|
833
|
-
last_seen_at TEXT NOT NULL,
|
|
834
|
-
last_focused_at TEXT,
|
|
835
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
836
|
-
created_at TEXT NOT NULL,
|
|
837
|
-
updated_at TEXT NOT NULL,
|
|
838
|
-
UNIQUE(agent_id, browser, profile_id, window_id, tab_id)
|
|
839
|
-
)`,
|
|
840
|
-
`CREATE TABLE IF NOT EXISTS life_browser_page_contexts (
|
|
841
|
-
id TEXT PRIMARY KEY,
|
|
842
|
-
agent_id TEXT NOT NULL,
|
|
843
|
-
browser TEXT NOT NULL,
|
|
844
|
-
profile_id TEXT NOT NULL,
|
|
845
|
-
window_id TEXT NOT NULL,
|
|
846
|
-
tab_id TEXT NOT NULL,
|
|
847
|
-
url TEXT NOT NULL,
|
|
848
|
-
title TEXT NOT NULL,
|
|
849
|
-
selection_text TEXT,
|
|
850
|
-
main_text TEXT,
|
|
851
|
-
headings_json TEXT NOT NULL DEFAULT '[]',
|
|
852
|
-
links_json TEXT NOT NULL DEFAULT '[]',
|
|
853
|
-
forms_json TEXT NOT NULL DEFAULT '[]',
|
|
854
|
-
captured_at TEXT NOT NULL,
|
|
855
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
856
|
-
UNIQUE(agent_id, browser, profile_id, window_id, tab_id)
|
|
857
|
-
)`,
|
|
858
|
-
`CREATE TABLE IF NOT EXISTS life_reminder_plans (
|
|
859
|
-
id TEXT PRIMARY KEY,
|
|
860
|
-
agent_id TEXT NOT NULL,
|
|
861
|
-
owner_type TEXT NOT NULL,
|
|
862
|
-
owner_id TEXT NOT NULL,
|
|
863
|
-
steps_json TEXT NOT NULL,
|
|
864
|
-
mute_policy_json TEXT NOT NULL DEFAULT '{}',
|
|
865
|
-
quiet_hours_json TEXT NOT NULL DEFAULT '{}',
|
|
866
|
-
created_at TEXT NOT NULL,
|
|
867
|
-
updated_at TEXT NOT NULL
|
|
868
|
-
)`,
|
|
869
|
-
`CREATE TABLE IF NOT EXISTS life_reminder_attempts (
|
|
870
|
-
id TEXT PRIMARY KEY,
|
|
871
|
-
agent_id TEXT NOT NULL,
|
|
872
|
-
plan_id TEXT NOT NULL,
|
|
873
|
-
owner_type TEXT NOT NULL,
|
|
874
|
-
owner_id TEXT NOT NULL,
|
|
875
|
-
occurrence_id TEXT,
|
|
876
|
-
channel TEXT NOT NULL,
|
|
877
|
-
step_index INTEGER NOT NULL,
|
|
878
|
-
scheduled_for TEXT NOT NULL,
|
|
879
|
-
attempted_at TEXT,
|
|
880
|
-
outcome TEXT NOT NULL,
|
|
881
|
-
connector_ref TEXT,
|
|
882
|
-
delivery_metadata_json TEXT NOT NULL DEFAULT '{}'
|
|
883
|
-
)`,
|
|
884
|
-
`CREATE TABLE IF NOT EXISTS life_connector_grants (
|
|
885
|
-
id TEXT PRIMARY KEY,
|
|
886
|
-
agent_id TEXT NOT NULL,
|
|
887
|
-
provider TEXT NOT NULL,
|
|
888
|
-
side TEXT NOT NULL DEFAULT 'owner',
|
|
889
|
-
identity_json TEXT NOT NULL DEFAULT '{}',
|
|
890
|
-
granted_scopes_json TEXT NOT NULL DEFAULT '[]',
|
|
891
|
-
capabilities_json TEXT NOT NULL DEFAULT '[]',
|
|
892
|
-
token_ref TEXT,
|
|
893
|
-
mode TEXT NOT NULL,
|
|
894
|
-
execution_target TEXT NOT NULL DEFAULT 'local',
|
|
895
|
-
source_of_truth TEXT NOT NULL DEFAULT 'local_storage',
|
|
896
|
-
preferred_by_agent BOOLEAN NOT NULL DEFAULT FALSE,
|
|
897
|
-
cloud_connection_id TEXT,
|
|
898
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
899
|
-
last_refresh_at TEXT,
|
|
900
|
-
created_at TEXT NOT NULL,
|
|
901
|
-
updated_at TEXT NOT NULL,
|
|
902
|
-
UNIQUE(agent_id, provider, side, mode)
|
|
903
|
-
)`,
|
|
904
|
-
`CREATE TABLE IF NOT EXISTS life_calendar_events (
|
|
905
|
-
id TEXT PRIMARY KEY,
|
|
906
|
-
agent_id TEXT NOT NULL,
|
|
907
|
-
provider TEXT NOT NULL,
|
|
908
|
-
side TEXT NOT NULL DEFAULT 'owner',
|
|
909
|
-
calendar_id TEXT NOT NULL,
|
|
910
|
-
external_event_id TEXT NOT NULL,
|
|
911
|
-
title TEXT NOT NULL,
|
|
912
|
-
description TEXT NOT NULL DEFAULT '',
|
|
913
|
-
location TEXT NOT NULL DEFAULT '',
|
|
914
|
-
status TEXT NOT NULL,
|
|
915
|
-
start_at TEXT NOT NULL,
|
|
916
|
-
end_at TEXT NOT NULL,
|
|
917
|
-
is_all_day BOOLEAN NOT NULL,
|
|
918
|
-
timezone TEXT,
|
|
919
|
-
html_link TEXT,
|
|
920
|
-
conference_link TEXT,
|
|
921
|
-
organizer_json TEXT,
|
|
922
|
-
attendees_json TEXT NOT NULL DEFAULT '[]',
|
|
923
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
924
|
-
synced_at TEXT NOT NULL,
|
|
925
|
-
updated_at TEXT NOT NULL,
|
|
926
|
-
UNIQUE(agent_id, provider, side, calendar_id, external_event_id)
|
|
927
|
-
)`,
|
|
928
|
-
`CREATE TABLE IF NOT EXISTS life_calendar_sync_states (
|
|
929
|
-
id TEXT PRIMARY KEY,
|
|
930
|
-
agent_id TEXT NOT NULL,
|
|
931
|
-
provider TEXT NOT NULL,
|
|
932
|
-
side TEXT NOT NULL DEFAULT 'owner',
|
|
933
|
-
calendar_id TEXT NOT NULL,
|
|
934
|
-
window_start_at TEXT NOT NULL,
|
|
935
|
-
window_end_at TEXT NOT NULL,
|
|
936
|
-
synced_at TEXT NOT NULL,
|
|
937
|
-
updated_at TEXT NOT NULL,
|
|
938
|
-
UNIQUE(agent_id, provider, side, calendar_id)
|
|
939
|
-
)`,
|
|
940
|
-
`CREATE TABLE IF NOT EXISTS life_gmail_messages (
|
|
941
|
-
id TEXT PRIMARY KEY,
|
|
942
|
-
agent_id TEXT NOT NULL,
|
|
943
|
-
provider TEXT NOT NULL,
|
|
944
|
-
side TEXT NOT NULL DEFAULT 'owner',
|
|
945
|
-
external_message_id TEXT NOT NULL,
|
|
946
|
-
thread_id TEXT NOT NULL,
|
|
947
|
-
subject TEXT NOT NULL DEFAULT '',
|
|
948
|
-
from_display TEXT NOT NULL DEFAULT '',
|
|
949
|
-
from_email TEXT,
|
|
950
|
-
reply_to TEXT,
|
|
951
|
-
to_json TEXT NOT NULL DEFAULT '[]',
|
|
952
|
-
cc_json TEXT NOT NULL DEFAULT '[]',
|
|
953
|
-
snippet TEXT NOT NULL DEFAULT '',
|
|
954
|
-
received_at TEXT NOT NULL,
|
|
955
|
-
is_unread BOOLEAN NOT NULL DEFAULT FALSE,
|
|
956
|
-
is_important BOOLEAN NOT NULL DEFAULT FALSE,
|
|
957
|
-
likely_reply_needed BOOLEAN NOT NULL DEFAULT FALSE,
|
|
958
|
-
triage_score INTEGER NOT NULL DEFAULT 0,
|
|
959
|
-
triage_reason TEXT NOT NULL DEFAULT '',
|
|
960
|
-
label_ids_json TEXT NOT NULL DEFAULT '[]',
|
|
961
|
-
html_link TEXT,
|
|
962
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
963
|
-
synced_at TEXT NOT NULL,
|
|
964
|
-
updated_at TEXT NOT NULL,
|
|
965
|
-
UNIQUE(agent_id, provider, side, external_message_id)
|
|
966
|
-
)`,
|
|
967
|
-
`CREATE TABLE IF NOT EXISTS life_gmail_sync_states (
|
|
968
|
-
id TEXT PRIMARY KEY,
|
|
969
|
-
agent_id TEXT NOT NULL,
|
|
970
|
-
provider TEXT NOT NULL,
|
|
971
|
-
side TEXT NOT NULL DEFAULT 'owner',
|
|
972
|
-
mailbox TEXT NOT NULL,
|
|
973
|
-
max_results INTEGER NOT NULL DEFAULT 0,
|
|
974
|
-
synced_at TEXT NOT NULL,
|
|
975
|
-
updated_at TEXT NOT NULL,
|
|
976
|
-
UNIQUE(agent_id, provider, side, mailbox)
|
|
977
|
-
)`,
|
|
978
|
-
`CREATE TABLE IF NOT EXISTS life_channel_policies (
|
|
979
|
-
id TEXT PRIMARY KEY,
|
|
980
|
-
agent_id TEXT NOT NULL,
|
|
981
|
-
channel_type TEXT NOT NULL,
|
|
982
|
-
channel_ref TEXT NOT NULL,
|
|
983
|
-
privacy_class TEXT NOT NULL,
|
|
984
|
-
allow_reminders BOOLEAN NOT NULL,
|
|
985
|
-
allow_escalation BOOLEAN NOT NULL,
|
|
986
|
-
allow_posts BOOLEAN NOT NULL,
|
|
987
|
-
require_confirmation_for_actions BOOLEAN NOT NULL,
|
|
988
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
989
|
-
created_at TEXT NOT NULL,
|
|
990
|
-
updated_at TEXT NOT NULL,
|
|
991
|
-
UNIQUE(agent_id, channel_type, channel_ref)
|
|
992
|
-
)`,
|
|
993
|
-
`CREATE TABLE IF NOT EXISTS life_website_access_grants (
|
|
994
|
-
id TEXT PRIMARY KEY,
|
|
995
|
-
agent_id TEXT NOT NULL,
|
|
996
|
-
group_key TEXT NOT NULL,
|
|
997
|
-
definition_id TEXT NOT NULL,
|
|
998
|
-
occurrence_id TEXT,
|
|
999
|
-
websites_json TEXT NOT NULL DEFAULT '[]',
|
|
1000
|
-
unlock_mode TEXT NOT NULL,
|
|
1001
|
-
unlock_duration_minutes INTEGER,
|
|
1002
|
-
callback_key TEXT,
|
|
1003
|
-
unlocked_at TEXT NOT NULL,
|
|
1004
|
-
expires_at TEXT,
|
|
1005
|
-
revoked_at TEXT,
|
|
1006
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1007
|
-
created_at TEXT NOT NULL,
|
|
1008
|
-
updated_at TEXT NOT NULL
|
|
1009
|
-
)`,
|
|
1010
|
-
`CREATE TABLE IF NOT EXISTS life_audit_events (
|
|
1011
|
-
id TEXT PRIMARY KEY,
|
|
1012
|
-
agent_id TEXT NOT NULL,
|
|
1013
|
-
event_type TEXT NOT NULL,
|
|
1014
|
-
owner_type TEXT NOT NULL,
|
|
1015
|
-
owner_id TEXT NOT NULL,
|
|
1016
|
-
reason TEXT NOT NULL,
|
|
1017
|
-
inputs_json TEXT NOT NULL DEFAULT '{}',
|
|
1018
|
-
decision_json TEXT NOT NULL DEFAULT '{}',
|
|
1019
|
-
actor TEXT NOT NULL,
|
|
1020
|
-
created_at TEXT NOT NULL
|
|
1021
|
-
)`,
|
|
1022
|
-
`CREATE TABLE IF NOT EXISTS life_activity_signals (
|
|
1023
|
-
id TEXT PRIMARY KEY,
|
|
1024
|
-
agent_id TEXT NOT NULL,
|
|
1025
|
-
source TEXT NOT NULL,
|
|
1026
|
-
platform TEXT NOT NULL,
|
|
1027
|
-
state TEXT NOT NULL,
|
|
1028
|
-
observed_at TEXT NOT NULL,
|
|
1029
|
-
idle_state TEXT,
|
|
1030
|
-
idle_time_seconds INTEGER,
|
|
1031
|
-
on_battery BOOLEAN,
|
|
1032
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1033
|
-
created_at TEXT NOT NULL
|
|
1034
|
-
)`,
|
|
1035
|
-
`CREATE TABLE IF NOT EXISTS life_escalation_states (
|
|
1036
|
-
id TEXT PRIMARY KEY,
|
|
1037
|
-
agent_id TEXT NOT NULL,
|
|
1038
|
-
reason TEXT NOT NULL,
|
|
1039
|
-
text TEXT NOT NULL,
|
|
1040
|
-
current_step INTEGER NOT NULL DEFAULT 0,
|
|
1041
|
-
channels_sent_json TEXT NOT NULL DEFAULT '[]',
|
|
1042
|
-
started_at TEXT NOT NULL,
|
|
1043
|
-
last_sent_at TEXT NOT NULL,
|
|
1044
|
-
resolved BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1045
|
-
resolved_at TEXT,
|
|
1046
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1047
|
-
created_at TEXT NOT NULL,
|
|
1048
|
-
updated_at TEXT NOT NULL
|
|
1049
|
-
)`,
|
|
1050
|
-
];
|
|
1051
|
-
/** Applied after legacy ownership columns are added — old DBs may lack domain/subject_* until ALTERs below. */
|
|
1052
|
-
const coreIndexStatements = [
|
|
1053
|
-
`CREATE INDEX IF NOT EXISTS idx_life_task_definitions_agent_status
|
|
1054
|
-
ON life_task_definitions(agent_id, status)`,
|
|
1055
|
-
`CREATE INDEX IF NOT EXISTS idx_life_task_definitions_subject
|
|
1056
|
-
ON life_task_definitions(agent_id, domain, subject_type, subject_id, status)`,
|
|
1057
|
-
`CREATE INDEX IF NOT EXISTS idx_life_task_occurrences_agent_state_start
|
|
1058
|
-
ON life_task_occurrences(agent_id, state, relevance_start_at)`,
|
|
1059
|
-
`CREATE INDEX IF NOT EXISTS idx_life_task_occurrences_subject
|
|
1060
|
-
ON life_task_occurrences(agent_id, domain, subject_type, subject_id, state, relevance_start_at)`,
|
|
1061
|
-
`CREATE INDEX IF NOT EXISTS idx_life_task_occurrences_definition
|
|
1062
|
-
ON life_task_occurrences(definition_id, relevance_start_at)`,
|
|
1063
|
-
`CREATE INDEX IF NOT EXISTS idx_life_goal_definitions_agent_status
|
|
1064
|
-
ON life_goal_definitions(agent_id, status)`,
|
|
1065
|
-
`CREATE INDEX IF NOT EXISTS idx_life_goal_definitions_subject
|
|
1066
|
-
ON life_goal_definitions(agent_id, domain, subject_type, subject_id, status)`,
|
|
1067
|
-
`CREATE INDEX IF NOT EXISTS idx_life_reminder_plans_owner
|
|
1068
|
-
ON life_reminder_plans(agent_id, owner_type, owner_id)`,
|
|
1069
|
-
`CREATE INDEX IF NOT EXISTS idx_life_audit_events_owner
|
|
1070
|
-
ON life_audit_events(agent_id, owner_type, owner_id, created_at)`,
|
|
1071
|
-
`CREATE INDEX IF NOT EXISTS idx_life_activity_signals_agent
|
|
1072
|
-
ON life_activity_signals(agent_id, observed_at DESC)`,
|
|
1073
|
-
`CREATE INDEX IF NOT EXISTS idx_life_workflow_definitions_agent
|
|
1074
|
-
ON life_workflow_definitions(agent_id, status, updated_at)`,
|
|
1075
|
-
`CREATE INDEX IF NOT EXISTS idx_life_workflow_definitions_subject
|
|
1076
|
-
ON life_workflow_definitions(agent_id, domain, subject_type, subject_id, status, updated_at)`,
|
|
1077
|
-
`CREATE INDEX IF NOT EXISTS idx_life_workflow_runs_workflow
|
|
1078
|
-
ON life_workflow_runs(agent_id, workflow_id, started_at)`,
|
|
1079
|
-
`CREATE INDEX IF NOT EXISTS idx_life_browser_sessions_agent
|
|
1080
|
-
ON life_browser_sessions(agent_id, status, updated_at)`,
|
|
1081
|
-
`CREATE INDEX IF NOT EXISTS idx_life_browser_sessions_subject
|
|
1082
|
-
ON life_browser_sessions(agent_id, domain, subject_type, subject_id, status, updated_at)`,
|
|
1083
|
-
`CREATE INDEX IF NOT EXISTS idx_life_browser_companions_agent
|
|
1084
|
-
ON life_browser_companions(agent_id, browser, updated_at)`,
|
|
1085
|
-
`CREATE INDEX IF NOT EXISTS idx_life_browser_tabs_agent
|
|
1086
|
-
ON life_browser_tabs(agent_id, focused_active, active_in_window, last_seen_at)`,
|
|
1087
|
-
`CREATE INDEX IF NOT EXISTS idx_life_browser_page_contexts_agent
|
|
1088
|
-
ON life_browser_page_contexts(agent_id, captured_at)`,
|
|
1089
|
-
`CREATE INDEX IF NOT EXISTS idx_life_goal_links_goal
|
|
1090
|
-
ON life_goal_links(goal_id)`,
|
|
1091
|
-
`CREATE INDEX IF NOT EXISTS idx_life_goal_links_linked
|
|
1092
|
-
ON life_goal_links(linked_type, linked_id)`,
|
|
1093
|
-
`CREATE INDEX IF NOT EXISTS idx_life_reminder_attempts_plan
|
|
1094
|
-
ON life_reminder_attempts(plan_id, owner_type, owner_id)`,
|
|
1095
|
-
`CREATE INDEX IF NOT EXISTS idx_life_channel_policies_agent
|
|
1096
|
-
ON life_channel_policies(agent_id, channel_type)`,
|
|
1097
|
-
`CREATE INDEX IF NOT EXISTS idx_life_website_access_grants_group
|
|
1098
|
-
ON life_website_access_grants(agent_id, group_key, revoked_at, expires_at)`,
|
|
1099
|
-
`CREATE INDEX IF NOT EXISTS idx_life_escalation_states_agent_resolved
|
|
1100
|
-
ON life_escalation_states(agent_id, resolved)`,
|
|
1101
|
-
];
|
|
1102
|
-
for (const statement of statements) {
|
|
1103
|
-
await executeRawSql(runtime, statement);
|
|
1104
|
-
}
|
|
1105
|
-
const ownershipTables = [
|
|
1106
|
-
"life_task_definitions",
|
|
1107
|
-
"life_task_occurrences",
|
|
1108
|
-
"life_goal_definitions",
|
|
1109
|
-
"life_workflow_definitions",
|
|
1110
|
-
"life_browser_sessions",
|
|
1111
|
-
];
|
|
1112
|
-
const ownershipColumns = [
|
|
1113
|
-
{
|
|
1114
|
-
name: "domain",
|
|
1115
|
-
definition: "TEXT NOT NULL DEFAULT 'user_lifeops'",
|
|
1116
|
-
},
|
|
1117
|
-
{
|
|
1118
|
-
name: "subject_type",
|
|
1119
|
-
definition: "TEXT NOT NULL DEFAULT 'owner'",
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
name: "subject_id",
|
|
1123
|
-
definition: "TEXT NOT NULL DEFAULT ''",
|
|
1124
|
-
},
|
|
1125
|
-
{
|
|
1126
|
-
name: "visibility_scope",
|
|
1127
|
-
definition: "TEXT NOT NULL DEFAULT 'owner_agent_admin'",
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
name: "context_policy",
|
|
1131
|
-
definition: "TEXT NOT NULL DEFAULT 'explicit_only'",
|
|
1132
|
-
},
|
|
1133
|
-
];
|
|
1134
|
-
for (const tableName of ownershipTables) {
|
|
1135
|
-
const existingColumns = new Set(await listTableColumns(runtime, tableName));
|
|
1136
|
-
for (const column of ownershipColumns) {
|
|
1137
|
-
if (existingColumns.has(column.name))
|
|
1138
|
-
continue;
|
|
1139
|
-
await executeRawSql(runtime, `ALTER TABLE ${tableName} ADD COLUMN ${column.name} ${column.definition}`);
|
|
1140
|
-
}
|
|
1141
|
-
await executeRawSql(runtime, `UPDATE ${tableName}
|
|
1142
|
-
SET subject_id = agent_id
|
|
1143
|
-
WHERE subject_id = '' OR subject_id IS NULL`);
|
|
1144
|
-
}
|
|
1145
|
-
const browserSessionColumns = [
|
|
1146
|
-
{ name: "browser", definition: "TEXT" },
|
|
1147
|
-
{ name: "companion_id", definition: "TEXT" },
|
|
1148
|
-
{ name: "profile_id", definition: "TEXT" },
|
|
1149
|
-
{ name: "window_id", definition: "TEXT" },
|
|
1150
|
-
{ name: "tab_id", definition: "TEXT" },
|
|
1151
|
-
];
|
|
1152
|
-
const existingBrowserSessionColumns = new Set(await listTableColumns(runtime, "life_browser_sessions"));
|
|
1153
|
-
for (const column of browserSessionColumns) {
|
|
1154
|
-
if (existingBrowserSessionColumns.has(column.name))
|
|
1155
|
-
continue;
|
|
1156
|
-
await executeRawSql(runtime, `ALTER TABLE life_browser_sessions ADD COLUMN ${column.name} ${column.definition}`);
|
|
1157
|
-
}
|
|
1158
|
-
const browserCompanionColumns = [
|
|
1159
|
-
{ name: "pairing_token_hash", definition: "TEXT" },
|
|
1160
|
-
{
|
|
1161
|
-
name: "pending_pairing_token_hashes_json",
|
|
1162
|
-
definition: "TEXT NOT NULL DEFAULT '[]'",
|
|
1163
|
-
},
|
|
1164
|
-
];
|
|
1165
|
-
const existingBrowserCompanionColumns = new Set(await listTableColumns(runtime, "life_browser_companions"));
|
|
1166
|
-
for (const column of browserCompanionColumns) {
|
|
1167
|
-
if (existingBrowserCompanionColumns.has(column.name))
|
|
1168
|
-
continue;
|
|
1169
|
-
await executeRawSql(runtime, `ALTER TABLE life_browser_companions ADD COLUMN ${column.name} ${column.definition}`);
|
|
1170
|
-
}
|
|
1171
|
-
const existingDefinitionColumns = new Set(await listTableColumns(runtime, "life_task_definitions"));
|
|
1172
|
-
if (!existingDefinitionColumns.has("website_access_json")) {
|
|
1173
|
-
await executeRawSql(runtime, "ALTER TABLE life_task_definitions ADD COLUMN website_access_json TEXT");
|
|
1174
|
-
}
|
|
1175
|
-
// Indexes reference ownership columns (see coreIndexStatements doc). Running
|
|
1176
|
-
// this loop before the ALTERs above used to break legacy DBs that lacked
|
|
1177
|
-
// domain / subject_* until migration — PGlite would fail CREATE INDEX.
|
|
1178
|
-
for (const statement of coreIndexStatements) {
|
|
1179
|
-
await executeRawSql(runtime, statement);
|
|
1180
|
-
}
|
|
1181
|
-
const existingConnectorGrantColumns = new Set(await listTableColumns(runtime, "life_connector_grants"));
|
|
1182
|
-
if (existingConnectorGrantColumns.size > 0 &&
|
|
1183
|
-
!existingConnectorGrantColumns.has("side")) {
|
|
1184
|
-
await runMigrationWithSavepoint(runtime, "migrate_connector_grants", async () => {
|
|
1185
|
-
await executeRawSql(runtime, `DROP TABLE IF EXISTS life_connector_grants_next`);
|
|
1186
|
-
await executeRawSql(runtime, `CREATE TABLE life_connector_grants_next (
|
|
664
|
+
function parseXFeedItem(row) {
|
|
665
|
+
return {
|
|
666
|
+
id: toText(row.id),
|
|
667
|
+
agentId: toText(row.agent_id),
|
|
668
|
+
externalTweetId: toText(row.external_tweet_id),
|
|
669
|
+
authorHandle: toText(row.author_handle),
|
|
670
|
+
authorId: toText(row.author_id),
|
|
671
|
+
text: toText(row.text),
|
|
672
|
+
createdAtSource: toText(row.created_at_source),
|
|
673
|
+
feedType: toText(row.feed_type),
|
|
674
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
675
|
+
syncedAt: toText(row.synced_at),
|
|
676
|
+
updatedAt: toText(row.updated_at),
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
function parseXSyncState(row) {
|
|
680
|
+
return {
|
|
681
|
+
id: toText(row.id),
|
|
682
|
+
agentId: toText(row.agent_id),
|
|
683
|
+
feedType: toText(row.feed_type),
|
|
684
|
+
lastCursor: row.last_cursor ? toText(row.last_cursor) : null,
|
|
685
|
+
syncedAt: toText(row.synced_at),
|
|
686
|
+
updatedAt: toText(row.updated_at),
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
function parseScreenTimeSession(row) {
|
|
690
|
+
return {
|
|
691
|
+
id: toText(row.id),
|
|
692
|
+
agentId: toText(row.agent_id),
|
|
693
|
+
source: toText(row.source),
|
|
694
|
+
identifier: toText(row.identifier),
|
|
695
|
+
displayName: toText(row.display_name, toText(row.identifier)),
|
|
696
|
+
startAt: toText(row.start_at),
|
|
697
|
+
endAt: row.end_at ? toText(row.end_at) : null,
|
|
698
|
+
durationSeconds: toNumber(row.duration_seconds, 0),
|
|
699
|
+
isActive: toBoolean(row.is_active),
|
|
700
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
701
|
+
createdAt: toText(row.created_at),
|
|
702
|
+
updatedAt: toText(row.updated_at),
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function parseScreenTimeDaily(row) {
|
|
706
|
+
return {
|
|
707
|
+
id: toText(row.id),
|
|
708
|
+
agentId: toText(row.agent_id),
|
|
709
|
+
source: toText(row.source),
|
|
710
|
+
identifier: toText(row.identifier),
|
|
711
|
+
date: toText(row.date),
|
|
712
|
+
totalSeconds: toNumber(row.total_seconds, 0),
|
|
713
|
+
sessionCount: toNumber(row.session_count, 0),
|
|
714
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
715
|
+
createdAt: toText(row.created_at),
|
|
716
|
+
updatedAt: toText(row.updated_at),
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
function parseSchedulingNegotiation(row) {
|
|
720
|
+
return {
|
|
721
|
+
id: toText(row.id),
|
|
722
|
+
agentId: toText(row.agent_id),
|
|
723
|
+
subject: toText(row.subject),
|
|
724
|
+
relationshipId: row.relationship_id ? toText(row.relationship_id) : null,
|
|
725
|
+
durationMinutes: toNumber(row.duration_minutes, 0),
|
|
726
|
+
timezone: toText(row.timezone, "UTC"),
|
|
727
|
+
state: toText(row.state, "initiated"),
|
|
728
|
+
acceptedProposalId: row.accepted_proposal_id
|
|
729
|
+
? toText(row.accepted_proposal_id)
|
|
730
|
+
: null,
|
|
731
|
+
startedAt: toText(row.started_at),
|
|
732
|
+
finalizedAt: row.finalized_at ? toText(row.finalized_at) : null,
|
|
733
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
734
|
+
createdAt: toText(row.created_at),
|
|
735
|
+
updatedAt: toText(row.updated_at),
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
function parseSchedulingProposal(row) {
|
|
739
|
+
return {
|
|
740
|
+
id: toText(row.id),
|
|
741
|
+
agentId: toText(row.agent_id),
|
|
742
|
+
negotiationId: toText(row.negotiation_id),
|
|
743
|
+
startAt: toText(row.start_at),
|
|
744
|
+
endAt: toText(row.end_at),
|
|
745
|
+
proposedBy: toText(row.proposed_by, "agent"),
|
|
746
|
+
status: toText(row.status, "pending"),
|
|
747
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
748
|
+
createdAt: toText(row.created_at),
|
|
749
|
+
updatedAt: toText(row.updated_at),
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
function parseDossier(row) {
|
|
753
|
+
const rawSources = parseJsonArray(row.sources_json);
|
|
754
|
+
const sources = rawSources
|
|
755
|
+
.filter((s) => !!s && typeof s === "object")
|
|
756
|
+
.map((s) => ({
|
|
757
|
+
kind: toText(s.kind),
|
|
758
|
+
ref: toText(s.ref),
|
|
759
|
+
...(typeof s.snippet === "string" && s.snippet.length > 0
|
|
760
|
+
? { snippet: s.snippet }
|
|
761
|
+
: {}),
|
|
762
|
+
}));
|
|
763
|
+
return {
|
|
764
|
+
id: toText(row.id),
|
|
765
|
+
agentId: toText(row.agent_id),
|
|
766
|
+
calendarEventId: row.calendar_event_id
|
|
767
|
+
? toText(row.calendar_event_id)
|
|
768
|
+
: null,
|
|
769
|
+
subject: toText(row.subject),
|
|
770
|
+
generatedForAt: toText(row.generated_for_at),
|
|
771
|
+
contentMd: toText(row.content_md, ""),
|
|
772
|
+
sources,
|
|
773
|
+
metadata: parseJsonRecord(row.metadata_json),
|
|
774
|
+
createdAt: toText(row.created_at),
|
|
775
|
+
updatedAt: toText(row.updated_at),
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
export class LifeOpsRepository {
|
|
779
|
+
runtime;
|
|
780
|
+
constructor(runtime) {
|
|
781
|
+
this.runtime = runtime;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Create all LifeOps tables if they do not already exist.
|
|
785
|
+
* Must be called once during plugin init before any queries run.
|
|
786
|
+
*/
|
|
787
|
+
static async bootstrapSchema(runtime) {
|
|
788
|
+
// Each statement is idempotent (CREATE TABLE IF NOT EXISTS).
|
|
789
|
+
// We run them sequentially so tables referenced by foreign-key-like
|
|
790
|
+
// patterns exist before dependent tables, but there are no actual FK
|
|
791
|
+
// constraints — ordering is just for clarity.
|
|
792
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_connector_grants (
|
|
1187
793
|
id TEXT PRIMARY KEY,
|
|
1188
794
|
agent_id TEXT NOT NULL,
|
|
1189
795
|
provider TEXT NOT NULL,
|
|
1190
796
|
side TEXT NOT NULL DEFAULT 'owner',
|
|
1191
797
|
identity_json TEXT NOT NULL DEFAULT '{}',
|
|
798
|
+
identity_email TEXT,
|
|
1192
799
|
granted_scopes_json TEXT NOT NULL DEFAULT '[]',
|
|
1193
800
|
capabilities_json TEXT NOT NULL DEFAULT '[]',
|
|
1194
801
|
token_ref TEXT,
|
|
1195
|
-
mode TEXT NOT NULL,
|
|
802
|
+
mode TEXT NOT NULL DEFAULT 'oauth',
|
|
1196
803
|
execution_target TEXT NOT NULL DEFAULT 'local',
|
|
1197
804
|
source_of_truth TEXT NOT NULL DEFAULT 'local_storage',
|
|
1198
805
|
preferred_by_agent BOOLEAN NOT NULL DEFAULT FALSE,
|
|
@@ -1201,84 +808,184 @@ async function runLifeOpsSchemaSetup(runtime, key) {
|
|
|
1201
808
|
last_refresh_at TEXT,
|
|
1202
809
|
created_at TEXT NOT NULL,
|
|
1203
810
|
updated_at TEXT NOT NULL,
|
|
1204
|
-
UNIQUE(agent_id, provider, side, mode)
|
|
811
|
+
UNIQUE(agent_id, provider, side, mode, identity_email)
|
|
1205
812
|
)`);
|
|
1206
|
-
|
|
1207
|
-
id, agent_id, provider, side, identity_json, granted_scopes_json,
|
|
1208
|
-
capabilities_json, token_ref, mode, execution_target, source_of_truth,
|
|
1209
|
-
preferred_by_agent, cloud_connection_id, metadata_json,
|
|
1210
|
-
last_refresh_at, created_at, updated_at
|
|
1211
|
-
)
|
|
1212
|
-
SELECT
|
|
1213
|
-
id,
|
|
1214
|
-
agent_id,
|
|
1215
|
-
provider,
|
|
1216
|
-
'owner',
|
|
1217
|
-
identity_json,
|
|
1218
|
-
granted_scopes_json,
|
|
1219
|
-
capabilities_json,
|
|
1220
|
-
token_ref,
|
|
1221
|
-
mode,
|
|
1222
|
-
'local',
|
|
1223
|
-
'local_storage',
|
|
1224
|
-
FALSE,
|
|
1225
|
-
NULL,
|
|
1226
|
-
COALESCE(metadata_json, '{}'),
|
|
1227
|
-
last_refresh_at,
|
|
1228
|
-
created_at,
|
|
1229
|
-
updated_at
|
|
1230
|
-
FROM life_connector_grants`);
|
|
1231
|
-
await executeRawSql(runtime, `DROP TABLE life_connector_grants`);
|
|
1232
|
-
await executeRawSql(runtime, `ALTER TABLE life_connector_grants_next RENAME TO life_connector_grants`);
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
const connectorGrantColumns = [
|
|
1236
|
-
{
|
|
1237
|
-
name: "side",
|
|
1238
|
-
definition: "TEXT NOT NULL DEFAULT 'owner'",
|
|
1239
|
-
},
|
|
1240
|
-
{
|
|
1241
|
-
name: "execution_target",
|
|
1242
|
-
definition: "TEXT NOT NULL DEFAULT 'local'",
|
|
1243
|
-
},
|
|
1244
|
-
{
|
|
1245
|
-
name: "source_of_truth",
|
|
1246
|
-
definition: "TEXT NOT NULL DEFAULT 'local_storage'",
|
|
1247
|
-
},
|
|
1248
|
-
{
|
|
1249
|
-
name: "preferred_by_agent",
|
|
1250
|
-
definition: "BOOLEAN NOT NULL DEFAULT FALSE",
|
|
1251
|
-
},
|
|
1252
|
-
{
|
|
1253
|
-
name: "cloud_connection_id",
|
|
1254
|
-
definition: "TEXT",
|
|
1255
|
-
},
|
|
1256
|
-
];
|
|
1257
|
-
const refreshedConnectorGrantColumns = new Set(await listTableColumns(runtime, "life_connector_grants"));
|
|
1258
|
-
for (const column of connectorGrantColumns) {
|
|
1259
|
-
if (refreshedConnectorGrantColumns.has(column.name))
|
|
1260
|
-
continue;
|
|
1261
|
-
await executeRawSql(runtime, `ALTER TABLE life_connector_grants ADD COLUMN ${column.name} ${column.definition}`);
|
|
1262
|
-
}
|
|
1263
|
-
const existingCalendarEventColumns = new Set(await listTableColumns(runtime, "life_calendar_events"));
|
|
1264
|
-
if (existingCalendarEventColumns.size > 0 &&
|
|
1265
|
-
!existingCalendarEventColumns.has("side")) {
|
|
1266
|
-
await runMigrationWithSavepoint(runtime, "migrate_calendar_events", async () => {
|
|
1267
|
-
await executeRawSql(runtime, `DROP TABLE IF EXISTS life_calendar_events_next`);
|
|
1268
|
-
await executeRawSql(runtime, `CREATE TABLE life_calendar_events_next (
|
|
813
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_task_definitions (
|
|
1269
814
|
id TEXT PRIMARY KEY,
|
|
1270
815
|
agent_id TEXT NOT NULL,
|
|
1271
|
-
|
|
816
|
+
domain TEXT NOT NULL DEFAULT 'user_lifeops',
|
|
817
|
+
subject_type TEXT NOT NULL DEFAULT 'owner',
|
|
818
|
+
subject_id TEXT NOT NULL,
|
|
819
|
+
visibility_scope TEXT NOT NULL DEFAULT 'owner_agent_admin',
|
|
820
|
+
context_policy TEXT NOT NULL DEFAULT 'explicit_only',
|
|
821
|
+
kind TEXT NOT NULL,
|
|
822
|
+
title TEXT NOT NULL,
|
|
823
|
+
description TEXT NOT NULL DEFAULT '',
|
|
824
|
+
original_intent TEXT NOT NULL DEFAULT '',
|
|
825
|
+
timezone TEXT NOT NULL DEFAULT 'UTC',
|
|
826
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
827
|
+
priority INTEGER NOT NULL DEFAULT 3,
|
|
828
|
+
cadence_json TEXT NOT NULL DEFAULT '{}',
|
|
829
|
+
window_policy_json TEXT NOT NULL DEFAULT '{}',
|
|
830
|
+
progression_rule_json TEXT NOT NULL DEFAULT '{}',
|
|
831
|
+
website_access_json TEXT,
|
|
832
|
+
reminder_plan_id TEXT,
|
|
833
|
+
goal_id TEXT,
|
|
834
|
+
source TEXT NOT NULL DEFAULT 'manual',
|
|
835
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
836
|
+
created_at TEXT NOT NULL,
|
|
837
|
+
updated_at TEXT NOT NULL
|
|
838
|
+
)`);
|
|
839
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_task_occurrences (
|
|
840
|
+
id TEXT PRIMARY KEY,
|
|
841
|
+
agent_id TEXT NOT NULL,
|
|
842
|
+
domain TEXT NOT NULL DEFAULT 'user_lifeops',
|
|
843
|
+
subject_type TEXT NOT NULL DEFAULT 'owner',
|
|
844
|
+
subject_id TEXT NOT NULL,
|
|
845
|
+
visibility_scope TEXT NOT NULL DEFAULT 'owner_agent_admin',
|
|
846
|
+
context_policy TEXT NOT NULL DEFAULT 'explicit_only',
|
|
847
|
+
definition_id TEXT NOT NULL,
|
|
848
|
+
occurrence_key TEXT NOT NULL,
|
|
849
|
+
scheduled_at TEXT,
|
|
850
|
+
due_at TEXT,
|
|
851
|
+
relevance_start_at TEXT NOT NULL,
|
|
852
|
+
relevance_end_at TEXT NOT NULL,
|
|
853
|
+
window_name TEXT,
|
|
854
|
+
state TEXT NOT NULL DEFAULT 'pending',
|
|
855
|
+
snoozed_until TEXT,
|
|
856
|
+
completion_payload_json TEXT,
|
|
857
|
+
derived_target_json TEXT,
|
|
858
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
859
|
+
created_at TEXT NOT NULL,
|
|
860
|
+
updated_at TEXT NOT NULL,
|
|
861
|
+
UNIQUE(agent_id, definition_id, occurrence_key)
|
|
862
|
+
)`);
|
|
863
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_goal_definitions (
|
|
864
|
+
id TEXT PRIMARY KEY,
|
|
865
|
+
agent_id TEXT NOT NULL,
|
|
866
|
+
domain TEXT NOT NULL DEFAULT 'user_lifeops',
|
|
867
|
+
subject_type TEXT NOT NULL DEFAULT 'owner',
|
|
868
|
+
subject_id TEXT NOT NULL,
|
|
869
|
+
visibility_scope TEXT NOT NULL DEFAULT 'owner_agent_admin',
|
|
870
|
+
context_policy TEXT NOT NULL DEFAULT 'explicit_only',
|
|
871
|
+
title TEXT NOT NULL,
|
|
872
|
+
description TEXT NOT NULL DEFAULT '',
|
|
873
|
+
cadence_json TEXT,
|
|
874
|
+
support_strategy_json TEXT NOT NULL DEFAULT '{}',
|
|
875
|
+
success_criteria_json TEXT NOT NULL DEFAULT '{}',
|
|
876
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
877
|
+
review_state TEXT NOT NULL DEFAULT 'pending',
|
|
878
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
879
|
+
created_at TEXT NOT NULL,
|
|
880
|
+
updated_at TEXT NOT NULL
|
|
881
|
+
)`);
|
|
882
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_goal_links (
|
|
883
|
+
id TEXT PRIMARY KEY,
|
|
884
|
+
agent_id TEXT NOT NULL,
|
|
885
|
+
goal_id TEXT NOT NULL,
|
|
886
|
+
linked_type TEXT NOT NULL,
|
|
887
|
+
linked_id TEXT NOT NULL,
|
|
888
|
+
created_at TEXT NOT NULL,
|
|
889
|
+
UNIQUE(agent_id, goal_id, linked_type, linked_id)
|
|
890
|
+
)`);
|
|
891
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_reminder_plans (
|
|
892
|
+
id TEXT PRIMARY KEY,
|
|
893
|
+
agent_id TEXT NOT NULL,
|
|
894
|
+
owner_type TEXT NOT NULL,
|
|
895
|
+
owner_id TEXT NOT NULL,
|
|
896
|
+
steps_json TEXT NOT NULL DEFAULT '[]',
|
|
897
|
+
mute_policy_json TEXT NOT NULL DEFAULT '{}',
|
|
898
|
+
quiet_hours_json TEXT NOT NULL DEFAULT '{}',
|
|
899
|
+
created_at TEXT NOT NULL,
|
|
900
|
+
updated_at TEXT NOT NULL
|
|
901
|
+
)`);
|
|
902
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_reminder_attempts (
|
|
903
|
+
id TEXT PRIMARY KEY,
|
|
904
|
+
agent_id TEXT NOT NULL,
|
|
905
|
+
plan_id TEXT NOT NULL,
|
|
906
|
+
owner_type TEXT NOT NULL,
|
|
907
|
+
owner_id TEXT NOT NULL,
|
|
908
|
+
occurrence_id TEXT,
|
|
909
|
+
channel TEXT NOT NULL,
|
|
910
|
+
step_index INTEGER NOT NULL DEFAULT 0,
|
|
911
|
+
scheduled_for TEXT NOT NULL,
|
|
912
|
+
attempted_at TEXT,
|
|
913
|
+
outcome TEXT NOT NULL DEFAULT 'pending',
|
|
914
|
+
connector_ref TEXT,
|
|
915
|
+
delivery_metadata_json TEXT NOT NULL DEFAULT '{}'
|
|
916
|
+
)`);
|
|
917
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_audit_events (
|
|
918
|
+
id TEXT PRIMARY KEY,
|
|
919
|
+
agent_id TEXT NOT NULL,
|
|
920
|
+
event_type TEXT NOT NULL,
|
|
921
|
+
owner_type TEXT NOT NULL,
|
|
922
|
+
owner_id TEXT NOT NULL,
|
|
923
|
+
reason TEXT NOT NULL DEFAULT '',
|
|
924
|
+
inputs_json TEXT NOT NULL DEFAULT '{}',
|
|
925
|
+
decision_json TEXT NOT NULL DEFAULT '{}',
|
|
926
|
+
actor TEXT NOT NULL DEFAULT 'agent',
|
|
927
|
+
created_at TEXT NOT NULL
|
|
928
|
+
)`);
|
|
929
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_activity_signals (
|
|
930
|
+
id TEXT PRIMARY KEY,
|
|
931
|
+
agent_id TEXT NOT NULL,
|
|
932
|
+
source TEXT NOT NULL,
|
|
933
|
+
platform TEXT NOT NULL DEFAULT '',
|
|
934
|
+
state TEXT NOT NULL,
|
|
935
|
+
observed_at TEXT NOT NULL,
|
|
936
|
+
idle_state TEXT,
|
|
937
|
+
idle_time_seconds INTEGER,
|
|
938
|
+
on_battery BOOLEAN,
|
|
939
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
940
|
+
created_at TEXT NOT NULL
|
|
941
|
+
)`);
|
|
942
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_channel_policies (
|
|
943
|
+
id TEXT PRIMARY KEY,
|
|
944
|
+
agent_id TEXT NOT NULL,
|
|
945
|
+
channel_type TEXT NOT NULL,
|
|
946
|
+
channel_ref TEXT NOT NULL,
|
|
947
|
+
privacy_class TEXT NOT NULL DEFAULT 'private',
|
|
948
|
+
allow_reminders BOOLEAN NOT NULL DEFAULT TRUE,
|
|
949
|
+
allow_escalation BOOLEAN NOT NULL DEFAULT FALSE,
|
|
950
|
+
allow_posts BOOLEAN NOT NULL DEFAULT FALSE,
|
|
951
|
+
require_confirmation_for_actions BOOLEAN NOT NULL DEFAULT TRUE,
|
|
952
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
953
|
+
created_at TEXT NOT NULL,
|
|
954
|
+
updated_at TEXT NOT NULL,
|
|
955
|
+
UNIQUE(agent_id, channel_type, channel_ref)
|
|
956
|
+
)`);
|
|
957
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_website_access_grants (
|
|
958
|
+
id TEXT PRIMARY KEY,
|
|
959
|
+
agent_id TEXT NOT NULL,
|
|
960
|
+
group_key TEXT NOT NULL,
|
|
961
|
+
definition_id TEXT NOT NULL,
|
|
962
|
+
occurrence_id TEXT,
|
|
963
|
+
websites_json TEXT NOT NULL DEFAULT '[]',
|
|
964
|
+
unlock_mode TEXT NOT NULL DEFAULT 'fixed_duration',
|
|
965
|
+
unlock_duration_minutes INTEGER,
|
|
966
|
+
callback_key TEXT,
|
|
967
|
+
unlocked_at TEXT NOT NULL,
|
|
968
|
+
expires_at TEXT,
|
|
969
|
+
revoked_at TEXT,
|
|
970
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
971
|
+
created_at TEXT NOT NULL,
|
|
972
|
+
updated_at TEXT NOT NULL
|
|
973
|
+
)`);
|
|
974
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_calendar_events (
|
|
975
|
+
id TEXT PRIMARY KEY,
|
|
976
|
+
agent_id TEXT NOT NULL,
|
|
977
|
+
provider TEXT NOT NULL DEFAULT 'google',
|
|
1272
978
|
side TEXT NOT NULL DEFAULT 'owner',
|
|
1273
979
|
calendar_id TEXT NOT NULL,
|
|
1274
980
|
external_event_id TEXT NOT NULL,
|
|
1275
|
-
|
|
981
|
+
grant_id TEXT,
|
|
982
|
+
title TEXT NOT NULL DEFAULT '',
|
|
1276
983
|
description TEXT NOT NULL DEFAULT '',
|
|
1277
984
|
location TEXT NOT NULL DEFAULT '',
|
|
1278
|
-
status TEXT NOT NULL,
|
|
985
|
+
status TEXT NOT NULL DEFAULT '',
|
|
1279
986
|
start_at TEXT NOT NULL,
|
|
1280
987
|
end_at TEXT NOT NULL,
|
|
1281
|
-
is_all_day BOOLEAN NOT NULL,
|
|
988
|
+
is_all_day BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1282
989
|
timezone TEXT,
|
|
1283
990
|
html_link TEXT,
|
|
1284
991
|
conference_link TEXT,
|
|
@@ -1289,63 +996,27 @@ async function runLifeOpsSchemaSetup(runtime, key) {
|
|
|
1289
996
|
updated_at TEXT NOT NULL,
|
|
1290
997
|
UNIQUE(agent_id, provider, side, calendar_id, external_event_id)
|
|
1291
998
|
)`);
|
|
1292
|
-
|
|
1293
|
-
id, agent_id, provider, side, calendar_id, external_event_id, title,
|
|
1294
|
-
description, location, status, start_at, end_at, is_all_day, timezone,
|
|
1295
|
-
html_link, conference_link, organizer_json, attendees_json,
|
|
1296
|
-
metadata_json, synced_at, updated_at
|
|
1297
|
-
)
|
|
1298
|
-
SELECT
|
|
1299
|
-
id, agent_id, provider, 'owner', calendar_id, external_event_id, title,
|
|
1300
|
-
description, location, status, start_at, end_at, is_all_day, timezone,
|
|
1301
|
-
html_link, conference_link, organizer_json, attendees_json,
|
|
1302
|
-
COALESCE(metadata_json, '{}'), synced_at, updated_at
|
|
1303
|
-
FROM life_calendar_events`);
|
|
1304
|
-
await executeRawSql(runtime, `DROP TABLE life_calendar_events`);
|
|
1305
|
-
await executeRawSql(runtime, `ALTER TABLE life_calendar_events_next RENAME TO life_calendar_events`);
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
const existingCalendarSyncStateColumns = new Set(await listTableColumns(runtime, "life_calendar_sync_states"));
|
|
1309
|
-
if (existingCalendarSyncStateColumns.size > 0 &&
|
|
1310
|
-
!existingCalendarSyncStateColumns.has("side")) {
|
|
1311
|
-
await runMigrationWithSavepoint(runtime, "migrate_calendar_sync_states", async () => {
|
|
1312
|
-
await executeRawSql(runtime, `DROP TABLE IF EXISTS life_calendar_sync_states_next`);
|
|
1313
|
-
await executeRawSql(runtime, `CREATE TABLE life_calendar_sync_states_next (
|
|
999
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_calendar_sync_states (
|
|
1314
1000
|
id TEXT PRIMARY KEY,
|
|
1315
1001
|
agent_id TEXT NOT NULL,
|
|
1316
|
-
provider TEXT NOT NULL,
|
|
1002
|
+
provider TEXT NOT NULL DEFAULT 'google',
|
|
1317
1003
|
side TEXT NOT NULL DEFAULT 'owner',
|
|
1318
1004
|
calendar_id TEXT NOT NULL,
|
|
1005
|
+
grant_id TEXT,
|
|
1319
1006
|
window_start_at TEXT NOT NULL,
|
|
1320
1007
|
window_end_at TEXT NOT NULL,
|
|
1321
1008
|
synced_at TEXT NOT NULL,
|
|
1322
1009
|
updated_at TEXT NOT NULL,
|
|
1323
1010
|
UNIQUE(agent_id, provider, side, calendar_id)
|
|
1324
1011
|
)`);
|
|
1325
|
-
|
|
1326
|
-
id, agent_id, provider, side, calendar_id, window_start_at,
|
|
1327
|
-
window_end_at, synced_at, updated_at
|
|
1328
|
-
)
|
|
1329
|
-
SELECT
|
|
1330
|
-
id, agent_id, provider, 'owner', calendar_id, window_start_at,
|
|
1331
|
-
window_end_at, synced_at, updated_at
|
|
1332
|
-
FROM life_calendar_sync_states`);
|
|
1333
|
-
await executeRawSql(runtime, `DROP TABLE life_calendar_sync_states`);
|
|
1334
|
-
await executeRawSql(runtime, `ALTER TABLE life_calendar_sync_states_next RENAME TO life_calendar_sync_states`);
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
const existingGmailMessageColumns = new Set(await listTableColumns(runtime, "life_gmail_messages"));
|
|
1338
|
-
if (existingGmailMessageColumns.size > 0 &&
|
|
1339
|
-
!existingGmailMessageColumns.has("side")) {
|
|
1340
|
-
await runMigrationWithSavepoint(runtime, "migrate_gmail_messages", async () => {
|
|
1341
|
-
await executeRawSql(runtime, `DROP TABLE IF EXISTS life_gmail_messages_next`);
|
|
1342
|
-
await executeRawSql(runtime, `CREATE TABLE life_gmail_messages_next (
|
|
1012
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_gmail_messages (
|
|
1343
1013
|
id TEXT PRIMARY KEY,
|
|
1344
1014
|
agent_id TEXT NOT NULL,
|
|
1345
|
-
provider TEXT NOT NULL,
|
|
1015
|
+
provider TEXT NOT NULL DEFAULT 'google',
|
|
1346
1016
|
side TEXT NOT NULL DEFAULT 'owner',
|
|
1347
1017
|
external_message_id TEXT NOT NULL,
|
|
1348
|
-
|
|
1018
|
+
grant_id TEXT,
|
|
1019
|
+
thread_id TEXT NOT NULL DEFAULT '',
|
|
1349
1020
|
subject TEXT NOT NULL DEFAULT '',
|
|
1350
1021
|
from_display TEXT NOT NULL DEFAULT '',
|
|
1351
1022
|
from_email TEXT,
|
|
@@ -1354,7 +1025,7 @@ async function runLifeOpsSchemaSetup(runtime, key) {
|
|
|
1354
1025
|
cc_json TEXT NOT NULL DEFAULT '[]',
|
|
1355
1026
|
snippet TEXT NOT NULL DEFAULT '',
|
|
1356
1027
|
received_at TEXT NOT NULL,
|
|
1357
|
-
is_unread BOOLEAN NOT NULL DEFAULT
|
|
1028
|
+
is_unread BOOLEAN NOT NULL DEFAULT TRUE,
|
|
1358
1029
|
is_important BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1359
1030
|
likely_reply_needed BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1360
1031
|
triage_score INTEGER NOT NULL DEFAULT 0,
|
|
@@ -1366,134 +1037,382 @@ async function runLifeOpsSchemaSetup(runtime, key) {
|
|
|
1366
1037
|
updated_at TEXT NOT NULL,
|
|
1367
1038
|
UNIQUE(agent_id, provider, side, external_message_id)
|
|
1368
1039
|
)`);
|
|
1369
|
-
|
|
1370
|
-
id, agent_id, provider, side, external_message_id, thread_id, subject,
|
|
1371
|
-
from_display, from_email, reply_to, to_json, cc_json, snippet,
|
|
1372
|
-
received_at, is_unread, is_important, likely_reply_needed,
|
|
1373
|
-
triage_score, triage_reason, label_ids_json, html_link, metadata_json,
|
|
1374
|
-
synced_at, updated_at
|
|
1375
|
-
)
|
|
1376
|
-
SELECT
|
|
1377
|
-
id, agent_id, provider, 'owner', external_message_id, thread_id,
|
|
1378
|
-
subject, from_display, from_email, reply_to, to_json, cc_json,
|
|
1379
|
-
snippet, received_at, is_unread, is_important, likely_reply_needed,
|
|
1380
|
-
triage_score, triage_reason, label_ids_json, html_link,
|
|
1381
|
-
COALESCE(metadata_json, '{}'), synced_at, updated_at
|
|
1382
|
-
FROM life_gmail_messages`);
|
|
1383
|
-
await executeRawSql(runtime, `DROP TABLE life_gmail_messages`);
|
|
1384
|
-
await executeRawSql(runtime, `ALTER TABLE life_gmail_messages_next RENAME TO life_gmail_messages`);
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
const existingGmailSyncStateColumns = new Set(await listTableColumns(runtime, "life_gmail_sync_states"));
|
|
1388
|
-
if (existingGmailSyncStateColumns.size > 0 &&
|
|
1389
|
-
!existingGmailSyncStateColumns.has("side")) {
|
|
1390
|
-
await runMigrationWithSavepoint(runtime, "migrate_gmail_sync_states", async () => {
|
|
1391
|
-
await executeRawSql(runtime, `DROP TABLE IF EXISTS life_gmail_sync_states_next`);
|
|
1392
|
-
await executeRawSql(runtime, `CREATE TABLE life_gmail_sync_states_next (
|
|
1040
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_gmail_sync_states (
|
|
1393
1041
|
id TEXT PRIMARY KEY,
|
|
1394
1042
|
agent_id TEXT NOT NULL,
|
|
1395
|
-
provider TEXT NOT NULL,
|
|
1043
|
+
provider TEXT NOT NULL DEFAULT 'google',
|
|
1396
1044
|
side TEXT NOT NULL DEFAULT 'owner',
|
|
1397
1045
|
mailbox TEXT NOT NULL,
|
|
1046
|
+
grant_id TEXT,
|
|
1398
1047
|
max_results INTEGER NOT NULL DEFAULT 0,
|
|
1399
1048
|
synced_at TEXT NOT NULL,
|
|
1400
1049
|
updated_at TEXT NOT NULL,
|
|
1401
1050
|
UNIQUE(agent_id, provider, side, mailbox)
|
|
1402
1051
|
)`);
|
|
1403
|
-
|
|
1404
|
-
id
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
`CREATE
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1052
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_workflow_definitions (
|
|
1053
|
+
id TEXT PRIMARY KEY,
|
|
1054
|
+
agent_id TEXT NOT NULL,
|
|
1055
|
+
domain TEXT NOT NULL DEFAULT 'user_lifeops',
|
|
1056
|
+
subject_type TEXT NOT NULL DEFAULT 'owner',
|
|
1057
|
+
subject_id TEXT NOT NULL,
|
|
1058
|
+
visibility_scope TEXT NOT NULL DEFAULT 'owner_agent_admin',
|
|
1059
|
+
context_policy TEXT NOT NULL DEFAULT 'explicit_only',
|
|
1060
|
+
title TEXT NOT NULL,
|
|
1061
|
+
trigger_type TEXT NOT NULL,
|
|
1062
|
+
schedule_json TEXT NOT NULL DEFAULT '{}',
|
|
1063
|
+
action_plan_json TEXT NOT NULL DEFAULT '{}',
|
|
1064
|
+
permission_policy_json TEXT NOT NULL DEFAULT '{}',
|
|
1065
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
1066
|
+
created_by TEXT NOT NULL DEFAULT 'agent',
|
|
1067
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1068
|
+
created_at TEXT NOT NULL,
|
|
1069
|
+
updated_at TEXT NOT NULL
|
|
1070
|
+
)`);
|
|
1071
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_workflow_runs (
|
|
1072
|
+
id TEXT PRIMARY KEY,
|
|
1073
|
+
agent_id TEXT NOT NULL,
|
|
1074
|
+
workflow_id TEXT NOT NULL,
|
|
1075
|
+
started_at TEXT NOT NULL,
|
|
1076
|
+
finished_at TEXT,
|
|
1077
|
+
status TEXT NOT NULL DEFAULT 'running',
|
|
1078
|
+
result_json TEXT NOT NULL DEFAULT '{}',
|
|
1079
|
+
audit_ref TEXT
|
|
1080
|
+
)`);
|
|
1081
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_browser_companions (
|
|
1082
|
+
id TEXT PRIMARY KEY,
|
|
1083
|
+
agent_id TEXT NOT NULL,
|
|
1084
|
+
browser TEXT NOT NULL,
|
|
1085
|
+
profile_id TEXT NOT NULL,
|
|
1086
|
+
profile_label TEXT NOT NULL DEFAULT '',
|
|
1087
|
+
label TEXT NOT NULL DEFAULT '',
|
|
1088
|
+
extension_version TEXT,
|
|
1089
|
+
connection_state TEXT NOT NULL DEFAULT 'disconnected',
|
|
1090
|
+
permissions_json TEXT NOT NULL DEFAULT '{}',
|
|
1091
|
+
pairing_token_hash TEXT,
|
|
1092
|
+
pending_pairing_token_hashes_json TEXT NOT NULL DEFAULT '[]',
|
|
1093
|
+
last_seen_at TEXT,
|
|
1094
|
+
paired_at TEXT,
|
|
1095
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1096
|
+
created_at TEXT NOT NULL,
|
|
1097
|
+
updated_at TEXT NOT NULL,
|
|
1098
|
+
UNIQUE(agent_id, browser, profile_id)
|
|
1099
|
+
)`);
|
|
1100
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_browser_settings (
|
|
1101
|
+
agent_id TEXT PRIMARY KEY,
|
|
1102
|
+
enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1103
|
+
tracking_mode TEXT NOT NULL DEFAULT 'current_tab',
|
|
1104
|
+
allow_browser_control BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1105
|
+
require_confirmation_for_account_affecting BOOLEAN NOT NULL DEFAULT TRUE,
|
|
1106
|
+
incognito_enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1107
|
+
site_access_mode TEXT NOT NULL DEFAULT 'current_site_only',
|
|
1108
|
+
granted_origins_json TEXT NOT NULL DEFAULT '[]',
|
|
1109
|
+
blocked_origins_json TEXT NOT NULL DEFAULT '[]',
|
|
1110
|
+
max_remembered_tabs INTEGER NOT NULL DEFAULT 10,
|
|
1111
|
+
pause_until TEXT,
|
|
1112
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1113
|
+
created_at TEXT NOT NULL,
|
|
1114
|
+
updated_at TEXT NOT NULL
|
|
1115
|
+
)`);
|
|
1116
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_browser_sessions (
|
|
1117
|
+
id TEXT PRIMARY KEY,
|
|
1118
|
+
agent_id TEXT NOT NULL,
|
|
1119
|
+
domain TEXT NOT NULL DEFAULT 'user_lifeops',
|
|
1120
|
+
subject_type TEXT NOT NULL DEFAULT 'owner',
|
|
1121
|
+
subject_id TEXT NOT NULL,
|
|
1122
|
+
visibility_scope TEXT NOT NULL DEFAULT 'owner_agent_admin',
|
|
1123
|
+
context_policy TEXT NOT NULL DEFAULT 'explicit_only',
|
|
1124
|
+
workflow_id TEXT,
|
|
1125
|
+
browser TEXT,
|
|
1126
|
+
companion_id TEXT,
|
|
1127
|
+
profile_id TEXT,
|
|
1128
|
+
window_id TEXT,
|
|
1129
|
+
tab_id TEXT,
|
|
1130
|
+
title TEXT NOT NULL DEFAULT '',
|
|
1131
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
1132
|
+
actions_json TEXT NOT NULL DEFAULT '[]',
|
|
1133
|
+
current_action_index INTEGER NOT NULL DEFAULT 0,
|
|
1134
|
+
awaiting_confirmation_for_action_id TEXT,
|
|
1135
|
+
result_json TEXT NOT NULL DEFAULT '{}',
|
|
1136
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1137
|
+
created_at TEXT NOT NULL,
|
|
1138
|
+
updated_at TEXT NOT NULL,
|
|
1139
|
+
finished_at TEXT
|
|
1140
|
+
)`);
|
|
1141
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_browser_tabs (
|
|
1142
|
+
id TEXT PRIMARY KEY,
|
|
1143
|
+
agent_id TEXT NOT NULL,
|
|
1144
|
+
companion_id TEXT,
|
|
1145
|
+
browser TEXT NOT NULL,
|
|
1146
|
+
profile_id TEXT NOT NULL,
|
|
1147
|
+
window_id TEXT NOT NULL,
|
|
1148
|
+
tab_id TEXT NOT NULL,
|
|
1149
|
+
url TEXT NOT NULL DEFAULT '',
|
|
1150
|
+
title TEXT NOT NULL DEFAULT '',
|
|
1151
|
+
active_in_window BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1152
|
+
focused_window BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1153
|
+
focused_active BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1154
|
+
incognito BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1155
|
+
favicon_url TEXT,
|
|
1156
|
+
last_seen_at TEXT NOT NULL,
|
|
1157
|
+
last_focused_at TEXT,
|
|
1158
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1159
|
+
created_at TEXT NOT NULL,
|
|
1160
|
+
updated_at TEXT NOT NULL,
|
|
1161
|
+
UNIQUE(agent_id, browser, profile_id, window_id, tab_id)
|
|
1162
|
+
)`);
|
|
1163
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_browser_page_contexts (
|
|
1164
|
+
id TEXT PRIMARY KEY,
|
|
1165
|
+
agent_id TEXT NOT NULL,
|
|
1166
|
+
browser TEXT NOT NULL,
|
|
1167
|
+
profile_id TEXT NOT NULL,
|
|
1168
|
+
window_id TEXT NOT NULL,
|
|
1169
|
+
tab_id TEXT NOT NULL,
|
|
1170
|
+
url TEXT NOT NULL DEFAULT '',
|
|
1171
|
+
title TEXT NOT NULL DEFAULT '',
|
|
1172
|
+
selection_text TEXT,
|
|
1173
|
+
main_text TEXT,
|
|
1174
|
+
headings_json TEXT NOT NULL DEFAULT '[]',
|
|
1175
|
+
links_json TEXT NOT NULL DEFAULT '[]',
|
|
1176
|
+
forms_json TEXT NOT NULL DEFAULT '[]',
|
|
1177
|
+
captured_at TEXT NOT NULL,
|
|
1178
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1179
|
+
UNIQUE(agent_id, browser, profile_id, window_id, tab_id)
|
|
1180
|
+
)`);
|
|
1181
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_escalation_states (
|
|
1182
|
+
id TEXT PRIMARY KEY,
|
|
1183
|
+
agent_id TEXT NOT NULL,
|
|
1184
|
+
reason TEXT NOT NULL DEFAULT '',
|
|
1185
|
+
text TEXT NOT NULL DEFAULT '',
|
|
1186
|
+
current_step INTEGER NOT NULL DEFAULT 0,
|
|
1187
|
+
channels_sent_json TEXT NOT NULL DEFAULT '[]',
|
|
1188
|
+
started_at TEXT NOT NULL,
|
|
1189
|
+
last_sent_at TEXT NOT NULL,
|
|
1190
|
+
resolved BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1191
|
+
resolved_at TEXT,
|
|
1192
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1193
|
+
created_at TEXT NOT NULL,
|
|
1194
|
+
updated_at TEXT NOT NULL
|
|
1195
|
+
)`);
|
|
1196
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_relationships (
|
|
1197
|
+
id TEXT PRIMARY KEY,
|
|
1198
|
+
agent_id TEXT NOT NULL,
|
|
1199
|
+
name TEXT NOT NULL,
|
|
1200
|
+
primary_channel TEXT NOT NULL,
|
|
1201
|
+
primary_handle TEXT NOT NULL,
|
|
1202
|
+
email TEXT,
|
|
1203
|
+
phone TEXT,
|
|
1204
|
+
notes TEXT NOT NULL DEFAULT '',
|
|
1205
|
+
tags_json TEXT NOT NULL DEFAULT '[]',
|
|
1206
|
+
relationship_type TEXT NOT NULL DEFAULT '',
|
|
1207
|
+
last_contacted_at TEXT,
|
|
1208
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1209
|
+
created_at TEXT NOT NULL,
|
|
1210
|
+
updated_at TEXT NOT NULL
|
|
1211
|
+
)`);
|
|
1212
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_relationship_interactions (
|
|
1213
|
+
id TEXT PRIMARY KEY,
|
|
1214
|
+
agent_id TEXT NOT NULL,
|
|
1215
|
+
relationship_id TEXT NOT NULL,
|
|
1216
|
+
channel TEXT NOT NULL,
|
|
1217
|
+
direction TEXT NOT NULL,
|
|
1218
|
+
summary TEXT NOT NULL DEFAULT '',
|
|
1219
|
+
occurred_at TEXT NOT NULL,
|
|
1220
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1221
|
+
created_at TEXT NOT NULL
|
|
1222
|
+
)`);
|
|
1223
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_follow_ups (
|
|
1224
|
+
id TEXT PRIMARY KEY,
|
|
1225
|
+
agent_id TEXT NOT NULL,
|
|
1226
|
+
relationship_id TEXT NOT NULL,
|
|
1227
|
+
due_at TEXT NOT NULL,
|
|
1228
|
+
reason TEXT NOT NULL DEFAULT '',
|
|
1229
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
1230
|
+
priority INTEGER NOT NULL DEFAULT 3,
|
|
1231
|
+
draft_json TEXT,
|
|
1232
|
+
completed_at TEXT,
|
|
1233
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1234
|
+
created_at TEXT NOT NULL,
|
|
1235
|
+
updated_at TEXT NOT NULL
|
|
1236
|
+
)`);
|
|
1237
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_inbox_triage_entries (
|
|
1238
|
+
id TEXT PRIMARY KEY,
|
|
1239
|
+
agent_id TEXT NOT NULL,
|
|
1240
|
+
source TEXT NOT NULL,
|
|
1241
|
+
source_room_id TEXT,
|
|
1242
|
+
source_entity_id TEXT,
|
|
1243
|
+
source_message_id TEXT,
|
|
1244
|
+
channel_name TEXT NOT NULL,
|
|
1245
|
+
channel_type TEXT NOT NULL,
|
|
1246
|
+
deep_link TEXT,
|
|
1247
|
+
classification TEXT NOT NULL,
|
|
1248
|
+
urgency TEXT NOT NULL DEFAULT 'low',
|
|
1249
|
+
confidence REAL NOT NULL DEFAULT 0.5,
|
|
1250
|
+
snippet TEXT NOT NULL DEFAULT '',
|
|
1251
|
+
sender_name TEXT,
|
|
1252
|
+
thread_context TEXT,
|
|
1253
|
+
triage_reasoning TEXT,
|
|
1254
|
+
suggested_response TEXT,
|
|
1255
|
+
draft_response TEXT,
|
|
1256
|
+
auto_replied BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1257
|
+
resolved BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1258
|
+
resolved_at TEXT,
|
|
1259
|
+
created_at TEXT NOT NULL,
|
|
1260
|
+
updated_at TEXT NOT NULL
|
|
1261
|
+
)`);
|
|
1262
|
+
await executeRawSql(runtime, `CREATE INDEX IF NOT EXISTS idx_life_inbox_triage_entries_agent_created
|
|
1263
|
+
ON life_inbox_triage_entries(agent_id, created_at DESC)`);
|
|
1264
|
+
await executeRawSql(runtime, `CREATE INDEX IF NOT EXISTS idx_life_inbox_triage_entries_agent_source_message
|
|
1265
|
+
ON life_inbox_triage_entries(agent_id, source_message_id)`);
|
|
1266
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_inbox_triage_examples (
|
|
1267
|
+
id TEXT PRIMARY KEY,
|
|
1268
|
+
agent_id TEXT NOT NULL,
|
|
1269
|
+
source TEXT NOT NULL,
|
|
1270
|
+
snippet TEXT NOT NULL DEFAULT '',
|
|
1271
|
+
classification TEXT NOT NULL,
|
|
1272
|
+
owner_action TEXT NOT NULL,
|
|
1273
|
+
owner_classification TEXT,
|
|
1274
|
+
context_json TEXT NOT NULL DEFAULT '{}',
|
|
1275
|
+
created_at TEXT NOT NULL
|
|
1276
|
+
)`);
|
|
1277
|
+
await executeRawSql(runtime, `CREATE INDEX IF NOT EXISTS idx_life_inbox_triage_examples_agent_created
|
|
1278
|
+
ON life_inbox_triage_examples(agent_id, created_at DESC)`);
|
|
1279
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_x_dms (
|
|
1280
|
+
id TEXT PRIMARY KEY,
|
|
1281
|
+
agent_id TEXT NOT NULL,
|
|
1282
|
+
external_dm_id TEXT NOT NULL,
|
|
1283
|
+
conversation_id TEXT NOT NULL DEFAULT '',
|
|
1284
|
+
sender_handle TEXT NOT NULL DEFAULT '',
|
|
1285
|
+
sender_id TEXT NOT NULL DEFAULT '',
|
|
1286
|
+
is_inbound BOOLEAN NOT NULL DEFAULT TRUE,
|
|
1287
|
+
text TEXT NOT NULL DEFAULT '',
|
|
1288
|
+
received_at TEXT NOT NULL,
|
|
1289
|
+
read_at TEXT,
|
|
1290
|
+
replied_at TEXT,
|
|
1291
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1292
|
+
synced_at TEXT NOT NULL,
|
|
1293
|
+
updated_at TEXT NOT NULL,
|
|
1294
|
+
UNIQUE(agent_id, external_dm_id)
|
|
1295
|
+
)`);
|
|
1296
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_x_feed_items (
|
|
1297
|
+
id TEXT PRIMARY KEY,
|
|
1298
|
+
agent_id TEXT NOT NULL,
|
|
1299
|
+
external_tweet_id TEXT NOT NULL,
|
|
1300
|
+
author_handle TEXT NOT NULL DEFAULT '',
|
|
1301
|
+
author_id TEXT NOT NULL DEFAULT '',
|
|
1302
|
+
text TEXT NOT NULL DEFAULT '',
|
|
1303
|
+
created_at_source TEXT NOT NULL,
|
|
1304
|
+
feed_type TEXT NOT NULL,
|
|
1305
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1306
|
+
synced_at TEXT NOT NULL,
|
|
1307
|
+
updated_at TEXT NOT NULL,
|
|
1308
|
+
UNIQUE(agent_id, external_tweet_id, feed_type)
|
|
1309
|
+
)`);
|
|
1310
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_x_sync_states (
|
|
1311
|
+
id TEXT PRIMARY KEY,
|
|
1312
|
+
agent_id TEXT NOT NULL,
|
|
1313
|
+
feed_type TEXT NOT NULL,
|
|
1314
|
+
last_cursor TEXT,
|
|
1315
|
+
synced_at TEXT NOT NULL,
|
|
1316
|
+
updated_at TEXT NOT NULL,
|
|
1317
|
+
UNIQUE(agent_id, feed_type)
|
|
1318
|
+
)`);
|
|
1319
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_screen_time_sessions (
|
|
1320
|
+
id TEXT PRIMARY KEY,
|
|
1321
|
+
agent_id TEXT NOT NULL,
|
|
1322
|
+
source TEXT NOT NULL,
|
|
1323
|
+
identifier TEXT NOT NULL,
|
|
1324
|
+
display_name TEXT NOT NULL DEFAULT '',
|
|
1325
|
+
start_at TEXT NOT NULL,
|
|
1326
|
+
end_at TEXT,
|
|
1327
|
+
duration_seconds INTEGER NOT NULL DEFAULT 0,
|
|
1328
|
+
is_active BOOLEAN NOT NULL DEFAULT FALSE,
|
|
1329
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1330
|
+
created_at TEXT NOT NULL,
|
|
1331
|
+
updated_at TEXT NOT NULL
|
|
1332
|
+
)`);
|
|
1333
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_screen_time_daily (
|
|
1334
|
+
id TEXT PRIMARY KEY,
|
|
1335
|
+
agent_id TEXT NOT NULL,
|
|
1336
|
+
source TEXT NOT NULL,
|
|
1337
|
+
identifier TEXT NOT NULL,
|
|
1338
|
+
date TEXT NOT NULL,
|
|
1339
|
+
total_seconds INTEGER NOT NULL DEFAULT 0,
|
|
1340
|
+
session_count INTEGER NOT NULL DEFAULT 0,
|
|
1341
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1342
|
+
created_at TEXT NOT NULL,
|
|
1343
|
+
updated_at TEXT NOT NULL,
|
|
1344
|
+
UNIQUE(agent_id, source, identifier, date)
|
|
1345
|
+
)`);
|
|
1346
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_scheduling_negotiations (
|
|
1347
|
+
id TEXT PRIMARY KEY,
|
|
1348
|
+
agent_id TEXT NOT NULL,
|
|
1349
|
+
subject TEXT NOT NULL DEFAULT '',
|
|
1350
|
+
relationship_id TEXT,
|
|
1351
|
+
duration_minutes INTEGER NOT NULL DEFAULT 0,
|
|
1352
|
+
timezone TEXT NOT NULL DEFAULT 'UTC',
|
|
1353
|
+
state TEXT NOT NULL DEFAULT 'initiated',
|
|
1354
|
+
accepted_proposal_id TEXT,
|
|
1355
|
+
started_at TEXT NOT NULL,
|
|
1356
|
+
finalized_at TEXT,
|
|
1357
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1358
|
+
created_at TEXT NOT NULL,
|
|
1359
|
+
updated_at TEXT NOT NULL
|
|
1360
|
+
)`);
|
|
1361
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_scheduling_proposals (
|
|
1362
|
+
id TEXT PRIMARY KEY,
|
|
1363
|
+
agent_id TEXT NOT NULL,
|
|
1364
|
+
negotiation_id TEXT NOT NULL,
|
|
1365
|
+
start_at TEXT NOT NULL,
|
|
1366
|
+
end_at TEXT NOT NULL,
|
|
1367
|
+
proposed_by TEXT NOT NULL DEFAULT 'agent',
|
|
1368
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
1369
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1370
|
+
created_at TEXT NOT NULL,
|
|
1371
|
+
updated_at TEXT NOT NULL
|
|
1372
|
+
)`);
|
|
1373
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_dossiers (
|
|
1374
|
+
id TEXT PRIMARY KEY,
|
|
1375
|
+
agent_id TEXT NOT NULL,
|
|
1376
|
+
calendar_event_id TEXT,
|
|
1377
|
+
subject TEXT NOT NULL DEFAULT '',
|
|
1378
|
+
generated_for_at TEXT NOT NULL,
|
|
1379
|
+
content_md TEXT NOT NULL DEFAULT '',
|
|
1380
|
+
sources_json TEXT NOT NULL DEFAULT '[]',
|
|
1381
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1382
|
+
created_at TEXT NOT NULL,
|
|
1383
|
+
updated_at TEXT NOT NULL
|
|
1384
|
+
)`);
|
|
1385
|
+
// T8d — Activity tracker events (append-only). Plan §6.12.
|
|
1386
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_activity_events (
|
|
1387
|
+
id TEXT PRIMARY KEY,
|
|
1388
|
+
agent_id TEXT NOT NULL,
|
|
1389
|
+
observed_at TEXT NOT NULL,
|
|
1390
|
+
event_kind TEXT NOT NULL,
|
|
1391
|
+
bundle_id TEXT NOT NULL,
|
|
1392
|
+
app_name TEXT NOT NULL,
|
|
1393
|
+
window_title TEXT,
|
|
1394
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1395
|
+
created_at TEXT NOT NULL
|
|
1396
|
+
)`);
|
|
1397
|
+
// T7g — Website blocker chat integration block rules. Plan §6.8.
|
|
1398
|
+
await executeRawSql(runtime, `CREATE TABLE IF NOT EXISTS life_block_rules (
|
|
1399
|
+
id UUID PRIMARY KEY,
|
|
1400
|
+
agent_id UUID NOT NULL,
|
|
1401
|
+
profile TEXT NOT NULL,
|
|
1402
|
+
websites JSONB NOT NULL,
|
|
1403
|
+
gate_type TEXT NOT NULL,
|
|
1404
|
+
gate_todo_id TEXT,
|
|
1405
|
+
gate_until_ms BIGINT,
|
|
1406
|
+
fixed_duration_ms BIGINT,
|
|
1407
|
+
unlock_duration_ms BIGINT,
|
|
1408
|
+
active BOOLEAN DEFAULT TRUE,
|
|
1409
|
+
created_at BIGINT NOT NULL,
|
|
1410
|
+
released_at BIGINT,
|
|
1411
|
+
released_reason TEXT
|
|
1412
|
+
)`);
|
|
1413
|
+
await executeRawSql(runtime, `CREATE INDEX IF NOT EXISTS idx_block_rules_active_gate ON life_block_rules(active, gate_type) WHERE active = TRUE`);
|
|
1494
1414
|
}
|
|
1495
1415
|
async createDefinition(definition) {
|
|
1496
|
-
await this.ensureReady();
|
|
1497
1416
|
await executeRawSql(this.runtime, `INSERT INTO life_task_definitions (
|
|
1498
1417
|
id, agent_id, domain, subject_type, subject_id, visibility_scope,
|
|
1499
1418
|
context_policy, kind, title, description, original_intent, timezone,
|
|
@@ -1530,7 +1449,6 @@ export class LifeOpsRepository {
|
|
|
1530
1449
|
)`);
|
|
1531
1450
|
}
|
|
1532
1451
|
async updateDefinition(definition) {
|
|
1533
|
-
await this.ensureReady();
|
|
1534
1452
|
await executeRawSql(this.runtime, `UPDATE life_task_definitions
|
|
1535
1453
|
SET domain = ${sqlQuote(definition.domain)},
|
|
1536
1454
|
subject_type = ${sqlQuote(definition.subjectType)},
|
|
@@ -1558,7 +1476,6 @@ export class LifeOpsRepository {
|
|
|
1558
1476
|
AND agent_id = ${sqlQuote(definition.agentId)}`);
|
|
1559
1477
|
}
|
|
1560
1478
|
async getDefinition(agentId, definitionId) {
|
|
1561
|
-
await this.ensureReady();
|
|
1562
1479
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1563
1480
|
FROM life_task_definitions
|
|
1564
1481
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1568,7 +1485,6 @@ export class LifeOpsRepository {
|
|
|
1568
1485
|
return row ? parseTaskDefinition(row) : null;
|
|
1569
1486
|
}
|
|
1570
1487
|
async listDefinitions(agentId) {
|
|
1571
|
-
await this.ensureReady();
|
|
1572
1488
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1573
1489
|
FROM life_task_definitions
|
|
1574
1490
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1576,7 +1492,6 @@ export class LifeOpsRepository {
|
|
|
1576
1492
|
return rows.map(parseTaskDefinition);
|
|
1577
1493
|
}
|
|
1578
1494
|
async listActiveDefinitions(agentId) {
|
|
1579
|
-
await this.ensureReady();
|
|
1580
1495
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1581
1496
|
FROM life_task_definitions
|
|
1582
1497
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1585,7 +1500,6 @@ export class LifeOpsRepository {
|
|
|
1585
1500
|
return rows.map(parseTaskDefinition);
|
|
1586
1501
|
}
|
|
1587
1502
|
async deleteDefinition(agentId, definitionId) {
|
|
1588
|
-
await this.ensureReady();
|
|
1589
1503
|
await executeRawSql(this.runtime, `DELETE FROM life_reminder_plans
|
|
1590
1504
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
1591
1505
|
AND owner_type = 'definition'
|
|
@@ -1602,7 +1516,6 @@ export class LifeOpsRepository {
|
|
|
1602
1516
|
AND id = ${sqlQuote(definitionId)}`);
|
|
1603
1517
|
}
|
|
1604
1518
|
async upsertOccurrence(occurrence) {
|
|
1605
|
-
await this.ensureReady();
|
|
1606
1519
|
await executeRawSql(this.runtime, `INSERT INTO life_task_occurrences (
|
|
1607
1520
|
id, agent_id, domain, subject_type, subject_id, visibility_scope,
|
|
1608
1521
|
context_policy, definition_id, occurrence_key, scheduled_at, due_at,
|
|
@@ -1651,7 +1564,6 @@ export class LifeOpsRepository {
|
|
|
1651
1564
|
updated_at = excluded.updated_at`);
|
|
1652
1565
|
}
|
|
1653
1566
|
async listOccurrencesForDefinition(agentId, definitionId) {
|
|
1654
|
-
await this.ensureReady();
|
|
1655
1567
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1656
1568
|
FROM life_task_occurrences
|
|
1657
1569
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1660,7 +1572,6 @@ export class LifeOpsRepository {
|
|
|
1660
1572
|
return rows.map(parseOccurrence);
|
|
1661
1573
|
}
|
|
1662
1574
|
async listOccurrencesForDefinitions(agentId, definitionIds) {
|
|
1663
|
-
await this.ensureReady();
|
|
1664
1575
|
if (definitionIds.length === 0) {
|
|
1665
1576
|
return [];
|
|
1666
1577
|
}
|
|
@@ -1675,7 +1586,6 @@ export class LifeOpsRepository {
|
|
|
1675
1586
|
return rows.map(parseOccurrence);
|
|
1676
1587
|
}
|
|
1677
1588
|
async getOccurrence(agentId, occurrenceId) {
|
|
1678
|
-
await this.ensureReady();
|
|
1679
1589
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1680
1590
|
FROM life_task_occurrences
|
|
1681
1591
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1685,7 +1595,6 @@ export class LifeOpsRepository {
|
|
|
1685
1595
|
return row ? parseOccurrence(row) : null;
|
|
1686
1596
|
}
|
|
1687
1597
|
async getOccurrenceView(agentId, occurrenceId) {
|
|
1688
|
-
await this.ensureReady();
|
|
1689
1598
|
const rows = await executeRawSql(this.runtime, `SELECT occurrence.*,
|
|
1690
1599
|
definition.kind AS definition_kind,
|
|
1691
1600
|
definition.status AS definition_status,
|
|
@@ -1707,7 +1616,6 @@ export class LifeOpsRepository {
|
|
|
1707
1616
|
return row ? parseOccurrenceView(row) : null;
|
|
1708
1617
|
}
|
|
1709
1618
|
async listOccurrenceViewsForOverview(agentId, horizonIso) {
|
|
1710
|
-
await this.ensureReady();
|
|
1711
1619
|
const rows = await executeRawSql(this.runtime, `SELECT occurrence.*,
|
|
1712
1620
|
definition.kind AS definition_kind,
|
|
1713
1621
|
definition.status AS definition_status,
|
|
@@ -1735,7 +1643,6 @@ export class LifeOpsRepository {
|
|
|
1735
1643
|
return rows.map(parseOccurrenceView);
|
|
1736
1644
|
}
|
|
1737
1645
|
async updateOccurrence(occurrence) {
|
|
1738
|
-
await this.ensureReady();
|
|
1739
1646
|
await executeRawSql(this.runtime, `UPDATE life_task_occurrences
|
|
1740
1647
|
SET domain = ${sqlQuote(occurrence.domain)},
|
|
1741
1648
|
subject_type = ${sqlQuote(occurrence.subjectType)},
|
|
@@ -1757,7 +1664,6 @@ export class LifeOpsRepository {
|
|
|
1757
1664
|
AND agent_id = ${sqlQuote(occurrence.agentId)}`);
|
|
1758
1665
|
}
|
|
1759
1666
|
async pruneNonTerminalOccurrences(agentId, definitionId, keepOccurrenceKeys) {
|
|
1760
|
-
await this.ensureReady();
|
|
1761
1667
|
const keepClause = keepOccurrenceKeys.length > 0
|
|
1762
1668
|
? `AND occurrence_key NOT IN (${keepOccurrenceKeys
|
|
1763
1669
|
.map((occurrenceKey) => sqlQuote(occurrenceKey))
|
|
@@ -1770,7 +1676,6 @@ export class LifeOpsRepository {
|
|
|
1770
1676
|
${keepClause}`);
|
|
1771
1677
|
}
|
|
1772
1678
|
async createGoal(goal) {
|
|
1773
|
-
await this.ensureReady();
|
|
1774
1679
|
await executeRawSql(this.runtime, `INSERT INTO life_goal_definitions (
|
|
1775
1680
|
id, agent_id, domain, subject_type, subject_id, visibility_scope,
|
|
1776
1681
|
context_policy, title, description, cadence_json, support_strategy_json,
|
|
@@ -1797,7 +1702,6 @@ export class LifeOpsRepository {
|
|
|
1797
1702
|
)`);
|
|
1798
1703
|
}
|
|
1799
1704
|
async updateGoal(goal) {
|
|
1800
|
-
await this.ensureReady();
|
|
1801
1705
|
await executeRawSql(this.runtime, `UPDATE life_goal_definitions
|
|
1802
1706
|
SET domain = ${sqlQuote(goal.domain)},
|
|
1803
1707
|
subject_type = ${sqlQuote(goal.subjectType)},
|
|
@@ -1817,7 +1721,6 @@ export class LifeOpsRepository {
|
|
|
1817
1721
|
AND agent_id = ${sqlQuote(goal.agentId)}`);
|
|
1818
1722
|
}
|
|
1819
1723
|
async getGoal(agentId, goalId) {
|
|
1820
|
-
await this.ensureReady();
|
|
1821
1724
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1822
1725
|
FROM life_goal_definitions
|
|
1823
1726
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1827,7 +1730,6 @@ export class LifeOpsRepository {
|
|
|
1827
1730
|
return row ? parseGoal(row) : null;
|
|
1828
1731
|
}
|
|
1829
1732
|
async listGoals(agentId) {
|
|
1830
|
-
await this.ensureReady();
|
|
1831
1733
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1832
1734
|
FROM life_goal_definitions
|
|
1833
1735
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1835,7 +1737,6 @@ export class LifeOpsRepository {
|
|
|
1835
1737
|
return rows.map(parseGoal);
|
|
1836
1738
|
}
|
|
1837
1739
|
async deleteGoal(agentId, goalId) {
|
|
1838
|
-
await this.ensureReady();
|
|
1839
1740
|
await executeRawSql(this.runtime, `DELETE FROM life_goal_links
|
|
1840
1741
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
1841
1742
|
AND goal_id = ${sqlQuote(goalId)}`);
|
|
@@ -1848,7 +1749,6 @@ export class LifeOpsRepository {
|
|
|
1848
1749
|
AND id = ${sqlQuote(goalId)}`);
|
|
1849
1750
|
}
|
|
1850
1751
|
async upsertGoalLink(link) {
|
|
1851
|
-
await this.ensureReady();
|
|
1852
1752
|
await executeRawSql(this.runtime, `INSERT INTO life_goal_links (
|
|
1853
1753
|
id, agent_id, goal_id, linked_type, linked_id, created_at
|
|
1854
1754
|
) VALUES (
|
|
@@ -1862,14 +1762,12 @@ export class LifeOpsRepository {
|
|
|
1862
1762
|
ON CONFLICT(agent_id, goal_id, linked_type, linked_id) DO NOTHING`);
|
|
1863
1763
|
}
|
|
1864
1764
|
async deleteGoalLinksForLinked(agentId, linkedType, linkedId) {
|
|
1865
|
-
await this.ensureReady();
|
|
1866
1765
|
await executeRawSql(this.runtime, `DELETE FROM life_goal_links
|
|
1867
1766
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
1868
1767
|
AND linked_type = ${sqlQuote(linkedType)}
|
|
1869
1768
|
AND linked_id = ${sqlQuote(linkedId)}`);
|
|
1870
1769
|
}
|
|
1871
1770
|
async listGoalLinksForGoal(agentId, goalId) {
|
|
1872
|
-
await this.ensureReady();
|
|
1873
1771
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1874
1772
|
FROM life_goal_links
|
|
1875
1773
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1878,7 +1776,6 @@ export class LifeOpsRepository {
|
|
|
1878
1776
|
return rows.map(parseGoalLink);
|
|
1879
1777
|
}
|
|
1880
1778
|
async createReminderPlan(plan) {
|
|
1881
|
-
await this.ensureReady();
|
|
1882
1779
|
await executeRawSql(this.runtime, `INSERT INTO life_reminder_plans (
|
|
1883
1780
|
id, agent_id, owner_type, owner_id, steps_json,
|
|
1884
1781
|
mute_policy_json, quiet_hours_json, created_at, updated_at
|
|
@@ -1895,7 +1792,6 @@ export class LifeOpsRepository {
|
|
|
1895
1792
|
)`);
|
|
1896
1793
|
}
|
|
1897
1794
|
async updateReminderPlan(plan) {
|
|
1898
|
-
await this.ensureReady();
|
|
1899
1795
|
await executeRawSql(this.runtime, `UPDATE life_reminder_plans
|
|
1900
1796
|
SET steps_json = ${sqlJson(plan.steps)},
|
|
1901
1797
|
mute_policy_json = ${sqlJson(plan.mutePolicy)},
|
|
@@ -1905,13 +1801,11 @@ export class LifeOpsRepository {
|
|
|
1905
1801
|
AND agent_id = ${sqlQuote(plan.agentId)}`);
|
|
1906
1802
|
}
|
|
1907
1803
|
async deleteReminderPlan(agentId, planId) {
|
|
1908
|
-
await this.ensureReady();
|
|
1909
1804
|
await executeRawSql(this.runtime, `DELETE FROM life_reminder_plans
|
|
1910
1805
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
1911
1806
|
AND id = ${sqlQuote(planId)}`);
|
|
1912
1807
|
}
|
|
1913
1808
|
async getReminderPlan(agentId, planId) {
|
|
1914
|
-
await this.ensureReady();
|
|
1915
1809
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1916
1810
|
FROM life_reminder_plans
|
|
1917
1811
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1921,7 +1815,6 @@ export class LifeOpsRepository {
|
|
|
1921
1815
|
return row ? parseReminderPlan(row) : null;
|
|
1922
1816
|
}
|
|
1923
1817
|
async listReminderPlansForOwners(agentId, ownerType, ownerIds) {
|
|
1924
|
-
await this.ensureReady();
|
|
1925
1818
|
if (ownerIds.length === 0)
|
|
1926
1819
|
return [];
|
|
1927
1820
|
const ownerList = ownerIds.map((ownerId) => sqlQuote(ownerId)).join(", ");
|
|
@@ -1933,7 +1826,6 @@ export class LifeOpsRepository {
|
|
|
1933
1826
|
return rows.map(parseReminderPlan);
|
|
1934
1827
|
}
|
|
1935
1828
|
async createAuditEvent(event) {
|
|
1936
|
-
await this.ensureReady();
|
|
1937
1829
|
await executeRawSql(this.runtime, `INSERT INTO life_audit_events (
|
|
1938
1830
|
id, agent_id, event_type, owner_type, owner_id, reason,
|
|
1939
1831
|
inputs_json, decision_json, actor, created_at
|
|
@@ -1951,7 +1843,6 @@ export class LifeOpsRepository {
|
|
|
1951
1843
|
)`);
|
|
1952
1844
|
}
|
|
1953
1845
|
async listAuditEvents(agentId, ownerType, ownerId) {
|
|
1954
|
-
await this.ensureReady();
|
|
1955
1846
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
1956
1847
|
FROM life_audit_events
|
|
1957
1848
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -1961,7 +1852,6 @@ export class LifeOpsRepository {
|
|
|
1961
1852
|
return rows.map(parseAuditEvent);
|
|
1962
1853
|
}
|
|
1963
1854
|
async createActivitySignal(signal) {
|
|
1964
|
-
await this.ensureReady();
|
|
1965
1855
|
const metadata = signal.health !== null && signal.health !== undefined
|
|
1966
1856
|
? { ...signal.metadata, health: signal.health }
|
|
1967
1857
|
: signal.metadata;
|
|
@@ -1983,7 +1873,6 @@ export class LifeOpsRepository {
|
|
|
1983
1873
|
)`);
|
|
1984
1874
|
}
|
|
1985
1875
|
async listActivitySignals(agentId, args = {}) {
|
|
1986
|
-
await this.ensureReady();
|
|
1987
1876
|
const clauses = [`agent_id = ${sqlQuote(agentId)}`];
|
|
1988
1877
|
if (args.sinceAt) {
|
|
1989
1878
|
clauses.push(`observed_at >= ${sqlQuote(args.sinceAt)}`);
|
|
@@ -2003,7 +1892,6 @@ export class LifeOpsRepository {
|
|
|
2003
1892
|
return rows.map(parseActivitySignal);
|
|
2004
1893
|
}
|
|
2005
1894
|
async upsertChannelPolicy(policy) {
|
|
2006
|
-
await this.ensureReady();
|
|
2007
1895
|
await executeRawSql(this.runtime, `INSERT INTO life_channel_policies (
|
|
2008
1896
|
id, agent_id, channel_type, channel_ref, privacy_class,
|
|
2009
1897
|
allow_reminders, allow_escalation, allow_posts,
|
|
@@ -2032,7 +1920,6 @@ export class LifeOpsRepository {
|
|
|
2032
1920
|
updated_at = excluded.updated_at`);
|
|
2033
1921
|
}
|
|
2034
1922
|
async listChannelPolicies(agentId) {
|
|
2035
|
-
await this.ensureReady();
|
|
2036
1923
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2037
1924
|
FROM life_channel_policies
|
|
2038
1925
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2040,7 +1927,6 @@ export class LifeOpsRepository {
|
|
|
2040
1927
|
return rows.map(parseChannelPolicy);
|
|
2041
1928
|
}
|
|
2042
1929
|
async getChannelPolicy(agentId, channelType, channelRef) {
|
|
2043
|
-
await this.ensureReady();
|
|
2044
1930
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2045
1931
|
FROM life_channel_policies
|
|
2046
1932
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2051,7 +1937,6 @@ export class LifeOpsRepository {
|
|
|
2051
1937
|
return row ? parseChannelPolicy(row) : null;
|
|
2052
1938
|
}
|
|
2053
1939
|
async upsertWebsiteAccessGrant(grant) {
|
|
2054
|
-
await this.ensureReady();
|
|
2055
1940
|
await executeRawSql(this.runtime, `INSERT INTO life_website_access_grants (
|
|
2056
1941
|
id, agent_id, group_key, definition_id, occurrence_id, websites_json,
|
|
2057
1942
|
unlock_mode, unlock_duration_minutes, callback_key, unlocked_at,
|
|
@@ -2075,7 +1960,6 @@ export class LifeOpsRepository {
|
|
|
2075
1960
|
)`);
|
|
2076
1961
|
}
|
|
2077
1962
|
async listWebsiteAccessGrants(agentId) {
|
|
2078
|
-
await this.ensureReady();
|
|
2079
1963
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2080
1964
|
FROM life_website_access_grants
|
|
2081
1965
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2083,7 +1967,6 @@ export class LifeOpsRepository {
|
|
|
2083
1967
|
return rows.map(parseWebsiteAccessGrant);
|
|
2084
1968
|
}
|
|
2085
1969
|
async revokeWebsiteAccessGrants(agentId, args) {
|
|
2086
|
-
await this.ensureReady();
|
|
2087
1970
|
const clauses = [`agent_id = ${sqlQuote(agentId)}`, "revoked_at IS NULL"];
|
|
2088
1971
|
if (args.groupKey) {
|
|
2089
1972
|
clauses.push(`group_key = ${sqlQuote(args.groupKey)}`);
|
|
@@ -2097,9 +1980,10 @@ export class LifeOpsRepository {
|
|
|
2097
1980
|
WHERE ${clauses.join("\n AND ")}`);
|
|
2098
1981
|
}
|
|
2099
1982
|
async upsertConnectorGrant(grant) {
|
|
2100
|
-
|
|
1983
|
+
const identityEmail = deriveConnectorIdentityEmail(grant.identity);
|
|
2101
1984
|
await executeRawSql(this.runtime, `INSERT INTO life_connector_grants (
|
|
2102
|
-
id, agent_id, provider, side, identity_json,
|
|
1985
|
+
id, agent_id, provider, side, identity_json, identity_email,
|
|
1986
|
+
granted_scopes_json,
|
|
2103
1987
|
capabilities_json, token_ref, mode, execution_target, source_of_truth,
|
|
2104
1988
|
preferred_by_agent, cloud_connection_id, metadata_json,
|
|
2105
1989
|
last_refresh_at, created_at, updated_at
|
|
@@ -2109,6 +1993,7 @@ export class LifeOpsRepository {
|
|
|
2109
1993
|
${sqlQuote(grant.provider)},
|
|
2110
1994
|
${sqlQuote(grant.side)},
|
|
2111
1995
|
${sqlJson(grant.identity)},
|
|
1996
|
+
${sqlText(identityEmail)},
|
|
2112
1997
|
${sqlJson(grant.grantedScopes)},
|
|
2113
1998
|
${sqlJson(grant.capabilities)},
|
|
2114
1999
|
${sqlText(grant.tokenRef)},
|
|
@@ -2122,8 +2007,9 @@ export class LifeOpsRepository {
|
|
|
2122
2007
|
${sqlQuote(grant.createdAt)},
|
|
2123
2008
|
${sqlQuote(grant.updatedAt)}
|
|
2124
2009
|
)
|
|
2125
|
-
ON CONFLICT(agent_id, provider, side, mode) DO UPDATE SET
|
|
2010
|
+
ON CONFLICT(agent_id, provider, side, mode, identity_email) DO UPDATE SET
|
|
2126
2011
|
identity_json = excluded.identity_json,
|
|
2012
|
+
identity_email = excluded.identity_email,
|
|
2127
2013
|
granted_scopes_json = excluded.granted_scopes_json,
|
|
2128
2014
|
capabilities_json = excluded.capabilities_json,
|
|
2129
2015
|
token_ref = excluded.token_ref,
|
|
@@ -2136,7 +2022,6 @@ export class LifeOpsRepository {
|
|
|
2136
2022
|
updated_at = excluded.updated_at`);
|
|
2137
2023
|
}
|
|
2138
2024
|
async listConnectorGrants(agentId) {
|
|
2139
|
-
await this.ensureReady();
|
|
2140
2025
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2141
2026
|
FROM life_connector_grants
|
|
2142
2027
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2144,7 +2029,6 @@ export class LifeOpsRepository {
|
|
|
2144
2029
|
return rows.map(parseConnectorGrant);
|
|
2145
2030
|
}
|
|
2146
2031
|
async getConnectorGrant(agentId, provider, mode, side = "owner") {
|
|
2147
|
-
await this.ensureReady();
|
|
2148
2032
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2149
2033
|
FROM life_connector_grants
|
|
2150
2034
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2156,7 +2040,6 @@ export class LifeOpsRepository {
|
|
|
2156
2040
|
return row ? parseConnectorGrant(row) : null;
|
|
2157
2041
|
}
|
|
2158
2042
|
async deleteConnectorGrant(agentId, provider, mode, side) {
|
|
2159
|
-
await this.ensureReady();
|
|
2160
2043
|
const modeClause = mode ? `AND mode = ${sqlQuote(mode)}` : "";
|
|
2161
2044
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
2162
2045
|
await executeRawSql(this.runtime, `DELETE FROM life_connector_grants
|
|
@@ -2166,7 +2049,6 @@ export class LifeOpsRepository {
|
|
|
2166
2049
|
${sideClause}`);
|
|
2167
2050
|
}
|
|
2168
2051
|
async upsertCalendarEvent(event, side = event.side) {
|
|
2169
|
-
await this.ensureReady();
|
|
2170
2052
|
await executeRawSql(this.runtime, `INSERT INTO life_calendar_events (
|
|
2171
2053
|
id, agent_id, provider, side, calendar_id, external_event_id, title,
|
|
2172
2054
|
description, location, status, start_at, end_at, is_all_day,
|
|
@@ -2213,7 +2095,6 @@ export class LifeOpsRepository {
|
|
|
2213
2095
|
updated_at = excluded.updated_at`);
|
|
2214
2096
|
}
|
|
2215
2097
|
async deleteCalendarEventsForProvider(agentId, provider, calendarId, side) {
|
|
2216
|
-
await this.ensureReady();
|
|
2217
2098
|
const calendarClause = calendarId
|
|
2218
2099
|
? `AND calendar_id = ${sqlQuote(calendarId)}`
|
|
2219
2100
|
: "";
|
|
@@ -2225,7 +2106,6 @@ export class LifeOpsRepository {
|
|
|
2225
2106
|
${sideClause}`);
|
|
2226
2107
|
}
|
|
2227
2108
|
async deleteCalendarEventByExternalId(agentId, provider, calendarId, externalEventId, side) {
|
|
2228
|
-
await this.ensureReady();
|
|
2229
2109
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
2230
2110
|
await executeRawSql(this.runtime, `DELETE FROM life_calendar_events
|
|
2231
2111
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2235,7 +2115,6 @@ export class LifeOpsRepository {
|
|
|
2235
2115
|
${sideClause}`);
|
|
2236
2116
|
}
|
|
2237
2117
|
async pruneCalendarEventsInWindow(agentId, provider, calendarId, timeMin, timeMax, keepExternalIds, side = "owner") {
|
|
2238
|
-
await this.ensureReady();
|
|
2239
2118
|
const keepClause = keepExternalIds.length > 0
|
|
2240
2119
|
? `AND external_event_id NOT IN (${keepExternalIds
|
|
2241
2120
|
.map((externalId) => sqlQuote(externalId))
|
|
@@ -2251,7 +2130,6 @@ export class LifeOpsRepository {
|
|
|
2251
2130
|
${keepClause}`);
|
|
2252
2131
|
}
|
|
2253
2132
|
async listCalendarEvents(agentId, provider, timeMin, timeMax, side) {
|
|
2254
|
-
await this.ensureReady();
|
|
2255
2133
|
const timeMinClause = timeMin ? `AND end_at > ${sqlQuote(timeMin)}` : "";
|
|
2256
2134
|
const timeMaxClause = timeMax ? `AND start_at < ${sqlQuote(timeMax)}` : "";
|
|
2257
2135
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
@@ -2266,7 +2144,6 @@ export class LifeOpsRepository {
|
|
|
2266
2144
|
return rows.map(parseCalendarEvent);
|
|
2267
2145
|
}
|
|
2268
2146
|
async upsertCalendarSyncState(state) {
|
|
2269
|
-
await this.ensureReady();
|
|
2270
2147
|
await executeRawSql(this.runtime, `INSERT INTO life_calendar_sync_states (
|
|
2271
2148
|
id, agent_id, provider, side, calendar_id, window_start_at,
|
|
2272
2149
|
window_end_at, synced_at, updated_at
|
|
@@ -2288,7 +2165,6 @@ export class LifeOpsRepository {
|
|
|
2288
2165
|
updated_at = excluded.updated_at`);
|
|
2289
2166
|
}
|
|
2290
2167
|
async getCalendarSyncState(agentId, provider, calendarId, side) {
|
|
2291
|
-
await this.ensureReady();
|
|
2292
2168
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
2293
2169
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2294
2170
|
FROM life_calendar_sync_states
|
|
@@ -2301,7 +2177,6 @@ export class LifeOpsRepository {
|
|
|
2301
2177
|
return row ? parseCalendarSyncState(row) : null;
|
|
2302
2178
|
}
|
|
2303
2179
|
async deleteCalendarSyncState(agentId, provider, calendarId, side) {
|
|
2304
|
-
await this.ensureReady();
|
|
2305
2180
|
const calendarClause = calendarId
|
|
2306
2181
|
? `AND calendar_id = ${sqlQuote(calendarId)}`
|
|
2307
2182
|
: "";
|
|
@@ -2313,7 +2188,6 @@ export class LifeOpsRepository {
|
|
|
2313
2188
|
${sideClause}`);
|
|
2314
2189
|
}
|
|
2315
2190
|
async upsertGmailMessage(message, side = message.side) {
|
|
2316
|
-
await this.ensureReady();
|
|
2317
2191
|
await executeRawSql(this.runtime, `INSERT INTO life_gmail_messages (
|
|
2318
2192
|
id, agent_id, provider, side, external_message_id, thread_id, subject,
|
|
2319
2193
|
from_display, from_email, reply_to, to_json, cc_json, snippet,
|
|
@@ -2368,7 +2242,6 @@ export class LifeOpsRepository {
|
|
|
2368
2242
|
updated_at = excluded.updated_at`);
|
|
2369
2243
|
}
|
|
2370
2244
|
async pruneGmailMessages(agentId, provider, keepExternalIds, side) {
|
|
2371
|
-
await this.ensureReady();
|
|
2372
2245
|
const keepClause = keepExternalIds.length > 0
|
|
2373
2246
|
? `AND external_message_id NOT IN (${keepExternalIds
|
|
2374
2247
|
.map((externalId) => sqlQuote(externalId))
|
|
@@ -2382,7 +2255,6 @@ export class LifeOpsRepository {
|
|
|
2382
2255
|
${keepClause}`);
|
|
2383
2256
|
}
|
|
2384
2257
|
async listGmailMessages(agentId, provider, options, side) {
|
|
2385
|
-
await this.ensureReady();
|
|
2386
2258
|
const DEFAULT_GMAIL_LIST_LIMIT = 200;
|
|
2387
2259
|
const limit = options?.maxResults !== undefined && Number.isFinite(options.maxResults)
|
|
2388
2260
|
? options.maxResults
|
|
@@ -2407,7 +2279,6 @@ export class LifeOpsRepository {
|
|
|
2407
2279
|
return rows.map(parseGmailMessageSummary);
|
|
2408
2280
|
}
|
|
2409
2281
|
async getGmailMessage(agentId, provider, messageId, side) {
|
|
2410
|
-
await this.ensureReady();
|
|
2411
2282
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
2412
2283
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2413
2284
|
FROM life_gmail_messages
|
|
@@ -2420,7 +2291,6 @@ export class LifeOpsRepository {
|
|
|
2420
2291
|
return row ? parseGmailMessageSummary(row) : null;
|
|
2421
2292
|
}
|
|
2422
2293
|
async deleteGmailMessagesForProvider(agentId, provider, side) {
|
|
2423
|
-
await this.ensureReady();
|
|
2424
2294
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
2425
2295
|
await executeRawSql(this.runtime, `DELETE FROM life_gmail_messages
|
|
2426
2296
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2428,7 +2298,6 @@ export class LifeOpsRepository {
|
|
|
2428
2298
|
${sideClause}`);
|
|
2429
2299
|
}
|
|
2430
2300
|
async upsertGmailSyncState(state) {
|
|
2431
|
-
await this.ensureReady();
|
|
2432
2301
|
await executeRawSql(this.runtime, `INSERT INTO life_gmail_sync_states (
|
|
2433
2302
|
id, agent_id, provider, side, mailbox, max_results, synced_at, updated_at
|
|
2434
2303
|
) VALUES (
|
|
@@ -2447,7 +2316,6 @@ export class LifeOpsRepository {
|
|
|
2447
2316
|
updated_at = excluded.updated_at`);
|
|
2448
2317
|
}
|
|
2449
2318
|
async getGmailSyncState(agentId, provider, mailbox, side) {
|
|
2450
|
-
await this.ensureReady();
|
|
2451
2319
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
2452
2320
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2453
2321
|
FROM life_gmail_sync_states
|
|
@@ -2460,7 +2328,6 @@ export class LifeOpsRepository {
|
|
|
2460
2328
|
return row ? parseGmailSyncState(row) : null;
|
|
2461
2329
|
}
|
|
2462
2330
|
async deleteGmailSyncState(agentId, provider, mailbox, side) {
|
|
2463
|
-
await this.ensureReady();
|
|
2464
2331
|
const mailboxClause = mailbox ? `AND mailbox = ${sqlQuote(mailbox)}` : "";
|
|
2465
2332
|
const sideClause = side ? `AND side = ${sqlQuote(side)}` : "";
|
|
2466
2333
|
await executeRawSql(this.runtime, `DELETE FROM life_gmail_sync_states
|
|
@@ -2470,7 +2337,6 @@ export class LifeOpsRepository {
|
|
|
2470
2337
|
${sideClause}`);
|
|
2471
2338
|
}
|
|
2472
2339
|
async createWorkflow(definition) {
|
|
2473
|
-
await this.ensureReady();
|
|
2474
2340
|
await executeRawSql(this.runtime, `INSERT INTO life_workflow_definitions (
|
|
2475
2341
|
id, agent_id, domain, subject_type, subject_id, visibility_scope,
|
|
2476
2342
|
context_policy, title, trigger_type, schedule_json, action_plan_json,
|
|
@@ -2497,7 +2363,6 @@ export class LifeOpsRepository {
|
|
|
2497
2363
|
)`);
|
|
2498
2364
|
}
|
|
2499
2365
|
async updateWorkflow(definition) {
|
|
2500
|
-
await this.ensureReady();
|
|
2501
2366
|
await executeRawSql(this.runtime, `UPDATE life_workflow_definitions
|
|
2502
2367
|
SET domain = ${sqlQuote(definition.domain)},
|
|
2503
2368
|
subject_type = ${sqlQuote(definition.subjectType)},
|
|
@@ -2516,7 +2381,6 @@ export class LifeOpsRepository {
|
|
|
2516
2381
|
AND agent_id = ${sqlQuote(definition.agentId)}`);
|
|
2517
2382
|
}
|
|
2518
2383
|
async listWorkflows(agentId) {
|
|
2519
|
-
await this.ensureReady();
|
|
2520
2384
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2521
2385
|
FROM life_workflow_definitions
|
|
2522
2386
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2524,7 +2388,6 @@ export class LifeOpsRepository {
|
|
|
2524
2388
|
return rows.map(parseWorkflowDefinition);
|
|
2525
2389
|
}
|
|
2526
2390
|
async deleteWorkflow(agentId, workflowId) {
|
|
2527
|
-
await this.ensureReady();
|
|
2528
2391
|
await executeRawSql(this.runtime, `DELETE FROM life_workflow_runs
|
|
2529
2392
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
2530
2393
|
AND workflow_id = ${sqlQuote(workflowId)}`);
|
|
@@ -2537,7 +2400,6 @@ export class LifeOpsRepository {
|
|
|
2537
2400
|
AND id = ${sqlQuote(workflowId)}`);
|
|
2538
2401
|
}
|
|
2539
2402
|
async getWorkflow(agentId, workflowId) {
|
|
2540
|
-
await this.ensureReady();
|
|
2541
2403
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2542
2404
|
FROM life_workflow_definitions
|
|
2543
2405
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2547,7 +2409,6 @@ export class LifeOpsRepository {
|
|
|
2547
2409
|
return row ? parseWorkflowDefinition(row) : null;
|
|
2548
2410
|
}
|
|
2549
2411
|
async createWorkflowRun(run) {
|
|
2550
|
-
await this.ensureReady();
|
|
2551
2412
|
await executeRawSql(this.runtime, `INSERT INTO life_workflow_runs (
|
|
2552
2413
|
id, agent_id, workflow_id, started_at, finished_at, status,
|
|
2553
2414
|
result_json, audit_ref
|
|
@@ -2563,7 +2424,6 @@ export class LifeOpsRepository {
|
|
|
2563
2424
|
)`);
|
|
2564
2425
|
}
|
|
2565
2426
|
async listWorkflowRuns(agentId, workflowId) {
|
|
2566
|
-
await this.ensureReady();
|
|
2567
2427
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2568
2428
|
FROM life_workflow_runs
|
|
2569
2429
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2572,7 +2432,6 @@ export class LifeOpsRepository {
|
|
|
2572
2432
|
return rows.map(parseWorkflowRun);
|
|
2573
2433
|
}
|
|
2574
2434
|
async createReminderAttempt(attempt) {
|
|
2575
|
-
await this.ensureReady();
|
|
2576
2435
|
await executeRawSql(this.runtime, `INSERT INTO life_reminder_attempts (
|
|
2577
2436
|
id, agent_id, plan_id, owner_type, owner_id, occurrence_id,
|
|
2578
2437
|
channel, step_index, scheduled_for, attempted_at, outcome,
|
|
@@ -2594,7 +2453,6 @@ export class LifeOpsRepository {
|
|
|
2594
2453
|
)`);
|
|
2595
2454
|
}
|
|
2596
2455
|
async listReminderAttempts(agentId, options) {
|
|
2597
|
-
await this.ensureReady();
|
|
2598
2456
|
const ownerTypeClause = options?.ownerType
|
|
2599
2457
|
? `AND owner_type = ${sqlQuote(options.ownerType)}`
|
|
2600
2458
|
: "";
|
|
@@ -2614,7 +2472,6 @@ export class LifeOpsRepository {
|
|
|
2614
2472
|
return rows.map(parseReminderAttempt);
|
|
2615
2473
|
}
|
|
2616
2474
|
async updateReminderAttemptOutcome(id, outcome, metadata) {
|
|
2617
|
-
await this.ensureReady();
|
|
2618
2475
|
if (metadata && Object.keys(metadata).length > 0) {
|
|
2619
2476
|
await executeRawSql(this.runtime, `UPDATE life_reminder_attempts
|
|
2620
2477
|
SET outcome = ${sqlQuote(outcome)},
|
|
@@ -2628,7 +2485,6 @@ export class LifeOpsRepository {
|
|
|
2628
2485
|
}
|
|
2629
2486
|
}
|
|
2630
2487
|
async createBrowserSession(session) {
|
|
2631
|
-
await this.ensureReady();
|
|
2632
2488
|
await executeRawSql(this.runtime, `INSERT INTO life_browser_sessions (
|
|
2633
2489
|
id, agent_id, domain, subject_type, subject_id, visibility_scope,
|
|
2634
2490
|
context_policy, workflow_id, browser, companion_id, profile_id,
|
|
@@ -2662,7 +2518,6 @@ export class LifeOpsRepository {
|
|
|
2662
2518
|
)`);
|
|
2663
2519
|
}
|
|
2664
2520
|
async updateBrowserSession(session) {
|
|
2665
|
-
await this.ensureReady();
|
|
2666
2521
|
await executeRawSql(this.runtime, `UPDATE life_browser_sessions
|
|
2667
2522
|
SET domain = ${sqlQuote(session.domain)},
|
|
2668
2523
|
subject_type = ${sqlQuote(session.subjectType)},
|
|
@@ -2688,7 +2543,6 @@ export class LifeOpsRepository {
|
|
|
2688
2543
|
AND agent_id = ${sqlQuote(session.agentId)}`);
|
|
2689
2544
|
}
|
|
2690
2545
|
async getBrowserSession(agentId, sessionId) {
|
|
2691
|
-
await this.ensureReady();
|
|
2692
2546
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2693
2547
|
FROM life_browser_sessions
|
|
2694
2548
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2698,7 +2552,6 @@ export class LifeOpsRepository {
|
|
|
2698
2552
|
return row ? parseBrowserSession(row) : null;
|
|
2699
2553
|
}
|
|
2700
2554
|
async listBrowserSessions(agentId) {
|
|
2701
|
-
await this.ensureReady();
|
|
2702
2555
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2703
2556
|
FROM life_browser_sessions
|
|
2704
2557
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2706,7 +2559,6 @@ export class LifeOpsRepository {
|
|
|
2706
2559
|
return rows.map(parseBrowserSession);
|
|
2707
2560
|
}
|
|
2708
2561
|
async getBrowserSettings(agentId) {
|
|
2709
|
-
await this.ensureReady();
|
|
2710
2562
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2711
2563
|
FROM life_browser_settings
|
|
2712
2564
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2715,7 +2567,6 @@ export class LifeOpsRepository {
|
|
|
2715
2567
|
return row ? parseBrowserSettings(row) : null;
|
|
2716
2568
|
}
|
|
2717
2569
|
async upsertBrowserSettings(agentId, settings) {
|
|
2718
|
-
await this.ensureReady();
|
|
2719
2570
|
const createdAt = settings.updatedAt ?? isoNow();
|
|
2720
2571
|
await executeRawSql(this.runtime, `INSERT INTO life_browser_settings (
|
|
2721
2572
|
agent_id, enabled, tracking_mode, allow_browser_control,
|
|
@@ -2753,7 +2604,6 @@ export class LifeOpsRepository {
|
|
|
2753
2604
|
updated_at = excluded.updated_at`);
|
|
2754
2605
|
}
|
|
2755
2606
|
async getBrowserCompanionByProfile(agentId, browser, profileId) {
|
|
2756
|
-
await this.ensureReady();
|
|
2757
2607
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2758
2608
|
FROM life_browser_companions
|
|
2759
2609
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2764,7 +2614,6 @@ export class LifeOpsRepository {
|
|
|
2764
2614
|
return row ? parseBrowserCompanion(row) : null;
|
|
2765
2615
|
}
|
|
2766
2616
|
async getBrowserCompanionCredential(agentId, companionId) {
|
|
2767
|
-
await this.ensureReady();
|
|
2768
2617
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2769
2618
|
FROM life_browser_companions
|
|
2770
2619
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2774,7 +2623,6 @@ export class LifeOpsRepository {
|
|
|
2774
2623
|
return row ? parseBrowserCompanionCredential(row) : null;
|
|
2775
2624
|
}
|
|
2776
2625
|
async upsertBrowserCompanion(companion) {
|
|
2777
|
-
await this.ensureReady();
|
|
2778
2626
|
await executeRawSql(this.runtime, `INSERT INTO life_browser_companions (
|
|
2779
2627
|
id, agent_id, browser, profile_id, profile_label, label,
|
|
2780
2628
|
extension_version, connection_state, permissions_json, last_seen_at,
|
|
@@ -2807,7 +2655,6 @@ export class LifeOpsRepository {
|
|
|
2807
2655
|
updated_at = excluded.updated_at`);
|
|
2808
2656
|
}
|
|
2809
2657
|
async updateBrowserCompanionPairingToken(agentId, companionId, pairingTokenHash, pairedAt, updatedAt) {
|
|
2810
|
-
await this.ensureReady();
|
|
2811
2658
|
await executeRawSql(this.runtime, `UPDATE life_browser_companions
|
|
2812
2659
|
SET pairing_token_hash = ${sqlQuote(pairingTokenHash)},
|
|
2813
2660
|
pending_pairing_token_hashes_json = '[]',
|
|
@@ -2817,7 +2664,6 @@ export class LifeOpsRepository {
|
|
|
2817
2664
|
AND id = ${sqlQuote(companionId)}`);
|
|
2818
2665
|
}
|
|
2819
2666
|
async updateBrowserCompanionPendingPairingTokenHashes(agentId, companionId, pendingPairingTokenHashes, updatedAt) {
|
|
2820
|
-
await this.ensureReady();
|
|
2821
2667
|
await executeRawSql(this.runtime, `UPDATE life_browser_companions
|
|
2822
2668
|
SET pending_pairing_token_hashes_json = ${sqlJson(pendingPairingTokenHashes)},
|
|
2823
2669
|
updated_at = ${sqlQuote(updatedAt)}
|
|
@@ -2825,7 +2671,6 @@ export class LifeOpsRepository {
|
|
|
2825
2671
|
AND id = ${sqlQuote(companionId)}`);
|
|
2826
2672
|
}
|
|
2827
2673
|
async promoteBrowserCompanionPendingPairingToken(agentId, companionId, pairingTokenHash, pendingPairingTokenHashes, pairedAt, updatedAt) {
|
|
2828
|
-
await this.ensureReady();
|
|
2829
2674
|
await executeRawSql(this.runtime, `UPDATE life_browser_companions
|
|
2830
2675
|
SET pairing_token_hash = ${sqlQuote(pairingTokenHash)},
|
|
2831
2676
|
pending_pairing_token_hashes_json = ${sqlJson(pendingPairingTokenHashes)},
|
|
@@ -2835,7 +2680,6 @@ export class LifeOpsRepository {
|
|
|
2835
2680
|
AND id = ${sqlQuote(companionId)}`);
|
|
2836
2681
|
}
|
|
2837
2682
|
async listBrowserCompanions(agentId) {
|
|
2838
|
-
await this.ensureReady();
|
|
2839
2683
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2840
2684
|
FROM life_browser_companions
|
|
2841
2685
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2843,7 +2687,6 @@ export class LifeOpsRepository {
|
|
|
2843
2687
|
return rows.map(parseBrowserCompanion);
|
|
2844
2688
|
}
|
|
2845
2689
|
async upsertBrowserTab(tab) {
|
|
2846
|
-
await this.ensureReady();
|
|
2847
2690
|
await executeRawSql(this.runtime, `INSERT INTO life_browser_tabs (
|
|
2848
2691
|
id, agent_id, companion_id, browser, profile_id, window_id, tab_id,
|
|
2849
2692
|
url, title, active_in_window, focused_window, focused_active,
|
|
@@ -2885,7 +2728,6 @@ export class LifeOpsRepository {
|
|
|
2885
2728
|
updated_at = excluded.updated_at`);
|
|
2886
2729
|
}
|
|
2887
2730
|
async listBrowserTabs(agentId) {
|
|
2888
|
-
await this.ensureReady();
|
|
2889
2731
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2890
2732
|
FROM life_browser_tabs
|
|
2891
2733
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2896,7 +2738,6 @@ export class LifeOpsRepository {
|
|
|
2896
2738
|
return rows.map(parseBrowserTabSummary);
|
|
2897
2739
|
}
|
|
2898
2740
|
async deleteBrowserTabsByIds(agentId, ids) {
|
|
2899
|
-
await this.ensureReady();
|
|
2900
2741
|
if (ids.length === 0)
|
|
2901
2742
|
return;
|
|
2902
2743
|
const values = ids.map((id) => sqlQuote(id)).join(", ");
|
|
@@ -2905,12 +2746,10 @@ export class LifeOpsRepository {
|
|
|
2905
2746
|
AND id IN (${values})`);
|
|
2906
2747
|
}
|
|
2907
2748
|
async deleteAllBrowserTabs(agentId) {
|
|
2908
|
-
await this.ensureReady();
|
|
2909
2749
|
await executeRawSql(this.runtime, `DELETE FROM life_browser_tabs
|
|
2910
2750
|
WHERE agent_id = ${sqlQuote(agentId)}`);
|
|
2911
2751
|
}
|
|
2912
2752
|
async upsertBrowserPageContext(context) {
|
|
2913
|
-
await this.ensureReady();
|
|
2914
2753
|
await executeRawSql(this.runtime, `INSERT INTO life_browser_page_contexts (
|
|
2915
2754
|
id, agent_id, browser, profile_id, window_id, tab_id, url, title,
|
|
2916
2755
|
selection_text, main_text, headings_json, links_json, forms_json,
|
|
@@ -2944,7 +2783,6 @@ export class LifeOpsRepository {
|
|
|
2944
2783
|
metadata_json = excluded.metadata_json`);
|
|
2945
2784
|
}
|
|
2946
2785
|
async listBrowserPageContexts(agentId) {
|
|
2947
|
-
await this.ensureReady();
|
|
2948
2786
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2949
2787
|
FROM life_browser_page_contexts
|
|
2950
2788
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -2952,7 +2790,6 @@ export class LifeOpsRepository {
|
|
|
2952
2790
|
return rows.map(parseBrowserPageContext);
|
|
2953
2791
|
}
|
|
2954
2792
|
async deleteBrowserPageContextsByIds(agentId, ids) {
|
|
2955
|
-
await this.ensureReady();
|
|
2956
2793
|
if (ids.length === 0)
|
|
2957
2794
|
return;
|
|
2958
2795
|
const values = ids.map((id) => sqlQuote(id)).join(", ");
|
|
@@ -2961,12 +2798,10 @@ export class LifeOpsRepository {
|
|
|
2961
2798
|
AND id IN (${values})`);
|
|
2962
2799
|
}
|
|
2963
2800
|
async deleteAllBrowserPageContexts(agentId) {
|
|
2964
|
-
await this.ensureReady();
|
|
2965
2801
|
await executeRawSql(this.runtime, `DELETE FROM life_browser_page_contexts
|
|
2966
2802
|
WHERE agent_id = ${sqlQuote(agentId)}`);
|
|
2967
2803
|
}
|
|
2968
2804
|
async deleteBrowserSession(agentId, sessionId) {
|
|
2969
|
-
await this.ensureReady();
|
|
2970
2805
|
await executeRawSql(this.runtime, `DELETE FROM life_browser_sessions
|
|
2971
2806
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
2972
2807
|
AND id = ${sqlQuote(sessionId)}`);
|
|
@@ -2975,7 +2810,6 @@ export class LifeOpsRepository {
|
|
|
2975
2810
|
// Escalation state persistence
|
|
2976
2811
|
// ---------------------------------------------------------------------------
|
|
2977
2812
|
async upsertEscalationState(state) {
|
|
2978
|
-
await this.ensureReady();
|
|
2979
2813
|
const now = isoNow();
|
|
2980
2814
|
await executeRawSql(this.runtime, `INSERT INTO life_escalation_states (
|
|
2981
2815
|
id, agent_id, reason, text, current_step,
|
|
@@ -3009,7 +2843,6 @@ export class LifeOpsRepository {
|
|
|
3009
2843
|
updated_at = excluded.updated_at`);
|
|
3010
2844
|
}
|
|
3011
2845
|
async getActiveEscalationState(agentId) {
|
|
3012
|
-
await this.ensureReady();
|
|
3013
2846
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3014
2847
|
FROM life_escalation_states
|
|
3015
2848
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -3020,7 +2853,6 @@ export class LifeOpsRepository {
|
|
|
3020
2853
|
return row ? parseEscalationStateRow(row) : null;
|
|
3021
2854
|
}
|
|
3022
2855
|
async resolveEscalationState(id, resolvedAt) {
|
|
3023
|
-
await this.ensureReady();
|
|
3024
2856
|
const now = isoNow();
|
|
3025
2857
|
await executeRawSql(this.runtime, `UPDATE life_escalation_states
|
|
3026
2858
|
SET resolved = TRUE,
|
|
@@ -3029,7 +2861,6 @@ export class LifeOpsRepository {
|
|
|
3029
2861
|
WHERE id = ${sqlQuote(id)}`);
|
|
3030
2862
|
}
|
|
3031
2863
|
async listRecentEscalationStates(agentId, limit = 10) {
|
|
3032
|
-
await this.ensureReady();
|
|
3033
2864
|
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3034
2865
|
FROM life_escalation_states
|
|
3035
2866
|
WHERE agent_id = ${sqlQuote(agentId)}
|
|
@@ -3038,10 +2869,621 @@ export class LifeOpsRepository {
|
|
|
3038
2869
|
return rows.map(parseEscalationStateRow);
|
|
3039
2870
|
}
|
|
3040
2871
|
async deleteAllEscalationStates(agentId) {
|
|
3041
|
-
await this.ensureReady();
|
|
3042
2872
|
await executeRawSql(this.runtime, `DELETE FROM life_escalation_states
|
|
3043
2873
|
WHERE agent_id = ${sqlQuote(agentId)}`);
|
|
3044
2874
|
}
|
|
2875
|
+
// -----------------------------------------------------------------------
|
|
2876
|
+
// Relationships, interactions & follow-ups
|
|
2877
|
+
// -----------------------------------------------------------------------
|
|
2878
|
+
async upsertRelationship(rel) {
|
|
2879
|
+
await executeRawSql(this.runtime, `INSERT INTO life_relationships (
|
|
2880
|
+
id, agent_id, name, primary_channel, primary_handle, email, phone,
|
|
2881
|
+
notes, tags_json, relationship_type, last_contacted_at, metadata_json,
|
|
2882
|
+
created_at, updated_at
|
|
2883
|
+
) VALUES (
|
|
2884
|
+
${sqlQuote(rel.id)},
|
|
2885
|
+
${sqlQuote(rel.agentId)},
|
|
2886
|
+
${sqlQuote(rel.name)},
|
|
2887
|
+
${sqlQuote(rel.primaryChannel)},
|
|
2888
|
+
${sqlQuote(rel.primaryHandle)},
|
|
2889
|
+
${sqlText(rel.email)},
|
|
2890
|
+
${sqlText(rel.phone)},
|
|
2891
|
+
${sqlQuote(rel.notes)},
|
|
2892
|
+
${sqlJson(rel.tags)},
|
|
2893
|
+
${sqlQuote(rel.relationshipType)},
|
|
2894
|
+
${sqlText(rel.lastContactedAt)},
|
|
2895
|
+
${sqlJson(rel.metadata)},
|
|
2896
|
+
${sqlQuote(rel.createdAt)},
|
|
2897
|
+
${sqlQuote(rel.updatedAt)}
|
|
2898
|
+
)
|
|
2899
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
2900
|
+
name = EXCLUDED.name,
|
|
2901
|
+
primary_channel = EXCLUDED.primary_channel,
|
|
2902
|
+
primary_handle = EXCLUDED.primary_handle,
|
|
2903
|
+
email = EXCLUDED.email,
|
|
2904
|
+
phone = EXCLUDED.phone,
|
|
2905
|
+
notes = EXCLUDED.notes,
|
|
2906
|
+
tags_json = EXCLUDED.tags_json,
|
|
2907
|
+
relationship_type = EXCLUDED.relationship_type,
|
|
2908
|
+
last_contacted_at = EXCLUDED.last_contacted_at,
|
|
2909
|
+
metadata_json = EXCLUDED.metadata_json,
|
|
2910
|
+
updated_at = EXCLUDED.updated_at`);
|
|
2911
|
+
}
|
|
2912
|
+
async getRelationship(agentId, id) {
|
|
2913
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2914
|
+
FROM life_relationships
|
|
2915
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
2916
|
+
AND id = ${sqlQuote(id)}
|
|
2917
|
+
LIMIT 1`);
|
|
2918
|
+
const row = rows[0];
|
|
2919
|
+
return row ? parseRelationship(row) : null;
|
|
2920
|
+
}
|
|
2921
|
+
async listRelationships(agentId, opts) {
|
|
2922
|
+
const clauses = [`agent_id = ${sqlQuote(agentId)}`];
|
|
2923
|
+
if (opts?.primaryChannel) {
|
|
2924
|
+
clauses.push(`primary_channel = ${sqlQuote(opts.primaryChannel)}`);
|
|
2925
|
+
}
|
|
2926
|
+
const limitClause = typeof opts?.limit === "number"
|
|
2927
|
+
? `LIMIT ${sqlInteger(opts.limit)}`
|
|
2928
|
+
: "";
|
|
2929
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2930
|
+
FROM life_relationships
|
|
2931
|
+
WHERE ${clauses.join(" AND ")}
|
|
2932
|
+
ORDER BY name ASC
|
|
2933
|
+
${limitClause}`);
|
|
2934
|
+
return rows.map(parseRelationship);
|
|
2935
|
+
}
|
|
2936
|
+
async logRelationshipInteraction(interaction) {
|
|
2937
|
+
await executeRawSql(this.runtime, `INSERT INTO life_relationship_interactions (
|
|
2938
|
+
id, agent_id, relationship_id, channel, direction, summary,
|
|
2939
|
+
occurred_at, metadata_json, created_at
|
|
2940
|
+
) VALUES (
|
|
2941
|
+
${sqlQuote(interaction.id)},
|
|
2942
|
+
${sqlQuote(interaction.agentId)},
|
|
2943
|
+
${sqlQuote(interaction.relationshipId)},
|
|
2944
|
+
${sqlQuote(interaction.channel)},
|
|
2945
|
+
${sqlQuote(interaction.direction)},
|
|
2946
|
+
${sqlQuote(interaction.summary)},
|
|
2947
|
+
${sqlQuote(interaction.occurredAt)},
|
|
2948
|
+
${sqlJson(interaction.metadata)},
|
|
2949
|
+
${sqlQuote(interaction.createdAt)}
|
|
2950
|
+
)`);
|
|
2951
|
+
}
|
|
2952
|
+
async listInteractions(agentId, relationshipId, opts) {
|
|
2953
|
+
const limitClause = typeof opts?.limit === "number"
|
|
2954
|
+
? `LIMIT ${sqlInteger(opts.limit)}`
|
|
2955
|
+
: "";
|
|
2956
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
2957
|
+
FROM life_relationship_interactions
|
|
2958
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
2959
|
+
AND relationship_id = ${sqlQuote(relationshipId)}
|
|
2960
|
+
ORDER BY occurred_at DESC
|
|
2961
|
+
${limitClause}`);
|
|
2962
|
+
return rows.map(parseRelationshipInteraction);
|
|
2963
|
+
}
|
|
2964
|
+
async updateRelationshipLastContactedAt(agentId, relationshipId, timestamp) {
|
|
2965
|
+
await executeRawSql(this.runtime, `UPDATE life_relationships
|
|
2966
|
+
SET last_contacted_at = ${sqlQuote(timestamp)},
|
|
2967
|
+
updated_at = ${sqlQuote(timestamp)}
|
|
2968
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
2969
|
+
AND id = ${sqlQuote(relationshipId)}
|
|
2970
|
+
AND (last_contacted_at IS NULL OR last_contacted_at < ${sqlQuote(timestamp)})`);
|
|
2971
|
+
}
|
|
2972
|
+
async upsertFollowUp(fu) {
|
|
2973
|
+
await executeRawSql(this.runtime, `INSERT INTO life_follow_ups (
|
|
2974
|
+
id, agent_id, relationship_id, due_at, reason, status, priority,
|
|
2975
|
+
draft_json, completed_at, metadata_json, created_at, updated_at
|
|
2976
|
+
) VALUES (
|
|
2977
|
+
${sqlQuote(fu.id)},
|
|
2978
|
+
${sqlQuote(fu.agentId)},
|
|
2979
|
+
${sqlQuote(fu.relationshipId)},
|
|
2980
|
+
${sqlQuote(fu.dueAt)},
|
|
2981
|
+
${sqlQuote(fu.reason)},
|
|
2982
|
+
${sqlQuote(fu.status)},
|
|
2983
|
+
${sqlInteger(fu.priority)},
|
|
2984
|
+
${fu.draft ? sqlJson(fu.draft) : "NULL"},
|
|
2985
|
+
${sqlText(fu.completedAt)},
|
|
2986
|
+
${sqlJson(fu.metadata)},
|
|
2987
|
+
${sqlQuote(fu.createdAt)},
|
|
2988
|
+
${sqlQuote(fu.updatedAt)}
|
|
2989
|
+
)
|
|
2990
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
2991
|
+
relationship_id = EXCLUDED.relationship_id,
|
|
2992
|
+
due_at = EXCLUDED.due_at,
|
|
2993
|
+
reason = EXCLUDED.reason,
|
|
2994
|
+
status = EXCLUDED.status,
|
|
2995
|
+
priority = EXCLUDED.priority,
|
|
2996
|
+
draft_json = EXCLUDED.draft_json,
|
|
2997
|
+
completed_at = EXCLUDED.completed_at,
|
|
2998
|
+
metadata_json = EXCLUDED.metadata_json,
|
|
2999
|
+
updated_at = EXCLUDED.updated_at`);
|
|
3000
|
+
}
|
|
3001
|
+
async getFollowUp(agentId, id) {
|
|
3002
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3003
|
+
FROM life_follow_ups
|
|
3004
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3005
|
+
AND id = ${sqlQuote(id)}
|
|
3006
|
+
LIMIT 1`);
|
|
3007
|
+
const row = rows[0];
|
|
3008
|
+
return row ? parseFollowUp(row) : null;
|
|
3009
|
+
}
|
|
3010
|
+
async listFollowUps(agentId, opts) {
|
|
3011
|
+
const clauses = [`agent_id = ${sqlQuote(agentId)}`];
|
|
3012
|
+
if (opts?.status) {
|
|
3013
|
+
clauses.push(`status = ${sqlQuote(opts.status)}`);
|
|
3014
|
+
}
|
|
3015
|
+
if (opts?.dueOnOrBefore) {
|
|
3016
|
+
clauses.push(`due_at <= ${sqlQuote(opts.dueOnOrBefore)}`);
|
|
3017
|
+
}
|
|
3018
|
+
const limitClause = typeof opts?.limit === "number"
|
|
3019
|
+
? `LIMIT ${sqlInteger(opts.limit)}`
|
|
3020
|
+
: "";
|
|
3021
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3022
|
+
FROM life_follow_ups
|
|
3023
|
+
WHERE ${clauses.join(" AND ")}
|
|
3024
|
+
ORDER BY due_at ASC
|
|
3025
|
+
${limitClause}`);
|
|
3026
|
+
return rows.map(parseFollowUp);
|
|
3027
|
+
}
|
|
3028
|
+
async updateFollowUpStatus(agentId, id, status, completedAt) {
|
|
3029
|
+
const now = isoNow();
|
|
3030
|
+
const completedClause = completedAt
|
|
3031
|
+
? `, completed_at = ${sqlQuote(completedAt)}`
|
|
3032
|
+
: "";
|
|
3033
|
+
await executeRawSql(this.runtime, `UPDATE life_follow_ups
|
|
3034
|
+
SET status = ${sqlQuote(status)},
|
|
3035
|
+
updated_at = ${sqlQuote(now)}
|
|
3036
|
+
${completedClause}
|
|
3037
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3038
|
+
AND id = ${sqlQuote(id)}`);
|
|
3039
|
+
}
|
|
3040
|
+
async updateFollowUpDueAt(agentId, id, dueAt) {
|
|
3041
|
+
const now = isoNow();
|
|
3042
|
+
await executeRawSql(this.runtime, `UPDATE life_follow_ups
|
|
3043
|
+
SET due_at = ${sqlQuote(dueAt)},
|
|
3044
|
+
updated_at = ${sqlQuote(now)}
|
|
3045
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3046
|
+
AND id = ${sqlQuote(id)}`);
|
|
3047
|
+
}
|
|
3048
|
+
// -----------------------------------------------------------------------
|
|
3049
|
+
// X (Twitter) DMs, feed items, and sync state
|
|
3050
|
+
// -----------------------------------------------------------------------
|
|
3051
|
+
async upsertXDm(dm) {
|
|
3052
|
+
await executeRawSql(this.runtime, `INSERT INTO life_x_dms (
|
|
3053
|
+
id, agent_id, external_dm_id, conversation_id, sender_handle, sender_id,
|
|
3054
|
+
is_inbound, text, received_at, read_at, replied_at, metadata_json,
|
|
3055
|
+
synced_at, updated_at
|
|
3056
|
+
) VALUES (
|
|
3057
|
+
${sqlQuote(dm.id)},
|
|
3058
|
+
${sqlQuote(dm.agentId)},
|
|
3059
|
+
${sqlQuote(dm.externalDmId)},
|
|
3060
|
+
${sqlQuote(dm.conversationId)},
|
|
3061
|
+
${sqlQuote(dm.senderHandle)},
|
|
3062
|
+
${sqlQuote(dm.senderId)},
|
|
3063
|
+
${sqlBoolean(dm.isInbound)},
|
|
3064
|
+
${sqlQuote(dm.text)},
|
|
3065
|
+
${sqlQuote(dm.receivedAt)},
|
|
3066
|
+
${sqlText(dm.readAt)},
|
|
3067
|
+
${sqlText(dm.repliedAt)},
|
|
3068
|
+
${sqlJson(dm.metadata)},
|
|
3069
|
+
${sqlQuote(dm.syncedAt)},
|
|
3070
|
+
${sqlQuote(dm.updatedAt)}
|
|
3071
|
+
)
|
|
3072
|
+
ON CONFLICT(agent_id, external_dm_id) DO UPDATE SET
|
|
3073
|
+
conversation_id = excluded.conversation_id,
|
|
3074
|
+
sender_handle = excluded.sender_handle,
|
|
3075
|
+
sender_id = excluded.sender_id,
|
|
3076
|
+
is_inbound = excluded.is_inbound,
|
|
3077
|
+
text = excluded.text,
|
|
3078
|
+
received_at = excluded.received_at,
|
|
3079
|
+
read_at = excluded.read_at,
|
|
3080
|
+
replied_at = excluded.replied_at,
|
|
3081
|
+
metadata_json = excluded.metadata_json,
|
|
3082
|
+
synced_at = excluded.synced_at,
|
|
3083
|
+
updated_at = excluded.updated_at`);
|
|
3084
|
+
}
|
|
3085
|
+
async listXDms(agentId, opts = {}) {
|
|
3086
|
+
const DEFAULT_LIMIT = 100;
|
|
3087
|
+
const limit = opts.limit !== undefined && Number.isFinite(opts.limit)
|
|
3088
|
+
? opts.limit
|
|
3089
|
+
: DEFAULT_LIMIT;
|
|
3090
|
+
const conversationClause = opts.conversationId
|
|
3091
|
+
? `AND conversation_id = ${sqlQuote(opts.conversationId)}`
|
|
3092
|
+
: "";
|
|
3093
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3094
|
+
FROM life_x_dms
|
|
3095
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3096
|
+
${conversationClause}
|
|
3097
|
+
ORDER BY received_at DESC
|
|
3098
|
+
LIMIT ${sqlInteger(limit)}`);
|
|
3099
|
+
return rows.map(parseXDm);
|
|
3100
|
+
}
|
|
3101
|
+
async upsertXFeedItem(item) {
|
|
3102
|
+
await executeRawSql(this.runtime, `INSERT INTO life_x_feed_items (
|
|
3103
|
+
id, agent_id, external_tweet_id, author_handle, author_id, text,
|
|
3104
|
+
created_at_source, feed_type, metadata_json, synced_at, updated_at
|
|
3105
|
+
) VALUES (
|
|
3106
|
+
${sqlQuote(item.id)},
|
|
3107
|
+
${sqlQuote(item.agentId)},
|
|
3108
|
+
${sqlQuote(item.externalTweetId)},
|
|
3109
|
+
${sqlQuote(item.authorHandle)},
|
|
3110
|
+
${sqlQuote(item.authorId)},
|
|
3111
|
+
${sqlQuote(item.text)},
|
|
3112
|
+
${sqlQuote(item.createdAtSource)},
|
|
3113
|
+
${sqlQuote(item.feedType)},
|
|
3114
|
+
${sqlJson(item.metadata)},
|
|
3115
|
+
${sqlQuote(item.syncedAt)},
|
|
3116
|
+
${sqlQuote(item.updatedAt)}
|
|
3117
|
+
)
|
|
3118
|
+
ON CONFLICT(agent_id, external_tweet_id, feed_type) DO UPDATE SET
|
|
3119
|
+
author_handle = excluded.author_handle,
|
|
3120
|
+
author_id = excluded.author_id,
|
|
3121
|
+
text = excluded.text,
|
|
3122
|
+
created_at_source = excluded.created_at_source,
|
|
3123
|
+
metadata_json = excluded.metadata_json,
|
|
3124
|
+
synced_at = excluded.synced_at,
|
|
3125
|
+
updated_at = excluded.updated_at`);
|
|
3126
|
+
}
|
|
3127
|
+
async listXFeedItems(agentId, feedType, opts = {}) {
|
|
3128
|
+
const DEFAULT_LIMIT = 100;
|
|
3129
|
+
const limit = opts.limit !== undefined && Number.isFinite(opts.limit)
|
|
3130
|
+
? opts.limit
|
|
3131
|
+
: DEFAULT_LIMIT;
|
|
3132
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3133
|
+
FROM life_x_feed_items
|
|
3134
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3135
|
+
AND feed_type = ${sqlQuote(feedType)}
|
|
3136
|
+
ORDER BY created_at_source DESC
|
|
3137
|
+
LIMIT ${sqlInteger(limit)}`);
|
|
3138
|
+
return rows.map(parseXFeedItem);
|
|
3139
|
+
}
|
|
3140
|
+
async upsertXSyncState(state) {
|
|
3141
|
+
await executeRawSql(this.runtime, `INSERT INTO life_x_sync_states (
|
|
3142
|
+
id, agent_id, feed_type, last_cursor, synced_at, updated_at
|
|
3143
|
+
) VALUES (
|
|
3144
|
+
${sqlQuote(state.id)},
|
|
3145
|
+
${sqlQuote(state.agentId)},
|
|
3146
|
+
${sqlQuote(state.feedType)},
|
|
3147
|
+
${sqlText(state.lastCursor)},
|
|
3148
|
+
${sqlQuote(state.syncedAt)},
|
|
3149
|
+
${sqlQuote(state.updatedAt)}
|
|
3150
|
+
)
|
|
3151
|
+
ON CONFLICT(agent_id, feed_type) DO UPDATE SET
|
|
3152
|
+
last_cursor = excluded.last_cursor,
|
|
3153
|
+
synced_at = excluded.synced_at,
|
|
3154
|
+
updated_at = excluded.updated_at`);
|
|
3155
|
+
}
|
|
3156
|
+
async getXSyncState(agentId, feedType) {
|
|
3157
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3158
|
+
FROM life_x_sync_states
|
|
3159
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3160
|
+
AND feed_type = ${sqlQuote(feedType)}
|
|
3161
|
+
LIMIT 1`);
|
|
3162
|
+
const row = rows[0];
|
|
3163
|
+
return row ? parseXSyncState(row) : null;
|
|
3164
|
+
}
|
|
3165
|
+
// -----------------------------------------------------------------------
|
|
3166
|
+
// Screen time — per-app and per-website dwell sessions + daily rollups
|
|
3167
|
+
// -----------------------------------------------------------------------
|
|
3168
|
+
async upsertScreenTimeSession(session) {
|
|
3169
|
+
await executeRawSql(this.runtime, `INSERT INTO life_screen_time_sessions (
|
|
3170
|
+
id, agent_id, source, identifier, display_name, start_at, end_at,
|
|
3171
|
+
duration_seconds, is_active, metadata_json, created_at, updated_at
|
|
3172
|
+
) VALUES (
|
|
3173
|
+
${sqlQuote(session.id)},
|
|
3174
|
+
${sqlQuote(session.agentId)},
|
|
3175
|
+
${sqlQuote(session.source)},
|
|
3176
|
+
${sqlQuote(session.identifier)},
|
|
3177
|
+
${sqlQuote(session.displayName)},
|
|
3178
|
+
${sqlQuote(session.startAt)},
|
|
3179
|
+
${sqlText(session.endAt)},
|
|
3180
|
+
${sqlInteger(session.durationSeconds)},
|
|
3181
|
+
${sqlBoolean(session.isActive)},
|
|
3182
|
+
${sqlJson(session.metadata)},
|
|
3183
|
+
${sqlQuote(session.createdAt)},
|
|
3184
|
+
${sqlQuote(session.updatedAt)}
|
|
3185
|
+
)
|
|
3186
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
3187
|
+
source = EXCLUDED.source,
|
|
3188
|
+
identifier = EXCLUDED.identifier,
|
|
3189
|
+
display_name = EXCLUDED.display_name,
|
|
3190
|
+
start_at = EXCLUDED.start_at,
|
|
3191
|
+
end_at = EXCLUDED.end_at,
|
|
3192
|
+
duration_seconds = EXCLUDED.duration_seconds,
|
|
3193
|
+
is_active = EXCLUDED.is_active,
|
|
3194
|
+
metadata_json = EXCLUDED.metadata_json,
|
|
3195
|
+
updated_at = EXCLUDED.updated_at`);
|
|
3196
|
+
}
|
|
3197
|
+
async getScreenTimeSession(agentId, id) {
|
|
3198
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3199
|
+
FROM life_screen_time_sessions
|
|
3200
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3201
|
+
AND id = ${sqlQuote(id)}
|
|
3202
|
+
LIMIT 1`);
|
|
3203
|
+
const row = rows[0];
|
|
3204
|
+
return row ? parseScreenTimeSession(row) : null;
|
|
3205
|
+
}
|
|
3206
|
+
async finishScreenTimeSession(agentId, id, endAt, durationSeconds) {
|
|
3207
|
+
const now = isoNow();
|
|
3208
|
+
await executeRawSql(this.runtime, `UPDATE life_screen_time_sessions
|
|
3209
|
+
SET end_at = ${sqlQuote(endAt)},
|
|
3210
|
+
duration_seconds = ${sqlInteger(durationSeconds)},
|
|
3211
|
+
is_active = ${sqlBoolean(false)},
|
|
3212
|
+
updated_at = ${sqlQuote(now)}
|
|
3213
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3214
|
+
AND id = ${sqlQuote(id)}`);
|
|
3215
|
+
}
|
|
3216
|
+
async listScreenTimeSessionsBetween(agentId, start, end, opts) {
|
|
3217
|
+
const clauses = [
|
|
3218
|
+
`agent_id = ${sqlQuote(agentId)}`,
|
|
3219
|
+
`start_at >= ${sqlQuote(start)}`,
|
|
3220
|
+
`start_at < ${sqlQuote(end)}`,
|
|
3221
|
+
];
|
|
3222
|
+
if (opts?.source) {
|
|
3223
|
+
clauses.push(`source = ${sqlQuote(opts.source)}`);
|
|
3224
|
+
}
|
|
3225
|
+
const limitClause = typeof opts?.limit === "number"
|
|
3226
|
+
? `LIMIT ${sqlInteger(opts.limit)}`
|
|
3227
|
+
: "";
|
|
3228
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3229
|
+
FROM life_screen_time_sessions
|
|
3230
|
+
WHERE ${clauses.join(" AND ")}
|
|
3231
|
+
ORDER BY start_at ASC
|
|
3232
|
+
${limitClause}`);
|
|
3233
|
+
return rows.map(parseScreenTimeSession);
|
|
3234
|
+
}
|
|
3235
|
+
async upsertScreenTimeDaily(row) {
|
|
3236
|
+
await executeRawSql(this.runtime, `INSERT INTO life_screen_time_daily (
|
|
3237
|
+
id, agent_id, source, identifier, date, total_seconds, session_count,
|
|
3238
|
+
metadata_json, created_at, updated_at
|
|
3239
|
+
) VALUES (
|
|
3240
|
+
${sqlQuote(row.id)},
|
|
3241
|
+
${sqlQuote(row.agentId)},
|
|
3242
|
+
${sqlQuote(row.source)},
|
|
3243
|
+
${sqlQuote(row.identifier)},
|
|
3244
|
+
${sqlQuote(row.date)},
|
|
3245
|
+
${sqlInteger(row.totalSeconds)},
|
|
3246
|
+
${sqlInteger(row.sessionCount)},
|
|
3247
|
+
${sqlJson(row.metadata)},
|
|
3248
|
+
${sqlQuote(row.createdAt)},
|
|
3249
|
+
${sqlQuote(row.updatedAt)}
|
|
3250
|
+
)
|
|
3251
|
+
ON CONFLICT (agent_id, source, identifier, date) DO UPDATE SET
|
|
3252
|
+
total_seconds = EXCLUDED.total_seconds,
|
|
3253
|
+
session_count = EXCLUDED.session_count,
|
|
3254
|
+
metadata_json = EXCLUDED.metadata_json,
|
|
3255
|
+
updated_at = EXCLUDED.updated_at`);
|
|
3256
|
+
}
|
|
3257
|
+
async listScreenTimeDaily(agentId, date, opts) {
|
|
3258
|
+
const clauses = [
|
|
3259
|
+
`agent_id = ${sqlQuote(agentId)}`,
|
|
3260
|
+
`date = ${sqlQuote(date)}`,
|
|
3261
|
+
];
|
|
3262
|
+
if (opts?.source) {
|
|
3263
|
+
clauses.push(`source = ${sqlQuote(opts.source)}`);
|
|
3264
|
+
}
|
|
3265
|
+
const limitClause = typeof opts?.limit === "number"
|
|
3266
|
+
? `LIMIT ${sqlInteger(opts.limit)}`
|
|
3267
|
+
: "";
|
|
3268
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3269
|
+
FROM life_screen_time_daily
|
|
3270
|
+
WHERE ${clauses.join(" AND ")}
|
|
3271
|
+
ORDER BY total_seconds DESC
|
|
3272
|
+
${limitClause}`);
|
|
3273
|
+
return rows.map(parseScreenTimeDaily);
|
|
3274
|
+
}
|
|
3275
|
+
async aggregateScreenTimeDailyForDate(agentId, date) {
|
|
3276
|
+
// Sessions counted when their start_at falls within the UTC day window.
|
|
3277
|
+
const dayStart = `${date}T00:00:00.000Z`;
|
|
3278
|
+
const dayEnd = `${date}T23:59:59.999Z`;
|
|
3279
|
+
const rows = await executeRawSql(this.runtime, `SELECT source,
|
|
3280
|
+
identifier,
|
|
3281
|
+
MAX(display_name) AS display_name,
|
|
3282
|
+
SUM(duration_seconds) AS total_seconds,
|
|
3283
|
+
COUNT(*) AS session_count
|
|
3284
|
+
FROM life_screen_time_sessions
|
|
3285
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3286
|
+
AND start_at >= ${sqlQuote(dayStart)}
|
|
3287
|
+
AND start_at <= ${sqlQuote(dayEnd)}
|
|
3288
|
+
GROUP BY source, identifier`);
|
|
3289
|
+
const now = isoNow();
|
|
3290
|
+
let updated = 0;
|
|
3291
|
+
for (const row of rows) {
|
|
3292
|
+
const rollup = {
|
|
3293
|
+
id: crypto.randomUUID(),
|
|
3294
|
+
agentId,
|
|
3295
|
+
source: toText(row.source),
|
|
3296
|
+
identifier: toText(row.identifier),
|
|
3297
|
+
date,
|
|
3298
|
+
totalSeconds: toNumber(row.total_seconds, 0),
|
|
3299
|
+
sessionCount: toNumber(row.session_count, 0),
|
|
3300
|
+
metadata: {
|
|
3301
|
+
displayName: toText(row.display_name, toText(row.identifier)),
|
|
3302
|
+
},
|
|
3303
|
+
createdAt: now,
|
|
3304
|
+
updatedAt: now,
|
|
3305
|
+
};
|
|
3306
|
+
await this.upsertScreenTimeDaily(rollup);
|
|
3307
|
+
updated += 1;
|
|
3308
|
+
}
|
|
3309
|
+
return { updated };
|
|
3310
|
+
}
|
|
3311
|
+
// -----------------------------------------------------------------------
|
|
3312
|
+
// Scheduling negotiations + proposals
|
|
3313
|
+
// -----------------------------------------------------------------------
|
|
3314
|
+
async upsertSchedulingNegotiation(neg) {
|
|
3315
|
+
await executeRawSql(this.runtime, `INSERT INTO life_scheduling_negotiations (
|
|
3316
|
+
id, agent_id, subject, relationship_id, duration_minutes, timezone,
|
|
3317
|
+
state, accepted_proposal_id, started_at, finalized_at, metadata_json,
|
|
3318
|
+
created_at, updated_at
|
|
3319
|
+
) VALUES (
|
|
3320
|
+
${sqlQuote(neg.id)},
|
|
3321
|
+
${sqlQuote(neg.agentId)},
|
|
3322
|
+
${sqlQuote(neg.subject)},
|
|
3323
|
+
${sqlText(neg.relationshipId)},
|
|
3324
|
+
${sqlInteger(neg.durationMinutes)},
|
|
3325
|
+
${sqlQuote(neg.timezone)},
|
|
3326
|
+
${sqlQuote(neg.state)},
|
|
3327
|
+
${sqlText(neg.acceptedProposalId)},
|
|
3328
|
+
${sqlQuote(neg.startedAt)},
|
|
3329
|
+
${sqlText(neg.finalizedAt)},
|
|
3330
|
+
${sqlJson(neg.metadata)},
|
|
3331
|
+
${sqlQuote(neg.createdAt)},
|
|
3332
|
+
${sqlQuote(neg.updatedAt)}
|
|
3333
|
+
)
|
|
3334
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
3335
|
+
subject = EXCLUDED.subject,
|
|
3336
|
+
relationship_id = EXCLUDED.relationship_id,
|
|
3337
|
+
duration_minutes = EXCLUDED.duration_minutes,
|
|
3338
|
+
timezone = EXCLUDED.timezone,
|
|
3339
|
+
state = EXCLUDED.state,
|
|
3340
|
+
accepted_proposal_id = EXCLUDED.accepted_proposal_id,
|
|
3341
|
+
finalized_at = EXCLUDED.finalized_at,
|
|
3342
|
+
metadata_json = EXCLUDED.metadata_json,
|
|
3343
|
+
updated_at = EXCLUDED.updated_at`);
|
|
3344
|
+
}
|
|
3345
|
+
async getSchedulingNegotiation(agentId, id) {
|
|
3346
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3347
|
+
FROM life_scheduling_negotiations
|
|
3348
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3349
|
+
AND id = ${sqlQuote(id)}
|
|
3350
|
+
LIMIT 1`);
|
|
3351
|
+
const row = rows[0];
|
|
3352
|
+
return row ? parseSchedulingNegotiation(row) : null;
|
|
3353
|
+
}
|
|
3354
|
+
async listSchedulingNegotiations(agentId, opts) {
|
|
3355
|
+
const clauses = [`agent_id = ${sqlQuote(agentId)}`];
|
|
3356
|
+
if (opts?.state) {
|
|
3357
|
+
clauses.push(`state = ${sqlQuote(opts.state)}`);
|
|
3358
|
+
}
|
|
3359
|
+
const limitClause = typeof opts?.limit === "number"
|
|
3360
|
+
? `LIMIT ${sqlInteger(opts.limit)}`
|
|
3361
|
+
: "";
|
|
3362
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3363
|
+
FROM life_scheduling_negotiations
|
|
3364
|
+
WHERE ${clauses.join(" AND ")}
|
|
3365
|
+
ORDER BY updated_at DESC
|
|
3366
|
+
${limitClause}`);
|
|
3367
|
+
return rows.map(parseSchedulingNegotiation);
|
|
3368
|
+
}
|
|
3369
|
+
async updateSchedulingNegotiationState(agentId, id, state, finalizedAt) {
|
|
3370
|
+
const now = isoNow();
|
|
3371
|
+
const finalizedClause = finalizedAt === undefined
|
|
3372
|
+
? ""
|
|
3373
|
+
: `, finalized_at = ${sqlText(finalizedAt)}`;
|
|
3374
|
+
await executeRawSql(this.runtime, `UPDATE life_scheduling_negotiations
|
|
3375
|
+
SET state = ${sqlQuote(state)},
|
|
3376
|
+
updated_at = ${sqlQuote(now)}${finalizedClause}
|
|
3377
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3378
|
+
AND id = ${sqlQuote(id)}`);
|
|
3379
|
+
}
|
|
3380
|
+
async upsertSchedulingProposal(p) {
|
|
3381
|
+
await executeRawSql(this.runtime, `INSERT INTO life_scheduling_proposals (
|
|
3382
|
+
id, agent_id, negotiation_id, start_at, end_at, proposed_by, status,
|
|
3383
|
+
metadata_json, created_at, updated_at
|
|
3384
|
+
) VALUES (
|
|
3385
|
+
${sqlQuote(p.id)},
|
|
3386
|
+
${sqlQuote(p.agentId)},
|
|
3387
|
+
${sqlQuote(p.negotiationId)},
|
|
3388
|
+
${sqlQuote(p.startAt)},
|
|
3389
|
+
${sqlQuote(p.endAt)},
|
|
3390
|
+
${sqlQuote(p.proposedBy)},
|
|
3391
|
+
${sqlQuote(p.status)},
|
|
3392
|
+
${sqlJson(p.metadata)},
|
|
3393
|
+
${sqlQuote(p.createdAt)},
|
|
3394
|
+
${sqlQuote(p.updatedAt)}
|
|
3395
|
+
)
|
|
3396
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
3397
|
+
start_at = EXCLUDED.start_at,
|
|
3398
|
+
end_at = EXCLUDED.end_at,
|
|
3399
|
+
proposed_by = EXCLUDED.proposed_by,
|
|
3400
|
+
status = EXCLUDED.status,
|
|
3401
|
+
metadata_json = EXCLUDED.metadata_json,
|
|
3402
|
+
updated_at = EXCLUDED.updated_at`);
|
|
3403
|
+
}
|
|
3404
|
+
async getSchedulingProposal(agentId, id) {
|
|
3405
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3406
|
+
FROM life_scheduling_proposals
|
|
3407
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3408
|
+
AND id = ${sqlQuote(id)}
|
|
3409
|
+
LIMIT 1`);
|
|
3410
|
+
const row = rows[0];
|
|
3411
|
+
return row ? parseSchedulingProposal(row) : null;
|
|
3412
|
+
}
|
|
3413
|
+
async listSchedulingProposals(agentId, negotiationId) {
|
|
3414
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3415
|
+
FROM life_scheduling_proposals
|
|
3416
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3417
|
+
AND negotiation_id = ${sqlQuote(negotiationId)}
|
|
3418
|
+
ORDER BY created_at ASC`);
|
|
3419
|
+
return rows.map(parseSchedulingProposal);
|
|
3420
|
+
}
|
|
3421
|
+
async updateSchedulingProposalStatus(agentId, id, status) {
|
|
3422
|
+
const now = isoNow();
|
|
3423
|
+
await executeRawSql(this.runtime, `UPDATE life_scheduling_proposals
|
|
3424
|
+
SET status = ${sqlQuote(status)},
|
|
3425
|
+
updated_at = ${sqlQuote(now)}
|
|
3426
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3427
|
+
AND id = ${sqlQuote(id)}`);
|
|
3428
|
+
}
|
|
3429
|
+
// -----------------------------------------------------------------------
|
|
3430
|
+
// Dossiers
|
|
3431
|
+
// -----------------------------------------------------------------------
|
|
3432
|
+
async upsertDossier(d) {
|
|
3433
|
+
await executeRawSql(this.runtime, `INSERT INTO life_dossiers (
|
|
3434
|
+
id, agent_id, calendar_event_id, subject, generated_for_at,
|
|
3435
|
+
content_md, sources_json, metadata_json, created_at, updated_at
|
|
3436
|
+
) VALUES (
|
|
3437
|
+
${sqlQuote(d.id)},
|
|
3438
|
+
${sqlQuote(d.agentId)},
|
|
3439
|
+
${sqlText(d.calendarEventId)},
|
|
3440
|
+
${sqlQuote(d.subject)},
|
|
3441
|
+
${sqlQuote(d.generatedForAt)},
|
|
3442
|
+
${sqlQuote(d.contentMd)},
|
|
3443
|
+
${sqlJson(d.sources)},
|
|
3444
|
+
${sqlJson(d.metadata)},
|
|
3445
|
+
${sqlQuote(d.createdAt)},
|
|
3446
|
+
${sqlQuote(d.updatedAt)}
|
|
3447
|
+
)
|
|
3448
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
3449
|
+
calendar_event_id = EXCLUDED.calendar_event_id,
|
|
3450
|
+
subject = EXCLUDED.subject,
|
|
3451
|
+
generated_for_at = EXCLUDED.generated_for_at,
|
|
3452
|
+
content_md = EXCLUDED.content_md,
|
|
3453
|
+
sources_json = EXCLUDED.sources_json,
|
|
3454
|
+
metadata_json = EXCLUDED.metadata_json,
|
|
3455
|
+
updated_at = EXCLUDED.updated_at`);
|
|
3456
|
+
}
|
|
3457
|
+
async getDossier(agentId, id) {
|
|
3458
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3459
|
+
FROM life_dossiers
|
|
3460
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3461
|
+
AND id = ${sqlQuote(id)}
|
|
3462
|
+
LIMIT 1`);
|
|
3463
|
+
const row = rows[0];
|
|
3464
|
+
return row ? parseDossier(row) : null;
|
|
3465
|
+
}
|
|
3466
|
+
async getDossierByCalendarEvent(agentId, calendarEventId) {
|
|
3467
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3468
|
+
FROM life_dossiers
|
|
3469
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3470
|
+
AND calendar_event_id = ${sqlQuote(calendarEventId)}
|
|
3471
|
+
ORDER BY generated_for_at DESC
|
|
3472
|
+
LIMIT 1`);
|
|
3473
|
+
const row = rows[0];
|
|
3474
|
+
return row ? parseDossier(row) : null;
|
|
3475
|
+
}
|
|
3476
|
+
async listDossiers(agentId, opts) {
|
|
3477
|
+
const limitClause = typeof opts?.limit === "number"
|
|
3478
|
+
? `LIMIT ${sqlInteger(opts.limit)}`
|
|
3479
|
+
: "LIMIT 50";
|
|
3480
|
+
const rows = await executeRawSql(this.runtime, `SELECT *
|
|
3481
|
+
FROM life_dossiers
|
|
3482
|
+
WHERE agent_id = ${sqlQuote(agentId)}
|
|
3483
|
+
ORDER BY generated_for_at DESC
|
|
3484
|
+
${limitClause}`);
|
|
3485
|
+
return rows.map(parseDossier);
|
|
3486
|
+
}
|
|
3045
3487
|
}
|
|
3046
3488
|
export function createLifeOpsTaskDefinition(params) {
|
|
3047
3489
|
const timestamp = isoNow();
|