@codemation/core-nodes 0.0.19 → 0.0.22
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 -0
- package/dist/index.cjs +938 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +937 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/nodes/AIAgentExecutionHelpersFactory.ts +100 -2
- package/src/nodes/AIAgentNode.ts +23 -2
- package/src/workflows/AIAgentConnectionWorkflowExpander.ts +67 -37
package/dist/index.d.cts
CHANGED
|
@@ -320,8 +320,9 @@ interface Edge {
|
|
|
320
320
|
}
|
|
321
321
|
type NodeConnectionName = string;
|
|
322
322
|
/**
|
|
323
|
-
* Named connection from
|
|
324
|
-
* but are not traversed by the main execution graph.
|
|
323
|
+
* Named connection from a parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
|
|
324
|
+
* but are not traversed by the main execution graph. Parents are commonly executable nodes, but may
|
|
325
|
+
* also be connection-owned nodes for recursive agent attachments.
|
|
325
326
|
*/
|
|
326
327
|
interface WorkflowNodeConnection {
|
|
327
328
|
readonly parentNodeId: NodeId;
|
|
@@ -922,6 +923,19 @@ type ExecutedToolCall = Readonly<{
|
|
|
922
923
|
declare class AIAgentExecutionHelpersFactory {
|
|
923
924
|
createConnectionCredentialExecutionContextFactory(credentialSessions: CredentialSessionService): ConnectionCredentialExecutionContextFactory;
|
|
924
925
|
createDynamicStructuredTool(entry: ResolvedTool, toolCredentialContext: NodeExecutionContext<any>, item: Item, itemIndex: number, items: Items): DynamicStructuredTool;
|
|
926
|
+
/**
|
|
927
|
+
* Produces a plain JSON Schema object for OpenAI tool parameters and LangChain tool invocation:
|
|
928
|
+
* - **Zod** → `toJSONSchema(..., { target: "draft-07" })` so shapes match what `@cfworker/json-schema`
|
|
929
|
+
* expects (`required` must be an array; draft 2020-12 output can break validation).
|
|
930
|
+
* - Otherwise LangChain `toJsonSchema` (Standard Schema + JSON passthrough); if the result is still Zod
|
|
931
|
+
* (duplicate `zod` copies), fall back to Zod `toJSONSchema` with draft-07.
|
|
932
|
+
* - Strip root `$schema` for OpenAI; normalize invalid `required` keywords for cfworker; ensure `properties`.
|
|
933
|
+
*/
|
|
934
|
+
private normalizeToolInputSchemaForOpenAiDynamicStructuredTool;
|
|
935
|
+
/**
|
|
936
|
+
* `@cfworker/json-schema` iterates `schema.required` with `for...of`; it must be a string array or absent.
|
|
937
|
+
*/
|
|
938
|
+
private sanitizeJsonSchemaRequiredKeywordsForCfworker;
|
|
925
939
|
}
|
|
926
940
|
//#endregion
|
|
927
941
|
//#region src/nodes/NodeBackedToolRuntime.d.ts
|
|
@@ -974,6 +988,12 @@ declare class AIAgentNode implements Node<AIAgent<any, any>> {
|
|
|
974
988
|
private resultToJsonValue;
|
|
975
989
|
private createPromptMessages;
|
|
976
990
|
private resolveToolRuntime;
|
|
991
|
+
/**
|
|
992
|
+
* Consumer apps can resolve two copies of `@codemation/core`, breaking `instanceof NodeBackedToolConfig` and
|
|
993
|
+
* sending node-backed tools down the plugin-tool branch with `inputSchema: undefined` (LangChain then crashes in
|
|
994
|
+
* json-schema validation). {@link NodeBackedToolConfig#toolKind} is stable across copies.
|
|
995
|
+
*/
|
|
996
|
+
private isNodeBackedToolConfig;
|
|
977
997
|
private resolveGuardrails;
|
|
978
998
|
}
|
|
979
999
|
//#endregion
|
|
@@ -1414,6 +1434,9 @@ declare class AIAgentConnectionWorkflowExpander {
|
|
|
1414
1434
|
private readonly connectionCredentialNodeConfigFactory;
|
|
1415
1435
|
constructor(connectionCredentialNodeConfigFactory: ConnectionCredentialNodeConfigFactory);
|
|
1416
1436
|
expand(workflow: WorkflowDefinition): WorkflowDefinition;
|
|
1437
|
+
private createConnectionsByParentAndName;
|
|
1438
|
+
private collectExistingChildIds;
|
|
1439
|
+
private connectionKey;
|
|
1417
1440
|
private assertNoIdCollision;
|
|
1418
1441
|
}
|
|
1419
1442
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -320,8 +320,9 @@ interface Edge {
|
|
|
320
320
|
}
|
|
321
321
|
type NodeConnectionName = string;
|
|
322
322
|
/**
|
|
323
|
-
* Named connection from
|
|
324
|
-
* but are not traversed by the main execution graph.
|
|
323
|
+
* Named connection from a parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
|
|
324
|
+
* but are not traversed by the main execution graph. Parents are commonly executable nodes, but may
|
|
325
|
+
* also be connection-owned nodes for recursive agent attachments.
|
|
325
326
|
*/
|
|
326
327
|
interface WorkflowNodeConnection {
|
|
327
328
|
readonly parentNodeId: NodeId;
|
|
@@ -922,6 +923,19 @@ type ExecutedToolCall = Readonly<{
|
|
|
922
923
|
declare class AIAgentExecutionHelpersFactory {
|
|
923
924
|
createConnectionCredentialExecutionContextFactory(credentialSessions: CredentialSessionService): ConnectionCredentialExecutionContextFactory;
|
|
924
925
|
createDynamicStructuredTool(entry: ResolvedTool, toolCredentialContext: NodeExecutionContext<any>, item: Item, itemIndex: number, items: Items): DynamicStructuredTool;
|
|
926
|
+
/**
|
|
927
|
+
* Produces a plain JSON Schema object for OpenAI tool parameters and LangChain tool invocation:
|
|
928
|
+
* - **Zod** → `toJSONSchema(..., { target: "draft-07" })` so shapes match what `@cfworker/json-schema`
|
|
929
|
+
* expects (`required` must be an array; draft 2020-12 output can break validation).
|
|
930
|
+
* - Otherwise LangChain `toJsonSchema` (Standard Schema + JSON passthrough); if the result is still Zod
|
|
931
|
+
* (duplicate `zod` copies), fall back to Zod `toJSONSchema` with draft-07.
|
|
932
|
+
* - Strip root `$schema` for OpenAI; normalize invalid `required` keywords for cfworker; ensure `properties`.
|
|
933
|
+
*/
|
|
934
|
+
private normalizeToolInputSchemaForOpenAiDynamicStructuredTool;
|
|
935
|
+
/**
|
|
936
|
+
* `@cfworker/json-schema` iterates `schema.required` with `for...of`; it must be a string array or absent.
|
|
937
|
+
*/
|
|
938
|
+
private sanitizeJsonSchemaRequiredKeywordsForCfworker;
|
|
925
939
|
}
|
|
926
940
|
//#endregion
|
|
927
941
|
//#region src/nodes/NodeBackedToolRuntime.d.ts
|
|
@@ -974,6 +988,12 @@ declare class AIAgentNode implements Node<AIAgent<any, any>> {
|
|
|
974
988
|
private resultToJsonValue;
|
|
975
989
|
private createPromptMessages;
|
|
976
990
|
private resolveToolRuntime;
|
|
991
|
+
/**
|
|
992
|
+
* Consumer apps can resolve two copies of `@codemation/core`, breaking `instanceof NodeBackedToolConfig` and
|
|
993
|
+
* sending node-backed tools down the plugin-tool branch with `inputSchema: undefined` (LangChain then crashes in
|
|
994
|
+
* json-schema validation). {@link NodeBackedToolConfig#toolKind} is stable across copies.
|
|
995
|
+
*/
|
|
996
|
+
private isNodeBackedToolConfig;
|
|
977
997
|
private resolveGuardrails;
|
|
978
998
|
}
|
|
979
999
|
//#endregion
|
|
@@ -1414,6 +1434,9 @@ declare class AIAgentConnectionWorkflowExpander {
|
|
|
1414
1434
|
private readonly connectionCredentialNodeConfigFactory;
|
|
1415
1435
|
constructor(connectionCredentialNodeConfigFactory: ConnectionCredentialNodeConfigFactory);
|
|
1416
1436
|
expand(workflow: WorkflowDefinition): WorkflowDefinition;
|
|
1437
|
+
private createConnectionsByParentAndName;
|
|
1438
|
+
private collectExistingChildIds;
|
|
1439
|
+
private connectionKey;
|
|
1417
1440
|
private assertNoIdCollision;
|
|
1418
1441
|
}
|
|
1419
1442
|
//#endregion
|