@codemation/core 0.2.1 → 0.3.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/CHANGELOG.md +22 -0
- package/README.md +2 -0
- package/dist/{EngineRuntimeRegistration.types-0sgV2XL2.d.ts → EngineRuntimeRegistration.types-Bjeo7Sfq.d.ts} +2 -2
- package/dist/{EngineWorkflowRunnerService-Dx7bJsJR.d.cts → EngineWorkflowRunnerService-Dd4yD31l.d.cts} +2 -2
- package/dist/{InMemoryRunDataFactory-qIYQEar7.d.cts → InMemoryRunDataFactory-OUzDmAHt.d.cts} +2 -2
- package/dist/{RunIntentService-BCvGdOSY.d.ts → RunIntentService-BAKikN8h.d.ts} +80 -12
- package/dist/{RunIntentService-CV8izV8t.d.cts → RunIntentService-Bkg4oYrM.d.cts} +74 -5
- package/dist/bootstrap/index.cjs +31 -31
- package/dist/bootstrap/index.d.cts +5 -3
- package/dist/bootstrap/index.d.ts +3 -3
- package/dist/bootstrap/index.js +2 -2
- package/dist/bootstrap-BD6CobHl.js +215 -0
- package/dist/bootstrap-BD6CobHl.js.map +1 -0
- package/dist/bootstrap-DwS5S7s9.cjs +240 -0
- package/dist/bootstrap-DwS5S7s9.cjs.map +1 -0
- package/dist/{index-CueSzHsf.d.ts → index-uCm9l0nw.d.ts} +64 -15
- package/dist/index.cjs +114 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -21
- package/dist/index.d.ts +3 -3
- package/dist/index.js +83 -2
- package/dist/index.js.map +1 -1
- package/dist/{RunIntentService-BFA48UpH.js → runtime-Cy-3FTI_.js} +1224 -94
- package/dist/runtime-Cy-3FTI_.js.map +1 -0
- package/dist/{RunIntentService-DcxXf_AM.cjs → runtime-ZJUpWmPH.cjs} +1251 -132
- package/dist/runtime-ZJUpWmPH.cjs.map +1 -0
- package/dist/testing.cjs +74 -29
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +55 -3
- package/dist/testing.d.ts +55 -3
- package/dist/testing.js +46 -3
- package/dist/testing.js.map +1 -1
- package/dist/workflowActivationPolicy-B8HzTk3o.js.map +1 -1
- package/dist/workflowActivationPolicy-BzyzXLa_.cjs.map +1 -1
- package/package.json +1 -1
- package/src/ai/AgentMessageConfigNormalizerFactory.ts +43 -0
- package/src/ai/AgentToolFactory.ts +2 -2
- package/src/ai/AiHost.ts +10 -9
- package/src/ai/NodeBackedToolConfig.ts +1 -1
- package/src/authoring/defineNode.types.ts +153 -10
- package/src/authoring/index.ts +3 -1
- package/src/contracts/runtimeTypes.ts +26 -0
- package/src/contracts/workflowTypes.ts +67 -5
- package/src/execution/ActivationEnqueueService.ts +8 -5
- package/src/execution/NodeActivationRequestInputPreparer.ts +89 -0
- package/src/execution/NodeExecutor.ts +38 -1
- package/src/execution/NodeInputContractError.ts +13 -0
- package/src/execution/index.ts +2 -0
- package/src/orchestration/RunContinuationService.ts +181 -50
- package/src/planning/RunQueuePlanner.ts +12 -1
- package/src/runtime/EngineFactory.ts +3 -0
- package/src/testing/ItemHarnessNode.ts +27 -0
- package/src/testing/ItemHarnessNodeConfig.ts +43 -0
- package/src/testing/RegistrarEngineTestKitFactory.ts +2 -0
- package/src/testing.ts +2 -0
- package/src/workflow/dsl/ChainCursorResolver.ts +1 -1
- package/src/workflow/dsl/workflowBuilderTypes.ts +8 -5
- package/dist/RunIntentService-BFA48UpH.js.map +0 -1
- package/dist/RunIntentService-DcxXf_AM.cjs.map +0 -1
- package/dist/bootstrap-D67Sf2BF.js +0 -1136
- package/dist/bootstrap-D67Sf2BF.js.map +0 -1
- package/dist/bootstrap-DoQHAEQJ.cjs +0 -1203
- package/dist/bootstrap-DoQHAEQJ.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as
|
|
1
|
+
import { $n as NodeExecutionRequest, $t as RunId, Ai as EngineExecutionLimitsPolicy, An as BinaryBody, Bn as ExecutionContext, Bt as NodeId, Dr as WebhookTriggerRoutingDiagnostics, Dt as Items, Fn as BinaryStorageWriteResult, Ft as NodeConnectionName, Gr as PersistedRunState, Gt as NodeSchedulerDecision, Ht as NodeOffloadPolicy, In as EngineDeps, It as NodeDefinition, Jn as NodeActivationRequest, Jt as ParentExecutionRef, K as AnyCredentialType, Kn as NodeActivationContinuation, Lr as NodeExecutionSnapshot, Mi as RunEvent, Mn as BinaryStorageReadResult, Mt as MutableRunData, Ni as RunEventBus, Nn as BinaryStorageStatResult, Nt as NodeActivationId, Pi as RunEventSubscription, Pr as EngineRunCounters, Pt as NodeConfigBase, Qn as NodeExecutionContext, Qt as RunDataSnapshot, St as Item, Tr as WebhookTriggerMatcher, Ut as NodeOutputs, Vi as RetryPolicySpec, Vn as ExecutionContextFactory, Wr as PersistedRunSchedulingState, X as CredentialFieldSchema, Xn as NodeActivationScheduler, Z as CredentialHealth, Zn as NodeBinaryAttachmentService, Zt as RunDataFactory, _i as TypeToken, _t as BinaryAttachment, at as CredentialRequirement, bt as ExecutionMode, ci as WorkflowExecutionListingRepository, ct as CredentialSessionService, dt as CredentialTypeDefinition, ei as RunPruneCandidate, ft as CredentialTypeId, gr as WorkflowRepository, hn as WorkflowId, hr as WorkflowNodeInstanceFactory, ir as NodeResolver, jn as BinaryStorage, jt as JsonValue, kr as WorkflowActivationPolicy, l as WorkflowSnapshotCodec, li as WorkflowExecutionPruneRepository, ln as WorkflowDefinition, nn as RunnableNodeInputJson, nr as NodeExecutionStatePublisher, nt as CredentialJsonRecord, oi as RunSummary, or as PreparedNodeActivationDispatch, qr as PersistedWorkflowSnapshotNode, st as CredentialSessionFactoryArgs, tn as RunnableNodeConfig, tr as NodeExecutionScheduler, u as Engine, ui as WorkflowExecutionRepository, ut as CredentialType, wr as WebhookInvocationMatch, wt as ItemInputMapper, xr as HttpMethod, zn as ExecutionBinaryService } from "./RunIntentService-BAKikN8h.js";
|
|
2
2
|
import { ZodType, input, output, z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/workflowSnapshots/MissingRuntimeFallbacksFactory.d.ts
|
|
@@ -89,6 +89,8 @@ declare class NodeExecutor {
|
|
|
89
89
|
execute(request: NodeActivationRequest): Promise<NodeOutputs>;
|
|
90
90
|
private executeMultiInputNode;
|
|
91
91
|
private executeSingleInputNode;
|
|
92
|
+
private hasExecuteOne;
|
|
93
|
+
private executeItemNode;
|
|
92
94
|
}
|
|
93
95
|
//#endregion
|
|
94
96
|
//#region src/execution/NodeInstanceFactory.d.ts
|
|
@@ -130,17 +132,35 @@ interface DefinedNodeRunContext<TConfig$1 extends CredentialJsonRecord, TBinding
|
|
|
130
132
|
readonly credentials: DefinedNodeCredentialAccessors<TBindings>;
|
|
131
133
|
readonly execution: NodeExecutionContext<RunnableNodeConfig<TConfig$1, unknown>>;
|
|
132
134
|
}
|
|
133
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Arguments for {@link defineNode} `executeOne` (engine `ctx` matches {@link ItemNode.executeOne};
|
|
137
|
+
* the second callback parameter adds {@link DefinedNodeRunContext} for credential accessors).
|
|
138
|
+
*/
|
|
139
|
+
type DefineNodeExecuteOneArgs<TConfig$1 extends CredentialJsonRecord, TInputJson, TWireJson> = Readonly<{
|
|
140
|
+
input: TInputJson;
|
|
141
|
+
item: Item;
|
|
142
|
+
itemIndex: number;
|
|
143
|
+
items: Items;
|
|
144
|
+
ctx: NodeExecutionContext<RunnableNodeConfig<TInputJson, unknown, TWireJson> & Readonly<{
|
|
145
|
+
config: TConfig$1;
|
|
146
|
+
}>>;
|
|
147
|
+
}>;
|
|
148
|
+
interface DefinedNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined, TWireJson = TInputJson> {
|
|
134
149
|
readonly kind: "defined-node";
|
|
135
150
|
readonly key: TKey$1;
|
|
136
151
|
readonly title: string;
|
|
137
152
|
readonly description?: string;
|
|
138
|
-
create(config: TConfig$1, name?: string, id?: string): RunnableNodeConfig<TInputJson, TOutputJson>;
|
|
153
|
+
create(config: TConfig$1, name?: string, id?: string): RunnableNodeConfig<TInputJson, TOutputJson, TWireJson>;
|
|
139
154
|
register(context: {
|
|
140
155
|
registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
|
|
141
156
|
}): void;
|
|
142
157
|
}
|
|
143
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Plugin / DSL-friendly node: **one item in, one item out** per engine activation step.
|
|
160
|
+
* The engine applies {@link RunnableNodeConfig.mapInput} (if any) + {@link RunnableNodeConfig.inputSchema}
|
|
161
|
+
* before `executeOne`. Use {@link defineBatchNode} for legacy batch `run(items, …)` semantics.
|
|
162
|
+
*/
|
|
163
|
+
interface DefineNodeOptions<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined, TWireJson = TInputJson> {
|
|
144
164
|
readonly key: TKey$1;
|
|
145
165
|
readonly title: string;
|
|
146
166
|
readonly description?: string;
|
|
@@ -149,12 +169,35 @@ interface DefineNodeOptions<TKey$1 extends string, TConfig$1 extends CredentialJ
|
|
|
149
169
|
* The Next host resolves Lucide (`lucide:…`), built-in SVGs (`builtin:…`), Simple Icons (`si:…`), and image URLs (`https:`, `data:`, `/…`).
|
|
150
170
|
*/
|
|
151
171
|
readonly icon?: string;
|
|
172
|
+
/** Default values / form hints for **static** node configuration (credentials, retry, IDs), not per-item payload. */
|
|
173
|
+
readonly input?: Readonly<Record<keyof TConfig$1 & string, unknown>>;
|
|
174
|
+
readonly configSchema?: z.ZodType<TConfig$1>;
|
|
175
|
+
readonly credentials?: TBindings;
|
|
176
|
+
/**
|
|
177
|
+
* Validates **`input`** after optional {@link mapInput} (engine also accepts `inputSchema` on the node class).
|
|
178
|
+
*/
|
|
179
|
+
readonly inputSchema?: ZodType<TInputJson>;
|
|
180
|
+
/**
|
|
181
|
+
* Maps wire JSON (`item.json` from upstream) to execute input before validation.
|
|
182
|
+
*/
|
|
183
|
+
readonly mapInput?: ItemInputMapper<TWireJson, TInputJson>;
|
|
184
|
+
executeOne(args: DefineNodeExecuteOneArgs<TConfig$1, TInputJson, TWireJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$1<TOutputJson>;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Batch-oriented defined node (legacy): receives all items at once via `run`.
|
|
188
|
+
*/
|
|
189
|
+
interface DefineBatchNodeOptions<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
|
|
190
|
+
readonly key: TKey$1;
|
|
191
|
+
readonly title: string;
|
|
192
|
+
readonly description?: string;
|
|
193
|
+
readonly icon?: string;
|
|
152
194
|
readonly input?: Readonly<Record<keyof TConfig$1 & string, unknown>>;
|
|
153
195
|
readonly configSchema?: z.ZodType<TConfig$1>;
|
|
154
196
|
readonly credentials?: TBindings;
|
|
155
197
|
run(items: ReadonlyArray<TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$1<ReadonlyArray<TOutputJson>>;
|
|
156
198
|
}
|
|
157
|
-
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>;
|
|
199
|
+
declare function defineNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined, TWireJson = TInputJson>(options: DefineNodeOptions<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings, TWireJson>): DefinedNode<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings, TWireJson>;
|
|
200
|
+
declare function defineBatchNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefineBatchNodeOptions<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>): DefinedNode<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings, TInputJson>;
|
|
158
201
|
//#endregion
|
|
159
202
|
//#region src/authoring/DefinedNodeRegistry.d.ts
|
|
160
203
|
declare class DefinedNodeRegistry {
|
|
@@ -185,7 +228,7 @@ declare function defineCredential<TPublicSource extends CredentialFieldMap<any>
|
|
|
185
228
|
};
|
|
186
229
|
//#endregion
|
|
187
230
|
//#region src/ai/NodeBackedToolConfig.d.ts
|
|
188
|
-
declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
|
|
231
|
+
declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
|
|
189
232
|
readonly name: string;
|
|
190
233
|
readonly node: TNodeConfig;
|
|
191
234
|
readonly type: TypeToken<unknown>;
|
|
@@ -208,7 +251,7 @@ declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, a
|
|
|
208
251
|
//#endregion
|
|
209
252
|
//#region src/ai/AgentToolFactory.d.ts
|
|
210
253
|
declare class AgentToolFactoryImpl {
|
|
211
|
-
asTool<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny>(node: TNodeConfig, options: Readonly<{
|
|
254
|
+
asTool<TNodeConfig extends RunnableNodeConfig<any, any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny>(node: TNodeConfig, options: Readonly<{
|
|
212
255
|
name?: string;
|
|
213
256
|
} & NodeBackedToolConfigOptions<TNodeConfig, TInputSchema, TOutputSchema>>): NodeBackedToolConfig<TNodeConfig, TInputSchema, TOutputSchema>;
|
|
214
257
|
private withDefaultAgentInputMapper;
|
|
@@ -219,7 +262,13 @@ declare const AgentToolFactory: AgentToolFactoryImpl;
|
|
|
219
262
|
//#endregion
|
|
220
263
|
//#region src/ai/AgentMessageConfigNormalizerFactory.d.ts
|
|
221
264
|
declare class AgentMessageConfigNormalizer {
|
|
265
|
+
/**
|
|
266
|
+
* Prefer {@code input.messages} when present (ItemNode / engine-mapped payloads); otherwise resolve from
|
|
267
|
+
* {@link AgentNodeConfig.messages} templates.
|
|
268
|
+
*/
|
|
269
|
+
static resolveFromInputOrConfig<TInputJson, TOutputJson>(input: unknown, config: AgentNodeConfig<TInputJson, TOutputJson>, args: AgentMessageBuildArgs<TInputJson>): ReadonlyArray<AgentMessageDto>;
|
|
222
270
|
static normalize<TInputJson, TOutputJson>(config: AgentNodeConfig<TInputJson, TOutputJson>, args: AgentMessageBuildArgs<TInputJson>): ReadonlyArray<AgentMessageDto>;
|
|
271
|
+
private static tryMessagesFromStructuredInput;
|
|
223
272
|
private static normalizeRichMessages;
|
|
224
273
|
private static lineToDto;
|
|
225
274
|
}
|
|
@@ -328,7 +377,7 @@ interface ChatModelFactory<TConfig$1 extends ChatModelConfig = ChatModelConfig>
|
|
|
328
377
|
ctx: NodeExecutionContext<any>;
|
|
329
378
|
}>): Promise<LangChainChatModelLike> | LangChainChatModelLike;
|
|
330
379
|
}
|
|
331
|
-
type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
|
|
380
|
+
type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = Readonly<{
|
|
332
381
|
input: TToolInput;
|
|
333
382
|
item: Item;
|
|
334
383
|
itemIndex: number;
|
|
@@ -336,7 +385,7 @@ type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, a
|
|
|
336
385
|
ctx: NodeExecutionContext<any>;
|
|
337
386
|
node: TNodeConfig;
|
|
338
387
|
}>;
|
|
339
|
-
type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
|
|
388
|
+
type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = Readonly<{
|
|
340
389
|
input: TToolInput;
|
|
341
390
|
item: Item;
|
|
342
391
|
itemIndex: number;
|
|
@@ -345,9 +394,9 @@ type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any,
|
|
|
345
394
|
node: TNodeConfig;
|
|
346
395
|
outputs: NodeOutputs;
|
|
347
396
|
}>;
|
|
348
|
-
type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = (args: NodeBackedToolInputMapperArgs<TNodeConfig, TToolInput>) => Item<RunnableNodeInputJson<TNodeConfig>> | RunnableNodeInputJson<TNodeConfig>;
|
|
349
|
-
type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown, TToolOutput = unknown> = (args: NodeBackedToolOutputMapperArgs<TNodeConfig, TToolInput>) => TToolOutput;
|
|
350
|
-
type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
|
|
397
|
+
type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = (args: NodeBackedToolInputMapperArgs<TNodeConfig, TToolInput>) => Item<RunnableNodeInputJson<TNodeConfig>> | RunnableNodeInputJson<TNodeConfig>;
|
|
398
|
+
type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown, TToolOutput = unknown> = (args: NodeBackedToolOutputMapperArgs<TNodeConfig, TToolInput>) => TToolOutput;
|
|
399
|
+
type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
|
|
351
400
|
description?: string;
|
|
352
401
|
presentation?: AgentCanvasPresentation;
|
|
353
402
|
inputSchema: TInputSchema;
|
|
@@ -355,7 +404,7 @@ type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any
|
|
|
355
404
|
mapInput?: NodeBackedToolInputMapper<TNodeConfig, input<TInputSchema>>;
|
|
356
405
|
mapOutput?: NodeBackedToolOutputMapper<TNodeConfig, input<TInputSchema>, output<TOutputSchema>>;
|
|
357
406
|
}>;
|
|
358
|
-
interface AgentNodeConfig<TInputJson = unknown, TOutputJson = unknown> extends RunnableNodeConfig<TInputJson, TOutputJson> {
|
|
407
|
+
interface AgentNodeConfig<TInputJson = unknown, TOutputJson = unknown, TWireJson = TInputJson> extends RunnableNodeConfig<TInputJson, TOutputJson, TWireJson> {
|
|
359
408
|
readonly messages: AgentMessageConfig<TInputJson>;
|
|
360
409
|
readonly chatModel: ChatModelConfig;
|
|
361
410
|
readonly tools?: ReadonlyArray<ToolConfig>;
|
|
@@ -654,5 +703,5 @@ declare class LocalOnlyScheduler implements NodeExecutionScheduler {
|
|
|
654
703
|
}>;
|
|
655
704
|
}
|
|
656
705
|
//#endregion
|
|
657
|
-
export { LangChainChatModelLike as $, AgentConnectionNodeRole as A,
|
|
658
|
-
//# sourceMappingURL=index-
|
|
706
|
+
export { LangChainChatModelLike as $, AgentConnectionNodeRole as A, InProcessRetryRunner as At, AgentMessageTemplate as B, PersistedRuntimeTypeKind as C, DefinedNodeRunContext as Ct, AgentConnectionCredentialSource as D, SystemClock as Dt, InMemoryRunEventBus as E, Clock as Et, AgentMessageBuildArgs as F, NodeEventPublisher as Ft, AgentToolCall as G, AgentModelInvocationOptions as H, AgentMessageConfig as I, EngineCompositionDeps as It, AgentToolExecuteArgs as J, AgentToolCallPlanner as K, AgentMessageDto as L, EngineFactory as Lt, AgentCanvasPresentation as M, DefaultAsyncSleeper as Mt, AgentGuardrailConfig as N, AsyncSleeper as Nt, AgentConnectionNodeCollector as O, NodeInstanceFactory as Ot, AgentGuardrailDefaults as P, CredentialResolverFactory as Pt, ChatModelFactory as Q, AgentMessageLine as R, PersistedRuntimeTypeDecoratorOptions as S, DefinedNodeCredentialBindings as St, EventPublishingWorkflowExecutionRepository as T, defineNode as Tt, AgentNodeConfig as U, AgentMessageTemplateContent as V, AgentTool as W, AgentTurnLimitBehavior as X, AgentToolToken as Y, ChatModelConfig as Z, tool as _, DefineNodeExecuteOneArgs as _t, ConfigDrivenOffloadPolicy as a, Tool as at, PersistedRuntimeTypeMetadataStore as b, DefinedNodeCredentialAccessors as bt, InMemoryWorkflowExecutionRepository as c, ZodSchemaAny as ct, DefaultExecutionBinaryService as d, AgentToolFactory as dt, NodeBackedToolConfigOptions as et, UnavailableBinaryStorage as f, NodeBackedToolConfig as ft, node as g, DefineBatchNodeOptions as gt, getPersistedRuntimeTypeMetadata as h, DefinedNodeRegistry as ht, InlineDrivingScheduler as i, NodeBackedToolOutputMapperArgs as it, AgentAttachmentRole as j, DefaultExecutionContextFactory as jt, AgentConnectionNodeDescriptor as k, NodeExecutor as kt, InMemoryRunDataFactory as l, AgentConfigInspector as lt, chatModel as m, defineCredential as mt, HintOnlyOffloadPolicy as n, NodeBackedToolInputMapperArgs as nt, WorkflowRepositoryWebhookTriggerMatcher as o, ToolConfig as ot, ItemsInputNormalizer as p, DefineCredentialOptions as pt, AgentToolDefinition as q, DefaultDrivingScheduler as r, NodeBackedToolOutputMapper as rt, RunSummaryMapper as s, ToolExecuteArgs as st, LocalOnlyScheduler as t, NodeBackedToolInputMapper as tt, InMemoryBinaryStorage as u, AgentMessageConfigNormalizer as ut, StackTraceCallSitePathResolver as v, DefineNodeOptions as vt, PersistedRuntimeTypeMetadata as w, defineBatchNode as wt, InjectableRuntimeDecoratorComposer as x, DefinedNodeCredentialBinding as xt, PersistedRuntimeTypeNameResolver as y, DefinedNode as yt, AgentMessageRole as z };
|
|
707
|
+
//# sourceMappingURL=index-uCm9l0nw.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_runtime = require('./runtime-ZJUpWmPH.cjs');
|
|
2
2
|
const require_workflowActivationPolicy = require('./workflowActivationPolicy-BzyzXLa_.cjs');
|
|
3
3
|
let zod = require("zod");
|
|
4
|
-
zod =
|
|
4
|
+
zod = require_runtime.__toESM(zod);
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
|
-
node_crypto =
|
|
6
|
+
node_crypto = require_runtime.__toESM(node_crypto);
|
|
7
7
|
let tsyringe = require("tsyringe");
|
|
8
|
-
tsyringe =
|
|
8
|
+
tsyringe = require_runtime.__toESM(tsyringe);
|
|
9
9
|
|
|
10
10
|
//#region src/contracts/Clock.ts
|
|
11
11
|
var SystemClock = class {
|
|
@@ -64,6 +64,60 @@ const definedNodeCredentialAccessorFactory = { create(bindings, ctx) {
|
|
|
64
64
|
return Object.fromEntries(entries);
|
|
65
65
|
} };
|
|
66
66
|
function defineNode(options) {
|
|
67
|
+
const credentialRequirements = definedNodeCredentialRequirementFactory.create(options.credentials);
|
|
68
|
+
const DefinedNodeRuntime = class {
|
|
69
|
+
kind = "node";
|
|
70
|
+
outputPorts = ["main"];
|
|
71
|
+
inputSchema = options.inputSchema;
|
|
72
|
+
async executeOne(args) {
|
|
73
|
+
const ctx = args.ctx;
|
|
74
|
+
const context = {
|
|
75
|
+
config: ctx.config.config,
|
|
76
|
+
credentials: definedNodeCredentialAccessorFactory.create(options.credentials, ctx),
|
|
77
|
+
execution: ctx
|
|
78
|
+
};
|
|
79
|
+
const payload = {
|
|
80
|
+
input: args.input,
|
|
81
|
+
item: args.item,
|
|
82
|
+
itemIndex: args.itemIndex,
|
|
83
|
+
items: args.items,
|
|
84
|
+
ctx
|
|
85
|
+
};
|
|
86
|
+
return await options.executeOne(payload, context);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
require_runtime.node({ name: options.key })(DefinedNodeRuntime);
|
|
90
|
+
const DefinedRunnableNodeConfig = class {
|
|
91
|
+
kind = "node";
|
|
92
|
+
type = DefinedNodeRuntime;
|
|
93
|
+
icon = options.icon;
|
|
94
|
+
inputSchema = options.inputSchema;
|
|
95
|
+
mapInput = options.mapInput;
|
|
96
|
+
constructor(name, config, id) {
|
|
97
|
+
this.name = name;
|
|
98
|
+
this.config = config;
|
|
99
|
+
this.id = id;
|
|
100
|
+
}
|
|
101
|
+
getCredentialRequirements() {
|
|
102
|
+
return credentialRequirements;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const definition = {
|
|
106
|
+
kind: "defined-node",
|
|
107
|
+
key: options.key,
|
|
108
|
+
title: options.title,
|
|
109
|
+
description: options.description,
|
|
110
|
+
create(config, name = options.title, id) {
|
|
111
|
+
return new DefinedRunnableNodeConfig(name, config, id);
|
|
112
|
+
},
|
|
113
|
+
register(context) {
|
|
114
|
+
context.registerNode(DefinedNodeRuntime);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
DefinedNodeRegistry.register(definition);
|
|
118
|
+
return definition;
|
|
119
|
+
}
|
|
120
|
+
function defineBatchNode(options) {
|
|
67
121
|
const credentialRequirements = definedNodeCredentialRequirementFactory.create(options.credentials);
|
|
68
122
|
const DefinedNodeRuntime = class {
|
|
69
123
|
kind = "node";
|
|
@@ -83,7 +137,7 @@ function defineNode(options) {
|
|
|
83
137
|
}) };
|
|
84
138
|
}
|
|
85
139
|
};
|
|
86
|
-
|
|
140
|
+
require_runtime.node({ name: options.key })(DefinedNodeRuntime);
|
|
87
141
|
const DefinedRunnableNodeConfig = class {
|
|
88
142
|
kind = "node";
|
|
89
143
|
type = DefinedNodeRuntime;
|
|
@@ -289,11 +343,38 @@ const AgentToolFactory = new AgentToolFactoryImpl();
|
|
|
289
343
|
//#endregion
|
|
290
344
|
//#region src/ai/AgentMessageConfigNormalizerFactory.ts
|
|
291
345
|
var AgentMessageConfigNormalizer = class {
|
|
346
|
+
/**
|
|
347
|
+
* Prefer {@code input.messages} when present (ItemNode / engine-mapped payloads); otherwise resolve from
|
|
348
|
+
* {@link AgentNodeConfig.messages} templates.
|
|
349
|
+
*/
|
|
350
|
+
static resolveFromInputOrConfig(input, config, args) {
|
|
351
|
+
const fromInput = this.tryMessagesFromStructuredInput(input);
|
|
352
|
+
if (fromInput.length > 0) return fromInput;
|
|
353
|
+
return this.normalize(config, args);
|
|
354
|
+
}
|
|
292
355
|
static normalize(config, args) {
|
|
293
356
|
const fromMessages = this.normalizeRichMessages(config.messages, args);
|
|
294
357
|
if (fromMessages.length > 0) return fromMessages;
|
|
295
358
|
throw new Error("AIAgent messages must be a non-empty array, or an object with a non-empty prompt array and/or buildMessages that returns messages.");
|
|
296
359
|
}
|
|
360
|
+
static tryMessagesFromStructuredInput(input) {
|
|
361
|
+
if (!input || typeof input !== "object") return [];
|
|
362
|
+
const raw = input.messages;
|
|
363
|
+
if (!Array.isArray(raw) || raw.length === 0) return [];
|
|
364
|
+
const out = [];
|
|
365
|
+
for (const m of raw) {
|
|
366
|
+
if (!m || typeof m !== "object") continue;
|
|
367
|
+
const role = m.role;
|
|
368
|
+
const content = m.content;
|
|
369
|
+
if (role !== "system" && role !== "user" && role !== "assistant") continue;
|
|
370
|
+
if (typeof content !== "string") continue;
|
|
371
|
+
out.push({
|
|
372
|
+
role,
|
|
373
|
+
content
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
return out;
|
|
377
|
+
}
|
|
297
378
|
static normalizeRichMessages(config, args) {
|
|
298
379
|
if (Array.isArray(config)) return config.map((line) => this.lineToDto(line, args));
|
|
299
380
|
const structured = config;
|
|
@@ -329,7 +410,7 @@ const AgentConnectionNodeCollector = new class {
|
|
|
329
410
|
}
|
|
330
411
|
collectInto(parentNodeId, agentConfig, collected) {
|
|
331
412
|
collected.push({
|
|
332
|
-
nodeId:
|
|
413
|
+
nodeId: require_runtime.ConnectionNodeIdFactory.languageModelConnectionNodeId(parentNodeId),
|
|
333
414
|
parentNodeId,
|
|
334
415
|
connectionName: "llm",
|
|
335
416
|
role: "languageModel",
|
|
@@ -339,7 +420,7 @@ const AgentConnectionNodeCollector = new class {
|
|
|
339
420
|
credentialSource: agentConfig.chatModel
|
|
340
421
|
});
|
|
341
422
|
for (const tool$1 of agentConfig.tools ?? []) {
|
|
342
|
-
const toolNodeId =
|
|
423
|
+
const toolNodeId = require_runtime.ConnectionNodeIdFactory.toolConnectionNodeId(parentNodeId, tool$1.name);
|
|
343
424
|
const isNestedAgent = this.isNodeBackedAgentTool(tool$1);
|
|
344
425
|
collected.push({
|
|
345
426
|
nodeId: toolNodeId,
|
|
@@ -573,24 +654,24 @@ exports.AgentToolFactory = AgentToolFactory;
|
|
|
573
654
|
exports.AllWorkflowsActiveWorkflowActivationPolicy = require_workflowActivationPolicy.AllWorkflowsActiveWorkflowActivationPolicy;
|
|
574
655
|
exports.ChainCursor = require_workflowActivationPolicy.ChainCursor;
|
|
575
656
|
exports.ConnectionInvocationIdFactory = ConnectionInvocationIdFactory;
|
|
576
|
-
exports.ConnectionNodeIdFactory =
|
|
577
|
-
exports.CoreTokens =
|
|
578
|
-
exports.CredentialResolverFactory =
|
|
657
|
+
exports.ConnectionNodeIdFactory = require_runtime.ConnectionNodeIdFactory;
|
|
658
|
+
exports.CoreTokens = require_runtime.CoreTokens;
|
|
659
|
+
exports.CredentialResolverFactory = require_runtime.CredentialResolverFactory;
|
|
579
660
|
exports.CredentialUnboundError = CredentialUnboundError;
|
|
580
|
-
exports.DefaultAsyncSleeper =
|
|
581
|
-
exports.DefaultExecutionBinaryService =
|
|
582
|
-
exports.DefaultExecutionContextFactory =
|
|
661
|
+
exports.DefaultAsyncSleeper = require_runtime.DefaultAsyncSleeper;
|
|
662
|
+
exports.DefaultExecutionBinaryService = require_runtime.DefaultExecutionBinaryService;
|
|
663
|
+
exports.DefaultExecutionContextFactory = require_runtime.DefaultExecutionContextFactory;
|
|
583
664
|
exports.DefaultWorkflowGraphFactory = DefaultWorkflowGraphFactory;
|
|
584
665
|
exports.DefinedNodeRegistry = DefinedNodeRegistry;
|
|
585
|
-
exports.EngineExecutionLimitsPolicy =
|
|
666
|
+
exports.EngineExecutionLimitsPolicy = require_runtime.EngineExecutionLimitsPolicy;
|
|
586
667
|
exports.EventPublishingWorkflowExecutionRepository = EventPublishingWorkflowExecutionRepository;
|
|
587
668
|
exports.ExpRetryPolicy = ExpRetryPolicy;
|
|
588
|
-
exports.InMemoryBinaryStorage =
|
|
589
|
-
exports.InMemoryLiveWorkflowRepository =
|
|
590
|
-
exports.InMemoryRunDataFactory =
|
|
669
|
+
exports.InMemoryBinaryStorage = require_runtime.InMemoryBinaryStorage;
|
|
670
|
+
exports.InMemoryLiveWorkflowRepository = require_runtime.InMemoryLiveWorkflowRepository;
|
|
671
|
+
exports.InMemoryRunDataFactory = require_runtime.InMemoryRunDataFactory;
|
|
591
672
|
exports.InMemoryRunEventBus = require_workflowActivationPolicy.InMemoryRunEventBus;
|
|
592
|
-
exports.InProcessRetryRunner =
|
|
593
|
-
exports.InjectableRuntimeDecoratorComposer =
|
|
673
|
+
exports.InProcessRetryRunner = require_runtime.InProcessRetryRunner;
|
|
674
|
+
exports.InjectableRuntimeDecoratorComposer = require_runtime.InjectableRuntimeDecoratorComposer;
|
|
594
675
|
Object.defineProperty(exports, 'ItemsInputNormalizer', {
|
|
595
676
|
enumerable: true,
|
|
596
677
|
get: function () {
|
|
@@ -599,27 +680,28 @@ Object.defineProperty(exports, 'ItemsInputNormalizer', {
|
|
|
599
680
|
});
|
|
600
681
|
exports.NoRetryPolicy = NoRetryPolicy;
|
|
601
682
|
exports.NodeBackedToolConfig = NodeBackedToolConfig;
|
|
602
|
-
exports.NodeEventPublisher =
|
|
603
|
-
exports.PersistedRuntimeTypeMetadataStore =
|
|
604
|
-
exports.PersistedRuntimeTypeNameResolver =
|
|
683
|
+
exports.NodeEventPublisher = require_runtime.NodeEventPublisher;
|
|
684
|
+
exports.PersistedRuntimeTypeMetadataStore = require_runtime.PersistedRuntimeTypeMetadataStore;
|
|
685
|
+
exports.PersistedRuntimeTypeNameResolver = require_runtime.PersistedRuntimeTypeNameResolver;
|
|
605
686
|
exports.RetryPolicy = RetryPolicy;
|
|
606
|
-
exports.RunFinishedAtFactory =
|
|
607
|
-
exports.RunIntentService =
|
|
608
|
-
exports.StackTraceCallSitePathResolver =
|
|
687
|
+
exports.RunFinishedAtFactory = require_runtime.RunFinishedAtFactory;
|
|
688
|
+
exports.RunIntentService = require_runtime.RunIntentService;
|
|
689
|
+
exports.StackTraceCallSitePathResolver = require_runtime.StackTraceCallSitePathResolver;
|
|
609
690
|
exports.SystemClock = SystemClock;
|
|
610
|
-
exports.UnavailableBinaryStorage =
|
|
691
|
+
exports.UnavailableBinaryStorage = require_runtime.UnavailableBinaryStorage;
|
|
611
692
|
exports.WhenBuilder = require_workflowActivationPolicy.WhenBuilder;
|
|
612
693
|
exports.WorkflowBuilder = require_workflowActivationPolicy.WorkflowBuilder;
|
|
613
|
-
exports.WorkflowExecutableNodeClassifier =
|
|
614
|
-
exports.WorkflowExecutableNodeClassifierFactory =
|
|
694
|
+
exports.WorkflowExecutableNodeClassifier = require_runtime.WorkflowExecutableNodeClassifier;
|
|
695
|
+
exports.WorkflowExecutableNodeClassifierFactory = require_runtime.WorkflowExecutableNodeClassifierFactory;
|
|
615
696
|
exports.branchRef = branchRef;
|
|
616
|
-
exports.chatModel =
|
|
697
|
+
exports.chatModel = require_runtime.chatModel;
|
|
617
698
|
Object.defineProperty(exports, 'container', {
|
|
618
699
|
enumerable: true,
|
|
619
700
|
get: function () {
|
|
620
701
|
return tsyringe.container;
|
|
621
702
|
}
|
|
622
703
|
});
|
|
704
|
+
exports.defineBatchNode = defineBatchNode;
|
|
623
705
|
exports.defineCredential = defineCredential;
|
|
624
706
|
exports.defineNode = defineNode;
|
|
625
707
|
Object.defineProperty(exports, 'delay', {
|
|
@@ -628,7 +710,7 @@ Object.defineProperty(exports, 'delay', {
|
|
|
628
710
|
return tsyringe.delay;
|
|
629
711
|
}
|
|
630
712
|
});
|
|
631
|
-
exports.getPersistedRuntimeTypeMetadata =
|
|
713
|
+
exports.getPersistedRuntimeTypeMetadata = require_runtime.getPersistedRuntimeTypeMetadata;
|
|
632
714
|
Object.defineProperty(exports, 'inject', {
|
|
633
715
|
enumerable: true,
|
|
634
716
|
get: function () {
|
|
@@ -659,7 +741,7 @@ Object.defineProperty(exports, 'instancePerContainerCachingFactory', {
|
|
|
659
741
|
return tsyringe.instancePerContainerCachingFactory;
|
|
660
742
|
}
|
|
661
743
|
});
|
|
662
|
-
exports.node =
|
|
744
|
+
exports.node = require_runtime.node;
|
|
663
745
|
Object.defineProperty(exports, 'predicateAwareClassFactory', {
|
|
664
746
|
enumerable: true,
|
|
665
747
|
get: function () {
|
|
@@ -678,5 +760,5 @@ Object.defineProperty(exports, 'singleton', {
|
|
|
678
760
|
return tsyringe.singleton;
|
|
679
761
|
}
|
|
680
762
|
});
|
|
681
|
-
exports.tool =
|
|
763
|
+
exports.tool = require_runtime.tool;
|
|
682
764
|
//# sourceMappingURL=index.cjs.map
|