@plures/praxis 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FRAMEWORK.md +106 -15
- package/README.md +209 -48
- package/dist/browser/adapter-TM4IS5KT.js +12 -0
- package/dist/browser/chunk-JQ64KMLN.js +141 -0
- package/dist/browser/chunk-LE2ZJYFC.js +154 -0
- package/dist/browser/{chunk-R45WXWKH.js → chunk-VOMLVI6V.js} +1 -149
- package/dist/browser/engine-YJZV4SLD.js +8 -0
- package/dist/browser/index.d.ts +130 -1
- package/dist/browser/index.js +146 -139
- package/dist/browser/integrations/svelte.js +2 -1
- package/dist/node/adapter-K6DOX6XS.js +13 -0
- package/dist/node/chunk-JQ64KMLN.js +141 -0
- package/dist/node/chunk-LE2ZJYFC.js +154 -0
- package/dist/node/chunk-S54337I5.js +446 -0
- package/dist/node/{chunk-R45WXWKH.js → chunk-VOMLVI6V.js} +1 -149
- package/dist/node/cli/index.cjs +1444 -889
- package/dist/node/cli/index.js +9 -0
- package/dist/node/docs-JFNYTOJA.js +102 -0
- package/dist/node/engine-2DQBKBJC.js +9 -0
- package/dist/node/index.cjs +503 -325
- package/dist/node/index.d.cts +130 -1
- package/dist/node/index.d.ts +130 -1
- package/dist/node/index.js +151 -580
- package/dist/node/integrations/svelte.js +2 -1
- package/package.json +1 -1
- package/src/cli/commands/docs.ts +147 -0
- package/src/cli/index.ts +21 -0
- package/src/core/pluresdb/adapter.ts +1 -1
- package/src/core/reactive-engine.svelte.ts +6 -1
- package/src/core/reactive-engine.ts +1 -1
- package/src/index.browser.ts +4 -0
- package/src/index.ts +4 -0
- package/src/integrations/unified.ts +350 -0
package/dist/node/index.d.cts
CHANGED
|
@@ -2669,4 +2669,133 @@ declare function attachTauriToEngine<TContext>(engine: LogicEngine<TContext>, ad
|
|
|
2669
2669
|
*/
|
|
2670
2670
|
declare function generateTauriConfig(config: TauriAppConfig): Record<string, unknown>;
|
|
2671
2671
|
|
|
2672
|
-
|
|
2672
|
+
/**
|
|
2673
|
+
* Unified Integration Helpers
|
|
2674
|
+
*
|
|
2675
|
+
* Convenience functions for setting up Praxis with all ecosystem integrations
|
|
2676
|
+
* (PluresDB, Unum, State-Docs, CodeCanvas) in a single call.
|
|
2677
|
+
*/
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Configuration for unified Praxis application
|
|
2681
|
+
*/
|
|
2682
|
+
interface UnifiedAppConfig<TContext = unknown> {
|
|
2683
|
+
/** Praxis registry with rules and constraints */
|
|
2684
|
+
registry: PraxisRegistry<TContext>;
|
|
2685
|
+
/** Initial context for the engine */
|
|
2686
|
+
initialContext: TContext;
|
|
2687
|
+
/** PluresDB instance (if not provided, creates in-memory DB) */
|
|
2688
|
+
db?: PraxisDB;
|
|
2689
|
+
/** Enable Unum for distributed communication */
|
|
2690
|
+
enableUnum?: boolean;
|
|
2691
|
+
/** Unum identity configuration (without id and createdAt which are auto-generated) */
|
|
2692
|
+
unumIdentity?: Omit<UnumIdentity, 'id' | 'createdAt'>;
|
|
2693
|
+
/** Enable State-Docs documentation generation */
|
|
2694
|
+
enableDocs?: boolean;
|
|
2695
|
+
/** State-Docs configuration */
|
|
2696
|
+
docsConfig?: {
|
|
2697
|
+
projectTitle: string;
|
|
2698
|
+
target?: string;
|
|
2699
|
+
};
|
|
2700
|
+
/** Praxis schema for CodeCanvas integration */
|
|
2701
|
+
schema?: PraxisSchema;
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Unified application instance with all integrations
|
|
2705
|
+
*/
|
|
2706
|
+
interface UnifiedApp<TContext = unknown> {
|
|
2707
|
+
/** Praxis logic engine */
|
|
2708
|
+
engine: LogicEngine<TContext>;
|
|
2709
|
+
/** PluresDB adapter for persistence */
|
|
2710
|
+
pluresdb: PluresDBAdapter<TContext>;
|
|
2711
|
+
/** Unum adapter for distributed communication (if enabled) */
|
|
2712
|
+
unum?: UnumAdapter;
|
|
2713
|
+
/** Default Unum channel (if Unum enabled) */
|
|
2714
|
+
channel?: UnumChannel;
|
|
2715
|
+
/** State-Docs generator (if enabled) */
|
|
2716
|
+
docs?: StateDocsGenerator;
|
|
2717
|
+
/** CodeCanvas document (if schema provided) */
|
|
2718
|
+
canvas?: CanvasDocument;
|
|
2719
|
+
/** Generate documentation from current state */
|
|
2720
|
+
generateDocs?: () => GeneratedDoc[];
|
|
2721
|
+
/** Cleanup function to dispose all integrations */
|
|
2722
|
+
dispose: () => void;
|
|
2723
|
+
}
|
|
2724
|
+
/**
|
|
2725
|
+
* Create a unified Praxis application with all integrations
|
|
2726
|
+
*
|
|
2727
|
+
* This is a convenience function that sets up:
|
|
2728
|
+
* - Praxis logic engine
|
|
2729
|
+
* - PluresDB for persistence (auto-attaches to engine)
|
|
2730
|
+
* - Unum for distributed communication (optional)
|
|
2731
|
+
* - State-Docs for documentation generation (optional)
|
|
2732
|
+
* - CodeCanvas for visual schema editing (optional)
|
|
2733
|
+
*
|
|
2734
|
+
* @example
|
|
2735
|
+
* ```typescript
|
|
2736
|
+
* import { createUnifiedApp } from '@plures/praxis';
|
|
2737
|
+
*
|
|
2738
|
+
* const app = await createUnifiedApp({
|
|
2739
|
+
* registry: myRegistry,
|
|
2740
|
+
* initialContext: { count: 0 },
|
|
2741
|
+
* enableUnum: true,
|
|
2742
|
+
* unumIdentity: { name: 'node-1' },
|
|
2743
|
+
* enableDocs: true,
|
|
2744
|
+
* docsConfig: { projectTitle: 'My App' },
|
|
2745
|
+
* schema: mySchema,
|
|
2746
|
+
* });
|
|
2747
|
+
*
|
|
2748
|
+
* // Use the engine
|
|
2749
|
+
* app.engine.step([myEvent]);
|
|
2750
|
+
*
|
|
2751
|
+
* // Broadcast to other nodes
|
|
2752
|
+
* if (app.channel) {
|
|
2753
|
+
* await app.unum?.broadcastEvent(app.channel.id, myEvent);
|
|
2754
|
+
* }
|
|
2755
|
+
*
|
|
2756
|
+
* // Generate documentation
|
|
2757
|
+
* const docs = app.generateDocs?.();
|
|
2758
|
+
*
|
|
2759
|
+
* // Cleanup
|
|
2760
|
+
* app.dispose();
|
|
2761
|
+
* ```
|
|
2762
|
+
*/
|
|
2763
|
+
declare function createUnifiedApp<TContext = unknown>(config: UnifiedAppConfig<TContext>): Promise<UnifiedApp<TContext>>;
|
|
2764
|
+
/**
|
|
2765
|
+
* Attach all available integrations to an existing Praxis engine
|
|
2766
|
+
*
|
|
2767
|
+
* This is useful when you already have an engine and want to add integrations.
|
|
2768
|
+
*
|
|
2769
|
+
* @example
|
|
2770
|
+
* ```typescript
|
|
2771
|
+
* import { createPraxisEngine, attachAllIntegrations } from '@plures/praxis';
|
|
2772
|
+
*
|
|
2773
|
+
* const engine = createPraxisEngine({ initialContext: {}, registry });
|
|
2774
|
+
*
|
|
2775
|
+
* const integrations = await attachAllIntegrations(engine, registry, {
|
|
2776
|
+
* enableUnum: true,
|
|
2777
|
+
* enableDocs: true,
|
|
2778
|
+
* });
|
|
2779
|
+
*
|
|
2780
|
+
* // Later cleanup
|
|
2781
|
+
* integrations.dispose();
|
|
2782
|
+
* ```
|
|
2783
|
+
*/
|
|
2784
|
+
declare function attachAllIntegrations<TContext = unknown>(engine: LogicEngine<TContext>, registry: PraxisRegistry<TContext>, options?: {
|
|
2785
|
+
db?: PraxisDB;
|
|
2786
|
+
enableUnum?: boolean;
|
|
2787
|
+
unumIdentity?: Omit<UnumIdentity, 'id' | 'createdAt'>;
|
|
2788
|
+
enableDocs?: boolean;
|
|
2789
|
+
docsConfig?: {
|
|
2790
|
+
projectTitle: string;
|
|
2791
|
+
target?: string;
|
|
2792
|
+
};
|
|
2793
|
+
}): Promise<{
|
|
2794
|
+
pluresdb: PluresDBAdapter<TContext>;
|
|
2795
|
+
unum?: UnumAdapter;
|
|
2796
|
+
channel?: UnumChannel;
|
|
2797
|
+
docs?: StateDocsGenerator;
|
|
2798
|
+
dispose: () => void;
|
|
2799
|
+
}>;
|
|
2800
|
+
|
|
2801
|
+
export { type ActivityState, type Actor, ActorManager, type CanvasDocument, type CanvasEdge, type CanvasEdgeStyle, type CanvasEditorConfig, type CanvasNode, type CanvasNodeStyle, ComponentDefinition, ConstraintDescriptor, ConstraintFn, type ConstraintNode, type ConstraintSchema, type DefineConstraintOptions, type DefineModuleOptions, type DefineRuleOptions, type EventDefinition, type EventStreamEntry, type FactDefinition, ReactiveLogicEngine as FrameworkAgnosticReactiveEngine, type ReactiveEngineOptions as FrameworkAgnosticReactiveEngineOptions, type GeneratedDoc, type GeneratedPluresDBFile, type GraphEdge, type GuardianError, type GuardianResult, type GuardianWarning, type LifecycleState, type LoaderOptions, type LoaderResult, LogicDefinition, LogicEngine, ModelDefinition, PRAXIS_PATHS, type PluresDBAdapter, type PluresDBAdapterOptions, PluresDBGenerator, type PluresDBGeneratorOptions, PraxisDB, PraxisDBStore, type PraxisDBStoreOptions, PraxisEvent, PraxisFact, PraxisModule, PraxisRegistry, PraxisSchema, PraxisSchemaRegistry, PraxisState, type RegistryGraph, RegistryIntrospector, type RegistrySchema, type RegistryStats, RuleDescriptor, RuleFn, type RuleNode, type RuleSchema, type StateChangeCallback, type StateDoc, type StateDocsConfig, StateDocsGenerator, type StateMachineDoc, type StoredSchema, type TauriAppConfig, type TauriBridge, type TauriCommand, type TauriEvent, type TauriFS, type TauriFileEntry, type TauriMenuItem, type TauriNotification, type TauriNotificationOptions, type TauriPlugin, type TauriPraxisAdapter, type TauriSecurityConfig, type TauriTray, type TauriUpdateConfig, type TauriUpdateInfo, type TauriWindowConfig, type TransitionDoc, type UnifiedApp, type UnifiedAppConfig, UnsubscribeFn$1 as UnsubscribeFn, type UnumAdapter, type UnumAdapterConfig, type UnumChannel, type UnumIdentity, type UnumMessage, type UnumStore, ValidationResult, attachAllIntegrations, attachTauriToEngine, attachToEngine, attachUnumToEngine, canvasToMermaid, canvasToSchema, canvasToYaml, createCanvasEditor, createReactiveEngine as createFrameworkAgnosticReactiveEngine, createIntrospector, createMockTauriBridge, createPluresDBAdapter, createPluresDBGenerator, createPraxisDBStore, createSchemaRegistry, createStateDocsGenerator, createTauriPraxisAdapter, createTimerActor, createUnifiedApp, createUnumAdapter, defineConstraint, defineEvent, defineFact, defineModule, defineRule, filterEvents, filterFacts, findEvent, findFact, generateDocs, generateId, generateTauriConfig, getEventPath, getFactPath, getSchemaPath, loadSchema, loadSchemaFromFile, loadSchemaFromJson, loadSchemaFromYaml, registerSchema, schemaToCanvas, validateForGeneration, validateWithGuardian };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -2669,4 +2669,133 @@ declare function attachTauriToEngine<TContext>(engine: LogicEngine<TContext>, ad
|
|
|
2669
2669
|
*/
|
|
2670
2670
|
declare function generateTauriConfig(config: TauriAppConfig): Record<string, unknown>;
|
|
2671
2671
|
|
|
2672
|
-
|
|
2672
|
+
/**
|
|
2673
|
+
* Unified Integration Helpers
|
|
2674
|
+
*
|
|
2675
|
+
* Convenience functions for setting up Praxis with all ecosystem integrations
|
|
2676
|
+
* (PluresDB, Unum, State-Docs, CodeCanvas) in a single call.
|
|
2677
|
+
*/
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Configuration for unified Praxis application
|
|
2681
|
+
*/
|
|
2682
|
+
interface UnifiedAppConfig<TContext = unknown> {
|
|
2683
|
+
/** Praxis registry with rules and constraints */
|
|
2684
|
+
registry: PraxisRegistry<TContext>;
|
|
2685
|
+
/** Initial context for the engine */
|
|
2686
|
+
initialContext: TContext;
|
|
2687
|
+
/** PluresDB instance (if not provided, creates in-memory DB) */
|
|
2688
|
+
db?: PraxisDB;
|
|
2689
|
+
/** Enable Unum for distributed communication */
|
|
2690
|
+
enableUnum?: boolean;
|
|
2691
|
+
/** Unum identity configuration (without id and createdAt which are auto-generated) */
|
|
2692
|
+
unumIdentity?: Omit<UnumIdentity, 'id' | 'createdAt'>;
|
|
2693
|
+
/** Enable State-Docs documentation generation */
|
|
2694
|
+
enableDocs?: boolean;
|
|
2695
|
+
/** State-Docs configuration */
|
|
2696
|
+
docsConfig?: {
|
|
2697
|
+
projectTitle: string;
|
|
2698
|
+
target?: string;
|
|
2699
|
+
};
|
|
2700
|
+
/** Praxis schema for CodeCanvas integration */
|
|
2701
|
+
schema?: PraxisSchema;
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Unified application instance with all integrations
|
|
2705
|
+
*/
|
|
2706
|
+
interface UnifiedApp<TContext = unknown> {
|
|
2707
|
+
/** Praxis logic engine */
|
|
2708
|
+
engine: LogicEngine<TContext>;
|
|
2709
|
+
/** PluresDB adapter for persistence */
|
|
2710
|
+
pluresdb: PluresDBAdapter<TContext>;
|
|
2711
|
+
/** Unum adapter for distributed communication (if enabled) */
|
|
2712
|
+
unum?: UnumAdapter;
|
|
2713
|
+
/** Default Unum channel (if Unum enabled) */
|
|
2714
|
+
channel?: UnumChannel;
|
|
2715
|
+
/** State-Docs generator (if enabled) */
|
|
2716
|
+
docs?: StateDocsGenerator;
|
|
2717
|
+
/** CodeCanvas document (if schema provided) */
|
|
2718
|
+
canvas?: CanvasDocument;
|
|
2719
|
+
/** Generate documentation from current state */
|
|
2720
|
+
generateDocs?: () => GeneratedDoc[];
|
|
2721
|
+
/** Cleanup function to dispose all integrations */
|
|
2722
|
+
dispose: () => void;
|
|
2723
|
+
}
|
|
2724
|
+
/**
|
|
2725
|
+
* Create a unified Praxis application with all integrations
|
|
2726
|
+
*
|
|
2727
|
+
* This is a convenience function that sets up:
|
|
2728
|
+
* - Praxis logic engine
|
|
2729
|
+
* - PluresDB for persistence (auto-attaches to engine)
|
|
2730
|
+
* - Unum for distributed communication (optional)
|
|
2731
|
+
* - State-Docs for documentation generation (optional)
|
|
2732
|
+
* - CodeCanvas for visual schema editing (optional)
|
|
2733
|
+
*
|
|
2734
|
+
* @example
|
|
2735
|
+
* ```typescript
|
|
2736
|
+
* import { createUnifiedApp } from '@plures/praxis';
|
|
2737
|
+
*
|
|
2738
|
+
* const app = await createUnifiedApp({
|
|
2739
|
+
* registry: myRegistry,
|
|
2740
|
+
* initialContext: { count: 0 },
|
|
2741
|
+
* enableUnum: true,
|
|
2742
|
+
* unumIdentity: { name: 'node-1' },
|
|
2743
|
+
* enableDocs: true,
|
|
2744
|
+
* docsConfig: { projectTitle: 'My App' },
|
|
2745
|
+
* schema: mySchema,
|
|
2746
|
+
* });
|
|
2747
|
+
*
|
|
2748
|
+
* // Use the engine
|
|
2749
|
+
* app.engine.step([myEvent]);
|
|
2750
|
+
*
|
|
2751
|
+
* // Broadcast to other nodes
|
|
2752
|
+
* if (app.channel) {
|
|
2753
|
+
* await app.unum?.broadcastEvent(app.channel.id, myEvent);
|
|
2754
|
+
* }
|
|
2755
|
+
*
|
|
2756
|
+
* // Generate documentation
|
|
2757
|
+
* const docs = app.generateDocs?.();
|
|
2758
|
+
*
|
|
2759
|
+
* // Cleanup
|
|
2760
|
+
* app.dispose();
|
|
2761
|
+
* ```
|
|
2762
|
+
*/
|
|
2763
|
+
declare function createUnifiedApp<TContext = unknown>(config: UnifiedAppConfig<TContext>): Promise<UnifiedApp<TContext>>;
|
|
2764
|
+
/**
|
|
2765
|
+
* Attach all available integrations to an existing Praxis engine
|
|
2766
|
+
*
|
|
2767
|
+
* This is useful when you already have an engine and want to add integrations.
|
|
2768
|
+
*
|
|
2769
|
+
* @example
|
|
2770
|
+
* ```typescript
|
|
2771
|
+
* import { createPraxisEngine, attachAllIntegrations } from '@plures/praxis';
|
|
2772
|
+
*
|
|
2773
|
+
* const engine = createPraxisEngine({ initialContext: {}, registry });
|
|
2774
|
+
*
|
|
2775
|
+
* const integrations = await attachAllIntegrations(engine, registry, {
|
|
2776
|
+
* enableUnum: true,
|
|
2777
|
+
* enableDocs: true,
|
|
2778
|
+
* });
|
|
2779
|
+
*
|
|
2780
|
+
* // Later cleanup
|
|
2781
|
+
* integrations.dispose();
|
|
2782
|
+
* ```
|
|
2783
|
+
*/
|
|
2784
|
+
declare function attachAllIntegrations<TContext = unknown>(engine: LogicEngine<TContext>, registry: PraxisRegistry<TContext>, options?: {
|
|
2785
|
+
db?: PraxisDB;
|
|
2786
|
+
enableUnum?: boolean;
|
|
2787
|
+
unumIdentity?: Omit<UnumIdentity, 'id' | 'createdAt'>;
|
|
2788
|
+
enableDocs?: boolean;
|
|
2789
|
+
docsConfig?: {
|
|
2790
|
+
projectTitle: string;
|
|
2791
|
+
target?: string;
|
|
2792
|
+
};
|
|
2793
|
+
}): Promise<{
|
|
2794
|
+
pluresdb: PluresDBAdapter<TContext>;
|
|
2795
|
+
unum?: UnumAdapter;
|
|
2796
|
+
channel?: UnumChannel;
|
|
2797
|
+
docs?: StateDocsGenerator;
|
|
2798
|
+
dispose: () => void;
|
|
2799
|
+
}>;
|
|
2800
|
+
|
|
2801
|
+
export { type ActivityState, type Actor, ActorManager, type CanvasDocument, type CanvasEdge, type CanvasEdgeStyle, type CanvasEditorConfig, type CanvasNode, type CanvasNodeStyle, ComponentDefinition, ConstraintDescriptor, ConstraintFn, type ConstraintNode, type ConstraintSchema, type DefineConstraintOptions, type DefineModuleOptions, type DefineRuleOptions, type EventDefinition, type EventStreamEntry, type FactDefinition, ReactiveLogicEngine as FrameworkAgnosticReactiveEngine, type ReactiveEngineOptions as FrameworkAgnosticReactiveEngineOptions, type GeneratedDoc, type GeneratedPluresDBFile, type GraphEdge, type GuardianError, type GuardianResult, type GuardianWarning, type LifecycleState, type LoaderOptions, type LoaderResult, LogicDefinition, LogicEngine, ModelDefinition, PRAXIS_PATHS, type PluresDBAdapter, type PluresDBAdapterOptions, PluresDBGenerator, type PluresDBGeneratorOptions, PraxisDB, PraxisDBStore, type PraxisDBStoreOptions, PraxisEvent, PraxisFact, PraxisModule, PraxisRegistry, PraxisSchema, PraxisSchemaRegistry, PraxisState, type RegistryGraph, RegistryIntrospector, type RegistrySchema, type RegistryStats, RuleDescriptor, RuleFn, type RuleNode, type RuleSchema, type StateChangeCallback, type StateDoc, type StateDocsConfig, StateDocsGenerator, type StateMachineDoc, type StoredSchema, type TauriAppConfig, type TauriBridge, type TauriCommand, type TauriEvent, type TauriFS, type TauriFileEntry, type TauriMenuItem, type TauriNotification, type TauriNotificationOptions, type TauriPlugin, type TauriPraxisAdapter, type TauriSecurityConfig, type TauriTray, type TauriUpdateConfig, type TauriUpdateInfo, type TauriWindowConfig, type TransitionDoc, type UnifiedApp, type UnifiedAppConfig, UnsubscribeFn$1 as UnsubscribeFn, type UnumAdapter, type UnumAdapterConfig, type UnumChannel, type UnumIdentity, type UnumMessage, type UnumStore, ValidationResult, attachAllIntegrations, attachTauriToEngine, attachToEngine, attachUnumToEngine, canvasToMermaid, canvasToSchema, canvasToYaml, createCanvasEditor, createReactiveEngine as createFrameworkAgnosticReactiveEngine, createIntrospector, createMockTauriBridge, createPluresDBAdapter, createPluresDBGenerator, createPraxisDBStore, createSchemaRegistry, createStateDocsGenerator, createTauriPraxisAdapter, createTimerActor, createUnifiedApp, createUnumAdapter, defineConstraint, defineEvent, defineFact, defineModule, defineRule, filterEvents, filterFacts, findEvent, findFact, generateDocs, generateId, generateTauriConfig, getEventPath, getFactPath, getSchemaPath, loadSchema, loadSchemaFromFile, loadSchemaFromJson, loadSchemaFromYaml, registerSchema, schemaToCanvas, validateForGeneration, validateWithGuardian };
|