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,68 @@
|
|
|
1
|
+
import { listPaymentHandlers, MORSEL_HANDLER_ID } from '../commerce/payment-handlers.js';
|
|
2
|
+
import { TEST_MONEY_HANDLER_ID } from '../commerce/test-money-handler.js';
|
|
3
|
+
import { percentFee } from '../commerce/money.js';
|
|
4
|
+
import { recordMoneyPlatformFee } from '../commerce/session-service.js';
|
|
5
|
+
/** The invoice/receivable rail that accrues real money without a live per-call PSP charge (prod EE). */
|
|
6
|
+
const ACCRUAL_HANDLER_ID = 'io.aimeat.invoice';
|
|
7
|
+
/** Pick the money handler to accrue against for a currency: prefer the invoice receivable rail, then the
|
|
8
|
+
* OSS test double, then any other non-morsel handler. Null when no money handler is registered. */
|
|
9
|
+
export function resolveAccrualHandler(currency) {
|
|
10
|
+
const money = listPaymentHandlers().filter(h => h.id !== MORSEL_HANDLER_ID && h.currencies.includes(currency));
|
|
11
|
+
return money.find(h => h.id === ACCRUAL_HANDLER_ID)
|
|
12
|
+
?? money.find(h => h.id === TEST_MONEY_HANDLER_ID)
|
|
13
|
+
?? money[0]
|
|
14
|
+
?? null;
|
|
15
|
+
}
|
|
16
|
+
const ownerOf = (ghii) => ghii.split('@')[0].split('#').pop() ?? ghii;
|
|
17
|
+
/**
|
|
18
|
+
* Settle ONE metered call in real money: collect the price from the consumer, pay the provider its net
|
|
19
|
+
* (price − rake), and account the operator's rake — all through the resolved money handler (accrual).
|
|
20
|
+
* Returns the tracking code so a post-payment script throw can refund. Never throws — a handler failure
|
|
21
|
+
* comes back as `{ ok:false }` so the gateway denies the call cleanly (no partial settlement).
|
|
22
|
+
*/
|
|
23
|
+
export async function settleEntitlementMoney(storage, config, args) {
|
|
24
|
+
const handler = resolveAccrualHandler(args.currency);
|
|
25
|
+
if (!handler)
|
|
26
|
+
return { ok: false, reason: 'no_money_handler' };
|
|
27
|
+
const price = Math.max(0, Math.floor(args.priceMicros));
|
|
28
|
+
const fee = percentFee(price, args.feePct);
|
|
29
|
+
const net = price - fee;
|
|
30
|
+
const ctx = { config, storage };
|
|
31
|
+
const seller = { ghii: args.providerGhii, owner: ownerOf(args.providerGhii) };
|
|
32
|
+
try {
|
|
33
|
+
const collected = await handler.collect(ctx, {
|
|
34
|
+
buyerGhii: args.consumerGhii, amount: price, currency: args.currency, reference: args.reference, fee, seller,
|
|
35
|
+
});
|
|
36
|
+
if (net > 0) {
|
|
37
|
+
await handler.payout(ctx, {
|
|
38
|
+
toGhii: args.providerGhii, amount: net, currency: args.currency,
|
|
39
|
+
buyerGhii: args.consumerGhii, trackingCode: collected.trackingCode, reference: args.reference,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (fee > 0) {
|
|
43
|
+
await recordMoneyPlatformFee(storage, config, {
|
|
44
|
+
fee, currency: args.currency, sellerGhii: args.providerGhii, buyerGhii: args.consumerGhii,
|
|
45
|
+
trackingCode: collected.trackingCode, handler: handler.id,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return { ok: true, handler: handler.id, trackingCode: collected.trackingCode, fee, net };
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return { ok: false, reason: 'settlement_failed' };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Best-effort reverse of a money accrual (post-payment script throw), mirroring the handler's refund leg. */
|
|
55
|
+
export async function refundEntitlementMoney(storage, config, args) {
|
|
56
|
+
const handler = resolveAccrualHandler(args.currency);
|
|
57
|
+
if (!handler)
|
|
58
|
+
return;
|
|
59
|
+
const ctx = { config, storage };
|
|
60
|
+
try {
|
|
61
|
+
await handler.refund(ctx, {
|
|
62
|
+
buyerGhii: args.consumerGhii, amount: Math.max(0, Math.floor(args.priceMicros)), trackingCode: args.trackingCode,
|
|
63
|
+
seller: { ghii: args.providerGhii, owner: ownerOf(args.providerGhii) },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch { /* refund is best-effort; the handler contract says it must not throw, but guard anyway */ }
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=entitlement-money.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlement-money.js","sourceRoot":"","sources":["../../../src/services/entitlement-money.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,wGAAwG;AACxG,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C;oGACoG;AACpG,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,MAAM,KAAK,GAAG,mBAAmB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,iBAAiB,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/G,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,kBAAkB,CAAC;WAC9C,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,qBAAqB,CAAC;WAC/C,KAAK,CAAC,CAAC,CAAC;WACR,IAAI,CAAC;AACZ,CAAC;AAED,MAAM,O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,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY;YAChH,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;SACvE,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC,CAAC,0FAA0F,CAAC,CAAC;AACxG,CAAC"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { Storage } from '../storage/interface.js';
|
|
2
|
+
import { type EntitlementUnit, type PricingSpec, type AppToolSurface, type AgentWorkSurface, type SellableSurface } from './metered-entitlements.js';
|
|
3
|
+
import type { Provenance, OdpsExtras } from '../models/odps-schemas.js';
|
|
4
|
+
export type { AppToolSurface, AgentWorkSurface, SellableSurface };
|
|
5
|
+
/** The action `commercial` block an offering/contract prices against. */
|
|
6
|
+
export interface ActionCommercial {
|
|
7
|
+
payMorsels?: number;
|
|
8
|
+
payMoney?: {
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
};
|
|
12
|
+
plans?: OfferingPlan[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the AUTHORITATIVE unit + per-call price + (optional plan) pricing spec from a provider action's
|
|
16
|
+
* commercial block — the single source of truth shared by the acceptance route AND bid-accept, so a
|
|
17
|
+
* consumer can never undercut the provider. Money (payMoney) takes precedence over morsels.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveActionPricing(comm: ActionCommercial | undefined, planId: string | null): {
|
|
20
|
+
ok: true;
|
|
21
|
+
unit: EntitlementUnit;
|
|
22
|
+
pricePerCall: number;
|
|
23
|
+
currency: string | null;
|
|
24
|
+
pricing: PricingSpec | null;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
/** A provider pricing plan surfaced on an offering (mirrors the action's commercial.plans). */
|
|
31
|
+
export type OfferingPlan = {
|
|
32
|
+
id: string;
|
|
33
|
+
model: 'per_call';
|
|
34
|
+
} | {
|
|
35
|
+
id: string;
|
|
36
|
+
model: 'bundle';
|
|
37
|
+
blockSize: number;
|
|
38
|
+
blockPrice: number;
|
|
39
|
+
} | {
|
|
40
|
+
id: string;
|
|
41
|
+
model: 'subscription';
|
|
42
|
+
periodSeconds: number;
|
|
43
|
+
periodPrice: number;
|
|
44
|
+
callsPerWindow: number;
|
|
45
|
+
windowSeconds: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Provenance attestation + the ODPS authoring block. Both are defined (and validated) in
|
|
49
|
+
* `models/odps-schemas.ts` and re-exported here so the offering record stays the single import site.
|
|
50
|
+
* A PROMISE by the provider, not a platform guarantee — but structured, attributed and projectable
|
|
51
|
+
* into the ODPS v4.1 document served at `/v1/exchange/offerings/{id}/odps.yaml`.
|
|
52
|
+
*/
|
|
53
|
+
export type { Provenance, OdpsExtras };
|
|
54
|
+
/**
|
|
55
|
+
* How a consumer may use the delivered data — the consent-forward half of provenance. A provider PROMISE
|
|
56
|
+
* surfaced to the consumer BEFORE they contract, so "may I refine and resell this downstream?" is answered
|
|
57
|
+
* up front (it is not enforced by the node — it is the stated licence the contract is accepted under).
|
|
58
|
+
*/
|
|
59
|
+
export interface UsageTerms {
|
|
60
|
+
derivatives: boolean;
|
|
61
|
+
resale: boolean;
|
|
62
|
+
attribution: boolean;
|
|
63
|
+
note?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The interface a requesting app is WAITING to call — what makes a NEED an emergent, machine-matchable
|
|
67
|
+
* data-API request rather than a wish. The app declares the exact shape it will SEND and the shape it EXPECTS
|
|
68
|
+
* back; a provider builds a matching app-tool (or extension) whose I/O satisfies it. `inputSchema`/`outputSchema`
|
|
69
|
+
* are the precise contract (like an offering's); `requiredFields`/`format`/`sample` are the light human hints.
|
|
70
|
+
*/
|
|
71
|
+
export interface NeedSpec {
|
|
72
|
+
requiredFields: string[];
|
|
73
|
+
format?: string;
|
|
74
|
+
sample?: string;
|
|
75
|
+
notes?: string;
|
|
76
|
+
inputSchema?: Record<string, unknown>;
|
|
77
|
+
outputSchema?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
/** A public supply listing. `kind` distinguishes a raw extension action (the original surface) from an
|
|
80
|
+
* app-tool (a method a provider app sells cross-app). For BOTH, `ext`/`action` hold the metered COORDINATE
|
|
81
|
+
* (app-tool uses `apptool:{owner}/{appId}` + the tool name) so the entitlement + stats machinery is shared. */
|
|
82
|
+
export interface Offering {
|
|
83
|
+
offeringId: string;
|
|
84
|
+
providerGhii: string;
|
|
85
|
+
providerOwner: string;
|
|
86
|
+
kind: 'ext-action' | 'app-tool' | 'agent-work';
|
|
87
|
+
ext: string;
|
|
88
|
+
action: string;
|
|
89
|
+
surface: SellableSurface | null;
|
|
90
|
+
title: string;
|
|
91
|
+
description: string;
|
|
92
|
+
unit: EntitlementUnit;
|
|
93
|
+
basePrice: number;
|
|
94
|
+
currency: string | null;
|
|
95
|
+
plans: OfferingPlan[];
|
|
96
|
+
/** For kind==='agent-work': the task interface (what the consumer sends / the agent delivers). */
|
|
97
|
+
taskSpec?: {
|
|
98
|
+
inputSchema: Record<string, unknown>;
|
|
99
|
+
outputSchema: Record<string, unknown>;
|
|
100
|
+
} | null;
|
|
101
|
+
provenance: Provenance | null;
|
|
102
|
+
/**
|
|
103
|
+
* Morsels burned per call on top of whatever this offering is paid in — the provider's own pacing.
|
|
104
|
+
* Projected from the source and captured into the contract at accept, so changing it later governs
|
|
105
|
+
* new contracts while existing ones keep the terms they were signed at.
|
|
106
|
+
*/
|
|
107
|
+
tollMorsels?: number | null;
|
|
108
|
+
usageTerms: UsageTerms | null;
|
|
109
|
+
/**
|
|
110
|
+
* The provider's ODPS authoring block — the Open Data Product Specification fields the node cannot derive
|
|
111
|
+
* (value proposition, categories, standards, use cases, sample, SLA + data-quality COMMITMENTS, the legal
|
|
112
|
+
* data holder, jurisdiction/exit terms). Optional: without it the listing still projects a valid, thinner
|
|
113
|
+
* ODPS v4.1 document at `/v1/exchange/offerings/{id}/odps.yaml`.
|
|
114
|
+
*/
|
|
115
|
+
odps?: OdpsExtras | null;
|
|
116
|
+
tags: string[];
|
|
117
|
+
state: 'listed' | 'delisted';
|
|
118
|
+
/**
|
|
119
|
+
* TARGET-050 — this listing is a PROJECTION of its source (the app-tool manifest, the extension action
|
|
120
|
+
* or the agent's offer), not a hand-authored snapshot: the source's `exchange` flag put it here and the
|
|
121
|
+
* source's price/labels flow into it. `sourceHash` is the content identity of that source at the last
|
|
122
|
+
* reconcile, so a change is detectable without re-writing every listing. A CONTRACT is never a
|
|
123
|
+
* projection — it stays pinned to the interface version and price it was signed at.
|
|
124
|
+
*/
|
|
125
|
+
auto?: boolean;
|
|
126
|
+
sourceHash?: string | null;
|
|
127
|
+
createdAt: string;
|
|
128
|
+
updatedAt: string;
|
|
129
|
+
}
|
|
130
|
+
/** The metered coordinate for an app-tool surface — the (ext, action) pair the entitlement + gate key on. */
|
|
131
|
+
export declare function appToolCoordinate(ownerName: string, appId: string, tool: string): {
|
|
132
|
+
ext: string;
|
|
133
|
+
action: string;
|
|
134
|
+
};
|
|
135
|
+
/** The metered coordinate for an agent-work surface (a provider agent's task type; settled per delivered task). */
|
|
136
|
+
export declare function agentWorkCoordinate(ownerName: string, agentName: string, taskType: string): {
|
|
137
|
+
ext: string;
|
|
138
|
+
action: string;
|
|
139
|
+
};
|
|
140
|
+
/** Build an ActionCommercial from an offering's stored price/plans, so the shared pricing resolver
|
|
141
|
+
* (resolveActionPricing) works for app-tool offerings too — the offering's listing IS the authoritative price. */
|
|
142
|
+
export declare function offeringToCommercial(o: Offering): ActionCommercial;
|
|
143
|
+
/**
|
|
144
|
+
* Resolve the authoritative pricing + metered coordinate to mint a contract from an offering — shared by the
|
|
145
|
+
* REST and MCP accept flows, for BOTH kinds. For app-tool the price comes from the offering's own listing;
|
|
146
|
+
* for ext-action it comes LIVE from the provider's extension action (so the provider's current price wins).
|
|
147
|
+
*/
|
|
148
|
+
export declare function resolveOfferingPricing(storage: Storage, o: Offering, planId: string | null): Promise<{
|
|
149
|
+
ok: true;
|
|
150
|
+
unit: EntitlementUnit;
|
|
151
|
+
pricePerCall: number;
|
|
152
|
+
currency: string | null;
|
|
153
|
+
pricing: PricingSpec | null;
|
|
154
|
+
providerGhii: string;
|
|
155
|
+
ext: string;
|
|
156
|
+
action: string;
|
|
157
|
+
capabilityLabel: string;
|
|
158
|
+
surface: SellableSurface | null;
|
|
159
|
+
tollMorsels: number | null;
|
|
160
|
+
} | {
|
|
161
|
+
ok: false;
|
|
162
|
+
status: number;
|
|
163
|
+
code: string;
|
|
164
|
+
message: string;
|
|
165
|
+
}>;
|
|
166
|
+
/** A public demand posting. */
|
|
167
|
+
export interface Need {
|
|
168
|
+
needId: string;
|
|
169
|
+
requesterGaii: string;
|
|
170
|
+
requesterOwner: string;
|
|
171
|
+
appId: string | null;
|
|
172
|
+
ext: string | null;
|
|
173
|
+
action: string | null;
|
|
174
|
+
description: string;
|
|
175
|
+
spec: NeedSpec | null;
|
|
176
|
+
usageIntent: string | null;
|
|
177
|
+
budgetUnit: EntitlementUnit | null;
|
|
178
|
+
budgetCap: number | null;
|
|
179
|
+
autonomy: 'supervised' | 'auto';
|
|
180
|
+
state: 'open' | 'matched' | 'closed';
|
|
181
|
+
createdAt: string;
|
|
182
|
+
updatedAt: string;
|
|
183
|
+
}
|
|
184
|
+
/** A need enriched with the requesting app's identity + purpose, so a provider knows WHO/WHAT they'd serve. */
|
|
185
|
+
export interface NeedWithContext extends Need {
|
|
186
|
+
appContext: {
|
|
187
|
+
app: string;
|
|
188
|
+
name: string;
|
|
189
|
+
description: string;
|
|
190
|
+
} | null;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Attach app context to needs: when a need names a requesting app (`appId` = "owner/filename" or a bare
|
|
194
|
+
* filename under the requester), resolve that app's published name + description so a provider can judge the
|
|
195
|
+
* consumer before offering (per "do I even want to serve an app that misuses the data?"). Best-effort — a
|
|
196
|
+
* need without a resolvable app gets `appContext: null` and is grouped under its requester instead.
|
|
197
|
+
*/
|
|
198
|
+
export declare function enrichNeeds(storage: Storage, needs: Need[]): Promise<NeedWithContext[]>;
|
|
199
|
+
/** A provider's bid against a NEED. */
|
|
200
|
+
export interface Bid {
|
|
201
|
+
bidId: string;
|
|
202
|
+
needId: string;
|
|
203
|
+
bidderGhii: string;
|
|
204
|
+
bidderOwner: string;
|
|
205
|
+
offeringId: string | null;
|
|
206
|
+
ext: string;
|
|
207
|
+
action: string;
|
|
208
|
+
planId: string | null;
|
|
209
|
+
note: string;
|
|
210
|
+
state: 'open' | 'accepted' | 'withdrawn';
|
|
211
|
+
createdAt: string;
|
|
212
|
+
}
|
|
213
|
+
export declare function newOfferingId(): string;
|
|
214
|
+
export declare function putOffering(storage: Storage, o: Offering): Promise<Offering>;
|
|
215
|
+
export declare function getOffering(storage: Storage, id: string): Promise<Offering | null>;
|
|
216
|
+
export declare function listOfferings(storage: Storage): Promise<Offering[]>;
|
|
217
|
+
/** Every offering including delisted ones — the reconcile needs to revive a listing rather than duplicate it. */
|
|
218
|
+
export declare function listAllOfferings(storage: Storage): Promise<Offering[]>;
|
|
219
|
+
export declare function deleteOffering(storage: Storage, id: string): Promise<boolean>;
|
|
220
|
+
/** Rank listed offerings that satisfy a capability. Match = exact (ext,action) when given, else a text
|
|
221
|
+
* contains over title/description/tags. Cheapest base price first (a proxy; agents refine with plans/trust). */
|
|
222
|
+
export declare function matchOfferings(storage: Storage, q: {
|
|
223
|
+
ext?: string | null;
|
|
224
|
+
action?: string | null;
|
|
225
|
+
text?: string | null;
|
|
226
|
+
}): Promise<Offering[]>;
|
|
227
|
+
export declare function newNeedId(): string;
|
|
228
|
+
export declare function putNeed(storage: Storage, n: Need): Promise<Need>;
|
|
229
|
+
export declare function getNeed(storage: Storage, id: string): Promise<Need | null>;
|
|
230
|
+
export declare function listNeeds(storage: Storage, opts?: {
|
|
231
|
+
openOnly?: boolean;
|
|
232
|
+
owner?: string;
|
|
233
|
+
}): Promise<Need[]>;
|
|
234
|
+
export declare function newBidId(): string;
|
|
235
|
+
export declare function putBid(storage: Storage, b: Bid): Promise<Bid>;
|
|
236
|
+
export declare function listBids(storage: Storage, needId: string): Promise<Bid[]>;
|
|
237
|
+
export declare function getBid(storage: Storage, needId: string, bidId: string): Promise<Bid | null>;
|
|
238
|
+
/**
|
|
239
|
+
* Usage/reputation for an offering — the "is this API actually used, and successful?" signal that was in
|
|
240
|
+
* the original measurability spec. Derived entirely from the entitlements against it (each carries its own
|
|
241
|
+
* call + spend counters), so it needs no separate metrics table: a real, tamper-resistant record of demand.
|
|
242
|
+
*/
|
|
243
|
+
export interface OfferingStats {
|
|
244
|
+
activeContracts: number;
|
|
245
|
+
totalContracts: number;
|
|
246
|
+
totalCalls: number;
|
|
247
|
+
totalSettledUnits: number;
|
|
248
|
+
consumers: number;
|
|
249
|
+
listedAt: string;
|
|
250
|
+
lastUsedAt: string | null;
|
|
251
|
+
/** Observed delivery time, so a service commitment can be proposed from evidence rather than guessed.
|
|
252
|
+
* Null until the capability has actually served calls (call-timing.ts). */
|
|
253
|
+
timing: {
|
|
254
|
+
count: number;
|
|
255
|
+
p50Ms: number;
|
|
256
|
+
p95Ms: number;
|
|
257
|
+
maxMs: number;
|
|
258
|
+
} | null;
|
|
259
|
+
}
|
|
260
|
+
/** Compute an offering's usage stats from the entitlements minted against its (provider, ext, action). */
|
|
261
|
+
export declare function offeringStats(storage: Storage, o: Offering): Promise<OfferingStats>;
|
|
262
|
+
/**
|
|
263
|
+
* The provider's DATA-LINEAGE view: who holds a contract against this offering, how much they have consumed,
|
|
264
|
+
* and when they last used it — answering "where is my data used, by whom, and how much?". One row per live
|
|
265
|
+
* or historical contract. Provider-only (the route authorises); the consuming identity is shown so the
|
|
266
|
+
* provider can see (and, via the off-switch, react to) each relationship.
|
|
267
|
+
*/
|
|
268
|
+
export interface ConsumerRow {
|
|
269
|
+
consumerGaii: string;
|
|
270
|
+
appId: string | null;
|
|
271
|
+
contractRef: string;
|
|
272
|
+
unit: EntitlementUnit;
|
|
273
|
+
calls: number;
|
|
274
|
+
settledUnits: number;
|
|
275
|
+
state: string;
|
|
276
|
+
lastUsedAt: string;
|
|
277
|
+
}
|
|
278
|
+
/** List the consumers holding contracts against an offering (provider lineage/consumption log). */
|
|
279
|
+
export declare function offeringConsumers(storage: Storage, o: Offering): Promise<ConsumerRow[]>;
|
|
280
|
+
//# sourceMappingURL=exchange-market.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-market.d.ts","sourceRoot":"","sources":["../../../src/services/exchange-market.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAA8B,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjL,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGxE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC;AAElE,yEAAyE;AACzE,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GACxD;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,eAAe,CAAC;IAAC,YAAY,E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AM,CAAC;CACpB;AAED,mGAAmG;AACnG,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAQ7F"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file src/services/exchange-market.ts
|
|
3
|
+
* @description The two-sided EXCHANGE marketplace records (TARGET-045 Phase C) — the DEMAND + SUPPLY sides
|
|
4
|
+
* that sit above the metered entitlement (the contract). Three public, memory-backed record types the
|
|
5
|
+
* marketplace app + agents read/write; matching + negotiation live in the app/agent layer (this service
|
|
6
|
+
* is the generic store + a simple capability match, per "node holds refined data, not orchestration"):
|
|
7
|
+
* - OFFERING — a provider's public supply listing: a capability (ext/action) + pricing (base + plans) +
|
|
8
|
+
* provenance + an optional ODPS authoring block. Discoverable by any consumer, and projectable into
|
|
9
|
+
* a full ODPS v4.1 document (services/exchange-odps.ts).
|
|
10
|
+
* - NEED — a consumer/app's open demand: a wanted capability + budget + autonomy. Providers browse open
|
|
11
|
+
* needs and BID.
|
|
12
|
+
* - BID — a provider's offer against a NEED (links an OFFERING + proposed terms). The requester accepts
|
|
13
|
+
* one → the acceptance flow mints the entitlement.
|
|
14
|
+
* Keys: `exchange.offering.{id}` / `exchange.need.{id}` / `exchange.bid.{needId}.{id}` — public so the
|
|
15
|
+
* marketplace is browsable; ownership is the record's provider/requester GHII (authorised by the routes).
|
|
16
|
+
* @structure Offering·Need·Bid types · UsageTerms·NeedSpec · put/get/list/delete for each · matchOfferings ·
|
|
17
|
+
* offeringStats (reputation) · offeringConsumers (provider data-lineage)
|
|
18
|
+
* @usage import { putOffering, listOfferings, matchOfferings, putNeed, listOpenNeeds, putBid } from './exchange-market.js';
|
|
19
|
+
* @version-history
|
|
20
|
+
* v1.7.0 — 2026-07-25 — Pacing is per capability: Offering carries `tollMorsels` and the pricing
|
|
21
|
+
* resolver hands it to the contract, so a provider — not only the node — sets the brake.
|
|
22
|
+
* v1.6.0 — 2026-07-25 — ODPS v4.1 adoption (TARGET-045 §4 / addendum Q2+Q3): Provenance (now with
|
|
23
|
+
* transformations + SHA-256 snapshot hash + lineage) and the new `odps` authoring block move to
|
|
24
|
+
* models/odps-schemas.ts as validated schemas; Offering gains `odps`.
|
|
25
|
+
* v1.5.0 — 2026-07-21 — Agent-work surface (Gap 2): Offering.kind gains 'agent-work' + AgentWorkSurface +
|
|
26
|
+
* agentWorkCoordinate + Offering.taskSpec; resolveOfferingPricing covers agent-work (DATA/SERVICES/AGENT WORK).
|
|
27
|
+
* v1.4.0 — 2026-07-21 — Demand side as an emergent interface request: NeedSpec gains input/outputSchema
|
|
28
|
+
* (the shape the app sends/expects — a provider builds a matching app-tool). A need is app-bound.
|
|
29
|
+
* v1.3.0 — 2026-07-21 — Needs app-context: Need.usageIntent + enrichNeeds (resolve the requesting app's
|
|
30
|
+
* name/description so a provider can judge who they'd serve before offering).
|
|
31
|
+
* v1.2.0 — 2026-07-21 — Cross-app selling (Gap 1): Offering.kind ('ext-action'|'app-tool') + AppToolSurface
|
|
32
|
+
* (pinned interface); appToolCoordinate + offeringToCommercial + resolveOfferingPricing (shared mint path).
|
|
33
|
+
* v1.1.0 — 2026-07-20 — Legibility layer: UsageTerms + NeedSpec on records; offeringStats (usage/reputation)
|
|
34
|
+
* + offeringConsumers (provider lineage) derived from entitlements (no metrics table).
|
|
35
|
+
* v1.0.0 — 2026-07-20 — Initial marketplace records (offering/need/bid) + capability matching (Phase C).
|
|
36
|
+
*/
|
|
37
|
+
import { randomUUID } from 'node:crypto';
|
|
38
|
+
import { listEntitlementsByProvider } from './metered-entitlements.js';
|
|
39
|
+
import { readCallTiming } from './call-timing.js';
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the AUTHORITATIVE unit + per-call price + (optional plan) pricing spec from a provider action's
|
|
42
|
+
* commercial block — the single source of truth shared by the acceptance route AND bid-accept, so a
|
|
43
|
+
* consumer can never undercut the provider. Money (payMoney) takes precedence over morsels.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveActionPricing(comm, planId) {
|
|
46
|
+
const money = comm?.payMoney;
|
|
47
|
+
let unit;
|
|
48
|
+
let pricePerCall;
|
|
49
|
+
let currency = null;
|
|
50
|
+
if (money && typeof money.amount === 'number' && Number.isInteger(money.amount) && money.amount > 0) {
|
|
51
|
+
unit = 'money';
|
|
52
|
+
pricePerCall = money.amount;
|
|
53
|
+
currency = money.currency;
|
|
54
|
+
}
|
|
55
|
+
else if (typeof comm?.payMorsels === 'number' && Number.isInteger(comm.payMorsels) && comm.payMorsels > 0) {
|
|
56
|
+
unit = 'morsels';
|
|
57
|
+
pricePerCall = comm.payMorsels;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return { ok: false, code: 'NOT_PRICED', message: 'Action has no price; only priced actions are contractable' };
|
|
61
|
+
}
|
|
62
|
+
let pricing = null;
|
|
63
|
+
if (planId) {
|
|
64
|
+
const plan = (comm?.plans ?? []).find(p => p.id === planId);
|
|
65
|
+
if (!plan)
|
|
66
|
+
return { ok: false, code: 'PLAN_NOT_FOUND', message: `No plan "${planId}" on this action` };
|
|
67
|
+
if (plan.model === 'bundle') {
|
|
68
|
+
pricing = { model: 'bundle', blockSize: plan.blockSize, blockPrice: plan.blockPrice, callsRemaining: 0 };
|
|
69
|
+
}
|
|
70
|
+
else if (plan.model === 'subscription') {
|
|
71
|
+
const epoch = new Date(0).toISOString();
|
|
72
|
+
pricing = { model: 'subscription', periodSeconds: plan.periodSeconds, periodPrice: plan.periodPrice, callsPerWindow: plan.callsPerWindow, windowSeconds: plan.windowSeconds, validUntil: epoch, windowStart: epoch, windowCount: 0 };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { ok: true, unit, pricePerCall, currency, pricing };
|
|
76
|
+
}
|
|
77
|
+
/** The metered coordinate for an app-tool surface — the (ext, action) pair the entitlement + gate key on. */
|
|
78
|
+
export function appToolCoordinate(ownerName, appId, tool) {
|
|
79
|
+
return { ext: `apptool:${ownerName}/${appId}`, action: tool };
|
|
80
|
+
}
|
|
81
|
+
/** The metered coordinate for an agent-work surface (a provider agent's task type; settled per delivered task). */
|
|
82
|
+
export function agentWorkCoordinate(ownerName, agentName, taskType) {
|
|
83
|
+
return { ext: `agentwork:${ownerName}/${agentName}`, action: taskType };
|
|
84
|
+
}
|
|
85
|
+
/** Build an ActionCommercial from an offering's stored price/plans, so the shared pricing resolver
|
|
86
|
+
* (resolveActionPricing) works for app-tool offerings too — the offering's listing IS the authoritative price. */
|
|
87
|
+
export function offeringToCommercial(o) {
|
|
88
|
+
return {
|
|
89
|
+
payMorsels: o.unit === 'morsels' ? o.basePrice : undefined,
|
|
90
|
+
payMoney: o.unit === 'money' ? { amount: o.basePrice, currency: o.currency ?? 'EUR' } : undefined,
|
|
91
|
+
plans: o.plans,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve the authoritative pricing + metered coordinate to mint a contract from an offering — shared by the
|
|
96
|
+
* REST and MCP accept flows, for BOTH kinds. For app-tool the price comes from the offering's own listing;
|
|
97
|
+
* for ext-action it comes LIVE from the provider's extension action (so the provider's current price wins).
|
|
98
|
+
*/
|
|
99
|
+
export async function resolveOfferingPricing(storage, o, planId) {
|
|
100
|
+
// app-tool + agent-work both price from the offering's own listing (the provider authored it).
|
|
101
|
+
if ((o.kind === 'app-tool' || o.kind === 'agent-work') && o.surface) {
|
|
102
|
+
const priced = resolveActionPricing(offeringToCommercial(o), planId);
|
|
103
|
+
if (!priced.ok)
|
|
104
|
+
return { ok: false, status: 400, code: priced.code, message: priced.message };
|
|
105
|
+
const label = o.surface.kind === 'app-tool'
|
|
106
|
+
? `${o.surface.appId}/${o.surface.tool} v${o.surface.ifaceVersion}`
|
|
107
|
+
: `${o.surface.agentName}:${o.surface.taskType}`;
|
|
108
|
+
return {
|
|
109
|
+
ok: true, unit: priced.unit, pricePerCall: priced.pricePerCall, currency: priced.currency, pricing: priced.pricing,
|
|
110
|
+
providerGhii: o.providerGhii, ext: o.ext, action: o.action, capabilityLabel: label, surface: o.surface,
|
|
111
|
+
tollMorsels: o.tollMorsels ?? null,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// ext-action: authoritative LIVE price from the provider's extension action.
|
|
115
|
+
const extRec = await storage.getExtension(o.ext);
|
|
116
|
+
const act = extRec?.actions.find(a => a.id === o.action);
|
|
117
|
+
if (!extRec || !act)
|
|
118
|
+
return { ok: false, status: 404, code: 'NOT_FOUND', message: 'Offering capability no longer exists' };
|
|
119
|
+
const priced = resolveActionPricing(act.commercial, planId);
|
|
120
|
+
if (!priced.ok)
|
|
121
|
+
return { ok: false, status: 400, code: priced.code, message: priced.message };
|
|
122
|
+
return {
|
|
123
|
+
ok: true, unit: priced.unit, pricePerCall: priced.pricePerCall, currency: priced.currency, pricing: priced.pricing,
|
|
124
|
+
providerGhii: o.providerGhii, ext: o.ext, action: o.action, capabilityLabel: `${o.ext}/${o.action}`, surface: null,
|
|
125
|
+
// The action is the live source for a raw ext offering — its declared toll, not the listing's copy.
|
|
126
|
+
tollMorsels: act.tollMorsels ?? null,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Attach app context to needs: when a need names a requesting app (`appId` = "owner/filename" or a bare
|
|
131
|
+
* filename under the requester), resolve that app's published name + description so a provider can judge the
|
|
132
|
+
* consumer before offering (per "do I even want to serve an app that misuses the data?"). Best-effort — a
|
|
133
|
+
* need without a resolvable app gets `appContext: null` and is grouped under its requester instead.
|
|
134
|
+
*/
|
|
135
|
+
export async function enrichNeeds(storage, needs) {
|
|
136
|
+
const cache = new Map();
|
|
137
|
+
const out = [];
|
|
138
|
+
for (const n of needs) {
|
|
139
|
+
let appContext = null;
|
|
140
|
+
if (n.appId) {
|
|
141
|
+
const ref = n.appId.includes('/') ? n.appId : `${n.requesterOwner}/${n.appId}`;
|
|
142
|
+
if (cache.has(ref)) {
|
|
143
|
+
appContext = cache.get(ref) ?? null;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const [owner, filename] = ref.split('/');
|
|
147
|
+
let resolved = null;
|
|
148
|
+
try {
|
|
149
|
+
const rec = owner && filename ? await storage.getAppByOwnerName(owner, filename) : null;
|
|
150
|
+
const m = (rec?.manifest ?? {});
|
|
151
|
+
if (rec)
|
|
152
|
+
resolved = { app: ref, name: m.name || filename, description: m.description || '' };
|
|
153
|
+
}
|
|
154
|
+
catch { /* unresolved app → null context */ }
|
|
155
|
+
cache.set(ref, resolved);
|
|
156
|
+
appContext = resolved;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
out.push({ ...n, appContext });
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
const OFFERING_PREFIX = 'exchange.offering.';
|
|
164
|
+
const NEED_PREFIX = 'exchange.need.';
|
|
165
|
+
const bidPrefix = (needId) => `exchange.bid.${needId}.`;
|
|
166
|
+
async function putPublic(storage, ownerGhii, key, value, tag) {
|
|
167
|
+
const now = new Date().toISOString();
|
|
168
|
+
await storage.setMemory({ key, ownerGaii: ownerGhii, value, visibility: 'public', tags: [tag], ttlHours: null, version: 1, createdAt: now, updatedAt: now });
|
|
169
|
+
}
|
|
170
|
+
// ── OFFERING ────────────────────────────────────────────────────────────────
|
|
171
|
+
export function newOfferingId() { return `off-${randomUUID().slice(0, 12)}`; }
|
|
172
|
+
export async function putOffering(storage, o) {
|
|
173
|
+
await putPublic(storage, o.providerGhii, OFFERING_PREFIX + o.offeringId, o, 'exchange-offering');
|
|
174
|
+
return o;
|
|
175
|
+
}
|
|
176
|
+
export async function getOffering(storage, id) {
|
|
177
|
+
const { items } = await storage.listAllMemory({ prefix: OFFERING_PREFIX + id, limit: 2 });
|
|
178
|
+
const rec = items.find(r => r.key === OFFERING_PREFIX + id);
|
|
179
|
+
return rec ? rec.value : null;
|
|
180
|
+
}
|
|
181
|
+
export async function listOfferings(storage) {
|
|
182
|
+
const { items } = await storage.listAllMemory({ prefix: OFFERING_PREFIX, limit: 5000 });
|
|
183
|
+
return items.map(r => r.value).filter(v => v && v.offeringId && v.state === 'listed');
|
|
184
|
+
}
|
|
185
|
+
/** Every offering including delisted ones — the reconcile needs to revive a listing rather than duplicate it. */
|
|
186
|
+
export async function listAllOfferings(storage) {
|
|
187
|
+
const { items } = await storage.listAllMemory({ prefix: OFFERING_PREFIX, limit: 5000 });
|
|
188
|
+
return items.map(r => r.value).filter(v => v && v.offeringId);
|
|
189
|
+
}
|
|
190
|
+
export async function deleteOffering(storage, id) {
|
|
191
|
+
const o = await getOffering(storage, id);
|
|
192
|
+
if (!o)
|
|
193
|
+
return false;
|
|
194
|
+
o.state = 'delisted';
|
|
195
|
+
o.updatedAt = new Date().toISOString();
|
|
196
|
+
await putOffering(storage, o);
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
/** Rank listed offerings that satisfy a capability. Match = exact (ext,action) when given, else a text
|
|
200
|
+
* contains over title/description/tags. Cheapest base price first (a proxy; agents refine with plans/trust). */
|
|
201
|
+
export async function matchOfferings(storage, q) {
|
|
202
|
+
const all = await listOfferings(storage);
|
|
203
|
+
const text = (q.text || '').trim().toLowerCase();
|
|
204
|
+
const hits = all.filter(o => {
|
|
205
|
+
if (q.ext && q.action)
|
|
206
|
+
return o.ext === q.ext && o.action === q.action;
|
|
207
|
+
if (!text)
|
|
208
|
+
return true;
|
|
209
|
+
return [o.title, o.description, o.ext, o.action, ...(o.tags || [])].join(' ').toLowerCase().includes(text);
|
|
210
|
+
});
|
|
211
|
+
return hits.sort((a, b) => a.basePrice - b.basePrice);
|
|
212
|
+
}
|
|
213
|
+
// ── NEED ────────────────────────────────────────────────────────────────────
|
|
214
|
+
export function newNeedId() { return `need-${randomUUID().slice(0, 12)}`; }
|
|
215
|
+
export async function putNeed(storage, n) {
|
|
216
|
+
await putPublic(storage, n.requesterGaii, NEED_PREFIX + n.needId, n, 'exchange-need');
|
|
217
|
+
return n;
|
|
218
|
+
}
|
|
219
|
+
export async function getNeed(storage, id) {
|
|
220
|
+
const { items } = await storage.listAllMemory({ prefix: NEED_PREFIX + id, limit: 2 });
|
|
221
|
+
const rec = items.find(r => r.key === NEED_PREFIX + id);
|
|
222
|
+
return rec ? rec.value : null;
|
|
223
|
+
}
|
|
224
|
+
export async function listNeeds(storage, opts) {
|
|
225
|
+
const { items } = await storage.listAllMemory({ prefix: NEED_PREFIX, limit: 5000 });
|
|
226
|
+
return items.map(r => r.value).filter(v => v && v.needId &&
|
|
227
|
+
(!opts?.openOnly || v.state === 'open') &&
|
|
228
|
+
(!opts?.owner || v.requesterOwner === opts.owner));
|
|
229
|
+
}
|
|
230
|
+
// ── BID ─────────────────────────────────────────────────────────────────────
|
|
231
|
+
export function newBidId() { return `bid-${randomUUID().slice(0, 12)}`; }
|
|
232
|
+
export async function putBid(storage, b) {
|
|
233
|
+
await putPublic(storage, b.bidderGhii, bidPrefix(b.needId) + b.bidId, b, 'exchange-bid');
|
|
234
|
+
return b;
|
|
235
|
+
}
|
|
236
|
+
export async function listBids(storage, needId) {
|
|
237
|
+
const { items } = await storage.listAllMemory({ prefix: bidPrefix(needId), limit: 2000 });
|
|
238
|
+
return items.map(r => r.value).filter(v => v && v.bidId);
|
|
239
|
+
}
|
|
240
|
+
export async function getBid(storage, needId, bidId) {
|
|
241
|
+
const rec = (await storage.listAllMemory({ prefix: bidPrefix(needId) + bidId, limit: 2 })).items.find(r => r.key === bidPrefix(needId) + bidId);
|
|
242
|
+
return rec ? rec.value : null;
|
|
243
|
+
}
|
|
244
|
+
/** Compute an offering's usage stats from the entitlements minted against its (provider, ext, action). */
|
|
245
|
+
export async function offeringStats(storage, o) {
|
|
246
|
+
const ents = (await listEntitlementsByProvider(storage, o.providerGhii)).filter(e => e.ext === o.ext && e.action === o.action);
|
|
247
|
+
const consumers = new Set(ents.map(e => e.consumerGaii));
|
|
248
|
+
let totalCalls = 0, totalSettledUnits = 0, activeContracts = 0, lastUsedAt = null;
|
|
249
|
+
for (const e of ents) {
|
|
250
|
+
totalCalls += e.budget.calls;
|
|
251
|
+
totalSettledUnits += e.budget.spentUnits;
|
|
252
|
+
if (e.state === 'active')
|
|
253
|
+
activeContracts += 1;
|
|
254
|
+
if (e.budget.calls > 0 && (!lastUsedAt || e.updatedAt > lastUsedAt))
|
|
255
|
+
lastUsedAt = e.updatedAt;
|
|
256
|
+
}
|
|
257
|
+
// Observed delivery time comes from the timing record, not from the entitlements: a contract knows what
|
|
258
|
+
// it paid, only the call itself knows how long it took.
|
|
259
|
+
const t = await readCallTiming(storage, o.providerGhii, o.ext, o.action);
|
|
260
|
+
return {
|
|
261
|
+
activeContracts, totalContracts: ents.length, totalCalls, totalSettledUnits,
|
|
262
|
+
consumers: consumers.size, listedAt: o.createdAt, lastUsedAt,
|
|
263
|
+
timing: t ? { count: t.count, p50Ms: t.p50Ms, p95Ms: t.p95Ms, maxMs: t.maxMs } : null,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/** List the consumers holding contracts against an offering (provider lineage/consumption log). */
|
|
267
|
+
export async function offeringConsumers(storage, o) {
|
|
268
|
+
const ents = (await listEntitlementsByProvider(storage, o.providerGhii)).filter(e => e.ext === o.ext && e.action === o.action);
|
|
269
|
+
return ents
|
|
270
|
+
.map(e => ({
|
|
271
|
+
consumerGaii: e.consumerGaii, appId: e.appId, contractRef: e.contractRef, unit: e.unit,
|
|
272
|
+
calls: e.budget.calls, settledUnits: e.budget.spentUnits, state: e.state, lastUsedAt: e.updatedAt,
|
|
273
|
+
}))
|
|
274
|
+
.sort((a, b) => b.calls - a.calls);
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=exchange-market.js.map
|