@elizaos/shared 2.0.0-alpha.537 → 2.0.0-beta.1
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/dist/api/chat-contracts.d.ts +2 -0
- package/dist/api/chat-contracts.d.ts.map +1 -0
- package/dist/api/chat-contracts.js +2 -0
- package/dist/api/chat-contracts.js.map +1 -0
- package/dist/api/http-helpers.d.ts +50 -0
- package/dist/api/http-helpers.d.ts.map +1 -0
- package/dist/api/http-helpers.js +168 -0
- package/dist/api/http-helpers.js.map +1 -0
- package/dist/api/route-helpers.d.ts +16 -0
- package/dist/api/route-helpers.d.ts.map +1 -0
- package/dist/api/route-helpers.js +2 -0
- package/dist/api/route-helpers.js.map +1 -0
- package/dist/cli/parse-duration.d.ts +5 -0
- package/dist/cli/parse-duration.d.ts.map +1 -0
- package/dist/cli/parse-duration.js +28 -0
- package/dist/cli/parse-duration.js.map +1 -0
- package/dist/config/allowed-hosts.d.ts +8 -0
- package/dist/config/allowed-hosts.d.ts.map +1 -0
- package/dist/config/allowed-hosts.js +44 -0
- package/dist/config/allowed-hosts.js.map +1 -0
- package/dist/config/api-key-prefix-hints.d.ts +25 -0
- package/dist/config/api-key-prefix-hints.d.ts.map +1 -0
- package/dist/config/api-key-prefix-hints.js +27 -0
- package/dist/config/api-key-prefix-hints.js.map +1 -0
- package/dist/config/app-config.d.ts +273 -0
- package/dist/config/app-config.d.ts.map +1 -0
- package/dist/config/app-config.js +32 -0
- package/dist/config/app-config.js.map +1 -0
- package/dist/config/app-manifest.d.ts +75 -0
- package/dist/config/app-manifest.d.ts.map +1 -0
- package/dist/config/app-manifest.js +109 -0
- package/dist/config/app-manifest.js.map +1 -0
- package/dist/config/boot-config-react.d.ts +5 -0
- package/dist/config/boot-config-react.d.ts.map +1 -0
- package/dist/config/boot-config-react.js +8 -0
- package/dist/config/boot-config-react.js.map +1 -0
- package/dist/config/boot-config-store.d.ts +74 -0
- package/dist/config/boot-config-store.d.ts.map +1 -0
- package/dist/config/boot-config-store.js +121 -0
- package/dist/config/boot-config-store.js.map +1 -0
- package/dist/config/boot-config.d.ts +6 -0
- package/dist/config/boot-config.d.ts.map +1 -0
- package/dist/config/boot-config.js +6 -0
- package/dist/config/boot-config.js.map +1 -0
- package/dist/config/branding-react.d.ts +4 -0
- package/dist/config/branding-react.d.ts.map +1 -0
- package/dist/config/branding-react.js +12 -0
- package/dist/config/branding-react.js.map +1 -0
- package/dist/config/branding.d.ts +53 -0
- package/dist/config/branding.d.ts.map +1 -0
- package/dist/config/branding.js +23 -0
- package/dist/config/branding.js.map +1 -0
- package/dist/config/cloud-only.d.ts +6 -0
- package/dist/config/cloud-only.d.ts.map +1 -0
- package/dist/config/cloud-only.js +16 -0
- package/dist/config/cloud-only.js.map +1 -0
- package/dist/config/config-catalog.d.ts +371 -0
- package/dist/config/config-catalog.d.ts.map +1 -0
- package/dist/config/config-catalog.js +710 -0
- package/dist/config/config-catalog.js.map +1 -0
- package/dist/config/config-paths.d.ts +11 -0
- package/dist/config/config-paths.d.ts.map +1 -0
- package/dist/config/config-paths.js +74 -0
- package/dist/config/config-paths.js.map +1 -0
- package/dist/config/config.d.ts +11 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +23 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/distribution-profile.d.ts +16 -0
- package/dist/config/distribution-profile.d.ts.map +1 -0
- package/dist/config/distribution-profile.js +29 -0
- package/dist/config/distribution-profile.js.map +1 -0
- package/dist/config/env-vars.d.ts +2 -0
- package/dist/config/env-vars.d.ts.map +1 -0
- package/dist/config/env-vars.js +2 -0
- package/dist/config/env-vars.js.map +1 -0
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +17 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/plugin-auto-enable-engine.d.ts +4 -0
- package/dist/config/plugin-auto-enable-engine.d.ts.map +1 -0
- package/dist/config/plugin-auto-enable-engine.js +45 -0
- package/dist/config/plugin-auto-enable-engine.js.map +1 -0
- package/dist/config/plugin-auto-enable.d.ts +2 -0
- package/dist/config/plugin-auto-enable.d.ts.map +1 -0
- package/dist/config/plugin-auto-enable.js +8 -0
- package/dist/config/plugin-auto-enable.js.map +1 -0
- package/dist/config/plugin-manifest.d.ts +89 -0
- package/dist/config/plugin-manifest.d.ts.map +1 -0
- package/dist/config/plugin-manifest.js +272 -0
- package/dist/config/plugin-manifest.js.map +1 -0
- package/dist/config/plugin-ui-spec.d.ts +42 -0
- package/dist/config/plugin-ui-spec.d.ts.map +1 -0
- package/dist/config/plugin-ui-spec.js +257 -0
- package/dist/config/plugin-ui-spec.js.map +1 -0
- package/dist/config/runtime-mode.d.ts +54 -0
- package/dist/config/runtime-mode.d.ts.map +1 -0
- package/dist/config/runtime-mode.js +103 -0
- package/dist/config/runtime-mode.js.map +1 -0
- package/dist/config/runtime-overrides.d.ts +16 -0
- package/dist/config/runtime-overrides.d.ts.map +1 -0
- package/dist/config/runtime-overrides.js +49 -0
- package/dist/config/runtime-overrides.js.map +1 -0
- package/dist/config/schema.d.ts +7 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +30 -0
- package/dist/config/schema.js.map +1 -0
- package/{config → dist/config}/types.eliza.d.ts +16 -38
- package/dist/config/types.eliza.d.ts.map +1 -0
- package/{config → dist/config}/types.messages.d.ts +1 -1
- package/{config → dist/config}/types.tools.d.ts +1 -1
- package/dist/config/ui-spec.d.ts +164 -0
- package/dist/config/ui-spec.d.ts.map +1 -0
- package/dist/config/ui-spec.js +14 -0
- package/dist/config/ui-spec.js.map +1 -0
- package/dist/config/wechat-config.d.ts +2 -0
- package/dist/config/wechat-config.d.ts.map +1 -0
- package/dist/config/wechat-config.js +2 -0
- package/dist/config/wechat-config.js.map +1 -0
- package/dist/config/zod-schema.agent-runtime.d.ts +1087 -0
- package/dist/config/zod-schema.agent-runtime.d.ts.map +1 -0
- package/dist/config/zod-schema.agent-runtime.js +764 -0
- package/dist/config/zod-schema.agent-runtime.js.map +1 -0
- package/dist/config/zod-schema.core.d.ts +1048 -0
- package/dist/config/zod-schema.core.d.ts.map +1 -0
- package/dist/config/zod-schema.core.js +707 -0
- package/dist/config/zod-schema.core.js.map +1 -0
- package/{connector-cred-types.d.ts → dist/connector-cred-types.d.ts} +3 -3
- package/{connector-cred-types.js → dist/connector-cred-types.js} +4 -4
- package/dist/connectors.d.ts +2 -0
- package/dist/connectors.d.ts.map +1 -0
- package/dist/connectors.js +2 -0
- package/dist/connectors.js.map +1 -0
- package/{contracts → dist/contracts}/apps.d.ts +21 -1
- package/dist/contracts/apps.d.ts.map +1 -0
- package/{contracts → dist/contracts}/apps.js +9 -10
- package/dist/contracts/apps.js.map +1 -0
- package/{contracts → dist/contracts}/awareness.d.ts +1 -1
- package/{contracts → dist/contracts}/config.d.ts +52 -4
- package/dist/contracts/config.d.ts.map +1 -0
- package/{contracts → dist/contracts}/content-pack.d.ts +1 -1
- package/{contracts → dist/contracts}/content-pack.d.ts.map +1 -1
- package/dist/contracts/feature-result.d.ts +24 -0
- package/dist/contracts/feature-result.d.ts.map +1 -0
- package/dist/contracts/feature-result.js +7 -0
- package/dist/contracts/feature-result.js.map +1 -0
- package/dist/contracts/health.d.ts +30 -0
- package/dist/contracts/health.d.ts.map +1 -0
- package/dist/contracts/health.js +29 -0
- package/dist/contracts/health.js.map +1 -0
- package/{contracts → dist/contracts}/index.d.ts +2 -1
- package/{contracts → dist/contracts}/index.d.ts.map +1 -1
- package/{contracts → dist/contracts}/index.js +2 -1
- package/dist/contracts/index.js.map +1 -0
- package/{contracts → dist/contracts}/lifeops.d.ts +410 -3
- package/dist/contracts/lifeops.d.ts.map +1 -0
- package/{contracts → dist/contracts}/lifeops.js +35 -5
- package/dist/contracts/lifeops.js.map +1 -0
- package/{contracts → dist/contracts}/onboarding.d.ts +107 -8
- package/dist/contracts/onboarding.d.ts.map +1 -0
- package/{contracts → dist/contracts}/onboarding.js +132 -13
- package/dist/contracts/onboarding.js.map +1 -0
- package/dist/contracts/permissions.d.ts +121 -0
- package/dist/contracts/permissions.d.ts.map +1 -0
- package/dist/contracts/permissions.js +31 -0
- package/dist/contracts/permissions.js.map +1 -0
- package/{contracts → dist/contracts}/service-routing.d.ts +4 -11
- package/dist/contracts/service-routing.d.ts.map +1 -0
- package/{contracts → dist/contracts}/service-routing.js +16 -14
- package/dist/contracts/service-routing.js.map +1 -0
- package/{contracts → dist/contracts}/wallet.d.ts +7 -0
- package/dist/contracts/wallet.d.ts.map +1 -0
- package/dist/contracts/wallet.js +194 -0
- package/dist/contracts/wallet.js.map +1 -0
- package/{env-utils.impl.d.ts → dist/env-utils.d.ts} +1 -1
- package/dist/env-utils.d.ts.map +1 -0
- package/{env-utils.impl.js → dist/env-utils.js} +4 -1
- package/dist/env-utils.js.map +1 -0
- package/dist/events/index.d.ts +62 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +52 -0
- package/dist/events/index.js.map +1 -0
- package/dist/i18n/generated/validation-keyword-data.d.ts +3080 -0
- package/dist/i18n/generated/validation-keyword-data.d.ts.map +1 -0
- package/dist/i18n/generated/validation-keyword-data.js +3084 -0
- package/dist/i18n/generated/validation-keyword-data.js.map +1 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/local-inference/index.d.ts +16 -0
- package/dist/local-inference/index.d.ts.map +1 -0
- package/dist/local-inference/index.js +16 -0
- package/dist/local-inference/index.js.map +1 -0
- package/dist/local-inference/paths.d.ts +24 -0
- package/dist/local-inference/paths.d.ts.map +1 -0
- package/dist/local-inference/paths.js +40 -0
- package/dist/local-inference/paths.js.map +1 -0
- package/dist/local-inference/routing-preferences.d.ts +31 -0
- package/dist/local-inference/routing-preferences.d.ts.map +1 -0
- package/dist/local-inference/routing-preferences.js +73 -0
- package/dist/local-inference/routing-preferences.js.map +1 -0
- package/dist/local-inference/types.d.ts +62 -0
- package/dist/local-inference/types.d.ts.map +1 -0
- package/dist/local-inference/types.js +25 -0
- package/dist/local-inference/types.js.map +1 -0
- package/dist/local-inference/verify.d.ts +39 -0
- package/dist/local-inference/verify.d.ts.map +1 -0
- package/dist/local-inference/verify.js +105 -0
- package/dist/local-inference/verify.js.map +1 -0
- package/dist/package.json +50 -0
- package/dist/platform/is-native-server.d.ts +9 -0
- package/dist/platform/is-native-server.d.ts.map +1 -0
- package/dist/platform/is-native-server.js +12 -0
- package/dist/platform/is-native-server.js.map +1 -0
- package/{runtime-env.js → dist/runtime-env.js} +2 -2
- package/{runtime-env.js.map → dist/runtime-env.js.map} +1 -1
- package/dist/self-edit.d.ts +64 -0
- package/dist/self-edit.d.ts.map +1 -0
- package/dist/self-edit.js +133 -0
- package/dist/self-edit.js.map +1 -0
- package/{settings-debug.d.ts.map → dist/settings-debug.d.ts.map} +1 -1
- package/{settings-debug.js → dist/settings-debug.js} +45 -38
- package/dist/settings-debug.js.map +1 -0
- package/{spoken-text.js → dist/spoken-text.js} +1 -1
- package/{spoken-text.js.map → dist/spoken-text.js.map} +1 -1
- package/dist/terminal/links.d.ts +9 -0
- package/dist/terminal/links.d.ts.map +1 -0
- package/dist/terminal/links.js +21 -0
- package/dist/terminal/links.js.map +1 -0
- package/dist/terminal/palette.d.ts +11 -0
- package/dist/terminal/palette.d.ts.map +1 -0
- package/dist/terminal/palette.js +13 -0
- package/dist/terminal/palette.js.map +1 -0
- package/dist/terminal/theme.d.ts +17 -0
- package/dist/terminal/theme.d.ts.map +1 -0
- package/dist/terminal/theme.js +25 -0
- package/dist/terminal/theme.js.map +1 -0
- package/dist/test-support/process-helpers.d.ts +13 -0
- package/dist/test-support/process-helpers.d.ts.map +1 -0
- package/dist/test-support/process-helpers.js +24 -0
- package/dist/test-support/process-helpers.js.map +1 -0
- package/dist/test-support/test-helpers.d.ts +112 -0
- package/dist/test-support/test-helpers.d.ts.map +1 -0
- package/dist/test-support/test-helpers.js +416 -0
- package/dist/test-support/test-helpers.js.map +1 -0
- package/{themes → dist/themes}/index.d.ts +3 -3
- package/dist/themes/index.d.ts.map +1 -0
- package/{themes → dist/themes}/index.js +2 -2
- package/{themes → dist/themes}/index.js.map +1 -1
- package/{themes → dist/themes}/presets.d.ts +1 -1
- package/{themes → dist/themes}/presets.d.ts.map +1 -1
- package/{type-guards.d.ts → dist/type-guards.d.ts} +1 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/{type-guards.js → dist/type-guards.js} +6 -0
- package/dist/type-guards.js.map +1 -0
- package/dist/types/index.d.ts +655 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/asset-url.d.ts +24 -0
- package/dist/utils/asset-url.d.ts.map +1 -0
- package/dist/utils/asset-url.js +151 -0
- package/dist/utils/asset-url.js.map +1 -0
- package/dist/utils/assistant-text.d.ts +2 -0
- package/dist/utils/assistant-text.d.ts.map +1 -0
- package/dist/utils/assistant-text.js +168 -0
- package/dist/utils/assistant-text.js.map +1 -0
- package/dist/utils/browser-tab-kit-types.d.ts +81 -0
- package/dist/utils/browser-tab-kit-types.d.ts.map +1 -0
- package/dist/utils/browser-tab-kit-types.js +23 -0
- package/dist/utils/browser-tab-kit-types.js.map +1 -0
- package/dist/utils/browser-tabs-renderer-registry.d.ts +56 -0
- package/dist/utils/browser-tabs-renderer-registry.d.ts.map +1 -0
- package/dist/utils/browser-tabs-renderer-registry.js +962 -0
- package/{i18n/generated/validation-keyword-data.d.ts.map → dist/utils/browser-tabs-renderer-registry.js.map} +1 -1
- package/dist/utils/character-message-examples.d.ts +7 -0
- package/dist/utils/character-message-examples.d.ts.map +1 -0
- package/dist/utils/character-message-examples.js +123 -0
- package/dist/utils/character-message-examples.js.map +1 -0
- package/dist/utils/cloud-status.d.ts +3 -0
- package/dist/utils/cloud-status.d.ts.map +1 -0
- package/dist/utils/cloud-status.js +11 -0
- package/dist/utils/cloud-status.js.map +1 -0
- package/dist/utils/documents-upload-image.d.ts +27 -0
- package/dist/utils/documents-upload-image.d.ts.map +1 -0
- package/dist/utils/documents-upload-image.js +147 -0
- package/dist/utils/documents-upload-image.js.map +1 -0
- package/dist/utils/eliza-cloud-model-route.d.ts +3 -0
- package/dist/utils/eliza-cloud-model-route.d.ts.map +1 -0
- package/dist/utils/eliza-cloud-model-route.js +10 -0
- package/dist/utils/eliza-cloud-model-route.js.map +1 -0
- package/dist/utils/eliza-globals.d.ts +13 -0
- package/dist/utils/eliza-globals.d.ts.map +1 -0
- package/dist/utils/eliza-globals.js +49 -0
- package/dist/utils/eliza-globals.js.map +1 -0
- package/dist/utils/eliza-root.d.ts +9 -0
- package/dist/utils/eliza-root.d.ts.map +1 -0
- package/dist/utils/eliza-root.js +102 -0
- package/dist/utils/eliza-root.js.map +1 -0
- package/dist/utils/env.d.ts +34 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +131 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/errors.d.ts +13 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +26 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/exec-safety.d.ts +2 -0
- package/dist/utils/exec-safety.d.ts.map +1 -0
- package/dist/utils/exec-safety.js +22 -0
- package/dist/utils/exec-safety.js.map +1 -0
- package/dist/utils/format.d.ts +66 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +122 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/labels.d.ts +6 -0
- package/dist/utils/labels.d.ts.map +1 -0
- package/dist/utils/labels.js +42 -0
- package/dist/utils/labels.js.map +1 -0
- package/dist/utils/log-prefix.d.ts +2 -0
- package/dist/utils/log-prefix.d.ts.map +1 -0
- package/dist/utils/log-prefix.js +54 -0
- package/dist/utils/log-prefix.js.map +1 -0
- package/dist/utils/name-tokens.d.ts +24 -0
- package/dist/utils/name-tokens.d.ts.map +1 -0
- package/dist/utils/name-tokens.js +37 -0
- package/dist/utils/name-tokens.js.map +1 -0
- package/dist/utils/namespace-defaults.d.ts +6 -0
- package/dist/utils/namespace-defaults.d.ts.map +1 -0
- package/dist/utils/namespace-defaults.js +16 -0
- package/dist/utils/namespace-defaults.js.map +1 -0
- package/dist/utils/number-parsing.d.ts +26 -0
- package/dist/utils/number-parsing.d.ts.map +1 -0
- package/dist/utils/number-parsing.js +52 -0
- package/dist/utils/number-parsing.js.map +1 -0
- package/dist/utils/owner-name.d.ts +3 -0
- package/dist/utils/owner-name.d.ts.map +1 -0
- package/dist/utils/owner-name.js +8 -0
- package/dist/utils/owner-name.js.map +1 -0
- package/dist/utils/permission-deep-links.d.ts +34 -0
- package/dist/utils/permission-deep-links.d.ts.map +1 -0
- package/dist/utils/permission-deep-links.js +84 -0
- package/dist/utils/permission-deep-links.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +32 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +53 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/serialise.d.ts +12 -0
- package/dist/utils/serialise.d.ts.map +1 -0
- package/dist/utils/serialise.js +22 -0
- package/dist/utils/serialise.js.map +1 -0
- package/dist/utils/sql-compat.d.ts +10 -0
- package/dist/utils/sql-compat.d.ts.map +1 -0
- package/dist/utils/sql-compat.js +112 -0
- package/dist/utils/sql-compat.js.map +1 -0
- package/dist/utils/streaming-text.d.ts +9 -0
- package/dist/utils/streaming-text.d.ts.map +1 -0
- package/dist/utils/streaming-text.js +113 -0
- package/dist/utils/streaming-text.js.map +1 -0
- package/dist/utils/subscription-auth.d.ts +9 -0
- package/dist/utils/subscription-auth.d.ts.map +1 -0
- package/dist/utils/subscription-auth.js +49 -0
- package/dist/utils/subscription-auth.js.map +1 -0
- package/dist/utils/trajectory-format.d.ts +6 -0
- package/dist/utils/trajectory-format.d.ts.map +1 -0
- package/dist/utils/trajectory-format.js +44 -0
- package/dist/utils/trajectory-format.js.map +1 -0
- package/dist/utils/tts-debug.d.ts +9 -0
- package/dist/utils/tts-debug.d.ts.map +1 -0
- package/dist/utils/tts-debug.js +70 -0
- package/dist/utils/tts-debug.js.map +1 -0
- package/dist/voice.d.ts +40 -0
- package/dist/voice.d.ts.map +1 -0
- package/dist/voice.js +296 -0
- package/dist/voice.js.map +1 -0
- package/package.json +33 -174
- package/config/types.eliza.d.ts.map +0 -1
- package/connectors.d.ts +0 -13
- package/connectors.d.ts.map +0 -1
- package/connectors.js +0 -97
- package/connectors.js.map +0 -1
- package/contracts/apps.d.ts.map +0 -1
- package/contracts/apps.js.map +0 -1
- package/contracts/config.d.ts.map +0 -1
- package/contracts/index.js.map +0 -1
- package/contracts/lifeops-extensions.d.ts +0 -340
- package/contracts/lifeops-extensions.d.ts.map +0 -1
- package/contracts/lifeops-extensions.js +0 -37
- package/contracts/lifeops-extensions.js.map +0 -1
- package/contracts/lifeops.d.ts.map +0 -1
- package/contracts/lifeops.js.map +0 -1
- package/contracts/onboarding.d.ts.map +0 -1
- package/contracts/onboarding.js.map +0 -1
- package/contracts/permissions.d.ts +0 -38
- package/contracts/permissions.d.ts.map +0 -1
- package/contracts/permissions.js +0 -5
- package/contracts/permissions.js.map +0 -1
- package/contracts/scratchpad.d.ts +0 -136
- package/contracts/scratchpad.d.ts.map +0 -1
- package/contracts/scratchpad.js +0 -91
- package/contracts/scratchpad.js.map +0 -1
- package/contracts/service-routing.d.ts.map +0 -1
- package/contracts/service-routing.js.map +0 -1
- package/contracts/wallet.d.ts.map +0 -1
- package/contracts/wallet.js +0 -61
- package/contracts/wallet.js.map +0 -1
- package/eliza-core-roles.d.ts +0 -79
- package/eliza-core-roles.d.ts.map +0 -1
- package/eliza-core-roles.js +0 -600
- package/eliza-core-roles.js.map +0 -1
- package/env-utils.d.ts +0 -5
- package/env-utils.d.ts.map +0 -1
- package/env-utils.impl.d.ts.map +0 -1
- package/env-utils.impl.js.map +0 -1
- package/env-utils.js +0 -5
- package/env-utils.js.map +0 -1
- package/i18n/generated/validation-keyword-data.d.ts +0 -1091
- package/i18n/generated/validation-keyword-data.js +0 -1095
- package/i18n/generated/validation-keyword-data.js.map +0 -1
- package/index.d.ts +0 -27
- package/index.d.ts.map +0 -1
- package/index.js +0 -39
- package/index.js.map +0 -1
- package/settings-debug.js.map +0 -1
- package/themes/index.d.ts.map +0 -1
- package/type-guards.d.ts.map +0 -1
- package/type-guards.js.map +0 -1
- package/types.d.ts +0 -27
- package/types.d.ts.map +0 -1
- package/types.js +0 -2
- package/types.js.map +0 -1
- /package/{app-hero-art.d.ts → dist/app-hero-art.d.ts} +0 -0
- /package/{app-hero-art.d.ts.map → dist/app-hero-art.d.ts.map} +0 -0
- /package/{app-hero-art.js → dist/app-hero-art.js} +0 -0
- /package/{app-hero-art.js.map → dist/app-hero-art.js.map} +0 -0
- /package/{awareness → dist/awareness}/index.d.ts +0 -0
- /package/{awareness → dist/awareness}/index.d.ts.map +0 -0
- /package/{awareness → dist/awareness}/index.js +0 -0
- /package/{awareness → dist/awareness}/index.js.map +0 -0
- /package/{awareness → dist/awareness}/registry.d.ts +0 -0
- /package/{awareness → dist/awareness}/registry.d.ts.map +0 -0
- /package/{awareness → dist/awareness}/registry.js +0 -0
- /package/{awareness → dist/awareness}/registry.js.map +0 -0
- /package/{config → dist/config}/types.agent-defaults.d.ts +0 -0
- /package/{config → dist/config}/types.agent-defaults.d.ts.map +0 -0
- /package/{config → dist/config}/types.agent-defaults.js +0 -0
- /package/{config → dist/config}/types.agent-defaults.js.map +0 -0
- /package/{config → dist/config}/types.agents.d.ts +0 -0
- /package/{config → dist/config}/types.agents.d.ts.map +0 -0
- /package/{config → dist/config}/types.agents.js +0 -0
- /package/{config → dist/config}/types.agents.js.map +0 -0
- /package/{config → dist/config}/types.d.ts +0 -0
- /package/{config → dist/config}/types.d.ts.map +0 -0
- /package/{config → dist/config}/types.eliza.js +0 -0
- /package/{config → dist/config}/types.eliza.js.map +0 -0
- /package/{config → dist/config}/types.gateway.d.ts +0 -0
- /package/{config → dist/config}/types.gateway.d.ts.map +0 -0
- /package/{config → dist/config}/types.gateway.js +0 -0
- /package/{config → dist/config}/types.gateway.js.map +0 -0
- /package/{config → dist/config}/types.hooks.d.ts +0 -0
- /package/{config → dist/config}/types.hooks.d.ts.map +0 -0
- /package/{config → dist/config}/types.hooks.js +0 -0
- /package/{config → dist/config}/types.hooks.js.map +0 -0
- /package/{config → dist/config}/types.js +0 -0
- /package/{config → dist/config}/types.js.map +0 -0
- /package/{config → dist/config}/types.messages.d.ts.map +0 -0
- /package/{config → dist/config}/types.messages.js +0 -0
- /package/{config → dist/config}/types.messages.js.map +0 -0
- /package/{config → dist/config}/types.tools.d.ts.map +0 -0
- /package/{config → dist/config}/types.tools.js +0 -0
- /package/{config → dist/config}/types.tools.js.map +0 -0
- /package/{connector-cred-types.d.ts.map → dist/connector-cred-types.d.ts.map} +0 -0
- /package/{connector-cred-types.js.map → dist/connector-cred-types.js.map} +0 -0
- /package/{contracts → dist/contracts}/awareness.d.ts.map +0 -0
- /package/{contracts → dist/contracts}/awareness.js +0 -0
- /package/{contracts → dist/contracts}/awareness.js.map +0 -0
- /package/{contracts → dist/contracts}/cloud-topology.d.ts +0 -0
- /package/{contracts → dist/contracts}/cloud-topology.d.ts.map +0 -0
- /package/{contracts → dist/contracts}/cloud-topology.js +0 -0
- /package/{contracts → dist/contracts}/cloud-topology.js.map +0 -0
- /package/{contracts → dist/contracts}/config.js +0 -0
- /package/{contracts → dist/contracts}/config.js.map +0 -0
- /package/{contracts → dist/contracts}/content-pack.js +0 -0
- /package/{contracts → dist/contracts}/content-pack.js.map +0 -0
- /package/{contracts → dist/contracts}/drop.d.ts +0 -0
- /package/{contracts → dist/contracts}/drop.d.ts.map +0 -0
- /package/{contracts → dist/contracts}/drop.js +0 -0
- /package/{contracts → dist/contracts}/drop.js.map +0 -0
- /package/{contracts → dist/contracts}/inbox.d.ts +0 -0
- /package/{contracts → dist/contracts}/inbox.d.ts.map +0 -0
- /package/{contracts → dist/contracts}/inbox.js +0 -0
- /package/{contracts → dist/contracts}/inbox.js.map +0 -0
- /package/{contracts → dist/contracts}/lifeops-connector-degradation.d.ts +0 -0
- /package/{contracts → dist/contracts}/lifeops-connector-degradation.d.ts.map +0 -0
- /package/{contracts → dist/contracts}/lifeops-connector-degradation.js +0 -0
- /package/{contracts → dist/contracts}/lifeops-connector-degradation.js.map +0 -0
- /package/{contracts → dist/contracts}/theme.d.ts +0 -0
- /package/{contracts → dist/contracts}/theme.d.ts.map +0 -0
- /package/{contracts → dist/contracts}/theme.js +0 -0
- /package/{contracts → dist/contracts}/theme.js.map +0 -0
- /package/{contracts → dist/contracts}/verification.d.ts +0 -0
- /package/{contracts → dist/contracts}/verification.d.ts.map +0 -0
- /package/{contracts → dist/contracts}/verification.js +0 -0
- /package/{contracts → dist/contracts}/verification.js.map +0 -0
- /package/{dev-settings-banner-style.d.ts → dist/dev-settings-banner-style.d.ts} +0 -0
- /package/{dev-settings-banner-style.d.ts.map → dist/dev-settings-banner-style.d.ts.map} +0 -0
- /package/{dev-settings-banner-style.js → dist/dev-settings-banner-style.js} +0 -0
- /package/{dev-settings-banner-style.js.map → dist/dev-settings-banner-style.js.map} +0 -0
- /package/{dev-settings-figlet-heading.d.ts → dist/dev-settings-figlet-heading.d.ts} +0 -0
- /package/{dev-settings-figlet-heading.d.ts.map → dist/dev-settings-figlet-heading.d.ts.map} +0 -0
- /package/{dev-settings-figlet-heading.js → dist/dev-settings-figlet-heading.js} +0 -0
- /package/{dev-settings-figlet-heading.js.map → dist/dev-settings-figlet-heading.js.map} +0 -0
- /package/{dev-settings-table.d.ts → dist/dev-settings-table.d.ts} +0 -0
- /package/{dev-settings-table.d.ts.map → dist/dev-settings-table.d.ts.map} +0 -0
- /package/{dev-settings-table.js → dist/dev-settings-table.js} +0 -0
- /package/{dev-settings-table.js.map → dist/dev-settings-table.js.map} +0 -0
- /package/{format-error.d.ts → dist/format-error.d.ts} +0 -0
- /package/{format-error.d.ts.map → dist/format-error.d.ts.map} +0 -0
- /package/{format-error.js → dist/format-error.js} +0 -0
- /package/{format-error.js.map → dist/format-error.js.map} +0 -0
- /package/{i18n → dist/i18n}/keyword-matching.d.ts +0 -0
- /package/{i18n → dist/i18n}/keyword-matching.d.ts.map +0 -0
- /package/{i18n → dist/i18n}/keyword-matching.js +0 -0
- /package/{i18n → dist/i18n}/keyword-matching.js.map +0 -0
- /package/{i18n → dist/i18n}/validation-keywords.d.ts +0 -0
- /package/{i18n → dist/i18n}/validation-keywords.d.ts.map +0 -0
- /package/{i18n → dist/i18n}/validation-keywords.js +0 -0
- /package/{i18n → dist/i18n}/validation-keywords.js.map +0 -0
- /package/{onboarding-presets.characters.d.ts → dist/onboarding-presets.characters.d.ts} +0 -0
- /package/{onboarding-presets.characters.d.ts.map → dist/onboarding-presets.characters.d.ts.map} +0 -0
- /package/{onboarding-presets.characters.js → dist/onboarding-presets.characters.js} +0 -0
- /package/{onboarding-presets.characters.js.map → dist/onboarding-presets.characters.js.map} +0 -0
- /package/{onboarding-presets.d.ts → dist/onboarding-presets.d.ts} +0 -0
- /package/{onboarding-presets.d.ts.map → dist/onboarding-presets.d.ts.map} +0 -0
- /package/{onboarding-presets.js → dist/onboarding-presets.js} +0 -0
- /package/{onboarding-presets.js.map → dist/onboarding-presets.js.map} +0 -0
- /package/{onboarding-presets.shared.d.ts → dist/onboarding-presets.shared.d.ts} +0 -0
- /package/{onboarding-presets.shared.d.ts.map → dist/onboarding-presets.shared.d.ts.map} +0 -0
- /package/{onboarding-presets.shared.js → dist/onboarding-presets.shared.js} +0 -0
- /package/{onboarding-presets.shared.js.map → dist/onboarding-presets.shared.js.map} +0 -0
- /package/{recent-messages-state.d.ts → dist/recent-messages-state.d.ts} +0 -0
- /package/{recent-messages-state.d.ts.map → dist/recent-messages-state.d.ts.map} +0 -0
- /package/{recent-messages-state.js → dist/recent-messages-state.js} +0 -0
- /package/{recent-messages-state.js.map → dist/recent-messages-state.js.map} +0 -0
- /package/{restart.d.ts → dist/restart.d.ts} +0 -0
- /package/{restart.d.ts.map → dist/restart.d.ts.map} +0 -0
- /package/{restart.js → dist/restart.js} +0 -0
- /package/{restart.js.map → dist/restart.js.map} +0 -0
- /package/{runtime-env.d.ts → dist/runtime-env.d.ts} +0 -0
- /package/{runtime-env.d.ts.map → dist/runtime-env.d.ts.map} +0 -0
- /package/{settings-debug.d.ts → dist/settings-debug.d.ts} +0 -0
- /package/{spoken-text.d.ts → dist/spoken-text.d.ts} +0 -0
- /package/{spoken-text.d.ts.map → dist/spoken-text.d.ts.map} +0 -0
- /package/{themes → dist/themes}/presets.js +0 -0
- /package/{themes → dist/themes}/presets.js.map +0 -0
- /package/{validation-keywords.d.ts → dist/validation-keywords.d.ts} +0 -0
- /package/{validation-keywords.d.ts.map → dist/validation-keywords.d.ts.map} +0 -0
- /package/{validation-keywords.js → dist/validation-keywords.js} +0 -0
- /package/{validation-keywords.js.map → dist/validation-keywords.js.map} +0 -0
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Window-global handshake between the BrowserWorkspaceView React component
|
|
3
|
+
* (which owns the live <electrobun-webview> tag refs) and the Electrobun
|
|
4
|
+
* preload bridge (which holds the Electroview RPC handlers that bun calls
|
|
5
|
+
* into for evaluate/snapshot on a tab).
|
|
6
|
+
*
|
|
7
|
+
* Mirror of the type declared in
|
|
8
|
+
* platforms/electrobun/src/bridge/browser-tabs-renderer-registry.ts — both
|
|
9
|
+
* read/write the same `window.__ELIZA_BROWSER_TABS_REGISTRY__` key.
|
|
10
|
+
*/
|
|
11
|
+
const REGISTRY_KEY = "__ELIZA_BROWSER_TABS_REGISTRY__";
|
|
12
|
+
/**
|
|
13
|
+
* Preload script string injected into every <electrobun-webview> tab so the
|
|
14
|
+
* host page (running in the main webview) can request a script evaluation
|
|
15
|
+
* via tag.executeJavascript and receive the result back via the
|
|
16
|
+
* `host-message` event channel.
|
|
17
|
+
*
|
|
18
|
+
* Runs inside the OOPIF (the tab's content) before any page scripts. Two
|
|
19
|
+
* surfaces are installed:
|
|
20
|
+
*
|
|
21
|
+
* 1. `window.__elizaTabExec(requestId, script)` — the eval-bridge entry
|
|
22
|
+
* that the renderer uses for arbitrary script evaluation. Results
|
|
23
|
+
* return via `__electrobunSendToHost`. `__electrobunSendToHost`
|
|
24
|
+
* JSON-stringifies the payload, so we pre-clone via
|
|
25
|
+
* `JSON.parse(JSON.stringify(...))` to surface unserializable results
|
|
26
|
+
* as a structured `{ __unserializable, type, repr }` marker rather
|
|
27
|
+
* than letting the native send silently drop them or throw.
|
|
28
|
+
*
|
|
29
|
+
* 2. `window.__elizaTabKit` — see browser-tab-kit-types.ts. Visual cursor
|
|
30
|
+
* overlay + faithful pointer-event sequences + React-compatible
|
|
31
|
+
* typing. Used by the agent's realistic-* subactions so the user can
|
|
32
|
+
* watch the cursor move and so events fire correctly on controlled
|
|
33
|
+
* inputs.
|
|
34
|
+
*/
|
|
35
|
+
export const BROWSER_TAB_PRELOAD_SCRIPT = `
|
|
36
|
+
(() => {
|
|
37
|
+
const send = (payload) => {
|
|
38
|
+
try {
|
|
39
|
+
if (typeof window.__electrobunSendToHost === "function") {
|
|
40
|
+
window.__electrobunSendToHost(payload);
|
|
41
|
+
}
|
|
42
|
+
} catch (_err) {
|
|
43
|
+
// No fallback — if the host bridge is missing, swallow.
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const describeValue = (value) => {
|
|
48
|
+
if (value === null) return "null";
|
|
49
|
+
const t = typeof value;
|
|
50
|
+
if (t !== "object") return t;
|
|
51
|
+
try {
|
|
52
|
+
const ctor = value && value.constructor && value.constructor.name;
|
|
53
|
+
return ctor || "object";
|
|
54
|
+
} catch {
|
|
55
|
+
return "object";
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const toCloneable = (value) => {
|
|
60
|
+
if (value === undefined) return undefined;
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(JSON.stringify(value));
|
|
63
|
+
} catch (_err) {
|
|
64
|
+
let repr;
|
|
65
|
+
try {
|
|
66
|
+
repr = String(value);
|
|
67
|
+
} catch {
|
|
68
|
+
repr = "[unprintable value]";
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
__unserializable: true,
|
|
72
|
+
type: describeValue(value),
|
|
73
|
+
repr,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
window.__elizaTabExec = (requestId, script) => {
|
|
79
|
+
let value;
|
|
80
|
+
try {
|
|
81
|
+
// Indirect eval gives the script the global scope, matching the
|
|
82
|
+
// behaviour of webview.executeJavascript on a top-level webview.
|
|
83
|
+
value = (0, eval)(script);
|
|
84
|
+
} catch (err) {
|
|
85
|
+
send({
|
|
86
|
+
type: "__elizaTabExecResult",
|
|
87
|
+
requestId,
|
|
88
|
+
ok: false,
|
|
89
|
+
error: err && err.message ? String(err.message) : String(err),
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
Promise.resolve(value)
|
|
95
|
+
.then((resolved) => {
|
|
96
|
+
send({
|
|
97
|
+
type: "__elizaTabExecResult",
|
|
98
|
+
requestId,
|
|
99
|
+
ok: true,
|
|
100
|
+
result: toCloneable(resolved),
|
|
101
|
+
});
|
|
102
|
+
})
|
|
103
|
+
.catch((err) => {
|
|
104
|
+
send({
|
|
105
|
+
type: "__elizaTabExecResult",
|
|
106
|
+
requestId,
|
|
107
|
+
ok: false,
|
|
108
|
+
error: err && err.message ? String(err.message) : String(err),
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// ── Visual cursor + realistic event kit ───────────────────────────────
|
|
114
|
+
// Installed lazily to avoid touching the DOM before the page is ready.
|
|
115
|
+
// Idempotent — re-running just returns the existing kit.
|
|
116
|
+
let kit = null;
|
|
117
|
+
const ensureKit = () => {
|
|
118
|
+
if (kit) return kit;
|
|
119
|
+
if (!document || !document.documentElement) return null;
|
|
120
|
+
|
|
121
|
+
let cursorRoot = null;
|
|
122
|
+
let cursorVisible = false;
|
|
123
|
+
let cursorPos = { x: 0, y: 0 };
|
|
124
|
+
let activeAnim = 0;
|
|
125
|
+
|
|
126
|
+
const easeOut = (t) => {
|
|
127
|
+
// Approximation of cubic-bezier(.22,.61,.36,1) — a brief ease-out.
|
|
128
|
+
const c = 1 - t;
|
|
129
|
+
return 1 - c * c * c;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const buildCursorRoot = () => {
|
|
133
|
+
const root = document.createElement("div");
|
|
134
|
+
root.setAttribute("aria-hidden", "true");
|
|
135
|
+
root.setAttribute("data-eliza-cursor", "1");
|
|
136
|
+
root.style.cssText = [
|
|
137
|
+
"position:fixed",
|
|
138
|
+
"left:0",
|
|
139
|
+
"top:0",
|
|
140
|
+
"width:0",
|
|
141
|
+
"height:0",
|
|
142
|
+
"pointer-events:none",
|
|
143
|
+
"z-index:2147483647",
|
|
144
|
+
"display:none",
|
|
145
|
+
"transform:translate3d(0,0,0)",
|
|
146
|
+
"will-change:transform",
|
|
147
|
+
].join(";");
|
|
148
|
+
// Inline SVG arrow + ripple ring. The arrow uses a soft drop-shadow
|
|
149
|
+
// so it stays visible against any page background.
|
|
150
|
+
root.innerHTML = [
|
|
151
|
+
"<svg width='28' height='28' viewBox='0 0 28 28' style='display:block;filter:drop-shadow(0 1px 2px rgba(0,0,0,0.45));'>",
|
|
152
|
+
" <path d='M3 2 L3 22 L9 16 L13 25 L16 23 L12 14 L20 14 Z' fill='#ffffff' stroke='#111111' stroke-width='1' stroke-linejoin='round'/>",
|
|
153
|
+
"</svg>",
|
|
154
|
+
"<div data-eliza-cursor-ripple style='position:absolute;left:-12px;top:-12px;width:24px;height:24px;border-radius:50%;border:2px solid #38bdf8;opacity:0;transform:scale(0.4);transition:transform 220ms ease-out, opacity 220ms ease-out;pointer-events:none;'></div>",
|
|
155
|
+
].join("");
|
|
156
|
+
return root;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const ensureCursorRoot = () => {
|
|
160
|
+
if (cursorRoot && cursorRoot.isConnected) return cursorRoot;
|
|
161
|
+
cursorRoot = buildCursorRoot();
|
|
162
|
+
document.documentElement.appendChild(cursorRoot);
|
|
163
|
+
return cursorRoot;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const showCursor = () => {
|
|
167
|
+
cursorVisible = true;
|
|
168
|
+
const root = ensureCursorRoot();
|
|
169
|
+
root.style.display = "block";
|
|
170
|
+
};
|
|
171
|
+
const hideCursor = () => {
|
|
172
|
+
cursorVisible = false;
|
|
173
|
+
if (cursorRoot) cursorRoot.style.display = "none";
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const placeCursor = (x, y) => {
|
|
177
|
+
cursorPos = { x, y };
|
|
178
|
+
const root = ensureCursorRoot();
|
|
179
|
+
root.style.transform = "translate3d(" + x + "px," + y + "px,0)";
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const moveTo = (target, options) =>
|
|
183
|
+
new Promise((resolve) => {
|
|
184
|
+
const root = ensureCursorRoot();
|
|
185
|
+
if (!cursorVisible) {
|
|
186
|
+
showCursor();
|
|
187
|
+
// Snap to current pos so the first move animates from where we are.
|
|
188
|
+
placeCursor(cursorPos.x || target.x, cursorPos.y || target.y);
|
|
189
|
+
}
|
|
190
|
+
const startX = cursorPos.x;
|
|
191
|
+
const startY = cursorPos.y;
|
|
192
|
+
const endX = target.x;
|
|
193
|
+
const endY = target.y;
|
|
194
|
+
const dur = Math.max(40, Math.min(2000, (options && options.durationMs) || 220));
|
|
195
|
+
const startedAt = performance.now();
|
|
196
|
+
const animId = ++activeAnim;
|
|
197
|
+
const step = (now) => {
|
|
198
|
+
if (animId !== activeAnim) return; // Superseded by another move.
|
|
199
|
+
const t = Math.min(1, (now - startedAt) / dur);
|
|
200
|
+
const eased = easeOut(t);
|
|
201
|
+
placeCursor(startX + (endX - startX) * eased, startY + (endY - startY) * eased);
|
|
202
|
+
if (t < 1) {
|
|
203
|
+
requestAnimationFrame(step);
|
|
204
|
+
} else {
|
|
205
|
+
resolve();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
requestAnimationFrame(step);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const playRipple = () => {
|
|
212
|
+
const root = ensureCursorRoot();
|
|
213
|
+
const ripple = root.querySelector("[data-eliza-cursor-ripple]");
|
|
214
|
+
if (!ripple) return;
|
|
215
|
+
ripple.style.transition = "none";
|
|
216
|
+
ripple.style.opacity = "0.85";
|
|
217
|
+
ripple.style.transform = "scale(0.4)";
|
|
218
|
+
// Force layout so the next frame animates.
|
|
219
|
+
void ripple.offsetWidth;
|
|
220
|
+
ripple.style.transition = "transform 320ms ease-out, opacity 320ms ease-out";
|
|
221
|
+
ripple.style.opacity = "0";
|
|
222
|
+
ripple.style.transform = "scale(1.6)";
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const clickAt = (target) => moveTo(target).then(() => {
|
|
226
|
+
playRipple();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const highlight = (element, durationMs) => {
|
|
230
|
+
if (!element || !element.style) return;
|
|
231
|
+
const prevOutline = element.style.outline;
|
|
232
|
+
const prevOutlineOffset = element.style.outlineOffset;
|
|
233
|
+
const prevTransition = element.style.transition;
|
|
234
|
+
element.style.transition = "outline-color 180ms ease-out";
|
|
235
|
+
element.style.outline = "2px solid #38bdf8";
|
|
236
|
+
element.style.outlineOffset = "2px";
|
|
237
|
+
const dur = Math.max(120, Math.min(2000, durationMs || 360));
|
|
238
|
+
setTimeout(() => {
|
|
239
|
+
element.style.outline = prevOutline;
|
|
240
|
+
element.style.outlineOffset = prevOutlineOffset;
|
|
241
|
+
element.style.transition = prevTransition;
|
|
242
|
+
}, dur);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const elementCenter = (element) => {
|
|
246
|
+
const rect = element.getBoundingClientRect();
|
|
247
|
+
return {
|
|
248
|
+
x: rect.left + rect.width / 2,
|
|
249
|
+
y: rect.top + rect.height / 2,
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const fireMouseEvent = (target, type, x, y, button, buttons) => {
|
|
254
|
+
// view is intentionally omitted — JSDOM rejects window references at
|
|
255
|
+
// construction time, real browsers fill view in during dispatch, and
|
|
256
|
+
// React synthetic events don't depend on it.
|
|
257
|
+
const event = new MouseEvent(type, {
|
|
258
|
+
bubbles: true,
|
|
259
|
+
cancelable: true,
|
|
260
|
+
composed: true,
|
|
261
|
+
button: button,
|
|
262
|
+
buttons: buttons,
|
|
263
|
+
clientX: x,
|
|
264
|
+
clientY: y,
|
|
265
|
+
screenX: x,
|
|
266
|
+
screenY: y,
|
|
267
|
+
});
|
|
268
|
+
target.dispatchEvent(event);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const firePointerEvent = (target, type, x, y, button, buttons) => {
|
|
272
|
+
let event;
|
|
273
|
+
try {
|
|
274
|
+
event = new PointerEvent(type, {
|
|
275
|
+
bubbles: true,
|
|
276
|
+
cancelable: true,
|
|
277
|
+
composed: true,
|
|
278
|
+
pointerId: 1,
|
|
279
|
+
pointerType: "mouse",
|
|
280
|
+
isPrimary: true,
|
|
281
|
+
button: button,
|
|
282
|
+
buttons: buttons,
|
|
283
|
+
clientX: x,
|
|
284
|
+
clientY: y,
|
|
285
|
+
screenX: x,
|
|
286
|
+
screenY: y,
|
|
287
|
+
});
|
|
288
|
+
} catch (_err) {
|
|
289
|
+
// Older WebKit may not have PointerEvent; fall back to mouse only.
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
target.dispatchEvent(event);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const dispatchPointerSequence = (target, options) => {
|
|
296
|
+
if (!target) return Promise.resolve();
|
|
297
|
+
const opts = options || {};
|
|
298
|
+
const center = elementCenter(target);
|
|
299
|
+
const x = typeof opts.x === "number" ? opts.x : center.x;
|
|
300
|
+
const y = typeof opts.y === "number" ? opts.y : center.y;
|
|
301
|
+
const button = typeof opts.button === "number" ? opts.button : 0;
|
|
302
|
+
|
|
303
|
+
return moveTo({ x: x, y: y }).then(() => {
|
|
304
|
+
firePointerEvent(target, "pointerover", x, y, button, 0);
|
|
305
|
+
fireMouseEvent(target, "mouseover", x, y, button, 0);
|
|
306
|
+
firePointerEvent(target, "pointermove", x, y, button, 0);
|
|
307
|
+
fireMouseEvent(target, "mousemove", x, y, button, 0);
|
|
308
|
+
firePointerEvent(target, "pointerdown", x, y, button, 1);
|
|
309
|
+
fireMouseEvent(target, "mousedown", x, y, button, 1);
|
|
310
|
+
// Most form controls expect focus between mousedown and click.
|
|
311
|
+
if (typeof target.focus === "function") {
|
|
312
|
+
try { target.focus({ preventScroll: true }); } catch (_e) { try { target.focus(); } catch (_e2) {} }
|
|
313
|
+
}
|
|
314
|
+
firePointerEvent(target, "pointerup", x, y, button, 0);
|
|
315
|
+
fireMouseEvent(target, "mouseup", x, y, button, 0);
|
|
316
|
+
fireMouseEvent(target, "click", x, y, button, 0);
|
|
317
|
+
if (opts.doubleClick) {
|
|
318
|
+
fireMouseEvent(target, "dblclick", x, y, button, 0);
|
|
319
|
+
}
|
|
320
|
+
playRipple();
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// React's controlled inputs check the value setter against the
|
|
325
|
+
// prototype's own descriptor to detect "real" user input. Mutating
|
|
326
|
+
// .value directly bypasses that. This helper sets value via the
|
|
327
|
+
// prototype descriptor so React/Preact/Solid all see the change.
|
|
328
|
+
const setNativeValue = (element, value) => {
|
|
329
|
+
const proto = Object.getPrototypeOf(element);
|
|
330
|
+
const protoDesc = proto ? Object.getOwnPropertyDescriptor(proto, "value") : null;
|
|
331
|
+
const ownDesc = Object.getOwnPropertyDescriptor(element, "value");
|
|
332
|
+
if (protoDesc && protoDesc.set && (!ownDesc || ownDesc.set !== protoDesc.set)) {
|
|
333
|
+
protoDesc.set.call(element, value);
|
|
334
|
+
} else {
|
|
335
|
+
element.value = value;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const fireKey = (target, type, key) => {
|
|
340
|
+
const isChar = key.length === 1;
|
|
341
|
+
const code = isChar
|
|
342
|
+
? (/[a-z]/i.test(key) ? "Key" + key.toUpperCase() : ("Digit" + key))
|
|
343
|
+
: key;
|
|
344
|
+
const init = {
|
|
345
|
+
key: key,
|
|
346
|
+
code: code,
|
|
347
|
+
bubbles: true,
|
|
348
|
+
cancelable: true,
|
|
349
|
+
composed: true,
|
|
350
|
+
};
|
|
351
|
+
try {
|
|
352
|
+
target.dispatchEvent(new KeyboardEvent(type, init));
|
|
353
|
+
} catch (_err) {
|
|
354
|
+
// KeyboardEvent always exists in modern browsers; ignore.
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const typeRealistic = (target, text, options) => {
|
|
359
|
+
if (!target) return Promise.resolve();
|
|
360
|
+
const opts = options || {};
|
|
361
|
+
const delay = Math.max(0, Math.min(200, typeof opts.perCharDelayMs === "number" ? opts.perCharDelayMs : 18));
|
|
362
|
+
try { target.focus({ preventScroll: true }); } catch (_e) { try { target.focus(); } catch (_e2) {} }
|
|
363
|
+
if (opts.replace) {
|
|
364
|
+
try {
|
|
365
|
+
if (typeof target.setSelectionRange === "function") {
|
|
366
|
+
target.setSelectionRange(0, (target.value || "").length);
|
|
367
|
+
}
|
|
368
|
+
} catch (_e) {}
|
|
369
|
+
setNativeValue(target, "");
|
|
370
|
+
target.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const chars = Array.from(text);
|
|
374
|
+
let index = 0;
|
|
375
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
376
|
+
|
|
377
|
+
const stepOne = () => {
|
|
378
|
+
if (index >= chars.length) return Promise.resolve();
|
|
379
|
+
const ch = chars[index++];
|
|
380
|
+
fireKey(target, "keydown", ch);
|
|
381
|
+
try {
|
|
382
|
+
target.dispatchEvent(new InputEvent("beforeinput", { bubbles: true, cancelable: true, composed: true, data: ch, inputType: "insertText" }));
|
|
383
|
+
} catch (_e) {}
|
|
384
|
+
const next = (target.value || "") + ch;
|
|
385
|
+
setNativeValue(target, next);
|
|
386
|
+
try {
|
|
387
|
+
target.dispatchEvent(new InputEvent("input", { bubbles: true, composed: true, data: ch, inputType: "insertText" }));
|
|
388
|
+
} catch (_e) {
|
|
389
|
+
target.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
390
|
+
}
|
|
391
|
+
fireKey(target, "keyup", ch);
|
|
392
|
+
if (delay > 0) return sleep(delay).then(stepOne);
|
|
393
|
+
return Promise.resolve().then(stepOne);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
return stepOne().then(() => {
|
|
397
|
+
target.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
398
|
+
});
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const setFileInput = async (target, url, options) => {
|
|
402
|
+
if (!target || target.tagName !== "INPUT" || target.type !== "file") {
|
|
403
|
+
throw new Error("setFileInput requires an HTMLInputElement of type=file");
|
|
404
|
+
}
|
|
405
|
+
const opts = options || {};
|
|
406
|
+
const response = await fetch(url, { credentials: "omit" });
|
|
407
|
+
if (!response.ok) {
|
|
408
|
+
throw new Error("setFileInput fetch failed: HTTP " + response.status);
|
|
409
|
+
}
|
|
410
|
+
const blob = await response.blob();
|
|
411
|
+
const mimeType = opts.mimeType || blob.type || "application/octet-stream";
|
|
412
|
+
const ext = (() => {
|
|
413
|
+
if (/png/i.test(mimeType)) return "png";
|
|
414
|
+
if (/jpe?g/i.test(mimeType)) return "jpg";
|
|
415
|
+
if (/webp/i.test(mimeType)) return "webp";
|
|
416
|
+
if (/gif/i.test(mimeType)) return "gif";
|
|
417
|
+
return "bin";
|
|
418
|
+
})();
|
|
419
|
+
const fileName = opts.fileName || "upload-" + Date.now() + "." + ext;
|
|
420
|
+
const file = new File([blob], fileName, { type: mimeType });
|
|
421
|
+
// The DataTransfer constructor is supported in WebKit, Blink, and
|
|
422
|
+
// Gecko; this is the standard "set <input type=file> from script"
|
|
423
|
+
// workaround. Direct .files= assignment is sandbox-blocked.
|
|
424
|
+
const dt = new DataTransfer();
|
|
425
|
+
dt.items.add(file);
|
|
426
|
+
target.files = dt.files;
|
|
427
|
+
try { target.focus({ preventScroll: true }); } catch (_e) {}
|
|
428
|
+
target.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
429
|
+
target.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
430
|
+
return { name: file.name, size: file.size, type: file.type };
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
kit = {
|
|
434
|
+
cursor: {
|
|
435
|
+
moveTo: moveTo,
|
|
436
|
+
click: clickAt,
|
|
437
|
+
highlight: highlight,
|
|
438
|
+
show: showCursor,
|
|
439
|
+
hide: hideCursor,
|
|
440
|
+
},
|
|
441
|
+
dispatchPointerSequence: dispatchPointerSequence,
|
|
442
|
+
typeRealistic: typeRealistic,
|
|
443
|
+
setFileInput: setFileInput,
|
|
444
|
+
};
|
|
445
|
+
window.__elizaTabKit = kit;
|
|
446
|
+
return kit;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// Defer first-time installation until the document is parseable.
|
|
450
|
+
if (document && document.documentElement) {
|
|
451
|
+
ensureKit();
|
|
452
|
+
} else if (typeof document !== "undefined") {
|
|
453
|
+
document.addEventListener("DOMContentLoaded", () => ensureKit(), { once: true });
|
|
454
|
+
}
|
|
455
|
+
// Also re-install after navigations within the same OOPIF (in case the
|
|
456
|
+
// document was replaced and our cursor root went with it).
|
|
457
|
+
if (typeof window !== "undefined") {
|
|
458
|
+
window.addEventListener("pageshow", () => ensureKit());
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// ── Wallet provider shims ────────────────────────────────────────────
|
|
462
|
+
// Inject EIP-1193 (window.ethereum) and Phantom-shaped (window.solana,
|
|
463
|
+
// window.phantom.solana) wallet adapters that route every call through
|
|
464
|
+
// __electrobunSendToHost to the React host, which forwards to the
|
|
465
|
+
// existing client.sendBrowserWalletTransaction /
|
|
466
|
+
// client.sendBrowserSolanaTransaction / etc. The host calls back into
|
|
467
|
+
// the tab via tag.executeJavascript("window.__elizaWalletReply(...)")
|
|
468
|
+
// to deliver responses.
|
|
469
|
+
//
|
|
470
|
+
// Without this, launchpad pages in our <electrobun-webview> tabs see no
|
|
471
|
+
// wallet provider and refuse to connect.
|
|
472
|
+
if (typeof window !== "undefined" && !window.__elizaWalletInstalled) {
|
|
473
|
+
window.__elizaWalletInstalled = true;
|
|
474
|
+
|
|
475
|
+
const walletPending = new Map();
|
|
476
|
+
let nextWalletReq = 1;
|
|
477
|
+
|
|
478
|
+
window.__elizaWalletReply = (requestId, payload) => {
|
|
479
|
+
const entry = walletPending.get(requestId);
|
|
480
|
+
if (!entry) return;
|
|
481
|
+
walletPending.delete(requestId);
|
|
482
|
+
if (payload && typeof payload === "object" && payload.error) {
|
|
483
|
+
entry.reject(new Error(String(payload.error)));
|
|
484
|
+
} else {
|
|
485
|
+
entry.resolve(payload && typeof payload === "object" ? payload.result : payload);
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
const callHost = (protocol, method, params) =>
|
|
490
|
+
new Promise((resolve, reject) => {
|
|
491
|
+
if (typeof window.__electrobunSendToHost !== "function") {
|
|
492
|
+
reject(new Error("Wallet bridge unavailable: not running in an Eliza tab."));
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
const requestId = nextWalletReq++;
|
|
496
|
+
walletPending.set(requestId, { resolve: resolve, reject: reject });
|
|
497
|
+
// Include the page's origin/hostname so the host can show a
|
|
498
|
+
// "<domain> wants to ..." consent dialog without an extra eval
|
|
499
|
+
// round-trip.
|
|
500
|
+
let originValue;
|
|
501
|
+
let hostnameValue;
|
|
502
|
+
try {
|
|
503
|
+
originValue = location.origin;
|
|
504
|
+
hostnameValue = location.hostname;
|
|
505
|
+
} catch (_e) {
|
|
506
|
+
originValue = "";
|
|
507
|
+
hostnameValue = "";
|
|
508
|
+
}
|
|
509
|
+
window.__electrobunSendToHost({
|
|
510
|
+
type: "__elizaWalletRequest",
|
|
511
|
+
requestId: requestId,
|
|
512
|
+
protocol: protocol,
|
|
513
|
+
method: method,
|
|
514
|
+
params: params,
|
|
515
|
+
origin: originValue,
|
|
516
|
+
hostname: hostnameValue,
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// ── EIP-1193 ──
|
|
521
|
+
const eventListeners = { accountsChanged: new Set(), chainChanged: new Set(), connect: new Set(), disconnect: new Set() };
|
|
522
|
+
const ethereum = {
|
|
523
|
+
isMetaMask: false,
|
|
524
|
+
isEliza: true,
|
|
525
|
+
_events: eventListeners,
|
|
526
|
+
request: (args) => {
|
|
527
|
+
if (!args || typeof args.method !== "string") {
|
|
528
|
+
return Promise.reject(new Error("EIP-1193 request requires {method, params}"));
|
|
529
|
+
}
|
|
530
|
+
return callHost("evm", args.method, args.params);
|
|
531
|
+
},
|
|
532
|
+
enable: function () {
|
|
533
|
+
return this.request({ method: "eth_requestAccounts" });
|
|
534
|
+
},
|
|
535
|
+
send: function (methodOrPayload, paramsOrCallback) {
|
|
536
|
+
// Legacy send shapes — best-effort polyfill.
|
|
537
|
+
if (typeof methodOrPayload === "string") {
|
|
538
|
+
return this.request({ method: methodOrPayload, params: paramsOrCallback });
|
|
539
|
+
}
|
|
540
|
+
if (methodOrPayload && typeof methodOrPayload === "object") {
|
|
541
|
+
return this.request({ method: methodOrPayload.method, params: methodOrPayload.params });
|
|
542
|
+
}
|
|
543
|
+
return Promise.reject(new Error("Unsupported send shape."));
|
|
544
|
+
},
|
|
545
|
+
sendAsync: function (payload, callback) {
|
|
546
|
+
this.request({ method: payload.method, params: payload.params })
|
|
547
|
+
.then((result) => callback(null, { jsonrpc: "2.0", id: payload.id, result: result }))
|
|
548
|
+
.catch((err) => callback(err, null));
|
|
549
|
+
},
|
|
550
|
+
on: (event, listener) => {
|
|
551
|
+
const set = eventListeners[event];
|
|
552
|
+
if (set) set.add(listener);
|
|
553
|
+
},
|
|
554
|
+
removeListener: (event, listener) => {
|
|
555
|
+
const set = eventListeners[event];
|
|
556
|
+
if (set) set.delete(listener);
|
|
557
|
+
},
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
window.__elizaWalletEmit = (event, payload) => {
|
|
561
|
+
const set = eventListeners[event];
|
|
562
|
+
if (!set) return;
|
|
563
|
+
for (const listener of Array.from(set)) {
|
|
564
|
+
try { listener(payload); } catch (_e) {}
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
try {
|
|
569
|
+
Object.defineProperty(window, "ethereum", {
|
|
570
|
+
value: ethereum,
|
|
571
|
+
writable: true,
|
|
572
|
+
configurable: true,
|
|
573
|
+
});
|
|
574
|
+
} catch (_err) {
|
|
575
|
+
// Some pages freeze window.ethereum after their wallet detected it;
|
|
576
|
+
// fall back to direct assignment when defineProperty is blocked.
|
|
577
|
+
try { window.ethereum = ethereum; } catch (_e) {}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// ── Solana (Phantom-shaped) ──
|
|
581
|
+
const solanaListeners = { connect: new Set(), disconnect: new Set(), accountChanged: new Set() };
|
|
582
|
+
const makePublicKey = (base58) => {
|
|
583
|
+
if (!base58) return null;
|
|
584
|
+
const obj = {
|
|
585
|
+
toBase58: () => base58,
|
|
586
|
+
toString: () => base58,
|
|
587
|
+
toBytes: () => {
|
|
588
|
+
// Best-effort: many launchpads only need toBase58/toString. If
|
|
589
|
+
// they do call toBytes the result will be wrong, but the lazy
|
|
590
|
+
// approach avoids bundling a base58 decoder into every tab.
|
|
591
|
+
// The host-side signing path receives base58 directly, so
|
|
592
|
+
// round-trip transactions don't depend on this method.
|
|
593
|
+
throw new Error("solana.publicKey.toBytes is not supported by the Eliza tab shim");
|
|
594
|
+
},
|
|
595
|
+
equals: (other) => other && typeof other.toBase58 === "function" && other.toBase58() === base58,
|
|
596
|
+
};
|
|
597
|
+
return obj;
|
|
598
|
+
};
|
|
599
|
+
const solana = {
|
|
600
|
+
isPhantom: true,
|
|
601
|
+
isEliza: true,
|
|
602
|
+
publicKey: null,
|
|
603
|
+
isConnected: false,
|
|
604
|
+
connect: async function (options) {
|
|
605
|
+
const _options = options;
|
|
606
|
+
const result = await callHost("solana", "connect", null);
|
|
607
|
+
if (result && typeof result.publicKey === "string") {
|
|
608
|
+
this.publicKey = makePublicKey(result.publicKey);
|
|
609
|
+
this.isConnected = true;
|
|
610
|
+
for (const listener of Array.from(solanaListeners.connect)) {
|
|
611
|
+
try { listener(this.publicKey); } catch (_e) {}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return { publicKey: this.publicKey };
|
|
615
|
+
},
|
|
616
|
+
disconnect: async function () {
|
|
617
|
+
this.publicKey = null;
|
|
618
|
+
this.isConnected = false;
|
|
619
|
+
for (const listener of Array.from(solanaListeners.disconnect)) {
|
|
620
|
+
try { listener(); } catch (_e) {}
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
signMessage: async function (message, _encoding) {
|
|
624
|
+
const bytes = message instanceof Uint8Array ? message : new TextEncoder().encode(String(message));
|
|
625
|
+
const messageBase64 = btoa(String.fromCharCode.apply(null, Array.from(bytes)));
|
|
626
|
+
const result = await callHost("solana", "signMessage", { messageBase64: messageBase64 });
|
|
627
|
+
if (!result || typeof result.signatureBase64 !== "string") {
|
|
628
|
+
throw new Error("Solana signMessage returned no signature.");
|
|
629
|
+
}
|
|
630
|
+
const sig = atob(result.signatureBase64);
|
|
631
|
+
const arr = new Uint8Array(sig.length);
|
|
632
|
+
for (let i = 0; i < sig.length; i += 1) arr[i] = sig.charCodeAt(i);
|
|
633
|
+
return { signature: arr, publicKey: this.publicKey };
|
|
634
|
+
},
|
|
635
|
+
signTransaction: async function (transaction) {
|
|
636
|
+
const transactionBase64 = await serializeTransactionForHost(transaction);
|
|
637
|
+
const result = await callHost("solana", "signTransaction", { transactionBase64: transactionBase64 });
|
|
638
|
+
if (!result || typeof result.signedTransactionBase64 !== "string") {
|
|
639
|
+
throw new Error("Solana signTransaction returned no signed tx.");
|
|
640
|
+
}
|
|
641
|
+
return deserializeTransactionFromHost(result.signedTransactionBase64, transaction);
|
|
642
|
+
},
|
|
643
|
+
signAndSendTransaction: async function (transaction) {
|
|
644
|
+
const transactionBase64 = await serializeTransactionForHost(transaction);
|
|
645
|
+
const result = await callHost("solana", "signAndSendTransaction", { transactionBase64: transactionBase64 });
|
|
646
|
+
if (!result || typeof result.signature !== "string") {
|
|
647
|
+
throw new Error("Solana signAndSendTransaction returned no signature.");
|
|
648
|
+
}
|
|
649
|
+
return { signature: result.signature };
|
|
650
|
+
},
|
|
651
|
+
signAllTransactions: async function (transactions) {
|
|
652
|
+
const out = [];
|
|
653
|
+
for (const tx of transactions) {
|
|
654
|
+
out.push(await this.signTransaction(tx));
|
|
655
|
+
}
|
|
656
|
+
return out;
|
|
657
|
+
},
|
|
658
|
+
on: (event, listener) => {
|
|
659
|
+
const set = solanaListeners[event];
|
|
660
|
+
if (set) set.add(listener);
|
|
661
|
+
},
|
|
662
|
+
off: (event, listener) => {
|
|
663
|
+
const set = solanaListeners[event];
|
|
664
|
+
if (set) set.delete(listener);
|
|
665
|
+
},
|
|
666
|
+
removeListener: (event, listener) => {
|
|
667
|
+
const set = solanaListeners[event];
|
|
668
|
+
if (set) set.delete(listener);
|
|
669
|
+
},
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
// Helper: serialize a Solana Transaction-like object to base64. We
|
|
673
|
+
// accept a few common shapes — the launchpad usually hands us either
|
|
674
|
+
// a VersionedTransaction (has .serialize()) or a legacy Transaction
|
|
675
|
+
// (has .serialize({verifySignatures:false})).
|
|
676
|
+
async function serializeTransactionForHost(transaction) {
|
|
677
|
+
if (!transaction) throw new Error("signTransaction requires a transaction");
|
|
678
|
+
try {
|
|
679
|
+
let bytes;
|
|
680
|
+
if (typeof transaction.serialize === "function") {
|
|
681
|
+
// Legacy Transaction.serialize() throws if signatures aren't
|
|
682
|
+
// present yet; pass {verifySignatures:false}. VersionedTransaction
|
|
683
|
+
// ignores the option so it's safe either way.
|
|
684
|
+
bytes = transaction.serialize({ verifySignatures: false, requireAllSignatures: false });
|
|
685
|
+
} else if (transaction instanceof Uint8Array) {
|
|
686
|
+
bytes = transaction;
|
|
687
|
+
} else {
|
|
688
|
+
throw new Error("Unsupported transaction shape for Eliza wallet bridge");
|
|
689
|
+
}
|
|
690
|
+
let binary = "";
|
|
691
|
+
for (let i = 0; i < bytes.length; i += 1) binary += String.fromCharCode(bytes[i]);
|
|
692
|
+
return btoa(binary);
|
|
693
|
+
} catch (err) {
|
|
694
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// Best-effort: hand the signed bytes back as the same shape the caller
|
|
699
|
+
// gave us. Most callers immediately send the result to a Connection
|
|
700
|
+
// which accepts a serialized buffer — passing a Uint8Array is safe.
|
|
701
|
+
function deserializeTransactionFromHost(base64, _original) {
|
|
702
|
+
const bin = atob(base64);
|
|
703
|
+
const bytes = new Uint8Array(bin.length);
|
|
704
|
+
for (let i = 0; i < bin.length; i += 1) bytes[i] = bin.charCodeAt(i);
|
|
705
|
+
return bytes;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
try {
|
|
709
|
+
Object.defineProperty(window, "solana", {
|
|
710
|
+
value: solana,
|
|
711
|
+
writable: true,
|
|
712
|
+
configurable: true,
|
|
713
|
+
});
|
|
714
|
+
} catch (_err) {
|
|
715
|
+
try { window.solana = solana; } catch (_e) {}
|
|
716
|
+
}
|
|
717
|
+
try {
|
|
718
|
+
const phantomNs = window.phantom || {};
|
|
719
|
+
phantomNs.solana = solana;
|
|
720
|
+
window.phantom = phantomNs;
|
|
721
|
+
} catch (_err) {}
|
|
722
|
+
|
|
723
|
+
// Announce the provider per EIP-6963 (https://eips.ethereum.org/EIPS/eip-6963).
|
|
724
|
+
// Keys:
|
|
725
|
+
// uuid — stable per-installation identifier; we use a fixed value
|
|
726
|
+
// because dApps key wallet selection on it. Changing this would
|
|
727
|
+
// make every dApp forget the user's previous choice.
|
|
728
|
+
// rdns — reverse-DNS namespace for the wallet brand.
|
|
729
|
+
// icon — data URI; the SVG below is a 24x24 monochrome "M" mark in
|
|
730
|
+
// the brand purple (#6f5cff). Inline so we don't depend on
|
|
731
|
+
// network availability for wallet-picker rendering.
|
|
732
|
+
const ELIZA_WALLET_ICON =
|
|
733
|
+
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj48cmVjdCB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHJ4PSI2IiBmaWxsPSIjNmY1Y2ZmIi8+PHRleHQgeD0iNTAlIiB5PSI2OCUiIGZvbnQtZmFtaWx5PSItYXBwbGUtc3lzdGVtLEJsaW5rTWFjU3lzdGVtRm9udCxzYW5zLXNlcmlmIiBmb250LXNpemU9IjE2IiBmb250LXdlaWdodD0iNzAwIiBmaWxsPSIjZmZmIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj5NPC90ZXh0Pjwvc3ZnPg==";
|
|
734
|
+
const announceEthereum = () => {
|
|
735
|
+
try {
|
|
736
|
+
const detail = Object.freeze({
|
|
737
|
+
info: Object.freeze({
|
|
738
|
+
name: "Eliza",
|
|
739
|
+
uuid: "ai.eliza.wallet:1",
|
|
740
|
+
icon: ELIZA_WALLET_ICON,
|
|
741
|
+
rdns: "ai.eliza.wallet",
|
|
742
|
+
}),
|
|
743
|
+
provider: ethereum,
|
|
744
|
+
});
|
|
745
|
+
window.dispatchEvent(new CustomEvent("eip6963:announceProvider", { detail: detail }));
|
|
746
|
+
} catch (_err) {}
|
|
747
|
+
};
|
|
748
|
+
window.addEventListener("eip6963:requestProvider", announceEthereum);
|
|
749
|
+
setTimeout(announceEthereum, 0);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// ── Vault autofill shim ─────────────────────────────────────────────
|
|
753
|
+
// Detect login forms on each tab page, ask the host to look up saved
|
|
754
|
+
// credentials for the current domain, and (with user consent) fill the
|
|
755
|
+
// username/password inputs. Mirrors the wallet shim's request/reply
|
|
756
|
+
// pattern: tab→host via __electrobunSendToHost; host→tab via
|
|
757
|
+
// tag.executeJavascript("window.__elizaVaultReply(...)").
|
|
758
|
+
//
|
|
759
|
+
// The host (BrowserWorkspaceView) is responsible for showing a consent
|
|
760
|
+
// prompt before returning credentials. The tab never autofills without
|
|
761
|
+
// a host response carrying explicit field values.
|
|
762
|
+
if (typeof window !== "undefined" && !window.__elizaVaultInstalled) {
|
|
763
|
+
window.__elizaVaultInstalled = true;
|
|
764
|
+
|
|
765
|
+
const vaultPending = new Map();
|
|
766
|
+
let nextVaultReq = 1;
|
|
767
|
+
|
|
768
|
+
window.__elizaVaultReply = (requestId, payload) => {
|
|
769
|
+
const entry = vaultPending.get(requestId);
|
|
770
|
+
if (!entry) return;
|
|
771
|
+
vaultPending.delete(requestId);
|
|
772
|
+
try {
|
|
773
|
+
if (payload && typeof payload === "object" && payload.error) {
|
|
774
|
+
entry.reject(new Error(String(payload.error)));
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
entry.resolve(payload && typeof payload === "object" ? payload : null);
|
|
778
|
+
} catch (_e) {
|
|
779
|
+
// Listener errors must not bubble up into the tab page.
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
function cssSelectorFor(el) {
|
|
784
|
+
if (!el || el.nodeType !== 1) return null;
|
|
785
|
+
if (el.id) {
|
|
786
|
+
// Document.querySelector('#…') only works when the id is a valid
|
|
787
|
+
// selector token. For complex ids fall through to the structural
|
|
788
|
+
// path so we never produce an unparsable selector.
|
|
789
|
+
if (/^[A-Za-z][A-Za-z0-9_-]*$/.test(el.id)) {
|
|
790
|
+
return "#" + el.id;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
const parts = [];
|
|
794
|
+
let node = el;
|
|
795
|
+
let depth = 0;
|
|
796
|
+
while (node && node.nodeType === 1 && depth < 6) {
|
|
797
|
+
let part = node.tagName.toLowerCase();
|
|
798
|
+
const parent = node.parentElement;
|
|
799
|
+
if (parent) {
|
|
800
|
+
const sameTag = Array.from(parent.children).filter(
|
|
801
|
+
(c) => c.tagName === node.tagName,
|
|
802
|
+
);
|
|
803
|
+
if (sameTag.length > 1) {
|
|
804
|
+
const idx = sameTag.indexOf(node) + 1;
|
|
805
|
+
part += ":nth-of-type(" + idx + ")";
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
parts.unshift(part);
|
|
809
|
+
if (parent === document.body || !parent) break;
|
|
810
|
+
node = parent;
|
|
811
|
+
depth += 1;
|
|
812
|
+
}
|
|
813
|
+
return parts.join(" > ");
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
function findPrecedingTextInput(passwordInput) {
|
|
817
|
+
// Walk previous form-field siblings/ancestors looking for a text
|
|
818
|
+
// or email input that's likely the username.
|
|
819
|
+
const root = passwordInput.form || document.body;
|
|
820
|
+
const candidates = root.querySelectorAll(
|
|
821
|
+
'input[type="text"], input[type="email"], input:not([type])',
|
|
822
|
+
);
|
|
823
|
+
let lastBefore = null;
|
|
824
|
+
for (const el of candidates) {
|
|
825
|
+
if (
|
|
826
|
+
el.compareDocumentPosition(passwordInput) &
|
|
827
|
+
Node.DOCUMENT_POSITION_FOLLOWING
|
|
828
|
+
) {
|
|
829
|
+
lastBefore = el;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
return lastBefore;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
function setNativeInputValue(input, value) {
|
|
836
|
+
// React (and other VDOM frameworks) overrides the value setter on
|
|
837
|
+
// HTMLInputElement.prototype to track changes. Calling the prototype
|
|
838
|
+
// setter directly bypasses that, then dispatching input + change
|
|
839
|
+
// events re-notifies the framework so controlled inputs see the
|
|
840
|
+
// update.
|
|
841
|
+
const proto = Object.getPrototypeOf(input);
|
|
842
|
+
const desc = Object.getOwnPropertyDescriptor(proto, "value");
|
|
843
|
+
if (desc && typeof desc.set === "function") {
|
|
844
|
+
desc.set.call(input, value);
|
|
845
|
+
} else {
|
|
846
|
+
input.value = value;
|
|
847
|
+
}
|
|
848
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
849
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
function fillFields(fields) {
|
|
853
|
+
if (!fields || typeof fields !== "object") return;
|
|
854
|
+
for (const selector of Object.keys(fields)) {
|
|
855
|
+
const value = fields[selector];
|
|
856
|
+
if (typeof value !== "string" || value.length === 0) continue;
|
|
857
|
+
let target = null;
|
|
858
|
+
try {
|
|
859
|
+
target = document.querySelector(selector);
|
|
860
|
+
} catch (_e) {
|
|
861
|
+
target = null;
|
|
862
|
+
}
|
|
863
|
+
if (!target) continue;
|
|
864
|
+
setNativeInputValue(target, value);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
const callHost = (domain, url, fieldHints) =>
|
|
869
|
+
new Promise((resolve, reject) => {
|
|
870
|
+
if (typeof window.__electrobunSendToHost !== "function") {
|
|
871
|
+
reject(
|
|
872
|
+
new Error("Vault autofill bridge unavailable: not in an Eliza tab."),
|
|
873
|
+
);
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
const requestId = nextVaultReq++;
|
|
877
|
+
vaultPending.set(requestId, { resolve: resolve, reject: reject });
|
|
878
|
+
window.__electrobunSendToHost({
|
|
879
|
+
type: "__elizaVaultAutofillRequest",
|
|
880
|
+
requestId: requestId,
|
|
881
|
+
domain: domain,
|
|
882
|
+
url: url,
|
|
883
|
+
fieldHints: fieldHints,
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
function scanLoginForms() {
|
|
888
|
+
const passwords = document.querySelectorAll(
|
|
889
|
+
'input[type="password"]:not([data-eliza-vault-scanned])',
|
|
890
|
+
);
|
|
891
|
+
for (const pw of passwords) {
|
|
892
|
+
pw.setAttribute("data-eliza-vault-scanned", "1");
|
|
893
|
+
const form = pw.form;
|
|
894
|
+
const userInput =
|
|
895
|
+
(form &&
|
|
896
|
+
form.querySelector(
|
|
897
|
+
'input[type="email"], input[name*="user" i], input[name*="email" i], input[name*="login" i]',
|
|
898
|
+
)) ||
|
|
899
|
+
findPrecedingTextInput(pw);
|
|
900
|
+
const fieldHints = [];
|
|
901
|
+
const pwSelector = cssSelectorFor(pw);
|
|
902
|
+
if (userInput) {
|
|
903
|
+
const userSelector = cssSelectorFor(userInput);
|
|
904
|
+
if (userSelector) {
|
|
905
|
+
fieldHints.push({ kind: "username", selector: userSelector });
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
if (pwSelector) {
|
|
909
|
+
fieldHints.push({ kind: "password", selector: pwSelector });
|
|
910
|
+
}
|
|
911
|
+
if (fieldHints.length === 0) continue;
|
|
912
|
+
callHost(location.hostname, location.href, fieldHints)
|
|
913
|
+
.then((payload) => {
|
|
914
|
+
if (payload && payload.fields) fillFields(payload.fields);
|
|
915
|
+
})
|
|
916
|
+
.catch(() => {
|
|
917
|
+
// User denied, no match, or bridge unavailable. Leave fields
|
|
918
|
+
// alone so the user can type credentials manually.
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
let scanTimer = null;
|
|
924
|
+
function ensureVaultScan() {
|
|
925
|
+
if (scanTimer) clearTimeout(scanTimer);
|
|
926
|
+
scanTimer = setTimeout(() => {
|
|
927
|
+
scanTimer = null;
|
|
928
|
+
scanLoginForms();
|
|
929
|
+
}, 250);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
if (typeof window !== "undefined") {
|
|
933
|
+
window.addEventListener("pageshow", ensureVaultScan);
|
|
934
|
+
}
|
|
935
|
+
if (typeof MutationObserver === "function" && document.documentElement) {
|
|
936
|
+
const obs = new MutationObserver(ensureVaultScan);
|
|
937
|
+
obs.observe(document.documentElement, {
|
|
938
|
+
childList: true,
|
|
939
|
+
subtree: true,
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
if (document && document.readyState !== "loading") {
|
|
943
|
+
ensureVaultScan();
|
|
944
|
+
} else if (typeof document !== "undefined") {
|
|
945
|
+
document.addEventListener("DOMContentLoaded", () => ensureVaultScan(), {
|
|
946
|
+
once: true,
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
})();
|
|
951
|
+
`;
|
|
952
|
+
export function setBrowserTabsRendererImpl(impl) {
|
|
953
|
+
if (typeof window === "undefined")
|
|
954
|
+
return;
|
|
955
|
+
if (impl) {
|
|
956
|
+
window[REGISTRY_KEY] = impl;
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
delete window[REGISTRY_KEY];
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
//# sourceMappingURL=browser-tabs-renderer-registry.js.map
|