@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,710 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin config catalog & registry — reverse-engineered from vercel-labs/json-render.
|
|
3
|
+
*
|
|
4
|
+
* json-render pattern:
|
|
5
|
+
* defineCatalog(schema, { components, actions, functions }) → type-safe catalog
|
|
6
|
+
* defineRegistry(catalog, { components, actions }) → maps catalog → renderers/handlers
|
|
7
|
+
* <Renderer spec={} registry={} /> → traverses spec, renders
|
|
8
|
+
*
|
|
9
|
+
* Our adaptation for plugin config forms:
|
|
10
|
+
* defineCatalog({ fields, actions?, functions? }) → field + action + validation catalog
|
|
11
|
+
* defineRegistry(catalog, renderers, actionHandlers?) → maps types → render/handler functions
|
|
12
|
+
* <ConfigRenderer> → reads JSON Schema + uiHints, renders form
|
|
13
|
+
*
|
|
14
|
+
* New in Phase 2 (json-render feature parity):
|
|
15
|
+
* - Actions: catalog actions with Zod params + registry handlers
|
|
16
|
+
* - Rich visibility: LogicExpression (and/or/not/eq/neq/gt/gte/lt/lte)
|
|
17
|
+
* - Validation checks: declarative checks (required/email/minLength/pattern/...)
|
|
18
|
+
* - Data binding: DynamicValue with path resolution (getByPath/setByPath)
|
|
19
|
+
* - Prompt generation: catalog.prompt() for AI system prompts
|
|
20
|
+
*
|
|
21
|
+
* @module config-catalog
|
|
22
|
+
*/
|
|
23
|
+
import z from "zod";
|
|
24
|
+
// ── Dynamic value resolution (≈ json-render DynamicValue + getByPath) ───
|
|
25
|
+
/**
|
|
26
|
+
* Get a value from a nested object by slash-delimited path (JSON Pointer).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* getByPath({ a: { b: 42 } }, "a/b") // → 42
|
|
30
|
+
* getByPath({ items: [1, 2] }, "items/0") // → 1
|
|
31
|
+
*/
|
|
32
|
+
export function getByPath(obj, path) {
|
|
33
|
+
if (!path || path === "/")
|
|
34
|
+
return obj;
|
|
35
|
+
const segments = (path.startsWith("/") ? path.slice(1) : path).split("/");
|
|
36
|
+
let current = obj;
|
|
37
|
+
for (const seg of segments) {
|
|
38
|
+
if (current == null)
|
|
39
|
+
return undefined;
|
|
40
|
+
if (Array.isArray(current)) {
|
|
41
|
+
current = current[parseInt(seg, 10)];
|
|
42
|
+
}
|
|
43
|
+
else if (typeof current === "object") {
|
|
44
|
+
current = current[seg];
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return current;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Set a value in a nested object by slash-delimited path.
|
|
54
|
+
*/
|
|
55
|
+
export function setByPath(obj, path, value) {
|
|
56
|
+
const segments = (path.startsWith("/") ? path.slice(1) : path).split("/");
|
|
57
|
+
if (segments.length === 0)
|
|
58
|
+
return;
|
|
59
|
+
const isUnsafeKey = (k) => k === "__proto__" || k === "constructor" || k === "prototype";
|
|
60
|
+
for (const seg of segments) {
|
|
61
|
+
if (isUnsafeKey(seg))
|
|
62
|
+
return; // silently reject dangerous paths
|
|
63
|
+
}
|
|
64
|
+
let current = obj;
|
|
65
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
66
|
+
const seg = segments[i];
|
|
67
|
+
if (isUnsafeKey(seg))
|
|
68
|
+
return;
|
|
69
|
+
if (!(seg in current) || typeof current[seg] !== "object") {
|
|
70
|
+
current[seg] = /^\d+$/.test(segments[i + 1]) ? [] : {};
|
|
71
|
+
}
|
|
72
|
+
current = current[seg];
|
|
73
|
+
}
|
|
74
|
+
const finalKey = segments[segments.length - 1];
|
|
75
|
+
if (isUnsafeKey(finalKey))
|
|
76
|
+
return;
|
|
77
|
+
current[finalKey] = value;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Resolve a DynamicValue — if it's a {path} reference, look up in state.
|
|
81
|
+
*/
|
|
82
|
+
export function resolveDynamic(value, state) {
|
|
83
|
+
if (value != null && typeof value === "object" && "path" in value) {
|
|
84
|
+
return getByPath(state, value.path);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Search for a field value by name — ported from json-render's dashboard example.
|
|
90
|
+
*
|
|
91
|
+
* Resolution order:
|
|
92
|
+
* 1. Direct params lookup
|
|
93
|
+
* 2. Params with path format (JSON Pointer)
|
|
94
|
+
* 3. State walk through common form prefixes (form, newItem, create, edit, root)
|
|
95
|
+
*/
|
|
96
|
+
export function findFormValue(fieldName, params, state) {
|
|
97
|
+
// 1. Check direct params
|
|
98
|
+
if (params && fieldName in params)
|
|
99
|
+
return params[fieldName];
|
|
100
|
+
// 2. Check params with path format
|
|
101
|
+
if (params) {
|
|
102
|
+
const pathValue = getByPath(params, `/${fieldName}`);
|
|
103
|
+
if (pathValue !== undefined)
|
|
104
|
+
return pathValue;
|
|
105
|
+
}
|
|
106
|
+
// 3. Search state - check common form prefixes
|
|
107
|
+
if (state) {
|
|
108
|
+
const prefixes = ["form", "newItem", "create", "edit", ""];
|
|
109
|
+
for (const prefix of prefixes) {
|
|
110
|
+
const path = prefix ? `/${prefix}/${fieldName}` : `/${fieldName}`;
|
|
111
|
+
const val = getByPath(state, path);
|
|
112
|
+
if (val !== undefined)
|
|
113
|
+
return val;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Interpolate `{{path}}` references in a template string using context values.
|
|
120
|
+
*
|
|
121
|
+
* Useful for action onSuccess/onError messages that reference state values.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* interpolateString("Created {{/form/name}} successfully", { form: { name: "Foo" } })
|
|
125
|
+
* // → "Created Foo successfully"
|
|
126
|
+
*/
|
|
127
|
+
export function interpolateString(template, context) {
|
|
128
|
+
const safeTemplate = template.length > 100_000 ? template.slice(0, 100_000) : template;
|
|
129
|
+
return safeTemplate.replace(/\{\{([^}]{1,1024})\}\}/g, (_, path) => {
|
|
130
|
+
const value = getByPath(context, path.trim().startsWith("/") ? path.trim() : `/${path.trim()}`);
|
|
131
|
+
return value !== undefined ? String(value) : "";
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// ── Rich visibility evaluation (≈ json-render evaluateVisibility) ───────
|
|
135
|
+
/**
|
|
136
|
+
* Evaluate a LogicExpression against a state model.
|
|
137
|
+
*/
|
|
138
|
+
export function evaluateLogicExpression(expr, state) {
|
|
139
|
+
if ("and" in expr)
|
|
140
|
+
return expr.and.every((e) => evaluateLogicExpression(e, state));
|
|
141
|
+
if ("or" in expr)
|
|
142
|
+
return expr.or.some((e) => evaluateLogicExpression(e, state));
|
|
143
|
+
if ("not" in expr)
|
|
144
|
+
return !evaluateLogicExpression(expr.not, state);
|
|
145
|
+
if ("path" in expr)
|
|
146
|
+
return Boolean(getByPath(state, expr.path));
|
|
147
|
+
if ("eq" in expr) {
|
|
148
|
+
const [l, r] = expr.eq;
|
|
149
|
+
return resolveDynamic(l, state) === resolveDynamic(r, state);
|
|
150
|
+
}
|
|
151
|
+
if ("neq" in expr) {
|
|
152
|
+
const [l, r] = expr.neq;
|
|
153
|
+
return resolveDynamic(l, state) !== resolveDynamic(r, state);
|
|
154
|
+
}
|
|
155
|
+
if ("gt" in expr) {
|
|
156
|
+
const [l, r] = expr.gt;
|
|
157
|
+
const lv = resolveDynamic(l, state), rv = resolveDynamic(r, state);
|
|
158
|
+
return typeof lv === "number" && typeof rv === "number" && lv > rv;
|
|
159
|
+
}
|
|
160
|
+
if ("gte" in expr) {
|
|
161
|
+
const [l, r] = expr.gte;
|
|
162
|
+
const lv = resolveDynamic(l, state), rv = resolveDynamic(r, state);
|
|
163
|
+
return typeof lv === "number" && typeof rv === "number" && lv >= rv;
|
|
164
|
+
}
|
|
165
|
+
if ("lt" in expr) {
|
|
166
|
+
const [l, r] = expr.lt;
|
|
167
|
+
const lv = resolveDynamic(l, state), rv = resolveDynamic(r, state);
|
|
168
|
+
return typeof lv === "number" && typeof rv === "number" && lv < rv;
|
|
169
|
+
}
|
|
170
|
+
if ("lte" in expr) {
|
|
171
|
+
const [l, r] = expr.lte;
|
|
172
|
+
const lv = resolveDynamic(l, state), rv = resolveDynamic(r, state);
|
|
173
|
+
return typeof lv === "number" && typeof rv === "number" && lv <= rv;
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Evaluate a full VisibilityCondition.
|
|
179
|
+
*/
|
|
180
|
+
export function evaluateVisibility(condition, state) {
|
|
181
|
+
if (condition === undefined)
|
|
182
|
+
return true;
|
|
183
|
+
if (typeof condition === "boolean")
|
|
184
|
+
return condition;
|
|
185
|
+
if ("path" in condition && !("and" in condition) && !("or" in condition)) {
|
|
186
|
+
return Boolean(getByPath(state, condition.path));
|
|
187
|
+
}
|
|
188
|
+
return evaluateLogicExpression(condition, state);
|
|
189
|
+
}
|
|
190
|
+
// ── Visibility helpers (≈ json-render visibility.*) ─────────────────────
|
|
191
|
+
export const visibility = {
|
|
192
|
+
always: true,
|
|
193
|
+
never: false,
|
|
194
|
+
when: (path) => ({ path }),
|
|
195
|
+
and: (...conditions) => ({
|
|
196
|
+
and: conditions,
|
|
197
|
+
}),
|
|
198
|
+
or: (...conditions) => ({
|
|
199
|
+
or: conditions,
|
|
200
|
+
}),
|
|
201
|
+
not: (condition) => ({ not: condition }),
|
|
202
|
+
eq: (left, right) => ({
|
|
203
|
+
eq: [left, right],
|
|
204
|
+
}),
|
|
205
|
+
neq: (left, right) => ({
|
|
206
|
+
neq: [left, right],
|
|
207
|
+
}),
|
|
208
|
+
gt: (left, right) => ({ gt: [left, right] }),
|
|
209
|
+
gte: (left, right) => ({ gte: [left, right] }),
|
|
210
|
+
lt: (left, right) => ({ lt: [left, right] }),
|
|
211
|
+
lte: (left, right) => ({ lte: [left, right] }),
|
|
212
|
+
};
|
|
213
|
+
export const builtInValidators = {
|
|
214
|
+
required: (value) => {
|
|
215
|
+
if (value == null)
|
|
216
|
+
return false;
|
|
217
|
+
if (typeof value === "string")
|
|
218
|
+
return value.trim().length > 0;
|
|
219
|
+
if (Array.isArray(value))
|
|
220
|
+
return value.length > 0;
|
|
221
|
+
return true;
|
|
222
|
+
},
|
|
223
|
+
email: (value) => typeof value === "string" &&
|
|
224
|
+
value.length <= 254 &&
|
|
225
|
+
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value),
|
|
226
|
+
minLength: (value, args) => typeof value === "string" &&
|
|
227
|
+
typeof args?.min === "number" &&
|
|
228
|
+
value.length >= args.min,
|
|
229
|
+
maxLength: (value, args) => typeof value === "string" &&
|
|
230
|
+
typeof args?.max === "number" &&
|
|
231
|
+
value.length <= args.max,
|
|
232
|
+
pattern: (value, args) => {
|
|
233
|
+
if (typeof value !== "string" || typeof args?.pattern !== "string")
|
|
234
|
+
return false;
|
|
235
|
+
try {
|
|
236
|
+
return new RegExp(args.pattern).test(value);
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
min: (value, args) => typeof value === "number" &&
|
|
243
|
+
typeof args?.min === "number" &&
|
|
244
|
+
value >= args.min,
|
|
245
|
+
max: (value, args) => typeof value === "number" &&
|
|
246
|
+
typeof args?.max === "number" &&
|
|
247
|
+
value <= args.max,
|
|
248
|
+
numeric: (value) => typeof value === "number"
|
|
249
|
+
? !Number.isNaN(value)
|
|
250
|
+
: typeof value === "string" && !Number.isNaN(parseFloat(value)),
|
|
251
|
+
url: (value) => {
|
|
252
|
+
if (typeof value !== "string")
|
|
253
|
+
return false;
|
|
254
|
+
try {
|
|
255
|
+
new URL(value);
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
matches: (value, args) => value === args?.other,
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Run validation checks for a field value.
|
|
266
|
+
*/
|
|
267
|
+
export function runValidation(config, value, state, customFunctions) {
|
|
268
|
+
const errors = [];
|
|
269
|
+
// Check if validation is enabled
|
|
270
|
+
if (config.enabled && !evaluateLogicExpression(config.enabled, state)) {
|
|
271
|
+
return { valid: true, errors: [] };
|
|
272
|
+
}
|
|
273
|
+
if (config.checks) {
|
|
274
|
+
for (const check of config.checks) {
|
|
275
|
+
// Resolve dynamic args
|
|
276
|
+
const resolvedArgs = {};
|
|
277
|
+
if (check.args) {
|
|
278
|
+
for (const [k, v] of Object.entries(check.args)) {
|
|
279
|
+
resolvedArgs[k] = resolveDynamic(v, state);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const fn = builtInValidators[check.fn] ?? customFunctions?.[check.fn];
|
|
283
|
+
if (fn && !fn(value, resolvedArgs)) {
|
|
284
|
+
errors.push(check.message);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return { valid: errors.length === 0, errors };
|
|
289
|
+
}
|
|
290
|
+
// ── Validation check helpers (≈ json-render check.*) ────────────────────
|
|
291
|
+
export const check = {
|
|
292
|
+
required: (message = "This field is required") => ({
|
|
293
|
+
fn: "required",
|
|
294
|
+
message,
|
|
295
|
+
}),
|
|
296
|
+
email: (message = "Invalid email address") => ({
|
|
297
|
+
fn: "email",
|
|
298
|
+
message,
|
|
299
|
+
}),
|
|
300
|
+
minLength: (min, message) => ({
|
|
301
|
+
fn: "minLength",
|
|
302
|
+
args: { min },
|
|
303
|
+
message: message ?? `Must be at least ${min} characters`,
|
|
304
|
+
}),
|
|
305
|
+
maxLength: (max, message) => ({
|
|
306
|
+
fn: "maxLength",
|
|
307
|
+
args: { max },
|
|
308
|
+
message: message ?? `Must be at most ${max} characters`,
|
|
309
|
+
}),
|
|
310
|
+
pattern: (pattern, message = "Invalid format") => ({
|
|
311
|
+
fn: "pattern",
|
|
312
|
+
args: { pattern },
|
|
313
|
+
message,
|
|
314
|
+
}),
|
|
315
|
+
min: (min, message) => ({
|
|
316
|
+
fn: "min",
|
|
317
|
+
args: { min },
|
|
318
|
+
message: message ?? `Must be at least ${min}`,
|
|
319
|
+
}),
|
|
320
|
+
max: (max, message) => ({
|
|
321
|
+
fn: "max",
|
|
322
|
+
args: { max },
|
|
323
|
+
message: message ?? `Must be at most ${max}`,
|
|
324
|
+
}),
|
|
325
|
+
url: (message = "Invalid URL") => ({ fn: "url", message }),
|
|
326
|
+
matches: (otherPath, message = "Fields must match") => ({
|
|
327
|
+
fn: "matches",
|
|
328
|
+
args: { other: { path: otherPath } },
|
|
329
|
+
message,
|
|
330
|
+
}),
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Create a type-safe field catalog.
|
|
334
|
+
*
|
|
335
|
+
* Equivalent to json-render's `defineCatalog(schema, config)`.
|
|
336
|
+
* Supports fields, actions, custom validation functions, and prompt generation.
|
|
337
|
+
*/
|
|
338
|
+
export function defineCatalog(fieldsOrConfig) {
|
|
339
|
+
// Support both old (fields-only) and new (full config) signatures.
|
|
340
|
+
// Old format: { text: { validator, ... }, ... } — values have "validator".
|
|
341
|
+
// New format: { fields: { text: { ... } }, actions?: { ... } } — top-level "fields" key.
|
|
342
|
+
const firstVal = Object.values(fieldsOrConfig)[0];
|
|
343
|
+
const isPlainFields = firstVal &&
|
|
344
|
+
typeof firstVal === "object" &&
|
|
345
|
+
"validator" in firstVal;
|
|
346
|
+
const config = isPlainFields
|
|
347
|
+
? { fields: fieldsOrConfig, actions: {} }
|
|
348
|
+
: fieldsOrConfig;
|
|
349
|
+
const fields = config.fields;
|
|
350
|
+
const actions = config.actions ?? {};
|
|
351
|
+
const functions = config.functions ?? {};
|
|
352
|
+
const fieldNames = Object.keys(fields);
|
|
353
|
+
const actionNames = Object.keys(actions);
|
|
354
|
+
return {
|
|
355
|
+
fields,
|
|
356
|
+
fieldNames,
|
|
357
|
+
actions,
|
|
358
|
+
actionNames,
|
|
359
|
+
functions,
|
|
360
|
+
hasField(type) {
|
|
361
|
+
return type in fields;
|
|
362
|
+
},
|
|
363
|
+
hasAction(name) {
|
|
364
|
+
return name in actions;
|
|
365
|
+
},
|
|
366
|
+
validate(type, value) {
|
|
367
|
+
const def = fields[type];
|
|
368
|
+
if (!def)
|
|
369
|
+
return {
|
|
370
|
+
success: false,
|
|
371
|
+
error: new z.ZodError([
|
|
372
|
+
{
|
|
373
|
+
code: "custom",
|
|
374
|
+
message: `Unknown field type: ${type}`,
|
|
375
|
+
path: [],
|
|
376
|
+
},
|
|
377
|
+
]),
|
|
378
|
+
};
|
|
379
|
+
return def.validator.safeParse(value);
|
|
380
|
+
},
|
|
381
|
+
resolveType(property, hint) {
|
|
382
|
+
return resolveFieldType(property, hint, fieldNames);
|
|
383
|
+
},
|
|
384
|
+
prompt() {
|
|
385
|
+
return generateCatalogPrompt(fields, actions, functions);
|
|
386
|
+
},
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
// ── Prompt generation (≈ json-render catalog.prompt()) ──────────────────
|
|
390
|
+
function generateCatalogPrompt(fields, actions, functions) {
|
|
391
|
+
const lines = [];
|
|
392
|
+
lines.push("# Plugin Configuration UI Catalog");
|
|
393
|
+
lines.push("");
|
|
394
|
+
lines.push("You are generating a plugin configuration form. Below are the available field types, actions, and validation functions.");
|
|
395
|
+
lines.push("");
|
|
396
|
+
// Field types
|
|
397
|
+
lines.push("## Field Types");
|
|
398
|
+
lines.push("");
|
|
399
|
+
for (const [name, def] of Object.entries(fields)) {
|
|
400
|
+
lines.push(`- **${name}**: ${def.description}`);
|
|
401
|
+
}
|
|
402
|
+
lines.push("");
|
|
403
|
+
// Actions
|
|
404
|
+
if (Object.keys(actions).length > 0) {
|
|
405
|
+
lines.push("## Actions");
|
|
406
|
+
lines.push("");
|
|
407
|
+
for (const [name, def] of Object.entries(actions)) {
|
|
408
|
+
lines.push(`- **${name}**: ${def.description ?? "No description"}`);
|
|
409
|
+
}
|
|
410
|
+
lines.push("");
|
|
411
|
+
}
|
|
412
|
+
// Validation functions
|
|
413
|
+
const allFunctions = { ...builtInValidators, ...functions };
|
|
414
|
+
lines.push("## Validation Functions");
|
|
415
|
+
lines.push("");
|
|
416
|
+
lines.push(`Built-in: ${Object.keys(allFunctions).join(", ")}`);
|
|
417
|
+
lines.push("");
|
|
418
|
+
// Schema format
|
|
419
|
+
lines.push("## Schema Format");
|
|
420
|
+
lines.push("");
|
|
421
|
+
lines.push("Each field is described by a JSON Schema property + ConfigUiHint:");
|
|
422
|
+
lines.push("```json");
|
|
423
|
+
lines.push(JSON.stringify({
|
|
424
|
+
FIELD_NAME: {
|
|
425
|
+
schema: { type: "string", description: "..." },
|
|
426
|
+
hint: {
|
|
427
|
+
type: "text",
|
|
428
|
+
label: "...",
|
|
429
|
+
help: "...",
|
|
430
|
+
group: "...",
|
|
431
|
+
validation: { checks: [{ fn: "required", message: "..." }] },
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
}, null, 2));
|
|
435
|
+
lines.push("```");
|
|
436
|
+
lines.push("");
|
|
437
|
+
// Visibility
|
|
438
|
+
lines.push("## Visibility Conditions");
|
|
439
|
+
lines.push("");
|
|
440
|
+
lines.push("Fields support `visible` conditions using LogicExpression:");
|
|
441
|
+
lines.push('- `{ path: "FIELD_NAME" }` — truthy check');
|
|
442
|
+
lines.push('- `{ eq: [{ path: "FIELD" }, "value"] }` — equality');
|
|
443
|
+
lines.push("- `{ and: [...] }`, `{ or: [...] }`, `{ not: {...} }` — logical operators");
|
|
444
|
+
lines.push("- `{ gt, gte, lt, lte }` — numeric comparisons");
|
|
445
|
+
return lines.join("\n");
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Create a field registry that maps catalog field types to render functions.
|
|
449
|
+
*
|
|
450
|
+
* Equivalent to json-render's `defineRegistry(catalog, { components, actions })`.
|
|
451
|
+
*/
|
|
452
|
+
export function defineRegistry(catalog, renderers, actionHandlers) {
|
|
453
|
+
const rendererMap = renderers;
|
|
454
|
+
const handlerMap = (actionHandlers ?? {});
|
|
455
|
+
return {
|
|
456
|
+
catalog,
|
|
457
|
+
renderers: rendererMap,
|
|
458
|
+
actionHandlers: handlerMap,
|
|
459
|
+
resolve(type) {
|
|
460
|
+
return rendererMap[type];
|
|
461
|
+
},
|
|
462
|
+
resolveOrFallback(type) {
|
|
463
|
+
return rendererMap[type] ?? rendererMap.text;
|
|
464
|
+
},
|
|
465
|
+
resolveAction(name) {
|
|
466
|
+
return handlerMap[name];
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
// ── Field type resolution ──────────────────────────────────────────────
|
|
471
|
+
/**
|
|
472
|
+
* Resolve a JSON Schema property + ConfigUiHint to a field type name.
|
|
473
|
+
*
|
|
474
|
+
* Priority order:
|
|
475
|
+
* 1. Explicit hint.type override (if it's a known type)
|
|
476
|
+
* 2. hint.sensitive → "password"
|
|
477
|
+
* 3. Schema enum/options → "select"
|
|
478
|
+
* 4. Schema type + format heuristics
|
|
479
|
+
* 5. Fallback → "text"
|
|
480
|
+
*/
|
|
481
|
+
function resolveFieldType(property, hint, knownTypes) {
|
|
482
|
+
const knownSet = new Set(knownTypes);
|
|
483
|
+
// 1. Explicit type override from hint
|
|
484
|
+
const hintType = hint?.type;
|
|
485
|
+
if (hintType && knownSet.has(hintType))
|
|
486
|
+
return hintType;
|
|
487
|
+
// 2. Sensitive → password
|
|
488
|
+
if (hint?.sensitive)
|
|
489
|
+
return knownSet.has("password") ? "password" : "text";
|
|
490
|
+
// 3. Enum → select
|
|
491
|
+
if (property.enum?.length || property.oneOf?.length) {
|
|
492
|
+
return knownSet.has("select") ? "select" : "text";
|
|
493
|
+
}
|
|
494
|
+
// 4. Schema type + format
|
|
495
|
+
const schemaType = Array.isArray(property.type)
|
|
496
|
+
? property.type[0]
|
|
497
|
+
: property.type;
|
|
498
|
+
switch (schemaType) {
|
|
499
|
+
case "boolean":
|
|
500
|
+
return knownSet.has("boolean") ? "boolean" : "text";
|
|
501
|
+
case "number":
|
|
502
|
+
case "integer":
|
|
503
|
+
return knownSet.has("number") ? "number" : "text";
|
|
504
|
+
case "array":
|
|
505
|
+
if (property.items?.enum && knownSet.has("multiselect"))
|
|
506
|
+
return "multiselect";
|
|
507
|
+
return knownSet.has("array") ? "array" : "text";
|
|
508
|
+
case "object":
|
|
509
|
+
if (property.additionalProperties && knownSet.has("keyvalue"))
|
|
510
|
+
return "keyvalue";
|
|
511
|
+
return knownSet.has("json") ? "json" : "text";
|
|
512
|
+
default:
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
// String format heuristics
|
|
516
|
+
if (schemaType === "string" || !schemaType) {
|
|
517
|
+
const fmt = property.format;
|
|
518
|
+
if (fmt === "uri" || fmt === "url")
|
|
519
|
+
return knownSet.has("url") ? "url" : "text";
|
|
520
|
+
if (fmt === "email")
|
|
521
|
+
return knownSet.has("email") ? "email" : "text";
|
|
522
|
+
if (fmt === "date-time")
|
|
523
|
+
return knownSet.has("datetime")
|
|
524
|
+
? "datetime"
|
|
525
|
+
: knownSet.has("date")
|
|
526
|
+
? "date"
|
|
527
|
+
: "text";
|
|
528
|
+
if (fmt === "date")
|
|
529
|
+
return knownSet.has("date") ? "date" : "text";
|
|
530
|
+
if (fmt === "color")
|
|
531
|
+
return knownSet.has("color") ? "color" : "text";
|
|
532
|
+
// Multiline heuristic: maxLength > 200 or no maxLength with "text" hint
|
|
533
|
+
if (property.maxLength && property.maxLength > 200) {
|
|
534
|
+
return knownSet.has("textarea") ? "textarea" : "text";
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
// 5. Fallback
|
|
538
|
+
return "text";
|
|
539
|
+
}
|
|
540
|
+
// ── Default catalog ────────────────────────────────────────────────────
|
|
541
|
+
/**
|
|
542
|
+
* The standard field catalog with 23 basic field types + built-in actions.
|
|
543
|
+
*/
|
|
544
|
+
export const defaultCatalog = defineCatalog({
|
|
545
|
+
fields: {
|
|
546
|
+
text: {
|
|
547
|
+
validator: z.string(),
|
|
548
|
+
description: "Single-line text input",
|
|
549
|
+
},
|
|
550
|
+
password: {
|
|
551
|
+
validator: z.string(),
|
|
552
|
+
description: "Masked input with show/hide toggle and API-backed reveal",
|
|
553
|
+
},
|
|
554
|
+
number: {
|
|
555
|
+
validator: z.coerce.number(),
|
|
556
|
+
description: "Numeric input with optional min/max/step",
|
|
557
|
+
},
|
|
558
|
+
boolean: {
|
|
559
|
+
validator: z.coerce.boolean(),
|
|
560
|
+
description: "Toggle switch (on/off)",
|
|
561
|
+
},
|
|
562
|
+
url: {
|
|
563
|
+
validator: z.string(),
|
|
564
|
+
description: "URL input with validation",
|
|
565
|
+
},
|
|
566
|
+
select: {
|
|
567
|
+
validator: z.string(),
|
|
568
|
+
description: "Single-select dropdown from enum values",
|
|
569
|
+
},
|
|
570
|
+
textarea: {
|
|
571
|
+
validator: z.string(),
|
|
572
|
+
description: "Multi-line text input for long values",
|
|
573
|
+
},
|
|
574
|
+
email: {
|
|
575
|
+
validator: z.string().email().or(z.literal("")),
|
|
576
|
+
description: "Email address input with validation",
|
|
577
|
+
},
|
|
578
|
+
color: {
|
|
579
|
+
validator: z
|
|
580
|
+
.string()
|
|
581
|
+
.regex(/^#[0-9a-fA-F]{3,8}$/)
|
|
582
|
+
.or(z.literal("")),
|
|
583
|
+
description: "Color picker with hex value display",
|
|
584
|
+
},
|
|
585
|
+
radio: {
|
|
586
|
+
validator: z.string(),
|
|
587
|
+
description: "Single-select radio button group with descriptions",
|
|
588
|
+
},
|
|
589
|
+
multiselect: {
|
|
590
|
+
validator: z.array(z.string()).or(z.string()),
|
|
591
|
+
description: "Multi-select checkbox group for array values",
|
|
592
|
+
},
|
|
593
|
+
date: {
|
|
594
|
+
validator: z.string(),
|
|
595
|
+
description: "Date or date-time input",
|
|
596
|
+
},
|
|
597
|
+
json: {
|
|
598
|
+
validator: z.string(),
|
|
599
|
+
description: "JSON editor with syntax highlighting and validation",
|
|
600
|
+
},
|
|
601
|
+
code: {
|
|
602
|
+
validator: z.string(),
|
|
603
|
+
description: "Code editor with syntax highlighting",
|
|
604
|
+
},
|
|
605
|
+
array: {
|
|
606
|
+
validator: z.array(z.unknown()),
|
|
607
|
+
description: "Repeatable field group with add/remove items",
|
|
608
|
+
},
|
|
609
|
+
keyvalue: {
|
|
610
|
+
validator: z.record(z.string(), z.string()),
|
|
611
|
+
description: "Key-value pair editor with add/remove rows",
|
|
612
|
+
},
|
|
613
|
+
datetime: {
|
|
614
|
+
validator: z.string(),
|
|
615
|
+
description: "Date and time picker input",
|
|
616
|
+
},
|
|
617
|
+
file: {
|
|
618
|
+
validator: z.string(),
|
|
619
|
+
description: "File path or upload input",
|
|
620
|
+
},
|
|
621
|
+
custom: {
|
|
622
|
+
validator: z.unknown(),
|
|
623
|
+
description: "Plugin-provided custom React component",
|
|
624
|
+
},
|
|
625
|
+
markdown: {
|
|
626
|
+
validator: z.string(),
|
|
627
|
+
description: "Markdown editor with preview toggle",
|
|
628
|
+
},
|
|
629
|
+
"checkbox-group": {
|
|
630
|
+
validator: z.array(z.string()).or(z.string()),
|
|
631
|
+
description: "Checkbox group for multiple selections with descriptions",
|
|
632
|
+
},
|
|
633
|
+
group: {
|
|
634
|
+
validator: z.record(z.string(), z.unknown()).or(z.string()),
|
|
635
|
+
description: "Fieldset container for grouping related configuration",
|
|
636
|
+
},
|
|
637
|
+
table: {
|
|
638
|
+
validator: z.array(z.record(z.string(), z.string())).or(z.string()),
|
|
639
|
+
description: "Tabular data editor with add/remove rows",
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
actions: {
|
|
643
|
+
save: {
|
|
644
|
+
params: z.object({}),
|
|
645
|
+
description: "Save the current configuration",
|
|
646
|
+
},
|
|
647
|
+
reset: {
|
|
648
|
+
params: z.object({}),
|
|
649
|
+
description: "Reset all fields to their defaults",
|
|
650
|
+
},
|
|
651
|
+
testConnection: {
|
|
652
|
+
params: z.object({ key: z.string().optional() }),
|
|
653
|
+
description: "Test the connection/API key validity",
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
});
|
|
657
|
+
/**
|
|
658
|
+
* Walk a JSON Schema object's properties and resolve each to a field descriptor.
|
|
659
|
+
*
|
|
660
|
+
* This is the equivalent of json-render's spec traversal — it turns a declarative
|
|
661
|
+
* schema into an ordered list of renderable field descriptors.
|
|
662
|
+
*/
|
|
663
|
+
export function resolveFields(schema, hints, catalog) {
|
|
664
|
+
const properties = schema.properties ?? {};
|
|
665
|
+
const requiredKeys = new Set(schema.required ?? []);
|
|
666
|
+
const fields = [];
|
|
667
|
+
// Field types that are compact enough for half-width columns
|
|
668
|
+
const HALF_WIDTH_TYPES = new Set([
|
|
669
|
+
"text",
|
|
670
|
+
"password",
|
|
671
|
+
"number",
|
|
672
|
+
"url",
|
|
673
|
+
"email",
|
|
674
|
+
"boolean",
|
|
675
|
+
"select",
|
|
676
|
+
"date",
|
|
677
|
+
"datetime",
|
|
678
|
+
"color",
|
|
679
|
+
"file",
|
|
680
|
+
]);
|
|
681
|
+
for (const [key, prop] of Object.entries(properties)) {
|
|
682
|
+
const hint = hints[key] ?? {};
|
|
683
|
+
const fieldType = catalog.resolveType(prop, hint);
|
|
684
|
+
fields.push({
|
|
685
|
+
key,
|
|
686
|
+
schema: prop,
|
|
687
|
+
hint,
|
|
688
|
+
fieldType,
|
|
689
|
+
required: requiredKeys.has(key),
|
|
690
|
+
group: hint.group ?? "general",
|
|
691
|
+
order: hint.order ?? 999,
|
|
692
|
+
advanced: hint.advanced ?? false,
|
|
693
|
+
hidden: hint.hidden ?? false,
|
|
694
|
+
width: hint.width ?? (HALF_WIDTH_TYPES.has(fieldType) ? "half" : "full"),
|
|
695
|
+
visible: hint.visible,
|
|
696
|
+
validation: hint.validation,
|
|
697
|
+
readonly: hint.readonly ?? false,
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
// Sort: non-advanced before advanced, then by order, then alphabetically
|
|
701
|
+
fields.sort((a, b) => {
|
|
702
|
+
if (a.advanced !== b.advanced)
|
|
703
|
+
return a.advanced ? 1 : -1;
|
|
704
|
+
if (a.order !== b.order)
|
|
705
|
+
return a.order - b.order;
|
|
706
|
+
return a.key.localeCompare(b.key);
|
|
707
|
+
});
|
|
708
|
+
return fields;
|
|
709
|
+
}
|
|
710
|
+
//# sourceMappingURL=config-catalog.js.map
|