@codemation/core 0.0.16 → 0.0.18

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.
@@ -1,4 +1,4 @@
1
- const require_RunIntentService = require('../RunIntentService-DlQH5eZ2.cjs');
1
+ const require_RunIntentService = require('../RunIntentService-nRx-m0Xs.cjs');
2
2
  const require_InMemoryLiveWorkflowRepository = require('../InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs');
3
3
  let tsyringe = require("tsyringe");
4
4
  tsyringe = require_RunIntentService.__toESM(tsyringe);
@@ -1,5 +1,5 @@
1
1
  import { Jn as WebhookTriggerRoutingDiagnostics, Kn as WebhookTriggerMatcher, Lr as TypeToken, Mr as DependencyContainer, Nt as WorkflowDefinition, Xr as EngineExecutionLimitsPolicy, Yr as ENGINE_EXECUTION_LIMITS_DEFAULTS, Zr as EngineExecutionLimitsPolicyConfig, jn as TriggerRuntimeDiagnostics, t as InMemoryLiveWorkflowRepository, xt as PersistedTokenId } from "../InMemoryLiveWorkflowRepository-DxoualoC.js";
2
- import { Ct as AsyncSleeper, Dt as EngineFactory, Et as EngineCompositionDeps, Ot as Engine, St as DefaultAsyncSleeper, _ as EngineExecutionLimitsPolicyFactory, a as ConfigDrivenOffloadPolicy, bt as InProcessRetryRunner, c as EngineWorkflowRunnerService, d as InMemoryRunDataFactory, f as InMemoryBinaryStorage, g as RunPolicySnapshotFactory, h as WorkflowStoragePolicyEvaluator, i as InlineDrivingScheduler, l as RunSummaryMapper, m as RunTerminalPersistenceCoordinator, n as HintOnlyOffloadPolicy, o as WorkflowRepositoryWebhookTriggerMatcher, p as WorkflowPolicyErrorServices, r as DefaultDrivingScheduler, s as RunIntentService, t as LocalOnlyScheduler, u as InMemoryWorkflowExecutionRepository, v as DefaultExecutionBinaryService, vt as NodeInstanceFactory, wt as CredentialResolverFactory, xt as DefaultExecutionContextFactory, y as UnavailableBinaryStorage, yt as NodeExecutor } from "../index-k0hwnJyT.js";
2
+ import { At as InProcessRetryRunner, It as EngineCompositionDeps, Lt as EngineFactory, Mt as DefaultAsyncSleeper, Nt as AsyncSleeper, Ot as NodeInstanceFactory, Pt as CredentialResolverFactory, Rt as Engine, _ as EngineExecutionLimitsPolicyFactory, a as ConfigDrivenOffloadPolicy, c as EngineWorkflowRunnerService, d as InMemoryRunDataFactory, f as InMemoryBinaryStorage, g as RunPolicySnapshotFactory, h as WorkflowStoragePolicyEvaluator, i as InlineDrivingScheduler, jt as DefaultExecutionContextFactory, kt as NodeExecutor, l as RunSummaryMapper, m as RunTerminalPersistenceCoordinator, n as HintOnlyOffloadPolicy, o as WorkflowRepositoryWebhookTriggerMatcher, p as WorkflowPolicyErrorServices, r as DefaultDrivingScheduler, s as RunIntentService, t as LocalOnlyScheduler, u as InMemoryWorkflowExecutionRepository, v as DefaultExecutionBinaryService, y as UnavailableBinaryStorage } from "../index-B4_ZRTyI.js";
3
3
 
4
4
  //#region src/bootstrap/runtime/EngineRuntimeRegistration.types.d.ts
5
5
 
