@limo-labs/deity 0.2.0-alpha.0 → 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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ZodSchema, z } from 'zod';
2
- import { V as Validator, T as Tool, A as AgentNode, P as PromptNode, E as ExecutionContext$1, S as SystemNode, U as UserNode, L as LLMLoopResult$1, O as ObserveNode, R as ResultNode, a as ValidationRules, b as ValidateNode, c as RetryNode, d as AgentComponent, M as Message, e as ValidationResult$1, f as LLMAdapter, G as GenerationConfig, g as ExecutionNode, W as WorkflowConfig, h as StateStore, i as TraceLogger, j as TraceEntry, k as ExecutionStats, C as ConversationManager, l as LimoMemoryManager, m as UIUpdateBridge, n as SessionStore, o as ConversationConfig, p as MemoryConfig, q as SessionConfig } from './jsx-dev-runtime-CKrGWO-8.js';
3
- export { r as ASTNode, J as JSXComponent, s as JSXElementType, t as JSXProps, u as LLMLoopState, v as LLMResponse, w as MessageRole, x as ToolCall, y as ToolResult, z as ValidationRule, B as isAgentNode, D as isObserveNode, F as isPromptNode, H as isResultNode, I as isRetryNode, K as isSystemNode, N as isUserNode, Q as isValidateNode } from './jsx-dev-runtime-CKrGWO-8.js';
2
+ import { V as Validator, T as ToolSpec, A as AgentNode, P as PromptNode, E as ExecutionContext$1, S as SystemNode, U as UserNode, L as LLMLoopResult, O as ObserveNode, R as ResultNode, a as ValidationRules, b as ValidateNode, c as RetryNode, d as ToolDefNode, e as ToolsNode, f as ToolRefNode, W as WorkflowChildNode, g as WorkflowSequenceNode, h as WorkflowParallelNode, i as WorkflowConditionalNode, j as WorkflowLoopNode, k as WorkflowForEachNode, l as WorkflowNode, m as AgentComponent, n as WorkflowConfig, o as ExecutionNode, p as ASTNode, M as Message, q as ValidationResult$1, r as LLMAdapter$1, G as GenerationConfig$1, s as StateStore$1, t as TraceLogger, u as TraceEntry, v as ExecutionStats, C as ConversationManager, w as LimoMemoryManager, x as UIUpdateBridge, y as SessionStore, z as ConversationConfig, B as MemoryConfig, D as SessionConfig } from './jsx-dev-runtime-Dg782FK5.js';
3
+ export { J as JSXComponent, F as JSXElementType, H as JSXProps, I as LLMLoopState, K as LLMResponse, N as MessageRole, Q as TemplatePart, X as ToolCall, Y as ToolResult, Z as ValidationRule, _ as isAgentNode, $ as isObserveNode, a0 as isPromptNode, a1 as isResultNode, a2 as isRetryNode, a3 as isSystemNode, a4 as isToolDefNode, a5 as isToolRefNode, a6 as isToolsNode, a7 as isUserNode, a8 as isValidateNode, a9 as isWorkflowConditionalNode, aa as isWorkflowForEachNode, ab as isWorkflowLoopNode, ac as isWorkflowNode, ad as isWorkflowParallelNode, ae as isWorkflowSequenceNode } from './jsx-dev-runtime-Dg782FK5.js';
4
4
 
5
5
  /**
6
6
  * Deity TSX - Agent Component
@@ -35,9 +35,9 @@ interface AgentProps<I = unknown, O = unknown> {
35
35
  loopValidator?: Validator;
36
36
  /** Optional LLM loop configuration */
37
37
  loopConfig?: LLMLoopConfig$1;
38
- /** Optional tool definitions */
39
- tools?: Tool[];
40
- /** Child components (Prompt, Observe, Result, Validate, Retry) */
38
+ /** Optional tool definitions (backward compatible - can also use <Tools> child) */
39
+ tools?: ToolSpec[];
40
+ /** Child components (Tools, Prompt, Observe, Result, Validate, Retry) */
41
41
  children?: any[];
42
42
  }
43
43
  /**
@@ -47,11 +47,19 @@ interface AgentProps<I = unknown, O = unknown> {
47
47
  * - Identity (id, description, tags)
48
48
  * - IO schemas (input/output)
49
49
  * - Behavior specification (Prompt, Observe, Result, Validate, Retry)
50
+ * - Tool definitions (via props.tools or <Tools> child)
50
51
  *
51
52
  * @example
52
53
  * ```tsx
53
54
  * export const MyAgent = (
54
55
  * <Agent id="my-agent" input={InputSchema} output={OutputSchema}>
56
+ * <Tools>
57
+ * <MemoryStore />
58
+ * <MemoryRecall />
59
+ * <Tool name="my_tool" description="..." input={Schema}>
60
+ * {async (params) => ({ ... })}
61
+ * </Tool>
62
+ * </Tools>
55
63
  * <Prompt>
56
64
  * <System source="file:./prompt.md" />
57
65
  * <User>{(ctx) => `Task: ${ctx.inputs.task}`}</User>
@@ -241,7 +249,7 @@ interface ObserveProps {
241
249
  /**
242
250
  * Alternative to children (same as children)
243
251
  */
244
- compute?: (llmResult: LLMLoopResult$1) => Record<string, unknown> | Promise<Record<string, unknown>>;
252
+ compute?: (llmResult: LLMLoopResult) => Record<string, unknown> | Promise<Record<string, unknown>>;
245
253
  }
246
254
  /**
247
255
  * Observe Component
@@ -303,7 +311,7 @@ interface ResultProps<O = unknown> {
303
311
  /**
304
312
  * Alternative to children (same as children)
305
313
  */
306
- extract?: (ctx: ExecutionContext$1, llmResult: LLMLoopResult$1, observed: Record<string, unknown>) => O | Promise<O>;
314
+ extract?: (ctx: ExecutionContext$1, llmResult: LLMLoopResult, observed: Record<string, unknown>) => O | Promise<O>;
307
315
  }
308
316
  /**
309
317
  * Result Component
@@ -446,6 +454,511 @@ interface RetryProps {
446
454
  */
447
455
  declare function Retry(props?: RetryProps): RetryNode;
448
456
 
