@codemation/core 0.7.0 → 0.8.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{EngineRuntimeRegistration.types-_M7KFD3D.d.ts → EngineRuntimeRegistration.types-BP6tsaNP.d.ts} +4 -2
  3. package/dist/{EngineWorkflowRunnerService-D0Cwngv7.d.cts → EngineWorkflowRunnerService-DzOCa1BW.d.cts} +4 -2
  4. package/dist/{InMemoryRunDataFactory-BIWx6e02.d.cts → InMemoryRunDataFactory-1iz7_SnO.d.cts} +24 -4
  5. package/dist/{workflowActivationPolicy-6V3OJD3N.cjs → InMemoryRunEventBusRegistry-B0_C4OnP.cjs} +1 -16
  6. package/dist/InMemoryRunEventBusRegistry-B0_C4OnP.cjs.map +1 -0
  7. package/dist/{workflowActivationPolicy-Td9HTOuD.js → InMemoryRunEventBusRegistry-C2U83Hmv.js} +2 -11
  8. package/dist/InMemoryRunEventBusRegistry-C2U83Hmv.js.map +1 -0
  9. package/dist/{RunIntentService-CuXAIO6_.d.ts → RunIntentService-BqhmdoA1.d.ts} +231 -3
  10. package/dist/{RunIntentService-5k0p-J67.d.cts → RunIntentService-S-1lW-gS.d.cts} +203 -3
  11. package/dist/bootstrap/index.cjs +4 -2
  12. package/dist/bootstrap/index.d.cts +24 -5
  13. package/dist/bootstrap/index.d.ts +4 -4
  14. package/dist/bootstrap/index.js +3 -3
  15. package/dist/{bootstrap-D-TDU9Lu.cjs → bootstrap-BaN6hZ5I.cjs} +6 -3
  16. package/dist/bootstrap-BaN6hZ5I.cjs.map +1 -0
  17. package/dist/{bootstrap-BhYxSivA.js → bootstrap-d_BMaDT4.js} +6 -3
  18. package/dist/bootstrap-d_BMaDT4.js.map +1 -0
  19. package/dist/{index-BnJ7_IrO.d.ts → index-CVs9rVhl.d.ts} +36 -6
  20. package/dist/index.cjs +48 -83
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +23 -4
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +27 -74
  25. package/dist/index.js.map +1 -1
  26. package/dist/{runtime-CJnObwsU.js → runtime-DUW6tIJ1.js} +423 -33
  27. package/dist/runtime-DUW6tIJ1.js.map +1 -0
  28. package/dist/{runtime-3YVDd2vY.cjs → runtime-Dvo2ru5A.cjs} +548 -32
  29. package/dist/runtime-Dvo2ru5A.cjs.map +1 -0
  30. package/dist/testing.cjs +6 -6
  31. package/dist/testing.cjs.map +1 -1
  32. package/dist/testing.d.cts +2 -2
  33. package/dist/testing.d.ts +2 -2
  34. package/dist/testing.js +3 -3
  35. package/package.json +1 -1
  36. package/src/ai/AiHost.ts +2 -0
  37. package/src/ai/CallableToolConfig.ts +28 -3
  38. package/src/bootstrap/index.ts +6 -1
  39. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +1 -0
  40. package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +3 -0
  41. package/src/contracts/CodemationTelemetryAttributeNames.ts +12 -0
  42. package/src/contracts/CodemationTelemetryMetricNames.ts +7 -0
  43. package/src/contracts/CostCatalogContract.ts +16 -0
  44. package/src/contracts/CostTrackingTelemetryContract.ts +47 -0
  45. package/src/contracts/GenAiTelemetryAttributeNames.ts +10 -0
  46. package/src/contracts/NoOpCostTrackingTelemetry.ts +16 -0
  47. package/src/contracts/NoOpCostTrackingTelemetryFactory.ts +9 -0
  48. package/src/contracts/NoOpExecutionTelemetry.ts +26 -0
  49. package/src/contracts/NoOpExecutionTelemetryFactory.ts +16 -0
  50. package/src/contracts/NoOpNodeExecutionTelemetry.ts +15 -0
  51. package/src/contracts/NoOpTelemetryArtifactReference.ts +9 -0
  52. package/src/contracts/NoOpTelemetrySpanScope.ts +22 -0
  53. package/src/contracts/index.ts +1 -0
  54. package/src/contracts/runTypes.ts +4 -1
  55. package/src/contracts/runtimeTypes.ts +7 -0
  56. package/src/contracts/telemetryTypes.ts +105 -0
  57. package/src/contracts/workflowTypes.ts +9 -0
  58. package/src/events/EventPublishingWorkflowExecutionRepository.ts +1 -1
  59. package/src/execution/CatalogBackedCostTrackingTelemetry.ts +81 -0
  60. package/src/execution/CatalogBackedCostTrackingTelemetryFactory.ts +12 -0
  61. package/src/execution/DefaultExecutionContextFactory.ts +23 -0
  62. package/src/execution/ExecutionTelemetryCostTrackingDecoratorFactory.ts +84 -0
  63. package/src/execution/NodeActivationRequestComposer.ts +1 -0
  64. package/src/execution/NodeExecutionSnapshotFactory.ts +2 -0
  65. package/src/execution/StaticCostCatalog.ts +22 -0
  66. package/src/execution/WorkflowRunExecutionContextFactory.ts +2 -0
  67. package/src/execution/index.ts +4 -0
  68. package/src/orchestration/NodeExecutionRequestHandlerService.ts +1 -0
  69. package/src/orchestration/RunContinuationService.ts +4 -0
  70. package/src/orchestration/RunStartService.ts +2 -0
  71. package/src/policies/storage/RunPolicySnapshotFactory.ts +9 -0
  72. package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +4 -2
  73. package/src/types/index.ts +5 -0
  74. package/dist/bootstrap-BhYxSivA.js.map +0 -1
  75. package/dist/bootstrap-D-TDU9Lu.cjs.map +0 -1
  76. package/dist/runtime-3YVDd2vY.cjs.map +0 -1
  77. package/dist/runtime-CJnObwsU.js.map +0 -1
  78. package/dist/workflowActivationPolicy-6V3OJD3N.cjs.map +0 -1
  79. package/dist/workflowActivationPolicy-Td9HTOuD.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { $n as NodeExecutionStatePublisher, $r as RunPruneCandidate, Ai as CredentialType, An as BinaryStorageReadResult, At as NodeDefinition, Bt as NodeSchedulerDecision, Cr as WebhookInvocationMatch, Di as CredentialSessionFactoryArgs, Dt as NodeActivationId, En as RetryPolicySpec, Er as WebhookTriggerRoutingDiagnostics, Et as MutableRunData, Gn as NodeActivationRequest, Hi as TypeToken, Ir as NodeExecutionSnapshot, Jn as NodeBinaryAttachmentService, Jt as RunId, Kr as PersistedWorkflowSnapshotNode, Kt as RunDataFactory, Ln as ExecutionBinaryService, Lt as NodeOffloadPolicy, Mi as CredentialTypeId, Nn as BinaryStorageWriteResult, Nr as EngineRunCounters, Oi as CredentialSessionService, On as BinaryBody, Or as WorkflowActivationPolicy, Ot as NodeConfigBase, Pn as EngineDeps, Pt as NodeId, Qn as NodeExecutionScheduler, Rn as ExecutionContext, Rt as NodeOutputs, Ti as CredentialRequirement, Tt as JsonValue, Un as NodeActivationContinuation, Ur as PersistedRunSchedulingState, Ut as ParentExecutionRef, Wr as PersistedRunState, Xn as NodeExecutionRequest, Xt as RunnableNodeConfig, Y as Expr, Yn as NodeExecutionContext, Z as ParamDeep, Zt as RunnableNodeInputJson, aa as RunEventSubscription, ai as RunSummary, br as HttpMethod, bt as Items, ci as WorkflowExecutionPruneRepository, gi as CredentialHealth, gt as ExecutionMode, hi as CredentialFieldSchema, hr as WorkflowRepository, ia as RunEventBus, ji as CredentialTypeDefinition, jn as BinaryStorageStatResult, kn as BinaryStorage, kt as NodeConnectionName, l as WorkflowSnapshotCodec, li as WorkflowExecutionRepository, ln as WorkflowId, mr as WorkflowNodeInstanceFactory, pt as BinaryAttachment, qn as NodeActivationScheduler, qt as RunDataSnapshot, ra as RunEvent, rn as WorkflowDefinition, rr as PreparedNodeActivationDispatch, si as WorkflowExecutionListingRepository, ta as EngineExecutionLimitsPolicy, tr as NodeResolver, u as Engine, ui as AnyCredentialType, vt as Item, wr as WebhookTriggerMatcher, xi as CredentialJsonRecord, zn as ExecutionContextFactory } from "./RunIntentService-CuXAIO6_.js";
