@codemation/core-nodes 0.2.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 +23 -1
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -30
- package/dist/index.d.ts +42 -30
- package/dist/index.js +11 -11
- 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 +19 -14
- package/src/workflowAuthoring/WorkflowChain.types.ts +39 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @codemation/core-nodes
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#81](https://github.com/MadeRelevant/codemation/pull/81) [`88844f7`](https://github.com/MadeRelevant/codemation/commit/88844f75a48fe051e4cb895c710408855de14da4) Thanks [@cblokland90](https://github.com/cblokland90)! - Improve workflow DSL typing for helper-defined nodes.
|
|
8
|
+
- allow `.node(...)` and branch `.node(...)` calls to accept helper-node params that use `itemExpr(...)`
|
|
9
|
+
- preserve type safety when the current workflow item is a superset of the helper node's declared input shape
|
|
10
|
+
- remove the need for common casts around empty-config helper nodes
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`88844f7`](https://github.com/MadeRelevant/codemation/commit/88844f75a48fe051e4cb895c710408855de14da4)]:
|
|
15
|
+
- @codemation/core@0.7.0
|
|
16
|
+
|
|
17
|
+
## 0.3.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [#78](https://github.com/MadeRelevant/codemation/pull/78) [`f451b1b`](https://github.com/MadeRelevant/codemation/commit/f451b1b4657b59406e15ce5f50b243e487ff99ed) Thanks [@cblokland90](https://github.com/cblokland90)! - Normalize fluent workflow DSL callback helpers around the runtime item contract.
|
|
22
|
+
|
|
23
|
+
`.map(...)`, `.if(...)`, and `.switch({ resolveCaseKey })` now receive `(item, ctx)` so workflow authors can use `item.json` consistently and read prior completed outputs through `ctx.data` without dropping down to direct node configs.
|
|
24
|
+
|
|
3
25
|
## 0.2.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -17,7 +39,7 @@
|
|
|
17
39
|
|
|
18
40
|
`WorkflowAgentOptions` now takes `messages` (the same `AgentMessageConfig` as `AIAgent`) instead of
|
|
19
41
|
`prompt`. The workflow helper passes `messages` through unchanged. Docs, workflow DSL skills, and the
|
|
20
|
-
test-dev sample use `
|
|
42
|
+
test-dev sample use `itemExpr(...)` for per-item prompts; execution docs note `itemExpr` on agent
|
|
21
43
|
`messages`.
|
|
22
44
|
|
|
23
45
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -2720,9 +2720,9 @@ var AgentToolCallPortMap = class {
|
|
|
2720
2720
|
//#region src/nodes/NodeBackedToolRuntime.ts
|
|
2721
2721
|
var _ref$1, _ref2$1, _ref3$1;
|
|
2722
2722
|
let NodeBackedToolRuntime = class NodeBackedToolRuntime$1 {
|
|
2723
|
-
constructor(nodeResolver,
|
|
2723
|
+
constructor(nodeResolver, itemExprResolver, outputNormalizer, outputBehaviorResolver) {
|
|
2724
2724
|
this.nodeResolver = nodeResolver;
|
|
2725
|
-
this.
|
|
2725
|
+
this.itemExprResolver = itemExprResolver;
|
|
2726
2726
|
this.outputNormalizer = outputNormalizer;
|
|
2727
2727
|
this.outputBehaviorResolver = outputBehaviorResolver;
|
|
2728
2728
|
}
|
|
@@ -2764,7 +2764,7 @@ let NodeBackedToolRuntime = class NodeBackedToolRuntime$1 {
|
|
|
2764
2764
|
item: nodeInput,
|
|
2765
2765
|
itemIndex: 0,
|
|
2766
2766
|
items,
|
|
2767
|
-
ctx: await this.
|
|
2767
|
+
ctx: await this.itemExprResolver.resolveConfigForItem(ctx, nodeInput, 0, items)
|
|
2768
2768
|
};
|
|
2769
2769
|
const raw = await Promise.resolve(runnable.execute(execArgs));
|
|
2770
2770
|
return this.outputNormalizer.normalizeExecuteResult({
|
|
@@ -2785,12 +2785,12 @@ let NodeBackedToolRuntime = class NodeBackedToolRuntime$1 {
|
|
|
2785
2785
|
NodeBackedToolRuntime = __decorate([
|
|
2786
2786
|
(0, __codemation_core.injectable)(),
|
|
2787
2787
|
__decorateParam(0, (0, __codemation_core.inject)(__codemation_core.CoreTokens.NodeResolver)),
|
|
2788
|
-
__decorateParam(1, (0, __codemation_core.inject)(__codemation_core.
|
|
2788
|
+
__decorateParam(1, (0, __codemation_core.inject)(__codemation_core.ItemExprResolver)),
|
|
2789
2789
|
__decorateParam(2, (0, __codemation_core.inject)(__codemation_core.NodeOutputNormalizer)),
|
|
2790
2790
|
__decorateParam(3, (0, __codemation_core.inject)(__codemation_core.RunnableOutputBehaviorResolver)),
|
|
2791
2791
|
__decorateMetadata("design:paramtypes", [
|
|
2792
2792
|
Object,
|
|
2793
|
-
typeof (_ref$1 = typeof __codemation_core.
|
|
2793
|
+
typeof (_ref$1 = typeof __codemation_core.ItemExprResolver !== "undefined" && __codemation_core.ItemExprResolver) === "function" ? _ref$1 : Object,
|
|
2794
2794
|
typeof (_ref2$1 = typeof __codemation_core.NodeOutputNormalizer !== "undefined" && __codemation_core.NodeOutputNormalizer) === "function" ? _ref2$1 : Object,
|
|
2795
2795
|
typeof (_ref3$1 = typeof __codemation_core.RunnableOutputBehaviorResolver !== "undefined" && __codemation_core.RunnableOutputBehaviorResolver) === "function" ? _ref3$1 : Object
|
|
2796
2796
|
])
|
|
@@ -2812,7 +2812,7 @@ let AIAgentNode = class AIAgentNode$1 {
|
|
|
2812
2812
|
outputPorts = ["main"];
|
|
2813
2813
|
/**
|
|
2814
2814
|
* Engine validates {@link RunnableNodeConfig.inputSchema} (Zod) on {@code item.json} before enqueue, then resolves
|
|
2815
|
-
* per-item **`
|
|
2815
|
+
* per-item **`itemExpr`** leaves on config before {@link #execute}. Prefer modeling prompts as
|
|
2816
2816
|
* {@code { messages: [{ role, content }, ...] }} (on input or config) so persisted inputs are visible in the UI.
|
|
2817
2817
|
*/
|
|
2818
2818
|
inputSchema = unknown();
|
|
@@ -4058,7 +4058,7 @@ var WorkflowBranchBuilder = class WorkflowBranchBuilder {
|
|
|
4058
4058
|
map(nameOrMapper, mapperOrUndefined, options) {
|
|
4059
4059
|
const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
|
|
4060
4060
|
const mapper = typeof nameOrMapper === "string" ? mapperOrUndefined : nameOrMapper;
|
|
4061
|
-
return this.then(new MapData(name,
|
|
4061
|
+
return this.then(new MapData(name, mapper, options));
|
|
4062
4062
|
}
|
|
4063
4063
|
wait(nameOrDuration, durationOrUndefined, id) {
|
|
4064
4064
|
const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
|
|
@@ -4104,7 +4104,7 @@ var WorkflowChain = class WorkflowChain {
|
|
|
4104
4104
|
map(nameOrMapper, mapperOrUndefined, options) {
|
|
4105
4105
|
const name = typeof nameOrMapper === "string" ? nameOrMapper : "Map data";
|
|
4106
4106
|
const mapper = typeof nameOrMapper === "string" ? mapperOrUndefined : nameOrMapper;
|
|
4107
|
-
return this.then(new MapData(name,
|
|
4107
|
+
return this.then(new MapData(name, mapper, options));
|
|
4108
4108
|
}
|
|
4109
4109
|
wait(nameOrDuration, durationOrUndefined, id) {
|
|
4110
4110
|
const name = typeof nameOrDuration === "string" && durationOrUndefined !== void 0 ? nameOrDuration : "Wait";
|
|
@@ -4136,7 +4136,7 @@ var WorkflowChain = class WorkflowChain {
|
|
|
4136
4136
|
const name = typeof nameOrPredicate === "string" ? nameOrPredicate : "If";
|
|
4137
4137
|
const predicate = typeof nameOrPredicate === "string" ? predicateOrBranches : nameOrPredicate;
|
|
4138
4138
|
const branches = typeof nameOrPredicate === "string" ? branchesOrUndefined : predicateOrBranches;
|
|
4139
|
-
const cursor = this.chain.then(new If(name, (item) => predicate(item
|
|
4139
|
+
const cursor = this.chain.then(new If(name, (item, _index, _items, ctx) => predicate(item, ctx)));
|
|
4140
4140
|
const trueSteps = branches.true?.(new WorkflowBranchBuilder()).getSteps();
|
|
4141
4141
|
const falseSteps = branches.false?.(new WorkflowBranchBuilder()).getSteps();
|
|
4142
4142
|
return new WorkflowChain(cursor.when({
|
|
@@ -4154,7 +4154,7 @@ var WorkflowChain = class WorkflowChain {
|
|
|
4154
4154
|
return this.then(new Switch(name, {
|
|
4155
4155
|
cases: cfg.cases,
|
|
4156
4156
|
defaultCase: cfg.defaultCase,
|
|
4157
|
-
resolveCaseKey: (item) => cfg.resolveCaseKey(item
|
|
4157
|
+
resolveCaseKey: (item, _index, _items, ctx) => cfg.resolveCaseKey(item, ctx)
|
|
4158
4158
|
}, id)).route(cfg.branches);
|
|
4159
4159
|
}
|
|
4160
4160
|
agent(nameOrOptions, optionsOrUndefined) {
|