457
+ /**
458
+ * Deity TSX - Tools Components
459
+ *
460
+ * Container and definition components for declaring tools in JSX.
461
+ *
462
+ * @example
463
+ * ```tsx
464
+ * <Agent id="my-agent" input={InputSchema} output={OutputSchema}>
465
+ * <Tools>
466
+ * <MemoryStore />
467
+ * <MemoryRecall />
468
+ * <Tool name="greet" description="Greet user" input={GreetSchema}>
469
+ * {async (params) => ({ success: true, data: { message: `Hello ${params.name}` } })}
470
+ * </Tool>
471
+ * </Tools>
472
+ * <Prompt>...</Prompt>
473
+ * <Result>...</Result>
474
+ * </Agent>
475
+ * ```
476
+ */
477
+
478
+ /**
479
+ * Tools Component Props
480
+ */
481
+ interface ToolsProps {
482
+ /** Child ToolDef/Tool components */
483
+ children?: any[];
484
+ }
485
+ /**
486
+ * Tools Component
487
+ *
488
+ * Container for tool definitions within an Agent.
489
+ * All tools (including memory tools) are declared as children.
490
+ */
491
+ declare function Tools(props: ToolsProps): ToolsNode;
492
+ /**
493
+ * ToolDef Component Props
494
+ */
495
+ interface ToolDefProps {
496
+ /** The tool object to register */
497
+ tool: ToolSpec;
498
+ /** Children (not used, but accepted for JSX compatibility) */
499
+ children?: any[];
500
+ }
501
+ /**
502
+ * ToolDef Component
503
+ *
504
+ * Wraps a single Tool object as a JSX element.
505
+ * Must be used inside a <Tools> container.
506
+ *
507
+ * Low-level escape hatch for pre-built ToolSpec objects.
508
+ * Prefer using the declarative <Tool> component for new tools.
509
+ */
510
+ declare function ToolDef(props: ToolDefProps): ToolDefNode;
511
+ /**
512
+ * Tool Component Props
513
+ *
514
+ * Declarative tool definition using TSX syntax.
515
+ *
516
+ * @example
517
+ * ```tsx
518
+ * <Tool name="file_list" description="List files" input={FileListInputSchema}>
519
+ * {async (params) => {
520
+ * const files = await glob(params.pattern);
521
+ * return { success: true, data: { files } };
522
+ * }}
523
+ * </Tool>
524
+ *
525
+ * // Or using the execute prop instead of children:
526
+ * <Tool
527
+ * name="file_list"
528
+ * description="List files"
529
+ * input={FileListInputSchema}
530
+ * execute={async (params) => ({ success: true, data: { files: [] } })}
531
+ * />
532
+ * ```
533
+ */
534
+ interface ToolProps<TInput = unknown> {
535
+ /** Tool name (unique identifier used by LLM) */
536
+ name: string;
537
+ /** Description (LLM uses this to decide when to invoke the tool) */
538
+ description: string;
539
+ /** Input validation schema (Zod) */
540
+ input: ZodSchema<TInput>;
541
+ /**
542
+ * Execute function (alternative to children).
543
+ * Use either `execute` prop or a function child, not both.
544
+ */
545
+ execute?: (input: TInput, ctx?: ExecutionContext$1) => any;
546
+ /** Function child that implements tool execution */
547
+ children?: any[];
548
+ }
549
+ /**
550
+ * Tool Component
551
+ *
552
+ * Declarative tool definition as a first-class TSX component.
553
+ * Produces a `ToolDefNode` (same as `<ToolDef>`), so the
554
+ * compiler and executor require zero changes.
555
+ *
556
+ * @example
557
+ * ```tsx
558
+ * <Tool name="file_list" description="List files" input={FileListInputSchema}>
559
+ * {async (params: FileListInput) => {
560
+ * const files = await glob(params.pattern, { cwd: rootPath });
561
+ * return { success: true, data: { files, total: files.length } };
562
+ * }}
563
+ * </Tool>
564
+ * ```
565
+ */
566
+ declare function Tool<TInput = unknown>(props: ToolProps<TInput>): ToolDefNode;
567
+
568
+ /**
569
+ * Deity TSX - ToolRef Component
570
+ *
571
+ * Allows referencing tool names in prompt text in a type-safe, refactoring-friendly way.
572
+ */
573
+
574
+ /**
575
+ * ToolRef target type
576
+ *
577
+ * Can be:
578
+ * - A tool component function with .toolName static property
579
+ * - A ToolSpec object with .name property
580
+ * - A plain string tool ID
581
+ */
582
+ type ToolRefTarget = {
583
+ toolName: string;
584
+ } | {
585
+ (): ToolDefNode;
586
+ toolName: string;
587
+ } | ToolSpec | string;
588
+ /**
589
+ * ToolRef Component Props
590
+ */
591
+ interface ToolRefProps {
592
+ /**
593
+ * Tool reference
594
+ *
595
+ * Can be:
596
+ * - Tool component with .toolName: `<ToolRef tool={MemoryStore} />`
597
+ * - ToolSpec object: `<ToolRef tool={myToolSpec} />`
598
+ * - String ID: `<ToolRef tool="memory_store" />`
599
+ */
600
+ tool: ToolRefTarget;
601
+ }
602
+ /**
603
+ * ToolRef Component
604
+ *
605
+ * Inserts a tool name reference into prompt text. The reference is resolved
606
+ * at compile time to the tool's runtime ID.
607
+ *
608
+ * This provides type-safe, refactor-friendly tool references that stay in sync
609
+ * with the <Tools> tree, unlike hard-coded string IDs.
610
+ *
611
+ * @example
612
+ * ```tsx
613
+ * import { MemoryStore } from '@limo-labs/deity-tools';
614
+ *
615
+ * <User>
616
+ * Use <ToolRef tool={MemoryStore} /> to save your findings.
617
+ * </User>
618
+ * // Compiles to: "Use memory_store to save your findings."
619
+ * ```
620
+ *
621
+ * @example
622
+ * ```tsx
623
+ * // With a custom tool
624
+ * const myTool = createTool({ name: 'my_tool', ... });
625
+ *
626
+ * <User>
627
+ * Call <ToolRef tool={myTool} /> when ready.
628
+ * </User>
629
+ * // Compiles to: "Call my_tool when ready."
630
+ * ```
631
+ *
632
+ * @example
633
+ * ```tsx
634
+ * // Direct string (for backwards compatibility)
635
+ * <User>
636
+ * Use <ToolRef tool="memory_store" /> for persistence.
637
+ * </User>
638
+ * ```
639
+ */
640
+ declare function ToolRef(props: ToolRefProps): ToolRefNode;
641
+
642
+ /**
643
+ * Deity TSX - Sequence Component
644
+ *
645
+ * Execute child nodes in sequential order.
646
+ */
647
+
648
+ /**
649
+ * Sequence Component Props
650
+ */
651
+ interface SequenceProps {
652
+ /** Child workflow nodes (Agents or other workflow structures) */
653
+ children?: WorkflowChildNode[] | any[];
654
+ }
655
+ /**
656
+ * Sequence Component
657
+ *
658
+ * Executes child nodes in sequential order.
659
+ * Each child completes before the next one starts.
660
+ *
661
+ * @example
662
+ * ```tsx
663
+ * <Sequence>
664
+ * <Agent1 />
665
+ * <Agent2 />
666
+ * <Agent3 />
667
+ * </Sequence>
668
+ * ```
669
+ */
670
+ declare function Sequence(props: SequenceProps): WorkflowSequenceNode;
671
+
672
+ /**
673
+ * Deity TSX - Parallel Component
674
+ *
675
+ * Execute child nodes concurrently.
676
+ */
677
+
678
+ /**
679
+ * Parallel Component Props
680
+ */
681
+ interface ParallelProps {
682
+ /** Child workflow nodes (Agents or other workflow structures) */
683
+ children?: WorkflowChildNode[] | any[];
684
+ }
685
+ /**
686
+ * Parallel Component
687
+ *
688
+ * Executes child nodes concurrently (in parallel).
689
+ * All children start simultaneously and the node completes when all children complete.
690
+ *
691
+ * @example
692
+ * ```tsx
693
+ * <Parallel>
694
+ * <SecurityScanAgent />
695
+ * <PerformanceAnalysisAgent />
696
+ * <CodeQualityAgent />
697
+ * </Parallel>
698
+ * ```
699
+ */
700
+ declare function Parallel(props: ParallelProps): WorkflowParallelNode;
701
+
702
+ /**
703
+ * Deity TSX - Conditional Component
704
+ *
705
+ * Execute child nodes based on a condition.
706
+ */
707
+
708
+ /**
709
+ * Conditional Component Props
710
+ */
711
+ interface ConditionalProps {
712
+ /** Condition function (true = first child, false = second child) */
713
+ condition: (ctx: ExecutionContext$1) => boolean | Promise<boolean>;
714
+ /** Child workflow nodes (1-2 children: true branch required, false branch optional) */
715
+ children?: [WorkflowChildNode] | [WorkflowChildNode, WorkflowChildNode] | any[];
716
+ }
717
+ /**
718
+ * Conditional Component
719
+ *
720
+ * Executes child nodes based on a condition function.
721
+ * - First child: executed when condition returns true
722
+ * - Second child (optional): executed when condition returns false
723
+ *
724
+ * @example
725
+ * ```tsx
726
+ * <Conditional condition={(ctx) => ctx.getOutput('check').needsAnalysis}>
727
+ * <DeepAnalysisAgent />
728
+ * <QuickSummaryAgent />
729
+ * </Conditional>
730
+ * ```
731
+ *
732
+ * @example With only true branch
733
+ * ```tsx
734
+ * <Conditional condition={(ctx) => ctx.getOutput('check').isValid}>
735
+ * <ProcessAgent />
736
+ * </Conditional>
737
+ * ```
738
+ */
739
+ declare function Conditional(props: ConditionalProps): WorkflowConditionalNode;
740
+
741
+ /**
742
+ * Deity TSX - Loop Component
743
+ *
744
+ * Execute a child node N times.
745
+ */
746
+
747
+ /**
748
+ * Loop Component Props
749
+ */
750
+ interface LoopProps {
751
+ /** Number of iterations */
752
+ iterations: number;
753
+ /** Single child workflow node (Agent or workflow structure) */
754
+ children?: WorkflowChildNode | any;
755
+ }
756
+ /**
757
+ * Loop Component
758
+ *
759
+ * Executes a single child node N times.
760
+ * The child has access to iteration context via ctx.iteration.
761
+ *
762
+ * @example
763
+ * ```tsx
764
+ * <Loop iterations={3}>
765
+ * <RefineAgent />
766
+ * </Loop>
767
+ * ```
768
+ */
769
+ declare function Loop(props: LoopProps): WorkflowLoopNode;
770
+
771
+ /**
772
+ * Deity TSX - ForEach Component
773
+ *
774
+ * Execute a child node for each item in a dynamic array.
775
+ */
776
+
777
+ /**
778
+ * Item injection modes for ForEach
779
+ */
780
+ type ItemMode = 'merge' | 'replace' | 'property';
781
+ /**
782
+ * Error handling modes for ForEach
783
+ */
784
+ type ErrorMode = 'stop' | 'continue' | 'skip';
785
+ /**
786
+ * ForEach Component Props
787
+ */
788
+ interface ForEachProps<TItem = unknown> {
789
+ /**
790
+ * Array of items to iterate over, or function to dynamically resolve items
791
+ * Function can be sync or async
792
+ */
793
+ items: TItem[] | ((ctx: ExecutionContext$1) => TItem[] | Promise<TItem[]>);
794
+ /**
795
+ * How to inject the current item into context inputs
796
+ * - 'property' (default): Inject as ctx.inputs[itemKey]
797
+ * - 'merge': Spread item properties into ctx.inputs (for object items)
798
+ * - 'replace': Replace entire ctx.inputs with item
799
+ */
800
+ itemMode?: ItemMode;
801
+ /**
802
+ * Key name for 'property' mode (default: 'currentItem')
803
+ */
804
+ itemKey?: string;
805
+ /**
806
+ * Error handling mode
807
+ * - 'stop' (default): Fail-fast, throw on first error
808
+ * - 'continue': Collect errors, don't stop loop
809
+ * - 'skip': Silent failure, increment failure count only
810
+ */
811
+ errorMode?: ErrorMode;
812
+ /**
813
+ * Whether to collect results from each iteration (default: true)
814
+ * Set to false for side-effect-only operations to optimize memory
815
+ */
816
+ collectResults?: boolean;
817
+ /** Single child workflow node (Agent or workflow structure) */
818
+ children?: WorkflowChildNode | any;
819
+ }
820
+ /**
821
+ * ForEach Component
822
+ *
823
+ * Executes a single child node for each item in an array.
824
+ * The child has access to iteration context via ctx.iteration and the current item
825
+ * via the injection mode specified.
826
+ *
827
+ * @example
828
+ * ```tsx
829
+ * // Static array with property injection
830
+ * <ForEach items={['task1', 'task2', 'task3']} itemKey="task">
831
+ * <ProcessAgent />
832
+ * </ForEach>
833
+ *
834
+ * // Dynamic array with merge injection
835
+ * <ForEach
836
+ * items={(ctx) => ctx.getOutput('planner').tasks}
837
+ * itemMode="merge"
838
+ * errorMode="continue"
839
+ * collectResults={false}
840
+ * >
841
+ * <AnalystAgent />
842
+ * </ForEach>
843
+ * ```
844
+ */
845
+ declare function ForEach<TItem = unknown>(props: ForEachProps<TItem>): WorkflowForEachNode;
846
+
847
+ /**
848
+ * Deity TSX - Workflow Component
849
+ *
850
+ * Top-level container for defining a complete workflow.
851
+ */
852
+
853
+ /**
854
+ * LLM Adapter interface (minimal definition for type safety)
855
+ */
856
+ interface LLMAdapter {
857
+ generate(messages: any[], config?: any): Promise<any>;
858
+ }
859
+ /**
860
+ * Generation Config (minimal definition)
861
+ */
862
+ interface GenerationConfig {
863
+ temperature?: number;
864
+ maxTokens?: number;
865
+ topP?: number;
866
+ stopSequences?: string[];
867
+ }
868
+ /**
869
+ * State Store interface (minimal definition)
870
+ */
871
+ interface StateStore {
872
+ get(key: string): Promise<unknown>;
873
+ set(key: string, value: unknown): Promise<void>;
874
+ }
875
+ /**
876
+ * Workflow Enhancement Options
877
+ */
878
+ interface WorkflowEnhancements {
879
+ /** Conversation management */
880
+ conversation?: {
881
+ maxTokens: number;
882
+ pruneThreshold: number;
883
+ messageRetentionPolicy?: unknown;
884
+ };
885
+ /** Memory management */
886
+ memory?: {
887
+ coreBudget: {
888
+ maxItems: number;
889
+ maxTotalSize: number;
890
+ };
891
+ detailedBudget?: {
892
+ maxItems: number;
893
+ maxTotalSize: number;
894
+ };
895
+ };
896
+ /** Session persistence */
897
+ session?: {
898
+ directory: string;
899
+ autoSave?: boolean;
900
+ };
901
+ /** UI updates */
902
+ ui?: any;
903
+ /** Application state store (isolated from AI memory) */
904
+ appState?: any;
905
+ }
906
+ /**
907
+ * Workflow Component Props
908
+ */
909
+ interface WorkflowProps {
910
+ /** Workflow name (required) */
911
+ name: string;
912
+ /** Optional description */
913
+ description?: string;
914
+ /** Default LLM model configuration */
915
+ defaultModel?: {
916
+ adapter: LLMAdapter;
917
+ config?: GenerationConfig;
918
+ };
919
+ /** Optional state storage */
920
+ state?: {
921
+ store: StateStore;
922
+ };
923
+ /** Optional enhancements (conversation, memory, session, UI) */
924
+ enhancements?: WorkflowEnhancements;
925
+ /** Single child representing the workflow graph */
926
+ children?: WorkflowChildNode | any;
927
+ }
928
+ /**
929
+ * Workflow Component
930
+ *
931
+ * Top-level container for defining a complete workflow.
932
+ * Must contain exactly one child representing the workflow execution graph.
933
+ *
934
+ * @example
935
+ * ```tsx
936
+ * const workflow = Workflow({
937
+ * name: 'my-workflow',
938
+ * defaultModel: { adapter: llmAdapter },
939
+ * children: Sequence({
940
+ * children: [Agent1, Agent2, Agent3]
941
+ * })
942
+ * });
943
+ * ```
944
+ *
945
+ * @example With enhancements
946
+ * ```tsx
947
+ * const workflow = Workflow({
948
+ * name: 'enhanced-workflow',
949
+ * defaultModel: { adapter: llmAdapter },
950
+ * enhancements: {
951
+ * conversation: { maxTokens: 8000, pruneThreshold: 6000 },
952
+ * memory: {
953
+ * coreBudget: { maxItems: 10, maxTotalSize: 8192 }
954
+ * }
955
+ * },
956
+ * children: MyAgent
957
+ * });
958
+ * ```
959
+ */
960
+ declare function Workflow(props: WorkflowProps): WorkflowNode;
961
+
449
962
  /**
450
963
  * Deity TSX - AST Compiler
451
964
  *
@@ -492,7 +1005,53 @@ declare function compileAgent<I = unknown, O = unknown>(ast: AgentNode<I, O>): A
492
1005
  *
493
1006
  * Extracts observations from LLM loop result.
494
1007
  */