1
+ import { $ as Expr, $i as CredentialJsonRecord, $n as NodeExecutionContext, An as RetryPolicySpec, Ar as WebhookTriggerRoutingDiagnostics, At as MutableRunData, Br as NodeExecutionSnapshot, Dr as WebhookInvocationMatch, Fa as RunEvent, Fn as BinaryStorageStatResult, Hi as AnyCredentialType, Hn as ExecutionContext, Ht as NodeOutputs, Ia as RunEventBus, J as CostCatalog, Ji as CredentialHealth, Jr as PersistedRunState, Jt as PersistedRunPolicySnapshot, La as RunEventSubscription, Li as CostTrackingTelemetry, Ln as BinaryStorageWriteResult, Lr as EngineRunCounters, Mn as BinaryBody, Mr as WorkflowActivationPolicy, Mt as NodeConfigBase, Na as EngineExecutionLimitsPolicy, Nn as BinaryStorage, Nt as NodeConnectionName, Or as WebhookTriggerMatcher, Pn as BinaryStorageReadResult, Pt as NodeDefinition, Qn as NodeBinaryAttachmentService, Qt as RunId, Rn as EngineDeps, Rt as NodeId, St as Item, Un as ExecutionContextFactory, Vi as CostTrackingUsageRecord, Vn as ExecutionBinaryService, Vt as NodeOffloadPolicy, Wt as NodeSchedulerDecision, Xr as PersistedWorkflowSnapshotNode, Xt as RunDataFactory, Y as CostCatalogEntry, Yn as NodeActivationRequest, Zn as NodeActivationScheduler, Zt as RunDataSnapshot, _t as BinaryAttachment, aa as CredentialSessionFactoryArgs, ar as NodeResolver, ba as TypeToken, bt as ExecutionMode, ca as CredentialType, di as WorkflowExecutionListingRepository, en as RunnableNodeConfig, er as NodeExecutionRequest, fi as WorkflowExecutionPruneRepository, hi as ExecutionTelemetryFactory, jt as NodeActivationId, kt as JsonValue, l as WorkflowSnapshotCodec, la as CredentialTypeDefinition, li as RunSummary, mi as ExecutionTelemetry, nr as NodeExecutionScheduler, oa as CredentialSessionService, pi as WorkflowExecutionRepository, pn as WorkflowId, qi as CredentialFieldSchema, qn as NodeActivationContinuation, qr as PersistedRunSchedulingState, qt as ParentExecutionRef, ra as CredentialRequirement, ri as RunPruneCandidate, rr as NodeExecutionStatePublisher, sn as WorkflowDefinition, sr as PreparedNodeActivationDispatch, tn as RunnableNodeInputJson, tt as ParamDeep, u as Engine, ua as CredentialTypeId, vr as WorkflowNodeInstanceFactory, wr as HttpMethod, wt as Items, yr as WorkflowRepository, zi as CostTrackingTelemetryFactory } from "./RunIntentService-BqhmdoA1.js";
2
2
  import { ZodType, input, output, z } from "zod";
