@elizaos/agent 2.0.0-alpha.441 → 2.0.0-alpha.501
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/components/companion/CompanionAppView.d.ts.map +1 -1
- package/apps/app-companion/src/components/companion/CompanionAppView.js +6 -2
- package/apps/app-companion/src/components/companion/CompanionHeader.d.ts +3 -1
- package/apps/app-companion/src/components/companion/CompanionHeader.d.ts.map +1 -1
- package/apps/app-companion/src/components/companion/CompanionHeader.js +8 -2
- package/apps/app-companion/src/components/companion/CompanionPerformanceSettings.d.ts +2 -0
- package/apps/app-companion/src/components/companion/CompanionPerformanceSettings.d.ts.map +1 -0
- package/apps/app-companion/src/components/companion/CompanionPerformanceSettings.js +33 -0
- package/apps/app-companion/src/components/companion/CompanionSettingsPanel.d.ts +2 -0
- package/apps/app-companion/src/components/companion/CompanionSettingsPanel.d.ts.map +1 -0
- package/apps/app-companion/src/components/companion/CompanionSettingsPanel.js +7 -0
- package/apps/app-companion/src/components/companion/CompanionShell.d.ts.map +1 -1
- package/apps/app-companion/src/components/companion/CompanionShell.js +1 -1
- package/apps/app-companion/src/components/companion/CompanionView.d.ts.map +1 -1
- package/apps/app-companion/src/components/companion/CompanionView.js +6 -2
- package/apps/app-companion/src/types/render-modes.d.ts +4 -0
- package/apps/app-companion/src/types/render-modes.d.ts.map +1 -0
- package/apps/app-companion/src/types/render-modes.js +6 -0
- package/apps/app-elizamaker/src/drop-routes.d.ts.map +1 -1
- package/apps/app-elizamaker/src/drop-service.d.ts +1 -1
- package/apps/app-elizamaker/src/drop-service.d.ts.map +1 -1
- package/apps/app-elizamaker/src/og-tracker.d.ts.map +1 -1
- package/apps/app-elizamaker/src/og-tracker.js +1 -1
- package/apps/app-elizamaker/src/twitter-verify.js +1 -1
- package/apps/app-lifeops/src/actions/website-blocker.d.ts.map +1 -1
- package/apps/app-lifeops/src/actions/website-blocker.js +18 -16
- package/apps/app-lifeops/src/api/client-lifeops.d.ts +37 -75
- package/apps/app-lifeops/src/api/client-lifeops.d.ts.map +1 -1
- package/apps/app-lifeops/src/api/client-lifeops.js +119 -0
- package/apps/app-lifeops/src/inbox/channel-deep-links.d.ts +2 -4
- package/apps/app-lifeops/src/inbox/channel-deep-links.d.ts.map +1 -1
- package/apps/app-lifeops/src/inbox/channel-deep-links.js +8 -38
- package/apps/app-lifeops/src/inbox/message-fetcher.d.ts +1 -1
- package/apps/app-lifeops/src/inbox/message-fetcher.d.ts.map +1 -1
- package/apps/app-lifeops/src/inbox/message-fetcher.js +180 -77
- package/apps/app-lifeops/src/inbox/types.d.ts +1 -1
- package/apps/app-lifeops/src/inbox/types.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/browser-extension-store.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/browser-readiness.d.ts +16 -0
- package/apps/app-lifeops/src/lifeops/browser-readiness.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/browser-readiness.js +74 -0
- package/apps/app-lifeops/src/lifeops/browser-session-lifecycle.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/browser-session-lifecycle.js +1 -1
- package/apps/app-lifeops/src/lifeops/checkin/checkin-service.d.ts.map +1 -1
- 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/discord-desktop-cdp.d.ts +16 -0
- package/apps/app-lifeops/src/lifeops/discord-desktop-cdp.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/discord-desktop-cdp.js +217 -1
- package/apps/app-lifeops/src/lifeops/email-unsubscribe-gmail.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/email-unsubscribe-gmail.js +8 -3
- package/apps/app-lifeops/src/lifeops/feature-flags.types.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/goal-semantic-evaluator.js +1 -1
- package/apps/app-lifeops/src/lifeops/google-calendar.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-calendar.js +24 -31
- package/apps/app-lifeops/src/lifeops/google-drive.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-drive.js +7 -1
- package/apps/app-lifeops/src/lifeops/google-fetch.d.ts +1 -1
- package/apps/app-lifeops/src/lifeops/google-fetch.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-fetch.js +4 -6
- package/apps/app-lifeops/src/lifeops/google-gmail.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/google-gmail.js +50 -34
- package/apps/app-lifeops/src/lifeops/health-bridge.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/health-bridge.js +53 -10
- package/apps/app-lifeops/src/lifeops/health-connectors.d.ts +23 -0
- package/apps/app-lifeops/src/lifeops/health-connectors.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/health-connectors.js +962 -0
- package/apps/app-lifeops/src/lifeops/health-oauth.d.ts +62 -0
- package/apps/app-lifeops/src/lifeops/health-oauth.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/health-oauth.js +496 -0
- package/apps/app-lifeops/src/lifeops/payment-csv-import.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/payment-csv-import.js +1 -5
- package/apps/app-lifeops/src/lifeops/payment-recurrence.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/payment-recurrence.js +2 -1
- package/apps/app-lifeops/src/lifeops/payment-types.d.ts +8 -7
- package/apps/app-lifeops/src/lifeops/payment-types.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/priority-scoring.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/repository.d.ts +46 -10
- package/apps/app-lifeops/src/lifeops/repository.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/repository.js +683 -65
- package/apps/app-lifeops/src/lifeops/schedule-insight.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/schedule-insight.js +2 -3
- package/apps/app-lifeops/src/lifeops/schema.d.ts +6403 -3831
- package/apps/app-lifeops/src/lifeops/schema.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/schema.js +105 -18
- package/apps/app-lifeops/src/lifeops/seed-routines.d.ts +1 -1
- package/apps/app-lifeops/src/lifeops/seed-routines.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/seed-routines.js +7 -2
- package/apps/app-lifeops/src/lifeops/service-constants.d.ts +15 -0
- package/apps/app-lifeops/src/lifeops/service-constants.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-constants.js +21 -3
- package/apps/app-lifeops/src/lifeops/service-helpers-browser.d.ts +1 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-browser.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-browser.js +1 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-misc.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-misc.js +5 -5
- package/apps/app-lifeops/src/lifeops/service-helpers-occurrence.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-occurrence.js +1 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-reminder.d.ts +48 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-reminder.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-helpers-reminder.js +191 -17
- package/apps/app-lifeops/src/lifeops/service-mixin-browser.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-browser.js +10 -7
- package/apps/app-lifeops/src/lifeops/service-mixin-calendar.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-calendar.js +4 -11
- package/apps/app-lifeops/src/lifeops/service-mixin-core.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-core.js +5 -2
- package/apps/app-lifeops/src/lifeops/service-mixin-definitions.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-definitions.js +7 -6
- package/apps/app-lifeops/src/lifeops/service-mixin-discord.js +237 -32
- package/apps/app-lifeops/src/lifeops/service-mixin-drive.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-drive.js +6 -5
- package/apps/app-lifeops/src/lifeops/service-mixin-gmail.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-gmail.js +86 -31
- package/apps/app-lifeops/src/lifeops/service-mixin-goals.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-goals.js +14 -15
- package/apps/app-lifeops/src/lifeops/service-mixin-google.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-google.js +71 -51
- package/apps/app-lifeops/src/lifeops/service-mixin-health.js +528 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-imessage.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-imessage.js +94 -6
- package/apps/app-lifeops/src/lifeops/service-mixin-inbox.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-inbox.js +9 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-payments.d.ts +3 -0
- package/apps/app-lifeops/src/lifeops/service-mixin-payments.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-payments.js +93 -26
- package/apps/app-lifeops/src/lifeops/service-mixin-reminders.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-reminders.js +331 -167
- package/apps/app-lifeops/src/lifeops/service-mixin-scheduling.js +5 -10
- package/apps/app-lifeops/src/lifeops/service-mixin-screentime.js +372 -10
- package/apps/app-lifeops/src/lifeops/service-mixin-signal.js +179 -43
- package/apps/app-lifeops/src/lifeops/service-mixin-sleep.js +31 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-status.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-status.js +82 -13
- package/apps/app-lifeops/src/lifeops/service-mixin-subscriptions.js +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-telegram.js +59 -12
- package/apps/app-lifeops/src/lifeops/service-mixin-whatsapp.js +165 -22
- package/apps/app-lifeops/src/lifeops/service-mixin-workflows.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-mixin-workflows.js +3 -0
- package/apps/app-lifeops/src/lifeops/service-normalize-calendar.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-normalize-calendar.js +4 -4
- package/apps/app-lifeops/src/lifeops/service-normalize-gmail.d.ts +3 -1
- package/apps/app-lifeops/src/lifeops/service-normalize-gmail.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-normalize-gmail.js +5 -3
- package/apps/app-lifeops/src/lifeops/service-normalize-health.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-normalize-health.js +4 -3
- package/apps/app-lifeops/src/lifeops/service-normalize-task.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-normalize-task.js +10 -1
- package/apps/app-lifeops/src/lifeops/service-normalize.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service-normalize.js +3 -3
- package/apps/app-lifeops/src/lifeops/service-types.d.ts +1 -1
- package/apps/app-lifeops/src/lifeops/service-types.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service.d.ts +92 -166
- package/apps/app-lifeops/src/lifeops/service.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/service.js +2 -2
- package/apps/app-lifeops/src/lifeops/signal-auth.d.ts +7 -0
- package/apps/app-lifeops/src/lifeops/signal-auth.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/signal-auth.js +50 -6
- package/apps/app-lifeops/src/lifeops/signal-local-client.d.ts +7 -0
- package/apps/app-lifeops/src/lifeops/signal-local-client.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/signal-local-client.js +95 -4
- package/apps/app-lifeops/src/lifeops/sleep-cycle.d.ts +7 -1
- package/apps/app-lifeops/src/lifeops/sleep-cycle.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/sleep-cycle.js +16 -6
- package/apps/app-lifeops/src/lifeops/sleep-episode-store.d.ts +2 -1
- package/apps/app-lifeops/src/lifeops/sleep-episode-store.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/sleep-episode-store.js +7 -3
- package/apps/app-lifeops/src/lifeops/social-taxonomy.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/social-taxonomy.js +68 -16
- package/apps/app-lifeops/src/lifeops/subscriptions-playbooks.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/subscriptions-playbooks.js +24 -14
- package/apps/app-lifeops/src/lifeops/subscriptions-types.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/telegram-auth.d.ts +8 -1
- package/apps/app-lifeops/src/lifeops/telegram-auth.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/telegram-auth.js +44 -5
- package/apps/app-lifeops/src/lifeops/telegram-local-client.d.ts +1 -0
- package/apps/app-lifeops/src/lifeops/telegram-local-client.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/telegram-local-client.js +141 -7
- package/apps/app-lifeops/src/lifeops/twilio.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/twilio.js +3 -1
- package/apps/app-lifeops/src/lifeops/whatsapp-client.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/whatsapp-client.js +7 -4
- package/apps/app-lifeops/src/lifeops/x-poster.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/x-poster.js +3 -1
- package/apps/app-lifeops/src/lifeops/x-reader.d.ts.map +1 -1
- package/apps/app-lifeops/src/lifeops/x-reader.js +10 -3
- package/apps/app-lifeops/src/providers/website-blocker.js +2 -2
- package/apps/app-lifeops/src/public.d.ts +2 -2
- package/apps/app-lifeops/src/public.d.ts.map +1 -1
- package/apps/app-lifeops/src/public.js +2 -2
- package/apps/app-lifeops/src/routes/lifeops-routes.d.ts.map +1 -1
- package/apps/app-lifeops/src/routes/lifeops-routes.js +327 -92
- package/apps/app-lifeops/src/routes/plugin.d.ts.map +1 -1
- package/apps/app-lifeops/src/routes/plugin.js +79 -50
- package/apps/app-lifeops/src/routes/sleep-routes.d.ts.map +1 -1
- package/apps/app-lifeops/src/website-blocker/access.d.ts +1 -1
- package/apps/app-lifeops/src/website-blocker/access.d.ts.map +1 -1
- package/apps/app-lifeops/src/website-blocker/access.js +13 -9
- package/apps/app-lifeops/src/website-blocker/engine.d.ts.map +1 -1
- package/apps/app-lifeops/src/website-blocker/engine.js +23 -2
- package/apps/app-lifeops/src/website-blocker/public.d.ts +4 -4
- package/apps/app-lifeops/src/website-blocker/public.d.ts.map +1 -1
- package/apps/app-lifeops/src/website-blocker/public.js +2 -2
- package/apps/app-lifeops/src/website-blocker/roles.d.ts +2 -4
- package/apps/app-lifeops/src/website-blocker/roles.d.ts.map +1 -1
- package/apps/app-lifeops/src/website-blocker/roles.js +1 -4
- package/apps/app-steward/src/actions/check-balance.d.ts.map +1 -1
- package/apps/app-steward/src/actions/wallet-action-shared.d.ts.map +1 -1
- package/apps/app-steward/src/actions/wallet-action-shared.js +1 -1
- package/apps/app-steward/src/api/wallet-evm-balance.d.ts.map +1 -1
- package/apps/app-steward/src/browser-workspace-wallet.d.ts +15 -1
- package/apps/app-steward/src/browser-workspace-wallet.d.ts.map +1 -1
- package/apps/app-steward/src/browser-workspace-wallet.js +7 -1
- package/apps/app-steward/src/index.d.ts +4 -4
- package/apps/app-steward/src/index.d.ts.map +1 -1
- package/apps/app-steward/src/index.js +4 -4
- package/apps/app-steward/src/routes/steward-bridge.d.ts.map +1 -1
- package/apps/app-steward/src/routes/steward-bridge.js +1 -1
- package/apps/app-steward/src/routes/wallet-browser-compat-routes.d.ts.map +1 -1
- package/apps/app-steward/src/routes/wallet-browser-compat-routes.js +88 -1
- package/apps/app-training/src/backends/atropos.d.ts.map +1 -1
- package/apps/app-training/src/backends/atropos.js +2 -2
- package/apps/app-training/src/backends/native.d.ts +1 -1
- package/apps/app-training/src/backends/native.d.ts.map +1 -1
- package/apps/app-training/src/backends/tinker.d.ts.map +1 -1
- package/apps/app-training/src/core/index.d.ts +5 -5
- package/apps/app-training/src/core/index.d.ts.map +1 -1
- package/apps/app-training/src/core/index.js +4 -4
- package/apps/app-training/src/core/privacy-filter.d.ts.map +1 -1
- package/apps/app-training/src/core/training-orchestrator.d.ts.map +1 -1
- package/apps/app-training/src/optimizers/bootstrap-fewshot.d.ts.map +1 -1
- package/apps/app-training/src/optimizers/bootstrap-fewshot.js +7 -3
- package/apps/app-training/src/optimizers/index.d.ts +4 -4
- package/apps/app-training/src/optimizers/index.d.ts.map +1 -1
- package/apps/app-training/src/optimizers/index.js +2 -2
- package/apps/app-training/src/optimizers/instruction-search.d.ts.map +1 -1
- package/apps/app-training/src/optimizers/instruction-search.js +6 -1
- package/apps/app-training/src/optimizers/prompt-evolution.d.ts.map +1 -1
- package/apps/app-training/src/optimizers/prompt-evolution.js +6 -1
- package/apps/app-training/src/optimizers/scoring.d.ts +5 -7
- package/apps/app-training/src/optimizers/scoring.d.ts.map +1 -1
- package/apps/app-training/src/optimizers/types.d.ts.map +1 -1
- package/apps/app-training/src/routes/index.d.ts +1 -1
- package/apps/app-training/src/routes/index.d.ts.map +1 -1
- package/apps/app-training/src/routes/index.js +1 -1
- package/apps/app-training/src/services/index.d.ts +3 -3
- package/apps/app-training/src/services/index.d.ts.map +1 -1
- package/apps/app-training/src/services/index.js +2 -2
- package/apps/app-training/src/services/training-trigger.d.ts.map +1 -1
- package/package.json +4 -4
- package/packages/agent/src/actions/browser-session.d.ts.map +1 -1
- package/packages/agent/src/actions/browser-session.js +73 -5
- package/packages/agent/src/actions/extract-page.d.ts.map +1 -1
- package/packages/agent/src/actions/extract-page.js +11 -3
- package/packages/agent/src/actions/launchpad-launch.d.ts +16 -0
- package/packages/agent/src/actions/launchpad-launch.d.ts.map +1 -0
- package/packages/agent/src/actions/launchpad-launch.js +207 -0
- package/packages/agent/src/actions/logs.d.ts.map +1 -1
- package/packages/agent/src/actions/logs.js +19 -2
- package/packages/agent/src/actions/manage-tasks.d.ts.map +1 -1
- package/packages/agent/src/actions/manage-tasks.js +55 -0
- package/packages/agent/src/actions/page-action-groups.d.ts +17 -0
- package/packages/agent/src/actions/page-action-groups.d.ts.map +1 -0
- package/packages/agent/src/actions/page-action-groups.js +171 -0
- package/packages/agent/src/actions/scratchpad.d.ts.map +1 -1
- package/packages/agent/src/actions/scratchpad.js +17 -2
- package/packages/agent/src/actions/web-search.d.ts.map +1 -1
- package/packages/agent/src/actions/web-search.js +10 -2
- package/packages/agent/src/api/accounts-routes.d.ts.map +1 -1
- package/packages/agent/src/api/accounts-routes.js +8 -10
- package/packages/agent/src/api/chat-augmentation.d.ts.map +1 -1
- package/packages/agent/src/api/chat-augmentation.js +18 -6
- package/packages/agent/src/api/cloud-relay-routes.d.ts.map +1 -1
- package/packages/agent/src/api/cloud-relay-routes.js +3 -2
- package/packages/agent/src/api/cloud-routes.d.ts +3 -0
- package/packages/agent/src/api/cloud-routes.d.ts.map +1 -1
- package/packages/agent/src/api/cloud-routes.js +54 -1
- package/packages/agent/src/api/cloud-status-routes.d.ts.map +1 -1
- package/packages/agent/src/api/cloud-status-routes.js +25 -15
- package/packages/agent/src/api/connector-routes.d.ts +8 -0
- package/packages/agent/src/api/connector-routes.d.ts.map +1 -1
- package/packages/agent/src/api/connector-routes.js +25 -1
- package/packages/agent/src/api/experience-routes.d.ts.map +1 -1
- package/packages/agent/src/api/experience-routes.js +57 -0
- package/packages/agent/src/api/index.d.ts +1 -1
- package/packages/agent/src/api/index.d.ts.map +1 -1
- package/packages/agent/src/api/index.js +5 -5
- package/packages/agent/src/api/provider-switch-config.d.ts +4 -1
- package/packages/agent/src/api/provider-switch-config.d.ts.map +1 -1
- package/packages/agent/src/api/provider-switch-config.js +8 -1
- package/packages/agent/src/api/provider-switch-routes.d.ts +7 -1
- package/packages/agent/src/api/provider-switch-routes.d.ts.map +1 -1
- package/packages/agent/src/api/provider-switch-routes.js +62 -27
- package/packages/agent/src/api/runtime-plugin-routes.d.ts +5 -0
- package/packages/agent/src/api/runtime-plugin-routes.d.ts.map +1 -1
- package/packages/agent/src/api/runtime-plugin-routes.js +13 -0
- package/packages/agent/src/api/server-helpers-auth.d.ts.map +1 -1
- package/packages/agent/src/api/server-helpers-auth.js +7 -0
- package/packages/agent/src/api/server.d.ts.map +1 -1
- package/packages/agent/src/api/server.js +73 -11
- package/packages/agent/src/api/subscription-routes.d.ts.map +1 -1
- package/packages/agent/src/api/subscription-routes.js +6 -2
- package/packages/agent/src/auth/credentials.d.ts.map +1 -1
- package/packages/agent/src/auth/credentials.js +6 -2
- package/packages/agent/src/autonomy/index.d.ts.map +1 -1
- package/packages/agent/src/autonomy/index.js +5 -3
- package/packages/agent/src/bin.js +25 -0
- package/packages/agent/src/cli/index.d.ts.map +1 -1
- package/packages/agent/src/cli/index.js +17 -1
- package/packages/agent/src/cloud/cloud-manager.d.ts +1 -0
- package/packages/agent/src/cloud/cloud-manager.d.ts.map +1 -1
- package/packages/agent/src/cloud/cloud-manager.js +9 -0
- package/packages/agent/src/providers/page-scoped-context.d.ts.map +1 -1
- package/packages/agent/src/providers/page-scoped-context.js +48 -8
- package/packages/agent/src/runtime/aosp-llama-adapter.d.ts +193 -0
- package/packages/agent/src/runtime/aosp-llama-adapter.d.ts.map +1 -0
- package/packages/agent/src/runtime/aosp-llama-adapter.js +938 -0
- package/packages/agent/src/runtime/aosp-local-inference-bootstrap.d.ts +42 -0
- package/packages/agent/src/runtime/aosp-local-inference-bootstrap.d.ts.map +1 -0
- package/packages/agent/src/runtime/aosp-local-inference-bootstrap.js +299 -0
- package/packages/agent/src/runtime/core-plugins.d.ts +20 -0
- package/packages/agent/src/runtime/core-plugins.d.ts.map +1 -1
- package/packages/agent/src/runtime/core-plugins.js +22 -2
- package/packages/agent/src/runtime/discord-local-plugin.d.ts.map +1 -1
- package/packages/agent/src/runtime/discord-local-plugin.js +36 -0
- package/packages/agent/src/runtime/eliza-plugin.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza-plugin.js +9 -0
- package/packages/agent/src/runtime/eliza.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza.js +18 -8
- package/packages/agent/src/runtime/first-time-setup.d.ts +1 -0
- package/packages/agent/src/runtime/first-time-setup.d.ts.map +1 -1
- package/packages/agent/src/runtime/first-time-setup.js +1 -0
- package/packages/agent/src/runtime/operations/classifier.d.ts +36 -0
- package/packages/agent/src/runtime/operations/classifier.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/classifier.js +72 -0
- package/packages/agent/src/runtime/operations/cold-strategy.d.ts +19 -0
- package/packages/agent/src/runtime/operations/cold-strategy.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/cold-strategy.js +83 -0
- package/packages/agent/src/runtime/operations/health-checks.d.ts +24 -0
- package/packages/agent/src/runtime/operations/health-checks.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/health-checks.js +186 -0
- package/packages/agent/src/runtime/operations/health.d.ts +32 -0
- package/packages/agent/src/runtime/operations/health.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/health.js +151 -0
- package/packages/agent/src/runtime/operations/index.d.ts +16 -0
- package/packages/agent/src/runtime/operations/index.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/index.js +14 -0
- package/packages/agent/src/runtime/operations/manager.d.ts +68 -0
- package/packages/agent/src/runtime/operations/manager.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/manager.js +182 -0
- package/packages/agent/src/runtime/operations/reload-hot.d.ts +40 -0
- package/packages/agent/src/runtime/operations/reload-hot.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/reload-hot.js +176 -0
- package/packages/agent/src/runtime/operations/repository.d.ts +44 -0
- package/packages/agent/src/runtime/operations/repository.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/repository.js +233 -0
- package/packages/agent/src/runtime/operations/types.d.ts +201 -0
- package/packages/agent/src/runtime/operations/types.d.ts.map +1 -0
- package/packages/agent/src/runtime/operations/types.js +30 -0
- package/packages/agent/src/runtime/plugin-collector.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-collector.js +47 -7
- package/packages/agent/src/runtime/plugin-role-gating.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-role-gating.js +42 -9
- package/packages/agent/src/runtime/restart.d.ts +14 -38
- package/packages/agent/src/runtime/restart.d.ts.map +1 -1
- package/packages/agent/src/runtime/restart.js +14 -39
- package/packages/agent/src/services/browser-workspace-desktop.d.ts.map +1 -1
- package/packages/agent/src/services/browser-workspace-desktop.js +107 -0
- package/packages/agent/src/services/browser-workspace-types.d.ts +7 -1
- package/packages/agent/src/services/browser-workspace-types.d.ts.map +1 -1
- package/packages/agent/src/services/browser-workspace.d.ts.map +1 -1
- package/packages/agent/src/services/browser-workspace.js +7 -0
- package/packages/agent/src/services/index.d.ts +1 -0
- package/packages/agent/src/services/index.d.ts.map +1 -1
- package/packages/agent/src/services/index.js +1 -0
- package/packages/agent/src/services/launchpads/image-generator.d.ts +22 -0
- package/packages/agent/src/services/launchpads/image-generator.d.ts.map +1 -0
- package/packages/agent/src/services/launchpads/image-generator.js +46 -0
- package/packages/agent/src/services/launchpads/launchpad-engine.d.ts +32 -0
- package/packages/agent/src/services/launchpads/launchpad-engine.d.ts.map +1 -0
- package/packages/agent/src/services/launchpads/launchpad-engine.js +191 -0
- package/packages/agent/src/services/launchpads/launchpad-types.d.ts +116 -0
- package/packages/agent/src/services/launchpads/launchpad-types.d.ts.map +1 -0
- package/packages/agent/src/services/launchpads/launchpad-types.js +19 -0
- package/packages/agent/src/services/launchpads/metadata-generator.d.ts +24 -0
- package/packages/agent/src/services/launchpads/metadata-generator.d.ts.map +1 -0
- package/packages/agent/src/services/launchpads/metadata-generator.js +96 -0
- package/packages/agent/src/services/launchpads/profiles/flap-sh.d.ts +25 -0
- package/packages/agent/src/services/launchpads/profiles/flap-sh.d.ts.map +1 -0
- package/packages/agent/src/services/launchpads/profiles/flap-sh.js +80 -0
- package/packages/agent/src/services/launchpads/profiles/four-meme.d.ts +11 -0
- package/packages/agent/src/services/launchpads/profiles/four-meme.d.ts.map +1 -0
- package/packages/agent/src/services/launchpads/profiles/four-meme.js +70 -0
- package/packages/agent/src/services/registry-client.js +1 -1
- package/packages/agent/src/services/research-task-executor.d.ts.map +1 -1
- package/packages/agent/src/services/research-task-executor.js +3 -1
- package/packages/app-core/src/App.d.ts.map +1 -1
- package/packages/app-core/src/App.js +6 -8
- package/packages/app-core/src/api/auth/sessions.js +1 -1
- package/packages/app-core/src/api/auth/tokens.d.ts +3 -0
- package/packages/app-core/src/api/auth/tokens.d.ts.map +1 -0
- package/packages/app-core/src/api/auth/tokens.js +13 -0
- package/packages/app-core/src/api/auth.d.ts +1 -3
- package/packages/app-core/src/api/auth.d.ts.map +1 -1
- package/packages/app-core/src/api/auth.js +2 -16
- package/packages/app-core/src/api/client-agent.d.ts +14 -3
- package/packages/app-core/src/api/client-agent.d.ts.map +1 -1
- package/packages/app-core/src/api/client-agent.js +74 -1
- package/packages/app-core/src/api/client-base.d.ts.map +1 -1
- package/packages/app-core/src/api/client-base.js +34 -2
- package/packages/app-core/src/api/client-cloud.d.ts +5 -1
- package/packages/app-core/src/api/client-cloud.d.ts.map +1 -1
- package/packages/app-core/src/api/client-cloud.js +9 -2
- package/packages/app-core/src/api/client-types-chat.d.ts +8 -0
- package/packages/app-core/src/api/client-types-chat.d.ts.map +1 -1
- package/packages/app-core/src/api/client-types-cloud.d.ts +2 -0
- package/packages/app-core/src/api/client-types-cloud.d.ts.map +1 -1
- package/packages/app-core/src/api/client-types-config.d.ts +1 -1
- package/packages/app-core/src/api/client-types-config.d.ts.map +1 -1
- package/packages/app-core/src/api/client-types-core.d.ts +1 -1
- package/packages/app-core/src/api/client-types-core.d.ts.map +1 -1
- package/packages/app-core/src/api/client-types-experience.d.ts +50 -0
- package/packages/app-core/src/api/client-types-experience.d.ts.map +1 -1
- package/packages/app-core/src/api/client-wallet.d.ts +7 -1
- package/packages/app-core/src/api/client-wallet.d.ts.map +1 -1
- package/packages/app-core/src/api/client-wallet.js +6 -0
- package/packages/app-core/src/components/accounts/AccountCard.d.ts.map +1 -1
- package/packages/app-core/src/components/accounts/AccountCard.js +5 -3
- package/packages/app-core/src/components/accounts/AccountList.d.ts.map +1 -1
- package/packages/app-core/src/components/accounts/AccountList.js +1 -9
- package/packages/app-core/src/components/accounts/AddAccountDialog.d.ts.map +1 -1
- package/packages/app-core/src/components/accounts/AddAccountDialog.js +2 -27
- package/packages/app-core/src/components/accounts/RotationStrategyPicker.d.ts.map +1 -1
- package/packages/app-core/src/components/accounts/RotationStrategyPicker.js +0 -5
- package/packages/app-core/src/components/apps/AppsCatalogGrid.js +1 -1
- package/packages/app-core/src/components/apps/app-identity.d.ts +8 -0
- package/packages/app-core/src/components/apps/app-identity.d.ts.map +1 -1
- package/packages/app-core/src/components/apps/app-identity.js +23 -2
- package/packages/app-core/src/components/apps/catalog-loader.d.ts.map +1 -1
- package/packages/app-core/src/components/apps/catalog-loader.js +10 -1
- package/packages/app-core/src/components/apps/helpers.d.ts +5 -2
- package/packages/app-core/src/components/apps/helpers.d.ts.map +1 -1
- package/packages/app-core/src/components/apps/helpers.js +14 -3
- package/packages/app-core/src/components/apps/overlay-app-registry.d.ts.map +1 -1
- package/packages/app-core/src/components/apps/overlay-app-registry.js +13 -2
- package/packages/app-core/src/components/character/CharacterExperienceWorkspace.d.ts.map +1 -1
- package/packages/app-core/src/components/character/CharacterExperienceWorkspace.js +220 -3
- package/packages/app-core/src/components/character/character-hub-helpers.d.ts.map +1 -1
- package/packages/app-core/src/components/character/character-hub-helpers.js +4 -0
- package/packages/app-core/src/components/character/character-hub-types.d.ts +4 -0
- package/packages/app-core/src/components/character/character-hub-types.d.ts.map +1 -1
- package/packages/app-core/src/components/chat/AppsSection.d.ts.map +1 -1
- package/packages/app-core/src/components/chat/AppsSection.js +24 -1
- package/packages/app-core/src/components/chat/TasksEventsPanel.d.ts.map +1 -1
- package/packages/app-core/src/components/chat/TasksEventsPanel.js +1 -1
- package/packages/app-core/src/components/connectors/ConnectorModeSelector.d.ts +35 -0
- package/packages/app-core/src/components/connectors/ConnectorModeSelector.d.ts.map +1 -0
- package/packages/app-core/src/components/connectors/ConnectorModeSelector.js +150 -0
- package/packages/app-core/src/components/conversations/ConversationsSidebar.d.ts.map +1 -1
- package/packages/app-core/src/components/conversations/ConversationsSidebar.js +8 -6
- package/packages/app-core/src/components/custom-actions/custom-action-form.d.ts +1 -1
- package/packages/app-core/src/components/custom-actions/custom-action-form.d.ts.map +1 -1
- package/packages/app-core/src/components/custom-actions/custom-action-form.js +1 -1
- package/packages/app-core/src/components/local-inference/LocalInferencePanel.d.ts.map +1 -1
- package/packages/app-core/src/components/local-inference/LocalInferencePanel.js +1 -3
- package/packages/app-core/src/components/local-inference/ProvidersList.d.ts +0 -13
- package/packages/app-core/src/components/local-inference/ProvidersList.d.ts.map +1 -1
- package/packages/app-core/src/components/local-inference/ProvidersList.js +10 -21
- package/packages/app-core/src/components/local-inference/RoutingMatrix.d.ts +0 -11
- package/packages/app-core/src/components/local-inference/RoutingMatrix.d.ts.map +1 -1
- package/packages/app-core/src/components/local-inference/RoutingMatrix.js +21 -18
- package/packages/app-core/src/components/local-inference/SlotAssignments.d.ts.map +1 -1
- package/packages/app-core/src/components/local-inference/SlotAssignments.js +11 -11
- package/packages/app-core/src/components/onboarding/BootstrapStep.d.ts +5 -2
- package/packages/app-core/src/components/onboarding/BootstrapStep.d.ts.map +1 -1
- package/packages/app-core/src/components/onboarding/BootstrapStep.js +54 -6
- package/packages/app-core/src/components/pages/AppDetailsView.d.ts +4 -6
- package/packages/app-core/src/components/pages/AppDetailsView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/AppDetailsView.js +109 -54
- package/packages/app-core/src/components/pages/AppsView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/AppsView.js +33 -53
- package/packages/app-core/src/components/pages/AutomationsView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/AutomationsView.js +6 -22
- package/packages/app-core/src/components/pages/BrowserWorkspaceView.d.ts +14 -0
- package/packages/app-core/src/components/pages/BrowserWorkspaceView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/BrowserWorkspaceView.js +462 -45
- package/packages/app-core/src/components/pages/ChatView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/ChatView.js +1 -1
- package/packages/app-core/src/components/pages/ConfigPageView.js +2 -2
- package/packages/app-core/src/components/pages/InventoryView.js +4 -4
- package/packages/app-core/src/components/pages/KnowledgeView.js +1 -1
- package/packages/app-core/src/components/pages/LogsView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/LogsView.js +0 -4
- package/packages/app-core/src/components/pages/SecretsView.js +1 -1
- package/packages/app-core/src/components/pages/SettingsView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/SettingsView.js +76 -176
- package/packages/app-core/src/components/pages/WorkflowGraphViewer.js +1 -1
- package/packages/app-core/src/components/pages/page-scoped-conversations.d.ts +1 -1
- package/packages/app-core/src/components/pages/page-scoped-conversations.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/page-scoped-conversations.js +62 -7
- package/packages/app-core/src/components/pages/plugin-list-utils.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/plugin-list-utils.js +0 -1
- package/packages/app-core/src/components/pages/plugin-view-connectors.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/plugin-view-connectors.js +12 -4
- package/packages/app-core/src/components/pages/useBrowserWorkspaceWalletBridge.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/useBrowserWorkspaceWalletBridge.js +41 -0
- package/packages/app-core/src/components/settings/AppearanceSettingsSection.d.ts.map +1 -1
- package/packages/app-core/src/components/settings/AppearanceSettingsSection.js +3 -42
- package/packages/app-core/src/components/settings/ProviderSwitcher.d.ts.map +1 -1
- package/packages/app-core/src/components/settings/ProviderSwitcher.js +74 -39
- package/packages/app-core/src/components/settings/SubscriptionStatus.d.ts.map +1 -1
- package/packages/app-core/src/components/settings/SubscriptionStatus.js +2 -2
- package/packages/app-core/src/components/settings/permission-controls.d.ts.map +1 -1
- package/packages/app-core/src/components/settings/permission-controls.js +41 -7
- package/packages/app-core/src/components/shell/BugReportModal.js +2 -2
- package/packages/app-core/src/components/shell/CommandPalette.d.ts.map +1 -1
- package/packages/app-core/src/components/shell/CommandPalette.js +3 -3
- package/packages/app-core/src/components/shell/Header.js +2 -2
- package/packages/app-core/src/components/shell/RuntimeGate.d.ts.map +1 -1
- package/packages/app-core/src/components/shell/RuntimeGate.js +309 -57
- package/packages/app-core/src/components/shell/StartupShell.js +2 -2
- package/packages/app-core/src/components/workspace/AppWorkspaceChrome.js +2 -2
- package/packages/app-core/src/config/boot-config-store.d.ts +35 -6
- package/packages/app-core/src/config/boot-config-store.d.ts.map +1 -1
- package/packages/app-core/src/hooks/useAccounts.d.ts +1 -1
- package/packages/app-core/src/hooks/useAccounts.d.ts.map +1 -1
- package/packages/app-core/src/hooks/voice-chat-playback.d.ts.map +1 -1
- package/packages/app-core/src/hooks/voice-chat-playback.js +2 -2
- package/packages/app-core/src/i18n/locales/en.json +229 -210
- package/packages/app-core/src/i18n/locales/es.json +255 -236
- package/packages/app-core/src/i18n/locales/ko.json +255 -236
- package/packages/app-core/src/i18n/locales/pt.json +255 -236
- package/packages/app-core/src/i18n/locales/tl.json +254 -235
- package/packages/app-core/src/i18n/locales/vi.json +255 -236
- package/packages/app-core/src/i18n/locales/zh-CN.json +255 -236
- package/packages/app-core/src/onboarding/mobile-runtime-mode.d.ts +1 -1
- package/packages/app-core/src/onboarding/mobile-runtime-mode.d.ts.map +1 -1
- package/packages/app-core/src/onboarding/mobile-runtime-mode.js +3 -0
- package/packages/app-core/src/onboarding/probe-local-agent.d.ts +44 -0
- package/packages/app-core/src/onboarding/probe-local-agent.d.ts.map +1 -0
- package/packages/app-core/src/onboarding/probe-local-agent.js +126 -0
- package/packages/app-core/src/onboarding-config.d.ts +1 -0
- package/packages/app-core/src/onboarding-config.d.ts.map +1 -1
- package/packages/app-core/src/onboarding-config.js +3 -0
- package/packages/app-core/src/platform/init.d.ts +8 -0
- package/packages/app-core/src/platform/init.d.ts.map +1 -1
- package/packages/app-core/src/platform/init.js +10 -0
- package/packages/app-core/src/services/account-pool.d.ts +98 -0
- package/packages/app-core/src/services/account-pool.d.ts.map +1 -0
- package/packages/app-core/src/services/account-pool.js +506 -0
- package/packages/app-core/src/services/account-usage.d.ts +75 -0
- package/packages/app-core/src/services/account-usage.d.ts.map +1 -0
- package/packages/app-core/src/services/account-usage.js +179 -0
- package/packages/app-core/src/services/local-inference/active-model.d.ts +14 -0
- package/packages/app-core/src/services/local-inference/active-model.d.ts.map +1 -1
- package/packages/app-core/src/services/local-inference/device-bridge.d.ts +7 -0
- package/packages/app-core/src/services/local-inference/device-bridge.d.ts.map +1 -1
- package/packages/app-core/src/services/local-inference/device-bridge.js +108 -3
- package/packages/app-core/src/services/local-inference/paths.d.ts +9 -2
- package/packages/app-core/src/services/local-inference/paths.d.ts.map +1 -1
- package/packages/app-core/src/services/local-inference/paths.js +10 -3
- package/packages/app-core/src/services/local-inference/providers.d.ts +1 -1
- package/packages/app-core/src/services/local-inference/providers.d.ts.map +1 -1
- package/packages/app-core/src/services/local-inference/providers.js +46 -0
- package/packages/app-core/src/services/local-inference/routing-preferences.d.ts +3 -1
- package/packages/app-core/src/services/local-inference/routing-preferences.d.ts.map +1 -1
- package/packages/app-core/src/services/local-inference/routing-preferences.js +1 -0
- package/packages/app-core/src/services/local-inference/types.d.ts +1 -1
- package/packages/app-core/src/services/local-inference/types.d.ts.map +1 -1
- package/packages/app-core/src/shell/AppWindowRenderer.d.ts.map +1 -1
- package/packages/app-core/src/shell/AppWindowRenderer.js +14 -26
- package/packages/app-core/src/state/AppContext.d.ts +1 -1
- package/packages/app-core/src/state/AppContext.d.ts.map +1 -1
- package/packages/app-core/src/state/AppContext.js +1 -1
- package/packages/app-core/src/state/connector-deeplink.d.ts +30 -0
- package/packages/app-core/src/state/connector-deeplink.d.ts.map +1 -0
- package/packages/app-core/src/state/connector-deeplink.js +46 -0
- package/packages/app-core/src/state/index.d.ts +1 -0
- package/packages/app-core/src/state/index.d.ts.map +1 -1
- package/packages/app-core/src/state/index.js +1 -0
- package/packages/app-core/src/state/useCloudState.d.ts.map +1 -1
- package/packages/app-core/src/state/useCloudState.js +4 -1
- package/packages/app-core/src/state/useMiscUiState.js +1 -1
- package/packages/app-core/src/utils/asset-url.d.ts.map +1 -1
- package/packages/app-core/src/utils/asset-url.js +14 -1
- package/packages/app-core/src/utils/browser-tabs-renderer-registry.d.ts +56 -0
- package/packages/app-core/src/utils/browser-tabs-renderer-registry.d.ts.map +1 -0
- package/packages/app-core/src/utils/browser-tabs-renderer-registry.js +738 -0
- package/packages/app-core/src/utils/errors.d.ts +13 -0
- package/packages/app-core/src/utils/errors.d.ts.map +1 -0
- package/packages/app-core/src/utils/errors.js +25 -0
- package/packages/shared/src/connector-cred-types.d.ts +27 -0
- package/packages/shared/src/connector-cred-types.d.ts.map +1 -0
- package/packages/shared/src/connector-cred-types.js +63 -0
- package/packages/shared/src/contracts/apps.d.ts.map +1 -1
- package/packages/shared/src/contracts/apps.js +10 -0
- package/packages/shared/src/contracts/lifeops-extensions.d.ts +145 -0
- package/packages/shared/src/contracts/lifeops-extensions.d.ts.map +1 -1
- package/packages/shared/src/contracts/lifeops-extensions.js +6 -0
- package/packages/shared/src/contracts/lifeops.d.ts +265 -25
- package/packages/shared/src/contracts/lifeops.d.ts.map +1 -1
- package/packages/shared/src/contracts/lifeops.js +56 -0
- package/packages/shared/src/contracts/service-routing.d.ts +1 -0
- package/packages/shared/src/contracts/service-routing.d.ts.map +1 -1
- package/packages/shared/src/contracts/service-routing.js +3 -0
- package/packages/shared/src/index.d.ts +1 -0
- package/packages/shared/src/index.d.ts.map +1 -1
- package/packages/shared/src/index.js +1 -0
- package/packages/shared/src/runtime-env.d.ts +2 -0
- package/packages/shared/src/runtime-env.d.ts.map +1 -1
- package/packages/shared/src/runtime-env.js +20 -0
- package/packages/shared/src/spoken-text.js +2 -2
- package/packages/typescript/src/action-docs.d.ts +4 -0
- package/packages/typescript/src/action-docs.d.ts.map +1 -1
- package/packages/typescript/src/action-docs.js +29 -5
- package/packages/typescript/src/actions.d.ts.map +1 -1
- package/packages/typescript/src/actions.js +19 -3
- package/packages/typescript/src/features/advanced-capabilities/actions/removeContact.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/actions/removeContact.js +23 -4
- package/packages/typescript/src/features/advanced-capabilities/actions/scheduleFollowUp.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/actions/scheduleFollowUp.js +2 -0
- package/packages/typescript/src/features/advanced-capabilities/actions/searchContacts.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/actions/searchContacts.js +2 -0
- package/packages/typescript/src/features/advanced-capabilities/actions/updateContact.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/actions/updateContact.js +23 -3
- package/packages/typescript/src/features/advanced-capabilities/clipboard/actions/read-attachment.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/clipboard/actions/read-attachment.js +9 -1
- package/packages/typescript/src/features/advanced-capabilities/clipboard/actions/read-file.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/clipboard/actions/read-file.js +4 -0
- package/packages/typescript/src/features/advanced-capabilities/clipboard/actions/save-attachment-to-clipboard.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/clipboard/actions/save-attachment-to-clipboard.js +8 -1
- package/packages/typescript/src/features/advanced-capabilities/clipboard/types.d.ts +1 -1
- package/packages/typescript/src/features/advanced-capabilities/clipboard/types.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/evaluators/factExtractor.js +2 -2
- package/packages/typescript/src/features/advanced-capabilities/experience/actions/record-experience.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/actions/record-experience.js +1 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/actions/search-experiences.d.ts +3 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/actions/search-experiences.d.ts.map +1 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/actions/search-experiences.js +110 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/evaluators/experienceEvaluator.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/evaluators/experienceEvaluator.js +5 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/index.d.ts +1 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/index.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/index.js +1 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/providers/experienceProvider.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/providers/experienceProvider.js +16 -6
- package/packages/typescript/src/features/advanced-capabilities/experience/service.d.ts +21 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/service.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/service.js +391 -8
- package/packages/typescript/src/features/advanced-capabilities/experience/types.d.ts +44 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/types.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/utils/experienceFormatter.d.ts +24 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/utils/experienceFormatter.d.ts.map +1 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/utils/experienceFormatter.js +152 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/utils/experienceText.d.ts +1 -0
- package/packages/typescript/src/features/advanced-capabilities/experience/utils/experienceText.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/experience/utils/experienceText.js +53 -1
- package/packages/typescript/src/features/advanced-capabilities/index.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/index.js +4 -2
- package/packages/typescript/src/features/advanced-capabilities/personality/index.d.ts +1 -2
- package/packages/typescript/src/features/advanced-capabilities/personality/index.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-capabilities/personality/index.js +1 -2
- package/packages/typescript/src/features/advanced-planning/actions/chain-example.d.ts.map +1 -1
- package/packages/typescript/src/features/advanced-planning/actions/chain-example.js +4 -7
- package/packages/typescript/src/features/basic-capabilities/actions/reply.d.ts.map +1 -1
- package/packages/typescript/src/features/basic-capabilities/actions/reply.js +1 -0
- package/packages/typescript/src/features/basic-capabilities/index.d.ts +1 -1
- package/packages/typescript/src/features/basic-capabilities/index.d.ts.map +1 -1
- package/packages/typescript/src/features/basic-capabilities/providers/actions.d.ts.map +1 -1
- package/packages/typescript/src/features/basic-capabilities/providers/actions.js +40 -2
- package/packages/typescript/src/features/index.js +1 -1
- package/packages/typescript/src/features/knowledge/actions.d.ts.map +1 -1
- package/packages/typescript/src/features/knowledge/actions.js +42 -16
- package/packages/typescript/src/features/plugin-manager/actions/coreStatusAction.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/coreStatusAction.js +23 -5
- package/packages/typescript/src/features/plugin-manager/actions/listEjectedPluginsAction.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/listEjectedPluginsAction.js +31 -6
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/core-status.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/create.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/create.js +21 -5
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/eject.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/eject.js +3 -1
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/install.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/plugin.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/plugin.js +4 -1
- package/packages/typescript/src/features/plugin-manager/actions/searchPluginAction.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/actions/searchPluginAction.js +44 -11
- package/packages/typescript/src/features/plugin-manager/index.d.ts +2 -2
- package/packages/typescript/src/features/plugin-manager/index.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/index.js +3 -3
- package/packages/typescript/src/features/plugin-manager/security.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/services/pluginManagerService.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/services/pluginManagerService.js +0 -1
- package/packages/typescript/src/features/plugin-manager/services/pluginRegistryService.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/services/pluginRegistryService.js +1 -2
- package/packages/typescript/src/features/secrets/actions/manage-secret.d.ts.map +1 -1
- package/packages/typescript/src/features/secrets/actions/manage-secret.js +13 -2
- package/packages/typescript/src/features/secrets/actions/request-secret.d.ts.map +1 -1
- package/packages/typescript/src/features/secrets/actions/request-secret.js +23 -5
- package/packages/typescript/src/features/secrets/actions/set-secret.d.ts.map +1 -1
- package/packages/typescript/src/features/secrets/actions/set-secret.js +22 -4
- package/packages/typescript/src/features/secrets/index.d.ts +22 -0
- package/packages/typescript/src/features/secrets/index.d.ts.map +1 -0
- package/packages/typescript/src/features/secrets/index.js +24 -0
- package/packages/typescript/src/features/secrets/onboarding/action.d.ts.map +1 -1
- package/packages/typescript/src/features/secrets/onboarding/action.js +1 -0
- package/packages/typescript/src/features/secrets/plugin.d.ts +70 -0
- package/packages/typescript/src/features/secrets/plugin.d.ts.map +1 -0
- package/packages/typescript/src/features/secrets/plugin.js +87 -0
- package/packages/typescript/src/features/secrets/services/index.d.ts +7 -0
- package/packages/typescript/src/features/secrets/services/index.d.ts.map +1 -0
- package/packages/typescript/src/features/secrets/services/index.js +5 -0
- package/packages/typescript/src/features/secrets/types.d.ts +1 -1
- package/packages/typescript/src/features/secrets/types.js +1 -1
- package/packages/typescript/src/features/trust/actions/evaluateTrust.d.ts.map +1 -1
- package/packages/typescript/src/features/trust/actions/evaluateTrust.js +5 -0
- package/packages/typescript/src/features/trust/actions/recordTrustInteraction.d.ts.map +1 -1
- package/packages/typescript/src/features/trust/actions/recordTrustInteraction.js +5 -0
- package/packages/typescript/src/features/trust/actions/requestElevation.d.ts.map +1 -1
- package/packages/typescript/src/features/trust/actions/requestElevation.js +5 -0
- package/packages/typescript/src/features/trust/actions/roles.d.ts.map +1 -1
- package/packages/typescript/src/features/trust/actions/roles.js +4 -0
- package/packages/typescript/src/features/trust/actions/settings.d.ts.map +1 -1
- package/packages/typescript/src/features/trust/actions/settings.js +17 -4
- package/packages/typescript/src/features/trust/index.js +4 -4
- package/packages/typescript/src/features/trust/providers/settings.js +1 -1
- package/packages/typescript/src/features/trust/services/SecurityStore.d.ts +1 -1
- package/packages/typescript/src/features/trust/services/SecurityStore.js +1 -1
- package/packages/typescript/src/features/trust/services/db.js +1 -1
- package/packages/typescript/src/generated/action-docs.d.ts +93 -15
- package/packages/typescript/src/generated/action-docs.d.ts.map +1 -1
- package/packages/typescript/src/generated/action-docs.js +93 -16
- 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 +4 -0
- package/packages/typescript/src/lifeops-passive-connectors.d.ts +7 -0
- package/packages/typescript/src/lifeops-passive-connectors.d.ts.map +1 -0
- package/packages/typescript/src/lifeops-passive-connectors.js +39 -0
- package/packages/typescript/src/runtime.d.ts +1 -0
- package/packages/typescript/src/runtime.d.ts.map +1 -1
- package/packages/typescript/src/runtime.js +199 -9
- package/packages/typescript/src/services/message.d.ts +7 -0
- package/packages/typescript/src/services/message.d.ts.map +1 -1
- package/packages/typescript/src/services/message.js +222 -25
- package/packages/typescript/src/types/components.d.ts +5 -0
- package/packages/typescript/src/types/components.d.ts.map +1 -1
- package/packages/typescript/src/types/memory.d.ts +2 -1
- package/packages/typescript/src/types/memory.d.ts.map +1 -1
- package/packages/typescript/src/utils/context-catalog.d.ts.map +1 -1
- package/packages/typescript/src/utils/context-catalog.js +124 -14
- package/packages/typescript/src/utils/context-routing.d.ts.map +1 -1
- package/packages/typescript/src/utils/context-routing.js +42 -0
- package/packages/typescript/src/utils/prompt-compression.d.ts +6 -0
- package/packages/typescript/src/utils/prompt-compression.d.ts.map +1 -0
- package/packages/typescript/src/utils/prompt-compression.js +14 -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 +2 -1
- package/packages/ui/src/components/composites/chat/chat-composer-shell.js +1 -1
- package/packages/ui/src/components/composites/sidebar/sidebar-root.js +3 -3
- package/packages/ui/src/components/ui/dialog.js +1 -1
- package/packages/ui/src/components/ui/drawer-sheet.js +1 -1
- package/packages/ui/src/components/ui/themed-select.js +2 -2
- package/packages/ui/src/components/ui/tooltip-extended.js +1 -1
- package/packages/ui/src/components/ui/tooltip.js +1 -1
- package/packages/ui/src/layouts/page-layout/page-layout-mobile-drawer.js +1 -1
- package/packages/ui/src/layouts/workspace-layout/workspace-layout.js +2 -2
- package/plugins/plugin-browser-bridge/src/actions.d.ts +44 -0
- package/plugins/plugin-browser-bridge/src/actions.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/actions.js +234 -0
- package/plugins/plugin-browser-bridge/src/contracts.d.ts +272 -0
- package/plugins/plugin-browser-bridge/src/contracts.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/contracts.js +48 -0
- package/plugins/plugin-browser-bridge/src/index.d.ts +19 -0
- package/plugins/plugin-browser-bridge/src/index.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/index.js +18 -0
- package/plugins/plugin-browser-bridge/src/packaging.d.ts +27 -0
- package/plugins/plugin-browser-bridge/src/packaging.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/packaging.js +503 -0
- package/plugins/plugin-browser-bridge/src/plugin.d.ts +10 -0
- package/plugins/plugin-browser-bridge/src/plugin.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/plugin.js +140 -0
- package/plugins/plugin-browser-bridge/src/routes.d.ts +37 -0
- package/plugins/plugin-browser-bridge/src/routes.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/routes.js +496 -0
- package/plugins/plugin-browser-bridge/src/schema.d.ts +2250 -0
- package/plugins/plugin-browser-bridge/src/schema.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/schema.js +111 -0
- package/plugins/plugin-browser-bridge/src/service.d.ts +28 -0
- package/plugins/plugin-browser-bridge/src/service.d.ts.map +1 -0
- package/plugins/plugin-browser-bridge/src/service.js +1 -0
- package/apps/app-lifeops/src/components/AppBlockerSettingsCard.d.ts +0 -3
- package/apps/app-lifeops/src/components/AppBlockerSettingsCard.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/AppBlockerSettingsCard.js +0 -189
- package/apps/app-lifeops/src/components/BrowserBridgeSetupPanel.d.ts +0 -2
- package/apps/app-lifeops/src/components/BrowserBridgeSetupPanel.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/BrowserBridgeSetupPanel.js +0 -1065
- package/apps/app-lifeops/src/components/BrowserBridgeStatusChip.d.ts +0 -7
- package/apps/app-lifeops/src/components/BrowserBridgeStatusChip.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/BrowserBridgeStatusChip.js +0 -71
- package/apps/app-lifeops/src/components/DataSourcesStrip.d.ts +0 -14
- package/apps/app-lifeops/src/components/DataSourcesStrip.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/DataSourcesStrip.js +0 -36
- package/apps/app-lifeops/src/components/EventEditorDrawer.d.ts +0 -23
- package/apps/app-lifeops/src/components/EventEditorDrawer.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/EventEditorDrawer.js +0 -514
- package/apps/app-lifeops/src/components/LifeOpsActivitySignalsEffect.d.ts +0 -2
- package/apps/app-lifeops/src/components/LifeOpsActivitySignalsEffect.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsActivitySignalsEffect.js +0 -10
- package/apps/app-lifeops/src/components/LifeOpsCalendarSection.d.ts +0 -15
- package/apps/app-lifeops/src/components/LifeOpsCalendarSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsCalendarSection.js +0 -515
- package/apps/app-lifeops/src/components/LifeOpsChatAdapter.d.ts +0 -34
- package/apps/app-lifeops/src/components/LifeOpsChatAdapter.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsChatAdapter.js +0 -175
- package/apps/app-lifeops/src/components/LifeOpsFeatureTogglesSection.d.ts +0 -2
- package/apps/app-lifeops/src/components/LifeOpsFeatureTogglesSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsFeatureTogglesSection.js +0 -99
- package/apps/app-lifeops/src/components/LifeOpsHabitVisuals.d.ts +0 -37
- package/apps/app-lifeops/src/components/LifeOpsHabitVisuals.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsHabitVisuals.js +0 -88
- package/apps/app-lifeops/src/components/LifeOpsInboxSection.d.ts +0 -13
- package/apps/app-lifeops/src/components/LifeOpsInboxSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsInboxSection.js +0 -491
- package/apps/app-lifeops/src/components/LifeOpsLinkBankButton.d.ts +0 -12
- package/apps/app-lifeops/src/components/LifeOpsLinkBankButton.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsLinkBankButton.js +0 -92
- package/apps/app-lifeops/src/components/LifeOpsLinkPaypalButton.d.ts +0 -12
- package/apps/app-lifeops/src/components/LifeOpsLinkPaypalButton.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsLinkPaypalButton.js +0 -160
- package/apps/app-lifeops/src/components/LifeOpsMoneySection.d.ts +0 -3
- package/apps/app-lifeops/src/components/LifeOpsMoneySection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsMoneySection.js +0 -373
- package/apps/app-lifeops/src/components/LifeOpsNavRail.d.ts +0 -9
- package/apps/app-lifeops/src/components/LifeOpsNavRail.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsNavRail.js +0 -93
- package/apps/app-lifeops/src/components/LifeOpsOperationalPanels.d.ts +0 -4
- package/apps/app-lifeops/src/components/LifeOpsOperationalPanels.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsOperationalPanels.js +0 -274
- package/apps/app-lifeops/src/components/LifeOpsOverviewSection.d.ts +0 -7
- package/apps/app-lifeops/src/components/LifeOpsOverviewSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsOverviewSection.js +0 -670
- package/apps/app-lifeops/src/components/LifeOpsPageSections.d.ts +0 -42
- package/apps/app-lifeops/src/components/LifeOpsPageSections.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsPageSections.js +0 -166
- package/apps/app-lifeops/src/components/LifeOpsPageView.d.ts +0 -2
- package/apps/app-lifeops/src/components/LifeOpsPageView.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsPageView.js +0 -566
- package/apps/app-lifeops/src/components/LifeOpsRemindersSection.d.ts +0 -2
- package/apps/app-lifeops/src/components/LifeOpsRemindersSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsRemindersSection.js +0 -749
- package/apps/app-lifeops/src/components/LifeOpsResizableSidebar.d.ts +0 -27
- package/apps/app-lifeops/src/components/LifeOpsResizableSidebar.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsResizableSidebar.js +0 -106
- package/apps/app-lifeops/src/components/LifeOpsScreenTimeSection.d.ts +0 -2
- package/apps/app-lifeops/src/components/LifeOpsScreenTimeSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsScreenTimeSection.js +0 -373
- package/apps/app-lifeops/src/components/LifeOpsSectionContent.d.ts +0 -10
- package/apps/app-lifeops/src/components/LifeOpsSectionContent.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsSectionContent.js +0 -30
- package/apps/app-lifeops/src/components/LifeOpsSelectionContext.d.ts +0 -21
- package/apps/app-lifeops/src/components/LifeOpsSelectionContext.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsSelectionContext.js +0 -30
- package/apps/app-lifeops/src/components/LifeOpsSettingsSection.d.ts +0 -20
- package/apps/app-lifeops/src/components/LifeOpsSettingsSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsSettingsSection.js +0 -598
- package/apps/app-lifeops/src/components/LifeOpsSetupGate.d.ts +0 -13
- package/apps/app-lifeops/src/components/LifeOpsSetupGate.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsSetupGate.js +0 -134
- package/apps/app-lifeops/src/components/LifeOpsSleepSection.d.ts +0 -10
- package/apps/app-lifeops/src/components/LifeOpsSleepSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsSleepSection.js +0 -425
- package/apps/app-lifeops/src/components/LifeOpsWorkspaceShell.d.ts +0 -11
- package/apps/app-lifeops/src/components/LifeOpsWorkspaceShell.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsWorkspaceShell.js +0 -49
- package/apps/app-lifeops/src/components/LifeOpsWorkspaceView.d.ts +0 -2
- package/apps/app-lifeops/src/components/LifeOpsWorkspaceView.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/LifeOpsWorkspaceView.js +0 -1041
- package/apps/app-lifeops/src/components/MessagingConnectorCards.d.ts +0 -7
- package/apps/app-lifeops/src/components/MessagingConnectorCards.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/MessagingConnectorCards.js +0 -643
- package/apps/app-lifeops/src/components/MissingSourceCard.d.ts +0 -9
- package/apps/app-lifeops/src/components/MissingSourceCard.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/MissingSourceCard.js +0 -5
- package/apps/app-lifeops/src/components/MobileSignalsSetupCard.d.ts +0 -2
- package/apps/app-lifeops/src/components/MobileSignalsSetupCard.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/MobileSignalsSetupCard.js +0 -163
- package/apps/app-lifeops/src/components/SleepInspectionPanel.d.ts +0 -8
- package/apps/app-lifeops/src/components/SleepInspectionPanel.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/SleepInspectionPanel.js +0 -59
- package/apps/app-lifeops/src/components/WebsiteBlockerSettingsCard.d.ts +0 -3
- package/apps/app-lifeops/src/components/WebsiteBlockerSettingsCard.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/WebsiteBlockerSettingsCard.js +0 -75
- package/apps/app-lifeops/src/components/WhatsAppQrOverlay.d.ts +0 -8
- package/apps/app-lifeops/src/components/WhatsAppQrOverlay.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/WhatsAppQrOverlay.js +0 -48
- package/apps/app-lifeops/src/components/lifeops-labels.d.ts +0 -2
- package/apps/app-lifeops/src/components/lifeops-labels.d.ts.map +0 -1
- package/apps/app-lifeops/src/components/lifeops-labels.js +0 -5
- package/apps/app-lifeops/src/events/index.d.ts +0 -34
- package/apps/app-lifeops/src/events/index.d.ts.map +0 -1
- package/apps/app-lifeops/src/events/index.js +0 -23
- package/apps/app-lifeops/src/hooks/useCalendarWeek.d.ts +0 -28
- package/apps/app-lifeops/src/hooks/useCalendarWeek.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useCalendarWeek.js +0 -93
- package/apps/app-lifeops/src/hooks/useDiscordConnector.d.ts +0 -14
- package/apps/app-lifeops/src/hooks/useDiscordConnector.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useDiscordConnector.js +0 -126
- package/apps/app-lifeops/src/hooks/useGoogleLifeOpsConnector.d.ts +0 -29
- package/apps/app-lifeops/src/hooks/useGoogleLifeOpsConnector.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useGoogleLifeOpsConnector.js +0 -481
- package/apps/app-lifeops/src/hooks/useIMessageConnector.d.ts +0 -10
- package/apps/app-lifeops/src/hooks/useIMessageConnector.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useIMessageConnector.js +0 -50
- package/apps/app-lifeops/src/hooks/useInbox.d.ts +0 -34
- package/apps/app-lifeops/src/hooks/useInbox.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useInbox.js +0 -98
- package/apps/app-lifeops/src/hooks/useLifeOpsActivitySignals.d.ts +0 -2
- package/apps/app-lifeops/src/hooks/useLifeOpsActivitySignals.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useLifeOpsActivitySignals.js +0 -383
- package/apps/app-lifeops/src/hooks/useLifeOpsAppState.d.ts +0 -9
- package/apps/app-lifeops/src/hooks/useLifeOpsAppState.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useLifeOpsAppState.js +0 -83
- package/apps/app-lifeops/src/hooks/useLifeOpsCapabilitiesStatus.d.ts +0 -8
- package/apps/app-lifeops/src/hooks/useLifeOpsCapabilitiesStatus.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useLifeOpsCapabilitiesStatus.js +0 -60
- package/apps/app-lifeops/src/hooks/useLifeOpsScheduleInspection.d.ts +0 -18
- package/apps/app-lifeops/src/hooks/useLifeOpsScheduleInspection.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useLifeOpsScheduleInspection.js +0 -66
- package/apps/app-lifeops/src/hooks/useLifeOpsScheduleState.d.ts +0 -14
- package/apps/app-lifeops/src/hooks/useLifeOpsScheduleState.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useLifeOpsScheduleState.js +0 -79
- package/apps/app-lifeops/src/hooks/useLifeOpsSection.d.ts +0 -18
- package/apps/app-lifeops/src/hooks/useLifeOpsSection.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useLifeOpsSection.js +0 -78
- package/apps/app-lifeops/src/hooks/useLifeOpsXConnector.d.ts +0 -14
- package/apps/app-lifeops/src/hooks/useLifeOpsXConnector.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useLifeOpsXConnector.js +0 -160
- package/apps/app-lifeops/src/hooks/useSignalConnector.d.ts +0 -16
- package/apps/app-lifeops/src/hooks/useSignalConnector.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useSignalConnector.js +0 -198
- package/apps/app-lifeops/src/hooks/useTelegramConnector.d.ts +0 -21
- package/apps/app-lifeops/src/hooks/useTelegramConnector.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useTelegramConnector.js +0 -177
- package/apps/app-lifeops/src/hooks/useWhatsAppConnector.d.ts +0 -8
- package/apps/app-lifeops/src/hooks/useWhatsAppConnector.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useWhatsAppConnector.js +0 -58
- package/apps/app-lifeops/src/hooks/useWhatsAppPairing.d.ts +0 -12
- package/apps/app-lifeops/src/hooks/useWhatsAppPairing.d.ts.map +0 -1
- package/apps/app-lifeops/src/hooks/useWhatsAppPairing.js +0 -159
- package/apps/app-lifeops/src/lifeops-route.d.ts +0 -74
- package/apps/app-lifeops/src/lifeops-route.d.ts.map +0 -1
- package/apps/app-lifeops/src/lifeops-route.js +0 -204
- package/apps/app-lifeops/src/platform/lifeops-github.d.ts +0 -15
- package/apps/app-lifeops/src/platform/lifeops-github.d.ts.map +0 -1
- package/apps/app-lifeops/src/platform/lifeops-github.js +0 -135
- package/apps/app-lifeops/src/types/app-blocker-settings-card.d.ts +0 -2
- package/apps/app-lifeops/src/types/app-blocker-settings-card.d.ts.map +0 -1
- package/apps/app-lifeops/src/types/app-blocker-settings-card.js +0 -1
- package/apps/app-lifeops/src/types/index.d.ts +0 -3
- package/apps/app-lifeops/src/types/index.d.ts.map +0 -1
- package/apps/app-lifeops/src/types/index.js +0 -1
- package/apps/app-lifeops/src/types/website-blocker-settings-card.d.ts +0 -2
- package/apps/app-lifeops/src/types/website-blocker-settings-card.d.ts.map +0 -1
- package/apps/app-lifeops/src/types/website-blocker-settings-card.js +0 -1
- package/apps/app-lifeops/src/ui.d.ts +0 -11
- package/apps/app-lifeops/src/ui.d.ts.map +0 -1
- package/apps/app-lifeops/src/ui.js +0 -9
- package/apps/app-lifeops/src/utils/lifeops-url.d.ts +0 -5
- package/apps/app-lifeops/src/utils/lifeops-url.d.ts.map +0 -1
- package/apps/app-lifeops/src/utils/lifeops-url.js +0 -35
- package/packages/native-plugins/mobile-signals/src/definitions.d.ts +0 -162
- package/packages/native-plugins/mobile-signals/src/definitions.d.ts.map +0 -1
- package/packages/native-plugins/mobile-signals/src/definitions.js +0 -1
- package/packages/native-plugins/mobile-signals/src/index.d.ts +0 -4
- package/packages/native-plugins/mobile-signals/src/index.d.ts.map +0 -1
- package/packages/native-plugins/mobile-signals/src/index.js +0 -6
- package/packages/native-plugins/mobile-signals/src/web.d.ts +0 -29
- package/packages/native-plugins/mobile-signals/src/web.d.ts.map +0 -1
- package/packages/native-plugins/mobile-signals/src/web.js +0 -269
|
@@ -0,0 +1,938 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AOSP-only loader for native llama.cpp via `bun:ffi`.
|
|
3
|
+
*
|
|
4
|
+
* Targets the apothic/llama.cpp-1bit-turboquant fork (commit
|
|
5
|
+
* https://github.com/Apothic-AI/llama.cpp-1bit-turboquant
|
|
6
|
+
* tag: main-b8198-b2b5273
|
|
7
|
+
* sha: b2b5273e8b275bb96362fe844a5202632eb3e52b
|
|
8
|
+
* — the matching libllama.so is compiled by the AOSP build pipeline
|
|
9
|
+
* against this same SHA via `scripts/miladyos/compile-libllama.mjs`).
|
|
10
|
+
*
|
|
11
|
+
* Why this fork (was stock llama.cpp b4500 before):
|
|
12
|
+
* apothic's fork adds two GGML quant types (TBQ3_0 = 43, TBQ4_0 = 44)
|
|
13
|
+
* for KV-cache compression, with CPU implementations under
|
|
14
|
+
* `ggml/src/ggml-cpu/quants.c` + `ggml/src/ggml-cpu/ggml-cpu.c`.
|
|
15
|
+
* block_tbq3_0 packs 32 floats into 14 bytes (vs 64 bytes for fp16) —
|
|
16
|
+
* ~4.6x KV-cache memory reduction. KV cache dominates phone-RAM
|
|
17
|
+
* pressure at long contexts, so this is the difference between Bonsai
|
|
18
|
+
* "loads but OOMs after 1k tokens" and "loads and chats". The matching
|
|
19
|
+
* Bonsai-8B-1bit GGUF on Hugging Face is trained against this fork.
|
|
20
|
+
*
|
|
21
|
+
* The fork is based on llama.cpp b8198 (much newer than b4500), so it
|
|
22
|
+
* inherits the post-2024 sampler-chain API
|
|
23
|
+
* (`llama_sampler_chain_init`, `llama_sampler_init_greedy`, etc.) and
|
|
24
|
+
* the renamed model/vocab API (`llama_model_load_from_file`,
|
|
25
|
+
* `llama_init_from_model`, `llama_model_get_vocab`, `llama_vocab_eos`,
|
|
26
|
+
* `llama_vocab_is_eog`) AND the embedding helpers
|
|
27
|
+
* (`llama_set_embeddings`, `llama_get_embeddings_seq`,
|
|
28
|
+
* `llama_model_n_embd`).
|
|
29
|
+
*
|
|
30
|
+
* Drift since the b4500 pin handled in the shim:
|
|
31
|
+
* - llama_context_params.flash_attn (bool) → flash_attn_type (enum);
|
|
32
|
+
* shim removed the bool setter (the adapter never called it).
|
|
33
|
+
* - llama_context_params adds type_k / type_v / samplers / kv_unified;
|
|
34
|
+
* shim now exposes set_type_k / set_type_v for TBQ KV-cache wiring
|
|
35
|
+
* (driven by `kvCacheType` in the adapter LoadOptions, with
|
|
36
|
+
* Bonsai-by-filename auto-detection as a default).
|
|
37
|
+
*
|
|
38
|
+
* Symbols pinned for reference:
|
|
39
|
+
* libllama.so (dlopen'd first):
|
|
40
|
+
* - llama_backend_init / llama_backend_free
|
|
41
|
+
* - llama_model_free / llama_free
|
|
42
|
+
* - llama_model_get_vocab / llama_vocab_eos / llama_vocab_is_eog
|
|
43
|
+
* - llama_tokenize / llama_token_to_piece
|
|
44
|
+
* - llama_sampler_chain_add / llama_sampler_init_temp /
|
|
45
|
+
* llama_sampler_init_top_p / llama_sampler_init_dist /
|
|
46
|
+
* llama_sampler_init_greedy / llama_sampler_sample /
|
|
47
|
+
* llama_sampler_accept / llama_sampler_free
|
|
48
|
+
* - llama_get_model / llama_n_ctx / llama_model_n_embd
|
|
49
|
+
* - llama_set_embeddings / llama_get_embeddings_seq / llama_get_embeddings
|
|
50
|
+
* libmilady-llama-shim.so (dlopen'd second; NEEDED libllama.so):
|
|
51
|
+
* - milady_llama_model_params_default / *_free + per-field setters
|
|
52
|
+
* - milady_llama_model_load_from_file
|
|
53
|
+
* - milady_llama_context_params_default / *_free + per-field setters
|
|
54
|
+
* - milady_llama_init_from_model
|
|
55
|
+
* - milady_llama_sampler_chain_params_default / *_free
|
|
56
|
+
* - milady_llama_sampler_chain_init
|
|
57
|
+
* - milady_llama_batch_get_one / milady_llama_batch_free
|
|
58
|
+
* - milady_llama_decode
|
|
59
|
+
*
|
|
60
|
+
* Struct-by-value handled via libmilady-llama-shim.so (NEEDED-links
|
|
61
|
+
* libllama.so, ships in the same per-ABI asset dir). bun:ffi cannot pass
|
|
62
|
+
* llama.cpp's by-value param structs (model_params, context_params,
|
|
63
|
+
* sampler_chain_params) directly. The shim — built by
|
|
64
|
+
* `scripts/miladyos/compile-libllama.mjs` from
|
|
65
|
+
* `scripts/miladyos/llama-shim/milady_llama_shim.c` — exposes a
|
|
66
|
+
* pointer-style API: `milady_llama_model_params_default()` returns a
|
|
67
|
+
* malloc'd pointer initialized via `llama_model_default_params()`, then
|
|
68
|
+
* field-by-field setters override the few values the adapter cares about
|
|
69
|
+
* (n_gpu_layers, use_mmap, use_mlock, n_threads, n_ctx, etc.) before the
|
|
70
|
+
* pointer is handed to `milady_llama_model_load_from_file()` /
|
|
71
|
+
* `milady_llama_init_from_model()` / `milady_llama_sampler_chain_init()`,
|
|
72
|
+
* each of which dereferences once into the real struct-by-value entry
|
|
73
|
+
* point. This restores the canonical defaults — most importantly
|
|
74
|
+
* model_params.use_mmap = true (was clobbered to false by the previous
|
|
75
|
+
* zeroed-buffer workaround, which forced the loader to read entire
|
|
76
|
+
* weights files into RAM on phones).
|
|
77
|
+
*
|
|
78
|
+
* Wired in via `ensure-local-inference-handler.ts`:
|
|
79
|
+
* - Trigger: `MILADY_LOCAL_LLAMA=1` in the AOSP agent process env.
|
|
80
|
+
* - Slot: `localInferenceLoader` runtime service (LocalInferenceLoader contract).
|
|
81
|
+
* - Selection precedence: this loader is registered BEFORE the Capacitor
|
|
82
|
+
* adapter so AOSP builds always pick the in-process FFI path.
|
|
83
|
+
*
|
|
84
|
+
* On a non-AOSP build that accidentally sets the env, this module logs and
|
|
85
|
+
* returns false from `registerAospLlamaLoader`. It does not throw at module
|
|
86
|
+
* load — bundlers must be able to statically import it on every platform.
|
|
87
|
+
*/
|
|
88
|
+
import { existsSync } from "node:fs";
|
|
89
|
+
import path from "node:path";
|
|
90
|
+
import { logger } from "@elizaos/core";
|
|
91
|
+
/**
|
|
92
|
+
* Pooling type values from llama.h b4500. We always materialize the AOSP
|
|
93
|
+
* context with `MEAN` pooling so `llama_get_embeddings_seq(ctx, 0)` returns
|
|
94
|
+
* exactly `n_embd` floats — the sequence buffer is sized by pooling type,
|
|
95
|
+
* and `NONE` would shape it as `n_outputs * n_embd` where `n_outputs <
|
|
96
|
+
* written` for output-pruning models, leading to a read-OOB on the
|
|
97
|
+
* mean-pool fallback path. By forcing MEAN at init we collapse two code
|
|
98
|
+
* paths into one and remove the OOB risk entirely.
|
|
99
|
+
*/
|
|
100
|
+
const LLAMA_POOLING_TYPE_MEAN = 1;
|
|
101
|
+
/**
|
|
102
|
+
* GGML type ids used for KV-cache configuration. The base set comes from
|
|
103
|
+
* ggml.h; TBQ3_0 / TBQ4_0 are the apothic/llama.cpp-1bit-turboquant fork
|
|
104
|
+
* additions and only valid against the fork-built libllama.so + matching
|
|
105
|
+
* Bonsai-8B-1bit GGUF model.
|
|
106
|
+
*
|
|
107
|
+
* Verified against
|
|
108
|
+
* ~/.cache/milady-android-agent/llama-cpp-main-b8198-b2b5273/ggml/include/ggml.h
|
|
109
|
+
* (lines 420-435 — Q1_0 = 42 sits next to TBQ3_0 = 43, TBQ4_0 = 44).
|
|
110
|
+
*/
|
|
111
|
+
const GGML_TYPE_F16 = 1;
|
|
112
|
+
const GGML_TYPE_TBQ3_0 = 43;
|
|
113
|
+
const GGML_TYPE_TBQ4_0 = 44;
|
|
114
|
+
export function kvCacheTypeNameToEnum(name) {
|
|
115
|
+
switch (name) {
|
|
116
|
+
case "f16":
|
|
117
|
+
return GGML_TYPE_F16;
|
|
118
|
+
case "tbq3_0":
|
|
119
|
+
return GGML_TYPE_TBQ3_0;
|
|
120
|
+
case "tbq4_0":
|
|
121
|
+
return GGML_TYPE_TBQ4_0;
|
|
122
|
+
default: {
|
|
123
|
+
// Exhaustive switch — fall here only if a future type is added without
|
|
124
|
+
// updating the map. Throw with the offending name so a future caller
|
|
125
|
+
// doesn't silently get f16.
|
|
126
|
+
const exhaustive = name;
|
|
127
|
+
throw new Error(`[aosp-llama] Unknown KV cache type: ${exhaustive}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Auto-detect when a model path indicates a Bonsai 1-bit TurboQuant build,
|
|
133
|
+
* which is the only model in the curated catalog that's trained against
|
|
134
|
+
* the fork's TBQ KV-cache codec. Match is intentionally loose
|
|
135
|
+
* (case-insensitive substring) because users may rename downloaded GGUFs.
|
|
136
|
+
*
|
|
137
|
+
* The Hugging Face repo is `apothic/bonsai-8B-1bit-turboquant` and ships
|
|
138
|
+
* `models/gguf/8B/Bonsai-8B.gguf`; downloads pass that filename through
|
|
139
|
+
* verbatim by default, so a "Bonsai" basename match is the right hook.
|
|
140
|
+
*
|
|
141
|
+
* Exported for unit tests.
|
|
142
|
+
*/
|
|
143
|
+
export function looksLikeBonsai(modelPath) {
|
|
144
|
+
const base = modelPath.split(/[/\\]/).pop() ?? modelPath;
|
|
145
|
+
return /bonsai/i.test(base);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Read a `KvCacheTypeName` from an env var, returning undefined when the var
|
|
149
|
+
* is unset, blank, or not a recognised type name. Recognised values are
|
|
150
|
+
* exactly `"f16"`, `"tbq3_0"`, `"tbq4_0"` (case-insensitive). An unrecognised
|
|
151
|
+
* value logs a warning and returns undefined rather than throwing — env-var
|
|
152
|
+
* typos shouldn't crash the loader.
|
|
153
|
+
*
|
|
154
|
+
* Exported for unit tests.
|
|
155
|
+
*/
|
|
156
|
+
export function readEnvKvCacheType(name, env = process.env) {
|
|
157
|
+
const raw = env[name]?.trim().toLowerCase();
|
|
158
|
+
if (!raw)
|
|
159
|
+
return undefined;
|
|
160
|
+
if (raw === "f16" || raw === "tbq3_0" || raw === "tbq4_0") {
|
|
161
|
+
return raw;
|
|
162
|
+
}
|
|
163
|
+
logger.warn(`[aosp-llama] ${name}=${raw} is not a recognised KV cache type; ignoring (use f16 / tbq3_0 / tbq4_0).`);
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Resolve the KV-cache type to use for a given load. Precedence:
|
|
168
|
+
* 1. Explicit `LoadOptions.kvCacheType.{k,v}` (highest priority).
|
|
169
|
+
* 2. `MILADY_LLAMA_CACHE_TYPE_K` / `MILADY_LLAMA_CACHE_TYPE_V` env vars.
|
|
170
|
+
* 3. Auto-detection: Bonsai-by-filename → `{ k: "tbq4_0", v: "tbq3_0" }`
|
|
171
|
+
* (matches the model card recommendation).
|
|
172
|
+
* 4. Otherwise undefined — the shim leaves the cache at llama.cpp's fp16
|
|
173
|
+
* default, which is the safe choice for any non-Bonsai GGUF.
|
|
174
|
+
*
|
|
175
|
+
* Returns `undefined` when no override applies, so the caller can skip the
|
|
176
|
+
* shim setters entirely (smaller diff to upstream behaviour, easier to
|
|
177
|
+
* reason about in logs).
|
|
178
|
+
*
|
|
179
|
+
* Exported for unit tests.
|
|
180
|
+
*/
|
|
181
|
+
export function resolveKvCacheType(modelPath, override, env = process.env) {
|
|
182
|
+
const explicitK = override?.k;
|
|
183
|
+
const explicitV = override?.v;
|
|
184
|
+
const envK = readEnvKvCacheType("MILADY_LLAMA_CACHE_TYPE_K", env);
|
|
185
|
+
const envV = readEnvKvCacheType("MILADY_LLAMA_CACHE_TYPE_V", env);
|
|
186
|
+
// Auto-detection only kicks in when neither an explicit override nor an
|
|
187
|
+
// env override is set. Catalog blurb references this contract directly —
|
|
188
|
+
// change here = update catalog.ts blurb in the same commit.
|
|
189
|
+
const auto = looksLikeBonsai(modelPath)
|
|
190
|
+
? { k: "tbq4_0", v: "tbq3_0" }
|
|
191
|
+
: undefined;
|
|
192
|
+
const k = explicitK ?? envK ?? auto?.k;
|
|
193
|
+
const v = explicitV ?? envV ?? auto?.v;
|
|
194
|
+
if (k === undefined && v === undefined)
|
|
195
|
+
return undefined;
|
|
196
|
+
return { k, v };
|
|
197
|
+
}
|
|
198
|
+
const SERVICE_NAME = "localInferenceLoader";
|
|
199
|
+
function isAospEnabled(env = process.env) {
|
|
200
|
+
return env.MILADY_LOCAL_LLAMA?.trim() === "1";
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Read a non-negative integer env override, falling back to `fallback`
|
|
204
|
+
* when the variable is unset, blank, or not parseable. Negative values
|
|
205
|
+
* are clamped to the fallback to avoid passing an int32-min into the
|
|
206
|
+
* shim setters.
|
|
207
|
+
*/
|
|
208
|
+
function readEnvInt(name, fallback) {
|
|
209
|
+
const raw = process.env[name]?.trim();
|
|
210
|
+
if (!raw)
|
|
211
|
+
return fallback;
|
|
212
|
+
const parsed = Number.parseInt(raw, 10);
|
|
213
|
+
if (!Number.isFinite(parsed) || parsed < 0)
|
|
214
|
+
return fallback;
|
|
215
|
+
return parsed;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Resolve the libllama.so path for the current ABI. The AOSP agent process
|
|
219
|
+
* runs with `cwd = <agent_root>`; the Java side unpacks `agent/{abi}/libllama.so`
|
|
220
|
+
* alongside the bun runtime and matching shared libraries.
|
|
221
|
+
*
|
|
222
|
+
* Exported for unit tests so we can verify ABI mapping without dlopen.
|
|
223
|
+
*/
|
|
224
|
+
export function resolveLibllamaPath(arch = process.arch, cwd = process.cwd()) {
|
|
225
|
+
return path.join(resolveAbiDir(arch, cwd), "libllama.so");
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Resolve the libmilady-llama-shim.so path for the current ABI. Lives in
|
|
229
|
+
* the same per-ABI dir as libllama.so; the dynamic linker resolves the
|
|
230
|
+
* shim's NEEDED libllama.so via LD_LIBRARY_PATH.
|
|
231
|
+
*
|
|
232
|
+
* Exported for unit tests.
|
|
233
|
+
*/
|
|
234
|
+
export function resolveLlamaShimPath(arch = process.arch, cwd = process.cwd()) {
|
|
235
|
+
return path.join(resolveAbiDir(arch, cwd), "libmilady-llama-shim.so");
|
|
236
|
+
}
|
|
237
|
+
function resolveAbiDir(arch, cwd) {
|
|
238
|
+
const abiDir = arch === "arm64" ? "arm64-v8a" : arch === "x64" ? "x86_64" : null;
|
|
239
|
+
if (abiDir === null) {
|
|
240
|
+
throw new Error(`[aosp-llama] Unsupported process.arch for AOSP build: ${arch}`);
|
|
241
|
+
}
|
|
242
|
+
return path.join(cwd, abiDir);
|
|
243
|
+
}
|
|
244
|
+
async function loadBunFfi() {
|
|
245
|
+
// Dynamic import keeps non-Bun bundlers from failing on the bare specifier.
|
|
246
|
+
// The AOSP runtime is Bun, so this resolves; on Vitest/Node it throws and
|
|
247
|
+
// the adapter degrades to a logged failure rather than crashing the boot.
|
|
248
|
+
// We surface the real error so AOSP-only debugging on Android can see the
|
|
249
|
+
// root cause instead of the generic "bun:ffi unavailable" message.
|
|
250
|
+
try {
|
|
251
|
+
/* Deliberate boundary cast: the real bun:ffi typings define dlopen
|
|
252
|
+
* with a generic `Fns extends Record<string, FFIFunction>` constraint
|
|
253
|
+
* we don't want leaking into adapter types; we only consume the
|
|
254
|
+
* weakly-typed runtime shape. */
|
|
255
|
+
const mod = (await import("bun:ffi"));
|
|
256
|
+
return { ok: true, mod };
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
return {
|
|
260
|
+
ok: false,
|
|
261
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function dlopenLlama(ffi, libPath) {
|
|
266
|
+
const T = ffi.FFIType;
|
|
267
|
+
const handle = ffi.dlopen(libPath, {
|
|
268
|
+
llama_backend_init: { args: [], returns: T.void },
|
|
269
|
+
llama_backend_free: { args: [], returns: T.void },
|
|
270
|
+
llama_model_free: { args: [T.ptr], returns: T.void },
|
|
271
|
+
llama_free: { args: [T.ptr], returns: T.void },
|
|
272
|
+
llama_get_model: { args: [T.ptr], returns: T.ptr },
|
|
273
|
+
llama_model_get_vocab: { args: [T.ptr], returns: T.ptr },
|
|
274
|
+
llama_model_n_embd: { args: [T.ptr], returns: T.i32 },
|
|
275
|
+
llama_n_ctx: { args: [T.ptr], returns: T.u32 },
|
|
276
|
+
llama_vocab_eos: { args: [T.ptr], returns: T.i32 },
|
|
277
|
+
llama_vocab_is_eog: { args: [T.ptr, T.i32], returns: T.bool },
|
|
278
|
+
llama_set_embeddings: { args: [T.ptr, T.bool], returns: T.void },
|
|
279
|
+
llama_get_embeddings_seq: { args: [T.ptr, T.i32], returns: T.ptr },
|
|
280
|
+
llama_get_embeddings: { args: [T.ptr], returns: T.ptr },
|
|
281
|
+
llama_get_memory: { args: [T.ptr], returns: T.ptr },
|
|
282
|
+
llama_memory_clear: { args: [T.ptr, T.bool], returns: T.void },
|
|
283
|
+
llama_tokenize: {
|
|
284
|
+
args: [T.ptr, T.ptr, T.i32, T.ptr, T.i32, T.bool, T.bool],
|
|
285
|
+
returns: T.i32,
|
|
286
|
+
},
|
|
287
|
+
llama_token_to_piece: {
|
|
288
|
+
args: [T.ptr, T.i32, T.ptr, T.i32, T.i32, T.bool],
|
|
289
|
+
returns: T.i32,
|
|
290
|
+
},
|
|
291
|
+
// Skip llama_batch_get_one / llama_decode — see LlamaSymbols comment.
|
|
292
|
+
// The pointer-style wrappers in ShimSymbols are bound below.
|
|
293
|
+
llama_sampler_chain_add: { args: [T.ptr, T.ptr], returns: T.void },
|
|
294
|
+
llama_sampler_init_temp: { args: [T.f32], returns: T.ptr },
|
|
295
|
+
llama_sampler_init_top_p: { args: [T.f32, T.u32], returns: T.ptr },
|
|
296
|
+
llama_sampler_init_dist: { args: [T.u32], returns: T.ptr },
|
|
297
|
+
llama_sampler_init_greedy: { args: [], returns: T.ptr },
|
|
298
|
+
llama_sampler_sample: { args: [T.ptr, T.ptr, T.i32], returns: T.i32 },
|
|
299
|
+
llama_sampler_accept: { args: [T.ptr, T.i32], returns: T.void },
|
|
300
|
+
llama_sampler_free: { args: [T.ptr], returns: T.void },
|
|
301
|
+
});
|
|
302
|
+
/* Deliberate boundary cast: bun:ffi.dlopen returns weakly-typed callable map */
|
|
303
|
+
return handle.symbols;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* dlopen libmilady-llama-shim.so and bind the pointer-style wrappers
|
|
307
|
+
* around llama.cpp's struct-by-value entry points. The shim NEEDED-links
|
|
308
|
+
* libllama.so, so libllama.so MUST already be loaded (via the earlier
|
|
309
|
+
* `dlopenLlama` call) or resolvable through LD_LIBRARY_PATH before this
|
|
310
|
+
* runs. On Android both conditions are satisfied — MiladyAgentService.java
|
|
311
|
+
* sets LD_LIBRARY_PATH to the per-ABI asset dir, and we always dlopen
|
|
312
|
+
* libllama.so first.
|
|
313
|
+
*/
|
|
314
|
+
function dlopenShim(ffi, shimPath) {
|
|
315
|
+
const T = ffi.FFIType;
|
|
316
|
+
const handle = ffi.dlopen(shimPath, {
|
|
317
|
+
milady_llama_model_params_default: { args: [], returns: T.ptr },
|
|
318
|
+
milady_llama_model_params_free: { args: [T.ptr], returns: T.void },
|
|
319
|
+
milady_llama_model_params_set_n_gpu_layers: {
|
|
320
|
+
args: [T.ptr, T.i32],
|
|
321
|
+
returns: T.void,
|
|
322
|
+
},
|
|
323
|
+
milady_llama_model_load_from_file: {
|
|
324
|
+
args: [T.ptr, T.ptr],
|
|
325
|
+
returns: T.ptr,
|
|
326
|
+
},
|
|
327
|
+
milady_llama_context_params_default: { args: [], returns: T.ptr },
|
|
328
|
+
milady_llama_context_params_free: { args: [T.ptr], returns: T.void },
|
|
329
|
+
milady_llama_context_params_set_n_ctx: {
|
|
330
|
+
args: [T.ptr, T.u32],
|
|
331
|
+
returns: T.void,
|
|
332
|
+
},
|
|
333
|
+
milady_llama_context_params_set_n_batch: {
|
|
334
|
+
args: [T.ptr, T.u32],
|
|
335
|
+
returns: T.void,
|
|
336
|
+
},
|
|
337
|
+
milady_llama_context_params_set_n_ubatch: {
|
|
338
|
+
args: [T.ptr, T.u32],
|
|
339
|
+
returns: T.void,
|
|
340
|
+
},
|
|
341
|
+
milady_llama_context_params_set_n_threads: {
|
|
342
|
+
args: [T.ptr, T.i32],
|
|
343
|
+
returns: T.void,
|
|
344
|
+
},
|
|
345
|
+
milady_llama_context_params_set_n_threads_batch: {
|
|
346
|
+
args: [T.ptr, T.i32],
|
|
347
|
+
returns: T.void,
|
|
348
|
+
},
|
|
349
|
+
milady_llama_context_params_set_embeddings: {
|
|
350
|
+
args: [T.ptr, T.bool],
|
|
351
|
+
returns: T.void,
|
|
352
|
+
},
|
|
353
|
+
milady_llama_context_params_set_pooling_type: {
|
|
354
|
+
args: [T.ptr, T.i32],
|
|
355
|
+
returns: T.void,
|
|
356
|
+
},
|
|
357
|
+
milady_llama_context_params_set_type_k: {
|
|
358
|
+
args: [T.ptr, T.i32],
|
|
359
|
+
returns: T.void,
|
|
360
|
+
},
|
|
361
|
+
milady_llama_context_params_set_type_v: {
|
|
362
|
+
args: [T.ptr, T.i32],
|
|
363
|
+
returns: T.void,
|
|
364
|
+
},
|
|
365
|
+
milady_llama_init_from_model: { args: [T.ptr, T.ptr], returns: T.ptr },
|
|
366
|
+
milady_llama_sampler_chain_params_default: { args: [], returns: T.ptr },
|
|
367
|
+
milady_llama_sampler_chain_params_free: {
|
|
368
|
+
args: [T.ptr],
|
|
369
|
+
returns: T.void,
|
|
370
|
+
},
|
|
371
|
+
milady_llama_sampler_chain_init: { args: [T.ptr], returns: T.ptr },
|
|
372
|
+
milady_llama_batch_get_one: {
|
|
373
|
+
args: [T.ptr, T.i32],
|
|
374
|
+
returns: T.ptr,
|
|
375
|
+
},
|
|
376
|
+
milady_llama_batch_free: { args: [T.ptr], returns: T.void },
|
|
377
|
+
milady_llama_decode: { args: [T.ptr, T.ptr], returns: T.i32 },
|
|
378
|
+
});
|
|
379
|
+
/* Deliberate boundary cast: bun:ffi.dlopen returns weakly-typed callable map */
|
|
380
|
+
return handle.symbols;
|
|
381
|
+
}
|
|
382
|
+
function encodeCString(text) {
|
|
383
|
+
const enc = new TextEncoder().encode(text);
|
|
384
|
+
const buf = new Uint8Array(enc.length + 1);
|
|
385
|
+
buf.set(enc, 0);
|
|
386
|
+
buf[enc.length] = 0;
|
|
387
|
+
return buf;
|
|
388
|
+
}
|
|
389
|
+
class AospLlamaAdapter {
|
|
390
|
+
ffi;
|
|
391
|
+
sym;
|
|
392
|
+
shim;
|
|
393
|
+
model = null;
|
|
394
|
+
ctx = null;
|
|
395
|
+
vocab = null;
|
|
396
|
+
nCtx = 0;
|
|
397
|
+
loadedPath = null;
|
|
398
|
+
backendInitialized = false;
|
|
399
|
+
/**
|
|
400
|
+
* Tracks whether the current ctx has had at least one successful
|
|
401
|
+
* `llama_decode` call. `llama_memory_clear` segfaults on cuttlefish
|
|
402
|
+
* x86_64 when called against a freshly-initialized ctx with no
|
|
403
|
+
* decoded positions, so we only invoke it once we know the KV cache
|
|
404
|
+
* has live state to wipe. Reset to `false` on every `loadModel` /
|
|
405
|
+
* `unloadModel`.
|
|
406
|
+
*/
|
|
407
|
+
hasDecoded = false;
|
|
408
|
+
constructor(ffi, sym, shim) {
|
|
409
|
+
this.ffi = ffi;
|
|
410
|
+
this.sym = sym;
|
|
411
|
+
this.shim = shim;
|
|
412
|
+
}
|
|
413
|
+
ensureBackend() {
|
|
414
|
+
if (this.backendInitialized)
|
|
415
|
+
return;
|
|
416
|
+
this.sym.llama_backend_init();
|
|
417
|
+
this.backendInitialized = true;
|
|
418
|
+
}
|
|
419
|
+
currentModelPath() {
|
|
420
|
+
return this.loadedPath;
|
|
421
|
+
}
|
|
422
|
+
async loadModel(args) {
|
|
423
|
+
this.ensureBackend();
|
|
424
|
+
if (this.loadedPath === args.modelPath && this.ctx !== null)
|
|
425
|
+
return;
|
|
426
|
+
if (this.ctx !== null || this.model !== null) {
|
|
427
|
+
await this.unloadModel();
|
|
428
|
+
}
|
|
429
|
+
// Resolve runtime tunables. The active-model coordinator only forwards
|
|
430
|
+
// `{ modelPath }` today, so we backfill from env so AOSP doesn't run at
|
|
431
|
+
// upstream defaults that under-use phone CPU cores.
|
|
432
|
+
const contextSize = args.contextSize ?? readEnvInt("MILADY_LLAMA_N_CTX", 8192);
|
|
433
|
+
const maxThreads = args.maxThreads ?? readEnvInt("MILADY_LLAMA_THREADS", 0);
|
|
434
|
+
const useGpu = args.useGpu ?? false;
|
|
435
|
+
const kvCacheType = resolveKvCacheType(args.modelPath, args.kvCacheType);
|
|
436
|
+
// Materialize llama_model_params via the shim. The shim runs
|
|
437
|
+
// llama_model_default_params() under the hood, so use_mmap=true,
|
|
438
|
+
// use_mlock=false, n_gpu_layers=999 (or whatever upstream's defaults
|
|
439
|
+
// are at the pinned tag) all land correctly. We pin n_gpu_layers=0
|
|
440
|
+
// explicitly when the caller opts out of GPU so the value is
|
|
441
|
+
// self-documenting in logs even though it matches the AOSP default.
|
|
442
|
+
const modelParamsPtr = this.shim.milady_llama_model_params_default();
|
|
443
|
+
if (!modelParamsPtr) {
|
|
444
|
+
throw new Error("[aosp-llama] milady_llama_model_params_default returned NULL (malloc failure?)");
|
|
445
|
+
}
|
|
446
|
+
let modelPtr = 0;
|
|
447
|
+
try {
|
|
448
|
+
if (!useGpu) {
|
|
449
|
+
this.shim.milady_llama_model_params_set_n_gpu_layers(modelParamsPtr, 0);
|
|
450
|
+
}
|
|
451
|
+
const pathBuf = encodeCString(args.modelPath);
|
|
452
|
+
modelPtr = this.shim.milady_llama_model_load_from_file(this.ffi.ptr(pathBuf), modelParamsPtr);
|
|
453
|
+
}
|
|
454
|
+
finally {
|
|
455
|
+
this.shim.milady_llama_model_params_free(modelParamsPtr);
|
|
456
|
+
}
|
|
457
|
+
if (!modelPtr) {
|
|
458
|
+
throw new Error(`[aosp-llama] llama_model_load_from_file returned NULL for ${args.modelPath}`);
|
|
459
|
+
}
|
|
460
|
+
const ctxParamsPtr = this.shim.milady_llama_context_params_default();
|
|
461
|
+
if (!ctxParamsPtr) {
|
|
462
|
+
this.sym.llama_model_free(modelPtr);
|
|
463
|
+
throw new Error("[aosp-llama] milady_llama_context_params_default returned NULL (malloc failure?)");
|
|
464
|
+
}
|
|
465
|
+
let ctxPtr = 0;
|
|
466
|
+
try {
|
|
467
|
+
// Override the canonical defaults for the few fields that actually
|
|
468
|
+
// matter on phones:
|
|
469
|
+
// - n_ctx: cap the context window (defaults to 0 = "from model"
|
|
470
|
+
// which can be huge on Llama-3-8B GGUFs and OOMs the device).
|
|
471
|
+
// - n_threads / n_threads_batch: parallelize generation + batch
|
|
472
|
+
// decode across the user's CPU cores. n_threads is on
|
|
473
|
+
// context_params (verified against b4500 llama.h:319-320),
|
|
474
|
+
// NOT model_params.
|
|
475
|
+
// - embeddings: leave the runtime toggle (`llama_set_embeddings`)
|
|
476
|
+
// to flip this per-call, but pre-allocate the buffers at init
|
|
477
|
+
// so the first embed() call doesn't pay an allocation tax.
|
|
478
|
+
// - pooling_type: pin to MEAN so `llama_get_embeddings_seq(ctx, 0)`
|
|
479
|
+
// always returns exactly `n_embd` floats. NONE would shape the
|
|
480
|
+
// ctx buffer as `n_outputs * n_embd` where n_outputs can be
|
|
481
|
+
// less than the input token count for output-pruning models —
|
|
482
|
+
// we'd read OOB on the mean-pool fallback. By forcing MEAN at
|
|
483
|
+
// init we collapse the embed() path to a single read.
|
|
484
|
+
this.shim.milady_llama_context_params_set_n_ctx(ctxParamsPtr, contextSize);
|
|
485
|
+
// n_batch = 2048: the per-decode token cap. We chunk longer prompts
|
|
486
|
+
// in the decode loop. Setting this to n_ctx makes the worst-case
|
|
487
|
+
// compute graph allocate ~1.85 GiB (8192 ubatch on a 360M model)
|
|
488
|
+
// which both wedges the bun event loop long enough to trip the
|
|
489
|
+
// service watchdog and pushes phone RAM over budget.
|
|
490
|
+
// n_ubatch = 512: upstream default, matches phone CPU cache.
|
|
491
|
+
const nBatchParam = readEnvInt("MILADY_LLAMA_N_BATCH", 2048);
|
|
492
|
+
const nUBatchParam = readEnvInt("MILADY_LLAMA_N_UBATCH", 512);
|
|
493
|
+
this.shim.milady_llama_context_params_set_n_batch(ctxParamsPtr, nBatchParam);
|
|
494
|
+
this.shim.milady_llama_context_params_set_n_ubatch(ctxParamsPtr, nUBatchParam);
|
|
495
|
+
this.shim.milady_llama_context_params_set_n_threads(ctxParamsPtr, maxThreads);
|
|
496
|
+
this.shim.milady_llama_context_params_set_n_threads_batch(ctxParamsPtr, maxThreads);
|
|
497
|
+
this.shim.milady_llama_context_params_set_embeddings(ctxParamsPtr, true);
|
|
498
|
+
this.shim.milady_llama_context_params_set_pooling_type(ctxParamsPtr, LLAMA_POOLING_TYPE_MEAN);
|
|
499
|
+
// KV-cache type override (TBQ for Bonsai, fp16 default for everything
|
|
500
|
+
// else). When kvCacheType.k / .v are set we forward the resolved
|
|
501
|
+
// ggml_type enum to the shim setters; otherwise we leave the cache at
|
|
502
|
+
// llama.cpp's canonical default. Only the apothic fork-built libllama.so
|
|
503
|
+
// understands TBQ3_0 / TBQ4_0 — using these against stock llama.cpp
|
|
504
|
+
// would crash inside type_traits lookup.
|
|
505
|
+
if (kvCacheType?.k !== undefined) {
|
|
506
|
+
this.shim.milady_llama_context_params_set_type_k(ctxParamsPtr, kvCacheTypeNameToEnum(kvCacheType.k));
|
|
507
|
+
}
|
|
508
|
+
if (kvCacheType?.v !== undefined) {
|
|
509
|
+
this.shim.milady_llama_context_params_set_type_v(ctxParamsPtr, kvCacheTypeNameToEnum(kvCacheType.v));
|
|
510
|
+
}
|
|
511
|
+
ctxPtr = this.shim.milady_llama_init_from_model(modelPtr, ctxParamsPtr);
|
|
512
|
+
}
|
|
513
|
+
finally {
|
|
514
|
+
this.shim.milady_llama_context_params_free(ctxParamsPtr);
|
|
515
|
+
}
|
|
516
|
+
if (!ctxPtr) {
|
|
517
|
+
this.sym.llama_model_free(modelPtr);
|
|
518
|
+
throw new Error(`[aosp-llama] llama_init_from_model returned NULL for ${args.modelPath}`);
|
|
519
|
+
}
|
|
520
|
+
this.model = modelPtr;
|
|
521
|
+
this.ctx = ctxPtr;
|
|
522
|
+
this.vocab = this.sym.llama_model_get_vocab(modelPtr);
|
|
523
|
+
this.nCtx = this.sym.llama_n_ctx(ctxPtr);
|
|
524
|
+
this.loadedPath = args.modelPath;
|
|
525
|
+
this.hasDecoded = false;
|
|
526
|
+
logger.info(`[aosp-llama] Loaded ${args.modelPath} (n_ctx=${this.nCtx}, n_threads=${maxThreads}, gpu=${useGpu}, kv_k=${kvCacheType?.k ?? "f16"}, kv_v=${kvCacheType?.v ?? "f16"})`);
|
|
527
|
+
}
|
|
528
|
+
async unloadModel() {
|
|
529
|
+
if (this.ctx !== null) {
|
|
530
|
+
this.sym.llama_free(this.ctx);
|
|
531
|
+
this.ctx = null;
|
|
532
|
+
}
|
|
533
|
+
if (this.model !== null) {
|
|
534
|
+
this.sym.llama_model_free(this.model);
|
|
535
|
+
this.model = null;
|
|
536
|
+
}
|
|
537
|
+
this.vocab = null;
|
|
538
|
+
this.nCtx = 0;
|
|
539
|
+
this.loadedPath = null;
|
|
540
|
+
this.hasDecoded = false;
|
|
541
|
+
}
|
|
542
|
+
async generate(args) {
|
|
543
|
+
if (this.ctx === null || this.model === null || this.vocab === null) {
|
|
544
|
+
throw new Error("[aosp-llama] generate called before loadModel");
|
|
545
|
+
}
|
|
546
|
+
const ctx = this.ctx;
|
|
547
|
+
const vocab = this.vocab;
|
|
548
|
+
// 0. Reset KV cache for this turn. The b8198 cuttlefish build
|
|
549
|
+
// segfaults when llama_memory_clear runs on a freshly-initialized
|
|
550
|
+
// ctx (no positions yet), so we only wipe once we've decoded at
|
|
551
|
+
// least one batch. The first generate() / embed() against a fresh
|
|
552
|
+
// ctx skips the clear; subsequent calls always wipe before the
|
|
553
|
+
// first chunk so prompts can land cleanly without stacking on top
|
|
554
|
+
// of stale KV state.
|
|
555
|
+
if (this.hasDecoded) {
|
|
556
|
+
const memHandle = this.sym.llama_get_memory(ctx);
|
|
557
|
+
if (memHandle) {
|
|
558
|
+
this.sym.llama_memory_clear(memHandle, false);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
// 1. Tokenize the prompt. Two-pass: ask for length (n_tokens_max=0,
|
|
562
|
+
// single-slot buffer — llama_tokenize never reads or writes through
|
|
563
|
+
// the pointer when the cap is zero, but bun:ffi's ptr() helper
|
|
564
|
+
// rejects zero-length TypedArrays with
|
|
565
|
+
// `ArrayBufferView must have a length > 0`. A length-1 probe is the
|
|
566
|
+
// smallest legal allocation that round-trips through ptr() without
|
|
567
|
+
// a runtime exception. Then alloc and fill on the second pass.
|
|
568
|
+
const promptBuf = encodeCString(args.prompt);
|
|
569
|
+
const promptByteLen = promptBuf.length - 1; // exclude NUL
|
|
570
|
+
const probe = new Int32Array(1);
|
|
571
|
+
const requested = this.sym.llama_tokenize(vocab, this.ffi.ptr(promptBuf), promptByteLen, this.ffi.ptr(probe), 0, true, false);
|
|
572
|
+
// llama_tokenize returns the negative of required length when n_tokens_max
|
|
573
|
+
// is too small. With n_tokens_max=0 we always get a negative number.
|
|
574
|
+
const required = requested < 0 ? -requested : requested;
|
|
575
|
+
if (required <= 0) {
|
|
576
|
+
throw new Error("[aosp-llama] llama_tokenize returned zero tokens");
|
|
577
|
+
}
|
|
578
|
+
const tokens = new Int32Array(required);
|
|
579
|
+
const written = this.sym.llama_tokenize(vocab, this.ffi.ptr(promptBuf), promptByteLen, this.ffi.ptr(tokens), required, true, false);
|
|
580
|
+
if (written < 0) {
|
|
581
|
+
throw new Error(`[aosp-llama] llama_tokenize second pass failed: ${written}`);
|
|
582
|
+
}
|
|
583
|
+
// 2. Build a sampler chain: temp → top_p → dist (or greedy). The
|
|
584
|
+
// sampler_chain_params struct is single-field (no_perf bool); the
|
|
585
|
+
// shim materializes it with llama.cpp's default and we don't
|
|
586
|
+
// override.
|
|
587
|
+
const samplerParamsPtr = this.shim.milady_llama_sampler_chain_params_default();
|
|
588
|
+
if (!samplerParamsPtr) {
|
|
589
|
+
throw new Error("[aosp-llama] milady_llama_sampler_chain_params_default returned NULL (malloc failure?)");
|
|
590
|
+
}
|
|
591
|
+
let chain = 0;
|
|
592
|
+
try {
|
|
593
|
+
chain = this.shim.milady_llama_sampler_chain_init(samplerParamsPtr);
|
|
594
|
+
}
|
|
595
|
+
finally {
|
|
596
|
+
this.shim.milady_llama_sampler_chain_params_free(samplerParamsPtr);
|
|
597
|
+
}
|
|
598
|
+
if (!chain) {
|
|
599
|
+
throw new Error("[aosp-llama] llama_sampler_chain_init returned NULL");
|
|
600
|
+
}
|
|
601
|
+
const temperature = args.temperature ?? 0.7;
|
|
602
|
+
if (temperature <= 0) {
|
|
603
|
+
this.sym.llama_sampler_chain_add(chain, this.sym.llama_sampler_init_greedy());
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
this.sym.llama_sampler_chain_add(chain, this.sym.llama_sampler_init_temp(temperature));
|
|
607
|
+
this.sym.llama_sampler_chain_add(chain, this.sym.llama_sampler_init_top_p(0.9, 1));
|
|
608
|
+
this.sym.llama_sampler_chain_add(chain, this.sym.llama_sampler_init_dist(0xffffffff));
|
|
609
|
+
}
|
|
610
|
+
try {
|
|
611
|
+
// 3. Decode the prompt batch.
|
|
612
|
+
// llama.cpp's llama_decode rejects token-only batches when the
|
|
613
|
+
// context is in embedding mode — the per-call assert is
|
|
614
|
+
// GGML_ASSERT((!batch_inp.token && batch_inp.embd) ||
|
|
615
|
+
// (batch_inp.token && !batch_inp.embd))
|
|
616
|
+
// and a previous embed() call may have flipped the flag on the
|
|
617
|
+
// shared context. Reset to OFF before every chat decode so the
|
|
618
|
+
// batch shape that llama_batch_get_one produces (token-only)
|
|
619
|
+
// matches what the decoder accepts, regardless of prior calls.
|
|
620
|
+
this.sym.llama_set_embeddings(ctx, false);
|
|
621
|
+
// Chunk the prompt into n_batch-sized pieces and feed them to
|
|
622
|
+
// llama_decode one at a time. llama.cpp asserts
|
|
623
|
+
// GGML_ASSERT(n_tokens_all <= cparams.n_batch)
|
|
624
|
+
// on the first decode if the prompt exceeds the configured n_batch
|
|
625
|
+
// — and even with n_batch == n_ctx the planner routinely hands us
|
|
626
|
+
// prompts that exceed n_ctx (system prompt + tools + history +
|
|
627
|
+
// user msg). When that happens we keep the TAIL of the prompt
|
|
628
|
+
// (the user's most recent message + closest context), reserving
|
|
629
|
+
// headroom for the model to generate output. Truncating from the
|
|
630
|
+
// tail would silently drop the user's question; truncating from
|
|
631
|
+
// the head preserves the question at the cost of dropping the
|
|
632
|
+
// earliest tools/history.
|
|
633
|
+
// bun:ffi struct-by-value workaround: route llama_batch_get_one +
|
|
634
|
+
// llama_decode through the shim. See ShimSymbols comment.
|
|
635
|
+
// Decode chunk size is bounded by n_batch (set in loadModel).
|
|
636
|
+
// Reading it here mirrors the parameter that loadModel committed
|
|
637
|
+
// to via milady_llama_context_params_set_n_batch.
|
|
638
|
+
const nBatch = readEnvInt("MILADY_LLAMA_N_BATCH", 2048);
|
|
639
|
+
const maxOutputReserve = args.maxTokens ?? 512;
|
|
640
|
+
// Reserve maxOutputReserve + n_batch (one ubatch slack) + an
|
|
641
|
+
// empirical 25 % safety margin. llama.cpp's Flash-Attention sliding
|
|
642
|
+
// memory allocator on the b8198 build returns
|
|
643
|
+
// decode: failed to find a memory slot for batch of size N
|
|
644
|
+
// when the per-sequence KV slots get fragmented by repeated
|
|
645
|
+
// back-to-back chunks even with positions still nominally free,
|
|
646
|
+
// so we leave generous headroom rather than push to the limit.
|
|
647
|
+
const promptCapacity = Math.max(1, Math.floor((this.nCtx - maxOutputReserve - nBatch) * 0.75));
|
|
648
|
+
let promptTokens = tokens;
|
|
649
|
+
let promptLen = written;
|
|
650
|
+
if (written > promptCapacity) {
|
|
651
|
+
const head = written - promptCapacity;
|
|
652
|
+
promptTokens = tokens.subarray(head);
|
|
653
|
+
promptLen = promptCapacity;
|
|
654
|
+
logger.warn(`[aosp-llama] prompt ${written} tokens > capacity ${promptCapacity} (n_ctx=${this.nCtx} - reserve ${maxOutputReserve}); dropping ${head} head tokens`);
|
|
655
|
+
}
|
|
656
|
+
for (let offset = 0; offset < promptLen; offset += nBatch) {
|
|
657
|
+
const chunkLen = Math.min(nBatch, promptLen - offset);
|
|
658
|
+
const chunk = promptTokens.subarray(offset, offset + chunkLen);
|
|
659
|
+
const promptBatchPtr = this.shim.milady_llama_batch_get_one(this.ffi.ptr(chunk), chunkLen);
|
|
660
|
+
if (!promptBatchPtr) {
|
|
661
|
+
throw new Error("[aosp-llama] milady_llama_batch_get_one returned NULL (malloc failure?)");
|
|
662
|
+
}
|
|
663
|
+
let decodeRc;
|
|
664
|
+
try {
|
|
665
|
+
decodeRc = this.shim.milady_llama_decode(ctx, promptBatchPtr);
|
|
666
|
+
}
|
|
667
|
+
finally {
|
|
668
|
+
this.shim.milady_llama_batch_free(promptBatchPtr);
|
|
669
|
+
}
|
|
670
|
+
if (decodeRc !== 0) {
|
|
671
|
+
throw new Error(`[aosp-llama] llama_decode (prompt chunk @${offset}/${promptLen}) returned ${decodeRc}`);
|
|
672
|
+
}
|
|
673
|
+
// Mark the ctx as decoded so subsequent generate()/embed() calls
|
|
674
|
+
// will issue the leading llama_memory_clear safely.
|
|
675
|
+
this.hasDecoded = true;
|
|
676
|
+
// Yield to the event loop between chunks so the on-device
|
|
677
|
+
// watchdog's /api/health probe (3s timeout × 3 strikes = ~6 min
|
|
678
|
+
// grace window with WATCHDOG_INTERVAL_MS=120s) can complete.
|
|
679
|
+
// Without this yield bun's single-threaded loop sits inside
|
|
680
|
+
// FFI for the entire prompt decode (minutes on cuttlefish CPU)
|
|
681
|
+
// and the service kills it for missed health checks.
|
|
682
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
683
|
+
}
|
|
684
|
+
// 4. Token loop.
|
|
685
|
+
const maxTokens = args.maxTokens ?? 512;
|
|
686
|
+
const stopSequences = args.stopSequences ?? [];
|
|
687
|
+
const pieceBuf = new Uint8Array(256);
|
|
688
|
+
const singleToken = new Int32Array(1);
|
|
689
|
+
let output = "";
|
|
690
|
+
for (let i = 0; i < maxTokens; i++) {
|
|
691
|
+
const next = this.sym.llama_sampler_sample(chain, ctx, -1);
|
|
692
|
+
if (this.sym.llama_vocab_is_eog(vocab, next))
|
|
693
|
+
break;
|
|
694
|
+
this.sym.llama_sampler_accept(chain, next);
|
|
695
|
+
const wrote = this.sym.llama_token_to_piece(vocab, next, this.ffi.ptr(pieceBuf), pieceBuf.length, 0, false);
|
|
696
|
+
if (wrote > 0) {
|
|
697
|
+
const piece = new TextDecoder().decode(pieceBuf.subarray(0, wrote));
|
|
698
|
+
output += piece;
|
|
699
|
+
if (stopSequences.some((s) => s.length > 0 && output.endsWith(s))) {
|
|
700
|
+
for (const stop of stopSequences) {
|
|
701
|
+
if (stop.length > 0 && output.endsWith(stop)) {
|
|
702
|
+
output = output.slice(0, -stop.length);
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
singleToken[0] = next;
|
|
710
|
+
const stepBatchPtr = this.shim.milady_llama_batch_get_one(this.ffi.ptr(singleToken), 1);
|
|
711
|
+
if (!stepBatchPtr) {
|
|
712
|
+
throw new Error("[aosp-llama] milady_llama_batch_get_one returned NULL (malloc failure?)");
|
|
713
|
+
}
|
|
714
|
+
let stepRc;
|
|
715
|
+
try {
|
|
716
|
+
stepRc = this.shim.milady_llama_decode(ctx, stepBatchPtr);
|
|
717
|
+
}
|
|
718
|
+
finally {
|
|
719
|
+
this.shim.milady_llama_batch_free(stepBatchPtr);
|
|
720
|
+
}
|
|
721
|
+
if (stepRc !== 0) {
|
|
722
|
+
throw new Error(`[aosp-llama] llama_decode (step) returned ${stepRc}`);
|
|
723
|
+
}
|
|
724
|
+
// Yield every 16 generated tokens. setImmediate every step
|
|
725
|
+
// would cut sampling throughput by ~30 %; a stride of 16 keeps
|
|
726
|
+
// the loop responsive to /api/health while staying close to
|
|
727
|
+
// peak generation rate. SmolLM2-360M on cuttlefish CPU lands
|
|
728
|
+
// roughly 5 tok/s, so 16 tokens = ~3 s per yield, well under
|
|
729
|
+
// the 3-strike × 120 s health-probe budget.
|
|
730
|
+
if ((i & 15) === 15) {
|
|
731
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return output;
|
|
735
|
+
}
|
|
736
|
+
finally {
|
|
737
|
+
this.sym.llama_sampler_free(chain);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Compute a sentence-level embedding for `input`. Single-context loader:
|
|
742
|
+
* we toggle the loaded ctx into embeddings mode via `llama_set_embeddings`,
|
|
743
|
+
* decode the tokenized input as one sequence, then read the per-sequence
|
|
744
|
+
* pooled embedding.
|
|
745
|
+
*
|
|
746
|
+
* Pooling contract: `loadModel()` initialises the context with
|
|
747
|
+
* `pooling_type = MEAN` (verified against b4500 llama.h enum), so
|
|
748
|
+
* `llama_get_embeddings_seq(ctx, 0)` returns exactly `n_embd` floats and
|
|
749
|
+
* we never need the per-token fallback path. If a future change ever
|
|
750
|
+
* sets `pooling_type = NONE`, this method must reject — reading
|
|
751
|
+
* `llama_get_embeddings(ctx)` for `written * n_embd` floats races with
|
|
752
|
+
* llama.cpp's per-decode `n_outputs` and would over-read for
|
|
753
|
+
* output-pruning models.
|
|
754
|
+
*
|
|
755
|
+
* Trade-off: the same context is used for generation and embeddings;
|
|
756
|
+
* toggling between modes flushes the KV cache implicitly on the next
|
|
757
|
+
* `llama_decode`, so repeated mode-switching is slow. Acceptable for a
|
|
758
|
+
* mobile-first runtime where embeddings are infrequent (memory + RAG
|
|
759
|
+
* indexing) compared to chat turns.
|
|
760
|
+
*/
|
|
761
|
+
async embed(args) {
|
|
762
|
+
if (this.ctx === null || this.model === null || this.vocab === null) {
|
|
763
|
+
throw new Error("[aosp-llama] embed called before loadModel");
|
|
764
|
+
}
|
|
765
|
+
const ctx = this.ctx;
|
|
766
|
+
const model = this.model;
|
|
767
|
+
const vocab = this.vocab;
|
|
768
|
+
// 0. Reset KV cache. See generate() for the hasDecoded gating
|
|
769
|
+
// rationale (cuttlefish x86_64 segfault on a freshly-initialized
|
|
770
|
+
// ctx).
|
|
771
|
+
if (this.hasDecoded) {
|
|
772
|
+
const memHandle = this.sym.llama_get_memory(ctx);
|
|
773
|
+
if (memHandle) {
|
|
774
|
+
this.sym.llama_memory_clear(memHandle, false);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
// 1. Tokenize the input. Embedding pipelines typically include the BOS
|
|
778
|
+
// token; we mirror generate() and pass add_special=true. Probe pass
|
|
779
|
+
// needs only a length, not storage, but bun:ffi's ptr() rejects
|
|
780
|
+
// zero-length TypedArrays — use a single-slot Int32Array, the
|
|
781
|
+
// smallest legal allocation that round-trips through ptr() without
|
|
782
|
+
// `ArrayBufferView must have a length > 0`.
|
|
783
|
+
const inputBuf = encodeCString(args.input);
|
|
784
|
+
const inputByteLen = inputBuf.length - 1;
|
|
785
|
+
const probeOut = new Int32Array(1);
|
|
786
|
+
const requested = this.sym.llama_tokenize(vocab, this.ffi.ptr(inputBuf), inputByteLen, this.ffi.ptr(probeOut), 0, true, false);
|
|
787
|
+
const required = requested < 0 ? -requested : requested;
|
|
788
|
+
if (required <= 0) {
|
|
789
|
+
throw new Error("[aosp-llama] llama_tokenize returned zero tokens for embed input");
|
|
790
|
+
}
|
|
791
|
+
const tokens = new Int32Array(required);
|
|
792
|
+
const written = this.sym.llama_tokenize(vocab, this.ffi.ptr(inputBuf), inputByteLen, this.ffi.ptr(tokens), required, true, false);
|
|
793
|
+
if (written < 0) {
|
|
794
|
+
throw new Error(`[aosp-llama] llama_tokenize embed second pass failed: ${written}`);
|
|
795
|
+
}
|
|
796
|
+
// 2. Switch ctx into embeddings mode, decode, then switch back. The
|
|
797
|
+
// next decode() implicitly clears KV cache state when the embeddings
|
|
798
|
+
// flag flips — `generate()` callers that ran before `embed()` see a
|
|
799
|
+
// fresh prompt anyway, so this is safe to do unconditionally.
|
|
800
|
+
this.sym.llama_set_embeddings(ctx, true);
|
|
801
|
+
try {
|
|
802
|
+
// bun:ffi struct-by-value workaround: route through the shim's
|
|
803
|
+
// pointer-style wrappers. See ShimSymbols.milady_llama_batch_get_one
|
|
804
|
+
// / milady_llama_decode for the rationale.
|
|
805
|
+
const batchPtr = this.shim.milady_llama_batch_get_one(this.ffi.ptr(tokens), written);
|
|
806
|
+
if (!batchPtr) {
|
|
807
|
+
throw new Error("[aosp-llama] milady_llama_batch_get_one returned NULL (malloc failure?)");
|
|
808
|
+
}
|
|
809
|
+
let decodeRc;
|
|
810
|
+
try {
|
|
811
|
+
decodeRc = this.shim.milady_llama_decode(ctx, batchPtr);
|
|
812
|
+
}
|
|
813
|
+
finally {
|
|
814
|
+
this.shim.milady_llama_batch_free(batchPtr);
|
|
815
|
+
}
|
|
816
|
+
if (decodeRc !== 0) {
|
|
817
|
+
throw new Error(`[aosp-llama] llama_decode (embed) returned ${decodeRc}`);
|
|
818
|
+
}
|
|
819
|
+
this.hasDecoded = true;
|
|
820
|
+
const nEmbd = this.sym.llama_model_n_embd(model);
|
|
821
|
+
if (nEmbd <= 0) {
|
|
822
|
+
throw new Error(`[aosp-llama] llama_model_n_embd returned non-positive ${nEmbd}`);
|
|
823
|
+
}
|
|
824
|
+
const byteLength = nEmbd * 4; // float32
|
|
825
|
+
// Read the pooled per-sequence buffer. `loadModel` pinned
|
|
826
|
+
// pooling_type = MEAN, so llama.cpp produces exactly `n_embd`
|
|
827
|
+
// floats here. A NULL return means either pooling was disabled
|
|
828
|
+
// (contract violation) or the model emitted no output for
|
|
829
|
+
// sequence 0 — both cases are unrecoverable, so fail loudly.
|
|
830
|
+
const pooledPtr = this.sym.llama_get_embeddings_seq(ctx, 0);
|
|
831
|
+
if (!pooledPtr) {
|
|
832
|
+
throw new Error("[aosp-llama] llama_get_embeddings_seq returned NULL — pooling_type contract violated");
|
|
833
|
+
}
|
|
834
|
+
const buf = this.ffi.toArrayBuffer(pooledPtr, 0, byteLength);
|
|
835
|
+
// Copy off the ctx-owned buffer so the result outlives the next
|
|
836
|
+
// llama_decode() call.
|
|
837
|
+
const view = new Float32Array(buf.slice(0));
|
|
838
|
+
return { embedding: Array.from(view), tokens: written };
|
|
839
|
+
}
|
|
840
|
+
finally {
|
|
841
|
+
// Restore generation mode so the next `generate()` call doesn't get
|
|
842
|
+
// hit with a reload-KV-cache stall on its first decode.
|
|
843
|
+
this.sym.llama_set_embeddings(ctx, false);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
let cachedAdapter = null;
|
|
848
|
+
/**
|
|
849
|
+
* Build (or return cached) AOSP loader. Returns null if the env opt-in is not
|
|
850
|
+
* set, libllama.so / libmilady-llama-shim.so cannot be located, or `bun:ffi`
|
|
851
|
+
* is unavailable. Each failure is logged once. Failures while
|
|
852
|
+
* `MILADY_LOCAL_LLAMA=1` is set are elevated to `error` because the user
|
|
853
|
+
* explicitly opted in.
|
|
854
|
+
*/
|
|
855
|
+
async function buildAdapter() {
|
|
856
|
+
if (cachedAdapter)
|
|
857
|
+
return cachedAdapter;
|
|
858
|
+
if (!isAospEnabled())
|
|
859
|
+
return null;
|
|
860
|
+
let libPath;
|
|
861
|
+
let shimPath;
|
|
862
|
+
try {
|
|
863
|
+
libPath = resolveLibllamaPath();
|
|
864
|
+
shimPath = resolveLlamaShimPath();
|
|
865
|
+
}
|
|
866
|
+
catch (err) {
|
|
867
|
+
logger.error("[aosp-llama] Cannot resolve native library paths:", err instanceof Error ? err.message : String(err));
|
|
868
|
+
return null;
|
|
869
|
+
}
|
|
870
|
+
if (!existsSync(libPath)) {
|
|
871
|
+
logger.error(`[aosp-llama] MILADY_LOCAL_LLAMA=1 but libllama.so missing at ${libPath}`);
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
if (!existsSync(shimPath)) {
|
|
875
|
+
logger.error(`[aosp-llama] MILADY_LOCAL_LLAMA=1 but libmilady-llama-shim.so missing at ${shimPath}. ` +
|
|
876
|
+
`Re-run scripts/miladyos/compile-libllama.mjs to produce the bun:ffi struct-by-value shim.`);
|
|
877
|
+
return null;
|
|
878
|
+
}
|
|
879
|
+
const ffiResult = await loadBunFfi();
|
|
880
|
+
if (ffiResult.ok === false) {
|
|
881
|
+
logger.error(`[aosp-llama] MILADY_LOCAL_LLAMA=1 but bun:ffi is unavailable on this runtime: ${ffiResult.error.message}`);
|
|
882
|
+
return null;
|
|
883
|
+
}
|
|
884
|
+
const ffi = ffiResult.mod;
|
|
885
|
+
let symbols;
|
|
886
|
+
try {
|
|
887
|
+
// Order matters: libllama.so must be loaded first so the shim's
|
|
888
|
+
// NEEDED entry resolves at dlopen time. (LD_LIBRARY_PATH is the
|
|
889
|
+
// runtime fallback, but loading libllama.so first guarantees the
|
|
890
|
+
// symbols are already in the global namespace.)
|
|
891
|
+
symbols = dlopenLlama(ffi, libPath);
|
|
892
|
+
}
|
|
893
|
+
catch (err) {
|
|
894
|
+
logger.error(`[aosp-llama] dlopen failed for ${libPath}:`, err instanceof Error ? err.message : String(err));
|
|
895
|
+
return null;
|
|
896
|
+
}
|
|
897
|
+
let shim;
|
|
898
|
+
try {
|
|
899
|
+
shim = dlopenShim(ffi, shimPath);
|
|
900
|
+
}
|
|
901
|
+
catch (err) {
|
|
902
|
+
logger.error(`[aosp-llama] dlopen failed for ${shimPath}:`, err instanceof Error ? err.message : String(err));
|
|
903
|
+
return null;
|
|
904
|
+
}
|
|
905
|
+
cachedAdapter = new AospLlamaAdapter(ffi, symbols, shim);
|
|
906
|
+
return cachedAdapter;
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Register the AOSP llama.cpp FFI loader on the runtime. No-op on non-AOSP
|
|
910
|
+
* builds (when `MILADY_LOCAL_LLAMA !== "1"`). Returns true on successful
|
|
911
|
+
* registration so the caller can confirm precedence.
|
|
912
|
+
*/
|
|
913
|
+
export async function registerAospLlamaLoader(runtime) {
|
|
914
|
+
if (!isAospEnabled())
|
|
915
|
+
return false;
|
|
916
|
+
if (typeof runtime.registerService !== "function")
|
|
917
|
+
return false;
|
|
918
|
+
const adapter = await buildAdapter();
|
|
919
|
+
if (!adapter)
|
|
920
|
+
return false;
|
|
921
|
+
runtime.registerService(SERVICE_NAME, {
|
|
922
|
+
// Accept the shared LocalInferenceLoader shape (`{ modelPath }`) AND the
|
|
923
|
+
// AOSP-specific extension (`{ modelPath, kvCacheType?, … }`) — callers
|
|
924
|
+
// that don't know about TBQ pass the slim shape and the adapter
|
|
925
|
+
// auto-detects from the filename.
|
|
926
|
+
loadModel: (a) => adapter.loadModel(a),
|
|
927
|
+
unloadModel: () => adapter.unloadModel(),
|
|
928
|
+
currentModelPath: () => adapter.currentModelPath(),
|
|
929
|
+
generate: (a) => adapter.generate(a),
|
|
930
|
+
embed: (a) => adapter.embed(a),
|
|
931
|
+
});
|
|
932
|
+
logger.info("[aosp-llama] Registered native libllama.so loader (MILADY_LOCAL_LLAMA=1)");
|
|
933
|
+
return true;
|
|
934
|
+
}
|
|
935
|
+
/** Test-only: drop the cached adapter so a fresh build can run. */
|
|
936
|
+
export function __resetForTests() {
|
|
937
|
+
cachedAdapter = null;
|
|
938
|
+
}
|