aimeat 2.1.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 +28 -0
- package/dist/locales/fi.json +28 -0
- 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/views/inbox.css +1 -1
- package/dist/public/css/views/profile.css +9 -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/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/views/profile/access-tab/connected-apps.js +81 -5
- package/dist/public/views/profile/extensions-tab.maturity.js +4 -1
- package/dist/public/views/profile/inbox-tab/components.js +17 -1
- package/dist/public/views/profile/inbox-tab/use-thread-ux.js +29 -2
- package/dist/public/views/profile/libraries-tab.js +10 -2
- package/dist/public/views/profile/wallet-tab.js +64 -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/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/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/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/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 +11 -3
- package/dist/src/data/app-templates/shells.d.ts.map +1 -1
- package/dist/src/data/app-templates/shells.js +87 -6
- 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/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 +478 -19
- 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/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/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/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/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.d.ts.map +1 -1
- package/dist/src/mcp/exchange.js +3 -2
- package/dist/src/mcp/exchange.js.map +1 -1
- package/dist/src/mcp/extensions.d.ts.map +1 -1
- package/dist/src/mcp/extensions.js +6 -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 +23 -4
- 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 +518 -1
- package/dist/src/models/app-tool-schemas.d.ts.map +1 -1
- package/dist/src/models/app-tool-schemas.js +53 -1
- 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 +357 -2
- 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 +6 -3
- package/dist/src/models/schemas.d.ts.map +1 -1
- package/dist/src/models/schemas.js +10 -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/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 +6 -0
- package/dist/src/routes/app-grants.d.ts.map +1 -1
- package/dist/src/routes/app-grants.js +55 -25
- 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/publish.d.ts +2 -0
- package/dist/src/routes/apps/publish.d.ts.map +1 -1
- package/dist/src/routes/apps/publish.js +17 -2
- package/dist/src/routes/apps/publish.js.map +1 -1
- 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 +6 -2
- package/dist/src/routes/exchange-market.d.ts.map +1 -1
- package/dist/src/routes/exchange-market.js +154 -28
- package/dist/src/routes/exchange-market.js.map +1 -1
- package/dist/src/routes/exchange.d.ts.map +1 -1
- package/dist/src/routes/exchange.js +5 -2
- package/dist/src/routes/exchange.js.map +1 -1
- 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.map +1 -1
- package/dist/src/routes/extensions/entitlement-gate.js +13 -0
- package/dist/src/routes/extensions/entitlement-gate.js.map +1 -1
- package/dist/src/routes/extensions/manifest.d.ts +6 -0
- package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
- package/dist/src/routes/extensions/manifest.js +68 -1
- 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 +17 -17
- package/dist/src/routes/extensions/paywall.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/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-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/upload.d.ts +11 -0
- package/dist/src/routes/upload.d.ts.map +1 -1
- package/dist/src/routes/upload.js +108 -28
- package/dist/src/routes/upload.js.map +1 -1
- package/dist/src/routes/webmcp.d.ts.map +1 -1
- package/dist/src/routes/webmcp.js +4 -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/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/build-app-prompt.d.ts +19 -0
- package/dist/src/services/build-app-prompt.d.ts.map +1 -1
- package/dist/src/services/build-app-prompt.js +97 -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/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/exchange-market.d.ts +41 -8
- package/dist/src/services/exchange-market.d.ts.map +1 -1
- package/dist/src/services/exchange-market.js +24 -2
- package/dist/src/services/exchange-market.js.map +1 -1
- 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.map +1 -1
- package/dist/src/services/exchange-proposals.js +2 -0
- package/dist/src/services/exchange-proposals.js.map +1 -1
- 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/metered-entitlements.d.ts +7 -0
- package/dist/src/services/metered-entitlements.d.ts.map +1 -1
- package/dist/src/services/metered-entitlements.js +4 -0
- package/dist/src/services/metered-entitlements.js.map +1 -1
- package/dist/src/services/owner-memory.d.ts +14 -1
- package/dist/src/services/owner-memory.d.ts.map +1 -1
- package/dist/src/services/owner-memory.js +8 -14
- package/dist/src/services/owner-memory.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/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/0012_unique_live_app_grant.sql +29 -0
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts +3 -0
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/apps.js +7 -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/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 +20 -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/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/organisms-federation.d.ts +29 -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/static/app-catalog/_template.html +6 -5
- package/dist/static/app-catalog/js/cortex.js +3 -1
- package/dist/static/app-catalog/js/detail.js +411 -36
- package/dist/static/app-catalog/js/i18n-data.js +279 -3
- package/dist/static/app-catalog/js/main.js +28 -37
- package/dist/static/app-catalog/js/monetize.js +204 -16
- package/dist/static/app-catalog/js/odps.js +489 -0
- package/dist/static/app-catalog/js/render.js +3 -0
- package/dist/static/app-catalog/js/workcopy.js +198 -0
- package/dist/static/app-catalog/styles/app-catalog.css +60 -0
- package/dist/static/app-catalog.html +1450 -137
- package/dist/static/sdk-libs/agents/index.js +45 -7
- package/dist/static/sdk-libs/auth/cluster.js +97 -0
- package/dist/static/sdk-libs/auth/index.js +25 -1
- package/dist/static/sdk-libs/auth/locale.js +151 -0
- package/dist/static/sdk-libs/auth/modal.js +11 -2
- package/dist/static/sdk-libs/auth/palette.js +172 -0
- package/dist/static/sdk-libs/auth/pill.js +37 -6
- package/dist/static/sdk-libs/auth/theme.js +61 -20
- package/dist/static/sdk-libs/data/index.js +70 -8
- package/dist/static/sdk-libs/dist/aimeat-agents.js +41 -8
- package/dist/static/sdk-libs/dist/aimeat-auth.js +422 -21
- package/dist/static/sdk-libs/dist/aimeat-data.js +50 -8
- package/dist/static/sdk-libs/dist/aimeat-live.js +54 -2
- package/dist/static/sdk-libs/dist/aimeat-markdown.js +32 -1
- package/dist/static/sdk-libs/live/index.js +71 -4
- package/dist/static/sdk-libs/markdown/index.js +49 -1
- package/package.json +6 -2
|
@@ -10,6 +10,15 @@
|
|
|
10
10
|
* this module re-renders #detail-monetize in place after loads/saves.
|
|
11
11
|
* @usage import { monetizeSectionInner, monetizeOnOpen, monetizeAddTool, ... } from './monetize.js'
|
|
12
12
|
* @version-history
|
|
13
|
+
* v1.3.0 — 2026-07-25 — ODPS: the app-level EXCHANGE status + ODPS defaults section, the per-tool ODPS
|
|
14
|
+
* descriptor block (with an AI draft and a link to the live odps.yaml), and the blocked-listing reason
|
|
15
|
+
* on a tool row. Also fixes a data loss of the same family as v1.1.0: a tool save rebuilt the manifest
|
|
16
|
+
* root from three fields and dropped the app-level `odps`/`provenance` defaults.
|
|
17
|
+
* v1.2.0 — 2026-07-25 — TARGET-050: the manifest is the SOURCE OF TRUTH for the EXCHANGE listing —
|
|
18
|
+
* a "List in EXCHANGE" toggle and a second money price (EUR *and* USD) live here, and the node
|
|
19
|
+
* projects the marketplace listing from this record on every write. No second listing step.
|
|
20
|
+
* v1.1.0 — 2026-07-25 — TARGET-050 slice 0: readEditor merges over the edited tool instead of rebuilding
|
|
21
|
+
* it, so inputSchema/outputSchema/plans survive a price edit (they were silently dropped on every save).
|
|
13
22
|
* v1.0.0 — 2026-07-14 — Initial Monetize tool editor (TARGET-034 phase B)
|
|
14
23
|
*/
|
|
15
24
|
import { escapeHtml } from './util.js';
|
|
@@ -17,11 +26,17 @@ import { dtlBtn, showConfirm, showNotice } from './ui.js';
|
|
|
17
26
|
import { loadConfig } from './config.js';
|
|
18
27
|
import { t } from './i18n.js';
|
|
19
28
|
import { getCortexOwnerToken } from './cortex.js';
|
|
29
|
+
import {
|
|
30
|
+
odpsStatusInner, odpsToolFieldsHtml, readOdpsToolFields, readOdpsAppDefaults,
|
|
31
|
+
odpsToggleDefaults, odpsToggleTool, odpsSuggestForTool, odpsBlockedReason,
|
|
32
|
+
odpsGenerateSample, odpsUseMeasured,
|
|
33
|
+
} from './odps.js';
|
|
20
34
|
|
|
21
35
|
// Tool names become sku segments (app-tool:<owner>/<appId>:<name>) — same rule the node schema
|
|
22
36
|
// (src/models/app-tool-schemas.ts) enforces at resolve time.
|
|
23
37
|
var NAME_RE = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
24
38
|
var MONEY_UNIT = 1000000; // 6-decimal micro-units, the node-wide money convention
|
|
39
|
+
var CURRENCIES = ['EUR', 'USD']; // mirrors MONEY_CURRENCIES in src/commerce/money.ts
|
|
25
40
|
|
|
26
41
|
var mzOwner = ''; // app owner (bare name) — the signed-in user for own apps
|
|
27
42
|
var mzAppId = ''; // published filename = the appId of the manifest key
|
|
@@ -29,6 +44,11 @@ var mzDoc = null; // { version?, updatedAt?, tools: [] } or null while lo
|
|
|
29
44
|
var mzState = 'off'; // 'off' | 'loading' | 'ready' | 'error'
|
|
30
45
|
var mzEditing = -1; // -1 closed · -2 new tool · >=0 editing tools[i]
|
|
31
46
|
var mzBusy = false; // guards Save/Delete while a write is in flight
|
|
47
|
+
var mzOfferings = {}; // tool name → offeringId, so a listed tool can link to its live odps.yaml
|
|
48
|
+
var mzTiming = {}; // tool name → observed delivery time, so a commitment can be proposed from data
|
|
49
|
+
var mzNodeId = ''; // captured from an API envelope: every response carries the node it came from
|
|
50
|
+
/** The public file URL form is /v1/pub/{GHII}/{key}, so the sample generator needs the full identity. */
|
|
51
|
+
function mzOwnerGhiiOf() { return (mzOwner && mzNodeId) ? (mzOwner + '@' + mzNodeId) : ''; }
|
|
32
52
|
|
|
33
53
|
function apiBase() {
|
|
34
54
|
var cfg = loadConfig();
|
|
@@ -40,6 +60,8 @@ function toolsKey() { return 'apps.' + mzAppId + '.tools'; }
|
|
|
40
60
|
function rerender() {
|
|
41
61
|
var el = document.getElementById('detail-monetize');
|
|
42
62
|
if (el) el.innerHTML = monetizeSectionInner();
|
|
63
|
+
var od = document.getElementById('detail-odps');
|
|
64
|
+
if (od) od.innerHTML = odpsStatusInner(mzDoc, mzState);
|
|
43
65
|
}
|
|
44
66
|
|
|
45
67
|
/** Reset + async-load the manifest when a detail view opens. No-op for non-own apps. */
|
|
@@ -57,6 +79,7 @@ export function monetizeOnOpen(owner, appId, isOwn) {
|
|
|
57
79
|
mzDoc = (value && Array.isArray(value.tools)) ? value : { tools: [] };
|
|
58
80
|
mzState = 'ready';
|
|
59
81
|
rerender();
|
|
82
|
+
loadOfferings();
|
|
60
83
|
})
|
|
61
84
|
.catch(function () {
|
|
62
85
|
// A missing record is a normal "no tools yet" state; only a hard fetch error lands here.
|
|
@@ -66,11 +89,42 @@ export function monetizeOnOpen(owner, appId, isOwn) {
|
|
|
66
89
|
});
|
|
67
90
|
}
|
|
68
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Map this app's tools to their live EXCHANGE listings, so a listed tool can link straight to its ODPS
|
|
94
|
+
* document. Best effort: the market is public, and a missing listing simply means no link.
|
|
95
|
+
*/
|
|
96
|
+
function loadOfferings() {
|
|
97
|
+
var ext = 'apptool:' + mzOwner + '/' + mzAppId;
|
|
98
|
+
fetch(apiBase() + '/v1/exchange/offerings?stats=1&q=' + encodeURIComponent(mzAppId))
|
|
99
|
+
.then(function (r) { return r.json(); })
|
|
100
|
+
.then(function (res) {
|
|
101
|
+
if (res && res.node) mzNodeId = res.node;
|
|
102
|
+
var list = (res && res.ok && res.data && res.data.offerings) || [];
|
|
103
|
+
var next = {};
|
|
104
|
+
var timing = {};
|
|
105
|
+
for (var i = 0; i < list.length; i++) {
|
|
106
|
+
if (list[i].ext === ext && list[i].state === 'listed') {
|
|
107
|
+
next[list[i].action] = list[i].offeringId;
|
|
108
|
+
if (list[i].stats && list[i].stats.timing) timing[list[i].action] = list[i].stats.timing;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
mzOfferings = next;
|
|
112
|
+
mzTiming = timing;
|
|
113
|
+
rerender();
|
|
114
|
+
})
|
|
115
|
+
.catch(function () { /* no market link is a cosmetic loss, never an error */ });
|
|
116
|
+
}
|
|
117
|
+
|
|
69
118
|
function priceLabel(tool) {
|
|
70
119
|
var parts = [];
|
|
120
|
+
var seen = {};
|
|
71
121
|
if (tool.price && tool.price.morsels > 0) parts.push(tool.price.morsels + ' morsels');
|
|
72
|
-
|
|
73
|
-
|
|
122
|
+
var money = [tool.priceMoney].concat(tool.pricesMoney || []);
|
|
123
|
+
for (var i = 0; i < money.length; i++) {
|
|
124
|
+
var m = money[i];
|
|
125
|
+
if (!m || !(m.amount > 0) || seen[m.currency]) continue;
|
|
126
|
+
seen[m.currency] = true;
|
|
127
|
+
parts.push((m.amount / MONEY_UNIT) + ' ' + m.currency);
|
|
74
128
|
}
|
|
75
129
|
return parts.length ? parts.join(' · ') : t('monetize.notForSale');
|
|
76
130
|
}
|
|
@@ -85,18 +139,35 @@ function toolRow(tool, i) {
|
|
|
85
139
|
'<span class="dtl-stat-val">' + escapeHtml(tool.name) + '</span>' +
|
|
86
140
|
(tool.description ? '<span class="dtl-stat-label">' + escapeHtml(tool.description) + '</span>' : '') +
|
|
87
141
|
'</div>' +
|
|
88
|
-
'<div class="dtl-stat"><span class="dtl-stat-label">' + t('monetize.priceCol') + '</span><span class="dtl-stat-val">' + escapeHtml(priceLabel(tool)) +
|
|
142
|
+
'<div class="dtl-stat"><span class="dtl-stat-label">' + t('monetize.priceCol') + '</span><span class="dtl-stat-val">' + escapeHtml(priceLabel(tool)) +
|
|
143
|
+
(tool.exchange ? ' <span class="dtl-sync ok" style="display:inline">' + t('monetize.exchangeOn') + '</span>' : '') + '</span></div>' +
|
|
89
144
|
'<div class="dtl-stat"><span class="dtl-stat-label">' + mode + '</span><span class="dtl-stat-val" style="font-size:.8rem">' + binding + '</span></div>' +
|
|
90
145
|
'<div class="dtl-btn-row" style="margin:0">' +
|
|
91
146
|
dtlBtn(t('detail.editDetails'), 'window._launcher.monetizeEditTool(' + i + ')') +
|
|
92
147
|
dtlBtn('✕', 'window._launcher.monetizeDeleteTool(' + i + ')', { variant: 'danger', title: t('monetize.deleteHint') }) +
|
|
93
148
|
'</div>' +
|
|
149
|
+
// A tool flagged for EXCHANGE that the projection will skip: say so here instead of leaving the
|
|
150
|
+
// owner with a ticked box and an empty marketplace.
|
|
151
|
+
(odpsBlockedReason(tool) ? '<div class="od-blocked">⚠ ' + escapeHtml(odpsBlockedReason(tool)) + '</div>' : '') +
|
|
94
152
|
'</div>';
|
|
95
153
|
}
|
|
96
154
|
|
|
155
|
+
/** A currency picker over the node's supported money currencies. */
|
|
156
|
+
function currencySelect(id, selected) {
|
|
157
|
+
var html = '<select id="' + id + '" class="modal-input" style="margin:4px 0 8px">';
|
|
158
|
+
for (var i = 0; i < CURRENCIES.length; i++) {
|
|
159
|
+
html += '<option value="' + CURRENCIES[i] + '"' + (selected === CURRENCIES[i] ? ' selected' : '') + '>' + CURRENCIES[i] + '</option>';
|
|
160
|
+
}
|
|
161
|
+
return html + '</select>';
|
|
162
|
+
}
|
|
163
|
+
|
|
97
164
|
function editorHtml(tool) {
|
|
98
165
|
var moneyMajor = (tool.priceMoney && tool.priceMoney.amount > 0) ? String(tool.priceMoney.amount / MONEY_UNIT) : '';
|
|
99
166
|
var cur = (tool.priceMoney && tool.priceMoney.currency) || 'EUR';
|
|
167
|
+
// The second money price is any declared currency that is not the primary one.
|
|
168
|
+
var second = (tool.pricesMoney || []).filter(function (p) { return p && p.currency !== cur && p.amount > 0; })[0];
|
|
169
|
+
var money2Major = second ? String(second.amount / MONEY_UNIT) : '';
|
|
170
|
+
var cur2 = (second && second.currency) || (cur === 'EUR' ? 'USD' : 'EUR');
|
|
100
171
|
return '<div class="dtl-ac-editor" style="margin-top:10px">' +
|
|
101
172
|
'<label class="dtl-stat-label" for="mz-name">' + t('monetize.name') + '</label>' +
|
|
102
173
|
'<input id="mz-name" class="modal-input" maxlength="80" value="' + escapeHtml(tool.name || '') + '" placeholder="summarize" style="margin:4px 0 8px" />' +
|
|
@@ -113,12 +184,35 @@ function editorHtml(tool) {
|
|
|
113
184
|
'</div>' +
|
|
114
185
|
'<div style="min-width:90px">' +
|
|
115
186
|
'<label class="dtl-stat-label" for="mz-currency">' + t('monetize.currency') + '</label>' +
|
|
116
|
-
'
|
|
117
|
-
'<option value="EUR"' + (cur === 'EUR' ? ' selected' : '') + '>EUR</option>' +
|
|
118
|
-
'<option value="USD"' + (cur === 'USD' ? ' selected' : '') + '>USD</option>' +
|
|
119
|
-
'</select>' +
|
|
187
|
+
currencySelect('mz-currency', cur) +
|
|
120
188
|
'</div>' +
|
|
121
189
|
'</div>' +
|
|
190
|
+
'<div style="display:flex;gap:10px;flex-wrap:wrap">' +
|
|
191
|
+
'<div style="flex:1;min-width:130px">' +
|
|
192
|
+
'<label class="dtl-stat-label" for="mz-money2">' + t('monetize.money2') + '</label>' +
|
|
193
|
+
'<input id="mz-money2" class="modal-input" inputmode="decimal" value="' + escapeHtml(money2Major) + '" placeholder="0.002" style="margin:4px 0 4px" />' +
|
|
194
|
+
'</div>' +
|
|
195
|
+
'<div style="min-width:90px">' +
|
|
196
|
+
'<label class="dtl-stat-label" for="mz-currency2">' + t('monetize.currency2') + '</label>' +
|
|
197
|
+
currencySelect('mz-currency2', cur2) +
|
|
198
|
+
'</div>' +
|
|
199
|
+
'</div>' +
|
|
200
|
+
'<div class="dtl-sync none" style="margin:0 0 8px">' + t('monetize.money2Hint') + '</div>' +
|
|
201
|
+
'<label class="dtl-stat-label" style="display:flex;align-items:center;gap:8px;cursor:pointer">' +
|
|
202
|
+
'<input id="mz-exchange" type="checkbox"' + (tool.exchange ? ' checked' : '') + ' />' +
|
|
203
|
+
t('monetize.exchange') +
|
|
204
|
+
'</label>' +
|
|
205
|
+
'<div class="dtl-sync none" style="margin:4px 0 8px">' + t('monetize.exchangeHint') + '</div>' +
|
|
206
|
+
// Pacing, not price: this is what a call BURNS to bound how fast the tool can be consumed. It is
|
|
207
|
+
// separate from every price above precisely because it is not revenue — nobody is credited it.
|
|
208
|
+
'<label class="dtl-stat-label" for="mz-toll">' + t('monetize.toll') + '</label>' +
|
|
209
|
+
'<input id="mz-toll" class="modal-input" type="number" min="0" max="100" step="1" value="'
|
|
210
|
+
+ (typeof tool.tollMorsels === 'number' ? tool.tollMorsels : '') + '" placeholder="0" style="margin:4px 0 4px" />' +
|
|
211
|
+
'<div class="dtl-sync none" style="margin:0 0 8px">' + t('monetize.tollHint') + '</div>' +
|
|
212
|
+
odpsToolFieldsHtml(tool, mzOfferings[tool.name || ''] || '', {
|
|
213
|
+
appId: mzAppId, ownerGhii: mzOwnerGhiiOf(), toolName: tool.name || '', actionId: tool.action_id || '',
|
|
214
|
+
appProvenance: (mzDoc && mzDoc.provenance) || null, timing: mzTiming[tool.name || ''] || null,
|
|
215
|
+
}) +
|
|
122
216
|
'<label class="dtl-stat-label" for="mz-action">' + t('monetize.actionId') + '</label>' +
|
|
123
217
|
'<input id="mz-action" class="modal-input" maxlength="200" value="' + escapeHtml(tool.action_id || '') + '" placeholder="ext:my-extension:summarize" style="margin:4px 0 4px" />' +
|
|
124
218
|
'<div class="dtl-sync none" style="margin:0 0 8px">' + t('monetize.actionIdHint') + '</div>' +
|
|
@@ -159,29 +253,121 @@ export function monetizeSectionInner() {
|
|
|
159
253
|
return html;
|
|
160
254
|
}
|
|
161
255
|
|
|
256
|
+
/** Inner HTML of the app-level EXCHANGE & ODPS section — detail.js wraps it in #detail-odps. */
|
|
257
|
+
export function odpsSectionInner() { return odpsStatusInner(mzDoc, mzState); }
|
|
258
|
+
|
|
259
|
+
export function odpsToggleDefaultsUi() { odpsToggleDefaults(rerender); }
|
|
260
|
+
export function odpsToggleToolUi() { odpsToggleTool(rerender); }
|
|
261
|
+
|
|
262
|
+
/** Draft the tool's descriptive ODPS fields with the owner's own AI key (attestations stay untouched). */
|
|
263
|
+
/** Run the capability once and store the answer as the public sample this listing points at. */
|
|
264
|
+
export function odpsGenerateSampleUi() {
|
|
265
|
+
var tool = (mzEditing >= 0 && mzDoc && mzDoc.tools[mzEditing]) ? mzDoc.tools[mzEditing] : {};
|
|
266
|
+
odpsGenerateSample({
|
|
267
|
+
appId: mzAppId, ownerGhii: mzOwnerGhiiOf(), toolName: (document.getElementById('mz-name') || {}).value || tool.name || '',
|
|
268
|
+
actionId: (document.getElementById('mz-action') || {}).value || tool.action_id || '',
|
|
269
|
+
}, rerender);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function odpsUseMeasuredUi(ms) { odpsUseMeasured(ms); }
|
|
273
|
+
|
|
274
|
+
export function odpsSuggestUi() {
|
|
275
|
+
var tool = (mzEditing >= 0 && mzDoc && mzDoc.tools[mzEditing]) ? mzDoc.tools[mzEditing] : {};
|
|
276
|
+
odpsSuggestForTool({
|
|
277
|
+
appId: mzAppId,
|
|
278
|
+
appName: mzAppId,
|
|
279
|
+
toolName: (document.getElementById('mz-name') || {}).value || tool.name || '',
|
|
280
|
+
toolDescription: (document.getElementById('mz-desc') || {}).value || tool.description || '',
|
|
281
|
+
inputSchema: tool.inputSchema,
|
|
282
|
+
outputSchema: tool.outputSchema,
|
|
283
|
+
price: priceLabel(tool),
|
|
284
|
+
}, rerender);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Save the app-level ODPS defaults onto the manifest root (they inherit into every tool). */
|
|
288
|
+
export function odpsSaveDefaults() {
|
|
289
|
+
if (mzBusy || !mzDoc) return;
|
|
290
|
+
var vals = readOdpsAppDefaults();
|
|
291
|
+
var next = Object.assign({}, mzDoc, { tools: mzDoc.tools.slice() });
|
|
292
|
+
if (vals.odps) next.odps = vals.odps; else delete next.odps;
|
|
293
|
+
if (vals.provenance) next.provenance = vals.provenance; else delete next.provenance;
|
|
294
|
+
mzBusy = true;
|
|
295
|
+
var el = document.getElementById('od-status');
|
|
296
|
+
if (el) el.textContent = '…';
|
|
297
|
+
writeManifest(next)
|
|
298
|
+
.then(function () {
|
|
299
|
+
mzDoc = next; mzBusy = false;
|
|
300
|
+
rerender();
|
|
301
|
+
showNotice(t('odps.defaultsSaved'), 'success');
|
|
302
|
+
})
|
|
303
|
+
.catch(function (e) {
|
|
304
|
+
mzBusy = false;
|
|
305
|
+
var st = document.getElementById('od-status');
|
|
306
|
+
if (st) st.textContent = t('monetize.saveFailed') + ': ' + e.message;
|
|
307
|
+
showNotice(t('monetize.saveFailed') + ': ' + e.message, 'error');
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
162
311
|
export function monetizeAddTool() { mzEditing = -2; rerender(); }
|
|
163
312
|
export function monetizeEditTool(i) { mzEditing = i; rerender(); }
|
|
164
313
|
export function monetizeCancelEdit() { mzEditing = -1; rerender(); }
|
|
165
314
|
|
|
166
|
-
/**
|
|
167
|
-
|
|
315
|
+
/**
|
|
316
|
+
* Read the editor fields into a manifest tool entry, MERGED OVER the tool being edited so that fields
|
|
317
|
+
* this editor does not surface survive the save — `inputSchema`/`outputSchema` (mandatory for an EXCHANGE
|
|
318
|
+
* listing), `plans`, `exchange`, and anything added later. Building the entry from scratch silently
|
|
319
|
+
* destroyed those on every price edit (TARGET-050 slice 0). Clearing a field the editor DOES own removes
|
|
320
|
+
* it, so "delete the money price" still works. Returns null (+ notice) when invalid.
|
|
321
|
+
*/
|
|
322
|
+
function readEditor(base) {
|
|
168
323
|
var name = (document.getElementById('mz-name').value || '').trim();
|
|
169
324
|
if (!NAME_RE.test(name)) { showNotice(t('monetize.nameInvalid'), 'error'); return null; }
|
|
170
|
-
var tool = {
|
|
325
|
+
var tool = Object.assign({}, base || {});
|
|
326
|
+
tool.name = name;
|
|
171
327
|
var desc = (document.getElementById('mz-desc').value || '').trim();
|
|
172
|
-
if (desc) tool.description = desc;
|
|
328
|
+
if (desc) tool.description = desc; else delete tool.description;
|
|
173
329
|
var morsels = parseInt(document.getElementById('mz-morsels').value, 10);
|
|
174
330
|
if (Number.isFinite(morsels) && morsels > 0) tool.price = { morsels: morsels, unit: 'per-call' };
|
|
331
|
+
else delete tool.price;
|
|
175
332
|
var moneyRaw = (document.getElementById('mz-money').value || '').trim();
|
|
176
333
|
if (moneyRaw) {
|
|
177
334
|
var major = parseFloat(moneyRaw.replace(',', '.'));
|
|
178
335
|
if (!Number.isFinite(major) || major <= 0) { showNotice(t('monetize.moneyInvalid'), 'error'); return null; }
|
|
179
336
|
tool.priceMoney = { amount: Math.round(major * MONEY_UNIT), currency: document.getElementById('mz-currency').value };
|
|
337
|
+
} else delete tool.priceMoney;
|
|
338
|
+
// Second money price (TARGET-050): the same call sold in another currency. `pricesMoney` carries the
|
|
339
|
+
// full set the EXCHANGE projection lists from; `priceMoney` stays the primary for every other reader.
|
|
340
|
+
var money2Raw = (document.getElementById('mz-money2').value || '').trim();
|
|
341
|
+
var cur2 = document.getElementById('mz-currency2').value;
|
|
342
|
+
var money2 = null;
|
|
343
|
+
if (money2Raw) {
|
|
344
|
+
var major2 = parseFloat(money2Raw.replace(',', '.'));
|
|
345
|
+
if (!Number.isFinite(major2) || major2 <= 0) { showNotice(t('monetize.moneyInvalid'), 'error'); return null; }
|
|
346
|
+
money2 = { amount: Math.round(major2 * MONEY_UNIT), currency: cur2 };
|
|
347
|
+
}
|
|
348
|
+
var moneySet = [];
|
|
349
|
+
if (tool.priceMoney) moneySet.push(tool.priceMoney);
|
|
350
|
+
if (money2 && (!tool.priceMoney || tool.priceMoney.currency !== money2.currency)) moneySet.push(money2);
|
|
351
|
+
if (moneySet.length > 1) tool.pricesMoney = moneySet; else delete tool.pricesMoney;
|
|
352
|
+
// The EXCHANGE listing exists because this flag says so; turning it off removes the listing (never a contract).
|
|
353
|
+
var ex = document.getElementById('mz-exchange');
|
|
354
|
+
if (ex && ex.checked) tool.exchange = true; else delete tool.exchange;
|
|
355
|
+
// An empty box means "whatever the node decides", which is not the same as an explicit 0 ("never pace
|
|
356
|
+
// this one") — so the field is deleted when blank rather than written as zero.
|
|
357
|
+
var tollRaw = (document.getElementById('mz-toll').value || '').trim();
|
|
358
|
+
if (tollRaw === '') delete tool.tollMorsels;
|
|
359
|
+
else {
|
|
360
|
+
var toll = parseInt(tollRaw, 10);
|
|
361
|
+
if (!Number.isFinite(toll) || toll < 0 || toll > 100) { showNotice(t('monetize.tollInvalid'), 'error'); return null; }
|
|
362
|
+
tool.tollMorsels = toll;
|
|
180
363
|
}
|
|
181
364
|
var actionId = (document.getElementById('mz-action').value || '').trim();
|
|
182
|
-
if (actionId) tool.action_id = actionId;
|
|
365
|
+
if (actionId) tool.action_id = actionId; else delete tool.action_id;
|
|
183
366
|
var agent = (document.getElementById('mz-agent').value || '').trim();
|
|
184
|
-
if (agent) tool.agent = agent;
|
|
367
|
+
if (agent) tool.agent = agent; else delete tool.agent;
|
|
368
|
+
var od = readOdpsToolFields(base);
|
|
369
|
+
if (od.odps) tool.odps = od.odps; else delete tool.odps;
|
|
370
|
+
if (od.provenance) tool.provenance = od.provenance; else delete tool.provenance;
|
|
185
371
|
return tool;
|
|
186
372
|
}
|
|
187
373
|
|
|
@@ -203,7 +389,7 @@ function writeManifest(doc) {
|
|
|
203
389
|
|
|
204
390
|
export function monetizeSaveTool() {
|
|
205
391
|
if (mzBusy || !mzDoc) return;
|
|
206
|
-
var tool = readEditor();
|
|
392
|
+
var tool = readEditor(mzEditing >= 0 ? mzDoc.tools[mzEditing] : null);
|
|
207
393
|
if (!tool) return;
|
|
208
394
|
var tools = mzDoc.tools.slice();
|
|
209
395
|
var dup = tools.findIndex(function (x, i) { return x.name === tool.name && i !== mzEditing; });
|
|
@@ -212,7 +398,9 @@ export function monetizeSaveTool() {
|
|
|
212
398
|
mzBusy = true;
|
|
213
399
|
var el = document.getElementById('mz-status');
|
|
214
400
|
if (el) el.textContent = '…';
|
|
215
|
-
|
|
401
|
+
// Object.assign over the loaded doc: the manifest root also carries the app-level `odps`/`provenance`
|
|
402
|
+
// defaults, and rebuilding it from three fields would drop them on every tool save.
|
|
403
|
+
var next = Object.assign({}, mzDoc, { tools: tools });
|
|
216
404
|
writeManifest(next)
|
|
217
405
|
.then(function () {
|
|
218
406
|
mzDoc = next; mzEditing = -1; mzBusy = false;
|
|
@@ -233,7 +421,7 @@ export async function monetizeDeleteTool(i) {
|
|
|
233
421
|
var tools = mzDoc.tools.slice();
|
|
234
422
|
tools.splice(i, 1);
|
|
235
423
|
mzBusy = true;
|
|
236
|
-
var next = {
|
|
424
|
+
var next = Object.assign({}, mzDoc, { tools: tools });
|
|
237
425
|
writeManifest(next)
|
|
238
426
|
.then(function () {
|
|
239
427
|
mzDoc = next; mzEditing = -1; mzBusy = false;
|