495
- type ObserveFunction = (llmResult: LLMLoopResult$1) => Promise<Record<string, unknown>>;
1008
+ type ObserveFunction = (llmResult: LLMLoopResult) => Promise<Record<string, unknown>>;
1009
+
1010
+ /**
1011
+ * Deity TSX - Workflow Compiler
1012
+ *
1013
+ * Compiles WorkflowNode AST into executable WorkflowConfig.
1014
+ */
1015
+
1016
+ /**
1017
+ * Compile Workflow AST to WorkflowConfig
1018
+ *
1019
+ * This is the main entry point for compiling a complete workflow.
1020
+ *
1021
+ * @param ast - Workflow AST node
1022
+ * @returns Executable WorkflowConfig that can be passed to runWorkflow()
1023
+ *
1024
+ * @example
1025
+ * ```typescript
1026
+ * const MyWorkflow = Workflow({
1027
+ * name: 'my-workflow',
1028
+ * defaultModel: { adapter: llmAdapter },
1029
+ * children: Sequence({
1030
+ * children: [Agent1, Agent2, Agent3]
1031
+ * })
1032
+ * });
1033
+ *
1034
+ * const config = compileWorkflow(MyWorkflow);
1035
+ * const result = await runWorkflow(config, inputs);
1036
+ * ```
1037
+ */
1038
+ declare function compileWorkflow(ast: WorkflowNode): WorkflowConfig;
1039
+
1040
+ /**
1041
+ * Deity TSX - Workflow Node Compiler
1042
+ *
1043
+ * Compiles workflow structure AST nodes into ExecutionNode instances.
1044
+ */
1045
+
1046
+ /**
1047
+ * Compile a workflow child node (Agent or workflow structure) to ExecutionNode
1048
+ *
1049
+ * This is the main dispatcher that routes to the appropriate compiler.
1050
+ *
1051
+ * @param node - Workflow child node (Agent, Sequence, Parallel, Conditional, Loop, ForEach)
1052
+ * @returns ExecutionNode that can be executed by the runtime
1053
+ */
1054
+ declare function compileWorkflowNode(node: WorkflowChildNode): ExecutionNode;
496
1055
 
