@limo-labs/deity 0.2.2 → 0.3.0-alpha.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.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-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';
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-BQMsrQII.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-BQMsrQII.cjs';
4
4
 
5
5
  /**
6
6
  * Deity TSX - Agent Component
@@ -37,6 +37,8 @@ interface AgentProps<I = unknown, O = unknown> {
37
37
  loopConfig?: LLMLoopConfig$1;
38
38
  /** Optional tool definitions (backward compatible - can also use <Tools> child) */
39
39
  tools?: ToolSpec[];
40
+ /** Execution mode: 'llm' (default) requires LLM adapter, 'pure' skips LLM */
41
+ mode?: 'llm' | 'pure';
40
42
  /** Child components (Tools, Prompt, Observe, Result, Validate, Retry) */
41
43
  children?: any[];
42
44
  }
@@ -2388,6 +2390,10 @@ interface RetryExecutionResult<O> {
2388
2390
  * Orchestrates AgentComponent execution
2389
2391
  */
2390
2392
 
2393
+ /**
2394
+ * Empty LLM loop result for pure-function agents that skip LLM execution
2395
+ */
2396
+ declare const EMPTY_LLM_RESULT: LLMLoopResult;
2391
2397
  /**
2392
2398
  * Result from component execution
2393
2399
  */
@@ -2821,4 +2827,4 @@ interface ContextConfig<I = unknown> {
2821
2827
  */
2822
2828
  declare function createEnhancedContext<I = unknown>(config: ContextConfig<I>): Promise<ExecutionContext<I>>;
2823
2829
 
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 };
2830
+ export { ASTNode, Agent, AgentComponent, AgentNode, type AgentProps, Conditional, type ConditionalProps, DEADLINE_PROMPT, DEBUG_ENABLED, DebugLogger, EMPTY_LLM_RESULT, 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-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';
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-BQMsrQII.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-BQMsrQII.js';
4
4
 
5
5
  /**
6
6
  * Deity TSX - Agent Component
@@ -37,6 +37,8 @@ interface AgentProps<I = unknown, O = unknown> {
37
37
  loopConfig?: LLMLoopConfig$1;
38
38
  /** Optional tool definitions (backward compatible - can also use <Tools> child) */
39
39
  tools?: ToolSpec[];
40
+ /** Execution mode: 'llm' (default) requires LLM adapter, 'pure' skips LLM */
41
+ mode?: 'llm' | 'pure';
40
42
  /** Child components (Tools, Prompt, Observe, Result, Validate, Retry) */
41
43
  children?: any[];
42
44
  }
@@ -2388,6 +2390,10 @@ interface RetryExecutionResult<O> {
2388
2390
  * Orchestrates AgentComponent execution
2389
2391
  */
2390
2392
 
2393
+ /**
2394
+ * Empty LLM loop result for pure-function agents that skip LLM execution
2395
+ */
2396
+ declare const EMPTY_LLM_RESULT: LLMLoopResult;
2391
2397
  /**
2392
2398
  * Result from component execution
2393
2399
  */
@@ -2821,4 +2827,4 @@ interface ContextConfig<I = unknown> {
2821
2827
  */
2822
2828
  declare function createEnhancedContext<I = unknown>(config: ContextConfig<I>): Promise<ExecutionContext<I>>;
2823
2829
 
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 };
2830
+ export { ASTNode, Agent, AgentComponent, AgentNode, type AgentProps, Conditional, type ConditionalProps, DEADLINE_PROMPT, DEBUG_ENABLED, DebugLogger, EMPTY_LLM_RESULT, 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
@@ -42,7 +42,8 @@ var init_compile_observe = __esm({
42
42
 
43
43
  // src/components/Agent.tsx
44
44
  function Agent(props) {
45
- const { id, input, output, description, tags, loopValidator, loopConfig, tools: propsTools, children } = props;
45
+ const { id, input, output, description, tags, loopValidator, loopConfig, tools: propsTools, mode, children } = props;
46
+ const resolvedMode = mode ?? "llm";
46
47
  if (!id) {
47
48
  throw new Error("Agent: id is required");
48
49
  }
@@ -53,13 +54,31 @@ function Agent(props) {
53
54
  throw new Error("Agent: output schema is required");
54
55
  }
55
56
  if (!children || children.length === 0) {
57
+ if (resolvedMode === "pure") {
58
+ throw new Error("Agent: pure mode must have at least a Result child");
59
+ }
56
60
  throw new Error("Agent: must have at least Prompt and Result children");
57
61
  }
58
62
  const toolsNode = children.find((child) => child?.type === "Tools");
59
63
  const nonToolsChildren = children.filter((child) => child?.type !== "Tools");
60
- const [prompt, ...rest] = nonToolsChildren;
61
- if (!prompt || prompt.type !== "Prompt") {
62
- throw new Error("Agent: first non-Tools child must be a Prompt component");
64
+ let prompt;
65
+ let rest;
66
+ if (resolvedMode === "pure") {
67
+ const firstNonTools = nonToolsChildren[0];
68
+ if (firstNonTools?.type === "Prompt") {
69
+ prompt = firstNonTools;
70
+ rest = nonToolsChildren.slice(1);
71
+ } else {
72
+ prompt = void 0;
73
+ rest = nonToolsChildren;
74
+ }
75
+ } else {
76
+ const [first, ...remaining] = nonToolsChildren;
77
+ if (!first || first.type !== "Prompt") {
78
+ throw new Error("Agent: first non-Tools child must be a Prompt component");
79
+ }
80
+ prompt = first;
81
+ rest = remaining;
63
82
  }
64
83
  const result = rest.find((child) => child?.type === "Result");
65
84
  if (!result) {
@@ -69,9 +88,8 @@ function Agent(props) {
69
88
  const validate = rest.find((child) => child?.type === "Validate");
70
89
  const retry = rest.find((child) => child?.type === "Retry");
71
90
  const mergedTools = mergeTools(propsTools, toolsNode);
72
- const orderedChildren = [
73
- prompt
74
- ];
91
+ const orderedChildren = [];
92
+ if (prompt) orderedChildren.push(prompt);
75
93
  if (observe) orderedChildren.push(observe);
76
94
  orderedChildren.push(result);
77
95
  if (validate) orderedChildren.push(validate);
@@ -87,7 +105,8 @@ function Agent(props) {
87
105
  tags,
88
106
  loopValidator,
89
107
  loopConfig,
90
- tools: mergedTools
108
+ tools: mergedTools,
109
+ mode: resolvedMode
91
110
  },
92
111
  children: orderedChildren
93
112
  };
@@ -1057,13 +1076,14 @@ function compileAgent(ast) {
1057
1076
  const resultNode = children.find((n) => n?.type === "Result");
1058
1077
  const validateNode = children.find((n) => n?.type === "Validate");
1059
1078
  const retryNode = children.find((n) => n?.type === "Retry");
1060
- if (!promptNode) {
1079
+ const mode = ast.props.mode ?? "llm";
1080
+ if (mode !== "pure" && !promptNode) {
1061
1081
  throw new Error("Agent must have a Prompt node");
1062
1082
  }
1063
1083
  if (!resultNode) {
1064
1084
  throw new Error("Agent must have a Result node");
1065
1085
  }
1066
- const buildPrompt = compilePrompt(promptNode);
1086
+ const buildPrompt = promptNode ? compilePrompt(promptNode) : () => [];
1067
1087
  const observe = observeNode ? compileObserve(observeNode) : void 0;
1068
1088
  const extractOutput = compileResult(resultNode, observe);
1069
1089
  const validateOutput = validateNode ? compileValidate(validateNode) : void 0;
@@ -1075,6 +1095,9 @@ function compileAgent(ast) {
1075
1095
  buildPrompt,
1076
1096
  extractOutput
1077
1097
  };
1098
+ if (mode === "pure") {
1099
+ component.mode = "pure";
1100
+ }
1078
1101
  if (validateOutput) {
1079
1102
  component.validateOutput = validateOutput;
1080
1103
  }
@@ -1215,6 +1238,9 @@ function createLazyAgentComponent(astNode) {
1215
1238
  get loopConfig() {
1216
1239
  return astNode.props.loopConfig;
1217
1240
  },
1241
+ get mode() {
1242
+ return astNode.props.mode;
1243
+ },
1218
1244
  // Lazy methods - compile on first call
1219
1245
  buildPrompt(ctx) {
1220
1246
  return ensureCompiled().buildPrompt(ctx);
@@ -3334,6 +3360,13 @@ function parseComponentOutput(content, schema) {
3334
3360
  }
3335
3361
 
3336
3362
  // src/engine/executor.ts
3363
+ var EMPTY_LLM_RESULT = {
3364
+ response: { content: "" },
3365
+ messages: [],
3366
+ rounds: 0,
3367
+ toolCallsExecuted: 0,
3368
+ errors: []
3369
+ };
3337
3370
  async function executeComponent(component, ctx, adapter, config) {
3338
3371
  const startTime = Date.now();
3339
3372
  const llmResults = [];
@@ -5034,6 +5067,9 @@ async function executeStepNode(node, ctx, adapter, config) {
5034
5067
  if (!node.component) {
5035
5068
  throw new Error("Step node missing component");
5036
5069
  }
5070
+ if (node.component.mode === "pure") {
5071
+ return executePureComponent(node.component, ctx);
5072
+ }
5037
5073
  if (!adapter) {
5038
5074
  if (node.component.model?.adapter) {
5039
5075
  adapter = node.component.model.adapter;
@@ -5221,6 +5257,56 @@ function createIterationContext(baseCtx, currentItem, index, totalItems, itemMod
5221
5257
  isLastIteration: index === totalItems - 1
5222
5258
  };
5223
5259
  }
5260
+ async function executePureComponent(component, ctx) {
5261
+ ctx.ui?.startStep(component.id, component.id);
5262
+ await ctx.trace.log({
5263
+ type: "stage_start",
5264
+ stageId: component.id,
5265
+ timestamp: /* @__PURE__ */ new Date()
5266
+ });
5267
+ try {
5268
+ if (!component.extractOutput) {
5269
+ throw new Error(`Pure component '${component.id}' must have extractOutput defined`);
5270
+ }
5271
+ const output = await Promise.resolve(
5272
+ component.extractOutput(ctx, EMPTY_LLM_RESULT)
5273
+ );
5274
+ const schemaResult = component.outputSchema.safeParse(output);
5275
+ if (!schemaResult.success) {
5276
+ const errors = schemaResult.error.issues.map((e) => `${e.path.join(".")}: ${e.message}`).join("; ");
5277
+ throw new Error(`Pure component '${component.id}' output validation failed: ${errors}`);
5278
+ }
5279
+ const validatedOutput = schemaResult.data;
5280
+ if (component.validateOutput) {
5281
+ const validationResult = await Promise.resolve(
5282
+ component.validateOutput(validatedOutput, ctx)
5283
+ );
5284
+ if (!validationResult.valid) {
5285
+ const feedback = validationResult.feedback || validationResult.errors?.join("; ") || "Validation failed";
5286
+ throw new Error(`Pure component '${component.id}' validateOutput failed: ${feedback}`);
5287
+ }
5288
+ }
5289
+ if (ctx instanceof ExecutionContext) {
5290
+ ctx.previousOutputs[component.id] = validatedOutput;
5291
+ }
5292
+ await ctx.trace.log({
5293
+ type: "stage_complete",
5294
+ output: validatedOutput,
5295
+ timestamp: /* @__PURE__ */ new Date()
5296
+ });
5297
+ ctx.ui?.completeStep(component.id, "Pure execution complete");
5298
+ return validatedOutput;
5299
+ } catch (error) {
5300
+ const errorMessage = error instanceof Error ? error.message : String(error);
5301
+ await ctx.trace.log({
5302
+ type: "stage_failed",
5303
+ error: errorMessage,
5304
+ timestamp: /* @__PURE__ */ new Date()
5305
+ });
5306
+ ctx.ui?.failStep(component.id, errorMessage);
5307
+ throw error;
5308
+ }
5309
+ }
5224
5310
  function createStepNode(component) {
5225
5311
  return {
5226
5312
  type: "step",
@@ -5254,6 +5340,6 @@ function createLoopNode(child, maxIterations) {
5254
5340
  };
5255
5341
  }
5256
5342
 
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 };
5343
+ export { Agent, Conditional, DEADLINE_PROMPT, DEBUG_ENABLED, DebugLogger, EMPTY_LLM_RESULT, 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 };
5258
5344
  //# sourceMappingURL=index.js.map
5259
5345
  //# sourceMappingURL=index.js.map