@limo-labs/deity 0.2.0 → 0.2.2

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.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ZodSchema, z } from 'zod';
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.cjs';
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.cjs';
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-1R5Vpr7w.cjs';
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-1R5Vpr7w.cjs';
4
4
 
5
5
  /**
6
6
  * Deity TSX - Agent Component
@@ -2359,7 +2359,7 @@ declare class DebugLogger {
2359
2359
  declare const logger: DebugLogger;
2360
2360
 
2361
2361
  /**
2362
- * Deity 4.0 - Retry Mechanism
2362
+ * Deity - Retry Mechanism
2363
2363
  *
2364
2364
  * Validation-based retry with dynamic stop conditions
2365
2365
  */
@@ -2383,7 +2383,7 @@ interface RetryExecutionResult<O> {
2383
2383
  }
2384
2384
 
2385
2385
  /**
2386
- * Deity 4.0 - Component Executor
2386
+ * Deity -Component Executor
2387
2387
  *
2388
2388
  * Orchestrates AgentComponent execution
2389
2389
  */
@@ -2419,7 +2419,7 @@ interface ComponentExecutionResult<O> {
2419
2419
  declare function executeComponent<I, O>(component: AgentComponent<I, O>, ctx: ExecutionContext$1<I>, adapter: LLMAdapter$1, config?: GenerationConfig$1): Promise<ComponentExecutionResult<O>>;
2420
2420
 
2421
2421
  /**
2422
- * Deity 4.0 - LLM Execution Loop
2422
+ * Deity - LLM Execution Loop
2423
2423
  *
2424
2424
  * Handles LLM calls with tool execution loop.
2425
2425
  *
@@ -2459,6 +2459,12 @@ interface LLMLoopConfig {
2459
2459
  /** Memory injection configuration */
2460
2460
  memoryInjection?: MemoryInjectionConfig;
2461
2461
  }
2462
+ /**
2463
+ * Deadline prompt injected when timeout or maxToolRounds is reached.
2464
+ * Instructs the LLM to immediately provide its final answer without further tool calls.
2465
+ * Exported for testing and external customization.
2466
+ */
2467
+ declare const DEADLINE_PROMPT = "\u26A0\uFE0F DEADLINE REACHED: You have reached the maximum allowed rounds or time limit. You MUST immediately provide your final answer based on the information gathered so far. Do NOT call any more tools. Respond with your best final output NOW.";
2462
2468
  /**
2463
2469
  * Execute LLM with tool calling loop
2464
2470
  *
@@ -2479,7 +2485,7 @@ interface LLMLoopConfig {
2479
2485
  declare function executeLLMLoop(adapter: LLMAdapter$1, initialMessages: Message[], tools: ToolSpec[] | undefined, config: GenerationConfig$1 | undefined, ctx: ExecutionContext$1, loopConfig?: LLMLoopConfig, validator?: Validator): Promise<LLMLoopResult>;
2480
2486
 
2481
2487
  /**
2482
- * Deity 4.0 - Workflow Runner
2488
+ * Deity - Workflow Runner
2483
2489
  *
2484
2490
  * Orchestrates workflow execution with checkpoint/resume
2485
2491
  */
@@ -2568,7 +2574,7 @@ declare function createConditionalNode(condition: (ctx: ExecutionContext$1) => b
2568
2574
  declare function createLoopNode(child: ExecutionNode, maxIterations: number): ExecutionNode;
2569
2575
 
2570
2576
  /**
2571
- * Deity 4.0 - In-Memory Stores
2577
+ * Deity - In-Memory Stores
2572
2578
  *
2573
2579
  * Simple in-memory implementations for testing
2574
2580
  */
@@ -2601,7 +2607,7 @@ declare class InMemoryTrace implements TraceLogger {
2601
2607
  }
2602
2608
 
2603
2609
  /**
2604
- * Deity 4.0 - Enhanced Execution Context
2610
+ * Deity -Enhanced Execution Context
2605
2611
  *
2606
2612
  * Unified context with integrated managers:
2607
2613
  * - ConversationManager (Phase 2)
@@ -2772,7 +2778,7 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2772
2778
  }
2773
2779
 
2774
2780
  /**
2775
- * Deity 4.0 - Context Factory
2781
+ * Deity - Context Factory
2776
2782
  *
2777
2783
  * Factory functions for creating ExecutionContext instances
2778
2784
  */
@@ -2815,4 +2821,4 @@ interface ContextConfig<I = unknown> {
2815
2821
  */
2816
2822
  declare function createEnhancedContext<I = unknown>(config: ContextConfig<I>): Promise<ExecutionContext<I>>;
2817
2823
 
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 };
2824
+ export { ASTNode, Agent, AgentComponent, AgentNode, type AgentProps, Conditional, type ConditionalProps, DEADLINE_PROMPT, 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 };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ZodSchema, z } from 'zod';
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';
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-1R5Vpr7w.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-1R5Vpr7w.js';
4
4
 
