@plures/praxis 0.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 +420 -0
- package/LICENSE +21 -0
- package/README.md +1310 -0
- package/dist/adapters/cli.d.ts +43 -0
- package/dist/adapters/cli.d.ts.map +1 -0
- package/dist/adapters/cli.js +126 -0
- package/dist/adapters/cli.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +26 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +233 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/cloud.d.ts +27 -0
- package/dist/cli/commands/cloud.d.ts.map +1 -0
- package/dist/cli/commands/cloud.js +232 -0
- package/dist/cli/commands/cloud.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +25 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +168 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +179 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cloud/auth.d.ts +51 -0
- package/dist/cloud/auth.d.ts.map +1 -0
- package/dist/cloud/auth.js +194 -0
- package/dist/cloud/auth.js.map +1 -0
- package/dist/cloud/billing.d.ts +184 -0
- package/dist/cloud/billing.d.ts.map +1 -0
- package/dist/cloud/billing.js +179 -0
- package/dist/cloud/billing.js.map +1 -0
- package/dist/cloud/client.d.ts +39 -0
- package/dist/cloud/client.d.ts.map +1 -0
- package/dist/cloud/client.js +176 -0
- package/dist/cloud/client.js.map +1 -0
- package/dist/cloud/index.d.ts +44 -0
- package/dist/cloud/index.d.ts.map +1 -0
- package/dist/cloud/index.js +44 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/cloud/marketplace.d.ts +166 -0
- package/dist/cloud/marketplace.d.ts.map +1 -0
- package/dist/cloud/marketplace.js +159 -0
- package/dist/cloud/marketplace.js.map +1 -0
- package/dist/cloud/provisioning.d.ts +110 -0
- package/dist/cloud/provisioning.d.ts.map +1 -0
- package/dist/cloud/provisioning.js +148 -0
- package/dist/cloud/provisioning.js.map +1 -0
- package/dist/cloud/relay/endpoints.d.ts +62 -0
- package/dist/cloud/relay/endpoints.d.ts.map +1 -0
- package/dist/cloud/relay/endpoints.js +217 -0
- package/dist/cloud/relay/endpoints.js.map +1 -0
- package/dist/cloud/relay/health/index.d.ts +5 -0
- package/dist/cloud/relay/health/index.d.ts.map +1 -0
- package/dist/cloud/relay/health/index.js +9 -0
- package/dist/cloud/relay/health/index.js.map +1 -0
- package/dist/cloud/relay/stats/index.d.ts +5 -0
- package/dist/cloud/relay/stats/index.d.ts.map +1 -0
- package/dist/cloud/relay/stats/index.js +9 -0
- package/dist/cloud/relay/stats/index.js.map +1 -0
- package/dist/cloud/relay/sync/index.d.ts +5 -0
- package/dist/cloud/relay/sync/index.d.ts.map +1 -0
- package/dist/cloud/relay/sync/index.js +9 -0
- package/dist/cloud/relay/sync/index.js.map +1 -0
- package/dist/cloud/relay/usage/index.d.ts +5 -0
- package/dist/cloud/relay/usage/index.d.ts.map +1 -0
- package/dist/cloud/relay/usage/index.js +9 -0
- package/dist/cloud/relay/usage/index.js.map +1 -0
- package/dist/cloud/sponsors.d.ts +81 -0
- package/dist/cloud/sponsors.d.ts.map +1 -0
- package/dist/cloud/sponsors.js +130 -0
- package/dist/cloud/sponsors.js.map +1 -0
- package/dist/cloud/types.d.ts +169 -0
- package/dist/cloud/types.d.ts.map +1 -0
- package/dist/cloud/types.js +7 -0
- package/dist/cloud/types.js.map +1 -0
- package/dist/components/index.d.ts +43 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +17 -0
- package/dist/components/index.js.map +1 -0
- package/dist/core/actors.d.ts +95 -0
- package/dist/core/actors.d.ts.map +1 -0
- package/dist/core/actors.js +158 -0
- package/dist/core/actors.js.map +1 -0
- package/dist/core/component/generator.d.ts +122 -0
- package/dist/core/component/generator.d.ts.map +1 -0
- package/dist/core/component/generator.js +307 -0
- package/dist/core/component/generator.js.map +1 -0
- package/dist/core/engine.d.ts +92 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/engine.js +199 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/introspection.d.ts +141 -0
- package/dist/core/introspection.d.ts.map +1 -0
- package/dist/core/introspection.js +208 -0
- package/dist/core/introspection.js.map +1 -0
- package/dist/core/logic/generator.d.ts +76 -0
- package/dist/core/logic/generator.d.ts.map +1 -0
- package/dist/core/logic/generator.js +339 -0
- package/dist/core/logic/generator.js.map +1 -0
- package/dist/core/pluresdb/generator.d.ts +58 -0
- package/dist/core/pluresdb/generator.d.ts.map +1 -0
- package/dist/core/pluresdb/generator.js +162 -0
- package/dist/core/pluresdb/generator.js.map +1 -0
- package/dist/core/protocol.d.ts +121 -0
- package/dist/core/protocol.d.ts.map +1 -0
- package/dist/core/protocol.js +46 -0
- package/dist/core/protocol.js.map +1 -0
- package/dist/core/rules.d.ts +120 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +81 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/schema/loader.d.ts +47 -0
- package/dist/core/schema/loader.d.ts.map +1 -0
- package/dist/core/schema/loader.js +189 -0
- package/dist/core/schema/loader.js.map +1 -0
- package/dist/core/schema/normalize.d.ts +72 -0
- package/dist/core/schema/normalize.d.ts.map +1 -0
- package/dist/core/schema/normalize.js +190 -0
- package/dist/core/schema/normalize.js.map +1 -0
- package/dist/core/schema/types.d.ts +370 -0
- package/dist/core/schema/types.d.ts.map +1 -0
- package/dist/core/schema/types.js +161 -0
- package/dist/core/schema/types.js.map +1 -0
- package/dist/dsl/index.d.ts +152 -0
- package/dist/dsl/index.d.ts.map +1 -0
- package/dist/dsl/index.js +132 -0
- package/dist/dsl/index.js.map +1 -0
- package/dist/dsl.d.ts +124 -0
- package/dist/dsl.d.ts.map +1 -0
- package/dist/dsl.js +130 -0
- package/dist/dsl.js.map +1 -0
- package/dist/examples/advanced-todo/index.d.ts +55 -0
- package/dist/examples/advanced-todo/index.d.ts.map +1 -0
- package/dist/examples/advanced-todo/index.js +222 -0
- package/dist/examples/advanced-todo/index.js.map +1 -0
- package/dist/examples/auth-basic/index.d.ts +17 -0
- package/dist/examples/auth-basic/index.d.ts.map +1 -0
- package/dist/examples/auth-basic/index.js +122 -0
- package/dist/examples/auth-basic/index.js.map +1 -0
- package/dist/examples/cart/index.d.ts +19 -0
- package/dist/examples/cart/index.d.ts.map +1 -0
- package/dist/examples/cart/index.js +202 -0
- package/dist/examples/cart/index.js.map +1 -0
- package/dist/examples/hero-ecommerce/index.d.ts +39 -0
- package/dist/examples/hero-ecommerce/index.d.ts.map +1 -0
- package/dist/examples/hero-ecommerce/index.js +506 -0
- package/dist/examples/hero-ecommerce/index.js.map +1 -0
- package/dist/examples/svelte-counter/index.d.ts +31 -0
- package/dist/examples/svelte-counter/index.d.ts.map +1 -0
- package/dist/examples/svelte-counter/index.js +123 -0
- package/dist/examples/svelte-counter/index.js.map +1 -0
- package/dist/flows.d.ts +125 -0
- package/dist/flows.d.ts.map +1 -0
- package/dist/flows.js +160 -0
- package/dist/flows.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/pluresdb.d.ts +56 -0
- package/dist/integrations/pluresdb.d.ts.map +1 -0
- package/dist/integrations/pluresdb.js +46 -0
- package/dist/integrations/pluresdb.js.map +1 -0
- package/dist/integrations/svelte.d.ts +306 -0
- package/dist/integrations/svelte.d.ts.map +1 -0
- package/dist/integrations/svelte.js +447 -0
- package/dist/integrations/svelte.js.map +1 -0
- package/dist/registry.d.ts +94 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +181 -0
- package/dist/registry.js.map +1 -0
- package/dist/runtime/terminal-adapter.d.ts +105 -0
- package/dist/runtime/terminal-adapter.d.ts.map +1 -0
- package/dist/runtime/terminal-adapter.js +113 -0
- package/dist/runtime/terminal-adapter.js.map +1 -0
- package/dist/step.d.ts +34 -0
- package/dist/step.d.ts.map +1 -0
- package/dist/step.js +111 -0
- package/dist/step.js.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/docs/MONETIZATION.md +394 -0
- package/docs/TERMINAL_NODE.md +588 -0
- package/docs/guides/canvas.md +389 -0
- package/docs/guides/getting-started.md +347 -0
- package/docs/guides/history-state-pattern.md +618 -0
- package/docs/guides/orchestration.md +617 -0
- package/docs/guides/parallel-state-pattern.md +767 -0
- package/docs/guides/svelte-integration.md +691 -0
- package/package.json +96 -0
- package/src/__tests__/actors.test.ts +270 -0
- package/src/__tests__/billing.test.ts +175 -0
- package/src/__tests__/cloud.test.ts +247 -0
- package/src/__tests__/dsl.test.ts +154 -0
- package/src/__tests__/edge-cases.test.ts +475 -0
- package/src/__tests__/engine.test.ts +137 -0
- package/src/__tests__/generators.test.ts +270 -0
- package/src/__tests__/introspection.test.ts +321 -0
- package/src/__tests__/protocol.test.ts +40 -0
- package/src/__tests__/provisioning.test.ts +162 -0
- package/src/__tests__/schema.test.ts +241 -0
- package/src/__tests__/svelte-integration.test.ts +431 -0
- package/src/__tests__/terminal-node.test.ts +352 -0
- package/src/adapters/cli.ts +175 -0
- package/src/cli/commands/auth.ts +271 -0
- package/src/cli/commands/cloud.ts +281 -0
- package/src/cli/commands/generate.ts +225 -0
- package/src/cli/index.ts +190 -0
- package/src/cloud/README.md +383 -0
- package/src/cloud/auth.ts +245 -0
- package/src/cloud/billing.ts +336 -0
- package/src/cloud/client.ts +221 -0
- package/src/cloud/index.ts +121 -0
- package/src/cloud/marketplace.ts +303 -0
- package/src/cloud/provisioning.ts +254 -0
- package/src/cloud/relay/endpoints.ts +307 -0
- package/src/cloud/relay/health/function.json +17 -0
- package/src/cloud/relay/health/index.ts +10 -0
- package/src/cloud/relay/host.json +15 -0
- package/src/cloud/relay/local.settings.json +8 -0
- package/src/cloud/relay/stats/function.json +17 -0
- package/src/cloud/relay/stats/index.ts +10 -0
- package/src/cloud/relay/sync/function.json +17 -0
- package/src/cloud/relay/sync/index.ts +10 -0
- package/src/cloud/relay/usage/function.json +17 -0
- package/src/cloud/relay/usage/index.ts +10 -0
- package/src/cloud/sponsors.ts +213 -0
- package/src/cloud/types.ts +198 -0
- package/src/components/README.md +125 -0
- package/src/components/TerminalNode.svelte +457 -0
- package/src/components/index.ts +46 -0
- package/src/core/actors.ts +205 -0
- package/src/core/component/generator.ts +432 -0
- package/src/core/engine.ts +243 -0
- package/src/core/introspection.ts +329 -0
- package/src/core/logic/generator.ts +420 -0
- package/src/core/pluresdb/generator.ts +229 -0
- package/src/core/protocol.ts +132 -0
- package/src/core/rules.ts +167 -0
- package/src/core/schema/loader.ts +247 -0
- package/src/core/schema/normalize.ts +322 -0
- package/src/core/schema/types.ts +557 -0
- package/src/dsl/index.ts +218 -0
- package/src/dsl.ts +214 -0
- package/src/examples/advanced-todo/App.svelte +506 -0
- package/src/examples/advanced-todo/README.md +371 -0
- package/src/examples/advanced-todo/index.ts +309 -0
- package/src/examples/auth-basic/index.ts +163 -0
- package/src/examples/cart/index.ts +259 -0
- package/src/examples/hero-ecommerce/index.ts +657 -0
- package/src/examples/svelte-counter/index.ts +168 -0
- package/src/flows.ts +268 -0
- package/src/index.ts +154 -0
- package/src/integrations/pluresdb.ts +93 -0
- package/src/integrations/svelte.ts +617 -0
- package/src/registry.ts +223 -0
- package/src/runtime/terminal-adapter.ts +175 -0
- package/src/step.ts +151 -0
- package/src/types.ts +70 -0
- package/templates/basic-app/README.md +147 -0
- package/templates/fullstack-app/README.md +279 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Praxis Logic Engine
|
|
3
|
+
*
|
|
4
|
+
* The logic engine manages state, processes events through rules,
|
|
5
|
+
* checks constraints, and provides a strongly-typed API for application logic.
|
|
6
|
+
*/
|
|
7
|
+
import type { PraxisEvent, PraxisFact, PraxisState, PraxisStepConfig, PraxisStepResult } from "./protocol.js";
|
|
8
|
+
import { PraxisRegistry } from "./rules.js";
|
|
9
|
+
/**
|
|
10
|
+
* Options for creating a Praxis engine
|
|
11
|
+
*/
|
|
12
|
+
export interface PraxisEngineOptions<TContext = unknown> {
|
|
13
|
+
/** Initial context */
|
|
14
|
+
initialContext: TContext;
|
|
15
|
+
/** Registry of rules and constraints */
|
|
16
|
+
registry: PraxisRegistry<TContext>;
|
|
17
|
+
/** Initial facts (optional) */
|
|
18
|
+
initialFacts?: PraxisFact[];
|
|
19
|
+
/** Initial metadata (optional) */
|
|
20
|
+
initialMeta?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The Praxis Logic Engine
|
|
24
|
+
*
|
|
25
|
+
* Manages application logic through facts, events, rules, and constraints.
|
|
26
|
+
* The engine is strongly typed and functional - all state updates are immutable.
|
|
27
|
+
*/
|
|
28
|
+
export declare class LogicEngine<TContext = unknown> {
|
|
29
|
+
private state;
|
|
30
|
+
private readonly registry;
|
|
31
|
+
constructor(options: PraxisEngineOptions<TContext>);
|
|
32
|
+
/**
|
|
33
|
+
* Get the current state (immutable copy)
|
|
34
|
+
*/
|
|
35
|
+
getState(): Readonly<PraxisState & {
|
|
36
|
+
context: TContext;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the current context
|
|
40
|
+
*/
|
|
41
|
+
getContext(): TContext;
|
|
42
|
+
/**
|
|
43
|
+
* Get current facts
|
|
44
|
+
*/
|
|
45
|
+
getFacts(): PraxisFact[];
|
|
46
|
+
/**
|
|
47
|
+
* Process events through the engine.
|
|
48
|
+
* Applies all registered rules and checks all registered constraints.
|
|
49
|
+
*
|
|
50
|
+
* @param events Events to process
|
|
51
|
+
* @returns Result with new state and diagnostics
|
|
52
|
+
*/
|
|
53
|
+
step(events: PraxisEvent[]): PraxisStepResult;
|
|
54
|
+
/**
|
|
55
|
+
* Process events with specific rule and constraint configuration.
|
|
56
|
+
*
|
|
57
|
+
* @param events Events to process
|
|
58
|
+
* @param config Step configuration
|
|
59
|
+
* @returns Result with new state and diagnostics
|
|
60
|
+
*/
|
|
61
|
+
stepWithConfig(events: PraxisEvent[], config: PraxisStepConfig): PraxisStepResult;
|
|
62
|
+
/**
|
|
63
|
+
* Update the context directly (for exceptional cases).
|
|
64
|
+
* Generally, context should be updated through rules.
|
|
65
|
+
*
|
|
66
|
+
* @param updater Function that produces new context from old context
|
|
67
|
+
*/
|
|
68
|
+
updateContext(updater: (context: TContext) => TContext): void;
|
|
69
|
+
/**
|
|
70
|
+
* Add facts directly (for exceptional cases).
|
|
71
|
+
* Generally, facts should be added through rules.
|
|
72
|
+
*
|
|
73
|
+
* @param facts Facts to add
|
|
74
|
+
*/
|
|
75
|
+
addFacts(facts: PraxisFact[]): void;
|
|
76
|
+
/**
|
|
77
|
+
* Clear all facts
|
|
78
|
+
*/
|
|
79
|
+
clearFacts(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Reset the engine to initial state
|
|
82
|
+
*/
|
|
83
|
+
reset(options: PraxisEngineOptions<TContext>): void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a new Praxis logic engine.
|
|
87
|
+
*
|
|
88
|
+
* @param options Engine options
|
|
89
|
+
* @returns New LogicEngine instance
|
|
90
|
+
*/
|
|
91
|
+
export declare function createPraxisEngine<TContext = unknown>(options: PraxisEngineOptions<TContext>): LogicEngine<TContext>;
|
|
92
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/core/engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAEjB,M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;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,GAAG,OAAO,EACnD,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC,GACrC,WAAW,CAAC,QAAQ,CAAC,CAEvB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Praxis Logic Engine
|
|
3
|
+
*
|
|
4
|
+
* The logic engine manages state, processes events through rules,
|
|
5
|
+
* checks constraints, and provides a strongly-typed API for application logic.
|
|
6
|
+
*/
|
|
7
|
+
import { PRAXIS_PROTOCOL_VERSION } from "./protocol.js";
|
|
8
|
+
/**
|
|
9
|
+
* The Praxis Logic Engine
|
|
10
|
+
*
|
|
11
|
+
* Manages application logic through facts, events, rules, and constraints.
|
|
12
|
+
* The engine is strongly typed and functional - all state updates are immutable.
|
|
13
|
+
*/
|
|
14
|
+
export class LogicEngine {
|
|
15
|
+
state;
|
|
16
|
+
registry;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.registry = options.registry;
|
|
19
|
+
this.state = {
|
|
20
|
+
context: options.initialContext,
|
|
21
|
+
facts: options.initialFacts ?? [],
|
|
22
|
+
meta: options.initialMeta ?? {},
|
|
23
|
+
protocolVersion: PRAXIS_PROTOCOL_VERSION,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the current state (immutable copy)
|
|
28
|
+
*/
|
|
29
|
+
getState() {
|
|
30
|
+
return {
|
|
31
|
+
context: structuredClone(this.state.context),
|
|
32
|
+
facts: [...this.state.facts],
|
|
33
|
+
meta: this.state.meta ? { ...this.state.meta } : undefined,
|
|
34
|
+
protocolVersion: this.state.protocolVersion,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get the current context
|
|
39
|
+
*/
|
|
40
|
+
getContext() {
|
|
41
|
+
return structuredClone(this.state.context);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get current facts
|
|
45
|
+
*/
|
|
46
|
+
getFacts() {
|
|
47
|
+
return [...this.state.facts];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Process events through the engine.
|
|
51
|
+
* Applies all registered rules and checks all registered constraints.
|
|
52
|
+
*
|
|
53
|
+
* @param events Events to process
|
|
54
|
+
* @returns Result with new state and diagnostics
|
|
55
|
+
*/
|
|
56
|
+
step(events) {
|
|
57
|
+
const config = {
|
|
58
|
+
ruleIds: this.registry.getRuleIds(),
|
|
59
|
+
constraintIds: this.registry.getConstraintIds(),
|
|
60
|
+
};
|
|
61
|
+
return this.stepWithConfig(events, config);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Process events with specific rule and constraint configuration.
|
|
65
|
+
*
|
|
66
|
+
* @param events Events to process
|
|
67
|
+
* @param config Step configuration
|
|
68
|
+
* @returns Result with new state and diagnostics
|
|
69
|
+
*/
|
|
70
|
+
stepWithConfig(events, config) {
|
|
71
|
+
const diagnostics = [];
|
|
72
|
+
let newState = { ...this.state };
|
|
73
|
+
// Apply rules
|
|
74
|
+
const newFacts = [];
|
|
75
|
+
for (const ruleId of config.ruleIds) {
|
|
76
|
+
const rule = this.registry.getRule(ruleId);
|
|
77
|
+
if (!rule) {
|
|
78
|
+
diagnostics.push({
|
|
79
|
+
kind: "rule-error",
|
|
80
|
+
message: `Rule "${ruleId}" not found in registry`,
|
|
81
|
+
data: { ruleId },
|
|
82
|
+
});
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const ruleFacts = rule.impl(newState, events);
|
|
87
|
+
newFacts.push(...ruleFacts);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
diagnostics.push({
|
|
91
|
+
kind: "rule-error",
|
|
92
|
+
message: `Error executing rule "${ruleId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
93
|
+
data: { ruleId, error },
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Add new facts to state
|
|
98
|
+
newState = {
|
|
99
|
+
...newState,
|
|
100
|
+
facts: [...newState.facts, ...newFacts],
|
|
101
|
+
};
|
|
102
|
+
// Check constraints
|
|
103
|
+
for (const constraintId of config.constraintIds) {
|
|
104
|
+
const constraint = this.registry.getConstraint(constraintId);
|
|
105
|
+
if (!constraint) {
|
|
106
|
+
diagnostics.push({
|
|
107
|
+
kind: "constraint-violation",
|
|
108
|
+
message: `Constraint "${constraintId}" not found in registry`,
|
|
109
|
+
data: { constraintId },
|
|
110
|
+
});
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
const result = constraint.impl(newState);
|
|
115
|
+
if (result === false) {
|
|
116
|
+
diagnostics.push({
|
|
117
|
+
kind: "constraint-violation",
|
|
118
|
+
message: `Constraint "${constraintId}" violated`,
|
|
119
|
+
data: { constraintId, description: constraint.description },
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
else if (typeof result === "string") {
|
|
123
|
+
diagnostics.push({
|
|
124
|
+
kind: "constraint-violation",
|
|
125
|
+
message: result,
|
|
126
|
+
data: { constraintId, description: constraint.description },
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
diagnostics.push({
|
|
132
|
+
kind: "constraint-violation",
|
|
133
|
+
message: `Error checking constraint "${constraintId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
134
|
+
data: { constraintId, error },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Update internal state
|
|
139
|
+
this.state = newState;
|
|
140
|
+
return {
|
|
141
|
+
state: newState,
|
|
142
|
+
diagnostics,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Update the context directly (for exceptional cases).
|
|
147
|
+
* Generally, context should be updated through rules.
|
|
148
|
+
*
|
|
149
|
+
* @param updater Function that produces new context from old context
|
|
150
|
+
*/
|
|
151
|
+
updateContext(updater) {
|
|
152
|
+
this.state = {
|
|
153
|
+
...this.state,
|
|
154
|
+
context: updater(this.state.context),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Add facts directly (for exceptional cases).
|
|
159
|
+
* Generally, facts should be added through rules.
|
|
160
|
+
*
|
|
161
|
+
* @param facts Facts to add
|
|
162
|
+
*/
|
|
163
|
+
addFacts(facts) {
|
|
164
|
+
this.state = {
|
|
165
|
+
...this.state,
|
|
166
|
+
facts: [...this.state.facts, ...facts],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Clear all facts
|
|
171
|
+
*/
|
|
172
|
+
clearFacts() {
|
|
173
|
+
this.state = {
|
|
174
|
+
...this.state,
|
|
175
|
+
facts: [],
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Reset the engine to initial state
|
|
180
|
+
*/
|
|
181
|
+
reset(options) {
|
|
182
|
+
this.state = {
|
|
183
|
+
context: options.initialContext,
|
|
184
|
+
facts: options.initialFacts ?? [],
|
|
185
|
+
meta: options.initialMeta ?? {},
|
|
186
|
+
protocolVersion: PRAXIS_PROTOCOL_VERSION,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Create a new Praxis logic engine.
|
|
192
|
+
*
|
|
193
|
+
* @param options Engine options
|
|
194
|
+
* @returns New LogicEngine instance
|
|
195
|
+
*/
|
|
196
|
+
export function createPraxisEngine(options) {
|
|
197
|
+
return new LogicEngine(options);
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/core/engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAiBxD;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IACd,K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AAO;YACL,KAAK,EAAE,QAAQ;YACf,WAAW;SACZ,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,OAAwC;QACpD,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,IAAI,CAAC,KAAK;YACb,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;SACrC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,KAAmB;QAC1B,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,IAAI,CAAC,KAAK;YACb,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC;SACvC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,IAAI,CAAC,KAAK;YACb,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAsC;QAC1C,IAAI,CAAC,KAAK,GAAG;YACX,OAAO,EAAE,OAAO,CAAC,cAAc;YAC/B,KAAK,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;YACjC,IAAI,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;YAC/B,eAAe,EAAE,uBAAuB;SACzC,CAAC;IACJ,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC;IAEtC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Introspection and Visualization Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides APIs to introspect the registry, generate schemas,
|
|
5
|
+
* and export graph representations for external tools.
|
|
6
|
+
*/
|
|
7
|
+
import type { PraxisRegistry, RuleDescriptor, ConstraintDescriptor } from "./rules.js";
|
|
8
|
+
/**
|
|
9
|
+
* Graph node representing a rule in the system
|
|
10
|
+
*/
|
|
11
|
+
export interface RuleNode {
|
|
12
|
+
id: string;
|
|
13
|
+
type: "rule";
|
|
14
|
+
description: string;
|
|
15
|
+
meta?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Graph node representing a constraint in the system
|
|
19
|
+
*/
|
|
20
|
+
export interface ConstraintNode {
|
|
21
|
+
id: string;
|
|
22
|
+
type: "constraint";
|
|
23
|
+
description: string;
|
|
24
|
+
meta?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Graph edge representing a dependency or relationship
|
|
28
|
+
*/
|
|
29
|
+
export interface GraphEdge {
|
|
30
|
+
from: string;
|
|
31
|
+
to: string;
|
|
32
|
+
type: "triggers" | "constrains" | "depends-on";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Complete graph representation of the registry
|
|
36
|
+
*/
|
|
37
|
+
export interface RegistryGraph {
|
|
38
|
+
nodes: (RuleNode | ConstraintNode)[];
|
|
39
|
+
edges: GraphEdge[];
|
|
40
|
+
meta: {
|
|
41
|
+
nodeCount: number;
|
|
42
|
+
ruleCount: number;
|
|
43
|
+
constraintCount: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* JSON Schema-like representation of a rule
|
|
48
|
+
*/
|
|
49
|
+
export interface RuleSchema {
|
|
50
|
+
id: string;
|
|
51
|
+
description: string;
|
|
52
|
+
type: "rule";
|
|
53
|
+
meta?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* JSON Schema-like representation of a constraint
|
|
57
|
+
*/
|
|
58
|
+
export interface ConstraintSchema {
|
|
59
|
+
id: string;
|
|
60
|
+
description: string;
|
|
61
|
+
type: "constraint";
|
|
62
|
+
meta?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Complete registry schema
|
|
66
|
+
*/
|
|
67
|
+
export interface RegistrySchema {
|
|
68
|
+
protocolVersion: string;
|
|
69
|
+
rules: RuleSchema[];
|
|
70
|
+
constraints: ConstraintSchema[];
|
|
71
|
+
meta: {
|
|
72
|
+
ruleCount: number;
|
|
73
|
+
constraintCount: number;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Statistics about the registry
|
|
78
|
+
*/
|
|
79
|
+
export interface RegistryStats {
|
|
80
|
+
ruleCount: number;
|
|
81
|
+
constraintCount: number;
|
|
82
|
+
moduleCount: number;
|
|
83
|
+
rulesById: string[];
|
|
84
|
+
constraintsById: string[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Introspection utilities for a Praxis registry
|
|
88
|
+
*/
|
|
89
|
+
export declare class RegistryIntrospector<TContext = unknown> {
|
|
90
|
+
private registry;
|
|
91
|
+
constructor(registry: PraxisRegistry<TContext>);
|
|
92
|
+
/**
|
|
93
|
+
* Get basic statistics about the registry
|
|
94
|
+
*/
|
|
95
|
+
getStats(): RegistryStats;
|
|
96
|
+
/**
|
|
97
|
+
* Generate a JSON schema representation of the registry
|
|
98
|
+
*/
|
|
99
|
+
generateSchema(protocolVersion: string): RegistrySchema;
|
|
100
|
+
/**
|
|
101
|
+
* Generate a graph representation of the registry
|
|
102
|
+
*
|
|
103
|
+
* This creates nodes for rules and constraints.
|
|
104
|
+
* Edges can be inferred from metadata if rules/constraints
|
|
105
|
+
* document their dependencies.
|
|
106
|
+
*/
|
|
107
|
+
generateGraph(): RegistryGraph;
|
|
108
|
+
/**
|
|
109
|
+
* Export graph in DOT format (Graphviz)
|
|
110
|
+
*
|
|
111
|
+
* This can be rendered with Graphviz tools or online services.
|
|
112
|
+
*/
|
|
113
|
+
exportDOT(): string;
|
|
114
|
+
/**
|
|
115
|
+
* Export graph in Mermaid format
|
|
116
|
+
*
|
|
117
|
+
* Mermaid is a markdown-friendly diagramming language.
|
|
118
|
+
*/
|
|
119
|
+
exportMermaid(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Get detailed information about a specific rule
|
|
122
|
+
*/
|
|
123
|
+
getRuleInfo(ruleId: string): RuleDescriptor<TContext> | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get detailed information about a specific constraint
|
|
126
|
+
*/
|
|
127
|
+
getConstraintInfo(constraintId: string): ConstraintDescriptor<TContext> | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Search for rules by description text
|
|
130
|
+
*/
|
|
131
|
+
searchRules(query: string): RuleDescriptor<TContext>[];
|
|
132
|
+
/**
|
|
133
|
+
* Search for constraints by description text
|
|
134
|
+
*/
|
|
135
|
+
searchConstraints(query: string): ConstraintDescriptor<TContext>[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Create a registry introspector
|
|
139
|
+
*/
|
|
140
|
+
export declare function createIntrospector<TContext = unknown>(registry: PraxisRegistry<TContext>): RegistryIntrospector<TContext>;
|
|
141
|
+
//# sourceMappingURL=introspection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspection.d.ts","sourceRoot":"","sources":["../../src/core/introspection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,SAA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qBAAa,oBAAoB,CAAC,QAAQ,GAAG,OAAO;IACtC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;IAEtD;;OAEG;IACH,QAAQ,IAAI,aAAa;IAUzB;;OAEG;IACH,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,cAAc;IA0BvD;;;;;;OAMG;IACH,aAAa,IAAI,aAAa;IA+D9B;;;;OAIG;IACH,SAAS,IAAI,MAAM;IA8BnB;;;;OAIG;IACH,aAAa,IAAI,MAAM;IAyBvB;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,SAAS;IAIjE;;OAEG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,GAAG,SAAS;IAInF;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,EAAE;IAWtD;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,EAAE;CAUnE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,GAAG,OAAO,EACnD,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,GACjC,oBAAoB,CAAC,QAAQ,CAAC,CAEhC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Introspection and Visualization Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides APIs to introspect the registry, generate schemas,
|
|
5
|
+
* and export graph representations for external tools.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Introspection utilities for a Praxis registry
|
|
9
|
+
*/
|
|
10
|
+
export class RegistryIntrospector {
|
|
11
|
+
registry;
|
|
12
|
+
constructor(registry) {
|
|
13
|
+
this.registry = registry;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get basic statistics about the registry
|
|
17
|
+
*/
|
|
18
|
+
getStats() {
|
|
19
|
+
return {
|
|
20
|
+
ruleCount: this.registry.getRuleIds().length,
|
|
21
|
+
constraintCount: this.registry.getConstraintIds().length,
|
|
22
|
+
moduleCount: 0, // Modules are flattened in registry
|
|
23
|
+
rulesById: this.registry.getRuleIds(),
|
|
24
|
+
constraintsById: this.registry.getConstraintIds(),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Generate a JSON schema representation of the registry
|
|
29
|
+
*/
|
|
30
|
+
generateSchema(protocolVersion) {
|
|
31
|
+
const rules = this.registry.getAllRules().map((rule) => ({
|
|
32
|
+
id: rule.id,
|
|
33
|
+
description: rule.description,
|
|
34
|
+
type: "rule",
|
|
35
|
+
meta: rule.meta,
|
|
36
|
+
}));
|
|
37
|
+
const constraints = this.registry.getAllConstraints().map((constraint) => ({
|
|
38
|
+
id: constraint.id,
|
|
39
|
+
description: constraint.description,
|
|
40
|
+
type: "constraint",
|
|
41
|
+
meta: constraint.meta,
|
|
42
|
+
}));
|
|
43
|
+
return {
|
|
44
|
+
protocolVersion,
|
|
45
|
+
rules,
|
|
46
|
+
constraints,
|
|
47
|
+
meta: {
|
|
48
|
+
ruleCount: rules.length,
|
|
49
|
+
constraintCount: constraints.length,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Generate a graph representation of the registry
|
|
55
|
+
*
|
|
56
|
+
* This creates nodes for rules and constraints.
|
|
57
|
+
* Edges can be inferred from metadata if rules/constraints
|
|
58
|
+
* document their dependencies.
|
|
59
|
+
*/
|
|
60
|
+
generateGraph() {
|
|
61
|
+
const nodes = [];
|
|
62
|
+
const edges = [];
|
|
63
|
+
// Add rule nodes
|
|
64
|
+
for (const rule of this.registry.getAllRules()) {
|
|
65
|
+
nodes.push({
|
|
66
|
+
id: rule.id,
|
|
67
|
+
type: "rule",
|
|
68
|
+
description: rule.description,
|
|
69
|
+
meta: rule.meta,
|
|
70
|
+
});
|
|
71
|
+
// Check for dependency metadata
|
|
72
|
+
if (rule.meta?.dependsOn) {
|
|
73
|
+
const deps = Array.isArray(rule.meta.dependsOn)
|
|
74
|
+
? rule.meta.dependsOn
|
|
75
|
+
: [rule.meta.dependsOn];
|
|
76
|
+
for (const dep of deps) {
|
|
77
|
+
edges.push({
|
|
78
|
+
from: String(dep),
|
|
79
|
+
to: rule.id,
|
|
80
|
+
type: "depends-on",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Add constraint nodes
|
|
86
|
+
for (const constraint of this.registry.getAllConstraints()) {
|
|
87
|
+
nodes.push({
|
|
88
|
+
id: constraint.id,
|
|
89
|
+
type: "constraint",
|
|
90
|
+
description: constraint.description,
|
|
91
|
+
meta: constraint.meta,
|
|
92
|
+
});
|
|
93
|
+
// Check for constraint targets
|
|
94
|
+
if (constraint.meta?.constrains) {
|
|
95
|
+
const targets = Array.isArray(constraint.meta.constrains)
|
|
96
|
+
? constraint.meta.constrains
|
|
97
|
+
: [constraint.meta.constrains];
|
|
98
|
+
for (const target of targets) {
|
|
99
|
+
edges.push({
|
|
100
|
+
from: constraint.id,
|
|
101
|
+
to: String(target),
|
|
102
|
+
type: "constrains",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
nodes,
|
|
109
|
+
edges,
|
|
110
|
+
meta: {
|
|
111
|
+
nodeCount: nodes.length,
|
|
112
|
+
ruleCount: nodes.filter((n) => n.type === "rule").length,
|
|
113
|
+
constraintCount: nodes.filter((n) => n.type === "constraint").length,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Export graph in DOT format (Graphviz)
|
|
119
|
+
*
|
|
120
|
+
* This can be rendered with Graphviz tools or online services.
|
|
121
|
+
*/
|
|
122
|
+
exportDOT() {
|
|
123
|
+
const graph = this.generateGraph();
|
|
124
|
+
const lines = [];
|
|
125
|
+
lines.push("digraph PraxisRegistry {");
|
|
126
|
+
lines.push(" rankdir=TB;");
|
|
127
|
+
lines.push(" node [shape=box, style=rounded];");
|
|
128
|
+
lines.push("");
|
|
129
|
+
// Add nodes
|
|
130
|
+
for (const node of graph.nodes) {
|
|
131
|
+
const shape = node.type === "rule" ? "box" : "diamond";
|
|
132
|
+
const color = node.type === "rule" ? "lightblue" : "lightcoral";
|
|
133
|
+
const label = `${node.id}\\n${node.description}`;
|
|
134
|
+
lines.push(` "${node.id}" [label="${label}", shape=${shape}, style=filled, fillcolor=${color}];`);
|
|
135
|
+
}
|
|
136
|
+
lines.push("");
|
|
137
|
+
// Add edges
|
|
138
|
+
for (const edge of graph.edges) {
|
|
139
|
+
const style = edge.type === "constrains" ? "dashed" : "solid";
|
|
140
|
+
lines.push(` "${edge.from}" -> "${edge.to}" [label="${edge.type}", style=${style}];`);
|
|
141
|
+
}
|
|
142
|
+
lines.push("}");
|
|
143
|
+
return lines.join("\n");
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Export graph in Mermaid format
|
|
147
|
+
*
|
|
148
|
+
* Mermaid is a markdown-friendly diagramming language.
|
|
149
|
+
*/
|
|
150
|
+
exportMermaid() {
|
|
151
|
+
const graph = this.generateGraph();
|
|
152
|
+
const lines = [];
|
|
153
|
+
lines.push("graph TB");
|
|
154
|
+
// Add nodes
|
|
155
|
+
for (const node of graph.nodes) {
|
|
156
|
+
const shape = node.type === "rule" ? "[" : "{";
|
|
157
|
+
const endShape = node.type === "rule" ? "]" : "}";
|
|
158
|
+
const label = `${node.id}<br/>${node.description}`;
|
|
159
|
+
lines.push(` ${node.id}${shape}"${label}"${endShape}`);
|
|
160
|
+
}
|
|
161
|
+
lines.push("");
|
|
162
|
+
// Add edges
|
|
163
|
+
for (const edge of graph.edges) {
|
|
164
|
+
const arrow = edge.type === "constrains" ? "-.->|constrains|" : "-->|" + edge.type + "|";
|
|
165
|
+
lines.push(` ${edge.from} ${arrow} ${edge.to}`);
|
|
166
|
+
}
|
|
167
|
+
return lines.join("\n");
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get detailed information about a specific rule
|
|
171
|
+
*/
|
|
172
|
+
getRuleInfo(ruleId) {
|
|
173
|
+
return this.registry.getRule(ruleId);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get detailed information about a specific constraint
|
|
177
|
+
*/
|
|
178
|
+
getConstraintInfo(constraintId) {
|
|
179
|
+
return this.registry.getConstraint(constraintId);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Search for rules by description text
|
|
183
|
+
*/
|
|
184
|
+
searchRules(query) {
|
|
185
|
+
const lowerQuery = query.toLowerCase();
|
|
186
|
+
return this.registry
|
|
187
|
+
.getAllRules()
|
|
188
|
+
.filter((rule) => rule.id.toLowerCase().includes(lowerQuery) ||
|
|
189
|
+
rule.description.toLowerCase().includes(lowerQuery));
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Search for constraints by description text
|
|
193
|
+
*/
|
|
194
|
+
searchConstraints(query) {
|
|
195
|
+
const lowerQuery = query.toLowerCase();
|
|
196
|
+
return this.registry
|
|
197
|
+
.getAllConstraints()
|
|
198
|
+
.filter((constraint) => constraint.id.toLowerCase().includes(lowerQuery) ||
|
|
199
|
+
constraint.description.toLowerCase().includes(lowerQuery));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Create a registry introspector
|
|
204
|
+
*/
|
|
205
|
+
export function createIntrospector(registry) {
|
|
206
|
+
return new RegistryIntrospector(registry);
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=introspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspection.js","sourceRoot":"","sources":["../../src/core/introspection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0FH;;GAEG;AACH,MA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