@@ -1,4 +1,4 @@
1
- import { A as InProcessRetryRunnerFactory, C as PersistedWorkflowTokenRegistry, D as NodeExecutorFactory, E as MissingRuntimeExecutionMarker, F as ActivationEnqueueService, I as DefaultExecutionBinaryService, K as NodeEventPublisher, L as UnavailableBinaryStorage, M as DefaultExecutionContextFactory, N as DefaultAsyncSleeper, O as NodeExecutor, P as CredentialResolverFactory, Q as instanceCachingFactory, S as WorkflowSnapshotResolver, T as MissingRuntimeTriggerToken, _ as RunStateSemantics, a as ENGINE_EXECUTION_LIMITS_DEFAULTS, b as NodeInstanceFactoryFactory, c as InlineDrivingScheduler, d as ConfigDrivenOffloadPolicy, f as RunStartService, g as WorkflowRunExecutionContextFactory, h as WorkflowTopology, i as InMemoryBinaryStorage, it as WorkflowExecutableNodeClassifierFactory, j as InProcessRetryRunner, k as NodeActivationRequestComposer, l as HintOnlyOffloadPolicy, m as RunContinuationService, n as RunFinishedAtFactory, o as EngineExecutionLimitsPolicy, p as RunPolicySnapshotFactory, r as InMemoryRunDataFactory, rt as CoreTokens, s as LocalOnlyScheduler, t as RunIntentService, u as DefaultDrivingScheduler, v as PersistedRunStateTerminalBuilder, w as MissingRuntimeFallbacks, x as NodeInstanceFactory, y as NodeRunStateWriterFactory } from "../RunIntentService-CYnn140t.js";
1
+ import { A as InProcessRetryRunnerFactory, C as PersistedWorkflowTokenRegistry, D as NodeExecutorFactory, E as MissingRuntimeExecutionMarker, F as ActivationEnqueueService, I as DefaultExecutionBinaryService, L as UnavailableBinaryStorage, M as DefaultExecutionContextFactory, N as DefaultAsyncSleeper, O as NodeExecutor, P as CredentialResolverFactory, R as NodeEventPublisher, S as WorkflowSnapshotResolver, T as MissingRuntimeTriggerToken, _ as RunStateSemantics, a as ENGINE_EXECUTION_LIMITS_DEFAULTS, b as NodeInstanceFactoryFactory, c as InlineDrivingScheduler, d as ConfigDrivenOffloadPolicy, f as RunStartService, g as WorkflowRunExecutionContextFactory, h as WorkflowTopology, i as InMemoryBinaryStorage, j as InProcessRetryRunner, k as NodeActivationRequestComposer, l as HintOnlyOffloadPolicy, m as RunContinuationService, n as RunFinishedAtFactory, o as EngineExecutionLimitsPolicy, ot as CoreTokens, p as RunPolicySnapshotFactory, r as InMemoryRunDataFactory, s as LocalOnlyScheduler, t as RunIntentService, tt as instanceCachingFactory, u as DefaultDrivingScheduler, v as PersistedRunStateTerminalBuilder, w as MissingRuntimeFallbacks, x as NodeInstanceFactory, y as NodeRunStateWriterFactory, z as WorkflowExecutableNodeClassifierFactory } from "../RunIntentService-BB4nqX3-.js";
2
2
  import { n as WorkflowSnapshotCodec, t as InMemoryLiveWorkflowRepository } from "../InMemoryLiveWorkflowRepository-BoLNnVLg.js";
3
3
 
4
4
  //#region src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts
