@contractspec/module.examples 0.0.0-canary-20260113170453

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chaman Ventures, SASU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @contractspec/module.examples
2
+
3
+ Website: https://contractspec.io/
4
+
5
+
6
+ Pure, deterministic types and registries for ContractSpec Examples.
7
+
8
+ ## Purpose
9
+
10
+ This module defines the canonical “Example” shape (metadata + entrypoints) and exposes:
11
+
12
+ - A registry API to list/search examples
13
+ - Pure validators to enforce minimum required metadata across examples
14
+
15
+ ## Design principles
16
+
17
+ - No I/O (no filesystem, no network)
18
+ - Deterministic outputs from explicit inputs
19
+ - Strong typing (no `any`)
20
+
21
+
@@ -0,0 +1,76 @@
1
+ import AgentConsole from "@contractspec/example.agent-console/example";
2
+ import AiSupportBot from "@contractspec/example.ai-support-bot/example";
3
+ import AnalyticsDashboard from "@contractspec/example.analytics-dashboard/example";
4
+ import ContentGeneration from "@contractspec/example.content-generation/example";
5
+ import CrmPipeline from "@contractspec/example.crm-pipeline/example";
6
+ import IntegrationHub from "@contractspec/example.integration-hub/example";
7
+ import IntegrationStripe from "@contractspec/example.integration-stripe/example";
8
+ import KbUpdatePipeline from "@contractspec/example.kb-update-pipeline/example";
9
+ import KnowledgeCanon from "@contractspec/example.knowledge-canon/example";
10
+ import LearningPatterns from "@contractspec/example.learning-patterns/example";
11
+ import LearningJourneyAmbientCoach from "@contractspec/example.learning-journey-ambient-coach/example";
12
+ import LearningJourneyCrmOnboarding from "@contractspec/example.learning-journey-crm-onboarding/example";
13
+ import LearningJourneyDuoDrills from "@contractspec/example.learning-journey-duo-drills/example";
14
+ import LearningJourneyPlatformTour from "@contractspec/example.learning-journey-platform-tour/example";
15
+ import LearningJourneyQuestChallenges from "@contractspec/example.learning-journey-quest-challenges/example";
16
+ import LearningJourneyRegistry from "@contractspec/example.learning-journey-registry/example";
17
+ import LearningJourneyStudioOnboarding from "@contractspec/example.learning-journey-studio-onboarding/example";
18
+ import LearningJourneyUiCoaching from "@contractspec/example.learning-journey-ui-coaching/example";
19
+ import LearningJourneyUiGamified from "@contractspec/example.learning-journey-ui-gamified/example";
20
+ import LearningJourneyUiOnboarding from "@contractspec/example.learning-journey-ui-onboarding/example";
21
+ import LearningJourneyUiShared from "@contractspec/example.learning-journey-ui-shared/example";
22
+ import LifecycleCli from "@contractspec/example.lifecycle-cli/example";
23
+ import LifecycleDashboard from "@contractspec/example.lifecycle-dashboard/example";
24
+ import LocaleJurisdictionGate from "@contractspec/example.locale-jurisdiction-gate/example";
25
+ import Marketplace from "@contractspec/example.marketplace/example";
26
+ import OpenbankingPowens from "@contractspec/example.openbanking-powens/example";
27
+ import Personalization from "@contractspec/example.personalization/example";
28
+ import PolicySafeKnowledgeAssistant from "@contractspec/example.policy-safe-knowledge-assistant/example";
29
+ import SaasBoilerplate from "@contractspec/example.saas-boilerplate/example";
30
+ import ServiceBusinessOs from "@contractspec/example.service-business-os/example";
31
+ import TeamHub from "@contractspec/example.team-hub/example";
32
+ import VersionedKnowledgeBase from "@contractspec/example.versioned-knowledge-base/example";
33
+ import WealthSnapshot from "@contractspec/example.wealth-snapshot/example";
34
+ import WorkflowSystem from "@contractspec/example.workflow-system/example";
35
+
36
+ //#region src/builtins.ts
37
+ const EXAMPLE_REGISTRY = [
38
+ AgentConsole,
39
+ AiSupportBot,
40
+ AnalyticsDashboard,
41
+ ContentGeneration,
42
+ CrmPipeline,
43
+ IntegrationHub,
44
+ IntegrationStripe,
45
+ KbUpdatePipeline,
46
+ KnowledgeCanon,
47
+ LearningPatterns,
48
+ LearningJourneyAmbientCoach,
49
+ LearningJourneyCrmOnboarding,
50
+ LearningJourneyDuoDrills,
51
+ LearningJourneyPlatformTour,
52
+ LearningJourneyQuestChallenges,
53
+ LearningJourneyRegistry,
54
+ LearningJourneyStudioOnboarding,
55
+ LearningJourneyUiCoaching,
56
+ LearningJourneyUiGamified,
57
+ LearningJourneyUiOnboarding,
58
+ LearningJourneyUiShared,
59
+ LifecycleCli,
60
+ LifecycleDashboard,
61
+ LocaleJurisdictionGate,
62
+ Marketplace,
63
+ OpenbankingPowens,
64
+ Personalization,
65
+ PolicySafeKnowledgeAssistant,
66
+ SaasBoilerplate,
67
+ ServiceBusinessOs,
68
+ TeamHub,
69
+ VersionedKnowledgeBase,
70
+ WealthSnapshot,
71
+ WorkflowSystem
72
+ ];
73
+
74
+ //#endregion
75
+ export { EXAMPLE_REGISTRY };
76
+ //# sourceMappingURL=builtins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.js","names":[],"sources":["../src/builtins.ts"],"sourcesContent":["import type { ExampleSpec } from '@contractspec/lib.contracts';\n\n// Import manifests ONLY via the side-effect-free `/example` entrypoints.\nimport AgentConsole from '@contractspec/example.agent-console/example';\nimport AiSupportBot from '@contractspec/example.ai-support-bot/example';\nimport AnalyticsDashboard from '@contractspec/example.analytics-dashboard/example';\nimport ContentGeneration from '@contractspec/example.content-generation/example';\nimport CrmPipeline from '@contractspec/example.crm-pipeline/example';\nimport IntegrationHub from '@contractspec/example.integration-hub/example';\nimport IntegrationStripe from '@contractspec/example.integration-stripe/example';\nimport KbUpdatePipeline from '@contractspec/example.kb-update-pipeline/example';\nimport KnowledgeCanon from '@contractspec/example.knowledge-canon/example';\nimport LearningPatterns from '@contractspec/example.learning-patterns/example';\nimport LearningJourneyAmbientCoach from '@contractspec/example.learning-journey-ambient-coach/example';\nimport LearningJourneyCrmOnboarding from '@contractspec/example.learning-journey-crm-onboarding/example';\nimport LearningJourneyDuoDrills from '@contractspec/example.learning-journey-duo-drills/example';\nimport LearningJourneyPlatformTour from '@contractspec/example.learning-journey-platform-tour/example';\nimport LearningJourneyQuestChallenges from '@contractspec/example.learning-journey-quest-challenges/example';\nimport LearningJourneyRegistry from '@contractspec/example.learning-journey-registry/example';\nimport LearningJourneyStudioOnboarding from '@contractspec/example.learning-journey-studio-onboarding/example';\nimport LearningJourneyUiCoaching from '@contractspec/example.learning-journey-ui-coaching/example';\nimport LearningJourneyUiGamified from '@contractspec/example.learning-journey-ui-gamified/example';\nimport LearningJourneyUiOnboarding from '@contractspec/example.learning-journey-ui-onboarding/example';\nimport LearningJourneyUiShared from '@contractspec/example.learning-journey-ui-shared/example';\nimport LifecycleCli from '@contractspec/example.lifecycle-cli/example';\nimport LifecycleDashboard from '@contractspec/example.lifecycle-dashboard/example';\nimport LocaleJurisdictionGate from '@contractspec/example.locale-jurisdiction-gate/example';\nimport Marketplace from '@contractspec/example.marketplace/example';\nimport OpenbankingPowens from '@contractspec/example.openbanking-powens/example';\nimport Personalization from '@contractspec/example.personalization/example';\nimport PolicySafeKnowledgeAssistant from '@contractspec/example.policy-safe-knowledge-assistant/example';\nimport SaasBoilerplate from '@contractspec/example.saas-boilerplate/example';\nimport ServiceBusinessOs from '@contractspec/example.service-business-os/example';\nimport TeamHub from '@contractspec/example.team-hub/example';\nimport VersionedKnowledgeBase from '@contractspec/example.versioned-knowledge-base/example';\nimport WealthSnapshot from '@contractspec/example.wealth-snapshot/example';\nimport WorkflowSystem from '@contractspec/example.workflow-system/example';\n\nexport const EXAMPLE_REGISTRY: readonly ExampleSpec[] = [\n AgentConsole,\n AiSupportBot,\n AnalyticsDashboard,\n ContentGeneration,\n CrmPipeline,\n IntegrationHub,\n IntegrationStripe,\n KbUpdatePipeline,\n KnowledgeCanon,\n LearningPatterns,\n LearningJourneyAmbientCoach,\n LearningJourneyCrmOnboarding,\n LearningJourneyDuoDrills,\n LearningJourneyPlatformTour,\n LearningJourneyQuestChallenges,\n LearningJourneyRegistry,\n LearningJourneyStudioOnboarding,\n LearningJourneyUiCoaching,\n LearningJourneyUiGamified,\n LearningJourneyUiOnboarding,\n LearningJourneyUiShared,\n LifecycleCli,\n LifecycleDashboard,\n LocaleJurisdictionGate,\n Marketplace,\n OpenbankingPowens,\n Personalization,\n PolicySafeKnowledgeAssistant,\n SaasBoilerplate,\n ServiceBusinessOs,\n TeamHub,\n VersionedKnowledgeBase,\n WealthSnapshot,\n WorkflowSystem,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,mBAA2C;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -0,0 +1,6 @@
1
+ import { EXAMPLE_REGISTRY, ExampleRegistry, getExample, listExamples, searchExamples } from "./registry.js";
2
+ import { createTemplateTransformEngine, getTemplateEngine, resetTemplateEngine } from "./runtime/engine.js";
3
+ import { TemplateInstaller, TemplateInstallerOptions } from "./runtime/installer.js";
4
+ import { TEMPLATE_REGISTRY, getClonableTemplates, getTemplate, getTemplatesByModule, listTemplates } from "./runtime/registry.js";
5
+ import { TemplateHandlers, TemplateRuntimeProvider, useAgentHandlers, useAnalyticsHandlers, useCrmHandlers, useIntegrationHandlers, useMarketplaceHandlers, useSaasHandlers, useTemplateEngine, useTemplateHandlers, useWorkflowHandlers } from "./runtime/context.js";
6
+ export { EXAMPLE_REGISTRY, ExampleRegistry, TEMPLATE_REGISTRY, TemplateHandlers, TemplateInstaller, TemplateInstallerOptions, TemplateRuntimeProvider, createTemplateTransformEngine, getClonableTemplates, getExample, getTemplate, getTemplateEngine, getTemplatesByModule, listExamples, listTemplates, resetTemplateEngine, searchExamples, useAgentHandlers, useAnalyticsHandlers, useCrmHandlers, useIntegrationHandlers, useMarketplaceHandlers, useSaasHandlers, useTemplateEngine, useTemplateHandlers, useWorkflowHandlers };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { EXAMPLE_REGISTRY, ExampleRegistry, getExample, listExamples, searchExamples } from "./registry.js";
2
+ import { createTemplateTransformEngine, getTemplateEngine, resetTemplateEngine } from "./runtime/engine.js";
3
+ import { TEMPLATE_REGISTRY, getClonableTemplates, getTemplate, getTemplatesByModule, listTemplates } from "./runtime/registry.js";
4
+ import { TemplateInstaller } from "./runtime/installer.js";
5
+ import { TemplateHandlers, TemplateRuntimeProvider, useAgentHandlers, useAnalyticsHandlers, useCrmHandlers, useIntegrationHandlers, useMarketplaceHandlers, useSaasHandlers, useTemplateEngine, useTemplateHandlers, useWorkflowHandlers } from "./runtime/context.js";
6
+
7
+ export { EXAMPLE_REGISTRY, ExampleRegistry, TEMPLATE_REGISTRY, TemplateHandlers, TemplateInstaller, TemplateRuntimeProvider, createTemplateTransformEngine, getClonableTemplates, getExample, getTemplate, getTemplateEngine, getTemplatesByModule, listExamples, listTemplates, resetTemplateEngine, searchExamples, useAgentHandlers, useAnalyticsHandlers, useCrmHandlers, useIntegrationHandlers, useMarketplaceHandlers, useSaasHandlers, useTemplateEngine, useTemplateHandlers, useWorkflowHandlers };
@@ -0,0 +1,24 @@
1
+ import { ExampleRegistry as ExampleRegistry$1, ExampleSpec } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/registry.d.ts
4
+
5
+ /**
6
+ * Global registry containing all builtin ContractSpec examples.
7
+ * @deprecated Prefer using ExampleRegistry directly for custom registrations.
8
+ */
9
+ declare const EXAMPLE_REGISTRY: readonly ExampleSpec[];
10
+ /**
11
+ * List all registered examples.
12
+ */
13
+ declare function listExamples(): readonly ExampleSpec[];
14
+ /**
15
+ * Get an example by its key.
16
+ */
17
+ declare function getExample(key: string): ExampleSpec | undefined;
18
+ /**
19
+ * Search examples by query (matches key, title, description, tags).
20
+ */
21
+ declare function searchExamples(query: string): ExampleSpec[];
22
+ //#endregion
23
+ export { EXAMPLE_REGISTRY, ExampleRegistry$1 as ExampleRegistry, getExample, listExamples, searchExamples };
24
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","names":[],"sources":["../src/registry.ts"],"sourcesContent":[],"mappings":";;;;;AAmBA;AAKA;AAOA;AAOgB,cAnBH,gBAmBkC,EAAA,SAnBP,WAmBkB,EAAA;;;;iBAd1C,YAAA,CAAA,YAAyB;;;;iBAOzB,UAAA,eAAyB;;;;iBAOzB,cAAA,iBAA+B"}
@@ -0,0 +1,33 @@
1
+ import { EXAMPLE_REGISTRY as EXAMPLE_REGISTRY$1 } from "./builtins.js";
2
+ import { ExampleRegistry, ExampleRegistry as ExampleRegistry$1 } from "@contractspec/lib.contracts";
3
+
4
+ //#region src/registry.ts
5
+ const globalRegistry = new ExampleRegistry();
6
+ for (const example of EXAMPLE_REGISTRY$1) globalRegistry.register(example);
7
+ /**
8
+ * Global registry containing all builtin ContractSpec examples.
9
+ * @deprecated Prefer using ExampleRegistry directly for custom registrations.
10
+ */
11
+ const EXAMPLE_REGISTRY = globalRegistry.list();
12
+ /**
13
+ * List all registered examples.
14
+ */
15
+ function listExamples() {
16
+ return globalRegistry.list();
17
+ }
18
+ /**
19
+ * Get an example by its key.
20
+ */
21
+ function getExample(key) {
22
+ return globalRegistry.get(key);
23
+ }
24
+ /**
25
+ * Search examples by query (matches key, title, description, tags).
26
+ */
27
+ function searchExamples(query) {
28
+ return globalRegistry.search(query);
29
+ }
30
+
31
+ //#endregion
32
+ export { EXAMPLE_REGISTRY, ExampleRegistry$1 as ExampleRegistry, getExample, listExamples, searchExamples };
33
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","names":["BUILTIN_EXAMPLES"],"sources":["../src/registry.ts"],"sourcesContent":["import { ExampleRegistry } from '@contractspec/lib.contracts';\nimport type { ExampleSpec } from '@contractspec/lib.contracts';\nimport { EXAMPLE_REGISTRY as BUILTIN_EXAMPLES } from './builtins';\n\n// Export the ExampleRegistry class from contracts\nexport { ExampleRegistry } from '@contractspec/lib.contracts';\n\n// Create a global registry instance populated with builtins\nconst globalRegistry = new ExampleRegistry();\n\n// Register all builtin examples\nfor (const example of BUILTIN_EXAMPLES) {\n globalRegistry.register(example);\n}\n\n/**\n * Global registry containing all builtin ContractSpec examples.\n * @deprecated Prefer using ExampleRegistry directly for custom registrations.\n */\nexport const EXAMPLE_REGISTRY: readonly ExampleSpec[] = globalRegistry.list();\n\n/**\n * List all registered examples.\n */\nexport function listExamples(): readonly ExampleSpec[] {\n return globalRegistry.list();\n}\n\n/**\n * Get an example by its key.\n */\nexport function getExample(key: string): ExampleSpec | undefined {\n return globalRegistry.get(key);\n}\n\n/**\n * Search examples by query (matches key, title, description, tags).\n */\nexport function searchExamples(query: string): ExampleSpec[] {\n return globalRegistry.search(query);\n}\n"],"mappings":";;;;AAQA,MAAM,iBAAiB,IAAI,iBAAiB;AAG5C,KAAK,MAAM,WAAWA,mBACpB,gBAAe,SAAS,QAAQ;;;;;AAOlC,MAAa,mBAA2C,eAAe,MAAM;;;;AAK7E,SAAgB,eAAuC;AACrD,QAAO,eAAe,MAAM;;;;;AAM9B,SAAgB,WAAW,KAAsC;AAC/D,QAAO,eAAe,IAAI,IAAI;;;;;AAMhC,SAAgB,eAAe,OAA8B;AAC3D,QAAO,eAAe,OAAO,MAAM"}
@@ -0,0 +1,45 @@
1
+ import { TransformEngine } from "@contractspec/lib.contracts/presentations";
2
+ import { AgentHandlers } from "@contractspec/example.agent-console";
3
+ import { SaasHandlers } from "@contractspec/example.saas-boilerplate";
4
+ import { CrmHandlers } from "@contractspec/example.crm-pipeline";
5
+ import { WorkflowHandlers } from "@contractspec/example.workflow-system";
6
+ import { MarketplaceHandlers } from "@contractspec/example.marketplace";
7
+ import { IntegrationHandlers } from "@contractspec/example.integration-hub";
8
+ import { AnalyticsHandlers } from "@contractspec/example.analytics-dashboard";
9
+ import { PropsWithChildren } from "react";
10
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
11
+ import { PolicySafeKnowledgeAssistantHandlers } from "@contractspec/example.policy-safe-knowledge-assistant";
12
+ import { TemplateRuntimeProviderProps } from "@contractspec/lib.example-shared-ui";
13
+
14
+ //#region src/runtime/context.d.ts
15
+ /**
16
+ * Template-specific handlers created from the runtime database
17
+ */
18
+ declare class TemplateHandlers {
19
+ crm: CrmHandlers;
20
+ saas: SaasHandlers;
21
+ agent: AgentHandlers;
22
+ workflow: WorkflowHandlers;
23
+ marketplace: MarketplaceHandlers;
24
+ integration: IntegrationHandlers;
25
+ analytics: AnalyticsHandlers;
26
+ policySafeKnowledgeAssistant: PolicySafeKnowledgeAssistantHandlers;
27
+ }
28
+ declare function TemplateRuntimeProvider({
29
+ templateId,
30
+ projectId,
31
+ lazy,
32
+ children
33
+ }: PropsWithChildren<TemplateRuntimeProviderProps>): react_jsx_runtime0.JSX.Element;
34
+ declare function useTemplateEngine(): TransformEngine;
35
+ declare function useTemplateHandlers(): TemplateHandlers;
36
+ declare function useCrmHandlers(): CrmHandlers;
37
+ declare function useSaasHandlers(): SaasHandlers;
38
+ declare function useAgentHandlers(): AgentHandlers;
39
+ declare function useWorkflowHandlers(): WorkflowHandlers;
40
+ declare function useMarketplaceHandlers(): MarketplaceHandlers;
41
+ declare function useIntegrationHandlers(): IntegrationHandlers;
42
+ declare function useAnalyticsHandlers(): AnalyticsHandlers;
43
+ //#endregion
44
+ export { TemplateHandlers, TemplateRuntimeProvider, useAgentHandlers, useAnalyticsHandlers, useCrmHandlers, useIntegrationHandlers, useMarketplaceHandlers, useSaasHandlers, useTemplateEngine, useTemplateHandlers, useWorkflowHandlers };
45
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","names":[],"sources":["../../src/runtime/context.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;AA4Ea,cAAA,gBAAA,CAAgB;EACrB,GAAA,EAAA,WAAA;EACC,IAAA,EAAA,YAAA;EACC,KAAA,EAAA,aAAA;EACG,QAAA,EAAA,gBAAA;EACG,WAAA,EAAA,mBAAA;EACA,WAAA,EAAA,mBAAA;EACF,SAAA,EAAA,iBAAA;EACmB,4BAAA,EAAA,oCAAA;;AAGjB,iBAAA,uBAAA,CAAuB;EAAA,UAAA;EAAA,SAAA;EAAA,IAAA;EAAA;AAAA,CAAA,EAKpC,iBALoC,CAKlB,4BALkB,CAAA,CAAA,EAKW,kBAAA,CAAA,GAAA,CAAA,OALX;AACrC,iBA6Sc,iBAAA,CAAA,CA7Sd,EA6SmC,eA7SnC;AACA,iBAiTc,mBAAA,CAAA,CAjTd,EAiTqC,gBAjTrC;AACA,iBAqTc,cAAA,CAAA,CArTd,EAqTgC,WArThC;AACA,iBAyTc,eAAA,CAAA,CAzTd,EAyTiC,YAzTjC;AACmB,iBA6TL,gBAAA,CAAA,CA7TK,EA6Te,aA7Tf;AAAlB,iBAkUa,mBAAA,CAAA,CAlUb,EAkUoC,gBAlUpC;AAA+C,iBAuUlC,sBAAA,CAAA,CAvUkC,EAuUR,mBAvUQ;AAAA,iBA4UlC,sBAAA,CAAA,CA5UkC,EA4UR,mBA5UQ;AAySlC,iBAwCA,oBAAA,CAAA,CAxCqB,EAwCG,iBAxCY"}
@@ -0,0 +1,328 @@
1
+ 'use client';
2
+
3
+ import { getTemplateEngine } from "./engine.js";
4
+ import { getTemplate } from "./registry.js";
5
+ import { TemplateInstaller } from "./installer.js";
6
+ import "@contractspec/lib.contracts/presentations";
7
+ import { createAgentHandlers } from "@contractspec/example.agent-console";
8
+ import { createSaasHandlers } from "@contractspec/example.saas-boilerplate";
9
+ import { createCrmHandlers } from "@contractspec/example.crm-pipeline";
10
+ import { createWorkflowHandlers } from "@contractspec/example.workflow-system";
11
+ import { createMarketplaceHandlers } from "@contractspec/example.marketplace";
12
+ import { createIntegrationHandlers } from "@contractspec/example.integration-hub";
13
+ import { createAnalyticsHandlers } from "@contractspec/example.analytics-dashboard";
14
+ import { web } from "@contractspec/lib.runtime-sandbox";
15
+ import { useEffect, useMemo, useState } from "react";
16
+ import { ApolloProvider } from "@apollo/client/react";
17
+ import { jsx, jsxs } from "react/jsx-runtime";
18
+ import { createPolicySafeKnowledgeAssistantHandlers } from "@contractspec/example.policy-safe-knowledge-assistant";
19
+ import { TemplateRuntimeContext, useTemplateComponents, useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
20
+
21
+ //#region src/runtime/context.tsx
22
+ const { LocalRuntimeServices } = web;
23
+ function logBootstrapFailure(error) {
24
+ console.error(`
25
+ [TemplateRuntime] Bootstrap Failed
26
+ ==================================
27
+
28
+ The runtime failed to initialize. This usually happens because:
29
+ 1. The PostgreSQL Web environment (pglite) failed to load
30
+ 2. The schema migration failed
31
+ 3. The initial seed data could not be inserted
32
+
33
+ Check the console for specific database errors.
34
+ `.trim(), error);
35
+ }
36
+ /**
37
+ * Template-specific handlers created from the runtime database
38
+ */
39
+ var TemplateHandlers = class {
40
+ crm;
41
+ saas;
42
+ agent;
43
+ workflow;
44
+ marketplace;
45
+ integration;
46
+ analytics;
47
+ policySafeKnowledgeAssistant;
48
+ };
49
+ function TemplateRuntimeProvider({ templateId, projectId = "default-project", lazy = false, children }) {
50
+ const [context, setContext] = useState(null);
51
+ const [error, setError] = useState(null);
52
+ useEffect(() => {
53
+ let mounted = true;
54
+ async function bootstrap() {
55
+ try {
56
+ if (lazy) return;
57
+ const template = getTemplate(templateId);
58
+ if (!template) throw new Error(`Template not found: ${templateId}`);
59
+ const runtime = new LocalRuntimeServices();
60
+ await runtime.init({});
61
+ const installer = new TemplateInstaller({ runtime });
62
+ await installer.install(templateId, { projectId });
63
+ const client = web.createLocalGraphqlClient(runtime);
64
+ const engine = await getTemplateEngine();
65
+ const handlers = new TemplateHandlers();
66
+ handlers.crm = createCrmHandlers(runtime.db);
67
+ handlers.saas = createSaasHandlers(runtime.db);
68
+ handlers.agent = createAgentHandlers(runtime.db);
69
+ handlers.workflow = createWorkflowHandlers(runtime.db);
70
+ handlers.marketplace = createMarketplaceHandlers(runtime.db);
71
+ handlers.integration = createIntegrationHandlers(runtime.db);
72
+ handlers.analytics = createAnalyticsHandlers(runtime.db);
73
+ handlers.policySafeKnowledgeAssistant = createPolicySafeKnowledgeAssistantHandlers(runtime.db);
74
+ const fetchData = async (presentationName) => {
75
+ if (presentationName === "crm-pipeline.dashboard") {
76
+ const [dealsResult, stages] = await Promise.all([handlers.crm.listDeals({
77
+ projectId,
78
+ pipelineId: "pipeline-1",
79
+ limit: 50
80
+ }), handlers.crm.getPipelineStages({ pipelineId: "pipeline-1" })]);
81
+ return {
82
+ data: {
83
+ deals: dealsResult.deals,
84
+ stages,
85
+ summary: {
86
+ total: dealsResult.total,
87
+ totalValue: dealsResult.totalValue
88
+ }
89
+ },
90
+ metadata: {
91
+ total: dealsResult.total,
92
+ timestamp: /* @__PURE__ */ new Date(),
93
+ source: "crm-pipeline"
94
+ }
95
+ };
96
+ }
97
+ if (presentationName === "crm-pipeline.deal.pipeline") {
98
+ const [dealsResult, stages] = await Promise.all([handlers.crm.listDeals({
99
+ projectId,
100
+ pipelineId: "pipeline-1",
101
+ limit: 100
102
+ }), handlers.crm.getPipelineStages({ pipelineId: "pipeline-1" })]);
103
+ return {
104
+ data: {
105
+ deals: dealsResult.deals,
106
+ stages,
107
+ total: dealsResult.total,
108
+ totalValue: dealsResult.totalValue
109
+ },
110
+ metadata: {
111
+ total: dealsResult.total,
112
+ timestamp: /* @__PURE__ */ new Date(),
113
+ source: "crm-pipeline"
114
+ }
115
+ };
116
+ }
117
+ if (presentationName === "saas-boilerplate.dashboard") {
118
+ const [projectsResult, subscription] = await Promise.all([handlers.saas.listProjects({
119
+ projectId,
120
+ limit: 10
121
+ }), handlers.saas.getSubscription({ projectId })]);
122
+ return {
123
+ data: {
124
+ projects: projectsResult.items,
125
+ subscription,
126
+ summary: { totalProjects: projectsResult.total }
127
+ },
128
+ metadata: {
129
+ total: projectsResult.total,
130
+ timestamp: /* @__PURE__ */ new Date(),
131
+ source: "saas-boilerplate"
132
+ }
133
+ };
134
+ }
135
+ if (presentationName === "saas-boilerplate.project.list") {
136
+ const result = await handlers.saas.listProjects({
137
+ projectId,
138
+ limit: 50
139
+ });
140
+ return {
141
+ data: result.items,
142
+ metadata: {
143
+ total: result.total,
144
+ timestamp: /* @__PURE__ */ new Date(),
145
+ source: "saas-boilerplate"
146
+ }
147
+ };
148
+ }
149
+ if (presentationName === "saas-boilerplate.billing.settings") return {
150
+ data: await handlers.saas.getSubscription({ projectId }),
151
+ metadata: {
152
+ timestamp: /* @__PURE__ */ new Date(),
153
+ source: "saas-boilerplate"
154
+ }
155
+ };
156
+ if (presentationName === "agent-console.dashboard") {
157
+ const [agentsResult, runsResult, toolsResult] = await Promise.all([
158
+ handlers.agent.listAgents({
159
+ projectId,
160
+ organizationId: "demo-org",
161
+ limit: 10
162
+ }),
163
+ handlers.agent.listRuns({
164
+ projectId,
165
+ limit: 10
166
+ }),
167
+ handlers.agent.listTools({
168
+ projectId,
169
+ organizationId: "demo-org",
170
+ limit: 10
171
+ })
172
+ ]);
173
+ return {
174
+ data: {
175
+ agents: agentsResult.items,
176
+ runs: runsResult.items,
177
+ tools: toolsResult.items,
178
+ summary: {
179
+ totalAgents: agentsResult.total,
180
+ totalRuns: runsResult.total,
181
+ totalTools: toolsResult.total
182
+ }
183
+ },
184
+ metadata: {
185
+ timestamp: /* @__PURE__ */ new Date(),
186
+ source: "agent-console"
187
+ }
188
+ };
189
+ }
190
+ if (presentationName === "agent-console.agent.list") {
191
+ const result = await handlers.agent.listAgents({
192
+ projectId,
193
+ organizationId: "demo-org",
194
+ limit: 50
195
+ });
196
+ return {
197
+ data: result.items,
198
+ metadata: {
199
+ total: result.total,
200
+ timestamp: /* @__PURE__ */ new Date(),
201
+ source: "agent-console"
202
+ }
203
+ };
204
+ }
205
+ if (presentationName === "agent-console.run.list") {
206
+ const result = await handlers.agent.listRuns({
207
+ projectId,
208
+ limit: 50
209
+ });
210
+ return {
211
+ data: result.items,
212
+ metadata: {
213
+ total: result.total,
214
+ timestamp: /* @__PURE__ */ new Date(),
215
+ source: "agent-console"
216
+ }
217
+ };
218
+ }
219
+ if (presentationName === "agent-console.tool.registry") {
220
+ const result = await handlers.agent.listTools({
221
+ projectId,
222
+ organizationId: "demo-org",
223
+ limit: 50
224
+ });
225
+ return {
226
+ data: result.items,
227
+ metadata: {
228
+ total: result.total,
229
+ timestamp: /* @__PURE__ */ new Date(),
230
+ source: "agent-console"
231
+ }
232
+ };
233
+ }
234
+ console.warn(`No data fetcher found for presentation: ${presentationName}`);
235
+ return {
236
+ data: null,
237
+ metadata: {
238
+ timestamp: /* @__PURE__ */ new Date(),
239
+ source: "unknown"
240
+ }
241
+ };
242
+ };
243
+ if (mounted) setContext({
244
+ template,
245
+ runtime,
246
+ installer,
247
+ client,
248
+ templateId,
249
+ projectId,
250
+ engine,
251
+ handlers,
252
+ fetchData
253
+ });
254
+ } catch (err) {
255
+ logBootstrapFailure(err);
256
+ if (mounted) setError(err instanceof Error ? err : /* @__PURE__ */ new Error("Unknown runtime error"));
257
+ }
258
+ }
259
+ bootstrap();
260
+ return () => {
261
+ mounted = false;
262
+ };
263
+ }, [
264
+ templateId,
265
+ projectId,
266
+ lazy
267
+ ]);
268
+ const components = useTemplateComponents(templateId);
269
+ const contextValue = useMemo(() => {
270
+ if (!context) return null;
271
+ return {
272
+ ...context,
273
+ components
274
+ };
275
+ }, [context, components]);
276
+ if (error) return /* @__PURE__ */ jsxs("div", {
277
+ className: "rounded border border-red-200 bg-red-50 p-4 text-red-500",
278
+ children: [/* @__PURE__ */ jsx("h3", {
279
+ className: "font-bold",
280
+ children: "Runtime Error"
281
+ }), /* @__PURE__ */ jsx("pre", {
282
+ className: "mt-2 overflow-auto text-xs",
283
+ children: error.message
284
+ })]
285
+ });
286
+ if (!contextValue) return /* @__PURE__ */ jsx("div", {
287
+ className: "animate-pulse p-12 text-center text-gray-400",
288
+ children: "Initializing runtime environment..."
289
+ });
290
+ return /* @__PURE__ */ jsx(ApolloProvider, {
291
+ client: contextValue.client,
292
+ children: /* @__PURE__ */ jsx(TemplateRuntimeContext.Provider, {
293
+ value: contextValue,
294
+ children
295
+ })
296
+ });
297
+ }
298
+ function useTemplateEngine() {
299
+ return useTemplateRuntime().engine;
300
+ }
301
+ function useTemplateHandlers() {
302
+ return useTemplateRuntime().handlers;
303
+ }
304
+ function useCrmHandlers() {
305
+ return useTemplateHandlers().crm;
306
+ }
307
+ function useSaasHandlers() {
308
+ return useTemplateHandlers().saas;
309
+ }
310
+ function useAgentHandlers() {
311
+ return useTemplateHandlers().agent;
312
+ }
313
+ function useWorkflowHandlers() {
314
+ return useTemplateHandlers().workflow;
315
+ }
316
+ function useMarketplaceHandlers() {
317
+ return useTemplateHandlers().marketplace;
318
+ }
319
+ function useIntegrationHandlers() {
320
+ return useTemplateHandlers().integration;
321
+ }
322
+ function useAnalyticsHandlers() {
323
+ return useTemplateHandlers().analytics;
324
+ }
325
+
326
+ //#endregion
327
+ export { TemplateHandlers, TemplateRuntimeProvider, useAgentHandlers, useAnalyticsHandlers, useCrmHandlers, useIntegrationHandlers, useMarketplaceHandlers, useSaasHandlers, useTemplateEngine, useTemplateHandlers, useWorkflowHandlers };
328
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","names":[],"sources":["../../src/runtime/context.tsx"],"sourcesContent":["'use client';\n\nimport { type PropsWithChildren, useEffect, useMemo, useState } from 'react';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { web } from '@contractspec/lib.runtime-sandbox';\n\nconst { LocalRuntimeServices } = web;\n\nimport { type TransformEngine } from '@contractspec/lib.contracts/presentations';\n\n// Import handlers from example packages\nimport {\n createCrmHandlers,\n type CrmHandlers,\n} from '@contractspec/example.crm-pipeline';\nimport {\n createSaasHandlers,\n type SaasHandlers,\n} from '@contractspec/example.saas-boilerplate';\nimport {\n createAgentHandlers,\n type AgentHandlers,\n} from '@contractspec/example.agent-console';\nimport {\n createWorkflowHandlers,\n type WorkflowHandlers,\n} from '@contractspec/example.workflow-system';\nimport {\n createMarketplaceHandlers,\n type MarketplaceHandlers,\n} from '@contractspec/example.marketplace';\nimport {\n createIntegrationHandlers,\n type IntegrationHandlers,\n} from '@contractspec/example.integration-hub';\nimport {\n createAnalyticsHandlers,\n type AnalyticsHandlers,\n} from '@contractspec/example.analytics-dashboard';\nimport {\n createPolicySafeKnowledgeAssistantHandlers,\n type PolicySafeKnowledgeAssistantHandlers,\n} from '@contractspec/example.policy-safe-knowledge-assistant';\n\nimport { TemplateInstaller } from './installer';\nimport { getTemplate } from './registry';\nimport { getTemplateEngine } from './engine';\n\nimport {\n TemplateRuntimeContext,\n type TemplateRuntimeContextValue,\n type TemplateRuntimeProviderProps,\n useTemplateRuntime,\n useTemplateComponents,\n} from '@contractspec/lib.example-shared-ui';\n\nfunction logBootstrapFailure(error: unknown) {\n console.error(\n `\n[TemplateRuntime] Bootstrap Failed\n==================================\n\nThe runtime failed to initialize. This usually happens because:\n1. The PostgreSQL Web environment (pglite) failed to load\n2. The schema migration failed\n3. The initial seed data could not be inserted\n\nCheck the console for specific database errors.\n `.trim(),\n error\n );\n}\n\n/**\n * Template-specific handlers created from the runtime database\n */\nexport class TemplateHandlers {\n crm!: CrmHandlers;\n saas!: SaasHandlers;\n agent!: AgentHandlers;\n workflow!: WorkflowHandlers;\n marketplace!: MarketplaceHandlers;\n integration!: IntegrationHandlers;\n analytics!: AnalyticsHandlers;\n policySafeKnowledgeAssistant!: PolicySafeKnowledgeAssistantHandlers;\n}\n\nexport function TemplateRuntimeProvider({\n templateId,\n projectId = 'default-project',\n lazy = false,\n children,\n}: PropsWithChildren<TemplateRuntimeProviderProps>) {\n const [context, setContext] = useState<TemplateRuntimeContextValue | null>(\n null\n );\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n let mounted = true;\n\n async function bootstrap() {\n try {\n if (lazy) return;\n\n // Load definition\n const template = getTemplate(templateId);\n if (!template) {\n throw new Error(`Template not found: ${templateId}`);\n }\n\n // Initialize runtime\n const runtime = new LocalRuntimeServices();\n await runtime.init({\n // In real app, we might persist to IndexedDB\n // dataDir: projectId // If persistence needed\n });\n\n // Initialize installer and run migrations/seeds\n const installer = new TemplateInstaller({ runtime });\n await installer.install(templateId, { projectId });\n\n // Create Apollo Client linked to local schema\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const client = (web as any).createLocalGraphqlClient(runtime);\n\n // Get or create transform engine\n const engine = await getTemplateEngine();\n\n // Initialize Handlers\n const handlers = new TemplateHandlers();\n handlers.crm = createCrmHandlers(runtime.db);\n handlers.saas = createSaasHandlers(runtime.db);\n handlers.agent = createAgentHandlers(runtime.db);\n handlers.workflow = createWorkflowHandlers(runtime.db);\n handlers.marketplace = createMarketplaceHandlers(runtime.db);\n handlers.integration = createIntegrationHandlers(runtime.db);\n handlers.analytics = createAnalyticsHandlers(runtime.db);\n handlers.policySafeKnowledgeAssistant =\n createPolicySafeKnowledgeAssistantHandlers(runtime.db);\n\n // Create data fetcher using the initialized handlers\n const fetchData = async (presentationName: string) => {\n // CRM Pipeline\n if (presentationName === 'crm-pipeline.dashboard') {\n const [dealsResult, stages] = await Promise.all([\n handlers.crm.listDeals({\n projectId,\n pipelineId: 'pipeline-1',\n limit: 50,\n }),\n handlers.crm.getPipelineStages({ pipelineId: 'pipeline-1' }),\n ]);\n return {\n data: {\n deals: dealsResult.deals,\n stages,\n summary: {\n total: dealsResult.total,\n totalValue: dealsResult.totalValue,\n },\n },\n metadata: {\n total: dealsResult.total,\n timestamp: new Date(),\n source: 'crm-pipeline',\n },\n };\n }\n if (presentationName === 'crm-pipeline.deal.pipeline') {\n const [dealsResult, stages] = await Promise.all([\n handlers.crm.listDeals({\n projectId,\n pipelineId: 'pipeline-1',\n limit: 100,\n }),\n handlers.crm.getPipelineStages({ pipelineId: 'pipeline-1' }),\n ]);\n return {\n data: {\n deals: dealsResult.deals,\n stages,\n total: dealsResult.total,\n totalValue: dealsResult.totalValue,\n },\n metadata: {\n total: dealsResult.total,\n timestamp: new Date(),\n source: 'crm-pipeline',\n },\n };\n }\n\n // SaaS Boilerplate\n if (presentationName === 'saas-boilerplate.dashboard') {\n const [projectsResult, subscription] = await Promise.all([\n handlers.saas.listProjects({ projectId, limit: 10 }),\n handlers.saas.getSubscription({ projectId }),\n ]);\n return {\n data: {\n projects: projectsResult.items,\n subscription,\n summary: { totalProjects: projectsResult.total },\n },\n metadata: {\n total: projectsResult.total,\n timestamp: new Date(),\n source: 'saas-boilerplate',\n },\n };\n }\n if (presentationName === 'saas-boilerplate.project.list') {\n const result = await handlers.saas.listProjects({\n projectId,\n limit: 50,\n });\n return {\n data: result.items,\n metadata: {\n total: result.total,\n timestamp: new Date(),\n source: 'saas-boilerplate',\n },\n };\n }\n if (presentationName === 'saas-boilerplate.billing.settings') {\n const subscription = await handlers.saas.getSubscription({\n projectId,\n });\n return {\n data: subscription,\n metadata: { timestamp: new Date(), source: 'saas-boilerplate' },\n };\n }\n\n // Agent Console\n if (presentationName === 'agent-console.dashboard') {\n const [agentsResult, runsResult, toolsResult] = await Promise.all([\n handlers.agent.listAgents({\n projectId,\n organizationId: 'demo-org',\n limit: 10,\n }),\n handlers.agent.listRuns({ projectId, limit: 10 }),\n handlers.agent.listTools({\n projectId,\n organizationId: 'demo-org',\n limit: 10,\n }),\n ]);\n return {\n data: {\n agents: agentsResult.items,\n runs: runsResult.items,\n tools: toolsResult.items,\n summary: {\n totalAgents: agentsResult.total,\n totalRuns: runsResult.total,\n totalTools: toolsResult.total,\n },\n },\n metadata: { timestamp: new Date(), source: 'agent-console' },\n };\n }\n if (presentationName === 'agent-console.agent.list') {\n const result = await handlers.agent.listAgents({\n projectId,\n organizationId: 'demo-org',\n limit: 50,\n });\n return {\n data: result.items,\n metadata: {\n total: result.total,\n timestamp: new Date(),\n source: 'agent-console',\n },\n };\n }\n if (presentationName === 'agent-console.run.list') {\n const result = await handlers.agent.listRuns({\n projectId,\n limit: 50,\n });\n return {\n data: result.items,\n metadata: {\n total: result.total,\n timestamp: new Date(),\n source: 'agent-console',\n },\n };\n }\n if (presentationName === 'agent-console.tool.registry') {\n const result = await handlers.agent.listTools({\n projectId,\n organizationId: 'demo-org',\n limit: 50,\n });\n return {\n data: result.items,\n metadata: {\n total: result.total,\n timestamp: new Date(),\n source: 'agent-console',\n },\n };\n }\n\n // Default fallback\n console.warn(\n `No data fetcher found for presentation: ${presentationName}`\n );\n return {\n data: null,\n metadata: { timestamp: new Date(), source: 'unknown' },\n };\n };\n\n if (mounted) {\n setContext({\n template,\n runtime,\n installer,\n client,\n templateId,\n projectId,\n engine,\n handlers,\n fetchData,\n });\n }\n } catch (err) {\n logBootstrapFailure(err);\n if (mounted) {\n setError(\n err instanceof Error ? err : new Error('Unknown runtime error')\n );\n }\n }\n }\n\n bootstrap();\n\n return () => {\n mounted = false;\n };\n }, [templateId, projectId, lazy]);\n\n // Load registered components\n const components = useTemplateComponents(templateId);\n\n // Combine context with components\n const contextValue = useMemo(() => {\n if (!context) return null;\n return {\n ...context,\n components,\n };\n }, [context, components]);\n\n if (error) {\n return (\n <div className=\"rounded border border-red-200 bg-red-50 p-4 text-red-500\">\n <h3 className=\"font-bold\">Runtime Error</h3>\n <pre className=\"mt-2 overflow-auto text-xs\">{error.message}</pre>\n </div>\n );\n }\n\n if (!contextValue) {\n return (\n <div className=\"animate-pulse p-12 text-center text-gray-400\">\n Initializing runtime environment...\n </div>\n );\n }\n\n return (\n <ApolloProvider client={contextValue.client}>\n <TemplateRuntimeContext.Provider value={contextValue}>\n {children}\n </TemplateRuntimeContext.Provider>\n </ApolloProvider>\n );\n}\n\n// Hook to access the TransformEngine for rendering presentations\nexport function useTemplateEngine(): TransformEngine {\n return useTemplateRuntime().engine;\n}\n\n// Hook to access the database-backed template handlers\nexport function useTemplateHandlers(): TemplateHandlers {\n return useTemplateRuntime<TemplateHandlers>().handlers;\n}\n\n// Hook to access CRM-specific handlers\nexport function useCrmHandlers(): CrmHandlers {\n return useTemplateHandlers().crm;\n}\n\n// Hook to access SaaS-specific handlers\nexport function useSaasHandlers(): SaasHandlers {\n return useTemplateHandlers().saas;\n}\n\n// Hook to access Agent Console-specific handlers\nexport function useAgentHandlers(): AgentHandlers {\n return useTemplateHandlers().agent;\n}\n\n// Hook to access Workflow-specific handlers\nexport function useWorkflowHandlers(): WorkflowHandlers {\n return useTemplateHandlers().workflow;\n}\n\n// Hook to access Marketplace-specific handlers\nexport function useMarketplaceHandlers(): MarketplaceHandlers {\n return useTemplateHandlers().marketplace;\n}\n\n// Hook to access Integration Hub-specific handlers\nexport function useIntegrationHandlers(): IntegrationHandlers {\n return useTemplateHandlers().integration;\n}\n\n// Hook to access Analytics Dashboard-specific handlers\nexport function useAnalyticsHandlers(): AnalyticsHandlers {\n return useTemplateHandlers().analytics;\n}\n\n// End of file\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,EAAE,yBAAyB;AAkDjC,SAAS,oBAAoB,OAAgB;AAC3C,SAAQ,MACN;;;;;;;;;;MAUE,MAAM,EACR,MACD;;;;;AAMH,IAAa,mBAAb,MAA8B;CAC5B;CACA;CACA;CACA;CACA;CACA;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+
5
+ /**
6
+ * Create a TransformEngine configured for template rendering
7
+ */
8
+ declare function createTemplateTransformEngine(): TransformEngine;
9
+ /**
10
+ * Get or create the shared template engine instance
11
+ */
12
+ declare function getTemplateEngine(): TransformEngine;
13
+ /**
14
+ * Reset the shared engine (useful for testing)
15
+ */
16
+ declare function resetTemplateEngine(): void;
17
+ //#endregion
18
+ export { createTemplateTransformEngine, getTemplateEngine, resetTemplateEngine };
19
+ //# sourceMappingURL=engine.d.ts.map