3
3
 
4
4
  //#region src/workflowSnapshots/MissingRuntimeFallbacksFactory.d.ts
@@ -54,21 +54,35 @@ declare class DefaultAsyncSleeper implements AsyncSleeper {
54
54
  //#region src/execution/DefaultExecutionContextFactory.d.ts
55
55
  declare class DefaultExecutionContextFactory implements ExecutionContextFactory {
56
56
  private readonly binaryStorage;
57
+ private readonly telemetryFactory;
58
+ private readonly costTrackingFactory;
57
59
  private readonly currentDate;
58
- constructor(binaryStorage?: BinaryStorage, currentDate?: () => Date);
60
+ private readonly telemetryDecoratorFactory;
61
+ constructor(binaryStorage?: BinaryStorage, telemetryFactory?: ExecutionTelemetryFactory, costTrackingFactory?: CostTrackingTelemetryFactory, currentDate?: () => Date);
59
62
  create(args: {
60
63
  runId: RunId;
61
64
  workflowId: WorkflowId;
62
65
  parent?: ParentExecutionRef;
66
+ policySnapshot?: PersistedRunPolicySnapshot;
63
67
  subworkflowDepth: number;
64
68
  engineMaxNodeActivations: number;
65
69
  engineMaxSubworkflowDepth: number;
66
70
  data: RunDataSnapshot;
67
71
  nodeState?: NodeExecutionStatePublisher;
72
+ telemetry?: ExecutionContext["telemetry"];
68
73
  getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
69
74
  }): ExecutionContext;
70
75
  }
71
76
  //#endregion
77
+ //#region src/execution/CatalogBackedCostTrackingTelemetryFactory.d.ts
78
+ declare class CatalogBackedCostTrackingTelemetryFactory implements CostTrackingTelemetryFactory {
79
+ private readonly costCatalog;
80
+ constructor(costCatalog: CostCatalog);
81
+ create(args: Readonly<{
82
+ telemetry: ExecutionTelemetry;
83
+ }>): CostTrackingTelemetry;
84
+ }
85
+ //#endregion
72
86
  //#region src/execution/InProcessRetryRunner.d.ts
73
87
  declare class InProcessRetryRunner {
74
88
  private readonly sleeper;
@@ -324,6 +338,9 @@ declare class CallableToolConfig<TInputSchema extends ZodSchemaAny, TOutputSchem
324
338
  * Parses tool input and output with the configured Zod schemas.
325
339
  */
326
340
  executeTool(args: ToolExecuteArgs<CallableToolConfig<TInputSchema, TOutputSchema>, input<TInputSchema>>): Promise<output<TOutputSchema>>;
341
+ private parseInput;
342
+ private parseOutput;
343
+ private decorateValidationError;
327
344
  }
328
345
  //#endregion
329
346
  //#region src/ai/CallableToolFactory.d.ts
@@ -454,6 +471,8 @@ type AgentToolCallPlanner<_TNodeConfig = unknown> = (item: Item, index: number,
454
471
  interface ChatModelConfig {
455
472
  readonly type: TypeToken<ChatModelFactory<ChatModelConfig>>;
456
473
  readonly name: string;
474
+ readonly provider?: string;
475
+ readonly modelName?: string;
457
476
  readonly presentation?: AgentCanvasPresentation;
458
477
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
459
478
  }
@@ -564,7 +583,8 @@ declare class EventPublishingWorkflowExecutionRepository implements WorkflowExec
564
583
  limit?: number;
565
584
  }>): Promise<ReadonlyArray<RunSummary>>;
