@wordrhyme/plugin 0.1.0-alpha.5

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.
Files changed (52) hide show
  1. package/dist/admin/index.d.ts +19 -0
  2. package/dist/admin/index.js +42 -0
  3. package/dist/admin/index.js.map +1 -0
  4. package/dist/artifact.d.ts +17 -0
  5. package/dist/artifact.js +96 -0
  6. package/dist/artifact.js.map +1 -0
  7. package/dist/chunk-46KUIGB6.js +230 -0
  8. package/dist/chunk-46KUIGB6.js.map +1 -0
  9. package/dist/chunk-6GDCFR67.js +218 -0
  10. package/dist/chunk-6GDCFR67.js.map +1 -0
  11. package/dist/chunk-DY44Q4CK.js +188 -0
  12. package/dist/chunk-DY44Q4CK.js.map +1 -0
  13. package/dist/chunk-MZOLSLJ7.js +65 -0
  14. package/dist/chunk-MZOLSLJ7.js.map +1 -0
  15. package/dist/chunk-QNCOGISF.js +694 -0
  16. package/dist/chunk-QNCOGISF.js.map +1 -0
  17. package/dist/chunk-UGMYO6AU.js +37 -0
  18. package/dist/chunk-UGMYO6AU.js.map +1 -0
  19. package/dist/chunk-YQDKOEUI.js +242 -0
  20. package/dist/chunk-YQDKOEUI.js.map +1 -0
  21. package/dist/chunk-ZUBFLOKU.js +153 -0
  22. package/dist/chunk-ZUBFLOKU.js.map +1 -0
  23. package/dist/client-WXWbuuvd.d.ts +100 -0
  24. package/dist/client.d.ts +3 -0
  25. package/dist/client.js +29 -0
  26. package/dist/client.js.map +1 -0
  27. package/dist/dev-utils.d.ts +68 -0
  28. package/dist/dev-utils.js +21 -0
  29. package/dist/dev-utils.js.map +1 -0
  30. package/dist/entity-extensions-B5BbZH-m.d.ts +56 -0
  31. package/dist/globalization.d.ts +80 -0
  32. package/dist/globalization.js +43 -0
  33. package/dist/globalization.js.map +1 -0
  34. package/dist/index.d.ts +316 -0
  35. package/dist/index.js +354 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/manifest-CPSCN_Ft.d.ts +1471 -0
  38. package/dist/react.d.ts +145 -0
  39. package/dist/react.js +94 -0
  40. package/dist/react.js.map +1 -0
  41. package/dist/release-CyapqJ3z.d.ts +230 -0
  42. package/dist/server.d.ts +114 -0
  43. package/dist/server.js +194 -0
  44. package/dist/server.js.map +1 -0
  45. package/dist/time.d.ts +34 -0
  46. package/dist/time.js +31 -0
  47. package/dist/time.js.map +1 -0
  48. package/dist/trpc.d.ts +43 -0
  49. package/dist/trpc.js +11 -0
  50. package/dist/trpc.js.map +1 -0
  51. package/dist/types-8P7XyoyQ.d.ts +1599 -0
  52. package/package.json +83 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts","../src/marketplace-publisher-contract.ts","../src/define-plugin.ts","../src/helpers.ts"],"sourcesContent":["/**\n * Plugin Context - Injected into plugin handlers\n *\n * All plugin code receives this context, which provides:\n * - Identity (pluginId, organizationId, userId)\n * - Capabilities (logger, db, permissions, queue, notifications, settings, media, storage)\n * - Observability (metrics, trace)\n */\nimport type { GlobalizationState } from \"./globalization\";\nimport type { RegistryCatalogPageEnvelope, RegistryReleaseEnvelope, RegistrySignature } from \"./release\";\nimport type { DateRangeResolver } from \"./time\";\n\nexport interface PluginContext {\n /** Plugin ID from manifest */\n pluginId: string;\n\n /** Current organization ID (from request context) */\n organizationId?: string | undefined;\n\n /** Original organization ID before any infrastructure policy context swap */\n originalOrganizationId?: string | undefined;\n\n /** Current user ID (from request context) */\n userId?: string | undefined;\n\n /** Current user profile snapshot from request context */\n user?:\n | {\n id: string;\n name?: string;\n email?: string;\n }\n | undefined;\n\n /** Request/correlation ID from the host runtime */\n requestId?: string | undefined;\n\n /** Current user's primary role and expanded role set */\n userRole?: string | undefined;\n userRoles?: string[] | undefined;\n\n /** Current team context for team-level permissions */\n currentTeamId?: string | undefined;\n\n /** Locale/timezone resolved by the host runtime */\n locale?: string | undefined;\n timezone?: string | undefined;\n /** Client-reported timezone; business logic must not treat it as authoritative. */\n clientTimeZone?: string | undefined;\n /** Host-provided calendar-date resolver for shared query infrastructure. */\n resolveDateRange?: DateRangeResolver | undefined;\n\n /** Host-provided actor metadata; runtime plugin contexts resolve to `plugin`. */\n actorType?: \"plugin\" | undefined;\n apiTokenId?: string | undefined;\n apiTokenScopes?: string[] | undefined;\n isSystemContext?: false | undefined;\n principal?:\n | {\n kind: \"plugin\";\n id: string;\n pluginId: string;\n }\n | undefined;\n invoker?: string | undefined;\n\n /** Scoped logger */\n logger: PluginLogger;\n\n /**\n * Drizzle-compatible ScopedDb bound to the plugin's private table prefix.\n * Automatically enforces LBAC, tenant filtering, auditing, and plugin table isolation.\n */\n db: PluginScopedDb;\n\n /** Host-only Marketplace execution boundary for platform reads and Publisher callbacks. */\n marketplaceOrganizationExecution?: MarketplaceOrganizationExecutionV1 | undefined;\n\n /** Authenticated upload actor supplied by the Host; never derived from request payloads. */\n marketplacePublishActor?: MarketplacePublishActor | undefined;\n\n /** Host-only Registry signing boundary. The private key never enters plugin settings or storage. */\n marketplaceRegistrySigner?: MarketplaceRegistrySigningCapability | undefined;\n\n /** Host-configured public Marketplace origin; null means production configuration is missing. */\n marketplaceRegistryBaseUrl?: string | null | undefined;\n\n /** Host-mediated Core organization creation for explicitly trusted plugins. */\n organizationProvisioning?: PluginOrganizationProvisioningCapability | undefined;\n\n /**\n * Shared database transaction for synchronous cross-plugin pipe calls.\n *\n * When present, plugin code may use this transaction to participate in the\n * caller's outer SQL transaction instead of opening an independent one.\n */\n tx?: any;\n\n /** Permission capability */\n permissions: PluginPermissionCapability;\n\n /** Public plugin API caller alias over the host's pluginApis route tree */\n plugins?: PluginApisCapability | undefined;\n\n /** Queue capability (for async job processing) */\n queue?: PluginQueueCapability | undefined;\n\n /** Notification capability (for sending notifications) */\n notifications?: PluginNotificationCapability | undefined;\n\n /** Settings capability (for plugin configuration) */\n settings: PluginSettingsCapability;\n\n /** Currency capability (for effective organization currency/rate access) */\n currency?: PluginCurrencyCapability | undefined;\n\n /** Media capability (for unified file and asset management) */\n media?: PluginMediaCapability | undefined;\n\n /** Storage capability (for registering custom storage providers) */\n storage?: PluginStorageCapability | undefined;\n\n /** Opaque plugin artifact storage for explicitly approved first-party workflows. */\n artifacts?: PluginArtifactCapability | undefined;\n\n /** Metrics capability (for recording usage metrics) */\n metrics?: PluginMetricsCapability | undefined;\n\n /** Trace capability (for accessing trace context) */\n trace?: PluginTraceCapability | undefined;\n\n /** Hook capability (for registering hook handlers) */\n hooks?: PluginHookCapability | undefined;\n\n /** Usage capability (for explicit billing consumption in dynamic scenarios) */\n usage?: PluginUsageCapability | undefined;\n\n /** External authorization capability for tenant platform/API connections */\n eAuth?: PluginEAuthCapability | undefined;\n\n /** Entity extension capability (Core-mediated extension value persistence) */\n entityExtensions?: PluginEntityExtensionCapability | undefined;\n\n /** Generic AutoCrud extension provider injected by the host runtime. */\n crudExtensions?: PluginCrudExtensionsCapability | undefined;\n\n /** Public web surface capability injected for plugin-owned web route handlers. */\n web?: PluginWebCapability | undefined;\n}\n\n/**\n * Public SDK shape for the Host-provided Drizzle-compatible database.\n *\n * The concrete type deliberately remains structural so plugin packages do not\n * depend on Server internals. Runtime enforcement is provided by ScopedDb.\n */\nexport interface PluginScopedDb {\n readonly query: any;\n /** @deprecated Prefer the v2 object-style `query` API. */\n readonly _query: any;\n select(...args: any[]): any;\n selectDistinct(...args: any[]): any;\n selectDistinctOn(...args: any[]): any;\n insert(table: any): any;\n update(table: any): any;\n delete(table: any, options?: { softDelete?: false }): any;\n $count(\n source: any,\n filters?: any,\n ): PromiseLike<number> & {\n execute(placeholderValues?: Record<string, unknown>): Promise<number>;\n };\n transaction<T>(callback: (tx: PluginScopedDb) => Promise<T>, options?: unknown): Promise<T>;\n forOrganization<T>(organizationId: string, callback: (db: PluginScopedDb) => Promise<T> | T): Promise<T>;\n}\n\nexport interface ReadonlyPluginScopedDb {\n readonly query: any;\n /** @deprecated Prefer the v2 object-style `query` API. */\n readonly _query: any;\n select(...args: any[]): any;\n selectDistinct(...args: any[]): any;\n selectDistinctOn(...args: any[]): any;\n $count(\n source: any,\n filters?: any,\n ): PromiseLike<number> & {\n execute(placeholderValues?: Record<string, unknown>): Promise<number>;\n };\n}\n\nexport type MarketplacePlatformReadAction = \"route\" | \"review-list\" | \"attestation-target\" | \"catalog\";\nexport type MarketplacePublisherAction = \"publish\" | \"review-command\" | \"release-attest\" | \"profile-manage\";\nexport type MarketplaceExecutionErrorCode =\n | \"MARKETPLACE_EXECUTION_ACTION_DENIED\"\n | \"MARKETPLACE_PUBLISHER_UNAVAILABLE\";\nexport type MarketplaceExecutionFailureCode = MarketplaceExecutionErrorCode | \"PLUGIN_DB_SCOPE_EXPIRED\";\n\nexport const MARKETPLACE_PUBLISH_AUTH_METHODS = [\n \"portal-session\",\n \"scoped-api-key\",\n] as const;\n\nexport type MarketplacePublishAuthMethod = (typeof MARKETPLACE_PUBLISH_AUTH_METHODS)[number];\n\nexport interface MarketplacePublishActor {\n actorId: string;\n authenticationMethod: MarketplacePublishAuthMethod;\n authenticatedAt: string;\n credentialId?: string | undefined;\n}\n\nexport interface MarketplaceRegistrySigningCapability {\n /** Serialize Catalog generations and Release projection changes on the Registry database clock. */\n withCatalogGeneration<T>(run: (generatedAt: string) => Promise<T>): Promise<T>;\n sign(targetId: string, envelope: RegistryReleaseEnvelope): Promise<RegistrySignature>;\n signCatalog(envelope: RegistryCatalogPageEnvelope): Promise<RegistrySignature>;\n}\n\nexport interface MarketplaceAttestationTargetV1 {\n organizationId: string;\n targetId: string;\n envelopeSha256: string;\n}\n\ndeclare const publisherCandidateBrand: unique symbol;\nexport interface OpaquePublisherCandidateV1 {\n readonly [publisherCandidateBrand]: true;\n}\n\nexport interface MarketplaceOrganizationExecutionV1 {\n withPlatformRead(\n ctx: PluginContext,\n action: \"route\",\n run: (db: ReadonlyPluginScopedDb) => Promise<string | undefined>,\n ): Promise<OpaquePublisherCandidateV1 | undefined>;\n withPlatformRead(\n ctx: PluginContext,\n action: \"review-list\",\n run: (db: ReadonlyPluginScopedDb) => Promise<string | undefined>,\n ): Promise<OpaquePublisherCandidateV1 | undefined>;\n withPlatformRead(\n ctx: PluginContext,\n action: \"attestation-target\",\n run: (db: ReadonlyPluginScopedDb) => Promise<MarketplaceAttestationTargetV1 | undefined>,\n ): Promise<OpaquePublisherCandidateV1 | undefined>;\n withPlatformRead<T>(\n ctx: PluginContext,\n action: Exclude<MarketplacePlatformReadAction, \"route\" | \"attestation-target\">,\n run: (db: ReadonlyPluginScopedDb) => Promise<T>,\n ): Promise<T>;\n withPublisher<T>(\n ctx: PluginContext,\n binding: \"current\" | OpaquePublisherCandidateV1,\n action: MarketplacePublisherAction,\n run: (db: PluginScopedDb) => Promise<T>,\n ): Promise<T>;\n}\n\nexport interface PluginOrganizationProvisioningCapability {\n provision(input: {\n name: string;\n idempotencyKey: string;\n transaction: PluginScopedDb;\n metadata?: Record<string, string | number | boolean | null> | undefined;\n }): Promise<{\n id: string;\n name: string;\n slug: string;\n status: \"created\" | \"existing\";\n }>;\n}\n\n/**\n * Framework-neutral request envelope for plugin-owned public web routes.\n *\n * This contract intentionally avoids Next.js, Pages Router, App Router, RSC,\n * TanStack Router, or any other host-specific request type. Host adapters\n * translate their native request shape into this envelope before invoking a\n * plugin web handler.\n */\nexport interface WebPluginRouteRequest {\n url: string;\n method: string;\n headers: Record<string, string>;\n cookies: Record<string, string>;\n path: string;\n query: Record<string, string | string[]>;\n organizationId: string;\n locale?: string | undefined;\n direction?: GlobalizationState[\"direction\"] | undefined;\n currency?: string | undefined;\n timezone?: string | undefined;\n globalization?: GlobalizationState | undefined;\n tenant?: WebPluginTenantInfo | undefined;\n site?: WebPluginSiteInfo | undefined;\n renderSlot?: WebSlotRenderer | undefined;\n}\n\nexport interface WebSlotRenderRequest {\n slot: string;\n props?: Record<string, unknown> | undefined;\n targetPluginId?: string | undefined;\n routeId?: string | undefined;\n}\n\nexport interface WebSlotRenderOptions {\n slot: string;\n props?: Record<string, unknown> | undefined;\n ownerPluginId?: string | undefined;\n routeId?: string | undefined;\n}\n\nexport interface WebSlotExtensionQuery {\n id: string;\n procedure: string;\n inputFrom?: \"slotProps\" | \"static\" | undefined;\n staticInput?: Record<string, unknown> | undefined;\n}\n\nexport interface WebSlotQueryResult {\n id: string;\n procedure: string;\n data?: unknown;\n error?: string | undefined;\n}\n\nexport interface WebSlotRemoteExtension {\n id: string;\n pluginId: string;\n label?: string | undefined;\n component: string;\n slot: string;\n targetPluginId: string;\n props: Record<string, unknown>;\n remoteEntry: string;\n devRemoteEntry?: string | undefined;\n moduleName?: string | undefined;\n expose?: string | undefined;\n order?: number | undefined;\n queries?: WebSlotExtensionQuery[] | undefined;\n queryResults?: WebSlotQueryResult[] | undefined;\n}\n\nexport interface WebSlotRenderResult {\n html: string;\n extensions?: WebSlotRemoteExtension[] | undefined;\n head?: WebPluginHead | undefined;\n initialData?: Record<string, unknown> | undefined;\n clientEntries?: string[] | undefined;\n}\n\nexport type WebSlotRenderer = (request: WebSlotRenderRequest) => WebSlotRenderResult | Promise<WebSlotRenderResult>;\n\nexport interface PluginWebCapability {\n renderSlot(options: WebSlotRenderOptions): WebSlotRenderResult | Promise<WebSlotRenderResult>;\n}\n\nexport interface WebPluginTenantInfo {\n organizationId: string;\n name: string;\n slug?: string | undefined;\n logo?: string | null | undefined;\n}\n\nexport interface WebPluginSiteInfo {\n mode: \"custom-domain\" | \"platform-subdomain\" | \"platform-path\" | \"internal-override\";\n basePath: string;\n publicOrigin?: string | undefined;\n host?: string | undefined;\n}\n\nexport interface WebPluginHeadLink {\n rel: string;\n href: string;\n as?: string | undefined;\n type?: string | undefined;\n}\n\nexport interface WebPluginHead {\n title?: string | undefined;\n description?: string | undefined;\n meta?: Record<string, string> | undefined;\n links?: WebPluginHeadLink[] | undefined;\n}\n\n/**\n * Framework-neutral SSR result returned by a plugin web handler.\n *\n * Redirects are represented as a 3xx status plus a `location` header so every\n * host adapter can map them into its own redirect primitive.\n */\nexport interface WebPluginRouteResult {\n status: number;\n headers?: Record<string, string> | undefined;\n head?: WebPluginHead | undefined;\n html?: string | undefined;\n initialData?: unknown;\n clientEntry?: string | undefined;\n clientEntries?: string[] | undefined;\n slotExtensions?: WebSlotRemoteExtension[] | undefined;\n routeId?: string | undefined;\n globalization?: GlobalizationState | undefined;\n site?: WebPluginSiteInfo | undefined;\n}\n\nexport type WebPluginRouteHandler<TContext extends PluginContext = PluginContext> = (\n request: WebPluginRouteRequest,\n context: TContext,\n) => WebPluginRouteResult | Promise<WebPluginRouteResult>;\n\n/**\n * Plugin Permission Definition (CASL format)\n *\n * Defines a permission that a plugin registers for use in the CASL permission system.\n * Plugins use this to declare what permissions they provide.\n *\n * @example\n * // Simple permission (manage is default action)\n * { subject: 'settings' }\n *\n * // Permission with specific actions\n * { subject: 'analytics', actions: ['read', 'export'] }\n *\n * // Permission with field-level access\n * { subject: 'report', actions: ['read'], fields: ['summary', 'chart'] }\n */\nexport interface PluginPermissionDef {\n /** Subject name (will be prefixed with plugin:{pluginId}:) */\n subject: string;\n /** Actions supported (default: ['manage']) */\n actions?: string[];\n /** Field-level restrictions (default: null = all fields) */\n fields?: string[] | null;\n /** Human-readable description for Admin UI */\n description?: string;\n}\n\n/**\n * Plugin Logger - Scoped logging interface\n *\n * Per OBSERVABILITY_GOVERNANCE §3.3:\n * - info, warn, error: Always available\n * - debug: Optional, only available when explicitly enabled by tenant admin\n */\nexport interface PluginLogger {\n info(message: string, meta?: Record<string, unknown>): void;\n warn(message: string, meta?: Record<string, unknown>): void;\n error(message: string, meta?: Record<string, unknown>): void;\n /**\n * Debug logging - only available when debug mode is enabled by tenant admin.\n * Calls are silently ignored when debug mode is disabled.\n */\n debug?(message: string, meta?: Record<string, unknown>): void;\n}\n\n/**\n * Plugin Permission Capability - Permission checking interface\n *\n * All permission checks are scoped to:\n * - Permissions declared in the plugin manifest\n * - Permissions granted to the current user\n */\nexport interface PluginPermissionCapability {\n /**\n * Check if current user has a capability\n * @param capability - Capability in format `resource:action:scope`\n * @param context - Optional context override for checks that resolve tenant or role after request setup\n * @returns true if allowed, false if denied\n */\n can(capability: string, context?: PluginPermissionCheckContext): Promise<boolean>;\n\n /**\n * Require a capability - throws if denied\n * @param capability - Capability to require\n * @param context - Optional context override for checks that resolve tenant or role after request setup\n * @throws PermissionDeniedError if permission denied\n */\n require(capability: string, context?: PluginPermissionCheckContext): Promise<void>;\n\n /**\n * Check if plugin has access to a capability\n * (Plugin must have declared this capability in manifest)\n * @param capability - Capability to check\n */\n hasDeclared(capability: string): boolean;\n}\n\nexport interface PluginPermissionCheckContext {\n requestId?: string | undefined;\n organizationId?: string | undefined;\n userId?: string | undefined;\n userRole?: string | undefined;\n userRoles?: string[] | undefined;\n currentTeamId?: string | undefined;\n actorType?: PluginContext[\"actorType\"] | undefined;\n apiTokenId?: string | undefined;\n apiTokenScopes?: string[] | undefined;\n}\n\nexport type PluginApisCapability = Record<string, any>;\n\nexport type EAuthModel = \"oauth_refresh\" | \"api_key\" | \"hmac\" | \"token\" | \"amazon_spapi\";\nexport type EAuthStatus = \"ok\" | \"reauth\" | \"retry\";\nexport type EAuthUse = \"products\" | \"orders\" | \"fulfillment\" | \"test\" | string;\n\nexport type EAuthTokenResult =\n | { status: \"ok\"; accessToken: string; accessTokenExpiresAt?: Date | undefined }\n | { status: \"reauth\"; code: string; message: string }\n | { status: \"retry\"; code: string; message: string; retryAt?: Date | undefined };\n\nexport interface EAuthRefreshInput {\n refreshToken: string;\n accountId: string;\n meta?: Record<string, unknown> | undefined;\n}\n\nexport interface EAuthRefreshResult {\n accessToken: string;\n refreshToken?: string | undefined;\n accessTokenExpiresAt?: Date | undefined;\n refreshTokenExpiresAt?: Date | undefined;\n scope?: string | undefined;\n meta?: Record<string, unknown> | undefined;\n}\n\nexport interface EAuthProvider {\n refresh(input: EAuthRefreshInput): Promise<EAuthRefreshResult>;\n}\n\nexport interface EAuthUpsertInput {\n id?: string | undefined;\n model: EAuthModel;\n connectionId: string;\n accountId: string;\n accessToken?: string | undefined;\n refreshToken?: string | undefined;\n accessTokenExpiresAt?: Date | undefined;\n refreshTokenExpiresAt?: Date | undefined;\n scope?: string | undefined;\n status?: EAuthStatus | undefined;\n meta?: Record<string, unknown> | undefined;\n}\n\nexport interface PluginEAuthCapability {\n registerProvider(provider: EAuthProvider): void;\n upsert(input: EAuthUpsertInput): Promise<{ id: string }>;\n token(input: {\n eauthId: string;\n use?: EAuthUse | undefined;\n }): Promise<EAuthTokenResult>;\n}\n\nexport interface PluginCurrencyCapability {\n /**\n * Get enabled currencies with effective current rates in the current tenant context.\n *\n * The host resolves platform-vs-tenant ownership according to infra policy.\n */\n getEffectiveEnabledCurrencies(options?: {\n organizationId?: string | undefined;\n }): Promise<\n Array<{\n code: string;\n nameI18n?: Record<string, string> | null;\n symbol?: string | null;\n decimalDigits?: number | null;\n isBase?: boolean;\n currentRate?: string | null;\n }>\n >;\n\n /**\n * Get the effective current rate for a currency code in the current tenant context.\n *\n * The host resolves platform-vs-tenant ownership according to infra policy.\n */\n getEffectiveCurrentRate(\n code: string,\n options?: {\n organizationId?: string | undefined;\n },\n ): Promise<string | null>;\n\n /**\n * Convenience helper for CNY to USD conversions.\n * Returns the effective CNY → USD rate, or null when not configured.\n */\n getEffectiveCnyToUsdRate(options?: {\n organizationId?: string | undefined;\n }): Promise<number | null>;\n}\n\nexport interface PluginEntityExtensionFilter {\n id: string;\n value: string | string[];\n variant: string;\n operator: string;\n filterId?: string | undefined;\n}\n\nexport interface PluginEntityExtensionCapability {\n /**\n * Save extension values for a target plugin CRUD row through the platform contract.\n *\n * Values are keyed by manifest field name. The platform resolves each\n * field owner from enabled plugin manifests, invokes owner save handlers,\n * and refreshes Core's query projection.\n */\n saveValues(options: {\n /** Globally unique extension target id, e.g. \"com.example.shop.stores\". */\n id: string;\n entityId: string;\n ext?: Record<string, unknown> | null | undefined;\n tx?: unknown;\n }): Promise<void>;\n\n /**\n * Match target CRUD row ids from Core's query projection for extension-field filters.\n *\n * This is a Core-mediated read model query. Plugins receive row ids only;\n * plugin-owned semantic extension values stay in the owner plugin's private\n * storage and are not exposed through this capability.\n */\n matchEntityIds(options: {\n /** Globally unique extension target id, e.g. \"com.example.shop.stores\". */\n id: string;\n filters: PluginEntityExtensionFilter[];\n joinOperator?: \"and\" | \"or\" | undefined;\n limit?: number | undefined;\n }): Promise<string[]>;\n\n /**\n * Match target CRUD row ids by global search over fields whose manifest\n * declaration has `search: true`.\n */\n searchEntityIds(options: {\n /** Globally unique extension target id, e.g. \"com.example.shop.stores\". */\n id: string;\n search: string;\n limit?: number | undefined;\n }): Promise<string[]>;\n}\n\nexport interface PluginCrudExtensionFilter {\n id: string;\n value: string | string[];\n variant: string;\n operator: string;\n filterId?: string | undefined;\n}\n\nexport interface PluginCrudExtensionMetadata {\n schema?: unknown;\n fields?: Record<string, unknown>;\n errors?: string[] | undefined;\n}\n\nexport interface PluginCrudExtensionsCapability {\n getMetadata?(options: {\n /** Globally unique CRUD target id, e.g. \"com.example.shop.stores\". */\n id: string;\n }): Promise<PluginCrudExtensionMetadata>;\n\n saveExtraValues(options: {\n /** Globally unique CRUD target id, e.g. \"com.example.shop.stores\". */\n id: string;\n entityId: string;\n rawValues: Record<string, unknown>;\n baseValues: Record<string, unknown>;\n extraValues: Record<string, unknown>;\n tx?: unknown;\n }): Promise<void>;\n\n readProjection(options: {\n /** Globally unique CRUD target id, e.g. \"com.example.shop.stores\". */\n id: string;\n entityIds: string[];\n fields?: string[] | undefined;\n }): Promise<Record<string, Record<string, unknown>>>;\n\n matchEntityIds(options: {\n /** Globally unique CRUD target id, e.g. \"com.example.shop.stores\". */\n id: string;\n filters: PluginCrudExtensionFilter[];\n joinOperator?: \"and\" | \"or\" | undefined;\n limit?: number | undefined;\n }): Promise<string[]>;\n\n searchEntityIds(options: {\n /** Globally unique CRUD target id, e.g. \"com.example.shop.stores\". */\n id: string;\n search: string;\n limit?: number | undefined;\n }): Promise<string[]>;\n}\n\n/**\n * Plugin Queue Capability - Async job processing\n *\n * All jobs are namespaced with plugin_{pluginId}_{jobName}\n * Subject to rate limits and payload size restrictions.\n */\nexport interface PluginQueueCapability {\n /**\n * Add a job to the queue\n * @param jobName - Job name (will be prefixed with plugin_{pluginId}_)\n * @param data - Job payload (must be JSON-serializable, max 64KB)\n * @param options - Job options\n */\n addJob<T = unknown>(jobName: string, data: T, options?: PluginJobOptions): Promise<{ jobId: string }>;\n\n /**\n * Get job status\n * @param jobId - Job ID returned from addJob\n */\n getJobStatus(jobId: string): Promise<PluginJobStatus>;\n\n /**\n * Cancel a pending job\n * @param jobId - Job ID to cancel\n */\n cancelJob(jobId: string): Promise<boolean>;\n}\n\n/**\n * Plugin Job Options\n */\nexport interface PluginJobOptions {\n /** Job priority: 'low' | 'normal' | 'high' | 'critical' */\n priority?: \"low\" | \"normal\" | \"high\" | \"critical\";\n /** Stable job id for idempotent queueing */\n jobId?: string;\n /** Delay in milliseconds before processing */\n delay?: number;\n /** Number of retry attempts on failure */\n attempts?: number;\n /** Backoff strategy for retries */\n backoff?: {\n type: \"fixed\" | \"exponential\";\n delay: number;\n };\n /** Remove job after completion */\n removeOnComplete?: boolean;\n /** Remove job after failure */\n removeOnFail?: boolean;\n}\n\n/**\n * Plugin Job Status\n */\nexport interface PluginJobStatus {\n id: string;\n name: string;\n state: \"waiting\" | \"active\" | \"completed\" | \"failed\" | \"delayed\";\n progress?: number;\n returnValue?: unknown;\n failedReason?: string;\n timestamp: number;\n processedOn?: number;\n finishedOn?: number;\n}\n\n/**\n * Plugin Notification Capability - Send notifications (Unified Contract v2)\n *\n * Plugins can send notifications to users via Core's notification system.\n * All notifications are tagged with sourcePluginId and validated against manifest.\n *\n * Key features:\n * - Type validation: notification type must be declared in manifest\n * - Rate limiting: plugin-level and user-level limits enforced\n * - Aggregation: automatic grouping based on manifest-declared strategy\n * - Webhooks: async callbacks for click/archive events\n */\nexport interface PluginNotificationCapability {\n /**\n * Send a notification using the unified contract\n *\n * The notification type must be declared in the plugin's manifest.\n * Rate limits are enforced (plugin: 100/min, 1000/hr, 10000/day; user: 10/min, 50/hr).\n *\n * @param params - Notification parameters\n * @returns Promise resolving to notification ID\n * @throws PluginNotificationValidationError if type not declared in manifest\n * @throws RateLimitExceededError if rate limit exceeded\n * @throws PermissionDeniedError if notification:send not declared\n */\n send(params: PluginNotificationSendParams): Promise<PluginNotificationSendResult>;\n\n /**\n * Register a notification template (legacy, still supported)\n * Templates are namespaced: plugin_{pluginId}_{templateKey}\n */\n registerTemplate(template: PluginNotificationTemplate): Promise<void>;\n\n /**\n * Register a notification channel (legacy, still supported)\n * Channels are namespaced: plugin_{pluginId}_{channelKey}\n */\n registerChannel(channel: PluginNotificationChannel): Promise<void>;\n\n /**\n * Subscribe to notification.created events\n * Allows plugins to enhance notifications (e.g., send to external services)\n */\n onNotificationCreated(handler: (event: PluginNotificationEvent) => void | Promise<void>): () => void;\n}\n\n// ============================================================================\n// Unified Notification Contract v2 Types\n// ============================================================================\n\n/**\n * Plugin Notification Send Parameters (Unified Contract v2)\n *\n * Simplified API where plugins declare \"intent\", platform handles \"execution\".\n */\nexport interface PluginNotificationSendParams {\n /**\n * Notification type ID - must match a type declared in manifest.notifications.types\n * @example \"task_reminder\", \"content_liked\"\n */\n type: string;\n\n /**\n * Target user ID to receive the notification\n */\n userId: string;\n\n /**\n * Actor who triggered the notification (optional)\n * If not provided, the plugin itself is treated as the actor\n */\n actor?: PluginNotificationActor;\n\n /**\n * Target object the notification is about\n */\n target: PluginNotificationTarget;\n\n /**\n * Custom data for template rendering\n * These values are passed to i18n templates as variables\n */\n data?: Record<string, unknown>;\n\n /**\n * Locale for i18n (e.g., 'en-US', 'zh-CN')\n * Falls back to user preference or 'en-US'\n */\n locale?: string;\n}\n\n/**\n * Notification Actor - who triggered the notification\n */\nexport interface PluginNotificationActor {\n /** Actor ID (user ID or plugin ID) */\n id: string;\n /** Actor type */\n type: \"user\" | \"plugin\";\n /** Display name */\n name: string;\n /** Avatar URL (optional) */\n avatarUrl?: string;\n}\n\n/**\n * Notification Target - what the notification is about\n */\nexport interface PluginNotificationTarget {\n /** Target type (e.g., 'post', 'comment', 'task') */\n type: string;\n /** Target ID */\n id: string;\n /** URL to navigate when notification is clicked */\n url: string;\n /** Preview image URL (optional, for rich notifications) */\n previewImage?: string;\n}\n\n/**\n * Plugin Notification Send Result\n */\nexport interface PluginNotificationSendResult {\n /** The created notification ID */\n notificationId: string;\n}\n\n/**\n * Rate Limit Configuration (read from manifest or platform defaults)\n */\nexport interface PluginRateLimitConfig {\n perPlugin: {\n maxPerMinute: number; // default: 100\n maxPerHour: number; // default: 1000\n maxPerDay: number; // default: 10000\n };\n perUser: {\n maxPerMinute: number; // default: 10\n maxPerHour: number; // default: 50\n };\n circuitBreaker: {\n failureThreshold: number; // consecutive failures to trigger\n cooldownSeconds: number; // cooldown period\n };\n}\n\n/**\n * Rate Limit Result\n */\nexport interface PluginRateLimitResult {\n allowed: boolean;\n remaining: number;\n resetAt: string; // ISO 8601\n retryAfter?: number; // seconds until retry allowed\n reason?: \"RATE_LIMIT_EXCEEDED\" | \"CIRCUIT_BREAKER_OPEN\";\n}\n\n/**\n * Notification Webhook Payload - sent to plugin webhooks\n */\nexport interface NotificationWebhookPayload {\n /** Event type */\n event: \"clicked\" | \"archived\";\n /** Notification ID */\n notificationId: string;\n /** User who performed the action */\n userId: string;\n /** Organization ID */\n organizationId: string;\n /** Notification type (as declared in manifest) */\n type: string;\n /** Target object */\n target: { type: string; id: string; url?: string };\n /** Event timestamp (ISO 8601) */\n timestamp: string;\n}\n\n// ============================================================================\n// Legacy Types (still supported for backward compatibility)\n// ============================================================================\n\n/**\n * Plugin Notification Input (Legacy - use PluginNotificationSendParams instead)\n * @deprecated Use PluginNotificationSendParams for new implementations\n */\nexport interface PluginNotificationInput {\n /** Target user ID */\n userId: string;\n /** Template key (will be prefixed with plugin_{pluginId}_ if not already) */\n templateKey: string;\n /** Variables for template interpolation */\n variables: Record<string, unknown>;\n /** Notification type */\n type?: \"info\" | \"success\" | \"warning\" | \"error\";\n /** Link to navigate when clicked */\n link?: string;\n /** Actor ID (who triggered the notification) */\n actorId?: string;\n /** Entity reference */\n entityId?: string;\n entityType?: string;\n /** Grouping key for bundling */\n groupKey?: string;\n /** Idempotency key to prevent duplicates */\n idempotencyKey?: string;\n /** Priority override */\n priority?: \"low\" | \"normal\" | \"high\" | \"urgent\";\n /** Channel overrides */\n channels?: string[];\n /** Locale for i18n */\n locale?: string;\n}\n\n/**\n * Plugin Notification Result (Legacy)\n * @deprecated Use PluginNotificationSendResult for new implementations\n */\nexport interface PluginNotificationResult {\n notificationId: string;\n channels: string[];\n decisionTrace: Array<{\n channel: string;\n included: boolean;\n reason: string;\n }>;\n}\n\n/**\n * Plugin Notification Template\n */\nexport interface PluginNotificationTemplate {\n /** Template key (will be prefixed with plugin_{pluginId}_) */\n key: string;\n /** Display name */\n name: string;\n /** Description */\n description?: string;\n /** i18n title templates */\n title: Record<string, string>;\n /** i18n message templates */\n message: Record<string, string>;\n /** Variables that can be interpolated */\n variables?: string[];\n /** Default channels */\n defaultChannels?: string[];\n /** Default priority */\n priority?: \"low\" | \"normal\" | \"high\" | \"urgent\";\n}\n\n/**\n * Plugin Notification Channel\n */\nexport interface PluginNotificationChannel {\n /** Channel key (will be prefixed with plugin_{pluginId}_) */\n key: string;\n /** i18n display name */\n name: Record<string, string>;\n /** i18n description */\n description?: Record<string, string>;\n /** Icon name */\n icon?: string;\n /** User configuration schema (JSON Schema) */\n configSchema?: Record<string, unknown>;\n}\n\n/**\n * Plugin Notification Event (for onNotificationCreated)\n */\nexport interface PluginNotificationEvent {\n notification: {\n id: string;\n userId: string;\n organizationId: string;\n templateKey?: string;\n type: string;\n title: string;\n message: string;\n html?: string;\n link?: string;\n priority: \"low\" | \"normal\" | \"high\" | \"urgent\";\n actorId?: string;\n entityId?: string;\n entityType?: string;\n groupKey?: string;\n sourcePluginId?: string;\n };\n user: {\n id: string;\n email?: string;\n preferences: {\n enabledChannels: string[];\n emailFrequency: \"instant\" | \"hourly\" | \"daily\";\n };\n };\n channels: string[];\n}\n\n/**\n * Plugin Settings Capability - Configuration management for plugins\n *\n * All settings are automatically scoped to the plugin's namespace:\n * - plugin_global: Plugin-wide settings (shared across all tenants)\n * - plugin_tenant: Per-tenant plugin settings\n *\n * Plugins cannot access Core settings or other plugins' settings.\n */\nexport interface PluginSettingsCapability {\n /**\n * Get a setting value\n * Resolution order: plugin_tenant → plugin_global → defaultValue\n *\n * @param key - Setting key (without plugin prefix)\n * @param defaultValue - Default value if not found\n * @returns The setting value or default\n */\n get<T = unknown>(key: string, defaultValue?: T): Promise<T | null>;\n\n /**\n * Set a setting value\n *\n * @param key - Setting key (without plugin prefix)\n * @param value - Value to store\n * @param options - Additional options\n */\n set(key: string, value: unknown, options?: PluginSettingOptions): Promise<void>;\n\n /**\n * Delete a setting\n *\n * @param key - Setting key to delete\n * @param options - Scope options\n */\n delete(key: string, options?: { global?: boolean }): Promise<boolean>;\n\n /**\n * List all settings for the plugin\n *\n * @param options - Filter options\n * @returns Array of settings\n */\n list(options?: {\n global?: boolean;\n keyPrefix?: string;\n }): Promise<PluginSettingEntry[]>;\n\n /**\n * Check if a feature flag is enabled for the current context\n *\n * @param flagKey - Feature flag key\n * @returns true if enabled, false otherwise\n */\n isFeatureEnabled(flagKey: string): Promise<boolean>;\n}\n\n/**\n * Plugin Setting Options\n */\nexport interface PluginSettingOptions {\n /** Store as global (plugin_global) instead of tenant-scoped (plugin_tenant) */\n global?: boolean;\n /** Encrypt the value (for sensitive data like API keys) */\n encrypted?: boolean;\n /** Description for admin UI */\n description?: string;\n}\n\n/**\n * Plugin Setting Entry (for list operation)\n */\nexport interface PluginSettingEntry {\n key: string;\n value: unknown;\n scope: \"plugin_global\" | \"plugin_tenant\";\n encrypted: boolean;\n description?: string | undefined;\n}\n\n// ============================================================================\n// Media/Storage Capabilities\n// ============================================================================\n\n/**\n * Plugin Media Capability - Unified file and asset management\n *\n * Provides plugins with the ability to upload, manage, and organize media.\n * Replaces the separate File and Asset capabilities.\n * All operations are scoped to the current tenant.\n */\nexport interface PluginMediaCapability {\n /**\n * Upload a media file\n * @param input - Media upload input\n * @returns Uploaded media info\n */\n upload(input: PluginMediaUploadInput): Promise<PluginMediaInfo>;\n\n /**\n * Get media info by ID\n * @param mediaId - Media ID\n * @returns Media info or null if not found\n */\n get(mediaId: string): Promise<PluginMediaInfo | null>;\n\n /**\n * Update media metadata\n * @param mediaId - Media ID\n * @param data - Update data\n */\n update(mediaId: string, data: PluginMediaUpdateData): Promise<PluginMediaInfo>;\n\n /**\n * Download media content\n * @param mediaId - Media ID\n * @returns Media content as Buffer\n */\n download(mediaId: string): Promise<Buffer>;\n\n /**\n * Get signed URL for media access\n * @param mediaId - Media ID\n * @param options - URL options\n * @returns Signed URL with expiration\n */\n getSignedUrl(mediaId: string, options?: { expiresIn?: number }): Promise<{ url: string; expiresIn: number }>;\n\n /**\n * Get fixed display URL for media access\n * @param mediaId - Media ID\n * @param options - Display URL options\n * @returns Stable application-controlled display URL\n */\n getDisplayUrl(mediaId: string, options?: { variant?: string }): Promise<{ url: string; variant: string }>;\n\n /**\n * Resolve a media reference or legacy signed file URL to a display URL\n * @param value - Media ID, signed file URL, display URL, or external URL\n * @param options - Display URL options\n * @returns Application-controlled display URL when resolvable\n */\n resolveAccessUrl(value: string, options?: { variant?: string }): Promise<{ url: string }>;\n\n /**\n * Delete a media (soft delete)\n * @param mediaId - Media ID\n */\n delete(mediaId: string): Promise<void>;\n\n /**\n * List media with filtering and pagination\n * @param query - Query options\n */\n list(query?: PluginMediaQuery): Promise<PluginPaginatedResult<PluginMediaInfo>>;\n\n /**\n * Get URL for a media variant\n * @param mediaId - Media ID\n * @param variant - Variant name (e.g., 'thumbnail', 'medium')\n */\n getVariantUrl(mediaId: string, variant: string): Promise<string>;\n\n /**\n * Get all variants for a media\n * @param mediaId - Media ID\n */\n getVariants(mediaId: string): Promise<PluginMediaVariant[]>;\n}\n\n/**\n * Plugin Media Upload Input\n */\nexport interface PluginMediaUploadInput {\n /** File content */\n content: Buffer;\n /** Original filename */\n filename: string;\n /** MIME type */\n mimeType: string;\n /** Is publicly accessible */\n isPublic?: boolean;\n /** Alt text for accessibility */\n alt?: string;\n /** Title */\n title?: string;\n /** Tags for organization */\n tags?: string[];\n /** Folder path */\n folderPath?: string;\n /** Additional metadata */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Plugin Media Info\n */\nexport interface PluginMediaInfo {\n id: string;\n filename: string;\n mimeType: string;\n size: number;\n isPublic: boolean;\n alt?: string;\n title?: string;\n tags: string[];\n folderPath?: string;\n width?: number;\n height?: number;\n format?: string;\n metadata?: Record<string, unknown>;\n createdAt: Date;\n updatedAt: Date;\n}\n\n/**\n * Plugin Media Update Data\n */\nexport interface PluginMediaUpdateData {\n alt?: string;\n title?: string;\n tags?: string[];\n folderPath?: string;\n}\n\n/**\n * Plugin Media Variant\n */\nexport interface PluginMediaVariant {\n name: string;\n mediaId: string;\n width?: number;\n height?: number;\n format?: string;\n}\n\n/**\n * Plugin Media Query\n */\nexport interface PluginMediaQuery {\n /** Filter by MIME type or category (e.g., 'image/*') */\n mimeType?: string;\n /** Tag filter */\n tags?: string[];\n /** Folder path filter (prefix match) */\n folderPath?: string;\n /** Search in filename/alt/title */\n search?: string;\n /** Sort field */\n sortBy?: \"createdAt\" | \"updatedAt\" | \"filename\";\n /** Sort order */\n sortOrder?: \"asc\" | \"desc\";\n /** Page number */\n page?: number;\n /** Page size */\n pageSize?: number;\n}\n\n// ---- Legacy aliases (deprecated) ----\n/** @deprecated Use PluginMediaCapability */\nexport type PluginFileCapability = {\n upload(input: PluginFileUploadInput): Promise<PluginFileInfo>;\n get(fileId: string): Promise<PluginFileInfo | null>;\n download(fileId: string): Promise<Buffer>;\n getSignedUrl(fileId: string, options?: { expiresIn?: number }): Promise<{ url: string; expiresIn: number }>;\n delete(fileId: string): Promise<void>;\n list(query?: PluginFileQuery): Promise<PluginPaginatedResult<PluginFileInfo>>;\n};\n/** @deprecated Use PluginMediaUploadInput */\nexport interface PluginFileUploadInput {\n content: Buffer;\n filename: string;\n mimeType: string;\n isPublic?: boolean;\n metadata?: Record<string, unknown>;\n}\n/** @deprecated Use PluginMediaInfo */\nexport interface PluginFileInfo {\n id: string;\n filename: string;\n mimeType: string;\n size: number;\n isPublic: boolean;\n metadata?: Record<string, unknown>;\n createdAt: Date;\n updatedAt: Date;\n}\n/** @deprecated Use PluginMediaQuery */\nexport interface PluginFileQuery {\n search?: string;\n mimeType?: string;\n page?: number;\n pageSize?: number;\n}\n/** @deprecated Use PluginMediaCapability */\nexport type PluginAssetCapability = {\n create(fileId: string, options?: PluginAssetCreateOptions): Promise<PluginAssetInfo>;\n get(assetId: string): Promise<PluginAssetInfo | null>;\n update(assetId: string, data: PluginAssetUpdateData): Promise<PluginAssetInfo>;\n delete(assetId: string): Promise<void>;\n list(query?: PluginAssetQuery): Promise<PluginPaginatedResult<PluginAssetInfo>>;\n getVariantUrl(assetId: string, variant: string): Promise<string>;\n getVariants(assetId: string): Promise<PluginAssetVariant[]>;\n};\n/** @deprecated Use PluginMediaUpdateData */\nexport interface PluginAssetCreateOptions {\n type?: \"image\" | \"video\" | \"document\" | \"other\";\n alt?: string;\n title?: string;\n tags?: string[];\n folderPath?: string;\n}\n/** @deprecated Use PluginMediaUpdateData */\nexport interface PluginAssetUpdateData {\n alt?: string;\n title?: string;\n tags?: string[];\n folderPath?: string;\n}\n/** @deprecated Use PluginMediaInfo */\nexport interface PluginAssetInfo {\n id: string;\n fileId: string;\n type: \"image\" | \"video\" | \"document\" | \"other\";\n alt?: string;\n title?: string;\n tags: string[];\n folderPath?: string;\n width?: number;\n height?: number;\n format?: string;\n createdAt: Date;\n updatedAt: Date;\n}\n/** @deprecated Use PluginMediaVariant */\nexport interface PluginAssetVariant {\n name: string;\n fileId: string;\n width: number;\n height: number;\n format: string;\n}\n/** @deprecated Use PluginMediaQuery */\nexport interface PluginAssetQuery {\n type?: \"image\" | \"video\" | \"document\" | \"other\";\n tags?: string[];\n folderPath?: string;\n search?: string;\n sortBy?: \"createdAt\" | \"updatedAt\" | \"title\";\n sortOrder?: \"asc\" | \"desc\";\n page?: number;\n pageSize?: number;\n}\n\n/**\n * Plugin Storage Capability - Custom storage provider registration\n *\n * Allows plugins to register custom storage providers (e.g., S3, OSS, R2).\n * Providers registered by plugins are automatically namespaced with plugin ID.\n */\nexport interface PluginStorageCapability {\n /**\n * Register a custom storage provider\n * The provider type will be prefixed: plugin_{pluginId}_{type}\n * @param config - Provider configuration\n */\n registerProvider(config: PluginStorageProviderConfig): Promise<void>;\n\n /**\n * List registered storage providers by this plugin\n */\n listProviders(): Promise<PluginStorageProviderInfo[]>;\n\n /**\n * Unregister a storage provider\n * @param type - Provider type (without plugin prefix)\n */\n unregisterProvider(type: string): Promise<void>;\n}\n\nexport interface PluginArtifactCapability {\n put(input: {\n content: Uint8Array;\n filename: string;\n mediaType: string;\n metadata?: Record<string, unknown>;\n }): Promise<{\n key: string;\n size: number;\n sha256: string;\n }>;\n\n get(key: string): Promise<Uint8Array>;\n\n delete(key: string): Promise<void>;\n}\n\n/**\n * Plugin Storage Provider Config\n */\nexport interface PluginStorageProviderConfig {\n /** Provider type (will be prefixed with plugin_{pluginId}_) */\n type: string;\n /** Display name for admin UI */\n name: string;\n /** Description */\n description?: string;\n /** Configuration schema (JSON Schema) */\n configSchema: Record<string, unknown>;\n /** Provider factory function */\n factory: (config: Record<string, unknown>) => PluginStorageProvider;\n}\n\n/**\n * Plugin Storage Provider Info\n */\nexport interface PluginStorageProviderInfo {\n type: string;\n name: string;\n description?: string;\n pluginId: string;\n}\n\n/**\n * Plugin Storage Provider Interface\n * Plugins implementing custom storage must implement this interface.\n */\nexport interface PluginStorageProvider {\n /** Provider type identifier */\n readonly type: string;\n\n /** Upload a file */\n upload(input: PluginStorageUploadInput): Promise<PluginStorageUploadResult>;\n\n /** Download file content */\n download(key: string): Promise<Buffer>;\n\n /** Delete a file */\n delete(key: string): Promise<void>;\n\n /** Check if file exists */\n exists(key: string): Promise<boolean>;\n\n /** Get signed URL */\n getSignedUrl(\n key: string,\n options: { expiresIn: number; operation: \"get\" | \"put\"; contentType?: string },\n ): Promise<string>;\n\n /** Initiate multipart upload */\n initiateMultipartUpload(key: string): Promise<string>;\n\n /** Upload a part */\n uploadPart(uploadId: string, partNumber: number, body: Buffer): Promise<{ partNumber: number; etag: string }>;\n\n /** Complete multipart upload */\n completeMultipartUpload(uploadId: string, parts: Array<{ partNumber: number; etag: string }>): Promise<void>;\n\n /** Abort multipart upload */\n abortMultipartUpload(uploadId: string): Promise<void>;\n}\n\n/**\n * Plugin Storage Upload Input\n */\nexport interface PluginStorageUploadInput {\n key: string;\n body: Buffer;\n contentType: string;\n metadata?: Record<string, string>;\n}\n\n/**\n * Plugin Storage Upload Result\n */\nexport interface PluginStorageUploadResult {\n key: string;\n size: number;\n etag?: string;\n}\n\n/**\n * Generic paginated result\n */\nexport interface PluginPaginatedResult<T> {\n items: T[];\n total: number;\n page: number;\n pageSize: number;\n totalPages: number;\n}\n\n// ============================================================================\n// Observability Capabilities\n// ============================================================================\n\n/**\n * Allowed labels for plugin metrics\n *\n * Per OBSERVABILITY_GOVERNANCE §4.1:\n * Only these labels are allowed to prevent cardinality explosion\n */\nexport type PluginMetricsAllowedLabels = {\n model?: string;\n type?: string;\n status?: \"success\" | \"failure\";\n};\n\n/**\n * Plugin Metrics Capability - Usage metrics recording\n *\n * Per OBSERVABILITY_GOVERNANCE §4.1:\n * - Only increment() for discrete event counters\n * - No histogram/gauge/observe/set methods\n * - Labels are restricted to a whitelist\n */\nexport interface PluginMetricsCapability {\n /**\n * Increment a counter metric\n *\n * @param name - Metric name (will be prefixed with plugin_)\n * @param labels - Optional labels (whitelist enforced: model, type, status)\n * @param value - Increment value (default: 1)\n *\n * @example\n * ctx.metrics.increment('content_generated', { model: 'gpt-4', status: 'success' });\n */\n increment(name: string, labels?: PluginMetricsAllowedLabels, value?: number): void;\n}\n\n/**\n * Plugin Trace Capability - Read-only trace context access\n *\n * Per OBSERVABILITY_GOVERNANCE §5:\n * - Plugins can only read trace context\n * - Plugins cannot create spans or modify trace context\n */\nexport interface PluginTraceCapability {\n /**\n * Get the current trace ID (W3C format, 32 hex chars)\n * @returns The trace ID or undefined if not available\n */\n getTraceId(): string | undefined;\n\n /**\n * Get the current span ID (16 hex chars)\n * @returns The span ID or undefined if not available\n */\n getSpanId(): string | undefined;\n}\n\n// ============================================================================\n// Hook Capabilities\n// ============================================================================\n\n/**\n * Hook Priority Enum\n * Controls execution order within a hook\n */\nexport enum HookPriority {\n EARLIEST = 0, // System-level, plugins should not use\n EARLY = 25, // Plugins needing early execution\n NORMAL = 50, // Default priority\n LATE = 75, // Plugins needing late execution\n LATEST = 100, // Final execution (e.g., logging)\n}\n\n/**\n * Hook Handler Options\n */\nexport interface HookHandlerOptions {\n /** Handler priority (default: NORMAL) */\n priority?: HookPriority;\n /** Handler timeout in ms (default: 5000) */\n timeout?: number;\n}\n\n/**\n * Plugin Hook Capability - Register hook handlers\n *\n * Plugins can register handlers for Core-defined hooks to:\n * - Actions: Perform async side-effects (logging, notifications, external sync)\n * - Filters: Transform data in the pipeline (validation, enrichment, masking)\n *\n * Per EVENT_HOOK_GOVERNANCE (Frozen v1):\n * - Plugins CANNOT block Core execution (except via HookAbortError in filters)\n * - Plugins CANNOT access other plugins' handlers\n */\n\n/**\n * Hook Event Map — Extensible type registry for TypeScript autocompletion\n *\n * Plugins can augment this interface to declare their hooks:\n *\n * ```typescript\n * // plugins/crm/src/shared/hook-types.ts\n * declare module '@wordrhyme/plugin' {\n * interface HookEventMap {\n * 'crm.customer.promoted': { customerId: string; organizationId: string };\n * 'crm.customer.beforeCreate': { name: string; organizationId: string };\n * 'crm.createProspect': { name: string; organizationId: string; id?: string; status?: string };\n * }\n * }\n * ```\n *\n * This enables:\n * - Hook ID autocompletion in on() and emit()\n * - Automatic payload type inference\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface HookEventMap {}\n\nexport interface PluginHookCapability {\n /**\n * Register a hook handler\n *\n * Subscribes to a hook. When someone calls `emit()` for this hookId,\n * your handler will be called with the data.\n *\n * - Handler can optionally return modified data (for pipe mode)\n * - Handler can throw HookAbortError to abort the operation\n * - Returns an unsubscribe function\n *\n * @param hookId - The hook ID (e.g., 'crm.customer.afterCreate')\n * @param handler - Handler function, optionally returns modified data\n * @param options - Handler options (priority, timeout)\n * @returns Unsubscribe function\n *\n * @example\n * // Notification handler (no return needed)\n * ctx.hooks.on('crm.customer.promoted', async (data) => {\n * await sendWelcomeEmail(data.customerId);\n * });\n *\n * @example\n * // Service handler (returns result)\n * ctx.hooks.on('crm.createProspect', async (data) => {\n * const id = await db.insert(customers).values(data);\n * return { ...data, id, status: 'prospect' };\n * });\n *\n * @example\n * // Abort handler (blocks operation)\n * ctx.hooks.on('crm.customer.beforeCreate', async (data) => {\n * if (!data.name) throw new HookAbortError('名字不能为空');\n * });\n */\n // Type-safe overload: auto-infer payload from HookEventMap\n on<K extends keyof HookEventMap>(\n hookId: K,\n handler: (\n data: HookEventMap[K],\n context: HookContext,\n ) => HookEventMap[K] | void | Promise<HookEventMap[K] | void>,\n options?: HookHandlerOptions,\n ): () => void;\n on<K extends keyof HookEventMap>(\n hookId: K[],\n handler: (\n data: HookEventMap[K],\n context: HookContext,\n ) => HookEventMap[K] | void | Promise<HookEventMap[K] | void>,\n options?: HookHandlerOptions,\n ): () => void;\n // Generic overload: any string hookId\n on<T = unknown>(\n hookId: string,\n handler: (data: T, context: HookContext) => T | void | Promise<T | void>,\n options?: HookHandlerOptions,\n ): () => void;\n on<T = unknown>(\n hookId: string[],\n handler: (data: T, context: HookContext) => T | void | Promise<T | void>,\n options?: HookHandlerOptions,\n ): () => void;\n\n /**\n * Emit a hook (trigger all registered handlers)\n *\n * Default mode: handlers run in **parallel**, return value from the\n * first handler that returns something (service call pattern).\n *\n * Pipe mode (`{ mode: 'pipe' }` or legacy `{ pipe: true }`): handlers run\n * **serially**, each receives the previous handler's output (data\n * transformation / synchronous service-call pattern).\n *\n * @param hookId - The hook ID\n * @param data - Data to pass to handlers\n * @param options - Emit options\n * @returns The handler result (or original data if no handler returns)\n *\n * @example\n * // Parallel (default) — notification, no return needed\n * await ctx.hooks.emit('crm.customer.promoted', { customerId: 'xxx' });\n *\n * @example\n * // Parallel — service call, get return value\n * const customer = await ctx.hooks.emit('crm.createProspect', { name: 'Acme' });\n *\n * @example\n * // Pipe mode — serial data transformation\n * const enrichedData = await ctx.hooks.emit('crm.customer.beforeCreate', data, { mode: 'pipe' });\n */\n // Type-safe overload: auto-infer payload from HookEventMap\n emit<K extends keyof HookEventMap>(\n hookId: K,\n data: HookEventMap[K],\n options?: HookEmitOptions,\n ): Promise<HookEventMap[K]>;\n // Generic overload: any string hookId\n emit<T = unknown>(hookId: string, data: T, options?: HookEmitOptions): Promise<T>;\n\n /**\n * List all available hooks\n *\n * Returns the list of hook definitions that plugins can subscribe to.\n * Useful for discovery and validation.\n *\n * @returns Array of hook definitions\n */\n listHooks(): Promise<\n Array<{\n id: string;\n description: string;\n }>\n >;\n\n // ── Deprecated aliases (backward compatibility) ──\n\n /** @deprecated Use `on()` instead */\n addAction<T = unknown>(\n hookId: string,\n handler: (data: T, ctx: PluginContext) => void | Promise<void>,\n options?: HookHandlerOptions,\n ): () => void;\n\n /** @deprecated Use `on()` instead */\n addFilter<T = unknown>(\n hookId: string,\n handler: (data: T, ctx: PluginContext) => T | Promise<T>,\n options?: HookHandlerOptions,\n ): () => void;\n\n /** @deprecated Use `emit(hookId, data, { pipe: true })` instead */\n applyFilter<T = unknown>(hookId: string, initialValue: T): Promise<T>;\n}\n\n/**\n * Hook emit options\n */\nexport interface HookEmitOptions {\n /**\n * Emit mode.\n * - `event` (default): parallel fire-and-forget / first-result-wins\n * - `pipe`: serial synchronous pipeline, fail-fast on handler error\n * - `effect`: serial synchronous effects, fail-fast, ignores handler return values\n */\n mode?: \"event\" | \"pipe\" | \"effect\";\n\n /**\n * Dispatch intent.\n * - `auto` (default): command-like bare ids may route to pluginApis.\n * - `command`: only route to the matching pluginApis procedure.\n * - `hook`: only notify registered hook listeners.\n */\n dispatch?: \"auto\" | \"command\" | \"hook\";\n\n /**\n * Shared database transaction.\n *\n * Only valid with `mode: 'pipe'` because event mode is intentionally\n * fire-and-forget and does not provide transactional guarantees.\n */\n tx?: any;\n\n /**\n * Request user id to pass through to synchronous hook handlers.\n */\n userId?: string;\n\n /** @deprecated Use `mode: 'pipe'` instead. Kept for backward compatibility. */\n pipe?: boolean;\n}\n\nexport interface HookTransaction {\n run<T>(callback: (db: NonNullable<PluginContext[\"db\"]>) => Promise<T>): Promise<T>;\n}\n\nexport interface HookContext {\n id: string;\n hookId: string;\n traceId?: string;\n pluginId: string;\n organizationId?: string | undefined;\n userId?: string | undefined;\n tx?: HookTransaction | undefined;\n}\n\n/**\n * Hook Abort Error - Thrown by filters to block operations\n *\n * When a filter handler throws this error, the operation is aborted\n * and the error message is returned to the caller.\n */\nexport class HookAbortError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"HookAbortError\";\n }\n}\n\n// ============================================================================\n// Usage/Billing Capabilities\n// ============================================================================\n\n/**\n * Plugin Usage Capability - Explicit billing consumption\n *\n * Used by plugins that need dynamic consumption amounts per request\n * (e.g., token count, file size MB). For fixed consumption (1 unit per call),\n * use manifest `capabilities.billing.procedures` instead (zero-code).\n */\nexport interface PluginUsageCapability {\n /**\n * Consume usage for a specific billing subject\n *\n * @param subject - Billing capability subject (must use {pluginId}.* prefix)\n * @param amount - Amount to consume (default: 1)\n * @throws EntitlementDeniedError if capability not approved or no quota\n */\n consume(subject: string, amount?: number): Promise<void>;\n}\nexport type ApiPayload<T> = {\n [K in keyof T]: T[K] extends Date\n ? string\n : T[K] extends Date | null\n ? string | null\n : T[K] extends Date | undefined\n ? string | undefined\n : T[K];\n};\n","import { z } from \"zod\";\nimport { pluginManifestSchema } from \"./manifest\";\n\nexport const MARKETPLACE_PUBLISH_SOURCES = [\"web\", \"cli\", \"github-actions\"] as const;\nexport const marketplacePublishSourceSchema = z.enum(MARKETPLACE_PUBLISH_SOURCES);\nexport type MarketplacePublishSource = z.infer<typeof marketplacePublishSourceSchema>;\n\nexport const MARKETPLACE_SUBMISSION_STATUSES = [\n \"uploaded\",\n \"scanning\",\n \"review_pending\",\n \"scan_failed\",\n \"approved\",\n \"rejected\",\n] as const;\nexport const marketplaceSubmissionStatusSchema = z.enum(MARKETPLACE_SUBMISSION_STATUSES);\nexport type MarketplaceSubmissionStatus = z.infer<typeof marketplaceSubmissionStatusSchema>;\n\nexport const marketplacePublisherProfileInputSchema = z.object({\n name: z.string().trim().min(1).max(160),\n});\nexport type MarketplacePublisherProfileInput = z.infer<typeof marketplacePublisherProfileInputSchema>;\n\nexport const marketplacePublisherProfileSchema = z.object({\n id: z.string().uuid(),\n organizationId: z.string().min(1),\n name: z.string().min(1).max(160),\n trust: z.enum([\"first_party\", \"third_party\"]),\n status: z.enum([\"active\", \"suspended\"]),\n createdAt: z.iso.datetime({ offset: true }),\n updatedAt: z.iso.datetime({ offset: true }),\n});\nexport type MarketplacePublisherProfile = z.infer<typeof marketplacePublisherProfileSchema>;\n\nexport const marketplacePublisherProfileResponseSchema = z.object({\n profile: marketplacePublisherProfileSchema.nullable(),\n});\nexport type MarketplacePublisherProfileResponse = z.infer<typeof marketplacePublisherProfileResponseSchema>;\n\nexport const marketplaceOwnedPluginInputSchema = z.object({\n pluginId: pluginManifestSchema.shape.pluginId,\n});\nexport type MarketplaceOwnedPluginInput = z.infer<typeof marketplaceOwnedPluginInputSchema>;\n\nexport const marketplaceOwnedPluginSchema = z.object({\n pluginId: pluginManifestSchema.shape.pluginId,\n publisherId: z.string().uuid(),\n createdAt: z.iso.datetime({ offset: true }),\n updatedAt: z.iso.datetime({ offset: true }),\n});\nexport type MarketplaceOwnedPlugin = z.infer<typeof marketplaceOwnedPluginSchema>;\n\nexport const marketplaceOwnedPluginsResponseSchema = z.object({\n items: z.array(marketplaceOwnedPluginSchema),\n});\nexport type MarketplaceOwnedPluginsResponse = z.infer<typeof marketplaceOwnedPluginsResponseSchema>;\n\nexport const marketplaceOwnedPluginResponseSchema = z.object({\n plugin: marketplaceOwnedPluginSchema,\n});\nexport type MarketplaceOwnedPluginResponse = z.infer<typeof marketplaceOwnedPluginResponseSchema>;\n\nexport const marketplaceSubmissionSchema = z.object({\n id: z.string().uuid(),\n publisherId: z.string().uuid(),\n organizationId: z.string().min(1),\n pluginId: pluginManifestSchema.shape.pluginId,\n version: z.string().min(1).max(80),\n status: marketplaceSubmissionStatusSchema,\n uploadSource: marketplacePublishSourceSchema,\n uploadActorId: z.string().nullable(),\n uploadAuthMethod: z.enum([\"portal-session\", \"scoped-api-key\"]).nullable(),\n uploadCredentialId: z.string().nullable(),\n uploadAuthenticatedAt: z.iso.datetime({ offset: true }).nullable(),\n reviewReason: z.string().nullable(),\n reviewedAt: z.iso.datetime({ offset: true }).nullable(),\n createdAt: z.iso.datetime({ offset: true }),\n updatedAt: z.iso.datetime({ offset: true }),\n});\nexport type MarketplaceSubmission = z.infer<typeof marketplaceSubmissionSchema>;\n\nexport const marketplaceSubmissionCursorSchema = z.object({\n cursor: z.string().min(1).optional(),\n pluginId: pluginManifestSchema.shape.pluginId.optional(),\n});\nexport type MarketplaceSubmissionCursor = z.infer<typeof marketplaceSubmissionCursorSchema>;\n\nexport const marketplaceSubmissionsResponseSchema = z.object({\n items: z.array(marketplaceSubmissionSchema),\n nextCursor: z.string().nullable(),\n});\nexport type MarketplaceSubmissionsResponse = z.infer<typeof marketplaceSubmissionsResponseSchema>;\n\nexport const marketplaceReleaseAcceptedResponseSchema = z.object({\n submission: marketplaceSubmissionSchema,\n});\nexport type MarketplaceReleaseAcceptedResponse = z.infer<typeof marketplaceReleaseAcceptedResponseSchema>;\n\nexport const marketplacePublisherErrorSchema = z.object({\n error: z.string().min(1),\n});\nexport type MarketplacePublisherError = z.infer<typeof marketplacePublisherErrorSchema>;\n","import type { PluginManifest } from './manifest';\nimport type { PluginContext } from './types';\n\n/**\n * Plugin Definition - Type-safe plugin configuration\n */\nexport interface PluginDefinition {\n /** Plugin manifest (required fields only) */\n manifest: Pick<PluginManifest, 'pluginId' | 'version' | 'name' | 'vendor' | 'engines'> & Partial<PluginManifest>;\n\n /** Server-side exports */\n server?: {\n /** tRPC router (optional) */\n router?: unknown;\n\n /** Lifecycle hooks */\n onInstall?: (ctx: PluginContext) => Promise<void>;\n onEnable?: (ctx: PluginContext) => Promise<void>;\n onDisable?: (ctx: PluginContext) => Promise<void>;\n onUninstall?: (ctx: PluginContext) => Promise<void>;\n };\n}\n\n/**\n * Define a plugin with type safety\n *\n * @example\n * ```ts\n * import { definePlugin } from '@wordrhyme/plugin';\n *\n * export default definePlugin({\n * manifest: {\n * pluginId: 'com.example.hello',\n * version: '1.0.0',\n * name: 'Hello World',\n * vendor: 'Example Inc',\n * engines: { wordrhyme: '^0.1.0' },\n * },\n * server: {\n * router: myRouter,\n * onEnable: async (ctx) => {\n * ctx.logger.info('Plugin enabled!');\n * },\n * },\n * });\n * ```\n */\nexport function definePlugin(definition: PluginDefinition): PluginDefinition {\n return definition;\n}\n","/**\n * Plugin Runtime Helpers (Client-Side)\n *\n * Utilities for plugins to use logger and permission capabilities.\n * These are convenience wrappers that work within plugin context.\n */\n\nimport type { PluginContext, PluginLogger, PluginPermissionCapability } from './types';\n\n/**\n * Create a scoped logger for a plugin\n *\n * @example\n * ```ts\n * import { createLogger } from '@wordrhyme/plugin';\n *\n * const logger = createLogger('com.vendor.my-plugin');\n * logger.info('Plugin started');\n * ```\n */\nexport function createLogger(pluginId: string): PluginLogger {\n return {\n info: (msg, meta) => console.log(`[${pluginId}]`, msg, meta ?? ''),\n warn: (msg, meta) => console.warn(`[${pluginId}]`, msg, meta ?? ''),\n error: (msg, meta) => console.error(`[${pluginId}]`, msg, meta ?? ''),\n debug: (msg, meta) => console.debug(`[${pluginId}]`, msg, meta ?? ''),\n };\n}\n\n/**\n * Check if a permission is granted in the context\n *\n * @example\n * ```ts\n * import { checkPermission } from '@wordrhyme/plugin';\n *\n * async function myHandler(ctx: PluginContext) {\n * if (await checkPermission(ctx, 'content:read:*')) {\n * // User has permission\n * }\n * }\n * ```\n */\nexport async function checkPermission(\n ctx: PluginContext,\n capability: string\n): Promise<boolean> {\n return ctx.permissions.can(capability);\n}\n\n/**\n * Require a permission - throws if denied\n *\n * @example\n * ```ts\n * import { requirePermission } from '@wordrhyme/plugin';\n *\n * async function protectedHandler(ctx: PluginContext) {\n * await requirePermission(ctx, 'admin:manage:*');\n * // Only executes if permission granted\n * }\n * ```\n */\nexport async function requirePermission(\n ctx: PluginContext,\n capability: string\n): Promise<void> {\n return ctx.permissions.require(capability);\n}\n\n/**\n * Check if plugin declared a capability in its manifest\n *\n * @example\n * ```ts\n * import { hasCapability } from '@wordrhyme/plugin';\n *\n * function checkDeclared(ctx: PluginContext) {\n * if (hasCapability(ctx, 'content:write:*')) {\n * // Plugin declared this capability\n * }\n * }\n * ```\n */\nexport function hasCapability(\n ctx: PluginContext,\n capability: string\n): boolean {\n return ctx.permissions.hasDeclared(capability);\n}\n"],"mappings":"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","names":["HookPriority"]}