@@ -1,5 +1,5 @@
1
- import { $r as RunEventBus, $t as BinaryBody, Ar as WorkflowExecutionRepository, Cn as NodeExecutionScheduler, Ct as RunDataSnapshot, Dr as WebhookRunResult, Dt as RunnableNodeInputJson, En as NodeResolver, Er as RunSummary, Et as RunnableNodeConfig, Ft as WorkflowErrorHandler, G as BinaryAttachment, Gn as WebhookInvocationMatch, Hn as HttpMethod, I as CredentialSessionService, In as WorkflowNodeInstanceFactory, It as WorkflowErrorHandlerSpec, J as ExecutionMode, Jn as WebhookTriggerRoutingDiagnostics, Kn as WebhookTriggerMatcher, Ln as WorkflowRepository, Lr as TypeToken, N as CredentialRequirement, Nt as WorkflowDefinition, Or as WorkflowExecutionListingRepository, Q as Items, Qr as RunEvent, Sn as NodeExecutionRequestHandler, Sr as RunResult, St as RunDataFactory, Tr as RunStopCondition, Ut as WorkflowStoragePolicyDecisionArgs, Vn as WorkflowSnapshotResolver, Vt as WorkflowPolicyRuntimeDefaults, X as Item, Xn as WorkflowActivationPolicy, Xr as EngineExecutionLimitsPolicy, Zr as EngineExecutionLimitsPolicyConfig, _r as RunCurrentState, an as EngineDeps, at as NodeConfigBase, bn as NodeExecutionContext, br as RunPruneCandidate, bt as PersistedRunPolicySnapshot, cn as ExecutionBinaryService, ct as NodeErrorHandler, dn as LiveWorkflowRepository, dr as PersistedRunState, dt as NodeId, ei as RunEventSubscription, en as BinaryStorage, er as CurrentStateExecutionRequest, gn as NodeActivationRequest, gt as NodeSchedulerDecision, hn as NodeActivationReceipt, in as BinaryStorageWriteResult, ir as NodeExecutionSnapshot, it as NodeActivationId, kr as WorkflowExecutionPruneRepository, ln as ExecutionContext, mn as NodeActivationContinuation, mr as PersistedWorkflowTokenRegistryLike, mt as NodeOutputs, n as WorkflowSnapshotCodec, nn as BinaryStorageStatResult, nt as JsonValue, or as NodeInputsByPort, pr as PersistedWorkflowSnapshotNode, pt as NodeOffloadPolicy, qn as WebhookTriggerResolution, rt as MutableRunData, si as RetryPolicySpec, st as NodeDefinition, tn as BinaryStorageReadResult, tr as EngineRunCounters, un as ExecutionContextFactory, ut as NodeErrorHandlerSpec, vn as NodeActivationScheduler, wn as NodeExecutionStatePublisher, wt as RunId, xn as NodeExecutionRequest, yn as NodeBinaryAttachmentService, yr as RunExecutionOptions, yt as ParentExecutionRef, zt as WorkflowId } from "./InMemoryLiveWorkflowRepository-DxoualoC.js";
2
- import { ZodType, input, output } from "zod";
1
+ import { $r as RunEventBus, $t as BinaryBody, A as CredentialJsonRecord, Ar as WorkflowExecutionRepository, B as CredentialTypeId, Cn as NodeExecutionScheduler, Ct as RunDataSnapshot, Dr as WebhookRunResult, Dt as RunnableNodeInputJson, En as NodeResolver, Er as RunSummary, Et as RunnableNodeConfig, F as CredentialSessionFactoryArgs, Ft as WorkflowErrorHandler, G as BinaryAttachment, Gn as WebhookInvocationMatch, Hn as HttpMethod, I as CredentialSessionService, In as WorkflowNodeInstanceFactory, It as WorkflowErrorHandlerSpec, J as ExecutionMode, Jn as WebhookTriggerRoutingDiagnostics, Kn as WebhookTriggerMatcher, Ln as WorkflowRepository, Lr as TypeToken, N as CredentialRequirement, Nt as WorkflowDefinition, Or as WorkflowExecutionListingRepository, Q as Items, Qr as RunEvent, R as CredentialType, Sn as NodeExecutionRequestHandler, Sr as RunResult, St as RunDataFactory, T as CredentialHealth, Tr as RunStopCondition, Ut as WorkflowStoragePolicyDecisionArgs, Vn as WorkflowSnapshotResolver, Vt as WorkflowPolicyRuntimeDefaults, X as Item, Xn as WorkflowActivationPolicy, Xr as EngineExecutionLimitsPolicy, Zr as EngineExecutionLimitsPolicyConfig, _r as RunCurrentState, an as EngineDeps, at as NodeConfigBase, b as AnyCredentialType, bn as NodeExecutionContext, br as RunPruneCandidate, bt as PersistedRunPolicySnapshot, cn as ExecutionBinaryService, ct as NodeErrorHandler, dn as LiveWorkflowRepository, dr as PersistedRunState, dt as NodeId, ei as RunEventSubscription, en as BinaryStorage, er as CurrentStateExecutionRequest, gn as NodeActivationRequest, gt as NodeSchedulerDecision, hn as NodeActivationReceipt, in as BinaryStorageWriteResult, ir as NodeExecutionSnapshot, it as NodeActivationId, kr as WorkflowExecutionPruneRepository, ln as ExecutionContext, mn as NodeActivationContinuation, mr as PersistedWorkflowTokenRegistryLike, mt as NodeOutputs, n as WorkflowSnapshotCodec, nn as BinaryStorageStatResult, nt as JsonValue, or as NodeInputsByPort, pr as PersistedWorkflowSnapshotNode, pt as NodeOffloadPolicy, qn as WebhookTriggerResolution, rt as MutableRunData, si as RetryPolicySpec, st as NodeDefinition, tn as BinaryStorageReadResult, tr as EngineRunCounters, un as ExecutionContextFactory, ut as NodeErrorHandlerSpec, vn as NodeActivationScheduler, w as CredentialFieldSchema, wn as NodeExecutionStatePublisher, wt as RunId, xn as NodeExecutionRequest, yn as NodeBinaryAttachmentService, yr as RunExecutionOptions, yt as ParentExecutionRef, z as CredentialTypeDefinition, zt as WorkflowId } from "./InMemoryLiveWorkflowRepository-DxoualoC.js";
2
+ import { ZodType, input, output, z } from "zod";
3
3
 
4
4
  //#region src/orchestration/Engine.d.ts
