@mmapp/react 0.1.0-alpha.3 → 0.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { StateMachine, EventBus, ActionDispatcher, Evaluator, PlayerWorkflowDefinition, ExpressionContext, TransitionResult as TransitionResult$1, RuntimeProfile, ActionHandlerFn, BusEvent, StateMachineEvent } from '@mindmatrix/player-core';
2
- export { ExpressionContext, IRStateHome, PlayerWorkflowDefinition, RuntimeProfile, StateMachineEvent, TransitionResult } from '@mindmatrix/player-core';
1
+ import { StateMachine, EventBus, ActionDispatcher, Evaluator, PlayerWorkflowDefinition, ExpressionContext, TransitionResult as TransitionResult$1, RuntimeProfile, ActionHandlerFn, BusEvent, StateMachineEvent } from '@mmapp/player-core';
2
+ export { ExpressionContext, IRStateHome, PlayerWorkflowDefinition, RuntimeProfile, StateMachineEvent, TransitionResult } from '@mmapp/player-core';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import * as React$1 from 'react';
@@ -145,7 +145,7 @@ declare function useDuringAction(config: DuringActionConfig): void;
145
145
  *
146
146
  * @example
147
147
  * ```typescript
148
- * import { defineModel } from '@mindmatrix/react';
148
+ * import { defineModel } from '@mmapp/react';
149
149
  *
150
150
  * export default defineModel({
151
151
  * slug: 'mod-authentication',
@@ -426,6 +426,11 @@ interface ActionDefinition {
426
426
  config?: Record<string, unknown>;
427
427
  /** Expression that must be truthy for this action to execute. */
428
428
  condition?: string;
429
+ /**
430
+ * Where this action executes at runtime.
431
+ * Default: inherited from the parent state/transition or `'any'`.
432
+ */
433
+ runtime?: RuntimeTarget;
429
434
  }
430
435
  /**
431
436
  * An on_event subscription — reacts to events from other workflow instances.
@@ -562,6 +567,11 @@ interface StateDescriptor {
562
567
  transition?: string;
563
568
  };
564
569
  };
570
+ /**
571
+ * Where this state executes at runtime.
572
+ * Default: inherited from `orchestration.defaultRuntime` or `'any'`.
573
+ */
574
+ runtime?: RuntimeTarget;
565
575
  }
566
576
  /**
567
577
  * Condition for a transition guard.
@@ -696,6 +706,11 @@ interface TransitionDescriptor {
696
706
  * ```
697
707
  */
698
708
  auto?: boolean;
709
+ /**
710
+ * Where this transition executes at runtime.
711
+ * Default: inherited from `orchestration.defaultRuntime` or `'any'`.
712
+ */
713
+ runtime?: RuntimeTarget;
699
714
  }
700
715
  /**
701
716
  * Role definition for the workflow's permission model.
@@ -717,6 +732,133 @@ interface RoleDefinition {
717
732
  /** Roles this role inherits permissions from. */
718
733
  inherits?: readonly string[];
719
734
  }
735
+ /** Strategy for multi-player workflow orchestration. */
736
+ type OrchestrationStrategy = 'solo' | 'client-server' | 'multi-client' | 'service-mesh' | 'peer-to-peer' | 'hybrid' | 'headless' | 'custom';
737
+ /** Where a state, transition, or action executes at runtime. */
738
+ type RuntimeTarget = 'server' | 'client' | 'worker' | 'edge' | 'any';
739
+ /** Conflict resolution strategy. */
740
+ type ConflictStrategy = 'last-writer-wins' | 'first-write-wins' | 'crdt' | 'manual' | 'custom';
741
+ /** Per-field conflict resolution override. */
742
+ interface FieldConflictConfig {
743
+ strategy: ConflictStrategy | string;
744
+ /** CRDT type when strategy is 'crdt' (e.g., 'lww-register', 'g-counter', 'or-set'). */
745
+ type?: string;
746
+ }
747
+ /** Role-based visibility configuration. */
748
+ interface RoleVisibility {
749
+ /** Fields visible to this role. Use '*' for all. */
750
+ fields: readonly string[] | '*';
751
+ /** States visible to this role. Use '*' for all. */
752
+ states?: readonly string[] | '*';
753
+ }
754
+ /** Player-type visibility configuration. */
755
+ interface PlayerVisibility {
756
+ /** Fields visible to this player type. Use '*' for all. */
757
+ fields: readonly string[] | '*';
758
+ }
759
+ /** Presence tracking configuration. */
760
+ interface PresenceConfig {
761
+ /** Enable real-time presence tracking. */
762
+ enabled?: boolean;
763
+ /** Show which fields other users are editing. */
764
+ showEditing?: boolean;
765
+ /** Show connected viewers. */
766
+ showViewing?: boolean;
767
+ /** Highlight fields with conflicting edits. */
768
+ conflictHighlight?: boolean;
769
+ }
770
+ /** Service registration for action routing. */
771
+ interface ServiceConfig {
772
+ /** Transport type for this service. */
773
+ type: 'webhook' | 'websocket' | 'job' | 'p2p';
774
+ /** Service endpoint URL (for webhook/websocket). */
775
+ url?: string;
776
+ /** Actions this service handles. */
777
+ actions: readonly string[];
778
+ /** Request timeout (e.g., '30s', '5m'). */
779
+ timeout?: string;
780
+ /** Number of retry attempts on failure. */
781
+ retry?: number;
782
+ }
783
+ /** Per-action routing rule. */
784
+ interface ActionRoutingRule {
785
+ /** Target player/service for this action. */
786
+ target: string;
787
+ /** Fallback target if primary is unavailable. */
788
+ fallback?: string;
789
+ /** Whether this action must succeed (no silent failure). */
790
+ required?: boolean;
791
+ }
792
+ /**
793
+ * Orchestration configuration for multi-player workflow execution.
794
+ *
795
+ * Controls how actions are routed, conflicts are resolved, presence is tracked,
796
+ * and visibility is scoped across multiple clients, servers, and services.
797
+ *
798
+ * @example
799
+ * ```typescript
800
+ * orchestration: {
801
+ * strategy: 'multi-client',
802
+ * evaluation: { pure: 'local' },
803
+ * conflicts: {
804
+ * default: 'last-writer-wins',
805
+ * fields: { description: { strategy: 'crdt', type: 'lww-register' } },
806
+ * },
807
+ * visibility: {
808
+ * roles: {
809
+ * customer: { fields: ['status', 'total'], states: ['submitted', 'completed'] },
810
+ * admin: { fields: '*', states: '*' },
811
+ * },
812
+ * },
813
+ * presence: { enabled: true, showEditing: true },
814
+ * }
815
+ * ```
816
+ */
817
+ interface OrchestrationConfig {
818
+ /** High-level orchestration strategy. Default: 'client-server'. */
819
+ strategy?: OrchestrationStrategy;
820
+ /** Default runtime target for states/transitions that don't specify one. */
821
+ defaultRuntime?: RuntimeTarget;
822
+ /** Expression evaluation routing. */
823
+ evaluation?: {
824
+ /** Where pure expressions are evaluated. */
825
+ pure?: 'local' | 'primary' | 'consensus' | 'nearest';
826
+ };
827
+ /** Action scheduling configuration. */
828
+ scheduling?: {
829
+ /** Who coordinates scheduled/during actions. */
830
+ coordinator?: 'server' | 'primary-client' | 'any' | string;
831
+ };
832
+ /** Event evaluation configuration. */
833
+ events?: {
834
+ /** Who evaluates onEvent subscriptions. */
835
+ evaluator?: 'server' | 'any-subscriber' | 'primary-client' | 'all';
836
+ };
837
+ /** Error handling strategy for failed actions. */
838
+ errorHandling?: {
839
+ strategy?: 'compensate' | 'rollback' | 'partial-commit' | 'saga' | 'manual';
840
+ };
841
+ /** Conflict resolution configuration. */
842
+ conflicts?: {
843
+ /** Default conflict resolution strategy. */
844
+ default?: ConflictStrategy;
845
+ /** Per-field conflict resolution overrides. */
846
+ fields?: Record<string, FieldConflictConfig>;
847
+ };
848
+ /** Visibility scoping by role and/or player type. */
849
+ visibility?: {
850
+ /** Per-role field/state visibility. */
851
+ roles?: Record<string, RoleVisibility>;
852
+ /** Per-player-type field visibility. */
853
+ players?: Record<string, PlayerVisibility>;
854
+ };
855
+ /** Real-time presence tracking. */
856
+ presence?: PresenceConfig;
857
+ /** Registered services for action routing. */
858
+ services?: Record<string, ServiceConfig>;
859
+ /** Per-action routing rules (action name → routing config). */
860
+ actionRouting?: Record<string, ActionRoutingRule>;
861
+ }
720
862
  /**
721
863
  * Full shape of a model definition passed to `defineModel()`.
722
864
  *
@@ -771,6 +913,23 @@ interface ModelDefinition {
771
913
  onEvent?: readonly EventSubscription[];
772
914
  /** @deprecated Use `onEvent`. */
773
915
  on_event?: readonly EventSubscription[];
916
+ /**
917
+ * Multi-player orchestration configuration.
918
+ *
919
+ * Controls how this workflow executes across multiple clients, servers,
920
+ * and services — including conflict resolution, visibility, presence,
921
+ * and action routing.
922
+ *
923
+ * @example
924
+ * ```typescript
925
+ * orchestration: {
926
+ * strategy: 'multi-client',
927
+ * presence: { enabled: true, showEditing: true },
928
+ * conflicts: { default: 'last-writer-wins' },
929
+ * }
930
+ * ```
931
+ */
932
+ orchestration?: OrchestrationConfig;
774
933
  }
775
934
  /**
776
935
  * Define a workflow model with preserved literal types.
@@ -786,7 +945,7 @@ interface ModelDefinition {
786
945
  *
787
946
  * @example
788
947
  * ```typescript
789
- * import { defineModel } from '@mindmatrix/react';
948
+ * import { defineModel } from '@mmapp/react';
790
949
  *
791
950
  * export default defineModel({
792
951
  * slug: 'invoice',
@@ -2281,6 +2440,141 @@ interface ToastHandle {
2281
2440
  */
2282
2441
  declare function useToast(): ToastHandle;
2283
2442
 
2443
+ /**
2444
+ * useVisibility — filters fields and states based on orchestration visibility config.
2445
+ *
2446
+ * Reads the `orchestration.visibility` configuration from a ModelDefinition
2447
+ * and returns which fields/states are visible for the given role or player type.
2448
+ *
2449
+ * @example
2450
+ * ```typescript
2451
+ * import { useVisibility, defineModel } from '@mmapp/react';
2452
+ *
2453
+ * const order = defineModel({
2454
+ * slug: 'order',
2455
+ * fields: { status: { type: 'string' }, total: { type: 'currency' }, internalNotes: { type: 'string' } },
2456
+ * states: { draft: { type: 'initial' }, submitted: {}, completed: { type: 'end' } },
2457
+ * transitions: { submit: { from: 'draft', to: 'submitted' }, complete: { from: 'submitted', to: 'completed' } },
2458
+ * orchestration: {
2459
+ * visibility: {
2460
+ * roles: {
2461
+ * customer: { fields: ['status', 'total'], states: ['submitted', 'completed'] },
2462
+ * admin: { fields: '*', states: '*' },
2463
+ * },
2464
+ * },
2465
+ * },
2466
+ * });
2467
+ *
2468
+ * function OrderView() {
2469
+ * const vis = useVisibility(order, 'customer');
2470
+ * // vis.visibleFields → ['status', 'total']
2471
+ * // vis.canSeeField('internalNotes') → false
2472
+ * // vis.canSeeState('draft') → false
2473
+ * }
2474
+ * ```
2475
+ */
2476
+
2477
+ /** Result of the useVisibility hook. */
2478
+ interface VisibilityResult {
2479
+ /** Fields visible to the current role/player. */
2480
+ visibleFields: string[];
2481
+ /** States visible to the current role/player. */
2482
+ visibleStates: string[];
2483
+ /** Check if a specific field is visible. */
2484
+ canSeeField: (field: string) => boolean;
2485
+ /** Check if a specific state is visible. */
2486
+ canSeeState: (state: string) => boolean;
2487
+ }
2488
+ /**
2489
+ * Compute visibility for a role or player type.
2490
+ *
2491
+ * When no orchestration.visibility config is defined, or when
2492
+ * the role/player is not listed, all fields and states are visible.
2493
+ *
2494
+ * @param model - The model definition containing orchestration config.
2495
+ * @param role - The role name to check visibility for.
2496
+ * @param playerType - The player type to check visibility for (optional, additive to role).
2497
+ */
2498
+ declare function useVisibility(model: ModelDefinition, role?: string, playerType?: string): VisibilityResult;
2499
+ /**
2500
+ * Pure function to compute visibility (testable without React).
2501
+ */
2502
+ declare function computeVisibility(model: ModelDefinition, role?: string, playerType?: string): VisibilityResult;
2503
+
2504
+ /**
2505
+ * usePresence — real-time presence tracking for workflow instances.
2506
+ *
2507
+ * Tracks who is viewing and editing a workflow instance, and which
2508
+ * fields are currently being edited by other users.
2509
+ *
2510
+ * Built on top of `useChannel` for real-time transport.
2511
+ *
2512
+ * @example
2513
+ * ```typescript
2514
+ * import { usePresence } from '@mmapp/react';
2515
+ *
2516
+ * function CollaborativeEditor({ instanceId }: { instanceId: string }) {
2517
+ * const { viewers, editors, viewerCount, isEditing, startEditing, stopEditing } =
2518
+ * usePresence(instanceId);
2519
+ *
2520
+ * return (
2521
+ * <div>
2522
+ * <span>{viewerCount} viewing</span>
2523
+ * {editors.map(e => <span key={e.id}>Editing: {e.field}</span>)}
2524
+ * <input
2525
+ * onFocus={() => startEditing('name')}
2526
+ * onBlur={() => stopEditing('name')}
2527
+ * />
2528
+ * </div>
2529
+ * );
2530
+ * }
2531
+ * ```
2532
+ */
2533
+ /** A connected viewer. */
2534
+ interface PresenceViewer {
2535
+ id: string;
2536
+ name: string;
2537
+ connectedAt: number;
2538
+ }
2539
+ /** A user currently editing a field. */
2540
+ interface PresenceEditor {
2541
+ id: string;
2542
+ name: string;
2543
+ field: string;
2544
+ startedAt: number;
2545
+ }
2546
+ /** Options for the usePresence hook. */
2547
+ interface PresenceOptions {
2548
+ /** Current user ID. */
2549
+ userId?: string;
2550
+ /** Current user display name. */
2551
+ userName?: string;
2552
+ /** WebSocket URL override. */
2553
+ wsUrl?: string;
2554
+ /** Whether presence is enabled. Default: true. */
2555
+ enabled?: boolean;
2556
+ /** Heartbeat interval in ms. Default: 15000. */
2557
+ heartbeatInterval?: number;
2558
+ /** Stale timeout in ms (remove viewers after this). Default: 45000. */
2559
+ staleTimeout?: number;
2560
+ }
2561
+ /** Result of the usePresence hook. */
2562
+ interface PresenceHandle {
2563
+ /** All connected viewers. */
2564
+ viewers: PresenceViewer[];
2565
+ /** Users currently editing fields. */
2566
+ editors: PresenceEditor[];
2567
+ /** Number of connected viewers. */
2568
+ viewerCount: number;
2569
+ /** Check if a specific field is being edited by another user. */
2570
+ isEditing: (field: string) => boolean;
2571
+ /** Announce that the current user started editing a field. */
2572
+ startEditing: (field: string) => void;
2573
+ /** Announce that the current user stopped editing a field. */
2574
+ stopEditing: (field: string) => void;
2575
+ }
2576
+ declare function usePresence(instanceId: string, options?: PresenceOptions): PresenceHandle;
2577
+
2284
2578
  /**
2285
2579
  * useMiddleware — Pre-render middleware pipeline for workflow pages.
2286
2580
  *
@@ -2304,7 +2598,7 @@ declare function useToast(): ToastHandle;
2304
2598
  * // ... render page
2305
2599
  *
2306
2600
  * Factory functions for common middleware:
2307
- * import { requireAuth, requireRole, prefetchData } from '@mindmatrix/react';
2601
+ * import { requireAuth, requireRole, prefetchData } from '@mmapp/react';
2308
2602
  */