566
585
  listRunsOlderThan(args: Readonly<{
567
- beforeIso: string;
586
+ nowIso: string;
587
+ defaultRetentionSeconds: number;
568
588
  limit?: number;
569
589
  }>): Promise<ReadonlyArray<RunPruneCandidate>>;
570
590
  }
@@ -708,7 +728,8 @@ declare class InMemoryWorkflowExecutionRepository implements WorkflowExecutionRe
708
728
  limit?: number;
709
729
  }>): Promise<ReadonlyArray<RunSummary>>;
710
730
  listRunsOlderThan(args: Readonly<{
711
- beforeIso: string;
731
+ nowIso: string;
732
+ defaultRetentionSeconds: number;
712
733
  limit?: number;
713
734
  }>): Promise<ReadonlyArray<RunPruneCandidate>>;
714
735
  }
@@ -745,6 +766,15 @@ declare class WorkflowRepositoryWebhookTriggerMatcher implements WebhookTriggerM
745
766
  private normalizeEndpointPath;
746
767
  }
747
768
  //#endregion
769
+ //#region src/execution/StaticCostCatalog.d.ts
770
+ declare class StaticCostCatalog implements CostCatalog {
771
+ private readonly entriesByKey;
772
+ constructor(entries: ReadonlyArray<CostCatalogEntry>);
773
+ findEntry(args: CostTrackingUsageRecord): CostCatalogEntry | undefined;
774
+ private createKeyFromEntry;
775
+ private createKeyFromUsage;
776
+ }
777
+ //#endregion
748
778
  //#region src/scheduler/ConfigDrivenOffloadPolicy.d.ts
749
779
  declare class ConfigDrivenOffloadPolicy implements NodeOffloadPolicy {
750
780
  private readonly defaultMode;
@@ -810,5 +840,5 @@ declare class LocalOnlyScheduler implements NodeExecutionScheduler {
810
840
  }>;
811
841
  }
812
842
  //#endregion
