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
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* injected once via initDetail(deps) — so there is no import cycle back through the entry module.
|
|
9
9
|
* @usage import { initDetail, openDetailView, mountLoginPill, ... } from './detail.js'; initDetail({...})
|
|
10
10
|
* @version-history
|
|
11
|
+
* v1.5.0 — 2026-07-25 — TARGET-048 edit-model clarity: the STATUS card becomes a WORKING COPY →
|
|
12
|
+
* PUBLISHED lifecycle band, saving persists (server draft slot) instead of only touching a
|
|
13
|
+
* transient blob, every save leaves a restorable checkpoint ("Working-copy history"), and the
|
|
14
|
+
* three meanings of "draft" are split into working copy / try-it / published version.
|
|
11
15
|
* v1.4.0 — 2026-07-20 — Server-only cutover: drop the local-only favourite star; the detail view
|
|
12
16
|
* always operates on a server app (materialized in memory on demand for editing).
|
|
13
17
|
* v1.3.0 — 2026-07-16 — Add openStagingPreview(owner, filename): mint a preview token for an
|
|
@@ -27,9 +31,10 @@ import { dtlBtn, showConfirm, showNotice } from './ui.js';
|
|
|
27
31
|
import { loadConfig } from './config.js';
|
|
28
32
|
import { t, getLang } from './i18n.js';
|
|
29
33
|
import { getPromotion, setPromotion, loadPromoted } from './promote.js';
|
|
30
|
-
import { monetizeSectionInner, monetizeOnOpen } from './monetize.js';
|
|
34
|
+
import { monetizeSectionInner, monetizeOnOpen, odpsSectionInner } from './monetize.js';
|
|
31
35
|
import { costSectionInner, costOnOpen } from './cost.js';
|
|
32
36
|
import { appManifestAgents } from './app-agents.js';
|
|
37
|
+
import { saveWorkingCopy, loadCheckpoints, getCheckpoints, readCheckpoint, deleteCheckpoint, discardWorkingCopy, getDraft } from './workcopy.js';
|
|
33
38
|
|
|
34
39
|
// Injected once at bootstrap by main.js. Functions are main-local; the get* return main's LIVE
|
|
35
40
|
// state (so reads + in-place mutations propagate across the reassignments main does each render).
|
|
@@ -56,6 +61,19 @@ var detailSkillPickerOpen = false; // true while the "attach a skill" picker i
|
|
|
56
61
|
var detailMySkills = null; // cached list of the user's own UNBOUND skills (attach options)
|
|
57
62
|
var detailBoundSkills = []; // refs of the skills currently bound to this app (filters the options)
|
|
58
63
|
var detailSkillBusy = false; // guards the Attach button while a bind/unbind republish is in flight
|
|
64
|
+
// ── Working copy (TARGET-048) ──
|
|
65
|
+
// The working copy is the app's SERVER DRAFT SLOT, not a browser blob: saving persists it, so it
|
|
66
|
+
// survives a reload and can be tested on a real origin before it ever becomes a published version.
|
|
67
|
+
var detailWorkSavedAt = null; // ISO time this session last persisted the working copy (null = not yet here)
|
|
68
|
+
var detailHasWorkCopy = false; // a saved (unpublished) working copy exists on the server for this app
|
|
69
|
+
var detailCheckpointsHtml = null; // cached rendered checkpoint list, survives re-renders
|
|
70
|
+
var detailCheckpointBusy = false; // guards restore/delete while a memory round-trip is in flight
|
|
71
|
+
var detailLastChangeNote = ''; // the change request behind the pending AI proposal — labels the checkpoint it replaces
|
|
72
|
+
// Bumped whenever the working-copy state changes underneath in-flight async loads (open a different
|
|
73
|
+
// app, publish, discard). A late-resolving loader compares the epoch it captured and bails instead
|
|
74
|
+
// of writing stale state back — otherwise a draft fetch started before a publish lands after it and
|
|
75
|
+
// resurrects "working copy saved" for an app that no longer has one.
|
|
76
|
+
var detailEpoch = 0;
|
|
59
77
|
|
|
60
78
|
function detailGetApp() {
|
|
61
79
|
for (var i = 0; i < getMainApps().length; i++) {
|
|
@@ -164,8 +182,15 @@ function openDetailView(appId) {
|
|
|
164
182
|
detailSkillPickerOpen = false;
|
|
165
183
|
detailMySkills = null;
|
|
166
184
|
detailBoundSkills = [];
|
|
185
|
+
detailWorkSavedAt = null;
|
|
186
|
+
detailCheckpointsHtml = null;
|
|
187
|
+
detailCheckpointBusy = false;
|
|
188
|
+
detailEpoch++;
|
|
167
189
|
var app = detailGetApp();
|
|
168
190
|
if (!app) return;
|
|
191
|
+
// A working copy saved in an EARLIER session shows up in the server listing as has_draft.
|
|
192
|
+
var wcState = (app.publishedFilename && getServerState()[app.publishedFilename]) || null;
|
|
193
|
+
detailHasWorkCopy = !!(wcState && wcState.hasDraft);
|
|
169
194
|
// Monetize (TARGET-034): reset + async-load the apps.{appId}.tools manifest for OWN published
|
|
170
195
|
// apps before the first render so the section shell picks up the loading state.
|
|
171
196
|
monetizeOnOpen(detailServerOwner(app), app.publishedFilename || '', detailIsOwnPublished(app));
|
|
@@ -179,6 +204,11 @@ function openDetailView(appId) {
|
|
|
179
204
|
if (app.published && app.publishedFilename && owner) {
|
|
180
205
|
detailLoadVersions(owner, app.publishedFilename);
|
|
181
206
|
detailLoadSkills(detailServerOwner(app) || owner, app.publishedFilename);
|
|
207
|
+
detailLoadCheckpoints(detailServerOwner(app) || owner, app.publishedFilename);
|
|
208
|
+
// A working copy saved earlier lives on the server, but the in-memory blob was materialized
|
|
209
|
+
// from the PUBLISHED bytes. Pull the real working copy in, so the source editor and the AI
|
|
210
|
+
// loop operate on YOUR work — not on the live app wearing its name.
|
|
211
|
+
if (detailHasWorkCopy) detailLoadWorkingCopy(app, detailServerOwner(app) || owner);
|
|
182
212
|
}
|
|
183
213
|
// Opened via a pencil ("edit the name") → jump straight into the About editor.
|
|
184
214
|
if (detailEditAboutOnOpen) {
|
|
@@ -297,13 +327,30 @@ function renderDetailView() {
|
|
|
297
327
|
'<span style="font-size:1.3rem">' + escapeHtml(icon) + '</span> ' + escapeHtml(app.name || 'App') +
|
|
298
328
|
((canEditAbout && !detailEditingAbout) ? ' <button class="rename-pencil" style="font-size:1rem" title="' + escapeHtml(t('detail.editDetails')) + '" onclick="window._launcher.detailAboutEdit()">✏️</button>' : '');
|
|
299
329
|
|
|
300
|
-
// ──
|
|
330
|
+
// ── LIFECYCLE (TARGET-048) ──
|
|
331
|
+
// Replaces the old two-number STATUS card. One band answers the question the old card never did:
|
|
332
|
+
// WHERE is my work right now — in an unsaved proposal, in a saved (private) working copy, or
|
|
333
|
+
// published for everyone? Each stop says what it means in plain words; one sentence says what to
|
|
334
|
+
// do next. "Draft" is deliberately absent: it used to mean three different things here.
|
|
301
335
|
var localBytes = app.blob ? Math.round(app.blob.length * 0.75) : 0; // base64 → bytes approx
|
|
302
|
-
var publishedV = app.publishedVersionNumber ? ('v' + app.publishedVersionNumber) :
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
336
|
+
var publishedV = app.publishedVersionNumber ? ('v' + app.publishedVersionNumber) : '';
|
|
337
|
+
// Three mutually exclusive working-copy states, in the order the user moves through them.
|
|
338
|
+
var wcState = detailDraftBlob ? 'pending' : (detailHasWorkCopy ? 'saved' : 'clean');
|
|
339
|
+
var wcValue, wcExplain;
|
|
340
|
+
if (wcState === 'pending') {
|
|
341
|
+
wcValue = t('wc.pending');
|
|
342
|
+
wcExplain = t('wc.explainPending');
|
|
343
|
+
} else if (wcState === 'saved') {
|
|
344
|
+
wcValue = detailWorkSavedAt
|
|
345
|
+
? t('wc.savedAt').replace('{t}', new Date(detailWorkSavedAt).toLocaleTimeString())
|
|
346
|
+
: t('wc.savedEarlier');
|
|
347
|
+
wcExplain = app.published
|
|
348
|
+
? t('wc.explainSaved').replace('{v}', String((app.publishedVersionNumber || 0) + 1))
|
|
349
|
+
: t('wc.explainSavedUnpublished');
|
|
350
|
+
} else {
|
|
351
|
+
wcValue = app.published ? t('wc.sameAsPublished') : t('wc.nothingYet');
|
|
352
|
+
wcExplain = app.published ? t('wc.explainClean') : t('wc.explainUnpublished');
|
|
353
|
+
}
|
|
307
354
|
|
|
308
355
|
// App thumbnail (right side of the Status card). Built from the published path; hides itself if
|
|
309
356
|
// the app has no screenshot yet. Cache-busted so a freshly (re)captured shot isn't shown stale.
|
|
@@ -319,17 +366,34 @@ function renderDetailView() {
|
|
|
319
366
|
|
|
320
367
|
var statusHtml =
|
|
321
368
|
'<div class="dtl-section">' +
|
|
322
|
-
'<h3>' + t('
|
|
323
|
-
'<div
|
|
324
|
-
'<div
|
|
325
|
-
'<div class="
|
|
326
|
-
'<
|
|
327
|
-
'<
|
|
369
|
+
'<h3>' + t('wc.lifecycle') + '</h3>' +
|
|
370
|
+
'<div class="wc-row">' +
|
|
371
|
+
'<div class="wc-band">' +
|
|
372
|
+
'<div class="wc-stop ' + (wcState === 'clean' ? 'is-idle' : 'is-active') + '">' +
|
|
373
|
+
'<span class="wc-stop-label">' + t('wc.title') + '</span>' +
|
|
374
|
+
'<span class="wc-stop-val">' + escapeHtml(wcValue) + '</span>' +
|
|
375
|
+
'<span class="wc-stop-note">' + t('wc.privateNote') + '</span>' +
|
|
376
|
+
'</div>' +
|
|
377
|
+
'<span class="wc-arrow" aria-hidden="true">→</span>' +
|
|
378
|
+
'<div class="wc-stop ' + (app.published ? 'is-live' : 'is-idle') + '">' +
|
|
379
|
+
'<span class="wc-stop-label">' + t('wc.published') + '</span>' +
|
|
380
|
+
'<span class="wc-stop-val">' + escapeHtml(app.published ? (publishedV || 'v?') : t('wc.notPublishedYet')) + '</span>' +
|
|
381
|
+
'<span class="wc-stop-note">' + (app.published ? t('wc.visibleToOthers') : t('wc.notVisibleYet')) + '</span>' +
|
|
328
382
|
'</div>' +
|
|
329
|
-
'<span class="dtl-sync ' + syncClass + '">' + escapeHtml(syncText) + '</span>' +
|
|
330
383
|
'</div>' +
|
|
331
384
|
shotImg +
|
|
332
385
|
'</div>' +
|
|
386
|
+
'<p class="wc-explain">' + escapeHtml(wcExplain) + '</p>' +
|
|
387
|
+
// A saved working copy must never be a dead end: the same three verbs are available right
|
|
388
|
+
// here, so you can try it, publish it, or throw it away without hunting through other menus.
|
|
389
|
+
(wcState === 'saved' && app.published && !isUrlApp
|
|
390
|
+
? '<div class="dtl-btn-row">' +
|
|
391
|
+
dtlBtn(t('wc.try'), 'window._launcher.detailWorkTry()') +
|
|
392
|
+
dtlBtn(t('wc.publishAs').replace('{v}', String((app.publishedVersionNumber || 0) + 1)), 'window._launcher.detailWorkPublish()', {variant:'success'}) +
|
|
393
|
+
dtlBtn(t('wc.discardWork'), 'window._launcher.detailWorkDiscard()') +
|
|
394
|
+
'</div>'
|
|
395
|
+
: '') +
|
|
396
|
+
(app.blob && !isUrlApp ? '<p class="wc-size">' + escapeHtml(t('detail.size') + ': ' + fmtSize(localBytes)) + '</p>' : '') +
|
|
333
397
|
'</div>';
|
|
334
398
|
|
|
335
399
|
// ── ABOUT ──
|
|
@@ -416,26 +480,44 @@ function renderDetailView() {
|
|
|
416
480
|
'</div>' +
|
|
417
481
|
'<div class="dtl-ai-status" id="detail-ai-status">' + (detailAiAvailable ? '' : escapeHtml(detailAiUnavailableMsg())) + '</div>' +
|
|
418
482
|
'<div class="dtl-ai-draft" id="detail-ai-draft"' + (detailDraftBlob ? '' : ' hidden') + '>' +
|
|
419
|
-
'<div class="dtl-ai-status
|
|
483
|
+
'<div class="dtl-ai-status wc-proposal-head">' + t('detail.draftReady') + '</div>' +
|
|
484
|
+
// The SAME three verbs the source editor uses, in the order you actually move through them:
|
|
485
|
+
// save (private, reversible) → try (real origin, live untouched) → publish (others see it).
|
|
420
486
|
'<div class="dtl-btn-row">' +
|
|
421
|
-
|
|
422
|
-
// sandbox "Test" is dropped here to avoid two near-identical "Test" buttons. An
|
|
423
|
-
// UNPUBLISHED app has no server draft slot yet, so it keeps the quick sandbox preview.
|
|
487
|
+
dtlBtn(t('wc.save'), 'window._launcher.detailAiKeep()', {variant:'primary'}) +
|
|
424
488
|
(app.published
|
|
425
|
-
? dtlBtn(t('
|
|
426
|
-
dtlBtn(t('
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
dtlBtn(t('
|
|
489
|
+
? dtlBtn(t('wc.try'), 'window._launcher.detailTestDraftLive()') +
|
|
490
|
+
dtlBtn(t('wc.publishAs').replace('{v}', String((app.publishedVersionNumber || 0) + 1)), 'window._launcher.detailPublishTestedDraft()', {variant:'success'})
|
|
491
|
+
// No published app yet → no server slot to stage into; keep the quick sandbox preview.
|
|
492
|
+
: dtlBtn(t('wc.tryLocal'), 'window._launcher.detailAiTest()')) +
|
|
493
|
+
dtlBtn(t('wc.discardProposal'), 'window._launcher.detailAiDiscard()') +
|
|
430
494
|
'</div>' +
|
|
495
|
+
'<p class="wc-verbs-hint">' + t('wc.verbsHint') + '</p>' +
|
|
431
496
|
'</div>';
|
|
432
497
|
}
|
|
433
498
|
aiHtml += '</div>';
|
|
434
499
|
|
|
500
|
+
// ── WORKING-COPY HISTORY (checkpoints, TARGET-048) ──
|
|
501
|
+
// Every save leaves the bytes it replaced here, so iterating can never lose earlier work. Kept
|
|
502
|
+
// visually and verbally separate from the published versions below — that pair of look-alike
|
|
503
|
+
// lists was itself a source of the confusion, so each one states who can see it.
|
|
504
|
+
var historyHtml = '';
|
|
505
|
+
if (!isUrlApp && app.published) {
|
|
506
|
+
historyHtml =
|
|
507
|
+
'<div class="dtl-section">' +
|
|
508
|
+
'<h3>' + t('wc.history') + '</h3>' +
|
|
509
|
+
'<p class="dtl-desc">' + t('wc.historyHint') + '</p>' +
|
|
510
|
+
'<div id="detail-checkpoints">' +
|
|
511
|
+
(detailCheckpointsHtml !== null ? detailCheckpointsHtml : '<span class="wc-muted">…</span>') +
|
|
512
|
+
'</div>' +
|
|
513
|
+
'</div>';
|
|
514
|
+
}
|
|
515
|
+
|
|
435
516
|
// ── VERSIONS ──
|
|
436
517
|
var versionsHtml =
|
|
437
518
|
'<div class="dtl-section">' +
|
|
438
519
|
'<h3>' + t('detail.versions') + '</h3>' +
|
|
520
|
+
'<p class="dtl-desc">' + t('versions.publishedHint') + '</p>' +
|
|
439
521
|
'<div id="detail-versions-list">' +
|
|
440
522
|
(detailVersionsHtml !== null ? detailVersionsHtml :
|
|
441
523
|
(!hasServer ? '<span class="dtl-sync none">' + t('detail.needServerVersions') + '</span>'
|
|
@@ -488,6 +570,13 @@ function renderDetailView() {
|
|
|
488
570
|
'</div>';
|
|
489
571
|
}
|
|
490
572
|
|
|
573
|
+
// ── EXCHANGE & ODPS — is this app on the marketplace, and the ODPS defaults every tool inherits.
|
|
574
|
+
// Sits above Monetize because it frames it: the app-level answer to "is this product for sale".
|
|
575
|
+
// Stable container: monetize.js re-renders #detail-odps in place alongside #detail-monetize.
|
|
576
|
+
var odpsHtml = (app.published && detailIsOwnPublished(app))
|
|
577
|
+
? '<div class="dtl-section" id="detail-odps">' + odpsSectionInner() + '</div>'
|
|
578
|
+
: '';
|
|
579
|
+
|
|
491
580
|
// ── MONETIZE (TARGET-034) — sell tool calls on this app (own published apps only) ──
|
|
492
581
|
// Stable container: monetize.js re-renders #detail-monetize in place after loads/saves.
|
|
493
582
|
var monetizeHtml = (app.published && detailIsOwnPublished(app))
|
|
@@ -528,7 +617,131 @@ function renderDetailView() {
|
|
|
528
617
|
}
|
|
529
618
|
|
|
530
619
|
document.getElementById('detail-body').innerHTML =
|
|
531
|
-
statusHtml + aboutHtml + aiHtml + versionsHtml + skillsHtml + agentsHtml + monetizeHtml + costHtml + promoteHtml + mgmtHtml + actionsHtml;
|
|
620
|
+
statusHtml + aboutHtml + aiHtml + historyHtml + versionsHtml + skillsHtml + agentsHtml + odpsHtml + monetizeHtml + costHtml + promoteHtml + mgmtHtml + actionsHtml;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// ── Working-copy history (checkpoints) ────────────────────────────────────────
|
|
624
|
+
// Rendered from the cached index (workcopy.js); each row can be previewed in the sandbox or
|
|
625
|
+
// restored. Restoring is itself a save, so the state you restore FROM is checkpointed too — there
|
|
626
|
+
// is no way to lose work by clicking around in here.
|
|
627
|
+
|
|
628
|
+
function detailCheckpointRows(app) {
|
|
629
|
+
var owner = detailServerOwner(app);
|
|
630
|
+
var list = getCheckpoints(owner, app.publishedFilename || '');
|
|
631
|
+
if (!list.length) return '<span class="wc-muted">' + t('wc.none') + '</span>';
|
|
632
|
+
var out = '';
|
|
633
|
+
for (var i = 0; i < list.length; i++) {
|
|
634
|
+
var c = list[i];
|
|
635
|
+
var when = c.at ? new Date(c.at).toLocaleString() : '';
|
|
636
|
+
var kb = c.size ? (Math.round(c.size / 102.4) / 10) + ' KB' : '';
|
|
637
|
+
var note = c.note ? t('wc.before').replace('{note}', c.note) : t('wc.beforeUnnamed');
|
|
638
|
+
out +=
|
|
639
|
+
'<div class="dtl-version-row">' +
|
|
640
|
+
'<div class="version-meta">' +
|
|
641
|
+
'<span class="wc-ckpt-when">' + escapeHtml(when) + '</span>' +
|
|
642
|
+
'<span class="wc-ckpt-note">' + escapeHtml(note) + (kb ? ' · ' + kb : '') + '</span>' +
|
|
643
|
+
'</div>' +
|
|
644
|
+
'<div class="dtl-btn-row">' +
|
|
645
|
+
dtlBtn(t('wc.preview'), 'window._launcher.detailCheckpointPreview(\'' + jsArg(c.id) + '\')') +
|
|
646
|
+
dtlBtn(t('wc.restore'), 'window._launcher.detailCheckpointRestore(\'' + jsArg(c.id) + '\')', {variant:'primary', disabled: detailCheckpointBusy}) +
|
|
647
|
+
dtlBtn(t('wc.delete'), 'window._launcher.detailCheckpointDelete(\'' + jsArg(c.id) + '\')', {disabled: detailCheckpointBusy}) +
|
|
648
|
+
'</div>' +
|
|
649
|
+
'</div>';
|
|
650
|
+
}
|
|
651
|
+
return out;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// Re-render ONLY the checkpoint list in place (keeps scroll + the rest of the detail intact).
|
|
655
|
+
function refreshCheckpoints() {
|
|
656
|
+
var app = detailGetApp();
|
|
657
|
+
if (!app) return;
|
|
658
|
+
detailCheckpointsHtml = detailCheckpointRows(app);
|
|
659
|
+
var el = document.getElementById('detail-checkpoints');
|
|
660
|
+
if (el) el.innerHTML = detailCheckpointsHtml;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// Load the saved working copy over the materialized published bytes (see the call site). Silent on
|
|
664
|
+
// failure: the band still says "saved earlier", and the worst case is the previous behaviour.
|
|
665
|
+
function detailLoadWorkingCopy(app, owner) {
|
|
666
|
+
var epoch = detailEpoch;
|
|
667
|
+
getDraft(owner, app.publishedFilename).then(function (d) {
|
|
668
|
+
// Bail if a publish/discard/app-switch happened while this was in flight (see detailEpoch).
|
|
669
|
+
if (!d || !d.content || detailAppId !== app.id || epoch !== detailEpoch) return;
|
|
670
|
+
app.blob = d.content;
|
|
671
|
+
if (d.updated_at) detailWorkSavedAt = d.updated_at;
|
|
672
|
+
saveApp(app).then(function () { if (detailAppId === app.id) renderDetailView(); });
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
function detailLoadCheckpoints(owner, filename) {
|
|
677
|
+
loadCheckpoints(owner, filename)
|
|
678
|
+
.then(function () { if (detailAppId) refreshCheckpoints(); })
|
|
679
|
+
.catch(function () { if (detailAppId) refreshCheckpoints(); });
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
// Open a stored checkpoint in the sandbox overlay WITHOUT touching the working copy.
|
|
683
|
+
function detailCheckpointPreview(id) {
|
|
684
|
+
var app = detailGetApp();
|
|
685
|
+
if (!app) return;
|
|
686
|
+
readCheckpoint(detailServerOwner(app), app.publishedFilename || '', id).then(function (b64) {
|
|
687
|
+
if (!b64) { showNotice(t('wc.gone')); return; }
|
|
688
|
+
var view = document.getElementById('iframe-view');
|
|
689
|
+
var iframe = document.getElementById('app-iframe');
|
|
690
|
+
document.getElementById('iframe-title').textContent = (app.name || 'App') + ' — ' + t('wc.previewTitle');
|
|
691
|
+
iframe.removeAttribute('src');
|
|
692
|
+
iframe.srcdoc = blobToHtml(b64);
|
|
693
|
+
setIframeUrl('');
|
|
694
|
+
delete iframe.dataset.appId;
|
|
695
|
+
view.hidden = false;
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// Restore = save the checkpoint's bytes AS the working copy (which checkpoints the current bytes
|
|
700
|
+
// first). The published app is untouched until you publish.
|
|
701
|
+
async function detailCheckpointRestore(id) {
|
|
702
|
+
var app = detailGetApp();
|
|
703
|
+
if (!app || detailCheckpointBusy) return;
|
|
704
|
+
if (!getCortexOwnerToken()) { showNotice(t('wc.loginNeeded')); return; }
|
|
705
|
+
if (!(await showConfirm(t('wc.confirmRestore')))) return;
|
|
706
|
+
var owner = detailServerOwner(app);
|
|
707
|
+
var filename = app.publishedFilename || '';
|
|
708
|
+
detailCheckpointBusy = true;
|
|
709
|
+
refreshCheckpoints();
|
|
710
|
+
readCheckpoint(owner, filename, id)
|
|
711
|
+
.then(function (b64) {
|
|
712
|
+
if (!b64) throw new Error(t('wc.gone'));
|
|
713
|
+
return saveWorkingCopy({
|
|
714
|
+
owner: owner, filename: filename,
|
|
715
|
+
previousB64: app.blob, nextB64: b64, note: t('wc.noteRestore'),
|
|
716
|
+
}).then(function () { return b64; });
|
|
717
|
+
})
|
|
718
|
+
.then(function (b64) {
|
|
719
|
+
app.blob = b64;
|
|
720
|
+
detailCheckpointBusy = false;
|
|
721
|
+
detailHasWorkCopy = true;
|
|
722
|
+
detailWorkSavedAt = new Date().toISOString();
|
|
723
|
+
return saveApp(app).then(function () {
|
|
724
|
+
renderDetailView();
|
|
725
|
+
refreshCheckpoints();
|
|
726
|
+
showNotice(t('wc.restored'));
|
|
727
|
+
});
|
|
728
|
+
})
|
|
729
|
+
.catch(function (err) {
|
|
730
|
+
detailCheckpointBusy = false;
|
|
731
|
+
refreshCheckpoints();
|
|
732
|
+
showNotice((err && err.message) || t('wc.saveFailed'));
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
async function detailCheckpointDelete(id) {
|
|
737
|
+
var app = detailGetApp();
|
|
738
|
+
if (!app || detailCheckpointBusy) return;
|
|
739
|
+
if (!(await showConfirm(t('wc.confirmDelete')))) return;
|
|
740
|
+
detailCheckpointBusy = true;
|
|
741
|
+
refreshCheckpoints();
|
|
742
|
+
deleteCheckpoint(detailServerOwner(app), app.publishedFilename || '', id)
|
|
743
|
+
.catch(function () { /* index already updated locally */ })
|
|
744
|
+
.then(function () { detailCheckpointBusy = false; refreshCheckpoints(); });
|
|
532
745
|
}
|
|
533
746
|
|
|
534
747
|
// The Promote section: a short EN/FI pitch that surfaces this app on the owner's public profile.
|
|
@@ -1218,6 +1431,7 @@ function detailAiRun() {
|
|
|
1218
1431
|
return;
|
|
1219
1432
|
}
|
|
1220
1433
|
detailDraftBlob = htmlToBlob(newHtml);
|
|
1434
|
+
detailLastChangeNote = change;
|
|
1221
1435
|
statusEl.style.color = '#34d399';
|
|
1222
1436
|
var usage = json.data && json.data.budget && typeof json.data.budget.spent_today_usd !== 'undefined'
|
|
1223
1437
|
? (' · ' + t('detail.aiUsage') + ': $' + Number(json.data.budget.spent_today_usd).toFixed(3)) : '';
|
|
@@ -1249,19 +1463,58 @@ function detailAiTest() {
|
|
|
1249
1463
|
view.hidden = false;
|
|
1250
1464
|
}
|
|
1251
1465
|
|
|
1466
|
+
// Accept the AI proposal INTO the working copy. This used to only overwrite the in-memory blob —
|
|
1467
|
+
// which a reload silently threw away. Now it checkpoints the bytes being replaced and persists the
|
|
1468
|
+
// new ones to the server draft slot, so "saved" actually means saved. The live app is untouched.
|
|
1252
1469
|
function detailAiKeep() {
|
|
1253
1470
|
var app = detailGetApp();
|
|
1254
1471
|
if (!app || !detailDraftBlob) return;
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1472
|
+
var next = detailDraftBlob;
|
|
1473
|
+
var prev = app.blob;
|
|
1474
|
+
var statusEl = document.getElementById('detail-ai-status');
|
|
1475
|
+
|
|
1476
|
+
function finishLocal() {
|
|
1477
|
+
app.blob = next;
|
|
1478
|
+
app.source = app.source === 'url' ? 'paste' : (app.source || 'paste');
|
|
1479
|
+
app.url = app.url || null;
|
|
1480
|
+
detailDraftBlob = null;
|
|
1481
|
+
return saveApp(app).then(function () {
|
|
1482
|
+
renderApps();
|
|
1483
|
+
renderDetailView();
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
// No published app (no server slot) or signed out → in-memory only, and say so plainly.
|
|
1488
|
+
if (!app.published || !app.publishedFilename || !getCortexOwnerToken()) {
|
|
1489
|
+
finishLocal().then(function () {
|
|
1490
|
+
var s2 = document.getElementById('detail-ai-status');
|
|
1491
|
+
if (s2) { s2.style.color = 'var(--text-muted)'; s2.textContent = t('wc.keptLocalOnly'); }
|
|
1492
|
+
});
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
if (statusEl) { statusEl.style.color = 'var(--text-muted)'; statusEl.textContent = t('wc.saving'); }
|
|
1497
|
+
saveWorkingCopy({
|
|
1498
|
+
owner: detailServerOwner(app),
|
|
1499
|
+
filename: app.publishedFilename,
|
|
1500
|
+
previousB64: prev,
|
|
1501
|
+
nextB64: next,
|
|
1502
|
+
note: detailLastChangeNote,
|
|
1503
|
+
})
|
|
1504
|
+
.then(function () {
|
|
1505
|
+
detailHasWorkCopy = true;
|
|
1506
|
+
detailWorkSavedAt = new Date().toISOString();
|
|
1507
|
+
return finishLocal();
|
|
1508
|
+
})
|
|
1509
|
+
.then(function () {
|
|
1510
|
+
refreshCheckpoints();
|
|
1511
|
+
var s2 = document.getElementById('detail-ai-status');
|
|
1512
|
+
if (s2) { s2.style.color = '#34d399'; s2.textContent = '✔ ' + t('wc.saved'); }
|
|
1513
|
+
})
|
|
1514
|
+
.catch(function (err) {
|
|
1515
|
+
var s2 = document.getElementById('detail-ai-status');
|
|
1516
|
+
if (s2) { s2.style.color = 'var(--accent)'; s2.textContent = '✘ ' + ((err && err.message) || t('wc.saveFailed')); }
|
|
1517
|
+
});
|
|
1265
1518
|
}
|
|
1266
1519
|
|
|
1267
1520
|
function detailAiDiscard() {
|
|
@@ -1365,6 +1618,63 @@ function publishDraftBytes(app, contentB64, statusEl, onDone) {
|
|
|
1365
1618
|
});
|
|
1366
1619
|
}
|
|
1367
1620
|
|
|
1621
|
+
// ── Saved working copy: try / publish / discard ───────────────────────────────
|
|
1622
|
+
// These act on the SERVER draft slot, which is authoritative. Publishing must NOT re-upload
|
|
1623
|
+
// app.blob: after a reload the in-memory blob is materialized from the PUBLISHED bytes, so
|
|
1624
|
+
// PUT-then-publish would silently overwrite the saved working copy with the live version. The
|
|
1625
|
+
// AI-proposal path is the only one that stages bytes first (they are not on the server yet).
|
|
1626
|
+
|
|
1627
|
+
function detailWorkTry() {
|
|
1628
|
+
var app = detailGetApp();
|
|
1629
|
+
if (!app || !app.publishedFilename) return;
|
|
1630
|
+
openStagingPreview(detailServerOwner(app), app.publishedFilename);
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
async function detailWorkPublish() {
|
|
1634
|
+
var app = detailGetApp();
|
|
1635
|
+
if (!app || !app.publishedFilename) return;
|
|
1636
|
+
if (!getCortexOwnerToken()) { showNotice(t('wc.loginNeeded')); return; }
|
|
1637
|
+
if (!(await showConfirm(t('detail.draftPublishConfirm')))) return;
|
|
1638
|
+
var owner = detailServerOwner(app);
|
|
1639
|
+
draftApi('POST', owner, app.publishedFilename, 'publish-draft')
|
|
1640
|
+
.then(function (data) {
|
|
1641
|
+
detailEpoch++;
|
|
1642
|
+
detailHasWorkCopy = false;
|
|
1643
|
+
detailWorkSavedAt = null;
|
|
1644
|
+
app.publishedVersionNumber = data.version_number || app.publishedVersionNumber;
|
|
1645
|
+
showNotice(t('detail.draftPublished').replace('{v}', data.version_number));
|
|
1646
|
+
// Render BEFORE refreshAll: it empties the working set synchronously, after which
|
|
1647
|
+
// detailGetApp() is null and renderDetailView() bails, leaving the pre-publish DOM on screen.
|
|
1648
|
+
renderDetailView();
|
|
1649
|
+
detailLoadVersions(owner, app.publishedFilename);
|
|
1650
|
+
refreshAll();
|
|
1651
|
+
})
|
|
1652
|
+
.catch(function (err) { showNotice('✘ ' + ((err && err.message) || 'Publish failed')); });
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
// Throw the working copy away and pull the live bytes back in, so what you see afterwards really
|
|
1656
|
+
// IS the published app (rather than a stale in-memory copy of what you just discarded).
|
|
1657
|
+
async function detailWorkDiscard() {
|
|
1658
|
+
var app = detailGetApp();
|
|
1659
|
+
if (!app || !app.publishedFilename) return;
|
|
1660
|
+
if (!(await showConfirm(t('wc.confirmDiscardWork')))) return;
|
|
1661
|
+
var owner = detailServerOwner(app);
|
|
1662
|
+
var cfg = loadConfig();
|
|
1663
|
+
var aimeatUrl = (cfg.aimeatUrl || '').replace(/\/+$/, '');
|
|
1664
|
+
discardWorkingCopy(owner, app.publishedFilename)
|
|
1665
|
+
.then(function () { return fetchAppContentBase64(aimeatUrl, owner, app.publishedFilename); })
|
|
1666
|
+
.then(function (b64) { app.blob = b64; return saveApp(app); })
|
|
1667
|
+
.catch(function () { /* keep whatever we have if the re-fetch fails */ })
|
|
1668
|
+
.then(function () {
|
|
1669
|
+
detailEpoch++;
|
|
1670
|
+
detailHasWorkCopy = false;
|
|
1671
|
+
detailWorkSavedAt = null;
|
|
1672
|
+
renderDetailView(); // before refreshAll — see detailWorkPublish
|
|
1673
|
+
refreshAll();
|
|
1674
|
+
showNotice(t('wc.discardedWork'));
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1368
1678
|
// ── AI-loop wrappers (stage the pending AI candidate `detailDraftBlob`) ──
|
|
1369
1679
|
function detailTestDraftLive() {
|
|
1370
1680
|
var app = detailGetApp();
|
|
@@ -1374,10 +1684,17 @@ function detailTestDraftLive() {
|
|
|
1374
1684
|
function detailPublishTestedDraft() {
|
|
1375
1685
|
var app = detailGetApp();
|
|
1376
1686
|
if (!app || !detailDraftBlob) return;
|
|
1377
|
-
publishDraftBytes(app, detailDraftBlob, document.getElementById('detail-ai-status'), function () {
|
|
1687
|
+
publishDraftBytes(app, detailDraftBlob, document.getElementById('detail-ai-status'), function (data) {
|
|
1688
|
+
// Published: the slot is cleared server-side, so the working copy is level with the live app.
|
|
1689
|
+
detailEpoch++;
|
|
1690
|
+
app.blob = detailDraftBlob;
|
|
1378
1691
|
detailDraftBlob = null;
|
|
1692
|
+
detailHasWorkCopy = false;
|
|
1693
|
+
detailWorkSavedAt = null;
|
|
1694
|
+
if (data && data.version_number) app.publishedVersionNumber = data.version_number;
|
|
1695
|
+
saveApp(app);
|
|
1696
|
+
renderDetailView(); // before refreshAll — see detailWorkPublish
|
|
1379
1697
|
refreshAll();
|
|
1380
|
-
renderDetailView();
|
|
1381
1698
|
});
|
|
1382
1699
|
}
|
|
1383
1700
|
|
|
@@ -1397,6 +1714,57 @@ function sourceCurrentB64() {
|
|
|
1397
1714
|
if (!ta) return null;
|
|
1398
1715
|
try { return btoa(unescape(encodeURIComponent(ta.value))); } catch (e) { return null; }
|
|
1399
1716
|
}
|
|
1717
|
+
// "Save working copy" in the source editor — the SAME contract as the AI loop's save: checkpoint
|
|
1718
|
+
// the bytes being replaced, then persist to the server draft slot. Previously this button only
|
|
1719
|
+
// reassigned a transient in-memory blob, so the edit was gone on the next reload. Returns a promise
|
|
1720
|
+
// so main.js can drive the button's label/disabled state.
|
|
1721
|
+
function saveSourceAsWorkingCopy() {
|
|
1722
|
+
var app = sourceOverlayApp();
|
|
1723
|
+
var b64 = sourceCurrentB64();
|
|
1724
|
+
if (!app || b64 == null) return Promise.reject(new Error('No app'));
|
|
1725
|
+
var statusEl = document.getElementById('source-draft-status');
|
|
1726
|
+
var prev = app.blob;
|
|
1727
|
+
var isOpenInDetail = (detailAppId === app.id);
|
|
1728
|
+
|
|
1729
|
+
function localOnly() {
|
|
1730
|
+
app.blob = b64;
|
|
1731
|
+
return saveApp(app).then(function () { renderApps(); });
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// Unpublished app or signed out → no server slot exists; keep the old in-memory behaviour but
|
|
1735
|
+
// say plainly that it will not survive a reload.
|
|
1736
|
+
if (!app.published || !app.publishedFilename || !getCortexOwnerToken()) {
|
|
1737
|
+
return localOnly().then(function () {
|
|
1738
|
+
if (statusEl) { statusEl.style.color = 'var(--text-muted)'; statusEl.textContent = t('wc.keptLocalOnly'); }
|
|
1739
|
+
return { persisted: false };
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
if (statusEl) { statusEl.style.color = 'var(--text-muted)'; statusEl.textContent = t('wc.saving'); }
|
|
1744
|
+
return saveWorkingCopy({
|
|
1745
|
+
owner: detailServerOwner(app),
|
|
1746
|
+
filename: app.publishedFilename,
|
|
1747
|
+
previousB64: prev,
|
|
1748
|
+
nextB64: b64,
|
|
1749
|
+
note: t('wc.noteManual'),
|
|
1750
|
+
})
|
|
1751
|
+
.then(function () { return localOnly(); })
|
|
1752
|
+
.then(function () {
|
|
1753
|
+
if (isOpenInDetail) {
|
|
1754
|
+
detailHasWorkCopy = true;
|
|
1755
|
+
detailWorkSavedAt = new Date().toISOString();
|
|
1756
|
+
renderDetailView();
|
|
1757
|
+
refreshCheckpoints();
|
|
1758
|
+
}
|
|
1759
|
+
if (statusEl) { statusEl.style.color = '#34d399'; statusEl.textContent = '✔ ' + t('wc.saved'); }
|
|
1760
|
+
return { persisted: true };
|
|
1761
|
+
})
|
|
1762
|
+
.catch(function (err) {
|
|
1763
|
+
if (statusEl) { statusEl.style.color = 'var(--accent)'; statusEl.textContent = '✘ ' + ((err && err.message) || t('wc.saveFailed')); }
|
|
1764
|
+
throw err;
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1400
1768
|
function sourceTestDraftLive() {
|
|
1401
1769
|
var app = sourceOverlayApp();
|
|
1402
1770
|
var c = sourceCurrentB64();
|
|
@@ -1796,6 +2164,13 @@ export {
|
|
|
1796
2164
|
detailAiDiscard,
|
|
1797
2165
|
detailTestDraftLive,
|
|
1798
2166
|
detailPublishTestedDraft,
|
|
2167
|
+
detailWorkTry,
|
|
2168
|
+
detailWorkPublish,
|
|
2169
|
+
detailWorkDiscard,
|
|
2170
|
+
detailCheckpointPreview,
|
|
2171
|
+
detailCheckpointRestore,
|
|
2172
|
+
detailCheckpointDelete,
|
|
2173
|
+
saveSourceAsWorkingCopy,
|
|
1799
2174
|
openStagingPreview,
|
|
1800
2175
|
sourceTestDraftLive,
|
|
1801
2176
|
sourcePublishTested,
|