497
1056
  /**
498
1057
  * Deity TSX - Observe Utilities
@@ -531,7 +1090,7 @@ declare class ObserveUtils {
531
1090
  * </Observe>
532
1091
  * ```
533
1092
  */
534
- static countToolCalls(llmResult: LLMLoopResult$1): number;
1093
+ static countToolCalls(llmResult: LLMLoopResult): number;
535
1094
  /**
536
1095
  * Count tool calls by name
537
1096
  *
@@ -547,7 +1106,7 @@ declare class ObserveUtils {
547
1106
  * </Observe>
548
1107
  * ```
549
1108
  */
550
- static countToolCallsByName(llmResult: LLMLoopResult$1, name: string): number;
1109
+ static countToolCallsByName(llmResult: LLMLoopResult, name: string): number;
551
1110
  /**
552
1111
  * Count tool calls matching filter
553
1112
  *
@@ -563,7 +1122,7 @@ declare class ObserveUtils {
563
1122
  * </Observe>
564
1123
  * ```
565
1124
  */
566
- static countToolCallsWhere(llmResult: LLMLoopResult$1, filter: ToolCallFilter): number;
1125
+ static countToolCallsWhere(llmResult: LLMLoopResult, filter: ToolCallFilter): number;
567
1126
  /**
568
1127
  * Get list of unique tool names called
569
1128
  *
@@ -576,7 +1135,7 @@ declare class ObserveUtils {
576
1135
  * </Observe>
577
1136
  * ```
578
1137
  */
579
- static getToolNames(llmResult: LLMLoopResult$1): string[];
1138
+ static getToolNames(llmResult: LLMLoopResult): string[];
580
1139
  /**
581
1140
  * Count occurrences of each tool
582
1141
  *
@@ -590,7 +1149,7 @@ declare class ObserveUtils {
590
1149
  * </Observe>
591
1150
  * ```
592
1151
  */
593
- static getToolFrequency(llmResult: LLMLoopResult$1): Record<string, number>;
1152
+ static getToolFrequency(llmResult: LLMLoopResult): Record<string, number>;
594
1153
  /**
595
1154
  * Check if specific tool was called
596
1155
  *
@@ -603,7 +1162,7 @@ declare class ObserveUtils {
603
1162
  * </Observe>
604
1163
  * ```
605
1164
  */
606
- static hasToolCall(llmResult: LLMLoopResult$1, name: string): boolean;
1165
+ static hasToolCall(llmResult: LLMLoopResult, name: string): boolean;
607
1166
  /**
608
1167
  * Check if any tool matching filter was called
609
1168
  *
@@ -619,7 +1178,7 @@ declare class ObserveUtils {
619
1178
  * </Observe>
620
1179
  * ```
621
1180
  */
