@theaiplatform/miniapp-sdk 0.3.2 → 0.4.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/README.md +126 -0
- package/dist/bin/tap-miniapp-test.d.ts +1 -0
- package/dist/bin/tap-miniapp-test.js +1293 -0
- package/dist/index.d.ts +50 -0
- package/dist/internal/json-schema.d.ts +10 -0
- package/dist/internal/json-schema.js +53 -0
- package/dist/rspack/index.d.ts +72 -6
- package/dist/rspack/index.js +177 -31
- package/dist/sdk.d.ts +50 -0
- package/dist/surface.d.ts +14 -0
- package/dist/testing/rstest-config.d.ts +38 -0
- package/dist/testing/rstest-config.js +59 -0
- package/dist/testing/rstest.d.ts +514 -41
- package/dist/testing/rstest.js +1734 -167
- package/dist/testing/tap.test.schema.json +361 -0
- package/dist/ui/styles.css +504 -6
- package/dist/ui/wasm.js +9231 -510
- package/dist/ui/wasm.js.LICENSE.txt +12 -0
- package/dist/ui.d.ts +14 -4
- package/dist/ui.js +9493 -540
- package/dist/ui.js.LICENSE.txt +12 -0
- package/dist/vscode-webview.d.ts +147 -0
- package/dist/vscode-webview.js +594 -0
- package/dist/web.d.ts +50 -0
- package/package.json +31 -13
package/dist/rspack/index.js
CHANGED
|
@@ -8,7 +8,26 @@ import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
|
8
8
|
import * as __rspack_external_node_url_3991086a from "node:url";
|
|
9
9
|
import * as __rspack_external_saxes from "saxes";
|
|
10
10
|
import * as __rspack_external_node_util_ac04460e from "node:util";
|
|
11
|
+
import { registerTapManifestAjvFormats } from "../internal/json-schema.js";
|
|
11
12
|
var config_schema_namespaceObject = /*#__PURE__*/ JSON.parse('{"$defs":{"ActorKind":{"enum":["human","specialist"],"type":"string"},"AuthorizationBinding":{"additionalProperties":false,"properties":{"allOf":{"items":{"type":"string"},"type":"array"},"effects":{"items":{"$ref":"#/$defs/RuntimeEffect"},"type":"array"}},"type":"object"},"AutonomyLevel":{"enum":["listen","plan","do"],"type":"string"},"BrowserExtensionOptions":{"additionalProperties":false,"properties":{"manifest":{"type":"string"},"permissions":{"items":{"type":"string"},"type":"array"},"restartRequired":{"default":false,"type":"boolean"}},"required":["manifest"],"type":"object"},"ChatBlockOptions":{"additionalProperties":false,"properties":{"accessibilityLabel":{"type":"string"},"fallbackFormat":{"$ref":"#/$defs/FallbackFormat"},"payloadSchema":{"type":"string"},"protocol":{"$ref":"#/$defs/ChatBlockProtocol"}},"required":["protocol","payloadSchema","fallbackFormat","accessibilityLabel"],"type":"object"},"ChatBlockProtocol":{"enum":["tap-primitives-v1","tap-federated-view-v1","isolated-html-v1","mcp-app-2026-01-26"],"type":"string"},"CommandOptions":{"additionalProperties":false,"properties":{"inputSchema":{"type":["string","null"]},"label":{"type":"string"},"placements":{"items":{"type":"string"},"type":"array"}},"required":["label"],"type":"object"},"CompositionOptions":{"additionalProperties":false,"properties":{"childPackageIds":{"items":{"type":"string"},"type":"array"},"contributionIds":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ConsentPolicy":{"enum":["none","once","channel","reusable","fresh-decision"],"type":"string"},"ContributionScope":{"enum":["user","workspace","channel","conversation","project","resource"],"type":"string"},"ContributionTarget":{"anyOf":[{"$ref":"#/$defs/ModuleContributionTarget"},{"$ref":"#/$defs/HostDeclarativeContributionTarget"}],"description":"A target-specific execution binding selected for a contribution.\\n\\nExecutable package modules select one immutable Federation expose. Host-\\ndeclarative contributions are materialized by TAP and therefore select the\\nhost runtime without inventing a module expose."},"DeclarativeOptions":{"additionalProperties":false,"properties":{"schema":{"type":"string"}},"required":["schema"],"type":"object"},"EventDelivery":{"enum":["ephemeral","durable"],"type":"string"},"ExecutableOptions":{"additionalProperties":false,"properties":{"effects":{"items":{"$ref":"#/$defs/RuntimeEffect"},"type":"array"},"inputSchema":{"type":["string","null"]},"outputSchema":{"type":["string","null"]},"timeoutMs":{"format":"uint64","minimum":0,"type":["integer","null"]}},"type":"object"},"ExecutionRuntime":{"enum":["webview","quickjs","worker","node","workflow-host"],"type":"string"},"FallbackFormat":{"enum":["text","markdown"],"type":"string"},"FederationExpose":{"additionalProperties":false,"description":"One exposed module in the locked Federation graph.","properties":{"integrity":{"type":"string"},"runtime":{"$ref":"#/$defs/ExecutionRuntime"}},"required":["integrity","runtime"],"type":"object"},"FederationLibraryType":{"enum":["module","script","commonjs-module"],"type":"string"},"FederationTarget":{"additionalProperties":false,"description":"One target-specific Module Federation remote container.","properties":{"assetLock":{"description":"Relative path to the build-generated content-addressed asset graph lock.","type":"string"},"assetLockIntegrity":{"description":"SHA-256 integrity of the canonical asset-lock bytes.","type":"string"},"exposes":{"additionalProperties":{"$ref":"#/$defs/FederationExpose"},"type":"object"},"libraryType":{"$ref":"#/$defs/FederationLibraryType"},"manifest":{"type":["string","null"]},"manifestIntegrity":{"type":["string","null"]},"remoteEntry":{"type":"string"},"remoteEntryIntegrity":{"type":"string"},"remoteName":{"type":"string"}},"required":["remoteName","remoteEntry","remoteEntryIntegrity","assetLock","assetLockIntegrity","libraryType","exposes"],"type":"object"},"HostDeclarativeContributionTarget":{"additionalProperties":false,"description":"A contribution whose declarative configuration TAP materializes directly.","properties":{"runtime":{"$ref":"#/$defs/HostDeclarativeRuntime"}},"required":["runtime"],"type":"object"},"HostDeclarativeRuntime":{"description":"The only runtime accepted by an expose-free contribution target binding.","enum":["host-declarative"],"type":"string"},"InstancePolicy":{"enum":["per-mount","per-conversation","per-channel","per-workspace","singleton"],"type":"string"},"KnowledgeOptions":{"additionalProperties":false,"properties":{"materialization":{"type":["string","null"]},"schema":{"type":"string"}},"required":["schema"],"type":"object"},"LifecycleScope":{"enum":["installation","realm","contribution","mount"],"type":"string"},"McpAppOptions":{"additionalProperties":false,"description":"One sandboxed MCP App bound to exact tool and UI resource contributions.","properties":{"protocolVersion":{"type":"string"},"resourceContributionId":{"type":"string"},"serverContributionId":{"type":"string"},"toolContributionId":{"type":"string"}},"required":["serverContributionId","toolContributionId","resourceContributionId","protocolVersion"],"type":"object"},"McpConsumerPolicy":{"additionalProperties":false,"description":"Publisher-declared upper bound on who may consume an MCP server.\\n\\nBoth lists default empty. Installation policy may select or remove entries,\\nbut cannot authorize consumers outside this signed maximum.","properties":{"contributionIds":{"description":"Exact same-package contribution identities eligible to receive access.","items":{"type":"string"},"type":"array"},"externalConsumers":{"description":"External platform consumer classes eligible for narrower host grants.","items":{"$ref":"#/$defs/McpExternalConsumerClass"},"type":"array"}},"type":"object"},"McpExternalConsumerClass":{"description":"Closed external consumer classes a publisher may include in its maximum.","enum":["selected-miniapps","selected-specialists","chat","workflows","platform"],"type":"string"},"McpHttpCredentialRequirement":{"additionalProperties":false,"description":"One host-held credential injected into a declared Streamable HTTP header.\\n\\nDescriptors name requirements and destinations only. Credential values are\\nresolved from host-owned secret storage after installation consent.","properties":{"header":{"type":"string"},"id":{"type":"string"}},"required":["id","header"],"type":"object"},"McpPromptOptions":{"additionalProperties":false,"description":"One MCP prompt promoted from its owning server\'s live catalog.","properties":{"promptName":{"type":"string"},"serverContributionId":{"type":"string"}},"required":["serverContributionId","promptName"],"type":"object"},"McpResourceOptions":{"additionalProperties":false,"description":"One exact MCP resource promoted from its owning server\'s live catalog.","properties":{"mimeType":{"type":["string","null"]},"serverContributionId":{"type":"string"},"uri":{"type":"string"}},"required":["serverContributionId","uri"],"type":"object"},"McpResourceTemplateOptions":{"additionalProperties":false,"description":"One MCP resource template promoted from its owning server\'s live catalog.","properties":{"mimeType":{"type":["string","null"]},"serverContributionId":{"type":"string"},"uriTemplate":{"type":"string"}},"required":["serverContributionId","uriTemplate"],"type":"object"},"McpServerImplementation":{"description":"Mutually exclusive ways TAP can activate a declared MCP server.","oneOf":[{"additionalProperties":false,"description":"Load the server adapter from the contribution\'s verified Federation expose.","properties":{"type":{"const":"package-runtime","type":"string"}},"required":["type"],"type":"object"},{"additionalProperties":false,"description":"Spawn a reviewed local process and communicate over stdio.","properties":{"args":{"items":{"type":"string"},"type":"array"},"command":{"type":"string"},"credentialRequirements":{"items":{"$ref":"#/$defs/McpStdioCredentialRequirement"},"type":"array"},"type":{"const":"stdio","type":"string"}},"required":["type","command"],"type":"object"},{"additionalProperties":false,"description":"Connect to an HTTPS MCP endpoint using Streamable HTTP.","properties":{"credentialRequirements":{"items":{"$ref":"#/$defs/McpHttpCredentialRequirement"},"type":"array"},"type":{"const":"streamable-http","type":"string"},"url":{"type":"string"}},"required":["type","url"],"type":"object"}]},"McpServerOptions":{"additionalProperties":false,"description":"One package-declared MCP server and its maximum consumer audience.","properties":{"consumerPolicy":{"$ref":"#/$defs/McpConsumerPolicy","default":{}},"implementation":{"$ref":"#/$defs/McpServerImplementation"},"protocolVersion":{"type":"string"}},"required":["protocolVersion","implementation"],"type":"object"},"McpStdioCredentialRequirement":{"additionalProperties":false,"description":"One host-held credential injected into a declared stdio environment slot.\\n\\nDescriptors name requirements and destinations only. Credential values are\\nresolved from host-owned secret storage after installation consent.","properties":{"environmentVariable":{"type":"string"},"id":{"type":"string"}},"required":["id","environmentVariable"],"type":"object"},"McpToolOptions":{"additionalProperties":false,"description":"One MCP tool promoted from its owning server\'s live catalog.","properties":{"effects":{"items":{"$ref":"#/$defs/RuntimeEffect"},"type":"array"},"inputSchema":{"type":["string","null"]},"outputSchema":{"type":["string","null"]},"serverContributionId":{"type":"string"},"timeoutMs":{"format":"uint64","minimum":0,"type":["integer","null"]},"toolName":{"type":"string"}},"required":["serverContributionId","toolName"],"type":"object"},"MiniAppBundleManifest":{"additionalProperties":false,"description":"Manifest for a single TAP miniapp bundle.","properties":{"$schema":{"description":"Optional JSON Schema reference for editor support.","type":["string","null"]},"description":{"description":"Short human-readable summary of the miniapp.","minLength":1,"type":"string"},"entry":{"$ref":"#/$defs/MiniAppSource","description":"Entry file, package specifier, or URL for the miniapp config."},"icon":{"description":"Lucide-compatible icon name shown by host UI surfaces.","minLength":1,"type":["string","null"]},"name":{"description":"Display name for the miniapp.","minLength":1,"type":"string"},"runtime":{"$ref":"#/$defs/TapRuntime","description":"TAP miniapp runtime version."},"version":{"description":"Miniapp version.","minLength":1,"type":"string"}},"required":["name","description","version","runtime","entry"],"title":"Tap Miniapp Bundle Manifest","type":"object"},"MiniAppCategory":{"description":"Closed Marketplace discovery taxonomy for descriptor-backed miniapps.","enum":["productivity","developer-tools","creativity","communication","data-and-analytics","business","education","media-and-entertainment","utilities","other"],"type":"string"},"MiniAppSource":{"description":"Absolute URL or local path. Bundle entry paths are resolved relative to the manifest that declares them.","oneOf":[{"additionalProperties":false,"properties":{"Path":{"additionalProperties":false,"properties":{"path":{"minLength":1,"type":"string"}},"required":["path"],"type":"object"}},"required":["Path"],"type":"object"},{"additionalProperties":false,"properties":{"Url":{"additionalProperties":false,"properties":{"hash":{"description":"Expected SHA-256 hex digest for the remote source bytes.","type":["string","null"]},"url":{"format":"uri","type":"string"}},"required":["url"],"type":"object"}},"required":["Url"],"type":"object"},{"description":"Absolute URL or local path. Bundle entry paths are resolved relative to the manifest that declares them.","minLength":1,"type":"string"},{"additionalProperties":false,"properties":{"hash":{"description":"Expected SHA-256 hex digest for the remote source bytes.","type":["string","null"]},"url":{"format":"uri","type":"string"}},"required":["url"],"type":"object"}]},"ModuleContributionTarget":{"additionalProperties":false,"description":"A contribution implemented by one module in the locked Federation graph.","properties":{"expose":{"type":"string"},"runtime":{"$ref":"#/$defs/ExecutionRuntime"}},"required":["expose","runtime"],"type":"object"},"PackageCompatibility":{"additionalProperties":false,"description":"Host and SDK compatibility checked before remote loading.","properties":{"tapHost":{"type":"string"},"tapSdk":{"type":"string"}},"required":["tapSdk","tapHost"],"type":"object"},"PackageContribution":{"description":"Strict contribution union covering the initial TAP extension catalog.","oneOf":[{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"ui.surface","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/UiSurfaceOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"ui.renderer","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/RendererOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"chat.block","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/ChatBlockOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"action.command","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/CommandOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"prompt","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/ExecutableOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"skill","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/ExecutableOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"tool","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/ExecutableOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"specialist","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/ExecutableOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"task.type","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/TaskOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"task.attribute","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/TaskOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"task.view","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/TaskOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"task.action","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/TaskOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"task.template","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/TaskOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"workflow","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/WorkflowOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"workflow.node","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/WorkflowNodeOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"automation.trigger","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/ExecutableOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"mcp.server","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/McpServerOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"mcp.tool","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/McpToolOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"mcp.prompt","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/McpPromptOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"mcp.resource","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/McpResourceOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"mcp.resource-template","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/McpResourceTemplateOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"mcp.app","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/McpAppOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"miniapp","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/CompositionOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"integration.connector","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/CompositionOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"browser.extension","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/BrowserExtensionOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"knowledge.plot-template","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/KnowledgeOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"knowledge.source-provider","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/KnowledgeOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"knowledge.enricher","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/KnowledgeOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"knowledge.retriever","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/KnowledgeOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"provider.adapter","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/ExecutableOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"template","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/DeclarativeOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"},{"additionalProperties":false,"description":"Fields shared by every package contribution.","properties":{"apiVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"authorization":{"$ref":"#/$defs/AuthorizationBinding","default":{}},"id":{"type":"string"},"kind":{"const":"permission.catalog","type":"string"},"lifecycleScope":{"$ref":"#/$defs/LifecycleScope","default":"mount"},"options":{"$ref":"#/$defs/PermissionCatalogOptions"},"publishes":{"items":{"type":"string"},"type":"array"},"subscribes":{"items":{"type":"string"},"type":"array"},"targets":{"additionalProperties":false,"properties":{"desktop":{"$ref":"#/$defs/ContributionTarget"},"mobile":{"$ref":"#/$defs/ContributionTarget"},"node":{"$ref":"#/$defs/ContributionTarget"},"quickjs":{"$ref":"#/$defs/ContributionTarget"},"worker":{"$ref":"#/$defs/ContributionTarget"},"workflow-host":{"$ref":"#/$defs/ContributionTarget"}},"type":"object"}},"required":["kind","id","apiVersion","options"],"type":"object"}]},"PackageDependency":{"additionalProperties":false,"properties":{"alias":{"type":"string"},"optional":{"default":false,"type":"boolean"},"packageId":{"type":"string"},"version":{"type":"string"}},"required":["alias","packageId","version"],"type":"object"},"PackageEventCatalog":{"additionalProperties":false,"description":"Package-defined published and consumed events.","properties":{"publishes":{"items":{"$ref":"#/$defs/PublishedEvent"},"type":"array"},"subscribes":{"items":{"$ref":"#/$defs/SubscribedEvent"},"type":"array"}},"type":"object"},"PackageIdentity":{"additionalProperties":false,"description":"Immutable identity carried by a package descriptor.","properties":{"namespace":{"type":"string"},"organizationId":{"type":["string","null"]},"packageId":{"type":"string"},"parentPackageId":{"type":["string","null"]},"publisherId":{"type":"string"},"slug":{"type":"string"}},"required":["packageId","publisherId","namespace","slug"],"type":"object"},"PackageLifecyclePolicy":{"additionalProperties":false,"properties":{"checkpoint":{"$ref":"#/$defs/PersistencePolicy","default":"none"},"checkpointSchema":{"type":["string","null"]},"lifecycleExpose":{"type":["string","null"]}},"type":"object"},"PackagePermissionAction":{"additionalProperties":false,"properties":{"autonomyCeiling":{"$ref":"#/$defs/AutonomyLevel"},"consent":{"$ref":"#/$defs/ConsentPolicy"},"delegatedActors":{"items":{"$ref":"#/$defs/ActorKind"},"type":"array"},"directActors":{"items":{"$ref":"#/$defs/ActorKind"},"type":"array"},"id":{"type":"string"},"resource":{"type":"string"},"risk":{"$ref":"#/$defs/PermissionRisk"},"scopes":{"items":{"$ref":"#/$defs/ContributionScope"},"type":"array"}},"required":["id","resource","scopes","directActors","delegatedActors","autonomyCeiling","consent","risk"],"type":"object"},"PackagePermissionLevel":{"additionalProperties":false,"properties":{"actions":{"items":{"type":"string"},"type":"array"},"assignableTo":{"items":{"$ref":"#/$defs/ActorKind"},"type":"array"},"id":{"type":"string"},"includes":{"items":{"type":"string"},"type":"array"}},"required":["id","assignableTo"],"type":"object"},"PackagePresentation":{"additionalProperties":false,"description":"Package presentation metadata and content-addressed visual assets.","properties":{"assets":{"items":{"$ref":"#/$defs/PresentationAsset"},"type":"array"},"categories":{"description":"Ordered Marketplace discovery categories. Existing private/manual\\npackages may omit categories; published listings validate their own\\ndiscovery requirements before accepting a release.","items":{"$ref":"#/$defs/MiniAppCategory"},"maxItems":3,"type":"array","uniqueItems":true},"description":{"type":"string"},"iconAssets":{"default":[],"description":"Ordered parent-package icon candidates. Empty inherits every app-icon\\nfor backwards compatibility; collection packages should select their\\nparent artwork explicitly so child surfaces cannot replace it.","items":{"type":"string"},"type":"array"},"name":{"type":"string"}},"required":["name","description"],"type":"object"},"PermissionCatalogOptions":{"additionalProperties":false,"description":"A signed package-local permission catalog. These are definitions, never grants.","properties":{"actions":{"items":{"$ref":"#/$defs/PackagePermissionAction"},"type":"array"},"levels":{"items":{"$ref":"#/$defs/PackagePermissionLevel"},"type":"array"},"roleRecommendations":{"items":{"$ref":"#/$defs/RoleRecommendation"},"type":"array"}},"type":"object"},"PermissionRisk":{"enum":["read","write","consequential","financial"],"type":"string"},"PersistencePolicy":{"enum":["none","checkpoint","retained"],"type":"string"},"PresentationAsset":{"additionalProperties":false,"description":"A PNG or SVG package, publisher, or organization presentation asset.","properties":{"integrity":{"type":"string"},"mediaType":{"$ref":"#/$defs/PresentationAssetMediaType"},"path":{"type":"string"},"role":{"$ref":"#/$defs/PresentationAssetRole"},"sizes":{"items":{"type":"string"},"type":"array"},"theme":{"$ref":"#/$defs/PresentationAssetTheme","default":"any"}},"required":["role","mediaType","path","integrity"],"type":"object"},"PresentationAssetMediaType":{"enum":["image/png","image/svg+xml"],"type":"string"},"PresentationAssetRole":{"enum":["app-icon","publisher-icon","organization-icon","marketplace-card","wordmark"],"type":"string"},"PresentationAssetTheme":{"enum":["any","light","dark"],"type":"string"},"PublishedEvent":{"additionalProperties":false,"properties":{"delivery":{"$ref":"#/$defs/EventDelivery"},"name":{"type":"string"},"schema":{"type":"string"},"schemaVersion":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"visibility":{"$ref":"#/$defs/ContributionScope"}},"required":["name","schema","schemaVersion","visibility","delivery"],"type":"object"},"ReleaseIdentity":{"additionalProperties":false,"description":"Immutable release identity carried by a package descriptor.","properties":{"contentDigest":{"type":"string"},"releaseId":{"type":"string"},"version":{"type":"string"}},"required":["releaseId","version","contentDigest"],"type":"object"},"RendererOptions":{"additionalProperties":false,"properties":{"payloadSchema":{"type":["string","null"]},"protocol":{"type":"string"}},"required":["protocol"],"type":"object"},"RoleRecommendation":{"additionalProperties":false,"properties":{"actor":{"$ref":"#/$defs/ActorKind"},"level":{"type":"string"},"workspaceRole":{"type":"string"}},"required":["actor","workspaceRole","level"],"type":"object"},"RuntimeEffect":{"additionalProperties":false,"properties":{"kind":{"type":"string"},"resources":{"items":{"type":"string"},"type":"array"}},"required":["kind"],"type":"object"},"SubscribedEvent":{"additionalProperties":false,"properties":{"dependency":{"type":["string","null"]},"event":{"type":"string"},"versions":{"items":{"format":"uint16","maximum":65535,"minimum":0,"type":"integer"},"type":"array"}},"required":["event","versions"],"type":"object"},"TapPackageDescriptorV1":{"additionalProperties":false,"description":"Versioned package descriptor inspected before a remote entry is evaluated.","properties":{"$schema":{"description":"Optional JSON Schema reference for editor validation and completion.","type":["string","null"]},"compatibility":{"$ref":"#/$defs/PackageCompatibility","description":"Host and SDK compatibility requirements."},"contributions":{"description":"Statically declared contributions. Code cannot add undeclared contributions at runtime.","items":{"$ref":"#/$defs/PackageContribution"},"type":"array"},"dependencies":{"description":"Package dependencies and optional collection children.","items":{"$ref":"#/$defs/PackageDependency"},"type":"array"},"descriptorVersion":{"description":"Descriptor schema version. Version 1 is the first Federation package contract.","format":"uint16","maximum":1,"minimum":1,"type":"integer"},"events":{"$ref":"#/$defs/PackageEventCatalog","default":{},"description":"Statically declared package event catalog."},"lifecycle":{"$ref":"#/$defs/PackageLifecyclePolicy","default":{"checkpoint":"none"},"description":"Package lifecycle and checkpoint policy."},"package":{"$ref":"#/$defs/PackageIdentity","description":"Immutable package, publisher, namespace, and collection identity."},"presentation":{"$ref":"#/$defs/PackagePresentation","description":"Marketplace and host presentation metadata."},"release":{"$ref":"#/$defs/ReleaseIdentity","description":"Immutable release identity and content digest."},"targets":{"additionalProperties":false,"description":"Target-specific Module Federation containers.","properties":{"desktop":{"$ref":"#/$defs/FederationTarget"},"mobile":{"$ref":"#/$defs/FederationTarget"},"node":{"$ref":"#/$defs/FederationTarget"},"quickjs":{"$ref":"#/$defs/FederationTarget"},"worker":{"$ref":"#/$defs/FederationTarget"},"workflow-host":{"$ref":"#/$defs/FederationTarget"}},"type":"object"}},"required":["descriptorVersion","package","release","presentation","compatibility","targets","contributions"],"type":"object"},"TapRuntime":{"description":"Supported TAP miniapp runtime versions.","enum":[0,1],"type":"integer"},"TaskOptions":{"additionalProperties":false,"properties":{"canonicalStatuses":{"additionalProperties":{"type":"string"},"type":"object"},"migrationExpose":{"type":["string","null"]},"schema":{"type":"string"}},"required":["schema"],"type":"object"},"UiPlacement":{"enum":["workspace-left","channel-apps","chat-right","route","settings","dialog","standalone-window"],"type":"string"},"UiSurfaceOptions":{"additionalProperties":false,"properties":{"description":{"type":["string","null"]},"displayName":{"description":"Surface-specific label. Packages with multiple mini apps must not rely\\non the package-wide Marketplace name for every navigation entry.","type":["string","null"]},"iconAssets":{"default":[],"description":"Ordered package presentation assets eligible for this contribution.\\nEmpty inherits the package-level `presentation.iconAssets` selection.","items":{"type":"string"},"type":"array"},"instancePolicy":{"$ref":"#/$defs/InstancePolicy","default":"per-mount"},"persistence":{"$ref":"#/$defs/PersistencePolicy","default":"none"},"placement":{"$ref":"#/$defs/UiPlacement"},"scope":{"$ref":"#/$defs/ContributionScope"}},"required":["placement","scope"],"type":"object"},"WorkflowCancellationPolicy":{"description":"Cancellation behavior supported by package-provided workflows.","enum":["host-managed"],"type":"string"},"WorkflowCheckpointPolicy":{"description":"Checkpoint behavior supported by the package-contribution ABI.","enum":["none"],"type":"string"},"WorkflowExecutionSemantics":{"additionalProperties":false,"description":"Fixed v1 execution semantics for one immutable package workflow.","properties":{"cancellation":{"$ref":"#/$defs/WorkflowCancellationPolicy"},"checkpoint":{"$ref":"#/$defs/WorkflowCheckpointPolicy"},"retry":{"$ref":"#/$defs/WorkflowRetryPolicy"},"rollback":{"$ref":"#/$defs/WorkflowRollbackPolicy"},"upgrade":{"$ref":"#/$defs/WorkflowUpgradePolicy"}},"required":["retry","cancellation","checkpoint","upgrade","rollback"],"type":"object"},"WorkflowHostPort":{"description":"Narrow host port a package-provided workflow node may request.","enum":["fs","proc","http","clock","crypto","store","source"],"type":"string"},"WorkflowNodeCancellationPolicy":{"description":"Cancellation behavior supported by one package-provided node attempt.","enum":["not-supported"],"type":"string"},"WorkflowNodeEffect":{"description":"Side-effect classification for a package-provided workflow node.","enum":["pure","read","write","exec"],"type":"string"},"WorkflowNodeExecutionSemantics":{"additionalProperties":false,"description":"Fixed v1 execution semantics for one package-provided workflow node.","properties":{"cancellation":{"$ref":"#/$defs/WorkflowNodeCancellationPolicy"},"checkpoint":{"$ref":"#/$defs/WorkflowCheckpointPolicy"},"idempotency":{"$ref":"#/$defs/WorkflowNodeIdempotency"},"maxAttempts":{"format":"uint8","maximum":1,"minimum":1,"type":"integer"},"rollback":{"$ref":"#/$defs/WorkflowRollbackPolicy"},"upgrade":{"$ref":"#/$defs/WorkflowUpgradePolicy"}},"required":["maxAttempts","idempotency","cancellation","checkpoint","upgrade","rollback"],"type":"object"},"WorkflowNodeIdempotency":{"description":"Idempotency claim for the one attempt allowed by the v1 node ABI.","enum":["idempotent","non-idempotent"],"type":"string"},"WorkflowNodeOptions":{"additionalProperties":false,"description":"Exact descriptor options for a canonical `ze-workflows` contributed node.","properties":{"config":{"$ref":"#/$defs/WorkflowSchemaReference"},"effect":{"$ref":"#/$defs/WorkflowNodeEffect"},"execution":{"$ref":"#/$defs/WorkflowNodeExecutionSemantics"},"exportName":{"type":"string"},"inputs":{"items":{"$ref":"#/$defs/WorkflowPort"},"type":"array"},"nodeKind":{"type":"string"},"outcomes":{"items":{"type":"string"},"type":"array"},"outputs":{"items":{"$ref":"#/$defs/WorkflowPort"},"type":"array"},"requires":{"items":{"$ref":"#/$defs/WorkflowHostPort"},"type":"array"}},"required":["nodeKind","exportName","config","inputs","outputs","outcomes","effect","requires","execution"],"type":"object"},"WorkflowOptions":{"additionalProperties":false,"description":"Exact descriptor options for a canonical `ze-workflows` workflow.\\n\\nThe module expose and runtime remain in [`ContributionBase::targets`]; the\\npackage host combines that verified target with these inert declarations to\\nbuild the release-scoped `ze-workflows` catalog.","properties":{"exportName":{"type":"string"},"inputs":{"items":{"$ref":"#/$defs/WorkflowPort"},"type":"array"},"lifecycle":{"$ref":"#/$defs/WorkflowExecutionSemantics"},"manifest":{"$ref":"#/$defs/WorkflowSchemaReference"},"outputs":{"items":{"$ref":"#/$defs/WorkflowPort"},"type":"array"},"workflowId":{"type":"string"}},"required":["workflowId","exportName","manifest","inputs","outputs","lifecycle"],"type":"object"},"WorkflowPort":{"additionalProperties":false,"description":"One named, schema-bound workflow input or output port.","properties":{"name":{"type":"string"},"required":{"type":"boolean"},"schema":{"$ref":"#/$defs/WorkflowSchemaReference"}},"required":["name","schema","required"],"type":"object"},"WorkflowRetryPolicy":{"description":"Retry behavior supported by package-provided workflow definitions.","enum":["none"],"type":"string"},"WorkflowRollbackPolicy":{"description":"Rollback ownership for package-provided workflows and nodes.","enum":["host-managed"],"type":"string"},"WorkflowSchemaReference":{"additionalProperties":false,"description":"Exact schema identity admitted by the canonical `ze-workflows` package ABI.\\n\\n`id` is the release-relative schema asset path and `integrity` is the SRI of\\nthe canonical JSON document. The target\'s [`PackageAssetLockV1`] separately\\nbinds the raw file bytes; the package host verifies both identities before\\nit evaluates the workflow-host export.","properties":{"id":{"type":"string"},"integrity":{"type":"string"}},"required":["id","integrity"],"type":"object"},"WorkflowUpgradePolicy":{"description":"Upgrade behavior supported by immutable package workflow definitions.","enum":["restart"],"type":"string"}},"$id":"https://tap.local/schemas/manifest.tap.schema.json","$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"$ref":"#/$defs/TapPackageDescriptorV1","description":"A static TAP package descriptor, validated before its remote code is evaluated."},{"$ref":"#/$defs/MiniAppBundleManifest","description":"A single miniapp bundle with its runtime entrypoint."}],"description":"Manifest for one Tap package or legacy miniapp bundle.","title":"Tap Miniapp Manifest"}');
|
|
13
|
+
function deterministicSurfaceTestUuid(seed, frameInstanceId, counter) {
|
|
14
|
+
if (!Number.isInteger(seed) || seed < 0 || seed > 0xffffffff || 0 === frameInstanceId.length || !Number.isInteger(counter) || counter < 0 || counter > 0xffffffff) throw new Error('Invalid TAP Test Lab deterministic UUID input.');
|
|
15
|
+
const mixWord = (input)=>{
|
|
16
|
+
let value = input + 0x9e3779b9 >>> 0;
|
|
17
|
+
value = Math.imul(value ^ value >>> 16, 0x21f0aaad) >>> 0;
|
|
18
|
+
value = Math.imul(value ^ value >>> 15, 0x735a2d97) >>> 0;
|
|
19
|
+
return (value ^ value >>> 15) >>> 0;
|
|
20
|
+
};
|
|
21
|
+
let scope = 0x811c9dc5;
|
|
22
|
+
for(let index = 0; index < frameInstanceId.length; index += 1)scope = Math.imul(scope ^ frameInstanceId.charCodeAt(index), 0x01000193) >>> 0;
|
|
23
|
+
const bytes = new Uint8Array(16);
|
|
24
|
+
const view = new DataView(bytes.buffer);
|
|
25
|
+
for(let index = 0; index < 4; index += 1)view.setUint32(4 * index, mixWord((seed ^ scope ^ Math.imul(counter + 1, 0x9e3779b1) ^ Math.imul(index + 1, 0x85ebca6b)) >>> 0));
|
|
26
|
+
bytes[6] = 0x0f & bytes[6] | 0x40;
|
|
27
|
+
bytes[8] = 0x3f & bytes[8] | 0x80;
|
|
28
|
+
const hex = Array.from(bytes, (byte)=>byte.toString(16).padStart(2, '0'));
|
|
29
|
+
return hex.slice(0, 4).join('') + '-' + hex.slice(4, 6).join('') + '-' + hex.slice(6, 8).join('') + '-' + hex.slice(8, 10).join('') + '-' + hex.slice(10).join('');
|
|
30
|
+
}
|
|
12
31
|
const MAX_SVG_DEPTH = 64;
|
|
13
32
|
const MAX_SVG_ELEMENTS = 10000;
|
|
14
33
|
const MAX_SVG_ATTRIBUTES_PER_ELEMENT = 64;
|
|
@@ -315,12 +334,35 @@ const normalizeFederationOptions = (target, federation)=>{
|
|
|
315
334
|
dts: false
|
|
316
335
|
};
|
|
317
336
|
};
|
|
318
|
-
const
|
|
337
|
+
const exactEmbeddedFrameOrigins = (descriptor)=>{
|
|
338
|
+
const origins = new Set();
|
|
339
|
+
for (const contribution of descriptor.contributions ?? [])if ('ui.surface' === contribution.kind) {
|
|
340
|
+
for (const effect of contribution.authorization?.effects ?? [])if ('embedded-frame' === effect.kind) for (const resource of effect.resources ?? []){
|
|
341
|
+
let url;
|
|
342
|
+
try {
|
|
343
|
+
url = new URL(resource);
|
|
344
|
+
} catch {
|
|
345
|
+
throw new Error(`TAP UI surface ${contribution.id} embedded-frame resource "${resource}" must be an exact canonical HTTPS origin.`);
|
|
346
|
+
}
|
|
347
|
+
if ('https:' !== url.protocol || !url.hostname || url.username || url.password || url.origin !== resource) throw new Error(`TAP UI surface ${contribution.id} embedded-frame resource "${resource}" must be an exact canonical HTTPS origin.`);
|
|
348
|
+
origins.add(resource);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return [
|
|
352
|
+
...origins
|
|
353
|
+
].sort();
|
|
354
|
+
};
|
|
355
|
+
const tapFederatedSurfaceHtml = (descriptor)=>{
|
|
356
|
+
const frameSources = [
|
|
357
|
+
"'self'",
|
|
358
|
+
...exactEmbeddedFrameOrigins(descriptor)
|
|
359
|
+
].join(' ');
|
|
360
|
+
return `<!doctype html>
|
|
319
361
|
<html lang="en">
|
|
320
362
|
<head>
|
|
321
363
|
<meta charset="utf-8">
|
|
322
364
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
323
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-src
|
|
365
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-src ${frameSources}; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; form-action 'none'">
|
|
324
366
|
<title>TAP mini app</title>
|
|
325
367
|
<style>html,body,#tap-root{height:100%;width:100%;margin:0}body{overflow:hidden;background:transparent}#tap-error{box-sizing:border-box;display:none;min-height:100%;padding:24px;font:14px/1.5 system-ui,sans-serif;color:#b42318;background:#fff}</style>
|
|
326
368
|
</head>
|
|
@@ -331,7 +373,9 @@ const TAP_FEDERATED_SURFACE_HTML = `<!doctype html>
|
|
|
331
373
|
</body>
|
|
332
374
|
</html>
|
|
333
375
|
`;
|
|
376
|
+
};
|
|
334
377
|
const TAP_FEDERATED_DOCUMENT_ID_GLOBAL_KEY = JSON.stringify(MINIAPP_DOCUMENT_ID_GLOBAL_KEY);
|
|
378
|
+
const DETERMINISTIC_SURFACE_TEST_UUID_SOURCE = deterministicSurfaceTestUuid.toString();
|
|
335
379
|
const TAP_FEDERATED_SURFACE_RUNTIME = String.raw`const params = new URLSearchParams(location.search);
|
|
336
380
|
const required = (name) => {
|
|
337
381
|
const value = params.get(name)?.trim();
|
|
@@ -358,6 +402,19 @@ const optionalSafeId = (name) => {
|
|
|
358
402
|
}
|
|
359
403
|
return value;
|
|
360
404
|
};
|
|
405
|
+
const optionalUint32 = (name) => {
|
|
406
|
+
const values = params.getAll(name);
|
|
407
|
+
if (values.length === 0) return undefined;
|
|
408
|
+
const value = values[0];
|
|
409
|
+
if (
|
|
410
|
+
values.length !== 1 ||
|
|
411
|
+
!/^(?:0|[1-9]\d{0,9})$/u.test(value) ||
|
|
412
|
+
Number(value) > 0xffffffff
|
|
413
|
+
) {
|
|
414
|
+
throw new Error('Invalid federated surface unsigned integer: ' + name);
|
|
415
|
+
}
|
|
416
|
+
return Number(value);
|
|
417
|
+
};
|
|
361
418
|
const packageTarget = optionalSafeId('target');
|
|
362
419
|
if (packageTarget !== undefined && packageTarget !== 'desktop' && packageTarget !== 'mobile') {
|
|
363
420
|
throw new Error('Invalid federated surface package target.');
|
|
@@ -385,6 +442,33 @@ const instanceId = safeId('logicalInstanceId', 'instanceId');
|
|
|
385
442
|
const workspaceId = optionalSafeId('workspaceId');
|
|
386
443
|
const channelId = optionalSafeId('channelId');
|
|
387
444
|
const conversationId = optionalSafeId('conversationId');
|
|
445
|
+
const testEntropySeed = optionalUint32('testEntropySeed');
|
|
446
|
+
let testEntropyCounter = 0;
|
|
447
|
+
const deterministicTestUuid = (${DETERMINISTIC_SURFACE_TEST_UUID_SOURCE});
|
|
448
|
+
const resetSurfaceEntropy = () => {
|
|
449
|
+
testEntropyCounter = 0;
|
|
450
|
+
};
|
|
451
|
+
const entropy = Object.freeze({
|
|
452
|
+
randomUUID() {
|
|
453
|
+
if (testEntropySeed === undefined) {
|
|
454
|
+
const randomUUID = globalThis.crypto?.randomUUID;
|
|
455
|
+
if (typeof randomUUID !== 'function') {
|
|
456
|
+
throw new Error('The TAP surface runtime requires cryptographic UUID support.');
|
|
457
|
+
}
|
|
458
|
+
return randomUUID.call(globalThis.crypto);
|
|
459
|
+
}
|
|
460
|
+
if (testEntropyCounter > 0xffffffff) {
|
|
461
|
+
throw new Error('The TAP Test Lab deterministic UUID stream is exhausted.');
|
|
462
|
+
}
|
|
463
|
+
const value = deterministicTestUuid(
|
|
464
|
+
testEntropySeed,
|
|
465
|
+
frameInstanceId,
|
|
466
|
+
testEntropyCounter,
|
|
467
|
+
);
|
|
468
|
+
testEntropyCounter += 1;
|
|
469
|
+
return value;
|
|
470
|
+
},
|
|
471
|
+
});
|
|
388
472
|
const expose = required('expose');
|
|
389
473
|
if (!/^\.\/[A-Za-z0-9._/-]+$/u.test(expose) || expose.includes('..')) {
|
|
390
474
|
throw new Error('Invalid Module Federation expose.');
|
|
@@ -452,6 +536,7 @@ const MAX_CHECKPOINT_JSON_BYTES = 32 * 1024;
|
|
|
452
536
|
const MAX_STORAGE_NAMESPACE_CHARS = 128;
|
|
453
537
|
const MAX_STORAGE_KEY_CHARS = 512;
|
|
454
538
|
const MAX_STORAGE_JSON_BYTES = 5 * 1024 * 1024;
|
|
539
|
+
const MAX_SESSION_JSON_BYTES = 1_800;
|
|
455
540
|
const MAX_PRESENCE_ROOM_CHARS = 256;
|
|
456
541
|
const MAX_PRESENCE_JSON_BYTES = 16 * 1024;
|
|
457
542
|
const MAX_HTTP_REQUEST_JSON_BYTES = 11 * 1024 * 1024;
|
|
@@ -464,6 +549,8 @@ const MAX_RECEIPT_LINE_CHARS = 512;
|
|
|
464
549
|
const MAX_RECEIPT_TOTAL_CHARS = 32768;
|
|
465
550
|
const TERMINAL_GET_CAPABILITIES_ACTION = 'tap.platform.terminal.v1.get-capabilities';
|
|
466
551
|
const TERMINAL_OPEN_ACTION = 'tap.platform.terminal.v1.open';
|
|
552
|
+
const AUTHORIZATION_CHECK_ACTION = 'tap.platform.authorization.check';
|
|
553
|
+
const AUTHORIZATION_AUTONOMY_LEVELS = new Set(['listen', 'plan', 'do']);
|
|
467
554
|
const TERMINAL_PROFILES = new Set(['workspace-shell', 'neovim']);
|
|
468
555
|
const MAX_TERMINAL_WRITE_BYTES = 64 * 1024;
|
|
469
556
|
const MAX_PENDING_TERMINAL_COMMANDS = 32;
|
|
@@ -694,6 +781,36 @@ const projectResultFields = (value, fields, label) => {
|
|
|
694
781
|
}
|
|
695
782
|
return Object.freeze(projected);
|
|
696
783
|
};
|
|
784
|
+
const projectExactBooleanResult = (value, field, label) => {
|
|
785
|
+
try {
|
|
786
|
+
const prototype =
|
|
787
|
+
value && typeof value === 'object' ? Object.getPrototypeOf(value) : null;
|
|
788
|
+
if (
|
|
789
|
+
!value ||
|
|
790
|
+
typeof value !== 'object' ||
|
|
791
|
+
Array.isArray(value) ||
|
|
792
|
+
(prototype !== null &&
|
|
793
|
+
prototype !== Object.prototype &&
|
|
794
|
+
Object.getPrototypeOf(prototype) !== null)
|
|
795
|
+
) {
|
|
796
|
+
throw new Error(label + ' returned an invalid result.');
|
|
797
|
+
}
|
|
798
|
+
const keys = Reflect.ownKeys(value);
|
|
799
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, field);
|
|
800
|
+
if (
|
|
801
|
+
keys.length !== 1 ||
|
|
802
|
+
keys[0] !== field ||
|
|
803
|
+
!descriptor ||
|
|
804
|
+
!Object.prototype.hasOwnProperty.call(descriptor, 'value') ||
|
|
805
|
+
typeof descriptor.value !== 'boolean'
|
|
806
|
+
) {
|
|
807
|
+
throw new Error(label + ' returned an invalid result.');
|
|
808
|
+
}
|
|
809
|
+
return Object.freeze({ [field]: descriptor.value });
|
|
810
|
+
} catch {
|
|
811
|
+
throw new Error(label + ' returned an invalid result.');
|
|
812
|
+
}
|
|
813
|
+
};
|
|
697
814
|
const invokeSdkHostAction = (
|
|
698
815
|
action,
|
|
699
816
|
options,
|
|
@@ -736,6 +853,26 @@ const storage = Object.freeze({
|
|
|
736
853
|
return invokeSdkHostAction('tap.platform.storage.delete', options, 'app.storage.delete');
|
|
737
854
|
},
|
|
738
855
|
});
|
|
856
|
+
const session = Object.freeze({
|
|
857
|
+
get() {
|
|
858
|
+
return invokeSdkHostAction('tap.platform.session.get', {}, 'app.session.get');
|
|
859
|
+
},
|
|
860
|
+
set(value) {
|
|
861
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
862
|
+
throw new Error('app.session.set requires a JSON object.');
|
|
863
|
+
}
|
|
864
|
+
checkedPlatformJson(value, MAX_SESSION_JSON_BYTES, 'app.session.set value');
|
|
865
|
+
return invokeSdkHostAction(
|
|
866
|
+
'tap.platform.session.set',
|
|
867
|
+
{ value },
|
|
868
|
+
'app.session.set',
|
|
869
|
+
12000,
|
|
870
|
+
);
|
|
871
|
+
},
|
|
872
|
+
clear() {
|
|
873
|
+
return invokeSdkHostAction('tap.platform.session.clear', {}, 'app.session.clear');
|
|
874
|
+
},
|
|
875
|
+
});
|
|
739
876
|
const checkedPresenceAddress = (options, label) => {
|
|
740
877
|
requireOptionsObject(options, label);
|
|
741
878
|
if (!validPlatformPartition(options.namespace, MAX_STORAGE_NAMESPACE_CHARS)) {
|
|
@@ -1501,6 +1638,29 @@ const appChat = Object.freeze({
|
|
|
1501
1638
|
return invokeSdkHostAction('sendTextToChat', { text }, 'app.chat.sendTextToChat');
|
|
1502
1639
|
},
|
|
1503
1640
|
});
|
|
1641
|
+
const authorization = Object.freeze({
|
|
1642
|
+
check(options) {
|
|
1643
|
+
requireOptionsObject(options, 'app.authorization.check');
|
|
1644
|
+
if (
|
|
1645
|
+
Object.keys(options).length !== 2 ||
|
|
1646
|
+
!Object.prototype.hasOwnProperty.call(options, 'actionId') ||
|
|
1647
|
+
!Object.prototype.hasOwnProperty.call(options, 'autonomy') ||
|
|
1648
|
+
!validPlatformPartition(options.actionId, 512) ||
|
|
1649
|
+
!AUTHORIZATION_AUTONOMY_LEVELS.has(options.autonomy)
|
|
1650
|
+
) {
|
|
1651
|
+
return Promise.reject(
|
|
1652
|
+
new Error('app.authorization.check options are invalid.'),
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
1655
|
+
return invokeSdkHostAction(
|
|
1656
|
+
AUTHORIZATION_CHECK_ACTION,
|
|
1657
|
+
{ actionId: options.actionId, autonomy: options.autonomy },
|
|
1658
|
+
'app.authorization.check',
|
|
1659
|
+
).then((result) =>
|
|
1660
|
+
projectExactBooleanResult(result, 'allowed', 'app.authorization.check'),
|
|
1661
|
+
);
|
|
1662
|
+
},
|
|
1663
|
+
});
|
|
1504
1664
|
|
|
1505
1665
|
const platformAuth = Object.freeze({
|
|
1506
1666
|
getUserProfile() {
|
|
@@ -1690,8 +1850,10 @@ const miniappSdk = Object.freeze({
|
|
|
1690
1850
|
projects,
|
|
1691
1851
|
workflows,
|
|
1692
1852
|
navigation,
|
|
1853
|
+
authorization,
|
|
1693
1854
|
chat: miniappChat,
|
|
1694
1855
|
storage,
|
|
1856
|
+
session,
|
|
1695
1857
|
presence,
|
|
1696
1858
|
http,
|
|
1697
1859
|
credentials,
|
|
@@ -1765,6 +1927,7 @@ const mountSurface = async () => {
|
|
|
1765
1927
|
if (surfaceMounted) return;
|
|
1766
1928
|
const mount = uiModule?.mount ?? uiModule?.default?.mount;
|
|
1767
1929
|
if (typeof mount !== 'function') throw new Error('The UI expose must export mount(container, context).');
|
|
1930
|
+
resetSurfaceEntropy();
|
|
1768
1931
|
mounted = await mount(root, Object.freeze({
|
|
1769
1932
|
packageId,
|
|
1770
1933
|
packageNamespace,
|
|
@@ -1778,6 +1941,7 @@ const mountSurface = async () => {
|
|
|
1778
1941
|
channelId,
|
|
1779
1942
|
conversationId,
|
|
1780
1943
|
events,
|
|
1944
|
+
entropy,
|
|
1781
1945
|
hostAuthority,
|
|
1782
1946
|
}));
|
|
1783
1947
|
surfaceMounted = true;
|
|
@@ -1986,33 +2150,6 @@ window.addEventListener('pagehide', () => {
|
|
|
1986
2150
|
try { void unmountSurface(); } catch { /* page teardown is best-effort */ }
|
|
1987
2151
|
}, { once: true });
|
|
1988
2152
|
`;
|
|
1989
|
-
const isUrl = (value)=>{
|
|
1990
|
-
try {
|
|
1991
|
-
new URL(value);
|
|
1992
|
-
return true;
|
|
1993
|
-
} catch {
|
|
1994
|
-
return false;
|
|
1995
|
-
}
|
|
1996
|
-
};
|
|
1997
|
-
const registerTapManifestAjvFormats = (ajv)=>{
|
|
1998
|
-
ajv.addFormat('uri', {
|
|
1999
|
-
type: 'string',
|
|
2000
|
-
validate: isUrl
|
|
2001
|
-
});
|
|
2002
|
-
ajv.addFormat('uint8', {
|
|
2003
|
-
type: 'number',
|
|
2004
|
-
validate: (value)=>Number.isInteger(value) && value >= 0 && value <= 255
|
|
2005
|
-
});
|
|
2006
|
-
ajv.addFormat('uint16', {
|
|
2007
|
-
type: 'number',
|
|
2008
|
-
validate: (value)=>Number.isInteger(value) && value >= 0 && value <= 65535
|
|
2009
|
-
});
|
|
2010
|
-
ajv.addFormat('uint64', {
|
|
2011
|
-
type: 'number',
|
|
2012
|
-
validate: (value)=>Number.isSafeInteger(value) && value >= 0
|
|
2013
|
-
});
|
|
2014
|
-
return ajv;
|
|
2015
|
-
};
|
|
2016
2153
|
const getSchemaValidator = async ()=>{
|
|
2017
2154
|
if (!schemaValidator) {
|
|
2018
2155
|
const ajv = registerTapManifestAjvFormats(new __rspack_external_ajv_dist_2020_js_e85899db["default"]({
|
|
@@ -2079,6 +2216,14 @@ const toVersionedAssetPath = (filePath, contents)=>{
|
|
|
2079
2216
|
};
|
|
2080
2217
|
const minifyInlineCss = (css)=>css.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\s+/g, ' ').replace(/\s*([{}:;,>])\s*/g, '$1').trim();
|
|
2081
2218
|
const minifyHtml = (html)=>html.replace(/<!--(?!\[if\b)[\s\S]*?-->/gi, '').replace(/<style\b([^>]*)>([\s\S]*?)<\/style>/gi, (_tag, attrs, css)=>`<style${attrs}>${minifyInlineCss(css)}</style>`).replace(/>\s+</g, '><').replace(/\s{2,}/g, ' ').trim();
|
|
2219
|
+
const isUrl = (value)=>{
|
|
2220
|
+
try {
|
|
2221
|
+
new URL(value);
|
|
2222
|
+
return true;
|
|
2223
|
+
} catch {
|
|
2224
|
+
return false;
|
|
2225
|
+
}
|
|
2226
|
+
};
|
|
2082
2227
|
const toBuffer = (source)=>Buffer.isBuffer(source) ? source : Buffer.from(source);
|
|
2083
2228
|
const isBundleManifest = (manifest)=>'entry' in manifest;
|
|
2084
2229
|
const isPackageManifest = (manifest)=>"descriptorVersion" in manifest && 1 === manifest.descriptorVersion;
|
|
@@ -3116,7 +3261,7 @@ const setupFederatedTapPackage = (api, options, manifestPath)=>{
|
|
|
3116
3261
|
if (Object.values(target.exposes).some((expose)=>'webview' === expose.runtime)) for (const [assetPath, contents] of [
|
|
3117
3262
|
[
|
|
3118
3263
|
TAP_FEDERATED_SURFACE_HTML_PATH,
|
|
3119
|
-
|
|
3264
|
+
tapFederatedSurfaceHtml(descriptor)
|
|
3120
3265
|
],
|
|
3121
3266
|
[
|
|
3122
3267
|
TAP_FEDERATED_SURFACE_RUNTIME_PATH,
|
|
@@ -3515,4 +3660,5 @@ const tapLib = (options = {})=>{
|
|
|
3515
3660
|
]
|
|
3516
3661
|
};
|
|
3517
3662
|
};
|
|
3518
|
-
export {
|
|
3663
|
+
export { registerTapManifestAjvFormats } from "../internal/json-schema.js";
|
|
3664
|
+
export { assembleTapPackage, assertPortableTapPackageArtifacts, pluginTap, tapLib };
|
package/dist/sdk.d.ts
CHANGED
|
@@ -98,6 +98,29 @@ export declare type MiniAppAuthApi = {
|
|
|
98
98
|
getUserProfile(): MiniAppMaybePromise<MiniAppUserProfile | null>;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Read-only authorization introspection for custom surface behavior.
|
|
103
|
+
*
|
|
104
|
+
* The host rejects action IDs that are not declared by the exact mounted
|
|
105
|
+
* surface. A declared action resolves to the current dynamic allow/deny
|
|
106
|
+
* decision without executing the action.
|
|
107
|
+
*/
|
|
108
|
+
export declare type MiniAppAuthorizationApi = {
|
|
109
|
+
check(options: MiniAppAuthorizationCheckOptions): Promise<MiniAppAuthorizationCheckResult>;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/** Canonical autonomy requested for one descriptor-declared package action. */
|
|
113
|
+
export declare type MiniAppAuthorizationAutonomy = 'listen' | 'plan' | 'do';
|
|
114
|
+
|
|
115
|
+
export declare type MiniAppAuthorizationCheckOptions = {
|
|
116
|
+
actionId: string;
|
|
117
|
+
autonomy: MiniAppAuthorizationAutonomy;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export declare type MiniAppAuthorizationCheckResult = {
|
|
121
|
+
allowed: boolean;
|
|
122
|
+
};
|
|
123
|
+
|
|
101
124
|
/**
|
|
102
125
|
* @capability miniapp-platform
|
|
103
126
|
*/
|
|
@@ -317,8 +340,10 @@ export declare type MiniAppPlatformApi = {
|
|
|
317
340
|
navigation: {
|
|
318
341
|
open(options: OpenNavigationOptions): void | Promise<void>;
|
|
319
342
|
};
|
|
343
|
+
authorization: MiniAppAuthorizationApi;
|
|
320
344
|
chat: MiniAppChatApi;
|
|
321
345
|
storage: MiniAppStorageApi;
|
|
346
|
+
session: MiniAppSessionApi;
|
|
322
347
|
presence: MiniAppPresenceApi;
|
|
323
348
|
/** Desktop host capability; feature-detect before use on portable targets. */
|
|
324
349
|
http?: MiniAppHttpApi;
|
|
@@ -478,6 +503,31 @@ export declare type MiniAppReceiptTextAlignment = 'left' | 'center' | 'right';
|
|
|
478
503
|
|
|
479
504
|
export declare type MiniAppReceiptTextWeight = 'normal' | 'bold';
|
|
480
505
|
|
|
506
|
+
/**
|
|
507
|
+
* Secure session storage backed by the operating system credential store.
|
|
508
|
+
*
|
|
509
|
+
* The host derives the signed-in TAP account, active workspace, installation,
|
|
510
|
+
* and package from the authenticated frame. Channel, surface, document, and
|
|
511
|
+
* release are deliberately excluded, so every surface of one installed
|
|
512
|
+
* miniapp shares the same session only within a workspace and package updates
|
|
513
|
+
* retain it. Unlike host-managed HTTP credentials, values returned here enter
|
|
514
|
+
* miniapp JavaScript.
|
|
515
|
+
*/
|
|
516
|
+
export declare type MiniAppSessionApi = {
|
|
517
|
+
get(): MiniAppMaybePromise<MiniAppSessionEntry>;
|
|
518
|
+
set(value: MiniAppSessionValue): MiniAppMaybePromise<void>;
|
|
519
|
+
clear(): MiniAppMaybePromise<void>;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
export declare type MiniAppSessionEntry = {
|
|
523
|
+
/** Null means that no session value currently exists for this installation. */
|
|
524
|
+
value: MiniAppSessionValue | null;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export declare type MiniAppSessionValue = {
|
|
528
|
+
[key: string]: MiniAppJsonValue;
|
|
529
|
+
};
|
|
530
|
+
|
|
481
531
|
export declare type MiniAppSpecialistApi = {
|
|
482
532
|
joinToChannel(channelId: string, specialistId: string): MiniAppMaybePromise<string>;
|
|
483
533
|
listWorkspace(workspaceId: string): MiniAppMaybePromise<MiniAppSpecialistSummary[]>;
|