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,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file header/index.js
|
|
3
|
+
* @description The aimeat-header library (SDK-libs migration Phase 1). A drop-in script that renders
|
|
4
|
+
* the canonical AIMEAT site header (brand + morsel count, nav links, language switcher, and the
|
|
5
|
+
* live golden login pill with its theme toggle) inside any standalone page such as a custom portal
|
|
6
|
+
* template. It reuses the real auth library (aimeat-auth.js → mountLoginButton) so login is
|
|
7
|
+
* identical to the SPA, links /css/theme.css so styling matches, and reads the same localStorage
|
|
8
|
+
* keys so theme/language stay in sync with the SPA. Componentized ESM source esbuild bundles to the
|
|
9
|
+
* IIFE served, unchanged, at /v1/libs/aimeat-header.js. Ported verbatim from lib-header.ts; this is
|
|
10
|
+
* a self-running shim (mounts into #aimeat-header or prepends to <body>) — it does not attach to
|
|
11
|
+
* window.AIMEAT, so it imports nothing from _core.
|
|
12
|
+
* @structure readLang/readTheme/applyTheme/flatten/ensureThemeCss/loadScript/loadTranslations/
|
|
13
|
+
* modalI18n/buildMarkup/wire/refreshSession/init — runs init() on DOM ready.
|
|
14
|
+
* @usage <div id="aimeat-header"></div><script src="/v1/libs/aimeat-header.js"></script>
|
|
15
|
+
* @version-history
|
|
16
|
+
* v1.0.0 — 2026-07-19 — Migrated from src/routes/lib-header.ts (SDK-libs migration Phase 1).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
if (!window.__AIMEAT_HEADER_MOUNTED__) {
|
|
20
|
+
window.__AIMEAT_HEADER_MOUNTED__ = true;
|
|
21
|
+
main();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function main() {
|
|
25
|
+
var THEME_KEY = 'aimeat-theme';
|
|
26
|
+
var LANG_KEY = 'aimeat-lang';
|
|
27
|
+
var NAV_FALLBACK = {
|
|
28
|
+
'nav.try': 'Try it', 'nav.devView': 'For Developers', 'nav.help': 'Help',
|
|
29
|
+
'nav.apps': 'Apps', 'nav.profile': 'Profile', 'nav.admin': 'Admin',
|
|
30
|
+
'nav.themeToDark': 'Switch to dark mode', 'nav.themeToLight': 'Switch to light mode',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function readLang() {
|
|
34
|
+
try {
|
|
35
|
+
var u = new URLSearchParams(location.search).get('lang');
|
|
36
|
+
if (u === 'en' || u === 'fi') return u;
|
|
37
|
+
var s = localStorage.getItem(LANG_KEY);
|
|
38
|
+
if (s === 'en' || s === 'fi') return s;
|
|
39
|
+
} catch { /* storage blocked */ }
|
|
40
|
+
return (navigator.language || 'en').slice(0, 2).toLowerCase() === 'fi' ? 'fi' : 'en';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function readTheme() {
|
|
44
|
+
try {
|
|
45
|
+
var s = localStorage.getItem(THEME_KEY);
|
|
46
|
+
if (s === 'light' || s === 'dark') return s;
|
|
47
|
+
} catch { /* storage blocked */ }
|
|
48
|
+
return (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function applyTheme(t) {
|
|
52
|
+
document.documentElement.dataset.theme = t;
|
|
53
|
+
try { localStorage.setItem(THEME_KEY, t); } catch { /* storage blocked */ }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function flatten(obj, prefix, out) {
|
|
57
|
+
out = out || {}; prefix = prefix || '';
|
|
58
|
+
for (var k in obj) {
|
|
59
|
+
if (!Object.prototype.hasOwnProperty.call(obj, k)) continue;
|
|
60
|
+
var key = prefix ? prefix + '.' + k : k;
|
|
61
|
+
var v = obj[k];
|
|
62
|
+
if (v && typeof v === 'object' && !Array.isArray(v)) flatten(v, key, out);
|
|
63
|
+
else out[key] = v;
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function ensureThemeCss() {
|
|
69
|
+
var present = Array.prototype.some.call(document.querySelectorAll('link[rel=stylesheet]'), function (l) {
|
|
70
|
+
return (l.getAttribute('href') || '').indexOf('/css/theme.css') !== -1;
|
|
71
|
+
});
|
|
72
|
+
if (present) return;
|
|
73
|
+
var link = document.createElement('link');
|
|
74
|
+
link.rel = 'stylesheet';
|
|
75
|
+
link.href = '/css/theme.css';
|
|
76
|
+
link.setAttribute('data-aimeat-theme-css', '');
|
|
77
|
+
// Insert first so the page's own <style> still wins on shared selectors (body, etc.).
|
|
78
|
+
document.head.insertBefore(link, document.head.firstChild);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function loadScript(src) {
|
|
82
|
+
return new Promise(function (resolve) {
|
|
83
|
+
var existing = document.querySelector('script[src="' + src + '"]');
|
|
84
|
+
if (existing) { resolve(undefined); return; }
|
|
85
|
+
var s = document.createElement('script');
|
|
86
|
+
s.src = src; s.onload = resolve; s.onerror = resolve;
|
|
87
|
+
document.head.appendChild(s);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function loadTranslations(lang) {
|
|
92
|
+
var v = Date.now();
|
|
93
|
+
var t = {};
|
|
94
|
+
try {
|
|
95
|
+
var enRes = await fetch('/locales/en.json?v=' + v);
|
|
96
|
+
if (enRes.ok) t = flatten(await enRes.json());
|
|
97
|
+
} catch { /* offline / missing locales — fall through to fallbacks */ }
|
|
98
|
+
if (lang !== 'en') {
|
|
99
|
+
try {
|
|
100
|
+
var locRes = await fetch('/locales/' + lang + '.json?v=' + v);
|
|
101
|
+
if (locRes.ok) {
|
|
102
|
+
var loc = flatten(await locRes.json());
|
|
103
|
+
for (var k in loc) if (Object.prototype.hasOwnProperty.call(loc, k)) t[k] = loc[k];
|
|
104
|
+
}
|
|
105
|
+
} catch { /* locale missing — English fallback stands */ }
|
|
106
|
+
}
|
|
107
|
+
return t;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function modalI18n(t) {
|
|
111
|
+
var keys = ['descNew', 'descReturning', 'usernameLabel', 'usernamePlaceholder', 'passwordLabel',
|
|
112
|
+
'passwordPlaceholder', 'displayNameLabel', 'displayNameHint', 'displayNamePlaceholder', 'signInBtn',
|
|
113
|
+
'cancelBtn', 'working', 'errUserShort', 'errPassShort', 'errWrongPass', 'loggedIn', 'logoutBtn',
|
|
114
|
+
'forgotPassword', 'forgotUsername', 'resetPasswordTitle', 'resetPasswordDesc', 'sendResetCode',
|
|
115
|
+
'backToLogin', 'resetCodeSent', 'enterNewPasswordTitle', 'codeLabel', 'newPasswordLabel',
|
|
116
|
+
'newPasswordPlaceholder', 'errPassWeak', 'resetPassword', 'resetSuccess', 'recoverUsernameTitle',
|
|
117
|
+
'recoverUsernameDesc', 'emailLabel', 'sendUsername', 'usernameSent', 'whyTitle', 'whyGhii',
|
|
118
|
+
'whyPrivacy', 'whyAgents', 'whyMorsels'];
|
|
119
|
+
var obj = {};
|
|
120
|
+
for (var i = 0; i < keys.length; i++) {
|
|
121
|
+
var val = t['modal.' + keys[i]];
|
|
122
|
+
if (typeof val === 'string') obj[keys[i]] = val;
|
|
123
|
+
}
|
|
124
|
+
return obj;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function buildMarkup(t) {
|
|
128
|
+
function label(k) { return t[k] || NAV_FALLBACK[k] || k; }
|
|
129
|
+
var nav = document.createElement('nav');
|
|
130
|
+
nav.className = 'topnav';
|
|
131
|
+
nav.innerHTML =
|
|
132
|
+
'<div style="display:flex;align-items:center;gap:20px">' +
|
|
133
|
+
'<a href="/v1/portal" class="topnav-brand">AIME<span class="heart">♥</span><span class="brand-at">AT</span></a>' +
|
|
134
|
+
'<span class="brand-morsels" data-morsels style="display:none"></span>' +
|
|
135
|
+
'</div>' +
|
|
136
|
+
'<div class="topnav-right">' +
|
|
137
|
+
'<button class="topnav-burger" aria-label="Menu" data-burger>☰</button>' +
|
|
138
|
+
'<div class="topnav-menu" data-menu>' +
|
|
139
|
+
'<a href="/v1/classic">' + label('nav.try') + '</a>' +
|
|
140
|
+
'<a href="/v1/portal?view=dev">' + label('nav.devView') + '</a>' +
|
|
141
|
+
'<a href="/v1/help">' + label('nav.help') + '</a>' +
|
|
142
|
+
'<a href="/app-catalog.html" target="_blank" data-auth-only style="display:none">' + label('nav.apps') + '</a>' +
|
|
143
|
+
'<a href="/v1/profile" class="profile-link visible" data-auth-only style="display:none">' + label('nav.profile') + '</a>' +
|
|
144
|
+
'<a href="/v1/admin" data-operator-only style="display:none">' + label('nav.admin') + '</a>' +
|
|
145
|
+
'<div class="topnav-center">' +
|
|
146
|
+
// Theme toggle now lives inside the login pill (mountLoginButton) — see init().
|
|
147
|
+
'<button class="lang-btn" data-lang="en">EN</button>' +
|
|
148
|
+
'<button class="lang-btn" data-lang="fi">FI</button>' +
|
|
149
|
+
'</div>' +
|
|
150
|
+
'</div>' +
|
|
151
|
+
'<span class="header-auth-slot" id="headerAuth"></span>' +
|
|
152
|
+
'</div>';
|
|
153
|
+
return nav;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function wire(nav, t, lang) {
|
|
157
|
+
// Burger
|
|
158
|
+
var burger = nav.querySelector('[data-burger]');
|
|
159
|
+
var menu = nav.querySelector('[data-menu]');
|
|
160
|
+
burger.addEventListener('click', function () { menu.classList.toggle('open'); });
|
|
161
|
+
|
|
162
|
+
// (Theme toggle moved into the login pill — see mountLoginButton in init().)
|
|
163
|
+
|
|
164
|
+
// Language buttons
|
|
165
|
+
nav.querySelectorAll('[data-lang]').forEach(function (b) {
|
|
166
|
+
if (b.getAttribute('data-lang') === lang) b.classList.add('active');
|
|
167
|
+
b.addEventListener('click', function () {
|
|
168
|
+
var next = b.getAttribute('data-lang');
|
|
169
|
+
try {
|
|
170
|
+
localStorage.setItem(LANG_KEY, next);
|
|
171
|
+
document.cookie = 'aimeat-lang=' + next + ';path=/;max-age=31536000;SameSite=Lax';
|
|
172
|
+
} catch { /* storage blocked — cookie may still be set */ }
|
|
173
|
+
location.reload();
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function refreshSession(nav) {
|
|
179
|
+
var hasSession = !!(window.AIMEAT && window.AIMEAT.auth && window.AIMEAT.auth.hasSession);
|
|
180
|
+
var session = hasSession && window.AIMEAT.auth.getSession ? window.AIMEAT.auth.getSession() : null;
|
|
181
|
+
nav.querySelectorAll('[data-auth-only]').forEach(function (el) {
|
|
182
|
+
/** @type {HTMLElement} */ (el).style.display = session ? '' : 'none';
|
|
183
|
+
});
|
|
184
|
+
var isOp = session && session.roles && session.roles.indexOf('operator') !== -1;
|
|
185
|
+
nav.querySelectorAll('[data-operator-only]').forEach(function (el) {
|
|
186
|
+
/** @type {HTMLElement} */ (el).style.display = isOp ? '' : 'none';
|
|
187
|
+
});
|
|
188
|
+
var morselEl = /** @type {HTMLElement} */ (nav.querySelector('[data-morsels]'));
|
|
189
|
+
if (session && session.jwt) {
|
|
190
|
+
fetch('/v1/wallet', { headers: { 'Authorization': 'Bearer ' + session.jwt } })
|
|
191
|
+
.then(function (r) { return r.json(); })
|
|
192
|
+
.then(function (d) {
|
|
193
|
+
if (d && d.ok && d.data && d.data.balance != null) {
|
|
194
|
+
morselEl.textContent = d.data.balance;
|
|
195
|
+
morselEl.style.display = 'inline-flex';
|
|
196
|
+
} else { morselEl.style.display = 'none'; }
|
|
197
|
+
})
|
|
198
|
+
.catch(function () { morselEl.style.display = 'none'; });
|
|
199
|
+
} else {
|
|
200
|
+
morselEl.style.display = 'none';
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function init() {
|
|
205
|
+
applyTheme(readTheme());
|
|
206
|
+
ensureThemeCss();
|
|
207
|
+
var lang = readLang();
|
|
208
|
+
document.documentElement.lang = lang;
|
|
209
|
+
|
|
210
|
+
var t = await loadTranslations(lang);
|
|
211
|
+
var nav = buildMarkup(t);
|
|
212
|
+
|
|
213
|
+
var mount = document.getElementById('aimeat-header');
|
|
214
|
+
if (mount) { mount.appendChild(nav); }
|
|
215
|
+
else { document.body.insertBefore(nav, document.body.firstChild); }
|
|
216
|
+
|
|
217
|
+
wire(nav, t, lang);
|
|
218
|
+
|
|
219
|
+
// Live login pill — the real thing, identical to the SPA.
|
|
220
|
+
await loadScript('/v1/libs/aimeat-auth.js');
|
|
221
|
+
if (window.AIMEAT && window.AIMEAT.auth && window.AIMEAT.auth.login) {
|
|
222
|
+
try { await window.AIMEAT.auth.login(); } catch { /* not signed in — pill renders logged-out */ }
|
|
223
|
+
}
|
|
224
|
+
function mountPill() {
|
|
225
|
+
try {
|
|
226
|
+
if (window.AIMEAT && window.AIMEAT.auth && window.AIMEAT.auth.mountLoginButton) {
|
|
227
|
+
var pillI18n = modalI18n(t);
|
|
228
|
+
// Labels for the theme toggle the pill now renders.
|
|
229
|
+
pillI18n.themeToDark = t['nav.themeToDark'] || NAV_FALLBACK['nav.themeToDark'];
|
|
230
|
+
pillI18n.themeToLight = t['nav.themeToLight'] || NAV_FALLBACK['nav.themeToLight'];
|
|
231
|
+
window.AIMEAT.auth.mountLoginButton('#headerAuth', {
|
|
232
|
+
onLogin: function () { window.dispatchEvent(new Event('aimeat-auth-change')); },
|
|
233
|
+
onLogout: function () { window.dispatchEvent(new Event('aimeat-auth-change')); },
|
|
234
|
+
i18n: pillI18n,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
} catch (e) { console.error('AIMEAT header: auth mount failed', e); }
|
|
238
|
+
}
|
|
239
|
+
mountPill();
|
|
240
|
+
refreshSession(nav);
|
|
241
|
+
window.addEventListener('aimeat-auth-change', function () { refreshSession(nav); });
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (document.readyState === 'loading') {
|
|
245
|
+
document.addEventListener('DOMContentLoaded', function () { init(); });
|
|
246
|
+
} else {
|
|
247
|
+
init();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file intake/index.js
|
|
3
|
+
* @description The aimeat-intake library (SDK-libs migration Phase 1). The browser client for the
|
|
4
|
+
* generic Public Intake capability, two audiences in one lib: (1) the PUBLIC form renderer (no
|
|
5
|
+
* session) — getForm()/submit() hit the no-auth intake endpoint, working cross-origin because the
|
|
6
|
+
* node base URL is resolved from _core/config (APEX_URL) or the auth lib's nodeUrl; (2) the OWNER
|
|
7
|
+
* (needs aimeat-auth) — defineForm()/listForms()/deleteForm() manage a workspace's intake forms.
|
|
8
|
+
* Componentized ESM source esbuild bundles to the IIFE served, unchanged, at /v1/libs/aimeat-intake.js.
|
|
9
|
+
* Ported verbatim from lib-intake.ts; the baked ${config.baseUrl} is now APEX_URL from _core/config.
|
|
10
|
+
* @structure imports APEX_URL (config) + attach (namespace); base()/enc()/submitPath(); public
|
|
11
|
+
* getForm/submit; owner authFetch/defineForm/listForms/deleteForm; attach('intake', …).
|
|
12
|
+
* @usage <script src="/v1/libs/aimeat-intake.js"></script>
|
|
13
|
+
* const form = await AIMEAT.intake.getForm(org, ws, 'contact-us');
|
|
14
|
+
* await AIMEAT.intake.submit(org, ws, 'contact-us', { nimi: '…', email: '…' });
|
|
15
|
+
* @version-history
|
|
16
|
+
* v1.0.0 — 2026-07-19 — Migrated from src/routes/lib-intake.ts (SDK-libs migration Phase 1).
|
|
17
|
+
*/
|
|
18
|
+
import { APEX_URL } from '../_core/config.js';
|
|
19
|
+
import { attach } from '../_core/namespace.js';
|
|
20
|
+
|
|
21
|
+
function base() {
|
|
22
|
+
// Prefer the auth lib's node URL (same node), else the baked apex base (from _core/config prelude).
|
|
23
|
+
if (window.AIMEAT && window.AIMEAT.auth && window.AIMEAT.auth.nodeUrl) return String(window.AIMEAT.auth.nodeUrl).replace(/\/+$/, '');
|
|
24
|
+
return APEX_URL;
|
|
25
|
+
}
|
|
26
|
+
function enc(s) { return encodeURIComponent(String(s == null ? '' : s)); }
|
|
27
|
+
function submitPath(org, ws, formId) { return '/v1/intake/' + enc(org) + '/' + enc(ws) + '/' + enc(formId); }
|
|
28
|
+
|
|
29
|
+
// ── PUBLIC (no session) ──────────────────────────────────────────────────────
|
|
30
|
+
async function getForm(org, ws, formId) {
|
|
31
|
+
var res = await fetch(base() + submitPath(org, ws, formId), { headers: { 'Accept': 'application/json' } });
|
|
32
|
+
var body = await res.json().catch(function () { return null; });
|
|
33
|
+
if (!body || body.ok === false) throw new Error((body && body.error && body.error.message) || 'Form not found');
|
|
34
|
+
return body.data;
|
|
35
|
+
}
|
|
36
|
+
async function submit(org, ws, formId, values) {
|
|
37
|
+
var res = await fetch(base() + submitPath(org, ws, formId), {
|
|
38
|
+
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(values || {}),
|
|
39
|
+
});
|
|
40
|
+
var body = await res.json().catch(function () { return null; });
|
|
41
|
+
if (!body || body.ok === false) {
|
|
42
|
+
var e = /** @type {Error & { code?: string, details?: unknown }} */ (new Error((body && body.error && body.error.message) || 'Submit failed'));
|
|
43
|
+
e.code = body && body.error && body.error.code;
|
|
44
|
+
e.details = body && body.error && body.error.details;
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
return body.data; // { ok, id, mode }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ── OWNER (needs aimeat-auth) ─────────────────────────────────────────────────
|
|
51
|
+
async function authFetch(path, opts) {
|
|
52
|
+
if (!window.AIMEAT || !window.AIMEAT.auth) throw new Error('AIMEAT.auth is required for owner methods (load aimeat-auth.js first)');
|
|
53
|
+
var s = window.AIMEAT.auth.getSession();
|
|
54
|
+
if (!s) throw new Error('Not logged in. Call AIMEAT.auth.login() first.');
|
|
55
|
+
var res = await s.fetch(path, opts);
|
|
56
|
+
if (res && typeof res.json === 'function') res = await res.json();
|
|
57
|
+
return res;
|
|
58
|
+
}
|
|
59
|
+
async function defineForm(cfg) {
|
|
60
|
+
var body = await authFetch('/v1/intake/forms', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(cfg || {}) });
|
|
61
|
+
if (!body || body.ok === false) throw new Error((body && body.error && body.error.message) || 'defineForm failed');
|
|
62
|
+
return body.data; // { form_id, submit_url, discoverable, enabled, mode }
|
|
63
|
+
}
|
|
64
|
+
async function listForms(org, ws) {
|
|
65
|
+
var body = await authFetch('/v1/intake/forms?organism_id=' + enc(org) + '&ws=' + enc(ws));
|
|
66
|
+
if (!body || body.ok === false) throw new Error((body && body.error && body.error.message) || 'listForms failed');
|
|
67
|
+
return (body.data && body.data.forms) || [];
|
|
68
|
+
}
|
|
69
|
+
async function deleteForm(org, ws, formId) {
|
|
70
|
+
var body = await authFetch('/v1/intake/forms?organism_id=' + enc(org) + '&ws=' + enc(ws) + '&form_id=' + enc(formId), { method: 'DELETE' });
|
|
71
|
+
if (!body || body.ok === false) throw new Error((body && body.error && body.error.message) || 'deleteForm failed');
|
|
72
|
+
return body.data;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
attach('intake', { getForm: getForm, submit: submit, defineForm: defineForm, listForms: listForms, deleteForm: deleteForm, submitPath: submitPath, nodeUrl: base() });
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file live/index.js
|
|
3
|
+
* @description The aimeat-live library (SDK-libs migration Phase 1, TARGET-012). Exposes AIMEAT.live
|
|
4
|
+
* — the realtime "subscribe to server-pushed domain changes" helper that wraps the node's SSE
|
|
5
|
+
* transport (POST /v1/events/ticket → GET /v1/events?ticket=) in ONE shared, multi-tab-elected
|
|
6
|
+
* EventSource (Web Locks + BroadcastChannel) with debounce, Page-Visibility gating and
|
|
7
|
+
* exponential-backoff reconnect. Subscribers re-fetch only when the server says their domain
|
|
8
|
+
* changed. Componentized ESM source esbuild bundles to the IIFE served, unchanged, at
|
|
9
|
+
* /v1/libs/aimeat-live.js. Ported verbatim from lib-live.ts.
|
|
10
|
+
* @structure imports getSession (session) + attach (namespace); the shared EventSource state machine
|
|
11
|
+
* (connect/startShared/_open/ingest/flush/dispatch/reconnect/disconnect/subscribe); attach('live', …).
|
|
12
|
+
* @usage <script src="/v1/libs/aimeat-auth.js"></script><script src="/v1/libs/aimeat-live.js"></script>
|
|
13
|
+
* const off = AIMEAT.live.subscribe(['agent-tasks','organisms'], (domains) => reload());
|
|
14
|
+
* @version-history
|
|
15
|
+
* v1.0.0 — 2026-07-19 — Migrated from src/routes/lib-live.ts (SDK-libs migration Phase 1).
|
|
16
|
+
* v1.1.0 — 2026-07-25 — subscribe() takes a third options argument: { keyPrefix, agent, ownerScope,
|
|
17
|
+
* minIntervalMs }. On a multi-agent fleet the 'memory' domain fires continuously, so every
|
|
18
|
+
* subscriber effectively polled. keyPrefix gates on a cheap server-side COUNT (the change frame
|
|
19
|
+
* carries no key, so a new key is detected and an in-place update is not). Additive.
|
|
20
|
+
*/
|
|
21
|
+
import { makeSession } from '../_core/session.js';
|
|
22
|
+
const { getSession } = makeSession('aimeat-live.js');
|
|
23
|
+
import { attach } from '../_core/namespace.js';
|
|
24
|
+
|
|
25
|
+
var es = null;
|
|
26
|
+
var subscribers = []; // { domains: Set<string>|null, fn } (null = all)
|
|
27
|
+
var debounceTimer = null;
|
|
28
|
+
var refCount = 0;
|
|
29
|
+
var reconnectTimer = null;
|
|
30
|
+
var reconnectDelay = 5000;
|
|
31
|
+
var everOpened = false;
|
|
32
|
+
var MAX_RECONNECT_DELAY = 120000;
|
|
33
|
+
var DEBOUNCE_MS = 1000; // match server COALESCE_MS
|
|
34
|
+
var pendingDomains = new Set(); // null => "everything changed"
|
|
35
|
+
var hadHiddenUpdate = false;
|
|
36
|
+
|
|
37
|
+
// Multi-tab sharing
|
|
38
|
+
var started = false;
|
|
39
|
+
var isLeader = false;
|
|
40
|
+
var bc = null;
|
|
41
|
+
var leaderRelease = null;
|
|
42
|
+
var leaderAbort = null;
|
|
43
|
+
|
|
44
|
+
function connect() {
|
|
45
|
+
refCount++;
|
|
46
|
+
if (started) return;
|
|
47
|
+
started = true;
|
|
48
|
+
startShared();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function startShared() {
|
|
52
|
+
var canShare = (typeof BroadcastChannel !== 'undefined') && (typeof navigator !== 'undefined') && navigator.locks;
|
|
53
|
+
if (!canShare) { becomeLeader(); return; }
|
|
54
|
+
bc = new BroadcastChannel('aimeat-live');
|
|
55
|
+
bc.onmessage = function (ev) { if (ev.data && ev.data.type === 'domains') ingestDomains(ev.data.domains); };
|
|
56
|
+
leaderAbort = new AbortController();
|
|
57
|
+
navigator.locks.request('aimeat-live-leader', { mode: 'exclusive', signal: leaderAbort.signal }, function () {
|
|
58
|
+
return new Promise(function (release) { leaderRelease = release; becomeLeader(); });
|
|
59
|
+
}).catch(function () { /* aborted while queued */ });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function becomeLeader() { if (isLeader) return; isLeader = true; _open(); }
|
|
63
|
+
function relay(domains) { if (bc) { try { bc.postMessage({ type: 'domains', domains: domains }); } catch { /* channel closed */ } } }
|
|
64
|
+
|
|
65
|
+
async function _open() {
|
|
66
|
+
var session;
|
|
67
|
+
try { session = getSession(); } catch { scheduleReconnect(); return; }
|
|
68
|
+
try {
|
|
69
|
+
var r = await session.fetch('/v1/events/ticket', { method: 'POST' });
|
|
70
|
+
if (!r || !r.ok || !r.data || !r.data.ticket) { scheduleReconnect(); return; }
|
|
71
|
+
es = new EventSource('/v1/events?ticket=' + encodeURIComponent(r.data.ticket));
|
|
72
|
+
es.onopen = function () {
|
|
73
|
+
reconnectDelay = 5000;
|
|
74
|
+
if (everOpened) { ingestDomains(null); relay(null); } // reconnect catch-up: reconcile all
|
|
75
|
+
everOpened = true;
|
|
76
|
+
};
|
|
77
|
+
es.onmessage = function (event) {
|
|
78
|
+
reconnectDelay = 5000;
|
|
79
|
+
var domains = null;
|
|
80
|
+
try { var p = JSON.parse(event.data); if (Array.isArray(p.domains)) domains = p.domains; } catch { /* non-JSON keep-alive frame */ }
|
|
81
|
+
ingestDomains(domains); relay(domains);
|
|
82
|
+
};
|
|
83
|
+
es.onerror = function () { if (es) { es.close(); es = null; } scheduleReconnect(); };
|
|
84
|
+
} catch { scheduleReconnect(); }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function ingestDomains(domains) {
|
|
88
|
+
if (domains === null) pendingDomains = null;
|
|
89
|
+
else if (pendingDomains !== null) domains.forEach(function (d) { pendingDomains.add(d); });
|
|
90
|
+
clearTimeout(debounceTimer);
|
|
91
|
+
debounceTimer = setTimeout(flushDomains, DEBOUNCE_MS);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function flushDomains() {
|
|
95
|
+
if (typeof document !== 'undefined' && document.hidden) { hadHiddenUpdate = true; return; }
|
|
96
|
+
var dset = pendingDomains;
|
|
97
|
+
pendingDomains = new Set();
|
|
98
|
+
dispatch(dset);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function dispatch(dset) {
|
|
102
|
+
// window event first (family convention: apps may listen instead of subscribe)
|
|
103
|
+
try { window.dispatchEvent(new CustomEvent('aimeat-live-update', { detail: { domains: dset } })); } catch { /* no window */ }
|
|
104
|
+
var list = subscribers.slice();
|
|
105
|
+
for (var i = 0; i < list.length; i++) {
|
|
106
|
+
var s = list[i];
|
|
107
|
+
if (dset === null || s.domains === null) { try { s.fn(dset); } catch { /* subscriber threw */ } continue; }
|
|
108
|
+
var it = dset.values ? dset.values() : dset[Symbol.iterator]();
|
|
109
|
+
var hit = false, n;
|
|
110
|
+
while (!(n = it.next()).done) { if (s.domains.has(n.value)) { hit = true; break; } }
|
|
111
|
+
if (hit) { try { s.fn(dset); } catch { /* subscriber threw */ } }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function scheduleReconnect() {
|
|
116
|
+
clearTimeout(reconnectTimer);
|
|
117
|
+
if (refCount > 0 && isLeader) {
|
|
118
|
+
reconnectTimer = setTimeout(function () { if (refCount > 0) _open(); }, reconnectDelay);
|
|
119
|
+
reconnectDelay = Math.min(reconnectDelay * 2, MAX_RECONNECT_DELAY);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (typeof document !== 'undefined') {
|
|
124
|
+
document.addEventListener('visibilitychange', function () {
|
|
125
|
+
if (!document.hidden && hadHiddenUpdate) { hadHiddenUpdate = false; pendingDomains = null; flushDomains(); }
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function disconnect() {
|
|
130
|
+
refCount = Math.max(0, refCount - 1);
|
|
131
|
+
if (refCount === 0) {
|
|
132
|
+
started = false;
|
|
133
|
+
if (es) { es.close(); es = null; }
|
|
134
|
+
if (leaderAbort) { try { leaderAbort.abort(); } catch { /* already aborted */ } leaderAbort = null; }
|
|
135
|
+
if (leaderRelease) { try { leaderRelease(); } catch { /* already released */ } leaderRelease = null; }
|
|
136
|
+
isLeader = false;
|
|
137
|
+
if (bc) { try { bc.close(); } catch { /* already closed */ } bc = null; }
|
|
138
|
+
clearTimeout(debounceTimer); clearTimeout(reconnectTimer);
|
|
139
|
+
reconnectDelay = 5000; everOpened = false; pendingDomains = new Set(); hadHiddenUpdate = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Subscribe to specific domains (or null = all). Auto-connects on first subscribe.
|
|
145
|
+
* Returns an unsubscribe function.
|
|
146
|
+
*
|
|
147
|
+
* opts (all optional, all additive — a two-argument call behaves exactly as before):
|
|
148
|
+
* keyPrefix — string | string[]. Only fire when the number of the caller's memory keys
|
|
149
|
+
* under one of these prefixes has CHANGED since the last check. The server's
|
|
150
|
+
* change frame carries a domain name only (see services/event-bus.ts), never
|
|
151
|
+
* the key that changed, so this is a client-side gate: on each 'memory' event
|
|
152
|
+
* the lib asks for a cheap server-side COUNT (`?count=true`, no values, its
|
|
153
|
+
* cache invalidated by any write) and stays quiet when the count is unmoved.
|
|
154
|
+
* LIMITATION, by design of the frame: a NEW key is detected, an in-place
|
|
155
|
+
* UPDATE of an existing key is not. For update-sensitive views pass
|
|
156
|
+
* minIntervalMs instead of (or with) keyPrefix.
|
|
157
|
+
* agent — GAII to scope the count to one agent's namespace.
|
|
158
|
+
* ownerScope — count across the owner's GHII + agents (an app-grant token needs this).
|
|
159
|
+
* minIntervalMs— never invoke the callback more often than this. On a fleet with many agents
|
|
160
|
+
* the 'memory' domain is a firehose; this is the blunt version of the gate.
|
|
161
|
+
*
|
|
162
|
+
* Why this exists: a multi-agent owner writes memory constantly, so `subscribe(['memory'], reload)`
|
|
163
|
+
* fires more or less continuously, and every subscriber that re-fetched a full listing on each
|
|
164
|
+
* event turned one agent's activity into a permanent poll.
|
|
165
|
+
*/
|
|
166
|
+
function subscribe(domains, fn, opts) {
|
|
167
|
+
if (typeof domains === 'function') { opts = fn; fn = domains; domains = null; }
|
|
168
|
+
opts = opts || {};
|
|
169
|
+
var prefixes = opts.keyPrefix
|
|
170
|
+
? (Array.isArray(opts.keyPrefix) ? opts.keyPrefix.slice() : [opts.keyPrefix])
|
|
171
|
+
: null;
|
|
172
|
+
var minInterval = opts.minIntervalMs > 0 ? opts.minIntervalMs : 0;
|
|
173
|
+
var counts = Object.create(null); // prefix -> last seen count
|
|
174
|
+
var lastCall = 0;
|
|
175
|
+
var probing = false;
|
|
176
|
+
var primed = !prefixes; // with keyPrefix, the first event only records a baseline
|
|
177
|
+
|
|
178
|
+
function pass(dset) { lastCall = Date.now(); try { fn(dset); } catch { /* subscriber threw */ } }
|
|
179
|
+
|
|
180
|
+
function gate(dset) {
|
|
181
|
+
if (minInterval && (Date.now() - lastCall) < minInterval) return;
|
|
182
|
+
if (!prefixes) { pass(dset); return; }
|
|
183
|
+
if (probing) return; // one probe in flight is enough
|
|
184
|
+
probing = true;
|
|
185
|
+
Promise.all(prefixes.map(function (p) {
|
|
186
|
+
var qs = 'count=true&prefix=' + encodeURIComponent(p) +
|
|
187
|
+
(opts.agent ? '&agent=' + encodeURIComponent(opts.agent)
|
|
188
|
+
: (opts.ownerScope ? '&owner_scope=true' : ''));
|
|
189
|
+
return getSession().fetch('/v1/memory?' + qs)
|
|
190
|
+
.then(function (r) {
|
|
191
|
+
var c = r && r.data && typeof r.data.count === 'number' ? r.data.count : null;
|
|
192
|
+
return { prefix: p, count: c };
|
|
193
|
+
})
|
|
194
|
+
.catch(function () { return { prefix: p, count: null }; });
|
|
195
|
+
})).then(function (res) {
|
|
196
|
+
probing = false;
|
|
197
|
+
var changed = false;
|
|
198
|
+
res.forEach(function (r) {
|
|
199
|
+
if (r.count == null) return; // probe failed: do not claim a change
|
|
200
|
+
if (counts[r.prefix] !== r.count) { changed = true; counts[r.prefix] = r.count; }
|
|
201
|
+
});
|
|
202
|
+
// A failed/unavailable probe must not silence a real update forever: if we could not
|
|
203
|
+
// establish any baseline, fall through and let the subscriber decide.
|
|
204
|
+
if (!primed) { primed = true; if (res.every(function (r) { return r.count != null; })) return; }
|
|
205
|
+
if (changed) pass(dset);
|
|
206
|
+
}).catch(function () { probing = false; });
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
var entry = { domains: domains ? new Set(domains) : null, fn: gate };
|
|
210
|
+
subscribers.push(entry);
|
|
211
|
+
connect();
|
|
212
|
+
return function () {
|
|
213
|
+
var i = subscribers.indexOf(entry);
|
|
214
|
+
if (i >= 0) { subscribers.splice(i, 1); disconnect(); }
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
attach('live', {
|
|
219
|
+
connect: connect,
|
|
220
|
+
disconnect: disconnect,
|
|
221
|
+
subscribe: subscribe,
|
|
222
|
+
onUpdate: function (fn) { return subscribe(null, fn); },
|
|
223
|
+
});
|