MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / serializeNodeData

Function serializeNodeData

ts/workflow-core/src/node/serialization.ts:67–318  ·  view source on GitHub ↗
(data: NodeData, position: { x: number; y: number }, isToolInput: boolean)

Source from the content-addressed store, hash-verified

65}
66
67function serializeNodeData(data: NodeData, position: { x: number; y: number }, isToolInput: boolean): Schemas["Node"] {
68 switch (data.type) {
69 case "ReadPin":
70 return {
71 id: data.id,
72 type: data.type,
73 position: position,
74 arguments: {
75 pinReference: draft(data.arguments.pinReference),
76 signalType: data.arguments.signalType,
77 output: data.arguments.output,
78 toolDescription: data.arguments.toolDescription,
79 },
80 };
81 case "SerialRead":
82 return {
83 id: data.id,
84 type: data.type,
85 position: position,
86 arguments: {
87 portReference: draft(data.arguments.portReference),
88 ...(data.arguments.prompt !== undefined ? { prompt: data.arguments.prompt } : {}),
89 output: data.arguments.output,
90 },
91 };
92 case "WritePin":
93 return {
94 id: data.id,
95 type: data.type,
96 position: position,
97 arguments: {
98 pinReference: draft(data.arguments.pinReference),
99 signalType: data.arguments.signalType,
100 value: data.arguments.value,
101 toolDescription: data.arguments.toolDescription,
102 },
103 };
104 case "SerialWrite":
105 return {
106 id: data.id,
107 type: data.type,
108 position: position,
109 arguments: {
110 portReference: draft(data.arguments.portReference),
111 value: data.arguments.value,
112 toolDescription: data.arguments.toolDescription,
113 },
114 };
115 case "Agent": {
116 // outputDeclarations is a list both in domain and API. Each entry's `name`
117 // is the JSON property the LLM is asked to produce; uniqueness is enforced
118 // by diagnostics, not the schema. memoryRefs is also a 1:1 list — domain
119 // and API share the same MemoryRef shape.
120 return {
121 id: data.id,
122 type: data.type,
123 position: position,
124 arguments: {

Callers 1

serializeFunction · 0.85

Calls 1

draftFunction · 0.85

Tested by

no test coverage detected