@limo-labs/deity 0.2.1 → 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.cjs +33 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -10
- package/dist/index.d.ts +16 -10
- package/dist/index.js +33 -7
- package/dist/index.js.map +1 -1
- package/dist/{jsx-dev-runtime-Dg782FK5.d.cts → jsx-dev-runtime-1R5Vpr7w.d.cts} +6 -8
- package/dist/{jsx-dev-runtime-Dg782FK5.d.ts → jsx-dev-runtime-1R5Vpr7w.d.ts} +6 -8
- package/dist/jsx-dev-runtime.d.cts +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-runtime.d.cts +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/package.json +1 -1
- package/README.md +0 -681
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-
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
@@ -2854,6 +2854,7 @@ var DEFAULT_LLM_LOOP_CONFIG = {
|
|
|
2854
2854
|
// 2 minutes
|
|
2855
2855
|
verbose: false
|
|
2856
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.`;
|
|
2857
2858
|
async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loopConfig = {}, validator) {
|
|
2858
2859
|
const cfg = { ...DEFAULT_LLM_LOOP_CONFIG, ...loopConfig };
|
|
2859
2860
|
const messagesWithMemory = await injectRelevantMemories(
|
|
@@ -2867,6 +2868,7 @@ async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loop
|
|
|
2867
2868
|
let toolCallsExecuted = 0;
|
|
2868
2869
|
let response;
|
|
2869
2870
|
let toolCallsThisRound = [];
|
|
2871
|
+
const startTime = Date.now();
|
|
2870
2872
|
while (rounds < cfg.maxToolRounds) {
|
|
2871
2873
|
rounds++;
|
|
2872
2874
|
toolCallsThisRound = [];
|
|
@@ -2914,10 +2916,6 @@ async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loop
|
|
|
2914
2916
|
}
|
|
2915
2917
|
break;
|
|
2916
2918
|
}
|
|
2917
|
-
if (rounds >= cfg.maxToolRounds) {
|
|
2918
|
-
errors.push(`Maximum tool rounds (${cfg.maxToolRounds}) exceeded`);
|
|
2919
|
-
break;
|
|
2920
|
-
}
|
|
2921
2919
|
for (const toolCall of response.toolCalls) {
|
|
2922
2920
|
const alreadyExecuted = toolCall._alreadyExecuted;
|
|
2923
2921
|
if (alreadyExecuted) {
|
|
@@ -2985,6 +2983,23 @@ async function executeLLMLoop(adapter, initialMessages, tools, config, ctx, loop
|
|
|
2985
2983
|
if (allPreExecuted) {
|
|
2986
2984
|
break;
|
|
2987
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
|
+
}
|
|
2988
3003
|
}
|
|
2989
3004
|
return {
|
|
2990
3005
|
response,
|
|
@@ -3224,6 +3239,17 @@ async function executeWithRetry(component, ctx, executeFn) {
|
|
|
3224
3239
|
}
|
|
3225
3240
|
const shouldRetry = retryConfig.shouldRetry ? retryConfig.shouldRetry(attempts, output, ctx) : attempts < retryConfig.maxAttempts;
|
|
3226
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
|
+
}
|
|
3227
3253
|
return {
|
|
3228
3254
|
success: false,
|
|
3229
3255
|
attempts,
|
|
@@ -4322,7 +4348,7 @@ z.object({
|
|
|
4322
4348
|
sessionId: z.string().min(1, "Session ID cannot be empty"),
|
|
4323
4349
|
workflowName: z.string().min(1, "Workflow name cannot be empty"),
|
|
4324
4350
|
pausedAt: z.string().datetime("Must be ISO 8601 datetime"),
|
|
4325
|
-
version: z.string().regex(/^\d+\.\d+\.\d+$/, "Must be semver format (e.g.,
|
|
4351
|
+
version: z.string().regex(/^\d+\.\d+\.\d+$/, "Must be semver format (e.g., 1.0.0)"),
|
|
4326
4352
|
state: PausedSessionStateSchema,
|
|
4327
4353
|
metadata: PausedSessionMetadataSchema
|
|
4328
4354
|
});
|
|
@@ -4338,7 +4364,7 @@ var SessionSerializer = class {
|
|
|
4338
4364
|
metadata;
|
|
4339
4365
|
constructor() {
|
|
4340
4366
|
this.metadata = {
|
|
4341
|
-
version: "
|
|
4367
|
+
version: "1.0.0",
|
|
4342
4368
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4343
4369
|
specialFields: []
|
|
4344
4370
|
};
|
|
@@ -5228,6 +5254,6 @@ function createLoopNode(child, maxIterations) {
|
|
|
5228
5254
|
};
|
|
5229
5255
|
}
|
|
5230
5256
|
|
|
5231
|
-
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 };
|
|
5232
5258
|
//# sourceMappingURL=index.js.map
|
|
5233
5259
|
//# sourceMappingURL=index.js.map
|