@codemation/core-nodes 0.3.0 → 0.4.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 +15 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -22
- package/dist/index.d.ts +30 -22
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/nodes/AIAgentNode.ts +1 -1
- package/src/nodes/NodeBackedToolRuntime.ts +4 -4
- package/src/workflowAuthoring/WorkflowBranchBuilder.types.ts +9 -7
- package/src/workflowAuthoring/WorkflowChain.types.ts +9 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemation/core-nodes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@langchain/core": "^1.1.31",
|
|
32
32
|
"@langchain/openai": "^1.2.12",
|
|
33
33
|
"lucide-react": "^0.577.0",
|
|
34
|
-
"@codemation/core": "0.
|
|
34
|
+
"@codemation/core": "0.7.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.3.5",
|
package/src/nodes/AIAgentNode.ts
CHANGED
|
@@ -68,7 +68,7 @@ export class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
|
|
|
68
68
|
outputPorts = ["main"] as const;
|
|
69
69
|
/**
|
|
70
70
|
* Engine validates {@link RunnableNodeConfig.inputSchema} (Zod) on {@code item.json} before enqueue, then resolves
|
|
71
|
-
* per-item **`
|
|
71
|
+
* per-item **`itemExpr`** leaves on config before {@link #execute}. Prefer modeling prompts as
|
|
72
72
|
* {@code { messages: [{ role, content }, ...] }} (on input or config) so persisted inputs are visible in the UI.
|
|
73
73
|
*/
|
|
74
74
|
readonly inputSchema = z.unknown();
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CoreTokens,
|
|
15
15
|
inject,
|
|
16
16
|
injectable,
|
|
17
|
-
|
|
17
|
+
ItemExprResolver,
|
|
18
18
|
NodeOutputNormalizer,
|
|
19
19
|
RunnableOutputBehaviorResolver,
|
|
20
20
|
} from "@codemation/core";
|
|
@@ -25,8 +25,8 @@ export class NodeBackedToolRuntime {
|
|
|
25
25
|
constructor(
|
|
26
26
|
@inject(CoreTokens.NodeResolver)
|
|
27
27
|
private readonly nodeResolver: NodeResolver,
|
|
28
|
-
@inject(
|
|
29
|
-
private readonly
|
|
28
|
+
@inject(ItemExprResolver)
|
|
29
|
+
private readonly itemExprResolver: ItemExprResolver,
|
|
30
30
|
@inject(NodeOutputNormalizer)
|
|
31
31
|
private readonly outputNormalizer: NodeOutputNormalizer,
|
|
32
32
|
@inject(RunnableOutputBehaviorResolver)
|
|
@@ -77,7 +77,7 @@ export class NodeBackedToolRuntime {
|
|
|
77
77
|
const inputSchema = runnable.inputSchema ?? runnableConfig.inputSchema ?? z.unknown();
|
|
78
78
|
const parsed = inputSchema.parse(nodeInput.json);
|
|
79
79
|
const items = [nodeInput];
|
|
80
|
-
const resolvedCtx = await this.
|
|
80
|
+
const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(ctx, nodeInput, 0, items);
|
|
81
81
|
const execArgs: RunnableNodeExecuteArgs = {
|
|
82
82
|
input: parsed,
|
|
83
83
|
item: nodeInput,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AnyRunnableNodeConfig,
|
|
3
|
+
CredentialJsonRecord,
|
|
3
4
|
DefinedNode,
|
|
5
|
+
DefinedNodeConfigInput,
|
|
4
6
|
Item,
|
|
5
7
|
Items,
|
|
6
8
|
NodeExecutionContext,
|
|
@@ -175,18 +177,18 @@ export class WorkflowBranchBuilder<TCurrentJson> {
|
|
|
175
177
|
>;
|
|
176
178
|
}
|
|
177
179
|
|
|
178
|
-
node<TConfig extends
|
|
179
|
-
definitionOrKey: DefinedNode<string, TConfig,
|
|
180
|
-
config: TConfig,
|
|
180
|
+
node<TConfig extends CredentialJsonRecord, TInputJson, TOutputJson>(
|
|
181
|
+
definitionOrKey: DefinedNode<string, TConfig, TInputJson, TOutputJson> | string,
|
|
182
|
+
config: DefinedNodeConfigInput<TConfig, TCurrentJson>,
|
|
181
183
|
name?: string,
|
|
182
184
|
id?: string,
|
|
183
|
-
): WorkflowBranchBuilder<TOutputJson> {
|
|
185
|
+
): TCurrentJson extends TInputJson ? WorkflowBranchBuilder<TOutputJson> : never {
|
|
184
186
|
const definition = WorkflowDefinedNodeResolver.resolve(
|
|
185
187
|
definitionOrKey as DefinedNode<string, Record<string, unknown>, unknown, unknown> | string,
|
|
186
|
-
) as DefinedNode<string, TConfig,
|
|
188
|
+
) as DefinedNode<string, TConfig, TInputJson, TOutputJson>;
|
|
187
189
|
return this.then(
|
|
188
|
-
definition.create(config, name, id) as RunnableNodeConfig<TCurrentJson, TOutputJson>,
|
|
189
|
-
) as WorkflowBranchBuilder<TOutputJson
|
|
190
|
+
definition.create(config, name, id) as unknown as RunnableNodeConfig<TCurrentJson, TOutputJson>,
|
|
191
|
+
) as TCurrentJson extends TInputJson ? WorkflowBranchBuilder<TOutputJson> : never;
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
getSteps(): ReadonlyArray<AnyRunnableNodeConfig> {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
CredentialJsonRecord,
|
|
2
3
|
DefinedNode,
|
|
4
|
+
DefinedNodeConfigInput,
|
|
3
5
|
Item,
|
|
4
6
|
Items,
|
|
5
7
|
NodeExecutionContext,
|
|
@@ -334,18 +336,18 @@ export class WorkflowChain<TCurrentJson> {
|
|
|
334
336
|
>;
|
|
335
337
|
}
|
|
336
338
|
|
|
337
|
-
node<TConfig extends
|
|
338
|
-
definitionOrKey: DefinedNode<string, TConfig,
|
|
339
|
-
config: TConfig,
|
|
339
|
+
node<TConfig extends CredentialJsonRecord, TInputJson, TOutputJson>(
|
|
340
|
+
definitionOrKey: DefinedNode<string, TConfig, TInputJson, TOutputJson> | string,
|
|
341
|
+
config: DefinedNodeConfigInput<TConfig, TCurrentJson>,
|
|
340
342
|
name?: string,
|
|
341
343
|
id?: string,
|
|
342
|
-
): WorkflowChain<TOutputJson> {
|
|
344
|
+
): TCurrentJson extends TInputJson ? WorkflowChain<TOutputJson> : never {
|
|
343
345
|
const definition = WorkflowDefinedNodeResolver.resolve(
|
|
344
346
|
definitionOrKey as DefinedNode<string, Record<string, unknown>, unknown, unknown> | string,
|
|
345
|
-
) as DefinedNode<string, TConfig,
|
|
347
|
+
) as DefinedNode<string, TConfig, TInputJson, TOutputJson>;
|
|
346
348
|
return this.then(
|
|
347
|
-
definition.create(config, name, id) as RunnableNodeConfig<TCurrentJson, TOutputJson>,
|
|
348
|
-
) as WorkflowChain<TOutputJson
|
|
349
|
+
definition.create(config, name, id) as unknown as RunnableNodeConfig<TCurrentJson, TOutputJson>,
|
|
350
|
+
) as TCurrentJson extends TInputJson ? WorkflowChain<TOutputJson> : never;
|
|
349
351
|
}
|
|
350
352
|
|
|
351
353
|
build(): WorkflowDefinition {
|