813
- export { ChatModelFactory as $, AgentConnectionNodeRole as A, DefinedNodeCredentialBinding as At, AgentMessageRole as B, RunnableOutputBehaviorResolver as Bt, PersistedRuntimeTypeKind as C, DefinedNodeRegistry as Ct, AgentConnectionCredentialSource as D, DefinedNode as Dt, InMemoryRunEventBus as E, DefineNodeOptions as Et, AgentGuardrailDefaults as F, Clock as Ft, AgentTool as G, AsyncSleeper as Gt, AgentMessageTemplateContent as H, InProcessRetryRunner as Ht, AgentMessageBuildArgs as I, SystemClock as It, AgentToolDefinition as J, EngineCompositionDeps as Jt, AgentToolCall as K, CredentialResolverFactory as Kt, AgentMessageConfig as L, NodeInstanceFactory as Lt, AgentAttachmentRole as M, DefinedNodeRunContext as Mt, AgentCanvasPresentation as N, defineBatchNode as Nt, AgentConnectionNodeCollector as O, DefinedNodeConfigInput as Ot, AgentGuardrailConfig as P, defineNode as Pt, ChatModelConfig as Q, AgentMessageDto as R, NodeExecutor as Rt, PersistedRuntimeTypeDecoratorOptions as S, defineCredential as St, EventPublishingWorkflowExecutionRepository as T, DefineNodeExecuteArgs as Tt, AgentModelInvocationOptions as U, DefaultExecutionContextFactory as Ut, AgentMessageTemplate as V, ItemExprResolver as Vt, AgentNodeConfig as W, DefaultAsyncSleeper as Wt, AgentToolToken as X, AgentToolExecuteArgs as Y, EngineFactory as Yt, AgentTurnLimitBehavior as Z, tool as _, CallableToolConfig as _t, ConfigDrivenOffloadPolicy as a, NodeBackedToolInputMapperArgs as at, PersistedRuntimeTypeMetadataStore as b, NodeBackedToolConfig as bt, InMemoryWorkflowExecutionRepository as c, Tool as ct, DefaultExecutionBinaryService as d, ZodSchemaAny as dt, ChatModelStructuredOutputOptions as et, UnavailableBinaryStorage as f, AgentConfigInspector as ft, node as g, CallableToolFactory as gt, getPersistedRuntimeTypeMetadata as h, CallableToolKindToken as ht, InlineDrivingScheduler as i, NodeBackedToolInputMapper as it, callableTool as j, DefinedNodeCredentialBindings as jt, AgentConnectionNodeDescriptor as k, DefinedNodeCredentialAccessors as kt, InMemoryRunDataFactory as l, ToolConfig as lt, chatModel as m, AgentToolFactory as mt, HintOnlyOffloadPolicy as n, LangChainStructuredOutputModelLike as nt, WorkflowRepositoryWebhookTriggerMatcher as o, NodeBackedToolOutputMapper as ot, ItemsInputNormalizer as p, AgentMessageConfigNormalizer as pt, AgentToolCallPlanner as q, NodeEventPublisher as qt, DefaultDrivingScheduler as r, NodeBackedToolConfigOptions as rt, RunSummaryMapper as s, NodeBackedToolOutputMapperArgs as st, LocalOnlyScheduler as t, LangChainChatModelLike as tt, InMemoryBinaryStorage as u, ToolExecuteArgs as ut, StackTraceCallSitePathResolver as v, CallableToolConfigOptions as vt, PersistedRuntimeTypeMetadata as w, DefineBatchNodeOptions as wt, InjectableRuntimeDecoratorComposer as x, DefineCredentialOptions as xt, PersistedRuntimeTypeNameResolver as y, CallableToolExecuteHandler as yt, AgentMessageLine as z, NodeOutputNormalizer as zt };
814
- //# sourceMappingURL=index-BnJ7_IrO.d.ts.map
843
+ export { ChatModelConfig as $, AgentConnectionNodeDescriptor as A, DefinedNodeCredentialAccessors as At, AgentMessageLine as B, NodeOutputNormalizer as Bt, PersistedRuntimeTypeDecoratorOptions as C, defineCredential as Ct, InMemoryRunEventBus as D, DefineNodeOptions as Dt, EventPublishingWorkflowExecutionRepository as E, DefineNodeExecuteArgs as Et, AgentGuardrailConfig as F, defineNode as Ft, AgentNodeConfig as G, DefaultExecutionContextFactory as Gt, AgentMessageTemplate as H, ItemExprResolver as Ht, AgentGuardrailDefaults as I, Clock as It, AgentToolCallPlanner as J, CredentialResolverFactory as Jt, AgentTool as K, DefaultAsyncSleeper as Kt, AgentMessageBuildArgs as L, SystemClock as Lt, callableTool as M, DefinedNodeCredentialBindings as Mt, AgentAttachmentRole as N, DefinedNodeRunContext as Nt, AgentConnectionCredentialSource as O, DefinedNode as Ot, AgentCanvasPresentation as P, defineBatchNode as Pt, AgentTurnLimitBehavior as Q, AgentMessageConfig as R, NodeInstanceFactory as Rt, InjectableRuntimeDecoratorComposer as S, DefineCredentialOptions as St, PersistedRuntimeTypeMetadata as T, DefineBatchNodeOptions as Tt, AgentMessageTemplateContent as U, InProcessRetryRunner as Ut, AgentMessageRole as V, RunnableOutputBehaviorResolver as Vt, AgentModelInvocationOptions as W, CatalogBackedCostTrackingTelemetryFactory as Wt, AgentToolExecuteArgs as X, EngineCompositionDeps as Xt, AgentToolDefinition as Y, NodeEventPublisher as Yt, AgentToolToken as Z, EngineFactory as Zt, node as _, CallableToolFactory as _t, ConfigDrivenOffloadPolicy as a, NodeBackedToolInputMapper as at, PersistedRuntimeTypeNameResolver as b, CallableToolExecuteHandler as bt, RunSummaryMapper as c, NodeBackedToolOutputMapperArgs as ct, InMemoryBinaryStorage as d, ToolExecuteArgs as dt, ChatModelFactory as et, DefaultExecutionBinaryService as f, ZodSchemaAny as ft, getPersistedRuntimeTypeMetadata as g, CallableToolKindToken as gt, chatModel as h, AgentToolFactory as ht, InlineDrivingScheduler as i, NodeBackedToolConfigOptions as it, AgentConnectionNodeRole as j, DefinedNodeCredentialBinding as jt, AgentConnectionNodeCollector as k, DefinedNodeConfigInput as kt, InMemoryWorkflowExecutionRepository as l, Tool as lt, ItemsInputNormalizer as m, AgentMessageConfigNormalizer as mt, HintOnlyOffloadPolicy as n, LangChainChatModelLike as nt, StaticCostCatalog as o, NodeBackedToolInputMapperArgs as ot, UnavailableBinaryStorage as p, AgentConfigInspector as pt, AgentToolCall as q, AsyncSleeper as qt, DefaultDrivingScheduler as r, LangChainStructuredOutputModelLike as rt, WorkflowRepositoryWebhookTriggerMatcher as s, NodeBackedToolOutputMapper as st, LocalOnlyScheduler as t, ChatModelStructuredOutputOptions as tt, InMemoryRunDataFactory as u, ToolConfig as ut, tool as v, CallableToolConfig as vt, PersistedRuntimeTypeKind as w, DefinedNodeRegistry as wt, PersistedRuntimeTypeMetadataStore as x, NodeBackedToolConfig as xt, StackTraceCallSitePathResolver as y, CallableToolConfigOptions as yt, AgentMessageDto as z, NodeExecutor as zt };
844
+ //# sourceMappingURL=index-CVs9rVhl.d.ts.map
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_runtime = require('./runtime-3YVDd2vY.cjs');
2
- const require_workflowActivationPolicy = require('./workflowActivationPolicy-6V3OJD3N.cjs');
1
+ const require_runtime = require('./runtime-Dvo2ru5A.cjs');
2
+ const require_InMemoryRunEventBusRegistry = require('./InMemoryRunEventBusRegistry-B0_C4OnP.cjs');
3
3
  let zod = require("zod");
