@hyprcart/app-manifest 1.0.0 → 1.0.2
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/LICENSE +21 -0
- package/dist/index.d.ts +556 -4
- package/dist/index.js +776 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -4
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema.ts","../src/validation.ts","../src/contract-generation.ts","../src/compatibility.ts","../src/ide-metadata.ts","../src/operation-metadata.ts"],"sourcesContent":["export const supportedSurfaces = [\n \"storefront_block\",\n \"admin_surface\",\n \"checkout_ui\",\n \"checkout_function\",\n \"pixel\",\n \"event\",\n \"flow\",\n \"mcp\",\n] as const;\n\nexport type AppSurfaceKind = (typeof supportedSurfaces)[number];\n\nexport type LocaleMessages = Record<string, string>;\n\nexport interface AppManifestSurface {\n id: string;\n type: AppSurfaceKind;\n entry: string;\n label: Record<string, string>;\n settings?: unknown[];\n scopes?: string[];\n deployable?: boolean;\n}\n\nexport interface AppManifest {\n id?: string;\n name: string;\n version: string;\n manifestVersion: string;\n sdkVersion: string;\n platformCompatibility: string;\n surfaces: AppManifestSurface[];\n scopes: string[];\n translations: Record<string, LocaleMessages>;\n egress?: string[];\n resources?: {\n bundleSizeBytes?: number;\n cpuMs?: number;\n memoryMb?: number;\n };\n}\n\nexport const defaultRequiredLocales = [\"en\", \"de\"] as const;\n\nexport function isSupportedSurface(value: string): value is AppSurfaceKind {\n return supportedSurfaces.includes(value as AppSurfaceKind);\n}\n","import {\n defaultRequiredLocales,\n type AppManifest,\n type AppSurfaceKind,\n isSupportedSurface,\n} from \"./schema\";\n\nexport type ValidationSeverity = \"info\" | \"warning\" | \"error\" | \"blocker\";\n\nexport interface ValidationIssue {\n code: string;\n severity: ValidationSeverity;\n path: string;\n message: string;\n suggestedFix?: string;\n docsUrl?: string;\n}\n\nexport interface ScopeImpact {\n scope: string;\n action: \"added\" | \"removed\" | \"unchanged\";\n dataClass: string;\n approvalRequired: boolean;\n reason: string;\n}\n\nexport interface TranslationGap {\n locale: string;\n key: string;\n surface: AppSurfaceKind;\n}\n\nexport interface TranslationStatus {\n requiredLocales: string[];\n completeLocales: string[];\n missing: TranslationGap[];\n}\n\nexport interface ValidationResult {\n status: \"valid\" | \"warning\" | \"invalid\";\n manifestHash: string;\n issues: ValidationIssue[];\n scopeImpact: ScopeImpact[];\n translationStatus: TranslationStatus;\n}\n\nexport interface ValidationOptions {\n requiredLocales?: string[];\n maxBundleSizeBytes?: number;\n supportedSdkMajor?: number;\n}\n\nconst riskyDependencyPatterns = [/child_process/i, /node:fs/i, /eval\\(/i];\n\nexport function validateManifest(\n manifest: AppManifest,\n options: ValidationOptions = {},\n): ValidationResult {\n const requiredLocales = options.requiredLocales ?? [...defaultRequiredLocales];\n const maxBundleSizeBytes = options.maxBundleSizeBytes ?? 512 * 1024;\n const supportedSdkMajor = options.supportedSdkMajor ?? 1;\n const issues: ValidationIssue[] = [];\n\n if (!manifest.name?.trim()) {\n issues.push(issue(\"manifest.name.missing\", \"blocker\", \"name\", \"App name is required.\"));\n }\n\n if (!manifest.manifestVersion?.trim()) {\n issues.push(issue(\"manifest.version.missing\", \"blocker\", \"manifestVersion\", \"Manifest version is required.\"));\n }\n\n if (!manifest.sdkVersion?.trim()) {\n issues.push(issue(\"sdk.version.missing\", \"blocker\", \"sdkVersion\", \"SDK version is required.\"));\n } else if (!isCompatibleSdk(manifest.sdkVersion, supportedSdkMajor)) {\n issues.push(\n issue(\n \"sdk.version.unsupported\",\n \"blocker\",\n \"sdkVersion\",\n `SDK version ${manifest.sdkVersion} is not compatible with this platform.`,\n \"Upgrade the app SDK and regenerate contracts.\",\n \"https://developer.hyprcart.com/docs/app-platform/sdk\",\n ),\n );\n }\n\n if (!Array.isArray(manifest.surfaces) || manifest.surfaces.length === 0) {\n issues.push(issue(\"surfaces.missing\", \"blocker\", \"surfaces\", \"At least one app surface is required.\"));\n }\n\n manifest.surfaces?.forEach((surface, index) => {\n const basePath = `surfaces.${index}`;\n if (!surface.id?.trim()) {\n issues.push(issue(\"surface.id.missing\", \"error\", `${basePath}.id`, \"Surface id is required.\"));\n }\n if (!isSupportedSurface(surface.type)) {\n issues.push(issue(\"surface.type.unsupported\", \"blocker\", `${basePath}.type`, `Unsupported surface type: ${surface.type}`));\n }\n if (!surface.entry?.trim()) {\n issues.push(issue(\"surface.entry.missing\", \"error\", `${basePath}.entry`, \"Surface entry file is required.\"));\n }\n if (surface.deployable === false) {\n issues.push(\n issue(\n \"surface.deferred\",\n \"warning\",\n `${basePath}.deployable`,\n \"This surface is marked as preview-only and will not be deployed.\",\n \"Remove the surface or mark it deployable when the platform supports it.\",\n ),\n );\n }\n });\n\n const translationStatus = getTranslationStatus(manifest, requiredLocales);\n for (const gap of translationStatus.missing) {\n issues.push(\n issue(\n \"validation.translation.missing\",\n gap.surface === \"storefront_block\" ? \"error\" : \"warning\",\n `translations.${gap.locale}.${gap.key}`,\n `Missing ${gap.locale} translation for ${gap.key}.`,\n \"Add the missing locale key before deployment.\",\n \"https://developer.hyprcart.com/docs/app-platform/translations\",\n ),\n );\n }\n\n if ((manifest.resources?.bundleSizeBytes ?? 0) > maxBundleSizeBytes) {\n issues.push(\n issue(\n \"bundle.size.exceeded\",\n \"blocker\",\n \"resources.bundleSizeBytes\",\n `Bundle size exceeds ${maxBundleSizeBytes} bytes.`,\n \"Remove unused dependencies or split the app surface.\",\n ),\n );\n }\n\n for (const domain of manifest.egress ?? []) {\n if (!domain.startsWith(\"https://\")) {\n issues.push(issue(\"egress.domain.invalid\", \"blocker\", \"egress\", \"Egress domains must use https.\"));\n }\n if (riskyDependencyPatterns.some((pattern) => pattern.test(domain))) {\n issues.push(issue(\"egress.domain.risky\", \"blocker\", \"egress\", \"Egress declaration contains risky content.\"));\n }\n }\n\n const blocker = issues.some((entry) => entry.severity === \"blocker\" || entry.severity === \"error\");\n const warning = issues.some((entry) => entry.severity === \"warning\");\n\n return {\n status: blocker ? \"invalid\" : warning ? \"warning\" : \"valid\",\n manifestHash: hashObject(manifest),\n issues,\n scopeImpact: (manifest.scopes ?? []).map((scope) => ({\n scope,\n action: \"added\",\n dataClass: classifyScope(scope),\n approvalRequired: scope.includes(\"write\") || scope.includes(\"customer\"),\n reason: \"Declared by app manifest.\",\n })),\n translationStatus,\n };\n}\n\nexport function getTranslationStatus(manifest: AppManifest, requiredLocales: string[]): TranslationStatus {\n const missing: TranslationGap[] = [];\n const completeLocales: string[] = [];\n\n for (const locale of requiredLocales) {\n const messages = manifest.translations?.[locale] ?? {};\n const before = missing.length;\n for (const surface of manifest.surfaces ?? []) {\n const labelKey = `${surface.id}.label`;\n if (!messages[labelKey]) {\n missing.push({ locale, key: labelKey, surface: surface.type });\n }\n }\n if (missing.length === before) {\n completeLocales.push(locale);\n }\n }\n\n return { requiredLocales, completeLocales, missing };\n}\n\nfunction issue(\n code: string,\n severity: ValidationSeverity,\n path: string,\n message: string,\n suggestedFix?: string,\n docsUrl?: string,\n): ValidationIssue {\n return { code, severity, path, message, suggestedFix, docsUrl };\n}\n\nfunction classifyScope(scope: string): string {\n if (scope.includes(\"customer\")) return \"customer\";\n if (scope.includes(\"order\")) return \"order\";\n if (scope.includes(\"product\")) return \"product\";\n return \"standard\";\n}\n\nfunction isCompatibleSdk(version: string, supportedMajor: number): boolean {\n const major = Number(version.split(\".\")[0]);\n return Number.isFinite(major) && major === supportedMajor;\n}\n\nfunction hashObject(value: unknown): string {\n const json = JSON.stringify(value, Object.keys(value as Record<string, unknown>).sort());\n let hash = 0;\n for (let index = 0; index < json.length; index += 1) {\n hash = (hash * 31 + json.charCodeAt(index)) >>> 0;\n }\n return `mf_${hash.toString(16).padStart(8, \"0\")}`;\n}\n","import type { AppManifest, AppManifestSurface } from \"./schema\";\n\nexport interface GeneratedContractFile {\n path: string;\n content: string;\n purpose: string;\n}\n\nexport interface ContractGenerationResult {\n manifestHash: string;\n schemaVersion: string;\n sdkVersion: string;\n files: GeneratedContractFile[];\n}\n\nexport function generateContracts(manifest: AppManifest, schemaVersion = \"2026-06-06\"): ContractGenerationResult {\n const surfaces = manifest.surfaces.map(renderSurfaceContract).join(\"\\n\\n\");\n const content = [\n \"/* Generated by Hyprcart app tooling. */\",\n `export const schemaVersion = ${JSON.stringify(schemaVersion)};`,\n `export const sdkVersion = ${JSON.stringify(manifest.sdkVersion)};`,\n surfaces,\n ].join(\"\\n\");\n\n return {\n manifestHash: stableHash(JSON.stringify(manifest)),\n schemaVersion,\n sdkVersion: manifest.sdkVersion,\n files: [\n {\n path: \"generated/hyprcart.contracts.ts\",\n content,\n purpose: \"typed surface contracts\",\n },\n ],\n };\n}\n\nfunction renderSurfaceContract(surface: AppManifestSurface): string {\n const name = toPascalCase(surface.id);\n return [\n `export interface ${name}Input {`,\n ` surface: ${JSON.stringify(surface.type)};`,\n \" context: Record<string, unknown>;\",\n \"}\",\n `export interface ${name}Output {`,\n \" html?: string;\",\n \" data?: Record<string, unknown>;\",\n \" events?: Array<Record<string, unknown>>;\",\n \"}\",\n `export const ${name}Contract = {`,\n ` id: ${JSON.stringify(surface.id)},`,\n ` type: ${JSON.stringify(surface.type)},`,\n ` entry: ${JSON.stringify(surface.entry)},`,\n ` scopes: ${JSON.stringify(surface.scopes ?? [])}`,\n \"} as const;\",\n ].join(\"\\n\");\n}\n\nfunction toPascalCase(value: string): string {\n return value\n .replace(/[^a-zA-Z0-9]+/g, \" \")\n .split(\" \")\n .filter(Boolean)\n .map((part) => `${part[0]?.toUpperCase() ?? \"\"}${part.slice(1)}`)\n .join(\"\");\n}\n\nfunction stableHash(value: string): string {\n let hash = 5381;\n for (let index = 0; index < value.length; index += 1) {\n hash = (hash * 33) ^ value.charCodeAt(index);\n }\n return `ct_${(hash >>> 0).toString(16).padStart(8, \"0\")}`;\n}\n","export interface CompatibilityResult {\n ok: boolean;\n code?: string;\n message?: string;\n docsUrl?: string;\n}\n\nexport function checkCompatibility(input: {\n cliVersion?: string;\n sdkVersion: string;\n platformVersion: string;\n requiredSdkMajor?: number;\n}): CompatibilityResult {\n const requiredSdkMajor = input.requiredSdkMajor ?? 1;\n const sdkMajor = Number(input.sdkVersion.split(\".\")[0]);\n\n if (!Number.isFinite(sdkMajor) || sdkMajor !== requiredSdkMajor) {\n return {\n ok: false,\n code: \"sdk.version.unsupported\",\n message: `SDK ${input.sdkVersion} is not compatible with platform ${input.platformVersion}.`,\n docsUrl: \"https://developer.hyprcart.com/docs/app-platform/sdk\",\n };\n }\n\n return { ok: true };\n}\n","import type { AppManifest } from \"./schema\";\nimport { generateContracts } from \"./contract-generation\";\nimport { validateManifest } from \"./validation\";\n\nexport function generateIdeMetadata(manifest: AppManifest) {\n const validation = validateManifest(manifest);\n const contracts = generateContracts(manifest);\n\n return {\n schemaVersion: contracts.schemaVersion,\n platformVersion: manifest.platformCompatibility,\n surfaceContracts: manifest.surfaces.map((surface) => ({\n surface: surface.type,\n inputTypeName: `${surface.id}Input`,\n outputTypeName: `${surface.id}Output`,\n fixtureTypeName: `${surface.id}Fixture`,\n scopes: surface.scopes ?? [],\n })),\n scopeWarnings: validation.scopeImpact,\n translationRequirements: validation.translationStatus,\n docsUrls: [\"https://developer.hyprcart.com/docs/app-platform/manifest\"],\n };\n}\n","export const developerToolingOperationMetadata = [\n {\n operationName: \"validateAppProject\",\n scopes: [\"app.validation:run\"],\n dataClass: \"developer_app\",\n costClass: \"standard\",\n idempotent: true,\n lifecycleEvents: [\"developer_tooling.validation_requested\"],\n docsStatus: \"public\",\n stability: \"preview\",\n },\n {\n operationName: \"requestDeveloperDeployment\",\n scopes: [\"app.deployment:write\"],\n dataClass: \"developer_app\",\n costClass: \"elevated\",\n idempotent: true,\n lifecycleEvents: [\"developer_tooling.deployment_requested\"],\n docsStatus: \"public\",\n stability: \"preview\",\n },\n] as const;\n"],"mappings":";AAAO,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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QAAM,YAAY,kBAAkB,QAAQ;AAE5C,SAAO;AAAA,IACL,eAAe,UAAU;AAAA,IACzB,iBAAiB,SAAS;AAAA,IAC1B,kBAAkB,SAAS,SAAS,IAAI,CAAC,aAAa;AAAA,MACpD,SAAS,QAAQ;AAAA,MACjB,eAAe,GAAG,QAAQ,EAAE;AAAA,MAC5B,gBAAgB,GAAG,QAAQ,EAAE;AAAA,MAC7B,iBAAiB,GAAG,QAAQ,EAAE;AAAA,MAC9B,QAAQ,QAAQ,UAAU,CAAC;AAAA,IAC7B,EAAE;AAAA,IACF,eAAe,WAAW;AAAA,IAC1B,yBAAyB,WAAW;AAAA,IACpC,UAAU,CAAC,2DAA2D;AAAA,EACxE;AACF;;;ACtBO,IAAM,oCAAoC;AAAA,EAC/C;AAAA,IACE,eAAe;AAAA,IACf,QAAQ,CAAC,oBAAoB;AAAA,IAC7B,WAAW;AAAA,IACX,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,iBAAiB,CAAC,wCAAwC;AAAA,IAC1D,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,eAAe;AAAA,IACf,QAAQ,CAAC,sBAAsB;AAAA,IAC/B,WAAW;AAAA,IACX,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,iBAAiB,CAAC,wCAAwC;AAAA,IAC1D,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts","../src/customer-privacy/privacy-manifest.ts","../src/surface-contracts.ts","../src/validation.ts","../src/contract-generation.ts","../src/compatibility.ts","../src/ide-metadata.ts","../src/operation-metadata.ts","../src/admin-component-kit.ts","../src/capability-declarations.ts","../src/ai-mcp-metadata.ts","../src/launch-readiness.ts","../src/preview-validation.ts"],"sourcesContent":["import type { PrivacyManifest } from \"./customer-privacy/privacy-manifest\";\n\nexport const supportedSurfaces = [\n \"storefront_block\",\n \"admin_surface\",\n \"checkout_ui\",\n \"deterministic_function\",\n \"checkout_function\",\n \"pixel\",\n \"event_subscription\",\n \"background_job\",\n \"event\",\n \"flow\",\n \"mcp\",\n] as const;\n\nexport type AppSurfaceKind = (typeof supportedSurfaces)[number];\n\nexport const storefrontBlockRenderTiers = [\"static\", \"edge_render\", \"edge_stream\"] as const;\nexport type StorefrontBlockRenderTier = (typeof storefrontBlockRenderTiers)[number];\n\nexport const legacyStorefrontBlockRenderTiers = [\"edge-function\", \"edge-stream\"] as const;\nexport type LegacyStorefrontBlockRenderTier = (typeof legacyStorefrontBlockRenderTiers)[number];\n\nexport const hydrationTriggers = [\"load\", \"visible\", \"interaction\", \"idle\", \"manual\"] as const;\nexport type HydrationTrigger = (typeof hydrationTriggers)[number];\n\nexport type LocaleMessages = Record<string, string>;\n\nexport interface AppSurfaceSetting {\n name: string;\n type: \"string\" | \"number\" | \"boolean\" | \"select\" | \"color\" | \"text\" | \"rich_text\";\n label?: Record<string, string> | string;\n default?: unknown;\n required?: boolean;\n options?: Array<{ label: Record<string, string> | string; value: string }>;\n min?: number;\n max?: number;\n}\n\nexport interface StorefrontBlockPlaceholder {\n width: string;\n height: string;\n skeleton: \"list\" | \"card\" | \"text\" | \"custom\";\n timeoutMs?: number;\n}\n\nexport interface StorefrontBlockClientIsland {\n artifactId: string;\n bundleUrl?: string;\n compressedSizeBytes: number;\n hydrationTrigger: HydrationTrigger;\n domBoundarySelector: string;\n consentCategory?: string;\n exceptionId?: string;\n}\n\nexport interface AppManifestSurface {\n id: string;\n type: AppSurfaceKind;\n entry: string;\n label: Record<string, string>;\n adminSurfaceType?:\n | \"app_home\"\n | \"settings_page\"\n | \"dashboard_widget\"\n | \"resource_panel\"\n | \"resource_action\"\n | \"bulk_action\"\n | \"command_palette_action\"\n | \"global_search_contribution\"\n | \"notification_task_contribution\"\n | \"modal_action\"\n | \"admin_ui_block\";\n settings?: AppSurfaceSetting[];\n scopes?: string[];\n roles?: string[];\n deployable?: boolean;\n renderTier?: StorefrontBlockRenderTier | LegacyStorefrontBlockRenderTier;\n tier?: StorefrontBlockRenderTier | LegacyStorefrontBlockRenderTier;\n category?: string;\n compatiblePageTypes?: string[];\n compatibleSlots?: string[];\n requiredContexts?: string[];\n cache?: {\n maxAgeSeconds?: number;\n staleWhileRevalidateSeconds?: number;\n tags?: string[];\n vary?: string[];\n };\n placeholder?: StorefrontBlockPlaceholder;\n fallbackPolicy?: \"omit_block\" | \"static_placeholder\" | \"previous_healthy\" | \"none\";\n clientIslands?: StorefrontBlockClientIsland[];\n placement?: string | string[];\n inputSchema?: Record<string, unknown>;\n outputSchema?: Record<string, unknown>;\n sandboxPolicy?: Record<string, unknown>;\n componentKit?: {\n minVersion: string;\n components: string[];\n };\n removalBehavior?: string[];\n dimensions?: Record<string, unknown>;\n dataRequirements?: Record<string, unknown>;\n consent?: {\n category?: string;\n events?: string[];\n destinations?: string[];\n retentionDays?: number;\n regions?: string[];\n fields?: string[];\n bypass?: boolean;\n };\n determinism?: {\n networkAccess?: boolean;\n mutationSideEffects?: boolean;\n operations?: string[];\n };\n schedule?: Record<string, unknown>;\n retryPolicy?: Record<string, unknown>;\n overlapPolicy?: string;\n checkpointPolicy?: Record<string, unknown>;\n quotaClass?: string;\n}\n\nexport interface AppManifest {\n id?: string;\n name: string;\n version: string;\n manifestVersion: string;\n sdkVersion: string;\n platformCompatibility: string;\n surfaces: AppManifestSurface[];\n scopes: string[];\n translations: Record<string, LocaleMessages>;\n customerPrivacy?: PrivacyManifest;\n launch?: LaunchReadinessDeclaration;\n fixedSlots?: FixedSlotManifestDeclaration[];\n storefrontTranslations?: StorefrontTranslationManifestDeclaration;\n certification?: AppCertificationManifestDeclaration;\n egress?: string[];\n resources?: {\n bundleSizeBytes?: number;\n cpuMs?: number;\n memoryMb?: number;\n };\n}\n\nexport interface LaunchReadinessDeclaration {\n adminApi?: LaunchAdminApiDeclaration;\n appData?: LaunchAppDataDeclaration[];\n environments?: LaunchEnvironmentDeclaration[];\n secrets?: LaunchSecretDeclaration[];\n settings?: LaunchMerchantSettingDeclaration[];\n consent?: LaunchConsentMetadataDeclaration;\n lifecycleCallbacks?: LaunchLifecycleCallbackDeclaration[];\n assets?: LaunchAssetDeclaration[];\n sandbox?: LaunchSandboxFixtureDeclaration;\n evidence?: LaunchEvidenceDeclaration;\n compatibility?: LaunchCompatibilityDeclaration;\n}\n\nexport interface LaunchAdminApiDeclaration {\n minApiVersion: string;\n operations: Array<{\n operationName: string;\n mode: \"offline_app_token\" | \"online_app_user_token\";\n requiredScopes: string[];\n idempotencyKeyRequired?: boolean;\n expectedCostClass?: string;\n examples?: string[];\n }>;\n}\n\nexport interface LaunchAppDataDeclaration {\n namespace: string;\n labelKey: string;\n purposeKey: string;\n visibility: \"private\" | \"merchant_visible\" | \"storefront_public\";\n retentionPolicyKey: string;\n storefrontMaterialization?: {\n enabled: boolean;\n fields: string[];\n cacheTags: string[];\n varyBy: string[];\n maxAgeSeconds?: number;\n };\n migrations?: Array<{\n key: string;\n idempotent: boolean;\n rollbackPolicy?: Record<string, unknown>;\n }>;\n}\n\nexport interface LaunchEnvironmentDeclaration {\n key: \"development\" | \"staging\" | \"production\";\n labelKey: string;\n runtimeChannel: \"preview\" | \"private\" | \"production\";\n promotionRequiresCertification: boolean;\n requiredSecrets: string[];\n optionalSecrets?: string[];\n allowedInstallModes: Array<\"sandbox\" | \"private_install\">;\n}\n\nexport interface LaunchSecretDeclaration {\n key: string;\n labelKey: string;\n purposeKey: string;\n required: boolean;\n scope: \"app_environment\" | \"installation\" | \"storefront\" | \"market\" | \"locale\";\n runtimeExposure: \"runtime_only\" | \"server_callback_only\" | \"not_exposed\";\n rotation?: {\n overlapSeconds?: number;\n requiredBeforePromotion?: boolean;\n };\n}\n\nexport interface LaunchMerchantSettingDeclaration {\n key: string;\n label: Record<string, string>;\n helpText?: Record<string, string>;\n scope: Array<\"organization\" | \"storefront\" | \"market\" | \"locale\" | \"role\" | \"resource\">;\n fields: AppSurfaceSetting[];\n}\n\nexport interface LaunchConsentMetadataDeclaration {\n appIcon: string;\n screenshots: string[];\n developerName: string;\n supportUrl: string;\n supportEmail?: string;\n privacyPolicyUrl: string;\n termsUrl: string;\n dataProcessingUrl?: string;\n dataCategories: string[];\n egressDestinations: string[];\n reviewerInstructions: string;\n}\n\nexport interface LaunchLifecycleCallbackDeclaration {\n event: \"install\" | \"update\" | \"uninstall\" | \"disable\" | \"enable\" | \"scope_change\" | \"secret_rotation\" | \"settings_change\" | \"data_export\" | \"data_delete\" | \"version_promotion\";\n endpoint: string;\n signingSecretRef: string;\n idempotencyWindowSeconds: number;\n}\n\nexport interface LaunchAssetDeclaration {\n key: string;\n kind: \"icon\" | \"screenshot\" | \"admin_media\" | \"storefront_asset\" | \"email_media\" | \"reviewer_instruction_media\";\n source: string;\n locale?: string;\n cacheMaxAgeSeconds?: number;\n}\n\nexport interface LaunchSandboxFixtureDeclaration {\n fixturePackId: string;\n seedVersion: string;\n anonymizationRequired: boolean;\n testModeIntegrations: string[];\n}\n\nexport interface LaunchEvidenceDeclaration {\n repositoryUrl?: string;\n testCommand: string;\n buildCommand: string;\n playwrightCoverage: string[];\n}\n\nexport interface LaunchCompatibilityDeclaration {\n adminApiVersion: string;\n appDataApiVersion: string;\n runtimeVersion: string;\n sdkVersion: string;\n componentKitVersion: string;\n}\n\nexport interface FixedSlotManifestDeclaration {\n pageType: \"product\" | \"collection\" | \"cart\" | \"checkout\" | \"customer_profile\" | \"customer_account\" | \"order_detail\" | \"app_landing\";\n slotKey: string;\n blockIds: string[];\n settingsSchema: AppSurfaceSetting[];\n cachePolicy: {\n privateData: \"never_shared_html\" | \"not_applicable\";\n tags: string[];\n varyBy: string[];\n };\n previewMode: \"safe_sample_buyer\" | \"public_only\";\n}\n\nexport interface StorefrontTranslationManifestDeclaration {\n defaultLocale: string;\n requiredLocales: string[];\n keys: Array<{\n key: string;\n description: string;\n defaults: Record<string, string>;\n }>;\n fallback: {\n mode: \"locale_then_default\" | \"default_only\";\n missingKeyBehavior: \"block_release\" | \"use_key\";\n };\n}\n\nexport interface AppCertificationManifestDeclaration {\n requiredEvidence: string[];\n playwrightCoverage: string[];\n performanceBudgets: {\n storefrontP95Ms: number;\n checkoutP95Ms: number;\n cacheHitRatio: number;\n };\n gapPolicy: {\n blockOnOpenRequiredGaps: boolean;\n requireNonLoyaltyEvidence: boolean;\n };\n}\n\nexport const defaultRequiredLocales = [\"en\", \"de\"] as const;\n\nexport function isSupportedSurface(value: string): value is AppSurfaceKind {\n return supportedSurfaces.includes(value as AppSurfaceKind);\n}\n\nexport function normalizeStorefrontBlockRenderTier(value: string | undefined): StorefrontBlockRenderTier {\n if (value === \"edge-function\") return \"edge_render\";\n if (value === \"edge-stream\") return \"edge_stream\";\n if (storefrontBlockRenderTiers.includes(value as StorefrontBlockRenderTier)) return value as StorefrontBlockRenderTier;\n return \"static\";\n}\n","import * as z from \"zod\";\nimport { en } from \"zod/locales\";\n\nz.config(en());\n\nconst key = z\n .string()\n .min(1)\n .max(120)\n .regex(/^[a-zA-Z0-9._:-]+$/);\nconst messageKey = z\n .string()\n .min(1)\n .max(160)\n .regex(/^[a-zA-Z0-9._-]+$/);\nconst safeEndpoint = z\n .string()\n .url()\n .refine((value) => {\n return value.startsWith(\"https://\") && !/^https:\\/\\/[^/]*@/u.test(value);\n }, \"privacy.endpoint.invalid\");\n\nconst terminalAccessSchema = z\n .object({\n type: z.enum([\n \"cookie\",\n \"local_storage\",\n \"session_storage\",\n \"indexed_db\",\n \"cache_storage\",\n \"device_access\",\n \"memory\",\n ]),\n key,\n durationSeconds: z.number().int().nonnegative().max(315_576_000).nullable(),\n removable: z.boolean(),\n })\n .strict();\n\nconst recipientSchema = z\n .object({\n id: key,\n endpoint: safeEndpoint,\n retentionDays: z.number().int().nonnegative().max(3_650),\n })\n .strict();\n\nconst boundedOperationSchema = z\n .object({\n id: key,\n eventClasses: z.array(key).min(1).max(100),\n fieldKeys: z.array(key).min(1).max(100),\n limits: z\n .object({\n eventCount: z.number().int().positive().max(10_000),\n byteCount: z.number().int().positive().max(10_000_000),\n maximumAgeSeconds: z.number().int().positive().max(86_400),\n })\n .strict(),\n cleanupTriggers: z.array(key).min(1).max(32),\n })\n .strict();\n\nexport const privacyManifestCapabilitySchema = z\n .object({\n key,\n type: z.enum([\n \"app_block\",\n \"client_island\",\n \"checkout_extension\",\n \"pixel\",\n \"server_event\",\n \"background_delivery\",\n \"analytics_destination\",\n \"platform_feature\",\n ]),\n purposes: z.array(key).min(1).max(16),\n dataCategories: z.array(key).min(1).max(32),\n terminalAccess: z.array(terminalAccessSchema).max(32),\n recipients: z.array(recipientSchema).max(32),\n boundedOperations: z.array(boundedOperationSchema).max(16).optional(),\n regions: z.array(z.string().min(1).max(16)).min(1).max(64),\n fallbackMessageKey: messageKey,\n cleanup: z\n .object({\n supported: z.boolean(),\n callback: key.nullable().optional(),\n })\n .strict(),\n exportSupport: z.enum([\"supported\", \"unsupported\", \"not_applicable\"]),\n erasureSupport: z.enum([\"supported\", \"unsupported\", \"not_applicable\"]),\n strictNecessity: z\n .object({\n claimed: z.boolean(),\n justification: z.string().min(1).max(2_000),\n platformApprovalId: key.nullable(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport const privacyManifestSchema = z\n .object({\n schemaVersion: z.literal(\"2026-07-01\"),\n messageKeys: z\n .object({\n benefit: messageKey,\n refusal: messageKey,\n fallback: messageKey,\n })\n .strict(),\n capabilities: z.array(privacyManifestCapabilitySchema).max(64),\n removed: z.literal(true).optional(),\n })\n .strict()\n .superRefine((value, context) => {\n if (value.removed !== true && value.capabilities.length === 0) {\n context.addIssue({\n code: \"custom\",\n message: \"privacy.manifest.capability_required\",\n path: [\"capabilities\"],\n });\n }\n });\n\nexport type PrivacyManifest = z.infer<typeof privacyManifestSchema>;\n\nexport interface PrivacyManifestIssue {\n code: string;\n path: string;\n}\n\nexport interface ValidatePrivacyManifestOptions {\n /**\n * App intake may persist a strict-necessity claim without an approval so the\n * platform review workflow can decide it. Certification and direct\n * validation remain fail-closed by default.\n */\n allowPendingNecessityReview?: boolean;\n}\n\nexport function validatePrivacyManifest(\n input: unknown,\n catalogs: Record<string, Record<string, string>>,\n options: ValidatePrivacyManifestOptions = {},\n): { valid: boolean; issues: PrivacyManifestIssue[] } {\n const parsed = privacyManifestSchema.safeParse(input);\n const issues: PrivacyManifestIssue[] = [];\n if (!parsed.success) {\n for (const issue of parsed.error.issues) {\n const code =\n issue.message === \"privacy.endpoint.invalid\"\n ? \"privacy.endpoint.invalid\"\n : \"privacy.manifest.invalid\";\n issues.push({ code, path: issue.path.join(\".\") });\n }\n }\n const candidate = parsed.success\n ? parsed.data\n : input && typeof input === \"object\"\n ? (input as Partial<PrivacyManifest>)\n : null;\n if (candidate?.capabilities) {\n for (const [index, capability] of candidate.capabilities.entries()) {\n if (\n capability.strictNecessity?.claimed &&\n !capability.strictNecessity.platformApprovalId &&\n !options.allowPendingNecessityReview\n ) {\n issues.push({\n code: \"privacy.necessity.approval_required\",\n path: `capabilities.${index}.strictNecessity.platformApprovalId`,\n });\n }\n }\n }\n const requiredKeys = candidate?.messageKeys\n ? Object.values(candidate.messageKeys)\n : [];\n for (const capability of candidate?.capabilities ?? []) {\n if (capability.fallbackMessageKey)\n requiredKeys.push(capability.fallbackMessageKey);\n }\n for (const [locale, catalog] of Object.entries(catalogs)) {\n for (const requiredKey of new Set(requiredKeys)) {\n if (!catalog[requiredKey]?.trim()) {\n issues.push({\n code: \"privacy.message.missing\",\n path: `${locale}.${requiredKey}`,\n });\n }\n }\n }\n return { valid: issues.length === 0, issues };\n}\n\nexport function classifyPrivacyManifestChange(\n previous: unknown,\n next: unknown,\n): { material: boolean; reasons: string[] } {\n const before = privacyManifestSchema.parse(previous);\n const after = privacyManifestSchema.parse(next);\n const reasons = new Set<string>();\n const byKey = new Map(\n before.capabilities.map((capability) => [capability.key, capability]),\n );\n const afterKeys = new Set(\n after.capabilities.map((capability) => capability.key),\n );\n if (\n before.removed !== after.removed ||\n before.capabilities.some((capability) => !afterKeys.has(capability.key))\n ) {\n reasons.add(\"capabilities\");\n }\n for (const capability of after.capabilities) {\n const prior = byKey.get(capability.key);\n if (!prior) {\n reasons.add(\"capabilities\");\n continue;\n }\n for (const field of [\n \"purposes\",\n \"dataCategories\",\n \"terminalAccess\",\n \"recipients\",\n \"regions\",\n \"boundedOperations\",\n ] as const) {\n if (JSON.stringify(prior[field]) !== JSON.stringify(capability[field])) {\n reasons.add(field === \"dataCategories\" ? \"fields\" : field);\n }\n }\n }\n return { material: reasons.size > 0, reasons: [...reasons].sort() };\n}\n","import type { AppManifest, AppManifestSurface, AppSurfaceKind } from \"./schema\";\n\nexport type SurfaceContractStatus = \"active\" | \"preview\" | \"deferred\" | \"unsupported\" | \"rejected\";\nexport type SurfaceContractSeverity = \"info\" | \"warning\" | \"error\" | \"blocking\";\n\nexport interface SurfaceContractDiagnostic {\n code: string;\n severity: SurfaceContractSeverity;\n path: string;\n message: string;\n docsUrl?: string;\n}\n\nexport interface SurfaceContractResult {\n surfaceId: string;\n surfaceType: AppSurfaceKind;\n status: SurfaceContractStatus;\n runtimeOwner: \"049c\" | \"049e\" | \"075a\" | \"deferred\";\n diagnostics: SurfaceContractDiagnostic[];\n}\n\nexport function validateExtensionSurfaceDeclarations(manifest: AppManifest): SurfaceContractResult[] {\n return (manifest.surfaces ?? []).map((surface, index) => validateExtensionSurface(surface, `surfaces.${index}`));\n}\n\nexport function validateExtensionSurface(surface: AppManifestSurface, basePath = \"surface\"): SurfaceContractResult {\n const diagnostics: SurfaceContractDiagnostic[] = [];\n if (!surface.label || Object.keys(surface.label).length === 0) {\n diagnostics.push(diagnostic(\"surface.label.missing\", \"blocking\", `${basePath}.label`, \"Surface must declare localized labels.\"));\n }\n if (!surface.entry?.trim()) {\n diagnostics.push(diagnostic(\"surface.entry.missing\", \"blocking\", `${basePath}.entry`, \"Surface must declare an entry file.\"));\n }\n\n if (surface.type === \"admin_surface\") validateAdminSurface(surface, basePath, diagnostics);\n if (surface.type === \"checkout_ui\") validateCheckoutSurface(surface, basePath, diagnostics);\n if (surface.type === \"deterministic_function\" || surface.type === \"checkout_function\") validateDeterministicFunction(surface, basePath, diagnostics);\n if (surface.type === \"pixel\") validatePixel(surface, basePath, diagnostics);\n if (surface.type === \"event_subscription\") validateEventSubscription(surface, basePath, diagnostics);\n if (surface.type === \"background_job\") validateBackgroundJob(surface, basePath, diagnostics);\n if (surface.type === \"flow\" || surface.type === \"event\") {\n diagnostics.push(\n diagnostic(\n \"surface.flow.deferred_to_075a\",\n \"warning\",\n `${basePath}.type`,\n \"Flow trigger/action declarations are owned by 075a and are not activated by 049c.\",\n \"https://hyprcart.com/docs/app-platform/storefront-app-blocks-internal\",\n ),\n );\n }\n\n const blocking = diagnostics.some((entry) => entry.severity === \"blocking\");\n return {\n surfaceId: surface.id,\n surfaceType: surface.type,\n status: blocking ? \"rejected\" : surface.type === \"storefront_block\" ? \"active\" : surface.type === \"flow\" || surface.type === \"event\" ? \"deferred\" : \"preview\",\n runtimeOwner: ownerForSurface(surface.type),\n diagnostics,\n };\n}\n\nfunction validateAdminSurface(surface: AppManifestSurface, basePath: string, diagnostics: SurfaceContractDiagnostic[]): void {\n if (!surface.adminSurfaceType) {\n diagnostics.push(diagnostic(\"surface.admin.type_missing\", \"blocking\", `${basePath}.adminSurfaceType`, \"Admin surfaces must declare a specific admin surface type.\"));\n }\n if (!surface.placement && !surface.compatibleSlots?.length) {\n diagnostics.push(diagnostic(\"surface.admin.placement_missing\", \"blocking\", `${basePath}.placement`, \"Admin surfaces must declare placement targets.\"));\n }\n if (!surface.scopes?.length) {\n diagnostics.push(diagnostic(\"surface.admin.scopes_missing\", \"blocking\", `${basePath}.scopes`, \"Admin surfaces must declare required scopes.\"));\n }\n if (!surface.componentKit?.minVersion || !surface.componentKit.components.length) {\n diagnostics.push(diagnostic(\"surface.admin.component_kit_missing\", \"blocking\", `${basePath}.componentKit`, \"Admin surfaces must declare Hyprcart admin component kit version and components.\"));\n }\n if (surface.adminSurfaceType === \"admin_ui_block\") {\n const removal = new Set(surface.removalBehavior ?? []);\n if (!removal.has(\"remove_on_disable\") || !removal.has(\"remove_on_uninstall\")) {\n diagnostics.push(diagnostic(\"surface.admin_block.removal_missing\", \"blocking\", `${basePath}.removalBehavior`, \"Admin UI blocks must remove placements on disable and uninstall without tombstones.\"));\n }\n if (!surface.dimensions) {\n diagnostics.push(diagnostic(\"surface.admin_block.dimensions_missing\", \"blocking\", `${basePath}.dimensions`, \"Admin UI blocks must reserve stable dimensions.\"));\n }\n }\n if (!surface.inputSchema && !surface.outputSchema) {\n diagnostics.push(diagnostic(\"surface.admin.schema_missing\", \"warning\", `${basePath}.inputSchema`, \"Admin surfaces should declare typed input or output schemas.\"));\n }\n if (!surface.sandboxPolicy) {\n diagnostics.push(diagnostic(\"surface.admin.sandbox_missing\", \"warning\", `${basePath}.sandboxPolicy`, \"Admin surfaces should declare a sandbox policy.\"));\n }\n}\n\nfunction validateCheckoutSurface(surface: AppManifestSurface, basePath: string, diagnostics: SurfaceContractDiagnostic[]): void {\n const sandbox = surface.sandboxPolicy ?? {};\n if (sandbox.allowArbitraryDom === true || sandbox.allowScripts === true || sandbox.allowPaymentBypass === true) {\n diagnostics.push(diagnostic(\"surface.checkout.unsupported_behavior\", \"blocking\", `${basePath}.sandboxPolicy`, \"Checkout UI extensions cannot declare arbitrary DOM, scripts, or payment bypass behavior.\"));\n }\n if (!surface.placement && !surface.compatibleSlots?.length) {\n diagnostics.push(diagnostic(\"surface.checkout.placement_missing\", \"blocking\", `${basePath}.placement`, \"Checkout UI extensions must declare placement targets.\"));\n }\n}\n\nfunction validateDeterministicFunction(surface: AppManifestSurface, basePath: string, diagnostics: SurfaceContractDiagnostic[]): void {\n if (surface.determinism?.networkAccess) {\n diagnostics.push(diagnostic(\"surface.function.network_forbidden\", \"blocking\", `${basePath}.determinism.networkAccess`, \"Deterministic functions cannot use arbitrary network access.\"));\n }\n if (surface.determinism?.mutationSideEffects) {\n diagnostics.push(diagnostic(\"surface.function.side_effects_forbidden\", \"blocking\", `${basePath}.determinism.mutationSideEffects`, \"Deterministic functions cannot perform direct mutation side effects.\"));\n }\n if (!surface.inputSchema || !surface.outputSchema) {\n diagnostics.push(diagnostic(\"surface.function.schema_missing\", \"blocking\", `${basePath}.inputSchema`, \"Deterministic functions require typed input and output schemas.\"));\n }\n}\n\nfunction validatePixel(surface: AppManifestSurface, basePath: string, diagnostics: SurfaceContractDiagnostic[]): void {\n const sandbox = surface.sandboxPolicy ?? {};\n if (sandbox.domRead === true || sandbox.domWrite === true || sandbox.allowDomScrape === true || sandbox.allowDomWrite === true) {\n diagnostics.push(diagnostic(\"surface.pixel.dom_access_forbidden\", \"blocking\", `${basePath}.sandboxPolicy`, \"Pixels cannot scrape or write storefront DOM.\"));\n }\n if (surface.consent?.bypass === true || sandbox.consentBypass === true) {\n diagnostics.push(diagnostic(\"surface.pixel.consent_bypass_forbidden\", \"blocking\", `${basePath}.consent`, \"Pixels cannot bypass consent checks.\"));\n }\n if (!surface.consent?.category) {\n diagnostics.push(diagnostic(\"surface.pixel.consent_missing\", \"blocking\", `${basePath}.consent.category`, \"Pixels must declare a consent category.\"));\n }\n if (!surface.consent?.events?.length) {\n diagnostics.push(diagnostic(\"surface.pixel.events_missing\", \"blocking\", `${basePath}.consent.events`, \"Pixels must declare events.\"));\n }\n if (!surface.consent?.destinations?.length) {\n diagnostics.push(diagnostic(\"surface.pixel.destinations_missing\", \"blocking\", `${basePath}.consent.destinations`, \"Pixels must declare destinations.\"));\n }\n if (!surface.consent?.regions?.length) {\n diagnostics.push(diagnostic(\"surface.pixel.regions_missing\", \"warning\", `${basePath}.consent.regions`, \"Pixels should declare regional availability.\"));\n }\n const fields = surface.consent?.fields ?? [];\n if (!fields.length || fields.some((field) => /email|phone|name|address|token|secret|session|payment|card/i.test(field))) {\n diagnostics.push(diagnostic(\"surface.pixel.field_selection_invalid\", \"blocking\", `${basePath}.consent.fields`, \"Pixels must declare minimized buyer-safe fields only.\"));\n }\n}\n\nfunction validateEventSubscription(surface: AppManifestSurface, basePath: string, diagnostics: SurfaceContractDiagnostic[]): void {\n if (!surface.consent?.events?.length && !surface.requiredContexts?.length) {\n diagnostics.push(diagnostic(\"surface.event.events_missing\", \"blocking\", `${basePath}.requiredContexts`, \"Event subscriptions must declare subscribed event names.\"));\n }\n if (!surface.scopes?.length) {\n diagnostics.push(diagnostic(\"surface.event.scopes_missing\", \"blocking\", `${basePath}.scopes`, \"Event subscriptions must declare required scopes.\"));\n }\n}\n\nfunction validateBackgroundJob(surface: AppManifestSurface, basePath: string, diagnostics: SurfaceContractDiagnostic[]): void {\n if (!surface.retryPolicy) {\n diagnostics.push(diagnostic(\"surface.background_job.retry_missing\", \"blocking\", `${basePath}.retryPolicy`, \"Background jobs must declare bounded retry policy.\"));\n }\n if ((surface.adminSurfaceType === \"bulk_action\" || surface.type === \"background_job\") && surface.overlapPolicy === undefined) {\n diagnostics.push(diagnostic(\"surface.background_job.overlap_missing\", \"blocking\", `${basePath}.overlapPolicy`, \"Background jobs must declare overlap policy.\"));\n }\n if (!surface.quotaClass) {\n diagnostics.push(diagnostic(\"surface.background_job.quota_missing\", \"warning\", `${basePath}.quotaClass`, \"Background jobs should declare a quota class.\"));\n }\n}\n\nfunction ownerForSurface(surface: AppSurfaceKind): SurfaceContractResult[\"runtimeOwner\"] {\n if (surface === \"storefront_block\") return \"049c\";\n if (surface === \"flow\" || surface === \"event\") return \"075a\";\n if (\n surface === \"admin_surface\" ||\n surface === \"checkout_ui\" ||\n surface === \"checkout_function\" ||\n surface === \"deterministic_function\" ||\n surface === \"pixel\" ||\n surface === \"event_subscription\" ||\n surface === \"background_job\"\n ) {\n return \"049e\";\n }\n return \"deferred\";\n}\n\nfunction diagnostic(code: string, severity: SurfaceContractSeverity, path: string, message: string, docsUrl?: string): SurfaceContractDiagnostic {\n return { code, severity, path, message, docsUrl };\n}\n","import {\n defaultRequiredLocales,\n type AppManifest,\n type AppSurfaceKind,\n isSupportedSurface,\n normalizeStorefrontBlockRenderTier,\n} from \"./schema\";\nimport { validatePrivacyManifest } from \"./customer-privacy/privacy-manifest\";\nimport { validateExtensionSurfaceDeclarations } from \"./surface-contracts\";\n\nexport type ValidationSeverity = \"info\" | \"warning\" | \"error\" | \"blocker\";\n\nexport interface ValidationIssue {\n code: string;\n severity: ValidationSeverity;\n path: string;\n message: string;\n suggestedFix?: string;\n docsUrl?: string;\n}\n\nexport interface ScopeImpact {\n scope: string;\n action: \"added\" | \"removed\" | \"unchanged\";\n dataClass: string;\n approvalRequired: boolean;\n reason: string;\n}\n\nexport interface TranslationGap {\n locale: string;\n key: string;\n surface: AppSurfaceKind;\n}\n\nexport interface TranslationStatus {\n requiredLocales: string[];\n completeLocales: string[];\n missing: TranslationGap[];\n}\n\nexport interface ValidationResult {\n status: \"valid\" | \"warning\" | \"invalid\";\n manifestHash: string;\n issues: ValidationIssue[];\n scopeImpact: ScopeImpact[];\n translationStatus: TranslationStatus;\n}\n\nexport interface ValidationOptions {\n requiredLocales?: string[];\n maxBundleSizeBytes?: number;\n supportedSdkMajor?: number;\n}\n\nconst riskyDependencyPatterns = [/child_process/i, /node:fs/i, /eval\\(/i];\n\nexport function validateManifest(\n manifest: AppManifest,\n options: ValidationOptions = {},\n): ValidationResult {\n const requiredLocales = options.requiredLocales ?? [...defaultRequiredLocales];\n const maxBundleSizeBytes = options.maxBundleSizeBytes ?? 512 * 1024;\n const supportedSdkMajor = options.supportedSdkMajor ?? 1;\n const issues: ValidationIssue[] = [];\n\n if (!manifest.name?.trim()) {\n issues.push(issue(\"manifest.name.missing\", \"blocker\", \"name\", \"App name is required.\"));\n }\n\n if (!manifest.manifestVersion?.trim()) {\n issues.push(issue(\"manifest.version.missing\", \"blocker\", \"manifestVersion\", \"Manifest version is required.\"));\n }\n\n if (!manifest.sdkVersion?.trim()) {\n issues.push(issue(\"sdk.version.missing\", \"blocker\", \"sdkVersion\", \"SDK version is required.\"));\n } else if (!isCompatibleSdk(manifest.sdkVersion, supportedSdkMajor)) {\n issues.push(\n issue(\n \"sdk.version.unsupported\",\n \"blocker\",\n \"sdkVersion\",\n `SDK version ${manifest.sdkVersion} is not compatible with this platform.`,\n \"Upgrade the app SDK and regenerate contracts.\",\n \"https://developer.hyprcart.com/docs/app-platform/sdk\",\n ),\n );\n }\n\n if (!Array.isArray(manifest.surfaces) || manifest.surfaces.length === 0) {\n issues.push(issue(\"surfaces.missing\", \"blocker\", \"surfaces\", \"At least one app surface is required.\"));\n }\n\n manifest.surfaces?.forEach((surface, index) => {\n const basePath = `surfaces.${index}`;\n if (!surface.id?.trim()) {\n issues.push(issue(\"surface.id.missing\", \"error\", `${basePath}.id`, \"Surface id is required.\"));\n }\n if (!isSupportedSurface(surface.type)) {\n issues.push(issue(\"surface.type.unsupported\", \"blocker\", `${basePath}.type`, `Unsupported surface type: ${surface.type}`));\n }\n if (!surface.entry?.trim()) {\n issues.push(issue(\"surface.entry.missing\", \"error\", `${basePath}.entry`, \"Surface entry file is required.\"));\n }\n if (surface.deployable === false) {\n issues.push(\n issue(\n \"surface.deferred\",\n \"warning\",\n `${basePath}.deployable`,\n \"This surface is marked as preview-only and will not be deployed.\",\n \"Remove the surface or mark it deployable when the platform supports it.\",\n ),\n );\n }\n if (surface.type === \"storefront_block\") {\n validateStorefrontBlockSurface(surface, basePath, issues);\n }\n });\n\n for (const surfaceResult of validateExtensionSurfaceDeclarations(manifest)) {\n for (const diagnostic of surfaceResult.diagnostics) {\n issues.push(\n issue(\n diagnostic.code,\n diagnostic.severity === \"blocking\" ? \"blocker\" : diagnostic.severity === \"error\" ? \"error\" : diagnostic.severity === \"warning\" ? \"warning\" : \"info\",\n diagnostic.path,\n diagnostic.message,\n undefined,\n diagnostic.docsUrl,\n ),\n );\n }\n }\n\n validateCustomerPrivacyDeclarations(manifest, requiredLocales, issues);\n\n const translationStatus = getTranslationStatus(manifest, requiredLocales);\n for (const gap of translationStatus.missing) {\n issues.push(\n issue(\n \"validation.translation.missing\",\n gap.surface === \"storefront_block\" ? \"error\" : \"warning\",\n `translations.${gap.locale}.${gap.key}`,\n `Missing ${gap.locale} translation for ${gap.key}.`,\n \"Add the missing locale key before deployment.\",\n \"https://developer.hyprcart.com/docs/app-platform/translations\",\n ),\n );\n }\n\n if ((manifest.resources?.bundleSizeBytes ?? 0) > maxBundleSizeBytes) {\n issues.push(\n issue(\n \"bundle.size.exceeded\",\n \"blocker\",\n \"resources.bundleSizeBytes\",\n `Bundle size exceeds ${maxBundleSizeBytes} bytes.`,\n \"Remove unused dependencies or split the app surface.\",\n ),\n );\n }\n\n for (const domain of manifest.egress ?? []) {\n if (!domain.startsWith(\"https://\")) {\n issues.push(issue(\"egress.domain.invalid\", \"blocker\", \"egress\", \"Egress domains must use https.\"));\n }\n if (riskyDependencyPatterns.some((pattern) => pattern.test(domain))) {\n issues.push(issue(\"egress.domain.risky\", \"blocker\", \"egress\", \"Egress declaration contains risky content.\"));\n }\n }\n\n const blocker = issues.some((entry) => entry.severity === \"blocker\" || entry.severity === \"error\");\n const warning = issues.some((entry) => entry.severity === \"warning\");\n\n return {\n status: blocker ? \"invalid\" : warning ? \"warning\" : \"valid\",\n manifestHash: hashObject(manifest),\n issues,\n scopeImpact: (manifest.scopes ?? []).map((scope) => ({\n scope,\n action: \"added\",\n dataClass: classifyScope(scope),\n approvalRequired: scope.includes(\"write\") || scope.includes(\"customer\"),\n reason: \"Declared by app manifest.\",\n })),\n translationStatus,\n };\n}\n\nfunction validateCustomerPrivacyDeclarations(\n manifest: AppManifest,\n requiredLocales: readonly string[],\n issues: ValidationIssue[],\n): void {\n const relevantSurfaces = (manifest.surfaces ?? []).filter((surface) =>\n surface.type === \"pixel\" ||\n (\n typeof surface.consent?.category === \"string\" &&\n surface.consent.category !== \"necessary\"\n ) ||\n (surface.clientIslands ?? []).some((island) =>\n Boolean(island.consentCategory) &&\n island.consentCategory !== \"necessary\"\n )\n );\n if (relevantSurfaces.length > 0 && !manifest.customerPrivacy) {\n issues.push(issue(\n \"privacy.manifest.required\",\n \"blocker\",\n \"customerPrivacy\",\n \"Privacy-relevant app surfaces require a customer privacy manifest.\",\n \"Declare each buyer-facing storage or processing capability.\",\n ));\n return;\n }\n if (!manifest.customerPrivacy) return;\n\n const catalogs = Object.fromEntries(\n requiredLocales.map((locale) => [\n locale,\n manifest.translations?.[locale] ?? {},\n ]),\n );\n const validation = validatePrivacyManifest(\n manifest.customerPrivacy,\n catalogs,\n { allowPendingNecessityReview: true },\n );\n for (const privacyIssue of validation.issues) {\n issues.push(issue(\n privacyIssue.code,\n \"blocker\",\n `customerPrivacy.${privacyIssue.path}`,\n \"The customer privacy declaration is incomplete or invalid.\",\n \"Correct the declaration and provide every localized buyer message.\",\n ));\n }\n\n const declaredKeys = new Set(\n manifest.customerPrivacy.capabilities.map((capability) => capability.key),\n );\n for (const surface of relevantSurfaces) {\n if (!declaredKeys.has(surface.id)) {\n issues.push(issue(\n \"privacy.surface.capability_missing\",\n \"blocker\",\n `surfaces.${surface.id}.consent`,\n `Privacy-relevant surface \"${surface.id}\" has no matching capability declaration.`,\n `Add customerPrivacy.capabilities entry \"${surface.id}\".`,\n ));\n }\n }\n}\n\nfunction validateStorefrontBlockSurface(surface: AppManifest[\"surfaces\"][number], basePath: string, issues: ValidationIssue[]): void {\n const renderTier = normalizeStorefrontBlockRenderTier(surface.renderTier ?? surface.tier);\n if (renderTier === \"edge_stream\" && (!surface.placeholder?.width || !surface.placeholder?.height || !surface.placeholder?.skeleton)) {\n issues.push(\n issue(\n \"storefront_block.placeholder.missing\",\n \"blocker\",\n `${basePath}.placeholder`,\n \"Streaming app blocks must declare placeholder width, height, and skeleton before install.\",\n \"Add exact placeholder dimensions and skeleton type.\",\n \"https://developer.hyprcart.com/docs/app-platform/surfaces\",\n ),\n );\n }\n for (const island of surface.clientIslands ?? []) {\n if (island.compressedSizeBytes > 32 * 1024 && !island.exceptionId) {\n issues.push(\n issue(\n \"client_island.bundle_budget.exceeded\",\n \"blocker\",\n `${basePath}.clientIslands`,\n \"Client island bundle exceeds the 32 KB compressed budget.\",\n \"Reduce bundle size or request a platform exception.\",\n \"https://developer.hyprcart.com/docs/app-platform/surfaces\",\n ),\n );\n }\n if (!island.domBoundarySelector?.startsWith(\"[data-hc-app-block\")) {\n issues.push(issue(\"client_island.dom_boundary.invalid\", \"blocker\", `${basePath}.clientIslands`, \"Client island DOM boundary must stay inside the app block wrapper.\"));\n }\n }\n}\n\nexport function getTranslationStatus(manifest: AppManifest, requiredLocales: string[]): TranslationStatus {\n const missing: TranslationGap[] = [];\n const completeLocales: string[] = [];\n\n for (const locale of requiredLocales) {\n const messages = manifest.translations?.[locale] ?? {};\n const before = missing.length;\n for (const surface of manifest.surfaces ?? []) {\n const labelKey = `${surface.id}.label`;\n if (!messages[labelKey]) {\n missing.push({ locale, key: labelKey, surface: surface.type });\n }\n }\n if (missing.length === before) {\n completeLocales.push(locale);\n }\n }\n\n return { requiredLocales, completeLocales, missing };\n}\n\nfunction issue(\n code: string,\n severity: ValidationSeverity,\n path: string,\n message: string,\n suggestedFix?: string,\n docsUrl?: string,\n): ValidationIssue {\n return { code, severity, path, message, suggestedFix, docsUrl };\n}\n\nfunction classifyScope(scope: string): string {\n if (scope.includes(\"customer\")) return \"customer\";\n if (scope.includes(\"order\")) return \"order\";\n if (scope.includes(\"product\")) return \"product\";\n return \"standard\";\n}\n\nfunction isCompatibleSdk(version: string, supportedMajor: number): boolean {\n const major = Number(version.split(\".\")[0]);\n return Number.isFinite(major) && major === supportedMajor;\n}\n\nfunction hashObject(value: unknown): string {\n const json = stableStringify(value);\n let hash = 0;\n for (let index = 0; index < json.length; index += 1) {\n hash = (hash * 31 + json.charCodeAt(index)) >>> 0;\n }\n return `mf_${hash.toString(16).padStart(8, \"0\")}`;\n}\n\nfunction stableStringify(value: unknown): string {\n return JSON.stringify(sortValue(value));\n}\n\nfunction sortValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(sortValue);\n if (!value || typeof value !== \"object\") return value;\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, entry]) => [key, sortValue(entry)]),\n );\n}\n","import type { AppManifest, AppManifestSurface } from \"./schema\";\nimport { validateExtensionSurfaceDeclarations, type SurfaceContractResult } from \"./surface-contracts\";\n\nexport interface GeneratedContractFile {\n path: string;\n content: string;\n purpose: string;\n}\n\nexport interface ContractGenerationResult {\n manifestHash: string;\n schemaVersion: string;\n sdkVersion: string;\n surfaces: SurfaceContractResult[];\n files: GeneratedContractFile[];\n}\n\nexport function generateContracts(manifest: AppManifest, schemaVersion = \"2026-06-06\"): ContractGenerationResult {\n const surfaces = manifest.surfaces.map(renderSurfaceContract).join(\"\\n\\n\");\n const surfaceMetadata = validateExtensionSurfaceDeclarations(manifest);\n const content = [\n \"/* Generated by Hyprcart app tooling. */\",\n `export const schemaVersion = ${JSON.stringify(schemaVersion)};`,\n `export const sdkVersion = ${JSON.stringify(manifest.sdkVersion)};`,\n `export const surfaceContracts = ${JSON.stringify(surfaceMetadata, null, 2)} as const;`,\n surfaces,\n ].join(\"\\n\");\n\n return {\n manifestHash: stableHash(JSON.stringify(manifest)),\n schemaVersion,\n sdkVersion: manifest.sdkVersion,\n surfaces: surfaceMetadata,\n files: [\n {\n path: \"generated/hyprcart.contracts.ts\",\n content,\n purpose: \"typed surface contracts\",\n },\n ],\n };\n}\n\nfunction renderSurfaceContract(surface: AppManifestSurface): string {\n const name = toPascalCase(surface.id);\n return [\n `export interface ${name}Input {`,\n ` surface: ${JSON.stringify(surface.type)};`,\n \" context: Record<string, unknown>;\",\n \"}\",\n `export interface ${name}Output {`,\n \" html?: string;\",\n \" data?: Record<string, unknown>;\",\n \" events?: Array<Record<string, unknown>>;\",\n \"}\",\n `export const ${name}Contract = {`,\n ` id: ${JSON.stringify(surface.id)},`,\n ` type: ${JSON.stringify(surface.type)},`,\n ` entry: ${JSON.stringify(surface.entry)},`,\n ` scopes: ${JSON.stringify(surface.scopes ?? [])}`,\n \"} as const;\",\n ].join(\"\\n\");\n}\n\nfunction toPascalCase(value: string): string {\n return value\n .replace(/[^a-zA-Z0-9]+/g, \" \")\n .split(\" \")\n .filter(Boolean)\n .map((part) => `${part[0]?.toUpperCase() ?? \"\"}${part.slice(1)}`)\n .join(\"\");\n}\n\nfunction stableHash(value: string): string {\n let hash = 5381;\n for (let index = 0; index < value.length; index += 1) {\n hash = (hash * 33) ^ value.charCodeAt(index);\n }\n return `ct_${(hash >>> 0).toString(16).padStart(8, \"0\")}`;\n}\n","export interface CompatibilityResult {\n ok: boolean;\n code?: string;\n message?: string;\n docsUrl?: string;\n}\n\nexport function checkCompatibility(input: {\n cliVersion?: string;\n sdkVersion: string;\n platformVersion: string;\n requiredSdkMajor?: number;\n}): CompatibilityResult {\n const requiredSdkMajor = input.requiredSdkMajor ?? 1;\n const sdkMajor = Number(input.sdkVersion.split(\".\")[0]);\n\n if (!Number.isFinite(sdkMajor) || sdkMajor !== requiredSdkMajor) {\n return {\n ok: false,\n code: \"sdk.version.unsupported\",\n message: `SDK ${input.sdkVersion} is not compatible with platform ${input.platformVersion}.`,\n docsUrl: \"https://developer.hyprcart.com/docs/app-platform/sdk\",\n };\n }\n\n return { ok: true };\n}\n","import type { AppManifest } from \"./schema\";\nimport { generateContracts } from \"./contract-generation\";\nimport { validateManifest } from \"./validation\";\n\nexport function generateIdeMetadata(manifest: AppManifest) {\n const validation = validateManifest(manifest);\n const contracts = generateContracts(manifest);\n\n return {\n schemaVersion: contracts.schemaVersion,\n platformVersion: manifest.platformCompatibility,\n surfaceContracts: manifest.surfaces.map((surface) => ({\n surface: surface.type,\n inputTypeName: `${surface.id}Input`,\n outputTypeName: `${surface.id}Output`,\n fixtureTypeName: `${surface.id}Fixture`,\n scopes: surface.scopes ?? [],\n })),\n scopeWarnings: validation.scopeImpact,\n translationRequirements: validation.translationStatus,\n docsUrls: [\"https://developer.hyprcart.com/docs/app-platform/manifest\"],\n };\n}\n","export const developerToolingOperationMetadata = [\n {\n operationName: \"validateAppProject\",\n scopes: [\"app.validation:run\"],\n dataClass: \"developer_app\",\n costClass: \"standard\",\n idempotent: true,\n lifecycleEvents: [\"developer_tooling.validation_requested\"],\n docsStatus: \"public\",\n stability: \"preview\",\n },\n {\n operationName: \"requestDeveloperDeployment\",\n scopes: [\"app.deployment:write\"],\n dataClass: \"developer_app\",\n costClass: \"elevated\",\n idempotent: true,\n lifecycleEvents: [\"developer_tooling.deployment_requested\"],\n docsStatus: \"public\",\n stability: \"preview\",\n },\n] as const;\n","// 049e-admin-checkout-pixel-app-surfaces: Hyprcart admin component kit manifest validation.\n\nconst defaultSupportedComponents = [\n \"Page\",\n \"Section\",\n \"Stack\",\n \"InlineStack\",\n \"Grid\",\n \"ResourcePanel\",\n \"AdminBlock\",\n \"Modal\",\n \"Sheet\",\n \"Text\",\n \"Heading\",\n \"Badge\",\n \"Status\",\n \"DescriptionList\",\n \"DataTable\",\n \"Timeline\",\n \"Metric\",\n \"EmptyState\",\n \"Skeleton\",\n \"Form\",\n \"TextField\",\n \"NumberField\",\n \"Select\",\n \"Combobox\",\n \"Checkbox\",\n \"RadioGroup\",\n \"DatePicker\",\n \"FilePicker\",\n \"ResourcePicker\",\n \"ValidationMessage\",\n \"Button\",\n \"IconButton\",\n \"Banner\",\n \"Toast\",\n \"InlineError\",\n \"Progress\",\n \"Spinner\",\n \"Tooltip\",\n \"ConfirmDialog\",\n \"TitleBar\",\n \"Breadcrumbs\",\n \"Tabs\",\n \"ActionList\",\n \"ContextualSaveBar\",\n \"CommandAction\",\n \"SearchResult\",\n] as const;\n\nexport const supportedAdminComponentKitComponents = [...defaultSupportedComponents];\n\nexport interface AdminComponentKitManifestValidationInput {\n minVersion?: string;\n components?: string[];\n tokens?: Record<string, unknown>;\n css?: string;\n supportedComponents?: readonly string[];\n}\n\nexport interface AdminComponentKitManifestValidationResult {\n valid: boolean;\n diagnostics: Array<{ code: string; path: string; message: string }>;\n}\n\nexport function validateAdminComponentKitManifest(input: AdminComponentKitManifestValidationInput): AdminComponentKitManifestValidationResult {\n const diagnostics: AdminComponentKitManifestValidationResult[\"diagnostics\"] = [];\n if (!input.minVersion) {\n diagnostics.push({ code: \"admin_component_kit.version_missing\", path: \"componentKit.minVersion\", message: \"Admin component kit minimum version is required.\" });\n }\n const supported = new Set(input.supportedComponents ?? supportedAdminComponentKitComponents);\n for (const component of input.components ?? []) {\n if (!supported.has(component)) {\n diagnostics.push({ code: \"admin_component_kit.component_unsupported\", path: \"componentKit.components\", message: `${component} is not an approved admin component.` });\n }\n }\n for (const [key, value] of Object.entries(input.tokens ?? {})) {\n if (/(?:#[0-9a-f]{3,8}\\b|rgba?\\(|font|radius|shadow)/i.test(`${key}:${String(value)}`)) {\n diagnostics.push({ code: \"admin_component_kit.token_forbidden\", path: `componentKit.tokens.${key}`, message: \"Apps cannot declare custom visual tokens outside the platform kit.\" });\n }\n }\n if (input.css && /(?:font-family|border-radius|box-shadow|position\\s*:\\s*fixed)/i.test(input.css)) {\n diagnostics.push({ code: \"admin_component_kit.css_forbidden\", path: \"componentKit.css\", message: \"Apps cannot inject global CSS or incompatible visual rules into admin surfaces.\" });\n }\n return { valid: diagnostics.length === 0, diagnostics };\n}\n","// 049d-app-governance-ai-capabilities\n// Verified 2026-06-09: TypeScript, Vitest, and app manifest package drift checked before implementation.\n\nexport const appGovernanceCapabilityTypes = [\n \"api_operation\",\n \"storefront_block\",\n \"admin_surface\",\n \"checkout_surface\",\n \"pixel\",\n \"event_subscription\",\n \"mcp_tool\",\n \"mcp_resource\",\n \"mcp_resource_template\",\n \"mcp_prompt\",\n \"background_job\",\n] as const;\n\nexport type AppGovernanceCapabilityType = (typeof appGovernanceCapabilityTypes)[number];\n\nexport const appGovernanceDataClasses = [\"public\", \"merchant_operational\", \"restricted_customer\", \"payment_adjacent\", \"auth_sensitive\", \"security\", \"operator_only\"] as const;\nexport type AppGovernanceDataClass = (typeof appGovernanceDataClasses)[number];\n\nexport const appGovernanceRiskClasses = [\"low\", \"medium\", \"high\", \"critical\"] as const;\nexport type AppGovernanceRiskClass = (typeof appGovernanceRiskClasses)[number];\n\nexport const appGovernanceCostClasses = [\"free\", \"low\", \"medium\", \"high\", \"operator\"] as const;\nexport type AppGovernanceCostClass = (typeof appGovernanceCostClasses)[number];\n\nexport const appGovernanceApprovalPolicies = [\"required\", \"optional\", \"operator_only\", \"automation_policy_required\", \"not_approvable\"] as const;\nexport type AppGovernanceApprovalPolicy = (typeof appGovernanceApprovalPolicies)[number];\n\nexport interface AppCapabilityDeclaration {\n key: string;\n type: AppGovernanceCapabilityType;\n surface: string;\n requiredScopes: string[];\n optionalScopes?: string[];\n dataClass: AppGovernanceDataClass;\n riskClass: AppGovernanceRiskClass;\n costClass: AppGovernanceCostClass;\n approvalPolicy: AppGovernanceApprovalPolicy;\n buyerVisible: boolean;\n aiExposed?: boolean;\n mutating?: boolean;\n}\n\nexport interface AppEgressDeclaration {\n key: string;\n hosts: string[];\n class: string;\n requiredForCapabilities: string[];\n defaultAction: \"allow\" | \"block\" | \"broker\" | \"log_only\";\n}\n\nexport interface AppRetentionDeclaration {\n key: string;\n appliesTo: string[];\n retentionMode: string;\n uninstallAction: string;\n merchantVisible: boolean;\n}\n\nexport interface CapabilityValidationIssue {\n code: string;\n path: string;\n message: string;\n}\n\nexport interface CapabilityValidationResult {\n valid: boolean;\n issues: CapabilityValidationIssue[];\n}\n\nexport function validateAppCapabilityDeclarations(input: {\n capabilities?: AppCapabilityDeclaration[];\n egress?: AppEgressDeclaration[];\n dataRetention?: AppRetentionDeclaration[];\n}): CapabilityValidationResult {\n const issues: CapabilityValidationIssue[] = [];\n const capabilityKeys = new Set<string>();\n\n for (const [index, capability] of (input.capabilities ?? []).entries()) {\n const path = `capabilities.${index}`;\n if (!capability.key?.trim()) issues.push(issue(\"capability.key.missing\", `${path}.key`, \"Capability key is required.\"));\n if (capabilityKeys.has(capability.key)) issues.push(issue(\"capability.key.duplicate\", `${path}.key`, \"Capability key must be unique.\"));\n capabilityKeys.add(capability.key);\n if (!isOneOf(capability.type, appGovernanceCapabilityTypes)) issues.push(issue(\"capability.type.invalid\", `${path}.type`, \"Capability type is not supported.\"));\n if (!isOneOf(capability.dataClass, appGovernanceDataClasses)) issues.push(issue(\"capability.data_class.invalid\", `${path}.dataClass`, \"Data class is not supported.\"));\n if (!isOneOf(capability.riskClass, appGovernanceRiskClasses)) issues.push(issue(\"capability.risk_class.invalid\", `${path}.riskClass`, \"Risk class is not supported.\"));\n if (!isOneOf(capability.costClass, appGovernanceCostClasses)) issues.push(issue(\"capability.cost_class.invalid\", `${path}.costClass`, \"Cost class is not supported.\"));\n if (!isOneOf(capability.approvalPolicy, appGovernanceApprovalPolicies)) issues.push(issue(\"capability.approval_policy.invalid\", `${path}.approvalPolicy`, \"Approval policy is not supported.\"));\n if (capability.mutating && capability.riskClass === \"low\") {\n issues.push(issue(\"capability.mutating.low_risk\", `${path}.riskClass`, \"Mutating capabilities must be medium risk or higher.\"));\n }\n }\n\n for (const [index, egress] of (input.egress ?? []).entries()) {\n const path = `egress.${index}`;\n for (const host of egress.hosts ?? []) {\n if (!isNormalizedHostPattern(host)) issues.push(issue(\"egress.host.invalid\", `${path}.hosts`, \"Egress host must be normalized and must not contain credentials, path, query, or fragment.\"));\n }\n for (const capabilityKey of egress.requiredForCapabilities ?? []) {\n if (!capabilityKeys.has(capabilityKey)) issues.push(issue(\"egress.capability.unknown\", `${path}.requiredForCapabilities`, `Unknown capability ${capabilityKey}.`));\n }\n }\n\n for (const [index, retention] of (input.dataRetention ?? []).entries()) {\n const path = `dataRetention.${index}`;\n if (retention.merchantVisible !== true) {\n issues.push(issue(\"retention.visibility.required\", `${path}.merchantVisible`, \"Retention policy must be visible to merchants at install and uninstall.\"));\n }\n for (const capabilityKey of retention.appliesTo ?? []) {\n if (!capabilityKeys.has(capabilityKey)) issues.push(issue(\"retention.capability.unknown\", `${path}.appliesTo`, `Unknown capability ${capabilityKey}.`));\n }\n }\n\n return { valid: issues.length === 0, issues };\n}\n\nexport function isNormalizedHostPattern(host: string): boolean {\n if (!host || host.includes(\"@\") || host.includes(\"/\") || host.includes(\"?\") || host.includes(\"#\")) return false;\n return /^[a-z0-9*.-]+(?::\\d+)?$/i.test(host);\n}\n\nfunction isOneOf<TValue extends string>(value: string, values: readonly TValue[]): value is TValue {\n return values.includes(value as TValue);\n}\n\nfunction issue(code: string, path: string, message: string): CapabilityValidationIssue {\n return { code, path, message };\n}\n","// 049d-app-governance-ai-capabilities\n// Verified 2026-06-09: MCP SDK and OpenAI agent safety guidance rechecked before implementation.\n\nexport const aiMcpDescriptorTypes = [\"tool\", \"resource\", \"resource_template\", \"prompt\"] as const;\nexport type AiMcpDescriptorType = (typeof aiMcpDescriptorTypes)[number];\n\nexport const aiMcpHumanApprovalPolicies = [\"not_required\", \"required\", \"required_for_mutation\", \"automation_policy_allowed\"] as const;\nexport type AiMcpHumanApprovalPolicy = (typeof aiMcpHumanApprovalPolicies)[number];\n\nexport interface AiMcpDescriptorDeclaration {\n name: string;\n descriptorType: AiMcpDescriptorType;\n capabilityKey: string;\n requiredScopes: string[];\n dataClass: string;\n riskClass: string;\n mutating: boolean;\n humanApprovalPolicy: AiMcpHumanApprovalPolicy;\n description?: string;\n promptTemplate?: string;\n resourceUriTemplate?: string;\n}\n\nexport interface AiMcpMetadataValidationIssue {\n code: string;\n path: string;\n message: string;\n}\n\nexport interface AiMcpMetadataValidationResult {\n valid: boolean;\n issues: AiMcpMetadataValidationIssue[];\n}\n\nconst unsafeAuthorityPattern = /(ignore previous|system prompt|act as admin|bypass|override policy|grant .*scope|no approval)/i;\n\nexport function validateAiMcpDescriptorMetadata(descriptors: AiMcpDescriptorDeclaration[]): AiMcpMetadataValidationResult {\n const issues: AiMcpMetadataValidationIssue[] = [];\n const names = new Set<string>();\n\n descriptors.forEach((descriptor, index) => {\n const path = `ai.mcp.${descriptor.descriptorType}.${index}`;\n if (!descriptor.name?.trim()) issues.push(issue(\"ai_mcp.name.missing\", `${path}.name`, \"Descriptor name is required.\"));\n if (names.has(descriptor.name)) issues.push(issue(\"ai_mcp.name.duplicate\", `${path}.name`, \"Descriptor name must be unique per app installation.\"));\n names.add(descriptor.name);\n if (!aiMcpDescriptorTypes.includes(descriptor.descriptorType)) issues.push(issue(\"ai_mcp.type.invalid\", `${path}.descriptorType`, \"Descriptor type is not supported.\"));\n if (!aiMcpHumanApprovalPolicies.includes(descriptor.humanApprovalPolicy)) issues.push(issue(\"ai_mcp.approval.invalid\", `${path}.humanApprovalPolicy`, \"Human approval policy is not supported.\"));\n if (descriptor.mutating && descriptor.humanApprovalPolicy === \"not_required\") {\n issues.push(issue(\"ai_mcp.mutating.approval_required\", `${path}.humanApprovalPolicy`, \"Mutating descriptors require human approval or automation policy.\"));\n }\n if (descriptor.resourceUriTemplate && /token|secret|bearer/i.test(descriptor.resourceUriTemplate)) {\n issues.push(issue(\"ai_mcp.resource_template.secret\", `${path}.resourceUriTemplate`, \"Resource URI templates must not embed tokens or secrets.\"));\n }\n for (const text of [descriptor.description, descriptor.promptTemplate].filter((value): value is string => Boolean(value))) {\n if (unsafeAuthorityPattern.test(text)) {\n issues.push(issue(\"ai_mcp.metadata.untrusted_authority\", path, \"Descriptor text is untrusted metadata and cannot claim platform authority.\"));\n }\n }\n });\n\n return { valid: issues.length === 0, issues };\n}\n\nexport function classifyAiMcpMetadataAuthority(text: string): \"safe_descriptor\" | \"untrusted_authority_claim\" {\n return unsafeAuthorityPattern.test(text) ? \"untrusted_authority_claim\" : \"safe_descriptor\";\n}\n\nfunction issue(code: string, path: string, message: string): AiMcpMetadataValidationIssue {\n return { code, path, message };\n}\n","// 049f-independent-app-launch-readiness: manifest launch validation helpers.\n// Verified 2026-06-11: app manifest/package guidance rechecked; repo-compatible pins remain in use.\n\nimport type { AppManifest, LaunchReadinessDeclaration } from \"./schema\";\n\nexport interface LaunchManifestValidationIssue {\n code: string;\n path: string;\n message: string;\n}\n\nexport interface LaunchManifestValidationResult {\n valid: boolean;\n issues: LaunchManifestValidationIssue[];\n}\n\nconst REQUIRED_LOCALES = [\"en\", \"de\"] as const;\n\nexport function validateLaunchReadinessManifest(manifest: AppManifest): LaunchManifestValidationResult {\n const issues: LaunchManifestValidationIssue[] = [];\n const launch = manifest.launch;\n if (!launch) {\n return issue(\"launch.missing\", \"launch\", \"Launch readiness declaration is required.\");\n }\n\n validateAdminApi(launch, issues);\n validateAppData(launch, issues);\n validateEnvironments(launch, issues);\n validateSecrets(launch, issues);\n validateSettings(launch, issues);\n validateConsent(launch, issues);\n validateLifecycleCallbacks(launch, issues);\n validateAssets(launch, issues);\n validateSandbox(launch, issues);\n validateEvidence(launch, issues);\n validateCompatibility(launch, issues);\n\n return { valid: issues.length === 0, issues };\n}\n\nexport function assertLaunchReadinessManifest(manifest: AppManifest): asserts manifest is AppManifest & {\n launch: LaunchReadinessDeclaration;\n} {\n const result = validateLaunchReadinessManifest(manifest);\n if (!result.valid) {\n throw new Error(result.issues.map((entry) => `${entry.code}:${entry.path}`).join(\", \"));\n }\n}\n\nfunction validateAdminApi(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.adminApi?.minApiVersion) addIssue(issues, \"launch.admin_api.missing\", \"launch.adminApi\", \"Admin API declaration is required.\");\n if (!launch.adminApi?.operations?.length) addIssue(issues, \"launch.admin_api.operations_missing\", \"launch.adminApi.operations\", \"At least one Admin API operation declaration is required.\");\n}\n\nfunction validateAppData(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.appData?.length) addIssue(issues, \"launch.app_data.missing\", \"launch.appData\", \"App data declarations are required.\");\n for (const [index, declaration] of (launch.appData ?? []).entries()) {\n if (!declaration.namespace) addIssue(issues, \"launch.app_data.namespace_missing\", `launch.appData.${index}.namespace`, \"App data namespace is required.\");\n if (declaration.visibility === \"storefront_public\" && !declaration.storefrontMaterialization?.cacheTags?.length) {\n addIssue(issues, \"launch.app_data.cache_tags_missing\", `launch.appData.${index}.storefrontMaterialization.cacheTags`, \"Storefront-public app data requires cache tags.\");\n }\n }\n}\n\nfunction validateEnvironments(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n const keys = new Set((launch.environments ?? []).map((environment) => environment.key));\n for (const key of [\"development\", \"staging\", \"production\"] as const) {\n if (!keys.has(key)) addIssue(issues, \"launch.environment.missing\", `launch.environments.${key}`, `${key} environment is required.`);\n }\n const production = (launch.environments ?? []).find((environment) => environment.key === \"production\");\n if (production && !production.promotionRequiresCertification) {\n addIssue(issues, \"launch.environment.production_certification\", \"launch.environments.production\", \"Production environment must require certification.\");\n }\n}\n\nfunction validateSecrets(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.secrets?.length) addIssue(issues, \"launch.secrets.missing\", \"launch.secrets\", \"At least one secret declaration is required.\");\n for (const [index, secret] of (launch.secrets ?? []).entries()) {\n if (secret.runtimeExposure === \"runtime_only\" && secret.key.toLowerCase().startsWith(\"next_public\")) {\n addIssue(issues, \"launch.secrets.client_bundle\", `launch.secrets.${index}.key`, \"Secrets cannot target client bundles.\");\n }\n }\n}\n\nfunction validateSettings(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.settings?.length) addIssue(issues, \"launch.settings.missing\", \"launch.settings\", \"Merchant settings declaration is required.\");\n for (const [index, setting] of (launch.settings ?? []).entries()) {\n for (const locale of REQUIRED_LOCALES) {\n if (!setting.label[locale]) addIssue(issues, \"launch.settings.locale_missing\", `launch.settings.${index}.label.${locale}`, \"Setting labels require English and German.\");\n }\n }\n}\n\nfunction validateConsent(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n const consent = launch.consent;\n if (!consent) {\n addIssue(issues, \"launch.consent.missing\", \"launch.consent\", \"Consent metadata is required.\");\n return;\n }\n for (const [field, value] of Object.entries({\n appIcon: consent.appIcon,\n developerName: consent.developerName,\n supportUrl: consent.supportUrl,\n privacyPolicyUrl: consent.privacyPolicyUrl,\n termsUrl: consent.termsUrl,\n reviewerInstructions: consent.reviewerInstructions,\n })) {\n if (!value) addIssue(issues, \"launch.consent.field_missing\", `launch.consent.${field}`, \"Consent metadata field is required.\");\n }\n if (!consent.screenshots.length) addIssue(issues, \"launch.consent.screenshots_missing\", \"launch.consent.screenshots\", \"At least one screenshot is required.\");\n if (!consent.dataCategories.length) addIssue(issues, \"launch.consent.data_categories_missing\", \"launch.consent.dataCategories\", \"Data categories are required.\");\n}\n\nfunction validateLifecycleCallbacks(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.lifecycleCallbacks?.length) addIssue(issues, \"launch.callbacks.missing\", \"launch.lifecycleCallbacks\", \"Lifecycle callback declarations are required.\");\n}\n\nfunction validateAssets(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n const kinds = new Set((launch.assets ?? []).map((asset) => asset.kind));\n for (const kind of [\"icon\", \"screenshot\"] as const) {\n if (!kinds.has(kind)) addIssue(issues, \"launch.assets.required_missing\", `launch.assets.${kind}`, `${kind} asset is required.`);\n }\n}\n\nfunction validateSandbox(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.sandbox?.fixturePackId) addIssue(issues, \"launch.sandbox.missing\", \"launch.sandbox\", \"Sandbox fixture declaration is required.\");\n if (launch.sandbox && !launch.sandbox.anonymizationRequired) {\n addIssue(issues, \"launch.sandbox.anonymization_required\", \"launch.sandbox.anonymizationRequired\", \"Sandbox fixtures must require anonymization.\");\n }\n}\n\nfunction validateEvidence(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.evidence?.testCommand) addIssue(issues, \"launch.evidence.test_missing\", \"launch.evidence.testCommand\", \"Evidence test command is required.\");\n if (!launch.evidence?.buildCommand) addIssue(issues, \"launch.evidence.build_missing\", \"launch.evidence.buildCommand\", \"Evidence build command is required.\");\n}\n\nfunction validateCompatibility(launch: LaunchReadinessDeclaration, issues: LaunchManifestValidationIssue[]): void {\n if (!launch.compatibility?.adminApiVersion) addIssue(issues, \"launch.compatibility.missing\", \"launch.compatibility\", \"Compatibility declaration is required.\");\n}\n\nfunction addIssue(issues: LaunchManifestValidationIssue[], code: string, path: string, message: string): void {\n issues.push({ code, path, message });\n}\n\nfunction issue(code: string, path: string, message: string): LaunchManifestValidationResult {\n return { valid: false, issues: [{ code, path, message }] };\n}\n","import type { AppManifest } from \"./schema\";\nimport { validateManifest } from \"./validation\";\n\nexport interface NoDeployPreviewValidationResult {\n readonly status: \"valid\" | \"invalid\";\n readonly createdProductionState: false;\n readonly diagnostics: readonly {\n readonly code: string;\n readonly message: string;\n readonly path?: string;\n }[];\n}\n\nexport function validateNoDeployPreviewManifest(manifest: AppManifest): NoDeployPreviewValidationResult {\n const validation = validateManifest(manifest);\n const diagnostics = validation.issues.map((issue) => ({\n code: `manifest.${issue.code}`,\n message: issue.message,\n path: issue.path,\n }));\n\n if (manifest.surfaces.length === 0) {\n diagnostics.push({\n code: \"preview.surface_missing\",\n message: \"No-deploy preview requires at least one app surface.\",\n path: \"surfaces\",\n });\n }\n\n for (const surface of manifest.surfaces) {\n if (!surface.entry) {\n diagnostics.push({\n code: \"preview.surface_entry_missing\",\n message: \"Preview surfaces must declare an entry point.\",\n path: `surfaces.${surface.id}.entry`,\n });\n }\n }\n\n return {\n status: diagnostics.length === 0 ? \"valid\" : \"invalid\",\n createdProductionState: false,\n diagnostics,\n };\n}\n"],"mappings":";AAEO,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,6BAA6B,CAAC,UAAU,eAAe,aAAa;AAG1E,IAAM,mCAAmC,CAAC,iBAAiB,aAAa;AAGxE,IAAM,oBAAoB,CAAC,QAAQ,WAAW,eAAe,QAAQ,QAAQ;AAqS7E,IAAM,yBAAyB,CAAC,MAAM,IAAI;AAE1C,SAAS,mBAAmB,OAAwC;AACzE,SAAO,kBAAkB,SAAS,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;AAC3D;;;ACrIO,SAAS,gCAAgC,UAAwD;AACtG,QAAM,aAAa,iBAAiB,QAAQ;AAC5C,QAAM,cAAc,WAAW,OAAO,IAAI,CAACE,YAAW;AAAA,IACpD,MAAM,YAAYA,OAAM,IAAI;AAAA,IAC5B,SAASA,OAAM;AAAA,IACf,MAAMA,OAAM;AAAA,EACd,EAAE;AAEF,MAAI,SAAS,SAAS,WAAW,GAAG;AAClC,gBAAY,KAAK;AAAA,MACf,MAAM;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,aAAW,WAAW,SAAS,UAAU;AACvC,QAAI,CAAC,QAAQ,OAAO;AAClB,kBAAY,KAAK;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM,YAAY,QAAQ,EAAE;AAAA,MAC9B,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,QAAQ,YAAY,WAAW,IAAI,UAAU;AAAA,IAC7C,wBAAwB;AAAA,IACxB;AAAA,EACF;AACF;","names":["issue","diagnostic","key","key","issue","issue","issue","key","issue"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyprcart/app-manifest",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Manifest schema and validation helpers for Hyprcart apps.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE"
|
|
10
11
|
],
|
|
11
12
|
"publishConfig": {
|
|
12
13
|
"access": "public",
|
|
@@ -20,10 +21,13 @@
|
|
|
20
21
|
"import": "./dist/index.js"
|
|
21
22
|
}
|
|
22
23
|
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"zod": "^4.3.6"
|
|
26
|
+
},
|
|
23
27
|
"devDependencies": {
|
|
24
28
|
"tsup": "^8.3.5",
|
|
25
29
|
"typescript": "^5.7.2",
|
|
26
|
-
"vitest": "^4.
|
|
30
|
+
"vitest": "^4.1.11",
|
|
27
31
|
"@repo/typescript-config": "0.0.1"
|
|
28
32
|
},
|
|
29
33
|
"scripts": {
|