@elizaos/shared 2.0.0-alpha.538 → 2.0.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/agent-api-types.d.ts +210 -0
- package/api/agent-api-types.d.ts.map +1 -0
- package/api/agent-api-types.js +11 -0
- package/api/agent-api-types.js.map +1 -0
- package/api/http-helpers.d.ts +3 -0
- package/api/http-helpers.d.ts.map +1 -0
- package/api/http-helpers.js +2 -0
- package/api/http-helpers.js.map +1 -0
- package/api/route-helpers.d.ts +2 -0
- package/api/route-helpers.d.ts.map +1 -0
- package/api/route-helpers.js +2 -0
- package/api/route-helpers.js.map +1 -0
- package/app-hero-art.d.ts.map +1 -1
- package/app-hero-art.js +5 -13
- package/app-hero-art.js.map +1 -1
- package/brand/index.d.ts +130 -0
- package/brand/index.d.ts.map +1 -0
- package/brand/index.js +126 -0
- package/brand/index.js.map +1 -0
- package/brand-classic/index.d.ts +158 -0
- package/brand-classic/index.d.ts.map +1 -0
- package/brand-classic/index.js +91 -0
- package/brand-classic/index.js.map +1 -0
- package/character-language.d.ts +16 -0
- package/character-language.d.ts.map +1 -0
- package/character-language.js +58 -0
- package/character-language.js.map +1 -0
- package/{onboarding-presets.characters.d.ts → character-presets.characters.d.ts} +2 -2
- package/character-presets.characters.d.ts.map +1 -0
- package/{onboarding-presets.characters.js → character-presets.characters.js} +1 -1
- package/character-presets.characters.js.map +1 -0
- package/{onboarding-presets.d.ts → character-presets.d.ts} +7 -5
- package/character-presets.d.ts.map +1 -0
- package/{onboarding-presets.js → character-presets.js} +53 -58
- package/character-presets.js.map +1 -0
- package/{onboarding-presets.shared.d.ts → character-presets.shared.d.ts} +1 -1
- package/character-presets.shared.d.ts.map +1 -0
- package/{onboarding-presets.shared.js → character-presets.shared.js} +1 -1
- package/character-presets.shared.js.map +1 -0
- package/checkout/index.d.ts +48 -0
- package/checkout/index.d.ts.map +1 -0
- package/checkout/index.js +59 -0
- package/checkout/index.js.map +1 -0
- package/cli/parse-duration.d.ts +5 -0
- package/cli/parse-duration.d.ts.map +1 -0
- package/cli/parse-duration.js +26 -0
- package/cli/parse-duration.js.map +1 -0
- package/config/allowed-hosts.d.ts +8 -0
- package/config/allowed-hosts.d.ts.map +1 -0
- package/config/allowed-hosts.js +44 -0
- package/config/allowed-hosts.js.map +1 -0
- package/config/api-key-prefix-hints.d.ts +24 -0
- package/config/api-key-prefix-hints.d.ts.map +1 -0
- package/config/api-key-prefix-hints.js +26 -0
- package/config/api-key-prefix-hints.js.map +1 -0
- package/config/app-config.d.ts +274 -0
- package/config/app-config.d.ts.map +1 -0
- package/config/app-config.js +64 -0
- package/config/app-config.js.map +1 -0
- package/config/app-manifest.d.ts +75 -0
- package/config/app-manifest.d.ts.map +1 -0
- package/config/app-manifest.js +115 -0
- package/config/app-manifest.js.map +1 -0
- package/config/boot-config-store.d.ts +74 -0
- package/config/boot-config-store.d.ts.map +1 -0
- package/config/boot-config-store.js +121 -0
- package/config/boot-config-store.js.map +1 -0
- package/config/boot-config.d.ts +6 -0
- package/config/boot-config.d.ts.map +1 -0
- package/config/boot-config.js +6 -0
- package/config/boot-config.js.map +1 -0
- package/config/branding.d.ts +53 -0
- package/config/branding.d.ts.map +1 -0
- package/config/branding.js +23 -0
- package/config/branding.js.map +1 -0
- package/config/cloud-only.d.ts +8 -0
- package/config/cloud-only.d.ts.map +1 -0
- package/config/cloud-only.js +26 -0
- package/config/cloud-only.js.map +1 -0
- package/config/config-catalog.d.ts +371 -0
- package/config/config-catalog.d.ts.map +1 -0
- package/config/config-catalog.js +719 -0
- package/config/config-catalog.js.map +1 -0
- package/config/config-paths.d.ts +11 -0
- package/config/config-paths.d.ts.map +1 -0
- package/config/config-paths.js +74 -0
- package/config/config-paths.js.map +1 -0
- package/config/config.d.ts +11 -0
- package/config/config.d.ts.map +1 -0
- package/config/config.js +23 -0
- package/config/config.js.map +1 -0
- package/config/distribution-profile.d.ts +16 -0
- package/config/distribution-profile.d.ts.map +1 -0
- package/config/distribution-profile.js +29 -0
- package/config/distribution-profile.js.map +1 -0
- package/config/env-vars.d.ts +2 -0
- package/config/env-vars.d.ts.map +1 -0
- package/config/env-vars.js +2 -0
- package/config/env-vars.js.map +1 -0
- package/config/index.d.ts +12 -0
- package/config/index.d.ts.map +1 -0
- package/config/index.js +15 -0
- package/config/index.js.map +1 -0
- package/config/plugin-auto-enable-engine.d.ts +4 -0
- package/config/plugin-auto-enable-engine.d.ts.map +1 -0
- package/config/plugin-auto-enable-engine.js +45 -0
- package/config/plugin-auto-enable-engine.js.map +1 -0
- package/config/plugin-auto-enable.d.ts +2 -0
- package/config/plugin-auto-enable.d.ts.map +1 -0
- package/config/plugin-auto-enable.js +8 -0
- package/config/plugin-auto-enable.js.map +1 -0
- package/config/plugin-manifest.d.ts +89 -0
- package/config/plugin-manifest.d.ts.map +1 -0
- package/config/plugin-manifest.js +281 -0
- package/config/plugin-manifest.js.map +1 -0
- package/config/plugin-ui-spec.d.ts +42 -0
- package/config/plugin-ui-spec.d.ts.map +1 -0
- package/config/plugin-ui-spec.js +257 -0
- package/config/plugin-ui-spec.js.map +1 -0
- package/config/runtime-mode.d.ts +54 -0
- package/config/runtime-mode.d.ts.map +1 -0
- package/config/runtime-mode.js +107 -0
- package/config/runtime-mode.js.map +1 -0
- package/config/runtime-overrides.d.ts +16 -0
- package/config/runtime-overrides.d.ts.map +1 -0
- package/config/runtime-overrides.js +49 -0
- package/config/runtime-overrides.js.map +1 -0
- package/config/schema.d.ts +7 -0
- package/config/schema.d.ts.map +1 -0
- package/config/schema.js +30 -0
- package/config/schema.js.map +1 -0
- package/config/types.agent-defaults.d.ts +6 -1
- package/config/types.agent-defaults.d.ts.map +1 -1
- package/config/types.agents.d.ts +9 -4
- package/config/types.agents.d.ts.map +1 -1
- package/config/types.eliza.d.ts +27 -49
- package/config/types.eliza.d.ts.map +1 -1
- package/config/types.messages.d.ts +2 -2
- package/config/types.messages.d.ts.map +1 -1
- package/config/types.tools.d.ts +2 -2
- package/config/types.tools.d.ts.map +1 -1
- package/config/ui-spec.d.ts +164 -0
- package/config/ui-spec.d.ts.map +1 -0
- package/config/ui-spec.js +14 -0
- package/config/ui-spec.js.map +1 -0
- package/config/wechat-config.d.ts +2 -0
- package/config/wechat-config.d.ts.map +1 -0
- package/config/wechat-config.js +2 -0
- package/config/wechat-config.js.map +1 -0
- package/config/zod-schema.agent-runtime.d.ts +1087 -0
- package/config/zod-schema.agent-runtime.d.ts.map +1 -0
- package/config/zod-schema.agent-runtime.js +764 -0
- package/config/zod-schema.agent-runtime.js.map +1 -0
- package/config/zod-schema.core.d.ts +1048 -0
- package/config/zod-schema.core.d.ts.map +1 -0
- package/config/zod-schema.core.js +707 -0
- package/config/zod-schema.core.js.map +1 -0
- package/connector-cred-types.d.ts +3 -3
- package/connector-cred-types.js +4 -4
- package/connectors.d.ts +0 -8
- package/connectors.d.ts.map +1 -1
- package/connectors.js +26 -50
- package/connectors.js.map +1 -1
- package/contracts/agent-routes.d.ts +63 -0
- package/contracts/agent-routes.d.ts.map +1 -0
- package/contracts/agent-routes.js +55 -0
- package/contracts/agent-routes.js.map +1 -0
- package/contracts/app-permissions-routes.d.ts +148 -0
- package/contracts/app-permissions-routes.d.ts.map +1 -0
- package/contracts/app-permissions-routes.js +96 -0
- package/contracts/app-permissions-routes.js.map +1 -0
- package/contracts/app-permissions.d.ts +122 -0
- package/contracts/app-permissions.d.ts.map +1 -0
- package/contracts/app-permissions.js +163 -0
- package/contracts/app-permissions.js.map +1 -0
- package/contracts/apps-favorites-routes.d.ts +44 -0
- package/contracts/apps-favorites-routes.d.ts.map +1 -0
- package/contracts/apps-favorites-routes.js +48 -0
- package/contracts/apps-favorites-routes.js.map +1 -0
- package/contracts/apps-lifecycle-routes.d.ts +185 -0
- package/contracts/apps-lifecycle-routes.d.ts.map +1 -0
- package/contracts/apps-lifecycle-routes.js +204 -0
- package/contracts/apps-lifecycle-routes.js.map +1 -0
- package/contracts/apps-loading-routes.d.ts +64 -0
- package/contracts/apps-loading-routes.d.ts.map +1 -0
- package/contracts/apps-loading-routes.js +65 -0
- package/contracts/apps-loading-routes.js.map +1 -0
- package/contracts/apps-runs-routes.d.ts +33 -0
- package/contracts/apps-runs-routes.d.ts.map +1 -0
- package/contracts/apps-runs-routes.js +38 -0
- package/contracts/apps-runs-routes.js.map +1 -0
- package/contracts/apps.d.ts +883 -3
- package/contracts/apps.d.ts.map +1 -1
- package/contracts/apps.js +278 -40
- package/contracts/apps.js.map +1 -1
- package/contracts/auth-routes.d.ts +23 -0
- package/contracts/auth-routes.d.ts.map +1 -0
- package/contracts/auth-routes.js +25 -0
- package/contracts/auth-routes.js.map +1 -0
- package/contracts/awareness.d.ts +1 -1
- package/contracts/calendar.d.ts +181 -0
- package/contracts/calendar.d.ts.map +1 -0
- package/contracts/calendar.js +19 -0
- package/contracts/calendar.js.map +1 -0
- package/contracts/character-routes.d.ts +70 -0
- package/contracts/character-routes.d.ts.map +1 -0
- package/contracts/character-routes.js +49 -0
- package/contracts/character-routes.js.map +1 -0
- package/contracts/cloud-coding-containers.d.ts +432 -0
- package/contracts/cloud-coding-containers.d.ts.map +1 -0
- package/contracts/cloud-coding-containers.js +135 -0
- package/contracts/cloud-coding-containers.js.map +1 -0
- package/contracts/cloud-topology.js +7 -7
- package/contracts/cloud-topology.js.map +1 -1
- package/contracts/config.d.ts +52 -4
- package/contracts/config.d.ts.map +1 -1
- package/contracts/connector-routes.d.ts +39 -0
- package/contracts/connector-routes.d.ts.map +1 -0
- package/contracts/connector-routes.js +50 -0
- package/contracts/connector-routes.js.map +1 -0
- package/contracts/content-pack.d.ts +2 -2
- package/contracts/content-pack.d.ts.map +1 -1
- package/contracts/content-pack.js +1 -1
- package/contracts/conversation-routes.d.ts +195 -0
- package/contracts/conversation-routes.d.ts.map +1 -0
- package/contracts/conversation-routes.js +107 -0
- package/contracts/conversation-routes.js.map +1 -0
- package/contracts/diagnostics-routes.d.ts +33 -0
- package/contracts/diagnostics-routes.d.ts.map +1 -0
- package/contracts/diagnostics-routes.js +26 -0
- package/contracts/diagnostics-routes.js.map +1 -0
- package/contracts/feature-result.d.ts +24 -0
- package/contracts/feature-result.d.ts.map +1 -0
- package/contracts/feature-result.js +7 -0
- package/contracts/feature-result.js.map +1 -0
- package/contracts/{onboarding.d.ts → first-run-options.d.ts} +172 -69
- package/contracts/first-run-options.d.ts.map +1 -0
- package/contracts/{onboarding.js → first-run-options.js} +222 -91
- package/contracts/first-run-options.js.map +1 -0
- package/contracts/first-run-routes.d.ts +167 -0
- package/contracts/first-run-routes.d.ts.map +1 -0
- package/contracts/first-run-routes.js +115 -0
- package/contracts/first-run-routes.js.map +1 -0
- package/contracts/health.d.ts +30 -0
- package/contracts/health.d.ts.map +1 -0
- package/contracts/health.js +29 -0
- package/contracts/health.js.map +1 -0
- package/contracts/inbox-routes.d.ts +37 -0
- package/contracts/inbox-routes.d.ts.map +1 -0
- package/contracts/inbox-routes.js +44 -0
- package/contracts/inbox-routes.js.map +1 -0
- package/contracts/index.d.ts +30 -3
- package/contracts/index.d.ts.map +1 -1
- package/contracts/index.js +30 -3
- package/contracts/index.js.map +1 -1
- package/contracts/memory-routes.d.ts +27 -0
- package/contracts/memory-routes.d.ts.map +1 -0
- package/contracts/memory-routes.js +23 -0
- package/contracts/memory-routes.js.map +1 -0
- package/contracts/misc-routes.d.ts +192 -0
- package/contracts/misc-routes.d.ts.map +1 -0
- package/contracts/misc-routes.js +155 -0
- package/contracts/misc-routes.js.map +1 -0
- package/contracts/permissions-routes.d.ts +31 -0
- package/contracts/permissions-routes.d.ts.map +1 -0
- package/contracts/permissions-routes.js +34 -0
- package/contracts/permissions-routes.js.map +1 -0
- package/contracts/permissions.d.ts +81 -11
- package/contracts/permissions.d.ts.map +1 -1
- package/contracts/permissions.js +37 -1
- package/contracts/permissions.js.map +1 -1
- package/contracts/{lifeops.d.ts → personal-assistant.d.ts} +368 -170
- package/contracts/personal-assistant.d.ts.map +1 -0
- package/contracts/{lifeops.js → personal-assistant.js} +39 -13
- package/contracts/personal-assistant.js.map +1 -0
- package/contracts/plugin-routes.d.ts +105 -0
- package/contracts/plugin-routes.d.ts.map +1 -0
- package/contracts/plugin-routes.js +81 -0
- package/contracts/plugin-routes.js.map +1 -0
- package/contracts/relationships-routes.d.ts +23 -0
- package/contracts/relationships-routes.d.ts.map +1 -0
- package/contracts/relationships-routes.js +22 -0
- package/contracts/relationships-routes.js.map +1 -0
- package/contracts/service-routing.d.ts +7 -121
- package/contracts/service-routing.d.ts.map +1 -1
- package/contracts/service-routing.js +19 -12
- package/contracts/service-routing.js.map +1 -1
- package/contracts/skills-routes.d.ts +116 -0
- package/contracts/skills-routes.d.ts.map +1 -0
- package/contracts/skills-routes.js +115 -0
- package/contracts/skills-routes.js.map +1 -0
- package/contracts/subscription-routes.d.ts +47 -0
- package/contracts/subscription-routes.d.ts.map +1 -0
- package/contracts/subscription-routes.js +50 -0
- package/contracts/subscription-routes.js.map +1 -0
- package/contracts/tail-routes.d.ts +78 -0
- package/contracts/tail-routes.d.ts.map +1 -0
- package/contracts/tail-routes.js +63 -0
- package/contracts/tail-routes.js.map +1 -0
- package/contracts/theme.d.ts +0 -2
- package/contracts/theme.d.ts.map +1 -1
- package/contracts/theme.js +0 -2
- package/contracts/theme.js.map +1 -1
- package/contracts/update-status.d.ts +100 -0
- package/contracts/update-status.d.ts.map +1 -0
- package/contracts/update-status.js +45 -0
- package/contracts/update-status.js.map +1 -0
- package/contracts/wallet-routes.d.ts +82 -0
- package/contracts/wallet-routes.d.ts.map +1 -0
- package/contracts/wallet-routes.js +49 -0
- package/contracts/wallet-routes.js.map +1 -0
- package/contracts/wallet.d.ts +12 -570
- package/contracts/wallet.d.ts.map +1 -1
- package/contracts/wallet.js +139 -0
- package/contracts/wallet.js.map +1 -1
- package/contracts/workbench-routes.d.ts +231 -0
- package/contracts/workbench-routes.d.ts.map +1 -0
- package/contracts/workbench-routes.js +183 -0
- package/contracts/workbench-routes.js.map +1 -0
- package/db/drizzle-database.d.ts +13 -0
- package/db/drizzle-database.d.ts.map +1 -0
- package/db/drizzle-database.js +2 -0
- package/db/drizzle-database.js.map +1 -0
- package/dev-settings-banner-style.d.ts +1 -1
- package/dev-settings-banner-style.js +2 -2
- package/dev-settings-banner-style.js.map +1 -1
- package/dev-settings-figlet-heading.d.ts.map +1 -1
- package/dev-settings-figlet-heading.js +1 -8
- package/dev-settings-figlet-heading.js.map +1 -1
- package/elizacloud/base-url.d.ts +6 -0
- package/elizacloud/base-url.d.ts.map +1 -0
- package/elizacloud/base-url.js +65 -0
- package/elizacloud/base-url.js.map +1 -0
- package/elizacloud/cloud-provisioning.d.ts +9 -0
- package/elizacloud/cloud-provisioning.d.ts.map +1 -0
- package/elizacloud/cloud-provisioning.js +25 -0
- package/elizacloud/cloud-provisioning.js.map +1 -0
- package/elizacloud/cloud-secrets.d.ts +23 -0
- package/elizacloud/cloud-secrets.d.ts.map +1 -0
- package/elizacloud/cloud-secrets.js +51 -0
- package/elizacloud/cloud-secrets.js.map +1 -0
- package/elizacloud/index.d.ts +6 -0
- package/elizacloud/index.d.ts.map +1 -0
- package/elizacloud/index.js +6 -0
- package/elizacloud/index.js.map +1 -0
- package/elizacloud/is-cloud-reachable.d.ts +19 -0
- package/elizacloud/is-cloud-reachable.d.ts.map +1 -0
- package/elizacloud/is-cloud-reachable.js +44 -0
- package/elizacloud/is-cloud-reachable.js.map +1 -0
- package/elizacloud/server-cloud-tts.d.ts +21 -0
- package/elizacloud/server-cloud-tts.d.ts.map +1 -0
- package/elizacloud/server-cloud-tts.js +293 -0
- package/elizacloud/server-cloud-tts.js.map +1 -0
- package/email-classification/email-classifier.d.ts +57 -0
- package/email-classification/email-classifier.d.ts.map +1 -0
- package/email-classification/email-classifier.js +348 -0
- package/email-classification/email-classifier.js.map +1 -0
- package/email-classification/index.d.ts +12 -0
- package/email-classification/index.d.ts.map +1 -0
- package/email-classification/index.js +12 -0
- package/email-classification/index.js.map +1 -0
- package/email-classification/wrap-untrusted-email-content.d.ts +15 -0
- package/email-classification/wrap-untrusted-email-content.d.ts.map +1 -0
- package/email-classification/wrap-untrusted-email-content.js +24 -0
- package/email-classification/wrap-untrusted-email-content.js.map +1 -0
- package/env-utils.d.ts +1 -4
- package/env-utils.d.ts.map +1 -1
- package/env-utils.js +9 -1
- package/env-utils.js.map +1 -1
- package/events/index.d.ts +68 -0
- package/events/index.d.ts.map +1 -0
- package/events/index.js +53 -0
- package/events/index.js.map +1 -0
- package/hardware-catalog/index.d.ts +204 -0
- package/hardware-catalog/index.d.ts.map +1 -0
- package/hardware-catalog/index.js +174 -0
- package/hardware-catalog/index.js.map +1 -0
- package/i18n/generated/validation-keyword-data.d.ts +2711 -748
- package/i18n/generated/validation-keyword-data.d.ts.map +1 -1
- package/i18n/generated/validation-keyword-data.js +2711 -748
- package/i18n/generated/validation-keyword-data.js.map +1 -1
- package/i18n/keyword-matching.d.ts.map +1 -1
- package/i18n/keyword-matching.js +4 -1
- package/i18n/keyword-matching.js.map +1 -1
- package/index.d.ts +82 -7
- package/index.d.ts.map +1 -1
- package/index.js +109 -13
- package/index.js.map +1 -1
- package/knowledge-graph/entity-types.d.ts +135 -0
- package/knowledge-graph/entity-types.d.ts.map +1 -0
- package/knowledge-graph/entity-types.js +75 -0
- package/knowledge-graph/entity-types.js.map +1 -0
- package/knowledge-graph/index.d.ts +13 -0
- package/knowledge-graph/index.d.ts.map +1 -0
- package/knowledge-graph/index.js +13 -0
- package/knowledge-graph/index.js.map +1 -0
- package/knowledge-graph/merge.d.ts +76 -0
- package/knowledge-graph/merge.d.ts.map +1 -0
- package/knowledge-graph/merge.js +175 -0
- package/knowledge-graph/merge.js.map +1 -0
- package/knowledge-graph/relationship-types.d.ts +105 -0
- package/knowledge-graph/relationship-types.d.ts.map +1 -0
- package/knowledge-graph/relationship-types.js +114 -0
- package/knowledge-graph/relationship-types.js.map +1 -0
- package/lifeops-constants/index.d.ts +9 -0
- package/lifeops-constants/index.d.ts.map +1 -0
- package/lifeops-constants/index.js +9 -0
- package/lifeops-constants/index.js.map +1 -0
- package/lifeops-constants/service-constants.d.ts +79 -0
- package/lifeops-constants/service-constants.d.ts.map +1 -0
- package/lifeops-constants/service-constants.js +123 -0
- package/lifeops-constants/service-constants.js.map +1 -0
- package/lifeops-normalize/index.d.ts +12 -0
- package/lifeops-normalize/index.d.ts.map +1 -0
- package/lifeops-normalize/index.js +12 -0
- package/lifeops-normalize/index.js.map +1 -0
- package/lifeops-normalize/service-error.d.ts +14 -0
- package/lifeops-normalize/service-error.d.ts.map +1 -0
- package/lifeops-normalize/service-error.js +19 -0
- package/lifeops-normalize/service-error.js.map +1 -0
- package/lifeops-normalize/service-normalize.d.ts +38 -0
- package/lifeops-normalize/service-normalize.d.ts.map +1 -0
- package/lifeops-normalize/service-normalize.js +205 -0
- package/lifeops-normalize/service-normalize.js.map +1 -0
- package/lifeops-normalize/time-zone.d.ts +12 -0
- package/lifeops-normalize/time-zone.d.ts.map +1 -0
- package/lifeops-normalize/time-zone.js +29 -0
- package/lifeops-normalize/time-zone.js.map +1 -0
- package/local-inference/catalog.d.ts +97 -0
- package/local-inference/catalog.d.ts.map +1 -0
- package/local-inference/catalog.js +510 -0
- package/local-inference/catalog.js.map +1 -0
- package/local-inference/gpu-profiles.d.ts +110 -0
- package/local-inference/gpu-profiles.d.ts.map +1 -0
- package/local-inference/gpu-profiles.js +191 -0
- package/local-inference/gpu-profiles.js.map +1 -0
- package/local-inference/index.d.ts +21 -0
- package/local-inference/index.d.ts.map +1 -0
- package/local-inference/index.js +18 -0
- package/local-inference/index.js.map +1 -0
- package/local-inference/manifest-signature.d.ts +61 -0
- package/local-inference/manifest-signature.d.ts.map +1 -0
- package/local-inference/manifest-signature.js +129 -0
- package/local-inference/manifest-signature.js.map +1 -0
- package/local-inference/network-policy.d.ts +115 -0
- package/local-inference/network-policy.d.ts.map +1 -0
- package/local-inference/network-policy.js +154 -0
- package/local-inference/network-policy.js.map +1 -0
- package/local-inference/paths.d.ts +24 -0
- package/local-inference/paths.d.ts.map +1 -0
- package/local-inference/paths.js +40 -0
- package/local-inference/paths.js.map +1 -0
- package/local-inference/providers-types.d.ts +56 -0
- package/local-inference/providers-types.d.ts.map +1 -0
- package/local-inference/providers-types.js +19 -0
- package/local-inference/providers-types.js.map +1 -0
- package/local-inference/routing-preferences.d.ts +38 -0
- package/local-inference/routing-preferences.d.ts.map +1 -0
- package/local-inference/routing-preferences.js +90 -0
- package/local-inference/routing-preferences.js.map +1 -0
- package/local-inference/throughput.d.ts +74 -0
- package/local-inference/throughput.d.ts.map +1 -0
- package/local-inference/throughput.js +84 -0
- package/local-inference/throughput.js.map +1 -0
- package/local-inference/types.d.ts +510 -0
- package/local-inference/types.d.ts.map +1 -0
- package/local-inference/types.js +22 -0
- package/local-inference/types.js.map +1 -0
- package/local-inference/verify.d.ts +39 -0
- package/local-inference/verify.d.ts.map +1 -0
- package/local-inference/verify.js +105 -0
- package/local-inference/verify.js.map +1 -0
- package/local-inference/voice-models.d.ts +156 -0
- package/local-inference/voice-models.d.ts.map +1 -0
- package/local-inference/voice-models.js +746 -0
- package/local-inference/voice-models.js.map +1 -0
- package/local-inference-gpu/gpu-overrides.d.ts +97 -0
- package/local-inference-gpu/gpu-overrides.d.ts.map +1 -0
- package/local-inference-gpu/gpu-overrides.js +76 -0
- package/local-inference-gpu/gpu-overrides.js.map +1 -0
- package/local-inference-gpu/gpu-profile-loader.d.ts +83 -0
- package/local-inference-gpu/gpu-profile-loader.d.ts.map +1 -0
- package/local-inference-gpu/gpu-profile-loader.js +196 -0
- package/local-inference-gpu/gpu-profile-loader.js.map +1 -0
- package/local-inference-gpu/gpu-profile-schema.d.ts +208 -0
- package/local-inference-gpu/gpu-profile-schema.d.ts.map +1 -0
- package/local-inference-gpu/gpu-profile-schema.js +123 -0
- package/local-inference-gpu/gpu-profile-schema.js.map +1 -0
- package/local-inference-gpu/gpu-tier-detect.d.ts +61 -0
- package/local-inference-gpu/gpu-tier-detect.d.ts.map +1 -0
- package/local-inference-gpu/gpu-tier-detect.js +93 -0
- package/local-inference-gpu/gpu-tier-detect.js.map +1 -0
- package/local-inference-gpu/gpu-tier-profiles.d.ts +110 -0
- package/local-inference-gpu/gpu-tier-profiles.d.ts.map +1 -0
- package/local-inference-gpu/gpu-tier-profiles.js +235 -0
- package/local-inference-gpu/gpu-tier-profiles.js.map +1 -0
- package/package.json +111 -160
- package/platform/is-native-server.d.ts +9 -0
- package/platform/is-native-server.d.ts.map +1 -0
- package/platform/is-native-server.js +12 -0
- package/platform/is-native-server.js.map +1 -0
- package/restart.d.ts +2 -1
- package/restart.d.ts.map +1 -1
- package/restart.js +3 -2
- package/restart.js.map +1 -1
- package/runtime-env.d.ts +2 -2
- package/runtime-env.d.ts.map +1 -1
- package/runtime-env.js +15 -7
- package/runtime-env.js.map +1 -1
- package/self-edit.d.ts +4 -4
- package/self-edit.d.ts.map +1 -1
- package/self-edit.js +5 -5
- package/self-edit.js.map +1 -1
- package/settings-debug.d.ts.map +1 -1
- package/settings-debug.js +45 -38
- package/settings-debug.js.map +1 -1
- package/spoken-text.d.ts.map +1 -1
- package/spoken-text.js +3 -2
- package/spoken-text.js.map +1 -1
- package/steward-session-client/index.d.ts +172 -0
- package/steward-session-client/index.d.ts.map +1 -0
- package/steward-session-client/index.js +248 -0
- package/steward-session-client/index.js.map +1 -0
- package/steward-session-client/steward-oauth-pkce.d.ts +24 -0
- package/steward-session-client/steward-oauth-pkce.d.ts.map +1 -0
- package/steward-session-client/steward-oauth-pkce.js +105 -0
- package/steward-session-client/steward-oauth-pkce.js.map +1 -0
- package/terminal/links.d.ts +9 -0
- package/terminal/links.d.ts.map +1 -0
- package/terminal/links.js +21 -0
- package/terminal/links.js.map +1 -0
- package/terminal/palette.d.ts +11 -0
- package/terminal/palette.d.ts.map +1 -0
- package/terminal/palette.js +13 -0
- package/terminal/palette.js.map +1 -0
- package/terminal/theme.d.ts +17 -0
- package/terminal/theme.d.ts.map +1 -0
- package/terminal/theme.js +25 -0
- package/terminal/theme.js.map +1 -0
- package/test-support/process-helpers.d.ts +13 -0
- package/test-support/process-helpers.d.ts.map +1 -0
- package/test-support/process-helpers.js +24 -0
- package/test-support/process-helpers.js.map +1 -0
- package/test-support/test-helpers.d.ts +79 -0
- package/test-support/test-helpers.d.ts.map +1 -0
- package/test-support/test-helpers.js +341 -0
- package/test-support/test-helpers.js.map +1 -0
- package/transcripts.d.ts +139 -0
- package/transcripts.d.ts.map +1 -0
- package/transcripts.js +162 -0
- package/transcripts.js.map +1 -0
- package/type-guards.d.ts +1 -23
- package/type-guards.d.ts.map +1 -1
- package/type-guards.js +6 -23
- package/type-guards.js.map +1 -1
- package/types/index.d.ts +654 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +5 -0
- package/types/index.js.map +1 -0
- package/utils/asset-url.d.ts +24 -0
- package/utils/asset-url.d.ts.map +1 -0
- package/utils/asset-url.js +151 -0
- package/utils/asset-url.js.map +1 -0
- package/utils/assistant-text.d.ts +13 -0
- package/utils/assistant-text.d.ts.map +1 -0
- package/utils/assistant-text.js +292 -0
- package/utils/assistant-text.js.map +1 -0
- package/utils/browser-tab-kit-types.d.ts +81 -0
- package/utils/browser-tab-kit-types.d.ts.map +1 -0
- package/utils/browser-tab-kit-types.js +23 -0
- package/utils/browser-tab-kit-types.js.map +1 -0
- package/utils/browser-tabs-renderer-registry.d.ts +56 -0
- package/utils/browser-tabs-renderer-registry.d.ts.map +1 -0
- package/utils/browser-tabs-renderer-registry.js +1282 -0
- package/utils/browser-tabs-renderer-registry.js.map +1 -0
- package/utils/character-message-examples.d.ts +7 -0
- package/utils/character-message-examples.d.ts.map +1 -0
- package/utils/character-message-examples.js +123 -0
- package/utils/character-message-examples.js.map +1 -0
- package/utils/cloud-status.d.ts +3 -0
- package/utils/cloud-status.d.ts.map +1 -0
- package/utils/cloud-status.js +11 -0
- package/utils/cloud-status.js.map +1 -0
- package/utils/documents-upload-image.d.ts +27 -0
- package/utils/documents-upload-image.d.ts.map +1 -0
- package/utils/documents-upload-image.js +147 -0
- package/utils/documents-upload-image.js.map +1 -0
- package/utils/eliza-cloud-model-route.d.ts +3 -0
- package/utils/eliza-cloud-model-route.d.ts.map +1 -0
- package/utils/eliza-cloud-model-route.js +10 -0
- package/utils/eliza-cloud-model-route.js.map +1 -0
- package/utils/eliza-globals.d.ts +13 -0
- package/utils/eliza-globals.d.ts.map +1 -0
- package/utils/eliza-globals.js +49 -0
- package/utils/eliza-globals.js.map +1 -0
- package/utils/eliza-root.d.ts +9 -0
- package/utils/eliza-root.d.ts.map +1 -0
- package/utils/eliza-root.js +102 -0
- package/utils/eliza-root.js.map +1 -0
- package/utils/env.d.ts +34 -0
- package/utils/env.d.ts.map +1 -0
- package/utils/env.js +142 -0
- package/utils/env.js.map +1 -0
- package/utils/errors.d.ts +13 -0
- package/utils/errors.d.ts.map +1 -0
- package/utils/errors.js +26 -0
- package/utils/errors.js.map +1 -0
- package/utils/exec-safety.d.ts +2 -0
- package/utils/exec-safety.d.ts.map +1 -0
- package/utils/exec-safety.js +25 -0
- package/utils/exec-safety.js.map +1 -0
- package/utils/format.d.ts +85 -0
- package/utils/format.d.ts.map +1 -0
- package/utils/format.js +140 -0
- package/utils/format.js.map +1 -0
- package/utils/labels.d.ts +6 -0
- package/utils/labels.d.ts.map +1 -0
- package/utils/labels.js +42 -0
- package/utils/labels.js.map +1 -0
- package/utils/log-prefix.d.ts +2 -0
- package/utils/log-prefix.d.ts.map +1 -0
- package/utils/log-prefix.js +44 -0
- package/utils/log-prefix.js.map +1 -0
- package/utils/name-tokens.d.ts +24 -0
- package/utils/name-tokens.d.ts.map +1 -0
- package/utils/name-tokens.js +37 -0
- package/utils/name-tokens.js.map +1 -0
- package/utils/namespace-defaults.d.ts +10 -0
- package/utils/namespace-defaults.d.ts.map +1 -0
- package/utils/namespace-defaults.js +17 -0
- package/utils/namespace-defaults.js.map +1 -0
- package/utils/number-parsing.d.ts +26 -0
- package/utils/number-parsing.d.ts.map +1 -0
- package/utils/number-parsing.js +57 -0
- package/utils/number-parsing.js.map +1 -0
- package/utils/owner-name.d.ts +3 -0
- package/utils/owner-name.d.ts.map +1 -0
- package/utils/owner-name.js +8 -0
- package/utils/owner-name.js.map +1 -0
- package/utils/permission-deep-links.d.ts +35 -0
- package/utils/permission-deep-links.d.ts.map +1 -0
- package/utils/permission-deep-links.js +95 -0
- package/utils/permission-deep-links.js.map +1 -0
- package/utils/rate-limiter.d.ts +32 -0
- package/utils/rate-limiter.d.ts.map +1 -0
- package/utils/rate-limiter.js +53 -0
- package/utils/rate-limiter.js.map +1 -0
- package/utils/serialise.d.ts +12 -0
- package/utils/serialise.d.ts.map +1 -0
- package/utils/serialise.js +22 -0
- package/utils/serialise.js.map +1 -0
- package/utils/sql-compat.d.ts +10 -0
- package/utils/sql-compat.d.ts.map +1 -0
- package/utils/sql-compat.js +112 -0
- package/utils/sql-compat.js.map +1 -0
- package/utils/streaming-text.d.ts +9 -0
- package/utils/streaming-text.d.ts.map +1 -0
- package/utils/streaming-text.js +116 -0
- package/utils/streaming-text.js.map +1 -0
- package/utils/subscription-auth.d.ts +9 -0
- package/utils/subscription-auth.d.ts.map +1 -0
- package/utils/subscription-auth.js +49 -0
- package/utils/subscription-auth.js.map +1 -0
- package/utils/trajectory-format.d.ts +6 -0
- package/utils/trajectory-format.d.ts.map +1 -0
- package/utils/trajectory-format.js +44 -0
- package/utils/trajectory-format.js.map +1 -0
- package/utils/tts-debug.d.ts +10 -0
- package/utils/tts-debug.d.ts.map +1 -0
- package/utils/tts-debug.js +73 -0
- package/utils/tts-debug.js.map +1 -0
- package/view-hero-art.d.ts +75 -0
- package/view-hero-art.d.ts.map +1 -0
- package/view-hero-art.js +360 -0
- package/view-hero-art.js.map +1 -0
- package/voice/first-sentence-snip.d.ts +68 -0
- package/voice/first-sentence-snip.d.ts.map +1 -0
- package/voice/first-sentence-snip.js +284 -0
- package/voice/first-sentence-snip.js.map +1 -0
- package/voice/voice-cancellation-token.d.ts +127 -0
- package/voice/voice-cancellation-token.d.ts.map +1 -0
- package/voice/voice-cancellation-token.js +186 -0
- package/voice/voice-cancellation-token.js.map +1 -0
- package/voice-wer.d.ts +19 -0
- package/voice-wer.d.ts.map +1 -0
- package/voice-wer.js +42 -0
- package/voice-wer.js.map +1 -0
- package/voice.d.ts +55 -0
- package/voice.d.ts.map +1 -0
- package/voice.js +337 -0
- package/voice.js.map +1 -0
- 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/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/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.impl.d.ts +0 -2
- package/env-utils.impl.d.ts.map +0 -1
- package/env-utils.impl.js +0 -10
- package/env-utils.impl.js.map +0 -1
- package/onboarding-presets.characters.d.ts.map +0 -1
- package/onboarding-presets.characters.js.map +0 -1
- package/onboarding-presets.d.ts.map +0 -1
- package/onboarding-presets.js.map +0 -1
- package/onboarding-presets.shared.d.ts.map +0 -1
- package/onboarding-presets.shared.js.map +0 -1
- package/themes/index.d.ts +0 -7
- package/themes/index.d.ts.map +0 -1
- package/themes/index.js +0 -6
- package/themes/index.js.map +0 -1
- package/themes/presets.d.ts +0 -15
- package/themes/presets.d.ts.map +0 -1
- package/themes/presets.js +0 -789
- package/themes/presets.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
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Steward session client.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for:
|
|
5
|
+
* - the storage / cookie / endpoint key names used across os-homepage
|
|
6
|
+
* (`elizaos.ai`), cloud-frontend (`elizacloud.ai`), and the cloud-api
|
|
7
|
+
* `/api/auth/steward-session` route handler;
|
|
8
|
+
* - the request / response / error shapes the route exchanges with the
|
|
9
|
+
* browser;
|
|
10
|
+
* - the small set of helpers each consumer needs (sync, clear, read).
|
|
11
|
+
*
|
|
12
|
+
* Browser-only helpers return cleanly under SSR (`typeof window === "undefined"`).
|
|
13
|
+
*/
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Constants
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
/** localStorage key for the Steward access token (JWT). */
|
|
18
|
+
export const STEWARD_TOKEN_KEY = "steward_session_token";
|
|
19
|
+
/**
|
|
20
|
+
* localStorage key for the Steward refresh token.
|
|
21
|
+
*
|
|
22
|
+
* @deprecated Refresh tokens are now persisted only as the HttpOnly
|
|
23
|
+
* `steward-refresh-token` cookie (set by `/api/auth/steward-session` and
|
|
24
|
+
* `/api/auth/steward-nonce-exchange`). The localStorage copy was XSS-
|
|
25
|
+
* reachable and is being removed; only the key constant and the
|
|
26
|
+
* read/write/clear helpers below remain so legacy tabs left over from
|
|
27
|
+
* before the rollout can still drain their stale value via
|
|
28
|
+
* `clearStoredStewardToken()`. Do NOT add new readers/writers.
|
|
29
|
+
*/
|
|
30
|
+
export const STEWARD_REFRESH_TOKEN_KEY = "steward_refresh_token";
|
|
31
|
+
/** Non-HttpOnly cookie set to "1" while the server-side session is live. */
|
|
32
|
+
export const STEWARD_AUTHED_COOKIE = "steward-authed";
|
|
33
|
+
/** Steward multi-tenant identifier for Eliza Cloud. */
|
|
34
|
+
export const STEWARD_TENANT_ID = "elizacloud";
|
|
35
|
+
/** Same-origin endpoint that exchanges the JWT for HttpOnly cookies. */
|
|
36
|
+
export const STEWARD_SESSION_ENDPOINT = "/api/auth/steward-session";
|
|
37
|
+
/**
|
|
38
|
+
* Same-origin endpoint that swaps a one-time OAuth `code` (the nonce-exchange
|
|
39
|
+
* flow's `?code=` query param) for HttpOnly cookies. The endpoint calls
|
|
40
|
+
* Steward's `POST /auth/oauth/exchange` server-side so the access and refresh
|
|
41
|
+
* tokens never touch the browser URL.
|
|
42
|
+
*/
|
|
43
|
+
export const STEWARD_NONCE_EXCHANGE_ENDPOINT = "/api/auth/steward-nonce-exchange";
|
|
44
|
+
/**
|
|
45
|
+
* Same-origin endpoint that rotates the Steward access + refresh tokens
|
|
46
|
+
* using the HttpOnly `steward-refresh-token` cookie. The browser POSTs
|
|
47
|
+
* with `credentials: "include"`; the cookie travels automatically. Trusted
|
|
48
|
+
* Cloud browser origins receive the short-lived access token so the SPA can
|
|
49
|
+
* refresh its localStorage mirror while route auth remains synchronous.
|
|
50
|
+
*/
|
|
51
|
+
export const STEWARD_REFRESH_ENDPOINT = "/api/auth/steward-refresh";
|
|
52
|
+
export class StewardSessionError extends Error {
|
|
53
|
+
status;
|
|
54
|
+
code;
|
|
55
|
+
constructor(message, status, code) {
|
|
56
|
+
super(message);
|
|
57
|
+
this.name = "StewardSessionError";
|
|
58
|
+
this.status = status;
|
|
59
|
+
this.code = code;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// localStorage helpers
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
export function readStoredStewardToken() {
|
|
66
|
+
if (typeof window === "undefined")
|
|
67
|
+
return null;
|
|
68
|
+
try {
|
|
69
|
+
return window.localStorage.getItem(STEWARD_TOKEN_KEY);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export function writeStoredStewardToken(token) {
|
|
76
|
+
if (typeof window === "undefined")
|
|
77
|
+
return;
|
|
78
|
+
try {
|
|
79
|
+
window.localStorage.setItem(STEWARD_TOKEN_KEY, token);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// localStorage may be disabled (private mode, quota, sandboxed iframe);
|
|
83
|
+
// callers that need durability should detect this themselves.
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
let warnedReadRefresh = false;
|
|
87
|
+
let warnedWriteRefresh = false;
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated The refresh token is now persisted only as the HttpOnly
|
|
90
|
+
* `steward-refresh-token` cookie. Reading it from localStorage is XSS-
|
|
91
|
+
* reachable and contradicts the cookie-only model. Callers should POST to
|
|
92
|
+
* `STEWARD_REFRESH_ENDPOINT` with `credentials: "include"` instead — the
|
|
93
|
+
* server reads the cookie and mints fresh tokens with no body payload.
|
|
94
|
+
* This helper is retained for one release window so legacy tabs can still
|
|
95
|
+
* be cleaned up via `clearStoredStewardToken()`; it will be removed once
|
|
96
|
+
* `os-homepage` and `cloud-frontend` have shipped the cookie-only flow.
|
|
97
|
+
*/
|
|
98
|
+
export function readStoredStewardRefreshToken() {
|
|
99
|
+
if (typeof window === "undefined")
|
|
100
|
+
return null;
|
|
101
|
+
if (!warnedReadRefresh) {
|
|
102
|
+
warnedReadRefresh = true;
|
|
103
|
+
try {
|
|
104
|
+
console.warn("[steward] readStoredStewardRefreshToken() is deprecated — refresh tokens live in the HttpOnly steward-refresh-token cookie. Use STEWARD_REFRESH_ENDPOINT with credentials: 'include' instead.");
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// ignore
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
return window.localStorage.getItem(STEWARD_REFRESH_TOKEN_KEY);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Writing the refresh token to localStorage defeats the
|
|
119
|
+
* HttpOnly-cookie protection the server already provides. The cookie is
|
|
120
|
+
* set by `/api/auth/steward-session` and `/api/auth/steward-nonce-exchange`
|
|
121
|
+
* — there is no longer any reason for the browser to hold a copy. This
|
|
122
|
+
* helper intentionally does not write and is kept only for one release
|
|
123
|
+
* window; after that it will be deleted.
|
|
124
|
+
*/
|
|
125
|
+
export function writeStoredStewardRefreshToken(_token) {
|
|
126
|
+
if (typeof window === "undefined")
|
|
127
|
+
return;
|
|
128
|
+
if (!warnedWriteRefresh) {
|
|
129
|
+
warnedWriteRefresh = true;
|
|
130
|
+
try {
|
|
131
|
+
console.warn("[steward] writeStoredStewardRefreshToken() is deprecated and no longer writes to localStorage. The HttpOnly steward-refresh-token cookie is now the only persistence. This call intentionally leaves storage unchanged.");
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// ignore
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Intentionally do not write — the cookie is the source of truth. We keep
|
|
138
|
+
// the function so existing call sites compile through the rollout window.
|
|
139
|
+
}
|
|
140
|
+
export function clearStoredStewardToken() {
|
|
141
|
+
if (typeof window === "undefined")
|
|
142
|
+
return;
|
|
143
|
+
try {
|
|
144
|
+
window.localStorage.removeItem(STEWARD_TOKEN_KEY);
|
|
145
|
+
window.localStorage.removeItem(STEWARD_REFRESH_TOKEN_KEY);
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// ignore
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Returns true when the non-HttpOnly `steward-authed=1` marker cookie is
|
|
153
|
+
* present. The JWT cookie itself is HttpOnly, so JS uses this hint to know
|
|
154
|
+
* "there is a server session" without ever touching the token.
|
|
155
|
+
*/
|
|
156
|
+
export function hasStewardAuthedCookie() {
|
|
157
|
+
if (typeof document === "undefined")
|
|
158
|
+
return false;
|
|
159
|
+
return document.cookie
|
|
160
|
+
.split(";")
|
|
161
|
+
.some((part) => part.trim().startsWith(`${STEWARD_AUTHED_COOKIE}=1`));
|
|
162
|
+
}
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
// Network helpers
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
async function readErrorBody(response) {
|
|
167
|
+
try {
|
|
168
|
+
return (await response.json());
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* POSTs the Steward JWT (+ optional refresh token) to the session endpoint
|
|
176
|
+
* so the server can set HttpOnly cookies. Throws `StewardSessionError` on
|
|
177
|
+
* non-2xx; caller decides whether to wipe localStorage based on `error.code`.
|
|
178
|
+
*/
|
|
179
|
+
export async function syncStewardSession(token, refreshToken, opts = {}) {
|
|
180
|
+
const endpoint = opts.endpoint ?? STEWARD_SESSION_ENDPOINT;
|
|
181
|
+
const f = opts.fetchImpl ?? fetch;
|
|
182
|
+
// Refresh tokens now live exclusively in the HttpOnly
|
|
183
|
+
// `steward-refresh-token` cookie. We forward whatever the caller passes
|
|
184
|
+
// (e.g. the value still arriving in a legacy URL fragment during the
|
|
185
|
+
// rollout window) so the server can set the cookie on first login, but we
|
|
186
|
+
// do NOT read it back from localStorage — that path is being removed.
|
|
187
|
+
const body = {
|
|
188
|
+
token,
|
|
189
|
+
...(refreshToken ? { refreshToken } : {}),
|
|
190
|
+
};
|
|
191
|
+
const response = await f(endpoint, {
|
|
192
|
+
method: "POST",
|
|
193
|
+
credentials: "include",
|
|
194
|
+
headers: { "Content-Type": "application/json" },
|
|
195
|
+
body: JSON.stringify(body),
|
|
196
|
+
});
|
|
197
|
+
if (!response.ok) {
|
|
198
|
+
const errBody = await readErrorBody(response);
|
|
199
|
+
throw new StewardSessionError(errBody?.error || "Could not establish an Eliza Cloud session.", response.status, errBody?.code ?? null);
|
|
200
|
+
}
|
|
201
|
+
return (await response.json());
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* POSTs the one-time OAuth code to the cloud-api nonce-exchange endpoint.
|
|
205
|
+
* The route calls Steward `POST /auth/oauth/exchange` server-side, sets the
|
|
206
|
+
* HttpOnly steward-token + steward-refresh-token cookies, and returns the
|
|
207
|
+
* Eliza Cloud user id. Some cross-origin checkout callers may also receive a
|
|
208
|
+
* browser bearer token. Throws `StewardSessionError` on non-2xx.
|
|
209
|
+
*/
|
|
210
|
+
export async function exchangeStewardCode(code, opts = {}) {
|
|
211
|
+
const endpoint = opts.endpoint ?? STEWARD_NONCE_EXCHANGE_ENDPOINT;
|
|
212
|
+
const f = opts.fetchImpl ?? fetch;
|
|
213
|
+
const body = {
|
|
214
|
+
code,
|
|
215
|
+
...(opts.redirectUri ? { redirectUri: opts.redirectUri } : {}),
|
|
216
|
+
...(opts.tenantId ? { tenantId: opts.tenantId } : {}),
|
|
217
|
+
...(opts.codeVerifier ? { codeVerifier: opts.codeVerifier } : {}),
|
|
218
|
+
};
|
|
219
|
+
const response = await f(endpoint, {
|
|
220
|
+
method: "POST",
|
|
221
|
+
credentials: "include",
|
|
222
|
+
headers: { "Content-Type": "application/json" },
|
|
223
|
+
body: JSON.stringify(body),
|
|
224
|
+
});
|
|
225
|
+
if (!response.ok) {
|
|
226
|
+
const errBody = await readErrorBody(response);
|
|
227
|
+
throw new StewardSessionError(errBody?.error || "Could not complete Eliza Cloud sign-in.", response.status, errBody?.code ?? null);
|
|
228
|
+
}
|
|
229
|
+
return (await response.json());
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Best-effort DELETE of every configured session endpoint. Failures are
|
|
233
|
+
* swallowed — the caller has already wiped localStorage and there's nothing
|
|
234
|
+
* useful to do about a cookie that won't clear.
|
|
235
|
+
*/
|
|
236
|
+
export { buildStewardOAuthAuthorizeUrl, consumeStewardPkceVerifier, createStewardPkceChallenge, createStewardPkcePair, generateStewardPkceVerifier, storeStewardPkceVerifier, } from "./steward-oauth-pkce.js";
|
|
237
|
+
export function clearStewardSession(opts = {}) {
|
|
238
|
+
const endpoints = opts.endpoints ?? [STEWARD_SESSION_ENDPOINT];
|
|
239
|
+
const f = opts.fetchImpl ?? (typeof fetch !== "undefined" ? fetch : null);
|
|
240
|
+
if (!f)
|
|
241
|
+
return;
|
|
242
|
+
for (const url of endpoints) {
|
|
243
|
+
f(url, { method: "DELETE", credentials: "include" }).catch(() => {
|
|
244
|
+
// ignore — see jsdoc
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/steward-session-client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,2DAA2D;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEjE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAEtD,uDAAuD;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE9C,wEAAwE;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,kCAAkC,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAsCpE,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAS;IACf,IAAI,CAA0C;IAEvD,YACE,OAAe,EACf,MAAc,EACd,IAA6C;QAE7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAqBD,8EAA8E;AA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I,SAAS,EAAE,CAAC;QAC5B,CAAC,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YAC9D,qBAAqB;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steward OAuth PKCE helpers (RFC 7636).
|
|
3
|
+
*
|
|
4
|
+
* Steward's `/auth/oauth/:provider/authorize` requires a S256 `code_challenge`
|
|
5
|
+
* when `response_type=code`. Mint a verifier/challenge pair, send the challenge
|
|
6
|
+
* at /authorize, stash the verifier in browser storage, and replay it at
|
|
7
|
+
* /exchange via {@link exchangeStewardCode}.
|
|
8
|
+
*/
|
|
9
|
+
export type StewardOAuthProvider = "google" | "discord" | "github" | "twitter";
|
|
10
|
+
export declare function generateStewardPkceVerifier(): string;
|
|
11
|
+
export declare function createStewardPkceChallenge(verifier: string): Promise<string>;
|
|
12
|
+
export interface StewardPkcePair {
|
|
13
|
+
verifier: string;
|
|
14
|
+
challenge: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function createStewardPkcePair(): Promise<StewardPkcePair>;
|
|
17
|
+
export declare function storeStewardPkceVerifier(verifier: string): boolean;
|
|
18
|
+
export declare function consumeStewardPkceVerifier(): string | null;
|
|
19
|
+
export declare function buildStewardOAuthAuthorizeUrl(provider: StewardOAuthProvider, redirectUri: string, options: {
|
|
20
|
+
stewardApiUrl: string;
|
|
21
|
+
stewardTenantId?: string;
|
|
22
|
+
codeChallenge?: string;
|
|
23
|
+
}): string;
|
|
24
|
+
//# sourceMappingURL=steward-oauth-pkce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steward-oauth-pkce.d.ts","sourceRoot":"","sources":["../../src/steward-session-client/steward-oauth-pkce.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAoB/E,wBAAgB,2BAA2B,IAAI,MAAM,CAIpD;AAED,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CAItE;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAoBlE;AAED,wBAAgB,0BAA0B,IAAI,MAAM,GAAG,IAAI,CAK1D;AA6BD,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,oBAAoB,EAC9B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IACP,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,MAAM,CAYR"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steward OAuth PKCE helpers (RFC 7636).
|
|
3
|
+
*
|
|
4
|
+
* Steward's `/auth/oauth/:provider/authorize` requires a S256 `code_challenge`
|
|
5
|
+
* when `response_type=code`. Mint a verifier/challenge pair, send the challenge
|
|
6
|
+
* at /authorize, stash the verifier in browser storage, and replay it at
|
|
7
|
+
* /exchange via {@link exchangeStewardCode}.
|
|
8
|
+
*/
|
|
9
|
+
const STEWARD_PKCE_VERIFIER_STORAGE_KEY = "steward.oauth.pkce.verifier";
|
|
10
|
+
const STEWARD_PKCE_VERIFIER_TTL_MS = 10 * 60 * 1000;
|
|
11
|
+
const PKCE_VERIFIER_BYTES = 48;
|
|
12
|
+
function base64UrlEncode(bytes) {
|
|
13
|
+
let binary = "";
|
|
14
|
+
for (const byte of bytes)
|
|
15
|
+
binary += String.fromCharCode(byte);
|
|
16
|
+
return btoa(binary)
|
|
17
|
+
.replace(/\+/g, "-")
|
|
18
|
+
.replace(/\//g, "_")
|
|
19
|
+
.replace(/=+$/, "");
|
|
20
|
+
}
|
|
21
|
+
export function generateStewardPkceVerifier() {
|
|
22
|
+
const bytes = new Uint8Array(PKCE_VERIFIER_BYTES);
|
|
23
|
+
crypto.getRandomValues(bytes);
|
|
24
|
+
return base64UrlEncode(bytes);
|
|
25
|
+
}
|
|
26
|
+
export async function createStewardPkceChallenge(verifier) {
|
|
27
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier));
|
|
28
|
+
return base64UrlEncode(new Uint8Array(digest));
|
|
29
|
+
}
|
|
30
|
+
export async function createStewardPkcePair() {
|
|
31
|
+
const verifier = generateStewardPkceVerifier();
|
|
32
|
+
const challenge = await createStewardPkceChallenge(verifier);
|
|
33
|
+
return { verifier, challenge };
|
|
34
|
+
}
|
|
35
|
+
export function storeStewardPkceVerifier(verifier) {
|
|
36
|
+
if (typeof window === "undefined")
|
|
37
|
+
return false;
|
|
38
|
+
const stored = JSON.stringify({
|
|
39
|
+
verifier,
|
|
40
|
+
expiresAt: Date.now() + STEWARD_PKCE_VERIFIER_TTL_MS,
|
|
41
|
+
});
|
|
42
|
+
let storedAnywhere = false;
|
|
43
|
+
try {
|
|
44
|
+
window.sessionStorage.setItem(STEWARD_PKCE_VERIFIER_STORAGE_KEY, stored);
|
|
45
|
+
storedAnywhere = true;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// private mode / disabled storage
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
window.localStorage.setItem(STEWARD_PKCE_VERIFIER_STORAGE_KEY, stored);
|
|
52
|
+
storedAnywhere = true;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// same as above
|
|
56
|
+
}
|
|
57
|
+
return storedAnywhere;
|
|
58
|
+
}
|
|
59
|
+
export function consumeStewardPkceVerifier() {
|
|
60
|
+
if (typeof window === "undefined")
|
|
61
|
+
return null;
|
|
62
|
+
const sessionVerifier = consumeStoredPkceVerifier(window.sessionStorage);
|
|
63
|
+
const localVerifier = consumeStoredPkceVerifier(window.localStorage);
|
|
64
|
+
return sessionVerifier ?? localVerifier;
|
|
65
|
+
}
|
|
66
|
+
function consumeStoredPkceVerifier(storage) {
|
|
67
|
+
try {
|
|
68
|
+
const verifier = storage.getItem(STEWARD_PKCE_VERIFIER_STORAGE_KEY);
|
|
69
|
+
storage.removeItem(STEWARD_PKCE_VERIFIER_STORAGE_KEY);
|
|
70
|
+
return parseStoredPkceVerifier(verifier);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function parseStoredPkceVerifier(value) {
|
|
77
|
+
if (!value)
|
|
78
|
+
return null;
|
|
79
|
+
try {
|
|
80
|
+
const parsed = JSON.parse(value);
|
|
81
|
+
if (typeof parsed.verifier === "string" &&
|
|
82
|
+
typeof parsed.expiresAt === "number" &&
|
|
83
|
+
parsed.expiresAt >= Date.now()) {
|
|
84
|
+
return parsed.verifier;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export function buildStewardOAuthAuthorizeUrl(provider, redirectUri, options) {
|
|
93
|
+
const params = new URLSearchParams({
|
|
94
|
+
redirect_uri: redirectUri,
|
|
95
|
+
tenant_id: options.stewardTenantId ?? "elizacloud",
|
|
96
|
+
response_type: "code",
|
|
97
|
+
});
|
|
98
|
+
if (options.codeChallenge) {
|
|
99
|
+
params.set("code_challenge", options.codeChallenge);
|
|
100
|
+
params.set("code_challenge_method", "S256");
|
|
101
|
+
}
|
|
102
|
+
const stewardApiUrl = options.stewardApiUrl.replace(/\/+$/, "");
|
|
103
|
+
return `${stewardApiUrl}/auth/oauth/${provider}/authorize?${params.toString()}`;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=steward-oauth-pkce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steward-oauth-pkce.js","sourceRoot":"","sources":["../../src/steward-session-client/steward-oauth-pkce.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,iCAAiC,GAAG,6BAA6B,CAAC;AACxE,MAAM,4BAA4B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACpD,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAO/B,SAAS,eAAe,CAAC,KAAiB;IACxC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC,MAAM,CAAC;SAChB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAClD,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,QAAgB;IAEhB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CACvC,SAAS,EACT,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CACnC,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC;AAOD,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,QAAQ,GAAG,2BA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|
1
|
+
export declare function formatTerminalLink(label: string, url: string, opts?: {
|
|
2
|
+
fallback?: string;
|
|
3
|
+
force?: boolean;
|
|
4
|
+
}): string;
|
|
5
|
+
export declare function formatDocsLink(path: string, label?: string, opts?: {
|
|
6
|
+
fallback?: string;
|
|
7
|
+
force?: boolean;
|
|
8
|
+
}): string;
|
|
9
|
+
//# sourceMappingURL=links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../src/terminal/links.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,MAAM,CAQR;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,MAAM,CASR"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const DOCS_ROOT = "https://docs.eliza.ai";
|
|
2
|
+
export function formatTerminalLink(label, url, opts) {
|
|
3
|
+
const safeLabel = label.replaceAll("\u001b", "");
|
|
4
|
+
const safeUrl = url.replaceAll("\u001b", "");
|
|
5
|
+
const allow = opts?.force ?? Boolean(process.stdout.isTTY);
|
|
6
|
+
if (!allow) {
|
|
7
|
+
return opts?.fallback ?? `${safeLabel} (${safeUrl})`;
|
|
8
|
+
}
|
|
9
|
+
return `\u001b]8;;${safeUrl}\u0007${safeLabel}\u001b]8;;\u0007`;
|
|
10
|
+
}
|
|
11
|
+
export function formatDocsLink(path, label, opts) {
|
|
12
|
+
const trimmed = path.trim();
|
|
13
|
+
const url = trimmed.startsWith("http")
|
|
14
|
+
? trimmed
|
|
15
|
+
: `${DOCS_ROOT}${trimmed.startsWith("/") ? trimmed : `/${trimmed}`}`;
|
|
16
|
+
return formatTerminalLink(label ?? url, url, {
|
|
17
|
+
fallback: opts?.fallback ?? url,
|
|
18
|
+
force: opts?.force,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../src/terminal/links.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAE1C,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,GAAW,EACX,IAA6C;IAE7C,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,EAAE,QAAQ,IAAI,GAAG,SAAS,KAAK,OAAO,GAAG,CAAC;IACvD,CAAC;IACD,OAAO,aAAa,OAAO,SAAS,SAAS,kBAAkB,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,KAAc,EACd,IAA6C;IAE7C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;QACpC,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,EAAE,CAAC;IACvE,OAAO,kBAAkB,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE;QAC3C,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,GAAG;QAC/B,KAAK,EAAE,IAAI,EAAE,KAAK;KACnB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const CLI_PALETTE: {
|
|
2
|
+
readonly accent: "#FF5A2D";
|
|
3
|
+
readonly accentBright: "#FF7A3D";
|
|
4
|
+
readonly accentDim: "#D14A22";
|
|
5
|
+
readonly info: "#FF8A5B";
|
|
6
|
+
readonly success: "#2FBF71";
|
|
7
|
+
readonly warn: "#FFB020";
|
|
8
|
+
readonly error: "#E23D2D";
|
|
9
|
+
readonly muted: "#8B7F77";
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/terminal/palette.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;;CASd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// CLI palette tokens for CLI/UI theming.
|
|
2
|
+
// Keep in sync with docs/cli/index.md (CLI palette section).
|
|
3
|
+
export const CLI_PALETTE = {
|
|
4
|
+
accent: "#FF5A2D",
|
|
5
|
+
accentBright: "#FF7A3D",
|
|
6
|
+
accentDim: "#D14A22",
|
|
7
|
+
info: "#FF8A5B",
|
|
8
|
+
success: "#2FBF71",
|
|
9
|
+
warn: "#FFB020",
|
|
10
|
+
error: "#E23D2D",
|
|
11
|
+
muted: "#8B7F77",
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../src/terminal/palette.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,SAAS;IACvB,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACR,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const theme: {
|
|
2
|
+
readonly accent: import("chalk").ChalkInstance;
|
|
3
|
+
readonly accentBright: import("chalk").ChalkInstance;
|
|
4
|
+
readonly accentDim: import("chalk").ChalkInstance;
|
|
5
|
+
readonly info: import("chalk").ChalkInstance;
|
|
6
|
+
readonly success: import("chalk").ChalkInstance;
|
|
7
|
+
readonly warn: import("chalk").ChalkInstance;
|
|
8
|
+
readonly error: import("chalk").ChalkInstance;
|
|
9
|
+
readonly muted: import("chalk").ChalkInstance;
|
|
10
|
+
readonly heading: import("chalk").ChalkInstance;
|
|
11
|
+
readonly command: import("chalk").ChalkInstance;
|
|
12
|
+
readonly option: import("chalk").ChalkInstance;
|
|
13
|
+
};
|
|
14
|
+
export declare const cyberGreen: import("chalk").ChalkInstance;
|
|
15
|
+
export declare const isRich: () => boolean;
|
|
16
|
+
export declare const colorize: (rich: boolean, color: (value: string) => string, value: string) => string;
|
|
17
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/terminal/theme.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,KAAK;;;;;;;;;;;;CAYR,CAAC;AAEX,eAAO,MAAM,UAAU,+BAAiB,CAAC;AAEzC,eAAO,MAAM,MAAM,eAAqC,CAAC;AAEzD,eAAO,MAAM,QAAQ,GACnB,MAAM,OAAO,EACb,OAAO,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAChC,OAAO,MAAM,WACmB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import chalk, { Chalk } from "chalk";
|
|
2
|
+
import { CLI_PALETTE } from "./palette.js";
|
|
3
|
+
const hasForceColor = typeof process.env.FORCE_COLOR === "string" &&
|
|
4
|
+
process.env.FORCE_COLOR.trim().length > 0 &&
|
|
5
|
+
process.env.FORCE_COLOR.trim() !== "0";
|
|
6
|
+
const hasNoColor = process.env.NO_COLOR !== undefined;
|
|
7
|
+
const baseChalk = hasNoColor && !hasForceColor ? new Chalk({ level: 0 }) : chalk;
|
|
8
|
+
const hex = (value) => baseChalk.hex(value);
|
|
9
|
+
export const theme = {
|
|
10
|
+
accent: hex(CLI_PALETTE.accent),
|
|
11
|
+
accentBright: hex(CLI_PALETTE.accentBright),
|
|
12
|
+
accentDim: hex(CLI_PALETTE.accentDim),
|
|
13
|
+
info: hex(CLI_PALETTE.info),
|
|
14
|
+
success: hex(CLI_PALETTE.success),
|
|
15
|
+
warn: hex(CLI_PALETTE.warn),
|
|
16
|
+
error: hex(CLI_PALETTE.error),
|
|
17
|
+
muted: hex(CLI_PALETTE.muted),
|
|
18
|
+
heading: baseChalk.bold.hex(CLI_PALETTE.accent),
|
|
19
|
+
command: hex(CLI_PALETTE.accentBright),
|
|
20
|
+
option: hex(CLI_PALETTE.warn),
|
|
21
|
+
};
|
|
22
|
+
export const cyberGreen = hex("#00FF41");
|
|
23
|
+
export const isRich = () => Boolean(baseChalk.level > 0);
|
|
24
|
+
export const colorize = (rich, color, value) => (rich ? color(value) : value);
|
|
25
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/terminal/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,aAAa,GACjB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,QAAQ;IAC3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MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAa,EACb,KAAgC,EAChC,KAAa,EACb,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
type MockSpawnOptions = {
|
|
3
|
+
exitCode: number;
|
|
4
|
+
stderrOutput?: string;
|
|
5
|
+
emitError?: Error;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Create a lightweight mocked ChildProcess that emits either an error event
|
|
9
|
+
* or a close event (with optional stderr output) on the next tick.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createMockChildProcess(options: MockSpawnOptions): ChildProcess;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=process-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-helpers.d.ts","sourceRoot":"","sources":["../../src/test-support/process-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,gBAAgB,GACxB,YAAY,CAmBd"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
/**
|
|
3
|
+
* Create a lightweight mocked ChildProcess that emits either an error event
|
|
4
|
+
* or a close event (with optional stderr output) on the next tick.
|
|
5
|
+
*/
|
|
6
|
+
export function createMockChildProcess(options) {
|
|
7
|
+
const child = new EventEmitter();
|
|
8
|
+
const stderrEmitter = new EventEmitter();
|
|
9
|
+
Object.defineProperty(child, "stderr", { value: stderrEmitter });
|
|
10
|
+
Object.defineProperty(child, "stdin", { value: null });
|
|
11
|
+
Object.defineProperty(child, "stdout", { value: null });
|
|
12
|
+
process.nextTick(() => {
|
|
13
|
+
if (options.emitError) {
|
|
14
|
+
child.emit("error", options.emitError);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (options.stderrOutput) {
|
|
18
|
+
stderrEmitter.emit("data", Buffer.from(options.stderrOutput));
|
|
19
|
+
}
|
|
20
|
+
child.emit("close", options.exitCode);
|
|
21
|
+
});
|
|
22
|
+
return child;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=process-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-helpers.js","sourceRoot":"","sources":["../../src/test-support/process-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAyB;IAEzB,MAAM,KAAK,GAAG,IAAI,YAAY,EAAkB,CAAC;IACjD,MAAM,aAAa,GAAG,IAAI,YAAY,EAAE,CAAC;IACzC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;IACjE,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;QACpB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YACvC,OAAO;QACT,CAAC;QACD,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;QAChE,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC"}
|