2309
2603
  /** Result of a middleware function. */
2310
2604
  interface MiddlewareResult {
@@ -2361,7 +2655,7 @@ declare function requireAuth(loginPath?: string): MiddlewareFn;
2361
2655
  /**
2362
2656
  * Factory: Require a specific role. Checks auth token for role claim.
2363
2657
  */
2364
- declare function requireRole(role: string, redirectPath?: string): MiddlewareFn;
2658
+ declare function requireRole$1(role: string, redirectPath?: string): MiddlewareFn;
2365
2659
  /**
2366
2660
  * Factory: Prefetch data before rendering.
2367
2661
  */
@@ -2566,7 +2860,7 @@ declare function createLocalEngineAdapter(_engine: LocalWorkflowEngine, store: L
2566
2860
  declare function createLocalDataResolver(engine: LocalWorkflowEngine, store: LocalEngineStore): LocalDataResolver;
2567
2861
 
2568
2862
  /**
2569
- * @mindmatrix/react/actions — Typed action factory functions.
2863
+ * @mmapp/react/actions — Typed action factory functions.
2570
2864
  *
2571
2865
  * Provides ergonomic helpers that produce {@link ActionDefinition} objects
2572
2866
  * for use in model definitions (states and transitions). Every function
@@ -2574,8 +2868,8 @@ declare function createLocalDataResolver(engine: LocalWorkflowEngine, store: Loc
2574
2868
  *
2575
2869
  * @example
2576
2870
  * ```typescript
2577
- * import { defineModel } from '@mindmatrix/react';
2578
- * import { setField, logEvent, notify, spawn } from '@mindmatrix/react/actions';
2871
+ * import { defineModel } from '@mmapp/react';
2872
+ * import { setField, logEvent, notify, spawn } from '@mmapp/react/actions';
2579
2873
  *
2580
2874
  * export default defineModel({
2581
2875
  * slug: 'order',
@@ -2725,7 +3019,7 @@ interface ActionNotifyOptions {
2725
3019
  * })
2726
3020
  * ```
2727
3021
  */
2728
- declare function notify(template: string, options?: ActionNotifyOptions): ActionDefinition;
3022
+ declare function notify$1(template: string, options?: ActionNotifyOptions): ActionDefinition;
2729
3023
  /**
2730
3024
  * Options for the {@link spawn} action factory.
2731
3025
  */
@@ -2927,14 +3221,14 @@ interface ActionOptions {
2927
3221
  declare function action(id: string, type: string, config?: Record<string, unknown>, options?: ActionOptions): ActionDefinition;
2928
3222
 
2929
3223
  /**
2930
- * @mindmatrix/react/actionCreators — Type-safe action reference factories.
3224
+ * @mmapp/react/actionCreators — Type-safe action reference factories.
2931
3225
  *
2932
3226
  * Replaces stringly-typed `serverAction("authenticate", {...})` calls with
2933
3227
  * typed action creators that catch typos at compile time.
2934
3228
  *
2935
3229
  * @example
2936
3230
  * ```typescript
2937
- * import { createActions } from '@mindmatrix/react';
3231
+ * import { createActions } from '@mmapp/react';
2938
3232
  *
2939
3233
  * const actions = createActions({
2940
3234
  * authenticate: { handler: 'actions/auth.server.ts' },
@@ -3015,6 +3309,77 @@ type ActionCreators<M extends ActionManifest> = {
3015
3309
  */
3016
3310
  declare function createActions<const M extends ActionManifest>(manifest: M): ActionCreators<M>;
3017
3311
 
3312
+ /**
3313
+ * Orchestration Strategy Presets (Design 28)
3314
+ *
3315
+ * Each preset provides sensible defaults for a common multi-player pattern.
3316
+ * Users can override any field — the preset just fills in defaults.
3317
+ */
3318
+
3319
+ /** Fully resolved orchestration config — every field has a value. */
3320
+ interface ResolvedOrchestrationConfig {
3321
+ strategy: OrchestrationStrategy;
3322
+ evaluation: {
3323
+ pure: 'local' | 'primary' | 'consensus' | 'nearest';
3324
+ };
3325
+ scheduling: {
3326
+ coordinator: string;
3327
+ };
3328
+ events: {
3329
+ evaluator: string;
3330
+ };
3331
+ errorHandling: {
3332
+ strategy: string;
3333
+ };
3334
+ conflicts: {
3335
+ default: string;
3336
+ fields: Record<string, {
3337
+ strategy: string;
3338
+ type?: string;
3339
+ }>;
3340
+ };
3341
+ visibility: {
3342
+ roles: Record<string, {
3343
+ fields: readonly string[] | '*';
3344
+ states?: readonly string[] | '*';
3345
+ }>;
3346
+ players: Record<string, {
3347
+ fields: readonly string[] | '*';
3348
+ }>;
3349
+ };
3350
+ presence: {
3351
+ enabled: boolean;
3352
+ showEditing: boolean;
3353
+ showViewing: boolean;
3354
+ conflictHighlight: boolean;
3355
+ };
3356
+ services: Record<string, {
3357
+ type: string;
3358
+ url?: string;
3359
+ actions: readonly string[];
3360
+ timeout?: string;
3361
+ retry?: number;
3362
+ }>;
3363
+ actionRouting: Record<string, {
3364
+ target: string;
3365
+ fallback?: string;
3366
+ required?: boolean;
3367
+ }>;
3368
+ }
3369
+ /** Preset lookup by strategy name. */
3370
+ declare const ORCHESTRATION_PRESETS: Record<OrchestrationStrategy, OrchestrationConfig>;
3371
+ /**
3372
+ * Resolve user-provided orchestration config with preset defaults.
3373
+ *
3374
+ * 1. If `config.strategy` is set, use that preset as the base.
3375
+ * 2. Merge user overrides on top.
3376
+ * 3. Fill any remaining gaps with the default (client-server).
3377
+ *
3378
+ * @param config - User-provided partial orchestration config.
3379
+ * @returns Fully resolved config with all fields populated.
3380
+ */
3381
+ declare function resolveOrchestration(config?: OrchestrationConfig): ResolvedOrchestrationConfig;
3382
+
3018
3383
  /**
3019
3384
  * defineBlueprint — declarative configuration for a MindMatrix workflow blueprint.
3020
3385
  *
@@ -3027,7 +3392,7 @@ declare function createActions<const M extends ActionManifest>(manifest: M): Act
3027
3392
  * it requires (dependencies, capabilities).
3028
3393
  *
3029
3394
  * Usage in mm.config.ts:
3030
- * import { defineBlueprint } from '@mindmatrix/react';
3395
+ * import { defineBlueprint } from '@mmapp/react';
3031
3396
  *
3032
3397
  * export default defineBlueprint({
3033
3398
  * slug: 'mod-authentication',
@@ -3188,7 +3553,7 @@ interface BlueprintConfig {
3188
3553
  icon?: string;
3189
3554
  /** Tags for discovery. */
3190
3555
  tags?: string[];
3191
- /** Compilation mode: strict enforces @mindmatrix/react-only hooks; infer allows escape hatches. */
3556
+ /** Compilation mode: strict enforces @mmapp/react-only hooks; infer allows escape hatches. */
3192
3557
  mode?: 'strict' | 'infer';
3193
3558
  /** Default runtime profile for all workflows in this definition. */
3194
3559
  defaultRuntime?: RuntimeProfile;
@@ -3277,7 +3642,7 @@ declare function defineModule<const M extends BlueprintConfig>(manifest: M): M &
3277
3642
  };
3278
3643
 
3279
3644
  /**
3280
- * @mindmatrix/react/conditions — Typed condition helpers for transition guards.
3645
+ * @mmapp/react/conditions — Typed condition helpers for transition guards.
3281
3646
  *
3282
3647
  * Factory functions that produce `TransitionCondition` objects for use in
3283
3648
  * model transition definitions. Instead of writing raw condition objects:
@@ -3293,7 +3658,7 @@ declare function defineModule<const M extends BlueprintConfig>(manifest: M): M &
3293
3658
  * You can use ergonomic helpers:
3294
3659
  *
3295
3660
  * ```typescript
3296
- * import { isSender, hasRole, fieldEquals, or } from '@mindmatrix/react';
3661
+ * import { isSender, hasRole, fieldEquals, or } from '@mmapp/react';
3297
3662
  *
3298
3663
  * conditions: [
3299
3664
  * or(isSender(), hasRole('admin')),
@@ -3310,7 +3675,7 @@ declare function defineModule<const M extends BlueprintConfig>(manifest: M): M &
3310
3675
  *
3311
3676
  * @example
3312
3677
  * ```typescript
3313
- * import { expr } from '@mindmatrix/react';
3678
+ * import { expr } from '@mmapp/react';
3314
3679
  *
3315
3680
  * transitions: {
3316
3681
  * approve: {
@@ -3331,7 +3696,7 @@ declare function expr(expression: string): TransitionCondition;
3331
3696
  *
3332
3697
  * @example
3333
3698
  * ```typescript
3334
- * import { when } from '@mindmatrix/react';
3699
+ * import { when } from '@mmapp/react';
3335
3700
  *
3336
3701
  * conditions: [when('input.email != null && LEN(input.email) > 0')]
3337
3702
  * ```
@@ -3345,7 +3710,7 @@ declare function when(expression: string): TransitionCondition;
3345
3710
  *
3346
3711
  * @example
3347
3712
  * ```typescript
3348
- * import { hasRole } from '@mindmatrix/react';
3713
+ * import { hasRole } from '@mmapp/react';
3349
3714
  *
3350
3715
  * transitions: {
3351
3716
  * delete: {
@@ -3366,7 +3731,7 @@ declare function hasRole(role: string): TransitionCondition;
3366
3731
  *
3367
3732
  * @example
3368
3733
  * ```typescript
3369
- * import { hasAnyRole } from '@mindmatrix/react';
3734
+ * import { hasAnyRole } from '@mmapp/react';
3370
3735
  *
3371
3736
  * transitions: {
3372
3737
  * archive: {
@@ -3387,7 +3752,7 @@ declare function hasAnyRole(...roles: string[]): TransitionCondition;
3387
3752
  *
3388
3753
  * @example
3389
3754
  * ```typescript
3390
- * import { isOwner } from '@mindmatrix/react';
3755
+ * import { isOwner } from '@mmapp/react';
3391
3756
  *
3392
3757
  * // Default: checks state_data.ownerId
3393
3758
  * conditions: [isOwner()]
@@ -3407,7 +3772,7 @@ declare function isOwner(ownerField?: string): TransitionCondition;
3407
3772
  *
3408
3773
  * @example
3409
3774
  * ```typescript
3410
- * import { isActor } from '@mindmatrix/react';
3775
+ * import { isActor } from '@mmapp/react';
3411
3776
  *
3412
3777
  * // Only the sender can edit their message
3413
3778
  * conditions: [isActor('senderId')]
@@ -3424,7 +3789,7 @@ declare function isActor(actorField: string): TransitionCondition;
3424
3789
  *
3425
3790
  * @example
3426
3791
  * ```typescript
3427
- * import { isSender, hasRole, or } from '@mindmatrix/react';
3792
+ * import { isSender, hasRole, or } from '@mmapp/react';
3428
3793
  *
3429
3794
  * // Only the sender or an admin can delete a message
3430
3795
  * conditions: [or(isSender(), hasRole('admin'))]
@@ -3440,7 +3805,7 @@ declare function isSender(): TransitionCondition;
3440
3805
  *
3441
3806
  * @example
3442
3807
  * ```typescript
3443
- * import { isCreator } from '@mindmatrix/react';
3808
+ * import { isCreator } from '@mmapp/react';
3444
3809
  *
3445
3810
  * conditions: [isCreator()]
3446
3811
  * ```
@@ -3455,7 +3820,7 @@ declare function isCreator(): TransitionCondition;
3455
3820
  *
3456
3821
  * @example
3457
3822
  * ```typescript
3458
- * import { fieldEquals } from '@mindmatrix/react';
3823
+ * import { fieldEquals } from '@mmapp/react';
3459
3824
  *
3460
3825
  * conditions: [fieldEquals('status', 'draft')]
3461
3826
  * // Equivalent to: { type: 'field', field: 'status', operator: 'eq', value: 'draft' }
@@ -3471,7 +3836,7 @@ declare function fieldEquals(field: string, value: unknown): TransitionCondition
3471
3836
  *
3472
3837
  * @example
3473
3838
  * ```typescript
3474
- * import { fieldNotEquals } from '@mindmatrix/react';
3839
+ * import { fieldNotEquals } from '@mmapp/react';
3475
3840
  *
3476
3841
  * conditions: [fieldNotEquals('type', 'system')]
3477
3842
  * ```
@@ -3486,7 +3851,7 @@ declare function fieldNotEquals(field: string, value: unknown): TransitionCondit
3486
3851
  *
3487
3852
  * @example
3488
3853
  * ```typescript
3489
- * import { fieldGreaterThan } from '@mindmatrix/react';
3854
+ * import { fieldGreaterThan } from '@mmapp/react';
3490
3855
  *
3491
3856
  * conditions: [fieldGreaterThan('amount', 1000)]
3492
3857
  * ```
@@ -3501,7 +3866,7 @@ declare function fieldGreaterThan(field: string, value: number): TransitionCondi
3501
3866
  *
3502
3867
  * @example
3503
3868
  * ```typescript
3504
- * import { fieldLessThan } from '@mindmatrix/react';
3869
+ * import { fieldLessThan } from '@mmapp/react';
3505
3870
  *
3506
3871
  * conditions: [fieldLessThan('retryCount', 3)]
3507
3872
  * ```
@@ -3516,7 +3881,7 @@ declare function fieldLessThan(field: string, value: number): TransitionConditio
3516
3881
  *
3517
3882
  * @example
3518
3883
  * ```typescript
3519
- * import { fieldIn } from '@mindmatrix/react';
3884
+ * import { fieldIn } from '@mmapp/react';
3520
3885
  *
3521
3886
  * conditions: [fieldIn('priority', ['high', 'critical'])]
3522
3887
  * ```
@@ -3531,7 +3896,7 @@ declare function fieldIn(field: string, values: unknown[]): TransitionCondition;
3531
3896
  *
3532
3897
  * @example
3533
3898
  * ```typescript
3534
- * import { fieldNotIn } from '@mindmatrix/react';
3899
+ * import { fieldNotIn } from '@mmapp/react';
3535
3900
  *
3536
3901
  * conditions: [fieldNotIn('status', ['deleted', 'archived'])]
3537
3902
  * ```
@@ -3546,7 +3911,7 @@ declare function fieldNotIn(field: string, values: unknown[]): TransitionConditi
3546
3911
  *
3547
3912
  * @example
3548
3913
  * ```typescript
3549
- * import { fieldContains } from '@mindmatrix/react';
3914
+ * import { fieldContains } from '@mmapp/react';
3550
3915
  *
3551
3916
  * // Check if the members array contains the actor
3552
3917
  * conditions: [fieldContains('members', 'context.actor_id')]
@@ -3561,7 +3926,7 @@ declare function fieldContains(field: string, value: unknown): TransitionConditi
3561
3926
  *
3562
3927
  * @example
3563
3928
  * ```typescript
3564
- * import { fieldIsSet } from '@mindmatrix/react';
3929
+ * import { fieldIsSet } from '@mmapp/react';
3565
3930
  *
3566
3931
  * conditions: [fieldIsSet('approvedBy')]
3567
3932
  * ```
@@ -3575,7 +3940,7 @@ declare function fieldIsSet(field: string): TransitionCondition;
3575
3940
  *
3576
3941
  * @example
3577
3942
  * ```typescript
3578
- * import { fieldIsEmpty } from '@mindmatrix/react';
3943
+ * import { fieldIsEmpty } from '@mmapp/react';
3579
3944
  *
3580
3945
  * conditions: [fieldIsEmpty('errorMessage')]
3581
3946
  * ```
@@ -3590,7 +3955,7 @@ declare function fieldIsEmpty(field: string): TransitionCondition;
3590
3955
  *
3591
3956
  * @example
3592
3957
  * ```typescript
3593
- * import { fieldMatches } from '@mindmatrix/react';
3958
+ * import { fieldMatches } from '@mmapp/react';
3594
3959
  *
3595
3960
  * conditions: [fieldMatches('email', '^[^@]+@[^@]+\\.[^@]+$')]
3596
3961
  * ```
@@ -3608,7 +3973,7 @@ declare function fieldMatches(field: string, pattern: string): TransitionConditi
3608
3973
  *
3609
3974
  * @example
3610
3975
  * ```typescript
3611
- * import { inputRequired } from '@mindmatrix/react';
3976
+ * import { inputRequired } from '@mmapp/react';
3612
3977
  *
3613
3978
  * transitions: {
3614
3979
  * login: {
@@ -3635,7 +4000,7 @@ declare function inputRequired(...fields: string[]): TransitionCondition;
3635
4000
  *
3636
4001
  * @example
3637
4002
  * ```typescript
3638
- * import { inputEquals } from '@mindmatrix/react';
4003
+ * import { inputEquals } from '@mmapp/react';
3639
4004
  *
3640
4005
  * conditions: [inputEquals('confirmDelete', true)]
3641
4006
  * // Generates: { type: 'expression', expression: 'input.confirmDelete == true' }
@@ -3655,7 +4020,7 @@ declare function inputEquals(field: string, value: unknown): TransitionCondition
3655
4020
  *
3656
4021
  * @example
3657
4022
  * ```typescript
3658
- * import { inState } from '@mindmatrix/react';
4023
+ * import { inState } from '@mmapp/react';
3659
4024
  *
3660
4025
  * conditions: [inState('active')]
3661
4026
  * ```
@@ -3671,7 +4036,7 @@ declare function inState(state: string): TransitionCondition;
3671
4036
  *
3672
4037
  * @example
3673
4038
  * ```typescript
3674
- * import { notInState } from '@mindmatrix/react';
4039
+ * import { notInState } from '@mmapp/react';
3675
4040
  *
3676
4041
  * conditions: [notInState('deleted')]
3677
4042
  * ```
@@ -3687,7 +4052,7 @@ declare function notInState(state: string): TransitionCondition;
3687
4052
  *
3688
4053
  * @example
3689
4054
  * ```typescript
3690
- * import { and, isOwner, fieldEquals } from '@mindmatrix/react';
4055
+ * import { and, isOwner, fieldEquals } from '@mmapp/react';
3691
4056
  *
3692
4057
  * conditions: [and(isOwner(), fieldEquals('status', 'draft'))]
3693
4058
  * ```
@@ -3704,7 +4069,7 @@ declare function and(...conditions: (TransitionCondition | string)[]): Transitio
3704
4069
  *
3705
4070
  * @example
3706
4071
  * ```typescript
3707
- * import { or, isSender, hasRole } from '@mindmatrix/react';
4072
+ * import { or, isSender, hasRole } from '@mmapp/react';
3708
4073
  *
3709
4074
  * // Only the sender or an admin can delete — mirrors the chat-message delete pattern
3710
4075
  * transitions: {
@@ -3728,7 +4093,7 @@ declare function or(...conditions: (TransitionCondition | string)[]): Transition
3728
4093
  *
3729
4094
  * @example
3730
4095
  * ```typescript
3731
- * import { not, hasRole, fieldEquals } from '@mindmatrix/react';
4096
+ * import { not, hasRole, fieldEquals } from '@mmapp/react';
3732
4097
  *
3733
4098
  * // Deny admins
3734
4099
  * conditions: [not(hasRole('admin'))]
@@ -3755,7 +4120,7 @@ declare function not(condition: TransitionCondition | string): TransitionConditi
3755
4120
  *
3756
4121
  * @example
3757
4122
  * ```typescript
3758
- * import { refHasRole } from '@mindmatrix/react';
4123
+ * import { refHasRole } from '@mmapp/react';
3759
4124
  *
3760
4125
  * // Only channel owners can delete — mirrors chat-channel delete pattern
3761
4126
  * transitions: {
@@ -3784,7 +4149,7 @@ declare function refHasRole(slug: string, lookupField: string, lookupValue: stri
3784
4149
  *
3785
4150
  * @example
3786
4151
  * ```typescript
3787
- * import { refHasAnyRole } from '@mindmatrix/react';
4152
+ * import { refHasAnyRole } from '@mmapp/react';
3788
4153
  *
3789
4154
  * // Admins or owners can archive — mirrors chat-channel archive pattern
3790
4155
  * transitions: {
@@ -3809,7 +4174,7 @@ declare function refHasAnyRole(slug: string, lookupField: string, lookupValue: s
3809
4174
  * @example
3810
4175
  * ```tsx
3811
4176
  * import auth from '../models/authentication.workflow';
3812
- * import { useModel } from '@mindmatrix/react';
4177
+ * import { useModel } from '@mmapp/react';
3813
4178
  *
3814
4179
  * export default function LoginPage() {
3815
4180
  * const { fields, state, trigger, loading } = useModel(auth);
@@ -3967,12 +4332,12 @@ declare function useCollection<D extends ModelDefinition>(definition: D, options
3967
4332
  * Compile-Time Atom Stubs — markers for the compiler to recognize.
3968
4333
  *
3969
4334
  * These are NOT runtime components — they are compile-time type stubs that
3970
- * the @mindmatrix/react-compiler recognizes in JSX and maps to IRExperienceNode
4335
+ * the @mmapp/react-compiler recognizes in JSX and maps to IRExperienceNode
3971
4336
  * entries. At runtime, the frontend's ComponentTreeRenderer resolves the
3972
4337
  * component name string to the actual registered React component.
3973
4338
  *
3974
4339
  * Usage in .workflow.tsx files:
3975
- * import { Stack, Row, Text, Button, TextInput } from '@mindmatrix/react/atoms';
4340
+ * import { Stack, Row, Text, Button, TextInput } from '@mmapp/react/atoms';
3976
4341
  *
3977
4342
  * return (
3978
4343
  * <Stack gap={4}>
@@ -4317,7 +4682,7 @@ declare const RoleGuard: FC<RoleGuardProps>;
4317
4682
  * - jsonpath: JSONPath expressions
4318
4683
  *
4319
4684
  * Usage in model files:
4320
- * import { cedar, sql, cron } from '@mindmatrix/react';
4685
+ * import { cedar, sql, cron } from '@mmapp/react';
4321
4686
  *
4322
4687
  * export const access = cedar`
4323
4688
  * permit (principal, action == Action::"read", resource)
@@ -4393,7 +4758,7 @@ declare function sql(strings: TemplateStringsArray, ...values: unknown[]): Gramm
4393
4758
  * Usage:
4394
4759
  * const schedule = cron`0 3 * * *`; // Every day at 3 AM
4395
4760
  */
4396
- declare function cron(strings: TemplateStringsArray, ...values: unknown[]): GrammarIsland;
4761
+ declare function cron$1(strings: TemplateStringsArray, ...values: unknown[]): GrammarIsland;
4397
4762
  /**
4398
4763
  * DMN decision table (markdown-like syntax).
4399
4764
  *
@@ -4434,7 +4799,7 @@ declare function jsonpath(strings: TemplateStringsArray, ...values: unknown[]):
4434
4799
  * and the backend runtime provides the concrete implementation.
4435
4800
  *
4436
4801
  * Usage in action files (actions.server.ts):
4437
- * import type { TransitionContext } from '@mindmatrix/react/server';
4802
+ * import type { TransitionContext } from '@mmapp/react/server';
4438
4803
  *
4439
4804
  * export async function notifyMembers(ctx: TransitionContext) {
4440
4805
  * const channel = ctx.stateData;
@@ -4579,7 +4944,7 @@ type ServerActionFn = (ctx: TransitionContext) => void | Promise<void>;
4579
4944
  * - No collision between blueprints
4580
4945
  *
4581
4946
  * Usage:
4582
- * import { deriveInstanceKey, deriveInstanceKeySync } from '@mindmatrix/react';
4947
+ * import { deriveInstanceKey, deriveInstanceKeySync } from '@mmapp/react';
4583
4948
  *
4584
4949
  * const key = deriveInstanceKeySync('mm-chat', '/chat/[channelId]', { channelId: '123' });
4585
4950
  * // → 'mm-chat:a1b2c3d4'
@@ -4600,11 +4965,11 @@ declare function deriveInstanceKey(blueprintSlug: string, layoutPath: string, pa
4600
4965
  declare function deriveInstanceKeySync(blueprintSlug: string, layoutPath: string, params?: InstanceKeyParams): string;
4601
4966
 
4602
4967
  /**
4603
- * Authoring-time API — compile-time declarations for the @mindmatrix/react
4968
+ * Authoring-time API — compile-time declarations for the @mmapp/react
4604
4969
  * workflow DSL.
4605
4970
  *
4606
4971
  * These functions are used when writing .workflow.tsx files. The Babel plugin
4607
- * (@mindmatrix/react-compiler) transforms them at compile time into IR.
4972
+ * (@mmapp/react-compiler) transforms them at compile time into IR.
4608
4973
  * They are NOT called at runtime — the compiler replaces them with runtime
4609
4974
  * equivalents (useExperienceState, useTransition with 1 arg, etc.).
4610
4975
  *
@@ -4776,14 +5141,14 @@ declare function useModuleConfigWithMutation(moduleSlug: string): {
4776
5141
  };
4777
5142
 
4778
5143
  /**
4779
- * @mindmatrix/react/builders — Fluent builder API for ModelDefinition objects.
5144
+ * @mmapp/react/builders — Fluent builder API for ModelDefinition objects.
4780
5145
  *
4781
5146
  * Provides a chainable API for constructing workflow models, fields, states,
4782
5147
  * and transitions without deeply nested object literals.
4783
5148
  *
4784
5149
  * @example
4785
5150
  * ```typescript
4786
- * import { model, field, state, transition } from '@mindmatrix/react/builders';
5151
+ * import { model, field, state, transition } from '@mmapp/react/builders';
4787
5152
  *
4788
5153
  * export default model('invoice')
4789
5154
  * .version('1.0.0')
@@ -5273,7 +5638,7 @@ declare class ModelBuilder<F extends Record<string, {
5273
5638
  *
5274
5639
  * @example
5275
5640
  * ```typescript
5276
- * import { model, field, state, transition } from '@mindmatrix/react/builders';
5641
+ * import { model, field, state, transition } from '@mmapp/react/builders';
5277
5642
  *
5278
5643
  * export default model('my-model')
5279
5644
  * .version('1.0.0')
@@ -5394,8 +5759,8 @@ declare function createCRUD(config: CRUDConfig): ModelDefinition;
5394
5759
  *
5395
5760
  * @example
5396
5761
  * ```typescript
5397
- * import { defineModel } from '@mindmatrix/react';
5398
- * import { pipe, withAuditTrail, withSoftDelete, withTags } from '@mindmatrix/react/mixins';
5762
+ * import { defineModel } from '@mmapp/react';
5763
+ * import { pipe, withAuditTrail, withSoftDelete, withTags } from '@mmapp/react/mixins';
5399
5764
  *
5400
5765
  * export default defineModel(pipe(
5401
5766
  * {
@@ -5413,7 +5778,7 @@ declare function createCRUD(config: CRUDConfig): ModelDefinition;
5413
5778
  * ));
5414
5779
  * ```
5415
5780
  *
5416
- * @module @mindmatrix/react/mixins
5781
+ * @module @mmapp/react/mixins
5417
5782
  */
5418
5783
 
5419
5784
  /**
@@ -5435,8 +5800,8 @@ type ModelMixin = (def: ModelDefinition) => ModelDefinition;
5435
5800
  *
5436
5801
  * @example
5437
5802
  * ```typescript
5438
- * import { defineModel } from '@mindmatrix/react';
5439
- * import { applyMixins, withTimestamps, withTags } from '@mindmatrix/react/mixins';
5803
+ * import { defineModel } from '@mmapp/react';
5804
+ * import { applyMixins, withTimestamps, withTags } from '@mmapp/react/mixins';
5440
5805
  *
5441
5806
  * const base = {
5442
5807
  * slug: 'article',
@@ -5461,8 +5826,8 @@ declare function applyMixins(def: ModelDefinition, ...mixins: ModelMixin[]): Mod
5461
5826
  *
5462
5827
  * @example
5463
5828
  * ```typescript
5464
- * import { defineModel } from '@mindmatrix/react';
5465
- * import { pipe, withAuditTrail, withSoftDelete, withOwnership } from '@mindmatrix/react/mixins';
5829
+ * import { defineModel } from '@mmapp/react';
5830
+ * import { pipe, withAuditTrail, withSoftDelete, withOwnership } from '@mmapp/react/mixins';
5466
5831
  *
5467
5832
  * export default defineModel(pipe(
5468
5833
  * {
@@ -5505,8 +5870,8 @@ interface WithAuditTrailOptions {
5505
5870
  *
5506
5871
  * @example
5507
5872
  * ```typescript
5508
- * import { defineModel } from '@mindmatrix/react';
5509
- * import { pipe, withAuditTrail } from '@mindmatrix/react/mixins';
5873
+ * import { defineModel } from '@mmapp/react';
5874
+ * import { pipe, withAuditTrail } from '@mmapp/react/mixins';
5510
5875
  *
5511
5876
  * export default defineModel(pipe(
5512
5877
  * {
@@ -5552,8 +5917,8 @@ interface WithSoftDeleteOptions {
5552
5917
  *
5553
5918
  * @example
5554
5919
  * ```typescript
5555
- * import { defineModel } from '@mindmatrix/react';
5556
- * import { pipe, withSoftDelete } from '@mindmatrix/react/mixins';
5920
+ * import { defineModel } from '@mmapp/react';
5921
+ * import { pipe, withSoftDelete } from '@mmapp/react/mixins';
5557
5922
  *
5558
5923
  * export default defineModel(pipe(
5559
5924
  * {
@@ -5594,8 +5959,8 @@ interface WithVersioningOptions {
5594
5959
  *
5595
5960
  * @example
5596
5961
  * ```typescript
5597
- * import { defineModel } from '@mindmatrix/react';
5598
- * import { pipe, withVersioning } from '@mindmatrix/react/mixins';
5962
+ * import { defineModel } from '@mmapp/react';
5963
+ * import { pipe, withVersioning } from '@mmapp/react/mixins';
5599
5964
  *
5600
5965
  * export default defineModel(pipe(
5601
5966
  * {
@@ -5650,8 +6015,8 @@ interface WithRBACOptions {
5650
6015
  *
5651
6016
  * @example
5652
6017
  * ```typescript
5653
- * import { defineModel } from '@mindmatrix/react';
5654
- * import { pipe, withRBAC } from '@mindmatrix/react/mixins';
6018
+ * import { defineModel } from '@mmapp/react';
6019
+ * import { pipe, withRBAC } from '@mmapp/react/mixins';
5655
6020
  *
5656
6021
  * export default defineModel(pipe(
5657
6022
  * {
@@ -5685,8 +6050,8 @@ declare function withRBAC(options: WithRBACOptions): ModelMixin;
5685
6050
  *
5686
6051
  * @example
5687
6052
  * ```typescript
5688
- * import { defineModel } from '@mindmatrix/react';
5689
- * import { pipe, withTimestamps } from '@mindmatrix/react/mixins';
6053
+ * import { defineModel } from '@mmapp/react';
6054
+ * import { pipe, withTimestamps } from '@mmapp/react/mixins';
5690
6055
  *
5691
6056
  * export default defineModel(pipe(
5692
6057
  * {
@@ -5723,8 +6088,8 @@ interface WithSlugOptions {
5723
6088
  *
5724
6089
  * @example
5725
6090
  * ```typescript
5726
- * import { defineModel } from '@mindmatrix/react';
5727
- * import { pipe, withSlug } from '@mindmatrix/react/mixins';
6091
+ * import { defineModel } from '@mmapp/react';
6092
+ * import { pipe, withSlug } from '@mmapp/react/mixins';
5728
6093
  *
5729
6094
  * export default defineModel(pipe(
5730
6095
  * {
@@ -5759,8 +6124,8 @@ interface WithOwnershipOptions {
5759
6124
  *
5760
6125
  * @example
5761
6126
  * ```typescript
5762
- * import { defineModel } from '@mindmatrix/react';
5763
- * import { pipe, withOwnership } from '@mindmatrix/react/mixins';
6127
+ * import { defineModel } from '@mmapp/react';
6128
+ * import { pipe, withOwnership } from '@mmapp/react/mixins';
5764
6129
  *
5765
6130
  * export default defineModel(pipe(
5766
6131
  * {
@@ -5789,8 +6154,8 @@ declare function withOwnership(options?: WithOwnershipOptions): ModelMixin;
5789
6154
  *
5790
6155
  * @example
5791
6156
  * ```typescript
5792
- * import { defineModel } from '@mindmatrix/react';
5793
- * import { pipe, withTags } from '@mindmatrix/react/mixins';
6157
+ * import { defineModel } from '@mmapp/react';
6158
+ * import { pipe, withTags } from '@mmapp/react/mixins';
5794
6159
  *
5795
6160
  * export default defineModel(pipe(
5796
6161
  * {
@@ -5828,8 +6193,8 @@ interface WithSearchOptions {
5828
6193
  *
5829
6194
  * @example
5830
6195
  * ```typescript
5831
- * import { defineModel } from '@mindmatrix/react';
5832
- * import { pipe, withSearch } from '@mindmatrix/react/mixins';
6196
+ * import { defineModel } from '@mmapp/react';
6197
+ * import { pipe, withSearch } from '@mmapp/react/mixins';
5833
6198
  *
5834
6199
  * export default defineModel(pipe(
5835
6200
  * {
@@ -5864,8 +6229,8 @@ declare function withSearch(options: WithSearchOptions): ModelMixin;
5864
6229
  *
5865
6230
  * @example
5866
6231
  * ```typescript
5867
- * import { defineModel } from '@mindmatrix/react';
5868
- * import { pipe, withPagination, withTimestamps } from '@mindmatrix/react/mixins';
6232
+ * import { defineModel } from '@mmapp/react';
6233
+ * import { pipe, withPagination, withTimestamps } from '@mmapp/react/mixins';
5869
6234
  *
5870
6235
  * export default defineModel(pipe(
5871
6236
  * {
@@ -5889,7 +6254,7 @@ declare function withPagination(): ModelMixin;
5889
6254
  *
5890
6255
  * @example
5891
6256
  * ```typescript
5892
- * import { Blueprint, field, state, transition } from '@mindmatrix/react';
6257
+ * import { Blueprint, field, state, transition } from '@mmapp/react';
5893
6258
  *
5894
6259
  * class AuthModule extends Blueprint {
5895
6260
  * slug = 'mod-authentication';
@@ -6009,8 +6374,8 @@ declare abstract class Blueprint {
6009
6374
  *
6010
6375
  * @example
6011
6376
  * ```typescript
6012
- * import { model, field, state } from '@mindmatrix/react';
6013
- * import { approval, escalation, review, crud } from '@mindmatrix/react/factories';
6377
+ * import { model, field, state } from '@mmapp/react';
6378
+ * import { approval, escalation, review, crud } from '@mmapp/react/factories';
6014
6379
  *
6015
6380
  * export default model('invoice')
6016
6381
  * .field('amount', field.currency().required())
@@ -6097,14 +6462,14 @@ interface CrudConfig {
6097
6462
  declare function crud(config?: CrudConfig): (def: ModelDefinition) => ModelDefinition;
6098
6463
 
6099
6464
  /**
6100
- * @mindmatrix/react/testing — Testing utilities for workflow models.
6465
+ * @mmapp/react/testing — Testing utilities for workflow models.
6101
6466
  *
6102
6467
  * Provides static analysis, BDD-style test harnesses, and pretty-printing
6103
6468
  * for models defined with `defineModel()`.
6104
6469
  *
6105
6470
  * @example
6106
6471
  * ```typescript
6107
- * import { validateModel, testModel, describeModel, assertModelValid } from '@mindmatrix/react/testing';
6472
+ * import { validateModel, testModel, describeModel, assertModelValid } from '@mmapp/react/testing';
6108
6473
  * import authModel from '../models/authentication';
6109
6474
  *
6110
6475
  * // Static analysis
@@ -6160,8 +6525,8 @@ interface ValidationIssue {
6160
6525
  *
6161
6526
  * @example
6162
6527
  * ```typescript
6163
- * import { defineModel } from '@mindmatrix/react';
6164
- * import { validateModel } from '@mindmatrix/react/testing';
6528
+ * import { defineModel } from '@mmapp/react';
6529
+ * import { validateModel } from '@mmapp/react/testing';
6165
6530
  *
6166
6531
  * const model = defineModel({
6167
6532
  * slug: 'order',
@@ -6194,7 +6559,7 @@ declare function validateModel(def: ModelDefinition): ValidationIssue[];
6194
6559
  *
6195
6560
  * @example
6196
6561
  * ```typescript
6197
- * import { assertModelValid } from '@mindmatrix/react/testing';
6562
+ * import { assertModelValid } from '@mmapp/react/testing';
6198
6563
  * import orderModel from '../models/order';
6199
6564
  *
6200
6565
  * // In a test file
@@ -6336,7 +6701,7 @@ interface TestChain extends TestStep {
6336
6701
  *
6337
6702
  * @example
6338
6703
  * ```typescript
6339
- * import { testModel } from '@mindmatrix/react/testing';
6704
+ * import { testModel } from '@mmapp/react/testing';
6340
6705
  * import messageModel from '../models/message';
6341
6706
  *
6342
6707
  * testModel(messageModel)
@@ -6385,7 +6750,7 @@ declare function testModel(def: ModelDefinition): {
6385
6750
  *
6386
6751
  * @example
6387
6752
  * ```typescript
6388
- * import { describeModel } from '@mindmatrix/react/testing';
6753
+ * import { describeModel } from '@mmapp/react/testing';
6389
6754
  * import authModel from '../models/authentication';
6390
6755
  *
6391
6756
  * console.log(describeModel(authModel));
@@ -6411,6 +6776,311 @@ declare function testModel(def: ModelDefinition): {
6411
6776
  */
6412
6777
  declare function describeModel(def: ModelDefinition): string;
6413
6778
 
6779
+ /**
6780
+ * Workflow Inheritance — extend a base workflow to create a derived workflow.
6781
+ *
6782
+ * `extend()` is a compile-time declaration. The compiler (@mmapp/react-compiler):
6783
+ * 1. Resolves the base workflow import
6784
+ * 2. Compiles the base to IR
6785
+ * 3. Applies overrides (replaced states, new fields, inserted states, modified transitions)
6786
+ * 4. Outputs a single flat IR definition
6787
+ *
6788
+ * At runtime, `extend()` throws — it must be compiled away before execution.
6789
+ *
6790
+ * @example
6791
+ * ```typescript
6792
+ * import orderWorkflow from './order';
6793
+ *
6794
+ * export default extend(orderWorkflow, {
6795
+ * slug: 'premium-order',
6796
+ * fields: {
6797
+ * loyaltyTier: 'gold | silver | bronze',
6798
+ * giftMessage: 'string',
6799
+ * },
6800
+ * states: {
6801
+ * processPayment: async (order, base) => {
6802
+ * await fraudCheck(order);
6803
+ * await base(order);
6804
+ * await addLoyaltyPoints(order);
6805
+ * },
6806
+ * },
6807
+ * insert: {
6808
+ * after: { checkout: verifyMembership },
6809
+ * before: { ship: giftWrap },
6810
+ * },
6811
+ * transitions: {
6812
+ * ship: { roles: ['premium-warehouse'] },
6813
+ * },
6814
+ * });
6815
+ * ```
6816
+ *
6817
+ * @module @mmapp/react/extend
6818
+ */
6819
+ /**
6820
+ * Shorthand field type string (e.g. 'string', 'number', 'gold | silver | bronze')
6821
+ * or a full field configuration object.
6822
+ */
6823
+ type FieldShorthand = string | {
6824
+ type: string;
6825
+ required?: boolean;
6826
+ default?: unknown;
6827
+ description?: string;
6828
+ validation?: Record<string, unknown>;
6829
+ };
6830
+ /**
6831
+ * Partial transition configuration for overriding base transitions.
6832
+ * All properties are optional — they merge with the base transition definition.
6833
+ */
6834
+ interface TransitionOverride {
6835
+ /** Roles allowed to trigger this transition. Replaces the base roles if provided. */
6836
+ roles?: string[];
6837
+ /** Required field keys that must be set before the transition fires. */
6838
+ require?: string[];
6839
+ /** Expression string evaluated at transition time. Must return truthy. */
6840
+ when?: string;
6841
+ /** If true, the transition fires automatically when conditions are met. */
6842
+ auto?: boolean;
6843
+ /** Override the 'from' state(s). */
6844
+ from?: string | string[];
6845
+ /** Override the 'to' state. */
6846
+ to?: string;
6847
+ }
6848
+ /** Role configuration for additional roles merged into the derived workflow. */
6849
+ interface ExtendRoleDefinition {
6850
+ /** Human-readable description of the role. */
6851
+ description?: string;
6852
+ /** Permission keys granted to this role. */
6853
+ permissions?: string[];
6854
+ /** Parent roles this role inherits from. */
6855
+ inherits?: string[];
6856
+ }
6857
+ /**
6858
+ * Insert configuration — inject new state functions at specific points in the
6859
+ * base workflow's state machine.
6860
+ *
6861
+ * The compiler rewires transitions so the inserted states execute in the
6862
+ * correct order while preserving the base workflow's transition graph.
6863
+ */
6864
+ interface InsertConfig<TData> {
6865
+ /**
6866
+ * Insert a state function after the named base state.
6867
+ * A new transition is created from the base state to the inserted state,
6868
+ * and the inserted state inherits the base state's outgoing transitions.
6869
+ */
6870
+ after?: Record<string, (data: TData) => Promise<void>>;
6871
+ /**
6872
+ * Insert a state function before the named base state.
6873
+ * A new transition is created from the inserted state to the base state,
6874
+ * and the inserted state inherits the base state's incoming transitions.
6875
+ */
6876
+ before?: Record<string, (data: TData) => Promise<void>>;
6877
+ }
6878
+ /**
6879
+ * Configuration for creating a derived workflow from a base workflow.
6880
+ *
6881
+ * @typeParam TData - The data shape of the workflow (inferred from base).
6882
+ */
6883
+ interface ExtendOptions<TData = unknown> {
6884
+ /** Slug for the derived workflow. If omitted, compiler generates one. */
6885
+ slug?: string;
6886
+ /** Human-readable name for the derived workflow. */
6887
+ name?: string;
6888
+ /** Description of the derived workflow. */
6889
+ description?: string;
6890
+ /** Category override (e.g. 'workflow', 'data', 'module'). */
6891
+ category?: string;
6892
+ /**
6893
+ * Additional fields to add to the derived workflow.
6894
+ * Uses shorthand strings ('string', 'number', 'gold | silver | bronze')
6895
+ * or full field configuration objects.
6896
+ */
6897
+ fields?: Record<string, FieldShorthand>;
6898
+ /**
6899
+ * Override state functions from the base workflow.
6900
+ *
6901
+ * Each key is a state name from the base. The function receives the
6902
+ * workflow data and a `base` callback that invokes the original state
6903
+ * function (the "super" call).
6904
+ *
6905
+ * @example
6906
+ * ```typescript
6907
+ * states: {
6908
+ * processPayment: async (order, base) => {
6909
+ * await fraudCheck(order);
6910
+ * await base(order); // call the original processPayment
6911
+ * await addLoyaltyPoints(order);
6912
+ * },
6913
+ * }
6914
+ * ```
6915
+ */
6916
+ states?: Record<string, (data: TData, base: (data: TData) => Promise<void>) => Promise<void>>;
6917
+ /**
6918
+ * Insert new state functions at specific points in the base workflow.
6919
+ * Creates new states and rewires transitions accordingly.
6920
+ */
6921
+ insert?: InsertConfig<TData>;
6922
+ /**
6923
+ * Override transition options. Properties are merged with the base
6924
+ * transition — you only need to specify what changes.
6925
+ */
6926
+ transitions?: Record<string, TransitionOverride>;
6927
+ /**
6928
+ * Additional roles to merge with the base workflow's roles.
6929
+ * New roles are added; existing roles are merged (arrays are concatenated).
6930
+ */
6931
+ roles?: Record<string, ExtendRoleDefinition>;
6932
+ /**
6933
+ * Override orchestration configuration (multi-player strategies, conflict
6934
+ * resolution, etc.). Merged shallowly with the base orchestration.
6935
+ */
6936
+ orchestration?: Record<string, unknown>;
6937
+ }
6938
+ /**
6939
+ * Create a derived workflow by extending a base workflow.
6940
+ *
6941
+ * This function is a **compile-time declaration**. The compiler
6942
+ * (`@mmapp/react-compiler`) detects `extend()` calls and:
6943
+ *
6944
+ * 1. Resolves the base workflow (which must be a default export from another
6945
+ * `.workflow.tsx` file or an imported `defineModel()` definition).
6946
+ * 2. Compiles the base workflow to IR.
6947
+ * 3. Applies the `options` as overrides — merging fields, replacing or
6948
+ * wrapping state functions, inserting new states, and adjusting transitions.
6949
+ * 4. Outputs a single flat IR definition (no runtime inheritance chain).
6950
+ *
6951
+ * **At runtime, this function throws.** It must be compiled away before the
6952
+ * code executes. If you see the runtime error, ensure your build pipeline
6953
+ * includes the `@mmapp/react-compiler` Babel plugin or use `mmrc build`.
6954
+ *
6955
+ * @typeParam TData - The data shape of the base workflow (inferred).
6956
+ * @param base - The base workflow function (imported from another file).
6957
+ * @param options - Override and extension configuration.
6958
+ * @returns A workflow function with the same signature as the base (for type inference).
6959
+ *
6960
+ * @example
6961
+ * ```typescript
6962
+ * import orderWorkflow from './order';
6963
+ *
6964
+ * export default extend(orderWorkflow, {
6965
+ * slug: 'premium-order',
6966
+ * fields: {
6967
+ * loyaltyTier: 'gold | silver | bronze',
6968
+ * giftMessage: 'string',
6969
+ * },
6970
+ * states: {
6971
+ * processPayment: async (order, base) => {
6972
+ * await fraudCheck(order);
6973
+ * await base(order);
6974
+ * await addLoyaltyPoints(order);
6975
+ * },
6976
+ * },
6977
+ * insert: {
6978
+ * after: { checkout: verifyMembership },
6979
+ * before: { ship: giftWrap },
6980
+ * },
6981
+ * transitions: {
6982
+ * ship: { roles: ['premium-warehouse'] },
6983
+ * },
6984
+ * });
6985
+ * ```
6986
+ */
6987
+ declare function extend<TData>(base: (data: TData) => Promise<void>, options: ExtendOptions<TData>): (data: TData) => Promise<void>;
6988
+
6989
+ /**
6990
+ * Workflow Composition — wrap a workflow with mixins for cross-cutting concerns.
6991
+ *
6992
+ * `compose()` applies mixins to a workflow function. Unlike `extend()` (which
6993
+ * creates a derived workflow from a base), `compose()` decorates an existing
6994
+ * workflow with additional fields, states, and transitions without modifying
6995
+ * the original function.
6996
+ *
6997
+ * Mixins are applied post-compilation: the compiler detects `compose()` calls,
6998
+ * compiles the inner workflow to IR, then applies each mixin's `apply()`
6999
+ * function to the IR in order (left to right).
7000
+ *
7001
+ * @example
7002
+ * ```typescript
7003
+ * import { compose, withAuditTrail, withSoftDelete, withRBAC } from '@mmapp/react';
7004
+ *
7005
+ * export default compose(taskWorkflow,
7006
+ * withAuditTrail(),
7007
+ * withSoftDelete(),
7008
+ * withRBAC({ admin: ['*'], member: ['start', 'complete'] }),
7009
+ * );
7010
+ * ```
7011
+ *
7012
+ * @module @mmapp/react/compose
7013
+ */
7014
+ /**
7015
+ * A mixin that can be applied to a compiled workflow IR.
7016
+ *
7017
+ * Mixins are created by factory functions (e.g. `withAuditTrail()`,
7018
+ * `withSoftDelete()`, `withRBAC()`). The factory returns a `WorkflowMixin`
7019
+ * object that the compiler applies to the IR after the base workflow is
7020
+ * compiled.
7021
+ *
7022
+ * The `apply` function receives the compiled IR and returns a new IR with
7023
+ * the mixin's enhancements. It must not mutate the input.
7024
+ */
7025
+ interface WorkflowMixin {
7026
+ /** Discriminator tag — always `true`. Used by the compiler to identify mixin objects. */
7027
+ readonly __mixin: true;
7028
+ /** Human-readable name for the mixin (e.g. 'audit-trail', 'soft-delete'). */
7029
+ readonly name: string;
7030
+ /**
7031
+ * Apply this mixin to a compiled workflow IR.
7032
+ * Returns a new IR with the mixin's enhancements (fields, states, transitions, etc.).
7033
+ * Must not mutate the input IR.
7034
+ *
7035
+ * @param ir - The compiled workflow IR (opaque at the type level; the compiler knows the shape).
7036
+ * @returns The enhanced IR.
7037
+ */
7038
+ apply: (ir: unknown) => unknown;
7039
+ }
7040
+ /**
7041
+ * Internal metadata attached to the wrapper function returned by `compose()`.
7042
+ * The compiler inspects this to discover the base workflow and mixin chain.
7043
+ */
7044
+ interface ComposedWorkflowMetadata<T extends (...args: unknown[]) => Promise<void>> {
7045
+ readonly __composed: true;
7046
+ /** The original workflow function before composition. */
7047
+ readonly workflow: T;
7048
+ /** The ordered list of mixins to apply post-compilation. */
7049
+ readonly mixins: readonly WorkflowMixin[];
7050
+ }
7051
+ /**
7052
+ * Compose a workflow with one or more mixins.
7053
+ *
7054
+ * Returns a thin wrapper that stores the workflow reference and mixin list.
7055
+ * The compiler detects `compose()` calls and:
7056
+ * 1. Compiles the inner workflow to IR.
7057
+ * 2. Applies each mixin's `apply()` to the IR in left-to-right order.
7058
+ * 3. Outputs the final enhanced IR.
7059
+ *
7060
+ * At runtime, the wrapper delegates to the original workflow function.
7061
+ * Mixin application only happens at compile time (in the IR layer).
7062
+ *
7063
+ * @typeParam T - The workflow function type (preserved through composition).
7064
+ * @param workflow - The workflow function to compose.
7065
+ * @param mixins - One or more `WorkflowMixin` objects to apply.
7066
+ * @returns A function with the same signature as `workflow`, annotated with composition metadata.
7067
+ *
7068
+ * @example
7069
+ * ```typescript
7070
+ * import { compose } from '@mmapp/react';
7071
+ * import { withAuditTrail, withSoftDelete, withRBAC } from '@mmapp/react';
7072
+ *
7073
+ * const taskWorkflow = async (data: TaskData) => { ... };
7074
+ *
7075
+ * export default compose(taskWorkflow,
7076
+ * withAuditTrail(),
7077
+ * withSoftDelete(),
7078
+ * withRBAC({ admin: ['*'], member: ['start', 'complete'] }),
7079
+ * );
7080
+ * ```
7081
+ */
7082
+ declare function compose<T extends (...args: any[]) => Promise<void>>(workflow: T, ...mixins: WorkflowMixin[]): T;
7083
+
6414
7084
  /**
6415
7085
  * Player Web Types — React integration types for the browser-side workflow engine.
6416
7086
  */
@@ -7021,4 +7691,593 @@ declare class BrowserPlayer {
7021
7691
  private log;
7022
7692
  }
7023
7693
 
7024
- export { Accordion, type ActionContext, type ActionCreator, type ActionCreators, type ActionDefinition, type ActionEnvironment, type ActionHandler, type ActionManifest, type ActionManifestEntry, type ActionNotifyOptions, type ActionOptions, type ActionResult, AnimatedBox, type ApprovalConfig, type AuthOptions, type AuthResolver, type AuthResult, type AuthUser, Badge, type BadgeProps, Blueprint, type BlueprintAction, type BlueprintConfig, type BlueprintConfigSchema, type BlueprintDependency, type BlueprintManifest, type BlueprintRoute, type BlueprintServerActionDeclaration, type BlueprintSlotContribution, type BlueprintViewDeclaration, BrowserPlayer, type BrowserPlayerConfig, type TransitionResult as BrowserTransitionResult, Button, type ButtonProps, type CRUDConfig, Canvas3D, Card, type CardProps, type CedarPolicy, type ChannelHandle, type ChannelMessage, type ChannelOptions, type ChannelTransport, Chart, type CollectionHandle, Column, type ColumnProps, type ComputedFieldMode, type ComputedFieldResult, type CronFields, type CrudConfig, DataGrid, type DataSource, type DataSourceResult, Divider, type DividerProps, type DmnRule, type DomainEvent, type DomainSubscriptionConfig, type DomainSubscriptionTransport, type DuringAction, type DuringActionConfig, Each, type EachProps, type EscalationConfig, type EventPayload, type EventSubscription, type ExperienceViewConfig, ExperienceWorkflowBridge, type ExperienceWorkflowBridgeProps, type ExperienceWorkflowDefinition, type ExpressionLibraryRecord, type ExpressionLibraryResolver, type ExpressionLibraryResult, Field, FieldBuilder, type FieldRegistration, type FieldTypeMap, type FieldValidation, type FieldValidator, type FormConfig, type FormHandle, type FormValidator, type GeoPosition, type GeolocationError, type GeolocationOptions, type GeolocationResult, type GrammarIsland, Grid, Heading, type HeadingProps, Icon, Image, type InferFieldNames, type InferFields, type InferSlug, type InferStates, type InferTransitions, type InstalledModuleRef, type InstanceData, type InstanceKeyParams, type InstanceRef, type LatLng, type LatLngBounds, type LibraryParam, Link, type LocalDataResolver, type LocalEngineAdapter, type LocalEngineContextValue, LocalEngineProvider, type LocalEngineStore, LocalWorkflowEngine, type LoginCredentials, type MapMarker, type MapViewHandle, type MapViewOptions, Markdown, MetricCard, type MiddlewareContext, type MiddlewareFn, type MiddlewareHandle, type MiddlewareOptions, type MiddlewareResult, type MmWasmModule, Modal, ModelBuilder, type ModelDefinition, type ModelHandle, type ModelMixin, type ModelTestContext, type ModuleAction, type ModuleConfigSchema, type ModuleDependency, type ModuleHandle, type ModuleManifest, type ModuleRoute, type ModuleRouteConfig, type MutationHandle, type MutationResolver, NavLink, type NotificationResult, type NotifyOptions, type PackageChild, type PackageManifest, type PackageResult, type PipelineConfig, type PipelineStage, type PlayerConfig, type PlayerEvent, type PlayerEventCallback, type PlayerEventListener, type PlayerHandle, type PlayerInstance, type PlayerLogEntry, PlayerProvider, type PlayerProviderProps, type QueryParams$1 as QueryParams, type QueryResolver, type QueryResult, type RealtimeQueryParams, type RealtimeQueryResult, type ReviewConfig, type RoleDefinition, RoleGuard, type RoleOptions, type RoleResult, Route, type RouteDefinition, type RouteGuard, type RouteLocation, type RouteParamsOptions, Router, type RouterHandle, type RouterOptions, Row, type RowProps, type RuntimeConfig, RuntimeContext, type RuntimeSnapshot, ScrollArea, Section, Select, type ServerActionFn, type ServerActionHandle, type ServerActionOptions, type ServerActionResolver, type ServerActionResult, ServerGrid, type ServerStateOptions, type ServerStateResolver, type ServerStateResult, type ServerStateSnapshot, type SetupWizard, type SetupWizardStep, Show, type ShowProps, Slot, type SlotContribution, type SlotContributions, type SlotProps, Spacer, type SpawnActionOptions, type SpawnOptions, Stack, type StackProps, StateBuilder, type StateDescriptor, type StateHome, type Subscription, Tabs, type TestChain, type TestStep, Text, TextInput, type TextInputProps, type TextProps, type ToastConfig, type ToastHandle, type ToastInstance, type ToastVariant, TransitionBuilder, type TransitionCondition, type TransitionConfig, type TransitionContext, type TransitionDescriptor, type TransitionHandle, type TypedMutationHandle, TypedTransitionBuilder, type UseCollectionOptions, type UseComputedOptions, type UseModelOptions, type UseModuleOptions, type UseOnEventOptions, type UseWorkflowOptions, type ValidationIssue, type ValidationResult, type ValidationRule, type ViewDefinitionResult, type ViewRecord, type ViewResolver, type WithAuditTrailOptions, type WithOwnershipOptions, type WithRBACOptions, type WithSearchOptions, type WithSlugOptions, type WithSoftDeleteOptions, type WithVersioningOptions, type WorkflowDataSource, type WorkflowDefinition, type WorkflowEvent, type WorkflowEventHandler, type WorkflowFieldDef, type WorkflowFieldDescriptor, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceWithEvents, WorkflowProvider, type WorkflowProviderProps, WorkflowRuntime, type WorkflowState, type WorkflowTransition, action, and, applyMixins, approval, assertModelValid, cedar, connector, createActions, createCRUD, createLocalDataResolver, createLocalEngineAdapter, createPipeline, cron, crud, defineBlueprint, defineModel, defineModule, defineWorkspace, deriveInstanceKey, deriveInstanceKeySync, describeModel, deviceAction, dmn, escalation, expr, field, fieldContains, fieldEquals, fieldGreaterThan, fieldIn, fieldIsEmpty, fieldIsSet, fieldLessThan, fieldMatches, fieldNotEquals, fieldNotIn, getInstalledModule, getInstalledModules, graphql, hasAnyRole, hasRole, inState, inputEquals, inputRequired, isActor, isCreator, isOwner, isPlayerDebug, isSender, jsonpath, llm, loadExperienceWorkflow, logEvent, model, normalizeDefinition, not, notInState, notify, or, pipe, playerLog, prefetchData, refHasAnyRole, refHasRole, requireAuth, requireRole, review, serverAction, setAuthResolver, setChannelTransport, setConfigContext, setExpressionLibraryResolver, setField, setFields, setInstalledModules, setModuleConfigDefaults, setMutationResolver, setPersistedModuleConfig, setPlayerDebug, setQueryResolver, setRealtimeQueryResolver, setRoleHierarchy, setServerActionResolver, setServerStateResolver, setViewResolver, spawn, sql, state, syncConfigDefaults, testModel, transition, updateDefinitionConfig, useAuth, useChannel, useCollection, useComputed, useComputedWithMeta, useDomainSubscription, useDuringAction, useExperienceState, useExpressionLibrary, useForm, useGeolocation, useLocalEngine, useMapView, useMiddleware, useModel, useModule, useModuleConfig, useModuleConfigWithMutation, useMutation, useNotification, useOnChange, useOnEnter, useOnEvent, useOnExit, useOnTransition, usePackage, useParams, usePlayer, usePlayerContext, usePlayerContextSafe, useQuery, useRealtimeQuery, useRole, useRouteParams, useRouter, useRuntimeContext, useServerAction, useServerState, useStateField, useToast, useTransition, useView, useWhileIn, useWorkflow, useState as useWorkflowState, validateExperienceWorkflow, validateModel, when, withAuditTrail, withOwnership, withPagination, withRBAC, withSearch, withSlug, withSoftDelete, withTags, withTimestamps, withVersioning };
7694
+ /**
7695
+ * Middleware Definition API (Design 33) — compile-time declarations for engine middleware.
7696
+ *
7697
+ * Middleware intercepts engine execution points (transitions, state changes, field updates, etc.)
7698
+ * and can block, modify, or wrap the operation. This is the declaration layer — the compiler
7699
+ * extracts match patterns and action bodies into IR for the engine to execute.
7700
+ *
7701
+ * Usage:
7702
+ * import { defineMiddleware } from '@mmapp/react';
7703
+ *
7704
+ * export default defineMiddleware({
7705
+ * name: 'audit-logger',
7706
+ * match: '*:*:transition.execute',
7707
+ * priority: 10,
7708
+ * after(ctx) {
7709
+ * ctx.modify({ lastAuditAt: ctx.timestamp });
7710
+ * },
7711
+ * });
7712
+ */
7713
+ /**
7714
+ * Execution points that middleware can intercept.
7715
+ * Used in match patterns: `{scope}:{slug}:{executionPoint}`
7716
+ */
7717
+ type ExecutionPoint = 'instance.create' | 'instance.delete' | 'transition.evaluate' | 'transition.execute' | 'state.enter' | 'state.exit' | 'action.execute' | 'field.change' | 'event.emit' | 'event.receive' | 'schedule.fire' | 'validation.check';
7718
+ /**
7719
+ * Context available to middleware at each execution point.
7720
+ *
7721
+ * NOTE: Named EngineMiddlewareContext to avoid collision with the existing
7722
+ * MiddlewareContext in hooks/useMiddleware.ts (which is a pre-render middleware).
7723
+ * This type represents the engine-level interception context.
7724
+ */
7725
+ interface EngineMiddlewareContext {
7726
+ /** The workflow instance being operated on. */
7727
+ instance: {
7728
+ id: string;
7729
+ state: string;
7730
+ fields: Record<string, unknown>;
7731
+ slug: string;
7732
+ };
7733
+ /** The actor performing the operation. */
7734
+ actor: {
7735
+ id: string;
7736
+ roles: string[];
7737
+ email?: string;
7738
+ };
7739
+ /** The workflow definition metadata. */
7740
+ definition: {
7741
+ slug: string;
7742
+ version?: string;
7743
+ category?: string;
7744
+ };
7745
+ /** Timestamp of the operation (epoch ms). */
7746
+ timestamp: number;
7747
+ /** Block the operation with a reason string. Prevents execution. */
7748
+ block(reason: string): void;
7749
+ /** Modify instance fields or operation parameters. */
7750
+ modify(changes: Record<string, unknown>): void;
7751
+ /** Skip the operation silently (no error, no execution). */
7752
+ skip(): void;
7753
+ /** Available for transition.evaluate / transition.execute. */
7754
+ transition?: {
7755
+ name: string;
7756
+ from: string;
7757
+ to: string;
7758
+ input?: Record<string, unknown>;
7759
+ };
7760
+ /** Available for state.enter / state.exit. */
7761
+ state?: {
7762
+ name: string;
7763
+ type: string;
7764
+ };
7765
+ /** Available for action.execute. */
7766
+ action?: {
7767
+ id: string;
7768
+ type: string;
7769
+ config: Record<string, unknown>;
7770
+ };
7771
+ /** Available for field.change. */
7772
+ field?: {
7773
+ name: string;
7774
+ oldValue: unknown;
7775
+ newValue: unknown;
7776
+ };
7777
+ /** Available for event.emit / event.receive. */
7778
+ event?: {
7779
+ type: string;
7780
+ payload: unknown;
7781
+ };
7782
+ /** Available for validation.check. */
7783
+ validation?: {
7784
+ field: string;
7785
+ rule: unknown;
7786
+ value: unknown;
7787
+ };
7788
+ }
7789
+ /**
7790
+ * Inter-type declarations — fields, states, and transitions that a middleware
7791
+ * introduces into workflows it applies to (AOP inter-type declaration pattern).
7792
+ */
7793
+ interface MiddlewareIntroduce {
7794
+ /** Fields to add to workflows this middleware applies to. */
7795
+ fields?: Record<string, {
7796
+ type: string;
7797
+ default?: unknown;
7798
+ }>;
7799
+ /** States to add to workflows this middleware applies to. */
7800
+ states?: Record<string, {
7801
+ type?: string;
7802
+ }>;
7803
+ /** Transitions to add to workflows this middleware applies to. */
7804
+ transitions?: Record<string, {
7805
+ from: string | string[];
7806
+ to: string;
7807
+ }>;
7808
+ }
7809
+ /**
7810
+ * Middleware definition object — the shape passed to defineMiddleware().
7811
+ */
7812
+ interface MiddlewareDefinition {
7813
+ /** Unique name for this middleware. */
7814
+ name: string;
7815
+ /**
7816
+ * Match pattern(s) specifying which execution points to intercept.
7817
+ * Format: `{scope}:{slug}:{executionPoint}` where `*` is a wildcard.
7818
+ * Examples: `'*:*:transition.execute'`, `['order:*:field.change', '*:*:state.enter']`
7819
+ */
7820
+ match: string | string[];
7821
+ /** Priority — higher values run first. Default: 0. */
7822
+ priority?: number;
7823
+ /** Configurable parameters for this middleware (schema for runtime config). */
7824
+ config?: Record<string, {
7825
+ type: string;
7826
+ default?: unknown;
7827
+ }>;
7828
+ /** Runs before the matched execution point. Can block/modify/skip. */
7829
+ before?: (ctx: EngineMiddlewareContext, config?: Record<string, unknown>) => void;
7830
+ /** Runs after the matched execution point completes. */
7831
+ after?: (ctx: EngineMiddlewareContext, config?: Record<string, unknown>) => void;
7832
+ /** Wraps the matched execution point. Must call next() to proceed. */
7833
+ around?: (ctx: EngineMiddlewareContext, next: () => Promise<void>, config?: Record<string, unknown>) => Promise<void>;
7834
+ /**
7835
+ * Inter-type declarations: fields, states, and transitions that this middleware
7836
+ * introduces into any workflow it applies to. The compiler merges these into the
7837
+ * workflow definition at compile time.
7838
+ *
7839
+ * @example
7840
+ * ```typescript
7841
+ * defineMiddleware({
7842
+ * name: 'mm:soft-delete',
7843
+ * match: '*:*:instance.delete',
7844
+ * introduce: {
7845
+ * fields: { deletedAt: { type: 'datetime' }, isDeleted: { type: 'boolean', default: false } },
7846
+ * states: { soft_deleted: { type: 'terminal' } },
7847
+ * transitions: { soft_delete: { from: '*', to: 'soft_deleted' } },
7848
+ * },
7849
+ * before(ctx) { ctx.skip(); ctx.modify({ isDeleted: true, deletedAt: ctx.timestamp }); },
7850
+ * });
7851
+ * ```
7852
+ */
7853
+ introduce?: MiddlewareIntroduce;
7854
+ /**
7855
+ * Scope of this middleware instance.
7856
+ * - `'definition'` (default): one instance per workflow definition (shared state across all instances).
7857
+ * - `'instance'`: one instance per workflow instance (per-instance isolated state).
7858
+ */
7859
+ scope?: 'definition' | 'instance';
7860
+ /**
7861
+ * Access level for this middleware.
7862
+ * - `'public'` (default): can only access public instance data (fields, state, actor).
7863
+ * - `'privileged'`: can access internal engine state (for platform-level middleware like metrics, tracing).
7864
+ */
7865
+ access?: 'public' | 'privileged';
7866
+ }
7867
+ /**
7868
+ * Define middleware for intercepting engine execution points.
7869
+ *
7870
+ * This is a compile-time declaration. The compiler extracts the match patterns
7871
+ * and action bodies. At runtime this is an identity function.
7872
+ *
7873
+ * @example
7874
+ * export default defineMiddleware({
7875
+ * name: 'require-auth',
7876
+ * match: '*:*:transition.execute',
7877
+ * priority: 90,
7878
+ * before(ctx) {
7879
+ * if (!ctx.actor.id) ctx.block('Authentication required');
7880
+ * },
7881
+ * });
7882
+ */
7883
+ declare function defineMiddleware<const D extends MiddlewareDefinition>(def: D): D;
7884
+ /**
7885
+ * Create a derived middleware by extending a base middleware definition.
7886
+ *
7887
+ * The override fields are shallow-merged on top of the base. For `match`,
7888
+ * the override replaces the base entirely (not concatenated). For `introduce`,
7889
+ * the sub-objects (fields, states, transitions) are merged.
7890
+ *
7891
+ * @param base - The base middleware to extend.
7892
+ * @param overrides - Fields to override or add.
7893
+ * @returns A new MiddlewareDefinition with merged values.
7894
+ *
7895
+ * @example
7896
+ * ```typescript
7897
+ * const baseAuth = defineMiddleware({
7898
+ * name: 'mm:auth',
7899
+ * match: '*:*:transition.execute',
7900
+ * priority: 90,
7901
+ * before(ctx) { if (!ctx.actor.id) ctx.block('Auth required'); },
7902
+ * });
7903
+ *
7904
+ * const strictAuth = extendMiddleware(baseAuth, {
7905
+ * name: 'mm:strict-auth',
7906
+ * priority: 95,
7907
+ * before(ctx) {
7908
+ * if (!ctx.actor.id) ctx.block('Auth required');
7909
+ * if (!ctx.actor.email) ctx.block('Verified email required');
7910
+ * },
7911
+ * });
7912
+ * ```
7913
+ */
7914
+ declare function extendMiddleware(base: MiddlewareDefinition, overrides: Partial<MiddlewareDefinition>): MiddlewareDefinition;
7915
+ /**
7916
+ * Authentication middleware — blocks transitions if no actor is present.
7917
+ */
7918
+ declare function withAuth(opts?: {
7919
+ redirectTo?: string;
7920
+ }): MiddlewareDefinition;
7921
+ /**
7922
+ * Audit log middleware — logs transition details after execution.
7923
+ */
7924
+ declare function withAuditLog(opts?: {
7925
+ level?: 'debug' | 'info' | 'warn';
7926
+ }): MiddlewareDefinition;
7927
+ /**
7928
+ * Rate limiting middleware — blocks transitions exceeding the rate limit.
7929
+ */
7930
+ declare function withRateLimit(opts?: {
7931
+ maxPerMinute?: number;
7932
+ }): MiddlewareDefinition;
7933
+ /**
7934
+ * Validation middleware — evaluates field validation rules on field changes.
7935
+ */
7936
+ declare function withValidation(opts?: {
7937
+ rules?: Array<{
7938
+ fields: string[];
7939
+ check: string;
7940
+ message: string;
7941
+ }>;
7942
+ }): MiddlewareDefinition;
7943
+ /**
7944
+ * Metrics middleware — wraps execution with timing measurements.
7945
+ */
7946
+ declare function withMetrics(opts?: {
7947
+ endpoint?: string;
7948
+ }): MiddlewareDefinition;
7949
+
7950
+ /**
7951
+ * Actor Model formalization for workflow instances.
7952
+ *
7953
+ * Each workflow instance is an actor:
7954
+ * - Private state: instance fields
7955
+ * - Mailbox: pending transitions/events
7956
+ * - Behavior: state machine definition
7957
+ * - Communication: events (emit/on)
7958
+ *
7959
+ * Supervision: what happens when an actor fails.
7960
+ * Hierarchy: parent-child relationships between instances.
7961
+ *
7962
+ * All functions are compile-time stubs that throw at runtime.
7963
+ * The compiler extracts the configuration at build time.
7964
+ */
7965
+ /** Supervision strategy when an actor (instance) fails */
7966
+ type SupervisionStrategy = 'restart' | 'resume' | 'stop' | 'escalate';
7967
+ /** Actor supervision configuration */
7968
+ interface ActorSupervision {
7969
+ strategy: SupervisionStrategy;
7970
+ /** Max restart attempts before escalating */
7971
+ maxRetries?: number;
7972
+ /** Time window for retry counting (e.g., '1h', '30m') */
7973
+ retryWindow?: string;
7974
+ /** Backoff strategy between retries */
7975
+ backoff?: 'none' | 'linear' | 'exponential';
7976
+ /** Optional callback descriptor for failure handling (extracted at compile time) */
7977
+ onFailure?: (ctx: {
7978
+ instanceId: string;
7979
+ error: string;
7980
+ retryCount: number;
7981
+ }) => void;
7982
+ }
7983
+ /** Actor hierarchy — parent-child relationships between workflow instances */
7984
+ interface ActorHierarchy {
7985
+ /** Parent instance that spawned this actor */
7986
+ parent?: string;
7987
+ /** Children spawned by this actor */
7988
+ children?: string[];
7989
+ /** Supervision strategy applied to children */
7990
+ childSupervision?: ActorSupervision;
7991
+ }
7992
+ /** Actor mailbox configuration — controls message queuing behavior */
7993
+ interface ActorMailbox {
7994
+ /** Max pending messages before backpressure */
7995
+ capacity?: number;
7996
+ /** What to do when mailbox is full */
7997
+ overflow?: 'drop-oldest' | 'drop-newest' | 'block' | 'error';
7998
+ /** Priority ordering for messages */
7999
+ priority?: 'fifo' | 'priority';
8000
+ }
8001
+ /** Resolved actor configuration (returned by configureActor) */
8002
+ interface ActorConfig {
8003
+ readonly __actor: true;
8004
+ readonly supervision: ActorSupervision;
8005
+ readonly mailbox: ActorMailbox;
8006
+ readonly hierarchy: Partial<ActorHierarchy>;
8007
+ }
8008
+ /**
8009
+ * Configure actor behavior for a workflow.
8010
+ * Used alongside imperative workflow definitions.
8011
+ *
8012
+ * This is a compile-time function. The Babel plugin extracts the
8013
+ * configuration and stores it in the workflow IR metadata.
8014
+ *
8015
+ * @example
8016
+ * ```typescript
8017
+ * import { configureActor } from '@mmapp/react';
8018
+ *
8019
+ * export const actor = configureActor({
8020
+ * supervision: { strategy: 'restart', maxRetries: 3 },
8021
+ * mailbox: { capacity: 100, overflow: 'drop-oldest' },
8022
+ * });
8023
+ * ```
8024
+ */
8025
+ declare function configureActor(config: {
8026
+ supervision?: ActorSupervision;
8027
+ mailbox?: ActorMailbox;
8028
+ hierarchy?: Partial<ActorHierarchy>;
8029
+ }): ActorConfig;
8030
+ /**
8031
+ * Spawn a child actor (sub-workflow instance).
8032
+ * The child is supervised by the current actor according to
8033
+ * the provided (or inherited) supervision strategy.
8034
+ *
8035
+ * This is a compile-time function. The compiler transforms it
8036
+ * into a spawn action in the workflow IR.
8037
+ *
8038
+ * @example
8039
+ * ```typescript
8040
+ * async function processing(order: Order) {
8041
+ * const paymentActor = await spawnActor('payment', {
8042
+ * input: { amount: order.total },
8043
+ * supervision: { strategy: 'restart', maxRetries: 3 },
8044
+ * });
8045
+ * // paymentActor is a child — if it fails, our supervision strategy applies
8046
+ * }
8047
+ * ```
8048
+ */
8049
+ declare function spawnActor(_slug: string, _options?: {
8050
+ input?: Record<string, unknown>;
8051
+ supervision?: ActorSupervision;
8052
+ /** If true, block until the child completes */
8053
+ blocking?: boolean;
8054
+ }): Promise<{
8055
+ instanceId: string;
8056
+ }>;
8057
+ /**
8058
+ * Send a message to another actor (instance).
8059
+ * Messages are delivered to the target actor's mailbox and
8060
+ * processed as transitions or events.
8061
+ *
8062
+ * This is a compile-time function. The compiler transforms it
8063
+ * into a send action in the workflow IR.
8064
+ *
8065
+ * @example
8066
+ * ```typescript
8067
+ * await sendMessage(targetInstanceId, 'process-payment', { amount: 100 });
8068
+ * ```
8069
+ */
8070
+ declare function sendMessage(_instanceId: string, _action: string, _payload?: Record<string, unknown>): Promise<void>;
8071
+ /**
8072
+ * Check if a value is an ActorConfig (returned by configureActor).
8073
+ */
8074
+ declare function isActorConfig(value: unknown): value is ActorConfig;
8075
+
8076
+ /**
8077
+ * Constraint Programming DX (Design 34) — declarative workflow constraints.
8078
+ *
8079
+ * Users declare what must be true about their workflow, and the compiler/verifier
8080
+ * proves it at build time using Design 32's verification layers.
8081
+ *
8082
+ * Usage:
8083
+ * import { constraints } from '@mmapp/react';
8084
+ *
8085
+ * export const rules = constraints(
8086
+ * 'every state is reachable',
8087
+ * 'no deadlocks',
8088
+ * 'deterministic guards',
8089
+ * // Business rules (checked via property-based testing)
8090
+ * 'amount >= 0',
8091
+ * 'endDate > startDate',
8092
+ * // Custom expressions
8093
+ * 'state_data.approvedBy != state_data.requesterId',
8094
+ * );
8095
+ */
8096
+ /**
8097
+ * Built-in constraints that map directly to Design 32 verification layers.
8098
+ * The compiler knows how to statically verify each of these.
8099
+ */
8100
+ type BuiltInConstraint = 'every state is reachable' | 'no deadlocks' | 'no unreachable states' | 'deterministic guards' | 'terminates' | 'no guard overlaps' | 'all roles defined' | 'all fields validated';
8101
+ /**
8102
+ * A constraint is either a built-in (statically verified) or a custom string
8103
+ * expression (checked via property-based testing at compile time).
8104
+ */
8105
+ type Constraint = BuiltInConstraint | (string & {});
8106
+ /**
8107
+ * The declaration object returned by constraints(). The compiler detects
8108
+ * this shape via the `__constraints` brand and runs the appropriate
8109
+ * verification layers for each rule.
8110
+ */
8111
+ interface ConstraintDeclaration {
8112
+ readonly __constraints: true;
8113
+ readonly rules: readonly Constraint[];
8114
+ }
8115
+ /** Set of all built-in constraint strings for compiler/tooling use. */
8116
+ declare const BUILT_IN_CONSTRAINTS: ReadonlySet<string>;
8117
+ /**
8118
+ * Declare workflow constraints that the compiler verifies at build time.
8119
+ *
8120
+ * Built-in constraints (e.g. `'no deadlocks'`, `'deterministic guards'`) map
8121
+ * to Design 32 verification layers and are proven via static analysis of the
8122
+ * workflow's state graph.
8123
+ *
8124
+ * Custom string constraints (e.g. `'amount >= 0'`) are checked via
8125
+ * property-based testing — the compiler generates random inputs and verifies
8126
+ * the expression holds for all reachable states.
8127
+ *
8128
+ * At runtime this is an identity function — it returns the branded declaration
8129
+ * object so the compiler can extract and verify the rules during compilation.
8130
+ *
8131
+ * @param rules - One or more constraint strings.
8132
+ * @returns A branded ConstraintDeclaration object.
8133
+ *
8134
+ * @example
8135
+ * ```typescript
8136
+ * // Structural constraints
8137
+ * export const safety = constraints(
8138
+ * 'every state is reachable',
8139
+ * 'no deadlocks',
8140
+ * 'deterministic guards',
8141
+ * );
8142
+ *
8143
+ * // Business rule constraints
8144
+ * export const invariants = constraints(
8145
+ * 'amount >= 0',
8146
+ * 'endDate > startDate',
8147
+ * 'state_data.approvedBy != state_data.requesterId',
8148
+ * );
8149
+ * ```
8150
+ */
8151
+ declare function constraints(...rules: Constraint[]): ConstraintDeclaration;
8152
+ /**
8153
+ * Type guard: check if a value is a ConstraintDeclaration.
8154
+ * Useful for compiler internals and tooling.
8155
+ */
8156
+ declare function isConstraintDeclaration(value: unknown): value is ConstraintDeclaration;
8157
+ /**
8158
+ * Check if a constraint string is a built-in constraint.
8159
+ */
8160
+ declare function isBuiltInConstraint(rule: string): rule is BuiltInConstraint;
8161
+
8162
+ /**
8163
+ * @mmapp/react/imperative — Compile-time stubs for the imperative
8164
+ * workflow authoring API (Design 30).
8165
+ *
8166
+ * These functions exist ONLY for TypeScript type-checking and IDE IntelliSense.
8167
+ * At runtime they throw helpful errors telling developers to use `mmrc build`.
8168
+ * The Rust compiler (mmrc) transforms calls to these functions into workflow
8169
+ * IR at compile time — they are never executed in the browser or on the server.
8170
+ */
8171
+
8172
+ type FieldConfig<T> = {
8173
+ [K in keyof T]?: {
8174
+ required?: boolean;
8175
+ min?: number;
8176
+ max?: number;
8177
+ minLength?: number;
8178
+ maxLength?: number;
8179
+ pattern?: string;
8180
+ default?: T[K];
8181
+ } | string;
8182
+ };
8183
+ declare function validate(_condition: boolean, _message: string, _severity?: 'error' | 'warning'): void;
8184
+ declare function log(_event: string, _data?: Record<string, unknown>): void;
8185
+ declare function notify(_to: string, _message: string, _opts?: {
8186
+ channel?: string;
8187
+ template?: string;
8188
+ }): void;
8189
+ declare function emit(_event: string, _payload?: unknown): void;
8190
+ declare function requireRole(..._roles: string[]): void;
8191
+ declare function requireField(..._fields: string[]): void;
8192
+ declare function guard(_expression: string): void;
8193
+ declare function every(_interval: string, _fn: (() => void) | {
8194
+ when?: string;
8195
+ do: () => void;
8196
+ }): void;
8197
+ declare function cron(_expression: string, _fn: () => void): void;
8198
+ declare function after(_delay: string, _fn: () => void): void;
8199
+ declare function on(_pattern: string, _handlerOrOpts: ((event: unknown) => void) | {
8200
+ when?: string;
8201
+ do: (event: unknown) => void;
8202
+ timeout?: string;
8203
+ } | {
8204
+ when?: string;
8205
+ timeout?: string;
8206
+ }): void | Promise<unknown>;
8207
+ declare function timeout(_duration: string, _handler: (() => void) | {
8208
+ transition?: string;
8209
+ escalate?: boolean;
8210
+ }): void;
8211
+ declare function userAction(_name: string, _opts?: {
8212
+ roles?: string[];
8213
+ require?: string[];
8214
+ when?: string;
8215
+ timeout?: string;
8216
+ description?: string;
8217
+ onTimeout?: () => void;
8218
+ }): Promise<void>;
8219
+ declare function userChoice<T extends Record<string, {
8220
+ roles?: string[];
8221
+ require?: string[];
8222
+ when?: string;
8223
+ description?: string;
8224
+ }>>(_options: T): Promise<Extract<keyof T, string>>;
8225
+ declare function named(_name: string, _stateCall: Promise<void>): Promise<void>;
8226
+ declare function delay(_duration: string): Promise<void>;
8227
+ declare function allowTransition(_name: string, _opts: {
8228
+ from: string | string[];
8229
+ to: string;
8230
+ roles?: string[];
8231
+ require?: string[];
8232
+ when?: string;
8233
+ }): void;
8234
+ declare function restrict(_field: string, _opts: {
8235
+ visibleTo?: string[];
8236
+ editableBy?: string[];
8237
+ editableIn?: string[];
8238
+ }): void;
8239
+ declare function visibleTo(..._roles: string[]): {
8240
+ visibleTo: string[];
8241
+ };
8242
+ declare function editableBy(..._roles: string[]): {
8243
+ editableBy: string[];
8244
+ };
8245
+ declare function editableIn(..._states: string[]): {
8246
+ editableIn: string[];
8247
+ };
8248
+ declare function defineRoles<T extends Record<string, {
8249
+ description?: string;
8250
+ permissions?: string[];
8251
+ inherits?: string[];
8252
+ }>>(roles: T): T;
8253
+ /**
8254
+ * Compiler hint: set the runtime target for the current state.
8255
+ * Does not execute at runtime.
8256
+ */
8257
+ declare function runtime(_target: RuntimeTarget): void;
8258
+ declare function orchestration(config: OrchestrationConfig): OrchestrationConfig;
8259
+ declare function blueprint(_slug: string, _config: {
8260
+ workflows: Record<string, Function>;
8261
+ views?: string[];
8262
+ routes?: Array<{
8263
+ path: string;
8264
+ view: string;
8265
+ label?: string;
8266
+ }>;
8267
+ dependencies?: string[];
8268
+ }): unknown;
8269
+
8270
+ declare function patch(_id: string, _overrides: Record<string, unknown>): void;
8271
+
8272
+ declare const actor: {
8273
+ id: string;
8274
+ email: string;
8275
+ roles: string[];
8276
+ };
8277
+ declare const instance: {
8278
+ id: string;
8279
+ state: string;
8280
+ slug: string;
8281
+ };
8282
+
8283
+ export { Accordion, type ActionContext, type ActionCreator, type ActionCreators, type ActionDefinition, type ActionEnvironment, type ActionHandler, type ActionManifest, type ActionManifestEntry, type ActionNotifyOptions, type ActionOptions, type ActionResult, type ActionRoutingRule, type ActorConfig, type ActorHierarchy, type ActorMailbox, type ActorSupervision, AnimatedBox, type ApprovalConfig, type AuthOptions, type AuthResolver, type AuthResult, type AuthUser, BUILT_IN_CONSTRAINTS, Badge, type BadgeProps, Blueprint, type BlueprintAction, type BlueprintConfig, type BlueprintConfigSchema, type BlueprintDependency, type BlueprintManifest, type BlueprintRoute, type BlueprintServerActionDeclaration, type BlueprintSlotContribution, type BlueprintViewDeclaration, BrowserPlayer, type BrowserPlayerConfig, type TransitionResult as BrowserTransitionResult, type BuiltInConstraint, Button, type ButtonProps, type CRUDConfig, Canvas3D, Card, type CardProps, type CedarPolicy, type ChannelHandle, type ChannelMessage, type ChannelOptions, type ChannelTransport, Chart, type CollectionHandle, Column, type ColumnProps, type ComposedWorkflowMetadata, type ComputedFieldMode, type ComputedFieldResult, type ConflictStrategy, type Constraint, type ConstraintDeclaration, type CronFields, type CrudConfig, DataGrid, type DataSource, type DataSourceResult, Divider, type DividerProps, type DmnRule, type DomainEvent, type DomainSubscriptionConfig, type DomainSubscriptionTransport, type DuringAction, type DuringActionConfig, Each, type EachProps, type EngineMiddlewareContext, type EscalationConfig, type EventPayload, type EventSubscription, type ExecutionPoint, type ExperienceViewConfig, ExperienceWorkflowBridge, type ExperienceWorkflowBridgeProps, type ExperienceWorkflowDefinition, type ExpressionLibraryRecord, type ExpressionLibraryResolver, type ExpressionLibraryResult, type ExtendOptions, type ExtendRoleDefinition, Field, FieldBuilder, type FieldConfig, type FieldConflictConfig, type FieldRegistration, type FieldShorthand, type FieldTypeMap, type FieldValidation, type FieldValidator, type FormConfig, type FormHandle, type FormValidator, type GeoPosition, type GeolocationError, type GeolocationOptions, type GeolocationResult, type GrammarIsland, Grid, Heading, type HeadingProps, Icon, Image, type InferFieldNames, type InferFields, type InferSlug, type InferStates, type InferTransitions, type InsertConfig, type InstalledModuleRef, type InstanceData, type InstanceKeyParams, type InstanceRef, type LatLng, type LatLngBounds, type LibraryParam, Link, type LocalDataResolver, type LocalEngineAdapter, type LocalEngineContextValue, LocalEngineProvider, type LocalEngineStore, LocalWorkflowEngine, type LoginCredentials, type MapMarker, type MapViewHandle, type MapViewOptions, Markdown, MetricCard, type MiddlewareContext, type MiddlewareDefinition, type MiddlewareFn, type MiddlewareHandle, type MiddlewareIntroduce, type MiddlewareOptions, type MiddlewareResult, type MmWasmModule, Modal, ModelBuilder, type ModelDefinition, type ModelHandle, type ModelMixin, type ModelTestContext, type ModuleAction, type ModuleConfigSchema, type ModuleDependency, type ModuleHandle, type ModuleManifest, type ModuleRoute, type ModuleRouteConfig, type MutationHandle, type MutationResolver, NavLink, type NotificationResult, type NotifyOptions, ORCHESTRATION_PRESETS, type OrchestrationConfig, type OrchestrationStrategy, type PackageChild, type PackageManifest, type PackageResult, type PipelineConfig, type PipelineStage, type PlayerConfig, type PlayerEvent, type PlayerEventCallback, type PlayerEventListener, type PlayerHandle, type PlayerInstance, type PlayerLogEntry, PlayerProvider, type PlayerProviderProps, type PlayerVisibility, type PresenceConfig, type PresenceEditor, type PresenceHandle, type PresenceOptions, type PresenceViewer, type QueryParams$1 as QueryParams, type QueryResolver, type QueryResult, type RealtimeQueryParams, type RealtimeQueryResult, type ResolvedOrchestrationConfig, type ReviewConfig, type RoleDefinition, RoleGuard, type RoleOptions, type RoleResult, type RoleVisibility, Route, type RouteDefinition, type RouteGuard, type RouteLocation, type RouteParamsOptions, Router, type RouterHandle, type RouterOptions, Row, type RowProps, type RuntimeConfig, RuntimeContext, type RuntimeSnapshot, type RuntimeTarget, ScrollArea, Section, Select, type ServerActionFn, type ServerActionHandle, type ServerActionOptions, type ServerActionResolver, type ServerActionResult, ServerGrid, type ServerStateOptions, type ServerStateResolver, type ServerStateResult, type ServerStateSnapshot, type ServiceConfig, type SetupWizard, type SetupWizardStep, Show, type ShowProps, Slot, type SlotContribution, type SlotContributions, type SlotProps, Spacer, type SpawnActionOptions, type SpawnOptions, Stack, type StackProps, StateBuilder, type StateDescriptor, type StateHome, type Subscription, type SupervisionStrategy, Tabs, type TestChain, type TestStep, Text, TextInput, type TextInputProps, type TextProps, type ToastConfig, type ToastHandle, type ToastInstance, type ToastVariant, TransitionBuilder, type TransitionCondition, type TransitionConfig, type TransitionContext, type TransitionDescriptor, type TransitionHandle, type TransitionOverride, type TypedMutationHandle, TypedTransitionBuilder, type UseCollectionOptions, type UseComputedOptions, type UseModelOptions, type UseModuleOptions, type UseOnEventOptions, type UseWorkflowOptions, type ValidationIssue, type ValidationResult, type ValidationRule, type ViewDefinitionResult, type ViewRecord, type ViewResolver, type VisibilityResult, type WithAuditTrailOptions, type WithOwnershipOptions, type WithRBACOptions, type WithSearchOptions, type WithSlugOptions, type WithSoftDeleteOptions, type WithVersioningOptions, type WorkflowDataSource, type WorkflowDefinition, type WorkflowEvent, type WorkflowEventHandler, type WorkflowFieldDef, type WorkflowFieldDescriptor, type WorkflowHandle, type WorkflowInstance, type WorkflowInstanceWithEvents, type WorkflowMixin, WorkflowProvider, type WorkflowProviderProps, WorkflowRuntime, type WorkflowState, type WorkflowTransition, action, actor, after, allowTransition, and, applyMixins, approval, assertModelValid, cedar, compose, computeVisibility, configureActor, connector, constraints, createActions, createCRUD, createLocalDataResolver, createLocalEngineAdapter, createPipeline, cron$1 as cron, crud, defineBlueprint, blueprint as defineImperativeBlueprint, defineMiddleware, defineModel, defineModule, defineRoles, defineWorkspace, delay, deriveInstanceKey, deriveInstanceKeySync, describeModel, deviceAction, dmn, editableBy, editableIn, emit, escalation, every, expr, extend, extendMiddleware, field, fieldContains, fieldEquals, fieldGreaterThan, fieldIn, fieldIsEmpty, fieldIsSet, fieldLessThan, fieldMatches, fieldNotEquals, fieldNotIn, getInstalledModule, getInstalledModules, graphql, guard, hasAnyRole, hasRole, cron as imperativeCron, log as imperativeLog, notify as imperativeNotify, requireRole as imperativeRequireRole, inState, inputEquals, inputRequired, instance, isActor, isActorConfig, isBuiltInConstraint, isConstraintDeclaration, isCreator, isOwner, isPlayerDebug, isSender, jsonpath, llm, loadExperienceWorkflow, logEvent, model, named, normalizeDefinition, not, notInState, notify$1 as notify, on, or, orchestration, patch, pipe, playerLog, prefetchData, refHasAnyRole, refHasRole, requireAuth, requireField, requireRole$1 as requireRole, resolveOrchestration, restrict, review, runtime, sendMessage, serverAction, setAuthResolver, setChannelTransport, setConfigContext, setExpressionLibraryResolver, setField, setFields, setInstalledModules, setModuleConfigDefaults, setMutationResolver, setPersistedModuleConfig, setPlayerDebug, setQueryResolver, setRealtimeQueryResolver, setRoleHierarchy, setServerActionResolver, setServerStateResolver, setViewResolver, spawn, spawnActor, sql, state, syncConfigDefaults, testModel, timeout, transition, updateDefinitionConfig, useAuth, useChannel, useCollection, useComputed, useComputedWithMeta, useDomainSubscription, useDuringAction, useExperienceState, useExpressionLibrary, useForm, useGeolocation, useLocalEngine, useMapView, useMiddleware, useModel, useModule, useModuleConfig, useModuleConfigWithMutation, useMutation, useNotification, useOnChange, useOnEnter, useOnEvent, useOnExit, useOnTransition, usePackage, useParams, usePlayer, usePlayerContext, usePlayerContextSafe, usePresence, useQuery, useRealtimeQuery, useRole, useRouteParams, useRouter, useRuntimeContext, useServerAction, useServerState, useStateField, useToast, useTransition, useView, useVisibility, useWhileIn, useWorkflow, useState as useWorkflowState, userAction, userChoice, validate, validateExperienceWorkflow, validateModel, visibleTo, when, withAuditLog, withAuditTrail, withAuth, withMetrics, withOwnership, withPagination, withRBAC, withRateLimit, withSearch, withSlug, withSoftDelete, withTags, withTimestamps, withValidation, withVersioning };