aimeat 2.0.0 → 2.1.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/locales/en.json +35 -1
- package/dist/locales/fi.json +35 -1
- package/dist/public/components/LinkPreview.js +101 -0
- package/dist/public/components/NotificationBell.js +18 -1
- 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 +46 -0
- package/dist/public/css/views/portfolio.css +46 -0
- package/dist/public/css/views/profile.css +29 -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/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/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/apps-tab.js +18 -1
- package/dist/public/views/profile/inbox-tab/ai-actions.js +86 -0
- package/dist/public/views/profile/inbox-tab/components.js +124 -9
- 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 +18 -1
- 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/skills-tab.js +1 -1
- 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/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/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/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/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/data/app-templates/shells.d.ts +7 -3
- package/dist/src/data/app-templates/shells.d.ts.map +1 -1
- package/dist/src/data/app-templates/shells.js +10 -6
- package/dist/src/data/app-templates/shells.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/generated/api-types.d.ts +1565 -9
- package/dist/src/generated/api-types.d.ts.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/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.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/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/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 +351 -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 +11 -0
- package/dist/src/mcp/extensions.js.map +1 -1
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +6 -2
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/models/app-tool-schemas.d.ts +55 -1
- package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
- package/dist/src/models/app-tool-schemas.js +20 -1
- package/dist/src/models/app-tool-schemas.js.map +1 -1
- package/dist/src/models/offer-schemas.d.ts +2 -2
- package/dist/src/models/schemas.d.ts +1 -0
- package/dist/src/models/schemas.d.ts.map +1 -1
- package/dist/src/models/schemas.js +3 -0
- package/dist/src/models/schemas.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/app-grants.d.ts +6 -0
- package/dist/src/routes/app-grants.d.ts.map +1 -1
- package/dist/src/routes/app-grants.js +35 -2
- package/dist/src/routes/app-grants.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 +2 -0
- package/dist/src/routes/apps/publish.d.ts.map +1 -1
- package/dist/src/routes/apps/publish.js +27 -1
- 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/exchange-market.d.ts +28 -0
- package/dist/src/routes/exchange-market.d.ts.map +1 -0
- package/dist/src/routes/exchange-market.js +454 -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 +395 -0
- package/dist/src/routes/exchange.js.map +1 -0
- 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 +143 -0
- package/dist/src/routes/extensions/entitlement-gate.js.map +1 -0
- package/dist/src/routes/extensions/manifest.d.ts +9 -0
- package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
- package/dist/src/routes/extensions/manifest.js +33 -1
- package/dist/src/routes/extensions/manifest.js.map +1 -1
- package/dist/src/routes/extensions/paywall.d.ts.map +1 -1
- package/dist/src/routes/extensions/paywall.js +9 -0
- 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/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/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/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 +2 -0
- package/dist/src/routes/upload.d.ts.map +1 -1
- package/dist/src/routes/upload.js +7 -0
- 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 +55 -0
- package/dist/src/routes/webmcp.js.map +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/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 +3 -0
- package/dist/src/services/build-app-prompt.d.ts.map +1 -1
- package/dist/src/services/build-app-prompt.js +12 -1
- package/dist/src/services/build-app-prompt.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/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 +247 -0
- package/dist/src/services/exchange-market.d.ts.map +1 -0
- package/dist/src/services/exchange-market.js +254 -0
- package/dist/src/services/exchange-market.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 +71 -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/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 +203 -0
- package/dist/src/services/metered-entitlements.d.ts.map +1 -0
- package/dist/src/services/metered-entitlements.js +264 -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 +16 -0
- package/dist/src/services/owner-memory.d.ts.map +1 -1
- package/dist/src/services/owner-memory.js +23 -0
- 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/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/migrations/0011_unique_verified_email.sql +25 -0
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts +1 -0
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/apps.js +2 -0
- package/dist/src/storage/providers/sqlite/methods/apps.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/schema.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.js +20 -0
- package/dist/src/storage/providers/sqlite/schema.js.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/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 +21 -0
- package/dist/src/storage/types/organisms-federation.d.ts.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 +12 -77
- package/dist/static/app-catalog/js/apps-io.js +51 -165
- 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 +158 -24
- package/dist/static/app-catalog/js/favorites.js +71 -0
- package/dist/static/app-catalog/js/i18n-data.js +90 -16
- package/dist/static/app-catalog/js/main.js +23 -103
- package/dist/static/app-catalog/js/migrate.js +88 -0
- package/dist/static/app-catalog/js/monetize.js +1 -1
- package/dist/static/app-catalog/js/promote.js +70 -0
- package/dist/static/app-catalog/js/render.js +26 -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/styles/app-catalog.css +40 -0
- package/dist/static/app-catalog.html +790 -912
- 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 +267 -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/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 +37 -0
- package/dist/static/sdk-libs/auth/modal.js +545 -0
- package/dist/static/sdk-libs/auth/pill.js +167 -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 +96 -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 +188 -0
- package/dist/static/sdk-libs/dist/aimeat-agentface.js +91 -0
- package/dist/static/sdk-libs/dist/aimeat-agents.js +315 -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 +1831 -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 +205 -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 +265 -0
- package/dist/static/sdk-libs/dist/aimeat-markdown.js +602 -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 +156 -0
- package/dist/static/sdk-libs/markdown/index.js +522 -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 +5 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<!--
|
|
3
3
|
@file src/static/app-catalog.html
|
|
4
|
-
@description Self-contained "My Apps" launcher SPA (
|
|
5
|
-
publishing, and
|
|
6
|
-
|
|
4
|
+
@description Self-contained "My Apps" launcher SPA (SERVER-ONLY — no browser persistence) for
|
|
5
|
+
creating, publishing, and managing the owner's server apps. Creating an app publishes it to the
|
|
6
|
+
server (unlisted); nothing is stored in the browser. Runs published app HTML only inside a
|
|
7
|
+
sandboxed, opaque-origin iframe — never as a top-level document on the apex origin (H-2).
|
|
7
8
|
@structure Inline <style>__APP_CATALOG_STYLES__</style>
|
|
8
9
|
</head>
|
|
9
10
|
<body data-active-view="library">
|
|
@@ -11,13 +12,6 @@
|
|
|
11
12
|
<header>
|
|
12
13
|
<a class="aimeat-cta aimeat-home" id="aimeat-home-link" href="/" data-i18n-title="cta.backHome" title="Back to home"><span class="aimeat-cta-spark">⚡</span><span id="aimeat-home-label">aimeat.io</span></a>
|
|
13
14
|
<h1 data-i18n="header.title">My Apps</h1>
|
|
14
|
-
<div class="mode-toggle-wrap">
|
|
15
|
-
<span class="mode-caption" data-i18n="mode.caption" data-i18n-title="mode.caption.title" title="These toggle which browser-local apps you see — not server visibility">Local apps</span>
|
|
16
|
-
<div class="mode-toggle">
|
|
17
|
-
<button id="mode-global" class="mode-btn active" onclick="window._launcher.switchDbMode('global')" data-i18n="mode.global" data-i18n-title="mode.global.title" title="Shared across all accounts on this browser">🌐 Shared</button>
|
|
18
|
-
<button id="mode-personal" class="mode-btn" onclick="window._launcher.switchDbMode('personal')" data-i18n="mode.personal" data-i18n-title="mode.personal.title" title="Private to your account">👤 Mine</button>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
15
|
<input type="text" id="search-input" placeholder="Search apps..." data-i18n-ph="search.ph" autocomplete="off" spellcheck="false"/>
|
|
22
16
|
<div class="header-actions">
|
|
23
17
|
<span id="headerAuth" class="header-auth-pill"></span>
|
|
@@ -118,10 +112,10 @@
|
|
|
118
112
|
<p class="view-empty-hint" data-i18n="view.communityHint">Community apps are apps other people on this node have published. When someone publishes one, it shows up here.</p>
|
|
119
113
|
</div>
|
|
120
114
|
|
|
121
|
-
<!--
|
|
122
|
-
<div id="
|
|
123
|
-
<
|
|
124
|
-
<div id="
|
|
115
|
+
<!-- ⭐ Favourites group (Library) — apps the owner favourited, pinned above "Your apps" -->
|
|
116
|
+
<div id="favorites-section" data-view="library" style="display:none;margin:0 24px 1rem">
|
|
117
|
+
<h2 class="fav-section-title"><span data-i18n="fav.title">⭐ Favourites</span> <span id="favorites-count" class="fav-section-count"></span></h2>
|
|
118
|
+
<div id="favorites-grid" class="published-grid"></div>
|
|
125
119
|
</div>
|
|
126
120
|
|
|
127
121
|
<div id="local-apps-block" class="local-apps-block" data-view="library">
|
|
@@ -142,18 +136,10 @@
|
|
|
142
136
|
<div class="modal" id="add-app-modal">
|
|
143
137
|
<h2 id="modal-title" data-i18n="addModal.title">Add App</h2>
|
|
144
138
|
|
|
145
|
-
<!-- Source tabs -->
|
|
139
|
+
<!-- Source tabs — server-only: paste HTML or upload an HTML/ZIP file; it publishes to your account. -->
|
|
146
140
|
<div class="modal-tabs">
|
|
147
|
-
<button class="modal-tab active" data-tab="
|
|
141
|
+
<button class="modal-tab active" data-tab="paste" data-i18n="tab.paste">Paste</button>
|
|
148
142
|
<button class="modal-tab" data-tab="file" data-i18n="tab.file">File</button>
|
|
149
|
-
<button class="modal-tab" data-tab="paste" data-i18n="tab.paste">Paste</button>
|
|
150
|
-
<button class="modal-tab" data-tab="aimeat" data-i18n="tab.aimeat">AIMEAT</button>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<!-- URL tab content -->
|
|
154
|
-
<div class="tab-content active" id="tab-url">
|
|
155
|
-
<label class="modal-label" for="app-url" data-i18n="addModal.url">App URL</label>
|
|
156
|
-
<input type="url" id="app-url" class="modal-input" placeholder="https://example.com/app.html" autocomplete="off"/>
|
|
157
143
|
</div>
|
|
158
144
|
|
|
159
145
|
<!-- File tab content -->
|
|
@@ -169,22 +155,12 @@
|
|
|
169
155
|
</div>
|
|
170
156
|
</div>
|
|
171
157
|
|
|
172
|
-
<!-- Paste tab content -->
|
|
173
|
-
<div class="tab-content" id="tab-paste">
|
|
158
|
+
<!-- Paste tab content (default) -->
|
|
159
|
+
<div class="tab-content active" id="tab-paste">
|
|
174
160
|
<label class="modal-label" for="app-paste-code" data-i18n="addModal.paste">Paste HTML Source Code</label>
|
|
175
161
|
<textarea id="app-paste-code" class="modal-input" rows="10" placeholder="Paste your HTML source code here..." data-i18n-ph="addModal.pastePh" style="font-family:'Consolas','Monaco','Courier New',monospace;font-size:.8rem;resize:vertical;min-height:160px;line-height:1.4"></textarea>
|
|
176
162
|
</div>
|
|
177
163
|
|
|
178
|
-
<!-- AIMEAT tab content -->
|
|
179
|
-
<div class="tab-content" id="tab-aimeat">
|
|
180
|
-
<p style="font-size:.85rem;color:var(--text-muted);margin-bottom:14px;line-height:1.5" data-i18n="addModal.aimeatHelp">
|
|
181
|
-
Import apps from a connected AIMEAT server. Configure the server URL in Settings first.
|
|
182
|
-
</p>
|
|
183
|
-
<button type="button" class="modal-btn primary" onclick="window._launcher.importFromAimeat()" style="width:100%" data-i18n="addModal.fetch">
|
|
184
|
-
Fetch Available Apps
|
|
185
|
-
</button>
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
164
|
<!-- Common fields -->
|
|
189
165
|
<div class="modal-fields">
|
|
190
166
|
<div class="modal-row">
|
|
@@ -319,21 +295,6 @@
|
|
|
319
295
|
</div>
|
|
320
296
|
</div>
|
|
321
297
|
|
|
322
|
-
<div class="settings-section">
|
|
323
|
-
<div class="settings-section-title" data-i18n="settings.backup">Backup & Restore</div>
|
|
324
|
-
<div class="settings-backup-actions">
|
|
325
|
-
<button type="button" class="modal-btn secondary" onclick="window._launcher.exportBackup()" data-i18n="settings.exportJson">Export JSON</button>
|
|
326
|
-
<button type="button" class="modal-btn secondary" onclick="document.getElementById('import-file-input').click()" data-i18n="settings.importJson">Import JSON</button>
|
|
327
|
-
<button type="button" class="modal-btn secondary" onclick="window._launcher.removeDuplicateApps()" data-i18n="dedup.btn">🧹 Remove duplicate apps</button>
|
|
328
|
-
<input type="file" id="import-file-input" accept=".json" hidden/>
|
|
329
|
-
</div>
|
|
330
|
-
</div>
|
|
331
|
-
|
|
332
|
-
<div class="settings-section" style="margin-bottom:0">
|
|
333
|
-
<div class="settings-section-title" data-i18n="settings.danger">Danger Zone</div>
|
|
334
|
-
<button type="button" class="modal-btn danger" onclick="window._launcher.clearAllData()" data-i18n="settings.clearAll">Clear All Data</button>
|
|
335
|
-
</div>
|
|
336
|
-
|
|
337
298
|
<div class="modal-actions" style="margin-top:24px">
|
|
338
299
|
<button type="button" class="modal-btn secondary" id="settings-cancel-btn" data-i18n="common.cancel">Cancel</button>
|
|
339
300
|
<button type="button" class="modal-btn primary" id="settings-save-btn" data-i18n="common.save">Save</button>
|
|
@@ -360,18 +321,6 @@
|
|
|
360
321
|
</div>
|
|
361
322
|
</div>
|
|
362
323
|
|
|
363
|
-
<!-- AIMEAT Import Dialog (dynamically populated) -->
|
|
364
|
-
<div id="aimeat-import-overlay" hidden>
|
|
365
|
-
<div class="modal" id="aimeat-import-modal">
|
|
366
|
-
<h2 data-i18n="import.title">Import from AIMEAT</h2>
|
|
367
|
-
<div class="aimeat-app-list" id="aimeat-app-list"></div>
|
|
368
|
-
<div class="modal-actions">
|
|
369
|
-
<button type="button" class="modal-btn secondary" onclick="document.getElementById('aimeat-import-overlay').hidden = true" data-i18n="common.cancel">Cancel</button>
|
|
370
|
-
<button type="button" class="modal-btn primary" onclick="window._launcher.processAimeatImport()" data-i18n="import.selected">Import Selected</button>
|
|
371
|
-
</div>
|
|
372
|
-
</div>
|
|
373
|
-
</div>
|
|
374
|
-
|
|
375
324
|
<!-- Publish Modal -->
|
|
376
325
|
<div id="publish-overlay" hidden>
|
|
377
326
|
<div class="modal" id="publish-modal">
|
|
@@ -399,20 +348,6 @@
|
|
|
399
348
|
</div>
|
|
400
349
|
</div>
|
|
401
350
|
|
|
402
|
-
<!-- JSON Backup Import Modal (user-selected, duplicate-aware) -->
|
|
403
|
-
<div id="json-import-overlay" hidden>
|
|
404
|
-
<div class="modal" id="json-import-modal">
|
|
405
|
-
<h2 data-i18n="jsonImport.title">📥 Import JSON backup</h2>
|
|
406
|
-
<div id="json-import-status" style="margin:4px 0;font-size:.85rem;min-height:1.1em"></div>
|
|
407
|
-
<div id="json-import-body" style="overflow-y:auto;max-height:55vh"></div>
|
|
408
|
-
<div class="modal-actions">
|
|
409
|
-
<button type="button" class="modal-btn secondary" onclick="document.getElementById('json-import-overlay').hidden = true" data-i18n="common.cancel">Cancel</button>
|
|
410
|
-
<button type="button" class="modal-btn primary" id="json-import-btn" onclick="window._launcher.submitJsonImport()" data-i18n="srvImport.import">Import selected</button>
|
|
411
|
-
</div>
|
|
412
|
-
</div>
|
|
413
|
-
</div>
|
|
414
|
-
|
|
415
|
-
|
|
416
351
|
<!-- Backup Import Modal -->
|
|
417
352
|
<div id="backup-overlay" hidden>
|
|
418
353
|
<div class="modal" id="backup-modal">
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file apps-io.js
|
|
3
|
-
* @description Getting apps INTO the catalog: creation from
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
3
|
+
* @description Getting apps INTO the catalog. Server-only: creation from an uploaded HTML file, a
|
|
4
|
+
* pasted source, or a ZIP bundle builds a TRANSIENT record and hands it straight to the publish
|
|
5
|
+
* flow — it is published to the owner's account (UNLISTED) on the server. There is no browser-local
|
|
6
|
+
* catalog anymore, so there is no "add a URL bookmark" and nothing is persisted in the browser.
|
|
7
|
+
* Owns the Add-app modal (open/close/tabs/file-drop/save, sign-in gate) + editingAppId. Shared
|
|
8
|
+
* modules by import; main-local fns injected via initAppsIo(deps). Carved from main.js.
|
|
9
|
+
* @usage import { initAppsIo, showModal, setEditingAppId } from './apps-io.js'; initAppsIo({...})
|
|
9
10
|
* @version-history
|
|
10
11
|
* v1.0.0 — 2026-07-10 — Initial extraction (TARGET-021 Aalto 3 modularization, phase 10).
|
|
12
|
+
* v2.0.0 — 2026-07-20 — Server-only cutover: drop the local writers (URL/file/paste/zip → IndexedDB);
|
|
13
|
+
* creation now builds a transient record and publishes it to the server as an unlisted app.
|
|
11
14
|
*/
|
|
12
15
|
import { saveApp } from './db.js';
|
|
13
16
|
import { showNotice } from './ui.js';
|
|
@@ -15,106 +18,36 @@ import { t } from './i18n.js';
|
|
|
15
18
|
import { extractZip, bundleZip } from './zip.js';
|
|
16
19
|
import { getCortexOwnerToken } from './cortex.js'; // sign-in gate in requireSignInThen (runtime-only call, no import cycle)
|
|
17
20
|
|
|
18
|
-
// Injected once at bootstrap by main.js (main-local fns + the live
|
|
19
|
-
|
|
21
|
+
// Injected once at bootstrap by main.js (main-local fns + the live working-set getter + the publish
|
|
22
|
+
// modal opener from server-io, injected to avoid an apps-io ↔ server-io import cycle).
|
|
23
|
+
let generateId, readFileAsText, renderApps, getMainApps, showPublishModal;
|
|
20
24
|
export function initAppsIo(deps) {
|
|
21
|
-
({ generateId, readFileAsText, renderApps, getMainApps } = deps);
|
|
25
|
+
({ generateId, readFileAsText, renderApps, getMainApps, showPublishModal } = deps);
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
// ──
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var encoded = btoa(unescape(encodeURIComponent(
|
|
30
|
-
var app = {
|
|
31
|
-
id: generateId(),
|
|
32
|
-
name: name,
|
|
33
|
-
description: '',
|
|
34
|
-
source: 'zip',
|
|
35
|
-
url: null,
|
|
36
|
-
blob: encoded,
|
|
37
|
-
tags: tags,
|
|
38
|
-
openMode: openMode,
|
|
39
|
-
icon: icon || '\u{1F4E6}',
|
|
40
|
-
screenshot: null,
|
|
41
|
-
favorite: false,
|
|
42
|
-
addedAt: new Date().toISOString(),
|
|
43
|
-
lastOpenedAt: null
|
|
44
|
-
};
|
|
45
|
-
await saveApp(app);
|
|
46
|
-
return app;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ── App Creation from URL ───────────────────────
|
|
50
|
-
|
|
51
|
-
function addAppFromUrl(name, url, icon, tags, openMode) {
|
|
52
|
-
var app = {
|
|
53
|
-
id: generateId(),
|
|
54
|
-
name: name,
|
|
55
|
-
description: '',
|
|
56
|
-
source: 'url',
|
|
57
|
-
url: url,
|
|
58
|
-
blob: null,
|
|
59
|
-
tags: tags,
|
|
60
|
-
openMode: openMode,
|
|
61
|
-
icon: icon || '\u{1F4DD}',
|
|
62
|
-
screenshot: null,
|
|
63
|
-
favorite: false,
|
|
64
|
-
addedAt: new Date().toISOString(),
|
|
65
|
-
lastOpenedAt: null
|
|
66
|
-
};
|
|
67
|
-
return saveApp(app).then(function () {
|
|
68
|
-
return app;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ── App Creation from File ──────────────────────
|
|
73
|
-
|
|
74
|
-
function addAppFromFile(name, file, icon, tags, openMode) {
|
|
75
|
-
return readFileAsText(file).then(function (content) {
|
|
76
|
-
var encoded = btoa(unescape(encodeURIComponent(content)));
|
|
77
|
-
var app = {
|
|
78
|
-
id: generateId(),
|
|
79
|
-
name: name,
|
|
80
|
-
description: '',
|
|
81
|
-
source: 'local',
|
|
82
|
-
url: null,
|
|
83
|
-
blob: encoded,
|
|
84
|
-
tags: tags,
|
|
85
|
-
openMode: openMode,
|
|
86
|
-
icon: icon || '\u{1F4DD}',
|
|
87
|
-
screenshot: null,
|
|
88
|
-
favorite: false,
|
|
89
|
-
addedAt: new Date().toISOString(),
|
|
90
|
-
lastOpenedAt: null
|
|
91
|
-
};
|
|
92
|
-
return saveApp(app).then(function () {
|
|
93
|
-
return app;
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// ── App Creation from Pasted Source ─────────────
|
|
99
|
-
|
|
100
|
-
function addAppFromSource(name, sourceCode, icon, tags, openMode) {
|
|
101
|
-
var encoded = btoa(unescape(encodeURIComponent(sourceCode)));
|
|
28
|
+
// ── Create → publish straight to the server (unlisted) ─────────────────────────
|
|
29
|
+
// Build a transient in-memory record from raw HTML and open the publish modal for it. The publish
|
|
30
|
+
// modal collects filename/description/access-code and POSTs to /v1/apps; the create flow parks the
|
|
31
|
+
// result so the new app lands UNLISTED (on the server, not yet public). Nothing is stored locally.
|
|
32
|
+
function createAppFromHtml(name, html, icon, tags, description) {
|
|
33
|
+
var encoded = btoa(unescape(encodeURIComponent(html)));
|
|
102
34
|
var app = {
|
|
103
35
|
id: generateId(),
|
|
104
36
|
name: name,
|
|
105
|
-
description:
|
|
106
|
-
source: '
|
|
37
|
+
description: description || '',
|
|
38
|
+
source: 'create',
|
|
107
39
|
url: null,
|
|
108
40
|
blob: encoded,
|
|
109
|
-
tags: tags,
|
|
110
|
-
openMode: openMode,
|
|
41
|
+
tags: tags || [],
|
|
111
42
|
icon: icon || '\u{1F4DD}',
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
addedAt: new Date().toISOString(),
|
|
115
|
-
lastOpenedAt: null
|
|
43
|
+
published: false,
|
|
44
|
+
addedAt: new Date().toISOString()
|
|
116
45
|
};
|
|
117
46
|
return saveApp(app).then(function () {
|
|
47
|
+
// showPublishModal resolves the app from the main working-set (getMainApps), so make the
|
|
48
|
+
// transient record visible there too before opening it (same pattern as openPublishedDetail).
|
|
49
|
+
try { getMainApps().push(app); } catch (e) { /* getter optional */ }
|
|
50
|
+
if (typeof showPublishModal === 'function') showPublishModal(app.id, { unlisted: true });
|
|
118
51
|
return app;
|
|
119
52
|
});
|
|
120
53
|
}
|
|
@@ -127,8 +60,8 @@ var editingAppId = null;
|
|
|
127
60
|
function showModal() {
|
|
128
61
|
document.getElementById('modal-overlay').hidden = false;
|
|
129
62
|
document.getElementById('modal-title').textContent = t('addModal.title');
|
|
130
|
-
//
|
|
131
|
-
switchTab('
|
|
63
|
+
// Server-only: there is no URL-bookmark tab — default to pasting source.
|
|
64
|
+
switchTab('paste');
|
|
132
65
|
}
|
|
133
66
|
|
|
134
67
|
// Step 0 for not-yet-signed-in users: adding/publishing an app needs an account, so
|
|
@@ -173,7 +106,6 @@ function parseAppMeta(html) {
|
|
|
173
106
|
function closeModal() {
|
|
174
107
|
document.getElementById('modal-overlay').hidden = true;
|
|
175
108
|
// Reset form
|
|
176
|
-
document.getElementById('app-url').value = '';
|
|
177
109
|
document.getElementById('app-name').value = '';
|
|
178
110
|
document.getElementById('app-icon').value = '';
|
|
179
111
|
document.getElementById('app-tags').value = '';
|
|
@@ -233,30 +165,19 @@ function handleSave() {
|
|
|
233
165
|
var name = document.getElementById('app-name').value.trim();
|
|
234
166
|
var icon = document.getElementById('app-icon').value.trim();
|
|
235
167
|
var tagsRaw = document.getElementById('app-tags').value.trim();
|
|
236
|
-
// Apps open TOP-LEVEL on a real origin (published) or in the sandbox (local); there is no
|
|
237
|
-
// user-facing open-mode choice anymore, so new/edited apps default to 'tab'.
|
|
238
|
-
var openMode = 'tab';
|
|
239
|
-
|
|
240
168
|
var tags = tagsRaw ? tagsRaw.split(',').map(function (t) { return t.trim(); }).filter(Boolean) : [];
|
|
241
169
|
|
|
242
|
-
// ── Edit mode: update
|
|
170
|
+
// ── Edit mode: update a transient record's display metadata in place ──
|
|
243
171
|
if (editingAppId) {
|
|
244
172
|
var app = null;
|
|
245
173
|
for (var i = 0; i < getMainApps().length; i++) {
|
|
246
174
|
if (getMainApps()[i].id === editingAppId) { app = getMainApps()[i]; break; }
|
|
247
175
|
}
|
|
248
|
-
if (!app) {
|
|
249
|
-
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
if (!name) {
|
|
253
|
-
showNotice('Please enter a name');
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
176
|
+
if (!app) { closeModal(); return; }
|
|
177
|
+
if (!name) { showNotice('Please enter a name'); return; }
|
|
256
178
|
app.name = name;
|
|
257
179
|
app.icon = icon || app.icon;
|
|
258
180
|
app.tags = tags;
|
|
259
|
-
app.openMode = openMode;
|
|
260
181
|
saveApp(app).then(function () {
|
|
261
182
|
closeModal();
|
|
262
183
|
renderApps();
|
|
@@ -264,69 +185,38 @@ function handleSave() {
|
|
|
264
185
|
return;
|
|
265
186
|
}
|
|
266
187
|
|
|
267
|
-
// ── Create mode ──
|
|
188
|
+
// ── Create mode → publish to the server (unlisted) ──
|
|
268
189
|
var activeTab = document.querySelector('.modal-tab.active');
|
|
269
|
-
var tabName = activeTab ? activeTab.getAttribute('data-tab') : '
|
|
190
|
+
var tabName = activeTab ? activeTab.getAttribute('data-tab') : 'paste';
|
|
270
191
|
|
|
271
|
-
if (tabName === '
|
|
272
|
-
var url = document.getElementById('app-url').value.trim();
|
|
273
|
-
if (!url) {
|
|
274
|
-
showNotice('Please enter a URL');
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
if (!name) {
|
|
278
|
-
// Derive name from URL
|
|
279
|
-
try {
|
|
280
|
-
name = new URL(url).hostname;
|
|
281
|
-
} catch (e) {
|
|
282
|
-
name = url;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
addAppFromUrl(name, url, icon, tags, openMode).then(function () {
|
|
286
|
-
closeModal();
|
|
287
|
-
renderApps();
|
|
288
|
-
});
|
|
289
|
-
} else if (tabName === 'paste') {
|
|
192
|
+
if (tabName === 'paste') {
|
|
290
193
|
var pastedCode = document.getElementById('app-paste-code').value.trim();
|
|
291
194
|
if (!pastedCode) {
|
|
292
195
|
showNotice('Please paste your HTML source code');
|
|
293
196
|
return;
|
|
294
197
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
addAppFromSource(name, pastedCode, icon, tags, openMode).then(function () {
|
|
301
|
-
closeModal();
|
|
302
|
-
renderApps();
|
|
303
|
-
});
|
|
198
|
+
var meta = parseAppMeta(pastedCode);
|
|
199
|
+
if (!name) name = meta.name || 'Pasted App';
|
|
200
|
+
closeModal();
|
|
201
|
+
createAppFromHtml(name, pastedCode, icon, tags, meta.description);
|
|
304
202
|
} else if (tabName === 'file') {
|
|
305
203
|
if (!selectedFile) {
|
|
306
204
|
showNotice('Please select a file');
|
|
307
205
|
return;
|
|
308
206
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (!name)
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
return
|
|
316
|
-
|
|
317
|
-
closeModal();
|
|
318
|
-
renderApps();
|
|
319
|
-
}).catch(function (err) {
|
|
320
|
-
showNotice('ZIP import failed: ' + (err.message || err));
|
|
321
|
-
});
|
|
207
|
+
var file = selectedFile;
|
|
208
|
+
if (file.name.toLowerCase().endsWith('.zip')) {
|
|
209
|
+
if (!name) name = file.name.replace(/\.zip$/i, '');
|
|
210
|
+
file.arrayBuffer()
|
|
211
|
+
.then(function (arrayBuffer) { return extractZip(arrayBuffer); })
|
|
212
|
+
.then(function (files) { return bundleZip(files); })
|
|
213
|
+
.then(function (html) { closeModal(); return createAppFromHtml(name, html, icon, tags, parseAppMeta(html).description); })
|
|
214
|
+
.catch(function (err) { showNotice('ZIP import failed: ' + (err.message || err)); });
|
|
322
215
|
} else {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
name = selectedFile.name.replace(/\.html?$/i, '');
|
|
326
|
-
}
|
|
327
|
-
addAppFromFile(name, selectedFile, icon, tags, openMode).then(function () {
|
|
216
|
+
if (!name) name = file.name.replace(/\.html?$/i, '');
|
|
217
|
+
readFileAsText(file).then(function (html) {
|
|
328
218
|
closeModal();
|
|
329
|
-
|
|
219
|
+
createAppFromHtml(name, html, icon, tags, parseAppMeta(html).description);
|
|
330
220
|
});
|
|
331
221
|
}
|
|
332
222
|
}
|
|
@@ -336,10 +226,6 @@ function handleSave() {
|
|
|
336
226
|
export function setEditingAppId(v) { editingAppId = v; }
|
|
337
227
|
|
|
338
228
|
export {
|
|
339
|
-
addAppFromZip,
|
|
340
|
-
addAppFromUrl,
|
|
341
|
-
addAppFromFile,
|
|
342
|
-
addAppFromSource,
|
|
343
229
|
showModal,
|
|
344
230
|
requireSignInThen,
|
|
345
231
|
parseAppMeta,
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file cost.js
|
|
3
|
+
* @description The Cost & Contracts section of the App Detail view (EXCHANGE G3 / TARGET-045): a
|
|
4
|
+
* read-only per-app surface of the EXCHANGE contracts (metered entitlements) an app sources, with
|
|
5
|
+
* live spend against each budget and the platform rake. Data comes from GET /v1/apps/cost?app_id=,
|
|
6
|
+
* which returns only entitlements whose consumer is the signed-in owner (strictly cross-owner).
|
|
7
|
+
* Rendering mirrors monetize.js: detail.js renders the shell for OWN published apps and calls
|
|
8
|
+
* costOnOpen; this module async-loads and re-renders #detail-cost in place.
|
|
9
|
+
* @structure costOnOpen · costSectionInner
|
|
10
|
+
* @usage import { costSectionInner, costOnOpen } from './cost.js'
|
|
11
|
+
* @version-history
|
|
12
|
+
* v1.0.0 — 2026-07-20 — Initial per-app cost & contracts surface (EXCHANGE G3).
|
|
13
|
+
*/
|
|
14
|
+
import { escapeHtml } from './util.js';
|
|
15
|
+
import { loadConfig } from './config.js';
|
|
16
|
+
import { t } from './i18n.js';
|
|
17
|
+
import { getCortexOwnerToken } from './cortex.js';
|
|
18
|
+
|
|
19
|
+
var cState = 'off'; // 'off' | 'loading' | 'ready' | 'error'
|
|
20
|
+
var cData = null; // the /v1/apps/cost data payload, or null
|
|
21
|
+
var cAppId = ''; // full app id "owner/filename"
|
|
22
|
+
|
|
23
|
+
function apiBase() {
|
|
24
|
+
var cfg = loadConfig();
|
|
25
|
+
return (cfg.aimeatUrl || '').replace(/\/+$/, '');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function rerender() {
|
|
29
|
+
var el = document.getElementById('detail-cost');
|
|
30
|
+
if (el) el.innerHTML = costSectionInner();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Reset + async-load the cost surface when a detail view opens. No-op for non-own / unpublished apps. */
|
|
34
|
+
export function costOnOpen(owner, appId, isOwn) {
|
|
35
|
+
cData = null;
|
|
36
|
+
if (!isOwn || !owner || !appId) { cState = 'off'; cAppId = ''; return; }
|
|
37
|
+
cAppId = owner + '/' + appId;
|
|
38
|
+
cState = 'loading';
|
|
39
|
+
var token = getCortexOwnerToken();
|
|
40
|
+
if (!token) { cState = 'error'; cData = { _needLogin: true }; return; }
|
|
41
|
+
fetch(apiBase() + '/v1/apps/cost?app_id=' + encodeURIComponent(cAppId), {
|
|
42
|
+
headers: { 'Authorization': 'Bearer ' + token },
|
|
43
|
+
})
|
|
44
|
+
.then(function (r) { return r.json(); })
|
|
45
|
+
.then(function (res) {
|
|
46
|
+
if (!res || !res.ok || !res.data) throw new Error('bad response');
|
|
47
|
+
cData = res.data;
|
|
48
|
+
cState = 'ready';
|
|
49
|
+
rerender();
|
|
50
|
+
})
|
|
51
|
+
.catch(function () { cState = 'error'; cData = null; rerender(); });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function stateBadge(state) {
|
|
55
|
+
// Reuse the sync-chip colours: ok (active), diff (paused), none (revoked/exhausted).
|
|
56
|
+
var cls = state === 'active' ? 'ok' : (state === 'paused' ? 'diff' : 'none');
|
|
57
|
+
return '<span class="dtl-sync ' + cls + '" style="margin:0">' + escapeHtml(state) + '</span>';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function contractRow(c) {
|
|
61
|
+
var b = c.budget || {};
|
|
62
|
+
var cap = (b.cap_units === null || b.cap_units === undefined) ? t('cost.uncapped') : (b.spent_units + ' / ' + b.cap_units);
|
|
63
|
+
var remaining = (b.remaining_units === null || b.remaining_units === undefined) ? ''
|
|
64
|
+
: ' <span class="dtl-stat-label">(' + t('cost.remaining').replace('{n}', b.remaining_units) + ')</span>';
|
|
65
|
+
var providerShort = String(c.provider || '').split('@')[0];
|
|
66
|
+
return '<div class="dtl-status-row" style="align-items:center;gap:10px;flex-wrap:wrap">' +
|
|
67
|
+
'<div class="dtl-stat" style="flex:1;min-width:150px">' +
|
|
68
|
+
'<span class="dtl-stat-val">' + escapeHtml(c.capability || '') + '</span>' +
|
|
69
|
+
'<span class="dtl-stat-label">' + escapeHtml(t('cost.providerCol')) + ': ' + escapeHtml(providerShort) + '</span>' +
|
|
70
|
+
'</div>' +
|
|
71
|
+
'<div class="dtl-stat"><span class="dtl-stat-label">' + t('cost.priceCol') + '</span><span class="dtl-stat-val">' + escapeHtml(String(c.price_per_call)) + ' morsels</span></div>' +
|
|
72
|
+
'<div class="dtl-stat"><span class="dtl-stat-label">' + t('cost.rakeCol') + '</span><span class="dtl-stat-val">' + escapeHtml(String(c.rake_per_call)) + ' morsels (' + escapeHtml(String(c.rake_percent)) + '%)</span></div>' +
|
|
73
|
+
'<div class="dtl-stat"><span class="dtl-stat-label">' + t('cost.budgetCol') + '</span><span class="dtl-stat-val">' + escapeHtml(cap) + remaining + '</span></div>' +
|
|
74
|
+
'<div class="dtl-stat">' + stateBadge(c.state) + '</div>' +
|
|
75
|
+
'</div>';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Inner HTML of the section — detail.js wraps it in <div class="dtl-section" id="detail-cost">. */
|
|
79
|
+
export function costSectionInner() {
|
|
80
|
+
if (cState === 'off') return '';
|
|
81
|
+
var html = '<h3>' + t('cost.title') + '</h3>' +
|
|
82
|
+
'<p class="dtl-desc">' + t('cost.hint') + '</p>';
|
|
83
|
+
if (cState === 'loading') {
|
|
84
|
+
return html + '<span style="color:var(--text-muted);font-size:.85rem">…</span>';
|
|
85
|
+
}
|
|
86
|
+
if (cState === 'error') {
|
|
87
|
+
var msg = (cData && cData._needLogin) ? t('cost.needLogin') : t('cost.loadFailed');
|
|
88
|
+
return html + '<span class="dtl-sync none">' + escapeHtml(msg) + '</span>';
|
|
89
|
+
}
|
|
90
|
+
var contracts = (cData && cData.contracts) || [];
|
|
91
|
+
if (!contracts.length) {
|
|
92
|
+
return html + '<span class="dtl-sync none">' + t('cost.empty') + '</span>';
|
|
93
|
+
}
|
|
94
|
+
var m = (cData.totals && cData.totals.morsels) || { spent_units: 0, calls: 0 };
|
|
95
|
+
html += '<div class="dtl-sync ok" style="margin:0 0 10px">' +
|
|
96
|
+
t('cost.summary').replace('{n}', cData.total_contracts).replace('{spent}', m.spent_units).replace('{calls}', m.calls) +
|
|
97
|
+
'</div>';
|
|
98
|
+
for (var i = 0; i < contracts.length; i++) html += contractRow(contracts[i]);
|
|
99
|
+
return html;
|
|
100
|
+
}
|