5
5
  interface EngineTriggerRuntime {
@@ -243,6 +243,76 @@ declare class SystemClock implements Clock {
243
243
  now(): Date;
244
244
  }
245
245
  //#endregion
246
+ //#region src/authoring/defineNode.types.d.ts
247
+ type MaybePromise$1<TValue> = TValue | Promise<TValue>;
248
+ type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
249
+ type SessionForCredentialType<TCredential extends ResolvableCredentialType> = TCredential extends AnyCredentialType ? Awaited<ReturnType<TCredential["createSession"]>> : unknown;
250
+ type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
251
+ readonly type: ResolvableCredentialType | ReadonlyArray<ResolvableCredentialType>;
252
+ readonly label?: string;
253
+ readonly optional?: true;
254
+ readonly helpText?: string;
255
+ readonly helpUrl?: string;
256
+ }>;
257
+ type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
258
+ type SessionForBinding<TBinding extends DefinedNodeCredentialBinding> = TBinding extends Readonly<{
259
+ type: infer TType;
260
+ }> ? TType extends ReadonlyArray<infer TEntry> ? SessionForCredentialType<TEntry & ResolvableCredentialType> : SessionForCredentialType<TType & ResolvableCredentialType> : SessionForCredentialType<TBinding & ResolvableCredentialType>;
261
+ type DefinedNodeCredentialAccessors<TBindings extends DefinedNodeCredentialBindings | undefined> = TBindings extends DefinedNodeCredentialBindings ? Readonly<{ [TKey in keyof TBindings]: () => Promise<SessionForBinding<TBindings[TKey]>> }> : Readonly<Record<string, never>>;
262
+ interface DefinedNodeRunContext<TConfig$1 extends CredentialJsonRecord, TBindings extends DefinedNodeCredentialBindings | undefined> {
263
+ readonly config: TConfig$1;
264
+ readonly credentials: DefinedNodeCredentialAccessors<TBindings>;
265
+ readonly execution: NodeExecutionContext<RunnableNodeConfig<TConfig$1, unknown>>;
266
+ }
267
+ interface DefinedNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
268
+ readonly kind: "defined-node";
269
+ readonly key: TKey$1;
270
+ readonly title: string;
271
+ readonly description?: string;
272
+ create(config: TConfig$1, name?: string, id?: string): RunnableNodeConfig<TInputJson, TOutputJson>;
273
+ register(context: {
274
+ registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
275
+ }): void;
276
+ }
277
+ interface DefineNodeOptions<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
278
+ readonly key: TKey$1;
279
+ readonly title: string;
280
+ readonly description?: string;
281
+ readonly input?: Readonly<Record<keyof TConfig$1 & string, unknown>>;
282
+ readonly configSchema?: z.ZodType<TConfig$1>;
283
+ readonly credentials?: TBindings;
284
+ run(items: ReadonlyArray<TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$1<ReadonlyArray<TOutputJson>>;
285
+ }
286
+ declare function defineNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefineNodeOptions<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>): DefinedNode<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>;
287
+ //#endregion
288
+ //#region src/authoring/DefinedNodeRegistry.d.ts
289
+ declare class DefinedNodeRegistry {
290
+ private static readonly definitions;
291
+ static register(definition: DefinedNode<string, Record<string, unknown>, unknown, unknown>): void;
292
+ static resolve(key: string): DefinedNode<string, Record<string, unknown>, unknown, unknown> | undefined;
293
+ }
294
+ //#endregion
295
+ //#region src/authoring/defineCredential.types.d.ts
296
+ type MaybePromise<TValue> = TValue | Promise<TValue>;
297
+ type CredentialFieldInput = CredentialFieldSchema["type"] | Readonly<Omit<CredentialFieldSchema, "key">>;
298
+ type CredentialFieldMap<TConfig$1 extends CredentialJsonRecord> = Readonly<Record<keyof TConfig$1 & string, CredentialFieldInput>>;
299
+ type ZodObjectSchema<TConfig$1 extends CredentialJsonRecord = CredentialJsonRecord> = z.ZodType<TConfig$1>;
300
+ type InferCredentialConfig<TSource> = TSource extends z.ZodType<infer TConfig, any, any> ? Readonly<TConfig> & CredentialJsonRecord : TSource extends CredentialFieldMap<infer TConfig> ? TConfig : CredentialJsonRecord;
301
+ interface DefineCredentialOptions<TPublicSource extends CredentialFieldMap<any> | ZodObjectSchema<any>, TSecretSource extends CredentialFieldMap<any> | ZodObjectSchema<any>, TSession> {
302
+ readonly key: string;
303
+ readonly label: string;
304
+ readonly description?: string;
305
+ readonly public: TPublicSource;
306
+ readonly secret: TSecretSource;
307
+ readonly supportedSourceKinds?: CredentialTypeDefinition["supportedSourceKinds"];
308
+ readonly auth?: CredentialTypeDefinition["auth"];
309
+ createSession(args: CredentialSessionFactoryArgs<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>>): MaybePromise<TSession>;
310
+ test(args: CredentialSessionFactoryArgs<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>>): MaybePromise<CredentialHealth>;
311
+ }
312
+ declare function defineCredential<TPublicSource extends CredentialFieldMap<any> | ZodObjectSchema<any>, TSecretSource extends CredentialFieldMap<any> | ZodObjectSchema<any>, TSession>(options: DefineCredentialOptions<TPublicSource, TSecretSource, TSession>): CredentialType<InferCredentialConfig<TPublicSource>, InferCredentialConfig<TSecretSource>, TSession> & {
313
+ readonly key: string;
314
+ };
315
+ //#endregion
246
316
  //#region src/ai/NodeBackedToolConfig.d.ts