4
4
  zod = require_runtime.__toESM(zod);
5
5
  let node_crypto = require("node:crypto");
@@ -286,13 +286,34 @@ var CallableToolConfig = class {
286
286
  * Parses tool input and output with the configured Zod schemas.
287
287
  */
288
288
  async executeTool(args) {
289
- const parsedInput = this.inputSchemaValue.parse(args.input);
289
+ const parsedInput = this.parseInput(args.input);
290
290
  const raw = await Promise.resolve(this.executeHandler({
291
291
  ...args,
292
292
  config: this,
293
293
  input: parsedInput
294
294
  }));
295
- return this.outputSchemaValue.parse(raw);
295
+ return this.parseOutput(raw);
296
+ }
297
+ parseInput(input) {
298
+ try {
299
+ return this.inputSchemaValue.parse(input);
300
+ } catch (error) {
301
+ throw this.decorateValidationError(error, "input");
302
+ }
303
+ }
304
+ parseOutput(output) {
305
+ try {
306
+ return this.outputSchemaValue.parse(output);
307
+ } catch (error) {
308
+ throw this.decorateValidationError(error, "output");
309
+ }
310
+ }
311
+ decorateValidationError(error, stage) {
312
+ if (error instanceof zod.ZodError) {
313
+ error.codemationToolValidationStage = stage;
314
+ return error;
315
+ }
316
+ return error instanceof Error ? error : new Error(String(error));
296
317
  }
297
318
  };
298
319
 
@@ -652,90 +673,26 @@ let ItemsInputNormalizer = class ItemsInputNormalizer$1 {
652
673
  };
653
674
  ItemsInputNormalizer = __decorate([(0, tsyringe.injectable)()], ItemsInputNormalizer);
654
675
 
