| 246 | } |
| 247 | |
| 248 | function getWorkflowErrorCode(status: number, executeResult: Record<string, unknown>): ErrorCode { |
| 249 | if (status === 499) return ErrorCode.ConnectionClosed |
| 250 | if (status === 400) return ErrorCode.InvalidParams |
| 251 | if (status === 413 && executeResult.code !== 'workflow_response_too_large') { |
| 252 | return ErrorCode.InvalidRequest |
| 253 | } |
| 254 | return ErrorCode.InternalError |
| 255 | } |
| 256 | |
| 257 | function getToolsListCursor(rpcParams: unknown): string | undefined { |
| 258 | if (!rpcParams || typeof rpcParams !== 'object' || !('cursor' in rpcParams)) return undefined |