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,348 @@
|
|
|
1
|
+
// GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/agents/ (+ _core/).
|
|
2
|
+
// Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-agents.js (with a per-node config prelude).
|
|
3
|
+
"use strict";
|
|
4
|
+
(() => {
|
|
5
|
+
// src/static/sdk-libs/_core/session.js
|
|
6
|
+
function getSession(libLabel) {
|
|
7
|
+
const auth = window.AIMEAT && window.AIMEAT.auth;
|
|
8
|
+
if (!auth) {
|
|
9
|
+
throw new Error("AIMEAT.auth is required. Include aimeat-auth.js before " + (libLabel || "this library"));
|
|
10
|
+
}
|
|
11
|
+
const s = auth.getSession();
|
|
12
|
+
if (!s) throw new Error("Not logged in. Call AIMEAT.auth.login() first.");
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
15
|
+
function authFetch(path, opts, libLabel) {
|
|
16
|
+
return getSession(libLabel).fetch(path, opts);
|
|
17
|
+
}
|
|
18
|
+
function makeSession(libLabel) {
|
|
19
|
+
return {
|
|
20
|
+
getSession: () => getSession(libLabel),
|
|
21
|
+
authFetch: (path, opts) => authFetch(path, opts, libLabel)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/static/sdk-libs/_core/namespace.js
|
|
26
|
+
function namespace() {
|
|
27
|
+
if (!window.AIMEAT) window.AIMEAT = {};
|
|
28
|
+
return window.AIMEAT;
|
|
29
|
+
}
|
|
30
|
+
function attach(key, value) {
|
|
31
|
+
const ns = namespace();
|
|
32
|
+
ns[key] = value;
|
|
33
|
+
return ns;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/static/sdk-libs/agents/index.js
|
|
37
|
+
var { authFetch: authFetch2 } = makeSession("aimeat-agents.js");
|
|
38
|
+
var enc = encodeURIComponent;
|
|
39
|
+
function unwrap(r, action) {
|
|
40
|
+
if (!r || !r.ok) {
|
|
41
|
+
var err = (
|
|
42
|
+
/** @type {Error & { code?: string }} */
|
|
43
|
+
new Error(r && r.error && r.error.message || action + " failed")
|
|
44
|
+
);
|
|
45
|
+
err.code = r && r.error && r.error.code || "UNKNOWN";
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
return r.data;
|
|
49
|
+
}
|
|
50
|
+
var _agentsCache = null;
|
|
51
|
+
var _cancelSetCache = null;
|
|
52
|
+
var agents = {
|
|
53
|
+
/** List the owner's agents. opts.activeOnly filters to ones seen recently.
|
|
54
|
+
* opts.fresh bypasses the 30s cache. */
|
|
55
|
+
async list(opts) {
|
|
56
|
+
var now = Date.now();
|
|
57
|
+
if (!(opts && opts.fresh) && _agentsCache && now - _agentsCache.t < 3e4) return _agentsCache.v;
|
|
58
|
+
var data = unwrap(await authFetch2("/v1/agents"), "list agents");
|
|
59
|
+
var v = data.agents || [];
|
|
60
|
+
_agentsCache = { v, t: now };
|
|
61
|
+
return opts && opts.activeOnly ? v.filter(function(a) {
|
|
62
|
+
return !!a.last_seen;
|
|
63
|
+
}) : v;
|
|
64
|
+
},
|
|
65
|
+
/** One agent by name (or GAII), or null. */
|
|
66
|
+
async get(name) {
|
|
67
|
+
var all = await agents.list();
|
|
68
|
+
return all.find(function(a) {
|
|
69
|
+
return a.name === name || a.gaii === name;
|
|
70
|
+
}) || null;
|
|
71
|
+
},
|
|
72
|
+
/** Commission a task for an agent. Returns the created task ({ id, status, ... }).
|
|
73
|
+
* Created 'queued' by default; task-runner agents auto-activate it.
|
|
74
|
+
*
|
|
75
|
+
* task.scope: [{ name, value, type }] — app-defined tags stored ON the task. This is how
|
|
76
|
+
* an app finds its own runs again later: filter `tasks({status:'done'})` on a tag you set,
|
|
77
|
+
* instead of trying to parse the agent's memory-key slug. Pass the same array in a
|
|
78
|
+
* schedule's `task_template.scope` so scheduled runs carry it too.
|
|
79
|
+
* task.verification: { user_expects, technical_checks } — what a good result looks like.
|
|
80
|
+
* Both were silently dropped before v1.1.0. */
|
|
81
|
+
async createTask(name, task) {
|
|
82
|
+
if (!task || !task.description) throw new Error("createTask requires { description }");
|
|
83
|
+
var body = {
|
|
84
|
+
title: task.title || task.description.slice(0, 80),
|
|
85
|
+
description: task.description,
|
|
86
|
+
status: task.status || "queued"
|
|
87
|
+
};
|
|
88
|
+
if (Array.isArray(task.scope) && task.scope.length) {
|
|
89
|
+
body.scope = task.scope.map(function(s) {
|
|
90
|
+
return {
|
|
91
|
+
name: s.name,
|
|
92
|
+
value: String(s.value),
|
|
93
|
+
type: s.type || "text",
|
|
94
|
+
...s.description ? { description: s.description } : {}
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (task.verification) {
|
|
99
|
+
var v = task.verification;
|
|
100
|
+
body.verification = {
|
|
101
|
+
user_expects: v.user_expects != null ? v.user_expects : v.userExpects || "",
|
|
102
|
+
technical_checks: v.technical_checks || v.technicalChecks || []
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (task.rules) body.rules = task.rules;
|
|
106
|
+
if (task.resources) body.resources = task.resources;
|
|
107
|
+
var data = unwrap(await authFetch2("/v1/agents/" + enc(name) + "/tasks", {
|
|
108
|
+
method: "POST",
|
|
109
|
+
body: JSON.stringify(body)
|
|
110
|
+
}), "create task");
|
|
111
|
+
return data.task;
|
|
112
|
+
},
|
|
113
|
+
/** Get a single task. */
|
|
114
|
+
async getTask(name, id) {
|
|
115
|
+
return unwrap(await authFetch2("/v1/agents/" + enc(name) + "/tasks/" + enc(id)), "get task").task;
|
|
116
|
+
},
|
|
117
|
+
/** List an agent's tasks. opts.status filters (queued|active|done|failed|...). */
|
|
118
|
+
async tasks(name, opts) {
|
|
119
|
+
var q = "?per_page=100" + (opts && opts.status ? "&status=" + enc(opts.status) : "");
|
|
120
|
+
return unwrap(await authFetch2("/v1/agents/" + enc(name) + "/tasks" + q), "list tasks").tasks || [];
|
|
121
|
+
},
|
|
122
|
+
/** The task's event log (oldest-first). */
|
|
123
|
+
async events(name, id) {
|
|
124
|
+
return unwrap(await authFetch2("/v1/agents/" + enc(name) + "/tasks/" + enc(id) + "/events"), "list events").events || [];
|
|
125
|
+
},
|
|
126
|
+
/** Live-watch a task: calls onUpdate(task, events) on every server change
|
|
127
|
+
* (SSE) plus a periodic poll as a safety net. Returns an unsubscribe fn. */
|
|
128
|
+
watch(name, id, onUpdate, opts) {
|
|
129
|
+
var stopped = false, es = null, pollTimer = null, debTimer = null;
|
|
130
|
+
var pollMs = opts && opts.pollMs || 15e3;
|
|
131
|
+
async function refresh() {
|
|
132
|
+
if (stopped) return;
|
|
133
|
+
try {
|
|
134
|
+
var task = await agents.getTask(name, id);
|
|
135
|
+
var events = await agents.events(name, id);
|
|
136
|
+
if (!stopped && typeof onUpdate === "function") onUpdate(task, events);
|
|
137
|
+
} catch {
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function debounced() {
|
|
141
|
+
clearTimeout(debTimer);
|
|
142
|
+
debTimer = setTimeout(refresh, 400);
|
|
143
|
+
}
|
|
144
|
+
refresh();
|
|
145
|
+
pollTimer = setInterval(refresh, pollMs);
|
|
146
|
+
(async function() {
|
|
147
|
+
try {
|
|
148
|
+
var tk = unwrap(await authFetch2("/v1/events/ticket", { method: "POST" }), "open event stream");
|
|
149
|
+
if (stopped || !tk || !tk.ticket) return;
|
|
150
|
+
es = new EventSource("/v1/events?ticket=" + enc(tk.ticket));
|
|
151
|
+
es.onmessage = debounced;
|
|
152
|
+
} catch {
|
|
153
|
+
}
|
|
154
|
+
})();
|
|
155
|
+
return function unsubscribe() {
|
|
156
|
+
stopped = true;
|
|
157
|
+
if (es) {
|
|
158
|
+
try {
|
|
159
|
+
es.close();
|
|
160
|
+
} catch {
|
|
161
|
+
}
|
|
162
|
+
es = null;
|
|
163
|
+
}
|
|
164
|
+
clearInterval(pollTimer);
|
|
165
|
+
clearTimeout(debTimer);
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
/** Read the task's published deliverable (task.deliverableKey) from the
|
|
169
|
+
* agent's memory. Returns { key, value } | { key, gone:true } | null. */
|
|
170
|
+
async deliverable(name, id) {
|
|
171
|
+
var task = await agents.getTask(name, id);
|
|
172
|
+
if (!task) return null;
|
|
173
|
+
var key = task.deliverableKey;
|
|
174
|
+
if (key) {
|
|
175
|
+
var data = unwrap(await authFetch2("/v1/memory?agent=" + enc(task.agentGaii) + "&prefix=" + enc(key) + "&per_page=20"), "read deliverable");
|
|
176
|
+
var found = (data.items || []).find(function(i) {
|
|
177
|
+
return i.key === key;
|
|
178
|
+
});
|
|
179
|
+
return found ? { key, value: found.value } : { key, gone: true };
|
|
180
|
+
}
|
|
181
|
+
var byTag = unwrap(await authFetch2("/v1/memory?agent=" + enc(task.agentGaii) + "&tags=" + enc("task:" + id) + "&per_page=20"), "read deliverable by tag");
|
|
182
|
+
var items = (byTag.items || []).slice().sort(function(a, b) {
|
|
183
|
+
return String(b.updated_at || "").localeCompare(String(a.updated_at || ""));
|
|
184
|
+
});
|
|
185
|
+
if (items.length) return { key: items[0].key, value: items[0].value, viaTag: true };
|
|
186
|
+
return null;
|
|
187
|
+
},
|
|
188
|
+
/** Read a specific memory entry under an agent's namespace (or null). */
|
|
189
|
+
async memory(name, key) {
|
|
190
|
+
var a = await agents.get(name);
|
|
191
|
+
var gaii = a && a.gaii || name;
|
|
192
|
+
var data = unwrap(await authFetch2("/v1/memory?agent=" + enc(gaii) + "&prefix=" + enc(key) + "&per_page=20"), "read agent memory");
|
|
193
|
+
var items = data.items || [];
|
|
194
|
+
var found = items.find(function(i) {
|
|
195
|
+
return i.key === key;
|
|
196
|
+
});
|
|
197
|
+
return found ? found.value : null;
|
|
198
|
+
},
|
|
199
|
+
/** Agent questions awaiting an answer: outbound option-prompts with no reply
|
|
200
|
+
* yet. Each is { message_id, prompt_id, question, options, allow_other }. */
|
|
201
|
+
async pendingPrompts(name) {
|
|
202
|
+
var data = unwrap(await authFetch2("/v1/agents/" + enc(name) + "/messages?per_page=100"), "list messages");
|
|
203
|
+
var msgs = data.messages || [];
|
|
204
|
+
var answered = {};
|
|
205
|
+
msgs.forEach(function(m) {
|
|
206
|
+
var pa = m.metadata && (m.metadata.promptAnswer || m.metadata.prompt_answer);
|
|
207
|
+
var pid = pa && (pa.promptId || pa.prompt_id);
|
|
208
|
+
if (pid) answered[pid] = true;
|
|
209
|
+
});
|
|
210
|
+
var out = [];
|
|
211
|
+
msgs.forEach(function(m) {
|
|
212
|
+
if (m.direction !== "outbound") return;
|
|
213
|
+
var p = m.metadata && m.metadata.prompt;
|
|
214
|
+
if (!p) return;
|
|
215
|
+
var pid = p.promptId || p.prompt_id;
|
|
216
|
+
if (!pid || answered[pid]) return;
|
|
217
|
+
out.push({
|
|
218
|
+
message_id: m.id,
|
|
219
|
+
prompt_id: pid,
|
|
220
|
+
question: p.question,
|
|
221
|
+
options: p.options || [],
|
|
222
|
+
allow_other: (p.allowOther != null ? p.allowOther : p.allow_other) !== false
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
return out;
|
|
226
|
+
},
|
|
227
|
+
/** Answer an agent's option-prompt (owner -> agent). choice is the chosen
|
|
228
|
+
* option text, or free text when is_other is true. */
|
|
229
|
+
async answerPrompt(name, ans) {
|
|
230
|
+
if (!ans || !ans.prompt_id || !ans.choice) throw new Error("answerPrompt requires { prompt_id, choice }");
|
|
231
|
+
return unwrap(await authFetch2("/v1/agents/" + enc(name) + "/messages", {
|
|
232
|
+
method: "POST",
|
|
233
|
+
body: JSON.stringify({
|
|
234
|
+
content: ans.choice,
|
|
235
|
+
direction: "inbound",
|
|
236
|
+
metadata: { prompt_answer: { prompt_id: ans.prompt_id, choice: ans.choice, is_other: !!ans.is_other } }
|
|
237
|
+
})
|
|
238
|
+
}), "answer prompt");
|
|
239
|
+
},
|
|
240
|
+
/** Commission + watch until done/failed/stalled, then resolve
|
|
241
|
+
* { task, deliverable }. Best for task-runner agents (which auto-activate).
|
|
242
|
+
* opts: { onProgress(task, events), timeoutMs, pollMs }. */
|
|
243
|
+
async run(name, task, opts) {
|
|
244
|
+
var created = await agents.createTask(name, task);
|
|
245
|
+
var id = created.id;
|
|
246
|
+
return await new Promise(function(resolve, reject) {
|
|
247
|
+
var done = false, to = null;
|
|
248
|
+
var stop = agents.watch(name, id, async function(t, events) {
|
|
249
|
+
if (opts && opts.onProgress) {
|
|
250
|
+
try {
|
|
251
|
+
opts.onProgress(t, events);
|
|
252
|
+
} catch {
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (!done && (t.status === "done" || t.status === "failed" || t.status === "stalled")) {
|
|
256
|
+
done = true;
|
|
257
|
+
if (to) clearTimeout(to);
|
|
258
|
+
stop();
|
|
259
|
+
var deliverable = t.status === "done" ? await agents.deliverable(name, id).catch(function() {
|
|
260
|
+
return null;
|
|
261
|
+
}) : null;
|
|
262
|
+
resolve({ task: t, deliverable });
|
|
263
|
+
}
|
|
264
|
+
}, opts);
|
|
265
|
+
if (opts && opts.timeoutMs > 0) {
|
|
266
|
+
to = setTimeout(function() {
|
|
267
|
+
if (!done) {
|
|
268
|
+
done = true;
|
|
269
|
+
stop();
|
|
270
|
+
var e = (
|
|
271
|
+
/** @type {Error & { code?: string, taskId?: string }} */
|
|
272
|
+
new Error("run() timed out")
|
|
273
|
+
);
|
|
274
|
+
e.code = "TIMEOUT";
|
|
275
|
+
e.taskId = id;
|
|
276
|
+
reject(e);
|
|
277
|
+
}
|
|
278
|
+
}, opts.timeoutMs);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
/** Cooperative-cancel a task. Writes a cancel marker the worker daemon
|
|
283
|
+
* honours before its next kickoff (so abandoned/speculative subtasks never
|
|
284
|
+
* start), AND, for immediate effect, natively pauses an active task or
|
|
285
|
+
* deletes a queued one (owner-only ops; best-effort). Returns
|
|
286
|
+
* { marked:true, native:'paused'|'deleted'|null }. */
|
|
287
|
+
async cancelTask(name, taskId, opts) {
|
|
288
|
+
await authFetch2("/v1/memory", { method: "POST", body: JSON.stringify({
|
|
289
|
+
key: "agents.cancel.task." + taskId,
|
|
290
|
+
value: [taskId],
|
|
291
|
+
visibility: "owner"
|
|
292
|
+
}) });
|
|
293
|
+
var native = null;
|
|
294
|
+
try {
|
|
295
|
+
var t = await agents.getTask(name, taskId);
|
|
296
|
+
var st = t && t.status;
|
|
297
|
+
if (st === "active") {
|
|
298
|
+
var r = await authFetch2("/v1/agents/" + enc(name) + "/tasks/" + enc(taskId) + "/pause", { method: "POST" });
|
|
299
|
+
if (r && r.ok) native = "paused";
|
|
300
|
+
} else if (st === "queued" || st === "draft") {
|
|
301
|
+
var r2 = await authFetch2("/v1/agents/" + enc(name) + "/tasks/" + enc(taskId), { method: "DELETE" });
|
|
302
|
+
if (r2 && r2.ok) native = "deleted";
|
|
303
|
+
}
|
|
304
|
+
} catch {
|
|
305
|
+
}
|
|
306
|
+
if (opts && opts.invalidate !== false) _cancelSetCache = null;
|
|
307
|
+
return { marked: true, native };
|
|
308
|
+
},
|
|
309
|
+
/** Cancel a whole run/batch: write one marker listing many task ids
|
|
310
|
+
* (key agents.cancel.run.<run>). Workers union all agents.cancel.* markers. */
|
|
311
|
+
async cancelRun(run, taskIds) {
|
|
312
|
+
if (!run || !Array.isArray(taskIds)) throw new Error("cancelRun requires (run, taskIds[])");
|
|
313
|
+
await authFetch2("/v1/memory", { method: "POST", body: JSON.stringify({
|
|
314
|
+
key: "agents.cancel.run." + run,
|
|
315
|
+
value: taskIds.map(String),
|
|
316
|
+
visibility: "owner"
|
|
317
|
+
}) });
|
|
318
|
+
_cancelSetCache = null;
|
|
319
|
+
return { marked: true, count: taskIds.length };
|
|
320
|
+
},
|
|
321
|
+
/** The set (array) of task ids cancelled via any agents.cancel.* marker
|
|
322
|
+
* visible to the owner. 10s cache. */
|
|
323
|
+
async cancelledTaskIds(opts) {
|
|
324
|
+
var now = Date.now();
|
|
325
|
+
if (!(opts && opts.fresh) && _cancelSetCache && now - _cancelSetCache.t < 1e4) return _cancelSetCache.v;
|
|
326
|
+
var data = unwrap(await authFetch2("/v1/memory?owner_scope=true&prefix=" + enc("agents.cancel.") + "&per_page=100"), "read cancel markers");
|
|
327
|
+
var set = {};
|
|
328
|
+
(data.items || []).forEach(function(it) {
|
|
329
|
+
var v2 = it.value;
|
|
330
|
+
if (Array.isArray(v2)) v2.forEach(function(x) {
|
|
331
|
+
set[String(x)] = true;
|
|
332
|
+
});
|
|
333
|
+
else if (v2 && typeof v2 === "object") Object.keys(v2).forEach(function(k) {
|
|
334
|
+
set[k] = true;
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
var v = Object.keys(set);
|
|
338
|
+
_cancelSetCache = { v, t: now };
|
|
339
|
+
return v;
|
|
340
|
+
},
|
|
341
|
+
/** Clear the cached agent list (call after creating/deleting an agent). */
|
|
342
|
+
invalidateCache() {
|
|
343
|
+
_agentsCache = null;
|
|
344
|
+
_cancelSetCache = null;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
attach("agents", agents);
|
|
348
|
+
})();
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// GENERATED FILE — do not edit directly. Source: src/static/sdk-libs/ai/ (+ _core/).
|
|
2
|
+
// Rebuild: pnpm build:sdk · Served at /v1/libs/aimeat-ai.js (with a per-node config prelude).
|
|
3
|
+
"use strict";
|
|
4
|
+
(() => {
|
|
5
|
+
// src/static/sdk-libs/_core/session.js
|
|
6
|
+
function getSession(libLabel) {
|
|
7
|
+
const auth = window.AIMEAT && window.AIMEAT.auth;
|
|
8
|
+
if (!auth) {
|
|
9
|
+
throw new Error("AIMEAT.auth is required. Include aimeat-auth.js before " + (libLabel || "this library"));
|
|
10
|
+
}
|
|
11
|
+
const s = auth.getSession();
|
|
12
|
+
if (!s) throw new Error("Not logged in. Call AIMEAT.auth.login() first.");
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
15
|
+
function authFetch(path, opts, libLabel) {
|
|
16
|
+
return getSession(libLabel).fetch(path, opts);
|
|
17
|
+
}
|
|
18
|
+
function makeSession(libLabel) {
|
|
19
|
+
return {
|
|
20
|
+
getSession: () => getSession(libLabel),
|
|
21
|
+
authFetch: (path, opts) => authFetch(path, opts, libLabel)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/static/sdk-libs/_core/namespace.js
|
|
26
|
+
function namespace() {
|
|
27
|
+
if (!window.AIMEAT) window.AIMEAT = {};
|
|
28
|
+
return window.AIMEAT;
|
|
29
|
+
}
|
|
30
|
+
function attach(key, value) {
|
|
31
|
+
const ns = namespace();
|
|
32
|
+
ns[key] = value;
|
|
33
|
+
return ns;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/static/sdk-libs/ai/index.js
|
|
37
|
+
var { authFetch: authFetch2 } = makeSession("aimeat-ai.js");
|
|
38
|
+
var _availCache = null;
|
|
39
|
+
var _modelsCache = null;
|
|
40
|
+
var ai = {
|
|
41
|
+
/**
|
|
42
|
+
* Returns true if the user has AI configured (an OpenRouter key, or a keyless
|
|
43
|
+
* self-hosted provider). Cached 60 seconds. Apps should call this before showing
|
|
44
|
+
* "Use AI" buttons. Uses GET /v1/ai/available, which an app-grant token (a sandboxed
|
|
45
|
+
* app on the isolated app origin) can call with the ai:use scope — unlike the
|
|
46
|
+
* owner-only /v1/openrouter/settings. Falls back to that settings probe on older nodes.
|
|
47
|
+
*/
|
|
48
|
+
async isAvailable() {
|
|
49
|
+
const now = Date.now();
|
|
50
|
+
if (_availCache && now - _availCache.t < 6e4) return _availCache.v;
|
|
51
|
+
try {
|
|
52
|
+
const r = await authFetch2("/v1/ai/available");
|
|
53
|
+
if (r && r.ok && r.data && typeof r.data.available === "boolean") {
|
|
54
|
+
_availCache = { v: r.data.available, t: now };
|
|
55
|
+
return r.data.available;
|
|
56
|
+
}
|
|
57
|
+
const s = await authFetch2("/v1/openrouter/settings");
|
|
58
|
+
const v = !!(s && s.ok && s.data && (s.data.hasApiKey || s.data.has_api_key));
|
|
59
|
+
_availCache = { v, t: now };
|
|
60
|
+
return v;
|
|
61
|
+
} catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Run a single completion. Returns { content, model, usage, budget }.
|
|
67
|
+
* Throws an Error with .code set on quota/permission/auth failures.
|
|
68
|
+
*
|
|
69
|
+
* Recognized error codes (see routes/ai.ts):
|
|
70
|
+
* NO_API_KEY — user hasn't set up a key yet
|
|
71
|
+
* QUOTA_EXHAUSTED — daily user budget hit
|
|
72
|
+
* APP_QUOTA_EXHAUSTED — per-app daily quota hit
|
|
73
|
+
* APP_NOT_ALLOWED — app_id not in user's allowlist
|
|
74
|
+
* APP_ID_REQUIRED — user has an allowlist; app must pass app_id
|
|
75
|
+
* INVALID_API_KEY — provider rejected the key
|
|
76
|
+
* RATE_LIMITED — provider rate limit
|
|
77
|
+
* PROVIDER_ERROR — upstream provider failed
|
|
78
|
+
*/
|
|
79
|
+
async complete(opts) {
|
|
80
|
+
if (!opts || typeof opts !== "object") throw new Error("opts object required");
|
|
81
|
+
if (!opts.prompt) throw new Error("opts.prompt required");
|
|
82
|
+
const body = {
|
|
83
|
+
prompt: opts.prompt,
|
|
84
|
+
systemPrompt: opts.systemPrompt,
|
|
85
|
+
model: opts.model,
|
|
86
|
+
modelRole: opts.modelRole,
|
|
87
|
+
temperature: opts.temperature,
|
|
88
|
+
top_p: opts.top_p,
|
|
89
|
+
max_tokens: opts.max_tokens,
|
|
90
|
+
app_id: opts.app_id
|
|
91
|
+
};
|
|
92
|
+
const r = await authFetch2("/v1/ai/complete", {
|
|
93
|
+
method: "POST",
|
|
94
|
+
body: JSON.stringify(body)
|
|
95
|
+
});
|
|
96
|
+
if (!r || !r.ok) {
|
|
97
|
+
const code = r && r.error && r.error.code || "UNKNOWN";
|
|
98
|
+
const msg = r && r.error && r.error.message || "AI call failed";
|
|
99
|
+
const err = (
|
|
100
|
+
/** @type {Error & { code?: string }} */
|
|
101
|
+
new Error(msg)
|
|
102
|
+
);
|
|
103
|
+
err.code = code;
|
|
104
|
+
throw err;
|
|
105
|
+
}
|
|
106
|
+
return r.data;
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* Convenience: complete + JSON.parse. Adds a "return ONLY valid JSON"
|
|
110
|
+
* suffix to systemPrompt. On parse failure, retries ONCE with a stronger
|
|
111
|
+
* instruction. Further failures throw — the user can retry by clicking.
|
|
112
|
+
*/
|
|
113
|
+
async completeJson(opts) {
|
|
114
|
+
const suffix = "\nReturn ONLY valid JSON, no prose, no markdown fences.";
|
|
115
|
+
const first = await ai.complete({
|
|
116
|
+
...opts,
|
|
117
|
+
systemPrompt: (opts.systemPrompt || "") + suffix
|
|
118
|
+
});
|
|
119
|
+
try {
|
|
120
|
+
return { ...first, parsed: JSON.parse(first.content) };
|
|
121
|
+
} catch {
|
|
122
|
+
const retry = await ai.complete({
|
|
123
|
+
...opts,
|
|
124
|
+
systemPrompt: (opts.systemPrompt || "") + suffix + "\nIMPORTANT: your previous attempt was not valid JSON. Output ONLY the JSON object, starting with { and ending with }. No other text.",
|
|
125
|
+
temperature: typeof opts.temperature === "number" ? Math.max(0, opts.temperature - 0.3) : 0.2
|
|
126
|
+
});
|
|
127
|
+
try {
|
|
128
|
+
return { ...retry, parsed: JSON.parse(retry.content) };
|
|
129
|
+
} catch {
|
|
130
|
+
const err = (
|
|
131
|
+
/** @type {Error & { code?: string }} */
|
|
132
|
+
new Error("AI returned invalid JSON twice. Original response: " + retry.content.slice(0, 200))
|
|
133
|
+
);
|
|
134
|
+
err.code = "JSON_PARSE_FAILED";
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* List the models the user's account can hit. Cached 1 hour.
|
|
141
|
+
*/
|
|
142
|
+
async models() {
|
|
143
|
+
const now = Date.now();
|
|
144
|
+
if (_modelsCache && now - _modelsCache.t < 36e5) return _modelsCache.v;
|
|
145
|
+
const r = await authFetch2("/v1/openrouter/models");
|
|
146
|
+
if (!r || !r.ok) throw new Error(r && r.error && r.error.message || "Failed to list models");
|
|
147
|
+
const v = r.data && r.data.models ? r.data.models : [];
|
|
148
|
+
_modelsCache = { v, t: now };
|
|
149
|
+
return v;
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Today's spend snapshot (owner-only). Useful for "AI used: $0.04 / $1.00".
|
|
153
|
+
*/
|
|
154
|
+
async usage() {
|
|
155
|
+
const r = await authFetch2("/v1/ai/usage");
|
|
156
|
+
if (!r || !r.ok) throw new Error(r && r.error && r.error.message || "Failed to read usage");
|
|
157
|
+
return r.data;
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* Clear browser-side caches. Call after the user toggles their key/budget.
|
|
161
|
+
*/
|
|
162
|
+
invalidateCache() {
|
|
163
|
+
_availCache = null;
|
|
164
|
+
_modelsCache = null;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
attach("ai", ai);
|
|
168
|
+
})();
|