247
317
  declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
248
318
  readonly name: string;
@@ -299,19 +369,19 @@ interface ToolConfig {
299
369
  readonly presentation?: AgentCanvasPresentation;
300
370
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
301
371
  }
302
- type ToolExecuteArgs<TConfig extends ToolConfig = ToolConfig, TInput = unknown> = Readonly<{
303
- config: TConfig;
372
+ type ToolExecuteArgs<TConfig$1 extends ToolConfig = ToolConfig, TInput = unknown> = Readonly<{
373
+ config: TConfig$1;
304
374
  input: TInput;
305
375
  ctx: NodeExecutionContext<any>;
306
376
  item: Item;
307
377
  itemIndex: number;
308
378
  items: Items;
309
379
  }>;
310
- interface Tool<TConfig extends ToolConfig = ToolConfig, TInputSchema extends ZodSchemaAny = ZodSchemaAny, TOutputSchema extends ZodSchemaAny = ZodSchemaAny> {
380
+ interface Tool<TConfig$1 extends ToolConfig = ToolConfig, TInputSchema extends ZodSchemaAny = ZodSchemaAny, TOutputSchema extends ZodSchemaAny = ZodSchemaAny> {
311
381
  readonly defaultDescription: string;
312
382
  readonly inputSchema: TInputSchema;
313
383
  readonly outputSchema: TOutputSchema;
314
- execute(args: ToolExecuteArgs<TConfig, input<TInputSchema>>): Promise<output<TOutputSchema>> | output<TOutputSchema>;
384
+ execute(args: ToolExecuteArgs<TConfig$1, input<TInputSchema>>): Promise<output<TOutputSchema>> | output<TOutputSchema>;
315
385
  }
316
386
  type AgentTool<TInputSchema extends ZodSchemaAny = ZodSchemaAny, TOutputSchema extends ZodSchemaAny = ZodSchemaAny> = Tool<ToolConfig, TInputSchema, TOutputSchema>;
317
387
  type AgentToolExecuteArgs<TInput = unknown> = ToolExecuteArgs<ToolConfig, TInput>;
@@ -378,9 +448,9 @@ interface LangChainChatModelLike {
378
448
  invoke(input: unknown, options?: unknown): Promise<unknown>;
379
449
  bindTools?(tools: ReadonlyArray<unknown>): LangChainChatModelLike;
380
450
  }
381
- interface ChatModelFactory<TConfig extends ChatModelConfig = ChatModelConfig> {
451
+ interface ChatModelFactory<TConfig$1 extends ChatModelConfig = ChatModelConfig> {
382
452
  create(args: Readonly<{
383
- config: TConfig;
453
+ config: TConfig$1;
384
454
  ctx: NodeExecutionContext<any>;
385
455
  }>): Promise<LangChainChatModelLike> | LangChainChatModelLike;
386
456
  }
@@ -798,5 +868,5 @@ declare class LocalOnlyScheduler implements NodeExecutionScheduler {
798
868
  }>;
799
869
  }
800
870
  //#endregion
801
- export { AgentTurnLimitBehavior as $, PersistedRuntimeTypeKind as A, AgentMessageDto as B, node as C, AsyncSleeper as Ct, PersistedRuntimeTypeMetadataStore as D, EngineFactory as Dt, PersistedRuntimeTypeNameResolver as E, EngineCompositionDeps as Et, AgentCanvasPresentation as F, AgentModelInvocationOptions as G, AgentMessageRole as H, AgentGuardrailConfig as I, AgentToolCall as J, AgentNodeConfig as K, AgentGuardrailDefaults as L, EventPublishingWorkflowExecutionRepository as M, InMemoryRunEventBus as N, InjectableRuntimeDecoratorComposer as O, Engine as Ot, AgentAttachmentRole as P, AgentToolToken as Q, AgentMessageBuildArgs as R, getPersistedRuntimeTypeMetadata as S, DefaultAsyncSleeper as St, StackTraceCallSitePathResolver as T, NodeEventPublisher as Tt, AgentMessageTemplate as U, AgentMessageLine as V, AgentMessageTemplateContent as W, AgentToolDefinition as X, AgentToolCallPlanner as Y, AgentToolExecuteArgs as Z, EngineExecutionLimitsPolicyFactory as _, SystemClock as _t, ConfigDrivenOffloadPolicy as a, NodeBackedToolInputMapperArgs as at, ItemsInputNormalizer as b, InProcessRetryRunner as bt, EngineWorkflowRunnerService as c, Tool as ct, InMemoryRunDataFactory as d, ZodSchemaAny as dt, ChatModelConfig as et, InMemoryBinaryStorage as f, AgentConfigInspector as ft, RunPolicySnapshotFactory as g, Clock as gt, WorkflowStoragePolicyEvaluator as h, NodeBackedToolConfig as ht, InlineDrivingScheduler as i, NodeBackedToolInputMapper as it, PersistedRuntimeTypeMetadata as j, PersistedRuntimeTypeDecoratorOptions as k, RunSummaryMapper as l, ToolConfig as lt, RunTerminalPersistenceCoordinator as m, AgentToolFactory as mt, HintOnlyOffloadPolicy as n, LangChainChatModelLike as nt, WorkflowRepositoryWebhookTriggerMatcher as o, NodeBackedToolOutputMapper as ot, WorkflowPolicyErrorServices as p, AgentMessageConfigNormalizer as pt, AgentTool as q, DefaultDrivingScheduler as r, NodeBackedToolConfigOptions as rt, RunIntentService as s, NodeBackedToolOutputMapperArgs as st, LocalOnlyScheduler as t, ChatModelFactory as tt, InMemoryWorkflowExecutionRepository as u, ToolExecuteArgs as ut, DefaultExecutionBinaryService as v, NodeInstanceFactory as vt, tool as w, CredentialResolverFactory as wt, chatModel as x, DefaultExecutionContextFactory as xt, UnavailableBinaryStorage as y, NodeExecutor as yt, AgentMessageConfig as z };
802
- //# sourceMappingURL=index-k0hwnJyT.d.ts.map
871
+ export { AgentTurnLimitBehavior as $, PersistedRuntimeTypeKind as A, InProcessRetryRunner as At, AgentMessageDto as B, node as C, DefinedNodeCredentialBindings as Ct, PersistedRuntimeTypeMetadataStore as D, SystemClock as Dt, PersistedRuntimeTypeNameResolver as E, Clock as Et, AgentCanvasPresentation as F, NodeEventPublisher as Ft, AgentModelInvocationOptions as G, AgentMessageRole as H, AgentGuardrailConfig as I, EngineCompositionDeps as It, AgentToolCall as J, AgentNodeConfig as K, AgentGuardrailDefaults as L, EngineFactory as Lt, EventPublishingWorkflowExecutionRepository as M, DefaultAsyncSleeper as Mt, InMemoryRunEventBus as N, AsyncSleeper as Nt, InjectableRuntimeDecoratorComposer as O, NodeInstanceFactory as Ot, AgentAttachmentRole as P, CredentialResolverFactory as Pt, AgentToolToken as Q, AgentMessageBuildArgs as R, Engine as Rt, getPersistedRuntimeTypeMetadata as S, DefinedNodeCredentialBinding as St, StackTraceCallSitePathResolver as T, defineNode as Tt, AgentMessageTemplate as U, AgentMessageLine as V, AgentMessageTemplateContent as W, AgentToolDefinition as X, AgentToolCallPlanner as Y, AgentToolExecuteArgs as Z, EngineExecutionLimitsPolicyFactory as _, defineCredential as _t, ConfigDrivenOffloadPolicy as a, NodeBackedToolInputMapperArgs as at, ItemsInputNormalizer as b, DefinedNode as bt, EngineWorkflowRunnerService as c, Tool as ct, InMemoryRunDataFactory as d, ZodSchemaAny as dt, ChatModelConfig as et, InMemoryBinaryStorage as f, AgentConfigInspector as ft, RunPolicySnapshotFactory as g, DefineCredentialOptions as gt, WorkflowStoragePolicyEvaluator as h, NodeBackedToolConfig as ht, InlineDrivingScheduler as i, NodeBackedToolInputMapper as it, PersistedRuntimeTypeMetadata as j, DefaultExecutionContextFactory as jt, PersistedRuntimeTypeDecoratorOptions as k, NodeExecutor as kt, RunSummaryMapper as l, ToolConfig as lt, RunTerminalPersistenceCoordinator as m, AgentToolFactory as mt, HintOnlyOffloadPolicy as n, LangChainChatModelLike as nt, WorkflowRepositoryWebhookTriggerMatcher as o, NodeBackedToolOutputMapper as ot, WorkflowPolicyErrorServices as p, AgentMessageConfigNormalizer as pt, AgentTool as q, DefaultDrivingScheduler as r, NodeBackedToolConfigOptions as rt, RunIntentService as s, NodeBackedToolOutputMapperArgs as st, LocalOnlyScheduler as t, ChatModelFactory as tt, InMemoryWorkflowExecutionRepository as u, ToolExecuteArgs as ut, DefaultExecutionBinaryService as v, DefinedNodeRegistry as vt, tool as w, DefinedNodeRunContext as wt, chatModel as x, DefinedNodeCredentialAccessors as xt, UnavailableBinaryStorage as y, DefineNodeOptions as yt, AgentMessageConfig as z };
872
+ //# sourceMappingURL=index-B4_ZRTyI.d.ts.map
package/dist/index.cjs CHANGED
@@ -1,5 +1,7 @@
1
- const require_RunIntentService = require('./RunIntentService-DlQH5eZ2.cjs');
1
+ const require_RunIntentService = require('./RunIntentService-nRx-m0Xs.cjs');
2
2
  const require_InMemoryLiveWorkflowRepository = require('./InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs');
3
+ let zod = require("zod");
4
+ zod = require_RunIntentService.__toESM(zod);
3
5
  let node_crypto = require("node:crypto");
4
6
  node_crypto = require_RunIntentService.__toESM(node_crypto);
5
7
  let tsyringe = require("tsyringe");
@@ -12,6 +14,181 @@ var SystemClock = class {
12
14
  }
13
15
  };
14
16
 
17
+ //#endregion
18
+ //#region src/authoring/DefinedNodeRegistry.ts
19
+ var DefinedNodeRegistry = class {
20
+ static definitions = /* @__PURE__ */ new Map();
21
+ static register(definition) {
22
+ this.definitions.set(definition.key, definition);
23
+ }
24
+ static resolve(key) {
25
+ return this.definitions.get(key);
26
+ }
27
+ };
28
+
29
+ //#endregion
30
+ //#region src/authoring/defineNode.types.ts
31
+ const definedNodeCredentialRequirementFactory = {
32
+ create(bindings) {
33
+ if (!bindings) return [];
34
+ return Object.entries(bindings).map(([slotKey, binding]) => {
35
+ if (typeof binding === "string" || this.isCredentialType(binding)) return {
36
+ slotKey,
37
+ label: this.humanize(slotKey),
38
+ acceptedTypes: [this.resolveTypeId(binding)]
39
+ };
40
+ const types = Array.isArray(binding.type) ? binding.type : [binding.type];
41
+ return {
42
+ slotKey,
43
+ label: binding.label ?? this.humanize(slotKey),
44
+ acceptedTypes: types.map((entry) => this.resolveTypeId(entry)),
45
+ optional: binding.optional,
46
+ helpText: binding.helpText,
47
+ helpUrl: binding.helpUrl
48
+ };
49
+ });
50
+ },
51
+ isCredentialType(value) {
52
+ return Boolean(value) && typeof value === "object" && "definition" in value && typeof value.definition?.typeId === "string";
53
+ },
54
+ resolveTypeId(type) {
55
+ return typeof type === "string" ? type : type.definition.typeId;
56
+ },
57
+ humanize(key) {
58
+ return key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_.]+/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (character) => character.toUpperCase());
59
+ }
60
+ };
61
+ const definedNodeCredentialAccessorFactory = { create(bindings, ctx) {
62
+ if (!bindings) return {};
63
+ const entries = Object.keys(bindings).map((slotKey) => [slotKey, () => ctx.getCredential(slotKey)]);
64
+ return Object.fromEntries(entries);
65
+ } };
66
+ function defineNode(options) {
67
+ const credentialRequirements = definedNodeCredentialRequirementFactory.create(options.credentials);
68
+ const DefinedNodeRuntime = class {
69
+ kind = "node";
70
+ outputPorts = ["main"];
71
+ async execute(items, ctx) {
72
+ return { main: (await options.run(items.map((item) => item.json), {
73
+ config: ctx.config.config,
74
+ credentials: definedNodeCredentialAccessorFactory.create(options.credentials, ctx),
75
+ execution: ctx
76
+ })).map((json, index) => {
77
+ const existing = items[index];
78
+ if (!existing) return { json };
79
+ return {
80
+ ...existing,
81
+ json
82
+ };
83
+ }) };
84
+ }
85
+ };
86
+ require_RunIntentService.node({ name: options.key })(DefinedNodeRuntime);
87
+ const DefinedRunnableNodeConfig = class {
88
+ kind = "node";
89
+ type = DefinedNodeRuntime;
90
+ constructor(name, config, id) {
91
+ this.name = name;
92
+ this.config = config;
93
+ this.id = id;
94
+ }
95
+ getCredentialRequirements() {
96
+ return credentialRequirements;
97
+ }
98
+ };
99
+ const definition = {
100
+ kind: "defined-node",
101
+ key: options.key,
102
+ title: options.title,
103
+ description: options.description,
104
+ create(config, name = options.title, id) {
105
+ return new DefinedRunnableNodeConfig(name, config, id);
106
+ },
107
+ register(context) {
108
+ context.registerNode(DefinedNodeRuntime);
109
+ }
110
+ };
111
+ DefinedNodeRegistry.register(definition);
112
+ return definition;
113
+ }
114
+
115
+ //#endregion
116
+ //#region src/authoring/defineCredential.types.ts
117
+ var CredentialFieldSchemaFactory = class {
118
+ static create(source) {
119
+ if (source instanceof zod.z.ZodObject) return this.createFromZodObject(source);
120
+ return this.createFromMap(source);
121
+ }
122
+ static createFromMap(source) {
123
+ return Object.entries(source).map(([key, input], index) => {
124
+ if (typeof input === "string") return {
125
+ key,
126
+ label: this.humanize(key),
127
+ order: index,
128
+ type: input
129
+ };
130
+ return {
131
+ key,
132
+ order: index,
133
+ ...input
134
+ };
135
+ });
136
+ }
137
+ static createFromZodObject(source) {
138
+ const shape = source.shape;
139
+ return Object.entries(shape).map(([key, schema], index) => {
140
+ const resolved = this.unwrap(schema);
141
+ return {
142
+ key,
143
+ label: this.humanize(key),
144
+ order: index,
145
+ required: this.isRequired(schema) ? true : void 0,
146
+ type: this.resolveType(resolved)
147
+ };
148
+ });
149
+ }
150
+ static isRequired(schema) {
151
+ return !(schema instanceof zod.z.ZodOptional || schema instanceof zod.z.ZodDefault);
152
+ }
153
+ static unwrap(schema) {
154
+ let current = schema;
155
+ while (current instanceof zod.z.ZodOptional || current instanceof zod.z.ZodDefault) current = current.unwrap();
156
+ return current;
157
+ }
158
+ static resolveType(schema) {
159
+ if (schema instanceof zod.z.ZodBoolean) return "boolean";
160
+ if (schema instanceof zod.z.ZodString) return "string";
161
+ return "json";
162
+ }
163
+ static humanize(key) {
164
+ return key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_.]+/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (character) => character.toUpperCase());
165
+ }
166
+ };
167
+ function defineCredential(options) {
168
+ return {
169
+ definition: {
170
+ typeId: options.key,
171
+ displayName: options.label,
172
+ description: options.description,
173
+ publicFields: CredentialFieldSchemaFactory.create(options.public),
174
+ secretFields: CredentialFieldSchemaFactory.create(options.secret),
175
+ supportedSourceKinds: options.supportedSourceKinds ?? [
176
+ "db",
177
+ "env",
178
+ "code"
179
+ ],
180
+ auth: options.auth
181
+ },
182
+ async createSession(args) {
183
+ return await options.createSession(args);
184
+ },
185
+ async test(args) {
186
+ return await options.test(args);
187
+ },
188
+ key: options.key
189
+ };
190
+ }
191
+
15
192
  //#endregion