5
5
  /**
6
6
  * Deity TSX - Agent Component
@@ -2359,7 +2359,7 @@ declare class DebugLogger {
2359
2359
  declare const logger: DebugLogger;
2360
2360
 
2361
2361
  /**
2362
- * Deity 4.0 - Retry Mechanism
2362
+ * Deity - Retry Mechanism
2363
2363
  *
2364
2364
  * Validation-based retry with dynamic stop conditions
2365
2365
  */
@@ -2383,7 +2383,7 @@ interface RetryExecutionResult<O> {
2383
2383
  }
2384
2384
 
2385
2385
  /**
2386
- * Deity 4.0 - Component Executor
2386
+ * Deity -Component Executor
2387
2387
  *
2388
2388
  * Orchestrates AgentComponent execution
2389
2389
  */
@@ -2419,7 +2419,7 @@ interface ComponentExecutionResult<O> {
2419
2419
  declare function executeComponent<I, O>(component: AgentComponent<I, O>, ctx: ExecutionContext$1<I>, adapter: LLMAdapter$1, config?: GenerationConfig$1): Promise<ComponentExecutionResult<O>>;
2420
2420
 
2421
2421
  /**
2422
- * Deity 4.0 - LLM Execution Loop
2422
+ * Deity - LLM Execution Loop
2423
2423
  *
2424
2424
  * Handles LLM calls with tool execution loop.
2425
2425
  *
@@ -2459,6 +2459,12 @@ interface LLMLoopConfig {
2459
2459
  /** Memory injection configuration */
2460
2460
  memoryInjection?: MemoryInjectionConfig;
2461
2461
  }
2462
+ /**
2463
+ * Deadline prompt injected when timeout or maxToolRounds is reached.
2464
+ * Instructs the LLM to immediately provide its final answer without further tool calls.
2465
+ * Exported for testing and external customization.
2466
+ */
2467
+ declare const DEADLINE_PROMPT = "\u26A0\uFE0F DEADLINE REACHED: You have reached the maximum allowed rounds or time limit. You MUST immediately provide your final answer based on the information gathered so far. Do NOT call any more tools. Respond with your best final output NOW.";
2462
2468
  /**
2463
2469
  * Execute LLM with tool calling loop
2464
2470
  *
@@ -2479,7 +2485,7 @@ interface LLMLoopConfig {
2479
2485
  declare function executeLLMLoop(adapter: LLMAdapter$1, initialMessages: Message[], tools: ToolSpec[] | undefined, config: GenerationConfig$1 | undefined, ctx: ExecutionContext$1, loopConfig?: LLMLoopConfig, validator?: Validator): Promise<LLMLoopResult>;
2480
2486
 
2481
2487
  /**
2482
- * Deity 4.0 - Workflow Runner
2488
+ * Deity - Workflow Runner
2483
2489
  *
2484
2490
  * Orchestrates workflow execution with checkpoint/resume
2485
2491
  */
