@elizaos/app-core 2.0.0-alpha.85 → 2.0.0-beta.2
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/account-pool.d.ts +6 -0
- package/account-pool.d.ts.map +1 -0
- package/account-pool.js +5 -0
- package/api/__tests__/sandbox-test-helpers.d.ts +10 -0
- package/api/__tests__/sandbox-test-helpers.d.ts.map +1 -0
- package/api/__tests__/sandbox-test-helpers.js +15 -0
- package/api/auth/audit.d.ts +52 -0
- package/api/auth/audit.d.ts.map +1 -0
- package/api/auth/audit.js +126 -0
- package/api/auth/auth-context.d.ts +40 -0
- package/api/auth/auth-context.d.ts.map +1 -0
- package/api/auth/auth-context.js +68 -0
- package/api/auth/bootstrap-token.d.ts +50 -0
- package/api/auth/bootstrap-token.d.ts.map +1 -0
- package/api/auth/bootstrap-token.js +157 -0
- package/api/auth/index.d.ts +14 -0
- package/api/auth/index.d.ts.map +1 -0
- package/api/auth/index.js +13 -0
- package/api/auth/passwords.d.ts +65 -0
- package/api/auth/passwords.d.ts.map +1 -0
- package/api/auth/passwords.js +87 -0
- package/api/auth/sensitive-rate-limit.d.ts +56 -0
- package/api/auth/sensitive-rate-limit.d.ts.map +1 -0
- package/api/auth/sensitive-rate-limit.js +95 -0
- package/api/auth/sessions.d.ts +152 -0
- package/api/auth/sessions.d.ts.map +1 -0
- package/api/auth/sessions.js +298 -0
- package/api/auth/tokens.d.ts +3 -0
- package/api/auth/tokens.d.ts.map +1 -0
- package/api/auth/tokens.js +13 -0
- package/api/auth-bootstrap-routes.d.ts +32 -0
- package/api/auth-bootstrap-routes.d.ts.map +1 -0
- package/api/auth-bootstrap-routes.js +179 -0
- package/api/auth-pairing-compat-routes.d.ts +17 -0
- package/api/auth-pairing-compat-routes.d.ts.map +1 -0
- package/api/auth-pairing-compat-routes.js +301 -0
- package/api/auth-session-routes.d.ts +31 -0
- package/api/auth-session-routes.d.ts.map +1 -0
- package/api/auth-session-routes.js +560 -0
- package/api/auth.d.ts +153 -0
- package/api/auth.d.ts.map +1 -0
- package/api/auth.js +290 -0
- package/api/automation-node-contributors.d.ts +14 -0
- package/api/automation-node-contributors.d.ts.map +1 -0
- package/api/automation-node-contributors.js +14 -0
- package/api/automations-compat-routes.d.ts +18 -0
- package/api/automations-compat-routes.d.ts.map +1 -0
- package/api/automations-compat-routes.js +274 -0
- package/api/catalog-routes.d.ts +4 -0
- package/api/catalog-routes.d.ts.map +1 -0
- package/api/catalog-routes.js +61 -0
- package/api/compat-route-shared.d.ts +29 -0
- package/api/compat-route-shared.d.ts.map +1 -0
- package/api/compat-route-shared.js +298 -0
- package/api/credential-resolver.d.ts +31 -0
- package/api/credential-resolver.d.ts.map +1 -0
- package/api/credential-resolver.js +199 -0
- package/api/database-rows-compat-routes.d.ts +4 -0
- package/api/database-rows-compat-routes.d.ts.map +1 -0
- package/api/database-rows-compat-routes.js +100 -0
- package/api/dev-compat-routes.d.ts +11 -0
- package/api/dev-compat-routes.d.ts.map +1 -0
- package/api/dev-compat-routes.js +144 -0
- package/api/dev-console-log.d.ts +21 -0
- package/api/dev-console-log.d.ts.map +1 -0
- package/api/dev-console-log.js +65 -0
- package/api/dev-stack.d.ts +49 -0
- package/api/dev-stack.d.ts.map +1 -0
- package/api/dev-stack.js +60 -0
- package/api/local-inference-compat-routes.d.ts +16 -0
- package/api/local-inference-compat-routes.d.ts.map +1 -0
- package/api/local-inference-compat-routes.js +617 -0
- package/api/onboarding-compat-routes.d.ts +4 -0
- package/api/onboarding-compat-routes.d.ts.map +1 -0
- package/api/onboarding-compat-routes.js +207 -0
- package/api/plugins-compat-routes.d.ts +103 -0
- package/api/plugins-compat-routes.d.ts.map +1 -0
- package/api/plugins-compat-routes.js +1181 -0
- package/api/response.d.ts +4 -0
- package/api/response.d.ts.map +1 -0
- package/api/response.js +28 -0
- package/api/runtime-mode-routes.d.ts +13 -0
- package/api/runtime-mode-routes.d.ts.map +1 -0
- package/api/runtime-mode-routes.js +32 -0
- package/api/secrets-inventory-routes.d.ts +39 -0
- package/api/secrets-inventory-routes.d.ts.map +1 -0
- package/api/secrets-inventory-routes.js +487 -0
- package/api/secrets-manager-routes.d.ts +9 -0
- package/api/secrets-manager-routes.d.ts.map +1 -0
- package/api/secrets-manager-routes.js +476 -0
- package/api/sensitive-request-routes.d.ts +20 -0
- package/api/sensitive-request-routes.d.ts.map +1 -0
- package/api/sensitive-request-routes.js +489 -0
- package/api/sensitive-request-store.d.ts +39 -0
- package/api/sensitive-request-store.d.ts.map +1 -0
- package/api/sensitive-request-store.js +204 -0
- package/api/server-config-filter.d.ts +14 -0
- package/api/server-config-filter.d.ts.map +1 -0
- package/api/server-config-filter.js +77 -0
- package/api/server-cors.d.ts +30 -0
- package/api/server-cors.d.ts.map +1 -0
- package/api/server-cors.js +128 -0
- package/api/server-html.d.ts +4 -0
- package/api/server-html.d.ts.map +1 -0
- package/api/server-html.js +5 -0
- package/api/server-onboarding-compat.d.ts +31 -0
- package/api/server-onboarding-compat.d.ts.map +1 -0
- package/api/server-onboarding-compat.js +283 -0
- package/api/server-security.d.ts +11 -0
- package/api/server-security.d.ts.map +1 -0
- package/api/server-security.js +29 -0
- package/api/server-startup.d.ts +5 -0
- package/api/server-startup.d.ts.map +1 -0
- package/api/server-startup.js +74 -0
- package/api/server-wallet-trade.d.ts +10 -0
- package/api/server-wallet-trade.d.ts.map +1 -0
- package/api/server-wallet-trade.js +240 -0
- package/api/server.d.ts +32 -0
- package/api/server.d.ts.map +1 -0
- package/api/server.js +768 -0
- package/api/workbench-compat-routes.d.ts +11 -0
- package/api/workbench-compat-routes.d.ts.map +1 -0
- package/api/workbench-compat-routes.js +325 -0
- package/benchmark/cua-routes.d.ts +10 -0
- package/benchmark/cua-routes.d.ts.map +1 -0
- package/benchmark/cua-routes.js +179 -0
- package/benchmark/lifeops-bench-handler.d.ts +94 -0
- package/benchmark/lifeops-bench-handler.d.ts.map +1 -0
- package/benchmark/lifeops-bench-handler.js +280 -0
- package/benchmark/lifeops-fake-backend.d.ts +227 -0
- package/benchmark/lifeops-fake-backend.d.ts.map +1 -0
- package/benchmark/lifeops-fake-backend.js +499 -0
- package/benchmark/mock-plugin-base.d.ts +9 -0
- package/benchmark/mock-plugin-base.d.ts.map +1 -0
- package/benchmark/mock-plugin-base.js +325 -0
- package/benchmark/mock-plugin.d.ts +3 -0
- package/benchmark/mock-plugin.d.ts.map +1 -0
- package/benchmark/mock-plugin.js +504 -0
- package/benchmark/params.d.ts +2 -0
- package/benchmark/params.d.ts.map +1 -0
- package/benchmark/params.js +18 -0
- package/benchmark/plugin.d.ts +42 -0
- package/benchmark/plugin.d.ts.map +1 -0
- package/benchmark/plugin.js +422 -0
- package/benchmark/replay-capture.d.ts +73 -0
- package/benchmark/replay-capture.d.ts.map +1 -0
- package/benchmark/replay-capture.js +223 -0
- package/benchmark/server-utils.d.ts +100 -0
- package/benchmark/server-utils.d.ts.map +1 -0
- package/benchmark/server-utils.js +289 -0
- package/benchmark/server.d.ts +2 -0
- package/benchmark/server.d.ts.map +1 -0
- package/benchmark/server.js +1176 -0
- package/browser.d.ts +13 -0
- package/browser.d.ts.map +1 -0
- package/browser.js +15 -0
- package/cli/argv.d.ts +17 -0
- package/cli/argv.d.ts.map +1 -0
- package/cli/argv.js +140 -0
- package/cli/banner.d.ts +11 -0
- package/cli/banner.d.ts.map +1 -0
- package/cli/banner.js +36 -0
- package/cli/cli-name.d.ts +5 -0
- package/cli/cli-name.d.ts.map +1 -0
- package/cli/cli-name.js +21 -0
- package/cli/cli-utils.d.ts +5 -0
- package/cli/cli-utils.d.ts.map +1 -0
- package/cli/cli-utils.js +13 -0
- package/cli/command-format.d.ts +2 -0
- package/cli/command-format.d.ts.map +1 -0
- package/cli/command-format.js +20 -0
- package/cli/doctor/checks.d.ts +96 -0
- package/cli/doctor/checks.d.ts.map +1 -0
- package/cli/doctor/checks.js +483 -0
- package/cli/git-commit.d.ts +5 -0
- package/cli/git-commit.d.ts.map +1 -0
- package/cli/git-commit.js +106 -0
- package/cli/parse-duration.d.ts +5 -0
- package/cli/parse-duration.d.ts.map +1 -0
- package/cli/parse-duration.js +27 -0
- package/cli/plugins-cli.d.ts +26 -0
- package/cli/plugins-cli.d.ts.map +1 -0
- package/cli/plugins-cli.js +892 -0
- package/cli/profile-utils.d.ts +3 -0
- package/cli/profile-utils.d.ts.map +1 -0
- package/cli/profile-utils.js +21 -0
- package/cli/profile.d.ts +15 -0
- package/cli/profile.d.ts.map +1 -0
- package/cli/profile.js +93 -0
- package/cli/program/build-program.d.ts +3 -0
- package/cli/program/build-program.d.ts.map +1 -0
- package/cli/program/build-program.js +12 -0
- package/cli/program/command-registry.d.ts +3 -0
- package/cli/program/command-registry.d.ts.map +1 -0
- package/cli/program/command-registry.js +24 -0
- package/cli/program/help.d.ts +3 -0
- package/cli/program/help.d.ts.map +1 -0
- package/cli/program/help.js +57 -0
- package/cli/program/preaction.d.ts +3 -0
- package/cli/program/preaction.d.ts.map +1 -0
- package/cli/program/preaction.js +40 -0
- package/cli/program/register.auth.d.ts +51 -0
- package/cli/program/register.auth.d.ts.map +1 -0
- package/cli/program/register.auth.js +203 -0
- package/cli/program/register.benchmark.d.ts +3 -0
- package/cli/program/register.benchmark.d.ts.map +1 -0
- package/cli/program/register.benchmark.js +12 -0
- package/cli/program/register.config.d.ts +3 -0
- package/cli/program/register.config.d.ts.map +1 -0
- package/cli/program/register.config.js +150 -0
- package/cli/program/register.configure.d.ts +3 -0
- package/cli/program/register.configure.d.ts.map +1 -0
- package/cli/program/register.configure.js +18 -0
- package/cli/program/register.dashboard.d.ts +3 -0
- package/cli/program/register.dashboard.d.ts.map +1 -0
- package/cli/program/register.dashboard.js +124 -0
- package/cli/program/register.db.d.ts +3 -0
- package/cli/program/register.db.d.ts.map +1 -0
- package/cli/program/register.db.js +45 -0
- package/cli/program/register.doctor.d.ts +3 -0
- package/cli/program/register.doctor.d.ts.map +1 -0
- package/cli/program/register.doctor.js +170 -0
- package/cli/program/register.models.d.ts +3 -0
- package/cli/program/register.models.d.ts.map +1 -0
- package/cli/program/register.models.js +32 -0
- package/cli/program/register.setup.d.ts +16 -0
- package/cli/program/register.setup.d.ts.map +1 -0
- package/cli/program/register.setup.js +333 -0
- package/cli/program/register.start.d.ts +3 -0
- package/cli/program/register.start.d.ts.map +1 -0
- package/cli/program/register.start.js +95 -0
- package/cli/program/register.subclis.d.ts +4 -0
- package/cli/program/register.subclis.d.ts.map +1 -0
- package/cli/program/register.subclis.js +87 -0
- package/cli/program/register.update.d.ts +12 -0
- package/cli/program/register.update.d.ts.map +1 -0
- package/cli/program/register.update.js +173 -0
- package/cli/program.d.ts +2 -0
- package/cli/program.d.ts.map +1 -0
- package/cli/program.js +1 -0
- package/cli/run-main.d.ts +2 -0
- package/cli/run-main.d.ts.map +1 -0
- package/cli/run-main.js +71 -0
- package/cli/version.d.ts +2 -0
- package/cli/version.d.ts.map +1 -0
- package/cli/version.js +2 -0
- package/connectors/capacitor-jsc.d.ts +66 -0
- package/connectors/capacitor-jsc.d.ts.map +1 -0
- package/connectors/capacitor-jsc.js +39 -0
- package/connectors/capacitor-quickjs.d.ts +64 -0
- package/connectors/capacitor-quickjs.d.ts.map +1 -0
- package/connectors/capacitor-quickjs.js +50 -0
- package/connectors/capacitor-sqlite.d.ts +41 -0
- package/connectors/capacitor-sqlite.d.ts.map +1 -0
- package/connectors/capacitor-sqlite.js +87 -0
- package/diagnostics/integration-observability.d.ts +40 -0
- package/diagnostics/integration-observability.d.ts.map +1 -0
- package/diagnostics/integration-observability.js +68 -0
- package/entry.d.ts +10 -0
- package/entry.d.ts.map +1 -0
- package/entry.js +66 -0
- package/index.d.ts +34 -4
- package/index.d.ts.map +1 -1
- package/index.js +42 -6
- package/package.json +81 -151
- package/packaging/PUBLISHING_GUIDE.md +707 -0
- package/packaging/debian/changelog +9 -0
- package/packaging/debian/control +26 -0
- package/packaging/debian/copyright +27 -0
- package/packaging/debian/elizaos-app.service +15 -0
- package/packaging/debian/install +4 -0
- package/packaging/debian/postinst +28 -0
- package/packaging/debian/prerm +14 -0
- package/packaging/debian/rules +44 -0
- package/packaging/debian/source/format +1 -0
- package/packaging/flatpak/README.md +150 -0
- package/packaging/flatpak/ai.elizaos.App.desktop +11 -0
- package/packaging/flatpak/ai.elizaos.App.metainfo.xml +81 -0
- package/packaging/flatpak/ai.elizaos.App.store.yml +142 -0
- package/packaging/flatpak/ai.elizaos.App.yml +142 -0
- package/packaging/flatpak/elizaos-app-wrapper.sh +5 -0
- package/packaging/flatpak/elizaos-app-wrapper.store.sh +16 -0
- package/packaging/flatpak/icons/128x128/ai.elizaos.App.png +0 -0
- package/packaging/flatpak/icons/256x256/ai.elizaos.App.png +0 -0
- package/packaging/flatpak/icons/512x512/ai.elizaos.App.png +0 -0
- package/packaging/homebrew/README.md +80 -0
- package/packaging/homebrew/elizaos-app.cask.rb +60 -0
- package/packaging/homebrew/elizaos-app.rb +49 -0
- package/packaging/inno/ElizaOSApp.iss +53 -0
- package/packaging/inno/build-inno.ps1 +231 -0
- package/packaging/msix/AppxManifest.store.xml +79 -0
- package/packaging/msix/AppxManifest.xml +53 -0
- package/packaging/msix/README.md +201 -0
- package/packaging/msix/assets/LargeTile.png +0 -0
- package/packaging/msix/assets/Square150x150Logo.png +0 -0
- package/packaging/msix/assets/Square44x44Logo.png +0 -0
- package/packaging/msix/assets/StoreLogo.png +0 -0
- package/packaging/msix/assets/Wide310x150Logo.png +0 -0
- package/packaging/msix/build-msix.ps1 +206 -0
- package/packaging/msix/generate-placeholder-assets.ps1 +49 -0
- package/packaging/msix/store/description.md +31 -0
- package/packaging/msix/store/listing.json +27 -0
- package/packaging/pypi/README.md +14 -0
- package/packaging/pypi/elizaos_app/__init__.py +7 -0
- package/packaging/pypi/elizaos_app/__main__.py +6 -0
- package/packaging/pypi/elizaos_app/cli.py +21 -0
- package/packaging/pypi/elizaos_app/loader.py +127 -0
- package/packaging/pypi/elizaos_app/py.typed +1 -0
- package/packaging/pypi/pyproject.toml +38 -0
- package/packaging/snap/snapcraft.yaml +560 -0
- package/packaging/test-packaging.sh +309 -0
- package/patches/@noble%2Fcurves@2.0.1.patch +33 -0
- package/patches/@pixiv%2Fthree-vrm@3.5.2.patch +26 -0
- package/patches/coding-agent-adapters@0.16.3.patch +44 -0
- package/patches/electrobun@1.16.0.patch +13 -0
- package/patches/llama-cpp-capacitor@0.1.5.patch +2387 -0
- package/patches/proper-lockfile@4.1.2.patch +14 -0
- package/patches/pty-manager@1.11.0.patch +194 -0
- package/permissions/types.d.ts +8 -0
- package/permissions/types.d.ts.map +1 -0
- package/permissions/types.js +7 -0
- package/platform/agent-browser-stub.d.ts +27 -0
- package/platform/agent-browser-stub.d.ts.map +1 -0
- package/platform/agent-browser-stub.js +16 -0
- package/platform/empty-node-module.d.ts +31 -0
- package/platform/empty-node-module.d.ts.map +1 -0
- package/platform/empty-node-module.js +22 -0
- package/platforms/android/Gemfile +6 -0
- package/platforms/android/README.md +79 -0
- package/platforms/android/app/build.gradle +124 -0
- package/platforms/android/app/capacitor.build.gradle +32 -0
- package/platforms/android/app/proguard-rules.pro +46 -0
- package/platforms/android/app/src/androidTest/java/ai/elizaos/app/ElizaOsInstrumentedTest.java +162 -0
- package/platforms/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +26 -0
- package/platforms/android/app/src/main/AndroidManifest.xml +83 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/AgentPlugin.java +232 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java +1514 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAssistActivity.java +21 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBootReceiver.java +61 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBrowserActivity.java +39 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCalendarActivity.java +75 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCameraActivity.java +54 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaClockActivity.java +70 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaContactsActivity.java +56 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaDialActivity.java +83 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaInCallService.java +168 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaMmsReceiver.java +70 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java +38 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaRespondViaMessageService.java +119 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsComposeActivity.java +50 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsReceiver.java +84 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/GatewayConnectionService.java +211 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/MainActivity.java +202 -0
- package/platforms/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/platforms/android/app/src/main/res/drawable/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/platforms/android/app/src/main/res/layout/activity_main.xml +12 -0
- package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
- package/platforms/android/app/src/main/res/values/strings.xml +7 -0
- package/platforms/android/app/src/main/res/values/styles.xml +22 -0
- package/platforms/android/app/src/main/res/xml/file_paths.xml +5 -0
- package/platforms/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +18 -0
- package/platforms/android/build.gradle +63 -0
- package/platforms/android/capacitor-cordova-android-plugins/build.gradle +53 -0
- package/platforms/android/capacitor-cordova-android-plugins/cordova.variables.gradle +3 -0
- package/platforms/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml +3 -0
- package/platforms/android/capacitor-cordova-android-plugins/src/main/java/.gitkeep +1 -0
- package/platforms/android/capacitor-cordova-android-plugins/src/main/res/.gitkeep +1 -0
- package/platforms/android/capacitor.settings.gradle +45 -0
- package/platforms/android/fastlane/Appfile +2 -0
- package/platforms/android/fastlane/Fastfile +59 -0
- package/platforms/android/fastlane/metadata/android/en-US/full_description.txt +24 -0
- package/platforms/android/fastlane/metadata/android/en-US/short_description.txt +1 -0
- package/platforms/android/fastlane/metadata/android/en-US/title.txt +1 -0
- package/platforms/android/fastlane/metadata/android/en-US/video.txt +0 -0
- package/platforms/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/platforms/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/platforms/android/gradle.properties +27 -0
- package/platforms/android/gradlew +251 -0
- package/platforms/android/gradlew.bat +94 -0
- package/platforms/android/settings.gradle +13 -0
- package/platforms/android/variables.gradle +17 -0
- package/platforms/electrobun/.generated/brand-config.json +8 -0
- package/platforms/electrobun/README.md +44 -0
- package/platforms/electrobun/assets/appIcon.ico +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_128x128.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_128x128@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_16x16.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_16x16@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_256x256.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_256x256@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_32x32.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_32x32@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_512x512.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_512x512@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.png +0 -0
- package/platforms/electrobun/assets/brand-config.json +8 -0
- package/platforms/electrobun/biome.json +11 -0
- package/platforms/electrobun/electrobun.config.ts +435 -0
- package/platforms/electrobun/entitlements/README.md +54 -0
- package/platforms/electrobun/entitlements/mas-child.entitlements +10 -0
- package/platforms/electrobun/entitlements/mas.entitlements +41 -0
- package/platforms/electrobun/native/macos/window-effects.mm +1030 -0
- package/platforms/electrobun/package.json +42 -0
- package/platforms/electrobun/scripts/bin/zip +2 -0
- package/platforms/electrobun/scripts/build-macos-effects.sh +31 -0
- package/platforms/electrobun/scripts/build-whisper-universal.sh +137 -0
- package/platforms/electrobun/scripts/build-whisper.sh +95 -0
- package/platforms/electrobun/scripts/ensure-whisper-model.sh +93 -0
- package/platforms/electrobun/scripts/hdiutil-wrapper.sh +33 -0
- package/platforms/electrobun/scripts/lib/app-dir.mjs +74 -0
- package/platforms/electrobun/scripts/lib/repo-root.mjs +77 -0
- package/platforms/electrobun/scripts/local-adhoc-sign-macos.ts +214 -0
- package/platforms/electrobun/scripts/macos-direct-launcher.c +84 -0
- package/platforms/electrobun/scripts/postwrap-diagnostics.ts +423 -0
- package/platforms/electrobun/scripts/postwrap-sign-runtime-macos.ts +352 -0
- package/platforms/electrobun/scripts/sign-windows.ps1 +121 -0
- package/platforms/electrobun/scripts/smoke-test-windows.ps1 +907 -0
- package/platforms/electrobun/scripts/smoke-test.sh +1186 -0
- package/platforms/electrobun/scripts/stage-macos-release-artifacts.sh +491 -0
- package/platforms/electrobun/scripts/sync-web-assets.mjs +48 -0
- package/platforms/electrobun/scripts/verify-rpc-handlers.ts +162 -0
- package/platforms/electrobun/scripts/verify-windows-installer-proof.ps1 +203 -0
- package/platforms/electrobun/scripts/xcrun-wrapper.sh +80 -0
- package/platforms/electrobun/scripts/zip-wrapper.sh +6 -0
- package/platforms/electrobun/src/__stubs__/bun-ffi.ts +51 -0
- package/platforms/electrobun/src/__stubs__/electrobun-bun.ts +20 -0
- package/platforms/electrobun/src/agent-ready-state.ts +35 -0
- package/platforms/electrobun/src/agent-reset-from-main.ts +87 -0
- package/platforms/electrobun/src/api-base.ts +169 -0
- package/platforms/electrobun/src/application-menu-action-registry.ts +21 -0
- package/platforms/electrobun/src/application-menu.ts +418 -0
- package/platforms/electrobun/src/background-notice.ts +65 -0
- package/platforms/electrobun/src/brand-config.ts +184 -0
- package/platforms/electrobun/src/bridge/browser-tabs-renderer-registry.ts +60 -0
- package/platforms/electrobun/src/bridge/electrobun-direct-rpc.ts +430 -0
- package/platforms/electrobun/src/bridge/electrobun-preload.ts +1 -0
- package/platforms/electrobun/src/bridge/electrobun-stub.ts +21 -0
- package/platforms/electrobun/src/browser-workspace-bridge-server.ts +284 -0
- package/platforms/electrobun/src/cloud-auth-window.ts +216 -0
- package/platforms/electrobun/src/cloud-disconnect-from-main.ts +118 -0
- package/platforms/electrobun/src/constants.ts +2 -0
- package/platforms/electrobun/src/desktop-http-request.test.ts +85 -0
- package/platforms/electrobun/src/desktop-http-request.ts +103 -0
- package/platforms/electrobun/src/desktop-test-bridge-server.ts +248 -0
- package/platforms/electrobun/src/devtools-layout.ts +63 -0
- package/platforms/electrobun/src/diagnostic-format.ts +65 -0
- package/platforms/electrobun/src/fatal-shutdown.test.ts +30 -0
- package/platforms/electrobun/src/fatal-shutdown.ts +10 -0
- package/platforms/electrobun/src/floating-chat-window.ts +239 -0
- package/platforms/electrobun/src/index.ts +2510 -0
- package/platforms/electrobun/src/libMacWindowEffects.dylib +0 -0
- package/platforms/electrobun/src/lifecycle/api-base-owner.ts +119 -0
- package/platforms/electrobun/src/lifecycle/desktop-session-prime.ts +77 -0
- package/platforms/electrobun/src/logger.ts +23 -0
- package/platforms/electrobun/src/main-window-runtime.ts +117 -0
- package/platforms/electrobun/src/main-window-session.ts +88 -0
- package/platforms/electrobun/src/menu-reset-from-main.ts +211 -0
- package/platforms/electrobun/src/native/agent.ts +1963 -0
- package/platforms/electrobun/src/native/auth-bridge.ts +525 -0
- package/platforms/electrobun/src/native/browser-workspace.ts +574 -0
- package/platforms/electrobun/src/native/camera.ts +68 -0
- package/platforms/electrobun/src/native/canvas.ts +504 -0
- package/platforms/electrobun/src/native/credentials.ts +765 -0
- package/platforms/electrobun/src/native/desktop.ts +2317 -0
- package/platforms/electrobun/src/native/editor-bridge.ts +292 -0
- package/platforms/electrobun/src/native/file-watcher.ts +220 -0
- package/platforms/electrobun/src/native/gateway.ts +218 -0
- package/platforms/electrobun/src/native/gpu-window.ts +301 -0
- package/platforms/electrobun/src/native/index.ts +105 -0
- package/platforms/electrobun/src/native/location.ts +110 -0
- package/platforms/electrobun/src/native/loopback-port.ts +81 -0
- package/platforms/electrobun/src/native/mac-window-effects.ts +178 -0
- package/platforms/electrobun/src/native/music-player.ts +61 -0
- package/platforms/electrobun/src/native/permissions-shared.ts +171 -0
- package/platforms/electrobun/src/native/permissions.ts +242 -0
- package/platforms/electrobun/src/native/power-state.ts +195 -0
- package/platforms/electrobun/src/native/screencapture.ts +654 -0
- package/platforms/electrobun/src/native/steward.ts +343 -0
- package/platforms/electrobun/src/native/swabble.ts +349 -0
- package/platforms/electrobun/src/native/talkmode.ts +441 -0
- package/platforms/electrobun/src/native/webgpu-browser-support.ts +220 -0
- package/platforms/electrobun/src/native/whisper.ts +280 -0
- package/platforms/electrobun/src/preload-validation.ts +65 -0
- package/platforms/electrobun/src/preload.js +1 -0
- package/platforms/electrobun/src/print-electrobun-dev-settings-banner.ts +140 -0
- package/platforms/electrobun/src/renderer-static.ts +77 -0
- package/platforms/electrobun/src/rpc-handlers.ts +1079 -0
- package/platforms/electrobun/src/rpc-schema.ts +1870 -0
- package/platforms/electrobun/src/runtime-layout.ts +150 -0
- package/platforms/electrobun/src/runtime-permissions.ts +131 -0
- package/platforms/electrobun/src/screenshot-dev-server.ts +125 -0
- package/platforms/electrobun/src/startup-trace.ts +351 -0
- package/platforms/electrobun/src/surface-windows.ts +475 -0
- package/platforms/electrobun/src/types/web-speech.d.ts +52 -0
- package/platforms/electrobun/src/types.ts +18 -0
- package/platforms/electrobun/src/windows-cef-profile.ts +124 -0
- package/platforms/electrobun/tsconfig.json +75 -0
- package/platforms/electrobun/vitest.electrobun.config.ts +54 -0
- package/platforms/ios/App/App/App.entitlements +18 -0
- package/platforms/ios/App/App/AppDelegate.swift +93 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-marketing-1024.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-83_5x83_5@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +116 -0
- package/platforms/ios/App/App/Assets.xcassets/Contents.json +6 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
- package/platforms/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
- package/platforms/ios/App/App/Base.lproj/Main.storyboard +19 -0
- package/platforms/ios/App/App/ElizaIntentPlugin.swift +185 -0
- package/platforms/ios/App/App/Info.plist +123 -0
- package/platforms/ios/App/App/PrivacyInfo.xcprivacy +55 -0
- package/platforms/ios/App/App/SceneDelegate.swift +77 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/ActionRequestHandler.swift +142 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/Info.plist +29 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/PrivacyInfo.xcprivacy +23 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/WebsiteBlockerContentExtension.entitlements +10 -0
- package/platforms/ios/App/App.xcodeproj/project.pbxproj +596 -0
- package/platforms/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
- package/platforms/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/platforms/ios/App/ExportOptions.plist +18 -0
- package/platforms/ios/App/Podfile +51 -0
- package/platforms/ios/App/Podfile.lock +131 -0
- package/platforms/ios/Gemfile +6 -0
- package/platforms/ios/fastlane/Appfile +4 -0
- package/platforms/ios/fastlane/Fastfile +94 -0
- package/platforms/ios/fastlane/Matchfile +12 -0
- package/platforms/ios/fastlane/metadata/en-US/description.txt +22 -0
- package/platforms/ios/fastlane/metadata/en-US/keywords.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/marketing_url.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/name.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/privacy_url.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/promotional_text.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/subtitle.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/support_url.txt +1 -0
- package/register-runtime-hooks.d.ts +2 -0
- package/register-runtime-hooks.d.ts.map +1 -0
- package/register-runtime-hooks.js +13 -0
- package/registry/generate-apps.d.ts +2 -0
- package/registry/generate-apps.d.ts.map +1 -0
- package/registry/generate-apps.js +338 -0
- package/registry/generate.d.ts +2 -0
- package/registry/generate.d.ts.map +1 -0
- package/registry/generate.js +506 -0
- package/registry/index.d.ts +6 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.js +68 -0
- package/registry/loader.d.ts +27 -0
- package/registry/loader.d.ts.map +1 -0
- package/registry/loader.js +111 -0
- package/registry/schema.d.ts +989 -0
- package/registry/schema.d.ts.map +1 -0
- package/registry/schema.js +264 -0
- package/runtime/api-dev-settings-banner.d.ts +7 -0
- package/runtime/api-dev-settings-banner.d.ts.map +1 -0
- package/runtime/api-dev-settings-banner.js +104 -0
- package/runtime/app-route-plugin-registry.d.ts +3 -0
- package/runtime/app-route-plugin-registry.d.ts.map +1 -0
- package/runtime/app-route-plugin-registry.js +1 -0
- package/runtime/build-character-from-config.d.ts +3 -0
- package/runtime/build-character-from-config.d.ts.map +1 -0
- package/runtime/build-character-from-config.js +59 -0
- package/runtime/build-variant.d.ts +8 -0
- package/runtime/build-variant.d.ts.map +1 -0
- package/runtime/build-variant.js +7 -0
- package/runtime/channel-plugin-map.d.ts +6 -0
- package/runtime/channel-plugin-map.d.ts.map +1 -0
- package/runtime/channel-plugin-map.js +38 -0
- package/runtime/dev-server.d.ts +2 -0
- package/runtime/dev-server.d.ts.map +1 -0
- package/runtime/dev-server.js +383 -0
- package/runtime/dev-settings-figlet-heading.d.ts +22 -0
- package/runtime/dev-settings-figlet-heading.d.ts.map +1 -0
- package/runtime/dev-settings-figlet-heading.js +55 -0
- package/runtime/eliza.d.ts +21 -0
- package/runtime/eliza.d.ts.map +1 -0
- package/runtime/eliza.js +863 -0
- package/runtime/embedding-manager-support.d.ts +77 -0
- package/runtime/embedding-manager-support.d.ts.map +1 -0
- package/runtime/embedding-manager-support.js +309 -0
- package/runtime/embedding-presets.d.ts +5 -0
- package/runtime/embedding-presets.d.ts.map +1 -0
- package/runtime/embedding-presets.js +47 -0
- package/runtime/embedding-warmup-policy.d.ts +13 -0
- package/runtime/embedding-warmup-policy.d.ts.map +1 -0
- package/runtime/embedding-warmup-policy.js +33 -0
- package/runtime/ensure-local-inference-handler.d.ts +25 -0
- package/runtime/ensure-local-inference-handler.d.ts.map +1 -0
- package/runtime/ensure-local-inference-handler.js +389 -0
- package/runtime/ensure-text-to-speech-handler.d.ts +18 -0
- package/runtime/ensure-text-to-speech-handler.d.ts.map +1 -0
- package/runtime/ensure-text-to-speech-handler.js +50 -0
- package/runtime/error-handlers.d.ts +12 -0
- package/runtime/error-handlers.d.ts.map +1 -0
- package/runtime/error-handlers.js +49 -0
- package/runtime/mobile-local-inference-gate.d.ts +21 -0
- package/runtime/mobile-local-inference-gate.d.ts.map +1 -0
- package/runtime/mobile-local-inference-gate.js +24 -0
- package/runtime/mobile-safe-runtime.d.ts +123 -0
- package/runtime/mobile-safe-runtime.d.ts.map +1 -0
- package/runtime/mobile-safe-runtime.js +290 -0
- package/runtime/mode/remote-forwarder.d.ts +35 -0
- package/runtime/mode/remote-forwarder.d.ts.map +1 -0
- package/runtime/mode/remote-forwarder.js +119 -0
- package/runtime/mode/route-mode-guard.d.ts +21 -0
- package/runtime/mode/route-mode-guard.d.ts.map +1 -0
- package/runtime/mode/route-mode-guard.js +30 -0
- package/runtime/mode/route-mode-matrix.d.ts +64 -0
- package/runtime/mode/route-mode-matrix.d.ts.map +1 -0
- package/runtime/mode/route-mode-matrix.js +125 -0
- package/runtime/mode/runtime-mode.d.ts +72 -0
- package/runtime/mode/runtime-mode.d.ts.map +1 -0
- package/runtime/mode/runtime-mode.js +167 -0
- package/runtime/runtime-bootstrap-policy.d.ts +17 -0
- package/runtime/runtime-bootstrap-policy.d.ts.map +1 -0
- package/runtime/runtime-bootstrap-policy.js +37 -0
- package/runtime/sandbox-policy.d.ts +8 -0
- package/runtime/sandbox-policy.d.ts.map +1 -0
- package/runtime/sandbox-policy.js +7 -0
- package/runtime/startup-overlay.d.ts +14 -0
- package/runtime/startup-overlay.d.ts.map +1 -0
- package/runtime/startup-overlay.js +55 -0
- package/runtime/telegram-standalone-handler.d.ts +34 -0
- package/runtime/telegram-standalone-handler.d.ts.map +1 -0
- package/runtime/telegram-standalone-handler.js +195 -0
- package/runtime/telegram-standalone-policy.d.ts +2 -0
- package/runtime/telegram-standalone-policy.d.ts.map +1 -0
- package/runtime/telegram-standalone-policy.js +14 -0
- package/scripts/README.md +27 -0
- package/scripts/align-electrobun-version.mjs +37 -0
- package/scripts/aosp/README.md +66 -0
- package/scripts/aosp/avd-test.mjs +403 -0
- package/scripts/aosp/boot-validate.mjs +536 -0
- package/scripts/aosp/build-aosp.mjs +448 -0
- package/scripts/aosp/build-bootanimation.mjs +178 -0
- package/scripts/aosp/capture-screens.mjs +325 -0
- package/scripts/aosp/compile-libllama.mjs +1333 -0
- package/scripts/aosp/compile-shim.mjs +328 -0
- package/scripts/aosp/e2e-validate.mjs +225 -0
- package/scripts/aosp/lib/load-variant-config.mjs +182 -0
- package/scripts/aosp/lint-init-rc.mjs +258 -0
- package/scripts/aosp/llama-cpp-patches/README.md +49 -0
- package/scripts/aosp/llama-cpp-patches/apply-patches.mjs +198 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0001-Q4_POLAR-register-GGML_TYPE_Q4_POLAR-45-and-block_q4.patch +108 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0002-Q4_POLAR-vendor-PolarQuant-ref-kernels-into-ggml-bas.patch +460 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0003-tests-cover-Q4_POLAR-fix-latent-buffer-overflow.patch +102 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0004-Q4_POLAR-gate-QJL-residual-on-runtime-flag-default-o.patch +97 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0001-ggml-add-GGML_TYPE_QJL1_256-GGML_OP_ATTN_SCORE_QJL-e.patch +120 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0002-ggml-register-QJL1_256-type-traits-ATTN_SCORE_QJL-op.patch +1392 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0003-ggml-set-QJL1_256-blck_size-to-head_dim-128-not-sket.patch +56 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0004-tests-add-test-qjl-cache-verifying-type-traits-score.patch +335 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0005-ggml-flip-block_qjl1_256-to-signs-then-norm.patch +69 -0
- package/scripts/aosp/llama-shim/eliza_llama_shim.c +276 -0
- package/scripts/aosp/seccomp-shim/loader-wrap.c +141 -0
- package/scripts/aosp/seccomp-shim/sigsys-handler.c +338 -0
- package/scripts/aosp/sim.mjs +277 -0
- package/scripts/aosp/smoke-cuttlefish.mjs +673 -0
- package/scripts/aosp/stage-default-models.mjs +340 -0
- package/scripts/aosp/stage-models-dfm.mjs +384 -0
- package/scripts/aosp/sync-to-aosp.mjs +134 -0
- package/scripts/aosp/validate.mjs +1273 -0
- package/scripts/aosp/variant-config-schema.ts +10 -0
- package/scripts/audit-live-test-surface.mjs +590 -0
- package/scripts/audit-server-test-surface.mjs +163 -0
- package/scripts/benchmark-preflight.mjs +170 -0
- package/scripts/bin/.gitkeep +0 -0
- package/scripts/build-bundled-agent-skills-artifact.mjs +58 -0
- package/scripts/build-bundled-orchestrator-artifact.mjs +66 -0
- package/scripts/build-capacitor-app.mjs +122 -0
- package/scripts/build-electrobun-preload.mjs +117 -0
- package/scripts/build-flatpak.mjs +125 -0
- package/scripts/build-image.sh +461 -0
- package/scripts/build-llama-cpp-dflash.mjs +1866 -0
- package/scripts/build-native-plugins.mjs +153 -0
- package/scripts/build-patched-electrobun-cli.mjs +424 -0
- package/scripts/build-win.mjs +82 -0
- package/scripts/bump-elizaos.sh +438 -0
- package/scripts/check-i18n.mjs +328 -0
- package/scripts/check-secret-hygiene.mjs +344 -0
- package/scripts/check-upstream-drift.mjs +102 -0
- package/scripts/clean-repo.mjs +187 -0
- package/scripts/codesign-mas.mjs +297 -0
- package/scripts/container-entrypoint.mjs +101 -0
- package/scripts/coordinator-cross-platform-review.mjs +192 -0
- package/scripts/copy-package-assets.mjs +31 -0
- package/scripts/copy-runtime-node-modules.ts +1782 -0
- package/scripts/coverage-policy.d.mts +16 -0
- package/scripts/coverage-policy.mjs +38 -0
- package/scripts/css-coverage.mjs +241 -0
- package/scripts/deploy-image.sh +318 -0
- package/scripts/desktop-build.mjs +867 -0
- package/scripts/desktop-stack-status.mjs +80 -0
- package/scripts/dev-platform.mjs +975 -0
- package/scripts/dev-ui.mjs +1178 -0
- package/scripts/dev-win.mjs +25 -0
- package/scripts/disable-local-eliza-workspace.mjs +420 -0
- package/scripts/docker-ci-smoke.sh +500 -0
- package/scripts/docker-entrypoint.sh +11 -0
- package/scripts/docker-runtime-review.mjs +230 -0
- package/scripts/docs-list.js +206 -0
- package/scripts/ensure-avatars.mjs +335 -0
- package/scripts/ensure-bundled-workspaces.mjs +143 -0
- package/scripts/ensure-capacitor-platform.mjs +58 -0
- package/scripts/ensure-electrobun-core.mjs +318 -0
- package/scripts/ensure-generated-core-proto-js.mjs +125 -0
- package/scripts/ensure-shared-i18n-data.mjs +67 -0
- package/scripts/ensure-skills.mjs +177 -0
- package/scripts/ensure-type-package-aliases.mjs +246 -0
- package/scripts/ensure-vision-deps.mjs +196 -0
- package/scripts/entry.ts +11 -0
- package/scripts/find-collisions.mjs +765 -0
- package/scripts/find-duplicate-components.mjs +203 -0
- package/scripts/fix-workspace-deps.mjs +328 -0
- package/scripts/generate-onboarding-voicelines.mjs +194 -0
- package/scripts/generate-plugin-index.js +1055 -0
- package/scripts/generate-static-asset-manifest.mjs +15 -0
- package/scripts/generated/static-asset-manifest.json +4 -0
- package/scripts/i18n-dynamic-keys.json +128 -0
- package/scripts/init-submodules.mjs +425 -0
- package/scripts/ios-xcframework/README.md +233 -0
- package/scripts/ios-xcframework/build-xcframework.mjs +487 -0
- package/scripts/kernel-patches/metal-kernels.mjs +656 -0
- package/scripts/kernel-patches/vulkan-dispatch-patches/01-vulkan-shaders-gen.patch +41 -0
- package/scripts/kernel-patches/vulkan-dispatch-patches/02-ggml-vulkan-pipelines.patch +86 -0
- package/scripts/kernel-patches/vulkan-kernels.mjs +281 -0
- package/scripts/lib/allocate-loopback-port.mjs +58 -0
- package/scripts/lib/api-supervisor.mjs +115 -0
- package/scripts/lib/app-dir.mjs +74 -0
- package/scripts/lib/asset-cdn.mjs +118 -0
- package/scripts/lib/bun-version-guard.mjs +44 -0
- package/scripts/lib/capacitor-platform-templates.mjs +306 -0
- package/scripts/lib/capacitor-plugin-build-needed.mjs +79 -0
- package/scripts/lib/capacitor-plugin-names.mjs +35 -0
- package/scripts/lib/desktop-preflight.mjs +122 -0
- package/scripts/lib/desktop-stack-status.mjs +151 -0
- package/scripts/lib/dev-ui-onchain.mjs +22 -0
- package/scripts/lib/dev-ui-vision.mjs +15 -0
- package/scripts/lib/kill-process-tree.mjs +87 -0
- package/scripts/lib/kill-ui-listen-port.mjs +74 -0
- package/scripts/lib/node-path-env.mjs +11 -0
- package/scripts/lib/orchestrator-desktop-dev-banner.mjs +285 -0
- package/scripts/lib/patch-bun-exports.mjs +1446 -0
- package/scripts/lib/read-app-identity.mjs +54 -0
- package/scripts/lib/release-check-pack-dry-run.ts +34 -0
- package/scripts/lib/repo-root.mjs +77 -0
- package/scripts/lib/stage-android-agent.mjs +704 -0
- package/scripts/lib/static-asset-manifest.mjs +151 -0
- package/scripts/lib/sync-eliza-env-aliases.mjs +37 -0
- package/scripts/lib/vite-renderer-dist-stale.mjs +141 -0
- package/scripts/lib/workspace-discovery.mjs +108 -0
- package/scripts/lifeops-prompt-benchmark.ts +206 -0
- package/scripts/link-browser-server.mjs +157 -0
- package/scripts/link-docker-local-app-packages.mjs +345 -0
- package/scripts/link-external-plugins.mjs +195 -0
- package/scripts/mobile-auth-simulator-smoke.mjs +373 -0
- package/scripts/normalize-parallax-capture.ts +97 -0
- package/scripts/omnivoice-fuse/Makefile +44 -0
- package/scripts/omnivoice-fuse/README.md +266 -0
- package/scripts/omnivoice-fuse/cmake-graft.mjs +180 -0
- package/scripts/omnivoice-fuse/ffi-stub.c +222 -0
- package/scripts/omnivoice-fuse/ffi.h +158 -0
- package/scripts/omnivoice-fuse/libelizainference_stub.dylib +0 -0
- package/scripts/omnivoice-fuse/prepare.mjs +263 -0
- package/scripts/omnivoice-fuse/verify-symbols.mjs +138 -0
- package/scripts/pack-upstreams.mjs +392 -0
- package/scripts/patch-deps.mjs +597 -0
- package/scripts/patch-workspace-plugins.mjs +148 -0
- package/scripts/playwright-ui-live-stack.ts +667 -0
- package/scripts/playwright-ui-smoke-api-stub.mjs +1838 -0
- package/scripts/plugin-index-local-additions.json +12 -0
- package/scripts/plugin-metadata-overrides.json +165 -0
- package/scripts/pre-review-local.mjs +599 -0
- package/scripts/prepare-ios-cocoapods.sh +30 -0
- package/scripts/prepare-package-dist.mjs +358 -0
- package/scripts/process-vrms.mjs +203 -0
- package/scripts/prune-cdn-local-assets.mjs +44 -0
- package/scripts/publish-local-plugins-next.mjs +122 -0
- package/scripts/release-check.ts +1402 -0
- package/scripts/relink-workspace-packages-to-dist.mjs +115 -0
- package/scripts/replace-workspace-versions.mjs +128 -0
- package/scripts/report-coverage-surfaces.mjs +121 -0
- package/scripts/restore-workspace-refs.mjs +128 -0
- package/scripts/rt.mjs +29 -0
- package/scripts/rt.sh +4 -0
- package/scripts/run-biome-check.mjs +191 -0
- package/scripts/run-coding-agent-e2e.mjs +46 -0
- package/scripts/run-desktop-playwright.mjs +35 -0
- package/scripts/run-local-plugin-live-smoke.mjs +185 -0
- package/scripts/run-mobile-build.mjs +3308 -0
- package/scripts/run-node-runtime.mjs +75 -0
- package/scripts/run-node-tsx.mjs +62 -0
- package/scripts/run-node.mjs +294 -0
- package/scripts/run-playwright.mjs +66 -0
- package/scripts/run-production-build.mjs +138 -0
- package/scripts/run-release-contract-suite.mjs +57 -0
- package/scripts/run-repo-setup.mjs +230 -0
- package/scripts/run-screenshotter.mjs +140 -0
- package/scripts/run-ui-smoke-playwright-suite.mjs +96 -0
- package/scripts/run-windows-smoke-launcher.ps1 +35 -0
- package/scripts/run-with-env.mjs +60 -0
- package/scripts/runtime-package-manifest.ts +107 -0
- package/scripts/sandbox-setup.sh +7 -0
- package/scripts/sanitize-npm-package-metadata.mjs +165 -0
- package/scripts/set-package-version.mjs +13 -0
- package/scripts/setup-upstreams.mjs +838 -0
- package/scripts/smoke-api-status.mjs +113 -0
- package/scripts/smoke-lifeops.mjs +305 -0
- package/scripts/startup-integration-script-drift.test.ts +94 -0
- package/scripts/sync-desktop-renderer.mjs +308 -0
- package/scripts/sync-dod-gap-issues-lib.mjs +214 -0
- package/scripts/sync-dod-gap-issues.mjs +218 -0
- package/scripts/type-audit.mjs +606 -0
- package/scripts/validate-cdn-assets.mjs +307 -0
- package/scripts/validate-regression-matrix.mjs +360 -0
- package/scripts/workspace-plugin-patches/plugin-anthropic-elizaos-core-api-compat.patch +34 -0
- package/scripts/workspace-prepare.mjs +192 -0
- package/scripts/worktree-env.sh +41 -0
- package/scripts/write-build-info.ts +69 -0
- package/scripts/write-homepage-release-data.mjs +393 -0
- package/security/agent-vault-id.d.ts +16 -0
- package/security/agent-vault-id.d.ts.map +1 -0
- package/security/agent-vault-id.js +32 -0
- package/security/cloud-secret-store.d.ts +34 -0
- package/security/cloud-secret-store.d.ts.map +1 -0
- package/security/cloud-secret-store.js +65 -0
- package/security/export-guard.d.ts +34 -0
- package/security/export-guard.d.ts.map +1 -0
- package/security/export-guard.js +127 -0
- package/security/hydrate-wallet-keys-from-platform-store.d.ts +13 -0
- package/security/hydrate-wallet-keys-from-platform-store.d.ts.map +1 -0
- package/security/hydrate-wallet-keys-from-platform-store.js +116 -0
- package/security/platform-secure-store-node.d.ts +13 -0
- package/security/platform-secure-store-node.d.ts.map +1 -0
- package/security/platform-secure-store-node.js +311 -0
- package/security/platform-secure-store.d.ts +47 -0
- package/security/platform-secure-store.d.ts.map +1 -0
- package/security/platform-secure-store.js +10 -0
- package/security/wallet-os-store-actions.d.ts +45 -0
- package/security/wallet-os-store-actions.d.ts.map +1 -0
- package/security/wallet-os-store-actions.js +125 -0
- package/services/account-pool.d.ts +134 -0
- package/services/account-pool.d.ts.map +1 -0
- package/services/account-pool.js +693 -0
- package/services/account-usage.d.ts +75 -0
- package/services/account-usage.d.ts.map +1 -0
- package/services/account-usage.js +179 -0
- package/services/auth-store.d.ts +179 -0
- package/services/auth-store.d.ts.map +1 -0
- package/services/auth-store.js +404 -0
- package/services/cloud-jwks-store.d.ts +62 -0
- package/services/cloud-jwks-store.d.ts.map +1 -0
- package/services/cloud-jwks-store.js +118 -0
- package/services/connector-target-catalog.d.ts +78 -0
- package/services/connector-target-catalog.d.ts.map +1 -0
- package/services/connector-target-catalog.js +64 -0
- package/services/discord-target-source.d.ts +53 -0
- package/services/discord-target-source.d.ts.map +1 -0
- package/services/discord-target-source.js +116 -0
- package/services/github-credentials.d.ts +95 -0
- package/services/github-credentials.d.ts.map +1 -0
- package/services/github-credentials.js +144 -0
- package/services/local-inference/__stress__/cache-stress-helpers.d.ts +76 -0
- package/services/local-inference/__stress__/cache-stress-helpers.d.ts.map +1 -0
- package/services/local-inference/__stress__/cache-stress-helpers.js +238 -0
- package/services/local-inference/active-model.d.ts +180 -0
- package/services/local-inference/active-model.d.ts.map +1 -0
- package/services/local-inference/active-model.js +362 -0
- package/services/local-inference/assignments.d.ts +58 -0
- package/services/local-inference/assignments.d.ts.map +1 -0
- package/services/local-inference/assignments.js +179 -0
- package/services/local-inference/backend.d.ts +200 -0
- package/services/local-inference/backend.d.ts.map +1 -0
- package/services/local-inference/backend.js +242 -0
- package/services/local-inference/bundled-models.d.ts +34 -0
- package/services/local-inference/bundled-models.d.ts.map +1 -0
- package/services/local-inference/bundled-models.js +104 -0
- package/services/local-inference/cache-bridge.d.ts +184 -0
- package/services/local-inference/cache-bridge.d.ts.map +1 -0
- package/services/local-inference/cache-bridge.js +333 -0
- package/services/local-inference/catalog.d.ts +57 -0
- package/services/local-inference/catalog.d.ts.map +1 -0
- package/services/local-inference/catalog.js +262 -0
- package/services/local-inference/conversation-registry.d.ts +122 -0
- package/services/local-inference/conversation-registry.d.ts.map +1 -0
- package/services/local-inference/conversation-registry.js +182 -0
- package/services/local-inference/device-bridge.d.ts +139 -0
- package/services/local-inference/device-bridge.d.ts.map +1 -0
- package/services/local-inference/device-bridge.js +774 -0
- package/services/local-inference/dflash-doctor.d.ts +27 -0
- package/services/local-inference/dflash-doctor.d.ts.map +1 -0
- package/services/local-inference/dflash-doctor.js +149 -0
- package/services/local-inference/dflash-server.d.ts +248 -0
- package/services/local-inference/dflash-server.d.ts.map +1 -0
- package/services/local-inference/dflash-server.js +1076 -0
- package/services/local-inference/downloader.d.ts +48 -0
- package/services/local-inference/downloader.d.ts.map +1 -0
- package/services/local-inference/downloader.js +688 -0
- package/services/local-inference/engine.d.ts +282 -0
- package/services/local-inference/engine.d.ts.map +1 -0
- package/services/local-inference/engine.js +743 -0
- package/services/local-inference/external-scanner.d.ts +17 -0
- package/services/local-inference/external-scanner.d.ts.map +1 -0
- package/services/local-inference/external-scanner.js +261 -0
- package/services/local-inference/handler-registry.d.ts +72 -0
- package/services/local-inference/handler-registry.d.ts.map +1 -0
- package/services/local-inference/handler-registry.js +159 -0
- package/services/local-inference/hardware.d.ts +26 -0
- package/services/local-inference/hardware.d.ts.map +1 -0
- package/services/local-inference/hardware.js +139 -0
- package/services/local-inference/hf-search.d.ts +19 -0
- package/services/local-inference/hf-search.d.ts.map +1 -0
- package/services/local-inference/hf-search.js +169 -0
- package/services/local-inference/index.d.ts +10 -0
- package/services/local-inference/index.d.ts.map +1 -0
- package/services/local-inference/index.js +7 -0
- package/services/local-inference/llama-server-metrics.d.ts +108 -0
- package/services/local-inference/llama-server-metrics.d.ts.map +1 -0
- package/services/local-inference/llama-server-metrics.js +175 -0
- package/services/local-inference/manifest/index.d.ts +4 -0
- package/services/local-inference/manifest/index.d.ts.map +1 -0
- package/services/local-inference/manifest/index.js +5 -0
- package/services/local-inference/manifest/schema.d.ts +419 -0
- package/services/local-inference/manifest/schema.d.ts.map +1 -0
- package/services/local-inference/manifest/schema.js +227 -0
- package/services/local-inference/manifest/types.d.ts +23 -0
- package/services/local-inference/manifest/types.d.ts.map +1 -0
- package/services/local-inference/manifest/types.js +5 -0
- package/services/local-inference/manifest/validator.d.ts +43 -0
- package/services/local-inference/manifest/validator.d.ts.map +1 -0
- package/services/local-inference/manifest/validator.js +180 -0
- package/services/local-inference/paths.d.ts +8 -0
- package/services/local-inference/paths.d.ts.map +1 -0
- package/services/local-inference/paths.js +7 -0
- package/services/local-inference/providers.d.ts +61 -0
- package/services/local-inference/providers.d.ts.map +1 -0
- package/services/local-inference/providers.js +334 -0
- package/services/local-inference/ram-budget.d.ts +57 -0
- package/services/local-inference/ram-budget.d.ts.map +1 -0
- package/services/local-inference/ram-budget.js +107 -0
- package/services/local-inference/readiness.d.ts +9 -0
- package/services/local-inference/readiness.d.ts.map +1 -0
- package/services/local-inference/readiness.js +153 -0
- package/services/local-inference/recommendation.d.ts +62 -0
- package/services/local-inference/recommendation.d.ts.map +1 -0
- package/services/local-inference/recommendation.js +309 -0
- package/services/local-inference/registry.d.ts +35 -0
- package/services/local-inference/registry.d.ts.map +1 -0
- package/services/local-inference/registry.js +117 -0
- package/services/local-inference/router-handler.d.ts +51 -0
- package/services/local-inference/router-handler.d.ts.map +1 -0
- package/services/local-inference/router-handler.js +165 -0
- package/services/local-inference/routing-policy.d.ts +55 -0
- package/services/local-inference/routing-policy.d.ts.map +1 -0
- package/services/local-inference/routing-policy.js +195 -0
- package/services/local-inference/routing-preferences.d.ts +8 -0
- package/services/local-inference/routing-preferences.d.ts.map +1 -0
- package/services/local-inference/routing-preferences.js +7 -0
- package/services/local-inference/service.d.ts +88 -0
- package/services/local-inference/service.d.ts.map +1 -0
- package/services/local-inference/service.js +210 -0
- package/services/local-inference/session-pool.d.ts +72 -0
- package/services/local-inference/session-pool.d.ts.map +1 -0
- package/services/local-inference/session-pool.js +125 -0
- package/services/local-inference/types.d.ts +309 -0
- package/services/local-inference/types.d.ts.map +1 -0
- package/services/local-inference/types.js +23 -0
- package/services/local-inference/verify.d.ts +8 -0
- package/services/local-inference/verify.d.ts.map +1 -0
- package/services/local-inference/verify.js +7 -0
- package/services/local-inference/voice/barge-in.d.ts +15 -0
- package/services/local-inference/voice/barge-in.d.ts.map +1 -0
- package/services/local-inference/voice/barge-in.js +20 -0
- package/services/local-inference/voice/engine-bridge.d.ts +256 -0
- package/services/local-inference/voice/engine-bridge.d.ts.map +1 -0
- package/services/local-inference/voice/engine-bridge.js +398 -0
- package/services/local-inference/voice/ffi-bindings.d.ts +114 -0
- package/services/local-inference/voice/ffi-bindings.d.ts.map +1 -0
- package/services/local-inference/voice/ffi-bindings.js +281 -0
- package/services/local-inference/voice/index.d.ts +51 -0
- package/services/local-inference/voice/index.d.ts.map +1 -0
- package/services/local-inference/voice/index.js +50 -0
- package/services/local-inference/voice/lifecycle.d.ts +135 -0
- package/services/local-inference/voice/lifecycle.d.ts.map +1 -0
- package/services/local-inference/voice/lifecycle.js +189 -0
- package/services/local-inference/voice/phoneme-tokenizer.d.ts +58 -0
- package/services/local-inference/voice/phoneme-tokenizer.d.ts.map +1 -0
- package/services/local-inference/voice/phoneme-tokenizer.js +53 -0
- package/services/local-inference/voice/phrase-cache.d.ts +24 -0
- package/services/local-inference/voice/phrase-cache.d.ts.map +1 -0
- package/services/local-inference/voice/phrase-cache.js +32 -0
- package/services/local-inference/voice/phrase-chunker.d.ts +20 -0
- package/services/local-inference/voice/phrase-chunker.d.ts.map +1 -0
- package/services/local-inference/voice/phrase-chunker.js +85 -0
- package/services/local-inference/voice/ring-buffer.d.ts +40 -0
- package/services/local-inference/voice/ring-buffer.d.ts.map +1 -0
- package/services/local-inference/voice/ring-buffer.js +85 -0
- package/services/local-inference/voice/rollback-queue.d.ts +24 -0
- package/services/local-inference/voice/rollback-queue.d.ts.map +1 -0
- package/services/local-inference/voice/rollback-queue.js +49 -0
- package/services/local-inference/voice/scheduler.d.ts +47 -0
- package/services/local-inference/voice/scheduler.d.ts.map +1 -0
- package/services/local-inference/voice/scheduler.js +123 -0
- package/services/local-inference/voice/shared-resources.d.ts +119 -0
- package/services/local-inference/voice/shared-resources.d.ts.map +1 -0
- package/services/local-inference/voice/shared-resources.js +83 -0
- package/services/local-inference/voice/speaker-preset-cache.d.ts +28 -0
- package/services/local-inference/voice/speaker-preset-cache.d.ts.map +1 -0
- package/services/local-inference/voice/speaker-preset-cache.js +44 -0
- package/services/local-inference/voice/types.d.ts +80 -0
- package/services/local-inference/voice/types.d.ts.map +1 -0
- package/services/local-inference/voice/voice-preset-format.d.ts +56 -0
- package/services/local-inference/voice/voice-preset-format.d.ts.map +1 -0
- package/services/local-inference/voice/voice-preset-format.js +184 -0
- package/services/persistence.d.ts +48 -0
- package/services/persistence.d.ts.map +1 -0
- package/services/persistence.js +128 -0
- package/services/plugin-installer.d.ts +22 -0
- package/services/plugin-installer.d.ts.map +1 -0
- package/services/plugin-installer.js +41 -0
- package/services/secrets-manager-installer.d.ts +140 -0
- package/services/secrets-manager-installer.d.ts.map +1 -0
- package/services/secrets-manager-installer.js +374 -0
- package/services/steward-credentials.d.ts +37 -0
- package/services/steward-credentials.d.ts.map +1 -0
- package/services/steward-credentials.js +93 -0
- package/services/steward-sidecar/health-check.d.ts +9 -0
- package/services/steward-sidecar/health-check.d.ts.map +1 -0
- package/services/steward-sidecar/health-check.js +34 -0
- package/services/steward-sidecar/helpers.d.ts +21 -0
- package/services/steward-sidecar/helpers.d.ts.map +1 -0
- package/services/steward-sidecar/helpers.js +71 -0
- package/services/steward-sidecar/process-management.d.ts +9 -0
- package/services/steward-sidecar/process-management.d.ts.map +1 -0
- package/services/steward-sidecar/process-management.js +53 -0
- package/services/steward-sidecar/types.d.ts +60 -0
- package/services/steward-sidecar/types.d.ts.map +1 -0
- package/services/steward-sidecar/types.js +17 -0
- package/services/steward-sidecar/wallet-setup.d.ts +9 -0
- package/services/steward-sidecar/wallet-setup.d.ts.map +1 -0
- package/services/steward-sidecar/wallet-setup.js +114 -0
- package/services/steward-sidecar.d.ts +70 -0
- package/services/steward-sidecar.d.ts.map +1 -0
- package/services/steward-sidecar.js +385 -0
- package/services/tool-call-cache/index.d.ts +13 -0
- package/services/tool-call-cache/index.d.ts.map +1 -0
- package/services/tool-call-cache/index.js +11 -0
- package/services/trigger-event-bridge.d.ts +52 -0
- package/services/trigger-event-bridge.d.ts.map +1 -0
- package/services/trigger-event-bridge.js +217 -0
- package/services/update-notifier.d.ts +6 -0
- package/services/update-notifier.d.ts.map +1 -0
- package/services/update-notifier.js +33 -0
- package/services/vault-bootstrap.d.ts +31 -0
- package/services/vault-bootstrap.d.ts.map +1 -0
- package/services/vault-bootstrap.js +209 -0
- package/services/vault-mirror.d.ts +44 -0
- package/services/vault-mirror.d.ts.map +1 -0
- package/services/vault-mirror.js +80 -0
- package/styles/electrobun-mac-window-drag.css +66 -0
- package/test/helpers/__tests__/live-agent-test.smoke.test.ts +105 -0
- package/test/helpers/action-assertions.ts +364 -0
- package/test/helpers/action-spy.ts +354 -0
- package/test/helpers/browser-launch.ts +103 -0
- package/test/helpers/browser-mocks.ts +275 -0
- package/test/helpers/conditional-tests.ts +42 -0
- package/test/helpers/conversation-harness.ts +334 -0
- package/test/helpers/http.ts +150 -0
- package/test/helpers/i18n.ts +5 -0
- package/test/helpers/isolated-config.ts +34 -0
- package/test/helpers/live-agent-test.ts +660 -0
- package/test/helpers/live-child-env.ts +72 -0
- package/test/helpers/live-provider.test.ts +124 -0
- package/test/helpers/live-provider.ts +362 -0
- package/test/helpers/live-runtime-server.ts +88 -0
- package/test/helpers/loopback.ts +33 -0
- package/test/helpers/pglite-runtime.ts +173 -0
- package/test/helpers/react-test.ts +40 -0
- package/test/helpers/real-connector.ts +250 -0
- package/test/helpers/real-runtime.ts +543 -0
- package/test/helpers/skip-without.ts +53 -0
- package/test/helpers/stochastic-test.ts +186 -0
- package/test/helpers/test-utils.ts +94 -0
- package/test/helpers/trajectory-assertions.ts +168 -0
- package/test/helpers/trajectory-harness.test.ts +101 -0
- package/test/helpers/trajectory-harness.ts +988 -0
- package/test/scripts/managed-test-command.mjs +632 -0
- package/test/scripts/task-agent-live-smoke.ts +1335 -0
- package/test/scripts/test-parallel.mjs +237 -0
- package/test/scripts/test-root-unit.mjs +169 -0
- package/test/scripts/test-runner.mjs +78 -0
- package/test/scripts/validate-all-features.sh +541 -0
- package/test-support/test-helpers.d.ts +111 -0
- package/test-support/test-helpers.d.ts.map +1 -0
- package/test-support/test-helpers.js +410 -0
- package/ui-compat.d.ts +3 -0
- package/ui-compat.d.ts.map +1 -0
- package/ui-compat.js +3 -0
- package/utils/eliza-root.d.ts +9 -0
- package/utils/eliza-root.d.ts.map +1 -0
- package/utils/eliza-root.js +101 -0
- package/utils/globals.d.ts +7 -0
- package/utils/globals.d.ts.map +1 -0
- package/utils/globals.js +47 -0
- package/App.d.ts +0 -5
- package/App.d.ts.map +0 -1
- package/App.js +0 -220
- package/LICENSE +0 -21
- package/actions/character.d.ts +0 -39
- package/actions/character.d.ts.map +0 -1
- package/actions/character.js +0 -247
- package/actions/chat-helpers.d.ts +0 -47
- package/actions/chat-helpers.d.ts.map +0 -1
- package/actions/chat-helpers.js +0 -79
- package/actions/cloud.d.ts +0 -17
- package/actions/cloud.d.ts.map +0 -1
- package/actions/cloud.js +0 -43
- package/actions/index.d.ts +0 -12
- package/actions/index.d.ts.map +0 -1
- package/actions/index.js +0 -11
- package/actions/lifecycle.d.ts +0 -43
- package/actions/lifecycle.d.ts.map +0 -1
- package/actions/lifecycle.js +0 -118
- package/actions/onboarding.d.ts +0 -13
- package/actions/onboarding.d.ts.map +0 -1
- package/actions/onboarding.js +0 -26
- package/actions/triggers.d.ts +0 -23
- package/actions/triggers.d.ts.map +0 -1
- package/actions/triggers.js +0 -148
- package/api/client.d.ts +0 -2742
- package/api/client.d.ts.map +0 -1
- package/api/client.js +0 -2520
- package/api/index.d.ts +0 -2
- package/api/index.d.ts.map +0 -1
- package/api/index.js +0 -1
- package/autonomy/index.d.ts +0 -48
- package/autonomy/index.d.ts.map +0 -1
- package/autonomy/index.js +0 -330
- package/bridge/capacitor-bridge.d.ts +0 -153
- package/bridge/capacitor-bridge.d.ts.map +0 -1
- package/bridge/capacitor-bridge.js +0 -193
- package/bridge/electrobun-rpc.d.ts +0 -28
- package/bridge/electrobun-rpc.d.ts.map +0 -1
- package/bridge/electrobun-rpc.js +0 -35
- package/bridge/electrobun-runtime.d.ts +0 -3
- package/bridge/electrobun-runtime.d.ts.map +0 -1
- package/bridge/electrobun-runtime.js +0 -17
- package/bridge/index.d.ts +0 -6
- package/bridge/index.d.ts.map +0 -1
- package/bridge/index.js +0 -5
- package/bridge/native-plugins.d.ts +0 -82
- package/bridge/native-plugins.d.ts.map +0 -1
- package/bridge/native-plugins.js +0 -39
- package/bridge/plugin-bridge.d.ts +0 -116
- package/bridge/plugin-bridge.d.ts.map +0 -1
- package/bridge/plugin-bridge.js +0 -203
- package/bridge/storage-bridge.d.ts +0 -39
- package/bridge/storage-bridge.d.ts.map +0 -1
- package/bridge/storage-bridge.js +0 -135
- package/chat/index.d.ts +0 -57
- package/chat/index.d.ts.map +0 -1
- package/chat/index.js +0 -160
- package/coding/index.d.ts +0 -25
- package/coding/index.d.ts.map +0 -1
- package/coding/index.js +0 -25
- package/components/AdvancedPageView.d.ts +0 -17
- package/components/AdvancedPageView.d.ts.map +0 -1
- package/components/AdvancedPageView.js +0 -146
- package/components/AgentActivityBox.d.ts +0 -7
- package/components/AgentActivityBox.d.ts.map +0 -1
- package/components/AgentActivityBox.js +0 -25
- package/components/ApiKeyConfig.d.ts +0 -26
- package/components/ApiKeyConfig.d.ts.map +0 -1
- package/components/ApiKeyConfig.js +0 -119
- package/components/AppsPageView.d.ts +0 -7
- package/components/AppsPageView.d.ts.map +0 -1
- package/components/AppsPageView.js +0 -31
- package/components/AppsView.d.ts +0 -8
- package/components/AppsView.d.ts.map +0 -1
- package/components/AppsView.js +0 -149
- package/components/AvatarLoader.d.ts +0 -13
- package/components/AvatarLoader.d.ts.map +0 -1
- package/components/AvatarLoader.js +0 -53
- package/components/AvatarSelector.d.ts +0 -23
- package/components/AvatarSelector.d.ts.map +0 -1
- package/components/AvatarSelector.js +0 -105
- package/components/BscTradePanel.d.ts +0 -22
- package/components/BscTradePanel.d.ts.map +0 -1
- package/components/BscTradePanel.js +0 -221
- package/components/BugReportModal.d.ts +0 -2
- package/components/BugReportModal.d.ts.map +0 -1
- package/components/BugReportModal.js +0 -219
- package/components/CharacterRoster.d.ts +0 -31
- package/components/CharacterRoster.d.ts.map +0 -1
- package/components/CharacterRoster.js +0 -41
- package/components/CharacterView.d.ts +0 -8
- package/components/CharacterView.d.ts.map +0 -1
- package/components/CharacterView.js +0 -685
- package/components/ChatAvatar.d.ts +0 -8
- package/components/ChatAvatar.d.ts.map +0 -1
- package/components/ChatAvatar.js +0 -89
- package/components/ChatComposer.d.ts +0 -37
- package/components/ChatComposer.d.ts.map +0 -1
- package/components/ChatComposer.js +0 -136
- package/components/ChatMessage.d.ts +0 -24
- package/components/ChatMessage.d.ts.map +0 -1
- package/components/ChatMessage.js +0 -187
- package/components/ChatModalView.d.ts +0 -10
- package/components/ChatModalView.d.ts.map +0 -1
- package/components/ChatModalView.js +0 -57
- package/components/ChatView.d.ts +0 -14
- package/components/ChatView.d.ts.map +0 -1
- package/components/ChatView.js +0 -526
- package/components/CloudOnboarding.d.ts +0 -7
- package/components/CloudOnboarding.d.ts.map +0 -1
- package/components/CloudOnboarding.js +0 -22
- package/components/CloudSourceControls.d.ts +0 -13
- package/components/CloudSourceControls.d.ts.map +0 -1
- package/components/CloudSourceControls.js +0 -16
- package/components/CodingAgentSettingsSection.d.ts +0 -8
- package/components/CodingAgentSettingsSection.d.ts.map +0 -1
- package/components/CodingAgentSettingsSection.js +0 -292
- package/components/CommandPalette.d.ts +0 -2
- package/components/CommandPalette.d.ts.map +0 -1
- package/components/CommandPalette.js +0 -181
- package/components/CompanionSceneHost.d.ts +0 -14
- package/components/CompanionSceneHost.d.ts.map +0 -1
- package/components/CompanionSceneHost.js +0 -362
- package/components/CompanionShell.d.ts +0 -17
- package/components/CompanionShell.d.ts.map +0 -1
- package/components/CompanionShell.js +0 -15
- package/components/CompanionView.d.ts +0 -2
- package/components/CompanionView.d.ts.map +0 -1
- package/components/CompanionView.js +0 -22
- package/components/ConfigPageView.d.ts +0 -11
- package/components/ConfigPageView.d.ts.map +0 -1
- package/components/ConfigPageView.js +0 -311
- package/components/ConfigSaveFooter.d.ts +0 -8
- package/components/ConfigSaveFooter.d.ts.map +0 -1
- package/components/ConfigSaveFooter.js +0 -10
- package/components/ConfirmModal.d.ts +0 -61
- package/components/ConfirmModal.d.ts.map +0 -1
- package/components/ConfirmModal.js +0 -164
- package/components/ConnectionFailedBanner.d.ts +0 -6
- package/components/ConnectionFailedBanner.d.ts.map +0 -1
- package/components/ConnectionFailedBanner.js +0 -22
- package/components/ConnectorsPageView.d.ts +0 -7
- package/components/ConnectorsPageView.d.ts.map +0 -1
- package/components/ConnectorsPageView.js +0 -8
- package/components/ConversationsSidebar.d.ts +0 -9
- package/components/ConversationsSidebar.d.ts.map +0 -1
- package/components/ConversationsSidebar.js +0 -116
- package/components/CustomActionEditor.d.ts +0 -10
- package/components/CustomActionEditor.d.ts.map +0 -1
- package/components/CustomActionEditor.js +0 -596
- package/components/CustomActionsPanel.d.ts +0 -9
- package/components/CustomActionsPanel.d.ts.map +0 -1
- package/components/CustomActionsPanel.js +0 -107
- package/components/CustomActionsView.d.ts +0 -2
- package/components/CustomActionsView.d.ts.map +0 -1
- package/components/CustomActionsView.js +0 -134
- package/components/DatabasePageView.d.ts +0 -5
- package/components/DatabasePageView.d.ts.map +0 -1
- package/components/DatabasePageView.js +0 -28
- package/components/DatabaseView.d.ts +0 -9
- package/components/DatabaseView.d.ts.map +0 -1
- package/components/DatabaseView.js +0 -311
- package/components/ElizaCloudDashboard.d.ts +0 -2
- package/components/ElizaCloudDashboard.d.ts.map +0 -1
- package/components/ElizaCloudDashboard.js +0 -657
- package/components/EmotePicker.d.ts +0 -2
- package/components/EmotePicker.d.ts.map +0 -1
- package/components/EmotePicker.js +0 -343
- package/components/ErrorBoundary.d.ts +0 -22
- package/components/ErrorBoundary.d.ts.map +0 -1
- package/components/ErrorBoundary.js +0 -31
- package/components/FineTuningView.d.ts +0 -2
- package/components/FineTuningView.d.ts.map +0 -1
- package/components/FineTuningView.js +0 -433
- package/components/FlaminaGuide.d.ts +0 -10
- package/components/FlaminaGuide.d.ts.map +0 -1
- package/components/FlaminaGuide.js +0 -64
- package/components/GameView.d.ts +0 -11
- package/components/GameView.d.ts.map +0 -1
- package/components/GameView.js +0 -294
- package/components/GameViewOverlay.d.ts +0 -8
- package/components/GameViewOverlay.d.ts.map +0 -1
- package/components/GameViewOverlay.js +0 -70
- package/components/GlobalEmoteOverlay.d.ts +0 -2
- package/components/GlobalEmoteOverlay.d.ts.map +0 -1
- package/components/GlobalEmoteOverlay.js +0 -112
- package/components/Header.d.ts +0 -9
- package/components/Header.d.ts.map +0 -1
- package/components/Header.js +0 -123
- package/components/HeartbeatsView.d.ts +0 -2
- package/components/HeartbeatsView.d.ts.map +0 -1
- package/components/HeartbeatsView.js +0 -378
- package/components/InventoryView.d.ts +0 -10
- package/components/InventoryView.d.ts.map +0 -1
- package/components/InventoryView.js +0 -176
- package/components/KnowledgeView.d.ts +0 -20
- package/components/KnowledgeView.d.ts.map +0 -1
- package/components/KnowledgeView.js +0 -483
- package/components/LanguageDropdown.d.ts +0 -30
- package/components/LanguageDropdown.d.ts.map +0 -1
- package/components/LanguageDropdown.js +0 -99
- package/components/LifoMonitorPanel.d.ts +0 -21
- package/components/LifoMonitorPanel.d.ts.map +0 -1
- package/components/LifoMonitorPanel.js +0 -24
- package/components/LifoSandboxView.d.ts +0 -5
- package/components/LifoSandboxView.d.ts.map +0 -1
- package/components/LifoSandboxView.js +0 -333
- package/components/LoadingScreen.d.ts +0 -13
- package/components/LoadingScreen.d.ts.map +0 -1
- package/components/LoadingScreen.js +0 -70
- package/components/LogsPageView.d.ts +0 -2
- package/components/LogsPageView.d.ts.map +0 -1
- package/components/LogsPageView.js +0 -7
- package/components/LogsView.d.ts +0 -5
- package/components/LogsView.d.ts.map +0 -1
- package/components/LogsView.js +0 -71
- package/components/MediaGalleryView.d.ts +0 -9
- package/components/MediaGalleryView.d.ts.map +0 -1
- package/components/MediaGalleryView.js +0 -236
- package/components/MediaSettingsSection.d.ts +0 -11
- package/components/MediaSettingsSection.d.ts.map +0 -1
- package/components/MediaSettingsSection.js +0 -329
- package/components/MessageContent.d.ts +0 -51
- package/components/MessageContent.d.ts.map +0 -1
- package/components/MessageContent.js +0 -553
- package/components/OnboardingWizard.d.ts +0 -2
- package/components/OnboardingWizard.d.ts.map +0 -1
- package/components/OnboardingWizard.js +0 -86
- package/components/PairingView.d.ts +0 -5
- package/components/PairingView.d.ts.map +0 -1
- package/components/PairingView.js +0 -29
- package/components/PermissionsSection.d.ts +0 -20
- package/components/PermissionsSection.d.ts.map +0 -1
- package/components/PermissionsSection.js +0 -573
- package/components/PluginsPageView.d.ts +0 -5
- package/components/PluginsPageView.d.ts.map +0 -1
- package/components/PluginsPageView.js +0 -8
- package/components/PluginsView.d.ts +0 -21
- package/components/PluginsView.d.ts.map +0 -1
- package/components/PluginsView.js +0 -1534
- package/components/ProviderSwitcher.d.ts +0 -42
- package/components/ProviderSwitcher.d.ts.map +0 -1
- package/components/ProviderSwitcher.js +0 -493
- package/components/RestartBanner.d.ts +0 -2
- package/components/RestartBanner.d.ts.map +0 -1
- package/components/RestartBanner.js +0 -36
- package/components/RuntimeView.d.ts +0 -10
- package/components/RuntimeView.d.ts.map +0 -1
- package/components/RuntimeView.js +0 -165
- package/components/SaveCommandModal.d.ts +0 -12
- package/components/SaveCommandModal.d.ts.map +0 -1
- package/components/SaveCommandModal.js +0 -84
- package/components/SecretsView.d.ts +0 -9
- package/components/SecretsView.d.ts.map +0 -1
- package/components/SecretsView.js +0 -249
- package/components/SettingsView.d.ts +0 -9
- package/components/SettingsView.d.ts.map +0 -1
- package/components/SettingsView.js +0 -230
- package/components/ShellOverlays.d.ts +0 -8
- package/components/ShellOverlays.d.ts.map +0 -1
- package/components/ShellOverlays.js +0 -10
- package/components/ShortcutsOverlay.d.ts +0 -2
- package/components/ShortcutsOverlay.d.ts.map +0 -1
- package/components/ShortcutsOverlay.js +0 -79
- package/components/SkillsView.d.ts +0 -11
- package/components/SkillsView.d.ts.map +0 -1
- package/components/SkillsView.js +0 -358
- package/components/StartupFailureView.d.ts +0 -8
- package/components/StartupFailureView.d.ts.map +0 -1
- package/components/StartupFailureView.js +0 -16
- package/components/StreamView.d.ts +0 -16
- package/components/StreamView.d.ts.map +0 -1
- package/components/StreamView.js +0 -300
- package/components/StripeEmbeddedCheckout.d.ts +0 -24
- package/components/StripeEmbeddedCheckout.d.ts.map +0 -1
- package/components/StripeEmbeddedCheckout.js +0 -101
- package/components/SubscriptionStatus.d.ts +0 -23
- package/components/SubscriptionStatus.d.ts.map +0 -1
- package/components/SubscriptionStatus.js +0 -301
- package/components/SystemWarningBanner.d.ts +0 -6
- package/components/SystemWarningBanner.d.ts.map +0 -1
- package/components/SystemWarningBanner.js +0 -46
- package/components/ThemeToggle.d.ts +0 -21
- package/components/ThemeToggle.d.ts.map +0 -1
- package/components/ThemeToggle.js +0 -24
- package/components/TrajectoriesView.d.ts +0 -12
- package/components/TrajectoriesView.d.ts.map +0 -1
- package/components/TrajectoriesView.js +0 -183
- package/components/TrajectoryDetailView.d.ts +0 -13
- package/components/TrajectoryDetailView.d.ts.map +0 -1
- package/components/TrajectoryDetailView.js +0 -112
- package/components/TriggersView.d.ts +0 -2
- package/components/TriggersView.d.ts.map +0 -1
- package/components/TriggersView.js +0 -1
- package/components/VectorBrowserView.d.ts +0 -10
- package/components/VectorBrowserView.d.ts.map +0 -1
- package/components/VectorBrowserView.js +0 -1000
- package/components/VoiceConfigView.d.ts +0 -11
- package/components/VoiceConfigView.d.ts.map +0 -1
- package/components/VoiceConfigView.js +0 -331
- package/components/VrmStage.d.ts +0 -28
- package/components/VrmStage.d.ts.map +0 -1
- package/components/VrmStage.js +0 -178
- package/components/WhatsAppQrOverlay.d.ts +0 -8
- package/components/WhatsAppQrOverlay.d.ts.map +0 -1
- package/components/WhatsAppQrOverlay.js +0 -63
- package/components/apps/AppDetailPane.d.ts +0 -15
- package/components/apps/AppDetailPane.d.ts.map +0 -1
- package/components/apps/AppDetailPane.js +0 -13
- package/components/apps/AppsCatalogGrid.d.ts +0 -20
- package/components/apps/AppsCatalogGrid.d.ts.map +0 -1
- package/components/apps/AppsCatalogGrid.js +0 -18
- package/components/apps/extensions/registry.d.ts +0 -4
- package/components/apps/extensions/registry.d.ts.map +0 -1
- package/components/apps/extensions/registry.js +0 -7
- package/components/apps/extensions/types.d.ts +0 -7
- package/components/apps/extensions/types.d.ts.map +0 -1
- package/components/apps/helpers.d.ts +0 -7
- package/components/apps/helpers.d.ts.map +0 -1
- package/components/apps/helpers.js +0 -44
- package/components/avatar/VrmAnimationLoader.d.ts +0 -30
- package/components/avatar/VrmAnimationLoader.d.ts.map +0 -1
- package/components/avatar/VrmAnimationLoader.js +0 -99
- package/components/avatar/VrmBlinkController.d.ts +0 -37
- package/components/avatar/VrmBlinkController.d.ts.map +0 -1
- package/components/avatar/VrmBlinkController.js +0 -98
- package/components/avatar/VrmCameraManager.d.ts +0 -57
- package/components/avatar/VrmCameraManager.d.ts.map +0 -1
- package/components/avatar/VrmCameraManager.js +0 -277
- package/components/avatar/VrmEngine.d.ts +0 -246
- package/components/avatar/VrmEngine.d.ts.map +0 -1
- package/components/avatar/VrmEngine.js +0 -2087
- package/components/avatar/VrmFootShadow.d.ts +0 -18
- package/components/avatar/VrmFootShadow.d.ts.map +0 -1
- package/components/avatar/VrmFootShadow.js +0 -83
- package/components/avatar/VrmViewer.d.ts +0 -60
- package/components/avatar/VrmViewer.d.ts.map +0 -1
- package/components/avatar/VrmViewer.js +0 -396
- package/components/avatar/mixamoVRMRigMap.d.ts +0 -3
- package/components/avatar/mixamoVRMRigMap.d.ts.map +0 -1
- package/components/avatar/mixamoVRMRigMap.js +0 -56
- package/components/avatar/retargetMixamoFbxToVrm.d.ts +0 -9
- package/components/avatar/retargetMixamoFbxToVrm.d.ts.map +0 -1
- package/components/avatar/retargetMixamoFbxToVrm.js +0 -88
- package/components/avatar/retargetMixamoGltfToVrm.d.ts +0 -11
- package/components/avatar/retargetMixamoGltfToVrm.d.ts.map +0 -1
- package/components/avatar/retargetMixamoGltfToVrm.js +0 -80
- package/components/chainConfig.d.ts +0 -89
- package/components/chainConfig.d.ts.map +0 -1
- package/components/chainConfig.js +0 -287
- package/components/companion/CompanionHeader.d.ts +0 -15
- package/components/companion/CompanionHeader.d.ts.map +0 -1
- package/components/companion/CompanionHeader.js +0 -7
- package/components/companion/CompanionSceneHost.d.ts +0 -2
- package/components/companion/CompanionSceneHost.d.ts.map +0 -1
- package/components/companion/CompanionSceneHost.js +0 -1
- package/components/companion/VrmStage.d.ts +0 -3
- package/components/companion/VrmStage.d.ts.map +0 -1
- package/components/companion/VrmStage.js +0 -1
- package/components/companion/index.d.ts +0 -18
- package/components/companion/index.d.ts.map +0 -1
- package/components/companion/index.js +0 -17
- package/components/companion/walletUtils.d.ts +0 -95
- package/components/companion/walletUtils.d.ts.map +0 -1
- package/components/companion/walletUtils.js +0 -167
- package/components/companion-shell-styles.d.ts +0 -38
- package/components/companion-shell-styles.d.ts.map +0 -1
- package/components/companion-shell-styles.js +0 -248
- package/components/confirm-delete-control.d.ts +0 -16
- package/components/confirm-delete-control.d.ts.map +0 -1
- package/components/confirm-delete-control.js +0 -12
- package/components/conversations/ConversationListItem.d.ts +0 -31
- package/components/conversations/ConversationListItem.d.ts.map +0 -1
- package/components/conversations/ConversationListItem.js +0 -52
- package/components/conversations/conversation-utils.d.ts +0 -9
- package/components/conversations/conversation-utils.d.ts.map +0 -1
- package/components/conversations/conversation-utils.js +0 -138
- package/components/format.d.ts +0 -54
- package/components/format.d.ts.map +0 -1
- package/components/format.js +0 -82
- package/components/index.d.ts +0 -96
- package/components/index.d.ts.map +0 -1
- package/components/index.js +0 -95
- package/components/inventory/CopyableAddress.d.ts +0 -8
- package/components/inventory/CopyableAddress.d.ts.map +0 -1
- package/components/inventory/CopyableAddress.js +0 -18
- package/components/inventory/InventoryToolbar.d.ts +0 -25
- package/components/inventory/InventoryToolbar.d.ts.map +0 -1
- package/components/inventory/InventoryToolbar.js +0 -28
- package/components/inventory/NftGrid.d.ts +0 -13
- package/components/inventory/NftGrid.d.ts.map +0 -1
- package/components/inventory/NftGrid.js +0 -29
- package/components/inventory/TokenLogo.d.ts +0 -12
- package/components/inventory/TokenLogo.d.ts.map +0 -1
- package/components/inventory/TokenLogo.js +0 -33
- package/components/inventory/TokensTable.d.ts +0 -24
- package/components/inventory/TokensTable.d.ts.map +0 -1
- package/components/inventory/TokensTable.js +0 -26
- package/components/inventory/constants.d.ts +0 -52
- package/components/inventory/constants.d.ts.map +0 -1
- package/components/inventory/constants.js +0 -121
- package/components/inventory/index.d.ts +0 -9
- package/components/inventory/index.d.ts.map +0 -1
- package/components/inventory/index.js +0 -8
- package/components/inventory/media-url.d.ts +0 -6
- package/components/inventory/media-url.d.ts.map +0 -1
- package/components/inventory/media-url.js +0 -28
- package/components/inventory/useInventoryData.d.ts +0 -53
- package/components/inventory/useInventoryData.d.ts.map +0 -1
- package/components/inventory/useInventoryData.js +0 -332
- package/components/knowledge-upload-image.d.ts +0 -27
- package/components/knowledge-upload-image.d.ts.map +0 -1
- package/components/knowledge-upload-image.js +0 -146
- package/components/labels.d.ts +0 -6
- package/components/labels.d.ts.map +0 -1
- package/components/labels.js +0 -40
- package/components/onboarding/ActivateStep.d.ts +0 -2
- package/components/onboarding/ActivateStep.d.ts.map +0 -1
- package/components/onboarding/ActivateStep.js +0 -10
- package/components/onboarding/CloudLoginStep.d.ts +0 -2
- package/components/onboarding/CloudLoginStep.d.ts.map +0 -1
- package/components/onboarding/CloudLoginStep.js +0 -20
- package/components/onboarding/ConnectionStep.d.ts +0 -2
- package/components/onboarding/ConnectionStep.d.ts.map +0 -1
- package/components/onboarding/ConnectionStep.js +0 -609
- package/components/onboarding/IdentityStep.d.ts +0 -2
- package/components/onboarding/IdentityStep.d.ts.map +0 -1
- package/components/onboarding/IdentityStep.js +0 -102
- package/components/onboarding/OnboardingPanel.d.ts +0 -9
- package/components/onboarding/OnboardingPanel.d.ts.map +0 -1
- package/components/onboarding/OnboardingPanel.js +0 -24
- package/components/onboarding/OnboardingStepNav.d.ts +0 -2
- package/components/onboarding/OnboardingStepNav.d.ts.map +0 -1
- package/components/onboarding/OnboardingStepNav.js +0 -24
- package/components/onboarding/PermissionsStep.d.ts +0 -2
- package/components/onboarding/PermissionsStep.d.ts.map +0 -1
- package/components/onboarding/PermissionsStep.js +0 -7
- package/components/onboarding/RpcStep.d.ts +0 -2
- package/components/onboarding/RpcStep.d.ts.map +0 -1
- package/components/onboarding/RpcStep.js +0 -125
- package/components/onboarding/SaveKeysStep.d.ts +0 -2
- package/components/onboarding/SaveKeysStep.d.ts.map +0 -1
- package/components/onboarding/SaveKeysStep.js +0 -44
- package/components/onboarding/WelcomeStep.d.ts +0 -2
- package/components/onboarding/WelcomeStep.d.ts.map +0 -1
- package/components/onboarding/WelcomeStep.js +0 -30
- package/components/permissions/PermissionIcon.d.ts +0 -4
- package/components/permissions/PermissionIcon.d.ts.map +0 -1
- package/components/permissions/PermissionIcon.js +0 -12
- package/components/permissions/StreamingPermissions.d.ts +0 -20
- package/components/permissions/StreamingPermissions.d.ts.map +0 -1
- package/components/permissions/StreamingPermissions.js +0 -178
- package/components/plugins/showcase-data.d.ts +0 -7
- package/components/plugins/showcase-data.d.ts.map +0 -1
- package/components/plugins/showcase-data.js +0 -464
- package/components/shared/ShellHeaderControls.d.ts +0 -27
- package/components/shared/ShellHeaderControls.d.ts.map +0 -1
- package/components/shared/ShellHeaderControls.js +0 -55
- package/components/shared-companion-scene-context.d.ts +0 -3
- package/components/shared-companion-scene-context.d.ts.map +0 -1
- package/components/shared-companion-scene-context.js +0 -13
- package/components/skeletons.d.ts +0 -17
- package/components/skeletons.d.ts.map +0 -1
- package/components/skeletons.js +0 -22
- package/components/stream/ActivityFeed.d.ts +0 -5
- package/components/stream/ActivityFeed.d.ts.map +0 -1
- package/components/stream/ActivityFeed.js +0 -57
- package/components/stream/AvatarPip.d.ts +0 -5
- package/components/stream/AvatarPip.d.ts.map +0 -1
- package/components/stream/AvatarPip.js +0 -6
- package/components/stream/ChatContent.d.ts +0 -6
- package/components/stream/ChatContent.d.ts.map +0 -1
- package/components/stream/ChatContent.js +0 -69
- package/components/stream/ChatTicker.d.ts +0 -5
- package/components/stream/ChatTicker.d.ts.map +0 -1
- package/components/stream/ChatTicker.js +0 -34
- package/components/stream/IdleContent.d.ts +0 -5
- package/components/stream/IdleContent.d.ts.map +0 -1
- package/components/stream/IdleContent.js +0 -17
- package/components/stream/StatusBar.d.ts +0 -36
- package/components/stream/StatusBar.d.ts.map +0 -1
- package/components/stream/StatusBar.js +0 -140
- package/components/stream/StreamSettings.d.ts +0 -33
- package/components/stream/StreamSettings.d.ts.map +0 -1
- package/components/stream/StreamSettings.js +0 -99
- package/components/stream/StreamTerminal.d.ts +0 -2
- package/components/stream/StreamTerminal.d.ts.map +0 -1
- package/components/stream/StreamTerminal.js +0 -52
- package/components/stream/StreamVoiceConfig.d.ts +0 -10
- package/components/stream/StreamVoiceConfig.d.ts.map +0 -1
- package/components/stream/StreamVoiceConfig.js +0 -88
- package/components/stream/helpers.d.ts +0 -32
- package/components/stream/helpers.d.ts.map +0 -1
- package/components/stream/helpers.js +0 -110
- package/components/stream/overlays/OverlayLayer.d.ts +0 -20
- package/components/stream/overlays/OverlayLayer.d.ts.map +0 -1
- package/components/stream/overlays/OverlayLayer.js +0 -24
- package/components/stream/overlays/built-in/ActionTickerWidget.d.ts +0 -8
- package/components/stream/overlays/built-in/ActionTickerWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/ActionTickerWidget.js +0 -44
- package/components/stream/overlays/built-in/AlertPopupWidget.d.ts +0 -7
- package/components/stream/overlays/built-in/AlertPopupWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/AlertPopupWidget.js +0 -62
- package/components/stream/overlays/built-in/BrandingWidget.d.ts +0 -7
- package/components/stream/overlays/built-in/BrandingWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/BrandingWidget.js +0 -36
- package/components/stream/overlays/built-in/CustomHtmlWidget.d.ts +0 -26
- package/components/stream/overlays/built-in/CustomHtmlWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/CustomHtmlWidget.js +0 -78
- package/components/stream/overlays/built-in/PeonGlassWidget.d.ts +0 -11
- package/components/stream/overlays/built-in/PeonGlassWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/PeonGlassWidget.js +0 -188
- package/components/stream/overlays/built-in/PeonHudWidget.d.ts +0 -10
- package/components/stream/overlays/built-in/PeonHudWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/PeonHudWidget.js +0 -168
- package/components/stream/overlays/built-in/PeonSakuraWidget.d.ts +0 -11
- package/components/stream/overlays/built-in/PeonSakuraWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/PeonSakuraWidget.js +0 -213
- package/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts +0 -8
- package/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/ThoughtBubbleWidget.js +0 -59
- package/components/stream/overlays/built-in/ViewerCountWidget.d.ts +0 -7
- package/components/stream/overlays/built-in/ViewerCountWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/ViewerCountWidget.js +0 -34
- package/components/stream/overlays/built-in/index.d.ts +0 -13
- package/components/stream/overlays/built-in/index.d.ts.map +0 -1
- package/components/stream/overlays/built-in/index.js +0 -12
- package/components/stream/overlays/registry.d.ts +0 -11
- package/components/stream/overlays/registry.d.ts.map +0 -1
- package/components/stream/overlays/registry.js +0 -16
- package/components/stream/overlays/types.d.ts +0 -67
- package/components/stream/overlays/types.d.ts.map +0 -1
- package/components/stream/overlays/types.js +0 -7
- package/components/stream/overlays/useOverlayLayout.d.ts +0 -27
- package/components/stream/overlays/useOverlayLayout.d.ts.map +0 -1
- package/components/stream/overlays/useOverlayLayout.js +0 -162
- package/components/trajectory-format.d.ts +0 -6
- package/components/trajectory-format.d.ts.map +0 -1
- package/components/trajectory-format.js +0 -43
- package/components/ui-badges.d.ts +0 -23
- package/components/ui-badges.d.ts.map +0 -1
- package/components/ui-badges.js +0 -38
- package/components/ui-switch.d.ts +0 -14
- package/components/ui-switch.d.ts.map +0 -1
- package/components/ui-switch.js +0 -15
- package/components/vector-browser-three.d.ts +0 -4
- package/components/vector-browser-three.d.ts.map +0 -1
- package/components/vector-browser-three.js +0 -21
- package/config/branding.d.ts +0 -49
- package/config/branding.d.ts.map +0 -1
- package/config/branding.js +0 -16
- package/config/config-catalog.d.ts +0 -376
- package/config/config-catalog.d.ts.map +0 -1
- package/config/config-catalog.js +0 -724
- package/config/config-field.d.ts +0 -68
- package/config/config-field.d.ts.map +0 -1
- package/config/config-field.js +0 -840
- package/config/config-renderer.d.ts +0 -176
- package/config/config-renderer.d.ts.map +0 -1
- package/config/config-renderer.js +0 -405
- package/config/index.d.ts +0 -6
- package/config/index.d.ts.map +0 -1
- package/config/index.js +0 -5
- package/config/ui-renderer.d.ts +0 -26
- package/config/ui-renderer.d.ts.map +0 -1
- package/config/ui-renderer.js +0 -815
- package/config/ui-spec.d.ts +0 -164
- package/config/ui-spec.d.ts.map +0 -1
- package/config/ui-spec.js +0 -13
- package/events/index.d.ts +0 -48
- package/events/index.d.ts.map +0 -1
- package/events/index.js +0 -45
- package/hooks/index.d.ts +0 -15
- package/hooks/index.d.ts.map +0 -1
- package/hooks/index.js +0 -14
- package/hooks/useBugReport.d.ts +0 -14
- package/hooks/useBugReport.d.ts.map +0 -1
- package/hooks/useBugReport.js +0 -18
- package/hooks/useCanvasWindow.d.ts +0 -38
- package/hooks/useCanvasWindow.d.ts.map +0 -1
- package/hooks/useCanvasWindow.js +0 -273
- package/hooks/useChatAvatarVoice.d.ts +0 -10
- package/hooks/useChatAvatarVoice.d.ts.map +0 -1
- package/hooks/useChatAvatarVoice.js +0 -71
- package/hooks/useClickOutside.d.ts +0 -6
- package/hooks/useClickOutside.d.ts.map +0 -1
- package/hooks/useClickOutside.js +0 -25
- package/hooks/useContextMenu.d.ts +0 -17
- package/hooks/useContextMenu.d.ts.map +0 -1
- package/hooks/useContextMenu.js +0 -100
- package/hooks/useKeyboardShortcuts.d.ts +0 -17
- package/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/hooks/useKeyboardShortcuts.js +0 -67
- package/hooks/useLifoSync.d.ts +0 -18
- package/hooks/useLifoSync.d.ts.map +0 -1
- package/hooks/useLifoSync.js +0 -113
- package/hooks/useMemoryMonitor.d.ts +0 -87
- package/hooks/useMemoryMonitor.d.ts.map +0 -1
- package/hooks/useMemoryMonitor.js +0 -209
- package/hooks/useRenderGuard.d.ts +0 -17
- package/hooks/useRenderGuard.d.ts.map +0 -1
- package/hooks/useRenderGuard.js +0 -36
- package/hooks/useRetakeCapture.d.ts +0 -12
- package/hooks/useRetakeCapture.d.ts.map +0 -1
- package/hooks/useRetakeCapture.js +0 -60
- package/hooks/useStreamPopoutNavigation.d.ts +0 -3
- package/hooks/useStreamPopoutNavigation.d.ts.map +0 -1
- package/hooks/useStreamPopoutNavigation.js +0 -17
- package/hooks/useTimeout.d.ts +0 -11
- package/hooks/useTimeout.d.ts.map +0 -1
- package/hooks/useTimeout.js +0 -32
- package/hooks/useVoiceChat.d.ts +0 -94
- package/hooks/useVoiceChat.d.ts.map +0 -1
- package/hooks/useVoiceChat.js +0 -1077
- package/hooks/useWhatsAppPairing.d.ts +0 -11
- package/hooks/useWhatsAppPairing.d.ts.map +0 -1
- package/hooks/useWhatsAppPairing.js +0 -95
- package/i18n/index.d.ts +0 -7
- package/i18n/index.d.ts.map +0 -1
- package/i18n/index.js +0 -53
- package/i18n/locales/en.json +0 -1268
- package/i18n/locales/es.json +0 -1236
- package/i18n/locales/ko.json +0 -1236
- package/i18n/locales/pt.json +0 -1236
- package/i18n/locales/zh-CN.json +0 -1236
- package/i18n/messages.d.ts +0 -6
- package/i18n/messages.d.ts.map +0 -1
- package/i18n/messages.js +0 -14
- package/navigation/index.d.ts +0 -27
- package/navigation/index.d.ts.map +0 -1
- package/navigation/index.js +0 -232
- package/onboarding-config.d.ts +0 -25
- package/onboarding-config.d.ts.map +0 -1
- package/onboarding-config.js +0 -76
- package/platform/browser-launch.d.ts +0 -2
- package/platform/browser-launch.d.ts.map +0 -1
- package/platform/browser-launch.js +0 -109
- package/platform/index.d.ts +0 -14
- package/platform/index.d.ts.map +0 -1
- package/platform/index.js +0 -24
- package/platform/init.d.ts +0 -40
- package/platform/init.d.ts.map +0 -1
- package/platform/init.js +0 -160
- package/platform/lifo.d.ts +0 -51
- package/platform/lifo.d.ts.map +0 -1
- package/platform/lifo.js +0 -138
- package/providers/index.d.ts +0 -19
- package/providers/index.d.ts.map +0 -1
- package/providers/index.js +0 -80
- package/shell-params.d.ts +0 -12
- package/shell-params.d.ts.map +0 -1
- package/shell-params.js +0 -19
- package/state/AppContext.d.ts +0 -12
- package/state/AppContext.d.ts.map +0 -1
- package/state/AppContext.js +0 -5102
- package/state/index.d.ts +0 -7
- package/state/index.d.ts.map +0 -1
- package/state/index.js +0 -6
- package/state/internal.d.ts +0 -7
- package/state/internal.d.ts.map +0 -1
- package/state/internal.js +0 -6
- package/state/onboarding-resume.d.ts +0 -11
- package/state/onboarding-resume.d.ts.map +0 -1
- package/state/onboarding-resume.js +0 -187
- package/state/parsers.d.ts +0 -26
- package/state/parsers.d.ts.map +0 -1
- package/state/parsers.js +0 -255
- package/state/persistence.d.ts +0 -59
- package/state/persistence.d.ts.map +0 -1
- package/state/persistence.js +0 -328
- package/state/shell-routing.d.ts +0 -12
- package/state/shell-routing.d.ts.map +0 -1
- package/state/shell-routing.js +0 -26
- package/state/types.d.ts +0 -426
- package/state/types.d.ts.map +0 -1
- package/state/types.js +0 -89
- package/state/ui-preferences.d.ts +0 -3
- package/state/ui-preferences.d.ts.map +0 -1
- package/state/ui-preferences.js +0 -1
- package/state/useApp.d.ts +0 -4
- package/state/useApp.d.ts.map +0 -1
- package/state/useApp.js +0 -22
- package/state/vrm.d.ts +0 -30
- package/state/vrm.d.ts.map +0 -1
- package/state/vrm.js +0 -82
- package/styles/anime.css +0 -6364
- package/styles/base.css +0 -255
- package/styles/onboarding-game.css +0 -1095
- package/styles/styles.css +0 -2087
- package/styles/xterm.css +0 -241
- package/types/index.d.ts +0 -657
- package/types/index.d.ts.map +0 -1
- package/types/index.js +0 -1
- package/utils/asset-url.d.ts +0 -26
- package/utils/asset-url.d.ts.map +0 -1
- package/utils/asset-url.js +0 -99
- package/utils/assistant-text.d.ts +0 -2
- package/utils/assistant-text.d.ts.map +0 -1
- package/utils/assistant-text.js +0 -161
- package/utils/clipboard.d.ts +0 -2
- package/utils/clipboard.d.ts.map +0 -1
- package/utils/clipboard.js +0 -38
- package/utils/desktop-dialogs.d.ts +0 -19
- package/utils/desktop-dialogs.d.ts.map +0 -1
- package/utils/desktop-dialogs.js +0 -50
- package/utils/eliza-globals.d.ts +0 -11
- package/utils/eliza-globals.d.ts.map +0 -1
- package/utils/eliza-globals.js +0 -33
- package/utils/index.d.ts +0 -8
- package/utils/index.d.ts.map +0 -1
- package/utils/index.js +0 -7
- package/utils/number-parsing.d.ts +0 -44
- package/utils/number-parsing.d.ts.map +0 -1
- package/utils/number-parsing.js +0 -56
- package/utils/openExternalUrl.d.ts +0 -2
- package/utils/openExternalUrl.d.ts.map +0 -1
- package/utils/openExternalUrl.js +0 -17
- package/utils/spoken-text.d.ts +0 -2
- package/utils/spoken-text.d.ts.map +0 -1
- package/utils/spoken-text.js +0 -56
- package/utils/streaming-text.d.ts +0 -3
- package/utils/streaming-text.d.ts.map +0 -1
- package/utils/streaming-text.js +0 -87
- package/voice/index.d.ts +0 -2
- package/voice/index.d.ts.map +0 -1
- package/voice/index.js +0 -1
- package/voice/types.d.ts +0 -25
- package/voice/types.d.ts.map +0 -1
- package/voice/types.js +0 -166
- package/wallet-rpc.d.ts +0 -8
- package/wallet-rpc.d.ts.map +0 -1
- package/wallet-rpc.js +0 -131
- /package/{components/apps/extensions → services/local-inference/voice}/types.js +0 -0
|
@@ -0,0 +1,1392 @@
|
|
|
1
|
+
From 7d2466c941c4afc0b5de58a7aac507d4d1d1e61c Mon Sep 17 00:00:00 2001
|
|
2
|
+
From: qjl-port <qjl@local>
|
|
3
|
+
Date: Sat, 9 May 2026 02:49:31 -0700
|
|
4
|
+
Subject: [PATCH 2/4] ggml: register QJL1_256 type traits + ATTN_SCORE_QJL op
|
|
5
|
+
MIME-Version: 1.0
|
|
6
|
+
Content-Type: text/plain; charset=UTF-8
|
|
7
|
+
Content-Transfer-Encoding: 8bit
|
|
8
|
+
|
|
9
|
+
- Vendor packages/native-plugins/qjl-cpu/ kernel sources into
|
|
10
|
+
ggml/src/ggml-cpu/qjl/ (kernel files unchanged, bit-parity-validated
|
|
11
|
+
scalar/AVX2/NEON paths).
|
|
12
|
+
- Add quants-qjl.c shim mapping the kernel-library API to the
|
|
13
|
+
ggml-shaped names quantize_row_qjl1_256_ref / quantize_row_qjl1_256
|
|
14
|
+
/ dequantize_row_qjl1_256 / quantize_qjl1_256.
|
|
15
|
+
- Wire the type-traits entry in ggml.c and the type-traits-cpu entry
|
|
16
|
+
in ggml-cpu.c (from_float only — QJL is K-cache-only and never
|
|
17
|
+
participates in mul_mat).
|
|
18
|
+
- Wire the GGML_OP_ATTN_SCORE_QJL constructor + name/symbol slots in
|
|
19
|
+
ggml.c, dispatcher case + n_tasks in ggml-cpu/ggml-cpu.c.
|
|
20
|
+
- Provide a lazily-built default seeded projection matrix Π
|
|
21
|
+
(head_dim=128 / proj_dim=256 / seed=42) for the type-traits round
|
|
22
|
+
trip; production deployments inject Π via the per-layer sidecar.
|
|
23
|
+
- CMakeLists adds ggml-cpu/qjl/ to the source list and exposes
|
|
24
|
+
ggml-cpu/qjl/{,include} on the private include path.
|
|
25
|
+
---
|
|
26
|
+
ggml/src/ggml-cpu/CMakeLists.txt | 36 ++
|
|
27
|
+
ggml/src/ggml-cpu/ggml-cpu.c | 19 ++
|
|
28
|
+
ggml/src/ggml-cpu/qjl/include/qjl/qjl.h | 162 +++++++++++++++
|
|
29
|
+
ggml/src/ggml-cpu/qjl/qjl_block.h | 18 ++
|
|
30
|
+
ggml/src/ggml-cpu/qjl/qjl_dispatch.c | 51 +++++
|
|
31
|
+
ggml/src/ggml-cpu/qjl/qjl_projection.c | 77 +++++++
|
|
32
|
+
ggml/src/ggml-cpu/qjl/qjl_quantize_avx2.c | 110 ++++++++++
|
|
33
|
+
ggml/src/ggml-cpu/qjl/qjl_quantize_neon.c | 107 ++++++++++
|
|
34
|
+
ggml/src/ggml-cpu/qjl/qjl_quantize_ref.c | 65 ++++++
|
|
35
|
+
ggml/src/ggml-cpu/qjl/qjl_score_avx2.c | 70 +++++++
|
|
36
|
+
ggml/src/ggml-cpu/qjl/qjl_score_neon.c | 66 ++++++
|
|
37
|
+
ggml/src/ggml-cpu/qjl/qjl_score_ref.c | 42 ++++
|
|
38
|
+
ggml/src/ggml-cpu/qjl/quants-qjl.c | 232 ++++++++++++++++++++++
|
|
39
|
+
ggml/src/ggml-cpu/quants.h | 9 +
|
|
40
|
+
ggml/src/ggml-quants.h | 3 +
|
|
41
|
+
ggml/src/ggml.c | 68 ++++++-
|
|
42
|
+
16 files changed, 1133 insertions(+), 2 deletions(-)
|
|
43
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/include/qjl/qjl.h
|
|
44
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_block.h
|
|
45
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_dispatch.c
|
|
46
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_projection.c
|
|
47
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_quantize_avx2.c
|
|
48
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_quantize_neon.c
|
|
49
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_quantize_ref.c
|
|
50
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_score_avx2.c
|
|
51
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_score_neon.c
|
|
52
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/qjl_score_ref.c
|
|
53
|
+
create mode 100644 ggml/src/ggml-cpu/qjl/quants-qjl.c
|
|
54
|
+
|
|
55
|
+
diff --git a/ggml/src/ggml-cpu/CMakeLists.txt b/ggml/src/ggml-cpu/CMakeLists.txt
|
|
56
|
+
index 3dc948e4..ad4701f2 100644
|
|
57
|
+
--- a/ggml/src/ggml-cpu/CMakeLists.txt
|
|
58
|
+
+++ b/ggml/src/ggml-cpu/CMakeLists.txt
|
|
59
|
+
@@ -52,8 +52,44 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
|
|
60
|
+
ggml-cpu/vec.cpp
|
|
61
|
+
ggml-cpu/ops.h
|
|
62
|
+
ggml-cpu/ops.cpp
|
|
63
|
+
+ # QJL 1-bit packed-K quant + attention-score op. Vendored from the
|
|
64
|
+
+ # standalone packages/native-plugins/qjl-cpu/ kernel library; the
|
|
65
|
+
+ # kernel files themselves carry their own SIMD guards (__AVX2__ /
|
|
66
|
+
+ # __ARM_NEON), so we always compile all of them and the dispatcher
|
|
67
|
+
+ # picks the right one at link/runtime.
|
|
68
|
+
+ ggml-cpu/qjl/quants-qjl.c
|
|
69
|
+
+ ggml-cpu/qjl/qjl_block.h
|
|
70
|
+
+ ggml-cpu/qjl/qjl_dispatch.c
|
|
71
|
+
+ ggml-cpu/qjl/qjl_projection.c
|
|
72
|
+
+ ggml-cpu/qjl/qjl_quantize_ref.c
|
|
73
|
+
+ ggml-cpu/qjl/qjl_quantize_avx2.c
|
|
74
|
+
+ ggml-cpu/qjl/qjl_quantize_neon.c
|
|
75
|
+
+ ggml-cpu/qjl/qjl_score_ref.c
|
|
76
|
+
+ ggml-cpu/qjl/qjl_score_avx2.c
|
|
77
|
+
+ ggml-cpu/qjl/qjl_score_neon.c
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
+ # qjl/include lets `#include "qjl/qjl.h"` resolve to the vendored kernel
|
|
81
|
+
+ # public header without polluting the rest of ggml-cpu's include surface.
|
|
82
|
+
+ # qjl/ itself is on the include path so the kernel files reach
|
|
83
|
+
+ # `qjl_block.h` (their internal header) the same way they do in the
|
|
84
|
+
+ # standalone packages/native-plugins/qjl-cpu/ build.
|
|
85
|
+
+ target_include_directories(${GGML_CPU_NAME} PRIVATE ggml-cpu/qjl/include ggml-cpu/qjl)
|
|
86
|
+
+
|
|
87
|
+
+ # Per-source SIMD flags. The AOSP cross-build sets GGML_NATIVE=OFF for
|
|
88
|
+
+ # portability, so the AVX2 TUs would otherwise compile without
|
|
89
|
+
+ # `__AVX2__` defined and the kernels would #if-out to nothing — leaving
|
|
90
|
+
+ # the cuttlefish x86_64 build with only the scalar `_ref` path. Add
|
|
91
|
+
+ # `-mavx2 -mfma` per-source so the AVX2 entry points (`qjl_quantize_row_avx2`,
|
|
92
|
+
+ # `qjl_score_qk_avx2`) get emitted regardless of the global GGML_NATIVE
|
|
93
|
+
+ # setting. NEON sources don't need this on AArch64 (NEON is on by
|
|
94
|
+
+ # default for the AArch64 ABI).
|
|
95
|
+
+ set_source_files_properties(
|
|
96
|
+
+ ggml-cpu/qjl/qjl_quantize_avx2.c
|
|
97
|
+
+ ggml-cpu/qjl/qjl_score_avx2.c
|
|
98
|
+
+ PROPERTIES COMPILE_OPTIONS "-mavx2;-mfma"
|
|
99
|
+
+ )
|
|
100
|
+
+
|
|
101
|
+
target_compile_features(${GGML_CPU_NAME} PRIVATE c_std_11 cxx_std_17)
|
|
102
|
+
target_include_directories(${GGML_CPU_NAME} PRIVATE . ggml-cpu)
|
|
103
|
+
|
|
104
|
+
diff --git a/ggml/src/ggml-cpu/ggml-cpu.c b/ggml/src/ggml-cpu/ggml-cpu.c
|
|
105
|
+
index 2cf69f93..fca430d1 100644
|
|
106
|
+
--- a/ggml/src/ggml-cpu/ggml-cpu.c
|
|
107
|
+
+++ b/ggml/src/ggml-cpu/ggml-cpu.c
|
|
108
|
+
@@ -408,6 +408,13 @@ static const struct ggml_type_traits_cpu type_traits_cpu[GGML_TYPE_COUNT] = {
|
|
109
|
+
.vec_dot_type = GGML_TYPE_F32,
|
|
110
|
+
.nrows = 1,
|
|
111
|
+
},
|
|
112
|
+
+ [GGML_TYPE_QJL1_256] = {
|
|
113
|
+
+ // QJL is K-cache-only; it is never an operand to mul_mat. The
|
|
114
|
+
+ // attention path uses GGML_OP_ATTN_SCORE_QJL instead, which calls
|
|
115
|
+
+ // qjl_score_qk() directly and bypasses the vec_dot table. We only
|
|
116
|
+
+ // need from_float so ggml_cpy(K_cur -> K_view) can quantize.
|
|
117
|
+
+ .from_float = quantize_row_qjl1_256,
|
|
118
|
+
+ },
|
|
119
|
+
[GGML_TYPE_I32] = {
|
|
120
|
+
.from_float = (ggml_from_float_t) ggml_cpu_fp32_to_i32,
|
|
121
|
+
},
|
|
122
|
+
@@ -1990,6 +1997,10 @@ static void ggml_compute_forward(struct ggml_compute_params * params, struct ggm
|
|
123
|
+
{
|
|
124
|
+
ggml_compute_forward_flash_attn_ext(params, tensor);
|
|
125
|
+
} break;
|
|
126
|
+
+ case GGML_OP_ATTN_SCORE_QJL:
|
|
127
|
+
+ {
|
|
128
|
+
+ ggml_compute_forward_attn_score_qjl(params, tensor);
|
|
129
|
+
+ } break;
|
|
130
|
+
case GGML_OP_FLASH_ATTN_BACK:
|
|
131
|
+
{
|
|
132
|
+
int32_t t = ggml_get_op_params_i32(tensor, 0);
|
|
133
|
+
@@ -2369,6 +2380,14 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads) {
|
|
134
|
+
{
|
|
135
|
+
n_tasks = n_threads;
|
|
136
|
+
} break;
|
|
137
|
+
+ case GGML_OP_ATTN_SCORE_QJL:
|
|
138
|
+
+ {
|
|
139
|
+
+ // QJL score forward dispatches over (h_q, t) inside the
|
|
140
|
+
+ // SIMD path itself; the outer loop here is a small
|
|
141
|
+
+ // n_batch * ne3 fan-out. Single-thread for now — revisit
|
|
142
|
+
+ // when we have a real per-token decode profile on arm64.
|
|
143
|
+
+ n_tasks = 1;
|
|
144
|
+
+ } break;
|
|
145
|
+
case GGML_OP_WIN_PART:
|
|
146
|
+
case GGML_OP_WIN_UNPART:
|
|
147
|
+
case GGML_OP_GET_REL_POS:
|
|
148
|
+
diff --git a/ggml/src/ggml-cpu/qjl/include/qjl/qjl.h b/ggml/src/ggml-cpu/qjl/include/qjl/qjl.h
|
|
149
|
+
new file mode 100644
|
|
150
|
+
index 00000000..8ff42243
|
|
151
|
+
--- /dev/null
|
|
152
|
+
+++ b/ggml/src/ggml-cpu/qjl/include/qjl/qjl.h
|
|
153
|
+
@@ -0,0 +1,162 @@
|
|
154
|
+
+/*
|
|
155
|
+
+ * QJL 1-bit JL Transform K-cache compression — public API.
|
|
156
|
+
+ *
|
|
157
|
+
+ * Reference: Zandieh, Daliri, Han. "QJL: 1-Bit Quantized JL Transform
|
|
158
|
+
+ * for KV Cache Quantization with Zero Overhead", AAAI 2025
|
|
159
|
+
+ * (arXiv:2406.03482). The original CUDA reference lives at
|
|
160
|
+
+ * packages/training/scripts/quantization/qjl/csrc/qjl_quant_kernel.cu
|
|
161
|
+
+ * packages/training/scripts/quantization/qjl/csrc/qjl_gqa_score_kernel.cu
|
|
162
|
+
+ * and the pure-PyTorch reference at
|
|
163
|
+
+ * packages/training/scripts/quantization/test_qjl.py
|
|
164
|
+
+ * This library implements the inlier-only branch (no outlier sketch),
|
|
165
|
+
+ * which is the form that ships through the CPU KV-cache path.
|
|
166
|
+
+ *
|
|
167
|
+
+ * Canonical paper defaults that this library is dimensioned around:
|
|
168
|
+
+ * head_dim = 128
|
|
169
|
+
+ * projection_dim_per_head = 256
|
|
170
|
+
+ * projection_seed = 42
|
|
171
|
+
+ *
|
|
172
|
+
+ * Block layout (`block_qjl1_256`): 32 bytes packed signs + bf16 norm = 34 B.
|
|
173
|
+
+ * Compression ratio at head_dim=128: 128 * 2 / 34 = 7.53x vs bf16 K-cache.
|
|
174
|
+
+ */
|
|
175
|
+
+
|
|
176
|
+
+#ifndef QJL_QJL_H
|
|
177
|
+
+#define QJL_QJL_H
|
|
178
|
+
+
|
|
179
|
+
+#include <stdint.h>
|
|
180
|
+
+#include <stddef.h>
|
|
181
|
+
+
|
|
182
|
+
+#ifdef __cplusplus
|
|
183
|
+
+extern "C" {
|
|
184
|
+
+#endif
|
|
185
|
+
+
|
|
186
|
+
+/* Canonical paper defaults. */
|
|
187
|
+
+#define QJL_HEAD_DIM 128
|
|
188
|
+
+#define QJL_PROJECTION_DIM 256
|
|
189
|
+
+#define QJL_PACKED_BYTES (QJL_PROJECTION_DIM / 8) /* 32 */
|
|
190
|
+
+#define QJL_BLOCK_BYTES (QJL_PACKED_BYTES + 2) /* 34 */
|
|
191
|
+
+
|
|
192
|
+
+/* On-disk / on-cache block layout for one cached key vector. */
|
|
193
|
+
+typedef struct {
|
|
194
|
+
+ uint8_t qs[QJL_PACKED_BYTES]; /* 256 sign bits, LSB = bit 0 of byte 0 */
|
|
195
|
+
+ uint16_t norm_bf16; /* bf16 L2 norm of the original key */
|
|
196
|
+
+} qjl_block_qjl1_256;
|
|
197
|
+
+
|
|
198
|
+
+/*
|
|
199
|
+
+ * Build a JL projection matrix Π in row-major (head_dim, projection_dim)
|
|
200
|
+
+ * layout, deterministic from `seed`. The standalone reference uses an
|
|
201
|
+
+ * external matrix supplied by the caller (see `qjl_quantize_row_*`); this
|
|
202
|
+
+ * helper exists for hosts that want to derive Π from a seed alone, using
|
|
203
|
+
+ * a Box-Muller draw on top of a Mersenne-Twister-derived stream. Note
|
|
204
|
+
+ * that PyTorch's torch.randn is a different draw — fixtures generated
|
|
205
|
+
+ * from PyTorch will ship the projection matrix explicitly.
|
|
206
|
+
+ *
|
|
207
|
+
+ * Returns 0 on success.
|
|
208
|
+
+ */
|
|
209
|
+
+int qjl_make_projection_mt(float *prj, int head_dim, int proj_dim, uint64_t seed);
|
|
210
|
+
+
|
|
211
|
+
+/* ---------------- quantize ---------------- */
|
|
212
|
+
+
|
|
213
|
+
+/*
|
|
214
|
+
+ * Quantize one key row (head_dim floats) into one block_qjl1_256 block.
|
|
215
|
+
+ * `prj` is (head_dim, proj_dim) row-major. `proj_dim` must equal
|
|
216
|
+
+ * QJL_PROJECTION_DIM; `head_dim` must equal QJL_HEAD_DIM.
|
|
217
|
+
+ *
|
|
218
|
+
+ * Algorithm (matches `qjl_pure_pytorch_quantize`):
|
|
219
|
+
+ * sketch[j] = sum_i key[i] * prj[i*proj_dim + j]
|
|
220
|
+
+ * bit[j] = sketch[j] > 0 ? 1 : 0
|
|
221
|
+
+ * pack 8 bits LSB-first into qs[j/8]
|
|
222
|
+
+ * norm = bf16(||key||_2)
|
|
223
|
+
+ */
|
|
224
|
+
+void qjl_quantize_row_ref(const float *key, const float *prj,
|
|
225
|
+
+ qjl_block_qjl1_256 *out);
|
|
226
|
+
+void qjl_quantize_row_avx2(const float *key, const float *prj,
|
|
227
|
+
+ qjl_block_qjl1_256 *out);
|
|
228
|
+
+void qjl_quantize_row_neon(const float *key, const float *prj,
|
|
229
|
+
+ qjl_block_qjl1_256 *out);
|
|
230
|
+
+
|
|
231
|
+
+/* Bulk: quantize n_rows successive key vectors. Each row is head_dim floats. */
|
|
232
|
+
+void qjl_quantize_rows_ref(const float *keys, const float *prj,
|
|
233
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows);
|
|
234
|
+
+void qjl_quantize_rows_avx2(const float *keys, const float *prj,
|
|
235
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows);
|
|
236
|
+
+void qjl_quantize_rows_neon(const float *keys, const float *prj,
|
|
237
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows);
|
|
238
|
+
+
|
|
239
|
+
+/* Best available implementation on the running CPU. */
|
|
240
|
+
+void qjl_quantize_rows(const float *keys, const float *prj,
|
|
241
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows);
|
|
242
|
+
+
|
|
243
|
+
+/* ---------------- dequantize ---------------- */
|
|
244
|
+
+
|
|
245
|
+
+/*
|
|
246
|
+
+ * Reconstruct an approximate key row from a packed block.
|
|
247
|
+
+ *
|
|
248
|
+
+ * The QJL paper's recovery is asymmetric: the proper attention path is
|
|
249
|
+
+ * reconstruct ||k|| * Π^T · sign(s) inside the score kernel; calling
|
|
250
|
+
+ * this directly produces a cosine-similarity reconstruction useful for
|
|
251
|
+
+ * debugging and dequant-then-fp32 fallback paths. Specifically:
|
|
252
|
+
+ *
|
|
253
|
+
+ * recon[i] = (||k|| * sqrt(pi/2) / proj_dim) *
|
|
254
|
+
+ * sum_j sign_packed[j] * prj[i*proj_dim + j]
|
|
255
|
+
+ *
|
|
256
|
+
+ * where sign_packed[j] is +1 if bit j is set, -1 otherwise. The
|
|
257
|
+
+ * sqrt(pi/2)/proj_dim scale matches the GQA score kernel (see
|
|
258
|
+
+ * qjl_gqa_score_kernel.cu line 175: `scl = sqrtf(M_PI_2) / sketch_dim`).
|
|
259
|
+
+ */
|
|
260
|
+
+void qjl_dequantize_row_ref(const qjl_block_qjl1_256 *blk, const float *prj,
|
|
261
|
+
+ float *out);
|
|
262
|
+
+void qjl_dequantize_row_avx2(const qjl_block_qjl1_256 *blk, const float *prj,
|
|
263
|
+
+ float *out);
|
|
264
|
+
+void qjl_dequantize_row_neon(const qjl_block_qjl1_256 *blk, const float *prj,
|
|
265
|
+
+ float *out);
|
|
266
|
+
+
|
|
267
|
+
+/* ---------------- GQA attention score ---------------- */
|
|
268
|
+
+
|
|
269
|
+
+/*
|
|
270
|
+
+ * GQA attention score: given a Q vector (n_heads heads of head_dim
|
|
271
|
+
+ * floats) and a packed K cache (n_kv_heads, n_tokens, block_qjl1_256),
|
|
272
|
+
+ * emit a score per (q_head, token) pair.
|
|
273
|
+
+ *
|
|
274
|
+
+ * Q is re-projected through the same Π once (`q_sketch`, supplied by
|
|
275
|
+
+ * the caller — caching this is the whole point of QJL). The score is:
|
|
276
|
+
+ *
|
|
277
|
+
+ * score[h_q, t] = ||k_t|| * sqrt(pi/2)/proj_dim *
|
|
278
|
+
+ * sum_j sign_packed[t,j] * q_sketch[h_q, j]
|
|
279
|
+
+ *
|
|
280
|
+
+ * Here `h_q` maps to `h_kv = h_q / (n_heads/n_kv_heads)` for the
|
|
281
|
+
+ * GQA share. Output shape: (n_heads, n_tokens) row-major.
|
|
282
|
+
+ */
|
|
283
|
+
+void qjl_score_qk_ref(const float *q_sketch,
|
|
284
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
285
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
286
|
+
+ float *scores);
|
|
287
|
+
+void qjl_score_qk_avx2(const float *q_sketch,
|
|
288
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
289
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
290
|
+
+ float *scores);
|
|
291
|
+
+void qjl_score_qk_neon(const float *q_sketch,
|
|
292
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
293
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
294
|
+
+ float *scores);
|
|
295
|
+
+
|
|
296
|
+
+void qjl_score_qk(const float *q_sketch,
|
|
297
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
298
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
299
|
+
+ float *scores);
|
|
300
|
+
+
|
|
301
|
+
+/* ---------------- helpers ---------------- */
|
|
302
|
+
+
|
|
303
|
+
+/* IEEE float32 -> bfloat16 with round-to-nearest-even. */
|
|
304
|
+
+uint16_t qjl_fp32_to_bf16(float x);
|
|
305
|
+
+/* bfloat16 -> float32 zero-extension. */
|
|
306
|
+
+float qjl_bf16_to_fp32(uint16_t b);
|
|
307
|
+
+
|
|
308
|
+
+/* Capability strings ("avx2" / "neon" / "ref") of the active SIMD path. */
|
|
309
|
+
+const char *qjl_active_simd(void);
|
|
310
|
+
+
|
|
311
|
+
+#ifdef __cplusplus
|
|
312
|
+
+}
|
|
313
|
+
+#endif
|
|
314
|
+
+
|
|
315
|
+
+#endif /* QJL_QJL_H */
|
|
316
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_block.h b/ggml/src/ggml-cpu/qjl/qjl_block.h
|
|
317
|
+
new file mode 100644
|
|
318
|
+
index 00000000..1b12b20d
|
|
319
|
+
--- /dev/null
|
|
320
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_block.h
|
|
321
|
+
@@ -0,0 +1,18 @@
|
|
322
|
+
+/*
|
|
323
|
+
+ * Internal block-format invariants. Kept separate from the public header
|
|
324
|
+
+ * so the public API stays free of the static-assert noise.
|
|
325
|
+
+ */
|
|
326
|
+
+#ifndef QJL_QJL_BLOCK_H
|
|
327
|
+
+#define QJL_QJL_BLOCK_H
|
|
328
|
+
+
|
|
329
|
+
+#include "qjl/qjl.h"
|
|
330
|
+
+
|
|
331
|
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
|
332
|
+
+_Static_assert(sizeof(qjl_block_qjl1_256) == 34,
|
|
333
|
+
+ "block_qjl1_256 must be 32 bytes signs + 2 bytes bf16 norm");
|
|
334
|
+
+_Static_assert(QJL_PROJECTION_DIM == 256, "canonical paper default");
|
|
335
|
+
+_Static_assert(QJL_HEAD_DIM == 128, "canonical paper default");
|
|
336
|
+
+_Static_assert(QJL_PACKED_BYTES == 32, "256 bits / 8 = 32 bytes");
|
|
337
|
+
+#endif
|
|
338
|
+
+
|
|
339
|
+
+#endif /* QJL_QJL_BLOCK_H */
|
|
340
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_dispatch.c b/ggml/src/ggml-cpu/qjl/qjl_dispatch.c
|
|
341
|
+
new file mode 100644
|
|
342
|
+
index 00000000..a0101df9
|
|
343
|
+
--- /dev/null
|
|
344
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_dispatch.c
|
|
345
|
+
@@ -0,0 +1,51 @@
|
|
346
|
+
+/*
|
|
347
|
+
+ * Runtime dispatch: pick the best available SIMD path.
|
|
348
|
+
+ * The CMake build sets QJL_HAVE_AVX2 / QJL_HAVE_NEON when the matching
|
|
349
|
+
+ * SIMD TUs are part of the static library. NEON is baseline on AArch64
|
|
350
|
+
+ * so the NEON dispatch is also enabled by __ARM_NEON when the
|
|
351
|
+
+ * dispatcher TU is itself built for AArch64.
|
|
352
|
+
+ */
|
|
353
|
+
+
|
|
354
|
+
+#include "qjl/qjl.h"
|
|
355
|
+
+#include "qjl_block.h"
|
|
356
|
+
+#include <string.h>
|
|
357
|
+
+
|
|
358
|
+
+#if defined(__ARM_NEON) || defined(__ARM_NEON__)
|
|
359
|
+
+# ifndef QJL_HAVE_NEON
|
|
360
|
+
+# define QJL_HAVE_NEON 1
|
|
361
|
+
+# endif
|
|
362
|
+
+#endif
|
|
363
|
+
+
|
|
364
|
+
+void qjl_quantize_rows(const float *keys, const float *prj,
|
|
365
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows) {
|
|
366
|
+
+#if defined(QJL_HAVE_NEON)
|
|
367
|
+
+ qjl_quantize_rows_neon(keys, prj, out, n_rows);
|
|
368
|
+
+#elif defined(QJL_HAVE_AVX2)
|
|
369
|
+
+ qjl_quantize_rows_avx2(keys, prj, out, n_rows);
|
|
370
|
+
+#else
|
|
371
|
+
+ qjl_quantize_rows_ref(keys, prj, out, n_rows);
|
|
372
|
+
+#endif
|
|
373
|
+
+}
|
|
374
|
+
+
|
|
375
|
+
+void qjl_score_qk(const float *q_sketch,
|
|
376
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
377
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
378
|
+
+ float *scores) {
|
|
379
|
+
+#if defined(QJL_HAVE_NEON)
|
|
380
|
+
+ qjl_score_qk_neon(q_sketch, packed_k, n_heads, n_kv_heads, n_tokens, scores);
|
|
381
|
+
+#elif defined(QJL_HAVE_AVX2)
|
|
382
|
+
+ qjl_score_qk_avx2(q_sketch, packed_k, n_heads, n_kv_heads, n_tokens, scores);
|
|
383
|
+
+#else
|
|
384
|
+
+ qjl_score_qk_ref(q_sketch, packed_k, n_heads, n_kv_heads, n_tokens, scores);
|
|
385
|
+
+#endif
|
|
386
|
+
+}
|
|
387
|
+
+
|
|
388
|
+
+const char *qjl_active_simd(void) {
|
|
389
|
+
+#if defined(QJL_HAVE_NEON)
|
|
390
|
+
+ return "neon";
|
|
391
|
+
+#elif defined(QJL_HAVE_AVX2)
|
|
392
|
+
+ return "avx2";
|
|
393
|
+
+#else
|
|
394
|
+
+ return "ref";
|
|
395
|
+
+#endif
|
|
396
|
+
+}
|
|
397
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_projection.c b/ggml/src/ggml-cpu/qjl/qjl_projection.c
|
|
398
|
+
new file mode 100644
|
|
399
|
+
index 00000000..aa76ddb6
|
|
400
|
+
--- /dev/null
|
|
401
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_projection.c
|
|
402
|
+
@@ -0,0 +1,77 @@
|
|
403
|
+
+/*
|
|
404
|
+
+ * Deterministic JL projection-matrix construction.
|
|
405
|
+
+ *
|
|
406
|
+
+ * IMPORTANT: this is *not* bit-compatible with torch.randn(). PyTorch
|
|
407
|
+
+ * uses a Philox-based generator and a specific Box-Muller pipeline that
|
|
408
|
+
+ * we don't reproduce here. Hosts that need bit-parity with the Python
|
|
409
|
+
+ * reference should ship the projection matrix in the fixture/sidecar
|
|
410
|
+
+ * (see scripts/gen_fixtures.py and qjl_apply.py's `rand_prj` field).
|
|
411
|
+
+ *
|
|
412
|
+
+ * For standalone hosts that just need a "good enough" Π without a
|
|
413
|
+
+ * companion sidecar, this builds one from a 64-bit splitmix-seeded
|
|
414
|
+
+ * Mersenne-Twister-style stream + Box-Muller, which is repeatable and
|
|
415
|
+
+ * statistically sane (independent N(0,1) draws).
|
|
416
|
+
+ */
|
|
417
|
+
+
|
|
418
|
+
+#include "qjl/qjl.h"
|
|
419
|
+
+#include <math.h>
|
|
420
|
+
+
|
|
421
|
+
+/* splitmix64: cheap, well-distributed seed expander. */
|
|
422
|
+
+static uint64_t splitmix64(uint64_t *state) {
|
|
423
|
+
+ uint64_t z = (*state += 0x9E3779B97F4A7C15ULL);
|
|
424
|
+
+ z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9ULL;
|
|
425
|
+
+ z = (z ^ (z >> 27)) * 0x94D049BB133111EBULL;
|
|
426
|
+
+ return z ^ (z >> 31);
|
|
427
|
+
+}
|
|
428
|
+
+
|
|
429
|
+
+/* uniform in (0, 1] from a 64-bit splitmix64 draw. */
|
|
430
|
+
+static double u01_open(uint64_t *state) {
|
|
431
|
+
+ uint64_t v = splitmix64(state);
|
|
432
|
+
+ /* Use the high 53 bits, shift to (0, 1]. Avoid exact 0 for log(). */
|
|
433
|
+
+ double u = (double)((v >> 11) | 1ULL) * (1.0 / 9007199254740992.0);
|
|
434
|
+
+ return u;
|
|
435
|
+
+}
|
|
436
|
+
+
|
|
437
|
+
+int qjl_make_projection_mt(float *prj, int head_dim, int proj_dim, uint64_t seed) {
|
|
438
|
+
+ if (!prj || head_dim <= 0 || proj_dim <= 0) return -1;
|
|
439
|
+
+ uint64_t state = seed ^ 0xC0FFEE1234567890ULL;
|
|
440
|
+
+ int total = head_dim * proj_dim;
|
|
441
|
+
+ int i = 0;
|
|
442
|
+
+ while (i + 1 < total) {
|
|
443
|
+
+ double u1 = u01_open(&state);
|
|
444
|
+
+ double u2 = u01_open(&state);
|
|
445
|
+
+ double r = sqrt(-2.0 * log(u1));
|
|
446
|
+
+ double th = 6.28318530717958647692 * u2;
|
|
447
|
+
+ prj[i++] = (float)(r * cos(th));
|
|
448
|
+
+ prj[i++] = (float)(r * sin(th));
|
|
449
|
+
+ }
|
|
450
|
+
+ if (i < total) {
|
|
451
|
+
+ double u1 = u01_open(&state);
|
|
452
|
+
+ double u2 = u01_open(&state);
|
|
453
|
+
+ double r = sqrt(-2.0 * log(u1));
|
|
454
|
+
+ double th = 6.28318530717958647692 * u2;
|
|
455
|
+
+ prj[i++] = (float)(r * cos(th));
|
|
456
|
+
+ }
|
|
457
|
+
+ return 0;
|
|
458
|
+
+}
|
|
459
|
+
+
|
|
460
|
+
+/* fp32 <-> bf16 helpers. */
|
|
461
|
+
+uint16_t qjl_fp32_to_bf16(float x) {
|
|
462
|
+
+ union { float f; uint32_t u; } v = { .f = x };
|
|
463
|
+
+ uint32_t u = v.u;
|
|
464
|
+
+ /* Round-to-nearest-even with NaN passthrough. */
|
|
465
|
+
+ if ((u & 0x7F800000u) == 0x7F800000u && (u & 0x007FFFFFu)) {
|
|
466
|
+
+ /* NaN: ensure quiet bit, low 16 nonzero. */
|
|
467
|
+
+ return (uint16_t)((u >> 16) | 0x40);
|
|
468
|
+
+ }
|
|
469
|
+
+ uint32_t lsb = (u >> 16) & 1u;
|
|
470
|
+
+ uint32_t rounding = 0x7FFFu + lsb;
|
|
471
|
+
+ u += rounding;
|
|
472
|
+
+ return (uint16_t)(u >> 16);
|
|
473
|
+
+}
|
|
474
|
+
+
|
|
475
|
+
+float qjl_bf16_to_fp32(uint16_t b) {
|
|
476
|
+
+ union { float f; uint32_t u; } v;
|
|
477
|
+
+ v.u = ((uint32_t)b) << 16;
|
|
478
|
+
+ return v.f;
|
|
479
|
+
+}
|
|
480
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_quantize_avx2.c b/ggml/src/ggml-cpu/qjl/qjl_quantize_avx2.c
|
|
481
|
+
new file mode 100644
|
|
482
|
+
index 00000000..c46571f9
|
|
483
|
+
--- /dev/null
|
|
484
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_quantize_avx2.c
|
|
485
|
+
@@ -0,0 +1,110 @@
|
|
486
|
+
+/*
|
|
487
|
+
+ * AVX2 quantize / dequantize for block_qjl1_256 (head_dim=128, proj_dim=256).
|
|
488
|
+
+ *
|
|
489
|
+
+ * Algorithm shape mirrors the scalar reference. The projection matrix is
|
|
490
|
+
+ * row-major (head_dim, proj_dim) so contiguous loads along the proj_dim
|
|
491
|
+
+ * axis vectorize cleanly: for each outer key index i, broadcast key[i]
|
|
492
|
+
+ * and FMA into N ymm accumulators that span the full proj_dim.
|
|
493
|
+
+ *
|
|
494
|
+
+ * Layout:
|
|
495
|
+
+ * - Outer loop: i in [0, head_dim) (128 iterations)
|
|
496
|
+
+ * - Inner: 32 ymm accumulators each holding 8 lanes of sketch[j..j+7].
|
|
497
|
+
+ *
|
|
498
|
+
+ * 32 ymm regs > 16 hardware ymms — we tile by 16 ymm at a time,
|
|
499
|
+
+ * one half of proj_dim per pass (128 lanes per pass).
|
|
500
|
+
+ */
|
|
501
|
+
+
|
|
502
|
+
+#if defined(__AVX2__)
|
|
503
|
+
+
|
|
504
|
+
+#include "qjl/qjl.h"
|
|
505
|
+
+#include "qjl_block.h"
|
|
506
|
+
+#include <immintrin.h>
|
|
507
|
+
+#include <math.h>
|
|
508
|
+
+#include <string.h>
|
|
509
|
+
+
|
|
510
|
+
+/* Pack 8 sketch lanes (one ymm of fp32) into one byte: bit j set iff lane j > 0. */
|
|
511
|
+
+static inline uint8_t pack8_signs(__m256 v) {
|
|
512
|
+
+ /* movemask of compare: bit j = (lane j is < 0) according to _CMP_LT.
|
|
513
|
+
+ We want bit j = (lane j > 0). Compare > 0 with a zero vector. */
|
|
514
|
+
+ __m256 zero = _mm256_setzero_ps();
|
|
515
|
+
+ __m256 cmp = _mm256_cmp_ps(v, zero, _CMP_GT_OQ);
|
|
516
|
+
+ /* movemask_ps gives an 8-bit mask, lane 0 -> bit 0, exactly what we want. */
|
|
517
|
+
+ return (uint8_t)_mm256_movemask_ps(cmp);
|
|
518
|
+
+}
|
|
519
|
+
+
|
|
520
|
+
+void qjl_quantize_row_avx2(const float *key, const float *prj,
|
|
521
|
+
+ qjl_block_qjl1_256 *out) {
|
|
522
|
+
+ /* L2 norm via 16 ymm fmas. */
|
|
523
|
+
+ __m256 nsum = _mm256_setzero_ps();
|
|
524
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i += 8) {
|
|
525
|
+
+ __m256 k = _mm256_loadu_ps(key + i);
|
|
526
|
+
+ nsum = _mm256_fmadd_ps(k, k, nsum);
|
|
527
|
+
+ }
|
|
528
|
+
+ /* horizontal sum */
|
|
529
|
+
+ __m128 lo = _mm256_castps256_ps128(nsum);
|
|
530
|
+
+ __m128 hi = _mm256_extractf128_ps(nsum, 1);
|
|
531
|
+
+ __m128 s = _mm_add_ps(lo, hi);
|
|
532
|
+
+ s = _mm_hadd_ps(s, s);
|
|
533
|
+
+ s = _mm_hadd_ps(s, s);
|
|
534
|
+
+ float norm_sq = _mm_cvtss_f32(s);
|
|
535
|
+
+ out->norm_bf16 = qjl_fp32_to_bf16(sqrtf(norm_sq));
|
|
536
|
+
+
|
|
537
|
+
+ /*
|
|
538
|
+
+ * Project. Two passes over 128 lanes each (proj_dim=256 = 2 * 128).
|
|
539
|
+
+ * Per pass: 16 ymm accumulators (acc[0..15]), each holds lanes
|
|
540
|
+
+ * [j..j+7] for j = pass*128 + b*8.
|
|
541
|
+
+ */
|
|
542
|
+
+ __m256 acc[16];
|
|
543
|
+
+ for (int pass = 0; pass < 2; pass++) {
|
|
544
|
+
+ for (int b = 0; b < 16; b++) acc[b] = _mm256_setzero_ps();
|
|
545
|
+
+
|
|
546
|
+
+ const float *prj_base = prj + pass * 128;
|
|
547
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i++) {
|
|
548
|
+
+ __m256 ki = _mm256_set1_ps(key[i]);
|
|
549
|
+
+ const float *row = prj_base + i * QJL_PROJECTION_DIM;
|
|
550
|
+
+ for (int b = 0; b < 16; b++) {
|
|
551
|
+
+ __m256 p = _mm256_loadu_ps(row + b * 8);
|
|
552
|
+
+ acc[b] = _mm256_fmadd_ps(ki, p, acc[b]);
|
|
553
|
+
+ }
|
|
554
|
+
+ }
|
|
555
|
+
+ for (int b = 0; b < 16; b++) {
|
|
556
|
+
+ out->qs[pass * 16 + b] = pack8_signs(acc[b]);
|
|
557
|
+
+ }
|
|
558
|
+
+ }
|
|
559
|
+
+}
|
|
560
|
+
+
|
|
561
|
+
+void qjl_quantize_rows_avx2(const float *keys, const float *prj,
|
|
562
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows) {
|
|
563
|
+
+ for (size_t r = 0; r < n_rows; r++) {
|
|
564
|
+
+ qjl_quantize_row_avx2(keys + r * QJL_HEAD_DIM, prj, out + r);
|
|
565
|
+
+ }
|
|
566
|
+
+}
|
|
567
|
+
+
|
|
568
|
+
+void qjl_dequantize_row_avx2(const qjl_block_qjl1_256 *blk, const float *prj,
|
|
569
|
+
+ float *out) {
|
|
570
|
+
+ const float scl = 1.2533141373155003f / (float)QJL_PROJECTION_DIM
|
|
571
|
+
+ * qjl_bf16_to_fp32(blk->norm_bf16);
|
|
572
|
+
+ /* Pre-expand the 256 sign bits into 256 fp32 lanes of +/-1. */
|
|
573
|
+
+ float signs[QJL_PROJECTION_DIM];
|
|
574
|
+
+ for (int j = 0; j < QJL_PROJECTION_DIM; j++) {
|
|
575
|
+
+ int bit = (blk->qs[j >> 3] >> (j & 7)) & 1;
|
|
576
|
+
+ signs[j] = bit ? 1.0f : -1.0f;
|
|
577
|
+
+ }
|
|
578
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i++) {
|
|
579
|
+
+ const float *row = prj + i * QJL_PROJECTION_DIM;
|
|
580
|
+
+ __m256 acc = _mm256_setzero_ps();
|
|
581
|
+
+ for (int j = 0; j < QJL_PROJECTION_DIM; j += 8) {
|
|
582
|
+
+ __m256 p = _mm256_loadu_ps(row + j);
|
|
583
|
+
+ __m256 s = _mm256_loadu_ps(signs + j);
|
|
584
|
+
+ acc = _mm256_fmadd_ps(p, s, acc);
|
|
585
|
+
+ }
|
|
586
|
+
+ __m128 lo = _mm256_castps256_ps128(acc);
|
|
587
|
+
+ __m128 hi = _mm256_extractf128_ps(acc, 1);
|
|
588
|
+
+ __m128 v = _mm_add_ps(lo, hi);
|
|
589
|
+
+ v = _mm_hadd_ps(v, v);
|
|
590
|
+
+ v = _mm_hadd_ps(v, v);
|
|
591
|
+
+ out[i] = scl * _mm_cvtss_f32(v);
|
|
592
|
+
+ }
|
|
593
|
+
+}
|
|
594
|
+
+
|
|
595
|
+
+#endif /* __AVX2__ */
|
|
596
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_quantize_neon.c b/ggml/src/ggml-cpu/qjl/qjl_quantize_neon.c
|
|
597
|
+
new file mode 100644
|
|
598
|
+
index 00000000..321f58b6
|
|
599
|
+
--- /dev/null
|
|
600
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_quantize_neon.c
|
|
601
|
+
@@ -0,0 +1,107 @@
|
|
602
|
+
+/*
|
|
603
|
+
+ * ARM NEON quantize / dequantize for block_qjl1_256.
|
|
604
|
+
+ *
|
|
605
|
+
+ * NEON fp32 vectors are 4 lanes wide. proj_dim=256 → 64 fp32 vectors of
|
|
606
|
+
+ * sketch lanes. We tile by 16 vectors per pass (64 lanes per pass) and
|
|
607
|
+
+ * loop 4 passes to cover proj_dim. Inner: broadcast key[i] and FMA.
|
|
608
|
+
+ *
|
|
609
|
+
+ * Sign extraction: vcgtq_f32(acc, zero) → uint32x4_t mask per lane.
|
|
610
|
+
+ * To pack 8 lanes into a byte LSB-first, we collapse two q-vectors into
|
|
611
|
+
+ * a u8 byte via per-lane bit weights and a horizontal reduction.
|
|
612
|
+
+ *
|
|
613
|
+
+ * Reference for the sign-pack technique: the NEON port shape was sketched
|
|
614
|
+
+ * in docs/porting/on-device-quantization-porting-plan.md ("vshrn_n_u16
|
|
615
|
+
+ * + vorr_u8" idiom). The implementation here uses a per-lane weighted
|
|
616
|
+
+ * sum because that maps 1:1 to the LSB-first encoding the Python
|
|
617
|
+
+ * reference uses (`(bits * (1<<arange(8))).sum(-1)`).
|
|
618
|
+
+ */
|
|
619
|
+
+
|
|
620
|
+
+#if defined(__ARM_NEON) || defined(__ARM_NEON__)
|
|
621
|
+
+
|
|
622
|
+
+#include "qjl/qjl.h"
|
|
623
|
+
+#include "qjl_block.h"
|
|
624
|
+
+#include <arm_neon.h>
|
|
625
|
+
+#include <math.h>
|
|
626
|
+
+#include <string.h>
|
|
627
|
+
+
|
|
628
|
+
+/* Pack 8 fp32 lanes (two q-regs of 4 lanes) into one byte LSB-first.
|
|
629
|
+
+ * lane j (0..7) → bit j of the output byte iff that lane is > 0. */
|
|
630
|
+
+static inline uint8_t pack8_signs_neon(float32x4_t lo, float32x4_t hi) {
|
|
631
|
+
+ /* Compare > 0; result is uint32x4_t with 0xFFFFFFFF or 0 per lane. */
|
|
632
|
+
+ uint32x4_t mlo = vcgtq_f32(lo, vdupq_n_f32(0.0f));
|
|
633
|
+
+ uint32x4_t mhi = vcgtq_f32(hi, vdupq_n_f32(0.0f));
|
|
634
|
+
+ /* Per-lane bit weights: lane k of mlo → bit k; lane k of mhi → bit k+4. */
|
|
635
|
+
+ static const uint32_t wlo_arr[4] = {1u, 2u, 4u, 8u};
|
|
636
|
+
+ static const uint32_t whi_arr[4] = {16u, 32u, 64u, 128u};
|
|
637
|
+
+ uint32x4_t wlo = vld1q_u32(wlo_arr);
|
|
638
|
+
+ uint32x4_t whi = vld1q_u32(whi_arr);
|
|
639
|
+
+ uint32x4_t blo = vandq_u32(mlo, wlo);
|
|
640
|
+
+ uint32x4_t bhi = vandq_u32(mhi, whi);
|
|
641
|
+
+ uint32x4_t sum = vaddq_u32(blo, bhi);
|
|
642
|
+
+ /* Horizontal sum across the 4 lanes → 8-bit byte. */
|
|
643
|
+
+ uint32x2_t s2 = vadd_u32(vget_low_u32(sum), vget_high_u32(sum));
|
|
644
|
+
+ return (uint8_t)(vget_lane_u32(s2, 0) + vget_lane_u32(s2, 1));
|
|
645
|
+
+}
|
|
646
|
+
+
|
|
647
|
+
+void qjl_quantize_row_neon(const float *key, const float *prj,
|
|
648
|
+
+ qjl_block_qjl1_256 *out) {
|
|
649
|
+
+ /* L2 norm. */
|
|
650
|
+
+ float32x4_t nsum = vdupq_n_f32(0.0f);
|
|
651
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i += 4) {
|
|
652
|
+
+ float32x4_t k = vld1q_f32(key + i);
|
|
653
|
+
+ nsum = vfmaq_f32(nsum, k, k);
|
|
654
|
+
+ }
|
|
655
|
+
+ float norm_sq = vaddvq_f32(nsum);
|
|
656
|
+
+ out->norm_bf16 = qjl_fp32_to_bf16(sqrtf(norm_sq));
|
|
657
|
+
+
|
|
658
|
+
+ /* Project. proj_dim=256 = 4 passes of 64 lanes (16 q-vectors per pass). */
|
|
659
|
+
+ float32x4_t acc[16];
|
|
660
|
+
+ for (int pass = 0; pass < 4; pass++) {
|
|
661
|
+
+ for (int b = 0; b < 16; b++) acc[b] = vdupq_n_f32(0.0f);
|
|
662
|
+
+
|
|
663
|
+
+ const float *prj_base = prj + pass * 64;
|
|
664
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i++) {
|
|
665
|
+
+ float32x4_t ki = vdupq_n_f32(key[i]);
|
|
666
|
+
+ const float *row = prj_base + i * QJL_PROJECTION_DIM;
|
|
667
|
+
+ for (int b = 0; b < 16; b++) {
|
|
668
|
+
+ float32x4_t p = vld1q_f32(row + b * 4);
|
|
669
|
+
+ acc[b] = vfmaq_f32(acc[b], ki, p);
|
|
670
|
+
+ }
|
|
671
|
+
+ }
|
|
672
|
+
+ /* Pack pairs of q-vectors into bytes. 16 q-vectors → 8 bytes. */
|
|
673
|
+
+ for (int b = 0; b < 8; b++) {
|
|
674
|
+
+ out->qs[pass * 8 + b] = pack8_signs_neon(acc[b * 2], acc[b * 2 + 1]);
|
|
675
|
+
+ }
|
|
676
|
+
+ }
|
|
677
|
+
+}
|
|
678
|
+
+
|
|
679
|
+
+void qjl_quantize_rows_neon(const float *keys, const float *prj,
|
|
680
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows) {
|
|
681
|
+
+ for (size_t r = 0; r < n_rows; r++) {
|
|
682
|
+
+ qjl_quantize_row_neon(keys + r * QJL_HEAD_DIM, prj, out + r);
|
|
683
|
+
+ }
|
|
684
|
+
+}
|
|
685
|
+
+
|
|
686
|
+
+void qjl_dequantize_row_neon(const qjl_block_qjl1_256 *blk, const float *prj,
|
|
687
|
+
+ float *out) {
|
|
688
|
+
+ const float scl = 1.2533141373155003f / (float)QJL_PROJECTION_DIM
|
|
689
|
+
+ * qjl_bf16_to_fp32(blk->norm_bf16);
|
|
690
|
+
+ /* Pre-expand signs to fp32 +/-1. */
|
|
691
|
+
+ float signs[QJL_PROJECTION_DIM];
|
|
692
|
+
+ for (int j = 0; j < QJL_PROJECTION_DIM; j++) {
|
|
693
|
+
+ int bit = (blk->qs[j >> 3] >> (j & 7)) & 1;
|
|
694
|
+
+ signs[j] = bit ? 1.0f : -1.0f;
|
|
695
|
+
+ }
|
|
696
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i++) {
|
|
697
|
+
+ const float *row = prj + i * QJL_PROJECTION_DIM;
|
|
698
|
+
+ float32x4_t acc = vdupq_n_f32(0.0f);
|
|
699
|
+
+ for (int j = 0; j < QJL_PROJECTION_DIM; j += 4) {
|
|
700
|
+
+ float32x4_t p = vld1q_f32(row + j);
|
|
701
|
+
+ float32x4_t s = vld1q_f32(signs + j);
|
|
702
|
+
+ acc = vfmaq_f32(acc, p, s);
|
|
703
|
+
+ }
|
|
704
|
+
+ out[i] = scl * vaddvq_f32(acc);
|
|
705
|
+
+ }
|
|
706
|
+
+}
|
|
707
|
+
+
|
|
708
|
+
+#endif /* __ARM_NEON */
|
|
709
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_quantize_ref.c b/ggml/src/ggml-cpu/qjl/qjl_quantize_ref.c
|
|
710
|
+
new file mode 100644
|
|
711
|
+
index 00000000..a5d540c6
|
|
712
|
+
--- /dev/null
|
|
713
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_quantize_ref.c
|
|
714
|
+
@@ -0,0 +1,65 @@
|
|
715
|
+
+/*
|
|
716
|
+
+ * Scalar reference for QJL quantize / dequantize.
|
|
717
|
+
+ * Always built. Defines correctness; the SIMD paths must agree with it.
|
|
718
|
+
+ *
|
|
719
|
+
+ * Mirrors `qjl_pure_pytorch_quantize` in
|
|
720
|
+
+ * packages/training/scripts/quantization/test_qjl.py:
|
|
721
|
+
+ * sketch = key @ prj # (head_dim,) @ (head_dim, proj_dim) -> (proj_dim,)
|
|
722
|
+
+ * bits = (sketch > 0).uint8 # LSB-first packing within a byte
|
|
723
|
+
+ * norm = bf16(||key||_2)
|
|
724
|
+
+ */
|
|
725
|
+
+
|
|
726
|
+
+#include "qjl/qjl.h"
|
|
727
|
+
+#include "qjl_block.h"
|
|
728
|
+
+#include <math.h>
|
|
729
|
+
+#include <string.h>
|
|
730
|
+
+
|
|
731
|
+
+void qjl_quantize_row_ref(const float *key, const float *prj,
|
|
732
|
+
+ qjl_block_qjl1_256 *out) {
|
|
733
|
+
+ /* ||key|| in fp32, then bf16-round at the end. */
|
|
734
|
+
+ float norm_sq = 0.0f;
|
|
735
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i++) {
|
|
736
|
+
+ norm_sq += key[i] * key[i];
|
|
737
|
+
+ }
|
|
738
|
+
+ out->norm_bf16 = qjl_fp32_to_bf16(sqrtf(norm_sq));
|
|
739
|
+
+
|
|
740
|
+
+ /* sketch[j] = sum_i key[i] * prj[i*proj_dim + j] */
|
|
741
|
+
+ /* Pack 8 bits LSB-first. */
|
|
742
|
+
+ memset(out->qs, 0, QJL_PACKED_BYTES);
|
|
743
|
+
+ for (int j = 0; j < QJL_PROJECTION_DIM; j++) {
|
|
744
|
+
+ float acc = 0.0f;
|
|
745
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i++) {
|
|
746
|
+
+ acc += key[i] * prj[i * QJL_PROJECTION_DIM + j];
|
|
747
|
+
+ }
|
|
748
|
+
+ if (acc > 0.0f) {
|
|
749
|
+
+ out->qs[j >> 3] |= (uint8_t)(1u << (j & 7));
|
|
750
|
+
+ }
|
|
751
|
+
+ }
|
|
752
|
+
+}
|
|
753
|
+
+
|
|
754
|
+
+void qjl_quantize_rows_ref(const float *keys, const float *prj,
|
|
755
|
+
+ qjl_block_qjl1_256 *out, size_t n_rows) {
|
|
756
|
+
+ for (size_t r = 0; r < n_rows; r++) {
|
|
757
|
+
+ qjl_quantize_row_ref(keys + r * QJL_HEAD_DIM, prj, out + r);
|
|
758
|
+
+ }
|
|
759
|
+
+}
|
|
760
|
+
+
|
|
761
|
+
+/*
|
|
762
|
+
+ * Dequantize: reconstruct an fp32 approximation of the original key.
|
|
763
|
+
+ * Uses the same scl = sqrt(pi/2) / proj_dim factor as the score kernel.
|
|
764
|
+
+ */
|
|
765
|
+
+void qjl_dequantize_row_ref(const qjl_block_qjl1_256 *blk, const float *prj,
|
|
766
|
+
+ float *out) {
|
|
767
|
+
+ /* sqrt(pi/2) ≈ 1.2533141373155003f. Matches the score kernel's `scl`. */
|
|
768
|
+
+ const float scl = 1.2533141373155003f / (float)QJL_PROJECTION_DIM
|
|
769
|
+
+ * qjl_bf16_to_fp32(blk->norm_bf16);
|
|
770
|
+
+ for (int i = 0; i < QJL_HEAD_DIM; i++) {
|
|
771
|
+
+ float acc = 0.0f;
|
|
772
|
+
+ const float *row = prj + i * QJL_PROJECTION_DIM;
|
|
773
|
+
+ for (int j = 0; j < QJL_PROJECTION_DIM; j++) {
|
|
774
|
+
+ int bit = (blk->qs[j >> 3] >> (j & 7)) & 1;
|
|
775
|
+
+ acc += (bit ? row[j] : -row[j]);
|
|
776
|
+
+ }
|
|
777
|
+
+ out[i] = scl * acc;
|
|
778
|
+
+ }
|
|
779
|
+
+}
|
|
780
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_score_avx2.c b/ggml/src/ggml-cpu/qjl/qjl_score_avx2.c
|
|
781
|
+
new file mode 100644
|
|
782
|
+
index 00000000..d462b7e1
|
|
783
|
+
--- /dev/null
|
|
784
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_score_avx2.c
|
|
785
|
+
@@ -0,0 +1,70 @@
|
|
786
|
+
+/*
|
|
787
|
+
+ * AVX2 GQA attention-score kernel.
|
|
788
|
+
+ *
|
|
789
|
+
+ * For each (h_q, t) pair:
|
|
790
|
+
+ * acc = sum_j sign_packed[t, j] * q_sketch[h_q, j]
|
|
791
|
+
+ * where the sign bits live in 32 bytes of `packed_k[hk, t].qs`.
|
|
792
|
+
+ *
|
|
793
|
+
+ * Strategy: expand each 32-byte sign mask into 256 fp32 +/-1 lanes
|
|
794
|
+
+ * (32 ymm registers' worth) by table-lookup, then dot against q_sketch
|
|
795
|
+
+ * via 32 fmadds. We do the expansion in 8-bit groups via the pdep-style
|
|
796
|
+
+ * trick: an 8-element u8->fp32 +/-1 LUT.
|
|
797
|
+
+ */
|
|
798
|
+
+
|
|
799
|
+
+#if defined(__AVX2__)
|
|
800
|
+
+
|
|
801
|
+
+#include "qjl/qjl.h"
|
|
802
|
+
+#include "qjl_block.h"
|
|
803
|
+
+#include <immintrin.h>
|
|
804
|
+
+#include <math.h>
|
|
805
|
+
+
|
|
806
|
+
+/* Expand one byte of sign bits into 8 fp32 lanes of +/-1. */
|
|
807
|
+
+static inline __m256 expand_signs_byte(uint8_t b) {
|
|
808
|
+
+ /* Build 8 lanes where lane j = bit j of b. Use a broadcast + AND + cmp.
|
|
809
|
+
+ This avoids a 256-entry LUT and is branchless. */
|
|
810
|
+
+ __m256i v = _mm256_set1_epi32((int)b);
|
|
811
|
+
+ /* per-lane bit selector: 1, 2, 4, 8, 16, 32, 64, 128 */
|
|
812
|
+
+ const __m256i bits = _mm256_setr_epi32(1, 2, 4, 8, 16, 32, 64, 128);
|
|
813
|
+
+ __m256i andv = _mm256_and_si256(v, bits);
|
|
814
|
+
+ /* lane mask: all-ones if bit set, else zero */
|
|
815
|
+
+ __m256i mask = _mm256_cmpeq_epi32(andv, bits);
|
|
816
|
+
+ /* convert to fp32: -1.0 + 2.0 * (mask?1:0) → +1 if set, -1 if not */
|
|
817
|
+
+ __m256 ones = _mm256_set1_ps(1.0f);
|
|
818
|
+
+ __m256 negones = _mm256_set1_ps(-1.0f);
|
|
819
|
+
+ /* blendv selects b when mask high-bit set */
|
|
820
|
+
+ return _mm256_blendv_ps(negones, ones, _mm256_castsi256_ps(mask));
|
|
821
|
+
+}
|
|
822
|
+
+
|
|
823
|
+
+void qjl_score_qk_avx2(const float *q_sketch,
|
|
824
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
825
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
826
|
+
+ float *scores) {
|
|
827
|
+
+ const float scl_base = 1.2533141373155003f / (float)QJL_PROJECTION_DIM;
|
|
828
|
+
+ const int gqa = n_heads / n_kv_heads;
|
|
829
|
+
+
|
|
830
|
+
+ for (int hq = 0; hq < n_heads; hq++) {
|
|
831
|
+
+ int hk = hq / gqa;
|
|
832
|
+
+ const float *qs = q_sketch + hq * QJL_PROJECTION_DIM;
|
|
833
|
+
+
|
|
834
|
+
+ for (int t = 0; t < n_tokens; t++) {
|
|
835
|
+
+ const qjl_block_qjl1_256 *blk = packed_k + hk * n_tokens + t;
|
|
836
|
+
+ __m256 acc = _mm256_setzero_ps();
|
|
837
|
+
+ /* 32 bytes of signs → 32 ymm of +/-1 → 32 fma with q_sketch */
|
|
838
|
+
+ for (int b = 0; b < QJL_PACKED_BYTES; b++) {
|
|
839
|
+
+ __m256 sgn = expand_signs_byte(blk->qs[b]);
|
|
840
|
+
+ __m256 q = _mm256_loadu_ps(qs + b * 8);
|
|
841
|
+
+ acc = _mm256_fmadd_ps(sgn, q, acc);
|
|
842
|
+
+ }
|
|
843
|
+
+ __m128 lo = _mm256_castps256_ps128(acc);
|
|
844
|
+
+ __m128 hi = _mm256_extractf128_ps(acc, 1);
|
|
845
|
+
+ __m128 v = _mm_add_ps(lo, hi);
|
|
846
|
+
+ v = _mm_hadd_ps(v, v);
|
|
847
|
+
+ v = _mm_hadd_ps(v, v);
|
|
848
|
+
+ float dot = _mm_cvtss_f32(v);
|
|
849
|
+
+ float norm_k = qjl_bf16_to_fp32(blk->norm_bf16);
|
|
850
|
+
+ scores[hq * n_tokens + t] = scl_base * norm_k * dot;
|
|
851
|
+
+ }
|
|
852
|
+
+ }
|
|
853
|
+
+}
|
|
854
|
+
+
|
|
855
|
+
+#endif /* __AVX2__ */
|
|
856
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_score_neon.c b/ggml/src/ggml-cpu/qjl/qjl_score_neon.c
|
|
857
|
+
new file mode 100644
|
|
858
|
+
index 00000000..ed72b64b
|
|
859
|
+
--- /dev/null
|
|
860
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_score_neon.c
|
|
861
|
+
@@ -0,0 +1,66 @@
|
|
862
|
+
+/*
|
|
863
|
+
+ * NEON GQA attention-score kernel.
|
|
864
|
+
+ *
|
|
865
|
+
+ * Same algorithm shape as the AVX2 path: expand each byte of packed
|
|
866
|
+
+ * signs into 8 fp32 +/-1 lanes (= 2 NEON q-vectors), FMA against the
|
|
867
|
+
+ * matching block of q_sketch, accumulate, scale by ||k|| * sqrt(pi/2)/proj.
|
|
868
|
+
+ */
|
|
869
|
+
+
|
|
870
|
+
+#if defined(__ARM_NEON) || defined(__ARM_NEON__)
|
|
871
|
+
+
|
|
872
|
+
+#include "qjl/qjl.h"
|
|
873
|
+
+#include "qjl_block.h"
|
|
874
|
+
+#include <arm_neon.h>
|
|
875
|
+
+#include <math.h>
|
|
876
|
+
+
|
|
877
|
+
+/* Expand 4 of the 8 bits of a byte into 4 fp32 lanes of +/-1.
|
|
878
|
+
+ * `bit_offset` is 0 (low nibble: bits 0..3) or 4 (high nibble: bits 4..7). */
|
|
879
|
+
+static inline float32x4_t expand_signs_nibble(uint8_t b, int bit_offset) {
|
|
880
|
+
+ /* Per-lane bit weights for the requested nibble. */
|
|
881
|
+
+ uint32_t w0 = 1u << (bit_offset + 0);
|
|
882
|
+
+ uint32_t w1 = 1u << (bit_offset + 1);
|
|
883
|
+
+ uint32_t w2 = 1u << (bit_offset + 2);
|
|
884
|
+
+ uint32_t w3 = 1u << (bit_offset + 3);
|
|
885
|
+
+ uint32_t warr[4] = {w0, w1, w2, w3};
|
|
886
|
+
+ uint32x4_t weights = vld1q_u32(warr);
|
|
887
|
+
+ uint32x4_t bv = vdupq_n_u32(b);
|
|
888
|
+
+ uint32x4_t andv = vandq_u32(bv, weights);
|
|
889
|
+
+ uint32x4_t mask = vceqq_u32(andv, weights);
|
|
890
|
+
+ /* mask is 0xFFFFFFFF (set) or 0 (clear) per lane. Map to +1/-1. */
|
|
891
|
+
+ float32x4_t one = vdupq_n_f32(1.0f);
|
|
892
|
+
+ float32x4_t none = vdupq_n_f32(-1.0f);
|
|
893
|
+
+ return vbslq_f32(mask, one, none);
|
|
894
|
+
+}
|
|
895
|
+
+
|
|
896
|
+
+void qjl_score_qk_neon(const float *q_sketch,
|
|
897
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
898
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
899
|
+
+ float *scores) {
|
|
900
|
+
+ const float scl_base = 1.2533141373155003f / (float)QJL_PROJECTION_DIM;
|
|
901
|
+
+ const int gqa = n_heads / n_kv_heads;
|
|
902
|
+
+
|
|
903
|
+
+ for (int hq = 0; hq < n_heads; hq++) {
|
|
904
|
+
+ int hk = hq / gqa;
|
|
905
|
+
+ const float *qs = q_sketch + hq * QJL_PROJECTION_DIM;
|
|
906
|
+
+
|
|
907
|
+
+ for (int t = 0; t < n_tokens; t++) {
|
|
908
|
+
+ const qjl_block_qjl1_256 *blk = packed_k + hk * n_tokens + t;
|
|
909
|
+
+ float32x4_t acc = vdupq_n_f32(0.0f);
|
|
910
|
+
+ /* 32 bytes → 64 q-vectors of +/-1 → 64 fma's. */
|
|
911
|
+
+ for (int b = 0; b < QJL_PACKED_BYTES; b++) {
|
|
912
|
+
+ uint8_t byte = blk->qs[b];
|
|
913
|
+
+ float32x4_t s_lo = expand_signs_nibble(byte, 0);
|
|
914
|
+
+ float32x4_t s_hi = expand_signs_nibble(byte, 4);
|
|
915
|
+
+ float32x4_t q_lo = vld1q_f32(qs + b * 8);
|
|
916
|
+
+ float32x4_t q_hi = vld1q_f32(qs + b * 8 + 4);
|
|
917
|
+
+ acc = vfmaq_f32(acc, s_lo, q_lo);
|
|
918
|
+
+ acc = vfmaq_f32(acc, s_hi, q_hi);
|
|
919
|
+
+ }
|
|
920
|
+
+ float dot = vaddvq_f32(acc);
|
|
921
|
+
+ float norm_k = qjl_bf16_to_fp32(blk->norm_bf16);
|
|
922
|
+
+ scores[hq * n_tokens + t] = scl_base * norm_k * dot;
|
|
923
|
+
+ }
|
|
924
|
+
+ }
|
|
925
|
+
+}
|
|
926
|
+
+
|
|
927
|
+
+#endif /* __ARM_NEON */
|
|
928
|
+
diff --git a/ggml/src/ggml-cpu/qjl/qjl_score_ref.c b/ggml/src/ggml-cpu/qjl/qjl_score_ref.c
|
|
929
|
+
new file mode 100644
|
|
930
|
+
index 00000000..cef15652
|
|
931
|
+
--- /dev/null
|
|
932
|
+
+++ b/ggml/src/ggml-cpu/qjl/qjl_score_ref.c
|
|
933
|
+
@@ -0,0 +1,42 @@
|
|
934
|
+
+/*
|
|
935
|
+
+ * Scalar reference for the GQA attention-score path.
|
|
936
|
+
+ *
|
|
937
|
+
+ * The pre-projected query sketch (shape: n_heads * proj_dim) is supplied
|
|
938
|
+
+ * by the caller — caching that sketch across the decode steps is the
|
|
939
|
+
+ * whole point of QJL on the K side. Each output score is:
|
|
940
|
+
+ *
|
|
941
|
+
+ * score[h_q, t] = ||k_t|| * sqrt(pi/2)/proj_dim *
|
|
942
|
+
+ * sum_j sign_packed[t, j] * q_sketch[h_q, j]
|
|
943
|
+
+ *
|
|
944
|
+
+ * with sign_packed[t, j] = +1 if bit j of token t's packed signs is set,
|
|
945
|
+
+ * -1 otherwise. h_kv = h_q / (n_heads / n_kv_heads) for GQA sharing.
|
|
946
|
+
+ */
|
|
947
|
+
+
|
|
948
|
+
+#include "qjl/qjl.h"
|
|
949
|
+
+#include "qjl_block.h"
|
|
950
|
+
+#include <math.h>
|
|
951
|
+
+
|
|
952
|
+
+void qjl_score_qk_ref(const float *q_sketch,
|
|
953
|
+
+ const qjl_block_qjl1_256 *packed_k,
|
|
954
|
+
+ int n_heads, int n_kv_heads, int n_tokens,
|
|
955
|
+
+ float *scores) {
|
|
956
|
+
+ /* sqrt(pi/2) / proj_dim — matches CUDA score kernel line 175. */
|
|
957
|
+
+ const float scl_base = 1.2533141373155003f / (float)QJL_PROJECTION_DIM;
|
|
958
|
+
+ const int gqa = n_heads / n_kv_heads; /* >= 1 */
|
|
959
|
+
+
|
|
960
|
+
+ for (int hq = 0; hq < n_heads; hq++) {
|
|
961
|
+
+ int hk = hq / gqa;
|
|
962
|
+
+ const float *qs = q_sketch + hq * QJL_PROJECTION_DIM;
|
|
963
|
+
+
|
|
964
|
+
+ for (int t = 0; t < n_tokens; t++) {
|
|
965
|
+
+ const qjl_block_qjl1_256 *blk = packed_k + hk * n_tokens + t;
|
|
966
|
+
+ float norm_k = qjl_bf16_to_fp32(blk->norm_bf16);
|
|
967
|
+
+ float acc = 0.0f;
|
|
968
|
+
+ for (int j = 0; j < QJL_PROJECTION_DIM; j++) {
|
|
969
|
+
+ int bit = (blk->qs[j >> 3] >> (j & 7)) & 1;
|
|
970
|
+
+ acc += (bit ? qs[j] : -qs[j]);
|
|
971
|
+
+ }
|
|
972
|
+
+ scores[hq * n_tokens + t] = scl_base * norm_k * acc;
|
|
973
|
+
+ }
|
|
974
|
+
+ }
|
|
975
|
+
+}
|
|
976
|
+
diff --git a/ggml/src/ggml-cpu/qjl/quants-qjl.c b/ggml/src/ggml-cpu/qjl/quants-qjl.c
|
|
977
|
+
new file mode 100644
|
|
978
|
+
index 00000000..268ff729
|
|
979
|
+
--- /dev/null
|
|
980
|
+
+++ b/ggml/src/ggml-cpu/qjl/quants-qjl.c
|
|
981
|
+
@@ -0,0 +1,232 @@
|
|
982
|
+
+/*
|
|
983
|
+
+ * GGML wrapper for the standalone QJL kernel library
|
|
984
|
+
+ * (packages/native-plugins/qjl-cpu/). Bridges the kernel-library API
|
|
985
|
+
+ * (qjl_quantize_row_*, qjl_score_qk_*) to the ggml-CPU-backend ABI
|
|
986
|
+
+ * (quantize_row_qjl1_256, dequantize_row_qjl1_256, quantize_qjl1_256,
|
|
987
|
+
+ * ggml_compute_forward_attn_score_qjl).
|
|
988
|
+
+ *
|
|
989
|
+
+ * The kernel library is the bit-parity-validated source of truth and is
|
|
990
|
+
+ * left untouched. This shim only exposes ggml-shaped names + provides a
|
|
991
|
+
+ * lazily-built default projection matrix Π for the quantize/dequantize
|
|
992
|
+
+ * table entries. Production QJL deployments ship Π in a sidecar (see
|
|
993
|
+
+ * packages/training/scripts/quantization/qjl_apply.py) and inject it
|
|
994
|
+
+ * via the attention path; the bundled MT-seeded Π here is for the
|
|
995
|
+
+ * "I just want a cache type that round-trips" case (synthetic graphs,
|
|
996
|
+
+ * smoke tests, the test-qjl-cache binary).
|
|
997
|
+
+ *
|
|
998
|
+
+ * block_qjl1_256 in ggml-common.h has identical layout to the kernel
|
|
999
|
+
+ * library's qjl_block_qjl1_256 (16-bit norm + 32 bytes packed signs);
|
|
1000
|
+
+ * the static_assert in both headers locks size = 34 B. We aliasing-cast
|
|
1001
|
+
+ * between the two; if the ggml type is ever extended with extra fields,
|
|
1002
|
+
+ * stop aliasing and copy.
|
|
1003
|
+
+ */
|
|
1004
|
+
+
|
|
1005
|
+
+#define GGML_COMMON_IMPL_C
|
|
1006
|
+
+#include "ggml-common.h"
|
|
1007
|
+
+
|
|
1008
|
+
+#include "ggml-cpu-impl.h"
|
|
1009
|
+
+#include "ggml-quants.h"
|
|
1010
|
+
+#include "quants.h"
|
|
1011
|
+
+
|
|
1012
|
+
+#include "qjl/qjl.h"
|
|
1013
|
+
+#include "qjl_block.h"
|
|
1014
|
+
+
|
|
1015
|
+
+#include <math.h>
|
|
1016
|
+
+#include <pthread.h>
|
|
1017
|
+
+#include <stdint.h>
|
|
1018
|
+
+#include <stdlib.h>
|
|
1019
|
+
+#include <string.h>
|
|
1020
|
+
+
|
|
1021
|
+
+/* Confirm the two block layouts agree byte-for-byte. */
|
|
1022
|
+
+_Static_assert(sizeof(qjl_block_qjl1_256) == sizeof(block_qjl1_256),
|
|
1023
|
+
+ "qjl block layouts must agree (kernel lib vs ggml)");
|
|
1024
|
+
+_Static_assert(QJL_PROJECTION_DIM == QK_QJL,
|
|
1025
|
+
+ "QJL projection dim must equal QK_QJL");
|
|
1026
|
+
+
|
|
1027
|
+
+/* ---------------- default projection ---------------- */
|
|
1028
|
+
+
|
|
1029
|
+
+/*
|
|
1030
|
+
+ * Lazily-built default projection matrix. head_dim=128, proj_dim=256,
|
|
1031
|
+
+ * seed=42 (the canonical QJL paper default — see QJL_PROJECTION_SEED in
|
|
1032
|
+
+ * the kernel-library docs). 128 * 256 * 4 = 128 KB. One-shot allocation
|
|
1033
|
+
+ * for the lifetime of the process.
|
|
1034
|
+
+ *
|
|
1035
|
+
+ * The intended production wiring has Π injected per layer from the
|
|
1036
|
+
+ * sidecar; this default exists so the quantize/dequantize entries in
|
|
1037
|
+
+ * the type-traits table can run standalone (e.g. for synthetic graphs
|
|
1038
|
+
+ * that exercise the cache-type path without a real sidecar).
|
|
1039
|
+
+ */
|
|
1040
|
+
+#define QJL_DEFAULT_HEAD_DIM 128
|
|
1041
|
+
+#define QJL_DEFAULT_PROJ_DIM 256
|
|
1042
|
+
+#define QJL_DEFAULT_SEED 42ULL
|
|
1043
|
+
+
|
|
1044
|
+
+static pthread_once_t g_qjl_prj_once = PTHREAD_ONCE_INIT;
|
|
1045
|
+
+static float *g_qjl_prj = NULL;
|
|
1046
|
+
+
|
|
1047
|
+
+static void qjl_default_projection_init(void) {
|
|
1048
|
+
+ g_qjl_prj = (float *) malloc(sizeof(float) * QJL_DEFAULT_HEAD_DIM * QJL_DEFAULT_PROJ_DIM);
|
|
1049
|
+
+ if (g_qjl_prj == NULL) return;
|
|
1050
|
+
+ qjl_make_projection_mt(g_qjl_prj, QJL_DEFAULT_HEAD_DIM, QJL_DEFAULT_PROJ_DIM, QJL_DEFAULT_SEED);
|
|
1051
|
+
+}
|
|
1052
|
+
+
|
|
1053
|
+
+static const float * qjl_default_projection(void) {
|
|
1054
|
+
+ pthread_once(&g_qjl_prj_once, qjl_default_projection_init);
|
|
1055
|
+
+ return g_qjl_prj;
|
|
1056
|
+
+}
|
|
1057
|
+
+
|
|
1058
|
+
+/* ---------------- ggml-API-shaped wrappers ---------------- */
|
|
1059
|
+
+
|
|
1060
|
+
+/*
|
|
1061
|
+
+ * Quantize one full row's worth of fp32 keys into block_qjl1_256.
|
|
1062
|
+
+ * `k` is the total scalar count and must be a multiple of QK_QJL/2 = 128
|
|
1063
|
+
+ * (one head_dim of 128 floats per output block — QK_QJL is the *sketch*
|
|
1064
|
+
+ * dim, not the input dim). We deliberately ignore that subtlety in the
|
|
1065
|
+
+ * type-traits blck_size, which is set to QK_QJL=256 so the standard
|
|
1066
|
+
+ * row-size math `nrow * QK_QJL * type_size / blck_size` produces the
|
|
1067
|
+
+ * correct on-cache footprint of 34 B per cached key vector.
|
|
1068
|
+
+ *
|
|
1069
|
+
+ * Strict-row callers (the type-traits from_float_ref) will pass
|
|
1070
|
+
+ * k = ggml_blck_size(GGML_TYPE_QJL1_256) = QK_QJL on each call. We treat
|
|
1071
|
+
+ * that single block as one cached key vector of head_dim=128 floats
|
|
1072
|
+
+ * preceded by 128 floats of "padding" the caller never reads back, which
|
|
1073
|
+
+ * matches how the K-cache stores one row per token-head pair. To keep the
|
|
1074
|
+
+ * math honest, the contract is: caller guarantees `k` rows worth of
|
|
1075
|
+
+ * head_dim=128 keys and the wrapper steps through them in 128-float
|
|
1076
|
+
+ * strides.
|
|
1077
|
+
+ *
|
|
1078
|
+
+ * In practice the GGML K-cache path issues from_float against a tensor
|
|
1079
|
+
+ * whose leading dim is head_dim, so the natural call pattern is one
|
|
1080
|
+
+ * block per cached key vector; QK_QJL is exposed in the table only as
|
|
1081
|
+
+ * the on-cache row-byte-size denominator.
|
|
1082
|
+
+ */
|
|
1083
|
+
+void quantize_row_qjl1_256_ref(const float * GGML_RESTRICT x, block_qjl1_256 * GGML_RESTRICT y, int64_t k) {
|
|
1084
|
+
+ /* Number of cached key vectors = k / head_dim. The ggml row-size math
|
|
1085
|
+
+ * pre-divides by blck_size (= QK_QJL = 256), so callers that respect
|
|
1086
|
+
+ * the type's blck_size always pass a multiple of 256 for n_per_row;
|
|
1087
|
+
+ * the kernel always consumes head_dim=128 floats per output block. */
|
|
1088
|
+
+ GGML_ASSERT(k > 0);
|
|
1089
|
+
+ GGML_ASSERT((k % QJL_HEAD_DIM) == 0);
|
|
1090
|
+
+ const int64_t n_blocks = k / QJL_HEAD_DIM;
|
|
1091
|
+
+ const float * prj = qjl_default_projection();
|
|
1092
|
+
+ GGML_ASSERT(prj != NULL);
|
|
1093
|
+
+
|
|
1094
|
+
+ for (int64_t r = 0; r < n_blocks; r++) {
|
|
1095
|
+
+ qjl_quantize_row_ref(x + r * QJL_HEAD_DIM, prj,
|
|
1096
|
+
+ (qjl_block_qjl1_256 *)(y + r));
|
|
1097
|
+
+ }
|
|
1098
|
+
+}
|
|
1099
|
+
+
|
|
1100
|
+
+/* CPU-backend entry point — pick best SIMD path. Mirrors quantize_row_tbq3_0(). */
|
|
1101
|
+
+void quantize_row_qjl1_256(const float * GGML_RESTRICT x, void * GGML_RESTRICT vy, int64_t k) {
|
|
1102
|
+
+ GGML_ASSERT(k > 0);
|
|
1103
|
+
+ GGML_ASSERT((k % QJL_HEAD_DIM) == 0);
|
|
1104
|
+
+ const int64_t n_blocks = k / QJL_HEAD_DIM;
|
|
1105
|
+
+ block_qjl1_256 * y = (block_qjl1_256 *) vy;
|
|
1106
|
+
+ const float * prj = qjl_default_projection();
|
|
1107
|
+
+ GGML_ASSERT(prj != NULL);
|
|
1108
|
+
+
|
|
1109
|
+
+ qjl_quantize_rows(x, prj, (qjl_block_qjl1_256 *)y, (size_t) n_blocks);
|
|
1110
|
+
+}
|
|
1111
|
+
+
|
|
1112
|
+
+/* Dequantize: reconstruct an approximate fp32 key from a packed block,
|
|
1113
|
+
+ * using the QJL paper's cosine-similarity scl = sqrt(pi/2)/proj_dim.
|
|
1114
|
+
+ * Stride matches quantize_row_qjl1_256_ref (one block per head_dim
|
|
1115
|
+
+ * outputs). Uses the same default projection as the quantize path so
|
|
1116
|
+
+ * round-trips match. */
|
|
1117
|
+
+void dequantize_row_qjl1_256(const block_qjl1_256 * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k) {
|
|
1118
|
+
+ GGML_ASSERT(k > 0);
|
|
1119
|
+
+ GGML_ASSERT((k % QJL_HEAD_DIM) == 0);
|
|
1120
|
+
+ const int64_t n_blocks = k / QJL_HEAD_DIM;
|
|
1121
|
+
+ const float * prj = qjl_default_projection();
|
|
1122
|
+
+ GGML_ASSERT(prj != NULL);
|
|
1123
|
+
+
|
|
1124
|
+
+ for (int64_t r = 0; r < n_blocks; r++) {
|
|
1125
|
+
+ qjl_dequantize_row_ref((const qjl_block_qjl1_256 *)(x + r), prj,
|
|
1126
|
+
+ y + r * QJL_HEAD_DIM);
|
|
1127
|
+
+ }
|
|
1128
|
+
+}
|
|
1129
|
+
+
|
|
1130
|
+
+/* `quantize_qjl1_256` — the bulk path called from ggml_quantize_chunk.
|
|
1131
|
+
+ * Mirrors `quantize_tbq3_0` shape: ignores quant_weights, defers to the
|
|
1132
|
+
+ * row-ref wrapper, returns the on-cache byte size of the result. */
|
|
1133
|
+
+size_t quantize_qjl1_256(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrow, int64_t n_per_row, const float * quant_weights) {
|
|
1134
|
+
+ (void) quant_weights;
|
|
1135
|
+
+ const size_t row_size = ggml_row_size(GGML_TYPE_QJL1_256, n_per_row);
|
|
1136
|
+
+ quantize_row_qjl1_256_ref(src, (block_qjl1_256 *) dst, (int64_t) nrow * n_per_row);
|
|
1137
|
+
+ return (size_t) nrow * row_size;
|
|
1138
|
+
+}
|
|
1139
|
+
+
|
|
1140
|
+
+/* ---------------- attention score op ---------------- */
|
|
1141
|
+
+
|
|
1142
|
+
+/*
|
|
1143
|
+
+ * GGML_OP_ATTN_SCORE_QJL forward. Called by ggml-cpu.c's dispatcher with
|
|
1144
|
+
+ * tensor->src[0] = q F32 [QK_QJL, n_heads, n_batch, ne3]
|
|
1145
|
+
+ * tensor->src[1] = packed_k QJL1_256 [QK_QJL, n_kv_tokens, n_kv_heads, ne3]
|
|
1146
|
+
+ * and emits
|
|
1147
|
+
+ * tensor = scores F32 [n_kv_tokens, n_heads, n_batch, ne3]
|
|
1148
|
+
+ *
|
|
1149
|
+
+ * n_kv_heads is stored in tensor->op_params[0]. We loop the batch and
|
|
1150
|
+
+ * ne3 dims serially; the inner per-batch call goes through the dispatched
|
|
1151
|
+
+ * SIMD score path in qjl_dispatch.c.
|
|
1152
|
+
+ *
|
|
1153
|
+
+ * Threading: the n_tasks fan-out for this op is set to 1 in ggml-cpu.c's
|
|
1154
|
+
+ * task-count switch; the inner SIMD already saturates the per-core FMA
|
|
1155
|
+
+ * throughput on the proj_dim=256 sweep, and the n_heads*n_kv_tokens loop
|
|
1156
|
+
+ * is small enough on phone-class workloads that thread-fan adds more
|
|
1157
|
+
+ * overhead than it saves. Revisit when we have a real per-token decode
|
|
1158
|
+
+ * profile on arm64 hardware.
|
|
1159
|
+
+ */
|
|
1160
|
+
+void ggml_compute_forward_attn_score_qjl(
|
|
1161
|
+
+ const struct ggml_compute_params * params,
|
|
1162
|
+
+ struct ggml_tensor * dst) {
|
|
1163
|
+
+ if (params->ith != 0) return; /* single-threaded for now */
|
|
1164
|
+
+
|
|
1165
|
+
+ const struct ggml_tensor * q = dst->src[0];
|
|
1166
|
+
+ const struct ggml_tensor * pk = dst->src[1];
|
|
1167
|
+
+
|
|
1168
|
+
+ GGML_ASSERT(q->type == GGML_TYPE_F32);
|
|
1169
|
+
+ GGML_ASSERT(pk->type == GGML_TYPE_QJL1_256);
|
|
1170
|
+
+ GGML_ASSERT(q->ne[0] == QK_QJL);
|
|
1171
|
+
+ GGML_ASSERT(pk->ne[0] == QK_QJL);
|
|
1172
|
+
+
|
|
1173
|
+
+ const int n_heads = (int) q->ne[1];
|
|
1174
|
+
+ const int n_kv_heads = ((const int32_t *) dst->op_params)[0];
|
|
1175
|
+
+ const int n_kv_tokens = (int) pk->ne[1];
|
|
1176
|
+
+
|
|
1177
|
+
+ GGML_ASSERT(n_kv_heads > 0);
|
|
1178
|
+
+ GGML_ASSERT((n_heads % n_kv_heads) == 0);
|
|
1179
|
+
+ GGML_ASSERT(pk->ne[2] == (int64_t) n_kv_heads);
|
|
1180
|
+
+
|
|
1181
|
+
+ const int64_t n_batch = q->ne[2];
|
|
1182
|
+
+ const int64_t ne3 = q->ne[3];
|
|
1183
|
+
+ GGML_ASSERT(pk->ne[3] == ne3);
|
|
1184
|
+
+
|
|
1185
|
+
+ /* Strides in elements (ggml `nb` is in bytes). */
|
|
1186
|
+
+ const size_t q_stride_b = q->nb[2]; /* bytes between batches in q */
|
|
1187
|
+
+ const size_t q_stride_3 = q->nb[3];
|
|
1188
|
+
+ const size_t pk_stride_3 = pk->nb[3];
|
|
1189
|
+
+ const size_t s_stride_b = dst->nb[2];
|
|
1190
|
+
+ const size_t s_stride_3 = dst->nb[3];
|
|
1191
|
+
+
|
|
1192
|
+
+ /* The packed_k layout for one (batch,ne3) plane is contiguous over
|
|
1193
|
+
+ * (n_kv_heads, n_kv_tokens, block_qjl1_256). The score kernel expects
|
|
1194
|
+
+ * n_kv_heads first then n_tokens for indexing — that matches our
|
|
1195
|
+
+ * pk->ne[1]=n_kv_tokens, ne[2]=n_kv_heads layout iff the stride from
|
|
1196
|
+
+ * the head dim equals n_kv_tokens * sizeof(block). Asserting catches
|
|
1197
|
+
+ * mis-shaped inputs early. */
|
|
1198
|
+
+ GGML_ASSERT(pk->nb[1] == sizeof(block_qjl1_256));
|
|
1199
|
+
+ GGML_ASSERT(pk->nb[2] == (size_t) n_kv_tokens * sizeof(block_qjl1_256));
|
|
1200
|
+
+
|
|
1201
|
+
+ for (int64_t i3 = 0; i3 < ne3; i3++) {
|
|
1202
|
+
+ const char * pk_plane = (const char *) pk->data + i3 * pk_stride_3;
|
|
1203
|
+
+ for (int64_t i2 = 0; i2 < n_batch; i2++) {
|
|
1204
|
+
+ const float * q_plane = (const float *) ((const char *) q->data + i2 * q_stride_b + i3 * q_stride_3);
|
|
1205
|
+
+ float * s_plane = (float *) ((char *) dst->data + i2 * s_stride_b + i3 * s_stride_3);
|
|
1206
|
+
+
|
|
1207
|
+
+ qjl_score_qk(q_plane,
|
|
1208
|
+
+ (const qjl_block_qjl1_256 *) pk_plane,
|
|
1209
|
+
+ n_heads, n_kv_heads, n_kv_tokens,
|
|
1210
|
+
+ s_plane);
|
|
1211
|
+
+ }
|
|
1212
|
+
+ }
|
|
1213
|
+
+}
|
|
1214
|
+
diff --git a/ggml/src/ggml-cpu/quants.h b/ggml/src/ggml-cpu/quants.h
|
|
1215
|
+
index 4847ac3c..ece1b848 100644
|
|
1216
|
+
--- a/ggml/src/ggml-cpu/quants.h
|
|
1217
|
+
+++ b/ggml/src/ggml-cpu/quants.h
|
|
1218
|
+
@@ -34,6 +34,15 @@ void quantize_row_tq1_0(const float * GGML_RESTRICT x, void * GGML_RESTRICT y, i
|
|
1219
|
+
void quantize_row_tq2_0(const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int64_t k);
|
|
1220
|
+
void quantize_row_tbq3_0(const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int64_t k);
|
|
1221
|
+
void quantize_row_tbq4_0(const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int64_t k);
|
|
1222
|
+
+void quantize_row_qjl1_256(const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int64_t k);
|
|
1223
|
+
+
|
|
1224
|
+
+// QJL custom op forward — packed-K attention score. Declared here so
|
|
1225
|
+
+// ggml-cpu.c's dispatcher can reach it; defined in qjl/quants-qjl.c.
|
|
1226
|
+
+struct ggml_compute_params;
|
|
1227
|
+
+struct ggml_tensor;
|
|
1228
|
+
+void ggml_compute_forward_attn_score_qjl(
|
|
1229
|
+
+ const struct ggml_compute_params * params,
|
|
1230
|
+
+ struct ggml_tensor * dst);
|
|
1231
|
+
|
|
1232
|
+
void quantize_row_iq4_nl (const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int64_t k);
|
|
1233
|
+
void quantize_row_iq4_xs (const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int64_t k);
|
|
1234
|
+
diff --git a/ggml/src/ggml-quants.h b/ggml/src/ggml-quants.h
|
|
1235
|
+
index 97ced4b5..f204e0bd 100644
|
|
1236
|
+
--- a/ggml/src/ggml-quants.h
|
|
1237
|
+
+++ b/ggml/src/ggml-quants.h
|
|
1238
|
+
@@ -36,6 +36,7 @@ GGML_API void quantize_row_tq1_0_ref(const float * GGML_RESTRICT x, block_tq1_0
|
|
1239
|
+
GGML_API void quantize_row_tq2_0_ref(const float * GGML_RESTRICT x, block_tq2_0 * GGML_RESTRICT y, int64_t k);
|
|
1240
|
+
GGML_API void quantize_row_tbq3_0_ref(const float * GGML_RESTRICT x, block_tbq3_0 * GGML_RESTRICT y, int64_t k);
|
|
1241
|
+
GGML_API void quantize_row_tbq4_0_ref(const float * GGML_RESTRICT x, block_tbq4_0 * GGML_RESTRICT y, int64_t k);
|
|
1242
|
+
+GGML_API void quantize_row_qjl1_256_ref(const float * GGML_RESTRICT x, block_qjl1_256 * GGML_RESTRICT y, int64_t k);
|
|
1243
|
+
|
|
1244
|
+
GGML_API void quantize_row_iq3_xxs_ref(const float * GGML_RESTRICT x, block_iq3_xxs * GGML_RESTRICT y, int64_t k);
|
|
1245
|
+
GGML_API void quantize_row_iq4_nl_ref (const float * GGML_RESTRICT x, block_iq4_nl * GGML_RESTRICT y, int64_t k);
|
|
1246
|
+
@@ -66,6 +67,7 @@ GGML_API void dequantize_row_tq1_0(const block_tq1_0 * GGML_RESTRICT x, float *
|
|
1247
|
+
GGML_API void dequantize_row_tq2_0(const block_tq2_0 * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k);
|
|
1248
|
+
GGML_API void dequantize_row_tbq3_0(const block_tbq3_0 * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k);
|
|
1249
|
+
GGML_API void dequantize_row_tbq4_0(const block_tbq4_0 * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k);
|
|
1250
|
+
+GGML_API void dequantize_row_qjl1_256(const block_qjl1_256 * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k);
|
|
1251
|
+
|
|
1252
|
+
GGML_API void dequantize_row_iq2_xxs(const block_iq2_xxs * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k);
|
|
1253
|
+
GGML_API void dequantize_row_iq2_xs (const block_iq2_xs * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k);
|
|
1254
|
+
@@ -92,6 +94,7 @@ GGML_API size_t quantize_tq1_0(const float * GGML_RESTRICT src, void * GGML_REST
|
|
1255
|
+
GGML_API size_t quantize_tq2_0(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrows, int64_t n_per_row, const float * imatrix);
|
|
1256
|
+
GGML_API size_t quantize_tbq3_0(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrows, int64_t n_per_row, const float * imatrix);
|
|
1257
|
+
GGML_API size_t quantize_tbq4_0(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrows, int64_t n_per_row, const float * imatrix);
|
|
1258
|
+
+GGML_API size_t quantize_qjl1_256(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrows, int64_t n_per_row, const float * imatrix);
|
|
1259
|
+
|
|
1260
|
+
GGML_API size_t quantize_q2_K(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrows, int64_t n_per_row, const float * imatrix);
|
|
1261
|
+
GGML_API size_t quantize_q3_K(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrows, int64_t n_per_row, const float * imatrix);
|
|
1262
|
+
diff --git a/ggml/src/ggml.c b/ggml/src/ggml.c
|
|
1263
|
+
index c67b80b9..a5851f44 100644
|
|
1264
|
+
--- a/ggml/src/ggml.c
|
|
1265
|
+
+++ b/ggml/src/ggml.c
|
|
1266
|
+
@@ -910,6 +910,21 @@ static const struct ggml_type_traits type_traits[GGML_TYPE_COUNT] = {
|
|
1267
|
+
.to_float = (ggml_to_float_t) dequantize_row_tbq4_0,
|
|
1268
|
+
.from_float_ref = (ggml_from_float_t) quantize_row_tbq4_0_ref,
|
|
1269
|
+
},
|
|
1270
|
+
+ [GGML_TYPE_QJL1_256] = {
|
|
1271
|
+
+ .type_name = "qjl1_256",
|
|
1272
|
+
+ // Block stores the sketch dim (QK_QJL = 256) worth of signs from
|
|
1273
|
+
+ // one cached key vector. Type-traits row-size math:
|
|
1274
|
+
+ // row_size = nrow * n_per_row * type_size / blck_size
|
|
1275
|
+
+ // With blck_size = QK_QJL = 256, type_size = sizeof(block_qjl1_256) = 34,
|
|
1276
|
+
+ // and n_per_row chosen by the caller as a multiple of QK_QJL,
|
|
1277
|
+
+ // this produces 34 B per cached key vector — exactly the on-cache
|
|
1278
|
+
+ // footprint the QJL paper specifies.
|
|
1279
|
+
+ .blck_size = QK_QJL,
|
|
1280
|
+
+ .type_size = sizeof(block_qjl1_256),
|
|
1281
|
+
+ .is_quantized = true,
|
|
1282
|
+
+ .to_float = (ggml_to_float_t) dequantize_row_qjl1_256,
|
|
1283
|
+
+ .from_float_ref = (ggml_from_float_t) quantize_row_qjl1_256_ref,
|
|
1284
|
+
+ },
|
|
1285
|
+
[36] = { // GGML_TYPE_IQ4_NL_4_4
|
|
1286
|
+
.type_name = "TYPE_IQ4_NL_4_4 REMOVED, use IQ4_NL with runtime repacking",
|
|
1287
|
+
.blck_size = 0,
|
|
1288
|
+
@@ -928,6 +943,14 @@ static const struct ggml_type_traits type_traits[GGML_TYPE_COUNT] = {
|
|
1289
|
+
.type_size = 0,
|
|
1290
|
+
.is_quantized = false,
|
|
1291
|
+
},
|
|
1292
|
+
+ [45] = { // RESERVED — was GGML_TYPE_COUNT pre-QJL; left as a hole so a
|
|
1293
|
+
+ // GGUF that recorded this id under the old build is unambiguously
|
|
1294
|
+
+ // not a QJL block at runtime.
|
|
1295
|
+
+ .type_name = "TYPE_45 RESERVED (pre-QJL GGML_TYPE_COUNT)",
|
|
1296
|
+
+ .blck_size = 0,
|
|
1297
|
+
+ .type_size = 0,
|
|
1298
|
+
+ .is_quantized = false,
|
|
1299
|
+
+ },
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
const struct ggml_type_traits * ggml_get_type_traits(enum ggml_type type) {
|
|
1303
|
+
@@ -1053,6 +1076,7 @@ static const char * GGML_OP_NAME[GGML_OP_COUNT] = {
|
|
1304
|
+
|
|
1305
|
+
"FLASH_ATTN_EXT",
|
|
1306
|
+
"FLASH_ATTN_BACK",
|
|
1307
|
+
+ "ATTN_SCORE_QJL",
|
|
1308
|
+
"SSM_CONV",
|
|
1309
|
+
"SSM_SCAN",
|
|
1310
|
+
"WIN_PART",
|
|
1311
|
+
@@ -1080,7 +1104,7 @@ static const char * GGML_OP_NAME[GGML_OP_COUNT] = {
|
|
1312
|
+
"GLU",
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
-static_assert(GGML_OP_COUNT == 95, "GGML_OP_COUNT != 95");
|
|
1316
|
+
+static_assert(GGML_OP_COUNT == 96, "GGML_OP_COUNT != 96");
|
|
1317
|
+
|
|
1318
|
+
static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = {
|
|
1319
|
+
"none",
|
|
1320
|
+
@@ -1162,6 +1186,7 @@ static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = {
|
|
1321
|
+
|
|
1322
|
+
"flash_attn_ext(x)",
|
|
1323
|
+
"flash_attn_back(x)",
|
|
1324
|
+
+ "attn_score_qjl(q, packed_k)",
|
|
1325
|
+
"ssm_conv(x)",
|
|
1326
|
+
"ssm_scan(x)",
|
|
1327
|
+
"win_part(x)",
|
|
1328
|
+
@@ -1189,7 +1214,7 @@ static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = {
|
|
1329
|
+
"glu(x)",
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
-static_assert(GGML_OP_COUNT == 95, "GGML_OP_COUNT != 95");
|
|
1333
|
+
+static_assert(GGML_OP_COUNT == 96, "GGML_OP_COUNT != 96");
|
|
1334
|
+
|
|
1335
|
+
static_assert(GGML_OP_POOL_COUNT == 2, "GGML_OP_POOL_COUNT != 2");
|
|
1336
|
+
|
|
1337
|
+
@@ -5388,6 +5413,44 @@ void ggml_flash_attn_ext_add_sinks(
|
|
1338
|
+
a->src[4] = sinks;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
+// ggml_attn_score_qjl
|
|
1342
|
+
+//
|
|
1343
|
+
+// Constructor for the QJL packed-K attention-score op. See header doc
|
|
1344
|
+
+// for shape contract; assertions here are the load-bearing ones.
|
|
1345
|
+
+struct ggml_tensor * ggml_attn_score_qjl(
|
|
1346
|
+
+ struct ggml_context * ctx,
|
|
1347
|
+
+ struct ggml_tensor * q,
|
|
1348
|
+
+ struct ggml_tensor * packed_k,
|
|
1349
|
+
+ int n_kv_heads) {
|
|
1350
|
+
+ GGML_ASSERT(q != NULL);
|
|
1351
|
+
+ GGML_ASSERT(packed_k != NULL);
|
|
1352
|
+
+ GGML_ASSERT(q->type == GGML_TYPE_F32);
|
|
1353
|
+
+ GGML_ASSERT(packed_k->type == GGML_TYPE_QJL1_256);
|
|
1354
|
+
+ GGML_ASSERT(q->ne[0] == QK_QJL);
|
|
1355
|
+
+ GGML_ASSERT(packed_k->ne[0] == QK_QJL);
|
|
1356
|
+
+
|
|
1357
|
+
+ const int64_t n_heads = q->ne[1];
|
|
1358
|
+
+ const int64_t n_kv_tokens = packed_k->ne[1];
|
|
1359
|
+
+
|
|
1360
|
+
+ GGML_ASSERT(n_kv_heads > 0);
|
|
1361
|
+
+ GGML_ASSERT((n_heads % n_kv_heads) == 0);
|
|
1362
|
+
+ GGML_ASSERT(packed_k->ne[2] == (int64_t) n_kv_heads);
|
|
1363
|
+
+ GGML_ASSERT(packed_k->ne[3] == q->ne[3]);
|
|
1364
|
+
+
|
|
1365
|
+
+ // Output: [n_kv_tokens, n_heads, n_batch, ne3].
|
|
1366
|
+
+ const int64_t ne[4] = { n_kv_tokens, n_heads, q->ne[2], q->ne[3] };
|
|
1367
|
+
+ struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, 4, ne);
|
|
1368
|
+
+
|
|
1369
|
+
+ int32_t params[1] = { n_kv_heads };
|
|
1370
|
+
+ ggml_set_op_params(result, params, sizeof(params));
|
|
1371
|
+
+
|
|
1372
|
+
+ result->op = GGML_OP_ATTN_SCORE_QJL;
|
|
1373
|
+
+ result->src[0] = q;
|
|
1374
|
+
+ result->src[1] = packed_k;
|
|
1375
|
+
+
|
|
1376
|
+
+ return result;
|
|
1377
|
+
+}
|
|
1378
|
+
+
|
|
1379
|
+
// ggml_flash_attn_back
|
|
1380
|
+
|
|
1381
|
+
struct ggml_tensor * ggml_flash_attn_back(
|
|
1382
|
+
@@ -7635,6 +7698,7 @@ size_t ggml_quantize_chunk(
|
|
1383
|
+
case GGML_TYPE_TQ2_0: result = quantize_tq2_0(src + start, (char *) dst + start_row * row_size, nrows, n_per_row, imatrix); break;
|
|
1384
|
+
case GGML_TYPE_TBQ3_0: result = quantize_tbq3_0(src + start, (char *) dst + start_row * row_size, nrows, n_per_row, imatrix); break;
|
|
1385
|
+
case GGML_TYPE_TBQ4_0: result = quantize_tbq4_0(src + start, (char *) dst + start_row * row_size, nrows, n_per_row, imatrix); break;
|
|
1386
|
+
+ case GGML_TYPE_QJL1_256: result = quantize_qjl1_256(src + start, (char *) dst + start_row * row_size, nrows, n_per_row, imatrix); break;
|
|
1387
|
+
case GGML_TYPE_IQ2_XXS: result = quantize_iq2_xxs(src + start, (char *) dst + start_row * row_size, nrows, n_per_row, imatrix); break;
|
|
1388
|
+
case GGML_TYPE_IQ2_XS: result = quantize_iq2_xs (src + start, (char *) dst + start_row * row_size, nrows, n_per_row, imatrix); break;
|
|
1389
|
+
case GGML_TYPE_IQ3_XXS: result = quantize_iq3_xxs(src + start, (char *) dst + start_row * row_size, nrows, n_per_row, imatrix); break;
|
|
1390
|
+
--
|
|
1391
|
+
2.43.0
|
|
1392
|
+
|