622
- static hasToolCallWhere(llmResult: LLMLoopResult$1, filter: ToolCallFilter): boolean;
1181
+ static hasToolCallWhere(llmResult: LLMLoopResult, filter: ToolCallFilter): boolean;
623
1182
  /**
624
1183
  * Get content length
625
1184
  *
@@ -632,7 +1191,7 @@ declare class ObserveUtils {
632
1191
  * </Observe>
633
1192
  * ```
634
1193
  */
635
- static getContentLength(llmResult: LLMLoopResult$1): number;
1194
+ static getContentLength(llmResult: LLMLoopResult): number;
636
1195
  /**
637
1196
  * Count successful tool calls
638
1197
  *
@@ -649,7 +1208,7 @@ declare class ObserveUtils {
649
1208
  * </Observe>
650
1209
  * ```
651
1210
  */
652
- static countSuccessfulCalls(llmResult: LLMLoopResult$1): number;
1211
+ static countSuccessfulCalls(llmResult: LLMLoopResult): number;
653
1212
  /**
654
1213
  * Count failed tool calls
655
1214
  *
@@ -666,7 +1225,7 @@ declare class ObserveUtils {
666
1225
  * </Observe>
667
1226
  * ```
668
1227
  */
669
- static countFailedCalls(_llmResult: LLMLoopResult$1): number;
1228
+ static countFailedCalls(_llmResult: LLMLoopResult): number;
670
1229
  /**
671
1230
  * Get tool call arguments
672
1231
  *
@@ -685,7 +1244,7 @@ declare class ObserveUtils {
685
1244
  * </Observe>
686
1245
  * ```
687
1246
  */
688
- static getToolArguments(llmResult: LLMLoopResult$1, name: string): any[];
1247
+ static getToolArguments(llmResult: LLMLoopResult, name: string): any[];
689
1248
  /**
690
1249
  * Get first tool call matching name
691
1250
  *
@@ -704,7 +1263,7 @@ declare class ObserveUtils {
704
1263
  * </Observe>
705
1264
  * ```
706
1265
  */
707
- static findToolCall(llmResult: LLMLoopResult$1, name: string): any | null;
1266
+ static findToolCall(llmResult: LLMLoopResult, name: string): any | null;
708
1267
  /**
709
1268
  * Get all tool calls matching filter
710
1269
  *
@@ -723,7 +1282,7 @@ declare class ObserveUtils {
723
1282
  * </Observe>
724
1283
  * ```
725
1284
  */
726
- static filterToolCalls(llmResult: LLMLoopResult$1, filter: ToolCallFilter): any[];
1285
+ static filterToolCalls(llmResult: LLMLoopResult, filter: ToolCallFilter): any[];
727
1286
  /**
728
1287
  * Check if content contains text
729
1288
  *
@@ -736,7 +1295,7 @@ declare class ObserveUtils {
736
1295
  * </Observe>
737
1296
  * ```
738
1297
  */
739
- static contentContains(llmResult: LLMLoopResult$1, text: string): boolean;
1298
+ static contentContains(llmResult: LLMLoopResult, text: string): boolean;
740
1299
  /**
741
1300
  * Check if content matches regex
742
1301
  *
@@ -749,7 +1308,7 @@ declare class ObserveUtils {
749
1308
  * </Observe>
750
1309
  * ```
751
1310
  */
752
- static contentMatches(llmResult: LLMLoopResult$1, regex: RegExp): boolean;
1311
+ static contentMatches(llmResult: LLMLoopResult, regex: RegExp): boolean;
753
1312
  /**
754
1313
  * Calculate success rate
755
1314
  *
@@ -762,7 +1321,7 @@ declare class ObserveUtils {
762
1321
  * </Observe>
763
1322
  * ```
764
1323
  */
765
- static getSuccessRate(llmResult: LLMLoopResult$1): number;
1324
+ static getSuccessRate(llmResult: LLMLoopResult): number;
766
1325
  }
767
1326
 
768
1327
  /**
@@ -799,7 +1358,7 @@ declare class ResultUtils {
799
1358
  * </Result>
800
1359
  * ```
801
1360
  */
802
- static extractJSON<T = any>(llmResult: LLMLoopResult$1): T;
1361
+ static extractJSON<T = any>(llmResult: LLMLoopResult): T;
803
1362
  /**
804
1363
  * Extract JSON with Zod schema validation
805
1364
  *
@@ -818,7 +1377,7 @@ declare class ResultUtils {
818
1377
  * </Result>
819
1378
  * ```
820
1379
  */
821
- static extractWithSchema<T extends z.ZodType>(llmResult: LLMLoopResult$1, schema: T): z.infer<T>;
1380
+ static extractWithSchema<T extends z.ZodType>(llmResult: LLMLoopResult, schema: T): z.infer<T>;
822
1381
  /**
823
1382
  * Extract from specific tool call result
824
1383
  *
@@ -835,7 +1394,7 @@ declare class ResultUtils {
835
1394
  * </Result>
836
1395
  * ```
837
1396
  */
838
- static extractFromToolCall(llmResult: LLMLoopResult$1, toolName: string): any;
1397
+ static extractFromToolCall(llmResult: LLMLoopResult, toolName: string): any;
839
1398
  /**
840
1399
  * Extract text content (no JSON parsing)
841
1400
  *
@@ -848,7 +1407,7 @@ declare class ResultUtils {
848
1407
  * </Result>
849
1408
  * ```
850
1409
  */
851
- static extractText(llmResult: LLMLoopResult$1): string;
1410
+ static extractText(llmResult: LLMLoopResult): string;
852
1411
  /**
853
1412
  * Extract code block by language
854
1413
  *
@@ -861,7 +1420,7 @@ declare class ResultUtils {
861
1420
  * </Result>
862
1421
  * ```
863
1422
  */
864
- static extractCodeBlock(llmResult: LLMLoopResult$1, language?: string): string;
1423
+ static extractCodeBlock(llmResult: LLMLoopResult, language?: string): string;
865
1424
  /**
866
1425
  * Extract all code blocks
867
1426
  *
@@ -874,7 +1433,7 @@ declare class ResultUtils {
874
1433
  * </Result>
875
1434
  * ```
876
1435
  */