16
193
  //#region src/ai/NodeBackedToolConfig.ts
17
194
  var NodeBackedToolConfig = class {
@@ -528,6 +705,7 @@ exports.DefaultAsyncSleeper = require_RunIntentService.DefaultAsyncSleeper;
528
705
  exports.DefaultExecutionBinaryService = require_RunIntentService.DefaultExecutionBinaryService;
529
706
  exports.DefaultExecutionContextFactory = require_RunIntentService.DefaultExecutionContextFactory;
530
707
  exports.DefaultWorkflowGraphFactory = DefaultWorkflowGraphFactory;
708
+ exports.DefinedNodeRegistry = DefinedNodeRegistry;
531
709
  exports.EngineExecutionLimitsPolicy = require_RunIntentService.EngineExecutionLimitsPolicy;
532
710
  exports.EventPublishingWorkflowExecutionRepository = EventPublishingWorkflowExecutionRepository;
533
711
  exports.ExpRetryPolicy = ExpRetryPolicy;
@@ -566,6 +744,8 @@ Object.defineProperty(exports, 'container', {
566
744
  return tsyringe.container;
567
745
  }
568
746
  });
747
+ exports.defineCredential = defineCredential;
748
+ exports.defineNode = defineNode;
569
749
  Object.defineProperty(exports, 'delay', {
570
750
  enumerable: true,
571
751
  get: function () {