@@ -2568,7 +2574,7 @@ declare function createConditionalNode(condition: (ctx: ExecutionContext$1) => b
2568
2574
  declare function createLoopNode(child: ExecutionNode, maxIterations: number): ExecutionNode;
2569
2575
 
2570
2576
  /**
2571
- * Deity 4.0 - In-Memory Stores
2577
+ * Deity - In-Memory Stores
2572
2578
  *
2573
2579
  * Simple in-memory implementations for testing
2574
2580
  */
@@ -2601,7 +2607,7 @@ declare class InMemoryTrace implements TraceLogger {
2601
2607
  }
2602
2608
 
2603
2609
  /**
2604
- * Deity 4.0 - Enhanced Execution Context
2610
+ * Deity -Enhanced Execution Context
2605
2611
  *
2606
2612
  * Unified context with integrated managers:
2607
2613
  * - ConversationManager (Phase 2)
@@ -2772,7 +2778,7 @@ declare class ExecutionContext<I = unknown> implements ExecutionContext$1<I> {
2772
2778
  }
2773
2779
 
2774
2780
  /**
2775
- * Deity 4.0 - Context Factory
2781
+ * Deity - Context Factory
2776
2782
  *
2777
2783
  * Factory functions for creating ExecutionContext instances
2778
2784
  */
@@ -2815,4 +2821,4 @@ interface ContextConfig<I = unknown> {
2815
2821
  */
2816
2822
  declare function createEnhancedContext<I = unknown>(config: ContextConfig<I>): Promise<ExecutionContext<I>>;
2817
2823
 
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 };
2824
+ export { ASTNode, Agent, AgentComponent, AgentNode, type AgentProps, Conditional, type ConditionalProps, DEADLINE_PROMPT, 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 };
package/dist/index.js CHANGED
@@ -488,15 +488,13 @@ function Tool(props) {
488
488
  throw new Error("Tool: input schema is required");
489
489
  }
490
490
  let executeFn;
491
- if (children) {
491
+ const hasChildren = children && Array.isArray(children) && children.length > 0;
492
+ if (hasChildren) {
492
493
  if (execute) {
493
494
  throw new Error("Tool: cannot use both children and execute prop");
494
495
  }
495
496
  let actualChild = children;
496
497
  if (Array.isArray(children)) {
497
- if (children.length === 0) {
498
- throw new Error("Tool: children array is empty");
499
- }
500
498
  if (children.length > 1) {
501
499
  throw new Error("Tool: can only have one child (the execute function)");
502
500
  }
@@ -2856,6 +2854,7 @@ var DEFAULT_LLM_LOOP_CONFIG = {
2856
2854
  // 2 minutes
2857
2855
  verbose: false
2858
2856
  };
2857
+ var DEADLINE_PROMPT = `\u26A0\uFE0F DEADLINE REACHED: You have reached the maximum allowed rounds or time limit. You MUST immediately provide your final answer based on the information gathered so far. Do NOT call any more tools. Respond with your best final output NOW.`;
2859
2858
  async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loopConfig = {}, validator) {
2860
2859
  const cfg = { ...DEFAULT_LLM_LOOP_CONFIG, ...loopConfig };
2861
2860
  const messagesWithMemory = await injectRelevantMemories(
@@ -2869,6 +2868,7 @@ async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loop
2869
2868
  let toolCallsExecuted = 0;
2870
2869
  let response;
2871
2870
  let toolCallsThisRound = [];
2871
+ const startTime = Date.now();
2872
2872
  while (rounds < cfg.maxToolRounds) {
2873
2873
  rounds++;
2874
2874
  toolCallsThisRound = [];
@@ -2916,10 +2916,6 @@ async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loop
2916
2916
  }
2917
2917
  break;
2918
2918
  }
2919
- if (rounds >= cfg.maxToolRounds) {
2920
- errors.push(`Maximum tool rounds (${cfg.maxToolRounds}) exceeded`);
2921
- break;
2922
- }
2923
2919
  for (const toolCall of response.toolCalls) {
2924
2920
  const alreadyExecuted = toolCall._alreadyExecuted;
2925
2921
  if (alreadyExecuted) {
@@ -2987,6 +2983,23 @@ async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loop
2987
2983
  if (allPreExecuted) {
2988
2984
  break;
2989
2985
  }
2986
+ const isTimeout = cfg.timeout > 0 && Date.now() - startTime >= cfg.timeout;
2987
+ const isLastRound = rounds >= cfg.maxToolRounds;
2988
+ if (isTimeout || isLastRound) {
2989
+ messages.push({
2990
+ role: "user",
2991
+ content: DEADLINE_PROMPT
2992
+ });
2993
+ try {
2994
+ response = await adapter.generate(messages, void 0, config, ctx);
2995
+ messages.push({ role: "assistant", content: response.content });
2996
+ } catch (_error) {
2997
+ }
2998
+ errors.push(
2999
+ isTimeout ? `Timeout reached (${cfg.timeout}ms)` : `Maximum tool rounds (${cfg.maxToolRounds}) reached`
3000
+ );
3001
+ break;
3002
+ }
2990
3003
  }
2991
3004
  return {
2992
3005
  response,
@@ -3226,6 +3239,17 @@ async function executeWithRetry(component, ctx, executeFn) {
3226
3239
  }
3227
3240
  const shouldRetry = retryConfig.shouldRetry ? retryConfig.shouldRetry(attempts, output, ctx) : attempts < retryConfig.maxAttempts;
3228
3241
  if (!shouldRetry) {
3242
+ const lastOutput = outputHistory[outputHistory.length - 1];
3243
+ if (lastOutput !== void 0) {
3244
+ return {
3245
+ output: lastOutput,
3246
+ success: true,
3247
+ attempts,
3248
+ errors: validation.errors ?? ["Validation failed (used best-effort output)"],
3249
+ validationHistory,
3250
+ outputHistory
3251
+ };
3252
+ }
3229
3253
  return {
3230
3254
  success: false,
3231
3255
  attempts,
@@ -4324,7 +4348,7 @@ z.object({
4324
4348
  sessionId: z.string().min(1, "Session ID cannot be empty"),
4325
4349
  workflowName: z.string().min(1, "Workflow name cannot be empty"),
4326
4350
  pausedAt: z.string().datetime("Must be ISO 8601 datetime"),
4327
- version: z.string().regex(/^\d+\.\d+\.\d+$/, "Must be semver format (e.g., 4.0.0)"),
4351
+ version: z.string().regex(/^\d+\.\d+\.\d+$/, "Must be semver format (e.g., 1.0.0)"),
4328
4352
  state: PausedSessionStateSchema,
4329
4353
  metadata: PausedSessionMetadataSchema
4330
4354
  });
@@ -4340,7 +4364,7 @@ var SessionSerializer = class {
4340
4364
  metadata;
4341
4365
  constructor() {
4342
4366
  this.metadata = {
4343
- version: "4.0.0",
4367
+ version: "1.0.0",
4344
4368
  timestamp: /* @__PURE__ */ new Date(),
4345
4369
  specialFields: []
4346
4370
  };
@@ -5230,6 +5254,6 @@ function createLoopNode(child, maxIterations) {
5230
5254
  };
5231
5255
  }
5232
5256
 
5233
- export { Agent, Conditional, DEBUG_ENABLED, DebugLogger, ForEach, InMemoryStore, InMemoryTrace, Loop, Observe, ObserveUtils, Parallel, PreflightChecker, Prompt, PromptResourceLoader, Result, ResultUtils, Retry, RetryUtils, Sequence, System, Tool, ToolDef, ToolRef, Tools, User, Validate, ValidateUtils, Workflow, compileAgent, compileWorkflow, compileWorkflowNode, createConditionalNode, createEnhancedContext, createLoopNode, createParallelNode, createSequenceNode, createStepNode, executeComponent, executeLLMLoop, getResourceLoader, isAgentNode, isObserveNode, isPromptNode, isResultNode, isRetryNode, isSystemNode, isToolDefNode, isToolRefNode, isToolsNode, isUserNode, isValidateNode, isWorkflowConditionalNode, isWorkflowForEachNode, isWorkflowLoopNode, isWorkflowNode, isWorkflowParallelNode, isWorkflowSequenceNode, logger, preflight, runTSXWorkflow, runWorkflow, setResourceLoader, testFullAgent, toAgent, toWorkflow };
5257
+ export { Agent, Conditional, DEADLINE_PROMPT, DEBUG_ENABLED, DebugLogger, ForEach, InMemoryStore, InMemoryTrace, Loop, Observe, ObserveUtils, Parallel, PreflightChecker, Prompt, PromptResourceLoader, Result, ResultUtils, Retry, RetryUtils, Sequence, System, Tool, ToolDef, ToolRef, Tools, User, Validate, ValidateUtils, Workflow, compileAgent, compileWorkflow, compileWorkflowNode, createConditionalNode, createEnhancedContext, createLoopNode, createParallelNode, createSequenceNode, createStepNode, executeComponent, executeLLMLoop, getResourceLoader, isAgentNode, isObserveNode, isPromptNode, isResultNode, isRetryNode, isSystemNode, isToolDefNode, isToolRefNode, isToolsNode, isUserNode, isValidateNode, isWorkflowConditionalNode, isWorkflowForEachNode, isWorkflowLoopNode, isWorkflowNode, isWorkflowParallelNode, isWorkflowSequenceNode, logger, preflight, runTSXWorkflow, runWorkflow, setResourceLoader, testFullAgent, toAgent, toWorkflow };
5234
5258
  //# sourceMappingURL=index.js.map
5235
5259
  //# sourceMappingURL=index.js.map