877
- static extractAllCodeBlocks(llmResult: LLMLoopResult$1): Array<{
1436
+ static extractAllCodeBlocks(llmResult: LLMLoopResult): Array<{
878
1437
  language: string | null;
879
1438
  code: string;
880
1439
  }>;
@@ -894,7 +1453,7 @@ declare class ResultUtils {
894
1453
  * </Result>
895
1454
  * ```
896
1455
  */
897
- static tryExtract<T = any>(llmResult: LLMLoopResult$1, extractors: Array<(result: LLMLoopResult$1) => T>): T;
1456
+ static tryExtract<T = any>(llmResult: LLMLoopResult, extractors: Array<(result: LLMLoopResult) => T>): T;
898
1457
  /**
899
1458
  * Normalize partial data with defaults
900
1459
  *
@@ -952,7 +1511,7 @@ declare class ResultUtils {
952
1511
  * </Result>
953
1512
  * ```
954
1513
  */
955
- static extractAndValidate<T>(llmResult: LLMLoopResult$1, extractor: (result: LLMLoopResult$1) => T, validator: (data: T) => T): T;
1514
+ static extractAndValidate<T>(llmResult: LLMLoopResult, extractor: (result: LLMLoopResult) => T, validator: (data: T) => T): T;
956
1515
  /**
957
1516
  * Merge observed data with extracted output
958
1517
  *
@@ -1382,6 +1941,48 @@ declare class RetryUtils {
1382
1941
  };
1383
1942
  }
1384
1943
 
1944
+ /**
1945
+ * JSX Type Helpers
1946
+ *
1947
+ * Helper functions to convert JSX elements to their specific AST node types.
1948
+ * This avoids the need for manual type assertions in user code.
1949
+ */
1950
+
1951
+ /**
1952
+ * Convert a JSX Workflow element to WorkflowNode type
1953
+ *
1954
+ * This is a type-safe helper that avoids manual type assertions.
1955
+ *
1956
+ * @example
1957
+ * ```tsx
1958
+ * const workflow = toWorkflow(
1959
+ * <Workflow name="my-workflow">
1960
+ * <Sequence>
1961
+ * <Agent1 />
1962
+ * <Agent2 />
1963
+ * </Sequence>
1964
+ * </Workflow>
1965
+ * );
1966
+ *
1967
+ * // No need for: as unknown as WorkflowNode
1968
+ * await runTSXWorkflow(workflow, inputs);
1969
+ * ```
1970
+ */
1971
+ declare function toWorkflow(element: ASTNode): WorkflowNode;
1972
+ /**
1973
+ * Convert a JSX Agent element to AgentNode type
1974
+ *
1975
+ * @example
1976
+ * ```tsx
1977
+ * const agent = toAgent(
1978
+ * <Agent id="test" input={schema} output={schema}>
1979
+ * <Prompt>...</Prompt>
1980
+ * </Agent>
1981
+ * );
1982
+ * ```
1983
+ */
1984
+ declare function toAgent<I = unknown, O = unknown>(element: ASTNode): AgentNode<I, O>;
1985
+
1385
1986
  /**
1386
1987
  * Deity TSX - Preflight Checker
1387
1988
  *
@@ -1633,7 +2234,7 @@ interface FullAgentTestOptions<I = unknown> {
1633
2234
  /** Inputs for the agent */
1634
2235
  inputs: I;
1635
2236
  /** Mock LLM loop result */
1636
- llmResult: Partial<LLMLoopResult$1>;
2237
+ llmResult: Partial<LLMLoopResult>;
1637
2238
  }
1638
2239
  /**
1639
2240
  * Full Agent Test Result
@@ -1798,7 +2399,7 @@ interface ComponentExecutionResult<O> {
1798
2399
  /** Total attempts made */
1799
2400
  attempts: number;
1800
2401
  /** LLM loop results from all attempts */
1801
- llmResults: LLMLoopResult$1[];
2402
+ llmResults: LLMLoopResult[];
1802
2403
  /** Retry execution result */
1803
2404
  retryResult: RetryExecutionResult<O>;
1804
2405
  /** Execution duration (ms) */
@@ -1815,7 +2416,7 @@ interface ComponentExecutionResult<O> {
1815
2416
  * 5. Retry if needed
1816
2417
  * 6. UI updates (if bridge available)
1817
2418
  */
1818
- declare function executeComponent<I, O>(component: AgentComponent<I, O>, ctx: ExecutionContext$1<I>, adapter: LLMAdapter, config?: GenerationConfig): Promise<ComponentExecutionResult<O>>;
2419
+ declare function executeComponent<I, O>(component: AgentComponent<I, O>, ctx: ExecutionContext$1<I>, adapter: LLMAdapter$1, config?: GenerationConfig$1): Promise<ComponentExecutionResult<O>>;
1819
2420
 
1820
2421
  /**
1821
2422
  * Deity 4.0 - LLM Execution Loop
@@ -1875,7 +2476,7 @@ interface LLMLoopConfig {
1875
2476
  * @param loopConfig - Loop configuration
1876
2477
  * @param validator - Optional validator for loop convergence
1877
2478
  */
1878
- declare function executeLLMLoop(adapter: LLMAdapter, initialMessages: Message[], tools: Tool[] | undefined, config: GenerationConfig | undefined, ctx: ExecutionContext$1, loopConfig?: LLMLoopConfig, validator?: Validator): Promise<LLMLoopResult$1>;
2479
+ declare function executeLLMLoop(adapter: LLMAdapter$1, initialMessages: Message[], tools: ToolSpec[] | undefined, config: GenerationConfig$1 | undefined, ctx: ExecutionContext$1, loopConfig?: LLMLoopConfig, validator?: Validator): Promise<LLMLoopResult>;
1879
2480
 
1880
2481
  /**
1881
2482
  * Deity 4.0 - Workflow Runner
@@ -1887,6 +2488,64 @@ declare function executeLLMLoop(adapter: LLMAdapter, initialMessages: Message[],
1887
2488
  * Execute a workflow
1888
2489
  */
1889
2490
  declare function runWorkflow<I, O>(config: WorkflowConfig, inputs: I): Promise<O>;
2491
+ /**
2492
+ * Execute a TSX workflow
2493
+ *
2494
+ * Convenience function that compiles a WorkflowNode AST and executes it.
2495
+ * This is the recommended way to run TSX-defined workflows.
2496
+ *
2497
+ * @param workflowAST - Workflow AST node (created by Workflow component)
2498
+ * @param inputs - Workflow inputs
2499
+ * @returns Workflow output
2500
+ *
2501
+ * @example
2502
+ * ```typescript
2503
+ * const workflow = Workflow({
2504
+ * name: 'my-workflow',
2505
+ * defaultModel: { adapter: llmAdapter },
2506
+ * children: Sequence({
2507
+ * children: [Agent1, Agent2, Agent3]
2508
+ * })
2509
+ * });
2510
+ *
2511
+ * const result = await runTSXWorkflow(workflow, { input: 'data' });
2512
+ * ```
2513
+ *
2514
+ * @example With enhancements
2515
+ * ```typescript
2516
+ * const workflow = Workflow({
2517
+ * name: 'enhanced-workflow',
2518
+ * defaultModel: { adapter: llmAdapter },
2519
+ * enhancements: {
2520
+ * conversation: { maxTokens: 8000, pruneThreshold: 6000 },
2521
+ * memory: { coreBudget: { maxItems: 10, maxTotalSize: 8192 } }
2522
+ * },
2523
+ * children: MyAgent
2524
+ * });
2525
+ *
2526
+ * const result = await runTSXWorkflow(workflow, inputs);
2527
+ * ```
2528
+ */
2529
+ declare function runTSXWorkflow<I, O>(workflowAST: WorkflowNode, inputs: I): Promise<O>;
2530
+ /**
2531
+ * Result from ForEach execution with error tracking
2532
+ */
2533
+ interface ForEachResult {
2534
+ /** Results from successful iterations */
2535
+ results: unknown[];
2536
+ /** Errors from failed iterations (when errorMode='continue' or 'skip') */
2537
+ errors: Array<{
2538
+ index: number;
2539
+ item: unknown;
2540
+ error: Error;
2541
+ }>;
2542
+ /** Total items processed */
2543
+ totalItems: number;
2544
+ /** Successfully processed count */
2545
+ successCount: number;
2546
+ /** Failed iterations count */
2547
+ failureCount: number;
2548
+ }
1890
2549
  /**
1891
2550
  * Create a simple step node
1892
2551
  */
@@ -1917,7 +2576,7 @@ declare function createLoopNode(child: ExecutionNode, maxIterations: number): Ex
1917
2576
  /**
1918
2577
  * Simple in-memory state store
1919
2578
  */
1920
- declare class InMemoryStore implements StateStore {
2579
+ declare class InMemoryStore implements StateStore$1 {
1921
2580
  private data;
1922
2581
  get(key: string): Promise<unknown>;
1923
2582
  set(key: string, value: unknown): Promise<void>;
@@ -1926,6 +2585,8 @@ declare class InMemoryStore implements StateStore {
1926
2585
  clear(): Promise<void>;
1927
2586
  size(): number;
1928
2587
  keys(): string[];
2588
+ entries(): [string, unknown][];
2589
+ values(): unknown[];
1929
2590
  }
1930
2591
  /**
1931
2592
  * Simple in-memory trace logger
@@ -1939,103 +2600,6 @@ declare class InMemoryTrace implements TraceLogger {
1939
2600
  getEntriesByType(type: TraceEntry['type']): TraceEntry[];
1940
2601
  }
1941
2602
 
1942
- /**
1943
- * Tool Result Extractor
1944
- *
1945
- * Utilities for extracting tool call results from LLM loop results.
1946
- * Simplifies common patterns in Agent extractOutput implementations.
1947
- */
1948
-
1949
- /**
1950
- * LLM Loop Result (subset needed for extraction)
1951
- */
1952
- interface LLMLoopResult {
1953
- messages: Message[];
1954
- response: {
1955
- content: string;
1956
- toolCalls?: any[];
1957
- };
1958
- [key: string]: any;
1959
- }
1960
- /**
1961
- * Extract options
1962
- */
1963
- interface ExtractOptions {
1964
- /** Auto unwrap { success, data } format (default: true) */
1965
- unwrap?: boolean;
1966
- /** Throw error if tool not called (default: true) */
1967
- required?: boolean;
1968
- /** Only return successful calls (for { success: boolean } format) */
1969
- filterSuccess?: boolean;
1970
- }
1971
- /**
1972
- * Extract last tool call result
1973
- *
1974
- * Uses a two-tier extraction strategy:
1975
- * 1. First checks llmResult.response.toolCalls array (priority 1)
1976
- * 2. Falls back to messages array filtering (priority 2)
1977
- *
1978
- * This supports adapters that track tool calls via hooks (e.g., Copilot SDK)
1979
- * while maintaining backward compatibility with message-based extraction.
1980
- *
1981
- * @param llmResult - LLM loop result
1982
- * @param toolName - Target tool name
1983
- * @param options - Extraction options
1984
- * @returns Parsed tool result or null if not found
1985
- * @throws Error if tool not called and required=true
1986
- *
1987
- * @example
1988
- * // Extract from toolCalls array
1989
- * const plan = extractLastToolResult<Plan>(llmResult, 'planning_create');
1990
- *
1991
- * @example
1992
- * // Extract with fallback to messages
1993
- * const result = extractLastToolResult<Result>(llmResult, 'analyze', {
1994
- * unwrap: false,
1995
- * required: false
1996
- * });
1997
- */
1998
- declare function extractLastToolResult<T = unknown>(llmResult: LLMLoopResult, toolName: string, options?: ExtractOptions): T | null;
1999
- /**
2000
- * Extract all tool call results
2001
- *
2002
- * Uses a two-tier extraction strategy:
2003
- * 1. First checks llmResult.response.toolCalls array (priority 1)
2004
- * 2. Falls back to messages array filtering (priority 2)
2005
- *
2006
- * This supports adapters that track tool calls via hooks (e.g., Copilot SDK)
2007
- * while maintaining backward compatibility with message-based extraction.
2008
- *
2009
- * @param llmResult - LLM loop result
2010
- * @param toolName - Target tool name
2011
- * @param options - Extraction options
2012
- * @returns Array of parsed results
2013
- *
2014
- * @example
2015
- * // Extract all analyze_file calls
2016
- * const results = extractAllToolResults<FileAnalysis>(llmResult, 'analyze_file');
2017
- *
2018
- * @example
2019
- * // Filter only successful results
2020
- * const successful = extractAllToolResults<Result>(llmResult, 'process', {
2021
- * filterSuccess: true
2022
- * });
2023
- */
2024
- declare function extractAllToolResults<T = unknown>(llmResult: LLMLoopResult, toolName: string, options?: ExtractOptions): T[];
2025
- /**
2026
- * Count tool calls
2027
- *
2028
- * Uses a two-tier counting strategy:
2029
- * 1. First checks llmResult.response.toolCalls array (priority 1)
2030
- * 2. Falls back to messages array filtering (priority 2)
2031
- *
2032
- * @param llmResult - LLM loop result
2033
- * @param toolName - Target tool name
2034
- * @param filter - Optional filter function
2035
- * @returns Number of tool calls
2036
- */
2037
- declare function countToolCalls(llmResult: LLMLoopResult, toolName: string, filter?: (result: any) => boolean): number;
2038
-
2039
2603
  /**
2040
2604
  * Deity 4.0 - Enhanced Execution Context
2041
2605
  *
@@ -2063,7 +2627,7 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2063
2627
  /** Outputs from previous stages */
2064
2628
  readonly previousOutputs: Record<string, unknown>;
2065
2629
  /** State store for persistence */
2066
- readonly store: StateStore;
2630
+ readonly store: StateStore$1;
2067
2631
  /** Trace logger for observability */
2068
2632
  readonly trace: TraceLogger;
2069
2633
  /** Execution statistics */
@@ -2084,17 +2648,20 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2084
2648
  readonly ui?: UIUpdateBridge;
2085
2649
  /** Session store (optional) */
2086
2650
  readonly session?: SessionStore;
2651
+ /** Application state store (optional, isolated from AI memory) */
2652
+ readonly appState?: StateStore$1;
2087
2653
  /** Current stage ID (for UI updates) */
2088
2654
  currentStageId?: string;
2089
2655
  constructor(params: {
2090
2656
  inputs: I;
2091
2657
  previousOutputs?: Record<string, unknown>;
2092
- store: StateStore;
2658
+ store: StateStore$1;
2093
2659
  trace: TraceLogger;
2094
2660
  stats: ExecutionStats;
2095
2661
  conversation?: ConversationManager;
2096
2662
  memory?: LimoMemoryManager;
2097
2663
  session?: SessionStore;
2664
+ appState?: StateStore$1;
2098
2665
  ui?: UIUpdateBridge;
2099
2666
  currentStageId?: string;
2100
2667
  iteration?: number;
@@ -2133,6 +2700,10 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2133
2700
  * Update iteration info (for loops)
2134
2701
  */
2135
2702
  withIteration(iteration: number, maxIterations: number): ExecutionContext<I>;
2703
+ /**
2704
+ * Update inputs (for ForEach iterations)
2705
+ */
2706
+ withInputs<NewI = I>(inputs: NewI): ExecutionContext<NewI>;
2136
2707
  /**
2137
2708
  * Add to iteration history
2138
2709
  */
@@ -2153,6 +2724,10 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2153
2724
  * Check if UI is enabled
2154
2725
  */
2155
2726
  hasUI(): boolean;
2727
+ /**
2728
+ * Check if appState is enabled
2729
+ */
2730
+ hasAppState(): boolean;
2156
2731
  /**
2157
2732
  * Get conversation manager (throws if not available)
2158
2733
  */
@@ -2169,6 +2744,10 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2169
2744
  * Get UI bridge (throws if not available)
2170
2745
  */
2171
2746
  requireUI(): UIUpdateBridge;
2747
+ /**
2748
+ * Get application state store (throws if not available)
2749
+ */
2750
+ requireAppState(): StateStore$1;
2172
2751
  /**
2173
2752
  * Get context summary for debugging
2174
2753
  */
@@ -2182,6 +2761,7 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2182
2761
  memory: boolean;
2183
2762
  session: boolean;
2184
2763
  ui: boolean;
2764
+ appState: boolean;
2185
2765
  };
2186
2766
  stats: ExecutionStats;
2187
2767
  };
@@ -2206,7 +2786,7 @@ interface ContextConfig<I = unknown> {
2206
2786
  /** Previous stage outputs */
2207
2787
  previousOutputs?: Record<string, unknown>;
2208
2788
  /** State store (required) */
2209
- store: StateStore;
2789
+ store: StateStore$1;
2210
2790
  /** Trace logger (required) */
2211
2791
  trace: TraceLogger;
2212
2792
  /** Execution stats (optional, will create if not provided) */
@@ -2217,6 +2797,8 @@ interface ContextConfig<I = unknown> {
2217
2797
  enableMemory?: boolean | MemoryConfig;
2218
2798
  /** Enable session store */
2219
2799
  enableSession?: boolean | SessionConfig;
2800
+ /** Enable application state store (isolated from AI memory) */
2801
+ enableAppState?: boolean | StateStore$1;
2220
2802
  /** UI update bridge */
2221
2803
  ui?: UIUpdateBridge;
2222
2804
  /** Current stage ID */
@@ -2233,35 +2815,4 @@ interface ContextConfig<I = unknown> {
2233
2815
  */
2234
2816
  declare function createEnhancedContext<I = unknown>(config: ContextConfig<I>): Promise<ExecutionContext<I>>;
2235
2817
 
2236
- /**
2237
- * Deity Built-in Memory Tools
2238
- *
2239
- * Provides out-of-the-box memory management tools that applications can use
2240
- * without implementing their own memory storage/retrieval logic.
2241
- */
2242
-
2243
- /**
2244
- * Create built-in memory management tools
2245
- *
2246
- * These tools integrate with Deity's LimoMemoryManager to provide:
2247
- * - Automatic tiered storage (core vs detailed)
2248
- * - Relevance-based retrieval
2249
- * - Automatic promotion/demotion of memories
2250
- *
2251
- * @param ctx ExecutionContext with memory enabled
2252
- * @returns Array of memory tools (memory_store, memory_recall)
2253
- *
2254
- * @example
2255
- * ```typescript
2256
- * const ctx = await createEnhancedContext({
2257
- * inputs: { task: "..." },
2258
- * enableMemory: true
2259
- * });
2260
- *
2261
- * const memoryTools = createMemoryTools(ctx);
2262
- * const allTools = [...memoryTools, ...myCustomTools];
2263
- * ```
2264
- */
2265
- declare function createMemoryTools(ctx: ExecutionContext): Tool[];
2266
-
2267
- export { Agent, AgentComponent, AgentNode, type AgentProps, DEBUG_ENABLED, DebugLogger, ExecutionContext$1 as ExecutionContext, type FullAgentTestOptions, type FullAgentTestResult, GenerationConfig, InMemoryStore, InMemoryTrace, LLMAdapter, type LLMLoopConfig, LLMLoopResult$1 as LLMLoopResult, type LogLevel, Message, Observe, type ObserveFunction, ObserveNode, type ObserveProps, ObserveUtils, PreflightChecker, type PreflightResult, Prompt, PromptNode, type PromptProps, PromptResourceLoader, Result, ResultNode, type ResultProps, ResultUtils, Retry, type RetryContext, RetryNode, type RetryProps, RetryUtils, StateStore, System, SystemNode, type SystemProps, Tool, TraceLogger, User, UserNode, type UserProps, Validate, ValidateNode, type ValidateProps, ValidateUtils, type ValidationResult, ValidationRules, Validator, compileAgent, countToolCalls, createConditionalNode, createEnhancedContext, createLoopNode, createMemoryTools, createParallelNode, createSequenceNode, createStepNode, executeComponent, executeLLMLoop, extractAllToolResults, extractLastToolResult, getResourceLoader, logger, preflight, runWorkflow, setResourceLoader, testFullAgent };
2818
+ export { ASTNode, Agent, AgentComponent, AgentNode, type AgentProps, Conditional, type ConditionalProps, DEBUG_ENABLED, DebugLogger, type ErrorMode, ExecutionContext$1 as ExecutionContext, ForEach, type ForEachProps, type ForEachResult, type FullAgentTestOptions, type FullAgentTestResult, GenerationConfig$1 as GenerationConfig, InMemoryStore, InMemoryTrace, type ItemMode, LLMAdapter$1 as LLMAdapter, type LLMLoopConfig, LLMLoopResult, type LogLevel, Loop, type LoopProps, Message, Observe, type ObserveFunction, ObserveNode, type ObserveProps, ObserveUtils, Parallel, type ParallelProps, PreflightChecker, type PreflightResult, Prompt, PromptNode, type PromptProps, PromptResourceLoader, Result, ResultNode, type ResultProps, ResultUtils, Retry, type RetryContext, RetryNode, type RetryProps, RetryUtils, Sequence, type SequenceProps, StateStore$1 as StateStore, System, SystemNode, type SystemProps, Tool, ToolDef, ToolDefNode, type ToolDefProps, type ToolProps, ToolRef, ToolRefNode, type ToolRefProps, type ToolRefTarget, ToolSpec, Tools, ToolsNode, type ToolsProps, TraceLogger, User, UserNode, type UserProps, Validate, ValidateNode, type ValidateProps, ValidateUtils, type ValidationResult, ValidationRules, Validator, Workflow, WorkflowChildNode, WorkflowConditionalNode, type WorkflowEnhancements, WorkflowForEachNode, type GenerationConfig as WorkflowGenerationConfig, type LLMAdapter as WorkflowLLMAdapter, WorkflowLoopNode, WorkflowNode, WorkflowParallelNode, type WorkflowProps, WorkflowSequenceNode, type StateStore as WorkflowStateStore, compileAgent, compileWorkflow, compileWorkflowNode, createConditionalNode, createEnhancedContext, createLoopNode, createParallelNode, createSequenceNode, createStepNode, executeComponent, executeLLMLoop, getResourceLoader, logger, preflight, runTSXWorkflow, runWorkflow, setResourceLoader, testFullAgent, toAgent, toWorkflow };