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,428 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file tunnel/index.js
|
|
3
|
+
* @description The aimeat-tunnel library (SDK-libs migration Phase 2). Exposes AIMEAT.tunnel — an
|
|
4
|
+
* auto-reconnecting WebSocket tunnel between a personal node and the operator: heartbeat with
|
|
5
|
+
* dead-connection detection, request/response handling, mailbox sync + ack, exponential-backoff
|
|
6
|
+
* reconnect with jitter, and status callbacks. Over the AIMEAT.auth session (jwt in the ws URL).
|
|
7
|
+
* Componentized ESM source esbuild bundles to the IIFE served, unchanged, at /v1/libs/aimeat-tunnel.js.
|
|
8
|
+
* Ported verbatim from lib-tunnel.ts; NODE_URL + the default heartbeat interval come from _core/config.
|
|
9
|
+
* @structure imports NODE_URL/HEARTBEAT_MS (config) + getSession (session) + attach (namespace);
|
|
10
|
+
* uuid(); the TunnelClient prototype class; the `tunnel` public API; attach('tunnel', …).
|
|
11
|
+
* @usage <script src="/v1/libs/aimeat-auth.js"></script><script src="/v1/libs/aimeat-tunnel.js"></script>
|
|
12
|
+
* const tunnel = AIMEAT.tunnel.connect({ onRequest, onMailbox });
|
|
13
|
+
* @version-history
|
|
14
|
+
* v1.0.0 — 2026-07-19 — Migrated from src/routes/lib-tunnel.ts (SDK-libs migration Phase 2).
|
|
15
|
+
*/
|
|
16
|
+
import { NODE_URL, HEARTBEAT_MS } from '../_core/config.js';
|
|
17
|
+
import { makeSession } from '../_core/session.js';
|
|
18
|
+
const { getSession } = makeSession('aimeat-tunnel.js');
|
|
19
|
+
import { attach } from '../_core/namespace.js';
|
|
20
|
+
|
|
21
|
+
function uuid() {
|
|
22
|
+
return crypto.randomUUID ? crypto.randomUUID() :
|
|
23
|
+
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
24
|
+
var r = Math.random() * 16 | 0;
|
|
25
|
+
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ── TunnelClient class ──
|
|
30
|
+
|
|
31
|
+
function TunnelClient(opts) {
|
|
32
|
+
this._opts = Object.assign({
|
|
33
|
+
heartbeatIntervalMs: HEARTBEAT_MS,
|
|
34
|
+
reconnect: true,
|
|
35
|
+
reconnectBaseMs: 1000,
|
|
36
|
+
reconnectMaxMs: 60000,
|
|
37
|
+
reconnectJitter: true,
|
|
38
|
+
maxReconnectAttempts: Infinity,
|
|
39
|
+
requestTimeoutMs: 30000,
|
|
40
|
+
onRequest: null, // async (msg) => response_payload
|
|
41
|
+
onMailbox: null, // (items) => void
|
|
42
|
+
onDeliveryReceipt: null, // (receipt) => void
|
|
43
|
+
onStatusChange: null, // (status: 'connecting'|'online'|'degraded'|'offline') => void
|
|
44
|
+
onError: null, // (error) => void
|
|
45
|
+
}, opts || {});
|
|
46
|
+
|
|
47
|
+
this._ws = null;
|
|
48
|
+
this._status = 'offline';
|
|
49
|
+
this._heartbeatTimer = null;
|
|
50
|
+
this._reconnectTimer = null;
|
|
51
|
+
this._reconnectAttempts = 0;
|
|
52
|
+
this._pendingResponses = new Map();
|
|
53
|
+
this._closed = false;
|
|
54
|
+
this._lastHeartbeatAck = 0;
|
|
55
|
+
this._serverConfig = null; // Populated by welcome message
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
TunnelClient.prototype._setStatus = function (status) {
|
|
59
|
+
if (this._status !== status) {
|
|
60
|
+
this._status = status;
|
|
61
|
+
if (this._opts.onStatusChange) {
|
|
62
|
+
try { this._opts.onStatusChange(status); } catch (e) { console.error('[aimeat-tunnel] onStatusChange error:', e); }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
TunnelClient.prototype.connect = function () {
|
|
68
|
+
if (this._closed) return;
|
|
69
|
+
|
|
70
|
+
this._setStatus('connecting');
|
|
71
|
+
|
|
72
|
+
var session = getSession();
|
|
73
|
+
var wsUrl = NODE_URL.replace(/^http/, 'ws') + '/v1/personal/tunnel?token=' + encodeURIComponent(session.jwt);
|
|
74
|
+
var self = this;
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
this._ws = new WebSocket(wsUrl);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
this._setStatus('offline');
|
|
80
|
+
if (this._opts.onError) this._opts.onError(e);
|
|
81
|
+
this._scheduleReconnect();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
this._ws.onopen = function () {
|
|
86
|
+
self._reconnectAttempts = 0;
|
|
87
|
+
self._lastHeartbeatAck = Date.now();
|
|
88
|
+
self._setStatus('online');
|
|
89
|
+
self._startHeartbeat();
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
this._ws.onmessage = function (event) {
|
|
93
|
+
try {
|
|
94
|
+
var msg = JSON.parse(event.data);
|
|
95
|
+
self._handleMessage(msg);
|
|
96
|
+
} catch (e) {
|
|
97
|
+
console.error('[aimeat-tunnel] Invalid message:', e);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
this._ws.onclose = function () {
|
|
102
|
+
self._cleanup();
|
|
103
|
+
self._setStatus('offline');
|
|
104
|
+
if (!self._closed) {
|
|
105
|
+
self._scheduleReconnect();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
this._ws.onerror = function (err) {
|
|
110
|
+
if (self._opts.onError) self._opts.onError(err);
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
TunnelClient.prototype._handleMessage = function (msg) {
|
|
115
|
+
switch (msg.type) {
|
|
116
|
+
case 'welcome':
|
|
117
|
+
this._handleWelcome(msg);
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
case 'request':
|
|
121
|
+
this._handleRequest(msg);
|
|
122
|
+
break;
|
|
123
|
+
|
|
124
|
+
case 'heartbeat_ack':
|
|
125
|
+
this._lastHeartbeatAck = Date.now();
|
|
126
|
+
break;
|
|
127
|
+
|
|
128
|
+
case 'mailbox_sync':
|
|
129
|
+
this._handleMailboxSync(msg);
|
|
130
|
+
break;
|
|
131
|
+
|
|
132
|
+
case 'delivery_receipt':
|
|
133
|
+
if (this._opts.onDeliveryReceipt && msg.payload) {
|
|
134
|
+
try { this._opts.onDeliveryReceipt(JSON.parse(msg.payload)); } catch { /* ignore */ }
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
|
|
138
|
+
case 'response': {
|
|
139
|
+
// Response to a request we sent (if acting as requester)
|
|
140
|
+
var pending = this._pendingResponses.get(msg.id);
|
|
141
|
+
if (pending) {
|
|
142
|
+
clearTimeout(pending.timer);
|
|
143
|
+
this._pendingResponses.delete(msg.id);
|
|
144
|
+
pending.resolve(msg);
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
default:
|
|
150
|
+
console.warn('[aimeat-tunnel] Unknown message type:', msg.type);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
TunnelClient.prototype._handleWelcome = function (msg) {
|
|
155
|
+
if (!msg.payload) return;
|
|
156
|
+
try {
|
|
157
|
+
this._serverConfig = JSON.parse(msg.payload);
|
|
158
|
+
|
|
159
|
+
// Auto-tune heartbeat interval from server hint
|
|
160
|
+
if (this._serverConfig.heartbeat_interval_ms) {
|
|
161
|
+
this._opts.heartbeatIntervalMs = this._serverConfig.heartbeat_interval_ms;
|
|
162
|
+
// Restart heartbeat with server-recommended interval
|
|
163
|
+
if (this._heartbeatTimer) this._startHeartbeat();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Apply reconnect hints from server
|
|
167
|
+
if (this._serverConfig.reconnect_hint) {
|
|
168
|
+
var hint = this._serverConfig.reconnect_hint;
|
|
169
|
+
if (hint.base_ms) this._opts.reconnectBaseMs = hint.base_ms;
|
|
170
|
+
if (hint.max_ms) this._opts.reconnectMaxMs = hint.max_ms;
|
|
171
|
+
if (hint.jitter !== undefined) this._opts.reconnectJitter = hint.jitter;
|
|
172
|
+
}
|
|
173
|
+
} catch (e) {
|
|
174
|
+
console.error('[aimeat-tunnel] Welcome parse error:', e);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
TunnelClient.prototype._handleRequest = async function (msg) {
|
|
179
|
+
if (!this._opts.onRequest) {
|
|
180
|
+
// No handler — send empty ack
|
|
181
|
+
this._sendResponse(msg.id, null);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
try {
|
|
186
|
+
var result = await this._opts.onRequest({
|
|
187
|
+
id: msg.id,
|
|
188
|
+
from: msg.from,
|
|
189
|
+
to: msg.to,
|
|
190
|
+
payload: msg.payload ? JSON.parse(msg.payload) : null,
|
|
191
|
+
timestamp: msg.timestamp,
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
this._sendResponse(msg.id, result);
|
|
195
|
+
} catch (e) {
|
|
196
|
+
console.error('[aimeat-tunnel] onRequest handler error:', e);
|
|
197
|
+
this._sendResponse(msg.id, { error: e.message || 'Handler error' });
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
TunnelClient.prototype._sendResponse = function (requestId, payload) {
|
|
202
|
+
if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
|
|
203
|
+
|
|
204
|
+
this._ws.send(JSON.stringify({
|
|
205
|
+
type: 'response',
|
|
206
|
+
id: requestId,
|
|
207
|
+
payload: payload != null ? JSON.stringify(payload) : null,
|
|
208
|
+
timestamp: new Date().toISOString(),
|
|
209
|
+
}));
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
TunnelClient.prototype._handleMailboxSync = function (msg) {
|
|
213
|
+
if (!msg.payload) return;
|
|
214
|
+
|
|
215
|
+
try {
|
|
216
|
+
var data = JSON.parse(msg.payload);
|
|
217
|
+
var items = data.mailbox_items || [];
|
|
218
|
+
|
|
219
|
+
// Deliver to callback
|
|
220
|
+
if (this._opts.onMailbox && items.length > 0) {
|
|
221
|
+
this._opts.onMailbox(items.map(function (item) {
|
|
222
|
+
return {
|
|
223
|
+
id: item.id,
|
|
224
|
+
type: item.type,
|
|
225
|
+
from: item.from,
|
|
226
|
+
to: item.to,
|
|
227
|
+
payload: item.payload ? JSON.parse(item.payload) : null,
|
|
228
|
+
created_at: item.created_at,
|
|
229
|
+
};
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Acknowledge receipt so operator can delete from mailbox
|
|
234
|
+
if (items.length > 0) {
|
|
235
|
+
var itemIds = items.map(function (i) { return i.id; });
|
|
236
|
+
this._send({
|
|
237
|
+
type: 'mailbox_ack',
|
|
238
|
+
id: uuid(),
|
|
239
|
+
payload: JSON.stringify(itemIds),
|
|
240
|
+
timestamp: new Date().toISOString(),
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
} catch (e) {
|
|
244
|
+
console.error('[aimeat-tunnel] Mailbox sync error:', e);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// ── Heartbeat ──
|
|
249
|
+
|
|
250
|
+
TunnelClient.prototype._startHeartbeat = function () {
|
|
251
|
+
this._stopHeartbeat();
|
|
252
|
+
var self = this;
|
|
253
|
+
var interval = this._opts.heartbeatIntervalMs;
|
|
254
|
+
|
|
255
|
+
this._heartbeatTimer = setInterval(function () {
|
|
256
|
+
if (!self._ws || self._ws.readyState !== WebSocket.OPEN) return;
|
|
257
|
+
|
|
258
|
+
// Check if last ack was received (detect dead connection)
|
|
259
|
+
var sinceLast = Date.now() - self._lastHeartbeatAck;
|
|
260
|
+
if (sinceLast > interval * 3) {
|
|
261
|
+
console.warn('[aimeat-tunnel] Heartbeat ack timeout (' + sinceLast + 'ms), reconnecting...');
|
|
262
|
+
self._ws.close(4000, 'heartbeat_timeout');
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
self._send({
|
|
267
|
+
type: 'heartbeat',
|
|
268
|
+
id: uuid(),
|
|
269
|
+
timestamp: new Date().toISOString(),
|
|
270
|
+
});
|
|
271
|
+
}, interval);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
TunnelClient.prototype._stopHeartbeat = function () {
|
|
275
|
+
if (this._heartbeatTimer) {
|
|
276
|
+
clearInterval(this._heartbeatTimer);
|
|
277
|
+
this._heartbeatTimer = null;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// ── Reconnect with exponential backoff + jitter ──
|
|
282
|
+
|
|
283
|
+
TunnelClient.prototype._scheduleReconnect = function () {
|
|
284
|
+
if (this._closed || !this._opts.reconnect) return;
|
|
285
|
+
if (this._reconnectAttempts >= this._opts.maxReconnectAttempts) {
|
|
286
|
+
console.error('[aimeat-tunnel] Max reconnect attempts reached (' + this._opts.maxReconnectAttempts + ')');
|
|
287
|
+
if (this._opts.onError) this._opts.onError(new Error('Max reconnect attempts reached'));
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
var base = this._opts.reconnectBaseMs;
|
|
292
|
+
var max = this._opts.reconnectMaxMs;
|
|
293
|
+
var attempt = this._reconnectAttempts;
|
|
294
|
+
|
|
295
|
+
// Exponential backoff: 1s, 2s, 4s, 8s, 16s, 32s, 60s cap
|
|
296
|
+
var delay = Math.min(base * Math.pow(2, attempt), max);
|
|
297
|
+
|
|
298
|
+
// Add random jitter (±25%) to prevent thundering herd
|
|
299
|
+
if (this._opts.reconnectJitter) {
|
|
300
|
+
var jitter = delay * 0.25 * (Math.random() * 2 - 1);
|
|
301
|
+
delay = Math.max(base, delay + jitter);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
var self = this;
|
|
305
|
+
this._reconnectAttempts++;
|
|
306
|
+
|
|
307
|
+
console.log('[aimeat-tunnel] Reconnecting in ' + Math.round(delay) + 'ms (attempt ' + this._reconnectAttempts + ')');
|
|
308
|
+
|
|
309
|
+
this._reconnectTimer = setTimeout(function () {
|
|
310
|
+
self._reconnectTimer = null;
|
|
311
|
+
self.connect();
|
|
312
|
+
}, delay);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// ── Send helper ──
|
|
316
|
+
|
|
317
|
+
TunnelClient.prototype._send = function (msg) {
|
|
318
|
+
if (this._ws && this._ws.readyState === WebSocket.OPEN) {
|
|
319
|
+
this._ws.send(JSON.stringify(msg));
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// ── Send a request to the operator and await response ──
|
|
324
|
+
|
|
325
|
+
TunnelClient.prototype.sendRequest = function (payload, timeoutMs) {
|
|
326
|
+
var self = this;
|
|
327
|
+
var timeout = timeoutMs || this._opts.requestTimeoutMs;
|
|
328
|
+
var id = uuid();
|
|
329
|
+
|
|
330
|
+
return new Promise(function (resolve, reject) {
|
|
331
|
+
if (!self._ws || self._ws.readyState !== WebSocket.OPEN) {
|
|
332
|
+
return reject(new Error('Tunnel not connected'));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
var timer = setTimeout(function () {
|
|
336
|
+
self._pendingResponses.delete(id);
|
|
337
|
+
reject(new Error('Request timeout (' + timeout + 'ms)'));
|
|
338
|
+
}, timeout);
|
|
339
|
+
|
|
340
|
+
self._pendingResponses.set(id, { resolve: resolve, timer: timer });
|
|
341
|
+
|
|
342
|
+
self._send({
|
|
343
|
+
type: 'request',
|
|
344
|
+
id: id,
|
|
345
|
+
payload: JSON.stringify(payload),
|
|
346
|
+
timestamp: new Date().toISOString(),
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
// ── Cleanup ──
|
|
352
|
+
|
|
353
|
+
TunnelClient.prototype._cleanup = function () {
|
|
354
|
+
this._stopHeartbeat();
|
|
355
|
+
|
|
356
|
+
// Reject all pending responses
|
|
357
|
+
for (var entry of this._pendingResponses.values()) {
|
|
358
|
+
clearTimeout(entry.timer);
|
|
359
|
+
entry.resolve(null);
|
|
360
|
+
}
|
|
361
|
+
this._pendingResponses.clear();
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// ── Close (permanent) ──
|
|
365
|
+
|
|
366
|
+
TunnelClient.prototype.close = function () {
|
|
367
|
+
this._closed = true;
|
|
368
|
+
this._cleanup();
|
|
369
|
+
|
|
370
|
+
if (this._reconnectTimer) {
|
|
371
|
+
clearTimeout(this._reconnectTimer);
|
|
372
|
+
this._reconnectTimer = null;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (this._ws) {
|
|
376
|
+
// Send graceful disconnect before closing
|
|
377
|
+
this._send({
|
|
378
|
+
type: 'disconnect',
|
|
379
|
+
id: uuid(),
|
|
380
|
+
timestamp: new Date().toISOString(),
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
try { this._ws.close(1000, 'client_close'); } catch { /* ignore */ }
|
|
384
|
+
this._ws = null;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
this._setStatus('offline');
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// ── Status getters ──
|
|
391
|
+
|
|
392
|
+
TunnelClient.prototype.isOnline = function () {
|
|
393
|
+
return this._status === 'online';
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
TunnelClient.prototype.getStatus = function () {
|
|
397
|
+
return this._status;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
TunnelClient.prototype.getReconnectAttempts = function () {
|
|
401
|
+
return this._reconnectAttempts;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
TunnelClient.prototype.getServerConfig = function () {
|
|
405
|
+
return this._serverConfig;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// ── Public API ──
|
|
409
|
+
|
|
410
|
+
var tunnel = {
|
|
411
|
+
// Create and connect a tunnel client
|
|
412
|
+
connect: function (opts) {
|
|
413
|
+
var client = new TunnelClient(opts);
|
|
414
|
+
client.connect();
|
|
415
|
+
return client;
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
// Create without auto-connecting
|
|
419
|
+
create: function (opts) {
|
|
420
|
+
return new TunnelClient(opts);
|
|
421
|
+
},
|
|
422
|
+
|
|
423
|
+
// Version
|
|
424
|
+
version: '1.0.0',
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// Mount on AIMEAT namespace
|
|
428
|
+
attach('tunnel', tunnel);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file wallet/index.js
|
|
3
|
+
* @description The aimeat-wallet library (SDK-libs migration Phase 1). Exposes AIMEAT.wallet —
|
|
4
|
+
* morsel balance + transaction-history helpers that call /v1/wallet via the AIMEAT.auth session,
|
|
5
|
+
* plus a self-contained mountBadge() UI component. Componentized ESM source esbuild bundles to the
|
|
6
|
+
* IIFE served, unchanged, at /v1/libs/aimeat-wallet.js. Ported verbatim from lib-wallet.ts; the
|
|
7
|
+
* only structural change is the shared _core session/namespace glue in place of inline copies.
|
|
8
|
+
* @structure imports authFetch (session) + attach (namespace); wallet.balance/transactions/history/
|
|
9
|
+
* request/mountBadge; attach('wallet', …).
|
|
10
|
+
* @usage <script src="/v1/libs/aimeat-auth.js"></script><script src="/v1/libs/aimeat-wallet.js"></script>
|
|
11
|
+
* const bal = await AIMEAT.wallet.balance();
|
|
12
|
+
* @version-history
|
|
13
|
+
* v1.0.0 — 2026-07-19 — Migrated from src/routes/lib-wallet.ts (SDK-libs migration Phase 1).
|
|
14
|
+
*/
|
|
15
|
+
import { makeSession } from '../_core/session.js';
|
|
16
|
+
const { authFetch } = makeSession('aimeat-wallet.js');
|
|
17
|
+
import { attach } from '../_core/namespace.js';
|
|
18
|
+
|
|
19
|
+
const wallet = {
|
|
20
|
+
// Get current balance
|
|
21
|
+
async balance() {
|
|
22
|
+
const res = await authFetch('/v1/wallet');
|
|
23
|
+
if (!res.ok) throw new Error(res.error?.message || 'Failed to get balance');
|
|
24
|
+
return res.data;
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
// Get transaction history
|
|
28
|
+
async transactions(opts) {
|
|
29
|
+
const params = new URLSearchParams();
|
|
30
|
+
if (opts?.type) params.set('type', opts.type);
|
|
31
|
+
if (opts?.page) params.set('page', String(opts.page));
|
|
32
|
+
if (opts?.per_page) params.set('per_page', String(opts.per_page));
|
|
33
|
+
if (opts?.limit) params.set('limit', String(opts.limit));
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const res = await authFetch('/v1/wallet/transactions' + (qs ? '?' + qs : ''));
|
|
36
|
+
if (!res.ok) throw new Error(res.error?.message || 'Failed to get transactions');
|
|
37
|
+
return res.data;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
// Legacy: get transaction history
|
|
41
|
+
async history(opts) {
|
|
42
|
+
const params = new URLSearchParams();
|
|
43
|
+
if (opts?.limit) params.set('limit', String(opts.limit));
|
|
44
|
+
const qs = params.toString();
|
|
45
|
+
const res = await authFetch('/v1/wallet/history' + (qs ? '?' + qs : ''));
|
|
46
|
+
if (!res.ok) throw new Error(res.error?.message || 'Failed to get history');
|
|
47
|
+
return res.data;
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// Request morsels (e.g. daily allowance)
|
|
51
|
+
async request(amount, reason) {
|
|
52
|
+
const res = await authFetch('/v1/wallet/request', {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
body: JSON.stringify({ amount, reason }),
|
|
55
|
+
});
|
|
56
|
+
if (!res.ok) throw new Error(res.error?.message || 'Failed to request morsels');
|
|
57
|
+
return res.data;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// ── UI Component: Balance Badge ──
|
|
61
|
+
mountBadge(selector, opts) {
|
|
62
|
+
const el = typeof selector === 'string' ? document.querySelector(selector) : selector;
|
|
63
|
+
if (!el) throw new Error('Badge element not found: ' + selector);
|
|
64
|
+
|
|
65
|
+
const badge = document.createElement('div');
|
|
66
|
+
badge.style.cssText = 'display:inline-flex;align-items:center;gap:6px;padding:4px 12px;background:#1e293b;border:1px solid #475569;border-radius:20px;color:#e2e8f0;font-family:system-ui;font-size:13px;cursor:pointer';
|
|
67
|
+
badge.innerHTML = '<span style="font-size:16px">\u{1F36A}</span><span class="aimeat-balance">...</span>';
|
|
68
|
+
el.appendChild(badge);
|
|
69
|
+
|
|
70
|
+
async function refresh() {
|
|
71
|
+
try {
|
|
72
|
+
const data = await wallet.balance();
|
|
73
|
+
badge.querySelector('.aimeat-balance').textContent = (data.available ?? data.balance ?? 0) + ' morsels';
|
|
74
|
+
} catch {
|
|
75
|
+
badge.querySelector('.aimeat-balance').textContent = '--';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
refresh();
|
|
80
|
+
|
|
81
|
+
// Auto-refresh
|
|
82
|
+
const interval = setInterval(refresh, (opts?.refreshInterval || 30) * 1000);
|
|
83
|
+
|
|
84
|
+
// Click to show transaction history
|
|
85
|
+
badge.addEventListener('click', async () => {
|
|
86
|
+
try {
|
|
87
|
+
const txData = await wallet.transactions({ limit: 10 });
|
|
88
|
+
const txList = (txData.transactions || []).map(tx =>
|
|
89
|
+
'<div style="padding:4px 0;border-bottom:1px solid #334155;font-size:12px">'
|
|
90
|
+
+ '<span style="color:' + (tx.amount >= 0 ? '#4ade80' : '#f87171') + '">'
|
|
91
|
+
+ (tx.amount >= 0 ? '+' : '') + tx.amount + '</span> '
|
|
92
|
+
+ (tx.type || '') + ' '
|
|
93
|
+
+ '<span style="color:#94a3b8">' + new Date(tx.timestamp).toLocaleString() + '</span>'
|
|
94
|
+
+ '</div>',
|
|
95
|
+
).join('');
|
|
96
|
+
|
|
97
|
+
const popup = document.createElement('div');
|
|
98
|
+
popup.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:99999';
|
|
99
|
+
popup.innerHTML = '<div style="background:#1e293b;border:1px solid #475569;border-radius:12px;padding:16px;max-width:320px;width:90%;color:#e2e8f0;font-family:system-ui;max-height:60vh;overflow-y:auto">'
|
|
100
|
+
+ '<h4 style="margin:0 0 12px">\u{1F36A} Wallet Transactions</h4>'
|
|
101
|
+
+ (txList || '<p style="color:#94a3b8;font-size:13px">No transactions yet.</p>')
|
|
102
|
+
+ '<button style="margin-top:12px;padding:6px 16px;background:#334155;color:#e2e8f0;border:none;border-radius:8px;cursor:pointer;font-size:13px">Close</button>'
|
|
103
|
+
+ '</div>';
|
|
104
|
+
popup.querySelector('button').addEventListener('click', () => popup.remove());
|
|
105
|
+
popup.addEventListener('click', (e) => { if (e.target === popup) popup.remove(); });
|
|
106
|
+
document.body.appendChild(popup);
|
|
107
|
+
} catch (e) { console.error('AIMEAT wallet:', e); }
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return { refresh, destroy: () => { clearInterval(interval); badge.remove(); } };
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// ── Expose globally ──
|
|
115
|
+
attach('wallet', wallet);
|