655
- //#endregion
656
- //#region src/contracts/NoRetryPolicy.ts
657
- var NoRetryPolicy = class {
658
- kind = "none";
659
- };
660
-
661
- //#endregion
662
- //#region src/contracts/RetryPolicy.ts
663
- var RetryPolicy = class {
664
- kind = "fixed";
665
- constructor(maxAttempts, delayMs) {
666
- this.maxAttempts = maxAttempts;
667
- this.delayMs = delayMs;
668
- if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) throw new Error(`RetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
669
- if (!Number.isFinite(delayMs) || delayMs < 0) throw new Error(`RetryPolicy.delayMs must be a non-negative finite number, got ${delayMs}`);
670
- }
671
- /** Default for HTTP-style transient failures: 3 tries, 1s between attempts. */
672
- static defaultForHttp = {
673
- kind: "fixed",
674
- maxAttempts: 3,
675
- delayMs: 1e3
676
- };
677
- /** Default for LLM / agent calls: 3 tries, 2s fixed backoff. */
678
- static defaultForAiAgent = {
679
- kind: "fixed",
680
- maxAttempts: 3,
681
- delayMs: 2e3
682
- };
683
- };
684
-
685
- //#endregion
686
- //#region src/contracts/ExpRetryPolicy.ts
687
- var ExpRetryPolicy = class {
688
- kind = "exponential";
689
- constructor(maxAttempts, initialDelayMs, multiplier, maxDelayMs, jitter) {
690
- this.maxAttempts = maxAttempts;
691
- this.initialDelayMs = initialDelayMs;
692
- this.multiplier = multiplier;
693
- this.maxDelayMs = maxDelayMs;
694
- this.jitter = jitter;
695
- if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) throw new Error(`ExpRetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
696
- if (!Number.isFinite(initialDelayMs) || initialDelayMs < 0) throw new Error(`ExpRetryPolicy.initialDelayMs must be a non-negative finite number, got ${initialDelayMs}`);
697
- if (!Number.isFinite(multiplier) || multiplier < 1) throw new Error(`ExpRetryPolicy.multiplier must be >= 1, got ${multiplier}`);
698
- }
699
- };
700
-
701
- //#endregion
702
- //#region src/contracts/credentialTypes.ts
703
- var CredentialUnboundError = class CredentialUnboundError extends Error {
704
- constructor(bindingKey, acceptedTypes = []) {
705
- super(CredentialUnboundError.createMessage(bindingKey, acceptedTypes));
706
- this.bindingKey = bindingKey;
707
- this.acceptedTypes = acceptedTypes;
708
- this.name = "CredentialUnboundError";
709
- }
710
- static createMessage(bindingKey, acceptedTypes) {
711
- const acceptedTypesSuffix = acceptedTypes.length > 0 ? ` Accepted credential types: ${acceptedTypes.join(", ")}.` : "";
712
- return `Credential slot "${bindingKey.slotKey}" is not bound for workflow ${bindingKey.workflowId} node ${bindingKey.nodeId}.${acceptedTypesSuffix}`;
713
- }
714
- };
715
-
716
- //#endregion
717
- //#region src/contracts/workflowTypes.ts
718
- function nodeRef(nodeId) {
719
- return nodeId;
720
- }
721
- const branchRef = (index) => `$${index}`;
722
-
723
676
  //#endregion
724
677
  exports.AgentConfigInspector = AgentConfigInspector;
725
678
  exports.AgentConnectionNodeCollector = AgentConnectionNodeCollector;
726
679
  exports.AgentGuardrailDefaults = AgentGuardrailDefaults;
727
680
  exports.AgentMessageConfigNormalizer = AgentMessageConfigNormalizer;
728
681
  exports.AgentToolFactory = AgentToolFactory;
729
- exports.AllWorkflowsActiveWorkflowActivationPolicy = require_workflowActivationPolicy.AllWorkflowsActiveWorkflowActivationPolicy;
682
+ exports.AllWorkflowsActiveWorkflowActivationPolicy = require_runtime.AllWorkflowsActiveWorkflowActivationPolicy;
730
683
  exports.CallableToolConfig = CallableToolConfig;
731
684
  exports.CallableToolFactory = CallableToolFactory;
732
685
  exports.CallableToolKindToken = CallableToolKindToken;
733
- exports.ChainCursor = require_workflowActivationPolicy.ChainCursor;
686
+ exports.ChainCursor = require_InMemoryRunEventBusRegistry.ChainCursor;
687
+ exports.CodemationTelemetryAttributeNames = require_runtime.CodemationTelemetryAttributeNames;
688
+ exports.CodemationTelemetryMetricNames = require_runtime.CodemationTelemetryMetricNames;
734
689
  exports.ConnectionInvocationIdFactory = ConnectionInvocationIdFactory;
735
690
  exports.ConnectionNodeIdFactory = require_runtime.ConnectionNodeIdFactory;
736
691
  exports.CoreTokens = require_runtime.CoreTokens;
692
+ exports.CostTrackingTelemetryAttributeNames = require_runtime.CostTrackingTelemetryAttributeNames;
693
+ exports.CostTrackingTelemetryMetricNames = require_runtime.CostTrackingTelemetryMetricNames;
737
694
  exports.CredentialResolverFactory = require_runtime.CredentialResolverFactory;
738
- exports.CredentialUnboundError = CredentialUnboundError;
695
+ exports.CredentialUnboundError = require_runtime.CredentialUnboundError;
739
696
  exports.DefaultAsyncSleeper = require_runtime.DefaultAsyncSleeper;
740
697
  exports.DefaultExecutionBinaryService = require_runtime.DefaultExecutionBinaryService;
741
698
  exports.DefaultExecutionContextFactory = require_runtime.DefaultExecutionContextFactory;
@@ -743,11 +700,12 @@ exports.DefaultWorkflowGraphFactory = DefaultWorkflowGraphFactory;
743
700
  exports.DefinedNodeRegistry = DefinedNodeRegistry;
744
701
  exports.EngineExecutionLimitsPolicy = require_runtime.EngineExecutionLimitsPolicy;
745
702
  exports.EventPublishingWorkflowExecutionRepository = EventPublishingWorkflowExecutionRepository;
746
- exports.ExpRetryPolicy = ExpRetryPolicy;
703
+ exports.ExpRetryPolicy = require_runtime.ExpRetryPolicy;
704
+ exports.GenAiTelemetryAttributeNames = require_runtime.GenAiTelemetryAttributeNames;
747
705
  exports.InMemoryBinaryStorage = require_runtime.InMemoryBinaryStorage;
