aimeat 2.0.0 → 2.2.0
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/.env.example +9 -4
- package/dist/locales/en.json +63 -1
- package/dist/locales/fi.json +63 -1
- package/dist/public/components/LinkPreview.js +101 -0
- package/dist/public/components/NotificationBell.js +18 -1
- package/dist/public/cortex-bundled/aimeat-charts.js +158 -10
- package/dist/public/cortex-bundled/aimeat-charts.yaml +1 -1
- package/dist/public/cortex-bundled/aimeat-dag.js +515 -173
- package/dist/public/cortex-bundled/aimeat-dag.yaml +1 -1
- package/dist/public/cortex-bundled/aimeat-i18n.js +6 -1
- package/dist/public/cortex-bundled/aimeat-i18n.yaml +1 -1
- package/dist/public/cortex-bundled/aimeat-surface.js +577 -0
- package/dist/public/cortex-bundled/aimeat-surface.yaml +107 -0
- package/dist/public/cortex-bundled/aimeat-viewport.js +405 -0
- package/dist/public/cortex-bundled/aimeat-viewport.yaml +100 -0
- package/dist/public/css/theme.css +57 -7
- package/dist/public/css/views/admin.css +8 -1
- package/dist/public/css/views/app-grant.css +18 -0
- package/dist/public/css/views/inbox.css +47 -1
- package/dist/public/css/views/portfolio.css +46 -0
- package/dist/public/css/views/profile.css +38 -4
- package/dist/public/js/services/apps.js +19 -3
- package/dist/public/js/services/messages-ai-prompts.js +38 -0
- package/dist/public/js/services/messages.js +26 -4
- package/dist/public/js/services/notebook.js +76 -0
- package/dist/public/js/services/unfurl.js +43 -0
- package/dist/public/lib/VENDORED.md +6 -3
- package/dist/public/lib/aimeat-daisyui-bridge.css +39 -2
- package/dist/public/lib/aimeat-theme.css +538 -0
- package/dist/public/lib/fonts/LICENSE.md +11 -4
- package/dist/public/lib/fonts/fraunces-var-latin-ext.woff2 +0 -0
- package/dist/public/lib/fonts/fraunces-var-latin.woff2 +0 -0
- package/dist/public/lib/fonts/inter-var-latin-ext.woff2 +0 -0
- package/dist/public/lib/fonts/inter-var-latin.woff2 +0 -0
- package/dist/public/lib/fonts/jetbrains-mono-var-latin-ext.woff2 +0 -0
- package/dist/public/lib/fonts/jetbrains-mono-var-latin.woff2 +0 -0
- package/dist/public/lib/fonts/space-grotesk-var-latin-ext.woff2 +0 -0
- package/dist/public/lib/fonts/space-grotesk-var-latin.woff2 +0 -0
- package/dist/public/lib/samples/LICENSE.md +11 -0
- package/dist/public/lib/samples/bass/A1.mp3 +0 -0
- package/dist/public/lib/samples/bass/B2.mp3 +0 -0
- package/dist/public/lib/samples/bass/D2.mp3 +0 -0
- package/dist/public/lib/samples/bass/E1.mp3 +0 -0
- package/dist/public/lib/samples/bass/E3.mp3 +0 -0
- package/dist/public/lib/samples/bass/G2.mp3 +0 -0
- package/dist/public/lib/samples/epiano/C2.mp3 +0 -0
- package/dist/public/lib/samples/epiano/C3.mp3 +0 -0
- package/dist/public/lib/samples/epiano/C4.mp3 +0 -0
- package/dist/public/lib/samples/epiano/C5.mp3 +0 -0
- package/dist/public/lib/samples/epiano/C6.mp3 +0 -0
- package/dist/public/lib/samples/epiano/G2.mp3 +0 -0
- package/dist/public/lib/samples/epiano/G3.mp3 +0 -0
- package/dist/public/lib/samples/epiano/G4.mp3 +0 -0
- package/dist/public/lib/samples/epiano/G5.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/A2.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/A4.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/B3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/D3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/E2.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/E4.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/E5.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/G3.mp3 +0 -0
- package/dist/public/lib/samples/organ/C2.mp3 +0 -0
- package/dist/public/lib/samples/organ/C3.mp3 +0 -0
- package/dist/public/lib/samples/organ/C4.mp3 +0 -0
- package/dist/public/lib/samples/organ/C5.mp3 +0 -0
- package/dist/public/lib/samples/organ/C6.mp3 +0 -0
- package/dist/public/lib/samples/organ/G2.mp3 +0 -0
- package/dist/public/lib/samples/organ/G3.mp3 +0 -0
- package/dist/public/lib/samples/organ/G4.mp3 +0 -0
- package/dist/public/lib/samples/organ/G5.mp3 +0 -0
- package/dist/public/lib/samples/strings/C2.mp3 +0 -0
- package/dist/public/lib/samples/strings/C3.mp3 +0 -0
- package/dist/public/lib/samples/strings/C4.mp3 +0 -0
- package/dist/public/lib/samples/strings/C5.mp3 +0 -0
- package/dist/public/lib/samples/strings/C6.mp3 +0 -0
- package/dist/public/lib/samples/strings/G2.mp3 +0 -0
- package/dist/public/lib/samples/strings/G3.mp3 +0 -0
- package/dist/public/lib/samples/strings/G4.mp3 +0 -0
- package/dist/public/lib/samples/strings/G5.mp3 +0 -0
- package/dist/public/lib/samples/theme-check.html +92 -0
- package/dist/public/lib/samples/themes-boot.js +20 -0
- package/dist/public/lib/samples/themes.html +154 -0
- package/dist/public/lib/samples/themes.js +60 -0
- package/dist/public/lib/samples/trumpet/A3.mp3 +0 -0
- package/dist/public/lib/samples/trumpet/A4.mp3 +0 -0
- package/dist/public/lib/samples/trumpet/A5.mp3 +0 -0
- package/dist/public/lib/samples/trumpet/C4.mp3 +0 -0
- package/dist/public/lib/samples/trumpet/C5.mp3 +0 -0
- package/dist/public/lib/samples/trumpet/E3.mp3 +0 -0
- package/dist/public/lib/samples/trumpet/E4.mp3 +0 -0
- package/dist/public/lib/samples/trumpet/E5.mp3 +0 -0
- package/dist/public/spa.html +2 -0
- package/dist/public/views/app-grant.js +24 -4
- package/dist/public/views/portfolio.js +61 -6
- package/dist/public/views/profile/access-tab/connected-apps.js +81 -5
- package/dist/public/views/profile/apps-tab.js +18 -1
- package/dist/public/views/profile/extensions-tab.maturity.js +4 -1
- package/dist/public/views/profile/inbox-tab/ai-actions.js +86 -0
- package/dist/public/views/profile/inbox-tab/components.js +141 -10
- package/dist/public/views/profile/inbox-tab/helpers.js +26 -0
- package/dist/public/views/profile/inbox-tab/panels.js +18 -3
- package/dist/public/views/profile/inbox-tab/use-thread-ux.js +47 -3
- package/dist/public/views/profile/inbox-tab.js +46 -49
- package/dist/public/views/profile/landing-page.cards.js +7 -0
- package/dist/public/views/profile/landing-page.js +12 -1
- package/dist/public/views/profile/libraries-tab.js +10 -2
- package/dist/public/views/profile/skills-tab.js +1 -1
- package/dist/public/views/profile/wallet-tab.js +64 -0
- package/dist/public/views/public-workspace-viewer.js +1 -1
- package/dist/public/views/start.js +2 -1
- package/dist/scripts/build-sdk-libs.d.ts +16 -0
- package/dist/scripts/build-sdk-libs.d.ts.map +1 -0
- package/dist/scripts/build-sdk-libs.js +112 -0
- package/dist/scripts/build-sdk-libs.js.map +1 -0
- package/dist/scripts/check-openapi.d.ts +2 -0
- package/dist/scripts/check-openapi.d.ts.map +1 -0
- package/dist/scripts/check-openapi.js +139 -0
- package/dist/scripts/check-openapi.js.map +1 -0
- package/dist/scripts/embed-viewport.d.ts +23 -0
- package/dist/scripts/embed-viewport.d.ts.map +1 -0
- package/dist/scripts/embed-viewport.js +116 -0
- package/dist/scripts/embed-viewport.js.map +1 -0
- package/dist/src/auth/sse-domain-scopes.d.ts +50 -0
- package/dist/src/auth/sse-domain-scopes.d.ts.map +1 -0
- package/dist/src/auth/sse-domain-scopes.js +111 -0
- package/dist/src/auth/sse-domain-scopes.js.map +1 -0
- package/dist/src/cli/connect/auth.d.ts +15 -0
- package/dist/src/cli/connect/auth.d.ts.map +1 -1
- package/dist/src/cli/connect/auth.js +25 -6
- package/dist/src/cli/connect/auth.js.map +1 -1
- package/dist/src/cli/connect/keychain.d.ts +9 -0
- package/dist/src/cli/connect/keychain.d.ts.map +1 -1
- package/dist/src/cli/connect/keychain.js +21 -8
- package/dist/src/cli/connect/keychain.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-tasks.js +4 -1
- package/dist/src/cli/connect/mcp/tools/agent-tasks.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/core.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/core.js +14 -3
- package/dist/src/cli/connect/mcp/tools/core.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/exchange.d.ts +18 -0
- package/dist/src/cli/connect/mcp/tools/exchange.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/exchange.js +170 -0
- package/dist/src/cli/connect/mcp/tools/exchange.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/index.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/index.js +2 -0
- package/dist/src/cli/connect/mcp/tools/index.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/workspaces.d.ts +3 -0
- package/dist/src/cli/connect/mcp/tools/workspaces.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/workspaces.js +4 -2
- package/dist/src/cli/connect/mcp/tools/workspaces.js.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-core.d.ts.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-core.js +13 -1
- package/dist/src/cli/connect/tool-call-defs-core.js.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-exchange.d.ts +3 -0
- package/dist/src/cli/connect/tool-call-defs-exchange.d.ts.map +1 -0
- package/dist/src/cli/connect/tool-call-defs-exchange.js +146 -0
- package/dist/src/cli/connect/tool-call-defs-exchange.js.map +1 -0
- package/dist/src/cli/connect/tool-call.d.ts.map +1 -1
- package/dist/src/cli/connect/tool-call.js +2 -0
- package/dist/src/cli/connect/tool-call.js.map +1 -1
- package/dist/src/commerce/__tests__/x402-registry.test.d.ts +2 -0
- package/dist/src/commerce/__tests__/x402-registry.test.d.ts.map +1 -0
- package/dist/src/commerce/__tests__/x402-registry.test.js +105 -0
- package/dist/src/commerce/__tests__/x402-registry.test.js.map +1 -0
- package/dist/src/commerce/evm-address.d.ts +21 -0
- package/dist/src/commerce/evm-address.d.ts.map +1 -0
- package/dist/src/commerce/evm-address.js +94 -0
- package/dist/src/commerce/evm-address.js.map +1 -0
- package/dist/src/commerce/money.d.ts +18 -5
- package/dist/src/commerce/money.d.ts.map +1 -1
- package/dist/src/commerce/money.js +27 -6
- package/dist/src/commerce/money.js.map +1 -1
- package/dist/src/commerce/session-service.d.ts +14 -0
- package/dist/src/commerce/session-service.d.ts.map +1 -1
- package/dist/src/commerce/session-service.js +1 -1
- package/dist/src/commerce/session-service.js.map +1 -1
- package/dist/src/commerce/x402-facilitator.d.ts +64 -13
- package/dist/src/commerce/x402-facilitator.d.ts.map +1 -1
- package/dist/src/commerce/x402-facilitator.js +71 -19
- package/dist/src/commerce/x402-facilitator.js.map +1 -1
- package/dist/src/commerce/x402-handler.d.ts +13 -7
- package/dist/src/commerce/x402-handler.d.ts.map +1 -1
- package/dist/src/commerce/x402-handler.js +23 -10
- package/dist/src/commerce/x402-handler.js.map +1 -1
- package/dist/src/commerce/x402.d.ts +11 -6
- package/dist/src/commerce/x402.d.ts.map +1 -1
- package/dist/src/commerce/x402.js +10 -7
- package/dist/src/commerce/x402.js.map +1 -1
- package/dist/src/config-types.d.ts +12 -0
- package/dist/src/config-types.d.ts.map +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +8 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/data/app-templates/shells.d.ts +15 -3
- package/dist/src/data/app-templates/shells.d.ts.map +1 -1
- package/dist/src/data/app-templates/shells.js +97 -12
- package/dist/src/data/app-templates/shells.js.map +1 -1
- package/dist/src/data/app-templates.js +2 -2
- package/dist/src/data/app-templates.js.map +1 -1
- package/dist/src/data/appdev-pitfalls.d.ts +2 -0
- package/dist/src/data/appdev-pitfalls.d.ts.map +1 -1
- package/dist/src/data/appdev-pitfalls.js +24 -1
- package/dist/src/data/appdev-pitfalls.js.map +1 -1
- package/dist/src/data/library-packs/cortex.d.ts.map +1 -1
- package/dist/src/data/library-packs/cortex.js +108 -5
- package/dist/src/data/library-packs/cortex.js.map +1 -1
- package/dist/src/data/library-packs/sdk.d.ts.map +1 -1
- package/dist/src/data/library-packs/sdk.js +32 -8
- package/dist/src/data/library-packs/sdk.js.map +1 -1
- package/dist/src/data/library-packs/vendored.d.ts.map +1 -1
- package/dist/src/data/library-packs/vendored.js +83 -6
- package/dist/src/data/library-packs/vendored.js.map +1 -1
- package/dist/src/generated/api-types.d.ts +2039 -24
- package/dist/src/generated/api-types.d.ts.map +1 -1
- package/dist/src/mcp/agent-tasks.d.ts +4 -0
- package/dist/src/mcp/agent-tasks.d.ts.map +1 -1
- package/dist/src/mcp/agent-tasks.js +20 -2
- package/dist/src/mcp/agent-tasks.js.map +1 -1
- package/dist/src/mcp/annotations.d.ts.map +1 -1
- package/dist/src/mcp/annotations.js +20 -0
- package/dist/src/mcp/annotations.js.map +1 -1
- package/dist/src/mcp/apps.d.ts.map +1 -1
- package/dist/src/mcp/apps.js +8 -4
- package/dist/src/mcp/apps.js.map +1 -1
- package/dist/src/mcp/capabilities.d.ts +7 -1
- package/dist/src/mcp/capabilities.d.ts.map +1 -1
- package/dist/src/mcp/capabilities.js +5 -2
- package/dist/src/mcp/capabilities.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/commerce.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions/commerce.js +4 -2
- package/dist/src/mcp/catalog/definitions/commerce.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/discovery-work-boards.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions/discovery-work-boards.js +4 -3
- package/dist/src/mcp/catalog/definitions/discovery-work-boards.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/exchange.d.ts +18 -0
- package/dist/src/mcp/catalog/definitions/exchange.d.ts.map +1 -0
- package/dist/src/mcp/catalog/definitions/exchange.js +182 -0
- package/dist/src/mcp/catalog/definitions/exchange.js.map +1 -0
- package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js +1 -1
- package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js +3 -2
- package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js.map +1 -1
- package/dist/src/mcp/catalog/definitions.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions.js +2 -0
- package/dist/src/mcp/catalog/definitions.js.map +1 -1
- package/dist/src/mcp/catalog/output-schemas.d.ts +6 -1
- package/dist/src/mcp/catalog/output-schemas.d.ts.map +1 -1
- package/dist/src/mcp/catalog/output-schemas.js +6 -1
- package/dist/src/mcp/catalog/output-schemas.js.map +1 -1
- package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
- package/dist/src/mcp/catalog/scopes.js +22 -0
- package/dist/src/mcp/catalog/scopes.js.map +1 -1
- package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
- package/dist/src/mcp/catalog/surfaces.js +14 -0
- package/dist/src/mcp/catalog/surfaces.js.map +1 -1
- package/dist/src/mcp/commerce.d.ts.map +1 -1
- package/dist/src/mcp/commerce.js +15 -3
- package/dist/src/mcp/commerce.js.map +1 -1
- package/dist/src/mcp/core-storage.d.ts +23 -0
- package/dist/src/mcp/core-storage.d.ts.map +1 -0
- package/dist/src/mcp/core-storage.js +157 -0
- package/dist/src/mcp/core-storage.js.map +1 -0
- package/dist/src/mcp/core.d.ts +16 -0
- package/dist/src/mcp/core.d.ts.map +1 -1
- package/dist/src/mcp/core.js +75 -119
- package/dist/src/mcp/core.js.map +1 -1
- package/dist/src/mcp/dm-messages.d.ts +4 -0
- package/dist/src/mcp/dm-messages.d.ts.map +1 -1
- package/dist/src/mcp/dm-messages.js +43 -2
- package/dist/src/mcp/dm-messages.js.map +1 -1
- package/dist/src/mcp/exchange-run.d.ts +5 -0
- package/dist/src/mcp/exchange-run.d.ts.map +1 -0
- package/dist/src/mcp/exchange-run.js +226 -0
- package/dist/src/mcp/exchange-run.js.map +1 -0
- package/dist/src/mcp/exchange.d.ts +5 -0
- package/dist/src/mcp/exchange.d.ts.map +1 -0
- package/dist/src/mcp/exchange.js +352 -0
- package/dist/src/mcp/exchange.js.map +1 -0
- package/dist/src/mcp/extensions.d.ts.map +1 -1
- package/dist/src/mcp/extensions.js +17 -2
- package/dist/src/mcp/extensions.js.map +1 -1
- package/dist/src/mcp/index.d.ts +5 -0
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +26 -3
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/memory-namespace-hints.d.ts +33 -0
- package/dist/src/mcp/memory-namespace-hints.d.ts.map +1 -0
- package/dist/src/mcp/memory-namespace-hints.js +60 -0
- package/dist/src/mcp/memory-namespace-hints.js.map +1 -0
- package/dist/src/mcp/workspaces.d.ts +5 -0
- package/dist/src/mcp/workspaces.d.ts.map +1 -1
- package/dist/src/mcp/workspaces.js +5 -3
- package/dist/src/mcp/workspaces.js.map +1 -1
- package/dist/src/models/agent-task-schemas.d.ts +25 -3
- package/dist/src/models/agent-task-schemas.d.ts.map +1 -1
- package/dist/src/models/agent-task-schemas.js +16 -0
- package/dist/src/models/agent-task-schemas.js.map +1 -1
- package/dist/src/models/app-tool-schemas.d.ts +573 -2
- package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
- package/dist/src/models/app-tool-schemas.js +73 -2
- package/dist/src/models/app-tool-schemas.js.map +1 -1
- package/dist/src/models/odps-schemas.d.ts +305 -0
- package/dist/src/models/odps-schemas.d.ts.map +1 -0
- package/dist/src/models/odps-schemas.js +182 -0
- package/dist/src/models/odps-schemas.js.map +1 -0
- package/dist/src/models/offer-schemas.d.ts +359 -4
- package/dist/src/models/offer-schemas.d.ts.map +1 -1
- package/dist/src/models/offer-schemas.js +37 -0
- package/dist/src/models/offer-schemas.js.map +1 -1
- package/dist/src/models/schemas.d.ts +7 -3
- package/dist/src/models/schemas.d.ts.map +1 -1
- package/dist/src/models/schemas.js +13 -1
- package/dist/src/models/schemas.js.map +1 -1
- package/dist/src/models/webhook-schemas.d.ts +8 -8
- package/dist/src/routes/agent-tasks/create-read.d.ts +4 -0
- package/dist/src/routes/agent-tasks/create-read.d.ts.map +1 -1
- package/dist/src/routes/agent-tasks/create-read.js +20 -1
- package/dist/src/routes/agent-tasks/create-read.js.map +1 -1
- package/dist/src/routes/agent-tasks/lifecycle.d.ts.map +1 -1
- package/dist/src/routes/agent-tasks/lifecycle.js +10 -0
- package/dist/src/routes/agent-tasks/lifecycle.js.map +1 -1
- package/dist/src/routes/agents/device-auth.d.ts +4 -0
- package/dist/src/routes/agents/device-auth.d.ts.map +1 -1
- package/dist/src/routes/agents/device-auth.js +19 -4
- package/dist/src/routes/agents/device-auth.js.map +1 -1
- package/dist/src/routes/agents/offers.d.ts +2 -0
- package/dist/src/routes/agents/offers.d.ts.map +1 -1
- package/dist/src/routes/agents/offers.js +0 -0
- package/dist/src/routes/agents/offers.js.map +1 -1
- package/dist/src/routes/app-grants.d.ts +12 -0
- package/dist/src/routes/app-grants.d.ts.map +1 -1
- package/dist/src/routes/app-grants.js +90 -27
- package/dist/src/routes/app-grants.js.map +1 -1
- package/dist/src/routes/apps/drafts.d.ts +3 -0
- package/dist/src/routes/apps/drafts.d.ts.map +1 -1
- package/dist/src/routes/apps/drafts.js +63 -1
- package/dist/src/routes/apps/drafts.js.map +1 -1
- package/dist/src/routes/apps/fork-manage.d.ts.map +1 -1
- package/dist/src/routes/apps/fork-manage.js +24 -1
- package/dist/src/routes/apps/fork-manage.js.map +1 -1
- package/dist/src/routes/apps/publish.d.ts +4 -0
- package/dist/src/routes/apps/publish.d.ts.map +1 -1
- package/dist/src/routes/apps/publish.js +44 -3
- package/dist/src/routes/apps/publish.js.map +1 -1
- package/dist/src/routes/apps-cost.d.ts +25 -0
- package/dist/src/routes/apps-cost.d.ts.map +1 -0
- package/dist/src/routes/apps-cost.js +107 -0
- package/dist/src/routes/apps-cost.js.map +1 -0
- package/dist/src/routes/commerce.d.ts.map +1 -1
- package/dist/src/routes/commerce.js +122 -2
- package/dist/src/routes/commerce.js.map +1 -1
- package/dist/src/routes/exchange-market.d.ts +32 -0
- package/dist/src/routes/exchange-market.d.ts.map +1 -0
- package/dist/src/routes/exchange-market.js +580 -0
- package/dist/src/routes/exchange-market.js.map +1 -0
- package/dist/src/routes/exchange.d.ts +33 -0
- package/dist/src/routes/exchange.d.ts.map +1 -0
- package/dist/src/routes/exchange.js +398 -0
- package/dist/src/routes/exchange.js.map +1 -0
- package/dist/src/routes/extensions/actions.d.ts.map +1 -1
- package/dist/src/routes/extensions/actions.js +18 -0
- package/dist/src/routes/extensions/actions.js.map +1 -1
- package/dist/src/routes/extensions/crud.d.ts.map +1 -1
- package/dist/src/routes/extensions/crud.js +36 -3
- package/dist/src/routes/extensions/crud.js.map +1 -1
- package/dist/src/routes/extensions/entitlement-gate.d.ts +33 -0
- package/dist/src/routes/extensions/entitlement-gate.d.ts.map +1 -0
- package/dist/src/routes/extensions/entitlement-gate.js +156 -0
- package/dist/src/routes/extensions/entitlement-gate.js.map +1 -0
- package/dist/src/routes/extensions/manifest.d.ts +15 -0
- package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
- package/dist/src/routes/extensions/manifest.js +101 -2
- package/dist/src/routes/extensions/manifest.js.map +1 -1
- package/dist/src/routes/extensions/pacing.d.ts +31 -0
- package/dist/src/routes/extensions/pacing.d.ts.map +1 -0
- package/dist/src/routes/extensions/pacing.js +73 -0
- package/dist/src/routes/extensions/pacing.js.map +1 -0
- package/dist/src/routes/extensions/paywall.d.ts.map +1 -1
- package/dist/src/routes/extensions/paywall.js +20 -11
- package/dist/src/routes/extensions/paywall.js.map +1 -1
- package/dist/src/routes/federation-sync/messaging.d.ts.map +1 -1
- package/dist/src/routes/federation-sync/messaging.js +3 -1
- package/dist/src/routes/federation-sync/messaging.js.map +1 -1
- package/dist/src/routes/ghii/recovery.d.ts +2 -0
- package/dist/src/routes/ghii/recovery.d.ts.map +1 -1
- package/dist/src/routes/ghii/recovery.js +7 -0
- package/dist/src/routes/ghii/recovery.js.map +1 -1
- package/dist/src/routes/ghii/register-login.d.ts +4 -0
- package/dist/src/routes/ghii/register-login.d.ts.map +1 -1
- package/dist/src/routes/ghii/register-login.js +45 -22
- package/dist/src/routes/ghii/register-login.js.map +1 -1
- package/dist/src/routes/ghii/web-verify.d.ts +5 -0
- package/dist/src/routes/ghii/web-verify.d.ts.map +1 -1
- package/dist/src/routes/ghii/web-verify.js +24 -3
- package/dist/src/routes/ghii/web-verify.js.map +1 -1
- package/dist/src/routes/libs/sdk-serve.d.ts +11 -0
- package/dist/src/routes/libs/sdk-serve.d.ts.map +1 -0
- package/dist/src/routes/libs/sdk-serve.js +53 -0
- package/dist/src/routes/libs/sdk-serve.js.map +1 -0
- package/dist/src/routes/libs.d.ts +7 -1
- package/dist/src/routes/libs.d.ts.map +1 -1
- package/dist/src/routes/libs.js +65 -146
- package/dist/src/routes/libs.js.map +1 -1
- package/dist/src/routes/memory/crud.d.ts.map +1 -1
- package/dist/src/routes/memory/crud.js +10 -0
- package/dist/src/routes/memory/crud.js.map +1 -1
- package/dist/src/routes/messages.d.ts +3 -0
- package/dist/src/routes/messages.d.ts.map +1 -1
- package/dist/src/routes/messages.js +9 -0
- package/dist/src/routes/messages.js.map +1 -1
- package/dist/src/routes/notifications.d.ts +6 -3
- package/dist/src/routes/notifications.d.ts.map +1 -1
- package/dist/src/routes/notifications.js +32 -3
- package/dist/src/routes/notifications.js.map +1 -1
- package/dist/src/routes/organisms/crud.d.ts +3 -0
- package/dist/src/routes/organisms/crud.d.ts.map +1 -1
- package/dist/src/routes/organisms/crud.js +5 -2
- package/dist/src/routes/organisms/crud.js.map +1 -1
- package/dist/src/routes/organisms/workspace-access.d.ts.map +1 -1
- package/dist/src/routes/organisms/workspace-access.js +38 -20
- package/dist/src/routes/organisms/workspace-access.js.map +1 -1
- package/dist/src/routes/organisms/workspace-read.d.ts.map +1 -1
- package/dist/src/routes/organisms/workspace-read.js +7 -2
- package/dist/src/routes/organisms/workspace-read.js.map +1 -1
- package/dist/src/routes/public-stats.d.ts +7 -0
- package/dist/src/routes/public-stats.d.ts.map +1 -1
- package/dist/src/routes/public-stats.js +28 -7
- package/dist/src/routes/public-stats.js.map +1 -1
- package/dist/src/routes/sse.d.ts +7 -0
- package/dist/src/routes/sse.d.ts.map +1 -1
- package/dist/src/routes/sse.js +36 -6
- package/dist/src/routes/sse.js.map +1 -1
- package/dist/src/routes/storage-files.d.ts +11 -0
- package/dist/src/routes/storage-files.d.ts.map +1 -1
- package/dist/src/routes/storage-files.js +58 -51
- package/dist/src/routes/storage-files.js.map +1 -1
- package/dist/src/routes/subdomains.d.ts +4 -0
- package/dist/src/routes/subdomains.d.ts.map +1 -1
- package/dist/src/routes/subdomains.js +42 -5
- package/dist/src/routes/subdomains.js.map +1 -1
- package/dist/src/routes/unfurl.d.ts +27 -0
- package/dist/src/routes/unfurl.d.ts.map +1 -0
- package/dist/src/routes/unfurl.js +180 -0
- package/dist/src/routes/unfurl.js.map +1 -0
- package/dist/src/routes/upload.d.ts +13 -0
- package/dist/src/routes/upload.d.ts.map +1 -1
- package/dist/src/routes/upload.js +115 -28
- package/dist/src/routes/upload.js.map +1 -1
- package/dist/src/routes/webmcp.d.ts +3 -0
- package/dist/src/routes/webmcp.d.ts.map +1 -1
- package/dist/src/routes/webmcp.js +59 -0
- package/dist/src/routes/webmcp.js.map +1 -1
- package/dist/src/schemas/knowledge-package.d.ts +1 -1
- package/dist/src/server-bootstrap/routes-loader.d.ts +1 -0
- package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.js +8 -0
- package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
- package/dist/src/server-bootstrap/static-files.d.ts +4 -0
- package/dist/src/server-bootstrap/static-files.d.ts.map +1 -1
- package/dist/src/server-bootstrap/static-files.js +11 -0
- package/dist/src/server-bootstrap/static-files.js.map +1 -1
- package/dist/src/services/agent-face.d.ts +10 -2
- package/dist/src/services/agent-face.d.ts.map +1 -1
- package/dist/src/services/agent-face.js +10 -4
- package/dist/src/services/agent-face.js.map +1 -1
- package/dist/src/services/app-tool-interfaces.d.ts +37 -0
- package/dist/src/services/app-tool-interfaces.d.ts.map +1 -0
- package/dist/src/services/app-tool-interfaces.js +101 -0
- package/dist/src/services/app-tool-interfaces.js.map +1 -0
- package/dist/src/services/build-app-prompt.d.ts +22 -0
- package/dist/src/services/build-app-prompt.d.ts.map +1 -1
- package/dist/src/services/build-app-prompt.js +108 -11
- package/dist/src/services/build-app-prompt.js.map +1 -1
- package/dist/src/services/call-timing.d.ts +51 -0
- package/dist/src/services/call-timing.d.ts.map +1 -0
- package/dist/src/services/call-timing.js +91 -0
- package/dist/src/services/call-timing.js.map +1 -0
- package/dist/src/services/capability-invoke.d.ts +2 -0
- package/dist/src/services/capability-invoke.d.ts.map +1 -1
- package/dist/src/services/capability-invoke.js +10 -0
- package/dist/src/services/capability-invoke.js.map +1 -1
- package/dist/src/services/config-schema.d.ts.map +1 -1
- package/dist/src/services/config-schema.js +6 -0
- package/dist/src/services/config-schema.js.map +1 -1
- package/dist/src/services/contacts.d.ts +25 -1
- package/dist/src/services/contacts.d.ts.map +1 -1
- package/dist/src/services/contacts.js +30 -0
- package/dist/src/services/contacts.js.map +1 -1
- package/dist/src/services/draft-token.d.ts +22 -2
- package/dist/src/services/draft-token.d.ts.map +1 -1
- package/dist/src/services/draft-token.js +52 -3
- package/dist/src/services/draft-token.js.map +1 -1
- package/dist/src/services/entitlement-money.d.ts +55 -0
- package/dist/src/services/entitlement-money.d.ts.map +1 -0
- package/dist/src/services/entitlement-money.js +68 -0
- package/dist/src/services/entitlement-money.js.map +1 -0
- package/dist/src/services/exchange-market.d.ts +280 -0
- package/dist/src/services/exchange-market.d.ts.map +1 -0
- package/dist/src/services/exchange-market.js +276 -0
- package/dist/src/services/exchange-market.js.map +1 -0
- package/dist/src/services/exchange-odps.d.ts +58 -0
- package/dist/src/services/exchange-odps.d.ts.map +1 -0
- package/dist/src/services/exchange-odps.js +400 -0
- package/dist/src/services/exchange-odps.js.map +1 -0
- package/dist/src/services/exchange-projection.d.ts +61 -0
- package/dist/src/services/exchange-projection.d.ts.map +1 -0
- package/dist/src/services/exchange-projection.js +504 -0
- package/dist/src/services/exchange-projection.js.map +1 -0
- package/dist/src/services/exchange-proposals.d.ts +47 -0
- package/dist/src/services/exchange-proposals.d.ts.map +1 -0
- package/dist/src/services/exchange-proposals.js +73 -0
- package/dist/src/services/exchange-proposals.js.map +1 -0
- package/dist/src/services/exchange-work.d.ts +30 -0
- package/dist/src/services/exchange-work.d.ts.map +1 -0
- package/dist/src/services/exchange-work.js +43 -0
- package/dist/src/services/exchange-work.js.map +1 -0
- package/dist/src/services/extension-files.d.ts +64 -0
- package/dist/src/services/extension-files.d.ts.map +1 -0
- package/dist/src/services/extension-files.js +88 -0
- package/dist/src/services/extension-files.js.map +1 -0
- package/dist/src/services/extension-runtime.d.ts +33 -0
- package/dist/src/services/extension-runtime.d.ts.map +1 -1
- package/dist/src/services/extension-runtime.js +52 -0
- package/dist/src/services/extension-runtime.js.map +1 -1
- package/dist/src/services/file-refs.d.ts +105 -0
- package/dist/src/services/file-refs.d.ts.map +1 -0
- package/dist/src/services/file-refs.js +106 -0
- package/dist/src/services/file-refs.js.map +1 -0
- package/dist/src/services/message-send.d.ts.map +1 -1
- package/dist/src/services/message-send.js +4 -1
- package/dist/src/services/message-send.js.map +1 -1
- package/dist/src/services/metered-entitlements.d.ts +210 -0
- package/dist/src/services/metered-entitlements.d.ts.map +1 -0
- package/dist/src/services/metered-entitlements.js +268 -0
- package/dist/src/services/metered-entitlements.js.map +1 -0
- package/dist/src/services/notify.d.ts +7 -0
- package/dist/src/services/notify.d.ts.map +1 -1
- package/dist/src/services/notify.js +35 -0
- package/dist/src/services/notify.js.map +1 -1
- package/dist/src/services/owner-memory.d.ts +30 -1
- package/dist/src/services/owner-memory.d.ts.map +1 -1
- package/dist/src/services/owner-memory.js +31 -14
- package/dist/src/services/owner-memory.js.map +1 -1
- package/dist/src/services/owner-provisioning.d.ts +5 -0
- package/dist/src/services/owner-provisioning.d.ts.map +1 -1
- package/dist/src/services/owner-provisioning.js +20 -2
- package/dist/src/services/owner-provisioning.js.map +1 -1
- package/dist/src/services/task-files.d.ts +51 -0
- package/dist/src/services/task-files.d.ts.map +1 -0
- package/dist/src/services/task-files.js +58 -0
- package/dist/src/services/task-files.js.map +1 -0
- package/dist/src/services/upload-token.d.ts +29 -0
- package/dist/src/services/upload-token.d.ts.map +1 -1
- package/dist/src/services/upload-token.js +37 -0
- package/dist/src/services/upload-token.js.map +1 -1
- package/dist/src/services/upload-zip.d.ts +2 -0
- package/dist/src/services/upload-zip.d.ts.map +1 -1
- package/dist/src/services/upload-zip.js +5 -1
- package/dist/src/services/upload-zip.js.map +1 -1
- package/dist/src/services/workspace-meta.d.ts +15 -0
- package/dist/src/services/workspace-meta.d.ts.map +1 -1
- package/dist/src/services/workspace-meta.js +17 -0
- package/dist/src/services/workspace-meta.js.map +1 -1
- package/dist/src/services/workspace-provision.d.ts +3 -0
- package/dist/src/services/workspace-provision.d.ts.map +1 -1
- package/dist/src/services/workspace-provision.js +5 -3
- package/dist/src/services/workspace-provision.js.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js +10 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/apps.js +2 -0
- package/dist/src/storage/providers/postgres-kysely/methods/apps.js.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/identity.js +4 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity.js.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts +2 -0
- package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/memory.js +12 -1
- package/dist/src/storage/providers/postgres-kysely/methods/memory.js.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/organisms.d.ts.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/methods/organisms.js +5 -1
- package/dist/src/storage/providers/postgres-kysely/methods/organisms.js.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/migrations/0011_unique_verified_email.sql +25 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0012_unique_live_app_grant.sql +29 -0
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts +4 -0
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/apps.js +9 -0
- package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/governance.d.ts +1 -0
- package/dist/src/storage/providers/sqlite/methods/governance.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/governance.js +4 -1
- package/dist/src/storage/providers/sqlite/methods/governance.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts +1 -0
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.js +4 -0
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/owner.d.ts +5 -0
- package/dist/src/storage/providers/sqlite/methods/owner.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/owner.js +8 -0
- package/dist/src/storage/providers/sqlite/methods/owner.js.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.d.ts +3 -0
- package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.js +40 -0
- package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
- package/dist/src/storage/repositories/app-grant.repository.d.ts +9 -1
- package/dist/src/storage/repositories/app-grant.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/app.repository.d.ts +0 -0
- package/dist/src/storage/repositories/app.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/identity.repository.d.ts +6 -0
- package/dist/src/storage/repositories/identity.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/memory.repository.d.ts +14 -0
- package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories-impl/memory-repository.d.ts +8 -1
- package/dist/src/storage/repositories-impl/memory-repository.d.ts.map +1 -1
- package/dist/src/storage/repositories-impl/memory-repository.js +15 -4
- package/dist/src/storage/repositories-impl/memory-repository.js.map +1 -1
- package/dist/src/storage/types/agents-messaging.d.ts +19 -0
- package/dist/src/storage/types/agents-messaging.d.ts.map +1 -1
- package/dist/src/storage/types/agents-messaging.js.map +1 -1
- package/dist/src/storage/types/apps.d.ts +1 -0
- package/dist/src/storage/types/apps.d.ts.map +1 -1
- package/dist/src/storage/types/organisms-federation.d.ts +50 -0
- package/dist/src/storage/types/organisms-federation.d.ts.map +1 -1
- package/dist/src/utils/app-badge.d.ts.map +1 -1
- package/dist/src/utils/app-badge.js +7 -3
- package/dist/src/utils/app-badge.js.map +1 -1
- package/dist/src/utils/app-mobile-lint.d.ts +17 -0
- package/dist/src/utils/app-mobile-lint.d.ts.map +1 -0
- package/dist/src/utils/app-mobile-lint.js +40 -0
- package/dist/src/utils/app-mobile-lint.js.map +1 -0
- package/dist/static/app-catalog/_template.html +18 -82
- package/dist/static/app-catalog/js/apps-io.js +51 -165
- package/dist/static/app-catalog/js/cortex.js +3 -1
- package/dist/static/app-catalog/js/cost.js +100 -0
- package/dist/static/app-catalog/js/db.js +23 -93
- package/dist/static/app-catalog/js/detail.js +568 -59
- package/dist/static/app-catalog/js/favorites.js +71 -0
- package/dist/static/app-catalog/js/i18n-data.js +369 -19
- package/dist/static/app-catalog/js/main.js +50 -139
- package/dist/static/app-catalog/js/migrate.js +88 -0
- package/dist/static/app-catalog/js/monetize.js +205 -17
- package/dist/static/app-catalog/js/odps.js +489 -0
- package/dist/static/app-catalog/js/promote.js +70 -0
- package/dist/static/app-catalog/js/render.js +29 -139
- package/dist/static/app-catalog/js/server-io.js +126 -223
- package/dist/static/app-catalog/js/settings.js +11 -204
- package/dist/static/app-catalog/js/workcopy.js +198 -0
- package/dist/static/app-catalog/styles/app-catalog.css +100 -0
- package/dist/static/app-catalog.html +2220 -1029
- package/dist/static/sdk-libs/_core/config.js +52 -0
- package/dist/static/sdk-libs/_core/http.js +52 -0
- package/dist/static/sdk-libs/_core/namespace.js +33 -0
- package/dist/static/sdk-libs/_core/sdk-globals.d.ts +50 -0
- package/dist/static/sdk-libs/_core/session.js +66 -0
- package/dist/static/sdk-libs/agentface/index.js +102 -0
- package/dist/static/sdk-libs/agents/index.js +305 -0
- package/dist/static/sdk-libs/ai/index.js +153 -0
- package/dist/static/sdk-libs/audio/core.js +111 -0
- package/dist/static/sdk-libs/audio/index.js +380 -0
- package/dist/static/sdk-libs/audio/instruments.js +369 -0
- package/dist/static/sdk-libs/auth/cluster.js +97 -0
- package/dist/static/sdk-libs/auth/config.js +46 -0
- package/dist/static/sdk-libs/auth/crypto.js +166 -0
- package/dist/static/sdk-libs/auth/events.js +27 -0
- package/dist/static/sdk-libs/auth/i18n.js +64 -0
- package/dist/static/sdk-libs/auth/index.js +61 -0
- package/dist/static/sdk-libs/auth/locale.js +151 -0
- package/dist/static/sdk-libs/auth/modal.js +554 -0
- package/dist/static/sdk-libs/auth/palette.js +172 -0
- package/dist/static/sdk-libs/auth/pill.js +198 -0
- package/dist/static/sdk-libs/auth/session.js +792 -0
- package/dist/static/sdk-libs/auth/signup.js +232 -0
- package/dist/static/sdk-libs/auth/theme.js +137 -0
- package/dist/static/sdk-libs/capabilities/index.js +179 -0
- package/dist/static/sdk-libs/commerce/index.js +243 -0
- package/dist/static/sdk-libs/data/index.js +250 -0
- package/dist/static/sdk-libs/dist/aimeat-agentface.js +91 -0
- package/dist/static/sdk-libs/dist/aimeat-agents.js +348 -0
- package/dist/static/sdk-libs/dist/aimeat-ai.js +168 -0
- package/dist/static/sdk-libs/dist/aimeat-audio.js +979 -0
- package/dist/static/sdk-libs/dist/aimeat-auth.js +2232 -0
- package/dist/static/sdk-libs/dist/aimeat-capabilities.js +177 -0
- package/dist/static/sdk-libs/dist/aimeat-commerce.js +265 -0
- package/dist/static/sdk-libs/dist/aimeat-data.js +247 -0
- package/dist/static/sdk-libs/dist/aimeat-editor.js +299 -0
- package/dist/static/sdk-libs/dist/aimeat-header.js +270 -0
- package/dist/static/sdk-libs/dist/aimeat-intake.js +94 -0
- package/dist/static/sdk-libs/dist/aimeat-live.js +317 -0
- package/dist/static/sdk-libs/dist/aimeat-markdown.js +633 -0
- package/dist/static/sdk-libs/dist/aimeat-organism.js +394 -0
- package/dist/static/sdk-libs/dist/aimeat-portfolio-standalone.js +90 -0
- package/dist/static/sdk-libs/dist/aimeat-social.js +157 -0
- package/dist/static/sdk-libs/dist/aimeat-speech.js +300 -0
- package/dist/static/sdk-libs/dist/aimeat-storage.js +210 -0
- package/dist/static/sdk-libs/dist/aimeat-tunnel.js +383 -0
- package/dist/static/sdk-libs/dist/aimeat-wallet.js +118 -0
- package/dist/static/sdk-libs/dist/aimeat-webmcp.js +187 -0
- package/dist/static/sdk-libs/dist/aimeat-work.js +213 -0
- package/dist/static/sdk-libs/dist/aimeat-workflows.js +147 -0
- package/dist/static/sdk-libs/editor/index.js +229 -0
- package/dist/static/sdk-libs/header/index.js +249 -0
- package/dist/static/sdk-libs/intake/index.js +75 -0
- package/dist/static/sdk-libs/live/index.js +223 -0
- package/dist/static/sdk-libs/markdown/index.js +570 -0
- package/dist/static/sdk-libs/organism/index.js +381 -0
- package/dist/static/sdk-libs/portfolio-standalone/index.js +78 -0
- package/dist/static/sdk-libs/social/index.js +140 -0
- package/dist/static/sdk-libs/speech/index.js +321 -0
- package/dist/static/sdk-libs/storage/index.js +189 -0
- package/dist/static/sdk-libs/tunnel/index.js +428 -0
- package/dist/static/sdk-libs/wallet/index.js +115 -0
- package/dist/static/sdk-libs/webmcp/index.js +185 -0
- package/dist/static/sdk-libs/work/index.js +191 -0
- package/dist/static/sdk-libs/workflows/index.js +113 -0
- package/package.json +10 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file auth/crypto.js
|
|
3
|
+
* @description aimeat-auth crypto + storage core (SDK-libs migration Phase 3). Self-contained, no
|
|
4
|
+
* shared auth state: Ed25519 via Web Crypto (generate/import-as-non-extractable/sign), the
|
|
5
|
+
* IndexedDB non-extractable CryptoKey store (open/store/load/delete + one-time localStorage→IDB
|
|
6
|
+
* migration), the localStorage metadata helpers (save/load/remove — NEVER private keys), and JWT
|
|
7
|
+
* helpers (parseJwt/isExpired). Extracted verbatim from auth-lib-part1.ts.
|
|
8
|
+
* @structure generateKeyPair/importEd25519Key/isCryptoKey/sign · openKeyDB/storeKey/loadKey/deleteKey/
|
|
9
|
+
* migrateKeysToIndexedDB · save/load/remove · parseJwt/isExpired.
|
|
10
|
+
* @usage import { sign, parseJwt, save, load } from './crypto.js';
|
|
11
|
+
* @version-history
|
|
12
|
+
* v1.0.0 — 2026-07-19 — Extracted from src/routes/libs/auth-lib-part1.ts (SDK-libs migration Phase 3).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// ── Ed25519 via Web Crypto ──
|
|
16
|
+
|
|
17
|
+
export async function generateKeyPair() {
|
|
18
|
+
const key = /** @type {CryptoKeyPair} */ (await crypto.subtle.generateKey('Ed25519', true, ['sign', 'verify']));
|
|
19
|
+
const privRaw = await crypto.subtle.exportKey('pkcs8', key.privateKey);
|
|
20
|
+
const pubRaw = await crypto.subtle.exportKey('spki', key.publicKey);
|
|
21
|
+
// Extract raw 32-byte keys from DER wrappers
|
|
22
|
+
const privBytes = new Uint8Array(privRaw).slice(-32);
|
|
23
|
+
const pubBytes = new Uint8Array(pubRaw).slice(-32);
|
|
24
|
+
return {
|
|
25
|
+
privateKey: btoa(String.fromCharCode(...privBytes)),
|
|
26
|
+
publicKey: btoa(String.fromCharCode(...pubBytes)),
|
|
27
|
+
cryptoKey: key,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// SECURITY: Import raw Ed25519 private key as non-extractable CryptoKey
|
|
32
|
+
export async function importEd25519Key(privateKeyBase64) {
|
|
33
|
+
const privBytes = Uint8Array.from(atob(privateKeyBase64), c => c.charCodeAt(0));
|
|
34
|
+
// Build PKCS8 DER wrapper for Ed25519
|
|
35
|
+
const pkcs8Prefix = new Uint8Array([48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32]);
|
|
36
|
+
const pkcs8 = new Uint8Array(pkcs8Prefix.length + privBytes.length);
|
|
37
|
+
pkcs8.set(pkcs8Prefix);
|
|
38
|
+
pkcs8.set(privBytes, pkcs8Prefix.length);
|
|
39
|
+
const cryptoKey = await crypto.subtle.importKey('pkcs8', pkcs8, 'Ed25519', false /* non-extractable */, ['sign']);
|
|
40
|
+
// Zero raw key bytes
|
|
41
|
+
privBytes.fill(0);
|
|
42
|
+
pkcs8.fill(0);
|
|
43
|
+
return cryptoKey;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function isCryptoKey(value) {
|
|
47
|
+
if (!value || typeof value !== 'object') return false;
|
|
48
|
+
if (typeof CryptoKey !== 'undefined' && value instanceof CryptoKey) return true;
|
|
49
|
+
return Object.prototype.toString.call(value) === '[object CryptoKey]';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Sign using CryptoKey (preferred) or base64 key string (fallback)
|
|
53
|
+
export async function sign(keyOrB64, message) {
|
|
54
|
+
let key = keyOrB64;
|
|
55
|
+
if (typeof keyOrB64 === 'string') {
|
|
56
|
+
// Legacy path: raw base64 key → import as CryptoKey
|
|
57
|
+
key = await importEd25519Key(keyOrB64);
|
|
58
|
+
}
|
|
59
|
+
if (!isCryptoKey(key)) {
|
|
60
|
+
throw new Error('AIMEAT signing key is missing or invalid. Please sign in again.');
|
|
61
|
+
}
|
|
62
|
+
const msgBytes = new TextEncoder().encode(message);
|
|
63
|
+
const sigBytes = await crypto.subtle.sign('Ed25519', key, msgBytes);
|
|
64
|
+
return btoa(String.fromCharCode(...new Uint8Array(sigBytes)));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ── IndexedDB Key Store (SECURITY: non-extractable CryptoKeys) ──
|
|
68
|
+
|
|
69
|
+
const KEY_DB_NAME = 'aimeat_keys';
|
|
70
|
+
const KEY_STORE_NAME = 'cryptokeys';
|
|
71
|
+
|
|
72
|
+
function openKeyDB() {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
const req = indexedDB.open(KEY_DB_NAME, 1);
|
|
75
|
+
req.onupgradeneeded = () => req.result.createObjectStore(KEY_STORE_NAME);
|
|
76
|
+
req.onsuccess = () => resolve(req.result);
|
|
77
|
+
req.onerror = () => reject(req.error);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export async function storeKey(name, cryptoKey) {
|
|
82
|
+
const db = /** @type {IDBDatabase} */ (await openKeyDB());
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
const tx = db.transaction(KEY_STORE_NAME, 'readwrite');
|
|
85
|
+
tx.objectStore(KEY_STORE_NAME).put(cryptoKey, name);
|
|
86
|
+
tx.oncomplete = () => { db.close(); resolve(undefined); };
|
|
87
|
+
tx.onerror = () => { db.close(); reject(tx.error); };
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export async function loadKey(name) {
|
|
92
|
+
const db = /** @type {IDBDatabase} */ (await openKeyDB());
|
|
93
|
+
return new Promise((resolve) => {
|
|
94
|
+
const tx = db.transaction(KEY_STORE_NAME, 'readonly');
|
|
95
|
+
const req = tx.objectStore(KEY_STORE_NAME).get(name);
|
|
96
|
+
req.onsuccess = () => { db.close(); resolve(req.result || null); };
|
|
97
|
+
req.onerror = () => { db.close(); resolve(null); };
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function deleteKey(name) {
|
|
102
|
+
try {
|
|
103
|
+
const db = /** @type {IDBDatabase} */ (await openKeyDB());
|
|
104
|
+
return new Promise((resolve) => {
|
|
105
|
+
const tx = db.transaction(KEY_STORE_NAME, 'readwrite');
|
|
106
|
+
tx.objectStore(KEY_STORE_NAME).delete(name);
|
|
107
|
+
tx.oncomplete = () => { db.close(); resolve(undefined); };
|
|
108
|
+
tx.onerror = () => { db.close(); resolve(undefined); };
|
|
109
|
+
});
|
|
110
|
+
} catch { /* IndexedDB may not be available */ }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Migrate legacy localStorage keys to IndexedDB (one-time)
|
|
114
|
+
export async function migrateKeysToIndexedDB() {
|
|
115
|
+
try {
|
|
116
|
+
const session = load('session');
|
|
117
|
+
if (session && session.privateKey) {
|
|
118
|
+
const cryptoKey = await importEd25519Key(session.privateKey);
|
|
119
|
+
await storeKey('agent_key', cryptoKey);
|
|
120
|
+
// Remove private key from localStorage, keep metadata
|
|
121
|
+
delete session.privateKey;
|
|
122
|
+
save('session', session);
|
|
123
|
+
}
|
|
124
|
+
const ownerKey = load('owner_key');
|
|
125
|
+
if (typeof ownerKey === 'string' && ownerKey.length > 0) {
|
|
126
|
+
const cryptoKey = await importEd25519Key(ownerKey);
|
|
127
|
+
await storeKey('owner_key', cryptoKey);
|
|
128
|
+
remove('owner_key');
|
|
129
|
+
}
|
|
130
|
+
} catch (e) {
|
|
131
|
+
console.warn('AIMEAT: Key migration to IndexedDB failed, falling back to localStorage', e);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ── Storage helpers (metadata only — NO private keys) ──
|
|
136
|
+
|
|
137
|
+
const STORAGE_PREFIX = 'aimeat_';
|
|
138
|
+
|
|
139
|
+
export function save(key, value) {
|
|
140
|
+
try { localStorage.setItem(STORAGE_PREFIX + key, JSON.stringify(value)); } catch { /* storage blocked */ }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function load(key) {
|
|
144
|
+
try { const v = localStorage.getItem(STORAGE_PREFIX + key); return v ? JSON.parse(v) : null; } catch { return null; }
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function remove(key) {
|
|
148
|
+
try { localStorage.removeItem(STORAGE_PREFIX + key); } catch { /* storage blocked */ }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ── JWT helpers ──
|
|
152
|
+
|
|
153
|
+
export function parseJwt(token) {
|
|
154
|
+
try {
|
|
155
|
+
const parts = token.split('.');
|
|
156
|
+
if (parts.length !== 3) return null;
|
|
157
|
+
const payload = JSON.parse(atob(parts[1].replace(/-/g, '+').replace(/_/g, '/')));
|
|
158
|
+
return payload;
|
|
159
|
+
} catch { return null; }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function isExpired(jwt) {
|
|
163
|
+
const payload = parseJwt(jwt);
|
|
164
|
+
if (!payload || !payload.exp) return true;
|
|
165
|
+
return Date.now() / 1000 > payload.exp - 60; // 60s grace
|
|
166
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file auth/events.js
|
|
3
|
+
* @description aimeat-auth event bus (SDK-libs migration Phase 3). The shared listener registry +
|
|
4
|
+
* emit/on/off that the session layer, pill, modal and boot all use to broadcast
|
|
5
|
+
* 'login'/'logout'/'refreshed'/'expired'/'session-updated'/'scopes-stale'/'popup-blocked' events.
|
|
6
|
+
* `listeners` is only ever mutated in place (never reassigned), so importing it across modules is
|
|
7
|
+
* safe. Extracted from auth-lib-part2.ts.
|
|
8
|
+
* @structure listeners · emit(event, data) · on(event, fn) · off(event, fn).
|
|
9
|
+
* @usage import { emit, on, off } from './events.js';
|
|
10
|
+
* @version-history
|
|
11
|
+
* v1.0.0 — 2026-07-19 — Extracted from src/routes/libs/auth-lib-part2.ts (SDK-libs migration Phase 3).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** @type {Record<string, Array<(data: any) => void>>} */
|
|
15
|
+
export const listeners = {};
|
|
16
|
+
|
|
17
|
+
export function emit(event, data) { (listeners[event] || []).forEach(fn => fn(data)); }
|
|
18
|
+
|
|
19
|
+
export function on(event, fn) {
|
|
20
|
+
if (!listeners[event]) listeners[event] = [];
|
|
21
|
+
listeners[event].push(fn);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function off(event, fn) {
|
|
25
|
+
if (!listeners[event]) return;
|
|
26
|
+
listeners[event] = listeners[event].filter(f => f !== fn);
|
|
27
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file auth/i18n.js
|
|
3
|
+
* @description aimeat-auth sign-in-modal language helpers (SDK-libs migration Phase 3). The modal can
|
|
4
|
+
* be shown standalone (e.g. a custom portal page) where the canonical header + its language switcher
|
|
5
|
+
* is absent, so it owns its own EN/FI switch and loads translations itself, using the same
|
|
6
|
+
* 'aimeat-lang' localStorage key + cookie the header uses so the choice stays in sync with the SPA.
|
|
7
|
+
* loadModalI18n fetches en.json (base) + <lang>.json (overrides) from the node and returns just the
|
|
8
|
+
* modal.* strings with the 'modal.' prefix stripped. Extracted from auth-lib-part2.ts.
|
|
9
|
+
* @structure MODAL_LANG_KEY · currentModalLang() · flattenModalI18n() · loadModalI18n(lang).
|
|
10
|
+
* @usage import { currentModalLang, loadModalI18n } from './i18n.js';
|
|
11
|
+
* @version-history
|
|
12
|
+
* v1.0.0 — 2026-07-19 — Extracted from src/routes/libs/auth-lib-part2.ts (SDK-libs migration Phase 3).
|
|
13
|
+
*/
|
|
14
|
+
import { NODE_URL } from './config.js';
|
|
15
|
+
|
|
16
|
+
export var MODAL_LANG_KEY = 'aimeat-lang';
|
|
17
|
+
|
|
18
|
+
export function currentModalLang() {
|
|
19
|
+
try {
|
|
20
|
+
var u = new URLSearchParams(location.search).get('lang');
|
|
21
|
+
if (u === 'en' || u === 'fi') return u;
|
|
22
|
+
var s = localStorage.getItem(MODAL_LANG_KEY);
|
|
23
|
+
if (s === 'en' || s === 'fi') return s;
|
|
24
|
+
} catch { /* storage blocked */ }
|
|
25
|
+
return (navigator.language || 'en').slice(0, 2).toLowerCase() === 'fi' ? 'fi' : 'en';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function flattenModalI18n(obj, prefix, out) {
|
|
29
|
+
out = out || {}; prefix = prefix || '';
|
|
30
|
+
for (var k in obj) {
|
|
31
|
+
if (!Object.prototype.hasOwnProperty.call(obj, k)) continue;
|
|
32
|
+
var key = prefix ? prefix + '.' + k : k;
|
|
33
|
+
var v = obj[k];
|
|
34
|
+
if (v && typeof v === 'object' && !Array.isArray(v)) flattenModalI18n(v, key, out);
|
|
35
|
+
else out[key] = v;
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Fetch en.json (base) + <lang>.json (overrides) from the node and return just the modal.* strings
|
|
41
|
+
// with the 'modal.' prefix stripped — the shape the modal (and every mountLoginButton caller) expects
|
|
42
|
+
// for opts.i18n.
|
|
43
|
+
export async function loadModalI18n(lang) {
|
|
44
|
+
var v = Date.now();
|
|
45
|
+
var t = {};
|
|
46
|
+
try {
|
|
47
|
+
var enRes = await fetch(NODE_URL + '/locales/en.json?v=' + v);
|
|
48
|
+
if (enRes.ok) t = flattenModalI18n(await enRes.json());
|
|
49
|
+
} catch { /* offline / missing locales — fall through to fallbacks */ }
|
|
50
|
+
if (lang !== 'en') {
|
|
51
|
+
try {
|
|
52
|
+
var locRes = await fetch(NODE_URL + '/locales/' + lang + '.json?v=' + v);
|
|
53
|
+
if (locRes.ok) {
|
|
54
|
+
var loc = flattenModalI18n(await locRes.json());
|
|
55
|
+
for (var lk in loc) if (Object.prototype.hasOwnProperty.call(loc, lk)) t[lk] = loc[lk];
|
|
56
|
+
}
|
|
57
|
+
} catch { /* locale missing — English fallback stands */ }
|
|
58
|
+
}
|
|
59
|
+
var out = {};
|
|
60
|
+
for (var k in t) {
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(t, k) && k.indexOf('modal.') === 0) out[k.slice(6)] = t[k];
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file auth/index.js
|
|
3
|
+
* @description Entry for the aimeat-auth library (SDK-libs migration Phase 3). Assembles the auth
|
|
4
|
+
* surface from its modules (crypto/config/events/i18n/theme/session/pill/modal/signup), wires boot
|
|
5
|
+
* (first-time OIDC signup prompt on load; token refresh on tab focus/visibility), and exposes
|
|
6
|
+
* window.AIMEAT.auth + AIMEAT.version. esbuild bundles this + all imports into the classic IIFE
|
|
7
|
+
* served, unchanged, at /v1/libs/aimeat-auth.js. Replaces the ~2200-line JS-in-a-string monolith
|
|
8
|
+
* (auth-lib.ts + auth-lib-part1/2/3.ts).
|
|
9
|
+
* @structure imports auth + refreshOnFocus (session) + maybeShowGoogleSignup (signup) + attach; boot
|
|
10
|
+
* listeners; attach('auth', auth) + version.
|
|
11
|
+
* @usage <script src="/v1/libs/aimeat-auth.js"></script> const s = await AIMEAT.auth.login();
|
|
12
|
+
* @version-history
|
|
13
|
+
* v1.2.0 — 2026-07-26 — An embedded app inherits the embedder's look: aimeatRestoreMode() joins
|
|
14
|
+
* aimeatRestorePalette() at parse time, so ?mode= / ?palette= in the frame URL win over an
|
|
15
|
+
* origin's own storage without overwriting it.
|
|
16
|
+
* v1.1.0 — 2026-07-25 — Palette surface: AIMEAT.auth.getPalette/setPalette/getPalettes + the
|
|
17
|
+
* stored palette applied at parse time (theme system v2).
|
|
18
|
+
* v1.0.0 — 2026-07-19 — Componentized rewrite of src/routes/libs/auth-lib*.ts (SDK-libs migration Phase 3).
|
|
19
|
+
*/
|
|
20
|
+
import { auth, refreshOnFocus } from './session.js';
|
|
21
|
+
import { maybeShowGoogleSignup } from './signup.js';
|
|
22
|
+
import { attach } from '../_core/namespace.js';
|
|
23
|
+
import { readLocales, aimeatReadLang, aimeatApplyLang } from './locale.js';
|
|
24
|
+
import { PALETTES, aimeatReadPalette, aimeatApplyPalette, aimeatRestorePalette } from './palette.js';
|
|
25
|
+
import { aimeatRestoreMode } from './theme.js';
|
|
26
|
+
|
|
27
|
+
// ── Boot: first-time OIDC signup prompt (after the callback bounced back with ?aimeat_signup=1) ──
|
|
28
|
+
if (typeof document !== 'undefined' && document.addEventListener) {
|
|
29
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', maybeShowGoogleSignup);
|
|
30
|
+
else maybeShowGoogleSignup();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ── Boot: refresh on focus / visibility (timers don't fire while asleep/frozen) ──
|
|
34
|
+
if (typeof document !== 'undefined' && document.addEventListener) {
|
|
35
|
+
document.addEventListener('visibilitychange', () => {
|
|
36
|
+
if (document.visibilityState === 'visible') refreshOnFocus();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
40
|
+
window.addEventListener('focus', refreshOnFocus);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ── Expose globally ──
|
|
44
|
+
// Locale, resolved the ONE way this platform resolves it ('aimeat-lang': ?lang= -> localStorage
|
|
45
|
+
// -> cookie -> navigator). The pill renders the control; these let an app read and set the same
|
|
46
|
+
// value without re-implementing the lookup and drifting from it. They hang off `auth` (NOT the
|
|
47
|
+
// return of attach(), which is the whole window.AIMEAT namespace) so they land on AIMEAT.auth.
|
|
48
|
+
auth.getLang = function (locales) { return aimeatReadLang(readLocales({ locales: locales })); };
|
|
49
|
+
auth.setLang = function (lang) { aimeatApplyLang(String(lang).toLowerCase()); };
|
|
50
|
+
// Palette (the designed look, orthogonal to light/dark — 'aimeat-palette' + <html data-palette>).
|
|
51
|
+
// The pill renders the picker; these let an app read/set/enumerate the same value.
|
|
52
|
+
auth.getPalette = function () { return aimeatReadPalette(); };
|
|
53
|
+
auth.setPalette = function (id) { aimeatApplyPalette(String(id).toLowerCase()); };
|
|
54
|
+
auth.getPalettes = function () { return PALETTES.map(function (p) { return { id: p.id, label: p.label, swatch: p.swatch }; }); };
|
|
55
|
+
|
|
56
|
+
// Apply the stored palette at parse time (before any UI mounts), so a published app follows the
|
|
57
|
+
// user's chosen look with zero app code — the same free ride the mode snippet gives light/dark.
|
|
58
|
+
if (typeof document !== 'undefined') { aimeatRestorePalette(); aimeatRestoreMode(); }
|
|
59
|
+
|
|
60
|
+
const ns = attach('auth', auth);
|
|
61
|
+
ns.version = '2026-07-25-002';
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file auth/locale.js
|
|
3
|
+
* @description The LANGUAGE switch that travels inside the login pill, exactly as the light/dark
|
|
4
|
+
* toggle does — so every embedding app inherits one identical control instead of hand-rolling its
|
|
5
|
+
* own. Before this, each app invented its own switcher (a text button, a select, a pair of links),
|
|
6
|
+
* and three different storage keys were in play: the SPA's 'aimeat-lang', the aimeat-i18n cortex's
|
|
7
|
+
* 'aimeat-i18n-locale', and a URL parameter read by nobody in particular.
|
|
8
|
+
*
|
|
9
|
+
* ONE key: 'aimeat-lang' — the same one the SPA and the sign-in modal already use. Reading order is
|
|
10
|
+
* ?lang= → localStorage → cookie → navigator, matching public/js/utils.js detectLocale() so an app
|
|
11
|
+
* and the SPA agree on the same origin. Writing sets localStorage AND the cookie and fires an
|
|
12
|
+
* 'aimeat-lang-change' window event; an app re-renders on that event and never manages the control.
|
|
13
|
+
*
|
|
14
|
+
* The app declares which languages it HAS — the pill cannot guess. Either
|
|
15
|
+
* `<meta name="aimeat-locales" content="en fi">` (preferred: declarative, like aimeat-scopes) or
|
|
16
|
+
* `mountLoginButton('#login', { locales: ['en','fi'] })`. Declare nothing and no switch renders,
|
|
17
|
+
* so a single-language app is unaffected.
|
|
18
|
+
* @structure AIMEAT_LANG_KEY · readLocales · aimeatReadLang/aimeatApplyLang · langName ·
|
|
19
|
+
* langSwitchHtml/wireLangSwitch
|
|
20
|
+
* @usage import { langSwitchHtml, wireLangSwitch } from './locale.js';
|
|
21
|
+
* In the app: window.addEventListener('aimeat-lang-change', e => render(e.detail.lang));
|
|
22
|
+
* @version-history
|
|
23
|
+
* v2.0.0 — 2026-07-25 — Segmented control (every option visible, one click to any) up to three
|
|
24
|
+
* languages; a popover list beyond that. Replaces the cycling button, which with three or more
|
|
25
|
+
* languages was a blind carousel.
|
|
26
|
+
* v1.0.0 — 2026-07-25 — Initial. Born from "the language switcher is different in EVERY app".
|
|
27
|
+
*/
|
|
28
|
+
import { escHtml } from './theme.js';
|
|
29
|
+
import { clampPopover } from './cluster.js';
|
|
30
|
+
|
|
31
|
+
/** The one locale key on this platform. Same as public/js/utils.js and auth/i18n.js. */
|
|
32
|
+
export var AIMEAT_LANG_KEY = 'aimeat-lang';
|
|
33
|
+
|
|
34
|
+
/** Two-letter codes the APP says it supports. Order matters: it is the cycle order. */
|
|
35
|
+
export function readLocales(opts) {
|
|
36
|
+
var list = (opts && Array.isArray(opts.locales)) ? opts.locales : null;
|
|
37
|
+
if (!list) {
|
|
38
|
+
try {
|
|
39
|
+
var m = /** @type {HTMLMetaElement|null} */ (document.querySelector('meta[name="aimeat-locales"]'));
|
|
40
|
+
if (m && m.content) list = m.content.split(/[\s,]+/);
|
|
41
|
+
} catch { /* no document */ }
|
|
42
|
+
}
|
|
43
|
+
if (!list) return [];
|
|
44
|
+
var seen = {}, out = [];
|
|
45
|
+
for (var i = 0; i < list.length; i++) {
|
|
46
|
+
var c = String(list[i] || '').trim().toLowerCase();
|
|
47
|
+
if (/^[a-z]{2}$/.test(c) && !seen[c]) { seen[c] = 1; out.push(c); }
|
|
48
|
+
}
|
|
49
|
+
return out.length > 1 ? out : []; // one language needs no switch
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Current locale, resolved the same way the SPA resolves it. */
|
|
53
|
+
export function aimeatReadLang(locales) {
|
|
54
|
+
var ok = function (v) { return v && locales.indexOf(v) >= 0 ? v : null; };
|
|
55
|
+
try {
|
|
56
|
+
var u = ok(new URLSearchParams(location.search).get('lang'));
|
|
57
|
+
if (u) return u;
|
|
58
|
+
var s = ok(localStorage.getItem(AIMEAT_LANG_KEY));
|
|
59
|
+
if (s) return s;
|
|
60
|
+
var c = document.cookie.match(/(?:^|;\s*)aimeat-lang=([a-z]{2})(?:;|$)/);
|
|
61
|
+
if (c && ok(c[1])) return c[1];
|
|
62
|
+
} catch { /* storage blocked */ }
|
|
63
|
+
var nav = ok((navigator.language || '').slice(0, 2).toLowerCase());
|
|
64
|
+
return nav || locales[0];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function aimeatApplyLang(lang) {
|
|
68
|
+
try {
|
|
69
|
+
localStorage.setItem(AIMEAT_LANG_KEY, lang);
|
|
70
|
+
document.cookie = 'aimeat-lang=' + lang + ';path=/;max-age=31536000;SameSite=Lax';
|
|
71
|
+
} catch { /* storage blocked */ }
|
|
72
|
+
try { document.documentElement.setAttribute('lang', lang); } catch { /* no document */ }
|
|
73
|
+
try { window.dispatchEvent(new CustomEvent('aimeat-lang-change', { detail: { lang: lang } })); } catch { /* no window */ }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The language's own name for the picker list ("suomi", not "Finnish"), code as the fallback. */
|
|
77
|
+
function langName(code) {
|
|
78
|
+
try {
|
|
79
|
+
var dn = new Intl.DisplayNames([code], { type: 'language' });
|
|
80
|
+
var n = dn.of(code);
|
|
81
|
+
if (n && n !== code) return n.charAt(0).toUpperCase() + n.slice(1);
|
|
82
|
+
} catch { /* Intl.DisplayNames unavailable */ }
|
|
83
|
+
return code.toUpperCase();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** How many languages still fit as a segmented control before the picker becomes a popover list. */
|
|
87
|
+
var SEGMENT_MAX = 3;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The control: every declared language VISIBLE, the active one marked, one click to any — never a
|
|
91
|
+
* blind cycle. Up to three languages render as a segmented group (FI | EN); four or more become a
|
|
92
|
+
* popover list (current code as the trigger) so eight languages cost the header no more width than
|
|
93
|
+
* two. Cluster classes come from cluster.js (ensureClusterStyles).
|
|
94
|
+
*/
|
|
95
|
+
export function langSwitchHtml(i, locales) {
|
|
96
|
+
if (!locales.length) return '';
|
|
97
|
+
var cur = aimeatReadLang(locales);
|
|
98
|
+
var group = (i && i.switchLanguage ? i.switchLanguage : 'Language');
|
|
99
|
+
if (locales.length <= SEGMENT_MAX) {
|
|
100
|
+
return '<span id="aimeat-lang-switch" class="aimeat-seg" role="group" aria-label="' + escHtml(group) + '">'
|
|
101
|
+
+ locales.map(function (c) {
|
|
102
|
+
return '<button type="button" data-lang="' + escHtml(c) + '" aria-pressed="' + (c === cur) + '" '
|
|
103
|
+
+ 'title="' + escHtml(langName(c)) + '" aria-label="' + escHtml(langName(c)) + '">'
|
|
104
|
+
+ escHtml(c.toUpperCase()) + '</button>';
|
|
105
|
+
}).join('')
|
|
106
|
+
+ '</span>';
|
|
107
|
+
}
|
|
108
|
+
return '<span id="aimeat-lang-switch" class="aimeat-pop-wrap">'
|
|
109
|
+
+ '<button type="button" class="aimeat-pop-btn" aria-haspopup="listbox" aria-expanded="false" '
|
|
110
|
+
+ 'title="' + escHtml(group) + '" aria-label="' + escHtml(group) + '">'
|
|
111
|
+
+ escHtml(cur.toUpperCase()) + ' <span aria-hidden="true">▾</span></button>'
|
|
112
|
+
+ '<span class="aimeat-pop aimeat-pop-list" role="listbox">'
|
|
113
|
+
+ locales.map(function (c) {
|
|
114
|
+
return '<button type="button" role="option" data-lang="' + escHtml(c) + '" aria-pressed="' + (c === cur) + '">'
|
|
115
|
+
+ escHtml(c.toUpperCase()) + ' · ' + escHtml(langName(c)) + '</button>';
|
|
116
|
+
}).join('')
|
|
117
|
+
+ '</span></span>';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function wireLangSwitch(container, i, locales) {
|
|
121
|
+
var root = container.querySelector('#aimeat-lang-switch');
|
|
122
|
+
if (!root || !locales.length) return;
|
|
123
|
+
var trigger = root.querySelector('.aimeat-pop-btn');
|
|
124
|
+
function sync(cur) {
|
|
125
|
+
root.querySelectorAll('button[data-lang]').forEach(function (b) {
|
|
126
|
+
b.setAttribute('aria-pressed', String(b.getAttribute('data-lang') === cur));
|
|
127
|
+
});
|
|
128
|
+
if (trigger) trigger.childNodes[0].textContent = cur.toUpperCase() + ' ';
|
|
129
|
+
}
|
|
130
|
+
root.querySelectorAll('button[data-lang]').forEach(function (b) {
|
|
131
|
+
b.addEventListener('click', function () {
|
|
132
|
+
aimeatApplyLang(b.getAttribute('data-lang'));
|
|
133
|
+
sync(b.getAttribute('data-lang'));
|
|
134
|
+
root.classList.remove('aimeat-open');
|
|
135
|
+
if (trigger) trigger.setAttribute('aria-expanded', 'false');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
if (trigger) trigger.addEventListener('click', function (ev) {
|
|
139
|
+
ev.stopPropagation();
|
|
140
|
+
var open = root.classList.toggle('aimeat-open');
|
|
141
|
+
trigger.setAttribute('aria-expanded', String(open));
|
|
142
|
+
if (open) clampPopover(root.querySelector('.aimeat-pop'));
|
|
143
|
+
});
|
|
144
|
+
// Stay truthful when the APP sets the language itself (AIMEAT.auth.setLang, a deep link, the
|
|
145
|
+
// i18n cortex): a control showing the wrong language is worse than no control.
|
|
146
|
+
window.addEventListener('aimeat-lang-change', function (ev) {
|
|
147
|
+
var e = /** @type {CustomEvent} */ (ev);
|
|
148
|
+
var lang = e && e.detail && e.detail.lang;
|
|
149
|
+
if (lang && locales.indexOf(lang) >= 0) sync(lang);
|
|
150
|
+
});
|
|
151
|
+
}
|