748
706
  exports.InMemoryLiveWorkflowRepository = require_runtime.InMemoryLiveWorkflowRepository;
749
707
  exports.InMemoryRunDataFactory = require_runtime.InMemoryRunDataFactory;
750
- exports.InMemoryRunEventBus = require_workflowActivationPolicy.InMemoryRunEventBus;
708
+ exports.InMemoryRunEventBus = require_InMemoryRunEventBusRegistry.InMemoryRunEventBus;
751
709
  exports.InProcessRetryRunner = require_runtime.InProcessRetryRunner;
752
710
  exports.InjectableRuntimeDecoratorComposer = require_runtime.InjectableRuntimeDecoratorComposer;
753
711
  exports.ItemExprResolver = require_runtime.ItemExprResolver;
@@ -757,24 +715,31 @@ Object.defineProperty(exports, 'ItemsInputNormalizer', {
757
715
  return ItemsInputNormalizer;
758
716
  }
759
717
  });
760
- exports.NoRetryPolicy = NoRetryPolicy;
718
+ exports.NoOpCostTrackingTelemetry = require_runtime.NoOpCostTrackingTelemetry;
719
+ exports.NoOpCostTrackingTelemetryFactory = require_runtime.NoOpCostTrackingTelemetryFactory;
720
+ exports.NoOpExecutionTelemetry = require_runtime.NoOpExecutionTelemetry;
721
+ exports.NoOpExecutionTelemetryFactory = require_runtime.NoOpExecutionTelemetryFactory;
722
+ exports.NoOpNodeExecutionTelemetry = require_runtime.NoOpNodeExecutionTelemetry;
723
+ exports.NoOpTelemetryArtifactReference = require_runtime.NoOpTelemetryArtifactReference;
724
+ exports.NoOpTelemetrySpanScope = require_runtime.NoOpTelemetrySpanScope;
725
+ exports.NoRetryPolicy = require_runtime.NoRetryPolicy;
761
726
  exports.NodeBackedToolConfig = NodeBackedToolConfig;
762
727
  exports.NodeEventPublisher = require_runtime.NodeEventPublisher;
763
728
  exports.NodeOutputNormalizer = require_runtime.NodeOutputNormalizer;
764
729
  exports.PersistedRuntimeTypeMetadataStore = require_runtime.PersistedRuntimeTypeMetadataStore;
765
730
  exports.PersistedRuntimeTypeNameResolver = require_runtime.PersistedRuntimeTypeNameResolver;
766
- exports.RetryPolicy = RetryPolicy;
731
+ exports.RetryPolicy = require_runtime.RetryPolicy;
767
732
  exports.RunFinishedAtFactory = require_runtime.RunFinishedAtFactory;
768
733
  exports.RunIntentService = require_runtime.RunIntentService;
769
734
  exports.RunnableOutputBehaviorResolver = require_runtime.RunnableOutputBehaviorResolver;
770
735
  exports.StackTraceCallSitePathResolver = require_runtime.StackTraceCallSitePathResolver;
771
736
  exports.SystemClock = SystemClock;
772
737
  exports.UnavailableBinaryStorage = require_runtime.UnavailableBinaryStorage;
773
- exports.WhenBuilder = require_workflowActivationPolicy.WhenBuilder;
774
- exports.WorkflowBuilder = require_workflowActivationPolicy.WorkflowBuilder;
738
+ exports.WhenBuilder = require_InMemoryRunEventBusRegistry.WhenBuilder;
739
+ exports.WorkflowBuilder = require_InMemoryRunEventBusRegistry.WorkflowBuilder;
775
740
  exports.WorkflowExecutableNodeClassifier = require_runtime.WorkflowExecutableNodeClassifier;
776
741
  exports.WorkflowExecutableNodeClassifierFactory = require_runtime.WorkflowExecutableNodeClassifierFactory;
777
- exports.branchRef = branchRef;
742
+ exports.branchRef = require_runtime.branchRef;
778
743
  exports.callableTool = callableTool;
779
744
  exports.chatModel = require_runtime.chatModel;
780
745
  Object.defineProperty(exports, 'container', {
@@ -830,7 +795,7 @@ exports.isPortsEmission = require_runtime.isPortsEmission;
830
795
  exports.isUnbrandedPortsEmissionShape = require_runtime.isUnbrandedPortsEmissionShape;
831
796
  exports.itemExpr = require_runtime.itemExpr;
832
797
  exports.node = require_runtime.node;
833
- exports.nodeRef = nodeRef;
798
+ exports.nodeRef = require_runtime.nodeRef;
834
799
  Object.defineProperty(exports, 'predicateAwareClassFactory', {
835
800
  enumerable: true,
836
801
  get: function () {